From ec51f7099dc9b88fbf7217c55b2884dfa93feedb Mon Sep 17 00:00:00 2001 From: AtsushiM Date: Tue, 28 Jan 2025 12:59:45 +0900 Subject: [PATCH 1/9] =?UTF-8?q?chore:=20CheckBox=E5=86=85=E3=81=AEhandleOn?= =?UTF-8?q?Click=E3=81=AF=E7=84=A1=E9=A7=84=E3=81=AAmemo=E5=8C=96=E3=81=A0?= =?UTF-8?q?=E3=81=A3=E3=81=9F=E3=81=AE=E3=81=A7onClick=E3=82=92=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E5=88=A9=E7=94=A8=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../smarthr-ui/src/components/CheckBox/CheckBox.tsx | 11 +++-------- packages/smarthr-ui/src/components/Chip/Chip.tsx | 1 + 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/smarthr-ui/src/components/CheckBox/CheckBox.tsx b/packages/smarthr-ui/src/components/CheckBox/CheckBox.tsx index 64699db917..551016b8f7 100644 --- a/packages/smarthr-ui/src/components/CheckBox/CheckBox.tsx +++ b/packages/smarthr-ui/src/components/CheckBox/CheckBox.tsx @@ -82,6 +82,7 @@ export const CheckBox = forwardRef( labelStyle, } = useMemo(() => { const { wrapper, innerWrapper, box, input, iconWrap, icon, label } = checkbox() + return { wrapperStyle: wrapper({ className }), innerWrapperStyle: innerWrapper(), @@ -93,14 +94,8 @@ export const CheckBox = forwardRef( } }, [className, props.disabled]) - const handleChange = useCallback>( - (e) => { - if (onChange) onChange(e) - }, - [onChange], - ) - const inputRef = useRef(null) + useImperativeHandle( ref, () => inputRef.current, @@ -124,7 +119,7 @@ export const CheckBox = forwardRef( type="checkbox" id={checkBoxId} checked={checked} - onChange={handleChange} + onChange={onChange} className={inputStyle} ref={inputRef} aria-invalid={error || undefined} diff --git a/packages/smarthr-ui/src/components/Chip/Chip.tsx b/packages/smarthr-ui/src/components/Chip/Chip.tsx index 40203edf70..e88a80f1c0 100644 --- a/packages/smarthr-ui/src/components/Chip/Chip.tsx +++ b/packages/smarthr-ui/src/components/Chip/Chip.tsx @@ -24,5 +24,6 @@ const chip = tv({ export const Chip: FC = ({ size, disabled, className, ...props }) => { const styles = useMemo(() => chip({ size, disabled, className }), [size, disabled, className]) + return } From 802fe1ea3f2174fb38355dff1a607dfce7cc7624 Mon Sep 17 00:00:00 2001 From: AtsushiM Date: Tue, 28 Jan 2025 13:07:32 +0900 Subject: [PATCH 2/9] =?UTF-8?q?chore:=20CheckBox=E3=81=AEAriaHiddenBox?= =?UTF-8?q?=E3=82=92=E5=88=87=E3=82=8A=E5=87=BA=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/smarthr-ui/src/components/CheckBox/CheckBox.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/smarthr-ui/src/components/CheckBox/CheckBox.tsx b/packages/smarthr-ui/src/components/CheckBox/CheckBox.tsx index 551016b8f7..1fc5b0eafd 100644 --- a/packages/smarthr-ui/src/components/CheckBox/CheckBox.tsx +++ b/packages/smarthr-ui/src/components/CheckBox/CheckBox.tsx @@ -124,7 +124,7 @@ export const CheckBox = forwardRef( ref={inputRef} aria-invalid={error || undefined} /> -