@telesign/boreal-web-components 0.1.0-alpha.5 → 0.1.0-alpha.6
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/components-build/bds-avatar.js +1 -1
- package/components-build/bds-breadcrumb-item.d.ts +11 -0
- package/components-build/bds-breadcrumb-item.js +1 -0
- package/components-build/bds-breadcrumb.d.ts +11 -0
- package/components-build/bds-breadcrumb.js +1 -0
- package/components-build/bds-button-group.js +1 -1
- package/components-build/bds-button.js +1 -1
- package/components-build/bds-checkbox-button.d.ts +11 -0
- package/components-build/bds-checkbox-button.js +1 -0
- package/components-build/bds-checkbox-card.js +1 -1
- package/components-build/bds-checkbox-group.d.ts +11 -0
- package/components-build/bds-checkbox-group.js +1 -0
- package/components-build/bds-checkbox.js +1 -1
- package/components-build/bds-dialog.js +1 -1
- package/components-build/bds-divider.js +1 -1
- package/components-build/bds-flag.js +1 -1
- package/components-build/bds-grid-item.js +1 -1
- package/components-build/bds-grid.js +1 -1
- package/components-build/bds-list-menu-item.js +1 -1
- package/components-build/bds-list-menu.js +1 -1
- package/components-build/bds-popover.js +1 -1
- package/components-build/bds-radio-button.js +1 -1
- package/components-build/bds-radio-card.js +1 -1
- package/components-build/bds-radio-group.js +1 -1
- package/components-build/bds-radio.js +1 -1
- package/components-build/bds-select.d.ts +11 -0
- package/components-build/bds-select.js +1 -0
- package/components-build/bds-slider.d.ts +11 -0
- package/components-build/bds-slider.js +1 -0
- package/components-build/bds-tag.js +1 -1
- package/components-build/bds-text-field.js +1 -1
- package/components-build/bds-toggle.js +1 -1
- package/components-build/bds-tooltip.js +1 -1
- package/components-build/bds-typography.js +1 -1
- package/components-build/p-B6e9eIHB.js +1 -0
- package/components-build/p-CJBdGD_4.js +1 -0
- package/components-build/p-DcR7mHFE.js +1 -0
- package/components-build/p-DdOPD9wW.js +1 -0
- package/components-build/{p-BSlaf0ff.js → p-DoNZM78n.js} +1 -1
- package/components-build/p-DrkDx75U.js +1 -0
- package/components-build/p-DuBzr05c.js +1 -0
- package/components-build/p-PmjPRW8X.js +1 -0
- package/components-build/p-cgdh1LO-.js +1 -0
- package/components-build/p-yLNcMg2E.js +1 -0
- package/custom-elements.json +2723 -841
- package/dist/boreal-web-components/boreal-web-components.esm.js +1 -1
- package/dist/boreal-web-components/css/boreal.css +60 -0
- package/dist/boreal-web-components/css/theme-connect.css +15 -0
- package/dist/boreal-web-components/css/theme-engage.css +15 -0
- package/dist/boreal-web-components/css/theme-protect.css +15 -0
- package/dist/boreal-web-components/css/theme-proximus.css +15 -0
- package/dist/boreal-web-components/{p-7bb88855.entry.js → p-02e53626.entry.js} +1 -1
- package/dist/boreal-web-components/p-0357450d.system.entry.js +1 -0
- package/dist/boreal-web-components/{p-efe159aa.entry.js → p-1250ba53.entry.js} +1 -1
- package/dist/boreal-web-components/p-1911b978.entry.js +1 -0
- package/dist/boreal-web-components/p-1mOd23lT.system.js +1 -0
- package/dist/boreal-web-components/{p-48ebbfbe.system.entry.js → p-25823f7d.system.entry.js} +1 -1
- package/dist/boreal-web-components/p-2db71382.system.entry.js +1 -0
- package/dist/boreal-web-components/p-367e40f9.entry.js +1 -0
- package/dist/boreal-web-components/p-3946d587.entry.js +1 -0
- package/dist/boreal-web-components/{p-4dc01078.system.entry.js → p-44b6fe6c.system.entry.js} +1 -1
- package/dist/boreal-web-components/{p-024d90b0.system.entry.js → p-48712a63.system.entry.js} +1 -1
- package/dist/boreal-web-components/{p-2adf2cd5.entry.js → p-49ea207a.entry.js} +1 -1
- package/dist/boreal-web-components/{p-7aff4c78.entry.js → p-4b028406.entry.js} +1 -1
- package/dist/boreal-web-components/p-4b615de8.system.entry.js +1 -0
- package/dist/boreal-web-components/{p-e0a41cab.system.entry.js → p-4f431941.system.entry.js} +1 -1
- package/dist/boreal-web-components/p-524421f7.system.entry.js +1 -0
- package/dist/boreal-web-components/p-530c8c7f.entry.js +1 -0
- package/dist/boreal-web-components/p-55aeff0c.system.entry.js +1 -0
- package/dist/boreal-web-components/p-5c8650b3.system.entry.js +1 -0
- package/dist/boreal-web-components/p-5e590291.system.entry.js +1 -0
- package/dist/boreal-web-components/p-5ee0841f.entry.js +1 -0
- package/dist/boreal-web-components/{p-93066db4.system.entry.js → p-65923619.system.entry.js} +1 -1
- package/dist/boreal-web-components/p-66ec16d9.entry.js +1 -0
- package/dist/boreal-web-components/{p-e55f2a8b.entry.js → p-714bf70d.entry.js} +1 -1
- package/dist/boreal-web-components/p-7626338e.system.entry.js +1 -0
- package/dist/boreal-web-components/p-7G4h4DI7.js +1 -0
- package/dist/boreal-web-components/p-800fc096.system.entry.js +1 -0
- package/dist/boreal-web-components/p-824485ad.entry.js +1 -0
- package/dist/boreal-web-components/p-8dfe3a9f.entry.js +1 -0
- package/dist/boreal-web-components/p-90022071.entry.js +1 -0
- package/dist/boreal-web-components/{p-7ebc67c9.entry.js → p-9d02057d.entry.js} +1 -1
- package/dist/boreal-web-components/{p-wREMI3WA.js → p-CcENtewr.js} +1 -1
- package/dist/boreal-web-components/p-Dk9dfU9-.system.js +1 -0
- package/dist/boreal-web-components/p-K7DvMlRo.system.js +1 -0
- package/dist/boreal-web-components/{p-DYlZcFrB.system.js → p-UEj9YHof.system.js} +1 -1
- package/dist/boreal-web-components/{p-147d6652.system.entry.js → p-b54fe67f.system.entry.js} +1 -1
- package/dist/boreal-web-components/p-bbcd3a30.system.entry.js +1 -0
- package/dist/boreal-web-components/p-bea25d3d.system.entry.js +1 -0
- package/dist/boreal-web-components/p-bed506d3.entry.js +1 -0
- package/dist/boreal-web-components/p-bfd62034.system.entry.js +1 -0
- package/dist/boreal-web-components/p-c07d6b82.system.entry.js +1 -0
- package/dist/boreal-web-components/{p-7d3a8f61.entry.js → p-cc5c359f.entry.js} +1 -1
- package/dist/boreal-web-components/p-cgdh1LO-.js +1 -0
- package/dist/boreal-web-components/p-d2b6ae79.entry.js +1 -0
- package/dist/boreal-web-components/p-e21b8416.entry.js +1 -0
- package/dist/boreal-web-components/p-e4364a44.system.entry.js +1 -0
- package/dist/boreal-web-components/p-e51407b2.system.entry.js +1 -0
- package/dist/boreal-web-components/p-e8cde179.system.entry.js +1 -0
- package/dist/boreal-web-components/p-eecc3028.system.entry.js +1 -0
- package/dist/boreal-web-components/p-f3bd824d.system.entry.js +1 -0
- package/dist/boreal-web-components/p-f6eabb16.entry.js +1 -0
- package/dist/boreal-web-components/p-f7acf6e5.system.entry.js +1 -0
- package/dist/boreal-web-components/{p-6629be14.entry.js → p-f9560509.entry.js} +1 -1
- package/dist/boreal-web-components/p-fa128cad.system.entry.js +1 -0
- package/dist/boreal-web-components/p-fab1a01d.entry.js +1 -0
- package/dist/boreal-web-components/p-fb9ba833.entry.js +1 -0
- package/dist/boreal-web-components/p-fbe0c9f2.entry.js +1 -0
- package/dist/boreal-web-components/p-fbe88555.entry.js +1 -0
- package/dist/boreal-web-components/p-fc1fa966.system.entry.js +1 -0
- package/dist/boreal-web-components/p-fc4ffa0e.entry.js +1 -0
- package/dist/boreal-web-components/p-fef13445.entry.js +1 -0
- package/dist/boreal-web-components/p-qGhMe8Hk.js +1 -0
- package/dist/boreal-web-components/p-vzZJGcYF.system.js +1 -1
- package/dist/boreal-web-components/scss/maps/_theme-connect.scss +16 -1
- package/dist/boreal-web-components/scss/maps/_theme-engage.scss +16 -1
- package/dist/boreal-web-components/scss/maps/_theme-protect.scss +16 -1
- package/dist/boreal-web-components/scss/maps/_theme-proximus.scss +16 -1
- package/dist/boreal-web-components/scss/variables/_theme-connect.scss +16 -1
- package/dist/boreal-web-components/scss/variables/_theme-engage.scss +16 -1
- package/dist/boreal-web-components/scss/variables/_theme-protect.scss +16 -1
- package/dist/boreal-web-components/scss/variables/_theme-proximus.scss +16 -1
- package/dist/cjs/KeyboardController-B_g3peyB.js +1067 -0
- package/dist/cjs/Keys-DXn16dlA.js +34 -0
- package/dist/cjs/bds-avatar.cjs.entry.js +1 -1
- package/dist/cjs/bds-breadcrumb-item.cjs.entry.js +106 -0
- package/dist/cjs/bds-breadcrumb.cjs.entry.js +127 -0
- package/dist/cjs/bds-button-group.cjs.entry.js +23 -2
- package/dist/cjs/bds-button.cjs.entry.js +33 -6
- package/dist/cjs/bds-checkbox-button.cjs.entry.js +119 -0
- package/dist/cjs/bds-checkbox-card.cjs.entry.js +37 -23
- package/dist/cjs/bds-checkbox-group.cjs.entry.js +292 -0
- package/dist/cjs/bds-checkbox.cjs.entry.js +62 -31
- package/dist/cjs/bds-dialog.cjs.entry.js +3 -3
- package/dist/cjs/bds-divider.cjs.entry.js +1 -1
- package/dist/cjs/bds-flag.cjs.entry.js +1 -1
- package/dist/cjs/bds-grid-item.cjs.entry.js +1 -1
- package/dist/cjs/bds-grid.cjs.entry.js +1 -1
- package/dist/cjs/bds-list-menu-item.cjs.entry.js +19 -8
- package/dist/cjs/bds-list-menu.cjs.entry.js +42 -7
- package/dist/cjs/bds-popover.cjs.entry.js +13 -5
- package/dist/cjs/bds-radio-button.cjs.entry.js +2 -2
- package/dist/cjs/bds-radio-card.cjs.entry.js +2 -2
- package/dist/cjs/bds-radio-group.cjs.entry.js +14 -8
- package/dist/cjs/bds-radio.cjs.entry.js +2 -2
- package/dist/cjs/bds-select.cjs.entry.js +394 -0
- package/dist/cjs/bds-slider.cjs.entry.js +655 -0
- package/dist/cjs/bds-tag.cjs.entry.js +1 -1
- package/dist/cjs/bds-text-field.cjs.entry.js +8 -3
- package/dist/cjs/bds-toggle.cjs.entry.js +1 -1
- package/dist/cjs/bds-tooltip_2.cjs.entry.js +7 -5
- package/dist/cjs/boreal-web-components.cjs.js +1 -1
- package/dist/cjs/checkbox-form-association-DTEpHXUD.js +43 -0
- package/dist/cjs/{getOffset-k4ezB-eT.js → getOffset-CsDHFjPW.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +16 -10
- package/dist/collection/components/actions/bds-button/bds-button.css +36 -36
- package/dist/collection/components/actions/bds-button/bds-button.js +29 -5
- package/dist/collection/components/actions/bds-button-group/bds-button-group.css +1 -1
- package/dist/collection/components/actions/bds-button-group/bds-button-group.js +21 -2
- package/dist/collection/components/actions/bds-list-menu/bds-list-menu/bds-list-menu.js +136 -3
- package/dist/collection/components/actions/bds-list-menu/bds-list-menu-item/bds-list-menu-item.css +5 -2
- package/dist/collection/components/actions/bds-list-menu/bds-list-menu-item/bds-list-menu-item.js +20 -7
- package/dist/collection/components/actions/bds-toggle/bds-toggle.css +3 -3
- package/dist/collection/components/feedback/bds-tag/bds-tag.css +6 -6
- package/dist/collection/components/forms/bds-checkbox/bds-checkbox/bds-checkbox.css +132 -0
- package/dist/collection/components/forms/bds-checkbox/{bds-checkbox.js → bds-checkbox/bds-checkbox.js} +135 -38
- package/dist/collection/components/forms/bds-checkbox/bds-checkbox-button/bds-checkbox-button.css +113 -0
- package/dist/collection/components/forms/bds-checkbox/bds-checkbox-button/bds-checkbox-button.js +382 -0
- package/dist/collection/components/forms/{bds-checkbox-card → bds-checkbox/bds-checkbox-card}/bds-checkbox-card.css +15 -3
- package/dist/collection/components/forms/{bds-checkbox-card → bds-checkbox/bds-checkbox-card}/bds-checkbox-card.js +97 -51
- package/dist/collection/components/forms/bds-checkbox/bds-checkbox-group/bds-checkbox-group.css +55 -0
- package/dist/collection/components/forms/bds-checkbox/bds-checkbox-group/bds-checkbox-group.js +648 -0
- package/dist/collection/components/forms/bds-checkbox/bds-checkbox-group/types/enum.js +5 -0
- package/dist/collection/components/forms/bds-checkbox/bds-checkbox-group/types/index.js +3 -0
- package/dist/collection/components/forms/bds-checkbox/utils/checkbox-form-association.js +39 -0
- package/dist/collection/components/forms/bds-checkbox/utils/index.js +1 -0
- package/dist/collection/components/forms/bds-flag/bds-flag.js +1 -1
- package/dist/collection/components/forms/bds-radio/{bds-radio.css → bds-radio/bds-radio.css} +3 -3
- package/dist/collection/components/forms/bds-radio/{bds-radio.js → bds-radio/bds-radio.js} +2 -2
- package/dist/collection/components/forms/{bds-radio-button → bds-radio/bds-radio-button}/bds-radio-button.css +12 -8
- package/dist/collection/components/forms/{bds-radio-button → bds-radio/bds-radio-button}/bds-radio-button.js +2 -2
- package/dist/collection/components/forms/{bds-radio-card → bds-radio/bds-radio-card}/bds-radio-card.css +2 -2
- package/dist/collection/components/forms/{bds-radio-card → bds-radio/bds-radio-card}/bds-radio-card.js +9 -9
- package/dist/collection/components/forms/{bds-radio-group → bds-radio/bds-radio-group}/bds-radio-group.js +51 -23
- package/dist/collection/components/forms/bds-select/bds-select.css +23 -0
- package/dist/collection/components/forms/bds-select/bds-select.js +431 -0
- package/dist/collection/components/forms/bds-slider/bds-slider.css +213 -0
- package/dist/collection/components/forms/bds-slider/bds-slider.js +847 -0
- package/dist/collection/components/forms/bds-slider/helpers/SliderDOMController.js +61 -0
- package/dist/collection/components/forms/bds-slider/helpers/SliderService.js +93 -0
- package/dist/collection/components/forms/bds-slider/helpers/index.js +3 -0
- package/dist/collection/components/forms/bds-slider/helpers/parseValues.js +43 -0
- package/dist/collection/components/forms/bds-slider/types/ISlider.js +1 -0
- package/dist/collection/components/forms/bds-slider/types/ISliderOptions.js +1 -0
- package/dist/collection/components/forms/bds-slider/types/enum.js +16 -0
- package/dist/collection/components/forms/bds-slider/types/index.js +5 -0
- package/dist/collection/components/forms/bds-slider/types/types.js +1 -0
- package/dist/collection/components/forms/bds-text-field/bds-text-field.css +10 -3
- package/dist/collection/components/forms/bds-text-field/bds-text-field.js +47 -2
- package/dist/collection/components/helpers/bds-divider/bds-divider.js +1 -1
- package/dist/collection/components/images-icons/bds-avatar/bds-avatar.js +1 -1
- package/dist/collection/components/layouts/bds-grid/{grid → bds-grid}/bds-grid.js +3 -3
- package/dist/collection/components/layouts/bds-grid/bds-grid/types/IGrid.js +1 -0
- package/dist/collection/components/layouts/bds-grid/bds-grid/types/types.js +1 -0
- package/dist/collection/components/layouts/bds-grid/{grid-item → bds-grid-item}/bds-grid-item.js +9 -9
- package/dist/collection/components/layouts/bds-grid/bds-grid-item/types/IGridItem.js +1 -0
- package/dist/collection/components/layouts/bds-grid/bds-grid-item/types/types.js +1 -0
- package/dist/collection/components/navigation/bds-breadcrumb/bds-breadcrumb.css +21 -0
- package/dist/collection/components/navigation/bds-breadcrumb/bds-breadcrumb.js +292 -0
- package/dist/collection/components/navigation/bds-breadcrumb/types/IBreadcrumb.js +1 -0
- package/dist/collection/components/navigation/bds-breadcrumb-item/bds-breadcrumb-item.css +64 -0
- package/dist/collection/components/navigation/bds-breadcrumb-item/bds-breadcrumb-item.js +369 -0
- package/dist/collection/components/navigation/bds-breadcrumb-item/types/IBreadcrumbItem.js +1 -0
- package/dist/collection/components/overlays/bds-dialog/bds-dialog.css +1 -1
- package/dist/collection/components/overlays/bds-dialog/bds-dialog.js +2 -2
- package/dist/collection/components/overlays/bds-popover/bds-popover.js +49 -3
- package/dist/collection/components/overlays/bds-tooltip/bds-tooltip.js +1 -1
- package/dist/collection/components/titles-text/bds-typography/bds-typography.js +30 -47
- package/dist/collection/components/titles-text/bds-typography/utils/bds-typography-utils.js +1 -1
- package/dist/collection/css/boreal.css +60 -0
- package/dist/collection/css/theme-connect.css +15 -0
- package/dist/collection/css/theme-engage.css +15 -0
- package/dist/collection/css/theme-protect.css +15 -0
- package/dist/collection/css/theme-proximus.css +15 -0
- package/dist/collection/mixins/menu-behavior.mixin.js +1 -1
- package/dist/collection/scss/maps/_theme-connect.scss +16 -1
- package/dist/collection/scss/maps/_theme-engage.scss +16 -1
- package/dist/collection/scss/maps/_theme-protect.scss +16 -1
- package/dist/collection/scss/maps/_theme-proximus.scss +16 -1
- package/dist/collection/scss/variables/_theme-connect.scss +16 -1
- package/dist/collection/scss/variables/_theme-engage.scss +16 -1
- package/dist/collection/scss/variables/_theme-protect.scss +16 -1
- package/dist/collection/scss/variables/_theme-proximus.scss +16 -1
- package/dist/collection/types/index.js +0 -1
- package/dist/collection/utils/a11y/index.js +4 -0
- package/dist/collection/utils/a11y/keyboard/KeyboardController.js +566 -0
- package/dist/collection/utils/a11y/keyboard/_constants.js +30 -0
- package/dist/collection/utils/a11y/keyboard/focus/aria-activedescendant.js +41 -0
- package/dist/collection/utils/a11y/keyboard/focus/resolve.js +48 -0
- package/dist/collection/utils/a11y/keyboard/focus/roving-tabindex.js +55 -0
- package/dist/collection/utils/a11y/keyboard/navigation/grid-navigation.js +194 -0
- package/dist/collection/utils/a11y/keyboard/navigation/linear-navigation.js +137 -0
- package/dist/collection/utils/a11y/keyboard/types/IKeyboardController.js +1 -0
- package/dist/collection/utils/a11y/keyboard/types/index.js +2 -0
- package/dist/collection/utils/a11y/keyboard/types/types.js +1 -0
- package/dist/collection/utils/constants/common/Keys.js +25 -6
- package/dist/collection/utils/dom/elements.js +63 -0
- package/dist/css/boreal.css +60 -0
- package/dist/css/theme-connect.css +15 -0
- package/dist/css/theme-engage.css +15 -0
- package/dist/css/theme-protect.css +15 -0
- package/dist/css/theme-proximus.css +15 -0
- package/dist/esm/KeyboardController-DcnXb5F5.js +1064 -0
- package/dist/esm/Keys-7G4h4DI7.js +31 -0
- package/dist/esm/bds-avatar.entry.js +1 -1
- package/dist/esm/bds-breadcrumb-item.entry.js +104 -0
- package/dist/esm/bds-breadcrumb.entry.js +125 -0
- package/dist/esm/bds-button-group.entry.js +23 -2
- package/dist/esm/bds-button.entry.js +33 -6
- package/dist/esm/bds-checkbox-button.entry.js +117 -0
- package/dist/esm/bds-checkbox-card.entry.js +37 -23
- package/dist/esm/bds-checkbox-group.entry.js +290 -0
- package/dist/esm/bds-checkbox.entry.js +62 -31
- package/dist/esm/bds-dialog.entry.js +3 -3
- package/dist/esm/bds-divider.entry.js +1 -1
- package/dist/esm/bds-flag.entry.js +1 -1
- package/dist/esm/bds-grid-item.entry.js +1 -1
- package/dist/esm/bds-grid.entry.js +1 -1
- package/dist/esm/bds-list-menu-item.entry.js +19 -8
- package/dist/esm/bds-list-menu.entry.js +38 -3
- package/dist/esm/bds-popover.entry.js +13 -5
- package/dist/esm/bds-radio-button.entry.js +2 -2
- package/dist/esm/bds-radio-card.entry.js +2 -2
- package/dist/esm/bds-radio-group.entry.js +14 -8
- package/dist/esm/bds-radio.entry.js +2 -2
- package/dist/esm/bds-select.entry.js +392 -0
- package/dist/esm/bds-slider.entry.js +653 -0
- package/dist/esm/bds-tag.entry.js +1 -1
- package/dist/esm/bds-text-field.entry.js +8 -3
- package/dist/esm/bds-toggle.entry.js +1 -1
- package/dist/esm/bds-tooltip_2.entry.js +7 -5
- package/dist/esm/boreal-web-components.js +1 -1
- package/dist/esm/checkbox-form-association-cgdh1LO-.js +41 -0
- package/dist/esm/{getOffset-BYS3c13B.js → getOffset-DCLpJBcp.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm-es5/KeyboardController-DcnXb5F5.js +1 -0
- package/dist/esm-es5/Keys-7G4h4DI7.js +1 -0
- package/dist/esm-es5/bds-avatar.entry.js +1 -1
- package/dist/esm-es5/bds-breadcrumb-item.entry.js +1 -0
- package/dist/esm-es5/bds-breadcrumb.entry.js +1 -0
- package/dist/esm-es5/bds-button-group.entry.js +1 -1
- package/dist/esm-es5/bds-button.entry.js +1 -1
- package/dist/esm-es5/bds-checkbox-button.entry.js +1 -0
- package/dist/esm-es5/bds-checkbox-card.entry.js +1 -1
- package/dist/esm-es5/bds-checkbox-group.entry.js +1 -0
- package/dist/esm-es5/bds-checkbox.entry.js +1 -1
- package/dist/esm-es5/bds-dialog.entry.js +1 -1
- package/dist/esm-es5/bds-divider.entry.js +1 -1
- package/dist/esm-es5/bds-flag.entry.js +1 -1
- package/dist/esm-es5/bds-grid-item.entry.js +1 -1
- package/dist/esm-es5/bds-grid.entry.js +1 -1
- package/dist/esm-es5/bds-list-menu-item.entry.js +1 -1
- package/dist/esm-es5/bds-list-menu.entry.js +1 -1
- package/dist/esm-es5/bds-popover.entry.js +1 -1
- package/dist/esm-es5/bds-radio-button.entry.js +1 -1
- package/dist/esm-es5/bds-radio-card.entry.js +1 -1
- package/dist/esm-es5/bds-radio-group.entry.js +1 -1
- package/dist/esm-es5/bds-radio.entry.js +1 -1
- package/dist/esm-es5/bds-select.entry.js +1 -0
- package/dist/esm-es5/bds-slider.entry.js +1 -0
- package/dist/esm-es5/bds-tag.entry.js +1 -1
- package/dist/esm-es5/bds-text-field.entry.js +1 -1
- package/dist/esm-es5/bds-toggle.entry.js +1 -1
- package/dist/esm-es5/bds-tooltip_2.entry.js +1 -1
- package/dist/esm-es5/boreal-web-components.js +1 -1
- package/dist/esm-es5/checkbox-form-association-cgdh1LO-.js +1 -0
- package/dist/esm-es5/{getOffset-BYS3c13B.js → getOffset-DCLpJBcp.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/scss/maps/_theme-connect.scss +16 -1
- package/dist/scss/maps/_theme-engage.scss +16 -1
- package/dist/scss/maps/_theme-protect.scss +16 -1
- package/dist/scss/maps/_theme-proximus.scss +16 -1
- package/dist/scss/variables/_theme-connect.scss +16 -1
- package/dist/scss/variables/_theme-engage.scss +16 -1
- package/dist/scss/variables/_theme-protect.scss +16 -1
- package/dist/scss/variables/_theme-proximus.scss +16 -1
- package/dist/types/components/actions/bds-button/bds-button.d.ts +4 -0
- package/dist/types/components/actions/bds-button-group/bds-button-group.d.ts +4 -0
- package/dist/types/components/actions/bds-list-menu/bds-list-menu/bds-list-menu.d.ts +13 -0
- package/dist/types/components/actions/bds-list-menu/bds-list-menu/types/IListMenu.d.ts +3 -0
- package/dist/types/components/actions/bds-list-menu/bds-list-menu-item/bds-list-menu-item.d.ts +4 -1
- package/dist/types/components/actions/bds-list-menu/bds-list-menu-item/types/IListMenuItem.d.ts +1 -0
- package/dist/types/components/actions/bds-toggle/types/IToggle.d.ts +1 -1
- package/dist/types/components/forms/bds-checkbox/{bds-checkbox.d.ts → bds-checkbox/bds-checkbox.d.ts} +23 -10
- package/dist/types/components/forms/bds-checkbox/bds-checkbox-button/bds-checkbox-button.d.ts +68 -0
- package/dist/types/components/forms/bds-checkbox/bds-checkbox-button/types/ICheckboxButton.d.ts +15 -0
- package/dist/types/components/forms/{bds-checkbox-card → bds-checkbox/bds-checkbox-card}/bds-checkbox-card.d.ts +15 -22
- package/dist/types/components/forms/bds-checkbox/bds-checkbox-card/types/ICheckboxCard.d.ts +9 -0
- package/dist/types/components/forms/bds-checkbox/bds-checkbox-group/bds-checkbox-group.d.ts +86 -0
- package/dist/types/components/forms/bds-checkbox/bds-checkbox-group/types/ICheckboxGroup.d.ts +27 -0
- package/dist/types/components/forms/bds-checkbox/bds-checkbox-group/types/enum.d.ts +6 -0
- package/dist/types/components/forms/bds-checkbox/bds-checkbox-group/types/index.d.ts +4 -0
- package/dist/types/components/forms/bds-checkbox/bds-checkbox-group/types/types.d.ts +4 -0
- package/dist/types/components/forms/bds-checkbox/types/ICheckbox.d.ts +7 -22
- package/dist/types/components/forms/bds-checkbox/utils/checkbox-form-association.d.ts +10 -0
- package/dist/types/components/forms/bds-checkbox/utils/index.d.ts +2 -0
- package/dist/types/components/forms/bds-radio/{bds-radio.d.ts → bds-radio/bds-radio.d.ts} +1 -1
- package/dist/types/components/forms/{bds-radio-button → bds-radio/bds-radio-button}/bds-radio-button.d.ts +1 -1
- package/dist/types/components/forms/{bds-radio-button → bds-radio/bds-radio-button}/types/IRadioButton.d.ts +1 -0
- package/dist/types/components/forms/{bds-radio-card → bds-radio/bds-radio-card}/bds-radio-card.d.ts +1 -1
- package/dist/types/components/forms/{bds-radio-group → bds-radio/bds-radio-group}/bds-radio-group.d.ts +13 -10
- package/dist/types/components/forms/bds-radio/bds-radio-group/types/IRadioGroup.d.ts +20 -0
- package/dist/types/components/forms/bds-select/bds-select.d.ts +98 -0
- package/dist/types/components/forms/bds-select/types/ISelect.d.ts +6 -0
- package/dist/types/components/forms/bds-slider/bds-slider.d.ts +176 -0
- package/dist/types/components/forms/bds-slider/helpers/SliderDOMController.d.ts +38 -0
- package/dist/types/components/forms/bds-slider/helpers/SliderService.d.ts +44 -0
- package/dist/types/components/forms/bds-slider/helpers/index.d.ts +4 -0
- package/dist/types/components/forms/bds-slider/helpers/parseValues.d.ts +18 -0
- package/dist/types/components/forms/bds-slider/types/ChangeDetail.d.ts +9 -0
- package/dist/types/components/forms/bds-slider/types/ISlider.d.ts +17 -0
- package/dist/types/components/forms/bds-slider/types/ISliderOptions.d.ts +31 -0
- package/dist/types/components/forms/bds-slider/types/enum.d.ts +17 -0
- package/dist/types/components/forms/bds-slider/types/index.d.ts +6 -0
- package/dist/types/components/forms/bds-slider/types/types.d.ts +5 -0
- package/dist/types/components/forms/bds-text-field/bds-text-field.d.ts +4 -0
- package/dist/types/components/navigation/bds-breadcrumb/bds-breadcrumb.d.ts +57 -0
- package/dist/types/components/navigation/bds-breadcrumb/types/IBreadcrumb.d.ts +17 -0
- package/dist/types/components/navigation/bds-breadcrumb-item/bds-breadcrumb-item.d.ts +83 -0
- package/dist/types/components/navigation/bds-breadcrumb-item/types/IBreadcrumbItem.d.ts +20 -0
- package/dist/types/components/overlays/bds-popover/bds-popover.d.ts +4 -0
- package/dist/types/components/titles-text/bds-typography/bds-typography.d.ts +2 -46
- package/dist/types/components/titles-text/bds-typography/types/ITypography.d.ts +1 -0
- package/dist/types/components.d.ts +1136 -277
- package/dist/types/types/form.d.ts +24 -0
- package/dist/types/types/index.d.ts +0 -1
- package/dist/types/utils/a11y/index.d.ts +4 -0
- package/dist/types/utils/a11y/keyboard/KeyboardController.d.ts +321 -0
- package/dist/types/utils/a11y/keyboard/_constants.d.ts +28 -0
- package/dist/types/utils/a11y/keyboard/focus/aria-activedescendant.d.ts +17 -0
- package/dist/types/utils/a11y/keyboard/focus/resolve.d.ts +23 -0
- package/dist/types/utils/a11y/keyboard/focus/roving-tabindex.d.ts +20 -0
- package/dist/types/utils/a11y/keyboard/navigation/grid-navigation.d.ts +9 -0
- package/dist/types/utils/a11y/keyboard/navigation/linear-navigation.d.ts +13 -0
- package/dist/types/utils/a11y/keyboard/types/IKeyboardController.d.ts +125 -0
- package/dist/types/utils/a11y/keyboard/types/index.d.ts +3 -0
- package/dist/types/utils/a11y/keyboard/types/types.d.ts +6 -0
- package/dist/types/utils/constants/common/Keys.d.ts +23 -6
- package/dist/types/utils/dom/elements.d.ts +41 -0
- package/package.json +1 -1
- package/components-build/p-Cbibqaz0.js +0 -1
- package/components-build/p-ClR-wgiT.js +0 -1
- package/components-build/p-N_tqtRV2.js +0 -1
- package/components-build/p-bAMuJ4Jx.js +0 -1
- package/components-build/p-c2z3tneT.js +0 -1
- package/components-build/p-dz9-Q2N8.js +0 -1
- package/components-build/p-iq2UuV7c.js +0 -1
- package/dist/boreal-web-components/p-06DrzEMB.system.js +0 -1
- package/dist/boreal-web-components/p-11e4c0ec.system.entry.js +0 -1
- package/dist/boreal-web-components/p-148d510f.entry.js +0 -1
- package/dist/boreal-web-components/p-277f142e.system.entry.js +0 -1
- package/dist/boreal-web-components/p-2be4aa3a.system.entry.js +0 -1
- package/dist/boreal-web-components/p-340896b2.entry.js +0 -1
- package/dist/boreal-web-components/p-3d4ce8eb.system.entry.js +0 -1
- package/dist/boreal-web-components/p-44a8fde5.entry.js +0 -1
- package/dist/boreal-web-components/p-5681b294.system.entry.js +0 -1
- package/dist/boreal-web-components/p-5ed75075.entry.js +0 -1
- package/dist/boreal-web-components/p-635f676b.system.entry.js +0 -1
- package/dist/boreal-web-components/p-68b83680.system.entry.js +0 -1
- package/dist/boreal-web-components/p-6a60d134.system.entry.js +0 -1
- package/dist/boreal-web-components/p-7e672cce.entry.js +0 -1
- package/dist/boreal-web-components/p-81401e2a.system.entry.js +0 -1
- package/dist/boreal-web-components/p-8289e506.entry.js +0 -1
- package/dist/boreal-web-components/p-82d15372.entry.js +0 -1
- package/dist/boreal-web-components/p-851c06f2.entry.js +0 -1
- package/dist/boreal-web-components/p-8a3716ec.entry.js +0 -1
- package/dist/boreal-web-components/p-8f4f8af0.system.entry.js +0 -1
- package/dist/boreal-web-components/p-DlYG-OVB.js +0 -1
- package/dist/boreal-web-components/p-DpnBDSUm.system.js +0 -1
- package/dist/boreal-web-components/p-a73659ac.system.entry.js +0 -1
- package/dist/boreal-web-components/p-b2ad9535.system.entry.js +0 -1
- package/dist/boreal-web-components/p-d4c30d2b.entry.js +0 -1
- package/dist/boreal-web-components/p-db0c10b9.system.entry.js +0 -1
- package/dist/boreal-web-components/p-dca16a3d.entry.js +0 -1
- package/dist/boreal-web-components/p-de846c43.system.entry.js +0 -1
- package/dist/boreal-web-components/p-df087e23.system.entry.js +0 -1
- package/dist/boreal-web-components/p-dfb4854e.entry.js +0 -1
- package/dist/boreal-web-components/p-dz9-Q2N8.js +0 -1
- package/dist/boreal-web-components/p-e09b4d14.system.entry.js +0 -1
- package/dist/boreal-web-components/p-e7af1e1a.entry.js +0 -1
- package/dist/boreal-web-components/p-f792aa74.entry.js +0 -1
- package/dist/cjs/Keys-rKl2za5q.js +0 -18
- package/dist/cjs/menu-BxKaEajh.js +0 -8
- package/dist/collection/components/forms/bds-checkbox/bds-checkbox.css +0 -91
- package/dist/esm/Keys-DlYG-OVB.js +0 -16
- package/dist/esm/menu-dz9-Q2N8.js +0 -6
- package/dist/esm-es5/Keys-DlYG-OVB.js +0 -1
- package/dist/esm-es5/menu-dz9-Q2N8.js +0 -1
- package/dist/types/components/forms/bds-checkbox-card/types/ICheckboxCard.d.ts +0 -8
- package/dist/types/components/forms/bds-radio-group/types/IRadioGroup.d.ts +0 -19
- package/dist/types/types/IFormProps.d.ts +0 -25
- /package/dist/collection/components/forms/{bds-checkbox-card/types/ICheckboxCard.js → bds-checkbox/bds-checkbox-button/types/ICheckboxButton.js} +0 -0
- /package/dist/collection/components/forms/{bds-radio-button/types/IRadioButton.js → bds-checkbox/bds-checkbox-card/types/ICheckboxCard.js} +0 -0
- /package/dist/collection/components/forms/{bds-radio-card/types/IRadioCard.js → bds-checkbox/bds-checkbox-group/types/ICheckboxGroup.js} +0 -0
- /package/dist/collection/components/forms/{bds-radio-group → bds-checkbox/bds-checkbox-group}/types/types.js +0 -0
- /package/dist/collection/components/{layouts/bds-grid/grid/types/IGrid.js → forms/bds-radio/bds-radio/types/IRadio.js} +0 -0
- /package/dist/collection/components/forms/{bds-radio-group/types/IRadioGroup.js → bds-radio/bds-radio-button/types/IRadioButton.js} +0 -0
- /package/dist/collection/components/forms/bds-radio/{types/IRadio.js → bds-radio-card/types/IRadioCard.js} +0 -0
- /package/dist/collection/components/forms/{bds-radio-group → bds-radio/bds-radio-group}/bds-radio-group.css +0 -0
- /package/dist/collection/components/{layouts/bds-grid/grid-item/types/IGridItem.js → forms/bds-radio/bds-radio-group/types/IRadioGroup.js} +0 -0
- /package/dist/collection/components/forms/{bds-radio-group → bds-radio/bds-radio-group}/types/enum.js +0 -0
- /package/dist/collection/components/{layouts/bds-grid/grid-item → forms/bds-radio/bds-radio-group}/types/types.js +0 -0
- /package/dist/collection/components/{layouts/bds-grid/grid/types/types.js → forms/bds-select/types/ISelect.js} +0 -0
- /package/dist/collection/{types/IFormProps.js → components/forms/bds-slider/types/ChangeDetail.js} +0 -0
- /package/dist/collection/components/layouts/bds-grid/{grid → bds-grid}/bds-grid.css +0 -0
- /package/dist/collection/components/layouts/bds-grid/{grid → bds-grid}/types/enum.js +0 -0
- /package/dist/collection/components/layouts/bds-grid/{grid → bds-grid}/types/index.js +0 -0
- /package/dist/collection/components/layouts/bds-grid/{grid-item → bds-grid-item}/bds-grid-item.css +0 -0
- /package/dist/collection/components/layouts/bds-grid/{grid-item → bds-grid-item}/types/enum.js +0 -0
- /package/dist/collection/components/layouts/bds-grid/{grid-item → bds-grid-item}/types/index.js +0 -0
- /package/dist/types/components/forms/bds-radio/{types → bds-radio/types}/IRadio.d.ts +0 -0
- /package/dist/types/components/forms/{bds-radio-card → bds-radio/bds-radio-card}/types/IRadioCard.d.ts +0 -0
- /package/dist/types/components/forms/{bds-radio-group → bds-radio/bds-radio-group}/types/enum.d.ts +0 -0
- /package/dist/types/components/forms/{bds-radio-group → bds-radio/bds-radio-group}/types/types.d.ts +0 -0
- /package/dist/types/components/layouts/bds-grid/{grid → bds-grid}/bds-grid.d.ts +0 -0
- /package/dist/types/components/layouts/bds-grid/{grid → bds-grid}/types/IGrid.d.ts +0 -0
- /package/dist/types/components/layouts/bds-grid/{grid → bds-grid}/types/enum.d.ts +0 -0
- /package/dist/types/components/layouts/bds-grid/{grid → bds-grid}/types/index.d.ts +0 -0
- /package/dist/types/components/layouts/bds-grid/{grid → bds-grid}/types/types.d.ts +0 -0
- /package/dist/types/components/layouts/bds-grid/{grid-item → bds-grid-item}/bds-grid-item.d.ts +0 -0
- /package/dist/types/components/layouts/bds-grid/{grid-item → bds-grid-item}/types/IGridItem.d.ts +0 -0
- /package/dist/types/components/layouts/bds-grid/{grid-item → bds-grid-item}/types/enum.d.ts +0 -0
- /package/dist/types/components/layouts/bds-grid/{grid-item → bds-grid-item}/types/index.d.ts +0 -0
- /package/dist/types/components/layouts/bds-grid/{grid-item → bds-grid-item}/types/types.d.ts +0 -0
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-CwYIVC9N.js');
|
|
4
|
+
var formAssociated_mixin = require('./form-associated.mixin-BCR6bj29.js');
|
|
5
|
+
var internals = require('./internals-D8x7GMfR.js');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Available tooltip types for the slider component.
|
|
9
|
+
* Used to control the visibility of the tooltip.
|
|
10
|
+
*/
|
|
11
|
+
const SLIDER_TOOLTIP = {
|
|
12
|
+
NEVER: 'never',
|
|
13
|
+
FOCUS: 'focus',
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Available slider types for the slider component.
|
|
17
|
+
* Used to control the behavior of the slider.
|
|
18
|
+
*/
|
|
19
|
+
const SLIDER_TYPE = {
|
|
20
|
+
SINGLE: 'single',
|
|
21
|
+
RANGE: 'range',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Parses any valid `values` input into a clean `number[]`.
|
|
26
|
+
* This is the single source of truth for value normalization.
|
|
27
|
+
*
|
|
28
|
+
* Handles:
|
|
29
|
+
* - `number[]` → `[10, 50, 80]` (passthrough, filtered for NaN)
|
|
30
|
+
* - `"[10, 50, 80]"` → `[10, 50, 80]`
|
|
31
|
+
* - anything malformed → `[this.min]` as safe fallback
|
|
32
|
+
*/
|
|
33
|
+
function parseValues(raw, fallback = [0]) {
|
|
34
|
+
if (Array.isArray(raw)) {
|
|
35
|
+
const result = raw.map(Number).filter(n => !isNaN(n));
|
|
36
|
+
return result.length > 0 ? result : fallback;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
const parsed = JSON.parse(raw);
|
|
40
|
+
const arr = Array.isArray(parsed) ? parsed : [parsed];
|
|
41
|
+
const result = arr.map(Number).filter(n => !isNaN(n));
|
|
42
|
+
return result.length > 0 ? result : fallback;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
const n = Number(raw);
|
|
46
|
+
return isNaN(n) ? fallback : [n];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Serialize the value for the form: a single number → "10", multiple → "10,20,30"
|
|
51
|
+
* FormData does not support arrays natively, so we use CSV.
|
|
52
|
+
*/
|
|
53
|
+
function serializeFormValue(values) {
|
|
54
|
+
return values.join(',');
|
|
55
|
+
}
|
|
56
|
+
function resolveValues(raw, min, max, type) {
|
|
57
|
+
const parsed = parseValues(raw, [Number(min)]);
|
|
58
|
+
if (type === SLIDER_TYPE.RANGE) {
|
|
59
|
+
if (parsed.length >= 2) {
|
|
60
|
+
return [parsed[0] ?? Number(min), parsed[1] ?? Number(max)];
|
|
61
|
+
}
|
|
62
|
+
return [parsed[0] ?? Number(min), Number(max)];
|
|
63
|
+
}
|
|
64
|
+
return [parsed[0] ?? Number(min)];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
class SliderService {
|
|
68
|
+
constructor(options) {
|
|
69
|
+
this.options = options;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Clamps a value between min and max.
|
|
73
|
+
*/
|
|
74
|
+
clamp(value) {
|
|
75
|
+
return Math.min(Math.max(value, this.options.min), this.options.max);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Rounds a value to the nearest step.
|
|
79
|
+
*/
|
|
80
|
+
snapToStep(value) {
|
|
81
|
+
const stepped = Math.round((value - this.options.min) / this.options.step) * this.options.step + this.options.min;
|
|
82
|
+
return this.clamp(stepped);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Applies collision prevention for range mode.
|
|
86
|
+
* Ensures handles never overlap — always at least 1 step apart.
|
|
87
|
+
*/
|
|
88
|
+
applyCollision(values, changedIndex) {
|
|
89
|
+
const result = [...values];
|
|
90
|
+
const margin = this.options.step;
|
|
91
|
+
if (this.options.type !== SLIDER_TYPE.RANGE || result.length < 2)
|
|
92
|
+
return result;
|
|
93
|
+
if (changedIndex === 0) {
|
|
94
|
+
// Min handle cannot exceed max handle - margin
|
|
95
|
+
const maxVal = result[1] ?? this.options.max;
|
|
96
|
+
result[0] = Math.min(result[0] ?? this.options.min, maxVal - margin);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
// Max handle cannot go below min handle + margin
|
|
100
|
+
const minVal = result[0] ?? this.options.min;
|
|
101
|
+
result[1] = Math.max(result[1] ?? this.options.max, minVal + margin);
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Calculates the percentage position of a value along the track.
|
|
107
|
+
*/
|
|
108
|
+
toPercent(value) {
|
|
109
|
+
const range = this.options.max - this.options.min;
|
|
110
|
+
if (range === 0)
|
|
111
|
+
return 0;
|
|
112
|
+
return ((value - this.options.min) / range) * 100;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Returns connect segments for the track.
|
|
116
|
+
* single: [left=0, width=percent of value]
|
|
117
|
+
* range: [left=percent of min, width=percent of (max - min)]
|
|
118
|
+
*/
|
|
119
|
+
getConnectSegment(values) {
|
|
120
|
+
if (this.options.type === SLIDER_TYPE.SINGLE) {
|
|
121
|
+
return {
|
|
122
|
+
left: 0,
|
|
123
|
+
width: this.toPercent(values[0] ?? this.options.min),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
const val0 = values[0] ?? this.options.min;
|
|
127
|
+
const val1 = values[1] ?? this.options.max;
|
|
128
|
+
return {
|
|
129
|
+
left: this.toPercent(val0),
|
|
130
|
+
width: this.toPercent(val1 - val0 + this.options.min),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Returns pip positions as percentages, excluding min and max.
|
|
135
|
+
*/
|
|
136
|
+
getPipPositions() {
|
|
137
|
+
const { min, max, step } = this.options;
|
|
138
|
+
const positions = [];
|
|
139
|
+
const total = (max - min) / step;
|
|
140
|
+
for (let i = 1; i < total; i++) {
|
|
141
|
+
const value = min + i * step;
|
|
142
|
+
positions.push(this.toPercent(value));
|
|
143
|
+
}
|
|
144
|
+
return positions;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Returns the CSS position of the thumb in pixels based on the track and percent.
|
|
148
|
+
* @param value - The value of the slider at the given clientX position.
|
|
149
|
+
* @param trackWidth - The width of the track element.
|
|
150
|
+
* @param thumbSize - The size of the thumb element.
|
|
151
|
+
* @returns The position of the thumb in pixels.
|
|
152
|
+
*/
|
|
153
|
+
getThumbCSSPosition(value, trackWidth, thumbSize) {
|
|
154
|
+
const percent = this.toPercent(value) / 100;
|
|
155
|
+
const usableWidth = trackWidth - thumbSize;
|
|
156
|
+
return percent * usableWidth + thumbSize / 2;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
class SliderDOMController {
|
|
161
|
+
/**
|
|
162
|
+
* Adds the necessary classes to show the tooltip when a handle is focused or active.
|
|
163
|
+
* This is used in both focus and active states to ensure the tooltip remains visible.
|
|
164
|
+
* @param inputEl - The input element to add the states to.
|
|
165
|
+
* @param blockClass - The block class of the slider.
|
|
166
|
+
*/
|
|
167
|
+
static addTooltipsStates(inputEl, blockClass) {
|
|
168
|
+
if (inputEl === undefined)
|
|
169
|
+
return;
|
|
170
|
+
inputEl.classList.add(`${blockClass}__tooltip--visible`, `${blockClass}__tooltip--active`);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Removes the necessary classes to hide the tooltip when a handle is blurred or inactive.
|
|
174
|
+
* @param inputEl - The input element to remove the states from.
|
|
175
|
+
* @param blockClass - The block class of the slider.
|
|
176
|
+
*/
|
|
177
|
+
static removeTooltipsStates(inputEl, blockClass) {
|
|
178
|
+
if (inputEl === undefined)
|
|
179
|
+
return;
|
|
180
|
+
inputEl.classList.remove(`${blockClass}__tooltip--visible`, `${blockClass}__tooltip--active`);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Syncs the tooltips with the given values and inputs.
|
|
184
|
+
* @param values - The values to sync the tooltips with.
|
|
185
|
+
* @param inputsEl - The inputs to sync the tooltips with.
|
|
186
|
+
*/
|
|
187
|
+
static syncTooltips(values, inputsEl) {
|
|
188
|
+
values.forEach((value, index) => {
|
|
189
|
+
const input = inputsEl[index];
|
|
190
|
+
if (input === undefined)
|
|
191
|
+
return;
|
|
192
|
+
input.value = String(value);
|
|
193
|
+
input.setAttribute('value', String(value));
|
|
194
|
+
input.setAttribute('aria-valuenow', String(value));
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Moves the connect element to the given percentage position.
|
|
199
|
+
* @param connectEl - The connect element to move.
|
|
200
|
+
* @param segment - The percentage position to move the connect element to.
|
|
201
|
+
*/
|
|
202
|
+
static moveConnect(connectEl, segment) {
|
|
203
|
+
connectEl.style.left = `${segment.left}%`;
|
|
204
|
+
connectEl.style.width = `${segment.width}%`;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Returns the CSS position of the thumb in pixels based on the track and percent.
|
|
208
|
+
* @param percent - The percentage of the track that the thumb should be positioned at.
|
|
209
|
+
* @returns The position of the thumb in pixels.
|
|
210
|
+
*/
|
|
211
|
+
static getThumbCSSPosition(percent) {
|
|
212
|
+
const thumbSize = 'var(--handle-size, 16px)';
|
|
213
|
+
return `calc(${percent}% + (${thumbSize} / 2) - (${percent} * ${thumbSize} / 100))`;
|
|
214
|
+
}
|
|
215
|
+
static updateInputValue(inputEl, value) {
|
|
216
|
+
inputEl.value = String(value);
|
|
217
|
+
inputEl.setAttribute('value', String(value));
|
|
218
|
+
inputEl.setAttribute('aria-valuenow', String(value));
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const bdsSliderCss = () => `@charset "UTF-8";.bds-slider{display:block;width:100%;--handle-size:16px}.bds-slider--range .bds-slider__input{pointer-events:none}.bds-slider--tooltip{margin-top:var(--boreal-spacing-xl)}.bds-slider--tooltip.bds-slider--label{margin-top:var(--boreal-spacing-ml)}.bds-slider--disabled .bds-slider__tooltip{display:none}.bds-slider--disabled .bds-slider__wrapper{cursor:auto}.bds-slider--disabled .bds-slider__connect{background:var(--boreal-ui-primary-light)}.bds-slider__label{margin-bottom:var(--boreal-spacing-3xs)}.bds-slider__wrapper{position:relative;width:100%;height:var(--handle-size);overflow:visible;cursor:pointer}.bds-slider__track-base{position:absolute;left:0;right:0;top:50%;height:var(--boreal-spacing-2xs);-webkit-transform:translateY(-50%);transform:translateY(-50%);background:var(--boreal-base-light);border-radius:var(--boreal-radius-full);pointer-events:none;z-index:1}.bds-slider__connect{position:absolute;top:50%;height:4px;-webkit-transform:translateY(-50%);transform:translateY(-50%);background:var(--boreal-ui-primary-base);border-radius:var(--boreal-radius-full);pointer-events:none;z-index:2}.bds-slider__input{position:absolute;left:0;top:50%;width:100%;height:var(--handle-size);-webkit-transform:translateY(-50%);transform:translateY(-50%);margin:0;padding:0;background:transparent;outline:none;-moz-appearance:none;appearance:none;-webkit-appearance:none;pointer-events:none;z-index:5}.bds-slider__input::-webkit-slider-runnable-track{height:var(--handle-size);background:transparent;border:none;appearance:none;-webkit-appearance:none}.bds-slider__input::-webkit-slider-thumb{width:var(--handle-size);height:var(--handle-size);margin-top:0;border-radius:var(--boreal-radius-full);background:var(--boreal-ui-inverse);border:var(--boreal-spacing-4xs) solid var(--boreal-stroke-default-light);-webkit-box-shadow:var(--boreal-depth-box-shadow-xs);box-shadow:var(--boreal-depth-box-shadow-xs);cursor:-webkit-grab;cursor:grab;pointer-events:auto;appearance:none;-webkit-appearance:none}.bds-slider__input::-moz-range-track{height:var(--handle-size);background:transparent;border:none}.bds-slider__input::-moz-range-thumb{width:var(--handle-size);height:var(--handle-size);border-radius:var(--boreal-radius-full);background:var(--boreal-ui-inverse);border:var(--boreal-spacing-4xs) solid var(--boreal-stroke-default-light);box-shadow:var(--boreal-depth-box-shadow-xs);cursor:grab;pointer-events:auto}.bds-slider__input:focus-visible::-webkit-slider-thumb,.bds-slider__input:active::-webkit-slider-thumb{-webkit-box-shadow:var(--boreal-depth-box-shadow-active);box-shadow:var(--boreal-depth-box-shadow-active)}.bds-slider__input:focus-visible::-webkit-slider-thumb .bds-slider__tooltip--active,.bds-slider__input:active::-webkit-slider-thumb .bds-slider__tooltip--active{-webkit-box-shadow:var(--boreal-depth-box-shadow-xs);box-shadow:var(--boreal-depth-box-shadow-xs)}.bds-slider__input:focus-visible::-moz-range-thumb,.bds-slider__input:active::-moz-range-thumb{box-shadow:var(--boreal-depth-box-shadow-active)}.bds-slider__input:focus-visible::-moz-range-thumb .bds-slider__tooltip--active,.bds-slider__input:active::-moz-range-thumb .bds-slider__tooltip--active{box-shadow:var(--boreal-depth-box-shadow-xs)}.bds-slider__input:active::-webkit-slider-thumb{cursor:-webkit-grabbing;cursor:grabbing}.bds-slider__input:active::-moz-range-thumb{cursor:grabbing}.bds-slider__input:disabled{pointer-events:none}.bds-slider__input:disabled.bds-slider__connect{background:var(--boreal-ui-disabled)}.bds-slider__input:disabled::-webkit-slider-thumb{background:var(--boreal-ui-disabled);border-color:var(--boreal-base-light);-webkit-box-shadow:none;box-shadow:none;cursor:not-allowed}.bds-slider__input:disabled::-moz-range-thumb{background:var(--boreal-ui-disabled);border-color:var(--boreal-base-light);box-shadow:none;cursor:not-allowed}.bds-slider__pips{position:absolute;left:0;right:0;top:50%;height:var(--boreal-spacing-2xs);-webkit-transform:translateY(-50%);transform:translateY(-50%);pointer-events:none;z-index:3}.bds-slider__pip{position:absolute;top:0;width:var(--boreal-spacing-3xs);height:100%;background:var(--boreal-ui-inverse);-webkit-transform:translateX(-50%);transform:translateX(-50%)}.bds-slider__limits{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;margin-top:var(--boreal-spacing-3xs)}.bds-slider__tooltip{position:absolute;bottom:calc(100% + 10px);-webkit-transform:translateX(-50%);transform:translateX(-50%);color:var(--boreal-text-default);background:var(--boreal-ui-inverse);border-radius:var(--boreal-radius-xs);padding:var(--boreal-spacing-2xs) var(--boreal-spacing-2xs);font-size:var(--boreal-typography-font-size-xs);font-family:var(--boreal-typography-font-family-primary);white-space:nowrap;cursor:auto;pointer-events:fill;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:var(--boreal-layout-ml);height:var(--boreal-layout-ml)}.bds-slider__tooltip--active{-webkit-box-shadow:var(--boreal-depth-box-shadow-xs);box-shadow:var(--boreal-depth-box-shadow-xs)}.bds-slider__tooltip--never{opacity:0}.bds-slider__tooltip--focus{opacity:0;-webkit-transition:opacity 0.15s ease;transition:opacity 0.15s ease}.bds-slider__tooltip--focus.bds-slider__tooltip--visible{opacity:1}`;
|
|
223
|
+
|
|
224
|
+
const BdsSlider = class extends index.Mixin(formAssociated_mixin.formAssociatedMixin) {
|
|
225
|
+
constructor(hostRef) {
|
|
226
|
+
super();
|
|
227
|
+
index.registerInstance(this, hostRef);
|
|
228
|
+
this.bdsChange = index.createEvent(this, "bdsChange");
|
|
229
|
+
this.valueChange = index.createEvent(this, "valueChange");
|
|
230
|
+
this.bdsClick = index.createEvent(this, "bdsClick");
|
|
231
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
232
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
236
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
237
|
+
}
|
|
238
|
+
this.blockClass = 'bds-slider';
|
|
239
|
+
/** Active input elements, one per handle */
|
|
240
|
+
this.inputEls = [];
|
|
241
|
+
/** Active tooltip elements, one per handle */
|
|
242
|
+
this.tooltipEls = [];
|
|
243
|
+
// ---------------------------------------------------------------------------
|
|
244
|
+
// Props
|
|
245
|
+
// ---------------------------------------------------------------------------
|
|
246
|
+
/** Minimum selectable value. Defaults to `0`. */
|
|
247
|
+
this.min = 0;
|
|
248
|
+
/** Maximum selectable value. Defaults to `100`. */
|
|
249
|
+
this.max = 100;
|
|
250
|
+
/** Slider type that defines the slider behavior. Defaults to `single`. */
|
|
251
|
+
this.type = SLIDER_TYPE.SINGLE;
|
|
252
|
+
/** Label for the slider. Defaults to `""`. */
|
|
253
|
+
this.label = '';
|
|
254
|
+
/**
|
|
255
|
+
* Step size for each increment/decrement.
|
|
256
|
+
* Must be a positive number. Defaults to `1`.
|
|
257
|
+
*/
|
|
258
|
+
this.step = 1;
|
|
259
|
+
/**
|
|
260
|
+
* Shows the min and max values of the slider.
|
|
261
|
+
* Defaults to `false`.
|
|
262
|
+
*/
|
|
263
|
+
this.showLimits = false;
|
|
264
|
+
/**
|
|
265
|
+
* Current value(s) of the slider.
|
|
266
|
+
* Accepts `number`, `number[]`, or a JSON string for HTML vanilla usage.
|
|
267
|
+
* - Single handle: `50` or `"50"`
|
|
268
|
+
* - Multi-handle: `[10, 50, 80]` or `"[10, 50, 80]"`
|
|
269
|
+
* - Defaults to `0`.
|
|
270
|
+
*/
|
|
271
|
+
this.value = [0];
|
|
272
|
+
/** Disables the slider, preventing all user interaction. Defaults to `false`. */
|
|
273
|
+
this.disabled = false;
|
|
274
|
+
/** Name of the form control, submitted as a key in the form data. */
|
|
275
|
+
this.name = '';
|
|
276
|
+
/**
|
|
277
|
+
* JSON string array of handle values that should be individually disabled.
|
|
278
|
+
* Each number must match a value present in the `value` prop.
|
|
279
|
+
* Accepts `number`, `number[]`, or JSON string: `"[5, 30]"`.
|
|
280
|
+
* Defaults to `"[]"`.
|
|
281
|
+
*/
|
|
282
|
+
this.disabledHandlers = '[]';
|
|
283
|
+
/**
|
|
284
|
+
* When `true`, renders discrete tick marks along the track
|
|
285
|
+
* at every step position between `min` and `max`.
|
|
286
|
+
* Defaults to `false`.
|
|
287
|
+
*/
|
|
288
|
+
this.discrete = false;
|
|
289
|
+
/**
|
|
290
|
+
* Controls tooltip visibility on each handle.
|
|
291
|
+
* - `"never"` — tooltip is hidden.
|
|
292
|
+
* - `"focus"` — tooltip appears only when the handle is active/focused.
|
|
293
|
+
* Defa ults to `"focus"`.
|
|
294
|
+
*/
|
|
295
|
+
this.tooltip = SLIDER_TOOLTIP.FOCUS;
|
|
296
|
+
// ---------------------------------------------------------------------------
|
|
297
|
+
// State
|
|
298
|
+
// ---------------------------------------------------------------------------
|
|
299
|
+
/** Internal mirror of `disabled`, kept in sync via `@Watch`. */
|
|
300
|
+
this.isDisabled = false;
|
|
301
|
+
/** Internal mirror of `discrete`, kept in sync via `@Watch`. */
|
|
302
|
+
this.isDiscrete = false;
|
|
303
|
+
/**
|
|
304
|
+
* Internal mirror of `values` normalized to `number[]`.
|
|
305
|
+
* All internal logic reads from here; never from `values` directly.
|
|
306
|
+
* Updated via `parseValues()` whenever `values` prop changes.
|
|
307
|
+
*/
|
|
308
|
+
this.internalValues = [0];
|
|
309
|
+
this.handleClick = (event) => {
|
|
310
|
+
const target = event.target;
|
|
311
|
+
this.bdsClick.emit({ target, value: [...this.internalValues] });
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
// ---------------------------------------------------------------------------
|
|
315
|
+
// Watchers
|
|
316
|
+
// ---------------------------------------------------------------------------
|
|
317
|
+
onDisabledChange(next) {
|
|
318
|
+
this.isDisabled = next;
|
|
319
|
+
this.syncDOMUpdates();
|
|
320
|
+
}
|
|
321
|
+
onDisabledHandlersChange() {
|
|
322
|
+
this.syncDOMUpdates();
|
|
323
|
+
}
|
|
324
|
+
onValueChange(next) {
|
|
325
|
+
this.internalValues = this.resolveValues(next);
|
|
326
|
+
this.syncDOMUpdates();
|
|
327
|
+
}
|
|
328
|
+
onConfigChange() {
|
|
329
|
+
this.isDiscrete = this.discrete;
|
|
330
|
+
this.internalValues = this.resolveValues(this.value);
|
|
331
|
+
this.buildAdapter();
|
|
332
|
+
this.syncDOMUpdates();
|
|
333
|
+
}
|
|
334
|
+
onRangeChange() {
|
|
335
|
+
this.buildAdapter();
|
|
336
|
+
this.syncDOMUpdates();
|
|
337
|
+
}
|
|
338
|
+
// ---------------------------------------------------------------------------
|
|
339
|
+
// Form-associated callbacks
|
|
340
|
+
// ---------------------------------------------------------------------------
|
|
341
|
+
formAssociatedCallback() {
|
|
342
|
+
this.syncFormValue();
|
|
343
|
+
}
|
|
344
|
+
formResetCallback() {
|
|
345
|
+
const initial = this.resolveValues(this.value);
|
|
346
|
+
this.updateValues(initial, false);
|
|
347
|
+
this.syncDOMUpdates();
|
|
348
|
+
this.emitChange(initial);
|
|
349
|
+
}
|
|
350
|
+
formStateRestoreCallback(state, _mode) {
|
|
351
|
+
if (typeof state !== 'string')
|
|
352
|
+
return;
|
|
353
|
+
const parsed = state
|
|
354
|
+
.split(',')
|
|
355
|
+
.map(value => parseFloat(value))
|
|
356
|
+
.filter(value => !Number.isNaN(value));
|
|
357
|
+
if (parsed.length === 0)
|
|
358
|
+
return;
|
|
359
|
+
this.updateValues(parsed, false);
|
|
360
|
+
this.syncDOMUpdates();
|
|
361
|
+
internals.setFormValue(this.internals, state);
|
|
362
|
+
}
|
|
363
|
+
syncFormValue() {
|
|
364
|
+
internals.setFormValue(this.internals, serializeFormValue(this.internalValues));
|
|
365
|
+
}
|
|
366
|
+
// ---------------------------------------------------------------------------
|
|
367
|
+
// Public methods
|
|
368
|
+
// ---------------------------------------------------------------------------
|
|
369
|
+
/**
|
|
370
|
+
* Returns the current value(s) of the slider.
|
|
371
|
+
* - Single-handle → `number`
|
|
372
|
+
* - Multi-handle → `number[]`
|
|
373
|
+
*/
|
|
374
|
+
async getValues() {
|
|
375
|
+
return [...this.internalValues];
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Programmatically sets the slider value(s).
|
|
379
|
+
* @param next - A single `number` or an array of `number[]` matching the number of handles.
|
|
380
|
+
*/
|
|
381
|
+
async setValues(next) {
|
|
382
|
+
const parsed = this.resolveValues(next);
|
|
383
|
+
this.updateValues(parsed, false);
|
|
384
|
+
this.syncDOMUpdates();
|
|
385
|
+
this.syncFormValue();
|
|
386
|
+
this.emitChange(parsed);
|
|
387
|
+
}
|
|
388
|
+
// ---------------------------------------------------------------------------
|
|
389
|
+
// Private — slider lifecycle
|
|
390
|
+
// ---------------------------------------------------------------------------
|
|
391
|
+
buildAdapter() {
|
|
392
|
+
this.service = new SliderService({
|
|
393
|
+
min: Number(this.min),
|
|
394
|
+
max: Number(this.max),
|
|
395
|
+
step: Number(this.step),
|
|
396
|
+
type: this.type,
|
|
397
|
+
value: this.internalValues,
|
|
398
|
+
disabledHandlers: parseValues(this.disabledHandlers, []),
|
|
399
|
+
discrete: this.isDiscrete,
|
|
400
|
+
disabled: this.isDisabled,
|
|
401
|
+
name: String(this.name ?? ''),
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
syncDOMUpdates() {
|
|
405
|
+
this.syncInputsToValues();
|
|
406
|
+
this.updateProgress();
|
|
407
|
+
this.syncTooltips();
|
|
408
|
+
}
|
|
409
|
+
// ---------------------------------------------------------------------------
|
|
410
|
+
// Private — helpers
|
|
411
|
+
// ---------------------------------------------------------------------------
|
|
412
|
+
handleInputEvent(handleIndex, event) {
|
|
413
|
+
const input = event?.target;
|
|
414
|
+
const targetInput = input ?? this.inputEls[handleIndex];
|
|
415
|
+
if (targetInput === undefined)
|
|
416
|
+
return;
|
|
417
|
+
let value = this.service.snapToStep(parseFloat(targetInput.value));
|
|
418
|
+
const nextValues = [...this.internalValues];
|
|
419
|
+
nextValues[handleIndex] = value;
|
|
420
|
+
const corrected = this.service.applyCollision(nextValues, handleIndex);
|
|
421
|
+
value = corrected[handleIndex] ?? value;
|
|
422
|
+
this.internalValues = corrected;
|
|
423
|
+
SliderDOMController.updateInputValue(targetInput, value);
|
|
424
|
+
this.updateProgress();
|
|
425
|
+
this.syncTooltip(handleIndex, value);
|
|
426
|
+
this.syncFormValue();
|
|
427
|
+
}
|
|
428
|
+
handleChangeEvent(handleIndex, event) {
|
|
429
|
+
this.handleInputEvent(handleIndex, event);
|
|
430
|
+
if (this.isDisabled)
|
|
431
|
+
return;
|
|
432
|
+
this.emitChange([...this.internalValues]);
|
|
433
|
+
}
|
|
434
|
+
onHandleFocus(handleIndex) {
|
|
435
|
+
SliderDOMController.addTooltipsStates(this.tooltipEls[handleIndex], this.blockClass);
|
|
436
|
+
}
|
|
437
|
+
onHandleBlur(handleIndex) {
|
|
438
|
+
SliderDOMController.removeTooltipsStates(this.tooltipEls[handleIndex], this.blockClass);
|
|
439
|
+
}
|
|
440
|
+
onHandleInactive(handleIndex) {
|
|
441
|
+
const input = this.inputEls[handleIndex];
|
|
442
|
+
SliderDOMController.removeTooltipsStates(input, this.blockClass);
|
|
443
|
+
input.blur();
|
|
444
|
+
}
|
|
445
|
+
syncInputsToValues() {
|
|
446
|
+
SliderDOMController.syncTooltips(this.internalValues, this.inputEls);
|
|
447
|
+
}
|
|
448
|
+
updateProgress() {
|
|
449
|
+
if (this.connectEl === undefined || this.service === undefined)
|
|
450
|
+
return;
|
|
451
|
+
const segment = this.service.getConnectSegment(this.internalValues);
|
|
452
|
+
SliderDOMController.moveConnect(this.connectEl, segment);
|
|
453
|
+
}
|
|
454
|
+
syncTooltip(handleIndex, value) {
|
|
455
|
+
const tooltip = this.tooltipEls[handleIndex];
|
|
456
|
+
if (tooltip === undefined)
|
|
457
|
+
return;
|
|
458
|
+
tooltip.textContent = String(value);
|
|
459
|
+
tooltip.style.left = `${this.getThumbPosition(value)}px`;
|
|
460
|
+
}
|
|
461
|
+
syncTooltips() {
|
|
462
|
+
this.internalValues.forEach((value, index) => {
|
|
463
|
+
this.syncTooltip(index, value);
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
resolveValues(raw) {
|
|
467
|
+
const service = this.service;
|
|
468
|
+
return resolveValues(raw, this.min, this.max, this.type).map(value => service.clamp(value));
|
|
469
|
+
}
|
|
470
|
+
updateValues(next, shouldEmit = true) {
|
|
471
|
+
this.internalValues = next;
|
|
472
|
+
if (shouldEmit) {
|
|
473
|
+
this.emitChange(next);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
emitChange(values) {
|
|
477
|
+
if (this.isDisabled)
|
|
478
|
+
return;
|
|
479
|
+
const payload = { value: values };
|
|
480
|
+
this.bdsChange.emit(payload);
|
|
481
|
+
this.valueChange.emit(values);
|
|
482
|
+
this.syncFormValue();
|
|
483
|
+
}
|
|
484
|
+
isHandleDisabled(value) {
|
|
485
|
+
const disabledValues = parseValues(this.disabledHandlers, []);
|
|
486
|
+
return this.isDisabled || disabledValues.includes(value);
|
|
487
|
+
}
|
|
488
|
+
getPipPositions() {
|
|
489
|
+
if (this.service === undefined)
|
|
490
|
+
return [];
|
|
491
|
+
return this.service.getPipPositions();
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Returns the CSS modifier class map for the slider component.
|
|
495
|
+
*
|
|
496
|
+
* Includes visual state modifiers such as disabled,
|
|
497
|
+
* discrete mode, and tooltip behavior.
|
|
498
|
+
*/
|
|
499
|
+
get classMap() {
|
|
500
|
+
const blockClass = 'bds-slider';
|
|
501
|
+
return {
|
|
502
|
+
[blockClass]: true,
|
|
503
|
+
[`${blockClass}--disabled`]: this.isDisabled,
|
|
504
|
+
[`${blockClass}--discrete`]: this.isDiscrete,
|
|
505
|
+
[`${blockClass}--label`]: Boolean(this.label.trim()),
|
|
506
|
+
[`${blockClass}--tooltip`]: Boolean(this.tooltip) && this.tooltip !== SLIDER_TOOLTIP.NEVER && this.isDisabled === false,
|
|
507
|
+
[`${blockClass}--tooltip-never`]: this.tooltip === SLIDER_TOOLTIP.NEVER,
|
|
508
|
+
[`${blockClass}--tooltip-focus`]: this.tooltip === SLIDER_TOOLTIP.FOCUS,
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
// ---------------------------------------------------------------------------
|
|
512
|
+
// Private — Render helpers
|
|
513
|
+
// ---------------------------------------------------------------------------
|
|
514
|
+
getThumbPosition(value) {
|
|
515
|
+
if (this.trackEl === undefined || this.service === undefined)
|
|
516
|
+
return 0;
|
|
517
|
+
const trackWidth = this.trackEl.getBoundingClientRect().width;
|
|
518
|
+
const thumbSize = parseFloat(getComputedStyle(this.el).getPropertyValue('--handle-size')) || 16;
|
|
519
|
+
return this.service.getThumbCSSPosition(value, trackWidth, thumbSize);
|
|
520
|
+
}
|
|
521
|
+
getThumbCSSPosition(percent) {
|
|
522
|
+
return SliderDOMController.getThumbCSSPosition(percent);
|
|
523
|
+
}
|
|
524
|
+
renderInput(handleIndex, value) {
|
|
525
|
+
const isDisabled = this.isHandleDisabled(value);
|
|
526
|
+
return (index.h("input", { class: `${this.blockClass}__input`, type: "range", min: this.min, max: this.max, step: this.step, value: value, disabled: isDisabled, "data-handle": handleIndex, "aria-valuemin": this.min, "aria-valuemax": this.max, "aria-valuenow": value, "aria-disabled": isDisabled ? 'true' : undefined, "aria-describedby": `bds-slider-tooltip-${handleIndex}`, onInput: event => this.handleInputEvent(handleIndex, event), onChange: event => this.handleChangeEvent(handleIndex, event), onFocus: () => this.onHandleFocus(handleIndex), onBlur: () => this.onHandleBlur(handleIndex), onPointerUp: () => this.onHandleInactive(handleIndex), ref: el => {
|
|
527
|
+
if (el !== undefined) {
|
|
528
|
+
this.inputEls[handleIndex] = el;
|
|
529
|
+
}
|
|
530
|
+
} }));
|
|
531
|
+
}
|
|
532
|
+
renderMinMax() {
|
|
533
|
+
if (this.showLimits === false)
|
|
534
|
+
return null;
|
|
535
|
+
return (index.h("div", { class: `${this.blockClass}__limits` }, index.h("bds-typography", { variant: "helper" }, this.min), index.h("bds-typography", { variant: "helper" }, this.max)));
|
|
536
|
+
}
|
|
537
|
+
handleTrackClick(event) {
|
|
538
|
+
if (this.isDisabled || this.trackEl === undefined)
|
|
539
|
+
return;
|
|
540
|
+
const target = event.target;
|
|
541
|
+
if (target.classList.contains(`${this.blockClass}__input`))
|
|
542
|
+
return;
|
|
543
|
+
const rect = this.trackEl.getBoundingClientRect();
|
|
544
|
+
const percent = Math.min(Math.max((event.clientX - rect.left) / rect.width, 0), 1);
|
|
545
|
+
const rawValue = Number(this.min) + percent * (Number(this.max) - Number(this.min));
|
|
546
|
+
const value = this.service.snapToStep(rawValue);
|
|
547
|
+
const nextValues = [...this.internalValues];
|
|
548
|
+
if (this.type === SLIDER_TYPE.SINGLE) {
|
|
549
|
+
if (this.isHandleDisabled(nextValues[0]))
|
|
550
|
+
return;
|
|
551
|
+
nextValues[0] = value;
|
|
552
|
+
this.internalValues = nextValues;
|
|
553
|
+
}
|
|
554
|
+
else {
|
|
555
|
+
const [minValue, maxValue] = nextValues;
|
|
556
|
+
const distanceToMin = Math.abs(value - minValue);
|
|
557
|
+
const distanceToMax = Math.abs(value - maxValue);
|
|
558
|
+
const targetHandle = distanceToMin <= distanceToMax ? 0 : 1;
|
|
559
|
+
if (this.isHandleDisabled(nextValues[targetHandle]))
|
|
560
|
+
return;
|
|
561
|
+
nextValues[targetHandle] = value;
|
|
562
|
+
this.internalValues = this.service.applyCollision(nextValues, targetHandle);
|
|
563
|
+
}
|
|
564
|
+
this.syncDOMUpdates();
|
|
565
|
+
this.emitChange([...this.internalValues]);
|
|
566
|
+
}
|
|
567
|
+
renderTooltip(handleIndex, value) {
|
|
568
|
+
if (this.tooltip === SLIDER_TOOLTIP.NEVER)
|
|
569
|
+
return null;
|
|
570
|
+
return (index.h("div", { id: `bds-slider-tooltip-${handleIndex}`, class: {
|
|
571
|
+
[`${this.blockClass}__tooltip`]: true,
|
|
572
|
+
[`${this.blockClass}__tooltip--${this.tooltip}`]: true,
|
|
573
|
+
}, role: "tooltip", onClick: event => {
|
|
574
|
+
event.stopPropagation();
|
|
575
|
+
}, style: {
|
|
576
|
+
left: `${this.service?.toPercent(value) ?? 0}%`,
|
|
577
|
+
}, ref: el => {
|
|
578
|
+
if (el !== undefined) {
|
|
579
|
+
this.tooltipEls[handleIndex] = el;
|
|
580
|
+
}
|
|
581
|
+
} }, value));
|
|
582
|
+
}
|
|
583
|
+
renderPips() {
|
|
584
|
+
if (!this.isDiscrete)
|
|
585
|
+
return null;
|
|
586
|
+
return (index.h("div", { class: `${this.blockClass}__pips` }, this.getPipPositions().map((percent, index$1) => (index.h("div", { key: `pip-${index$1}`, class: `${this.blockClass}__pip`, style: { left: this.getThumbCSSPosition(percent) } })))));
|
|
587
|
+
}
|
|
588
|
+
renderLabel() {
|
|
589
|
+
if (this.label.trim() === '' || this.label === undefined)
|
|
590
|
+
return null;
|
|
591
|
+
return (index.h("bds-typography", { class: `${this.blockClass}__label`, htmlFor: this.el.id, variant: "label" }, this.label));
|
|
592
|
+
}
|
|
593
|
+
// ---------------------------------------------------------------------------
|
|
594
|
+
// Lifecycle
|
|
595
|
+
// ---------------------------------------------------------------------------
|
|
596
|
+
componentWillLoad() {
|
|
597
|
+
this.isDisabled = this.disabled;
|
|
598
|
+
this.isDiscrete = this.discrete;
|
|
599
|
+
this.buildAdapter();
|
|
600
|
+
this.internalValues = this.resolveValues(this.value);
|
|
601
|
+
}
|
|
602
|
+
componentDidLoad() {
|
|
603
|
+
this.syncDOMUpdates();
|
|
604
|
+
}
|
|
605
|
+
componentDidUpdate() {
|
|
606
|
+
this.syncDOMUpdates();
|
|
607
|
+
}
|
|
608
|
+
disconnectedCallback() {
|
|
609
|
+
this.inputEls = [];
|
|
610
|
+
this.tooltipEls = [];
|
|
611
|
+
}
|
|
612
|
+
// ---------------------------------------------------------------------------
|
|
613
|
+
// Render
|
|
614
|
+
// ---------------------------------------------------------------------------
|
|
615
|
+
render() {
|
|
616
|
+
return (index.h(index.Host, { key: 'd883f67c2dfc80f8b97f2d7394b99ad6c30798fa', class: this.classMap, "aria-disabled": this.isDisabled ? 'true' : undefined, onClick: this.handleClick }, this.renderLabel(), index.h("div", { key: '2704c76fbc751029ca89519950dfb90c3294d5e7', class: `${this.blockClass}__wrapper`, onClick: event => this.handleTrackClick(event) }, index.h("div", { key: 'db67ea023a4f200069e68e02281539378e9e39db', class: `${this.blockClass}__track-base`, ref: el => {
|
|
617
|
+
if (el !== undefined)
|
|
618
|
+
this.trackEl = el;
|
|
619
|
+
} }), index.h("div", { key: '02163060bb531de138aae3ad1a4e7f221e7c127f', class: `${this.blockClass}__connect`, ref: el => {
|
|
620
|
+
if (el !== undefined)
|
|
621
|
+
this.connectEl = el;
|
|
622
|
+
} }), this.renderPips(), this.internalValues.map((value, index) => this.renderInput(index, value)), this.internalValues.map((value, index) => this.renderTooltip(index, value))), this.renderMinMax()));
|
|
623
|
+
}
|
|
624
|
+
static get formAssociated() { return true; }
|
|
625
|
+
get el() { return index.getElement(this); }
|
|
626
|
+
static get watchers() { return {
|
|
627
|
+
"disabled": [{
|
|
628
|
+
"onDisabledChange": 0
|
|
629
|
+
}],
|
|
630
|
+
"disabledHandlers": [{
|
|
631
|
+
"onDisabledHandlersChange": 0
|
|
632
|
+
}],
|
|
633
|
+
"value": [{
|
|
634
|
+
"onValueChange": 0
|
|
635
|
+
}],
|
|
636
|
+
"type": [{
|
|
637
|
+
"onConfigChange": 0
|
|
638
|
+
}],
|
|
639
|
+
"discrete": [{
|
|
640
|
+
"onConfigChange": 0
|
|
641
|
+
}],
|
|
642
|
+
"min": [{
|
|
643
|
+
"onRangeChange": 0
|
|
644
|
+
}],
|
|
645
|
+
"max": [{
|
|
646
|
+
"onRangeChange": 0
|
|
647
|
+
}],
|
|
648
|
+
"step": [{
|
|
649
|
+
"onRangeChange": 0
|
|
650
|
+
}]
|
|
651
|
+
}; }
|
|
652
|
+
};
|
|
653
|
+
BdsSlider.style = bdsSliderCss();
|
|
654
|
+
|
|
655
|
+
exports.bds_slider = BdsSlider;
|