The Open Standard for Generative UI
Refactor Checkbox and Radiogroup (#241)
subham162967488461
diff --git a/js/packages/react-ui/package.json b/js/packages/react-ui/package.jsonindex edd23f612..6b98b0522 100644--- a/js/packages/react-ui/package.json+++ b/js/packages/react-ui/package.json@@ -2,7 +2,7 @@"type": "module","name": "@crayonai/react-ui","license": "MIT",- "version": "0.9.7",+ "version": "0.9.8","description": "Component library for Generative UI SDK","main": "dist/index.js","types": "dist/index.d.ts",diff --git a/js/packages/react-ui/src/components/CheckBoxItem/CheckBoxItem.tsx b/js/packages/react-ui/src/components/CheckBoxItem/CheckBoxItem.tsxindex 56adadfef..1885e64c3 100644--- a/js/packages/react-ui/src/components/CheckBoxItem/CheckBoxItem.tsx+++ b/js/packages/react-ui/src/components/CheckBoxItem/CheckBoxItem.tsx@@ -21,11 +21,11 @@ const CheckBoxItem = forwardRef<HTMLButtonElement, CheckBoxItemProps>((props, reconst { label, description, onChange, className, disabled, required, ...rest } = props;const id = useId();return (- <div className="crayon-checkbox-item-container">+ <label htmlFor={id} className="crayon-checkbox-item-container"><Checkbox.Root+ {...rest}ref={ref}onCheckedChange={onChange}- {...rest}id={id}className={clsx("crayon-checkbox-item-root", className)}disabled={disabled}@@ -57,7 +57,7 @@ const CheckBoxItem = forwardRef<HTMLButtonElement, CheckBoxItemProps>((props, re)}{description && <p className="crayon-checkbox-item-description">{description}</p>}</div>- </div>+ </label>);});diff --git a/js/packages/react-ui/src/components/CheckBoxItem/checkBoxItem.scss b/js/packages/react-ui/src/components/CheckBoxItem/checkBoxItem.scssindex 7aa97ad60..78669ab35 100644--- a/js/packages/react-ui/src/components/CheckBoxItem/checkBoxItem.scss+++ b/js/packages/react-ui/src/components/CheckBoxItem/checkBoxItem.scss@@ -8,6 +8,10 @@width: 100%;max-width: 100%;overflow: hidden;+ cursor: pointer;+ &:disabled {+ cursor: not-allowed;+ }}.crayon-checkbox-item-root {@@ -55,8 +59,10 @@flex: 1;@include cssUtils.typography(primary, default);color: cssUtils.$primary-text;+ cursor: pointer;&:disabled {color: cssUtils.$disabled-text;+ cursor: not-allowed;}}diff --git a/js/packages/react-ui/src/components/RadioItem/RadioItem.tsx b/js/packages/react-ui/src/components/RadioItem/RadioItem.tsxindex 83e58d73d..c0c16efcd 100644--- a/js/packages/react-ui/src/components/RadioItem/RadioItem.tsx+++ b/js/packages/react-ui/src/components/RadioItem/RadioItem.tsx@@ -17,15 +17,15 @@ const RadioItem = forwardRef<HTMLButtonElement, RadioItemProps>((props, ref) =>const { label, description, className, style, disabled, required, value } = props;const id = useId();return (- <div className="crayon-radio-item-container">+ <label htmlFor={id} className="crayon-radio-item-container"><Radio.Itemref={ref}+ id={id}className={clsx("crayon-radio-item-root", className)}value={value}disabled={disabled}required={required}style={style}- id={id}><svgwidth={16}@@ -59,7 +59,7 @@ const RadioItem = forwardRef<HTMLButtonElement, RadioItemProps>((props, ref) =>)}{description && <p className="crayon-radio-item-description">{description}</p>}</div>- </div>+ </label>);});diff --git a/js/packages/react-ui/src/components/RadioItem/radioItem.scss b/js/packages/react-ui/src/components/RadioItem/radioItem.scssindex 77b80848b..61a168d0e 100644--- a/js/packages/react-ui/src/components/RadioItem/radioItem.scss+++ b/js/packages/react-ui/src/components/RadioItem/radioItem.scss@@ -8,6 +8,10 @@width: 100%;max-width: 100%;overflow: hidden;+ cursor: pointer;+ &:disabled {+ cursor: not-allowed;+ }}.crayon-radio-item-root {@@ -84,8 +88,10 @@flex: 1;@include cssUtils.typography(primary, default);color: cssUtils.$primary-text;+ cursor: pointer;&:disabled {color: cssUtils.$disabled-text;+ cursor: not-allowed;}}