Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(cli): BottomSheet checklist examples toggle from the whole row (#9533)

Divyanshu Dhruve84fb851fd7c
diff --git a/.changeset/bottomsheet-checklist-full-row-click.md b/.changeset/bottomsheet-checklist-full-row-click.md
new file mode 100644
index 0000000000..7b70db02f0
--- /dev/null
+++ b/.changeset/bottomsheet-checklist-full-row-click.md
@@ -0,0 +1,6 @@
+---
+'@astryxdesign/cli': patch
+---
+
+[fix] BottomSheet checklist examples use CheckboxList so the whole row toggles, not just the label
+@divyanshudhruv
diff --git a/apps/storybook/stories/BottomSheet.stories.tsx b/apps/storybook/stories/BottomSheet.stories.tsx
index 49d03d93b3..401911299a 100644
--- a/apps/storybook/stories/BottomSheet.stories.tsx
+++ b/apps/storybook/stories/BottomSheet.stories.tsx
@@ -25,6 +25,7 @@ import {Text} from '@astryxdesign/core/Text';
import {TextInput} from '@astryxdesign/core/TextInput';
import {TextArea} from '@astryxdesign/core/TextArea';
import {CheckboxInput} from '@astryxdesign/core/CheckboxInput';
+import {CheckboxList, CheckboxListItem} from '@astryxdesign/core/CheckboxList';
import {Popover} from '@astryxdesign/core/Popover';
const meta: Meta<typeof BottomSheet> = {
@@ -277,6 +278,9 @@ function MobileKeyboardCommentForm({onPost}: {onPost: () => void}) {
export const Showcase: Story = {
render: () => {
const [isOpen, setIsOpen] = useState(false);
+ const [inStock, setInStock] = useState(false);
+ const [onSale, setOnSale] = useState(false);
+ const [freeShipping, setFreeShipping] = useState(false);
return (
<>
<Button label="Open sheet" onClick={() => setIsOpen(true)} />
@@ -285,11 +289,23 @@ export const Showcase: Story = {
<VStack gap={4}>
<Heading level={3}>Filters</Heading>
<Divider />
- <VStack gap={2}>
- <CheckboxInput label="In stock" value={false} />
- <CheckboxInput label="On sale" value={false} />
- <CheckboxInput label="Free shipping" value={false} />
- </VStack>
+ <CheckboxList label="Filters" isLabelHidden>
+ <CheckboxListItem
+ label="In stock"
+ isChecked={inStock}
+ onCheck={setInStock}
+ />
+ <CheckboxListItem
+ label="On sale"
+ isChecked={onSale}
+ onCheck={setOnSale}
+ />
+ <CheckboxListItem
+ label="Free shipping"
+ isChecked={freeShipping}
+ onCheck={setFreeShipping}
+ />
+ </CheckboxList>
<Button label="Apply" onClick={() => setIsOpen(false)} />
</VStack>
</Section>
diff --git a/apps/storybook/stories/BottomSheetReplace.stories.tsx b/apps/storybook/stories/BottomSheetReplace.stories.tsx
index 45d8367b21..b5ff232dc0 100644
--- a/apps/storybook/stories/BottomSheetReplace.stories.tsx
+++ b/apps/storybook/stories/BottomSheetReplace.stories.tsx
@@ -4,7 +4,7 @@ import type {Meta, StoryObj} from '@storybook/react';
import {useEffect, useState} from 'react';
import {BottomSheet} from '@astryxdesign/core/BottomSheet';
import {Button} from '@astryxdesign/core/Button';
-import {CheckboxInput} from '@astryxdesign/core/CheckboxInput';
+import {CheckboxList, CheckboxListItem} from '@astryxdesign/core/CheckboxList';
import {Divider} from '@astryxdesign/core/Divider';
import {Heading} from '@astryxdesign/core/Heading';
import {Section} from '@astryxdesign/core/Section';
@@ -210,19 +210,23 @@ function NotificationChannelsSheet({
<Text type="supporting" color="secondary">
Choose any combination. You can change these preferences later.
</Text>
- <VStack gap={2}>
- <CheckboxInput label="Email" value={email} onChange={setEmail} />
- <CheckboxInput
+ <CheckboxList label="Notification channels" isLabelHidden>
+ <CheckboxListItem
+ label="Email"
+ isChecked={email}
+ onCheck={setEmail}
+ />
+ <CheckboxListItem
label="Push notifications"
- value={pushNotifications}
- onChange={setPushNotifications}
+ isChecked={pushNotifications}
+ onCheck={setPushNotifications}
/>
- <CheckboxInput
+ <CheckboxListItem
label="Text messages"
- value={textMessages}
- onChange={setTextMessages}
+ isChecked={textMessages}
+ onCheck={setTextMessages}
/>
- </VStack>
+ </CheckboxList>
<HStack gap={2} hAlign="end">
<Button label="Back" variant="secondary" onClick={onBack} />
<Button label="Finish" onClick={onFinish} />
diff --git a/apps/storybook/stories/BottomSheetSwitcher.stories.tsx b/apps/storybook/stories/BottomSheetSwitcher.stories.tsx
index 19465c2c63..a9c582ef98 100644
--- a/apps/storybook/stories/BottomSheetSwitcher.stories.tsx
+++ b/apps/storybook/stories/BottomSheetSwitcher.stories.tsx
@@ -5,7 +5,7 @@ import {useState} from 'react';
import {BottomSheet, BottomSheetSwitcher} from '@astryxdesign/core/BottomSheet';
import {Button} from '@astryxdesign/core/Button';
import {useAnnounce} from '@astryxdesign/core/hooks';
-import {CheckboxInput} from '@astryxdesign/core/CheckboxInput';
+import {CheckboxList, CheckboxListItem} from '@astryxdesign/core/CheckboxList';
import {Dialog, DialogHeader} from '@astryxdesign/core/Dialog';
import {Divider} from '@astryxdesign/core/Divider';
import {Heading} from '@astryxdesign/core/Heading';
@@ -289,19 +289,23 @@ function NotificationChannelsSheet({
<Text type="supporting" color="secondary">
Choose any combination. You can change these preferences later.
</Text>
- <VStack gap={2}>
- <CheckboxInput label="Email" value={email} onChange={setEmail} />
- <CheckboxInput
+ <CheckboxList label="Notification channels" isLabelHidden>
+ <CheckboxListItem
+ label="Email"
+ isChecked={email}
+ onCheck={setEmail}
+ />
+ <CheckboxListItem
label="Push notifications"
- value={pushNotifications}
- onChange={setPushNotifications}
+ isChecked={pushNotifications}
+ onCheck={setPushNotifications}
/>
- <CheckboxInput
+ <CheckboxListItem
label="Text messages"
- value={textMessages}
- onChange={setTextMessages}
+ isChecked={textMessages}
+ onCheck={setTextMessages}
/>
- </VStack>
+ </CheckboxList>
<HStack gap={2} hAlign="end">
<Button label="Back" variant="secondary" onClick={onBack} />
<Button label="Finish" onClick={onFinish} />
diff --git a/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.doc.mjs b/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.doc.mjs
index b2e55d0eda..8c646cc051 100644
--- a/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.doc.mjs
+++ b/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.doc.mjs
@@ -13,7 +13,7 @@ export const doc = {
componentsUsed: [
'BottomSheet',
'Button',
- 'CheckboxInput',
+ 'CheckboxList',
'Divider',
'Heading',
'Section',
diff --git a/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.tsx b/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.tsx
index 97ae2dc7be..88de789276 100644
--- a/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.tsx
+++ b/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.tsx
@@ -5,7 +5,7 @@
import {useState} from 'react';
import {BottomSheet} from '@astryxdesign/core/BottomSheet';
import {Button} from '@astryxdesign/core/Button';
-import {CheckboxInput} from '@astryxdesign/core/CheckboxInput';
+import {CheckboxList, CheckboxListItem} from '@astryxdesign/core/CheckboxList';
import {Divider} from '@astryxdesign/core/Divider';
import {Heading} from '@astryxdesign/core/Heading';
import {Section} from '@astryxdesign/core/Section';
@@ -25,23 +25,23 @@ export default function BottomSheetShowcase() {
<VStack gap={4}>
<Heading level={3}>Filters</Heading>
<Divider />
- <VStack gap={2}>
- <CheckboxInput
+ <CheckboxList label="Filters" isLabelHidden>
+ <CheckboxListItem
label="In stock"
- value={inStock}
- onChange={setInStock}
+ isChecked={inStock}
+ onCheck={setInStock}
/>
- <CheckboxInput
+ <CheckboxListItem
label="On sale"
- value={onSale}
- onChange={setOnSale}
+ isChecked={onSale}
+ onCheck={setOnSale}
/>
- <CheckboxInput
+ <CheckboxListItem
label="Free shipping"
- value={freeShipping}
- onChange={setFreeShipping}
+ isChecked={freeShipping}
+ onCheck={setFreeShipping}
/>
- </VStack>
+ </CheckboxList>
<Button label="Apply" onClick={() => setIsOpen(false)} />
</VStack>
</Section>
diff --git a/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.doc.mjs b/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.doc.mjs
index 6174cd9548..a5d4170c6d 100644
--- a/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.doc.mjs
+++ b/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.doc.mjs
@@ -17,7 +17,7 @@ export const doc = {
componentsUsed: [
'BottomSheet',
'Button',
- 'CheckboxInput',
+ 'CheckboxList',
'Divider',
'Heading',
'RadioList',
diff --git a/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.tsx b/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.tsx
index 07a63a88d8..c8089265f7 100644
--- a/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.tsx
+++ b/packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.tsx
@@ -5,7 +5,7 @@
import {useState} from 'react';
import {BottomSheet} from '@astryxdesign/core/BottomSheet';
import {Button} from '@astryxdesign/core/Button';
-import {CheckboxInput} from '@astryxdesign/core/CheckboxInput';
+import {CheckboxList, CheckboxListItem} from '@astryxdesign/core/CheckboxList';
import {Divider} from '@astryxdesign/core/Divider';
import {Heading} from '@astryxdesign/core/Heading';
import {Section} from '@astryxdesign/core/Section';
@@ -175,19 +175,23 @@ function NotificationChannelsSheet({
<Text type="supporting" color="secondary">
Choose any combination. You can change these preferences later.
</Text>
- <VStack gap={2}>
- <CheckboxInput label="Email" value={email} onChange={setEmail} />
- <CheckboxInput
+ <CheckboxList label="Notification channels" isLabelHidden>
+ <CheckboxListItem
+ label="Email"
+ isChecked={email}
+ onCheck={setEmail}
+ />
+ <CheckboxListItem
label="Push notifications"
- value={pushNotifications}
- onChange={setPushNotifications}
+ isChecked={pushNotifications}
+ onCheck={setPushNotifications}
/>
- <CheckboxInput
+ <CheckboxListItem
label="Text messages"
- value={textMessages}
- onChange={setTextMessages}
+ isChecked={textMessages}
+ onCheck={setTextMessages}
/>
- </VStack>
+ </CheckboxList>
<HStack gap={2} hAlign="end">
<Button label="Back" variant="secondary" onClick={onBack} />
<Button label="Finish" onClick={onFinish} />