@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,90 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsAlert.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# <bds-alert>
|
|
7
|
+
|
|
8
|
+
Framework-agnostic alert custom element for inline status messages. Supports four semantic variants, an optional title, and a dismissible mode.
|
|
9
|
+
|
|
10
|
+
> **Status: experimental** — API may change before stable release.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import '@boostdev/components/web-components';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
19
|
+
|
|
20
|
+
### All variants
|
|
21
|
+
<Canvas of={Stories.AllVariants} />
|
|
22
|
+
|
|
23
|
+
### Info
|
|
24
|
+
<Canvas of={Stories.Info} />
|
|
25
|
+
|
|
26
|
+
### Success
|
|
27
|
+
<Canvas of={Stories.Success} />
|
|
28
|
+
|
|
29
|
+
### Warning
|
|
30
|
+
<Canvas of={Stories.Warning} />
|
|
31
|
+
|
|
32
|
+
### Error
|
|
33
|
+
<Canvas of={Stories.Error} />
|
|
34
|
+
|
|
35
|
+
### With title
|
|
36
|
+
<Canvas of={Stories.WithTitle} />
|
|
37
|
+
|
|
38
|
+
### Dismissible
|
|
39
|
+
<Canvas of={Stories.Dismissible} />
|
|
40
|
+
|
|
41
|
+
## Props
|
|
42
|
+
|
|
43
|
+
<ArgTypes of={Stories} />
|
|
44
|
+
|
|
45
|
+
## Attributes
|
|
46
|
+
|
|
47
|
+
| Attribute | Type | Default | Description |
|
|
48
|
+
|-----------|------|---------|-------------|
|
|
49
|
+
| `variant` | `"info" \| "success" \| "warning" \| "error"` | `"info"` | Semantic colour and icon |
|
|
50
|
+
| `title` | string | — | Optional heading displayed above body content |
|
|
51
|
+
| `dismissible` | boolean | `false` | Shows a dismiss (×) button |
|
|
52
|
+
|
|
53
|
+
## Slots
|
|
54
|
+
|
|
55
|
+
| Slot | Description |
|
|
56
|
+
|------|-------------|
|
|
57
|
+
| `(default)` | Alert body text or content |
|
|
58
|
+
| `icon` | Custom icon, placed left of the content area |
|
|
59
|
+
|
|
60
|
+
## Events
|
|
61
|
+
|
|
62
|
+
| Event | Detail | Bubbles | Composed | Description |
|
|
63
|
+
|-------|--------|---------|----------|-------------|
|
|
64
|
+
| `bds-dismiss` | — | Yes | Yes | Fired when the dismiss button is clicked |
|
|
65
|
+
|
|
66
|
+
## Usage in plain HTML
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<bds-alert variant="success" title="Saved">
|
|
70
|
+
Your changes have been saved successfully.
|
|
71
|
+
</bds-alert>
|
|
72
|
+
|
|
73
|
+
<bds-alert variant="error" dismissible>
|
|
74
|
+
Something went wrong. Please try again.
|
|
75
|
+
</bds-alert>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Listen for dismiss:
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
document.querySelector('bds-alert').addEventListener('bds-dismiss', () => {
|
|
82
|
+
// remove or hide the element
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Accessibility
|
|
87
|
+
|
|
88
|
+
- `error` and `warning` use `role="alert"` + `aria-live="assertive"` — content is announced immediately
|
|
89
|
+
- `info` and `success` use `role="status"` + `aria-live="polite"` — content is announced at the next opportunity
|
|
90
|
+
- The dismiss button has an accessible label; do not rely solely on its icon
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as Stories from './BdsBadge.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# <bds-badge>
|
|
7
|
+
|
|
8
|
+
Framework-agnostic badge custom element for short status labels and counts. Five semantic variants covering the common status palette.
|
|
9
|
+
|
|
10
|
+
> **Status: experimental** — API may change before stable release.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import '@boostdev/components/web-components';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
19
|
+
|
|
20
|
+
### All variants
|
|
21
|
+
<Canvas of={Stories.AllVariants} />
|
|
22
|
+
|
|
23
|
+
### Primary
|
|
24
|
+
<Canvas of={Stories.Primary} />
|
|
25
|
+
|
|
26
|
+
### Secondary
|
|
27
|
+
<Canvas of={Stories.Secondary} />
|
|
28
|
+
|
|
29
|
+
### Success
|
|
30
|
+
<Canvas of={Stories.Success} />
|
|
31
|
+
|
|
32
|
+
### Error
|
|
33
|
+
<Canvas of={Stories.Error} />
|
|
34
|
+
|
|
35
|
+
### Warning
|
|
36
|
+
<Canvas of={Stories.Warning} />
|
|
37
|
+
|
|
38
|
+
## Props
|
|
39
|
+
|
|
40
|
+
<ArgTypes of={Stories} />
|
|
41
|
+
|
|
42
|
+
## Attributes
|
|
43
|
+
|
|
44
|
+
| Attribute | Type | Default | Description |
|
|
45
|
+
|-----------|------|---------|-------------|
|
|
46
|
+
| `variant` | `"primary" \| "secondary" \| "success" \| "error" \| "warning"` | `"primary"` | Semantic colour |
|
|
47
|
+
|
|
48
|
+
## Slots
|
|
49
|
+
|
|
50
|
+
| Slot | Description |
|
|
51
|
+
|------|-------------|
|
|
52
|
+
| `(default)` | Badge label text |
|
|
53
|
+
|
|
54
|
+
## CSS Custom Properties
|
|
55
|
+
|
|
56
|
+
| Property | Description |
|
|
57
|
+
|----------|-------------|
|
|
58
|
+
| `--badge_bg` | Badge background colour |
|
|
59
|
+
| `--badge_text` | Badge text colour |
|
|
60
|
+
| `--badge_font-size` | Font size |
|
|
61
|
+
| `--badge_radius` | Border radius |
|
|
62
|
+
|
|
63
|
+
## Usage in plain HTML
|
|
64
|
+
|
|
65
|
+
```html
|
|
66
|
+
<bds-badge variant="success">Active</bds-badge>
|
|
67
|
+
<bds-badge variant="error">3</bds-badge>
|
|
68
|
+
<bds-badge variant="warning">Pending</bds-badge>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Accessibility
|
|
72
|
+
|
|
73
|
+
- Badge is a purely visual element — wrap in an element with `aria-label` when the colour alone conveys meaning (e.g. status indicators)
|
|
74
|
+
- For count badges next to icon buttons, use `aria-label` on the parent: `aria-label="3 notifications"`
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { fixture, cleanup } from '../test/helpers';
|
|
2
|
+
import { BdsAvatar } from './bds-avatar';
|
|
3
|
+
|
|
4
|
+
describe('bds-avatar', () => {
|
|
5
|
+
it('is registered as a custom element', () => {
|
|
6
|
+
expect(customElements.get('bds-avatar')).toBe(BdsAvatar);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('defaults to size="medium"', async () => {
|
|
10
|
+
const el = await fixture('<bds-avatar></bds-avatar>');
|
|
11
|
+
expect(el.getAttribute('size')).toBe('medium');
|
|
12
|
+
cleanup(el);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('renders an <img> when src is set', async () => {
|
|
16
|
+
const el = await fixture('<bds-avatar src="/photo.jpg" name="Jane Doe"></bds-avatar>');
|
|
17
|
+
const img = el.shadowRoot!.querySelector('img');
|
|
18
|
+
expect(img).not.toBeNull();
|
|
19
|
+
expect(img!.getAttribute('src')).toBe('/photo.jpg');
|
|
20
|
+
cleanup(el);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('img alt defaults to name when alt is not set', async () => {
|
|
24
|
+
const el = await fixture('<bds-avatar src="/photo.jpg" name="Jane Doe"></bds-avatar>');
|
|
25
|
+
const img = el.shadowRoot!.querySelector('img');
|
|
26
|
+
expect(img!.getAttribute('alt')).toBe('Jane Doe');
|
|
27
|
+
cleanup(el);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('img uses explicit alt when set', async () => {
|
|
31
|
+
const el = await fixture('<bds-avatar src="/photo.jpg" alt="Custom alt" name="Jane Doe"></bds-avatar>');
|
|
32
|
+
const img = el.shadowRoot!.querySelector('img');
|
|
33
|
+
expect(img!.getAttribute('alt')).toBe('Custom alt');
|
|
34
|
+
cleanup(el);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('renders fallback with initials when src is not set', async () => {
|
|
38
|
+
const el = await fixture('<bds-avatar name="Jane Doe"></bds-avatar>');
|
|
39
|
+
const fallback = el.shadowRoot!.querySelector('.fallback');
|
|
40
|
+
expect(fallback).not.toBeNull();
|
|
41
|
+
expect(fallback!.getAttribute('role')).toBe('img');
|
|
42
|
+
const initials = el.shadowRoot!.querySelector('.initials');
|
|
43
|
+
expect(initials!.textContent).toBe('JD');
|
|
44
|
+
cleanup(el);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('computes initials from first two words', async () => {
|
|
48
|
+
const el = await fixture('<bds-avatar name="Alice Bob Charlie"></bds-avatar>');
|
|
49
|
+
const initials = el.shadowRoot!.querySelector('.initials');
|
|
50
|
+
expect(initials!.textContent).toBe('AB');
|
|
51
|
+
cleanup(el);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('fallback aria-label is the name', async () => {
|
|
55
|
+
const el = await fixture('<bds-avatar name="Jane Doe"></bds-avatar>');
|
|
56
|
+
const fallback = el.shadowRoot!.querySelector('.fallback');
|
|
57
|
+
expect(fallback!.getAttribute('aria-label')).toBe('Jane Doe');
|
|
58
|
+
cleanup(el);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('fallback aria-label defaults to "User avatar" when name is not set', async () => {
|
|
62
|
+
const el = await fixture('<bds-avatar></bds-avatar>');
|
|
63
|
+
const fallback = el.shadowRoot!.querySelector('.fallback');
|
|
64
|
+
expect(fallback!.getAttribute('aria-label')).toBe('User avatar');
|
|
65
|
+
cleanup(el);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('reflects size property to attribute', async () => {
|
|
69
|
+
const el = await fixture('<bds-avatar></bds-avatar>') as BdsAvatar;
|
|
70
|
+
el.size = 'large';
|
|
71
|
+
await el.updateComplete;
|
|
72
|
+
expect(el.getAttribute('size')).toBe('large');
|
|
73
|
+
cleanup(el);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { LitElement, css, html, nothing } from 'lit';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `<bds-avatar>` — framework-agnostic Avatar custom element.
|
|
5
|
+
*
|
|
6
|
+
* Shows an image when `src` is set; falls back to initials derived from `name`.
|
|
7
|
+
*
|
|
8
|
+
* Attributes:
|
|
9
|
+
* src — image URL
|
|
10
|
+
* alt — image alt text (defaults to `name` or "User avatar")
|
|
11
|
+
* name — full name; used to compute initials and as fallback aria-label
|
|
12
|
+
* size — "small" | "medium" (default) | "large"
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <bds-avatar src="/photo.jpg" name="Jane Doe"></bds-avatar>
|
|
16
|
+
* <bds-avatar name="Jane Doe" size="large"></bds-avatar>
|
|
17
|
+
*/
|
|
18
|
+
export class BdsAvatar extends LitElement {
|
|
19
|
+
static styles = css`
|
|
20
|
+
:host {
|
|
21
|
+
display: inline-flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
inline-size: var(--avatar_size, 3em);
|
|
25
|
+
block-size: var(--avatar_size, 3em);
|
|
26
|
+
border-radius: 50%;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
flex-shrink: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:host([size='small']) { --avatar_size: 2em; }
|
|
32
|
+
:host([size='medium']) { --avatar_size: 3em; }
|
|
33
|
+
:host([size='large']) { --avatar_size: 4.5em; }
|
|
34
|
+
|
|
35
|
+
.fallback {
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
inline-size: 100%;
|
|
40
|
+
block-size: 100%;
|
|
41
|
+
background-color: var(--avatar_bg, var(--bds-color_blue));
|
|
42
|
+
color: var(--avatar_text, var(--bds-color_on-blue));
|
|
43
|
+
font-weight: var(--bds-font_weight--semibold);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.initials {
|
|
47
|
+
line-height: 1;
|
|
48
|
+
user-select: none;
|
|
49
|
+
font-size: var(--bds-font_size--body);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
:host([size='small']) .initials { font-size: var(--bds-font_size--body--s); }
|
|
53
|
+
:host([size='large']) .initials { font-size: var(--bds-font_size--heading-3); }
|
|
54
|
+
|
|
55
|
+
.image {
|
|
56
|
+
inline-size: 100%;
|
|
57
|
+
block-size: 100%;
|
|
58
|
+
object-fit: cover;
|
|
59
|
+
display: block;
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
static properties = {
|
|
64
|
+
src: { type: String },
|
|
65
|
+
alt: { type: String },
|
|
66
|
+
name: { type: String },
|
|
67
|
+
size: { type: String, reflect: true },
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
declare src: string;
|
|
71
|
+
declare alt: string;
|
|
72
|
+
declare name: string;
|
|
73
|
+
declare size: 'small' | 'medium' | 'large';
|
|
74
|
+
|
|
75
|
+
constructor() {
|
|
76
|
+
super();
|
|
77
|
+
this.src = '';
|
|
78
|
+
this.alt = '';
|
|
79
|
+
this.name = '';
|
|
80
|
+
this.size = 'medium';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private get _initials(): string {
|
|
84
|
+
if (!this.name) return '';
|
|
85
|
+
return this.name
|
|
86
|
+
.split(' ')
|
|
87
|
+
.filter(Boolean)
|
|
88
|
+
.slice(0, 2)
|
|
89
|
+
.map(word => word[0].toUpperCase())
|
|
90
|
+
.join('');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
render() {
|
|
94
|
+
if (this.src) {
|
|
95
|
+
return html`<img
|
|
96
|
+
class="image"
|
|
97
|
+
src=${this.src}
|
|
98
|
+
alt=${this.alt || this.name || 'User avatar'}
|
|
99
|
+
/>`;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return html`
|
|
103
|
+
<span
|
|
104
|
+
class="fallback"
|
|
105
|
+
role="img"
|
|
106
|
+
aria-label=${this.name || 'User avatar'}
|
|
107
|
+
>
|
|
108
|
+
${this._initials
|
|
109
|
+
? html`<span class="initials" aria-hidden="true">${this._initials}</span>`
|
|
110
|
+
: nothing}
|
|
111
|
+
</span>
|
|
112
|
+
`;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
customElements.define('bds-avatar', BdsAvatar);
|
|
117
|
+
|
|
118
|
+
declare global {
|
|
119
|
+
interface HTMLElementTagNameMap {
|
|
120
|
+
'bds-avatar': BdsAvatar;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { fixture, cleanup } from '../test/helpers';
|
|
2
|
+
import { BdsBreadcrumb } from './bds-breadcrumb';
|
|
3
|
+
|
|
4
|
+
describe('bds-breadcrumb', () => {
|
|
5
|
+
it('is registered as a custom element', () => {
|
|
6
|
+
expect(customElements.get('bds-breadcrumb')).toBe(BdsBreadcrumb);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('renders a <nav> with aria-label="Breadcrumb"', async () => {
|
|
10
|
+
const el = await fixture('<bds-breadcrumb></bds-breadcrumb>');
|
|
11
|
+
const nav = el.shadowRoot!.querySelector('nav');
|
|
12
|
+
expect(nav).not.toBeNull();
|
|
13
|
+
expect(nav!.getAttribute('aria-label')).toBe('Breadcrumb');
|
|
14
|
+
cleanup(el);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('renders items as list items', async () => {
|
|
18
|
+
const el = await fixture('<bds-breadcrumb></bds-breadcrumb>') as BdsBreadcrumb;
|
|
19
|
+
el.items = [{ label: 'Home', href: '/' }, { label: 'Products', href: '/products' }, { label: 'Item' }];
|
|
20
|
+
await el.updateComplete;
|
|
21
|
+
const items = el.shadowRoot!.querySelectorAll('.item');
|
|
22
|
+
expect(items.length).toBe(3);
|
|
23
|
+
cleanup(el);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('renders links for non-last items', async () => {
|
|
27
|
+
const el = await fixture('<bds-breadcrumb></bds-breadcrumb>') as BdsBreadcrumb;
|
|
28
|
+
el.items = [{ label: 'Home', href: '/' }, { label: 'Current' }];
|
|
29
|
+
await el.updateComplete;
|
|
30
|
+
const link = el.shadowRoot!.querySelector('a.link');
|
|
31
|
+
expect(link).not.toBeNull();
|
|
32
|
+
expect(link!.getAttribute('href')).toBe('/');
|
|
33
|
+
cleanup(el);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('renders current page as span with aria-current="page"', async () => {
|
|
37
|
+
const el = await fixture('<bds-breadcrumb></bds-breadcrumb>') as BdsBreadcrumb;
|
|
38
|
+
el.items = [{ label: 'Home', href: '/' }, { label: 'Current' }];
|
|
39
|
+
await el.updateComplete;
|
|
40
|
+
const current = el.shadowRoot!.querySelector('.current');
|
|
41
|
+
expect(current).not.toBeNull();
|
|
42
|
+
expect(current!.getAttribute('aria-current')).toBe('page');
|
|
43
|
+
expect(current!.textContent).toBe('Current');
|
|
44
|
+
cleanup(el);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('renders separators between items', async () => {
|
|
48
|
+
const el = await fixture('<bds-breadcrumb></bds-breadcrumb>') as BdsBreadcrumb;
|
|
49
|
+
el.items = [{ label: 'Home', href: '/' }, { label: 'Products', href: '/p' }, { label: 'Item' }];
|
|
50
|
+
await el.updateComplete;
|
|
51
|
+
const separators = el.shadowRoot!.querySelectorAll('.separator');
|
|
52
|
+
expect(separators.length).toBe(2); // between each pair
|
|
53
|
+
cleanup(el);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { LitElement, css, html } from 'lit';
|
|
2
|
+
|
|
3
|
+
export interface BreadcrumbItem {
|
|
4
|
+
label: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* `<bds-breadcrumb>` — framework-agnostic Breadcrumb custom element.
|
|
10
|
+
*
|
|
11
|
+
* Attributes:
|
|
12
|
+
* items — JSON string array of `{ label: string, href?: string }` objects.
|
|
13
|
+
* The last item is treated as the current page (no link).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <bds-breadcrumb items='[{"label":"Home","href":"/"},{"label":"Products","href":"/products"},{"label":"Item"}]'></bds-breadcrumb>
|
|
17
|
+
*/
|
|
18
|
+
export class BdsBreadcrumb extends LitElement {
|
|
19
|
+
static styles = css`
|
|
20
|
+
:host {
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.breadcrumb {
|
|
25
|
+
font-size: var(--bds-font_size--body--s);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.list {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-wrap: wrap;
|
|
31
|
+
align-items: center;
|
|
32
|
+
gap: var(--bds-space_xxs);
|
|
33
|
+
list-style: none;
|
|
34
|
+
margin: 0;
|
|
35
|
+
padding: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.item {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
gap: var(--bds-space_xxs);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.link {
|
|
45
|
+
color: var(--bds-color_interactive_on-bg);
|
|
46
|
+
text-decoration: none;
|
|
47
|
+
transition: var(--bds-animation_transition);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.link:focus-visible {
|
|
51
|
+
outline: var(--bds-outline_default);
|
|
52
|
+
outline-offset: var(--bds-outline_offset);
|
|
53
|
+
border-radius: var(--bds-border_radius--xs);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media (hover: hover) and (pointer: fine) {
|
|
57
|
+
.link:hover {
|
|
58
|
+
text-decoration: underline;
|
|
59
|
+
text-underline-offset: 0.2em;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.separator {
|
|
64
|
+
color: var(--bds-color_on-bg--subtle);
|
|
65
|
+
user-select: none;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.current {
|
|
69
|
+
color: var(--bds-color_on-bg--subtle);
|
|
70
|
+
font-weight: var(--bds-font_weight--semibold);
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
static properties = {
|
|
75
|
+
items: { type: Array },
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
declare items: BreadcrumbItem[];
|
|
79
|
+
|
|
80
|
+
constructor() {
|
|
81
|
+
super();
|
|
82
|
+
this.items = [];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
render() {
|
|
86
|
+
return html`
|
|
87
|
+
<nav class="breadcrumb" aria-label="Breadcrumb">
|
|
88
|
+
<ol class="list">
|
|
89
|
+
${this.items.map((item, index) => {
|
|
90
|
+
const isLast = index === this.items.length - 1;
|
|
91
|
+
return html`
|
|
92
|
+
<li class="item">
|
|
93
|
+
${isLast
|
|
94
|
+
? html`<span class="current" aria-current="page">${item.label}</span>`
|
|
95
|
+
: html`
|
|
96
|
+
<a class="link" href=${item.href ?? '#'}>${item.label}</a>
|
|
97
|
+
<span class="separator" aria-hidden="true">›</span>
|
|
98
|
+
`}
|
|
99
|
+
</li>
|
|
100
|
+
`;
|
|
101
|
+
})}
|
|
102
|
+
</ol>
|
|
103
|
+
</nav>
|
|
104
|
+
`;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
customElements.define('bds-breadcrumb', BdsBreadcrumb);
|
|
109
|
+
|
|
110
|
+
declare global {
|
|
111
|
+
interface HTMLElementTagNameMap {
|
|
112
|
+
'bds-breadcrumb': BdsBreadcrumb;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { fixture, cleanup } from '../test/helpers';
|
|
2
|
+
import { BdsCard } from './bds-card';
|
|
3
|
+
|
|
4
|
+
describe('bds-card', () => {
|
|
5
|
+
it('is registered as a custom element', () => {
|
|
6
|
+
expect(customElements.get('bds-card')).toBe(BdsCard);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('defaults to variant="default", padding="medium", text-align="start"', async () => {
|
|
10
|
+
const el = await fixture('<bds-card>Content</bds-card>') as BdsCard;
|
|
11
|
+
expect(el.getAttribute('variant')).toBe('default');
|
|
12
|
+
expect(el.getAttribute('padding')).toBe('medium');
|
|
13
|
+
expect(el.getAttribute('text-align')).toBe('start');
|
|
14
|
+
cleanup(el);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('renders a <div> when not clickable', async () => {
|
|
18
|
+
const el = await fixture('<bds-card>Content</bds-card>');
|
|
19
|
+
expect(el.shadowRoot!.querySelector('div.card')).not.toBeNull();
|
|
20
|
+
expect(el.shadowRoot!.querySelector('button')).toBeNull();
|
|
21
|
+
cleanup(el);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('renders a <button> when clickable is set', async () => {
|
|
25
|
+
const el = await fixture('<bds-card clickable>Content</bds-card>');
|
|
26
|
+
expect(el.shadowRoot!.querySelector('button.card')).not.toBeNull();
|
|
27
|
+
expect(el.shadowRoot!.querySelector('div.card')).toBeNull();
|
|
28
|
+
cleanup(el);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('button has type="button"', async () => {
|
|
32
|
+
const el = await fixture('<bds-card clickable>Content</bds-card>');
|
|
33
|
+
const btn = el.shadowRoot!.querySelector('button');
|
|
34
|
+
expect(btn!.getAttribute('type')).toBe('button');
|
|
35
|
+
cleanup(el);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('fires bds-click event when clickable card is clicked', async () => {
|
|
39
|
+
const el = await fixture('<bds-card clickable>Content</bds-card>');
|
|
40
|
+
const btn = el.shadowRoot!.querySelector('button')!;
|
|
41
|
+
const handler = vi.fn();
|
|
42
|
+
el.addEventListener('bds-click', handler);
|
|
43
|
+
btn.dispatchEvent(new MouseEvent('click', { bubbles: true, composed: true }));
|
|
44
|
+
expect(handler).toHaveBeenCalledOnce();
|
|
45
|
+
cleanup(el);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('applies variant, padding and text-align classes to the card element', async () => {
|
|
49
|
+
const el = await fixture('<bds-card variant="elevated" padding="large" text-align="center">Content</bds-card>');
|
|
50
|
+
const card = el.shadowRoot!.querySelector('.card')!;
|
|
51
|
+
expect(card.classList.contains('--elevated')).toBe(true);
|
|
52
|
+
expect(card.classList.contains('--padding-large')).toBe(true);
|
|
53
|
+
expect(card.classList.contains('--text-center')).toBe(true);
|
|
54
|
+
cleanup(el);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('renders slotted content', async () => {
|
|
58
|
+
const el = await fixture('<bds-card>Hello card</bds-card>');
|
|
59
|
+
expect(el.textContent?.trim()).toBe('Hello card');
|
|
60
|
+
cleanup(el);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('reflects variant property update', async () => {
|
|
64
|
+
const el = await fixture('<bds-card>Content</bds-card>') as BdsCard;
|
|
65
|
+
el.variant = 'outlined';
|
|
66
|
+
await el.updateComplete;
|
|
67
|
+
expect(el.getAttribute('variant')).toBe('outlined');
|
|
68
|
+
cleanup(el);
|
|
69
|
+
});
|
|
70
|
+
});
|