@boostdev/design-system-components 2.15.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +19 -14
- package/dist/client.cjs +271 -205
- package/dist/client.css +801 -642
- package/dist/client.d.cts +19 -4
- package/dist/client.d.ts +19 -4
- package/dist/client.js +206 -139
- package/dist/index.cjs +271 -205
- package/dist/index.css +801 -642
- package/dist/index.d.cts +19 -4
- package/dist/index.d.ts +19 -4
- package/dist/index.js +206 -139
- package/dist/web-components/chunk-2DHW2WJZ.js +154 -0
- package/dist/web-components/{chunk-LDIPCTRN.js → chunk-2MJTO2IW.js} +48 -2
- package/dist/web-components/{chunk-3WAV6MDN.js → chunk-3FSGP35V.js} +1 -0
- package/dist/web-components/{chunk-KA3VPKMY.js → chunk-4MB2ICSK.js} +1 -0
- package/dist/web-components/{chunk-IDSM74LM.js → chunk-6XL5P76D.js} +3 -3
- package/dist/web-components/{chunk-P24JYC5V.js → chunk-7VXRMCAL.js} +10 -4
- package/dist/web-components/{chunk-CUKQ2L5B.js → chunk-AGI6YQRC.js} +9 -16
- package/dist/web-components/chunk-BDRV452N.js +51 -0
- package/dist/web-components/{chunk-3AY2YKCM.js → chunk-CKCPV347.js} +1 -0
- package/dist/web-components/{chunk-HBLJ4SLY.js → chunk-DD3OUXNG.js} +5 -5
- package/dist/web-components/{chunk-RVF7W653.js → chunk-DGOCPKHI.js} +30 -10
- package/dist/web-components/{chunk-2OLVQUBU.js → chunk-EYCW7TKB.js} +8 -15
- package/dist/web-components/{chunk-VANAKB6D.js → chunk-GPJWLAKU.js} +33 -16
- package/dist/web-components/{chunk-VED2DFJ6.js → chunk-GQNQBEYR.js} +8 -15
- package/dist/web-components/{chunk-WFVKU4GX.js → chunk-IKAJLROF.js} +49 -4
- package/dist/web-components/{chunk-RSZ3BWBK.js → chunk-KSK4RZZQ.js} +30 -7
- package/dist/web-components/{chunk-FEDABOR5.js → chunk-LHFUXZ52.js} +7 -15
- package/dist/web-components/{chunk-M3ECULRH.js → chunk-RBF7WPLI.js} +10 -8
- package/dist/web-components/{chunk-6G22I2CK.js → chunk-RZH5IVB5.js} +31 -1
- package/dist/web-components/chunk-SRKQ6GST.js +40 -0
- package/dist/web-components/{chunk-5HUAFCU6.js → chunk-TJV7UIXC.js} +7 -0
- package/dist/web-components/{chunk-J3HVUIUH.js → chunk-XI2U6U26.js} +8 -15
- package/dist/web-components/{chunk-JH6LQKLK.js → chunk-XJU7KITO.js} +8 -15
- package/dist/web-components/{chunk-JV5QT2OU.js → chunk-YLDQOESI.js} +27 -13
- package/dist/web-components/globals.js +1 -1
- package/dist/web-components/index.d.ts +1 -0
- package/dist/web-components/index.js +33 -28
- package/dist/web-components/interaction/bds-dropdown-menu-group.d.ts +41 -0
- package/dist/web-components/interaction/bds-dropdown-menu-group.js +7 -0
- package/dist/web-components/interaction/bds-dropdown-menu-item.d.ts +14 -1
- package/dist/web-components/interaction/bds-dropdown-menu-item.js +1 -1
- package/dist/web-components/interaction/bds-dropdown-menu.d.ts +2 -1
- package/dist/web-components/interaction/bds-dropdown-menu.js +1 -1
- package/dist/web-components/interaction/bds-tab.d.ts +5 -0
- package/dist/web-components/interaction/bds-tab.js +1 -1
- package/dist/web-components/interaction/bds-tooltip.js +1 -1
- package/dist/web-components/interaction/form/bds-checkbox-group.d.ts +6 -0
- package/dist/web-components/interaction/form/bds-checkbox-group.js +2 -1
- package/dist/web-components/interaction/form/bds-checkbox.js +1 -1
- package/dist/web-components/interaction/form/bds-combobox.js +2 -1
- package/dist/web-components/interaction/form/bds-form-input.js +2 -1
- package/dist/web-components/interaction/form/bds-number-input.js +2 -1
- package/dist/web-components/interaction/form/bds-radio-group.d.ts +5 -0
- package/dist/web-components/interaction/form/bds-radio-group.js +2 -1
- package/dist/web-components/interaction/form/bds-radio.js +1 -1
- package/dist/web-components/interaction/form/bds-select.js +2 -1
- package/dist/web-components/interaction/form/bds-slider.js +2 -1
- package/dist/web-components/interaction/form/bds-switch.js +1 -1
- package/dist/web-components/interaction/form/bds-textarea.js +2 -1
- package/dist/web-components/ui/bds-alert.d.ts +8 -1
- package/dist/web-components/ui/bds-alert.js +1 -1
- package/dist/web-components/ui/bds-avatar.d.ts +11 -0
- package/dist/web-components/ui/bds-avatar.js +1 -1
- package/dist/web-components/ui/bds-notification-banner.d.ts +14 -1
- package/dist/web-components/ui/bds-notification-banner.js +1 -1
- package/dist/web-components/ui/bds-section-header.d.ts +6 -0
- package/dist/web-components/ui/bds-section-header.js +1 -1
- package/dist/web-components/ui/bds-separator.js +1 -1
- package/dist/web-components/ui/bds-table.js +1 -1
- package/package.json +6 -2
- package/src/components/interaction/DropdownMenu/DropdownMenu.mdx +35 -4
- package/src/components/interaction/DropdownMenu/DropdownMenu.module.css +58 -10
- package/src/components/interaction/DropdownMenu/DropdownMenu.spec.tsx +114 -1
- package/src/components/interaction/DropdownMenu/DropdownMenu.stories.tsx +25 -0
- package/src/components/interaction/DropdownMenu/DropdownMenu.tsx +69 -17
- package/src/components/interaction/form/Checkbox/Checkbox.module.css +1 -0
- package/src/components/interaction/form/Checkbox/Checkbox.spec.tsx +7 -0
- package/src/components/interaction/form/CheckboxGroup/CheckboxGroup.mdx +1 -0
- package/src/components/interaction/form/CheckboxGroup/CheckboxGroup.module.css +7 -0
- package/src/components/interaction/form/CheckboxGroup/CheckboxGroup.spec.tsx +22 -0
- package/src/components/interaction/form/CheckboxGroup/CheckboxGroup.tsx +1 -1
- package/src/components/interaction/form/Combobox/Combobox.module.css +1 -0
- package/src/components/interaction/form/Combobox/Combobox.spec.tsx +7 -0
- package/src/components/interaction/form/FormInput/FormInput.mdx +9 -0
- package/src/components/interaction/form/FormInput/FormInput.module.css +1 -0
- package/src/components/interaction/form/FormInput/FormInput.spec.tsx +7 -0
- package/src/components/interaction/form/NumberInput/NumberInput.module.css +1 -0
- package/src/components/interaction/form/NumberInput/NumberInput.spec.tsx +7 -0
- package/src/components/interaction/form/Radio/Radio.module.css +1 -0
- package/src/components/interaction/form/Radio/Radio.spec.tsx +7 -0
- package/src/components/interaction/form/RadioGroup/RadioGroup.mdx +1 -0
- package/src/components/interaction/form/RadioGroup/RadioGroup.module.css +7 -0
- package/src/components/interaction/form/RadioGroup/RadioGroup.spec.tsx +22 -0
- package/src/components/interaction/form/RadioGroup/RadioGroup.tsx +1 -1
- package/src/components/interaction/form/Select/Select.module.css +1 -0
- package/src/components/interaction/form/Select/Select.spec.tsx +7 -0
- package/src/components/interaction/form/Switch/Switch.module.css +1 -0
- package/src/components/interaction/form/Switch/Switch.spec.tsx +7 -0
- package/src/components/interaction/form/Textarea/Textarea.module.css +1 -0
- package/src/components/interaction/form/Textarea/Textarea.spec.tsx +7 -0
- package/src/components/interaction/form/atoms/Message.module.css +14 -3
- package/src/components/interaction/form/atoms/Message.spec.tsx +22 -0
- package/src/components/interaction/form/atoms/Message.tsx +5 -0
- package/src/components/layout/SectionHeader/SectionHeader.mdx +18 -5
- package/src/components/layout/SectionHeader/SectionHeader.module.css +35 -14
- package/src/components/layout/SectionHeader/SectionHeader.spec.tsx +44 -0
- package/src/components/layout/SectionHeader/SectionHeader.stories.tsx +5 -0
- package/src/components/layout/SectionHeader/SectionHeader.tsx +3 -1
- package/src/components/ui/Alert/Alert.mdx +11 -0
- package/src/components/ui/Alert/Alert.module.css +30 -1
- package/src/components/ui/Alert/Alert.spec.tsx +21 -0
- package/src/components/ui/Alert/Alert.stories.tsx +20 -0
- package/src/components/ui/Alert/Alert.tsx +8 -1
- package/src/components/ui/Avatar/Avatar.mdx +22 -2
- package/src/components/ui/Avatar/Avatar.module.css +29 -2
- package/src/components/ui/Avatar/Avatar.spec.tsx +26 -0
- package/src/components/ui/Avatar/Avatar.stories.tsx +23 -0
- package/src/components/ui/Avatar/Avatar.tsx +4 -2
- package/src/components/ui/Avatar/avatarTone.spec.ts +41 -0
- package/src/components/ui/Avatar/avatarTone.ts +22 -0
- package/src/components/ui/Collapsible/Collapsible.module.css +1 -2
- package/src/components/ui/NotificationBanner/NotificationBanner.mdx +14 -0
- package/src/components/ui/NotificationBanner/NotificationBanner.module.css +31 -1
- package/src/components/ui/NotificationBanner/NotificationBanner.spec.tsx +29 -0
- package/src/components/ui/NotificationBanner/NotificationBanner.stories.tsx +25 -0
- package/src/components/ui/NotificationBanner/NotificationBanner.tsx +15 -1
- package/src/components/ui/Separator/Separator.mdx +1 -0
- package/src/components/ui/Separator/Separator.module.css +6 -0
- package/src/components/ui/Separator/Separator.spec.tsx +19 -0
- package/src/components/ui/Separator/Separator.stories.tsx +15 -0
- package/src/components/ui/Table/Table.mdx +4 -1
- package/src/components/ui/Table/Table.module.css +7 -7
- package/src/components/ui/Table/Table.spec.tsx +11 -0
- package/src/components/ui/Tabs/Tabs.mdx +11 -5
- package/src/components/ui/Tabs/Tabs.module.css +23 -5
- package/src/components/ui/Tabs/Tabs.spec.tsx +39 -0
- package/src/components/ui/Tabs/Tabs.tsx +2 -1
- package/src/components/ui/Tabs/getNodeText.spec.tsx +23 -0
- package/src/components/ui/Tabs/getNodeText.ts +13 -0
- package/src/components/ui/Tooltip/Tooltip.mdx +6 -3
- package/src/components/ui/Tooltip/Tooltip.module.css +6 -2
- package/src/components/ui/Tooltip/Tooltip.spec.tsx +10 -0
- package/src/components/ui/Tooltip/Tooltip.stories.tsx +13 -0
- package/src/css/bdc.css +5 -2
- package/src/css/bdc.spec.ts +65 -0
- package/src/stories/DesignSystem/Borders.mdx +17 -9
- package/src/web-components/globals.ts +10 -4
- package/src/web-components/index.ts +1 -0
- package/src/web-components/interaction/BdsAccordion.mdx +1 -1
- package/src/web-components/interaction/BdsAccordion.stories.tsx +1 -1
- package/src/web-components/interaction/BdsButton.mdx +1 -1
- package/src/web-components/interaction/BdsButton.stories.tsx +1 -1
- package/src/web-components/interaction/BdsCollapsible.mdx +1 -1
- package/src/web-components/interaction/BdsCollapsible.stories.tsx +1 -1
- package/src/web-components/interaction/BdsDialog.mdx +1 -1
- package/src/web-components/interaction/BdsDialog.stories.tsx +1 -1
- package/src/web-components/interaction/BdsDrawer.mdx +1 -1
- package/src/web-components/interaction/BdsDrawer.stories.tsx +1 -1
- package/src/web-components/interaction/BdsDropdownMenu.mdx +62 -6
- package/src/web-components/interaction/BdsDropdownMenu.stories.tsx +32 -7
- package/src/web-components/interaction/BdsPopover.mdx +1 -1
- package/src/web-components/interaction/BdsPopover.stories.tsx +1 -1
- package/src/web-components/interaction/BdsSkipLink.mdx +1 -1
- package/src/web-components/interaction/BdsSkipLink.stories.tsx +1 -1
- package/src/web-components/interaction/BdsTabs.mdx +10 -1
- package/src/web-components/interaction/BdsTabs.stories.tsx +1 -1
- package/src/web-components/interaction/BdsToastProvider.mdx +1 -1
- package/src/web-components/interaction/BdsToastProvider.stories.tsx +1 -1
- package/src/web-components/interaction/BdsTooltip.mdx +13 -5
- package/src/web-components/interaction/BdsTooltip.stories.tsx +12 -12
- package/src/web-components/interaction/bds-dropdown-menu-group.ts +72 -0
- package/src/web-components/interaction/bds-dropdown-menu-item.ts +65 -17
- package/src/web-components/interaction/bds-dropdown-menu.spec.ts +135 -0
- package/src/web-components/interaction/bds-dropdown-menu.ts +5 -4
- package/src/web-components/interaction/bds-tab.spec.ts +34 -2
- package/src/web-components/interaction/bds-tab.ts +31 -6
- package/src/web-components/interaction/bds-tooltip.spec.ts +16 -0
- package/src/web-components/interaction/bds-tooltip.ts +10 -8
- package/src/web-components/interaction/form/BdsCheckbox.mdx +5 -1
- package/src/web-components/interaction/form/BdsCheckbox.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsCheckboxGroup.mdx +5 -1
- package/src/web-components/interaction/form/BdsCheckboxGroup.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsCombobox.mdx +5 -1
- package/src/web-components/interaction/form/BdsCombobox.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsFieldGroup.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsFileInput.mdx +1 -1
- package/src/web-components/interaction/form/BdsFileInput.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsFormInput.mdx +8 -1
- package/src/web-components/interaction/form/BdsFormInput.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsNumberInput.mdx +5 -1
- package/src/web-components/interaction/form/BdsNumberInput.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsRadio.mdx +5 -1
- package/src/web-components/interaction/form/BdsRadio.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsRadioGroup.mdx +5 -1
- package/src/web-components/interaction/form/BdsRadioGroup.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsSegmentedControl.mdx +1 -1
- package/src/web-components/interaction/form/BdsSegmentedControl.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsSelect.mdx +5 -1
- package/src/web-components/interaction/form/BdsSelect.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsSlider.mdx +5 -1
- package/src/web-components/interaction/form/BdsSlider.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsSwitch.mdx +5 -1
- package/src/web-components/interaction/form/BdsSwitch.stories.tsx +1 -1
- package/src/web-components/interaction/form/BdsTextarea.mdx +5 -1
- package/src/web-components/interaction/form/BdsTextarea.stories.tsx +1 -1
- package/src/web-components/interaction/form/bds-checkbox-group.spec.ts +32 -3
- package/src/web-components/interaction/form/bds-checkbox-group.ts +33 -17
- package/src/web-components/interaction/form/bds-checkbox.ts +1 -0
- package/src/web-components/interaction/form/bds-combobox.ts +6 -16
- package/src/web-components/interaction/form/bds-form-input.ts +6 -16
- package/src/web-components/interaction/form/bds-number-input.ts +6 -16
- package/src/web-components/interaction/form/bds-radio-group.spec.ts +32 -3
- package/src/web-components/interaction/form/bds-radio-group.ts +26 -14
- package/src/web-components/interaction/form/bds-radio.ts +1 -0
- package/src/web-components/interaction/form/bds-select.ts +6 -16
- package/src/web-components/interaction/form/bds-slider.ts +5 -16
- package/src/web-components/interaction/form/bds-switch.ts +1 -0
- package/src/web-components/interaction/form/bds-textarea.ts +6 -16
- package/src/web-components/interaction/form/field-message.spec.ts +62 -0
- package/src/web-components/interaction/form/field-message.ts +55 -0
- package/src/web-components/layout/BdsGrid.mdx +1 -1
- package/src/web-components/layout/BdsGrid.stories.tsx +1 -1
- package/src/web-components/layout/BdsGridItem.mdx +1 -1
- package/src/web-components/layout/BdsGridItem.stories.tsx +1 -1
- package/src/web-components/ui/BdsAlert.mdx +19 -1
- package/src/web-components/ui/BdsAlert.stories.tsx +29 -3
- package/src/web-components/ui/BdsAvatar.mdx +20 -3
- package/src/web-components/ui/BdsAvatar.stories.tsx +25 -2
- package/src/web-components/ui/BdsBadge.mdx +1 -1
- package/src/web-components/ui/BdsBadge.stories.tsx +1 -1
- package/src/web-components/ui/BdsBreadcrumb.mdx +1 -1
- package/src/web-components/ui/BdsBreadcrumb.stories.tsx +1 -1
- package/src/web-components/ui/BdsButtonContainer.mdx +1 -1
- package/src/web-components/ui/BdsButtonContainer.stories.tsx +1 -1
- package/src/web-components/ui/BdsCalendar.mdx +1 -1
- package/src/web-components/ui/BdsCalendar.stories.tsx +1 -1
- package/src/web-components/ui/BdsCalendarRange.mdx +1 -1
- package/src/web-components/ui/BdsCalendarRange.stories.tsx +1 -1
- package/src/web-components/ui/BdsCard.mdx +1 -1
- package/src/web-components/ui/BdsCard.stories.tsx +1 -1
- package/src/web-components/ui/BdsCarousel.mdx +1 -1
- package/src/web-components/ui/BdsCarousel.stories.tsx +1 -1
- package/src/web-components/ui/BdsDescriptionList.mdx +1 -1
- package/src/web-components/ui/BdsDescriptionList.stories.tsx +1 -1
- package/src/web-components/ui/BdsIconWrapper.mdx +1 -1
- package/src/web-components/ui/BdsIconWrapper.stories.tsx +1 -1
- package/src/web-components/ui/BdsLink.mdx +1 -1
- package/src/web-components/ui/BdsLink.stories.tsx +1 -1
- package/src/web-components/ui/BdsLoading.mdx +1 -1
- package/src/web-components/ui/BdsLoading.stories.tsx +1 -1
- package/src/web-components/ui/BdsNotificationBanner.mdx +10 -1
- package/src/web-components/ui/BdsNotificationBanner.stories.tsx +29 -2
- package/src/web-components/ui/BdsPagination.mdx +1 -1
- package/src/web-components/ui/BdsPagination.stories.tsx +1 -1
- package/src/web-components/ui/BdsProgress.mdx +1 -1
- package/src/web-components/ui/BdsProgress.stories.tsx +1 -1
- package/src/web-components/ui/BdsProgressCircle.mdx +1 -1
- package/src/web-components/ui/BdsProgressCircle.stories.tsx +1 -1
- package/src/web-components/ui/BdsRating.mdx +1 -1
- package/src/web-components/ui/BdsRating.stories.tsx +1 -1
- package/src/web-components/ui/BdsSectionHeader.mdx +18 -6
- package/src/web-components/ui/BdsSectionHeader.stories.tsx +10 -2
- package/src/web-components/ui/BdsSeparator.mdx +2 -1
- package/src/web-components/ui/BdsSeparator.stories.tsx +13 -1
- package/src/web-components/ui/BdsSkeleton.mdx +1 -1
- package/src/web-components/ui/BdsSkeleton.stories.tsx +1 -1
- package/src/web-components/ui/BdsTable.mdx +5 -1
- package/src/web-components/ui/BdsTable.stories.tsx +1 -1
- package/src/web-components/ui/BdsTypography.mdx +1 -1
- package/src/web-components/ui/BdsTypography.stories.tsx +1 -1
- package/src/web-components/ui/bds-alert.spec.ts +27 -0
- package/src/web-components/ui/bds-alert.ts +34 -1
- package/src/web-components/ui/bds-avatar.spec.ts +47 -0
- package/src/web-components/ui/bds-avatar.ts +36 -3
- package/src/web-components/ui/bds-notification-banner.spec.ts +45 -0
- package/src/web-components/ui/bds-notification-banner.ts +53 -1
- package/src/web-components/ui/bds-section-header.spec.ts +36 -3
- package/src/web-components/ui/bds-section-header.ts +32 -10
- package/src/web-components/ui/bds-separator.spec.ts +8 -0
- package/src/web-components/ui/bds-separator.ts +7 -0
- package/src/web-components/ui/bds-table.spec.ts +11 -0
- package/src/web-components/ui/bds-table.ts +5 -5
- package/dist/web-components/chunk-QZAIRJ75.js +0 -111
|
@@ -7,7 +7,7 @@ import * as Stories from './BdsSegmentedControl.stories';
|
|
|
7
7
|
|
|
8
8
|
Form-associated segmented control. Renders a group of radio buttons (or anchor links) styled as a unified segmented bar. Supports two visual variants: `outline` (sliding inset-border indicator) and `filled` (sliding filled thumb).
|
|
9
9
|
|
|
10
|
-
> **Status:
|
|
10
|
+
> **Status: alpha** — API may change before stable release.
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
@@ -45,7 +45,7 @@ function BdsSegmentedControl({
|
|
|
45
45
|
const meta = {
|
|
46
46
|
title: 'Web Components/Form/SegmentedControl',
|
|
47
47
|
component: BdsSegmentedControl,
|
|
48
|
-
tags: ['!stable', '
|
|
48
|
+
tags: ['!stable', 'alpha'],
|
|
49
49
|
parameters: { layout: 'centered' },
|
|
50
50
|
argTypes: {
|
|
51
51
|
variant: { control: 'select', options: ['outline', 'filled'] },
|
|
@@ -7,7 +7,7 @@ import * as Stories from './BdsSelect.stories';
|
|
|
7
7
|
|
|
8
8
|
Form-associated select custom element. Wraps a native `<select>` with consistent styling. Options are passed as a JSON attribute because slotting `<option>` elements into shadow DOM is not supported cross-browser.
|
|
9
9
|
|
|
10
|
-
> **Status:
|
|
10
|
+
> **Status: alpha** — API may change before stable release.
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
@@ -82,6 +82,10 @@ When `label` is omitted, set `aria-label` on the host element (`<bds-select aria
|
|
|
82
82
|
></bds-select>
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
+
## Error state
|
|
86
|
+
|
|
87
|
+
With `error`, the message gets a warning icon and the field ring widens to `--bdc-outline_width--error` (2px). Message hooks (`--formMessage_*`: font-size, gap, icon-size, color--error, font-weight--error, color--hint, font-style--hint) are listed on `<bds-form-input>`.
|
|
88
|
+
|
|
85
89
|
## Accessibility
|
|
86
90
|
|
|
87
91
|
- Wraps a native `<select>` which has full browser and assistive technology support
|
|
@@ -54,7 +54,7 @@ function BdsSelect({
|
|
|
54
54
|
const meta = {
|
|
55
55
|
title: 'Web Components/Form/Select',
|
|
56
56
|
component: BdsSelect,
|
|
57
|
-
tags: ['!stable', '
|
|
57
|
+
tags: ['!stable', 'alpha'],
|
|
58
58
|
parameters: { layout: 'centered' },
|
|
59
59
|
argTypes: {
|
|
60
60
|
required: { control: 'boolean' },
|
|
@@ -7,7 +7,7 @@ import * as Stories from './BdsSlider.stories';
|
|
|
7
7
|
|
|
8
8
|
Form-associated range slider. Wraps a native `<input type="range">` with a styled fill track driven by the `--slider_fill` CSS custom property, plus label/hint/error wiring matching the other form web components.
|
|
9
9
|
|
|
10
|
-
> **Status:
|
|
10
|
+
> **Status: alpha** — API may change before stable release.
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
@@ -84,6 +84,10 @@ Use `<bds-slider>` for continuous or stepped numeric ranges — volume controls,
|
|
|
84
84
|
<bds-slider name="volume" label="Volume" value="50" min="0" max="100" step="5" show-value></bds-slider>
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
+
## Error state
|
|
88
|
+
|
|
89
|
+
With `error`, the message gets a warning icon. Message hooks (`--formMessage_*`: font-size, gap, icon-size, color--error, font-weight--error, color--hint, font-style--hint) are listed on `<bds-form-input>`.
|
|
90
|
+
|
|
87
91
|
## Accessibility
|
|
88
92
|
|
|
89
93
|
- Wraps a native `<input type="range">` which has full browser and assistive technology support
|
|
@@ -7,7 +7,7 @@ import * as Stories from './BdsSwitch.stories';
|
|
|
7
7
|
|
|
8
8
|
Form-associated toggle switch. Visually a sliding toggle but semantically equivalent to a checkbox (`role="switch"`). Participates in HTML forms via the Form-Associated Custom Elements API.
|
|
9
9
|
|
|
10
|
-
> **Status:
|
|
10
|
+
> **Status: alpha** — API may change before stable release.
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
@@ -89,6 +89,10 @@ Use `<bds-switch>` for binary on/off settings where the change takes immediate e
|
|
|
89
89
|
| `--switch_border-color--error` | `var(--bds-color_error)` | Track border colour when `error` is set |
|
|
90
90
|
| `--switch_shadow` | `var(--bdc-outline_shadow)` | Track box-shadow tail |
|
|
91
91
|
|
|
92
|
+
## Error state
|
|
93
|
+
|
|
94
|
+
With `error`, the track ring widens to `--bdc-outline_width--error` (2px). Message hooks (`--formMessage_*`: font-size, gap, icon-size, color--error, font-weight--error, color--hint, font-style--hint) are listed on `<bds-form-input>`.
|
|
95
|
+
|
|
92
96
|
## Accessibility
|
|
93
97
|
|
|
94
98
|
- Uses `role="switch"` on the inner `<input type="checkbox">` for correct screen reader announcement
|
|
@@ -39,7 +39,7 @@ function BdsSwitch({
|
|
|
39
39
|
const meta = {
|
|
40
40
|
title: 'Web Components/Form/Switch',
|
|
41
41
|
component: BdsSwitch,
|
|
42
|
-
tags: ['!stable', '
|
|
42
|
+
tags: ['!stable', 'alpha'],
|
|
43
43
|
parameters: { layout: 'centered' },
|
|
44
44
|
argTypes: {
|
|
45
45
|
checked: { control: 'boolean' },
|
|
@@ -7,7 +7,7 @@ import * as Stories from './BdsTextarea.stories';
|
|
|
7
7
|
|
|
8
8
|
Form-associated multiline text input. Wraps a native `<textarea>` with consistent styling while participating in HTML forms via the Form-Associated Custom Elements API.
|
|
9
9
|
|
|
10
|
-
> **Status:
|
|
10
|
+
> **Status: alpha** — API may change before stable release.
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
@@ -88,6 +88,10 @@ Use `<bds-textarea>` for multiline text entry — messages, comments, descriptio
|
|
|
88
88
|
<bds-textarea name="feedback" label="Feedback" error="Feedback is required"></bds-textarea>
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
+
## Error state
|
|
92
|
+
|
|
93
|
+
With `error`, the message gets a warning icon and the field ring widens to `--bdc-outline_width--error` (2px). Message hooks (`--formMessage_*`: font-size, gap, icon-size, color--error, font-weight--error, color--hint, font-style--hint) are listed on `<bds-form-input>`.
|
|
94
|
+
|
|
91
95
|
## Accessibility
|
|
92
96
|
|
|
93
97
|
- Wraps a native `<textarea>` which has full browser and assistive technology support
|
|
@@ -39,7 +39,7 @@ function BdsTextarea({
|
|
|
39
39
|
const meta = {
|
|
40
40
|
title: 'Web Components/Form/Textarea',
|
|
41
41
|
component: BdsTextarea,
|
|
42
|
-
tags: ['!stable', '
|
|
42
|
+
tags: ['!stable', 'alpha'],
|
|
43
43
|
parameters: { layout: 'centered' },
|
|
44
44
|
argTypes: {
|
|
45
45
|
rows: { control: 'number' },
|
|
@@ -137,9 +137,9 @@ describe('bds-checkbox-group', () => {
|
|
|
137
137
|
});
|
|
138
138
|
|
|
139
139
|
it('uses medium font-weight token for the legend (not semibold)', () => {
|
|
140
|
-
const
|
|
141
|
-
expect(
|
|
142
|
-
expect(
|
|
140
|
+
const legendRule = BdsCheckboxGroup.styles.toString().match(/\.legend \{[^}]*\}/)?.[0] ?? '';
|
|
141
|
+
expect(legendRule).toContain('--bds-font_weight--medium');
|
|
142
|
+
expect(legendRule).not.toContain('--bds-font_weight--semibold');
|
|
143
143
|
});
|
|
144
144
|
|
|
145
145
|
it('uses the on-bg error color token for the error message (not the raw error token)', () => {
|
|
@@ -151,4 +151,33 @@ describe('bds-checkbox-group', () => {
|
|
|
151
151
|
const styles = BdsCheckboxGroup.styles.toString();
|
|
152
152
|
expect(styles).toContain(':host([disabled])');
|
|
153
153
|
});
|
|
154
|
+
|
|
155
|
+
it('shows the error icon in the message', async () => {
|
|
156
|
+
const el = await fixture('<bds-checkbox-group label="Test" error="Required field"></bds-checkbox-group>');
|
|
157
|
+
const message = el.shadowRoot!.querySelector('.message--error')!;
|
|
158
|
+
expect(message.querySelector('svg')?.getAttribute('aria-hidden')).toBe('true');
|
|
159
|
+
expect(message.textContent).toContain('Required field');
|
|
160
|
+
cleanup(el);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('propagates error to slotted bds-checkbox elements', async () => {
|
|
164
|
+
const el = await fixture(
|
|
165
|
+
'<bds-checkbox-group label="Test" error="Required field"><bds-checkbox value="a">A</bds-checkbox><bds-checkbox value="b">B</bds-checkbox></bds-checkbox-group>',
|
|
166
|
+
);
|
|
167
|
+
const children = Array.from(el.querySelectorAll('bds-checkbox'));
|
|
168
|
+
expect(children.every(child => child.hasAttribute('error'))).toBe(true);
|
|
169
|
+
cleanup(el);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('removes propagated error when the group error clears, keeping an individual error', async () => {
|
|
173
|
+
const el = await fixture(
|
|
174
|
+
'<bds-checkbox-group label="Test" error="Required field"><bds-checkbox value="a">A</bds-checkbox><bds-checkbox value="b" error>B</bds-checkbox></bds-checkbox-group>',
|
|
175
|
+
) as BdsCheckboxGroup;
|
|
176
|
+
el.error = undefined;
|
|
177
|
+
await el.updateComplete;
|
|
178
|
+
const [first, second] = Array.from(el.querySelectorAll('bds-checkbox'));
|
|
179
|
+
expect(first.hasAttribute('error')).toBe(false);
|
|
180
|
+
expect(second.hasAttribute('error')).toBe(true);
|
|
181
|
+
cleanup(el);
|
|
182
|
+
});
|
|
154
183
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LitElement, css, html, nothing } from 'lit';
|
|
2
|
+
import { fieldMessageStyles, renderFieldMessage } from './field-message';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* `<bds-checkbox-group>` — groups related checkboxes with a shared label.
|
|
@@ -96,19 +97,10 @@ export class BdsCheckboxGroup extends LitElement {
|
|
|
96
97
|
gap: var(--bds-space_xs);
|
|
97
98
|
}
|
|
98
99
|
|
|
100
|
+
${fieldMessageStyles}
|
|
101
|
+
|
|
99
102
|
.message {
|
|
100
103
|
margin-block-start: var(--bds-space_xs);
|
|
101
|
-
font-size: var(--bds-font_size--body--s);
|
|
102
|
-
font-family: var(--bds-font_family--body);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.message--error {
|
|
106
|
-
color: var(--bds-color_error_on-bg);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.message--hint {
|
|
110
|
-
color: var(--bds-color_on-bg--subtle);
|
|
111
|
-
font-style: italic;
|
|
112
104
|
}
|
|
113
105
|
`;
|
|
114
106
|
|
|
@@ -156,16 +148,40 @@ export class BdsCheckboxGroup extends LitElement {
|
|
|
156
148
|
});
|
|
157
149
|
};
|
|
158
150
|
|
|
151
|
+
/**
|
|
152
|
+
* Propagates the group's `error` to slotted `<bds-checkbox>` elements so they
|
|
153
|
+
* show the error ring. A checkbox individually marked `error` in markup keeps it.
|
|
154
|
+
*/
|
|
155
|
+
private _propagateError = () => {
|
|
156
|
+
this.querySelectorAll('bds-checkbox').forEach(checkbox => {
|
|
157
|
+
const el = checkbox as HTMLElement;
|
|
158
|
+
if (this.error) {
|
|
159
|
+
if (!el.hasAttribute('error')) {
|
|
160
|
+
el.setAttribute('data-bds-group-error', '');
|
|
161
|
+
}
|
|
162
|
+
el.setAttribute('error', '');
|
|
163
|
+
} else if (el.hasAttribute('data-bds-group-error')) {
|
|
164
|
+
el.removeAttribute('error');
|
|
165
|
+
el.removeAttribute('data-bds-group-error');
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
private _propagateToCheckboxes = () => {
|
|
171
|
+
this._propagateDisabled();
|
|
172
|
+
this._propagateError();
|
|
173
|
+
};
|
|
174
|
+
|
|
159
175
|
connectedCallback() {
|
|
160
176
|
super.connectedCallback();
|
|
161
177
|
// Propagate after slot content has been parsed
|
|
162
|
-
Promise.resolve().then(this.
|
|
178
|
+
Promise.resolve().then(this._propagateToCheckboxes);
|
|
163
179
|
}
|
|
164
180
|
|
|
165
181
|
updated(changed: Map<string, unknown>) {
|
|
166
182
|
super.updated(changed);
|
|
167
|
-
if (changed.has('disabled')) {
|
|
168
|
-
this.
|
|
183
|
+
if (changed.has('disabled') || changed.has('error')) {
|
|
184
|
+
this._propagateToCheckboxes();
|
|
169
185
|
}
|
|
170
186
|
}
|
|
171
187
|
|
|
@@ -183,12 +199,12 @@ export class BdsCheckboxGroup extends LitElement {
|
|
|
183
199
|
: ''}
|
|
184
200
|
</legend>
|
|
185
201
|
<div class="items">
|
|
186
|
-
<slot @slotchange=${this.
|
|
202
|
+
<slot @slotchange=${this._propagateToCheckboxes}></slot>
|
|
187
203
|
</div>
|
|
188
204
|
${this.error
|
|
189
|
-
?
|
|
205
|
+
? renderFieldMessage('error', errorId, this.error)
|
|
190
206
|
: this.hint
|
|
191
|
-
?
|
|
207
|
+
? renderFieldMessage('hint', hintId, this.hint)
|
|
192
208
|
: ''}
|
|
193
209
|
</fieldset>
|
|
194
210
|
`;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LitElement, css, html, nothing } from 'lit';
|
|
2
|
+
import { fieldMessageStyles, renderFieldMessage } from './field-message';
|
|
2
3
|
|
|
3
4
|
export interface ComboboxOption {
|
|
4
5
|
value: string;
|
|
@@ -99,10 +100,12 @@ export class BdsCombobox extends LitElement {
|
|
|
99
100
|
|
|
100
101
|
:host([error]) .input {
|
|
101
102
|
--bdc_color: var(--bdc_color--error);
|
|
103
|
+
--bdc-outline_width: var(--bdc-outline_width--error, 2px);
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
:host([error]) .input:focus {
|
|
105
107
|
--bdc_color: var(--bdc_color--error);
|
|
108
|
+
--bdc-outline_width: var(--bdc-outline_width--error, 2px);
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
.chevron {
|
|
@@ -176,20 +179,7 @@ export class BdsCombobox extends LitElement {
|
|
|
176
179
|
color: var(--bds-color_on-bg--subtle);
|
|
177
180
|
}
|
|
178
181
|
|
|
179
|
-
|
|
180
|
-
margin-block-start: var(--bds-space_xxs);
|
|
181
|
-
font-size: var(--bds-font_size--body--s);
|
|
182
|
-
font-family: var(--bds-font_family--body);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.message--error {
|
|
186
|
-
color: var(--bds-color_error);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.message--hint {
|
|
190
|
-
color: var(--bds-color_on-bg--subtle);
|
|
191
|
-
font-style: italic;
|
|
192
|
-
}
|
|
182
|
+
${fieldMessageStyles}
|
|
193
183
|
`;
|
|
194
184
|
|
|
195
185
|
static properties = {
|
|
@@ -402,9 +392,9 @@ export class BdsCombobox extends LitElement {
|
|
|
402
392
|
` : ''}
|
|
403
393
|
</div>
|
|
404
394
|
${this.error
|
|
405
|
-
?
|
|
395
|
+
? renderFieldMessage('error', errorId, this.error)
|
|
406
396
|
: this.hint
|
|
407
|
-
?
|
|
397
|
+
? renderFieldMessage('hint', hintId, this.hint)
|
|
408
398
|
: ''}
|
|
409
399
|
`;
|
|
410
400
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement, css, html } from 'lit';
|
|
2
2
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
3
|
+
import { fieldMessageStyles, renderFieldMessage } from './field-message';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* `<bds-form-input>` — form-associated text input with label, hint, and error support.
|
|
@@ -83,6 +84,7 @@ export class BdsFormInput extends LitElement {
|
|
|
83
84
|
|
|
84
85
|
:host([error]) .wrapper {
|
|
85
86
|
--bdc_color: var(--bdc_color--error);
|
|
87
|
+
--bdc-outline_width: var(--bdc-outline_width--error, 2px);
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
.wrapper:focus-within {
|
|
@@ -91,6 +93,7 @@ export class BdsFormInput extends LitElement {
|
|
|
91
93
|
|
|
92
94
|
:host([error]) .wrapper:focus-within {
|
|
93
95
|
--bdc_color: var(--bdc_color--error);
|
|
96
|
+
--bdc-outline_width: var(--bdc-outline_width--error, 2px);
|
|
94
97
|
}
|
|
95
98
|
|
|
96
99
|
.input {
|
|
@@ -140,20 +143,7 @@ export class BdsFormInput extends LitElement {
|
|
|
140
143
|
display: none;
|
|
141
144
|
}
|
|
142
145
|
|
|
143
|
-
|
|
144
|
-
margin-block-start: var(--bds-space_xxs);
|
|
145
|
-
font-size: var(--bds-font_size--body--s);
|
|
146
|
-
font-family: var(--bds-font_family--body);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.message--error {
|
|
150
|
-
color: var(--bds-color_error);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.message--hint {
|
|
154
|
-
color: var(--bds-color_on-bg--subtle);
|
|
155
|
-
font-style: italic;
|
|
156
|
-
}
|
|
146
|
+
${fieldMessageStyles}
|
|
157
147
|
`;
|
|
158
148
|
|
|
159
149
|
static properties = {
|
|
@@ -265,8 +255,8 @@ export class BdsFormInput extends LitElement {
|
|
|
265
255
|
/>
|
|
266
256
|
<span class="suffix"><slot name="suffix"></slot></span>
|
|
267
257
|
</div>
|
|
268
|
-
${this.error ?
|
|
269
|
-
${this.hint ?
|
|
258
|
+
${this.error ? renderFieldMessage('error', errorId, this.error) : ''}
|
|
259
|
+
${this.hint ? renderFieldMessage('hint', hintId, this.hint) : ''}
|
|
270
260
|
`;
|
|
271
261
|
}
|
|
272
262
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LitElement, css, html } from 'lit';
|
|
2
|
+
import { fieldMessageStyles, renderFieldMessage } from './field-message';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* `<bds-number-input>` — form-associated Number Input with stepper buttons.
|
|
@@ -72,6 +73,7 @@ export class BdsNumberInput extends LitElement {
|
|
|
72
73
|
|
|
73
74
|
:host([error]) .row {
|
|
74
75
|
--bdc_color: var(--bdc_color--error);
|
|
76
|
+
--bdc-outline_width: var(--bdc-outline_width--error, 2px);
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
.row:focus-within {
|
|
@@ -80,6 +82,7 @@ export class BdsNumberInput extends LitElement {
|
|
|
80
82
|
|
|
81
83
|
:host([error]) .row:focus-within {
|
|
82
84
|
--bdc_color: var(--bdc_color--error);
|
|
85
|
+
--bdc-outline_width: var(--bdc-outline_width--error, 2px);
|
|
83
86
|
}
|
|
84
87
|
|
|
85
88
|
.row:focus-within:has(:focus-visible) {
|
|
@@ -154,20 +157,7 @@ export class BdsNumberInput extends LitElement {
|
|
|
154
157
|
color: var(--numberInput_stepper-color, var(--bds-color_interactive));
|
|
155
158
|
}
|
|
156
159
|
|
|
157
|
-
|
|
158
|
-
margin-block-start: var(--bds-space_xxs);
|
|
159
|
-
font-size: var(--bds-font_size--body--s);
|
|
160
|
-
font-family: var(--bds-font_family--body);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.message--error {
|
|
164
|
-
color: var(--bds-color_error);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.message--hint {
|
|
168
|
-
color: var(--bds-color_on-bg--subtle);
|
|
169
|
-
font-style: italic;
|
|
170
|
-
}
|
|
160
|
+
${fieldMessageStyles}
|
|
171
161
|
`;
|
|
172
162
|
|
|
173
163
|
static properties = {
|
|
@@ -292,9 +282,9 @@ export class BdsNumberInput extends LitElement {
|
|
|
292
282
|
</button>
|
|
293
283
|
</div>
|
|
294
284
|
${this.error
|
|
295
|
-
?
|
|
285
|
+
? renderFieldMessage('error', errorId, this.error)
|
|
296
286
|
: this.hint
|
|
297
|
-
?
|
|
287
|
+
? renderFieldMessage('hint', hintId, this.hint)
|
|
298
288
|
: ''}
|
|
299
289
|
`;
|
|
300
290
|
}
|
|
@@ -112,8 +112,37 @@ describe('bds-radio-group', () => {
|
|
|
112
112
|
});
|
|
113
113
|
|
|
114
114
|
it('uses medium font-weight token for the legend (not semibold)', () => {
|
|
115
|
-
const
|
|
116
|
-
expect(
|
|
117
|
-
expect(
|
|
115
|
+
const legendRule = BdsRadioGroup.styles.toString().match(/\.legend \{[^}]*\}/)?.[0] ?? '';
|
|
116
|
+
expect(legendRule).toContain('--bds-font_weight--medium');
|
|
117
|
+
expect(legendRule).not.toContain('--bds-font_weight--semibold');
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('shows the error icon in the message', async () => {
|
|
121
|
+
const el = await fixture('<bds-radio-group label="Test" error="Required field"></bds-radio-group>');
|
|
122
|
+
const message = el.shadowRoot!.querySelector('.message--error')!;
|
|
123
|
+
expect(message.querySelector('svg')?.getAttribute('aria-hidden')).toBe('true');
|
|
124
|
+
expect(message.textContent).toContain('Required field');
|
|
125
|
+
cleanup(el);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('propagates error to slotted bds-radio elements', async () => {
|
|
129
|
+
const el = await fixture(
|
|
130
|
+
'<bds-radio-group label="Test" error="Required field"><bds-radio value="a">A</bds-radio><bds-radio value="b">B</bds-radio></bds-radio-group>',
|
|
131
|
+
);
|
|
132
|
+
const children = Array.from(el.querySelectorAll('bds-radio'));
|
|
133
|
+
expect(children.every(child => child.hasAttribute('error'))).toBe(true);
|
|
134
|
+
cleanup(el);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('removes propagated error when the group error clears, keeping an individual error', async () => {
|
|
138
|
+
const el = await fixture(
|
|
139
|
+
'<bds-radio-group label="Test" error="Required field"><bds-radio value="a">A</bds-radio><bds-radio value="b" error>B</bds-radio></bds-radio-group>',
|
|
140
|
+
) as BdsRadioGroup;
|
|
141
|
+
el.error = undefined;
|
|
142
|
+
await el.updateComplete;
|
|
143
|
+
const [first, second] = Array.from(el.querySelectorAll('bds-radio'));
|
|
144
|
+
expect(first.hasAttribute('error')).toBe(false);
|
|
145
|
+
expect(second.hasAttribute('error')).toBe(true);
|
|
146
|
+
cleanup(el);
|
|
118
147
|
});
|
|
119
148
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LitElement, css, html, nothing } from 'lit';
|
|
2
|
+
import { fieldMessageStyles, renderFieldMessage } from './field-message';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* `<bds-radio-group>` — groups related radio buttons with a shared label and name.
|
|
@@ -67,19 +68,10 @@ export class BdsRadioGroup extends LitElement {
|
|
|
67
68
|
gap: var(--bds-space_xs);
|
|
68
69
|
}
|
|
69
70
|
|
|
71
|
+
${fieldMessageStyles}
|
|
72
|
+
|
|
70
73
|
.message {
|
|
71
74
|
margin-block-start: var(--bds-space_xs);
|
|
72
|
-
font-size: var(--bds-font_size--body--s);
|
|
73
|
-
font-family: var(--bds-font_family--body);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.message--error {
|
|
77
|
-
color: var(--bds-color_error);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.message--hint {
|
|
81
|
-
color: var(--bds-color_on-bg--subtle);
|
|
82
|
-
font-style: italic;
|
|
83
75
|
}
|
|
84
76
|
`;
|
|
85
77
|
|
|
@@ -136,9 +128,29 @@ export class BdsRadioGroup extends LitElement {
|
|
|
136
128
|
});
|
|
137
129
|
};
|
|
138
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Propagates the group's `error` to slotted `<bds-radio>` elements so they show
|
|
133
|
+
* the error ring. A radio individually marked `error` in markup keeps it.
|
|
134
|
+
*/
|
|
135
|
+
private _propagateError = () => {
|
|
136
|
+
this.querySelectorAll('bds-radio').forEach(radio => {
|
|
137
|
+
const el = radio as HTMLElement;
|
|
138
|
+
if (this.error) {
|
|
139
|
+
if (!el.hasAttribute('error')) {
|
|
140
|
+
el.setAttribute('data-bds-group-error', '');
|
|
141
|
+
}
|
|
142
|
+
el.setAttribute('error', '');
|
|
143
|
+
} else if (el.hasAttribute('data-bds-group-error')) {
|
|
144
|
+
el.removeAttribute('error');
|
|
145
|
+
el.removeAttribute('data-bds-group-error');
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
|
|
139
150
|
private _propagateToRadios = () => {
|
|
140
151
|
this._propagateName();
|
|
141
152
|
this._propagateDisabled();
|
|
153
|
+
this._propagateError();
|
|
142
154
|
};
|
|
143
155
|
|
|
144
156
|
connectedCallback() {
|
|
@@ -149,7 +161,7 @@ export class BdsRadioGroup extends LitElement {
|
|
|
149
161
|
|
|
150
162
|
updated(changed: Map<string, unknown>) {
|
|
151
163
|
super.updated(changed);
|
|
152
|
-
if (changed.has('name') || changed.has('disabled')) {
|
|
164
|
+
if (changed.has('name') || changed.has('disabled') || changed.has('error')) {
|
|
153
165
|
this._propagateToRadios();
|
|
154
166
|
}
|
|
155
167
|
}
|
|
@@ -173,9 +185,9 @@ export class BdsRadioGroup extends LitElement {
|
|
|
173
185
|
<slot @slotchange=${this._propagateToRadios}></slot>
|
|
174
186
|
</div>
|
|
175
187
|
${this.error
|
|
176
|
-
?
|
|
188
|
+
? renderFieldMessage('error', errorId, this.error)
|
|
177
189
|
: this.hint
|
|
178
|
-
?
|
|
190
|
+
? renderFieldMessage('hint', hintId, this.hint)
|
|
179
191
|
: ''}
|
|
180
192
|
</fieldset>
|
|
181
193
|
`;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LitElement, css, html, nothing } from 'lit';
|
|
2
|
+
import { fieldMessageStyles, renderFieldMessage } from './field-message';
|
|
2
3
|
|
|
3
4
|
export interface SelectOption {
|
|
4
5
|
value: string;
|
|
@@ -110,22 +111,9 @@ export class BdsSelect extends LitElement {
|
|
|
110
111
|
|
|
111
112
|
:host([error]) .select {
|
|
112
113
|
--bdc_color: var(--bdc_color--error);
|
|
114
|
+
--bdc-outline_width: var(--bdc-outline_width--error, 2px);
|
|
113
115
|
}
|
|
114
116
|
|
|
115
|
-
.message {
|
|
116
|
-
margin-block-start: var(--bds-space_xxs);
|
|
117
|
-
font-size: var(--bds-font_size--body--s);
|
|
118
|
-
font-family: var(--bds-font_family--body);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.message--error {
|
|
122
|
-
color: var(--bds-color_error);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.message--hint {
|
|
126
|
-
color: var(--bds-color_on-bg--subtle);
|
|
127
|
-
font-style: italic;
|
|
128
|
-
}
|
|
129
117
|
|
|
130
118
|
.chevron {
|
|
131
119
|
position: absolute;
|
|
@@ -142,6 +130,8 @@ export class BdsSelect extends LitElement {
|
|
|
142
130
|
inline-size: 100%;
|
|
143
131
|
block-size: 100%;
|
|
144
132
|
}
|
|
133
|
+
|
|
134
|
+
${fieldMessageStyles}
|
|
145
135
|
`;
|
|
146
136
|
|
|
147
137
|
static properties = {
|
|
@@ -259,9 +249,9 @@ export class BdsSelect extends LitElement {
|
|
|
259
249
|
</span>
|
|
260
250
|
</div>
|
|
261
251
|
${this.error
|
|
262
|
-
?
|
|
252
|
+
? renderFieldMessage('error', errorId, this.error)
|
|
263
253
|
: this.hint
|
|
264
|
-
?
|
|
254
|
+
? renderFieldMessage('hint', hintId, this.hint)
|
|
265
255
|
: ''}
|
|
266
256
|
`;
|
|
267
257
|
}
|