@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,152 @@
|
|
|
1
|
+
import {
|
|
2
|
+
A,
|
|
3
|
+
T,
|
|
4
|
+
i,
|
|
5
|
+
i2
|
|
6
|
+
} from "./chunk-LGEZYFUU.js";
|
|
7
|
+
|
|
8
|
+
// src/web-components/ui/bds-notification-banner.ts
|
|
9
|
+
var BdsNotificationBanner = class extends i2 {
|
|
10
|
+
static styles = i`
|
|
11
|
+
:host {
|
|
12
|
+
display: block;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.banner {
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
gap: var(--bds-space_m);
|
|
19
|
+
padding: var(--bds-space_s) var(--bds-space_m);
|
|
20
|
+
background-color: var(--banner_bg, var(--bds-color_blue--subtle));
|
|
21
|
+
color: var(--banner_text, var(--bds-color_on-blue--subtle));
|
|
22
|
+
border-block-end: 3px solid var(--banner_border, var(--bds-color_blue));
|
|
23
|
+
font-size: var(--bds-font_size--body);
|
|
24
|
+
line-height: var(--bds-font_line-height--body);
|
|
25
|
+
inline-size: 100%;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:host([variant='info']) .banner {
|
|
30
|
+
--banner_bg: var(--bds-color_blue--subtle);
|
|
31
|
+
--banner_text: var(--bds-color_on-blue--subtle);
|
|
32
|
+
--banner_border: var(--bds-color_blue);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host([variant='success']) .banner {
|
|
36
|
+
--banner_bg: var(--bds-color_success--subtle);
|
|
37
|
+
--banner_text: var(--bds-color_on-success--subtle);
|
|
38
|
+
--banner_border: var(--bds-color_success);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:host([variant='warning']) .banner {
|
|
42
|
+
--banner_bg: var(--bds-color_orange--subtle);
|
|
43
|
+
--banner_text: var(--bds-color_on-orange--subtle);
|
|
44
|
+
--banner_border: var(--bds-color_warning);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:host([variant='error']) .banner {
|
|
48
|
+
--banner_bg: rgb(from var(--bds-color_error) r g b / 12%);
|
|
49
|
+
--banner_text: var(--bds-color_on-bg);
|
|
50
|
+
--banner_border: var(--bds-color_error);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.content {
|
|
54
|
+
flex: 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.action {
|
|
58
|
+
flex-shrink: 0;
|
|
59
|
+
display: none;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.action.has-content {
|
|
63
|
+
display: block;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.dismiss {
|
|
67
|
+
all: unset;
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
flex-shrink: 0;
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
color: currentcolor;
|
|
74
|
+
border-radius: 50%;
|
|
75
|
+
transition: var(--bds-animation_transition);
|
|
76
|
+
--bdc_color: currentcolor;
|
|
77
|
+
outline: var(--bdc-outline_width) solid var(--bdc_color);
|
|
78
|
+
outline-offset: var(--bdc-outline_offset);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.dismiss svg {
|
|
82
|
+
inline-size: 1rem;
|
|
83
|
+
block-size: 1rem;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.dismiss:focus-visible {
|
|
87
|
+
outline: var(--bds-outline_default);
|
|
88
|
+
outline-offset: var(--bds-outline_offset);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@media (hover: hover) and (pointer: fine) {
|
|
92
|
+
.dismiss:hover {
|
|
93
|
+
opacity: 0.7;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
`;
|
|
97
|
+
static properties = {
|
|
98
|
+
variant: { type: String, reflect: true },
|
|
99
|
+
dismissible: { type: Boolean, reflect: true },
|
|
100
|
+
dismissLabel: { type: String, attribute: "dismiss-label" },
|
|
101
|
+
_actionFilled: { state: true }
|
|
102
|
+
};
|
|
103
|
+
constructor() {
|
|
104
|
+
super();
|
|
105
|
+
this.variant = "info";
|
|
106
|
+
this.dismissible = false;
|
|
107
|
+
this.dismissLabel = "Dismiss notification";
|
|
108
|
+
this._actionFilled = false;
|
|
109
|
+
}
|
|
110
|
+
_onActionSlotChange(e) {
|
|
111
|
+
const slot = e.target;
|
|
112
|
+
this._actionFilled = slot.assignedNodes({ flatten: true }).length > 0;
|
|
113
|
+
}
|
|
114
|
+
get _isUrgent() {
|
|
115
|
+
return this.variant === "error" || this.variant === "warning";
|
|
116
|
+
}
|
|
117
|
+
_handleDismiss() {
|
|
118
|
+
this.dispatchEvent(new CustomEvent("bds-dismiss", { bubbles: true, composed: true }));
|
|
119
|
+
}
|
|
120
|
+
render() {
|
|
121
|
+
return T`
|
|
122
|
+
<div
|
|
123
|
+
class="banner"
|
|
124
|
+
role=${this._isUrgent ? "alert" : "status"}
|
|
125
|
+
aria-live=${this._isUrgent ? "assertive" : "polite"}
|
|
126
|
+
aria-atomic="true"
|
|
127
|
+
>
|
|
128
|
+
<div class="content"><slot></slot></div>
|
|
129
|
+
<div class="action ${this._actionFilled ? "has-content" : ""}">
|
|
130
|
+
<slot name="action" @slotchange=${this._onActionSlotChange}></slot>
|
|
131
|
+
</div>
|
|
132
|
+
${this.dismissible ? T`
|
|
133
|
+
<button
|
|
134
|
+
type="button"
|
|
135
|
+
class="dismiss"
|
|
136
|
+
@click=${this._handleDismiss}
|
|
137
|
+
aria-label=${this.dismissLabel}
|
|
138
|
+
>
|
|
139
|
+
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
140
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M18 6L6 18M6 6l12 12" />
|
|
141
|
+
</svg>
|
|
142
|
+
</button>
|
|
143
|
+
` : A}
|
|
144
|
+
</div>
|
|
145
|
+
`;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
customElements.define("bds-notification-banner", BdsNotificationBanner);
|
|
149
|
+
|
|
150
|
+
export {
|
|
151
|
+
BdsNotificationBanner
|
|
152
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
T,
|
|
3
|
+
i,
|
|
4
|
+
i2
|
|
5
|
+
} from "./chunk-LGEZYFUU.js";
|
|
6
|
+
|
|
7
|
+
// src/web-components/ui/bds-separator.ts
|
|
8
|
+
var BdsSeparator = class extends i2 {
|
|
9
|
+
static styles = i`
|
|
10
|
+
:host {
|
|
11
|
+
display: block;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:host([orientation='vertical']) {
|
|
15
|
+
display: inline-block;
|
|
16
|
+
align-self: stretch;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.separator {
|
|
20
|
+
border: none;
|
|
21
|
+
background-color: var(--separator_color, var(--bds-color_on-bg));
|
|
22
|
+
display: block;
|
|
23
|
+
inline-size: 100%;
|
|
24
|
+
block-size: var(--separator_thickness, 1px);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:host([orientation='vertical']) .separator {
|
|
28
|
+
inline-size: var(--separator_thickness, 1px);
|
|
29
|
+
block-size: 100%;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
static properties = {
|
|
33
|
+
orientation: { type: String, reflect: true }
|
|
34
|
+
};
|
|
35
|
+
constructor() {
|
|
36
|
+
super();
|
|
37
|
+
this.orientation = "horizontal";
|
|
38
|
+
}
|
|
39
|
+
render() {
|
|
40
|
+
return T`
|
|
41
|
+
<div
|
|
42
|
+
class="separator"
|
|
43
|
+
role="separator"
|
|
44
|
+
aria-orientation=${this.orientation}
|
|
45
|
+
></div>
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
customElements.define("bds-separator", BdsSeparator);
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
BdsSeparator
|
|
53
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import {
|
|
2
|
+
T,
|
|
3
|
+
i,
|
|
4
|
+
i2
|
|
5
|
+
} from "./chunk-LGEZYFUU.js";
|
|
6
|
+
|
|
7
|
+
// src/web-components/interaction/form/bds-textarea.ts
|
|
8
|
+
var BdsTextarea = class extends i2 {
|
|
9
|
+
static formAssociated = true;
|
|
10
|
+
static styles = i`
|
|
11
|
+
:host {
|
|
12
|
+
display: block;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host([disabled]) {
|
|
16
|
+
opacity: 0.5;
|
|
17
|
+
pointer-events: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.textarea {
|
|
21
|
+
inline-size: 100%;
|
|
22
|
+
font-family: var(--bds-font_family--body);
|
|
23
|
+
font-size: var(--bds-font_size--body);
|
|
24
|
+
line-height: var(--bds-font_line-height--body);
|
|
25
|
+
padding: var(--bds-space_s);
|
|
26
|
+
border: none;
|
|
27
|
+
--bdc_color: currentcolor;
|
|
28
|
+
--bdc-outline_radius: var(--bds-border_radius--xs);
|
|
29
|
+
|
|
30
|
+
outline: var(--bdc-outline_width) solid var(--bdc_color);
|
|
31
|
+
outline-offset: var(--bdc-outline_offset);
|
|
32
|
+
border-radius: var(--textarea_radius, var(--bdc-outline_radius));
|
|
33
|
+
box-shadow: var(--textarea_shadow, var(--bdc-outline_shadow));
|
|
34
|
+
background-color: var(--textarea_color_bg, var(--bds-color_bg));
|
|
35
|
+
color: var(--textarea_color, var(--bds-color_on-bg));
|
|
36
|
+
resize: vertical;
|
|
37
|
+
min-block-size: calc(var(--bds-space_m) * 5);
|
|
38
|
+
box-sizing: border-box;
|
|
39
|
+
transition: --bdc_color var(--bds-animation_transition-duration) var(--bds-animation_easing),
|
|
40
|
+
background-color var(--bds-animation_transition-duration) var(--bds-animation_easing);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.textarea:focus {
|
|
44
|
+
--bdc_color: var(--bdc_color--focus);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.textarea:focus-visible {
|
|
48
|
+
outline: var(--bds-outline_default);
|
|
49
|
+
outline-offset: var(--bds-outline_offset);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.textarea:disabled {
|
|
53
|
+
opacity: 0.5;
|
|
54
|
+
cursor: not-allowed;
|
|
55
|
+
resize: none;
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
static properties = {
|
|
59
|
+
name: { type: String, reflect: true },
|
|
60
|
+
value: { type: String },
|
|
61
|
+
placeholder: { type: String },
|
|
62
|
+
rows: { type: Number },
|
|
63
|
+
required: { type: Boolean, reflect: true },
|
|
64
|
+
disabled: { type: Boolean, reflect: true }
|
|
65
|
+
};
|
|
66
|
+
_internals;
|
|
67
|
+
constructor() {
|
|
68
|
+
super();
|
|
69
|
+
this._internals = this.attachInternals();
|
|
70
|
+
this.name = "";
|
|
71
|
+
this.value = "";
|
|
72
|
+
this.placeholder = "";
|
|
73
|
+
this.rows = 4;
|
|
74
|
+
this.required = false;
|
|
75
|
+
this.disabled = false;
|
|
76
|
+
}
|
|
77
|
+
updated(changed) {
|
|
78
|
+
super.updated(changed);
|
|
79
|
+
if (changed.has("value")) {
|
|
80
|
+
this._internals.setFormValue?.(this.value || null);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
formResetCallback() {
|
|
84
|
+
this.value = "";
|
|
85
|
+
this._internals.setFormValue?.(null);
|
|
86
|
+
}
|
|
87
|
+
_handleInput(e) {
|
|
88
|
+
this.value = e.target.value;
|
|
89
|
+
}
|
|
90
|
+
render() {
|
|
91
|
+
return T`
|
|
92
|
+
<textarea
|
|
93
|
+
class="textarea"
|
|
94
|
+
name=${this.name}
|
|
95
|
+
.value=${this.value}
|
|
96
|
+
placeholder=${this.placeholder}
|
|
97
|
+
rows=${this.rows}
|
|
98
|
+
?required=${this.required}
|
|
99
|
+
?disabled=${this.disabled}
|
|
100
|
+
@input=${this._handleInput}
|
|
101
|
+
></textarea>
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
customElements.define("bds-textarea", BdsTextarea);
|
|
106
|
+
|
|
107
|
+
export {
|
|
108
|
+
BdsTextarea
|
|
109
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {
|
|
2
|
+
A,
|
|
3
|
+
T,
|
|
4
|
+
i,
|
|
5
|
+
i2
|
|
6
|
+
} from "./chunk-LGEZYFUU.js";
|
|
7
|
+
|
|
8
|
+
// src/web-components/ui/bds-card.ts
|
|
9
|
+
var BdsCard = class extends i2 {
|
|
10
|
+
static styles = i`
|
|
11
|
+
:host {
|
|
12
|
+
display: block;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.card {
|
|
16
|
+
background-color: var(--card_color, var(--bds-color_bg));
|
|
17
|
+
color: var(--card_on-color, var(--bds-color_on-bg));
|
|
18
|
+
border-radius: var(--bds-border_radius--m);
|
|
19
|
+
transition: all 0.3s ease;
|
|
20
|
+
position: relative;
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
inline-size: 100%;
|
|
23
|
+
text-align: inherit;
|
|
24
|
+
font: inherit;
|
|
25
|
+
border: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.card.--default { box-shadow: var(--bds-shadow_s); }
|
|
29
|
+
.card.--elevated { box-shadow: var(--bds-shadow_m); }
|
|
30
|
+
|
|
31
|
+
.card.--outlined {
|
|
32
|
+
--bdc_color: currentcolor;
|
|
33
|
+
outline: var(--bdc-outline_width) solid var(--bdc_color);
|
|
34
|
+
outline-offset: var(--bdc-outline_offset);
|
|
35
|
+
box-shadow: var(--bds-shadow_s);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.card.--padding-none { padding: 0; }
|
|
39
|
+
.card.--padding-small { padding: var(--bds-space_s); }
|
|
40
|
+
.card.--padding-medium { padding: var(--bds-space_m); }
|
|
41
|
+
.card.--padding-large { padding: var(--bds-space_l); }
|
|
42
|
+
|
|
43
|
+
.card.--text-start { text-align: start; }
|
|
44
|
+
.card.--text-center { text-align: center; }
|
|
45
|
+
.card.--text-end { text-align: end; }
|
|
46
|
+
|
|
47
|
+
.card.--clickable {
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
display: block;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.card.--clickable:focus-visible {
|
|
53
|
+
outline: 2px solid var(--color_focus, currentcolor);
|
|
54
|
+
outline-offset: 2px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.card.--clickable:active {
|
|
58
|
+
transform: translateY(0);
|
|
59
|
+
box-shadow: var(--bds-shadow_s);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@media (hover: hover) and (pointer: fine) {
|
|
63
|
+
.card.--clickable:hover {
|
|
64
|
+
transform: translateY(-2px);
|
|
65
|
+
box-shadow: var(--bds-shadow_xl);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.card.--default:hover { box-shadow: var(--bds-shadow_m); }
|
|
69
|
+
.card.--elevated:hover { box-shadow: var(--bds-shadow_2xl); }
|
|
70
|
+
.card.--outlined:hover { box-shadow: var(--bds-shadow_s); }
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
static properties = {
|
|
74
|
+
variant: { type: String, reflect: true },
|
|
75
|
+
padding: { type: String, reflect: true },
|
|
76
|
+
textAlign: { type: String, attribute: "text-align", reflect: true },
|
|
77
|
+
clickable: { type: Boolean, reflect: true },
|
|
78
|
+
ariaLabel: { type: String, attribute: "aria-label" }
|
|
79
|
+
};
|
|
80
|
+
constructor() {
|
|
81
|
+
super();
|
|
82
|
+
this.variant = "default";
|
|
83
|
+
this.padding = "medium";
|
|
84
|
+
this.textAlign = "start";
|
|
85
|
+
this.clickable = false;
|
|
86
|
+
this.ariaLabel = "";
|
|
87
|
+
}
|
|
88
|
+
_handleClick() {
|
|
89
|
+
this.dispatchEvent(new CustomEvent("bds-click", { bubbles: true, composed: true }));
|
|
90
|
+
}
|
|
91
|
+
render() {
|
|
92
|
+
const classes = [
|
|
93
|
+
"card",
|
|
94
|
+
`--${this.variant}`,
|
|
95
|
+
`--padding-${this.padding}`,
|
|
96
|
+
`--text-${this.textAlign}`,
|
|
97
|
+
this.clickable ? "--clickable" : ""
|
|
98
|
+
].filter(Boolean).join(" ");
|
|
99
|
+
if (this.clickable) {
|
|
100
|
+
return T`
|
|
101
|
+
<button
|
|
102
|
+
type="button"
|
|
103
|
+
class=${classes}
|
|
104
|
+
@click=${this._handleClick}
|
|
105
|
+
aria-label=${this.ariaLabel || A}
|
|
106
|
+
>
|
|
107
|
+
<slot></slot>
|
|
108
|
+
</button>
|
|
109
|
+
`;
|
|
110
|
+
}
|
|
111
|
+
return T`<div class=${classes}><slot></slot></div>`;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
customElements.define("bds-card", BdsCard);
|
|
115
|
+
|
|
116
|
+
export {
|
|
117
|
+
BdsCard
|
|
118
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {
|
|
2
|
+
s,
|
|
3
|
+
u
|
|
4
|
+
} from "./chunk-QPOKHLMQ.js";
|
|
5
|
+
import {
|
|
6
|
+
A,
|
|
7
|
+
T,
|
|
8
|
+
i,
|
|
9
|
+
i2
|
|
10
|
+
} from "./chunk-LGEZYFUU.js";
|
|
11
|
+
|
|
12
|
+
// src/web-components/ui/bds-section-header.ts
|
|
13
|
+
var BdsSectionHeader = class extends i2 {
|
|
14
|
+
static styles = i`
|
|
15
|
+
:host {
|
|
16
|
+
display: block;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.header {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
gap: var(--bds-space_m);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.title {
|
|
26
|
+
color: var(--sectionHeader-title-color, var(--bds-color_on-bg));
|
|
27
|
+
margin: 0;
|
|
28
|
+
font-family: var(--bds-font_family--body);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.subtitle {
|
|
32
|
+
color: var(--sectionHeader_subtitle-color, var(--bds-color_grey--strong));
|
|
33
|
+
margin: 0;
|
|
34
|
+
font-family: var(--bds-font_family--body);
|
|
35
|
+
font-weight: var(--bds-font_weight--medium);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.header.--start { align-items: flex-start; text-align: start; }
|
|
39
|
+
.header.--center { align-items: center; text-align: center; }
|
|
40
|
+
.header.--end { align-items: flex-end; text-align: end; }
|
|
41
|
+
|
|
42
|
+
.header.--small .title { font-size: var(--bds-font_size--heading-1); line-height: var(--bds-font_line-height--heading); font-weight: var(--bds-font_weight--bold); }
|
|
43
|
+
.header.--small .subtitle { font-size: var(--bds-font_size--body); line-height: 1.4; }
|
|
44
|
+
|
|
45
|
+
.header.--medium .title { font-size: var(--bds-font_size--display); line-height: var(--bds-font_line-height--display); font-weight: var(--bds-font_weight--bold); }
|
|
46
|
+
.header.--medium .subtitle { font-size: var(--bds-font_size--heading-3); line-height: 1.3; }
|
|
47
|
+
|
|
48
|
+
.header.--large .title { font-size: var(--bds-font_size--display); line-height: var(--bds-font_line-height--display); font-weight: var(--bds-font_weight--bold); letter-spacing: var(--bds-font_tracking--tight); }
|
|
49
|
+
.header.--large .subtitle { font-size: var(--bds-font_size--heading-2); line-height: 1.3; font-weight: var(--bds-font_weight--medium); }
|
|
50
|
+
`;
|
|
51
|
+
static properties = {
|
|
52
|
+
title: { type: String },
|
|
53
|
+
subtitle: { type: String },
|
|
54
|
+
alignment: { type: String, reflect: true },
|
|
55
|
+
size: { type: String, reflect: true },
|
|
56
|
+
titleAs: { type: String, attribute: "title-as" }
|
|
57
|
+
};
|
|
58
|
+
constructor() {
|
|
59
|
+
super();
|
|
60
|
+
this.title = "";
|
|
61
|
+
this.subtitle = "";
|
|
62
|
+
this.alignment = "start";
|
|
63
|
+
this.size = "medium";
|
|
64
|
+
this.titleAs = "h2";
|
|
65
|
+
}
|
|
66
|
+
render() {
|
|
67
|
+
const tag = s(this.titleAs || "h2");
|
|
68
|
+
return T`
|
|
69
|
+
<div class="header --${this.alignment} --${this.size}">
|
|
70
|
+
${u`<${tag} class="title">${this.title}</${tag}>`}
|
|
71
|
+
${this.subtitle ? T`<p class="subtitle">${this.subtitle}</p>` : A}
|
|
72
|
+
</div>
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
customElements.define("bds-section-header", BdsSectionHeader);
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
BdsSectionHeader
|
|
80
|
+
};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import {
|
|
2
|
+
T,
|
|
3
|
+
i,
|
|
4
|
+
i2
|
|
5
|
+
} from "./chunk-LGEZYFUU.js";
|
|
6
|
+
|
|
7
|
+
// src/web-components/interaction/bds-toast-provider.ts
|
|
8
|
+
var BdsToastProvider = class extends i2 {
|
|
9
|
+
static styles = i`
|
|
10
|
+
:host {
|
|
11
|
+
display: contents;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.container {
|
|
15
|
+
/* Reset UA popover defaults */
|
|
16
|
+
position: fixed;
|
|
17
|
+
inset: unset;
|
|
18
|
+
bottom: var(--bds-space_xl, 2rem);
|
|
19
|
+
right: var(--bds-space_xl, 2rem);
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
gap: var(--bds-space_m, 1rem);
|
|
23
|
+
border: none;
|
|
24
|
+
padding: 0;
|
|
25
|
+
background: transparent;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.toast {
|
|
29
|
+
padding: var(--bds-space_m) var(--bds-space_l);
|
|
30
|
+
background-color: var(--toast_color, var(--bds-color_bg));
|
|
31
|
+
color: var(--toast_on-color, var(--bds-color_on-bg));
|
|
32
|
+
border-radius: var(--bds-border_radius--s);
|
|
33
|
+
box-shadow: var(--bds-shadow_s);
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
gap: var(--bds-space_m);
|
|
37
|
+
min-width: 300px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.toast.--variant_success {
|
|
41
|
+
--toast_color: var(--bds-color_success);
|
|
42
|
+
--toast_on-color: var(--bds-color_on-success);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.toast.--variant_warning {
|
|
46
|
+
--toast_color: var(--bds-color_warning);
|
|
47
|
+
--toast_on-color: var(--bds-color_on-warning);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.toast.--variant_info {
|
|
51
|
+
--toast_color: var(--bds-color_bg--subtle);
|
|
52
|
+
--toast_on-color: var(--bds-color_on-bg--subtle);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.toast.--variant_error {
|
|
56
|
+
--toast_color: var(--bds-color_error);
|
|
57
|
+
--toast_on-color: var(--bds-color_on-error);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.message {
|
|
61
|
+
flex: 1;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.close {
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
flex-shrink: 0;
|
|
69
|
+
width: 1.25rem;
|
|
70
|
+
height: 1.25rem;
|
|
71
|
+
padding: 0;
|
|
72
|
+
background: none;
|
|
73
|
+
border: none;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
color: var(--toast_on-color);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.close svg {
|
|
79
|
+
width: 1rem;
|
|
80
|
+
height: 1rem;
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
static properties = {
|
|
84
|
+
_toasts: { state: true }
|
|
85
|
+
};
|
|
86
|
+
constructor() {
|
|
87
|
+
super();
|
|
88
|
+
this._toasts = [];
|
|
89
|
+
}
|
|
90
|
+
connectedCallback() {
|
|
91
|
+
super.connectedCallback();
|
|
92
|
+
document.addEventListener("bds-show-toast", this._onShowToastEvent);
|
|
93
|
+
}
|
|
94
|
+
disconnectedCallback() {
|
|
95
|
+
super.disconnectedCallback();
|
|
96
|
+
document.removeEventListener("bds-show-toast", this._onShowToastEvent);
|
|
97
|
+
}
|
|
98
|
+
// Sync the popover's top-layer visibility with the toast queue —
|
|
99
|
+
// mirrors Toast.tsx's useEffect([toasts.length]).
|
|
100
|
+
updated() {
|
|
101
|
+
const container = this.shadowRoot?.querySelector("[popover]");
|
|
102
|
+
if (!container) return;
|
|
103
|
+
if (this._toasts.length > 0) {
|
|
104
|
+
container.showPopover?.();
|
|
105
|
+
} else {
|
|
106
|
+
try {
|
|
107
|
+
container.hidePopover?.();
|
|
108
|
+
} catch {
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
showToast(message, variant = "info") {
|
|
113
|
+
const id = Math.random().toString(36).slice(2, 9);
|
|
114
|
+
this._toasts = [...this._toasts, { id, message, variant }];
|
|
115
|
+
setTimeout(() => this._removeToast(id), 5e3);
|
|
116
|
+
}
|
|
117
|
+
_removeToast(id) {
|
|
118
|
+
this._toasts = this._toasts.filter((t) => t.id !== id);
|
|
119
|
+
}
|
|
120
|
+
_onShowToastEvent = (e) => {
|
|
121
|
+
const { message, variant } = e.detail ?? {};
|
|
122
|
+
if (message) this.showToast(message, variant);
|
|
123
|
+
};
|
|
124
|
+
static show(message, variant) {
|
|
125
|
+
const provider = document.querySelector("bds-toast-provider");
|
|
126
|
+
provider?.showToast(message, variant ?? "info");
|
|
127
|
+
}
|
|
128
|
+
render() {
|
|
129
|
+
return T`
|
|
130
|
+
<slot></slot>
|
|
131
|
+
<div
|
|
132
|
+
popover="manual"
|
|
133
|
+
role="region"
|
|
134
|
+
aria-label="Notifications"
|
|
135
|
+
class="container"
|
|
136
|
+
>
|
|
137
|
+
${this._toasts.map((t) => T`
|
|
138
|
+
<div
|
|
139
|
+
class="toast --variant_${t.variant}"
|
|
140
|
+
role="status"
|
|
141
|
+
aria-live="polite"
|
|
142
|
+
aria-atomic="true"
|
|
143
|
+
>
|
|
144
|
+
<span class="message">${t.message}</span>
|
|
145
|
+
<button
|
|
146
|
+
type="button"
|
|
147
|
+
class="close"
|
|
148
|
+
@click=${() => this._removeToast(t.id)}
|
|
149
|
+
aria-label="Dismiss"
|
|
150
|
+
>
|
|
151
|
+
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
152
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M18 6L6 18M6 6l12 12" />
|
|
153
|
+
</svg>
|
|
154
|
+
</button>
|
|
155
|
+
</div>
|
|
156
|
+
`)}
|
|
157
|
+
</div>
|
|
158
|
+
`;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
customElements.define("bds-toast-provider", BdsToastProvider);
|
|
162
|
+
|
|
163
|
+
export {
|
|
164
|
+
BdsToastProvider
|
|
165
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./chunk-CAPI25CU.js";
|