@boostdev/design-system-components 1.1.0 → 1.1.2
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 +46 -5
- package/dist/client.cjs +206 -113
- package/dist/client.css +664 -624
- package/dist/client.d.cts +9 -3
- package/dist/client.d.ts +9 -3
- package/dist/client.js +241 -149
- package/dist/index.cjs +206 -113
- package/dist/index.css +664 -624
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +241 -149
- package/dist/web-components/chunk-2QA62WCQ.js +48 -0
- package/dist/web-components/chunk-4BX6AWXX.js +146 -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-6T3RKUKG.js +65 -0
- package/dist/web-components/chunk-7FMR53BW.js +127 -0
- package/dist/web-components/chunk-A67LCT7C.js +134 -0
- package/dist/web-components/chunk-AGKJTMJI.js +56 -0
- package/dist/web-components/chunk-BQLZ7I4G.js +56 -0
- package/dist/web-components/chunk-CAPI25CU.js +53 -0
- package/dist/web-components/chunk-CJ5ZOO42.js +229 -0
- package/dist/web-components/chunk-CR5PGUHV.js +109 -0
- package/dist/web-components/chunk-ECW3HHWA.js +185 -0
- package/dist/web-components/chunk-HGBNDR22.js +98 -0
- package/dist/web-components/chunk-IK3PTFZ4.js +133 -0
- package/dist/web-components/chunk-IQGLIQSO.js +188 -0
- package/dist/web-components/chunk-ITHLKR7Q.js +105 -0
- package/dist/web-components/chunk-K5CE6HSB.js +169 -0
- package/dist/web-components/chunk-L3XHOMN6.js +111 -0
- package/dist/{web-components.js → web-components/chunk-LGEZYFUU.js} +62 -834
- package/dist/web-components/chunk-LSC4N56Q.js +168 -0
- package/dist/web-components/chunk-LY62SAVN.js +64 -0
- package/dist/web-components/chunk-O4UFI2RX.js +244 -0
- package/dist/web-components/chunk-O7I63SQX.js +124 -0
- package/dist/web-components/chunk-OHUTLSIQ.js +69 -0
- package/dist/web-components/chunk-OQTRTMAB.js +27 -0
- package/dist/web-components/chunk-OTX4COSV.js +187 -0
- package/dist/web-components/chunk-PY62FTRW.js +179 -0
- package/dist/web-components/chunk-Q4T5BJT6.js +94 -0
- package/dist/web-components/chunk-QDRH46TF.js +281 -0
- package/dist/web-components/chunk-QDST57JC.js +119 -0
- package/dist/web-components/chunk-QPOKHLMQ.js +45 -0
- package/dist/web-components/chunk-SOQQ7RVJ.js +88 -0
- package/dist/web-components/chunk-UFFCKVZE.js +149 -0
- package/dist/web-components/chunk-VM3YHGQ2.js +152 -0
- package/dist/web-components/chunk-VMMVWLXL.js +53 -0
- package/dist/web-components/chunk-VSS5ITNE.js +109 -0
- package/dist/web-components/chunk-XIENXR7H.js +118 -0
- package/dist/web-components/chunk-Y4MAXTMA.js +80 -0
- package/dist/web-components/chunk-YLVTEY23.js +165 -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 +71 -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 +169 -4
- package/src/components/interaction/Button/Button.module.css +1 -1
- package/src/components/interaction/Button/Button.native.mdx +72 -0
- package/src/components/interaction/Command/Command.module.css +7 -7
- package/src/components/interaction/Command/Command.spec.tsx +37 -0
- package/src/components/interaction/Command/Command.tsx +37 -2
- package/src/components/interaction/Dialog/Dialog.module.css +10 -13
- package/src/components/interaction/Dialog/Dialog.spec.tsx +53 -1
- package/src/components/interaction/Dialog/Dialog.stories.tsx +17 -0
- package/src/components/interaction/Dialog/Dialog.tsx +50 -16
- package/src/components/interaction/Drawer/Drawer.module.css +11 -11
- package/src/components/interaction/Drawer/Drawer.spec.tsx +48 -1
- package/src/components/interaction/Drawer/Drawer.tsx +38 -4
- package/src/components/interaction/DropdownMenu/DropdownMenu.module.css +6 -6
- package/src/components/interaction/Popover/Popover.module.css +74 -15
- package/src/components/interaction/Popover/Popover.spec.tsx +94 -59
- package/src/components/interaction/Popover/Popover.tsx +44 -60
- package/src/components/interaction/Toast/Toast.module.css +7 -7
- package/src/components/interaction/form/Checkbox/Checkbox.module.css +6 -6
- package/src/components/interaction/form/Checkbox/Checkbox.native.mdx +74 -0
- package/src/components/interaction/form/Combobox/Combobox.module.css +7 -8
- package/src/components/interaction/form/FileInput/FileInput.module.css +4 -4
- package/src/components/interaction/form/NumberInput/NumberInput.module.css +1 -1
- package/src/components/interaction/form/Radio/Radio.module.css +6 -6
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.module.css +5 -6
- package/src/components/interaction/form/Select/Select.module.css +3 -3
- package/src/components/interaction/form/Slider/Slider.module.css +6 -6
- package/src/components/interaction/form/Switch/Switch.module.css +8 -8
- package/src/components/interaction/form/Textarea/Textarea.module.css +1 -1
- package/src/components/layout/IconWrapper/IconWrapper.module.css +2 -2
- package/src/components/ui/Accordion/Accordion.module.css +5 -5
- package/src/components/ui/Alert/Alert.native.mdx +62 -0
- package/src/components/ui/Avatar/Avatar.native.mdx +50 -0
- package/src/components/ui/Badge/Badge.native.mdx +54 -0
- package/src/components/ui/Calendar/Calendar.module.css +7 -7
- package/src/components/ui/Carousel/Carousel.module.css +5 -5
- package/src/components/ui/Collapsible/Collapsible.module.css +4 -4
- package/src/components/ui/Link/Link.module.css +2 -2
- package/src/components/ui/Loading/Loading.module.css +7 -7
- package/src/components/ui/NotificationBanner/NotificationBanner.module.css +3 -3
- package/src/components/ui/Pagination/Pagination.module.css +6 -6
- package/src/components/ui/Progress/Progress.module.css +5 -5
- package/src/components/ui/Separator/Separator.module.css +3 -3
- package/src/components/ui/Skeleton/Skeleton.module.css +1 -1
- package/src/components/ui/Table/Table.module.css +9 -9
- package/src/components/ui/Tabs/Tabs.module.css +3 -3
- package/src/components/ui/Tooltip/Tooltip.module.css +8 -8
- package/src/components/ui/Typography/Typography.native.mdx +56 -0
- package/src/polyfill-invoker-commands.ts +68 -0
- package/src/react-augment.d.ts +19 -0
- package/src/stories/ReactNative.mdx +121 -0
- package/src/web-components/index.ts +47 -0
- package/src/web-components/interaction/BdsButton.mdx +106 -0
- package/src/web-components/interaction/BdsPopover.mdx +120 -0
- package/src/web-components/interaction/BdsToastProvider.mdx +94 -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 +99 -0
- 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 +224 -0
- package/src/web-components/interaction/bds-drawer.spec.ts +113 -0
- package/src/web-components/interaction/bds-drawer.ts +266 -0
- package/src/web-components/interaction/bds-popover.spec.ts +49 -1
- package/src/web-components/interaction/bds-popover.ts +12 -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/bds-checkbox.spec.ts +63 -0
- package/src/web-components/interaction/form/bds-checkbox.ts +168 -0
- package/src/web-components/interaction/form/bds-combobox.spec.ts +117 -0
- package/src/web-components/interaction/form/bds-combobox.ts +336 -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 +221 -0
- package/src/web-components/interaction/form/bds-radio.spec.ts +70 -0
- package/src/web-components/interaction/form/bds-radio.ts +157 -0
- package/src/web-components/interaction/form/bds-segmented-control.spec.ts +74 -0
- package/src/web-components/interaction/form/bds-segmented-control.ts +211 -0
- package/src/web-components/interaction/form/bds-select.spec.ts +74 -0
- package/src/web-components/interaction/form/bds-select.ts +190 -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 +166 -0
- package/src/web-components/interaction/form/bds-textarea.spec.ts +55 -0
- package/src/web-components/interaction/form/bds-textarea.ts +143 -0
- package/src/web-components/test/helpers.ts +8 -0
- package/src/web-components/ui/BdsAlert.mdx +90 -0
- package/src/web-components/ui/BdsBadge.mdx +74 -0
- 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 +156 -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 +185 -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 -303
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import {
|
|
2
|
+
T,
|
|
3
|
+
i,
|
|
4
|
+
i2
|
|
5
|
+
} from "./chunk-LGEZYFUU.js";
|
|
6
|
+
|
|
7
|
+
// src/web-components/interaction/form/bds-combobox.ts
|
|
8
|
+
var BdsCombobox = class extends i2 {
|
|
9
|
+
static formAssociated = true;
|
|
10
|
+
static styles = i`
|
|
11
|
+
:host {
|
|
12
|
+
display: block;
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:host([disabled]) {
|
|
17
|
+
opacity: 0.5;
|
|
18
|
+
pointer-events: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.wrapper {
|
|
22
|
+
position: relative;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.input {
|
|
26
|
+
inline-size: 100%;
|
|
27
|
+
font-family: var(--bds-font_family--body);
|
|
28
|
+
font-size: var(--bds-font_size--body);
|
|
29
|
+
padding: var(--bds-space_s);
|
|
30
|
+
padding-inline-end: var(--bds-space_xl);
|
|
31
|
+
border: none;
|
|
32
|
+
--bdc_color: currentcolor;
|
|
33
|
+
--bdc-outline_radius: var(--bds-border_radius--xs);
|
|
34
|
+
|
|
35
|
+
outline: var(--bdc-outline_width) solid var(--bdc_color);
|
|
36
|
+
outline-offset: var(--bdc-outline_offset);
|
|
37
|
+
border-radius: var(--combobox_radius, var(--bdc-outline_radius));
|
|
38
|
+
box-shadow: var(--combobox_shadow, var(--bdc-outline_shadow));
|
|
39
|
+
background-color: var(--combobox_color_bg, var(--bds-color_bg));
|
|
40
|
+
color: var(--combobox_color, var(--bds-color_on-bg));
|
|
41
|
+
box-sizing: border-box;
|
|
42
|
+
transition: --bdc_color var(--bds-animation_transition-duration) var(--bds-animation_easing);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.input:focus {
|
|
46
|
+
--bdc_color: var(--bdc_color--focus);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.input:focus-visible {
|
|
50
|
+
outline: var(--bds-outline_default);
|
|
51
|
+
outline-offset: var(--bds-outline_offset);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.chevron {
|
|
55
|
+
position: absolute;
|
|
56
|
+
inset-inline-end: var(--bds-space_s);
|
|
57
|
+
inset-block-start: 50%;
|
|
58
|
+
transform: translateY(-50%);
|
|
59
|
+
pointer-events: none;
|
|
60
|
+
inline-size: 1rem;
|
|
61
|
+
block-size: 1rem;
|
|
62
|
+
color: currentcolor;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.chevron svg {
|
|
66
|
+
inline-size: 100%;
|
|
67
|
+
block-size: 100%;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.listbox {
|
|
71
|
+
position: absolute;
|
|
72
|
+
inset-block-start: calc(100% + var(--bds-space_xs));
|
|
73
|
+
inset-inline-start: 0;
|
|
74
|
+
inline-size: 100%;
|
|
75
|
+
max-block-size: 15rem;
|
|
76
|
+
overflow-y: auto;
|
|
77
|
+
background-color: var(--combobox_list-bg, var(--bds-color_bg));
|
|
78
|
+
border-radius: var(--bds-border_radius--s);
|
|
79
|
+
box-shadow: var(--bds-shadow_m);
|
|
80
|
+
z-index: var(--combobox_z-index, 100);
|
|
81
|
+
padding-block: var(--bds-space_xs);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.option {
|
|
85
|
+
display: block;
|
|
86
|
+
padding: var(--bds-space_s) var(--bds-space_m);
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
font-family: var(--bds-font_family--body);
|
|
89
|
+
font-size: var(--bds-font_size--body);
|
|
90
|
+
color: var(--bds-color_on-bg);
|
|
91
|
+
transition: background-color var(--bds-animation_transition-duration) var(--bds-animation_easing);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.option:hover,
|
|
95
|
+
.option[aria-selected='true'] {
|
|
96
|
+
background-color: var(--bds-color_bg--subtle);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.option[aria-disabled='true'] {
|
|
100
|
+
opacity: 0.4;
|
|
101
|
+
cursor: not-allowed;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.option.--focused {
|
|
105
|
+
background-color: var(--bds-color_bg--subtle);
|
|
106
|
+
outline: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.no-results {
|
|
110
|
+
padding: var(--bds-space_s) var(--bds-space_m);
|
|
111
|
+
font-family: var(--bds-font_family--body);
|
|
112
|
+
font-size: var(--bds-font_size--body--s);
|
|
113
|
+
color: var(--bds-color_on-bg--subtle);
|
|
114
|
+
}
|
|
115
|
+
`;
|
|
116
|
+
static properties = {
|
|
117
|
+
name: { type: String, reflect: true },
|
|
118
|
+
value: { type: String },
|
|
119
|
+
options: { type: String },
|
|
120
|
+
placeholder: { type: String },
|
|
121
|
+
disabled: { type: Boolean, reflect: true }
|
|
122
|
+
};
|
|
123
|
+
_internals;
|
|
124
|
+
_open = false;
|
|
125
|
+
_query = "";
|
|
126
|
+
_focusedIndex = -1;
|
|
127
|
+
constructor() {
|
|
128
|
+
super();
|
|
129
|
+
this._internals = this.attachInternals();
|
|
130
|
+
this.name = "";
|
|
131
|
+
this.value = "";
|
|
132
|
+
this.options = "[]";
|
|
133
|
+
this.placeholder = "";
|
|
134
|
+
this.disabled = false;
|
|
135
|
+
}
|
|
136
|
+
get _options() {
|
|
137
|
+
try {
|
|
138
|
+
return JSON.parse(this.options);
|
|
139
|
+
} catch {
|
|
140
|
+
return [];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
get _filtered() {
|
|
144
|
+
const q = this._query.toLowerCase();
|
|
145
|
+
return q ? this._options.filter((o) => o.label.toLowerCase().includes(q)) : this._options;
|
|
146
|
+
}
|
|
147
|
+
get _displayLabel() {
|
|
148
|
+
if (this.value) {
|
|
149
|
+
return this._options.find((o) => o.value === this.value)?.label ?? "";
|
|
150
|
+
}
|
|
151
|
+
return "";
|
|
152
|
+
}
|
|
153
|
+
updated(changed) {
|
|
154
|
+
super.updated(changed);
|
|
155
|
+
if (changed.has("value")) {
|
|
156
|
+
this._internals.setFormValue?.(this.value || null);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
formResetCallback() {
|
|
160
|
+
this.value = "";
|
|
161
|
+
this._query = "";
|
|
162
|
+
this._open = false;
|
|
163
|
+
this._internals.setFormValue?.(null);
|
|
164
|
+
this.requestUpdate();
|
|
165
|
+
}
|
|
166
|
+
_openList() {
|
|
167
|
+
this._open = true;
|
|
168
|
+
this._focusedIndex = this._filtered.findIndex((o) => o.value === this.value);
|
|
169
|
+
this.requestUpdate();
|
|
170
|
+
}
|
|
171
|
+
_closeList() {
|
|
172
|
+
this._open = false;
|
|
173
|
+
this._query = "";
|
|
174
|
+
this._focusedIndex = -1;
|
|
175
|
+
this.requestUpdate();
|
|
176
|
+
}
|
|
177
|
+
_selectOption(opt) {
|
|
178
|
+
if (opt.disabled) return;
|
|
179
|
+
this.value = opt.value;
|
|
180
|
+
this._closeList();
|
|
181
|
+
this.dispatchEvent(new CustomEvent("bds-change", {
|
|
182
|
+
bubbles: true,
|
|
183
|
+
composed: true,
|
|
184
|
+
detail: { value: opt.value, label: opt.label }
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
187
|
+
_handleInput(e) {
|
|
188
|
+
this._query = e.target.value;
|
|
189
|
+
this._open = true;
|
|
190
|
+
this._focusedIndex = -1;
|
|
191
|
+
this.requestUpdate();
|
|
192
|
+
}
|
|
193
|
+
_handleFocus() {
|
|
194
|
+
this._openList();
|
|
195
|
+
}
|
|
196
|
+
_handleBlur() {
|
|
197
|
+
setTimeout(() => {
|
|
198
|
+
this._closeList();
|
|
199
|
+
}, 150);
|
|
200
|
+
}
|
|
201
|
+
_handleKeydown(e) {
|
|
202
|
+
const filtered = this._filtered;
|
|
203
|
+
if (!this._open) {
|
|
204
|
+
if (e.key === "ArrowDown" || e.key === "Enter") {
|
|
205
|
+
e.preventDefault();
|
|
206
|
+
this._openList();
|
|
207
|
+
}
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
if (e.key === "ArrowDown") {
|
|
211
|
+
e.preventDefault();
|
|
212
|
+
let next = this._focusedIndex + 1;
|
|
213
|
+
while (next < filtered.length && filtered[next].disabled) next++;
|
|
214
|
+
if (next < filtered.length) this._focusedIndex = next;
|
|
215
|
+
} else if (e.key === "ArrowUp") {
|
|
216
|
+
e.preventDefault();
|
|
217
|
+
let prev = this._focusedIndex - 1;
|
|
218
|
+
while (prev >= 0 && filtered[prev].disabled) prev--;
|
|
219
|
+
if (prev >= 0) this._focusedIndex = prev;
|
|
220
|
+
} else if (e.key === "Enter") {
|
|
221
|
+
e.preventDefault();
|
|
222
|
+
if (this._focusedIndex >= 0 && this._focusedIndex < filtered.length) {
|
|
223
|
+
this._selectOption(filtered[this._focusedIndex]);
|
|
224
|
+
}
|
|
225
|
+
} else if (e.key === "Escape") {
|
|
226
|
+
e.preventDefault();
|
|
227
|
+
this._closeList();
|
|
228
|
+
}
|
|
229
|
+
this.requestUpdate();
|
|
230
|
+
}
|
|
231
|
+
render() {
|
|
232
|
+
const filtered = this._filtered;
|
|
233
|
+
const inputValue = this._open ? this._query : this._displayLabel;
|
|
234
|
+
return T`
|
|
235
|
+
<div class="wrapper">
|
|
236
|
+
<input
|
|
237
|
+
type="text"
|
|
238
|
+
class="input"
|
|
239
|
+
role="combobox"
|
|
240
|
+
aria-expanded=${this._open}
|
|
241
|
+
aria-autocomplete="list"
|
|
242
|
+
aria-haspopup="listbox"
|
|
243
|
+
name=${this.name}
|
|
244
|
+
placeholder=${this.placeholder}
|
|
245
|
+
.value=${inputValue}
|
|
246
|
+
?disabled=${this.disabled}
|
|
247
|
+
@input=${this._handleInput}
|
|
248
|
+
@focus=${this._handleFocus}
|
|
249
|
+
@blur=${this._handleBlur}
|
|
250
|
+
@keydown=${this._handleKeydown}
|
|
251
|
+
/>
|
|
252
|
+
<span class="chevron" aria-hidden="true">
|
|
253
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
254
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M6 9l6 6 6-6" />
|
|
255
|
+
</svg>
|
|
256
|
+
</span>
|
|
257
|
+
${this._open ? T`
|
|
258
|
+
<ul class="listbox" role="listbox" aria-label="Options">
|
|
259
|
+
${filtered.length === 0 ? T`<li class="no-results">No results</li>` : filtered.map((opt, i3) => T`
|
|
260
|
+
<li
|
|
261
|
+
class="option ${i3 === this._focusedIndex ? "--focused" : ""}"
|
|
262
|
+
role="option"
|
|
263
|
+
aria-selected=${opt.value === this.value}
|
|
264
|
+
aria-disabled=${opt.disabled ?? false}
|
|
265
|
+
@mousedown=${(e) => {
|
|
266
|
+
e.preventDefault();
|
|
267
|
+
this._selectOption(opt);
|
|
268
|
+
}}
|
|
269
|
+
>${opt.label}</li>
|
|
270
|
+
`)}
|
|
271
|
+
</ul>
|
|
272
|
+
` : ""}
|
|
273
|
+
</div>
|
|
274
|
+
`;
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
customElements.define("bds-combobox", BdsCombobox);
|
|
278
|
+
|
|
279
|
+
export {
|
|
280
|
+
BdsCombobox
|
|
281
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import {
|
|
2
|
+
A,
|
|
3
|
+
T,
|
|
4
|
+
i,
|
|
5
|
+
i2
|
|
6
|
+
} from "./chunk-LGEZYFUU.js";
|
|
7
|
+
|
|
8
|
+
// src/web-components/ui/bds-progress-circle.ts
|
|
9
|
+
var SIZE_PX = { small: 40, medium: 64, large: 96 };
|
|
10
|
+
var STROKE_WIDTH = 4;
|
|
11
|
+
var BdsProgressCircle = class extends i2 {
|
|
12
|
+
static styles = i`
|
|
13
|
+
:host {
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
position: relative;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.svg {
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.track {
|
|
25
|
+
stroke: var(--bds-color_bg--subtle);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.fill {
|
|
29
|
+
stroke: var(--progressCircle_color-active, var(--bdc-color_active));
|
|
30
|
+
transition: stroke-dashoffset var(--bds-animation_transition-duration) var(--bds-animation_easing);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.value {
|
|
34
|
+
position: absolute;
|
|
35
|
+
font-size: var(--bds-font_size--body--s);
|
|
36
|
+
font-weight: var(--bds-font_weight--semibold);
|
|
37
|
+
font-variant-numeric: tabular-nums;
|
|
38
|
+
color: var(--bds-color_on-bg);
|
|
39
|
+
line-height: 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host([size='small']) .value { font-size: 0.5rem; }
|
|
43
|
+
:host([size='large']) .value { font-size: var(--bds-font_size--body); }
|
|
44
|
+
|
|
45
|
+
@media (prefers-reduced-motion: reduce) {
|
|
46
|
+
.fill {
|
|
47
|
+
transition: none;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
static properties = {
|
|
52
|
+
value: { type: Number },
|
|
53
|
+
max: { type: Number },
|
|
54
|
+
label: { type: String },
|
|
55
|
+
showValue: { type: Boolean, attribute: "show-value", reflect: true },
|
|
56
|
+
size: { type: String, reflect: true }
|
|
57
|
+
};
|
|
58
|
+
constructor() {
|
|
59
|
+
super();
|
|
60
|
+
this.value = 0;
|
|
61
|
+
this.max = 100;
|
|
62
|
+
this.label = "";
|
|
63
|
+
this.showValue = false;
|
|
64
|
+
this.size = "medium";
|
|
65
|
+
}
|
|
66
|
+
render() {
|
|
67
|
+
const percentage = Math.min(100, Math.max(0, this.value / this.max * 100));
|
|
68
|
+
const px = SIZE_PX[this.size] ?? SIZE_PX.medium;
|
|
69
|
+
const radius = (px - STROKE_WIDTH * 2) / 2;
|
|
70
|
+
const circumference = 2 * Math.PI * radius;
|
|
71
|
+
const offset = circumference - percentage / 100 * circumference;
|
|
72
|
+
const cx = px / 2;
|
|
73
|
+
return T`
|
|
74
|
+
<div
|
|
75
|
+
role="progressbar"
|
|
76
|
+
aria-label=${this.label}
|
|
77
|
+
aria-valuenow=${this.value}
|
|
78
|
+
aria-valuemin="0"
|
|
79
|
+
aria-valuemax=${this.max}
|
|
80
|
+
style="position: relative; display: inline-flex; align-items: center; justify-content: center;"
|
|
81
|
+
>
|
|
82
|
+
<svg
|
|
83
|
+
class="svg"
|
|
84
|
+
width=${px}
|
|
85
|
+
height=${px}
|
|
86
|
+
viewBox="0 0 ${px} ${px}"
|
|
87
|
+
aria-hidden="true"
|
|
88
|
+
>
|
|
89
|
+
<circle
|
|
90
|
+
class="track"
|
|
91
|
+
cx=${cx}
|
|
92
|
+
cy=${cx}
|
|
93
|
+
r=${radius}
|
|
94
|
+
stroke-width=${STROKE_WIDTH}
|
|
95
|
+
fill="none"
|
|
96
|
+
/>
|
|
97
|
+
<circle
|
|
98
|
+
class="fill"
|
|
99
|
+
cx=${cx}
|
|
100
|
+
cy=${cx}
|
|
101
|
+
r=${radius}
|
|
102
|
+
stroke-width=${STROKE_WIDTH}
|
|
103
|
+
fill="none"
|
|
104
|
+
stroke-dasharray=${circumference}
|
|
105
|
+
stroke-dashoffset=${offset}
|
|
106
|
+
stroke-linecap="round"
|
|
107
|
+
transform="rotate(-90 ${cx} ${cx})"
|
|
108
|
+
/>
|
|
109
|
+
</svg>
|
|
110
|
+
${this.showValue ? T`<span class="value" aria-hidden="true">${Math.round(percentage)}%</span>` : A}
|
|
111
|
+
</div>
|
|
112
|
+
`;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
customElements.define("bds-progress-circle", BdsProgressCircle);
|
|
116
|
+
|
|
117
|
+
export {
|
|
118
|
+
BdsProgressCircle
|
|
119
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
T,
|
|
3
|
+
b,
|
|
4
|
+
w
|
|
5
|
+
} from "./chunk-LGEZYFUU.js";
|
|
6
|
+
|
|
7
|
+
// node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/node/static.js
|
|
8
|
+
var a = /* @__PURE__ */ Symbol.for("");
|
|
9
|
+
var o = (t) => {
|
|
10
|
+
if (t?.r === a) return t?._$litStatic$;
|
|
11
|
+
};
|
|
12
|
+
var s = (t) => ({ _$litStatic$: t, r: a });
|
|
13
|
+
var l = /* @__PURE__ */ new Map();
|
|
14
|
+
var n = (t) => (r, ...e) => {
|
|
15
|
+
const a2 = e.length;
|
|
16
|
+
let s2, i;
|
|
17
|
+
const n2 = [], u2 = [];
|
|
18
|
+
let c2, $2 = 0, f = false;
|
|
19
|
+
for (; $2 < a2; ) {
|
|
20
|
+
for (c2 = r[$2]; $2 < a2 && void 0 !== (i = e[$2], s2 = o(i)); ) c2 += s2 + r[++$2], f = true;
|
|
21
|
+
$2 !== a2 && u2.push(i), n2.push(c2), $2++;
|
|
22
|
+
}
|
|
23
|
+
if ($2 === a2 && n2.push(r[a2]), f) {
|
|
24
|
+
const t2 = n2.join("$$lit$$");
|
|
25
|
+
void 0 === (r = l.get(t2)) && (n2.raw = n2, l.set(t2, r = n2)), e = u2;
|
|
26
|
+
}
|
|
27
|
+
return t(r, ...e);
|
|
28
|
+
};
|
|
29
|
+
var u = n(T);
|
|
30
|
+
var c = n(b);
|
|
31
|
+
var $ = n(w);
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
s,
|
|
35
|
+
u
|
|
36
|
+
};
|
|
37
|
+
/*! Bundled license information:
|
|
38
|
+
|
|
39
|
+
lit-html/node/static.js:
|
|
40
|
+
(**
|
|
41
|
+
* @license
|
|
42
|
+
* Copyright 2020 Google LLC
|
|
43
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
44
|
+
*)
|
|
45
|
+
*/
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import {
|
|
2
|
+
s,
|
|
3
|
+
u
|
|
4
|
+
} from "./chunk-QPOKHLMQ.js";
|
|
5
|
+
import {
|
|
6
|
+
i,
|
|
7
|
+
i2
|
|
8
|
+
} from "./chunk-LGEZYFUU.js";
|
|
9
|
+
|
|
10
|
+
// src/web-components/ui/bds-typography.ts
|
|
11
|
+
var VARIANT_TAG = {
|
|
12
|
+
h1: "h1",
|
|
13
|
+
h2: "h2",
|
|
14
|
+
h3: "h3",
|
|
15
|
+
body: "p",
|
|
16
|
+
body_s: "p"
|
|
17
|
+
};
|
|
18
|
+
var BdsTypography = class extends i2 {
|
|
19
|
+
static styles = i`
|
|
20
|
+
:host {
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.typography {
|
|
25
|
+
margin: 0;
|
|
26
|
+
font-family: var(--bds-font_family--body);
|
|
27
|
+
color: var(--typography_color, var(--bds-color_on-bg));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.typography.--h1 {
|
|
31
|
+
font-family: var(--bds-font_family--heading);
|
|
32
|
+
font-size: var(--bds-font_size--heading-1);
|
|
33
|
+
font-weight: var(--bds-font_weight--bold);
|
|
34
|
+
line-height: var(--bds-font_line-height--heading);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.typography.--h2 {
|
|
38
|
+
font-family: var(--bds-font_family--heading);
|
|
39
|
+
font-size: var(--bds-font_size--heading-2);
|
|
40
|
+
font-weight: var(--bds-font_weight--semibold);
|
|
41
|
+
line-height: var(--bds-font_line-height--heading);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.typography.--h3 {
|
|
45
|
+
font-family: var(--bds-font_family--heading);
|
|
46
|
+
font-size: var(--bds-font_size--heading-3);
|
|
47
|
+
font-weight: var(--bds-font_weight--semibold);
|
|
48
|
+
line-height: var(--bds-font_line-height--heading);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.typography.--body {
|
|
52
|
+
font-size: var(--bds-font_size--body);
|
|
53
|
+
line-height: var(--bds-font_line-height--body);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.typography.--body_s {
|
|
57
|
+
font-size: var(--bds-font_size--body--s);
|
|
58
|
+
line-height: var(--bds-font_line-height--body);
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
static properties = {
|
|
62
|
+
variant: { type: String, reflect: true },
|
|
63
|
+
component: { type: String }
|
|
64
|
+
};
|
|
65
|
+
constructor() {
|
|
66
|
+
super();
|
|
67
|
+
this.variant = "body";
|
|
68
|
+
this.component = "";
|
|
69
|
+
}
|
|
70
|
+
get _tag() {
|
|
71
|
+
if (this.component) return this.component;
|
|
72
|
+
return VARIANT_TAG[this.variant] ?? "p";
|
|
73
|
+
}
|
|
74
|
+
render() {
|
|
75
|
+
const tag = s(this._tag);
|
|
76
|
+
const variant = s(this.variant);
|
|
77
|
+
return u`
|
|
78
|
+
<${tag} class="typography --${variant}">
|
|
79
|
+
<slot></slot>
|
|
80
|
+
</${tag}>
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
customElements.define("bds-typography", BdsTypography);
|
|
85
|
+
|
|
86
|
+
export {
|
|
87
|
+
BdsTypography
|
|
88
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import {
|
|
2
|
+
T,
|
|
3
|
+
i,
|
|
4
|
+
i2
|
|
5
|
+
} from "./chunk-LGEZYFUU.js";
|
|
6
|
+
|
|
7
|
+
// src/web-components/interaction/bds-accordion-item.ts
|
|
8
|
+
var BdsAccordionItem = class extends i2 {
|
|
9
|
+
static styles = i`
|
|
10
|
+
:host {
|
|
11
|
+
display: block;
|
|
12
|
+
border-block-end: 1px solid var(--bds-color_bg--subtle);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host(:last-child) {
|
|
16
|
+
border-block-end: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.heading {
|
|
20
|
+
margin: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.trigger {
|
|
24
|
+
all: unset;
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: space-between;
|
|
28
|
+
inline-size: 100%;
|
|
29
|
+
padding: var(--bds-space_m);
|
|
30
|
+
font-family: var(--bds-font_family--body);
|
|
31
|
+
font-size: var(--bds-font_size--body);
|
|
32
|
+
font-weight: var(--bds-font_weight--semibold);
|
|
33
|
+
color: var(--bds-color_on-bg);
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
transition: var(--bds-animation_transition);
|
|
36
|
+
box-sizing: border-box;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.trigger:disabled {
|
|
40
|
+
opacity: 0.4;
|
|
41
|
+
cursor: not-allowed;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.trigger:focus-visible {
|
|
45
|
+
outline: var(--bds-outline_default);
|
|
46
|
+
outline-offset: calc(var(--bds-outline_offset) * -1);
|
|
47
|
+
border-radius: var(--bds-border_radius--xs);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@media (hover: hover) and (pointer: fine) {
|
|
51
|
+
.trigger:not(:disabled):hover {
|
|
52
|
+
background-color: var(--bds-color_bg--subtle);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.trigger-label {
|
|
57
|
+
flex: 1;
|
|
58
|
+
text-align: start;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.chevron {
|
|
62
|
+
inline-size: 1.25rem;
|
|
63
|
+
block-size: 1.25rem;
|
|
64
|
+
flex-shrink: 0;
|
|
65
|
+
transition: transform var(--bds-animation_transition-duration) var(--bds-animation_easing);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:host([open]) .chevron {
|
|
69
|
+
transform: rotate(180deg);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.panel {
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.panel-content {
|
|
77
|
+
padding: 0 var(--bds-space_m) var(--bds-space_m);
|
|
78
|
+
color: var(--bds-color_on-bg);
|
|
79
|
+
font-size: var(--bds-font_size--body);
|
|
80
|
+
line-height: var(--bds-font_line-height--body);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@media (prefers-reduced-motion: reduce) {
|
|
84
|
+
.chevron {
|
|
85
|
+
transition: none;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
`;
|
|
89
|
+
static properties = {
|
|
90
|
+
open: { type: Boolean, reflect: true },
|
|
91
|
+
disabled: { type: Boolean, reflect: true }
|
|
92
|
+
};
|
|
93
|
+
// Stable IDs for aria-controls / aria-labelledby
|
|
94
|
+
_uid = Math.random().toString(36).slice(2, 8);
|
|
95
|
+
constructor() {
|
|
96
|
+
super();
|
|
97
|
+
this.open = false;
|
|
98
|
+
this.disabled = false;
|
|
99
|
+
}
|
|
100
|
+
_handleTriggerClick() {
|
|
101
|
+
if (this.disabled) return;
|
|
102
|
+
this.dispatchEvent(
|
|
103
|
+
new CustomEvent("bds-accordion-item-toggle", { bubbles: true, composed: true })
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
render() {
|
|
107
|
+
const triggerId = `bds-acc-trigger-${this._uid}`;
|
|
108
|
+
const panelId = `bds-acc-panel-${this._uid}`;
|
|
109
|
+
return T`
|
|
110
|
+
<h3 class="heading">
|
|
111
|
+
<button
|
|
112
|
+
type="button"
|
|
113
|
+
id=${triggerId}
|
|
114
|
+
class="trigger"
|
|
115
|
+
aria-expanded=${this.open}
|
|
116
|
+
aria-controls=${panelId}
|
|
117
|
+
?disabled=${this.disabled}
|
|
118
|
+
@click=${this._handleTriggerClick}
|
|
119
|
+
>
|
|
120
|
+
<span class="trigger-label"><slot name="header"></slot></span>
|
|
121
|
+
<svg
|
|
122
|
+
class="chevron"
|
|
123
|
+
aria-hidden="true"
|
|
124
|
+
viewBox="0 0 24 24"
|
|
125
|
+
fill="none"
|
|
126
|
+
stroke="currentColor"
|
|
127
|
+
stroke-width="2"
|
|
128
|
+
>
|
|
129
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M6 9l6 6 6-6" />
|
|
130
|
+
</svg>
|
|
131
|
+
</button>
|
|
132
|
+
</h3>
|
|
133
|
+
<div
|
|
134
|
+
id=${panelId}
|
|
135
|
+
class="panel"
|
|
136
|
+
role="region"
|
|
137
|
+
aria-labelledby=${triggerId}
|
|
138
|
+
?hidden=${!this.open}
|
|
139
|
+
>
|
|
140
|
+
<div class="panel-content"><slot></slot></div>
|
|
141
|
+
</div>
|
|
142
|
+
`;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
customElements.define("bds-accordion-item", BdsAccordionItem);
|
|
146
|
+
|
|
147
|
+
export {
|
|
148
|
+
BdsAccordionItem
|
|
149
|
+
};
|