diff --git a/src/components/radiobutton/DOCS.md b/src/components/radiobutton/DOCS.md deleted file mode 100644 index 9c31f33f..00000000 --- a/src/components/radiobutton/DOCS.md +++ /dev/null @@ -1,9 +0,0 @@ -# Radio - -Radio component. - -```js -import { Radio, RadioButtonProps } from '@panenco/ui'; -``` - - diff --git a/src/components/radiobutton/README.md b/src/components/radiobutton/README.md deleted file mode 100644 index 3e90bdec..00000000 --- a/src/components/radiobutton/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# Radio - -## Usage - -```js -import { Radio } from '@panenco/ui'; - -return ( - <> - - - - - -); -``` - ---- - -### Properties - -This component inherits the attributes of the **input** element and extends the functionality with next properties. - -- id - component id (generate unique id by default); -- label - component label; -- error - add this prop when smth went wrong; -- wrapperProps - it's props which will be added to wrapper component; -- inputProps - it's props which will be added to input component; -- pointColor - customizing point color for different cases; -- ref - wrapper ref; - -| propName | propType | defaultValue | isRequired | -| ------------ | ------------------------- | ----------------- | ---------- | -| error | string | - | - | -| label | string | - | - | -| id | string or (any) | generate uniqueID | - | -| pointColor | string | - | - | -| inputProps | React.InputHTMLAttributes | - | - | -| wrapperProps | React.LabelHTMLAttributes | - | - | -| ref | React.RefObject | - | - | diff --git a/src/components/radiobutton/index.tsx b/src/components/radiobutton/index.tsx index 816bd1f2..7a9808f5 100644 --- a/src/components/radiobutton/index.tsx +++ b/src/components/radiobutton/index.tsx @@ -2,7 +2,6 @@ import cx from 'classnames'; import { Text } from 'components'; import * as React from 'react'; -import { idGenerator } from 'utils/helpers'; import { useTheme } from 'utils/hooks'; import { InputPropsType } from '../../utils/types'; @@ -14,10 +13,31 @@ interface WrapperProps extends React.LabelHTMLAttributes { } export interface RadioButtonProps extends React.InputHTMLAttributes { + /** + * Is checked; + * @default false + * */ + checked?: boolean; + /** + * Error text; + */ error?: string; + /** + * Child html input component props. Will be removed in next version; + */ inputProps?: InputPropsType; + /** + * RadioButton label; + */ label?: string; - pointColor?: string; // will be removed in next version + /** + * Point color; + */ + pointColor?: string; + // will be removed in next version + /** + * Wrapper props; + */ wrapperProps?: WrapperProps; } @@ -25,7 +45,6 @@ export const Radio = React.forwardRef( ( { label, - id, className, checked, value, @@ -39,20 +58,18 @@ export const Radio = React.forwardRef( ref, ): JSX.Element => { const theme = useTheme(); - const uniqueID = idGenerator(); - const defaultId = id || uniqueID; - const { className: inputClassName, ...otherInputProps } = inputProps; + const { className: inputClassName, id, ...otherInputProps } = inputProps; return ( -