@boostdev/design-system-components 1.1.1 → 1.2.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 +13 -10
- package/dist/client.cjs +77 -99
- package/dist/client.css +611 -580
- package/dist/client.d.cts +13 -16
- package/dist/client.d.ts +13 -16
- package/dist/client.js +87 -109
- package/dist/index.cjs +77 -99
- package/dist/index.css +611 -580
- package/dist/index.d.cts +13 -16
- package/dist/index.d.ts +13 -16
- package/dist/index.js +87 -109
- package/dist/native/index.cjs +9 -8
- package/dist/native/index.d.cts +1 -1
- package/dist/native/index.d.ts +1 -1
- package/dist/native/index.js +9 -8
- package/dist/web-components/chunk-2QA62WCQ.js +48 -0
- package/dist/web-components/chunk-3REOIRDW.js +246 -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-6MH5UWUD.js +226 -0
- package/dist/web-components/chunk-7FMR53BW.js +127 -0
- package/dist/web-components/chunk-AGKJTMJI.js +56 -0
- package/dist/web-components/chunk-AJSXNDAP.js +151 -0
- package/dist/web-components/chunk-BQLZ7I4G.js +56 -0
- package/dist/web-components/chunk-BX3IPVOB.js +167 -0
- package/dist/web-components/chunk-CR5PGUHV.js +109 -0
- package/dist/web-components/chunk-DI46Q2EA.js +278 -0
- package/dist/web-components/chunk-DZRSJGPB.js +53 -0
- package/dist/web-components/chunk-EBJM3VD4.js +107 -0
- package/dist/web-components/chunk-ECW3HHWA.js +185 -0
- package/dist/web-components/chunk-HGBNDR22.js +98 -0
- package/dist/web-components/chunk-HHHRF2PS.js +118 -0
- package/dist/web-components/chunk-ITHLKR7Q.js +105 -0
- package/dist/web-components/chunk-JUKB3BUP.js +186 -0
- package/dist/web-components/chunk-L3XHOMN6.js +111 -0
- package/dist/{web-components.js → web-components/chunk-LGEZYFUU.js} +62 -844
- package/dist/web-components/chunk-LY62SAVN.js +64 -0
- package/dist/web-components/chunk-N6IMUOY4.js +185 -0
- package/dist/web-components/chunk-OHUTLSIQ.js +69 -0
- package/dist/web-components/chunk-OQTRTMAB.js +27 -0
- package/dist/web-components/chunk-PY62FTRW.js +179 -0
- package/dist/web-components/chunk-Q4T5BJT6.js +94 -0
- package/dist/web-components/chunk-QDST57JC.js +119 -0
- package/dist/web-components/chunk-QLZ2362S.js +279 -0
- package/dist/web-components/chunk-QPOKHLMQ.js +45 -0
- package/dist/web-components/chunk-SOQQ7RVJ.js +88 -0
- package/dist/web-components/chunk-T6AETZRP.js +131 -0
- package/dist/web-components/chunk-UFFCKVZE.js +149 -0
- package/dist/web-components/chunk-VMMVWLXL.js +53 -0
- package/dist/web-components/chunk-X3FKVHLK.js +144 -0
- package/dist/web-components/chunk-XNA6WTXG.js +133 -0
- package/dist/web-components/chunk-Y4MAXTMA.js +80 -0
- package/dist/web-components/chunk-YLVTEY23.js +165 -0
- package/dist/web-components/chunk-YRXCVKHV.js +116 -0
- package/dist/web-components/chunk-ZTC6GRP7.js +64 -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 +88 -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 +170 -5
- package/src/components/interaction/Button/Button.module.css +12 -11
- package/src/components/interaction/Button/Button.native.tsx +10 -9
- package/src/components/interaction/Button/Button.tsx +1 -1
- package/src/components/interaction/Command/Command.module.css +3 -7
- package/src/components/interaction/Dialog/Dialog.module.css +7 -5
- package/src/components/interaction/Drawer/Drawer.module.css +49 -1
- package/src/components/interaction/DropdownMenu/DropdownMenu.module.css +1 -3
- package/src/components/interaction/Popover/Popover.module.css +1 -3
- package/src/components/interaction/form/Checkbox/Checkbox.module.css +1 -3
- package/src/components/interaction/form/Combobox/Combobox.module.css +2 -6
- package/src/components/interaction/form/FormInput/FormInput.module.css +1 -3
- package/src/components/interaction/form/NumberInput/NumberInput.module.css +16 -4
- package/src/components/interaction/form/Radio/Radio.module.css +6 -16
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.mdx +70 -25
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.module.css +55 -33
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.spec.tsx +127 -56
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.stories.tsx +89 -72
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.tsx +40 -62
- package/src/components/interaction/form/SegmentedControl/index.ts +1 -1
- package/src/components/interaction/form/Select/Select.module.css +2 -4
- package/src/components/interaction/form/Switch/Switch.module.css +5 -7
- package/src/components/interaction/form/Switch/Switch.native.spec.tsx +9 -9
- package/src/components/interaction/form/Switch/Switch.native.tsx +2 -2
- package/src/components/interaction/form/Textarea/Textarea.module.css +1 -3
- package/src/components/interaction/form/atoms/InputContainer.stories.tsx +64 -0
- package/src/components/interaction/form/atoms/Label.stories.tsx +33 -0
- package/src/components/interaction/form/atoms/Message.stories.tsx +33 -0
- package/src/components/layout/Card/Card.module.css +1 -3
- package/src/components/ui/Accordion/Accordion.module.css +1 -2
- package/src/components/ui/Alert/Alert.module.css +1 -2
- package/src/components/ui/Calendar/Calendar.module.css +2 -5
- package/src/components/ui/Carousel/Carousel.module.css +1 -3
- package/src/components/ui/NotificationBanner/NotificationBanner.module.css +1 -2
- package/src/components/ui/Pagination/Pagination.module.css +1 -2
- package/src/components/ui/SkipLink/SkipLink.module.css +1 -2
- package/src/components/ui/Table/Table.module.css +1 -2
- package/src/css/bdc.css +16 -11
- package/src/index.ts +1 -1
- package/src/web-components/globals.ts +3 -3
- package/src/web-components/index.ts +47 -0
- package/src/web-components/interaction/BdsAccordion.mdx +51 -0
- package/src/web-components/interaction/BdsAccordion.stories.tsx +85 -0
- package/src/web-components/interaction/BdsCollapsible.mdx +46 -0
- package/src/web-components/interaction/BdsCollapsible.stories.tsx +87 -0
- package/src/web-components/interaction/BdsDialog.mdx +49 -0
- package/src/web-components/interaction/BdsDialog.stories.tsx +75 -0
- package/src/web-components/interaction/BdsDrawer.mdx +50 -0
- package/src/web-components/interaction/BdsDrawer.stories.tsx +66 -0
- package/src/web-components/interaction/BdsSkipLink.mdx +34 -0
- package/src/web-components/interaction/BdsSkipLink.stories.tsx +55 -0
- package/src/web-components/interaction/BdsTabs.mdx +47 -0
- package/src/web-components/interaction/BdsTabs.stories.tsx +80 -0
- package/src/web-components/interaction/BdsTooltip.mdx +38 -0
- package/src/web-components/interaction/BdsTooltip.stories.tsx +68 -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 +98 -0
- package/src/web-components/interaction/bds-button.ts +15 -13
- 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 +221 -0
- package/src/web-components/interaction/bds-drawer.spec.ts +113 -0
- package/src/web-components/interaction/bds-drawer.ts +315 -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/BdsCheckbox.mdx +39 -0
- package/src/web-components/interaction/form/BdsCheckbox.stories.tsx +73 -0
- package/src/web-components/interaction/form/BdsCombobox.mdx +52 -0
- package/src/web-components/interaction/form/BdsCombobox.stories.tsx +91 -0
- package/src/web-components/interaction/form/BdsFileInput.mdx +44 -0
- package/src/web-components/interaction/form/BdsFileInput.stories.tsx +84 -0
- package/src/web-components/interaction/form/BdsNumberInput.mdx +41 -0
- package/src/web-components/interaction/form/BdsNumberInput.stories.tsx +90 -0
- package/src/web-components/interaction/form/BdsRadio.mdx +41 -0
- package/src/web-components/interaction/form/BdsRadio.stories.tsx +90 -0
- package/src/web-components/interaction/form/BdsSegmentedControl.mdx +42 -0
- package/src/web-components/interaction/form/BdsSegmentedControl.stories.tsx +92 -0
- package/src/web-components/interaction/form/BdsSelect.mdx +38 -0
- package/src/web-components/interaction/form/BdsSelect.stories.tsx +93 -0
- package/src/web-components/interaction/form/BdsSlider.mdx +49 -0
- package/src/web-components/interaction/form/BdsSlider.stories.tsx +89 -0
- package/src/web-components/interaction/form/BdsSwitch.mdx +39 -0
- package/src/web-components/interaction/form/BdsSwitch.stories.tsx +73 -0
- package/src/web-components/interaction/form/BdsTextarea.mdx +41 -0
- package/src/web-components/interaction/form/BdsTextarea.stories.tsx +79 -0
- package/src/web-components/interaction/form/bds-checkbox.spec.ts +63 -0
- package/src/web-components/interaction/form/bds-checkbox.ts +166 -0
- package/src/web-components/interaction/form/bds-combobox.spec.ts +117 -0
- package/src/web-components/interaction/form/bds-combobox.ts +334 -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 +220 -0
- package/src/web-components/interaction/form/bds-radio.spec.ts +70 -0
- package/src/web-components/interaction/form/bds-radio.ts +151 -0
- package/src/web-components/interaction/form/bds-segmented-control.spec.ts +74 -0
- package/src/web-components/interaction/form/bds-segmented-control.ts +282 -0
- package/src/web-components/interaction/form/bds-select.spec.ts +74 -0
- package/src/web-components/interaction/form/bds-select.ts +188 -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 +165 -0
- package/src/web-components/interaction/form/bds-textarea.spec.ts +55 -0
- package/src/web-components/interaction/form/bds-textarea.ts +141 -0
- package/src/web-components/ui/BdsAvatar.mdx +67 -0
- package/src/web-components/ui/BdsAvatar.stories.tsx +62 -0
- package/src/web-components/ui/BdsBreadcrumb.mdx +63 -0
- package/src/web-components/ui/BdsBreadcrumb.stories.tsx +59 -0
- package/src/web-components/ui/BdsCard.mdx +83 -0
- package/src/web-components/ui/BdsCard.stories.tsx +90 -0
- package/src/web-components/ui/BdsDescriptionList.mdx +67 -0
- package/src/web-components/ui/BdsDescriptionList.stories.tsx +79 -0
- package/src/web-components/ui/BdsIconWrapper.mdx +70 -0
- package/src/web-components/ui/BdsIconWrapper.stories.tsx +76 -0
- package/src/web-components/ui/BdsLink.mdx +75 -0
- package/src/web-components/ui/BdsLink.stories.tsx +64 -0
- package/src/web-components/ui/BdsLoading.mdx +62 -0
- package/src/web-components/ui/BdsLoading.stories.tsx +37 -0
- package/src/web-components/ui/BdsNotificationBanner.mdx +90 -0
- package/src/web-components/ui/BdsNotificationBanner.stories.tsx +93 -0
- package/src/web-components/ui/BdsProgress.mdx +63 -0
- package/src/web-components/ui/BdsProgress.stories.tsx +70 -0
- package/src/web-components/ui/BdsProgressCircle.mdx +64 -0
- package/src/web-components/ui/BdsProgressCircle.stories.tsx +69 -0
- package/src/web-components/ui/BdsRating.mdx +61 -0
- package/src/web-components/ui/BdsRating.stories.tsx +39 -0
- package/src/web-components/ui/BdsSectionHeader.mdx +69 -0
- package/src/web-components/ui/BdsSectionHeader.stories.tsx +56 -0
- package/src/web-components/ui/BdsSeparator.mdx +63 -0
- package/src/web-components/ui/BdsSeparator.stories.tsx +47 -0
- package/src/web-components/ui/BdsSkeleton.mdx +67 -0
- package/src/web-components/ui/BdsSkeleton.stories.tsx +50 -0
- package/src/web-components/ui/BdsTypography.mdx +83 -0
- package/src/web-components/ui/BdsTypography.stories.tsx +51 -0
- package/src/web-components/ui/bds-alert.ts +1 -2
- 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 +154 -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 +184 -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 -304
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
@keyframes pulse {
|
|
14
14
|
0% {
|
|
15
15
|
transform: scale(1);
|
|
16
|
-
box-shadow: 0 0 0 0 rgb(from var(--button_pulse-color, var(--button_color, var(--bds-
|
|
16
|
+
box-shadow: 0 0 0 0 rgb(from var(--button_pulse-color, var(--button_color, var(--bds-color_interactive))) r g b / 50%);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
70% {
|
|
20
20
|
transform: scale(1.01);
|
|
21
|
-
box-shadow: 0 0 0 var(--bds-space_m) rgb(from var(--button_pulse-color, var(--button_color, var(--bds-
|
|
21
|
+
box-shadow: 0 0 0 var(--bds-space_m) rgb(from var(--button_pulse-color, var(--button_color, var(--bds-color_interactive))) r g b / 0%);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
100% {
|
|
25
25
|
transform: scale(1);
|
|
26
|
-
box-shadow: 0 0 0 0 rgb(from var(--button_pulse-color, var(--button_color, var(--bds-
|
|
26
|
+
box-shadow: 0 0 0 0 rgb(from var(--button_pulse-color, var(--button_color, var(--bds-color_interactive))) r g b / 0%);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -47,27 +47,27 @@
|
|
|
47
47
|
line-height: 1;
|
|
48
48
|
|
|
49
49
|
/* Colour model: override --button_color + --button_on-color to re-theme */
|
|
50
|
-
--button_color: var(--bds-
|
|
51
|
-
--button_on-color: var(--bds-color_on-
|
|
50
|
+
--button_color: var(--bds-color_interactive);
|
|
51
|
+
--button_on-color: var(--bds-color_on-interactive);
|
|
52
52
|
|
|
53
53
|
/* Text-safe variant of --button_color for use on page background (ghost text/border) */
|
|
54
|
-
--button_color--on-bg: var(--bds-
|
|
54
|
+
--button_color--on-bg: var(--bds-color_interactive_on-bg);
|
|
55
55
|
|
|
56
56
|
background-color: var(--button_bg, var(--button_color));
|
|
57
57
|
color: var(--button_text, var(--button_on-color));
|
|
58
58
|
border: var(--button_border, none);
|
|
59
59
|
--bdc_color: transparent;
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
outline-offset: var(--bdc-outline_offset);
|
|
61
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color);
|
|
63
62
|
transition: var(--bds-animation_transition), --bdc_color var(--bds-animation_transition-duration) var(--bds-animation_easing);
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
/* Default: filled with --button_color, no visible border */
|
|
67
66
|
.button.--default { /* inherits base — no overrides needed */ }
|
|
68
67
|
|
|
69
|
-
/*
|
|
70
|
-
.button.--
|
|
68
|
+
/* Outline: transparent background, border and text use text-safe --button_color--on-bg */
|
|
69
|
+
.button.--outline,
|
|
70
|
+
.button.--ghost /* @deprecated — use variant="outline" */ {
|
|
71
71
|
--button_bg: transparent;
|
|
72
72
|
--button_text: var(--button_color--on-bg);
|
|
73
73
|
--bdc_color: var(--button_color--on-bg);
|
|
@@ -150,8 +150,9 @@
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
/*
|
|
153
|
+
/* Outline hover: fills with --button_color */
|
|
154
154
|
@media (hover: hover) and (pointer: fine) {
|
|
155
|
+
.button.--outline:hover,
|
|
155
156
|
.button.--ghost:hover {
|
|
156
157
|
--button_bg: var(--button_color);
|
|
157
158
|
--button_text: var(--button_on-color);
|
|
@@ -3,7 +3,7 @@ import { StyleSheet, Pressable, Text, View, StyleProp, ViewStyle } from 'react-n
|
|
|
3
3
|
import { spacing, font, border } from '../../../native/tokens';
|
|
4
4
|
import { useTheme } from '../../../native/ThemeContext';
|
|
5
5
|
|
|
6
|
-
type ButtonVariant = 'default' | 'ghost';
|
|
6
|
+
type ButtonVariant = 'default' | 'outline' | 'ghost'; // 'ghost' is deprecated, use 'outline'
|
|
7
7
|
type ButtonSize = 'small' | 'medium' | 'large';
|
|
8
8
|
|
|
9
9
|
export interface ButtonProps {
|
|
@@ -53,26 +53,27 @@ export function Button({
|
|
|
53
53
|
const { colors } = useTheme();
|
|
54
54
|
const { height, px, fontSize, radius } = sizeTokens[size];
|
|
55
55
|
|
|
56
|
-
// Color model: filled =
|
|
57
|
-
const primaryColor = colors.
|
|
58
|
-
const onPrimaryColor = colors.
|
|
59
|
-
//
|
|
60
|
-
const
|
|
56
|
+
// Color model: filled = interactive bg, outline = transparent bg + interactive_on-bg border/text
|
|
57
|
+
const primaryColor = colors.colorInteractive;
|
|
58
|
+
const onPrimaryColor = colors.colorOnInteractive;
|
|
59
|
+
// Outline uses colorInteractiveOnBg for text/border — colorInteractive may not meet 3:1 on white
|
|
60
|
+
const outlineTextColor = colors.colorInteractiveOnBg;
|
|
61
61
|
|
|
62
|
+
const isOutline = variant === 'outline' || variant === 'ghost';
|
|
62
63
|
const containerStyle: ViewStyle = {
|
|
63
64
|
height,
|
|
64
65
|
paddingHorizontal: px,
|
|
65
66
|
borderRadius: radius,
|
|
66
67
|
opacity: disabled ? 0.4 : 1,
|
|
67
68
|
...(variant === 'default' && { backgroundColor: primaryColor }),
|
|
68
|
-
...(
|
|
69
|
+
...(isOutline && {
|
|
69
70
|
backgroundColor: 'transparent',
|
|
70
71
|
borderWidth: 1,
|
|
71
|
-
borderColor:
|
|
72
|
+
borderColor: outlineTextColor,
|
|
72
73
|
}),
|
|
73
74
|
};
|
|
74
75
|
|
|
75
|
-
const textColor = variant === 'default' ? onPrimaryColor :
|
|
76
|
+
const textColor = variant === 'default' ? onPrimaryColor : outlineTextColor;
|
|
76
77
|
|
|
77
78
|
return (
|
|
78
79
|
<Pressable
|
|
@@ -5,7 +5,7 @@ import type { WithClassName } from '../../../types';
|
|
|
5
5
|
|
|
6
6
|
export interface ButtonProps extends WithClassName, ButtonHTMLAttributes<HTMLButtonElement | HTMLAnchorElement> {
|
|
7
7
|
href?: string;
|
|
8
|
-
variant?: 'default' | 'ghost';
|
|
8
|
+
variant?: 'default' | 'outline' | /** @deprecated Use "outline" instead */ 'ghost';
|
|
9
9
|
type?: 'button' | 'submit' | 'reset';
|
|
10
10
|
size?: 'small' | 'medium' | 'large';
|
|
11
11
|
iconStart?: ReactNode;
|
|
@@ -21,15 +21,13 @@
|
|
|
21
21
|
background-color: var(--command_color, var(--bds-color_bg));
|
|
22
22
|
color: var(--command_on-color, var(--bds-color_on-bg));
|
|
23
23
|
border-radius: var(--bds-border_radius--m);
|
|
24
|
-
box-shadow: var(--command_shadow, var(--bds-shadow_xl));
|
|
25
24
|
overflow: hidden;
|
|
26
25
|
max-block-size: 70vh;
|
|
27
26
|
border: var(--command_border, none);
|
|
28
27
|
--bdc_color: currentcolor;
|
|
29
28
|
--bdc-outline_radius: var(--bds-border_radius--m);
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
outline-offset: var(--bdc-outline_offset);
|
|
30
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color), var(--command_shadow, var(--bds-shadow_xl));
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
.searchRow {
|
|
@@ -73,8 +71,7 @@
|
|
|
73
71
|
--bdc_color: currentcolor;
|
|
74
72
|
|
|
75
73
|
border: none;
|
|
76
|
-
|
|
77
|
-
outline-offset: var(--bdc-outline_offset);
|
|
74
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color);
|
|
78
75
|
}
|
|
79
76
|
|
|
80
77
|
.list {
|
|
@@ -132,8 +129,7 @@
|
|
|
132
129
|
--bdc_color: currentcolor;
|
|
133
130
|
|
|
134
131
|
border: none;
|
|
135
|
-
|
|
136
|
-
outline-offset: var(--bdc-outline_offset);
|
|
132
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color);
|
|
137
133
|
}
|
|
138
134
|
|
|
139
135
|
.empty {
|
|
@@ -5,10 +5,8 @@
|
|
|
5
5
|
--bdc_color: currentcolor;
|
|
6
6
|
--bdc-outline_radius: var(--bds-border_radius--m);
|
|
7
7
|
|
|
8
|
-
outline: var(--bdc-outline_width) solid var(--bdc_color);
|
|
9
|
-
outline-offset: var(--bdc-outline_offset);
|
|
10
8
|
border-radius: var(--dialog_radius, var(--bdc-outline_radius));
|
|
11
|
-
box-shadow: var(--dialog_shadow, var(--bdc-outline_shadow));
|
|
9
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color), var(--dialog_shadow, var(--bdc-outline_shadow));
|
|
12
10
|
background-color: var(--dialog_color ,var(--bds-color_grey--subtle));
|
|
13
11
|
color: var(--dialog_on-color, var(--bds-color_on-grey--subtle));
|
|
14
12
|
padding: var(--bds-space_l);
|
|
@@ -41,11 +39,15 @@
|
|
|
41
39
|
border: var(--dialog_close-border, none);
|
|
42
40
|
--bdc_color: currentcolor;
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
outline-offset: var(--bdc-outline_offset);
|
|
42
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color);
|
|
46
43
|
cursor: pointer;
|
|
47
44
|
}
|
|
48
45
|
|
|
46
|
+
.closeButton:focus-visible {
|
|
47
|
+
outline: var(--bds-outline_default);
|
|
48
|
+
outline-offset: var(--bds-outline_offset);
|
|
49
|
+
}
|
|
50
|
+
|
|
49
51
|
.closeButton svg {
|
|
50
52
|
inline-size: 1.25em;
|
|
51
53
|
block-size: 1.25em;
|
|
@@ -11,16 +11,32 @@
|
|
|
11
11
|
border: none;
|
|
12
12
|
background: transparent;
|
|
13
13
|
overflow: hidden;
|
|
14
|
+
transition:
|
|
15
|
+
display var(--bds-animation_transition-duration) allow-discrete,
|
|
16
|
+
overlay var(--bds-animation_transition-duration) allow-discrete;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
.drawer::backdrop {
|
|
17
20
|
background-color: var(--color_backdrop, rgb(0 0 0 / 50%));
|
|
18
21
|
backdrop-filter: blur(3px);
|
|
22
|
+
transition:
|
|
23
|
+
display var(--bds-animation_transition-duration) allow-discrete,
|
|
24
|
+
overlay var(--bds-animation_transition-duration) allow-discrete,
|
|
25
|
+
background-color var(--bds-animation_transition-duration) var(--bds-animation_easing),
|
|
26
|
+
backdrop-filter var(--bds-animation_transition-duration) var(--bds-animation_easing);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@starting-style {
|
|
30
|
+
.drawer[open]::backdrop {
|
|
31
|
+
background-color: transparent;
|
|
32
|
+
backdrop-filter: blur(0);
|
|
33
|
+
}
|
|
19
34
|
}
|
|
20
35
|
|
|
21
36
|
.panel {
|
|
22
37
|
position: absolute;
|
|
23
38
|
inset-block: 0;
|
|
39
|
+
inset-inline: auto;
|
|
24
40
|
display: flex;
|
|
25
41
|
flex-direction: column;
|
|
26
42
|
inline-size: min(28rem, 90vw);
|
|
@@ -29,15 +45,40 @@
|
|
|
29
45
|
color: var(--drawer_on-color, var(--bds-color_on-bg));
|
|
30
46
|
box-shadow: var(--bds-shadow_xl);
|
|
31
47
|
overflow: hidden;
|
|
32
|
-
|
|
48
|
+
translate: 100% 0;
|
|
49
|
+
transition: translate var(--bds-animation_transition-duration) var(--bds-animation_easing);
|
|
33
50
|
}
|
|
34
51
|
|
|
35
52
|
.--side_right .panel {
|
|
36
53
|
inset-inline-end: 0;
|
|
54
|
+
translate: 100% 0;
|
|
37
55
|
}
|
|
38
56
|
|
|
39
57
|
.--side_left .panel {
|
|
40
58
|
inset-inline-start: 0;
|
|
59
|
+
translate: -100% 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.drawer[open] .panel {
|
|
63
|
+
translate: 0 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.drawer[open].--side_right .panel {
|
|
67
|
+
animation: bdc-drawer-slide-right var(--bds-animation_transition-duration) var(--bds-animation_easing) both;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.drawer[open].--side_left .panel {
|
|
71
|
+
animation: bdc-drawer-slide-left var(--bds-animation_transition-duration) var(--bds-animation_easing) both;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@keyframes bdc-drawer-slide-right {
|
|
75
|
+
from { translate: 100% 0; }
|
|
76
|
+
to { translate: 0 0; }
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@keyframes bdc-drawer-slide-left {
|
|
80
|
+
from { translate: -100% 0; }
|
|
81
|
+
to { translate: 0 0; }
|
|
41
82
|
}
|
|
42
83
|
|
|
43
84
|
.header {
|
|
@@ -86,8 +127,15 @@
|
|
|
86
127
|
}
|
|
87
128
|
|
|
88
129
|
@media (prefers-reduced-motion: reduce) {
|
|
130
|
+
.drawer,
|
|
131
|
+
.drawer::backdrop,
|
|
89
132
|
.panel {
|
|
90
133
|
transition: none;
|
|
91
134
|
}
|
|
135
|
+
|
|
136
|
+
.drawer[open].--side_right .panel,
|
|
137
|
+
.drawer[open].--side_left .panel {
|
|
138
|
+
animation: none;
|
|
139
|
+
}
|
|
92
140
|
}
|
|
93
141
|
}
|
|
@@ -14,12 +14,10 @@
|
|
|
14
14
|
--bdc_color: currentcolor;
|
|
15
15
|
--bdc-outline_radius: var(--bds-border_radius--s);
|
|
16
16
|
|
|
17
|
-
outline: var(--bdc-outline_width) solid var(--bdc_color);
|
|
18
|
-
outline-offset: var(--bdc-outline_offset);
|
|
19
17
|
border-radius: var(--dropdown_radius, var(--bdc-outline_radius));
|
|
20
18
|
background-color: var(--dropdown_color, var(--bds-color_bg));
|
|
21
19
|
color: var(--dropdown_on-color, var(--bds-color_on-bg));
|
|
22
|
-
box-shadow: var(--dropdown_shadow, var(--bds-shadow_m));
|
|
20
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color), var(--dropdown_shadow, var(--bds-shadow_m));
|
|
23
21
|
list-style: none;
|
|
24
22
|
margin: 0;
|
|
25
23
|
}
|
|
@@ -25,11 +25,9 @@
|
|
|
25
25
|
--bdc_color: currentcolor;
|
|
26
26
|
--bdc-outline_radius: var(--bds-border_radius--s);
|
|
27
27
|
|
|
28
|
-
outline: var(--bdc-outline_width) solid var(--bdc_color);
|
|
29
|
-
outline-offset: var(--bdc-outline_offset);
|
|
30
28
|
border-radius: var(--popover_radius, var(--bdc-outline_radius));
|
|
31
29
|
background-color: var(--popover_color, var(--bds-color_bg));
|
|
32
|
-
box-shadow: var(--popover_shadow, var(--bds-shadow_m));
|
|
30
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color), var(--popover_shadow, var(--bds-shadow_m));
|
|
33
31
|
color: var(--popover_on-color, var(--bds-color_on-bg));
|
|
34
32
|
font-size: var(--bds-font_size--body);
|
|
35
33
|
}
|
|
@@ -21,10 +21,8 @@
|
|
|
21
21
|
--bdc_color: currentcolor;
|
|
22
22
|
--bdc-outline_radius: var(--bds-border_radius--xs);
|
|
23
23
|
|
|
24
|
-
outline: var(--bdc-outline_width) solid var(--bdc_color);
|
|
25
|
-
outline-offset: var(--bdc-outline_offset);
|
|
26
24
|
border-radius: var(--checkbox_radius, var(--bdc-outline_radius));
|
|
27
|
-
box-shadow: var(--checkbox_shadow, var(--bdc-outline_shadow));
|
|
25
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color), var(--checkbox_shadow, var(--bdc-outline_shadow));
|
|
28
26
|
appearance: none;
|
|
29
27
|
background-color: var(--checkbox_color_bg, var(--bds-color_bg));
|
|
30
28
|
cursor: pointer;
|
|
@@ -21,10 +21,8 @@
|
|
|
21
21
|
--bdc_color: currentcolor;
|
|
22
22
|
--bdc-outline_radius: var(--bds-border_radius--xs);
|
|
23
23
|
|
|
24
|
-
outline: var(--bdc-outline_width) solid var(--bdc_color);
|
|
25
|
-
outline-offset: var(--bdc-outline_offset);
|
|
26
24
|
border-radius: var(--combobox_radius, var(--bdc-outline_radius));
|
|
27
|
-
box-shadow: var(--combobox_shadow, var(--bdc-outline_shadow));
|
|
25
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color), var(--combobox_shadow, var(--bdc-outline_shadow));
|
|
28
26
|
background-color: var(--combobox_color_bg, var(--bds-color_bg));
|
|
29
27
|
color: var(--combobox_color, var(--bds-color_on-bg));
|
|
30
28
|
transition: --bdc_color var(--bds-animation_transition-duration) var(--bds-animation_easing),
|
|
@@ -77,12 +75,10 @@
|
|
|
77
75
|
--bdc_color: currentcolor;
|
|
78
76
|
--bdc-outline_radius: var(--bds-border_radius--xs);
|
|
79
77
|
|
|
80
|
-
outline: var(--bdc-outline_width) solid var(--bdc_color);
|
|
81
|
-
outline-offset: var(--bdc-outline_offset);
|
|
82
78
|
border-radius: var(--combobox_listbox-radius, var(--bdc-outline_radius));
|
|
83
79
|
background-color: var(--combobox_color, var(--bds-color_bg));
|
|
84
80
|
color: var(--combobox_on-color, var(--bds-color_on-bg));
|
|
85
|
-
box-shadow: var(--combobox_listbox-shadow, var(--bds-shadow_m));
|
|
81
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color), var(--combobox_listbox-shadow, var(--bds-shadow_m));
|
|
86
82
|
}
|
|
87
83
|
|
|
88
84
|
.option {
|
|
@@ -14,10 +14,8 @@
|
|
|
14
14
|
--bdc_color: currentcolor;
|
|
15
15
|
--bdc-outline_radius: var(--bds-border_radius--xs);
|
|
16
16
|
|
|
17
|
-
outline: var(--bdc-outline_width) solid var(--bdc_color);
|
|
18
|
-
outline-offset: var(--bdc-outline_offset);
|
|
19
17
|
border-radius: var(--input_radius, var(--bdc-outline_radius));
|
|
20
|
-
box-shadow: var(--input_shadow, var(--bdc-outline_shadow));
|
|
18
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color), var(--input_shadow, var(--bdc-outline_shadow));
|
|
21
19
|
color: var(--input_color, var(--bds-color_on-bg));
|
|
22
20
|
background-color: var(--input_color_bg, var(--bds-color_bg));
|
|
23
21
|
transition: --bdc_color var(--bds-animation_transition-duration) var(--bds-animation_easing),
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
--bdc_color: currentcolor;
|
|
12
12
|
--bdc-outline_radius: var(--bds-border_radius--xs);
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
border-radius: var(--
|
|
17
|
-
box-shadow: var(--numberInput_shadow, var(--bdc-outline_shadow));
|
|
14
|
+
--_radius: var(--numberInput_radius, var(--bdc-outline_radius));
|
|
15
|
+
|
|
16
|
+
border-radius: var(--_radius);
|
|
17
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color), var(--numberInput_shadow, var(--bdc-outline_shadow));
|
|
18
18
|
overflow: hidden;
|
|
19
19
|
transition: --bdc_color var(--bds-animation_transition-duration) var(--bds-animation_easing);
|
|
20
20
|
}
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
align-items: center;
|
|
58
58
|
justify-content: center;
|
|
59
59
|
padding: var(--bds-space_xs);
|
|
60
|
+
margin: 1px;
|
|
60
61
|
background-color: var(--bds-color_bg--subtle);
|
|
61
62
|
color: var(--numberInput_color, var(--bds-color_on-bg));
|
|
62
63
|
cursor: pointer;
|
|
@@ -67,6 +68,17 @@
|
|
|
67
68
|
.stepper svg {
|
|
68
69
|
width: 1rem;
|
|
69
70
|
height: 1rem;
|
|
71
|
+
color: var(--numberInput_stepper-color, var(--bds-color_interactive));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.stepper:first-child {
|
|
75
|
+
border-start-start-radius: var(--_radius);
|
|
76
|
+
border-end-start-radius: var(--_radius);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.stepper:last-child {
|
|
80
|
+
border-start-end-radius: var(--_radius);
|
|
81
|
+
border-end-end-radius: var(--_radius);
|
|
70
82
|
}
|
|
71
83
|
|
|
72
84
|
.stepper:disabled {
|
|
@@ -36,10 +36,8 @@
|
|
|
36
36
|
--bdc_color: currentcolor;
|
|
37
37
|
--bdc-outline_radius: 50%;
|
|
38
38
|
|
|
39
|
-
outline: var(--bdc-outline_width) solid var(--bdc_color);
|
|
40
|
-
outline-offset: var(--bdc-outline_offset);
|
|
41
39
|
border-radius: var(--radio_radius, var(--bdc-outline_radius));
|
|
42
|
-
box-shadow: var(--radio_shadow, var(--bdc-outline_shadow));
|
|
40
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color), var(--radio_shadow, var(--bdc-outline_shadow));
|
|
43
41
|
appearance: none;
|
|
44
42
|
background-color: var(--radio_color_bg, var(--bds-color_bg));
|
|
45
43
|
cursor: pointer;
|
|
@@ -48,22 +46,14 @@
|
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
.radio:checked {
|
|
51
|
-
background
|
|
49
|
+
background: radial-gradient(
|
|
50
|
+
circle,
|
|
51
|
+
var(--radio_color-active, var(--bdc-color_active)) 35%,
|
|
52
|
+
var(--radio_color_bg, var(--bds-color_bg)) 42%
|
|
53
|
+
);
|
|
52
54
|
--bdc_color: var(--radio_color-active, var(--bdc-color_active));
|
|
53
55
|
}
|
|
54
56
|
|
|
55
|
-
.radio:checked::after {
|
|
56
|
-
content: '';
|
|
57
|
-
position: absolute;
|
|
58
|
-
inset-inline-start: 50%;
|
|
59
|
-
inset-block-start: 50%;
|
|
60
|
-
transform: translate(-50%, -50%);
|
|
61
|
-
inline-size: 0.4em;
|
|
62
|
-
block-size: 0.4em;
|
|
63
|
-
border-radius: 50%;
|
|
64
|
-
background-color: var(--radio_color-on-active, var(--bdc-color_on-active));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
57
|
.radio:focus {
|
|
68
58
|
--bdc_color: var(--bdc_color--focus);
|
|
69
59
|
}
|
|
@@ -5,60 +5,105 @@ import * as Stories from './SegmentedControl.stories';
|
|
|
5
5
|
|
|
6
6
|
# SegmentedControl
|
|
7
7
|
|
|
8
|
-
Single-select control where all options
|
|
8
|
+
Single-select control where all options share a track and a sliding indicator highlights the active choice. Children can be any interactive element — buttons, links, or framework router components.
|
|
9
9
|
|
|
10
|
-
All
|
|
10
|
+
All items have **equal width** (CSS grid `1fr` columns). In the `large` size, labels may wrap.
|
|
11
11
|
|
|
12
12
|
## When to use
|
|
13
13
|
- Switching between a small set of mutually exclusive views or modes (2–5 options)
|
|
14
|
-
-
|
|
14
|
+
- Navigation between sections where all options should be visible simultaneously
|
|
15
|
+
- When you need links (`<a>`, Next.js `<Link>`) instead of radio buttons
|
|
15
16
|
|
|
16
17
|
## When not to use
|
|
17
18
|
- More than 5 options — use `Select` or `Tabs`
|
|
18
19
|
- Independent toggles — use `Switch` or `Checkbox`
|
|
19
20
|
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
Pass any interactive elements as children. The component injects `.item`, `.--active`, and `.--disabled` CSS classes via `cloneElement` — your existing `className` is preserved.
|
|
24
|
+
|
|
25
|
+
### With buttons (explicit `selectedIndex`)
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
const [tab, setTab] = useState(1);
|
|
29
|
+
|
|
30
|
+
<SegmentedControl selectedIndex={tab}>
|
|
31
|
+
<button onClick={() => setTab(0)}>Day</button>
|
|
32
|
+
<button onClick={() => setTab(1)}>Week</button>
|
|
33
|
+
<button onClick={() => setTab(2)}>Month</button>
|
|
34
|
+
</SegmentedControl>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### With buttons (`aria-pressed` auto-detection)
|
|
38
|
+
|
|
39
|
+
When `selectedIndex` is omitted, the component auto-detects the active item from the first child that has `aria-current="page"`, `aria-pressed={true}`, or `aria-selected={true}`.
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
<SegmentedControl>
|
|
43
|
+
<button onClick={() => setTab('day')} aria-pressed={tab === 'day'}>Day</button>
|
|
44
|
+
<button onClick={() => setTab('week')} aria-pressed={tab === 'week'}>Week</button>
|
|
45
|
+
<button onClick={() => setTab('month')} aria-pressed={tab === 'month'}>Month</button>
|
|
46
|
+
</SegmentedControl>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### With links (`aria-current` auto-detection)
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
<SegmentedControl>
|
|
53
|
+
<a href="/overview" aria-current={path === '/overview' ? 'page' : undefined}>Overview</a>
|
|
54
|
+
<a href="/usage" aria-current={path === '/usage' ? 'page' : undefined}>Usage</a>
|
|
55
|
+
<a href="/api" aria-current={path === '/api' ? 'page' : undefined}>API</a>
|
|
56
|
+
</SegmentedControl>
|
|
57
|
+
```
|
|
58
|
+
|
|
20
59
|
## Examples
|
|
21
60
|
|
|
22
|
-
### Default
|
|
61
|
+
### Default (outline variant)
|
|
23
62
|
<Canvas of={Stories.Default} />
|
|
24
63
|
|
|
64
|
+
### Filled variant
|
|
65
|
+
<Canvas of={Stories.Filled} />
|
|
66
|
+
|
|
67
|
+
### With links
|
|
68
|
+
<Canvas of={Stories.WithLinks} />
|
|
69
|
+
|
|
25
70
|
### Small
|
|
26
71
|
<Canvas of={Stories.Small} />
|
|
27
72
|
|
|
28
73
|
### Large (wrapping labels)
|
|
29
74
|
<Canvas of={Stories.WrappingLabels} />
|
|
30
75
|
|
|
31
|
-
### With disabled option
|
|
32
|
-
<Canvas of={Stories.WithDisabledOption} />
|
|
33
|
-
|
|
34
76
|
### All disabled
|
|
35
77
|
<Canvas of={Stories.AllDisabled} />
|
|
36
78
|
|
|
37
|
-
###
|
|
38
|
-
<Canvas of={Stories.
|
|
79
|
+
### With aria-pressed (auto-detection)
|
|
80
|
+
<Canvas of={Stories.WithAriaPressed} />
|
|
39
81
|
|
|
40
82
|
## Props
|
|
41
83
|
|
|
42
84
|
<ArgTypes of={Stories} />
|
|
43
85
|
|
|
86
|
+
## Variants
|
|
87
|
+
|
|
88
|
+
| Variant | Description |
|
|
89
|
+
|---------|-------------|
|
|
90
|
+
| `outline` (default) | Transparent track, inset-border indicator slides to the active item |
|
|
91
|
+
| `filled` | Coloured track, filled thumb slides behind the active item |
|
|
92
|
+
|
|
44
93
|
## CSS variables
|
|
45
94
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<tr><td>`--control_label-color`</td><td>`var(--bds-on-bg--subtle)`</td><td>Unselected label colour</td></tr>
|
|
54
|
-
<tr><td>`--control_label-color--active`</td><td>`var(--bds-on-bg)`</td><td>Selected label colour</td></tr>
|
|
55
|
-
<tr><td>`--control_label-color--hover`</td><td>`var(--bds-on-bg)`</td><td>Hovered (unselected) label colour</td></tr>
|
|
56
|
-
</tbody>
|
|
57
|
-
</table>
|
|
95
|
+
| Variable | Default | Description |
|
|
96
|
+
|----------|---------|-------------|
|
|
97
|
+
| `--control_track-bg` | `var(--bds-color_bg--subtle)` (filled) / `transparent` (outline) | Track background |
|
|
98
|
+
| `--control_thumb-bg` | `var(--bds-color_interactive)` | Filled thumb colour |
|
|
99
|
+
| `--control_label-color` | `var(--bds-color_on-bg--subtle)` | Inactive item text colour |
|
|
100
|
+
| `--control_label-color--active` | `var(--bds-color_on-interactive)` (filled) / `var(--bds-color_interactive)` (outline) | Active item text colour |
|
|
101
|
+
| `--control_label-color--hover` | `var(--bds-color_on-bg)` | Hovered inactive item text colour |
|
|
58
102
|
|
|
59
103
|
## Accessibility
|
|
60
104
|
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
105
|
+
- The container renders as `role="group"`. Provide `aria-label` when the context doesn't supply a visible label.
|
|
106
|
+
- Each child is responsible for its own semantics: buttons use `aria-pressed`, links use `aria-current="page"`.
|
|
107
|
+
- The sliding thumb and indicator are `aria-hidden` — they are purely decorative.
|
|
108
|
+
- The active item is communicated via the child's own ARIA attribute, not via the container.
|
|
109
|
+
- Respects `prefers-reduced-motion` — the sliding animation is disabled when the user has opted out.
|