@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,79 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../index';
|
|
4
|
+
|
|
5
|
+
function BdsDescriptionList({
|
|
6
|
+
layout,
|
|
7
|
+
children,
|
|
8
|
+
}: {
|
|
9
|
+
layout?: 'stacked' | 'inline';
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}) {
|
|
12
|
+
return React.createElement('bds-description-list', { layout }, children);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const meta = {
|
|
16
|
+
title: 'Web Components/UI/DescriptionList',
|
|
17
|
+
component: BdsDescriptionList,
|
|
18
|
+
tags: ['!stable', 'experimental'],
|
|
19
|
+
parameters: { layout: 'centered' },
|
|
20
|
+
argTypes: {
|
|
21
|
+
layout: { control: 'select', options: ['stacked', 'inline'] },
|
|
22
|
+
},
|
|
23
|
+
} satisfies Meta<typeof BdsDescriptionList>;
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<typeof meta>;
|
|
27
|
+
|
|
28
|
+
const items = [
|
|
29
|
+
{ term: 'Name', detail: 'Jane Doe' },
|
|
30
|
+
{ term: 'Email', detail: 'jane@example.com' },
|
|
31
|
+
{ term: 'Role', detail: 'Designer' },
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
export const Stacked: Story = {
|
|
35
|
+
render: () => (
|
|
36
|
+
<BdsDescriptionList layout="stacked">
|
|
37
|
+
{items.flatMap(({ term, detail }) => [
|
|
38
|
+
React.createElement('dt', { key: `dt-${term}` }, term),
|
|
39
|
+
React.createElement('dd', { key: `dd-${term}` }, detail),
|
|
40
|
+
])}
|
|
41
|
+
</BdsDescriptionList>
|
|
42
|
+
),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const Inline: Story = {
|
|
46
|
+
render: () => (
|
|
47
|
+
<BdsDescriptionList layout="inline">
|
|
48
|
+
{items.flatMap(({ term, detail }) => [
|
|
49
|
+
React.createElement('dt', { key: `dt-${term}` }, term),
|
|
50
|
+
React.createElement('dd', { key: `dd-${term}` }, detail),
|
|
51
|
+
])}
|
|
52
|
+
</BdsDescriptionList>
|
|
53
|
+
),
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const AllVariants: Story = {
|
|
57
|
+
render: () => (
|
|
58
|
+
<div style={{ display: 'flex', gap: '48px', flexWrap: 'wrap', alignItems: 'flex-start' }}>
|
|
59
|
+
<div>
|
|
60
|
+
<p style={{ margin: '0 0 8px', fontSize: '0.75rem', color: '#888', fontWeight: 600 }}>Stacked</p>
|
|
61
|
+
<BdsDescriptionList layout="stacked">
|
|
62
|
+
{items.flatMap(({ term, detail }) => [
|
|
63
|
+
React.createElement('dt', { key: `dt-${term}` }, term),
|
|
64
|
+
React.createElement('dd', { key: `dd-${term}` }, detail),
|
|
65
|
+
])}
|
|
66
|
+
</BdsDescriptionList>
|
|
67
|
+
</div>
|
|
68
|
+
<div>
|
|
69
|
+
<p style={{ margin: '0 0 8px', fontSize: '0.75rem', color: '#888', fontWeight: 600 }}>Inline</p>
|
|
70
|
+
<BdsDescriptionList layout="inline">
|
|
71
|
+
{items.flatMap(({ term, detail }) => [
|
|
72
|
+
React.createElement('dt', { key: `dt-${term}` }, term),
|
|
73
|
+
React.createElement('dd', { key: `dd-${term}` }, detail),
|
|
74
|
+
])}
|
|
75
|
+
</BdsDescriptionList>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
),
|
|
79
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsIconWrapper.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# <bds-icon-wrapper>
|
|
7
|
+
|
|
8
|
+
Framework-agnostic Icon Wrapper custom element. Displays an icon inside a circular container with background and foreground theming.
|
|
9
|
+
|
|
10
|
+
> **Status: experimental** — API may change before stable release.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import '@boostdev/components/web-components';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
19
|
+
|
|
20
|
+
### All variants
|
|
21
|
+
<Canvas of={Stories.AllVariants} />
|
|
22
|
+
|
|
23
|
+
### With star icon
|
|
24
|
+
<Canvas of={Stories.WithStar} />
|
|
25
|
+
|
|
26
|
+
## Props
|
|
27
|
+
|
|
28
|
+
<ArgTypes of={Stories} />
|
|
29
|
+
|
|
30
|
+
## Attributes
|
|
31
|
+
|
|
32
|
+
| Attribute | Type | Default | Description |
|
|
33
|
+
|-----------|------|---------|-------------|
|
|
34
|
+
| `aria-hidden` | string | — | Set to `"true"` for purely decorative icons |
|
|
35
|
+
|
|
36
|
+
## Slots
|
|
37
|
+
|
|
38
|
+
| Slot | Description |
|
|
39
|
+
|------|-------------|
|
|
40
|
+
| `(default)` | Icon content (SVG or `<img>`) |
|
|
41
|
+
|
|
42
|
+
## CSS Custom Properties
|
|
43
|
+
|
|
44
|
+
| Property | Description |
|
|
45
|
+
|----------|-------------|
|
|
46
|
+
| `--icon-wrapper-color` | Circle background colour |
|
|
47
|
+
| `--bds-on-icon-wrapper-color` | Icon fill/stroke colour |
|
|
48
|
+
|
|
49
|
+
## Usage in plain HTML
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<!-- Decorative icon -->
|
|
53
|
+
<bds-icon-wrapper aria-hidden="true">
|
|
54
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
55
|
+
<path d="M12 17.27L18.18 21..."/>
|
|
56
|
+
</svg>
|
|
57
|
+
</bds-icon-wrapper>
|
|
58
|
+
|
|
59
|
+
<!-- Meaningful icon — add aria-label to the wrapper -->
|
|
60
|
+
<bds-icon-wrapper aria-label="Favourite">
|
|
61
|
+
<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
62
|
+
<path d="M12 21.593c..."/>
|
|
63
|
+
</svg>
|
|
64
|
+
</bds-icon-wrapper>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Accessibility
|
|
68
|
+
|
|
69
|
+
- When the icon is decorative, set `aria-hidden="true"` on the host
|
|
70
|
+
- When the icon conveys meaning, set `aria-label` on the host and `aria-hidden="true"` on the SVG itself
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../index';
|
|
4
|
+
|
|
5
|
+
const StarIcon = () =>
|
|
6
|
+
React.createElement(
|
|
7
|
+
'svg',
|
|
8
|
+
{ viewBox: '0 0 24 24', fill: 'currentColor', width: '1.25em', height: '1.25em', 'aria-hidden': 'true' },
|
|
9
|
+
React.createElement('path', {
|
|
10
|
+
d: 'M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z',
|
|
11
|
+
}),
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const CheckIcon = () =>
|
|
15
|
+
React.createElement(
|
|
16
|
+
'svg',
|
|
17
|
+
{ viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2.5', width: '1.25em', height: '1.25em', 'aria-hidden': 'true' },
|
|
18
|
+
React.createElement('path', { strokeLinecap: 'round', strokeLinejoin: 'round', d: 'M5 13l4 4L19 7' }),
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const HeartIcon = () =>
|
|
22
|
+
React.createElement(
|
|
23
|
+
'svg',
|
|
24
|
+
{ viewBox: '0 0 24 24', fill: 'currentColor', width: '1.25em', height: '1.25em', 'aria-hidden': 'true' },
|
|
25
|
+
React.createElement('path', {
|
|
26
|
+
d: 'M12 21.593c-.425-.052-8.092-5.65-8.092-10.82C3.908 6.64 7.084 4 10.408 4c1.75 0 3.192.806 4.175 2.016A5.355 5.355 0 0 1 18.175 4c3.324 0 6.5 2.64 6.5 6.773 0 5.17-7.667 10.768-8.092 10.82z',
|
|
27
|
+
}),
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
function BdsIconWrapper({ children }: { children?: React.ReactNode }) {
|
|
31
|
+
return React.createElement('bds-icon-wrapper', null, children);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const meta = {
|
|
35
|
+
title: 'Web Components/UI/IconWrapper',
|
|
36
|
+
component: BdsIconWrapper,
|
|
37
|
+
tags: ['!stable', 'experimental'],
|
|
38
|
+
parameters: { layout: 'centered' },
|
|
39
|
+
} satisfies Meta<typeof BdsIconWrapper>;
|
|
40
|
+
|
|
41
|
+
export default meta;
|
|
42
|
+
type Story = StoryObj<typeof meta>;
|
|
43
|
+
|
|
44
|
+
export const WithStar: Story = {
|
|
45
|
+
render: () => (
|
|
46
|
+
<BdsIconWrapper>
|
|
47
|
+
<StarIcon />
|
|
48
|
+
</BdsIconWrapper>
|
|
49
|
+
),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const WithCheck: Story = {
|
|
53
|
+
render: () => (
|
|
54
|
+
<BdsIconWrapper>
|
|
55
|
+
<CheckIcon />
|
|
56
|
+
</BdsIconWrapper>
|
|
57
|
+
),
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const WithHeart: Story = {
|
|
61
|
+
render: () => (
|
|
62
|
+
<BdsIconWrapper>
|
|
63
|
+
<HeartIcon />
|
|
64
|
+
</BdsIconWrapper>
|
|
65
|
+
),
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const AllVariants: Story = {
|
|
69
|
+
render: () => (
|
|
70
|
+
<div style={{ display: 'flex', gap: '16px', alignItems: 'center' }}>
|
|
71
|
+
<BdsIconWrapper><StarIcon /></BdsIconWrapper>
|
|
72
|
+
<BdsIconWrapper><CheckIcon /></BdsIconWrapper>
|
|
73
|
+
<BdsIconWrapper><HeartIcon /></BdsIconWrapper>
|
|
74
|
+
</div>
|
|
75
|
+
),
|
|
76
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsLink.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# <bds-link>
|
|
7
|
+
|
|
8
|
+
Framework-agnostic Link custom element. Renders a semantic `<a>` element with three visual styles and built-in external link handling.
|
|
9
|
+
|
|
10
|
+
> **Status: experimental** — API may change before stable release.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import '@boostdev/components/web-components';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
19
|
+
|
|
20
|
+
### All variants
|
|
21
|
+
<Canvas of={Stories.AllVariants} />
|
|
22
|
+
|
|
23
|
+
### Default
|
|
24
|
+
<Canvas of={Stories.Default} />
|
|
25
|
+
|
|
26
|
+
### Standalone
|
|
27
|
+
<Canvas of={Stories.Standalone} />
|
|
28
|
+
|
|
29
|
+
### External
|
|
30
|
+
<Canvas of={Stories.External} />
|
|
31
|
+
|
|
32
|
+
## Props
|
|
33
|
+
|
|
34
|
+
<ArgTypes of={Stories} />
|
|
35
|
+
|
|
36
|
+
## Attributes
|
|
37
|
+
|
|
38
|
+
| Attribute | Type | Default | Description |
|
|
39
|
+
|-----------|------|---------|-------------|
|
|
40
|
+
| `href` | string | — | Link destination |
|
|
41
|
+
| `target` | string | — | Native anchor target |
|
|
42
|
+
| `variant` | `"default" \| "subtle" \| "standalone"` | `"default"` | Visual style |
|
|
43
|
+
| `external` | boolean | `false` | Adds `rel="noreferrer noopener"`, opens in new tab, appends screen-reader text |
|
|
44
|
+
| `external-label` | string | `"(opens in new tab)"` | Visually-hidden text appended for external links |
|
|
45
|
+
|
|
46
|
+
## Slots
|
|
47
|
+
|
|
48
|
+
| Slot | Description |
|
|
49
|
+
|------|-------------|
|
|
50
|
+
| `(default)` | Link text content |
|
|
51
|
+
|
|
52
|
+
## CSS Custom Properties
|
|
53
|
+
|
|
54
|
+
| Property | Description |
|
|
55
|
+
|----------|-------------|
|
|
56
|
+
| `--link_color` | Link text colour |
|
|
57
|
+
| `--link_color-hover` | Link colour on hover |
|
|
58
|
+
|
|
59
|
+
## Usage in plain HTML
|
|
60
|
+
|
|
61
|
+
```html
|
|
62
|
+
<bds-link href="/docs">Read the docs</bds-link>
|
|
63
|
+
|
|
64
|
+
<bds-link href="/about" variant="subtle">About us</bds-link>
|
|
65
|
+
|
|
66
|
+
<bds-link href="/get-started" variant="standalone">Get started →</bds-link>
|
|
67
|
+
|
|
68
|
+
<bds-link href="https://example.com" external>Visit site</bds-link>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Accessibility
|
|
72
|
+
|
|
73
|
+
- Renders a native `<a>` — fully keyboard accessible
|
|
74
|
+
- `external` adds a visually-hidden `(opens in new tab)` label for screen reader users and sets `rel="noreferrer noopener"` for security
|
|
75
|
+
- Always provide meaningful link text — avoid "click here" or "read more"
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import type { LinkVariant } from './bds-link';
|
|
4
|
+
import '../index';
|
|
5
|
+
|
|
6
|
+
function BdsLink({
|
|
7
|
+
href,
|
|
8
|
+
variant,
|
|
9
|
+
external,
|
|
10
|
+
externalLabel,
|
|
11
|
+
children,
|
|
12
|
+
}: {
|
|
13
|
+
href?: string;
|
|
14
|
+
variant?: LinkVariant;
|
|
15
|
+
external?: boolean;
|
|
16
|
+
externalLabel?: string;
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
}) {
|
|
19
|
+
return React.createElement(
|
|
20
|
+
'bds-link',
|
|
21
|
+
{
|
|
22
|
+
href: href ?? '#',
|
|
23
|
+
variant,
|
|
24
|
+
external: external || undefined,
|
|
25
|
+
'external-label': externalLabel,
|
|
26
|
+
},
|
|
27
|
+
children,
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const meta = {
|
|
32
|
+
title: 'Web Components/UI/Link',
|
|
33
|
+
component: BdsLink,
|
|
34
|
+
tags: ['!stable', 'experimental'],
|
|
35
|
+
parameters: { layout: 'centered' },
|
|
36
|
+
argTypes: {
|
|
37
|
+
variant: { control: 'select', options: ['default', 'subtle', 'standalone'] },
|
|
38
|
+
},
|
|
39
|
+
} satisfies Meta<typeof BdsLink>;
|
|
40
|
+
|
|
41
|
+
export default meta;
|
|
42
|
+
type Story = StoryObj<typeof meta>;
|
|
43
|
+
|
|
44
|
+
export const Default: Story = { args: { children: 'Default link', variant: 'default' } };
|
|
45
|
+
export const Subtle: Story = { args: { children: 'Subtle link', variant: 'subtle' } };
|
|
46
|
+
export const Standalone: Story = { args: { children: 'Standalone link →', variant: 'standalone' } };
|
|
47
|
+
export const External: Story = { args: { children: 'External link', variant: 'default', external: true } };
|
|
48
|
+
|
|
49
|
+
export const AllVariants: Story = {
|
|
50
|
+
render: () => (
|
|
51
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
|
52
|
+
{(['default', 'subtle', 'standalone'] as const).map(v => (
|
|
53
|
+
<div key={v} style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
|
|
54
|
+
<BdsLink variant={v}>{v.charAt(0).toUpperCase() + v.slice(1)} link</BdsLink>
|
|
55
|
+
<span style={{ fontSize: '0.75rem', color: '#888' }}>{v}</span>
|
|
56
|
+
</div>
|
|
57
|
+
))}
|
|
58
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
|
|
59
|
+
<BdsLink external>External link</BdsLink>
|
|
60
|
+
<span style={{ fontSize: '0.75rem', color: '#888' }}>external</span>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
),
|
|
64
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsLoading.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# <bds-loading>
|
|
7
|
+
|
|
8
|
+
Framework-agnostic Loading spinner custom element. Use to indicate an ongoing asynchronous operation.
|
|
9
|
+
|
|
10
|
+
> **Status: experimental** — API may change before stable release.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import '@boostdev/components/web-components';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
19
|
+
|
|
20
|
+
### All sizes
|
|
21
|
+
<Canvas of={Stories.AllVariants} />
|
|
22
|
+
|
|
23
|
+
### Small
|
|
24
|
+
<Canvas of={Stories.Small} />
|
|
25
|
+
|
|
26
|
+
### Medium
|
|
27
|
+
<Canvas of={Stories.Medium} />
|
|
28
|
+
|
|
29
|
+
### Large
|
|
30
|
+
<Canvas of={Stories.Large} />
|
|
31
|
+
|
|
32
|
+
## Props
|
|
33
|
+
|
|
34
|
+
<ArgTypes of={Stories} />
|
|
35
|
+
|
|
36
|
+
## Attributes
|
|
37
|
+
|
|
38
|
+
| Attribute | Type | Default | Description |
|
|
39
|
+
|-----------|------|---------|-------------|
|
|
40
|
+
| `size` | `"small" \| "medium" \| "large"` | `"medium"` | Spinner diameter |
|
|
41
|
+
|
|
42
|
+
## CSS Custom Properties
|
|
43
|
+
|
|
44
|
+
The spinner uses design tokens directly:
|
|
45
|
+
|
|
46
|
+
| Token | Description |
|
|
47
|
+
|-------|-------------|
|
|
48
|
+
| `--bds-color_bg` | Track colour |
|
|
49
|
+
| `--bds-color_interactive` | Active arc colour |
|
|
50
|
+
|
|
51
|
+
## Usage in plain HTML
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<bds-loading></bds-loading>
|
|
55
|
+
<bds-loading size="small"></bds-loading>
|
|
56
|
+
<bds-loading size="large"></bds-loading>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Accessibility
|
|
60
|
+
|
|
61
|
+
- Renders a `role="status"` element with `aria-label="Loading"` — screen readers announce the loading state
|
|
62
|
+
- Respects `prefers-reduced-motion`: the spin animation stops for users who prefer reduced motion
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../index';
|
|
4
|
+
|
|
5
|
+
function BdsLoading({ size }: { size?: 'small' | 'medium' | 'large' }) {
|
|
6
|
+
return React.createElement('bds-loading', { size });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const meta = {
|
|
10
|
+
title: 'Web Components/UI/Loading',
|
|
11
|
+
component: BdsLoading,
|
|
12
|
+
tags: ['!stable', 'experimental'],
|
|
13
|
+
parameters: { layout: 'centered' },
|
|
14
|
+
argTypes: {
|
|
15
|
+
size: { control: 'select', options: ['small', 'medium', 'large'] },
|
|
16
|
+
},
|
|
17
|
+
} satisfies Meta<typeof BdsLoading>;
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
|
|
22
|
+
export const Small: Story = { args: { size: 'small' } };
|
|
23
|
+
export const Medium: Story = { args: { size: 'medium' } };
|
|
24
|
+
export const Large: Story = { args: { size: 'large' } };
|
|
25
|
+
|
|
26
|
+
export const AllVariants: Story = {
|
|
27
|
+
render: () => (
|
|
28
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '32px' }}>
|
|
29
|
+
{(['small', 'medium', 'large'] as const).map(s => (
|
|
30
|
+
<div key={s} style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '8px' }}>
|
|
31
|
+
<BdsLoading size={s} />
|
|
32
|
+
<span style={{ fontSize: '0.75rem', color: '#888' }}>{s}</span>
|
|
33
|
+
</div>
|
|
34
|
+
))}
|
|
35
|
+
</div>
|
|
36
|
+
),
|
|
37
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsNotificationBanner.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# <bds-notification-banner>
|
|
7
|
+
|
|
8
|
+
Framework-agnostic full-width Notification Banner. Use for page-level messages that require user attention — system notices, maintenance windows, or status updates.
|
|
9
|
+
|
|
10
|
+
> **Status: experimental** — API may change before stable release.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import '@boostdev/components/web-components';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
19
|
+
|
|
20
|
+
### All variants
|
|
21
|
+
<Canvas of={Stories.AllVariants} />
|
|
22
|
+
|
|
23
|
+
### Dismissible
|
|
24
|
+
<Canvas of={Stories.Interactive} />
|
|
25
|
+
|
|
26
|
+
### With action
|
|
27
|
+
<Canvas of={Stories.WithAction} />
|
|
28
|
+
|
|
29
|
+
## Props
|
|
30
|
+
|
|
31
|
+
<ArgTypes of={Stories} />
|
|
32
|
+
|
|
33
|
+
## Attributes
|
|
34
|
+
|
|
35
|
+
| Attribute | Type | Default | Description |
|
|
36
|
+
|-----------|------|---------|-------------|
|
|
37
|
+
| `variant` | `"info" \| "success" \| "warning" \| "error"` | `"info"` | Semantic colour and urgency |
|
|
38
|
+
| `dismissible` | boolean | `false` | Shows a dismiss (×) button |
|
|
39
|
+
| `dismiss-label` | string | `"Dismiss notification"` | Accessible label for the dismiss button |
|
|
40
|
+
|
|
41
|
+
## Slots
|
|
42
|
+
|
|
43
|
+
| Slot | Description |
|
|
44
|
+
|------|-------------|
|
|
45
|
+
| `(default)` | Banner body content |
|
|
46
|
+
| `action` | Optional action area (e.g. a button or link) |
|
|
47
|
+
|
|
48
|
+
## Events
|
|
49
|
+
|
|
50
|
+
| Event | Detail | Bubbles | Composed | Description |
|
|
51
|
+
|-------|--------|---------|----------|-------------|
|
|
52
|
+
| `bds-dismiss` | — | Yes | Yes | Fired when the dismiss button is clicked |
|
|
53
|
+
|
|
54
|
+
## CSS Custom Properties
|
|
55
|
+
|
|
56
|
+
| Property | Description |
|
|
57
|
+
|----------|-------------|
|
|
58
|
+
| `--banner_bg` | Banner background colour |
|
|
59
|
+
| `--banner_text` | Banner text colour |
|
|
60
|
+
| `--banner_border` | Bottom border accent colour |
|
|
61
|
+
|
|
62
|
+
## Usage in plain HTML
|
|
63
|
+
|
|
64
|
+
```html
|
|
65
|
+
<bds-notification-banner variant="success">
|
|
66
|
+
Your changes have been saved.
|
|
67
|
+
</bds-notification-banner>
|
|
68
|
+
|
|
69
|
+
<bds-notification-banner variant="warning" dismissible>
|
|
70
|
+
Scheduled maintenance on Sunday.
|
|
71
|
+
</bds-notification-banner>
|
|
72
|
+
|
|
73
|
+
<bds-notification-banner variant="info">
|
|
74
|
+
New features available.
|
|
75
|
+
<button slot="action" type="button">Learn more</button>
|
|
76
|
+
</bds-notification-banner>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Listen for dismiss:
|
|
80
|
+
```js
|
|
81
|
+
document.querySelector('bds-notification-banner').addEventListener('bds-dismiss', () => {
|
|
82
|
+
// hide or remove the element
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Accessibility
|
|
87
|
+
|
|
88
|
+
- `error` and `warning` variants use `role="alert"` + `aria-live="assertive"` — announced immediately
|
|
89
|
+
- `info` and `success` variants use `role="status"` + `aria-live="polite"` — announced at next opportunity
|
|
90
|
+
- The dismiss button has an accessible label; customize with `dismiss-label` when needed
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import type { NotificationBannerVariant } from './bds-notification-banner';
|
|
4
|
+
import '../index';
|
|
5
|
+
|
|
6
|
+
function BdsNotificationBanner({
|
|
7
|
+
variant = 'info',
|
|
8
|
+
dismissible,
|
|
9
|
+
dismissLabel,
|
|
10
|
+
onDismiss,
|
|
11
|
+
action,
|
|
12
|
+
children,
|
|
13
|
+
}: {
|
|
14
|
+
variant?: NotificationBannerVariant;
|
|
15
|
+
dismissible?: boolean;
|
|
16
|
+
dismissLabel?: string;
|
|
17
|
+
onDismiss?: () => void;
|
|
18
|
+
action?: React.ReactNode;
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
}) {
|
|
21
|
+
return React.createElement(
|
|
22
|
+
'bds-notification-banner',
|
|
23
|
+
{
|
|
24
|
+
variant,
|
|
25
|
+
dismissible: dismissible || undefined,
|
|
26
|
+
'dismiss-label': dismissLabel,
|
|
27
|
+
onbdsdismiss: onDismiss,
|
|
28
|
+
},
|
|
29
|
+
children,
|
|
30
|
+
action ? React.createElement('span', { slot: 'action' }, action) : null,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const meta = {
|
|
35
|
+
title: 'Web Components/UI/NotificationBanner',
|
|
36
|
+
component: BdsNotificationBanner,
|
|
37
|
+
tags: ['!stable', 'experimental'],
|
|
38
|
+
parameters: { layout: 'padded' },
|
|
39
|
+
argTypes: {
|
|
40
|
+
variant: { control: 'select', options: ['info', 'success', 'warning', 'error'] },
|
|
41
|
+
},
|
|
42
|
+
} satisfies Meta<typeof BdsNotificationBanner>;
|
|
43
|
+
|
|
44
|
+
export default meta;
|
|
45
|
+
type Story = StoryObj<typeof meta>;
|
|
46
|
+
|
|
47
|
+
export const Info: Story = { args: { children: 'Your session will expire in 10 minutes.', variant: 'info' } };
|
|
48
|
+
export const Success: Story = { args: { children: 'Your changes have been saved.', variant: 'success' } };
|
|
49
|
+
export const Warning: Story = { args: { children: 'Scheduled maintenance on Sunday 02:00–04:00 UTC.', variant: 'warning' } };
|
|
50
|
+
export const Error: Story = { args: { children: 'Something went wrong. Please try again.', variant: 'error' } };
|
|
51
|
+
export const Dismissible: Story = { args: { children: 'This banner can be dismissed.', variant: 'info', dismissible: true } };
|
|
52
|
+
export const WithAction: Story = {
|
|
53
|
+
render: () => (
|
|
54
|
+
<BdsNotificationBanner
|
|
55
|
+
variant="warning"
|
|
56
|
+
action={React.createElement('button', { type: 'button' }, 'Learn more')}
|
|
57
|
+
>
|
|
58
|
+
New terms of service take effect on Jan 1.
|
|
59
|
+
</BdsNotificationBanner>
|
|
60
|
+
),
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const AllVariants: Story = {
|
|
64
|
+
render: () => (
|
|
65
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '0' }}>
|
|
66
|
+
{(['info', 'success', 'warning', 'error'] as const).map(v => (
|
|
67
|
+
<BdsNotificationBanner key={v} variant={v}>
|
|
68
|
+
This is a {v} notification banner.
|
|
69
|
+
</BdsNotificationBanner>
|
|
70
|
+
))}
|
|
71
|
+
</div>
|
|
72
|
+
),
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const Interactive: Story = {
|
|
76
|
+
render: () => {
|
|
77
|
+
const [visible, setVisible] = React.useState(true);
|
|
78
|
+
return (
|
|
79
|
+
<div style={{ width: '100%' }}>
|
|
80
|
+
{visible ? (
|
|
81
|
+
<BdsNotificationBanner variant="info" dismissible onDismiss={() => setVisible(false)}>
|
|
82
|
+
Click × to dismiss this banner.
|
|
83
|
+
</BdsNotificationBanner>
|
|
84
|
+
) : (
|
|
85
|
+
<div style={{ padding: '1rem', textAlign: 'center' }}>
|
|
86
|
+
<p style={{ margin: '0 0 8px' }}>Banner dismissed.</p>
|
|
87
|
+
<button onClick={() => setVisible(true)}>Show again</button>
|
|
88
|
+
</div>
|
|
89
|
+
)}
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
},
|
|
93
|
+
};
|