@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
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import {
|
|
2
|
+
A,
|
|
3
|
+
T,
|
|
4
|
+
i,
|
|
5
|
+
i2
|
|
6
|
+
} from "./chunk-LGEZYFUU.js";
|
|
7
|
+
|
|
8
|
+
// src/web-components/ui/bds-progress-circle.ts
|
|
9
|
+
var SIZE_PX = { small: 40, medium: 64, large: 96 };
|
|
10
|
+
var STROKE_WIDTH = 4;
|
|
11
|
+
var BdsProgressCircle = class extends i2 {
|
|
12
|
+
static styles = i`
|
|
13
|
+
:host {
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
position: relative;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.svg {
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.track {
|
|
25
|
+
stroke: var(--bds-color_bg--subtle);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.fill {
|
|
29
|
+
stroke: var(--progressCircle_color-active, var(--bdc-color_active));
|
|
30
|
+
transition: stroke-dashoffset var(--bds-animation_transition-duration) var(--bds-animation_easing);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.value {
|
|
34
|
+
position: absolute;
|
|
35
|
+
font-size: var(--bds-font_size--body--s);
|
|
36
|
+
font-weight: var(--bds-font_weight--semibold);
|
|
37
|
+
font-variant-numeric: tabular-nums;
|
|
38
|
+
color: var(--bds-color_on-bg);
|
|
39
|
+
line-height: 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host([size='small']) .value { font-size: 0.5rem; }
|
|
43
|
+
:host([size='large']) .value { font-size: var(--bds-font_size--body); }
|
|
44
|
+
|
|
45
|
+
@media (prefers-reduced-motion: reduce) {
|
|
46
|
+
.fill {
|
|
47
|
+
transition: none;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
static properties = {
|
|
52
|
+
value: { type: Number },
|
|
53
|
+
max: { type: Number },
|
|
54
|
+
label: { type: String },
|
|
55
|
+
showValue: { type: Boolean, attribute: "show-value", reflect: true },
|
|
56
|
+
size: { type: String, reflect: true }
|
|
57
|
+
};
|
|
58
|
+
constructor() {
|
|
59
|
+
super();
|
|
60
|
+
this.value = 0;
|
|
61
|
+
this.max = 100;
|
|
62
|
+
this.label = "";
|
|
63
|
+
this.showValue = false;
|
|
64
|
+
this.size = "medium";
|
|
65
|
+
}
|
|
66
|
+
render() {
|
|
67
|
+
const percentage = Math.min(100, Math.max(0, this.value / this.max * 100));
|
|
68
|
+
const px = SIZE_PX[this.size] ?? SIZE_PX.medium;
|
|
69
|
+
const radius = (px - STROKE_WIDTH * 2) / 2;
|
|
70
|
+
const circumference = 2 * Math.PI * radius;
|
|
71
|
+
const offset = circumference - percentage / 100 * circumference;
|
|
72
|
+
const cx = px / 2;
|
|
73
|
+
return T`
|
|
74
|
+
<div
|
|
75
|
+
role="progressbar"
|
|
76
|
+
aria-label=${this.label}
|
|
77
|
+
aria-valuenow=${this.value}
|
|
78
|
+
aria-valuemin="0"
|
|
79
|
+
aria-valuemax=${this.max}
|
|
80
|
+
style="position: relative; display: inline-flex; align-items: center; justify-content: center;"
|
|
81
|
+
>
|
|
82
|
+
<svg
|
|
83
|
+
class="svg"
|
|
84
|
+
width=${px}
|
|
85
|
+
height=${px}
|
|
86
|
+
viewBox="0 0 ${px} ${px}"
|
|
87
|
+
aria-hidden="true"
|
|
88
|
+
>
|
|
89
|
+
<circle
|
|
90
|
+
class="track"
|
|
91
|
+
cx=${cx}
|
|
92
|
+
cy=${cx}
|
|
93
|
+
r=${radius}
|
|
94
|
+
stroke-width=${STROKE_WIDTH}
|
|
95
|
+
fill="none"
|
|
96
|
+
/>
|
|
97
|
+
<circle
|
|
98
|
+
class="fill"
|
|
99
|
+
cx=${cx}
|
|
100
|
+
cy=${cx}
|
|
101
|
+
r=${radius}
|
|
102
|
+
stroke-width=${STROKE_WIDTH}
|
|
103
|
+
fill="none"
|
|
104
|
+
stroke-dasharray=${circumference}
|
|
105
|
+
stroke-dashoffset=${offset}
|
|
106
|
+
stroke-linecap="round"
|
|
107
|
+
transform="rotate(-90 ${cx} ${cx})"
|
|
108
|
+
/>
|
|
109
|
+
</svg>
|
|
110
|
+
${this.showValue ? T`<span class="value" aria-hidden="true">${Math.round(percentage)}%</span>` : A}
|
|
111
|
+
</div>
|
|
112
|
+
`;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
customElements.define("bds-progress-circle", BdsProgressCircle);
|
|
116
|
+
|
|
117
|
+
export {
|
|
118
|
+
BdsProgressCircle
|
|
119
|
+
};
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import {
|
|
2
|
+
T,
|
|
3
|
+
i,
|
|
4
|
+
i2
|
|
5
|
+
} from "./chunk-LGEZYFUU.js";
|
|
6
|
+
|
|
7
|
+
// src/web-components/interaction/form/bds-combobox.ts
|
|
8
|
+
var BdsCombobox = class extends i2 {
|
|
9
|
+
static formAssociated = true;
|
|
10
|
+
static styles = i`
|
|
11
|
+
:host {
|
|
12
|
+
display: block;
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:host([disabled]) {
|
|
17
|
+
opacity: 0.5;
|
|
18
|
+
pointer-events: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.wrapper {
|
|
22
|
+
position: relative;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.input {
|
|
26
|
+
inline-size: 100%;
|
|
27
|
+
font-family: var(--bds-font_family--body);
|
|
28
|
+
font-size: var(--bds-font_size--body);
|
|
29
|
+
padding: var(--bds-space_s);
|
|
30
|
+
padding-inline-end: var(--bds-space_xl);
|
|
31
|
+
border: none;
|
|
32
|
+
--bdc_color: currentcolor;
|
|
33
|
+
--bdc-outline_radius: var(--bds-border_radius--xs);
|
|
34
|
+
|
|
35
|
+
border-radius: var(--combobox_radius, var(--bdc-outline_radius));
|
|
36
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color), var(--combobox_shadow, var(--bdc-outline_shadow));
|
|
37
|
+
background-color: var(--combobox_color_bg, var(--bds-color_bg));
|
|
38
|
+
color: var(--combobox_color, var(--bds-color_on-bg));
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
transition: --bdc_color var(--bds-animation_transition-duration) var(--bds-animation_easing);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.input:focus {
|
|
44
|
+
--bdc_color: var(--bdc_color--focus);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.input:focus-visible {
|
|
48
|
+
outline: var(--bds-outline_default);
|
|
49
|
+
outline-offset: var(--bds-outline_offset);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.chevron {
|
|
53
|
+
position: absolute;
|
|
54
|
+
inset-inline-end: var(--bds-space_s);
|
|
55
|
+
inset-block-start: 50%;
|
|
56
|
+
transform: translateY(-50%);
|
|
57
|
+
pointer-events: none;
|
|
58
|
+
inline-size: 1rem;
|
|
59
|
+
block-size: 1rem;
|
|
60
|
+
color: currentcolor;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.chevron svg {
|
|
64
|
+
inline-size: 100%;
|
|
65
|
+
block-size: 100%;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.listbox {
|
|
69
|
+
position: absolute;
|
|
70
|
+
inset-block-start: calc(100% + var(--bds-space_xs));
|
|
71
|
+
inset-inline-start: 0;
|
|
72
|
+
inline-size: 100%;
|
|
73
|
+
max-block-size: 15rem;
|
|
74
|
+
overflow-y: auto;
|
|
75
|
+
background-color: var(--combobox_list-bg, var(--bds-color_bg));
|
|
76
|
+
border-radius: var(--bds-border_radius--s);
|
|
77
|
+
box-shadow: var(--bds-shadow_m);
|
|
78
|
+
z-index: var(--combobox_z-index, 100);
|
|
79
|
+
padding-block: var(--bds-space_xs);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.option {
|
|
83
|
+
display: block;
|
|
84
|
+
padding: var(--bds-space_s) var(--bds-space_m);
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
font-family: var(--bds-font_family--body);
|
|
87
|
+
font-size: var(--bds-font_size--body);
|
|
88
|
+
color: var(--bds-color_on-bg);
|
|
89
|
+
transition: background-color var(--bds-animation_transition-duration) var(--bds-animation_easing);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.option:hover,
|
|
93
|
+
.option[aria-selected='true'] {
|
|
94
|
+
background-color: var(--bds-color_bg--subtle);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.option[aria-disabled='true'] {
|
|
98
|
+
opacity: 0.4;
|
|
99
|
+
cursor: not-allowed;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.option.--focused {
|
|
103
|
+
background-color: var(--bds-color_bg--subtle);
|
|
104
|
+
outline: none;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.no-results {
|
|
108
|
+
padding: var(--bds-space_s) var(--bds-space_m);
|
|
109
|
+
font-family: var(--bds-font_family--body);
|
|
110
|
+
font-size: var(--bds-font_size--body--s);
|
|
111
|
+
color: var(--bds-color_on-bg--subtle);
|
|
112
|
+
}
|
|
113
|
+
`;
|
|
114
|
+
static properties = {
|
|
115
|
+
name: { type: String, reflect: true },
|
|
116
|
+
value: { type: String },
|
|
117
|
+
options: { type: String },
|
|
118
|
+
placeholder: { type: String },
|
|
119
|
+
disabled: { type: Boolean, reflect: true }
|
|
120
|
+
};
|
|
121
|
+
_internals;
|
|
122
|
+
_open = false;
|
|
123
|
+
_query = "";
|
|
124
|
+
_focusedIndex = -1;
|
|
125
|
+
constructor() {
|
|
126
|
+
super();
|
|
127
|
+
this._internals = this.attachInternals();
|
|
128
|
+
this.name = "";
|
|
129
|
+
this.value = "";
|
|
130
|
+
this.options = "[]";
|
|
131
|
+
this.placeholder = "";
|
|
132
|
+
this.disabled = false;
|
|
133
|
+
}
|
|
134
|
+
get _options() {
|
|
135
|
+
try {
|
|
136
|
+
return JSON.parse(this.options);
|
|
137
|
+
} catch {
|
|
138
|
+
return [];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
get _filtered() {
|
|
142
|
+
const q = this._query.toLowerCase();
|
|
143
|
+
return q ? this._options.filter((o) => o.label.toLowerCase().includes(q)) : this._options;
|
|
144
|
+
}
|
|
145
|
+
get _displayLabel() {
|
|
146
|
+
if (this.value) {
|
|
147
|
+
return this._options.find((o) => o.value === this.value)?.label ?? "";
|
|
148
|
+
}
|
|
149
|
+
return "";
|
|
150
|
+
}
|
|
151
|
+
updated(changed) {
|
|
152
|
+
super.updated(changed);
|
|
153
|
+
if (changed.has("value")) {
|
|
154
|
+
this._internals.setFormValue?.(this.value || null);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
formResetCallback() {
|
|
158
|
+
this.value = "";
|
|
159
|
+
this._query = "";
|
|
160
|
+
this._open = false;
|
|
161
|
+
this._internals.setFormValue?.(null);
|
|
162
|
+
this.requestUpdate();
|
|
163
|
+
}
|
|
164
|
+
_openList() {
|
|
165
|
+
this._open = true;
|
|
166
|
+
this._focusedIndex = this._filtered.findIndex((o) => o.value === this.value);
|
|
167
|
+
this.requestUpdate();
|
|
168
|
+
}
|
|
169
|
+
_closeList() {
|
|
170
|
+
this._open = false;
|
|
171
|
+
this._query = "";
|
|
172
|
+
this._focusedIndex = -1;
|
|
173
|
+
this.requestUpdate();
|
|
174
|
+
}
|
|
175
|
+
_selectOption(opt) {
|
|
176
|
+
if (opt.disabled) return;
|
|
177
|
+
this.value = opt.value;
|
|
178
|
+
this._closeList();
|
|
179
|
+
this.dispatchEvent(new CustomEvent("bds-change", {
|
|
180
|
+
bubbles: true,
|
|
181
|
+
composed: true,
|
|
182
|
+
detail: { value: opt.value, label: opt.label }
|
|
183
|
+
}));
|
|
184
|
+
}
|
|
185
|
+
_handleInput(e) {
|
|
186
|
+
this._query = e.target.value;
|
|
187
|
+
this._open = true;
|
|
188
|
+
this._focusedIndex = -1;
|
|
189
|
+
this.requestUpdate();
|
|
190
|
+
}
|
|
191
|
+
_handleFocus() {
|
|
192
|
+
this._openList();
|
|
193
|
+
}
|
|
194
|
+
_handleBlur() {
|
|
195
|
+
setTimeout(() => {
|
|
196
|
+
this._closeList();
|
|
197
|
+
}, 150);
|
|
198
|
+
}
|
|
199
|
+
_handleKeydown(e) {
|
|
200
|
+
const filtered = this._filtered;
|
|
201
|
+
if (!this._open) {
|
|
202
|
+
if (e.key === "ArrowDown" || e.key === "Enter") {
|
|
203
|
+
e.preventDefault();
|
|
204
|
+
this._openList();
|
|
205
|
+
}
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
if (e.key === "ArrowDown") {
|
|
209
|
+
e.preventDefault();
|
|
210
|
+
let next = this._focusedIndex + 1;
|
|
211
|
+
while (next < filtered.length && filtered[next].disabled) next++;
|
|
212
|
+
if (next < filtered.length) this._focusedIndex = next;
|
|
213
|
+
} else if (e.key === "ArrowUp") {
|
|
214
|
+
e.preventDefault();
|
|
215
|
+
let prev = this._focusedIndex - 1;
|
|
216
|
+
while (prev >= 0 && filtered[prev].disabled) prev--;
|
|
217
|
+
if (prev >= 0) this._focusedIndex = prev;
|
|
218
|
+
} else if (e.key === "Enter") {
|
|
219
|
+
e.preventDefault();
|
|
220
|
+
if (this._focusedIndex >= 0 && this._focusedIndex < filtered.length) {
|
|
221
|
+
this._selectOption(filtered[this._focusedIndex]);
|
|
222
|
+
}
|
|
223
|
+
} else if (e.key === "Escape") {
|
|
224
|
+
e.preventDefault();
|
|
225
|
+
this._closeList();
|
|
226
|
+
}
|
|
227
|
+
this.requestUpdate();
|
|
228
|
+
}
|
|
229
|
+
render() {
|
|
230
|
+
const filtered = this._filtered;
|
|
231
|
+
const inputValue = this._open ? this._query : this._displayLabel;
|
|
232
|
+
return T`
|
|
233
|
+
<div class="wrapper">
|
|
234
|
+
<input
|
|
235
|
+
type="text"
|
|
236
|
+
class="input"
|
|
237
|
+
role="combobox"
|
|
238
|
+
aria-expanded=${this._open}
|
|
239
|
+
aria-autocomplete="list"
|
|
240
|
+
aria-haspopup="listbox"
|
|
241
|
+
name=${this.name}
|
|
242
|
+
placeholder=${this.placeholder}
|
|
243
|
+
.value=${inputValue}
|
|
244
|
+
?disabled=${this.disabled}
|
|
245
|
+
@input=${this._handleInput}
|
|
246
|
+
@focus=${this._handleFocus}
|
|
247
|
+
@blur=${this._handleBlur}
|
|
248
|
+
@keydown=${this._handleKeydown}
|
|
249
|
+
/>
|
|
250
|
+
<span class="chevron" aria-hidden="true">
|
|
251
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
252
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M6 9l6 6 6-6" />
|
|
253
|
+
</svg>
|
|
254
|
+
</span>
|
|
255
|
+
${this._open ? T`
|
|
256
|
+
<ul class="listbox" role="listbox" aria-label="Options">
|
|
257
|
+
${filtered.length === 0 ? T`<li class="no-results">No results</li>` : filtered.map((opt, i3) => T`
|
|
258
|
+
<li
|
|
259
|
+
class="option ${i3 === this._focusedIndex ? "--focused" : ""}"
|
|
260
|
+
role="option"
|
|
261
|
+
aria-selected=${opt.value === this.value}
|
|
262
|
+
aria-disabled=${opt.disabled ?? false}
|
|
263
|
+
@mousedown=${(e) => {
|
|
264
|
+
e.preventDefault();
|
|
265
|
+
this._selectOption(opt);
|
|
266
|
+
}}
|
|
267
|
+
>${opt.label}</li>
|
|
268
|
+
`)}
|
|
269
|
+
</ul>
|
|
270
|
+
` : ""}
|
|
271
|
+
</div>
|
|
272
|
+
`;
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
customElements.define("bds-combobox", BdsCombobox);
|
|
276
|
+
|
|
277
|
+
export {
|
|
278
|
+
BdsCombobox
|
|
279
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
T,
|
|
3
|
+
b,
|
|
4
|
+
w
|
|
5
|
+
} from "./chunk-LGEZYFUU.js";
|
|
6
|
+
|
|
7
|
+
// node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/node/static.js
|
|
8
|
+
var a = /* @__PURE__ */ Symbol.for("");
|
|
9
|
+
var o = (t) => {
|
|
10
|
+
if (t?.r === a) return t?._$litStatic$;
|
|
11
|
+
};
|
|
12
|
+
var s = (t) => ({ _$litStatic$: t, r: a });
|
|
13
|
+
var l = /* @__PURE__ */ new Map();
|
|
14
|
+
var n = (t) => (r, ...e) => {
|
|
15
|
+
const a2 = e.length;
|
|
16
|
+
let s2, i;
|
|
17
|
+
const n2 = [], u2 = [];
|
|
18
|
+
let c2, $2 = 0, f = false;
|
|
19
|
+
for (; $2 < a2; ) {
|
|
20
|
+
for (c2 = r[$2]; $2 < a2 && void 0 !== (i = e[$2], s2 = o(i)); ) c2 += s2 + r[++$2], f = true;
|
|
21
|
+
$2 !== a2 && u2.push(i), n2.push(c2), $2++;
|
|
22
|
+
}
|
|
23
|
+
if ($2 === a2 && n2.push(r[a2]), f) {
|
|
24
|
+
const t2 = n2.join("$$lit$$");
|
|
25
|
+
void 0 === (r = l.get(t2)) && (n2.raw = n2, l.set(t2, r = n2)), e = u2;
|
|
26
|
+
}
|
|
27
|
+
return t(r, ...e);
|
|
28
|
+
};
|
|
29
|
+
var u = n(T);
|
|
30
|
+
var c = n(b);
|
|
31
|
+
var $ = n(w);
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
s,
|
|
35
|
+
u
|
|
36
|
+
};
|
|
37
|
+
/*! Bundled license information:
|
|
38
|
+
|
|
39
|
+
lit-html/node/static.js:
|
|
40
|
+
(**
|
|
41
|
+
* @license
|
|
42
|
+
* Copyright 2020 Google LLC
|
|
43
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
44
|
+
*)
|
|
45
|
+
*/
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import {
|
|
2
|
+
s,
|
|
3
|
+
u
|
|
4
|
+
} from "./chunk-QPOKHLMQ.js";
|
|
5
|
+
import {
|
|
6
|
+
i,
|
|
7
|
+
i2
|
|
8
|
+
} from "./chunk-LGEZYFUU.js";
|
|
9
|
+
|
|
10
|
+
// src/web-components/ui/bds-typography.ts
|
|
11
|
+
var VARIANT_TAG = {
|
|
12
|
+
h1: "h1",
|
|
13
|
+
h2: "h2",
|
|
14
|
+
h3: "h3",
|
|
15
|
+
body: "p",
|
|
16
|
+
body_s: "p"
|
|
17
|
+
};
|
|
18
|
+
var BdsTypography = class extends i2 {
|
|
19
|
+
static styles = i`
|
|
20
|
+
:host {
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.typography {
|
|
25
|
+
margin: 0;
|
|
26
|
+
font-family: var(--bds-font_family--body);
|
|
27
|
+
color: var(--typography_color, var(--bds-color_on-bg));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.typography.--h1 {
|
|
31
|
+
font-family: var(--bds-font_family--heading);
|
|
32
|
+
font-size: var(--bds-font_size--heading-1);
|
|
33
|
+
font-weight: var(--bds-font_weight--bold);
|
|
34
|
+
line-height: var(--bds-font_line-height--heading);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.typography.--h2 {
|
|
38
|
+
font-family: var(--bds-font_family--heading);
|
|
39
|
+
font-size: var(--bds-font_size--heading-2);
|
|
40
|
+
font-weight: var(--bds-font_weight--semibold);
|
|
41
|
+
line-height: var(--bds-font_line-height--heading);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.typography.--h3 {
|
|
45
|
+
font-family: var(--bds-font_family--heading);
|
|
46
|
+
font-size: var(--bds-font_size--heading-3);
|
|
47
|
+
font-weight: var(--bds-font_weight--semibold);
|
|
48
|
+
line-height: var(--bds-font_line-height--heading);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.typography.--body {
|
|
52
|
+
font-size: var(--bds-font_size--body);
|
|
53
|
+
line-height: var(--bds-font_line-height--body);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.typography.--body_s {
|
|
57
|
+
font-size: var(--bds-font_size--body--s);
|
|
58
|
+
line-height: var(--bds-font_line-height--body);
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
static properties = {
|
|
62
|
+
variant: { type: String, reflect: true },
|
|
63
|
+
component: { type: String }
|
|
64
|
+
};
|
|
65
|
+
constructor() {
|
|
66
|
+
super();
|
|
67
|
+
this.variant = "body";
|
|
68
|
+
this.component = "";
|
|
69
|
+
}
|
|
70
|
+
get _tag() {
|
|
71
|
+
if (this.component) return this.component;
|
|
72
|
+
return VARIANT_TAG[this.variant] ?? "p";
|
|
73
|
+
}
|
|
74
|
+
render() {
|
|
75
|
+
const tag = s(this._tag);
|
|
76
|
+
const variant = s(this.variant);
|
|
77
|
+
return u`
|
|
78
|
+
<${tag} class="typography --${variant}">
|
|
79
|
+
<slot></slot>
|
|
80
|
+
</${tag}>
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
customElements.define("bds-typography", BdsTypography);
|
|
85
|
+
|
|
86
|
+
export {
|
|
87
|
+
BdsTypography
|
|
88
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import {
|
|
2
|
+
T,
|
|
3
|
+
i,
|
|
4
|
+
i2
|
|
5
|
+
} from "./chunk-LGEZYFUU.js";
|
|
6
|
+
|
|
7
|
+
// src/web-components/interaction/form/bds-checkbox.ts
|
|
8
|
+
var BdsCheckbox = class extends i2 {
|
|
9
|
+
static formAssociated = true;
|
|
10
|
+
static styles = i`
|
|
11
|
+
:host {
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
align-items: flex-start;
|
|
14
|
+
gap: var(--bds-space_xs);
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
font-size: var(--bds-font_size--body);
|
|
17
|
+
font-family: var(--bds-font_family--body);
|
|
18
|
+
color: var(--bds-color_on-bg);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:host([disabled]) {
|
|
22
|
+
opacity: 0.5;
|
|
23
|
+
cursor: not-allowed;
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.input {
|
|
28
|
+
--inputSize: calc(var(--bds-space_s) * 2);
|
|
29
|
+
margin-block-start: 0.25em;
|
|
30
|
+
inline-size: var(--inputSize);
|
|
31
|
+
block-size: var(--inputSize);
|
|
32
|
+
flex-shrink: 0;
|
|
33
|
+
--bdc_color: currentcolor;
|
|
34
|
+
--bdc-outline_radius: var(--bds-border_radius--xs);
|
|
35
|
+
|
|
36
|
+
border-radius: var(--checkbox_radius, var(--bdc-outline_radius));
|
|
37
|
+
box-shadow: inset 0 0 0 var(--bdc-outline_width) var(--bdc_color), var(--checkbox_shadow, var(--bdc-outline_shadow));
|
|
38
|
+
border: none;
|
|
39
|
+
appearance: none;
|
|
40
|
+
background-color: var(--checkbox_color_bg, var(--bds-color_bg));
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
position: relative;
|
|
43
|
+
transition: --bdc_color 0.3s ease, background-color 0.3s ease;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.input:checked {
|
|
47
|
+
background-color: var(--checkbox_color-active, var(--bdc-color_active));
|
|
48
|
+
--bdc_color: var(--checkbox_color-active, var(--bdc-color_active));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.input:checked::after {
|
|
52
|
+
content: '';
|
|
53
|
+
position: absolute;
|
|
54
|
+
inset-inline-start: 0.6em;
|
|
55
|
+
inset-block-start: 0.2em;
|
|
56
|
+
inline-size: 0.5em;
|
|
57
|
+
block-size: 1em;
|
|
58
|
+
border: solid var(--checkbox_color-on-active, var(--bdc-color_on-active));
|
|
59
|
+
border-width: 0 2px 2px 0;
|
|
60
|
+
transform: rotate(45deg);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.input:focus-visible {
|
|
64
|
+
outline: var(--bds-outline_default);
|
|
65
|
+
outline-offset: var(--bds-outline_offset);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
label {
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
flex: 1;
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
static properties = {
|
|
74
|
+
name: { type: String, reflect: true },
|
|
75
|
+
value: { type: String },
|
|
76
|
+
checked: { type: Boolean, reflect: true },
|
|
77
|
+
required: { type: Boolean, reflect: true },
|
|
78
|
+
disabled: { type: Boolean, reflect: true }
|
|
79
|
+
};
|
|
80
|
+
_internals;
|
|
81
|
+
_uid = Math.random().toString(36).slice(2, 8);
|
|
82
|
+
constructor() {
|
|
83
|
+
super();
|
|
84
|
+
this._internals = this.attachInternals();
|
|
85
|
+
this.name = "";
|
|
86
|
+
this.value = "on";
|
|
87
|
+
this.checked = false;
|
|
88
|
+
this.required = false;
|
|
89
|
+
this.disabled = false;
|
|
90
|
+
}
|
|
91
|
+
updated(changed) {
|
|
92
|
+
super.updated(changed);
|
|
93
|
+
if (changed.has("checked") || changed.has("value")) {
|
|
94
|
+
this._internals.setFormValue?.(this.checked ? this.value : null);
|
|
95
|
+
}
|
|
96
|
+
if (changed.has("required")) {
|
|
97
|
+
if (this.required && !this.checked) {
|
|
98
|
+
this._internals.setValidity?.({ valueMissing: true }, "Required");
|
|
99
|
+
} else {
|
|
100
|
+
this._internals.setValidity?.({});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
formResetCallback() {
|
|
105
|
+
this.checked = false;
|
|
106
|
+
this._internals.setFormValue?.(null);
|
|
107
|
+
}
|
|
108
|
+
_handleChange(e) {
|
|
109
|
+
this.checked = e.target.checked;
|
|
110
|
+
}
|
|
111
|
+
render() {
|
|
112
|
+
const id = `bds-checkbox-${this._uid}`;
|
|
113
|
+
return T`
|
|
114
|
+
<input
|
|
115
|
+
id=${id}
|
|
116
|
+
type="checkbox"
|
|
117
|
+
class="input"
|
|
118
|
+
.checked=${this.checked}
|
|
119
|
+
?required=${this.required}
|
|
120
|
+
?disabled=${this.disabled}
|
|
121
|
+
@change=${this._handleChange}
|
|
122
|
+
/>
|
|
123
|
+
<label for=${id}><slot></slot></label>
|
|
124
|
+
`;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
customElements.define("bds-checkbox", BdsCheckbox);
|
|
128
|
+
|
|
129
|
+
export {
|
|
130
|
+
BdsCheckbox
|
|
131
|
+
};
|