@boostdev/design-system-components 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +13 -10
- package/dist/client.cjs +77 -99
- package/dist/client.css +611 -580
- package/dist/client.d.cts +13 -16
- package/dist/client.d.ts +13 -16
- package/dist/client.js +87 -109
- package/dist/index.cjs +77 -99
- package/dist/index.css +611 -580
- package/dist/index.d.cts +13 -16
- package/dist/index.d.ts +13 -16
- package/dist/index.js +87 -109
- package/dist/native/index.cjs +9 -8
- package/dist/native/index.d.cts +1 -1
- package/dist/native/index.d.ts +1 -1
- package/dist/native/index.js +9 -8
- package/dist/web-components/chunk-2QA62WCQ.js +48 -0
- package/dist/web-components/chunk-3REOIRDW.js +246 -0
- package/dist/web-components/chunk-57TRNCWQ.js +93 -0
- package/dist/web-components/chunk-5IPHEONG.js +139 -0
- package/dist/web-components/chunk-5R6IFELV.js +63 -0
- package/dist/web-components/chunk-5TFWOPLH.js +49 -0
- package/dist/web-components/chunk-6I3CFC26.js +89 -0
- package/dist/web-components/chunk-6MH5UWUD.js +226 -0
- package/dist/web-components/chunk-7FMR53BW.js +127 -0
- package/dist/web-components/chunk-AGKJTMJI.js +56 -0
- package/dist/web-components/chunk-AJSXNDAP.js +151 -0
- package/dist/web-components/chunk-BQLZ7I4G.js +56 -0
- package/dist/web-components/chunk-BX3IPVOB.js +167 -0
- package/dist/web-components/chunk-CR5PGUHV.js +109 -0
- package/dist/web-components/chunk-DI46Q2EA.js +278 -0
- package/dist/web-components/chunk-DZRSJGPB.js +53 -0
- package/dist/web-components/chunk-EBJM3VD4.js +107 -0
- package/dist/web-components/chunk-ECW3HHWA.js +185 -0
- package/dist/web-components/chunk-HGBNDR22.js +98 -0
- package/dist/web-components/chunk-HHHRF2PS.js +118 -0
- package/dist/web-components/chunk-ITHLKR7Q.js +105 -0
- package/dist/web-components/chunk-JUKB3BUP.js +186 -0
- package/dist/web-components/chunk-L3XHOMN6.js +111 -0
- package/dist/{web-components.js → web-components/chunk-LGEZYFUU.js} +62 -844
- package/dist/web-components/chunk-LY62SAVN.js +64 -0
- package/dist/web-components/chunk-N6IMUOY4.js +185 -0
- package/dist/web-components/chunk-OHUTLSIQ.js +69 -0
- package/dist/web-components/chunk-OQTRTMAB.js +27 -0
- package/dist/web-components/chunk-PY62FTRW.js +179 -0
- package/dist/web-components/chunk-Q4T5BJT6.js +94 -0
- package/dist/web-components/chunk-QDST57JC.js +119 -0
- package/dist/web-components/chunk-QLZ2362S.js +279 -0
- package/dist/web-components/chunk-QPOKHLMQ.js +45 -0
- package/dist/web-components/chunk-SOQQ7RVJ.js +88 -0
- package/dist/web-components/chunk-T6AETZRP.js +131 -0
- package/dist/web-components/chunk-UFFCKVZE.js +149 -0
- package/dist/web-components/chunk-VMMVWLXL.js +53 -0
- package/dist/web-components/chunk-X3FKVHLK.js +144 -0
- package/dist/web-components/chunk-XNA6WTXG.js +133 -0
- package/dist/web-components/chunk-Y4MAXTMA.js +80 -0
- package/dist/web-components/chunk-YLVTEY23.js +165 -0
- package/dist/web-components/chunk-YRXCVKHV.js +116 -0
- package/dist/web-components/chunk-ZTC6GRP7.js +64 -0
- package/dist/web-components/globals.d.ts +2 -0
- package/dist/web-components/globals.js +1 -0
- package/dist/web-components/index.d.ts +41 -0
- package/dist/web-components/index.js +165 -0
- package/dist/web-components/interaction/bds-accordion-item.d.ts +54 -0
- package/dist/web-components/interaction/bds-accordion-item.js +7 -0
- package/dist/web-components/interaction/bds-accordion.d.ts +50 -0
- package/dist/web-components/interaction/bds-accordion.js +7 -0
- package/dist/web-components/interaction/bds-button.d.ts +100 -0
- package/dist/web-components/interaction/bds-button.js +7 -0
- package/dist/web-components/interaction/bds-collapsible.d.ts +52 -0
- package/dist/web-components/interaction/bds-collapsible.js +7 -0
- package/dist/web-components/interaction/bds-dialog.d.ts +56 -0
- package/dist/web-components/interaction/bds-dialog.js +7 -0
- package/dist/web-components/interaction/bds-drawer.d.ts +64 -0
- package/dist/web-components/interaction/bds-drawer.js +7 -0
- package/dist/web-components/interaction/bds-popover.d.ts +62 -0
- package/dist/web-components/interaction/bds-popover.js +7 -0
- package/dist/web-components/interaction/bds-skip-link.d.ts +36 -0
- package/dist/web-components/interaction/bds-skip-link.js +7 -0
- package/dist/web-components/interaction/bds-tab-panel.d.ts +26 -0
- package/dist/web-components/interaction/bds-tab-panel.js +7 -0
- package/dist/web-components/interaction/bds-tab.d.ts +45 -0
- package/dist/web-components/interaction/bds-tab.js +7 -0
- package/dist/web-components/interaction/bds-tabs.d.ts +46 -0
- package/dist/web-components/interaction/bds-tabs.js +7 -0
- package/dist/web-components/interaction/bds-toast-provider.d.ts +57 -0
- package/dist/web-components/interaction/bds-toast-provider.js +7 -0
- package/dist/web-components/interaction/bds-tooltip.d.ts +50 -0
- package/dist/web-components/interaction/bds-tooltip.js +7 -0
- package/dist/web-components/interaction/form/bds-checkbox.d.ts +70 -0
- package/dist/web-components/interaction/form/bds-checkbox.js +7 -0
- package/dist/web-components/interaction/form/bds-combobox.d.ts +84 -0
- package/dist/web-components/interaction/form/bds-combobox.js +7 -0
- package/dist/web-components/interaction/form/bds-file-input.d.ts +62 -0
- package/dist/web-components/interaction/form/bds-file-input.js +7 -0
- package/dist/web-components/interaction/form/bds-number-input.d.ts +68 -0
- package/dist/web-components/interaction/form/bds-number-input.js +7 -0
- package/dist/web-components/interaction/form/bds-radio.d.ts +68 -0
- package/dist/web-components/interaction/form/bds-radio.js +7 -0
- package/dist/web-components/interaction/form/bds-segmented-control.d.ts +88 -0
- package/dist/web-components/interaction/form/bds-segmented-control.js +7 -0
- package/dist/web-components/interaction/form/bds-select.d.ts +79 -0
- package/dist/web-components/interaction/form/bds-select.js +7 -0
- package/dist/web-components/interaction/form/bds-slider.d.ts +70 -0
- package/dist/web-components/interaction/form/bds-slider.js +7 -0
- package/dist/web-components/interaction/form/bds-switch.d.ts +67 -0
- package/dist/web-components/interaction/form/bds-switch.js +7 -0
- package/dist/web-components/interaction/form/bds-textarea.d.ts +70 -0
- package/dist/web-components/interaction/form/bds-textarea.js +7 -0
- package/dist/web-components/ui/bds-alert.d.ts +66 -0
- package/dist/web-components/ui/bds-alert.js +7 -0
- package/dist/web-components/ui/bds-avatar.d.ts +50 -0
- package/dist/web-components/ui/bds-avatar.js +7 -0
- package/dist/web-components/ui/bds-badge.d.ts +35 -0
- package/dist/web-components/ui/bds-badge.js +7 -0
- package/dist/web-components/ui/bds-breadcrumb.d.ts +35 -0
- package/dist/web-components/ui/bds-breadcrumb.js +7 -0
- package/dist/web-components/ui/bds-card.d.ts +72 -0
- package/dist/web-components/ui/bds-card.js +7 -0
- package/dist/web-components/ui/bds-description-list.d.ts +42 -0
- package/dist/web-components/ui/bds-description-list.js +7 -0
- package/dist/web-components/ui/bds-icon-wrapper.d.ts +39 -0
- package/dist/web-components/ui/bds-icon-wrapper.js +7 -0
- package/dist/web-components/ui/bds-link.d.ts +59 -0
- package/dist/web-components/ui/bds-link.js +7 -0
- package/dist/web-components/ui/bds-loading.d.ts +32 -0
- package/dist/web-components/ui/bds-loading.js +7 -0
- package/dist/web-components/ui/bds-notification-banner.d.ts +61 -0
- package/dist/web-components/ui/bds-notification-banner.js +7 -0
- package/dist/web-components/ui/bds-progress-circle.d.ts +53 -0
- package/dist/web-components/ui/bds-progress-circle.js +7 -0
- package/dist/web-components/ui/bds-progress.d.ts +54 -0
- package/dist/web-components/ui/bds-progress.js +7 -0
- package/dist/web-components/ui/bds-rating.d.ts +36 -0
- package/dist/web-components/ui/bds-rating.js +7 -0
- package/dist/web-components/ui/bds-section-header.d.ts +53 -0
- package/dist/web-components/ui/bds-section-header.js +8 -0
- package/dist/web-components/ui/bds-separator.d.ts +32 -0
- package/dist/web-components/ui/bds-separator.js +7 -0
- package/dist/web-components/ui/bds-skeleton.d.ts +22 -0
- package/dist/web-components/ui/bds-skeleton.js +7 -0
- package/dist/web-components/ui/bds-typography.d.ts +44 -0
- package/dist/web-components/ui/bds-typography.js +8 -0
- package/package.json +170 -5
- package/src/components/interaction/Button/Button.module.css +12 -11
- package/src/components/interaction/Button/Button.native.tsx +10 -9
- package/src/components/interaction/Button/Button.tsx +1 -1
- package/src/components/interaction/Command/Command.module.css +3 -7
- package/src/components/interaction/Dialog/Dialog.module.css +7 -5
- package/src/components/interaction/Drawer/Drawer.module.css +49 -1
- package/src/components/interaction/DropdownMenu/DropdownMenu.module.css +1 -3
- package/src/components/interaction/Popover/Popover.module.css +1 -3
- package/src/components/interaction/form/Checkbox/Checkbox.module.css +1 -3
- package/src/components/interaction/form/Combobox/Combobox.module.css +2 -6
- package/src/components/interaction/form/FormInput/FormInput.module.css +1 -3
- package/src/components/interaction/form/NumberInput/NumberInput.module.css +16 -4
- package/src/components/interaction/form/Radio/Radio.module.css +6 -16
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.mdx +70 -25
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.module.css +55 -33
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.spec.tsx +127 -56
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.stories.tsx +89 -72
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.tsx +40 -62
- package/src/components/interaction/form/SegmentedControl/index.ts +1 -1
- package/src/components/interaction/form/Select/Select.module.css +2 -4
- package/src/components/interaction/form/Switch/Switch.module.css +5 -7
- package/src/components/interaction/form/Switch/Switch.native.spec.tsx +9 -9
- package/src/components/interaction/form/Switch/Switch.native.tsx +2 -2
- package/src/components/interaction/form/Textarea/Textarea.module.css +1 -3
- package/src/components/interaction/form/atoms/InputContainer.stories.tsx +64 -0
- package/src/components/interaction/form/atoms/Label.stories.tsx +33 -0
- package/src/components/interaction/form/atoms/Message.stories.tsx +33 -0
- package/src/components/layout/Card/Card.module.css +1 -3
- package/src/components/ui/Accordion/Accordion.module.css +1 -2
- package/src/components/ui/Alert/Alert.module.css +1 -2
- package/src/components/ui/Calendar/Calendar.module.css +2 -5
- package/src/components/ui/Carousel/Carousel.module.css +1 -3
- package/src/components/ui/NotificationBanner/NotificationBanner.module.css +1 -2
- package/src/components/ui/Pagination/Pagination.module.css +1 -2
- package/src/components/ui/SkipLink/SkipLink.module.css +1 -2
- package/src/components/ui/Table/Table.module.css +1 -2
- package/src/css/bdc.css +16 -11
- package/src/index.ts +1 -1
- package/src/web-components/globals.ts +3 -3
- package/src/web-components/index.ts +47 -0
- package/src/web-components/interaction/BdsAccordion.mdx +51 -0
- package/src/web-components/interaction/BdsAccordion.stories.tsx +85 -0
- package/src/web-components/interaction/BdsCollapsible.mdx +46 -0
- package/src/web-components/interaction/BdsCollapsible.stories.tsx +87 -0
- package/src/web-components/interaction/BdsDialog.mdx +49 -0
- package/src/web-components/interaction/BdsDialog.stories.tsx +75 -0
- package/src/web-components/interaction/BdsDrawer.mdx +50 -0
- package/src/web-components/interaction/BdsDrawer.stories.tsx +66 -0
- package/src/web-components/interaction/BdsSkipLink.mdx +34 -0
- package/src/web-components/interaction/BdsSkipLink.stories.tsx +55 -0
- package/src/web-components/interaction/BdsTabs.mdx +47 -0
- package/src/web-components/interaction/BdsTabs.stories.tsx +80 -0
- package/src/web-components/interaction/BdsTooltip.mdx +38 -0
- package/src/web-components/interaction/BdsTooltip.stories.tsx +68 -0
- package/src/web-components/interaction/bds-accordion-item.spec.ts +75 -0
- package/src/web-components/interaction/bds-accordion-item.ts +181 -0
- package/src/web-components/interaction/bds-accordion.spec.ts +73 -0
- package/src/web-components/interaction/bds-accordion.ts +98 -0
- package/src/web-components/interaction/bds-button.ts +15 -13
- package/src/web-components/interaction/bds-collapsible.spec.ts +56 -0
- package/src/web-components/interaction/bds-collapsible.ts +170 -0
- package/src/web-components/interaction/bds-dialog.spec.ts +119 -0
- package/src/web-components/interaction/bds-dialog.ts +221 -0
- package/src/web-components/interaction/bds-drawer.spec.ts +113 -0
- package/src/web-components/interaction/bds-drawer.ts +315 -0
- package/src/web-components/interaction/bds-skip-link.spec.ts +42 -0
- package/src/web-components/interaction/bds-skip-link.ts +74 -0
- package/src/web-components/interaction/bds-tab-panel.spec.ts +32 -0
- package/src/web-components/interaction/bds-tab-panel.ts +38 -0
- package/src/web-components/interaction/bds-tab.spec.ts +71 -0
- package/src/web-components/interaction/bds-tab.ts +110 -0
- package/src/web-components/interaction/bds-tabs.spec.ts +120 -0
- package/src/web-components/interaction/bds-tabs.ts +152 -0
- package/src/web-components/interaction/bds-tooltip.spec.ts +49 -0
- package/src/web-components/interaction/bds-tooltip.ts +127 -0
- package/src/web-components/interaction/form/BdsCheckbox.mdx +39 -0
- package/src/web-components/interaction/form/BdsCheckbox.stories.tsx +73 -0
- package/src/web-components/interaction/form/BdsCombobox.mdx +52 -0
- package/src/web-components/interaction/form/BdsCombobox.stories.tsx +91 -0
- package/src/web-components/interaction/form/BdsFileInput.mdx +44 -0
- package/src/web-components/interaction/form/BdsFileInput.stories.tsx +84 -0
- package/src/web-components/interaction/form/BdsNumberInput.mdx +41 -0
- package/src/web-components/interaction/form/BdsNumberInput.stories.tsx +90 -0
- package/src/web-components/interaction/form/BdsRadio.mdx +41 -0
- package/src/web-components/interaction/form/BdsRadio.stories.tsx +90 -0
- package/src/web-components/interaction/form/BdsSegmentedControl.mdx +42 -0
- package/src/web-components/interaction/form/BdsSegmentedControl.stories.tsx +92 -0
- package/src/web-components/interaction/form/BdsSelect.mdx +38 -0
- package/src/web-components/interaction/form/BdsSelect.stories.tsx +93 -0
- package/src/web-components/interaction/form/BdsSlider.mdx +49 -0
- package/src/web-components/interaction/form/BdsSlider.stories.tsx +89 -0
- package/src/web-components/interaction/form/BdsSwitch.mdx +39 -0
- package/src/web-components/interaction/form/BdsSwitch.stories.tsx +73 -0
- package/src/web-components/interaction/form/BdsTextarea.mdx +41 -0
- package/src/web-components/interaction/form/BdsTextarea.stories.tsx +79 -0
- package/src/web-components/interaction/form/bds-checkbox.spec.ts +63 -0
- package/src/web-components/interaction/form/bds-checkbox.ts +166 -0
- package/src/web-components/interaction/form/bds-combobox.spec.ts +117 -0
- package/src/web-components/interaction/form/bds-combobox.ts +334 -0
- package/src/web-components/interaction/form/bds-file-input.spec.ts +58 -0
- package/src/web-components/interaction/form/bds-file-input.ts +209 -0
- package/src/web-components/interaction/form/bds-number-input.spec.ts +87 -0
- package/src/web-components/interaction/form/bds-number-input.ts +220 -0
- package/src/web-components/interaction/form/bds-radio.spec.ts +70 -0
- package/src/web-components/interaction/form/bds-radio.ts +151 -0
- package/src/web-components/interaction/form/bds-segmented-control.spec.ts +74 -0
- package/src/web-components/interaction/form/bds-segmented-control.ts +282 -0
- package/src/web-components/interaction/form/bds-select.spec.ts +74 -0
- package/src/web-components/interaction/form/bds-select.ts +188 -0
- package/src/web-components/interaction/form/bds-slider.spec.ts +41 -0
- package/src/web-components/interaction/form/bds-slider.ts +162 -0
- package/src/web-components/interaction/form/bds-switch.spec.ts +62 -0
- package/src/web-components/interaction/form/bds-switch.ts +165 -0
- package/src/web-components/interaction/form/bds-textarea.spec.ts +55 -0
- package/src/web-components/interaction/form/bds-textarea.ts +141 -0
- package/src/web-components/ui/BdsAvatar.mdx +67 -0
- package/src/web-components/ui/BdsAvatar.stories.tsx +62 -0
- package/src/web-components/ui/BdsBreadcrumb.mdx +63 -0
- package/src/web-components/ui/BdsBreadcrumb.stories.tsx +59 -0
- package/src/web-components/ui/BdsCard.mdx +83 -0
- package/src/web-components/ui/BdsCard.stories.tsx +90 -0
- package/src/web-components/ui/BdsDescriptionList.mdx +67 -0
- package/src/web-components/ui/BdsDescriptionList.stories.tsx +79 -0
- package/src/web-components/ui/BdsIconWrapper.mdx +70 -0
- package/src/web-components/ui/BdsIconWrapper.stories.tsx +76 -0
- package/src/web-components/ui/BdsLink.mdx +75 -0
- package/src/web-components/ui/BdsLink.stories.tsx +64 -0
- package/src/web-components/ui/BdsLoading.mdx +62 -0
- package/src/web-components/ui/BdsLoading.stories.tsx +37 -0
- package/src/web-components/ui/BdsNotificationBanner.mdx +90 -0
- package/src/web-components/ui/BdsNotificationBanner.stories.tsx +93 -0
- package/src/web-components/ui/BdsProgress.mdx +63 -0
- package/src/web-components/ui/BdsProgress.stories.tsx +70 -0
- package/src/web-components/ui/BdsProgressCircle.mdx +64 -0
- package/src/web-components/ui/BdsProgressCircle.stories.tsx +69 -0
- package/src/web-components/ui/BdsRating.mdx +61 -0
- package/src/web-components/ui/BdsRating.stories.tsx +39 -0
- package/src/web-components/ui/BdsSectionHeader.mdx +69 -0
- package/src/web-components/ui/BdsSectionHeader.stories.tsx +56 -0
- package/src/web-components/ui/BdsSeparator.mdx +63 -0
- package/src/web-components/ui/BdsSeparator.stories.tsx +47 -0
- package/src/web-components/ui/BdsSkeleton.mdx +67 -0
- package/src/web-components/ui/BdsSkeleton.stories.tsx +50 -0
- package/src/web-components/ui/BdsTypography.mdx +83 -0
- package/src/web-components/ui/BdsTypography.stories.tsx +51 -0
- package/src/web-components/ui/bds-alert.ts +1 -2
- package/src/web-components/ui/bds-avatar.spec.ts +75 -0
- package/src/web-components/ui/bds-avatar.ts +122 -0
- package/src/web-components/ui/bds-breadcrumb.spec.ts +55 -0
- package/src/web-components/ui/bds-breadcrumb.ts +114 -0
- package/src/web-components/ui/bds-card.spec.ts +70 -0
- package/src/web-components/ui/bds-card.ts +154 -0
- package/src/web-components/ui/bds-description-list.spec.ts +36 -0
- package/src/web-components/ui/bds-description-list.ts +79 -0
- package/src/web-components/ui/bds-icon-wrapper.spec.ts +21 -0
- package/src/web-components/ui/bds-icon-wrapper.ts +68 -0
- package/src/web-components/ui/bds-link.spec.ts +72 -0
- package/src/web-components/ui/bds-link.ts +138 -0
- package/src/web-components/ui/bds-loading.spec.ts +38 -0
- package/src/web-components/ui/bds-loading.ts +76 -0
- package/src/web-components/ui/bds-notification-banner.spec.ts +82 -0
- package/src/web-components/ui/bds-notification-banner.ts +184 -0
- package/src/web-components/ui/bds-progress-circle.spec.ts +58 -0
- package/src/web-components/ui/bds-progress-circle.ts +142 -0
- package/src/web-components/ui/bds-progress.spec.ts +66 -0
- package/src/web-components/ui/bds-progress.ts +127 -0
- package/src/web-components/ui/bds-rating.spec.ts +70 -0
- package/src/web-components/ui/bds-rating.ts +80 -0
- package/src/web-components/ui/bds-section-header.spec.ts +57 -0
- package/src/web-components/ui/bds-section-header.ts +96 -0
- package/src/web-components/ui/bds-separator.spec.ts +50 -0
- package/src/web-components/ui/bds-separator.ts +66 -0
- package/src/web-components/ui/bds-skeleton.spec.ts +22 -0
- package/src/web-components/ui/bds-skeleton.ts +55 -0
- package/src/web-components/ui/bds-typography.spec.ts +76 -0
- package/src/web-components/ui/bds-typography.ts +112 -0
- package/dist/web-components.d.ts +0 -304
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsAccordion.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# Accordion
|
|
7
|
+
|
|
8
|
+
`<bds-accordion>` is a container for one or more `<bds-accordion-item>` elements. Each item shows a header and reveals its body on click. By default only one item can be open at a time; set `allow-multiple` to allow several.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<bds-accordion>
|
|
14
|
+
<bds-accordion-item>
|
|
15
|
+
<span slot="header">Section 1</span>
|
|
16
|
+
<p>Content for section 1.</p>
|
|
17
|
+
</bds-accordion-item>
|
|
18
|
+
<bds-accordion-item>
|
|
19
|
+
<span slot="header">Section 2</span>
|
|
20
|
+
<p>Content for section 2.</p>
|
|
21
|
+
</bds-accordion-item>
|
|
22
|
+
</bds-accordion>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Attributes — `<bds-accordion>`
|
|
26
|
+
|
|
27
|
+
| Attribute | Type | Default | Description |
|
|
28
|
+
|------------------|-----------|---------|-----------------------------------------|
|
|
29
|
+
| `allow-multiple` | `boolean` | `false` | Allow more than one item open at a time |
|
|
30
|
+
|
|
31
|
+
## Attributes — `<bds-accordion-item>`
|
|
32
|
+
|
|
33
|
+
| Attribute | Type | Default | Description |
|
|
34
|
+
|------------|-----------|---------|-----------------------------------|
|
|
35
|
+
| `disabled` | `boolean` | `false` | Prevents this item from toggling |
|
|
36
|
+
|
|
37
|
+
## Slots — `<bds-accordion-item>`
|
|
38
|
+
|
|
39
|
+
| Slot | Description |
|
|
40
|
+
|-----------|--------------------------|
|
|
41
|
+
| `header` | The clickable header text |
|
|
42
|
+
| (default) | The collapsible body content |
|
|
43
|
+
|
|
44
|
+
## Stories
|
|
45
|
+
|
|
46
|
+
<Canvas of={Stories.Default} />
|
|
47
|
+
<Canvas of={Stories.AllVariants} />
|
|
48
|
+
|
|
49
|
+
## Controls
|
|
50
|
+
|
|
51
|
+
<ArgTypes of={Stories} />
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../index';
|
|
4
|
+
|
|
5
|
+
function BdsAccordion({ allowMultiple }: { allowMultiple?: boolean }) {
|
|
6
|
+
return React.createElement(
|
|
7
|
+
'bds-accordion',
|
|
8
|
+
{ 'allow-multiple': allowMultiple || undefined },
|
|
9
|
+
React.createElement(
|
|
10
|
+
'bds-accordion-item',
|
|
11
|
+
null,
|
|
12
|
+
React.createElement('span', { slot: 'header' }, 'What is a web component?'),
|
|
13
|
+
React.createElement('p', { style: { margin: 0 } }, 'A web component is a reusable custom element built with native web platform APIs — no framework required.'),
|
|
14
|
+
),
|
|
15
|
+
React.createElement(
|
|
16
|
+
'bds-accordion-item',
|
|
17
|
+
null,
|
|
18
|
+
React.createElement('span', { slot: 'header' }, 'How do I use it?'),
|
|
19
|
+
React.createElement('p', { style: { margin: 0 } }, 'Import the package and add the custom element tag to your HTML. Works in any framework.'),
|
|
20
|
+
),
|
|
21
|
+
React.createElement(
|
|
22
|
+
'bds-accordion-item',
|
|
23
|
+
null,
|
|
24
|
+
React.createElement('span', { slot: 'header' }, 'Is it accessible?'),
|
|
25
|
+
React.createElement('p', { style: { margin: 0 } }, 'Yes. Each item uses proper ARIA attributes: aria-expanded, aria-controls, and aria-labelledby.'),
|
|
26
|
+
),
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const meta = {
|
|
31
|
+
title: 'Web Components/Interaction/Accordion',
|
|
32
|
+
component: BdsAccordion,
|
|
33
|
+
tags: ['!stable', 'experimental'],
|
|
34
|
+
parameters: { layout: 'padded' },
|
|
35
|
+
argTypes: {
|
|
36
|
+
allowMultiple: { control: 'boolean' },
|
|
37
|
+
},
|
|
38
|
+
} satisfies Meta<typeof BdsAccordion>;
|
|
39
|
+
|
|
40
|
+
export default meta;
|
|
41
|
+
type Story = StoryObj<typeof meta>;
|
|
42
|
+
|
|
43
|
+
export const Default: Story = { args: { allowMultiple: false } };
|
|
44
|
+
export const AllowMultiple: Story = { args: { allowMultiple: true } };
|
|
45
|
+
|
|
46
|
+
export const WithDisabledItem: Story = {
|
|
47
|
+
render: () =>
|
|
48
|
+
React.createElement(
|
|
49
|
+
'bds-accordion',
|
|
50
|
+
null,
|
|
51
|
+
React.createElement(
|
|
52
|
+
'bds-accordion-item',
|
|
53
|
+
null,
|
|
54
|
+
React.createElement('span', { slot: 'header' }, 'Available item'),
|
|
55
|
+
React.createElement('p', { style: { margin: 0 } }, 'This item can be opened and closed.'),
|
|
56
|
+
),
|
|
57
|
+
React.createElement(
|
|
58
|
+
'bds-accordion-item',
|
|
59
|
+
{ disabled: true },
|
|
60
|
+
React.createElement('span', { slot: 'header' }, 'Disabled item'),
|
|
61
|
+
React.createElement('p', { style: { margin: 0 } }, 'This item cannot be toggled.'),
|
|
62
|
+
),
|
|
63
|
+
React.createElement(
|
|
64
|
+
'bds-accordion-item',
|
|
65
|
+
null,
|
|
66
|
+
React.createElement('span', { slot: 'header' }, 'Another available item'),
|
|
67
|
+
React.createElement('p', { style: { margin: 0 } }, 'This item can also be opened.'),
|
|
68
|
+
),
|
|
69
|
+
),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const AllVariants: Story = {
|
|
73
|
+
render: () => (
|
|
74
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '24px' }}>
|
|
75
|
+
<div>
|
|
76
|
+
<p style={{ margin: '0 0 8px', fontSize: '0.75rem', color: '#888', fontWeight: 600 }}>Single open (default)</p>
|
|
77
|
+
<BdsAccordion />
|
|
78
|
+
</div>
|
|
79
|
+
<div>
|
|
80
|
+
<p style={{ margin: '0 0 8px', fontSize: '0.75rem', color: '#888', fontWeight: 600 }}>Multiple open</p>
|
|
81
|
+
<BdsAccordion allowMultiple />
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
),
|
|
85
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsCollapsible.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# Collapsible
|
|
7
|
+
|
|
8
|
+
`<bds-collapsible>` reveals or hides content on demand. Built on native `<details>/<summary>` semantics for built-in accessibility. Set the same `name` on multiple collapsibles to link them — opening one will close the others.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<bds-collapsible>
|
|
14
|
+
<span slot="summary">Show more</span>
|
|
15
|
+
<p>Hidden content revealed on click.</p>
|
|
16
|
+
</bds-collapsible>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Attributes
|
|
20
|
+
|
|
21
|
+
| Attribute | Type | Default | Description |
|
|
22
|
+
|-----------|-----------|-------------|----------------------------------------------|
|
|
23
|
+
| `open` | `boolean` | `false` | Controls the open/closed state |
|
|
24
|
+
| `name` | `string` | `undefined` | Links collapsibles into a mutually-exclusive group |
|
|
25
|
+
|
|
26
|
+
## Slots
|
|
27
|
+
|
|
28
|
+
| Slot | Description |
|
|
29
|
+
|-----------|----------------------------------|
|
|
30
|
+
| `summary` | The always-visible clickable label |
|
|
31
|
+
| (default) | The collapsible body content |
|
|
32
|
+
|
|
33
|
+
## Events
|
|
34
|
+
|
|
35
|
+
| Event | Detail | Description |
|
|
36
|
+
|--------------|---------------------------------|--------------------------------|
|
|
37
|
+
| `bds-toggle` | `{ open: boolean }` | Fired when open state changes |
|
|
38
|
+
|
|
39
|
+
## Stories
|
|
40
|
+
|
|
41
|
+
<Canvas of={Stories.Default} />
|
|
42
|
+
<Canvas of={Stories.Grouped} />
|
|
43
|
+
|
|
44
|
+
## Controls
|
|
45
|
+
|
|
46
|
+
<ArgTypes of={Stories} />
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../index';
|
|
4
|
+
|
|
5
|
+
function BdsCollapsible({
|
|
6
|
+
open,
|
|
7
|
+
name,
|
|
8
|
+
summary,
|
|
9
|
+
children,
|
|
10
|
+
onToggle,
|
|
11
|
+
}: {
|
|
12
|
+
open?: boolean;
|
|
13
|
+
name?: string;
|
|
14
|
+
summary?: string;
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
onToggle?: (e: Event) => void;
|
|
17
|
+
}) {
|
|
18
|
+
return React.createElement(
|
|
19
|
+
'bds-collapsible',
|
|
20
|
+
{ open: open || undefined, name, onbdstoggle: onToggle },
|
|
21
|
+
React.createElement('span', { slot: 'summary' }, summary ?? 'Toggle section'),
|
|
22
|
+
children ?? React.createElement('p', { style: { margin: 0 } }, 'Collapsible content goes here.'),
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const meta = {
|
|
27
|
+
title: 'Web Components/Interaction/Collapsible',
|
|
28
|
+
component: BdsCollapsible,
|
|
29
|
+
tags: ['!stable', 'experimental'],
|
|
30
|
+
parameters: { layout: 'padded' },
|
|
31
|
+
argTypes: {
|
|
32
|
+
open: { control: 'boolean' },
|
|
33
|
+
},
|
|
34
|
+
} satisfies Meta<typeof BdsCollapsible>;
|
|
35
|
+
|
|
36
|
+
export default meta;
|
|
37
|
+
type Story = StoryObj<typeof meta>;
|
|
38
|
+
|
|
39
|
+
export const Default: Story = { args: { summary: 'Show more details' } };
|
|
40
|
+
export const OpenByDefault: Story = { args: { summary: 'Open by default', open: true } };
|
|
41
|
+
|
|
42
|
+
export const Grouped: Story = {
|
|
43
|
+
render: () => (
|
|
44
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px', maxWidth: '480px' }}>
|
|
45
|
+
<BdsCollapsible name="faq" summary="What is this component?">
|
|
46
|
+
<p style={{ margin: 0 }}>A Collapsible reveals or hides content on demand.</p>
|
|
47
|
+
</BdsCollapsible>
|
|
48
|
+
<BdsCollapsible name="faq" summary="How does grouping work?">
|
|
49
|
+
<p style={{ margin: 0 }}>Setting the same `name` on multiple collapsibles links them — opening one closes the others.</p>
|
|
50
|
+
</BdsCollapsible>
|
|
51
|
+
<BdsCollapsible name="faq" summary="Is it accessible?">
|
|
52
|
+
<p style={{ margin: 0 }}>Yes — built on native `<details>/<summary>` semantics.</p>
|
|
53
|
+
</BdsCollapsible>
|
|
54
|
+
</div>
|
|
55
|
+
),
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const AllVariants: Story = {
|
|
59
|
+
render: () => (
|
|
60
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px', maxWidth: '480px' }}>
|
|
61
|
+
<BdsCollapsible summary="Closed by default">
|
|
62
|
+
<p style={{ margin: 0 }}>This starts closed.</p>
|
|
63
|
+
</BdsCollapsible>
|
|
64
|
+
<BdsCollapsible summary="Open by default" open>
|
|
65
|
+
<p style={{ margin: 0 }}>This starts open.</p>
|
|
66
|
+
</BdsCollapsible>
|
|
67
|
+
</div>
|
|
68
|
+
),
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const Interactive: Story = {
|
|
72
|
+
render: () => {
|
|
73
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
74
|
+
return (
|
|
75
|
+
<div style={{ maxWidth: '480px' }}>
|
|
76
|
+
<p style={{ margin: '0 0 8px', fontSize: '0.875rem' }}>State: {isOpen ? 'open' : 'closed'}</p>
|
|
77
|
+
<BdsCollapsible
|
|
78
|
+
summary="Controlled collapsible"
|
|
79
|
+
open={isOpen}
|
|
80
|
+
onToggle={(e: Event) => setIsOpen((e as CustomEvent<{ open: boolean }>).detail.open)}
|
|
81
|
+
>
|
|
82
|
+
<p style={{ margin: 0 }}>Controlled via React state. The bds-toggle event updates the parent.</p>
|
|
83
|
+
</BdsCollapsible>
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
},
|
|
87
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsDialog.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# Dialog
|
|
7
|
+
|
|
8
|
+
`<bds-dialog>` is a modal dialog built on the native `<dialog>` element. It traps focus while open, dismisses on Escape and backdrop click, and restores focus to the trigger element on close. Supports the native Invoker Commands API.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<bds-dialog id="my-dialog">
|
|
14
|
+
<h2>Dialog title</h2>
|
|
15
|
+
<p>Dialog body content.</p>
|
|
16
|
+
<button type="button">Close</button>
|
|
17
|
+
</bds-dialog>
|
|
18
|
+
|
|
19
|
+
<!-- Declarative open via Invoker API -->
|
|
20
|
+
<button type="button" commandfor="my-dialog" command="show-modal">Open</button>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Attributes
|
|
24
|
+
|
|
25
|
+
| Attribute | Type | Default | Description |
|
|
26
|
+
|-----------|-----------|---------|-----------------------------|
|
|
27
|
+
| `open` | `boolean` | `false` | Controls the open state |
|
|
28
|
+
|
|
29
|
+
## Events
|
|
30
|
+
|
|
31
|
+
| Event | Description |
|
|
32
|
+
|-------------|---------------------------------------|
|
|
33
|
+
| `bds-open` | Fired when the dialog opens |
|
|
34
|
+
| `bds-close` | Fired when the dialog closes |
|
|
35
|
+
|
|
36
|
+
## Slots
|
|
37
|
+
|
|
38
|
+
| Slot | Description |
|
|
39
|
+
|-----------|-------------------------------------|
|
|
40
|
+
| (default) | Dialog content (title, body, actions) |
|
|
41
|
+
|
|
42
|
+
## Stories
|
|
43
|
+
|
|
44
|
+
<Canvas of={Stories.Default} />
|
|
45
|
+
<Canvas of={Stories.InvokerAPI} />
|
|
46
|
+
|
|
47
|
+
## Controls
|
|
48
|
+
|
|
49
|
+
<ArgTypes of={Stories} />
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../index';
|
|
4
|
+
|
|
5
|
+
function DialogDemo({ title = 'Dialog title', withForm = false }: { title?: string; withForm?: boolean }) {
|
|
6
|
+
const [open, setOpen] = React.useState(false);
|
|
7
|
+
return (
|
|
8
|
+
<div>
|
|
9
|
+
<button type="button" onClick={() => setOpen(true)}>Open dialog</button>
|
|
10
|
+
{React.createElement(
|
|
11
|
+
'bds-dialog',
|
|
12
|
+
{ open: open || undefined, onbdsclose: () => setOpen(false) },
|
|
13
|
+
React.createElement('h2', { style: { margin: '0 0 12px' } }, title),
|
|
14
|
+
withForm
|
|
15
|
+
? React.createElement(
|
|
16
|
+
'form',
|
|
17
|
+
{ style: { display: 'flex', flexDirection: 'column', gap: '12px' } },
|
|
18
|
+
React.createElement('label', null,
|
|
19
|
+
'Name',
|
|
20
|
+
React.createElement('input', { type: 'text', placeholder: 'Your name', style: { display: 'block', width: '100%', marginTop: '4px' } }),
|
|
21
|
+
),
|
|
22
|
+
React.createElement('label', null,
|
|
23
|
+
'Email',
|
|
24
|
+
React.createElement('input', { type: 'email', placeholder: 'you@example.com', style: { display: 'block', width: '100%', marginTop: '4px' } }),
|
|
25
|
+
),
|
|
26
|
+
)
|
|
27
|
+
: React.createElement('p', { style: { margin: '0 0 12px' } }, 'This is the dialog body. Press Escape or click the × button to close.'),
|
|
28
|
+
React.createElement(
|
|
29
|
+
'div',
|
|
30
|
+
{ style: { display: 'flex', gap: '8px', justifyContent: 'flex-end', marginTop: '12px' } },
|
|
31
|
+
React.createElement('button', { type: 'button', onClick: () => setOpen(false) }, 'Cancel'),
|
|
32
|
+
React.createElement('button', { type: 'button', onClick: () => setOpen(false) }, 'Confirm'),
|
|
33
|
+
),
|
|
34
|
+
)}
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function BdsDialogStory({ withForm }: { withForm?: boolean }) {
|
|
40
|
+
return React.createElement(DialogDemo, { withForm });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const meta = {
|
|
44
|
+
title: 'Web Components/Interaction/Dialog',
|
|
45
|
+
component: BdsDialogStory,
|
|
46
|
+
tags: ['!stable', 'experimental'],
|
|
47
|
+
parameters: { layout: 'centered' },
|
|
48
|
+
} satisfies Meta<typeof BdsDialogStory>;
|
|
49
|
+
|
|
50
|
+
export default meta;
|
|
51
|
+
type Story = StoryObj<typeof meta>;
|
|
52
|
+
|
|
53
|
+
export const Default: Story = { args: { withForm: false } };
|
|
54
|
+
export const WithForm: Story = { args: { withForm: true } };
|
|
55
|
+
|
|
56
|
+
export const InvokerAPI: Story = {
|
|
57
|
+
render: () => (
|
|
58
|
+
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '16px' }}>
|
|
59
|
+
<p style={{ margin: 0, fontSize: '0.875rem', color: '#666' }}>
|
|
60
|
+
Uses native Invoker Commands API — no JavaScript needed.
|
|
61
|
+
</p>
|
|
62
|
+
{React.createElement('button', { type: 'button', commandfor: 'invoker-dialog', command: 'show-modal' }, 'Open via commandfor')}
|
|
63
|
+
{React.createElement(
|
|
64
|
+
'bds-dialog',
|
|
65
|
+
{ id: 'invoker-dialog' },
|
|
66
|
+
React.createElement('h2', { style: { margin: '0 0 12px' } }, 'Opened via Invoker API'),
|
|
67
|
+
React.createElement('p', { style: { margin: 0 } }, 'This dialog was opened declaratively using commandfor and command attributes.'),
|
|
68
|
+
)}
|
|
69
|
+
</div>
|
|
70
|
+
),
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const AllVariants: Story = {
|
|
74
|
+
render: () => React.createElement(DialogDemo, { title: 'Confirmation' }),
|
|
75
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsDrawer.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# Drawer
|
|
7
|
+
|
|
8
|
+
`<bds-drawer>` is a slide-in side panel built on the native `<dialog>` element. It uses the same modal infrastructure as `<bds-dialog>` but positions itself at the edge of the viewport. Supports the native Invoker Commands API.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<bds-drawer id="settings-drawer" side="right">
|
|
14
|
+
<span slot="title">Settings</span>
|
|
15
|
+
<p>Drawer body content.</p>
|
|
16
|
+
</bds-drawer>
|
|
17
|
+
|
|
18
|
+
<!-- Declarative open via Invoker API -->
|
|
19
|
+
<button type="button" commandfor="settings-drawer" command="show-modal">Open settings</button>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Attributes
|
|
23
|
+
|
|
24
|
+
| Attribute | Type | Default | Description |
|
|
25
|
+
|-----------|-------------------------|-----------|-------------------------------|
|
|
26
|
+
| `open` | `boolean` | `false` | Controls the open state |
|
|
27
|
+
| `side` | `"left" \| "right"` | `"right"` | Which side the drawer slides in from |
|
|
28
|
+
|
|
29
|
+
## Slots
|
|
30
|
+
|
|
31
|
+
| Slot | Description |
|
|
32
|
+
|-----------|----------------------------------|
|
|
33
|
+
| `title` | Drawer title text in the header |
|
|
34
|
+
| (default) | Drawer body content |
|
|
35
|
+
|
|
36
|
+
## Events
|
|
37
|
+
|
|
38
|
+
| Event | Description |
|
|
39
|
+
|-------------|---------------------------------|
|
|
40
|
+
| `bds-open` | Fired when the drawer opens |
|
|
41
|
+
| `bds-close` | Fired when the drawer closes |
|
|
42
|
+
|
|
43
|
+
## Stories
|
|
44
|
+
|
|
45
|
+
<Canvas of={Stories.Right} />
|
|
46
|
+
<Canvas of={Stories.InvokerAPI} />
|
|
47
|
+
|
|
48
|
+
## Controls
|
|
49
|
+
|
|
50
|
+
<ArgTypes of={Stories} />
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import type { DrawerSide } from './bds-drawer';
|
|
4
|
+
import '../index';
|
|
5
|
+
|
|
6
|
+
function DrawerDemo({ side = 'right' }: { side?: DrawerSide }) {
|
|
7
|
+
const [open, setOpen] = React.useState(false);
|
|
8
|
+
return (
|
|
9
|
+
<div>
|
|
10
|
+
<button type="button" onClick={() => setOpen(true)}>Open drawer</button>
|
|
11
|
+
{React.createElement(
|
|
12
|
+
'bds-drawer',
|
|
13
|
+
{ open: open || undefined, side, onbdsclose: () => setOpen(false) },
|
|
14
|
+
React.createElement('span', { slot: 'title' }, side === 'left' ? 'Left Drawer' : 'Settings'),
|
|
15
|
+
React.createElement('p', { style: { margin: '0 0 12px' } }, 'Drawer content goes here. Press Escape or click × to close.'),
|
|
16
|
+
React.createElement('button', { type: 'button', onClick: () => setOpen(false) }, 'Close'),
|
|
17
|
+
)}
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function BdsDrawer({ side }: { side?: DrawerSide }) {
|
|
23
|
+
return React.createElement(DrawerDemo, { side });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const meta = {
|
|
27
|
+
title: 'Web Components/Interaction/Drawer',
|
|
28
|
+
component: BdsDrawer,
|
|
29
|
+
tags: ['!stable', 'experimental'],
|
|
30
|
+
parameters: { layout: 'centered' },
|
|
31
|
+
argTypes: {
|
|
32
|
+
side: { control: 'select', options: ['left', 'right'] },
|
|
33
|
+
},
|
|
34
|
+
} satisfies Meta<typeof BdsDrawer>;
|
|
35
|
+
|
|
36
|
+
export default meta;
|
|
37
|
+
type Story = StoryObj<typeof meta>;
|
|
38
|
+
|
|
39
|
+
export const Right: Story = { args: { side: 'right' } };
|
|
40
|
+
export const Left: Story = { args: { side: 'left' } };
|
|
41
|
+
|
|
42
|
+
export const AllVariants: Story = {
|
|
43
|
+
render: () => (
|
|
44
|
+
<div style={{ display: 'flex', gap: '12px' }}>
|
|
45
|
+
<DrawerDemo side="right" />
|
|
46
|
+
<DrawerDemo side="left" />
|
|
47
|
+
</div>
|
|
48
|
+
),
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const InvokerAPI: Story = {
|
|
52
|
+
render: () => (
|
|
53
|
+
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '16px' }}>
|
|
54
|
+
<p style={{ margin: 0, fontSize: '0.875rem', color: '#666' }}>
|
|
55
|
+
Uses native Invoker Commands API — no JavaScript needed.
|
|
56
|
+
</p>
|
|
57
|
+
{React.createElement('button', { type: 'button', commandfor: 'invoker-drawer', command: 'show-modal' }, 'Open via commandfor')}
|
|
58
|
+
{React.createElement(
|
|
59
|
+
'bds-drawer',
|
|
60
|
+
{ id: 'invoker-drawer', side: 'right' },
|
|
61
|
+
React.createElement('span', { slot: 'title' }, 'Opened via Invoker API'),
|
|
62
|
+
React.createElement('p', { style: { margin: 0 } }, 'This drawer was opened declaratively using commandfor and command attributes.'),
|
|
63
|
+
)}
|
|
64
|
+
</div>
|
|
65
|
+
),
|
|
66
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsSkipLink.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# Skip Link
|
|
7
|
+
|
|
8
|
+
`<bds-skip-link>` renders a visually hidden anchor that becomes visible on focus, allowing keyboard users to skip directly to the main content. This is a critical accessibility component that should be the first focusable element on every page.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<bds-skip-link href="#main-content">Skip to main content</bds-skip-link>
|
|
14
|
+
<!-- ... navigation ... -->
|
|
15
|
+
<main id="main-content">...</main>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Attributes
|
|
19
|
+
|
|
20
|
+
| Attribute | Type | Default | Description |
|
|
21
|
+
|-----------|----------|---------|----------------------------------------|
|
|
22
|
+
| `href` | `string` | `""` | Target anchor ID (e.g. `#main-content`) |
|
|
23
|
+
|
|
24
|
+
## Slots
|
|
25
|
+
|
|
26
|
+
| Slot | Description |
|
|
27
|
+
|-----------|--------------------------|
|
|
28
|
+
| (default) | The visible link text |
|
|
29
|
+
|
|
30
|
+
## Notes
|
|
31
|
+
|
|
32
|
+
- The link is visually hidden until it receives keyboard focus (Tab key)
|
|
33
|
+
- Place it as the very first element inside `<body>` before any navigation
|
|
34
|
+
- The `href` must point to an `id` on the main content container
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../index';
|
|
4
|
+
|
|
5
|
+
function BdsSkipLink({ href, children }: { href?: string; children?: React.ReactNode }) {
|
|
6
|
+
return React.createElement('bds-skip-link', { href }, children);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const meta = {
|
|
10
|
+
title: 'Web Components/Interaction/SkipLink',
|
|
11
|
+
component: BdsSkipLink,
|
|
12
|
+
tags: ['!stable', 'experimental'],
|
|
13
|
+
parameters: { layout: 'padded' },
|
|
14
|
+
} satisfies Meta<typeof BdsSkipLink>;
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story = StoryObj<typeof meta>;
|
|
18
|
+
|
|
19
|
+
export const Default: Story = {
|
|
20
|
+
render: () => (
|
|
21
|
+
<div style={{ position: 'relative', minHeight: '80px', border: '1px dashed #ccc', padding: '8px' }}>
|
|
22
|
+
<p style={{ margin: '0 0 8px', fontSize: '0.75rem', color: '#888' }}>
|
|
23
|
+
Tab into this area to reveal the skip link
|
|
24
|
+
</p>
|
|
25
|
+
<BdsSkipLink href="#main">Skip to main content</BdsSkipLink>
|
|
26
|
+
<p style={{ margin: '8px 0 0', fontSize: '0.875rem' }}>Press Tab to focus the skip link above</p>
|
|
27
|
+
</div>
|
|
28
|
+
),
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const CustomTarget: Story = {
|
|
32
|
+
render: () => (
|
|
33
|
+
<div style={{ position: 'relative', minHeight: '80px' }}>
|
|
34
|
+
<BdsSkipLink href="#main-content">Skip to main content</BdsSkipLink>
|
|
35
|
+
</div>
|
|
36
|
+
),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const CustomLabel: Story = {
|
|
40
|
+
render: () => (
|
|
41
|
+
<div style={{ position: 'relative', minHeight: '80px' }}>
|
|
42
|
+
<BdsSkipLink href="#content">Jump to content</BdsSkipLink>
|
|
43
|
+
</div>
|
|
44
|
+
),
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const AllVariants: Story = {
|
|
48
|
+
render: () => (
|
|
49
|
+
<div style={{ position: 'relative', minHeight: '120px', display: 'flex', flexDirection: 'column', gap: '8px' }}>
|
|
50
|
+
<p style={{ margin: 0, fontSize: '0.75rem', color: '#888' }}>Tab to reveal — visually hidden until focused</p>
|
|
51
|
+
<BdsSkipLink href="#main">Skip to main content</BdsSkipLink>
|
|
52
|
+
<BdsSkipLink href="#nav">Skip to navigation</BdsSkipLink>
|
|
53
|
+
</div>
|
|
54
|
+
),
|
|
55
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsTabs.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# Tabs
|
|
7
|
+
|
|
8
|
+
`<bds-tabs>` provides a tabbed interface. Place `<bds-tab>` elements in the `tab` slot and matching `<bds-tab-panel>` elements in the `panel` slot. Tabs and panels are associated by order.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<bds-tabs>
|
|
14
|
+
<bds-tab slot="tab">Overview</bds-tab>
|
|
15
|
+
<bds-tab slot="tab">Details</bds-tab>
|
|
16
|
+
<bds-tab-panel slot="panel">
|
|
17
|
+
<p>Overview content.</p>
|
|
18
|
+
</bds-tab-panel>
|
|
19
|
+
<bds-tab-panel slot="panel">
|
|
20
|
+
<p>Details content.</p>
|
|
21
|
+
</bds-tab-panel>
|
|
22
|
+
</bds-tabs>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Attributes — `<bds-tab>`
|
|
26
|
+
|
|
27
|
+
| Attribute | Type | Default | Description |
|
|
28
|
+
|------------|-----------|---------|---------------------------|
|
|
29
|
+
| `disabled` | `boolean` | `false` | Prevents selecting this tab |
|
|
30
|
+
|
|
31
|
+
## Keyboard Navigation
|
|
32
|
+
|
|
33
|
+
| Key | Action |
|
|
34
|
+
|-------------|-------------------------|
|
|
35
|
+
| `ArrowLeft` | Move to previous tab |
|
|
36
|
+
| `ArrowRight`| Move to next tab |
|
|
37
|
+
| `Home` | Move to first tab |
|
|
38
|
+
| `End` | Move to last tab |
|
|
39
|
+
|
|
40
|
+
## Stories
|
|
41
|
+
|
|
42
|
+
<Canvas of={Stories.Default} />
|
|
43
|
+
<Canvas of={Stories.AllVariants} />
|
|
44
|
+
|
|
45
|
+
## Controls
|
|
46
|
+
|
|
47
|
+
<ArgTypes of={Stories} />
|