@boostdev/design-system-components 1.1.2 → 1.2.1
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 +38 -14
- package/dist/client.cjs +85 -103
- package/dist/client.css +610 -601
- package/dist/client.d.cts +13 -16
- package/dist/client.d.ts +13 -16
- package/dist/client.js +95 -113
- package/dist/index.cjs +85 -103
- package/dist/index.css +610 -601
- package/dist/index.d.cts +13 -16
- package/dist/index.d.ts +13 -16
- package/dist/index.js +95 -113
- 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-K5CE6HSB.js → chunk-2FGATTGT.js} +79 -17
- package/dist/web-components/{chunk-O4UFI2RX.js → chunk-3REOIRDW.js} +13 -11
- package/dist/web-components/{chunk-5IPHEONG.js → chunk-6I2DBFQ7.js} +1 -0
- package/dist/web-components/{chunk-VM3YHGQ2.js → chunk-AJSXNDAP.js} +1 -2
- package/dist/web-components/{chunk-LSC4N56Q.js → chunk-BX3IPVOB.js} +1 -2
- package/dist/web-components/{chunk-CAPI25CU.js → chunk-DZRSJGPB.js} +3 -3
- package/dist/web-components/{chunk-VSS5ITNE.js → chunk-EBJM3VD4.js} +1 -3
- package/dist/web-components/{chunk-O7I63SQX.js → chunk-HHHRF2PS.js} +6 -12
- package/dist/web-components/{chunk-OTX4COSV.js → chunk-JUKB3BUP.js} +3 -4
- package/dist/web-components/{chunk-IQGLIQSO.js → chunk-N6IMUOY4.js} +2 -5
- package/dist/web-components/{chunk-CJ5ZOO42.js → chunk-OCODKRVZ.js} +68 -44
- package/dist/web-components/{chunk-QDRH46TF.js → chunk-QLZ2362S.js} +1 -3
- package/dist/web-components/{chunk-IK3PTFZ4.js → chunk-T6AETZRP.js} +1 -3
- package/dist/web-components/{chunk-4BX6AWXX.js → chunk-X3FKVHLK.js} +2 -4
- package/dist/web-components/{chunk-A67LCT7C.js → chunk-XNA6WTXG.js} +3 -4
- package/dist/web-components/{chunk-XIENXR7H.js → chunk-YRXCVKHV.js} +1 -3
- package/dist/web-components/{chunk-6T3RKUKG.js → chunk-ZTC6GRP7.js} +1 -2
- package/dist/web-components/globals.js +1 -1
- package/dist/web-components/index.d.ts +571 -1
- package/dist/web-components/index.js +1515 -18
- package/dist/web-components/interaction/bds-accordion.js +1 -1
- package/dist/web-components/interaction/bds-button.d.ts +2 -2
- package/dist/web-components/interaction/bds-button.js +1 -1
- package/dist/web-components/interaction/bds-collapsible.js +1 -1
- package/dist/web-components/interaction/bds-dialog.js +1 -1
- package/dist/web-components/interaction/bds-drawer.js +1 -1
- package/dist/web-components/interaction/form/bds-checkbox.js +1 -1
- package/dist/web-components/interaction/form/bds-combobox.js +1 -1
- package/dist/web-components/interaction/form/bds-number-input.js +1 -1
- package/dist/web-components/interaction/form/bds-radio.js +1 -1
- package/dist/web-components/interaction/form/bds-segmented-control.d.ts +20 -3
- package/dist/web-components/interaction/form/bds-segmented-control.js +1 -1
- package/dist/web-components/interaction/form/bds-select.js +1 -1
- package/dist/web-components/interaction/form/bds-switch.js +1 -1
- package/dist/web-components/interaction/form/bds-textarea.js +1 -1
- package/dist/web-components/ui/bds-alert.js +1 -1
- package/dist/web-components/ui/bds-card.js +1 -1
- package/dist/web-components/ui/bds-notification-banner.js +1 -1
- package/package.json +2 -2
- 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 +48 -25
- package/src/components/interaction/Drawer/Drawer.tsx +21 -17
- 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 +74 -25
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.module.css +65 -36
- 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/stories/Introduction.mdx +2 -1
- package/src/web-components/globals.ts +3 -3
- package/src/web-components/index.ts +12 -0
- package/src/web-components/interaction/BdsAccordion.mdx +103 -0
- package/src/web-components/interaction/BdsAccordion.stories.tsx +94 -0
- package/src/web-components/interaction/BdsCollapsible.mdx +116 -0
- package/src/web-components/interaction/BdsCollapsible.stories.tsx +68 -0
- package/src/web-components/interaction/BdsDialog.mdx +110 -0
- package/src/web-components/interaction/BdsDialog.stories.tsx +157 -0
- package/src/web-components/interaction/BdsDrawer.mdx +108 -0
- package/src/web-components/interaction/BdsDrawer.stories.tsx +196 -0
- package/src/web-components/interaction/BdsDropdownMenu.mdx +108 -0
- package/src/web-components/interaction/BdsDropdownMenu.stories.tsx +91 -0
- package/src/web-components/interaction/BdsSkipLink.mdx +90 -0
- package/src/web-components/interaction/BdsSkipLink.stories.tsx +68 -0
- package/src/web-components/interaction/BdsTabs.mdx +117 -0
- package/src/web-components/interaction/BdsTabs.stories.tsx +94 -0
- package/src/web-components/interaction/BdsTooltip.mdx +104 -0
- package/src/web-components/interaction/BdsTooltip.stories.tsx +87 -0
- package/src/web-components/interaction/bds-accordion.ts +1 -2
- package/src/web-components/interaction/bds-button.ts +15 -13
- package/src/web-components/interaction/bds-collapsible.ts +1 -0
- package/src/web-components/interaction/bds-dialog.ts +2 -5
- package/src/web-components/interaction/bds-drawer.ts +70 -44
- package/src/web-components/interaction/bds-dropdown-menu-item.ts +124 -0
- package/src/web-components/interaction/bds-dropdown-menu.spec.ts +102 -0
- package/src/web-components/interaction/bds-dropdown-menu.ts +200 -0
- package/src/web-components/interaction/form/BdsCheckbox.mdx +76 -0
- package/src/web-components/interaction/form/BdsCheckbox.stories.tsx +72 -0
- package/src/web-components/interaction/form/BdsCheckboxGroup.mdx +70 -0
- package/src/web-components/interaction/form/BdsCheckboxGroup.stories.tsx +81 -0
- package/src/web-components/interaction/form/BdsCombobox.mdx +71 -0
- package/src/web-components/interaction/form/BdsCombobox.stories.tsx +93 -0
- package/src/web-components/interaction/form/BdsFileInput.mdx +79 -0
- package/src/web-components/interaction/form/BdsFileInput.stories.tsx +69 -0
- package/src/web-components/interaction/form/BdsFormInput.mdx +98 -0
- package/src/web-components/interaction/form/BdsFormInput.stories.tsx +139 -0
- package/src/web-components/interaction/form/BdsNumberInput.mdx +70 -0
- package/src/web-components/interaction/form/BdsNumberInput.stories.tsx +68 -0
- package/src/web-components/interaction/form/BdsRadio.mdx +72 -0
- package/src/web-components/interaction/form/BdsRadio.stories.tsx +58 -0
- package/src/web-components/interaction/form/BdsRadioGroup.mdx +73 -0
- package/src/web-components/interaction/form/BdsRadioGroup.stories.tsx +88 -0
- package/src/web-components/interaction/form/BdsSegmentedControl.mdx +95 -0
- package/src/web-components/interaction/form/BdsSegmentedControl.stories.tsx +102 -0
- package/src/web-components/interaction/form/BdsSelect.mdx +76 -0
- package/src/web-components/interaction/form/BdsSelect.stories.tsx +84 -0
- package/src/web-components/interaction/form/BdsSlider.mdx +77 -0
- package/src/web-components/interaction/form/BdsSlider.stories.tsx +68 -0
- package/src/web-components/interaction/form/BdsSwitch.mdx +72 -0
- package/src/web-components/interaction/form/BdsSwitch.stories.tsx +58 -0
- package/src/web-components/interaction/form/BdsTextarea.mdx +73 -0
- package/src/web-components/interaction/form/BdsTextarea.stories.tsx +70 -0
- package/src/web-components/interaction/form/bds-checkbox-group.spec.ts +55 -0
- package/src/web-components/interaction/form/bds-checkbox-group.ts +117 -0
- package/src/web-components/interaction/form/bds-checkbox.ts +1 -3
- package/src/web-components/interaction/form/bds-combobox.ts +1 -3
- package/src/web-components/interaction/form/bds-form-input.spec.ts +83 -0
- package/src/web-components/interaction/form/bds-form-input.ts +268 -0
- package/src/web-components/interaction/form/bds-number-input.ts +3 -4
- package/src/web-components/interaction/form/bds-radio-group.spec.ts +62 -0
- package/src/web-components/interaction/form/bds-radio-group.ts +142 -0
- package/src/web-components/interaction/form/bds-radio.ts +6 -12
- package/src/web-components/interaction/form/bds-segmented-control.ts +96 -20
- package/src/web-components/interaction/form/bds-select.ts +2 -4
- package/src/web-components/interaction/form/bds-switch.ts +3 -4
- package/src/web-components/interaction/form/bds-textarea.ts +1 -3
- package/src/web-components/ui/BdsAvatar.mdx +76 -0
- package/src/web-components/ui/BdsAvatar.stories.tsx +48 -0
- package/src/web-components/ui/BdsBreadcrumb.mdx +66 -0
- package/src/web-components/ui/BdsBreadcrumb.stories.tsx +49 -0
- package/src/web-components/ui/BdsButtonGroup.mdx +69 -0
- package/src/web-components/ui/BdsButtonGroup.stories.tsx +66 -0
- package/src/web-components/ui/BdsCalendar.mdx +93 -0
- package/src/web-components/ui/BdsCalendar.stories.tsx +63 -0
- package/src/web-components/ui/BdsCard.mdx +88 -0
- package/src/web-components/ui/BdsCard.stories.tsx +67 -0
- package/src/web-components/ui/BdsCarousel.mdx +83 -0
- package/src/web-components/ui/BdsCarousel.stories.tsx +96 -0
- package/src/web-components/ui/BdsDescriptionList.mdx +64 -0
- package/src/web-components/ui/BdsDescriptionList.stories.tsx +64 -0
- package/src/web-components/ui/BdsIconWrapper.mdx +70 -0
- package/src/web-components/ui/BdsIconWrapper.stories.tsx +81 -0
- package/src/web-components/ui/BdsLink.mdx +79 -0
- package/src/web-components/ui/BdsLink.stories.tsx +63 -0
- package/src/web-components/ui/BdsLoading.mdx +58 -0
- package/src/web-components/ui/BdsLoading.stories.tsx +35 -0
- package/src/web-components/ui/BdsNotificationBanner.mdx +85 -0
- package/src/web-components/ui/BdsNotificationBanner.stories.tsx +84 -0
- package/src/web-components/ui/BdsPagination.mdx +74 -0
- package/src/web-components/ui/BdsPagination.stories.tsx +36 -0
- package/src/web-components/ui/BdsProgress.mdx +70 -0
- package/src/web-components/ui/BdsProgress.stories.tsx +96 -0
- package/src/web-components/ui/BdsProgressCircle.mdx +70 -0
- package/src/web-components/ui/BdsProgressCircle.stories.tsx +57 -0
- package/src/web-components/ui/BdsRating.mdx +61 -0
- package/src/web-components/ui/BdsRating.stories.tsx +45 -0
- package/src/web-components/ui/BdsSectionHeader.mdx +72 -0
- package/src/web-components/ui/BdsSectionHeader.stories.tsx +54 -0
- package/src/web-components/ui/BdsSeparator.mdx +77 -0
- package/src/web-components/ui/BdsSeparator.stories.tsx +55 -0
- package/src/web-components/ui/BdsSkeleton.mdx +61 -0
- package/src/web-components/ui/BdsSkeleton.stories.tsx +50 -0
- package/src/web-components/ui/BdsTable.mdx +81 -0
- package/src/web-components/ui/BdsTable.stories.tsx +83 -0
- package/src/web-components/ui/BdsTypography.mdx +74 -0
- package/src/web-components/ui/BdsTypography.stories.tsx +52 -0
- package/src/web-components/ui/bds-alert.ts +1 -2
- package/src/web-components/ui/bds-button-group.spec.ts +40 -0
- package/src/web-components/ui/bds-button-group.ts +78 -0
- package/src/web-components/ui/bds-calendar.spec.ts +91 -0
- package/src/web-components/ui/bds-calendar.ts +427 -0
- package/src/web-components/ui/bds-card.ts +1 -3
- package/src/web-components/ui/bds-carousel.spec.ts +64 -0
- package/src/web-components/ui/bds-carousel.ts +296 -0
- package/src/web-components/ui/bds-notification-banner.ts +1 -2
- package/src/web-components/ui/bds-pagination.spec.ts +67 -0
- package/src/web-components/ui/bds-pagination.ts +197 -0
- package/src/web-components/ui/bds-table.spec.ts +45 -0
- package/src/web-components/ui/bds-table.ts +96 -0
|
@@ -39,12 +39,10 @@
|
|
|
39
39
|
--bdc_color: var(--bds-color_on-bg);
|
|
40
40
|
|
|
41
41
|
border: none;
|
|
42
|
-
|
|
43
|
-
outline-offset: var(--bdc-outline_offset);
|
|
42
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color), var(--bds-shadow_s);
|
|
44
43
|
cursor: pointer;
|
|
45
44
|
flex-shrink: 0;
|
|
46
45
|
transition: var(--bds-animation_transition);
|
|
47
|
-
box-shadow: var(--bds-shadow_s);
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
.navBtn svg {
|
|
@@ -57,8 +57,7 @@
|
|
|
57
57
|
transition: var(--bds-animation_transition);
|
|
58
58
|
--bdc_color: currentcolor;
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
outline-offset: var(--bdc-outline_offset);
|
|
60
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color);
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
.dismiss svg {
|
|
@@ -27,8 +27,7 @@
|
|
|
27
27
|
--bdc_color: var(--btn_border, var(--bds-color_bg--subtle));
|
|
28
28
|
|
|
29
29
|
border: none;
|
|
30
|
-
|
|
31
|
-
outline-offset: var(--bdc-outline_offset);
|
|
30
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color);
|
|
32
31
|
color: var(--btn_color, var(--bds-color_on-bg));
|
|
33
32
|
font-family: var(--bds-font_family--body);
|
|
34
33
|
font-size: var(--bds-font_size--body);
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
--bdc_color: var(--color_focus, var(--bds-color_interactive));
|
|
16
16
|
|
|
17
17
|
border: var(--skip-link_border, none);
|
|
18
|
-
|
|
19
|
-
outline-offset: var(--bdc-outline_offset);
|
|
18
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color);
|
|
20
19
|
transform: translateY(-200%);
|
|
21
20
|
transition: transform var(--bds-animation_transition-duration) var(--bds-animation_easing);
|
|
22
21
|
}
|
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
--bdc_color: var(--bds-color_bg--subtle);
|
|
7
7
|
--bdc-outline_radius: var(--bds-border_radius--s);
|
|
8
8
|
|
|
9
|
-
outline: var(--bdc-outline_width) solid var(--bdc_color);
|
|
10
|
-
outline-offset: var(--bdc-outline_offset);
|
|
11
9
|
border-radius: var(--table_radius, var(--bdc-outline_radius));
|
|
10
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color);
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
.table {
|
package/src/css/bdc.css
CHANGED
|
@@ -38,11 +38,12 @@
|
|
|
38
38
|
initial-value: 0;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
/* '*' syntax cannot be interpolated
|
|
41
|
+
/* '*' syntax cannot be interpolated; use a transparent shadow (not 'none') so it
|
|
42
|
+
can safely appear as the trailing item in a comma-separated box-shadow list. */
|
|
42
43
|
@property --bdc-outline_shadow {
|
|
43
44
|
syntax: '*';
|
|
44
45
|
inherits: false;
|
|
45
|
-
initial-value:
|
|
46
|
+
initial-value: 0 0 0 0 transparent;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
@layer component {
|
|
@@ -56,19 +57,23 @@
|
|
|
56
57
|
--bdc_color--error: var(--bds-color_error);
|
|
57
58
|
|
|
58
59
|
/* Active / selected state colours — override these to theme all filled form controls globally */
|
|
59
|
-
--bdc-color_active: var(--bds-
|
|
60
|
-
--bdc-color_on-active: var(--bds-color_on-
|
|
61
|
-
--bdc-color_active--subtle: var(--bds-
|
|
62
|
-
--bdc-color_on-active--subtle: var(--bds-color_on-
|
|
63
|
-
--bdc-color_active--strong: var(--bds-
|
|
64
|
-
--bdc-color_on-active--strong: var(--bds-color_on-
|
|
60
|
+
--bdc-color_active: var(--bds-color_interactive);
|
|
61
|
+
--bdc-color_on-active: var(--bds-color_on-interactive);
|
|
62
|
+
--bdc-color_active--subtle: var(--bds-color_blue--subtle);
|
|
63
|
+
--bdc-color_on-active--subtle: var(--bds-color_on-blue--subtle);
|
|
64
|
+
--bdc-color_active--strong: var(--bds-color_interactive_on-bg);
|
|
65
|
+
--bdc-color_on-active--strong: var(--bds-color_on-blue--strong);
|
|
65
66
|
|
|
66
67
|
/* Outline geometry */
|
|
67
68
|
--bdc-outline_width: 1px;
|
|
68
|
-
--bdc-outline_offset: -1px; /*
|
|
69
|
+
--bdc-outline_offset: -1px; /* available for consumer use; bdc borders now use inset box-shadow */
|
|
69
70
|
--bdc-outline_radius: var(--bds-border_radius--xs);
|
|
70
71
|
|
|
71
|
-
/* Shadow: opt-in
|
|
72
|
-
--bdc-outline_shadow:
|
|
72
|
+
/* Shadow: opt-in; transparent (not 'none') so it's valid in a comma-separated box-shadow list */
|
|
73
|
+
--bdc-outline_shadow: 0 0 0 0 transparent;
|
|
74
|
+
|
|
75
|
+
/* Focus-visible ring — solid interactive colour, replaces foundation's dotted grey default */
|
|
76
|
+
--bds-outline_default: 2px solid var(--bds-color_interactive);
|
|
77
|
+
--bds-outline_offset: 2px;
|
|
73
78
|
}
|
|
74
79
|
}
|
package/src/index.ts
CHANGED
|
@@ -56,7 +56,7 @@ export { Radio } from './components/interaction/form/Radio';
|
|
|
56
56
|
export { RadioGroup } from './components/interaction/form/RadioGroup';
|
|
57
57
|
export type { RadioGroupProps } from './components/interaction/form/RadioGroup';
|
|
58
58
|
export { SegmentedControl } from './components/interaction/form/SegmentedControl';
|
|
59
|
-
export type { SegmentedControlProps
|
|
59
|
+
export type { SegmentedControlProps } from './components/interaction/form/SegmentedControl';
|
|
60
60
|
export { Select } from './components/interaction/form/Select';
|
|
61
61
|
export type { SelectOption } from './components/interaction/form/Select';
|
|
62
62
|
export { Slider } from './components/interaction/form/Slider';
|
|
@@ -5,6 +5,7 @@ import foundationPackageJson from '../../node_modules/@boostdev/design-system-fo
|
|
|
5
5
|
import './Introduction.css';
|
|
6
6
|
import {ButtonGroup} from "../components/layout/ButtonGroup/index.ts";
|
|
7
7
|
import {Card} from "../components/layout/Card/index.ts";
|
|
8
|
+
import logo from '../static/logo.svg';
|
|
8
9
|
|
|
9
10
|
<Meta title="Introduction"/>
|
|
10
11
|
|
|
@@ -12,7 +13,7 @@ import {Card} from "../components/layout/Card/index.ts";
|
|
|
12
13
|
|
|
13
14
|
<div>
|
|
14
15
|
<div>
|
|
15
|
-
<img src=
|
|
16
|
+
<img src={logo} alt="BoostDev logo" width={200}/>
|
|
16
17
|
<div className="title">Design System Foundation {foundationPackageJson.version} &<br/> Components {componentsPackageJson.version}</div>
|
|
17
18
|
</div>
|
|
18
19
|
<div className="main-description">
|
|
@@ -33,7 +33,7 @@ const bdcCss = `
|
|
|
33
33
|
@property --bdc-outline_shadow {
|
|
34
34
|
syntax: '*';
|
|
35
35
|
inherits: false;
|
|
36
|
-
initial-value:
|
|
36
|
+
initial-value: 0 0 0 0 transparent;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
@layer component {
|
|
@@ -45,9 +45,9 @@ const bdcCss = `
|
|
|
45
45
|
--bdc_color--error: var(--bds-color_error);
|
|
46
46
|
|
|
47
47
|
--bdc-outline_width: 1px;
|
|
48
|
-
--bdc-outline_offset: -1px;
|
|
48
|
+
--bdc-outline_offset: -1px; /* available for consumer use; bdc borders now use inset box-shadow */
|
|
49
49
|
--bdc-outline_radius: var(--bds-border_radius--xs);
|
|
50
|
-
--bdc-outline_shadow:
|
|
50
|
+
--bdc-outline_shadow: 0 0 0 0 transparent;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
`;
|
|
@@ -57,3 +57,15 @@ export { BdsIconWrapper } from './ui/bds-icon-wrapper';
|
|
|
57
57
|
export { BdsDescriptionList } from './ui/bds-description-list';
|
|
58
58
|
export { BdsBreadcrumb } from './ui/bds-breadcrumb';
|
|
59
59
|
export { BdsLink } from './ui/bds-link';
|
|
60
|
+
|
|
61
|
+
// Phase 8 — complete parity with React library
|
|
62
|
+
export { BdsButtonGroup } from './ui/bds-button-group';
|
|
63
|
+
export { BdsTable } from './ui/bds-table';
|
|
64
|
+
export { BdsPagination } from './ui/bds-pagination';
|
|
65
|
+
export { BdsCheckboxGroup } from './interaction/form/bds-checkbox-group';
|
|
66
|
+
export { BdsRadioGroup } from './interaction/form/bds-radio-group';
|
|
67
|
+
export { BdsFormInput } from './interaction/form/bds-form-input';
|
|
68
|
+
export { BdsCarousel } from './ui/bds-carousel';
|
|
69
|
+
export { BdsCalendar } from './ui/bds-calendar';
|
|
70
|
+
export { BdsDropdownMenu } from './interaction/bds-dropdown-menu';
|
|
71
|
+
export { BdsDropdownMenuItem } from './interaction/bds-dropdown-menu-item';
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsAccordion.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# <bds-accordion>
|
|
7
|
+
|
|
8
|
+
Framework-agnostic Accordion custom element. Coordinates open/closed state across `<bds-accordion-item>` children; by default only one item is open at a time.
|
|
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
|
+
Or in HTML without a bundler:
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<script type="module">
|
|
22
|
+
import '@boostdev/components/web-components';
|
|
23
|
+
</script>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## When to use
|
|
27
|
+
|
|
28
|
+
- Displaying a list of questions and answers (FAQ)
|
|
29
|
+
- Grouping related settings or options to reduce visual clutter
|
|
30
|
+
- Progressive disclosure of content sections on a page
|
|
31
|
+
|
|
32
|
+
## When not to use
|
|
33
|
+
|
|
34
|
+
- When all sections should be visible at once — use a regular list or `<bds-collapsible>` per section instead
|
|
35
|
+
- For navigation — use a menu or sidebar
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
### Default (single open)
|
|
40
|
+
<Canvas of={Stories.Default} />
|
|
41
|
+
|
|
42
|
+
### Allow multiple open
|
|
43
|
+
<Canvas of={Stories.AllowMultiple} />
|
|
44
|
+
|
|
45
|
+
### With disabled item
|
|
46
|
+
<Canvas of={Stories.WithDisabledItem} />
|
|
47
|
+
|
|
48
|
+
## Props
|
|
49
|
+
|
|
50
|
+
<ArgTypes of={Stories} />
|
|
51
|
+
|
|
52
|
+
## Attributes — `<bds-accordion>`
|
|
53
|
+
|
|
54
|
+
| Attribute | Type | Default | Description |
|
|
55
|
+
|-----------|------|---------|-------------|
|
|
56
|
+
| `allow-multiple` | boolean | `false` | When set, multiple items can be open simultaneously |
|
|
57
|
+
|
|
58
|
+
## Attributes — `<bds-accordion-item>`
|
|
59
|
+
|
|
60
|
+
| Attribute | Type | Default | Description |
|
|
61
|
+
|-----------|------|---------|-------------|
|
|
62
|
+
| `open` | boolean | `false` | Whether this panel is currently expanded |
|
|
63
|
+
| `disabled` | boolean | `false` | Prevents the user from toggling this item |
|
|
64
|
+
|
|
65
|
+
## Slots — `<bds-accordion-item>`
|
|
66
|
+
|
|
67
|
+
| Slot | Description |
|
|
68
|
+
|------|-------------|
|
|
69
|
+
| `header` | The always-visible trigger label |
|
|
70
|
+
| `(default)` | The content revealed when the item is open |
|
|
71
|
+
|
|
72
|
+
## Events
|
|
73
|
+
|
|
74
|
+
| Event | Bubbles | Description |
|
|
75
|
+
|-------|---------|-------------|
|
|
76
|
+
| `bds-accordion-item-toggle` | Yes | Fired by `<bds-accordion-item>` when the trigger is clicked; the parent accordion handles state |
|
|
77
|
+
|
|
78
|
+
## Usage in plain HTML
|
|
79
|
+
|
|
80
|
+
```html
|
|
81
|
+
<bds-accordion>
|
|
82
|
+
<bds-accordion-item open>
|
|
83
|
+
<span slot="header">What is Boost Components?</span>
|
|
84
|
+
<p>A framework-agnostic component library built on web standards.</p>
|
|
85
|
+
</bds-accordion-item>
|
|
86
|
+
<bds-accordion-item>
|
|
87
|
+
<span slot="header">How do I install it?</span>
|
|
88
|
+
<p>Run npm install @boostdev/components.</p>
|
|
89
|
+
</bds-accordion-item>
|
|
90
|
+
</bds-accordion>
|
|
91
|
+
|
|
92
|
+
<!-- Allow multiple panels open at once -->
|
|
93
|
+
<bds-accordion allow-multiple>
|
|
94
|
+
<!-- ... -->
|
|
95
|
+
</bds-accordion>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Accessibility
|
|
99
|
+
|
|
100
|
+
- Each trigger is a `<button>` inside an `<h3>` heading with `aria-expanded` and `aria-controls` wired to the corresponding panel
|
|
101
|
+
- Panels use `role="region"` and `aria-labelledby` pointing back to the trigger
|
|
102
|
+
- `disabled` prevents toggle and conveys state via the native `disabled` attribute on the button
|
|
103
|
+
- Chevron icon is `aria-hidden="true"`
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../index'; // auto-registers all custom elements
|
|
4
|
+
|
|
5
|
+
// Thin wrapper for bds-accordion-item
|
|
6
|
+
function BdsAccordionItem({
|
|
7
|
+
open,
|
|
8
|
+
disabled,
|
|
9
|
+
header,
|
|
10
|
+
children,
|
|
11
|
+
}: {
|
|
12
|
+
open?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
header?: string;
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
}) {
|
|
17
|
+
return React.createElement(
|
|
18
|
+
'bds-accordion-item',
|
|
19
|
+
{ open: open || undefined, disabled: disabled || undefined },
|
|
20
|
+
React.createElement('span', { slot: 'header' }, header ?? 'Accordion item'),
|
|
21
|
+
children ?? React.createElement('p', { style: { margin: 0 } }, 'Accordion panel content.'),
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Thin wrapper for bds-accordion
|
|
26
|
+
function BdsAccordion({
|
|
27
|
+
allowMultiple,
|
|
28
|
+
children,
|
|
29
|
+
}: {
|
|
30
|
+
allowMultiple?: boolean;
|
|
31
|
+
children?: React.ReactNode;
|
|
32
|
+
}) {
|
|
33
|
+
return React.createElement(
|
|
34
|
+
'bds-accordion',
|
|
35
|
+
{ 'allow-multiple': allowMultiple || undefined },
|
|
36
|
+
children,
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Top-level wrapper used by Storybook controls
|
|
41
|
+
function BdsAccordionStory({
|
|
42
|
+
allowMultiple = false,
|
|
43
|
+
}: {
|
|
44
|
+
allowMultiple?: boolean;
|
|
45
|
+
}) {
|
|
46
|
+
return (
|
|
47
|
+
<BdsAccordion allowMultiple={allowMultiple}>
|
|
48
|
+
<BdsAccordionItem header="What is Boost Components?" open>
|
|
49
|
+
{React.createElement('p', { style: { margin: 0 } }, 'A framework-agnostic component library built on web standards.')}
|
|
50
|
+
</BdsAccordionItem>
|
|
51
|
+
<BdsAccordionItem header="How do I install it?">
|
|
52
|
+
{React.createElement('p', { style: { margin: 0 } }, 'Run npm install @boostdev/components and import the web components entry point.')}
|
|
53
|
+
</BdsAccordionItem>
|
|
54
|
+
<BdsAccordionItem header="Does it support dark mode?">
|
|
55
|
+
{React.createElement('p', { style: { margin: 0 } }, 'Yes — all design tokens respond to [data-theme="dark"] and prefers-color-scheme: dark.')}
|
|
56
|
+
</BdsAccordionItem>
|
|
57
|
+
</BdsAccordion>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const meta = {
|
|
62
|
+
title: 'Web Components/Interaction/Accordion',
|
|
63
|
+
component: BdsAccordionStory,
|
|
64
|
+
tags: ['!stable', 'experimental'],
|
|
65
|
+
parameters: { layout: 'padded' },
|
|
66
|
+
argTypes: {
|
|
67
|
+
allowMultiple: { control: 'boolean' },
|
|
68
|
+
},
|
|
69
|
+
} satisfies Meta<typeof BdsAccordionStory>;
|
|
70
|
+
|
|
71
|
+
export default meta;
|
|
72
|
+
type Story = StoryObj<typeof meta>;
|
|
73
|
+
|
|
74
|
+
export const Default: Story = { args: { allowMultiple: false } };
|
|
75
|
+
|
|
76
|
+
export const AllowMultiple: Story = {
|
|
77
|
+
args: { allowMultiple: true },
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const WithDisabledItem: Story = {
|
|
81
|
+
render: () => (
|
|
82
|
+
<BdsAccordion>
|
|
83
|
+
<BdsAccordionItem header="Available item" open>
|
|
84
|
+
{React.createElement('p', { style: { margin: 0 } }, 'This item can be toggled.')}
|
|
85
|
+
</BdsAccordionItem>
|
|
86
|
+
<BdsAccordionItem header="Disabled item" disabled>
|
|
87
|
+
{React.createElement('p', { style: { margin: 0 } }, 'This content is inaccessible because the item is disabled.')}
|
|
88
|
+
</BdsAccordionItem>
|
|
89
|
+
<BdsAccordionItem header="Another available item">
|
|
90
|
+
{React.createElement('p', { style: { margin: 0 } }, 'This item can also be toggled.')}
|
|
91
|
+
</BdsAccordionItem>
|
|
92
|
+
</BdsAccordion>
|
|
93
|
+
),
|
|
94
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsCollapsible.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# <bds-collapsible>
|
|
7
|
+
|
|
8
|
+
Framework-agnostic Collapsible custom element. Wraps a native `<details>`/`<summary>` pair for built-in toggle behaviour with design-system styling and a `bds-toggle` event.
|
|
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
|
+
Or in HTML without a bundler:
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<script type="module">
|
|
22
|
+
import '@boostdev/components/web-components';
|
|
23
|
+
</script>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## When to use
|
|
27
|
+
|
|
28
|
+
- Revealing secondary content on demand (e.g. "More details", "Advanced options")
|
|
29
|
+
- Standalone expandable sections that are independent of each other
|
|
30
|
+
- When accordion-style coordination is not required
|
|
31
|
+
|
|
32
|
+
## When not to use
|
|
33
|
+
|
|
34
|
+
- When multiple related sections need to be coordinated (open one, close others) — use `<bds-accordion>` instead
|
|
35
|
+
- For navigation menus — use a dedicated nav component
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
### Default
|
|
40
|
+
<Canvas of={Stories.Default} />
|
|
41
|
+
|
|
42
|
+
### Open by default
|
|
43
|
+
<Canvas of={Stories.Open} />
|
|
44
|
+
|
|
45
|
+
### Grouped (only one open at a time)
|
|
46
|
+
<Canvas of={Stories.Grouped} />
|
|
47
|
+
|
|
48
|
+
## Props
|
|
49
|
+
|
|
50
|
+
<ArgTypes of={Stories} />
|
|
51
|
+
|
|
52
|
+
## Attributes
|
|
53
|
+
|
|
54
|
+
| Attribute | Type | Default | Description |
|
|
55
|
+
|-----------|------|---------|-------------|
|
|
56
|
+
| `open` | boolean | `false` | Whether the panel is currently expanded |
|
|
57
|
+
| `name` | string | `""` | Groups collapsibles so only one in a group is open at a time (native `<details name>` behaviour) |
|
|
58
|
+
|
|
59
|
+
## Slots
|
|
60
|
+
|
|
61
|
+
| Slot | Description |
|
|
62
|
+
|------|-------------|
|
|
63
|
+
| `summary` | The always-visible trigger text |
|
|
64
|
+
| `(default)` | The content revealed when expanded |
|
|
65
|
+
|
|
66
|
+
## Events
|
|
67
|
+
|
|
68
|
+
| Event | Bubbles | Detail | Description |
|
|
69
|
+
|-------|---------|--------|-------------|
|
|
70
|
+
| `bds-toggle` | Yes | `{ open: boolean }` | Fired when the collapsible opens or closes; `detail.open` reflects the new state |
|
|
71
|
+
|
|
72
|
+
## Usage in plain HTML
|
|
73
|
+
|
|
74
|
+
```html
|
|
75
|
+
<bds-collapsible>
|
|
76
|
+
<span slot="summary">Show details</span>
|
|
77
|
+
<p>Hidden content revealed on toggle.</p>
|
|
78
|
+
</bds-collapsible>
|
|
79
|
+
|
|
80
|
+
<!-- Open by default -->
|
|
81
|
+
<bds-collapsible open>
|
|
82
|
+
<span slot="summary">Open section</span>
|
|
83
|
+
<p>This is visible immediately.</p>
|
|
84
|
+
</bds-collapsible>
|
|
85
|
+
|
|
86
|
+
<!-- Grouped: only one open at a time -->
|
|
87
|
+
<bds-collapsible name="faq">
|
|
88
|
+
<span slot="summary">Question 1</span>
|
|
89
|
+
<p>Answer 1</p>
|
|
90
|
+
</bds-collapsible>
|
|
91
|
+
<bds-collapsible name="faq">
|
|
92
|
+
<span slot="summary">Question 2</span>
|
|
93
|
+
<p>Answer 2</p>
|
|
94
|
+
</bds-collapsible>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## CSS Custom Properties
|
|
98
|
+
|
|
99
|
+
| Property | Default | Description |
|
|
100
|
+
|----------|---------|-------------|
|
|
101
|
+
| `--collapsible_bg` | `var(--bds-color_bg)` | Summary (header) background colour |
|
|
102
|
+
| `--collapsible_bg--hover` | `var(--bds-color_bg--subtle)` | Summary background on hover |
|
|
103
|
+
| `--collapsible_content-bg` | `var(--bds-color_bg)` | Content panel background colour |
|
|
104
|
+
| `--collapsible_color` | `var(--bds-color_on-bg)` | Summary text colour |
|
|
105
|
+
| `--collapsible_on-color` | `var(--bds-color_on-bg)` | Content text colour |
|
|
106
|
+
| `--collapsible_border-color` | `var(--bds-color_bg--subtle)` | Border colour |
|
|
107
|
+
| `--collapsible_border-width` | `1px` | Border width |
|
|
108
|
+
| `--collapsible_border-radius` | `var(--bds-border_radius--m)` | Border radius |
|
|
109
|
+
|
|
110
|
+
## Accessibility
|
|
111
|
+
|
|
112
|
+
- Built on native `<details>`/`<summary>`, which is keyboard accessible out of the box
|
|
113
|
+
- The `summary` slot element is focusable and responds to Enter/Space
|
|
114
|
+
- Focus outline follows design system tokens
|
|
115
|
+
- Chevron icon is `aria-hidden="true"`
|
|
116
|
+
- `prefers-reduced-motion` disables the chevron transition
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../index'; // auto-registers all custom elements
|
|
4
|
+
|
|
5
|
+
// Thin React wrapper so Storybook controls work with the custom element's props
|
|
6
|
+
function BdsCollapsible({
|
|
7
|
+
open = false,
|
|
8
|
+
name,
|
|
9
|
+
summary,
|
|
10
|
+
children,
|
|
11
|
+
}: {
|
|
12
|
+
open?: boolean;
|
|
13
|
+
name?: string;
|
|
14
|
+
summary?: string;
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
}) {
|
|
17
|
+
return React.createElement(
|
|
18
|
+
'bds-collapsible',
|
|
19
|
+
{ open: open || undefined, name: name || undefined },
|
|
20
|
+
React.createElement('span', { slot: 'summary' }, summary ?? 'Toggle section'),
|
|
21
|
+
children ?? React.createElement('p', { style: { margin: 0 } }, 'Collapsible panel content.'),
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const meta = {
|
|
26
|
+
title: 'Web Components/Interaction/Collapsible',
|
|
27
|
+
component: BdsCollapsible,
|
|
28
|
+
tags: ['!stable', 'experimental'],
|
|
29
|
+
parameters: { layout: 'padded' },
|
|
30
|
+
argTypes: {
|
|
31
|
+
open: { control: 'boolean' },
|
|
32
|
+
name: { control: 'text' },
|
|
33
|
+
summary: { control: 'text' },
|
|
34
|
+
},
|
|
35
|
+
} satisfies Meta<typeof BdsCollapsible>;
|
|
36
|
+
|
|
37
|
+
export default meta;
|
|
38
|
+
type Story = StoryObj<typeof meta>;
|
|
39
|
+
|
|
40
|
+
export const Default: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
summary: 'Show details',
|
|
43
|
+
open: false,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const Open: Story = {
|
|
48
|
+
args: {
|
|
49
|
+
summary: 'Open by default',
|
|
50
|
+
open: true,
|
|
51
|
+
children: React.createElement('p', { style: { margin: 0 } }, 'This collapsible is open by default via the open attribute.'),
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const Grouped: Story = {
|
|
56
|
+
render: () => (
|
|
57
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem', maxWidth: '480px' }}>
|
|
58
|
+
{(['Section A', 'Section B', 'Section C'] as const).map((label, i) =>
|
|
59
|
+
React.createElement(
|
|
60
|
+
'bds-collapsible',
|
|
61
|
+
{ key: label, name: 'group', open: i === 0 ? '' : undefined },
|
|
62
|
+
React.createElement('span', { slot: 'summary' }, label),
|
|
63
|
+
React.createElement('p', { style: { margin: 0 } }, `Content for ${label}. Only one section in this group can be open at a time.`),
|
|
64
|
+
),
|
|
65
|
+
)}
|
|
66
|
+
</div>
|
|
67
|
+
),
|
|
68
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsDialog.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# <bds-dialog>
|
|
7
|
+
|
|
8
|
+
Framework-agnostic Dialog custom element. Wraps a native `<dialog>` element with `showModal()` / `close()` lifecycle, backdrop-click to dismiss, Escape key handling, Tab focus trapping, and the Invoker Commands API.
|
|
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
|
+
Or in HTML without a bundler:
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<script type="module">
|
|
22
|
+
import '@boostdev/components/web-components';
|
|
23
|
+
</script>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## When to use
|
|
27
|
+
|
|
28
|
+
- Confirmations that require a decision before continuing
|
|
29
|
+
- Short forms (edit profile, create item) that interrupt the current flow
|
|
30
|
+
- Alerts or notices that must be acknowledged
|
|
31
|
+
|
|
32
|
+
## When not to use
|
|
33
|
+
|
|
34
|
+
- Complex multi-step flows — consider a dedicated page instead
|
|
35
|
+
- Non-blocking panels — use `<bds-drawer>` or `<bds-popover>` instead
|
|
36
|
+
- Displaying lots of scrollable content — prefer a full page or `<bds-drawer>`
|
|
37
|
+
|
|
38
|
+
## Examples
|
|
39
|
+
|
|
40
|
+
### Default
|
|
41
|
+
<Canvas of={Stories.Default} />
|
|
42
|
+
|
|
43
|
+
### With form content
|
|
44
|
+
<Canvas of={Stories.WithForm} />
|
|
45
|
+
|
|
46
|
+
### Invoker Commands API
|
|
47
|
+
<Canvas of={Stories.InvokerCommands} />
|
|
48
|
+
|
|
49
|
+
## Props
|
|
50
|
+
|
|
51
|
+
<ArgTypes of={Stories} />
|
|
52
|
+
|
|
53
|
+
## Attributes
|
|
54
|
+
|
|
55
|
+
| Attribute | Type | Default | Description |
|
|
56
|
+
|-----------|------|---------|-------------|
|
|
57
|
+
| `open` | boolean | `false` | Controlled open state — syncs to native `showModal()` / `close()` |
|
|
58
|
+
|
|
59
|
+
## Slots
|
|
60
|
+
|
|
61
|
+
| Slot | Description |
|
|
62
|
+
|------|-------------|
|
|
63
|
+
| `(default)` | Dialog content |
|
|
64
|
+
|
|
65
|
+
## Events
|
|
66
|
+
|
|
67
|
+
| Event | Bubbles | Description |
|
|
68
|
+
|-------|---------|-------------|
|
|
69
|
+
| `bds-open` | Yes | Fired when the dialog opens |
|
|
70
|
+
| `bds-close` | Yes | Fired when the dialog closes (backdrop click, Escape, or close button) |
|
|
71
|
+
|
|
72
|
+
## Invoker Commands API
|
|
73
|
+
|
|
74
|
+
Open or close the dialog declaratively using the Invoker Commands API:
|
|
75
|
+
|
|
76
|
+
```html
|
|
77
|
+
<button commandfor="my-dialog" command="show-modal">Open</button>
|
|
78
|
+
<button commandfor="my-dialog" command="close">Close</button>
|
|
79
|
+
|
|
80
|
+
<bds-dialog id="my-dialog">
|
|
81
|
+
<p>Dialog content</p>
|
|
82
|
+
</bds-dialog>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The Invoker Commands API is a native browser feature. For browsers that do not support it yet, use the `open` attribute or JavaScript.
|
|
86
|
+
|
|
87
|
+
## Usage in plain HTML
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<bds-dialog id="my-dialog">
|
|
91
|
+
<h2>Confirm deletion</h2>
|
|
92
|
+
<p>This action cannot be undone.</p>
|
|
93
|
+
<div>
|
|
94
|
+
<button onclick="document.getElementById('my-dialog').open = false">Cancel</button>
|
|
95
|
+
<button>Delete</button>
|
|
96
|
+
</div>
|
|
97
|
+
</bds-dialog>
|
|
98
|
+
|
|
99
|
+
<button onclick="document.getElementById('my-dialog').open = true">Delete item</button>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Accessibility
|
|
103
|
+
|
|
104
|
+
- Renders a native `<dialog>` element with `aria-modal="true"`
|
|
105
|
+
- Focus is trapped inside the dialog while open (Tab / Shift+Tab cycle)
|
|
106
|
+
- Escape key closes the dialog
|
|
107
|
+
- Clicking the backdrop closes the dialog
|
|
108
|
+
- Focus returns to the triggering element on close
|
|
109
|
+
- A visually positioned close button is provided with `aria-label="Close dialog"`
|
|
110
|
+
- `document.body.overflow` is set to `hidden` while the dialog is open to prevent background scroll
|