@material/web 2.5.1-nightly.70e259d.0 → 2.5.1-nightly.8f78cc3.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/button/internal/button.d.ts +10 -0
- package/button/internal/button.js +27 -4
- package/button/internal/button.js.map +1 -1
- package/checkbox/internal/checkbox.js +2 -1
- package/checkbox/internal/checkbox.js.map +1 -1
- package/chips/internal/assist-chip.d.ts +10 -0
- package/chips/internal/assist-chip.js +23 -2
- package/chips/internal/assist-chip.js.map +1 -1
- package/chips/internal/chip.js +3 -1
- package/chips/internal/chip.js.map +1 -1
- package/chips/internal/filter-chip.js +2 -1
- package/chips/internal/filter-chip.js.map +1 -1
- package/chips/internal/input-chip.d.ts +10 -0
- package/chips/internal/input-chip.js +27 -3
- package/chips/internal/input-chip.js.map +1 -1
- package/custom-elements.json +16806 -7092
- package/dialog/internal/dialog.js +2 -1
- package/dialog/internal/dialog.js.map +1 -1
- package/fab/internal/shared.js +3 -2
- package/fab/internal/shared.js.map +1 -1
- package/field/internal/_content.scss +4 -0
- package/field/internal/_shared.scss +12 -0
- package/field/internal/shared-styles.css +1 -1
- package/field/internal/shared-styles.css.map +1 -1
- package/field/internal/shared-styles.cssresult.js +1 -1
- package/field/internal/shared-styles.cssresult.js.map +1 -1
- package/iconbutton/internal/icon-button.d.ts +10 -0
- package/iconbutton/internal/icon-button.js +26 -5
- package/iconbutton/internal/icon-button.js.map +1 -1
- package/internal/aria/aria.d.ts +1 -0
- package/internal/aria/aria.js +1 -0
- package/internal/aria/aria.js.map +1 -1
- package/internal/directives/safe-href.d.ts +23 -0
- package/internal/directives/safe-href.js +44 -0
- package/internal/directives/safe-href.js.map +1 -0
- package/labs/aria/buttons/keyboard_click_handler.d.ts +25 -0
- package/labs/aria/buttons/keyboard_click_handler.js +74 -0
- package/labs/aria/buttons/keyboard_click_handler.js.map +1 -0
- package/labs/aria/buttons/md-aria-toggle.d.ts +29 -0
- package/labs/aria/buttons/md-aria-toggle.js +67 -0
- package/labs/aria/buttons/md-aria-toggle.js.map +1 -0
- package/labs/aria/buttons/toggle.d.ts +40 -0
- package/labs/aria/buttons/toggle.js +100 -0
- package/labs/aria/buttons/toggle.js.map +1 -0
- package/labs/aria/command.d.ts +18 -0
- package/labs/aria/command.js +204 -0
- package/labs/aria/command.js.map +1 -0
- package/labs/aria/menu/fieldset.d.ts +36 -0
- package/labs/aria/menu/fieldset.js +103 -0
- package/labs/aria/menu/fieldset.js.map +1 -0
- package/labs/aria/menu/internal.d.ts +15 -0
- package/labs/aria/menu/internal.js +16 -0
- package/labs/aria/menu/internal.js.map +1 -0
- package/labs/aria/menu/md-aria-fieldset.d.ts +11 -0
- package/labs/aria/menu/md-aria-fieldset.js +8 -0
- package/labs/aria/menu/md-aria-fieldset.js.map +1 -0
- package/labs/aria/menu/md-aria-menubar.d.ts +11 -0
- package/labs/aria/menu/md-aria-menubar.js +8 -0
- package/labs/aria/menu/md-aria-menubar.js.map +1 -0
- package/labs/aria/menu/md-aria-menuitem.d.ts +11 -0
- package/labs/aria/menu/md-aria-menuitem.js +8 -0
- package/labs/aria/menu/md-aria-menuitem.js.map +1 -0
- package/labs/aria/menu/md-aria-menulist.d.ts +11 -0
- package/labs/aria/menu/md-aria-menulist.js +8 -0
- package/labs/aria/menu/md-aria-menulist.js.map +1 -0
- package/labs/aria/menu/menubar.d.ts +15 -0
- package/labs/aria/menu/menubar.js +45 -0
- package/labs/aria/menu/menubar.js.map +1 -0
- package/labs/aria/menu/menuitem.d.ts +59 -0
- package/labs/aria/menu/menuitem.js +237 -0
- package/labs/aria/menu/menuitem.js.map +1 -0
- package/labs/aria/menu/menulist.d.ts +21 -0
- package/labs/aria/menu/menulist.js +104 -0
- package/labs/aria/menu/menulist.js.map +1 -0
- package/labs/aria/menu/shared-slotted-content.d.ts +10 -0
- package/labs/aria/menu/shared-slotted-content.js +51 -0
- package/labs/aria/menu/shared-slotted-content.js.map +1 -0
- package/labs/aria/pseudo-classes.d.ts +19 -0
- package/labs/aria/pseudo-classes.js +22 -0
- package/labs/aria/pseudo-classes.js.map +1 -0
- package/labs/aria/tabs/tab.js +5 -0
- package/labs/aria/tabs/tab.js.map +1 -1
- package/labs/aria/tabs/tablist.d.ts +3 -5
- package/labs/aria/tabs/tablist.js +23 -88
- package/labs/aria/tabs/tablist.js.map +1 -1
- package/labs/gb/components/all.d.ts +72 -0
- package/labs/gb/components/all.js +81 -0
- package/labs/gb/components/all.js.map +1 -0
- package/labs/gb/components/appbar/app-bar-element.d.ts +1 -0
- package/labs/gb/components/appbar/app-bar-element.js +1 -0
- package/labs/gb/components/appbar/app-bar-element.js.map +1 -1
- package/labs/gb/components/appbar/app-bar.css +1 -1
- package/labs/gb/components/appbar/app-bar.css.map +1 -1
- package/labs/gb/components/appbar/app-bar.cssresult.js +1 -1
- package/labs/gb/components/appbar/app-bar.cssresult.js.map +1 -1
- package/labs/gb/components/appbar/app-bar.scss +1 -0
- package/labs/gb/components/badge/badge-element.d.ts +1 -0
- package/labs/gb/components/badge/badge-element.js +1 -0
- package/labs/gb/components/badge/badge-element.js.map +1 -1
- package/labs/gb/components/badge/badge.css +1 -1
- package/labs/gb/components/badge/badge.css.map +1 -1
- package/labs/gb/components/badge/badge.cssresult.js +1 -1
- package/labs/gb/components/badge/badge.cssresult.js.map +1 -1
- package/labs/gb/components/badge/badge.scss +1 -0
- package/labs/gb/components/button/_button-tokens.scss +33 -22
- package/labs/gb/components/button/button-element.d.ts +21 -14
- package/labs/gb/components/button/button-element.js +52 -74
- package/labs/gb/components/button/button-element.js.map +1 -1
- package/labs/gb/components/button/button.css +1 -1
- package/labs/gb/components/button/button.css.map +1 -1
- package/labs/gb/components/button/button.cssresult.js +1 -1
- package/labs/gb/components/button/button.cssresult.js.map +1 -1
- package/labs/gb/components/button/button.js +1 -1
- package/labs/gb/components/button/button.js.map +1 -1
- package/labs/gb/components/button/button.scss +19 -9
- package/labs/gb/components/buttongroup/_button-group-tokens.scss +124 -0
- package/labs/gb/components/buttongroup/button-group-element.d.ts +68 -0
- package/labs/gb/components/buttongroup/button-group-element.js +320 -0
- package/labs/gb/components/buttongroup/button-group-element.js.map +1 -0
- package/labs/gb/components/buttongroup/button-group.css +5 -0
- package/labs/gb/components/buttongroup/button-group.css.map +1 -0
- package/labs/gb/components/buttongroup/button-group.cssresult.d.ts +3 -0
- package/labs/gb/components/buttongroup/button-group.cssresult.js +15 -0
- package/labs/gb/components/buttongroup/button-group.cssresult.js.map +1 -0
- package/labs/gb/components/buttongroup/button-group.d.ts +96 -0
- package/labs/gb/components/buttongroup/button-group.js +105 -0
- package/labs/gb/components/buttongroup/button-group.js.map +1 -0
- package/labs/gb/components/buttongroup/button-group.scss +335 -0
- package/labs/gb/components/buttongroup/md-gb-button-group.d.ts +12 -0
- package/labs/gb/components/buttongroup/md-gb-button-group.js +8 -0
- package/labs/gb/components/buttongroup/md-gb-button-group.js.map +1 -0
- package/labs/gb/components/card/card-element.d.ts +2 -9
- package/labs/gb/components/card/card-element.js +8 -61
- package/labs/gb/components/card/card-element.js.map +1 -1
- package/labs/gb/components/card/card.css +1 -1
- package/labs/gb/components/card/card.css.map +1 -1
- package/labs/gb/components/card/card.cssresult.js +1 -1
- package/labs/gb/components/card/card.cssresult.js.map +1 -1
- package/labs/gb/components/card/card.scss +18 -5
- package/labs/gb/components/checkbox/checkbox-element.d.ts +1 -0
- package/labs/gb/components/checkbox/checkbox-element.js +3 -1
- package/labs/gb/components/checkbox/checkbox-element.js.map +1 -1
- package/labs/gb/components/checkbox/checkbox.css +1 -1
- package/labs/gb/components/checkbox/checkbox.css.map +1 -1
- package/labs/gb/components/checkbox/checkbox.cssresult.js +1 -1
- package/labs/gb/components/checkbox/checkbox.cssresult.js.map +1 -1
- package/labs/gb/components/checkbox/checkbox.scss +1 -0
- package/labs/gb/components/chip/chip-element.d.ts +11 -0
- package/labs/gb/components/chip/chip-element.js +28 -6
- package/labs/gb/components/chip/chip-element.js.map +1 -1
- package/labs/gb/components/chip/chip.css +1 -1
- package/labs/gb/components/chip/chip.css.map +1 -1
- package/labs/gb/components/chip/chip.cssresult.js +1 -1
- package/labs/gb/components/chip/chip.cssresult.js.map +1 -1
- package/labs/gb/components/chip/chip.js +1 -1
- package/labs/gb/components/chip/chip.js.map +1 -1
- package/labs/gb/components/chip/chip.scss +5 -1
- package/labs/gb/components/divider/divider-element.d.ts +1 -0
- package/labs/gb/components/divider/divider-element.js +1 -0
- package/labs/gb/components/divider/divider-element.js.map +1 -1
- package/labs/gb/components/fab/_fab-tokens.scss +4 -1
- package/labs/gb/components/fab/fab-element.d.ts +2 -0
- package/labs/gb/components/fab/fab-element.js +2 -0
- package/labs/gb/components/fab/fab-element.js.map +1 -1
- package/labs/gb/components/fab/fab.css +1 -1
- package/labs/gb/components/fab/fab.css.map +1 -1
- package/labs/gb/components/fab/fab.cssresult.js +1 -1
- package/labs/gb/components/fab/fab.cssresult.js.map +1 -1
- package/labs/gb/components/fab/fab.scss +3 -2
- package/labs/gb/components/iconbutton/_icon-button-tokens.scss +13 -4
- package/labs/gb/components/iconbutton/icon-button-element.d.ts +15 -1
- package/labs/gb/components/iconbutton/icon-button-element.js +42 -6
- package/labs/gb/components/iconbutton/icon-button-element.js.map +1 -1
- package/labs/gb/components/iconbutton/icon-button.css +1 -1
- package/labs/gb/components/iconbutton/icon-button.css.map +1 -1
- package/labs/gb/components/iconbutton/icon-button.cssresult.js +1 -1
- package/labs/gb/components/iconbutton/icon-button.cssresult.js.map +1 -1
- package/labs/gb/components/iconbutton/icon-button.js +1 -1
- package/labs/gb/components/iconbutton/icon-button.js.map +1 -1
- package/labs/gb/components/iconbutton/icon-button.scss +13 -2
- package/labs/gb/components/list/_list-tokens.scss +11 -14
- package/labs/gb/components/list/list-element.d.ts +1 -0
- package/labs/gb/components/list/list-element.js +1 -0
- package/labs/gb/components/list/list-element.js.map +1 -1
- package/labs/gb/components/list/list-item-element.d.ts +5 -0
- package/labs/gb/components/list/list-item-element.js +8 -2
- package/labs/gb/components/list/list-item-element.js.map +1 -1
- package/labs/gb/components/list/list.css +1 -1
- package/labs/gb/components/list/list.css.map +1 -1
- package/labs/gb/components/list/list.cssresult.js +1 -1
- package/labs/gb/components/list/list.cssresult.js.map +1 -1
- package/labs/gb/components/list/list.scss +7 -0
- package/labs/gb/components/menu/_menu-tokens.scss +45 -16
- package/labs/gb/components/menu/menu-element.d.ts +1 -0
- package/labs/gb/components/menu/menu-element.js +1 -0
- package/labs/gb/components/menu/menu-element.js.map +1 -1
- package/labs/gb/components/menu/menu-group-element.d.ts +1 -0
- package/labs/gb/components/menu/menu-group-element.js +1 -0
- package/labs/gb/components/menu/menu-group-element.js.map +1 -1
- package/labs/gb/components/menu/menu-item-element.d.ts +5 -1
- package/labs/gb/components/menu/menu-item-element.js +5 -1
- package/labs/gb/components/menu/menu-item-element.js.map +1 -1
- package/labs/gb/components/menu/menu.css +1 -1
- package/labs/gb/components/menu/menu.css.map +1 -1
- package/labs/gb/components/menu/menu.cssresult.js +1 -1
- package/labs/gb/components/menu/menu.cssresult.js.map +1 -1
- package/labs/gb/components/menu/menu.scss +5 -0
- package/labs/gb/components/navbar/_nav-bar-tokens.scss +57 -0
- package/labs/gb/components/navbar/md-gb-nav-bar-item.d.ts +12 -0
- package/labs/gb/components/navbar/md-gb-nav-bar-item.js +10 -0
- package/labs/gb/components/navbar/md-gb-nav-bar-item.js.map +1 -0
- package/labs/gb/components/navbar/md-gb-nav-bar.d.ts +12 -0
- package/labs/gb/components/navbar/md-gb-nav-bar.js +10 -0
- package/labs/gb/components/navbar/md-gb-nav-bar.js.map +1 -0
- package/labs/gb/components/navbar/nav-bar-element.d.ts +60 -0
- package/labs/gb/components/navbar/nav-bar-element.js +118 -0
- package/labs/gb/components/navbar/nav-bar-element.js.map +1 -0
- package/labs/gb/components/navbar/nav-bar-item-element.d.ts +41 -0
- package/labs/gb/components/navbar/nav-bar-item-element.js +150 -0
- package/labs/gb/components/navbar/nav-bar-item-element.js.map +1 -0
- package/labs/gb/components/navbar/nav-bar.css +4 -0
- package/labs/gb/components/navbar/nav-bar.css.map +1 -0
- package/labs/gb/components/navbar/nav-bar.cssresult.d.ts +3 -0
- package/labs/gb/components/navbar/nav-bar.cssresult.js +14 -0
- package/labs/gb/components/navbar/nav-bar.cssresult.js.map +1 -0
- package/labs/gb/components/navbar/nav-bar.d.ts +86 -0
- package/labs/gb/components/navbar/nav-bar.js +92 -0
- package/labs/gb/components/navbar/nav-bar.js.map +1 -0
- package/labs/gb/components/navbar/nav-bar.scss +340 -0
- package/labs/gb/components/navrail/_nav-rail-tokens.scss +123 -0
- package/labs/gb/components/navrail/md-gb-nav-rail-item.d.ts +12 -0
- package/labs/gb/components/navrail/md-gb-nav-rail-item.js +10 -0
- package/labs/gb/components/navrail/md-gb-nav-rail-item.js.map +1 -0
- package/labs/gb/components/navrail/md-gb-nav-rail.d.ts +12 -0
- package/labs/gb/components/navrail/md-gb-nav-rail.js +10 -0
- package/labs/gb/components/navrail/md-gb-nav-rail.js.map +1 -0
- package/labs/gb/components/navrail/nav-rail-element.d.ts +120 -0
- package/labs/gb/components/navrail/nav-rail-element.js +366 -0
- package/labs/gb/components/navrail/nav-rail-element.js.map +1 -0
- package/labs/gb/components/navrail/nav-rail-item-element.d.ts +44 -0
- package/labs/gb/components/navrail/nav-rail-item-element.js +178 -0
- package/labs/gb/components/navrail/nav-rail-item-element.js.map +1 -0
- package/labs/gb/components/navrail/nav-rail.css +4 -0
- package/labs/gb/components/navrail/nav-rail.css.map +1 -0
- package/labs/gb/components/navrail/nav-rail.cssresult.d.ts +3 -0
- package/labs/gb/components/navrail/nav-rail.cssresult.js +14 -0
- package/labs/gb/components/navrail/nav-rail.cssresult.js.map +1 -0
- package/labs/gb/components/navrail/nav-rail.d.ts +108 -0
- package/labs/gb/components/navrail/nav-rail.js +115 -0
- package/labs/gb/components/navrail/nav-rail.js.map +1 -0
- package/labs/gb/components/navrail/nav-rail.scss +419 -0
- package/labs/gb/components/radio/radio-element.d.ts +1 -0
- package/labs/gb/components/radio/radio-element.js +1 -0
- package/labs/gb/components/radio/radio-element.js.map +1 -1
- package/labs/gb/components/radio/radio.css +1 -1
- package/labs/gb/components/radio/radio.css.map +1 -1
- package/labs/gb/components/radio/radio.cssresult.js +1 -1
- package/labs/gb/components/radio/radio.cssresult.js.map +1 -1
- package/labs/gb/components/radio/radio.scss +1 -0
- package/labs/gb/components/shared/fx.d.ts +67 -0
- package/labs/gb/components/shared/fx.js +106 -0
- package/labs/gb/components/shared/fx.js.map +1 -0
- package/labs/gb/components/shared/pseudo-classes.d.ts +1 -7
- package/labs/gb/components/shared/pseudo-classes.js +1 -9
- package/labs/gb/components/shared/pseudo-classes.js.map +1 -1
- package/labs/gb/components/shared/update-class-list.d.ts +22 -0
- package/labs/gb/components/shared/update-class-list.js +26 -0
- package/labs/gb/components/shared/update-class-list.js.map +1 -0
- package/labs/gb/components/slider/_slider-tokens.scss +86 -0
- package/labs/gb/components/slider/md-gb-slider.d.ts +12 -0
- package/labs/gb/components/slider/md-gb-slider.js +8 -0
- package/labs/gb/components/slider/md-gb-slider.js.map +1 -0
- package/labs/gb/components/slider/slider-element.d.ts +147 -0
- package/labs/gb/components/slider/slider-element.js +981 -0
- package/labs/gb/components/slider/slider-element.js.map +1 -0
- package/labs/gb/components/slider/slider.css +1 -0
- package/labs/gb/components/slider/slider.css.map +1 -0
- package/labs/gb/components/slider/slider.cssresult.d.ts +3 -0
- package/labs/gb/components/slider/slider.cssresult.js +11 -0
- package/labs/gb/components/slider/slider.cssresult.js.map +1 -0
- package/labs/gb/components/slider/slider.d.ts +181 -0
- package/labs/gb/components/slider/slider.js +510 -0
- package/labs/gb/components/slider/slider.js.map +1 -0
- package/labs/gb/components/slider/slider.scss +711 -0
- package/labs/gb/components/snackbar/_snackbar-tokens.scss +86 -0
- package/labs/gb/components/snackbar/harness.d.ts +32 -0
- package/labs/gb/components/snackbar/harness.js +64 -0
- package/labs/gb/components/snackbar/harness.js.map +1 -0
- package/labs/gb/components/snackbar/md-gb-snackbar.d.ts +12 -0
- package/labs/gb/components/snackbar/md-gb-snackbar.js +8 -0
- package/labs/gb/components/snackbar/md-gb-snackbar.js.map +1 -0
- package/labs/gb/components/snackbar/snackbar-element.d.ts +123 -0
- package/labs/gb/components/snackbar/snackbar-element.js +448 -0
- package/labs/gb/components/snackbar/snackbar-element.js.map +1 -0
- package/labs/gb/components/snackbar/snackbar.css +5 -0
- package/labs/gb/components/snackbar/snackbar.css.map +1 -0
- package/labs/gb/components/snackbar/snackbar.cssresult.d.ts +3 -0
- package/labs/gb/components/snackbar/snackbar.cssresult.js +15 -0
- package/labs/gb/components/snackbar/snackbar.cssresult.js.map +1 -0
- package/labs/gb/components/snackbar/snackbar.d.ts +54 -0
- package/labs/gb/components/snackbar/snackbar.js +72 -0
- package/labs/gb/components/snackbar/snackbar.js.map +1 -0
- package/labs/gb/components/snackbar/snackbar.scss +384 -0
- package/labs/gb/components/splitbutton/split-button-element.d.ts +1 -0
- package/labs/gb/components/splitbutton/split-button-element.js +1 -0
- package/labs/gb/components/splitbutton/split-button-element.js.map +1 -1
- package/labs/gb/components/switch/switch-element.d.ts +1 -0
- package/labs/gb/components/switch/switch-element.js +3 -1
- package/labs/gb/components/switch/switch-element.js.map +1 -1
- package/labs/gb/components/switch/switch.css +1 -1
- package/labs/gb/components/switch/switch.css.map +1 -1
- package/labs/gb/components/switch/switch.cssresult.js +1 -1
- package/labs/gb/components/switch/switch.cssresult.js.map +1 -1
- package/labs/gb/components/switch/switch.js +5 -2
- package/labs/gb/components/switch/switch.js.map +1 -1
- package/labs/gb/components/switch/switch.scss +4 -2
- package/labs/gb/components/tabs/_tabs-tokens.scss +177 -0
- package/labs/gb/components/tabs/md-gb-tab.d.ts +12 -0
- package/labs/gb/components/tabs/md-gb-tab.js +8 -0
- package/labs/gb/components/tabs/md-gb-tab.js.map +1 -0
- package/labs/gb/components/tabs/md-gb-tabs.d.ts +12 -0
- package/labs/gb/components/tabs/md-gb-tabs.js +8 -0
- package/labs/gb/components/tabs/md-gb-tabs.js.map +1 -0
- package/labs/gb/components/tabs/tab-element.d.ts +42 -0
- package/labs/gb/components/tabs/tab-element.js +75 -0
- package/labs/gb/components/tabs/tab-element.js.map +1 -0
- package/labs/gb/components/tabs/tabs-element.d.ts +37 -0
- package/labs/gb/components/tabs/tabs-element.js +67 -0
- package/labs/gb/components/tabs/tabs-element.js.map +1 -0
- package/labs/gb/components/tabs/tabs.css +4 -0
- package/labs/gb/components/tabs/tabs.css.map +1 -0
- package/labs/gb/components/tabs/tabs.cssresult.d.ts +3 -0
- package/labs/gb/components/tabs/tabs.cssresult.js +14 -0
- package/labs/gb/components/tabs/tabs.cssresult.js.map +1 -0
- package/labs/gb/components/tabs/tabs.d.ts +98 -0
- package/labs/gb/components/tabs/tabs.js +112 -0
- package/labs/gb/components/tabs/tabs.js.map +1 -0
- package/labs/gb/components/tabs/tabs.scss +301 -0
- package/labs/gb/components/toolbar/_toolbar-tokens.scss +70 -0
- package/labs/gb/components/toolbar/md-gb-toolbar.d.ts +12 -0
- package/labs/gb/components/toolbar/md-gb-toolbar.js +8 -0
- package/labs/gb/components/toolbar/md-gb-toolbar.js.map +1 -0
- package/labs/gb/components/toolbar/toolbar-element.d.ts +56 -0
- package/labs/gb/components/toolbar/toolbar-element.js +120 -0
- package/labs/gb/components/toolbar/toolbar-element.js.map +1 -0
- package/labs/gb/components/toolbar/toolbar.css +4 -0
- package/labs/gb/components/toolbar/toolbar.css.map +1 -0
- package/labs/gb/components/toolbar/toolbar.cssresult.d.ts +3 -0
- package/labs/gb/components/toolbar/toolbar.cssresult.js +14 -0
- package/labs/gb/components/toolbar/toolbar.cssresult.js.map +1 -0
- package/labs/gb/components/toolbar/toolbar.d.ts +56 -0
- package/labs/gb/components/toolbar/toolbar.js +60 -0
- package/labs/gb/components/toolbar/toolbar.js.map +1 -0
- package/labs/gb/components/toolbar/toolbar.scss +240 -0
- package/labs/gb/styles/icon/icon-element.d.ts +1 -0
- package/labs/gb/styles/icon/icon-element.js +1 -0
- package/labs/gb/styles/icon/icon-element.js.map +1 -1
- package/labs/gb/styles/tailwind.css +1 -1
- package/labs/gb/styles/tailwind.css.map +1 -1
- package/labs/gb/styles/tailwind.cssresult.js +1 -1
- package/labs/gb/styles/tailwind.cssresult.js.map +1 -1
- package/labs/gb/styles/tailwind.scss +2 -0
- package/labs/navigationbar/internal/navigation-bar.js +2 -1
- package/labs/navigationbar/internal/navigation-bar.js.map +1 -1
- package/labs/navigationdrawer/internal/navigation-drawer-modal.js +2 -1
- package/labs/navigationdrawer/internal/navigation-drawer-modal.js.map +1 -1
- package/labs/navigationdrawer/internal/navigation-drawer.js +2 -1
- package/labs/navigationdrawer/internal/navigation-drawer.js.map +1 -1
- package/labs/navigationtab/internal/navigation-tab.js +2 -1
- package/labs/navigationtab/internal/navigation-tab.js.map +1 -1
- package/labs/segmentedbutton/internal/segmented-button.js +2 -1
- package/labs/segmentedbutton/internal/segmented-button.js.map +1 -1
- package/labs/segmentedbuttonset/internal/segmented-button-set.js +2 -1
- package/labs/segmentedbuttonset/internal/segmented-button-set.js.map +1 -1
- package/list/internal/listitem/list-item.d.ts +10 -0
- package/list/internal/listitem/list-item.js +21 -1
- package/list/internal/listitem/list-item.js.map +1 -1
- package/menu/internal/menuitem/menu-item.d.ts +10 -0
- package/menu/internal/menuitem/menu-item.js +21 -1
- package/menu/internal/menuitem/menu-item.js.map +1 -1
- package/package.json +2 -1
- package/progress/internal/progress.js +2 -1
- package/progress/internal/progress.js.map +1 -1
- package/radio/internal/single-selection-controller.js +4 -1
- package/radio/internal/single-selection-controller.js.map +1 -1
- package/select/internal/selectoption/select-option.js +1 -0
- package/select/internal/selectoption/select-option.js.map +1 -1
- package/slider/internal/slider.js +1 -0
- package/slider/internal/slider.js.map +1 -1
- package/switch/internal/switch.js +1 -0
- package/switch/internal/switch.js.map +1 -1
- package/testing/harness.js +3 -0
- package/testing/harness.js.map +1 -1
- package/textfield/internal/_shared.scss +1 -0
- package/textfield/internal/shared-styles.css +1 -1
- package/textfield/internal/shared-styles.css.map +1 -1
- package/textfield/internal/shared-styles.cssresult.js +1 -1
- package/textfield/internal/shared-styles.cssresult.js.map +1 -1
- package/types/command-event.d.ts +34 -0
- package/types/popover.d.ts +25 -0
|
@@ -0,0 +1,981 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { __decorate } from "tslib";
|
|
7
|
+
import { html, isServer, LitElement, nothing, } from 'lit';
|
|
8
|
+
import { property, query, state } from 'lit/decorators.js';
|
|
9
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
10
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
11
|
+
import { when } from 'lit/directives/when.js';
|
|
12
|
+
import { mixinDelegatesAria } from '../../../../internal/aria/delegate.js';
|
|
13
|
+
import { dispatchActivationClick, isActivationClick, } from '../../../../internal/events/form-label-activation.js';
|
|
14
|
+
import { redispatchEvent } from '../../../../internal/events/redispatch-event.js';
|
|
15
|
+
import { mixinElementInternals } from '../../../behaviors/element-internals.js';
|
|
16
|
+
import { getFormValue, mixinFormAssociated, } from '../../../behaviors/form-associated.js';
|
|
17
|
+
import { computeSliderProperties, formatValueIndicatorLabel, handleClasses, handleNubClasses, sliderClasses, } from './slider.js';
|
|
18
|
+
import focusRingStyles from '../focus/focus-ring.css' with { type: 'css' }; // github-only
|
|
19
|
+
// import focusRingStyles from '../focus/focus-ring.cssresult.js'; // google3-only
|
|
20
|
+
import sliderStyles from './slider.css' with { type: 'css' }; // github-only
|
|
21
|
+
// Separate variable needed for closure.
|
|
22
|
+
const baseClass = mixinDelegatesAria(mixinFormAssociated(mixinElementInternals(LitElement)));
|
|
23
|
+
/**
|
|
24
|
+
* A Material Design slider component.
|
|
25
|
+
*
|
|
26
|
+
* This component does not format numbers; formatting is the application's
|
|
27
|
+
* responsibility via `valueLabel` and `ariaValueText*`.
|
|
28
|
+
* Note: An optional leading inset icon slot (`slot="icon"`) is supported on
|
|
29
|
+
* the standard horizontal slider only (not range, not centered, and not
|
|
30
|
+
* vertical) for sizes `md`, `lg`, and `xl`. Slotted icons should use
|
|
31
|
+
* `<md-gb-icon slot="icon">` (e.g.
|
|
32
|
+
* `<md-gb-icon slot="icon">volume_up</md-gb-icon>`).
|
|
33
|
+
*
|
|
34
|
+
* @fires {InputEvent} input - Fired when the slider value changes from user interaction. --bubbles --composed
|
|
35
|
+
* @fires {Event} change - Fired when the slider value commit changes from user interaction. --bubbles
|
|
36
|
+
* @cssprop --active-track-color
|
|
37
|
+
* @cssprop --inactive-track-color
|
|
38
|
+
* @cssprop --handle-color
|
|
39
|
+
* @cssprop --handle-shape
|
|
40
|
+
* @cssprop --handle-width
|
|
41
|
+
* @cssprop --focus-handle-width
|
|
42
|
+
* @cssprop --handle-height
|
|
43
|
+
* @cssprop --active-handle-leading-space
|
|
44
|
+
* @cssprop --active-track-inner-corner-size
|
|
45
|
+
* @cssprop --stop-indicator-color
|
|
46
|
+
* @cssprop --stop-indicator-color-selected
|
|
47
|
+
* @cssprop --stop-indicator-size
|
|
48
|
+
* @cssprop --stop-indicator-min-spacing
|
|
49
|
+
* @cssprop --track-height
|
|
50
|
+
* @cssprop --track-shape
|
|
51
|
+
* @cssprop --inactive-track-shape-trailing
|
|
52
|
+
* @cssprop --value-indicator-color
|
|
53
|
+
* @cssprop --value-indicator-label-text-color
|
|
54
|
+
* @cssprop --value-indicator-bottom-space
|
|
55
|
+
* @cssprop --value-indicator-width
|
|
56
|
+
* @cssprop --state-layer-size
|
|
57
|
+
* @cssprop --with-overlap-handle-outline-color
|
|
58
|
+
* @cssprop --with-overlap-handle-outline-width
|
|
59
|
+
* @cssprop --icon-size
|
|
60
|
+
* @cssprop --icon-color
|
|
61
|
+
* @cssprop --icon-color-active
|
|
62
|
+
*/
|
|
63
|
+
export class SliderElement extends baseClass {
|
|
64
|
+
get isRange() {
|
|
65
|
+
return this.range && this.orientation !== 'vertical';
|
|
66
|
+
}
|
|
67
|
+
get nameStart() {
|
|
68
|
+
return this.getAttribute('name-start') ?? this.name;
|
|
69
|
+
}
|
|
70
|
+
set nameStart(name) {
|
|
71
|
+
this.setAttribute('name-start', name);
|
|
72
|
+
}
|
|
73
|
+
get nameEnd() {
|
|
74
|
+
return this.getAttribute('name-end') ?? this.nameStart;
|
|
75
|
+
}
|
|
76
|
+
set nameEnd(name) {
|
|
77
|
+
this.setAttribute('name-end', name);
|
|
78
|
+
}
|
|
79
|
+
get dragTarget() {
|
|
80
|
+
return this.isPointerDragging
|
|
81
|
+
? this.action?.target
|
|
82
|
+
: undefined;
|
|
83
|
+
}
|
|
84
|
+
constructor() {
|
|
85
|
+
super();
|
|
86
|
+
this.min = 0;
|
|
87
|
+
this.max = 100;
|
|
88
|
+
this.step = 1;
|
|
89
|
+
this.size = 'xs';
|
|
90
|
+
/**
|
|
91
|
+
* The orientation of the slider.
|
|
92
|
+
*
|
|
93
|
+
* Vertical orientation applies to standard, discrete, and centered variants
|
|
94
|
+
* (range is not supported in vertical orientation).
|
|
95
|
+
*/
|
|
96
|
+
this.orientation = 'horizontal';
|
|
97
|
+
this.range = false;
|
|
98
|
+
this.centered = false;
|
|
99
|
+
this.ticks = false;
|
|
100
|
+
this.labeled = false;
|
|
101
|
+
this.disabled = false;
|
|
102
|
+
this.valueLabel = '';
|
|
103
|
+
this.valueLabelStart = '';
|
|
104
|
+
this.valueLabelEnd = '';
|
|
105
|
+
this.ariaLabelStart = '';
|
|
106
|
+
this.ariaLabelEnd = '';
|
|
107
|
+
this.ariaValueTextStart = '';
|
|
108
|
+
this.ariaValueTextEnd = '';
|
|
109
|
+
this.startOnTop = false;
|
|
110
|
+
this.handleStartHover = false;
|
|
111
|
+
this.handleEndHover = false;
|
|
112
|
+
this.startFocusVisible = false;
|
|
113
|
+
this.endFocusVisible = false;
|
|
114
|
+
this.handlesOverlapping = false;
|
|
115
|
+
this.isRedispatchingEvent = false;
|
|
116
|
+
this.pointerDownPending = false;
|
|
117
|
+
this.isPointerDragging = false;
|
|
118
|
+
if (!isServer) {
|
|
119
|
+
this.addEventListener('click', (event) => {
|
|
120
|
+
if (this.disabled || !isActivationClick(event) || !this.inputEnd) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
this.focus();
|
|
124
|
+
dispatchActivationClick(this.inputEnd);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
get renderAriaLabelStart() {
|
|
129
|
+
const { ariaLabel } = this;
|
|
130
|
+
return (this.ariaLabelStart ||
|
|
131
|
+
(ariaLabel && `${ariaLabel} start`) ||
|
|
132
|
+
this.valueLabelStart ||
|
|
133
|
+
(this.valueStart !== undefined ? String(this.valueStart) : ''));
|
|
134
|
+
}
|
|
135
|
+
get renderAriaValueTextStart() {
|
|
136
|
+
return (this.ariaValueTextStart ||
|
|
137
|
+
this.valueLabelStart ||
|
|
138
|
+
(this.valueStart !== undefined ? String(this.valueStart) : ''));
|
|
139
|
+
}
|
|
140
|
+
get renderAriaLabelEnd() {
|
|
141
|
+
const { ariaLabel } = this;
|
|
142
|
+
if (this.isRange) {
|
|
143
|
+
return (this.ariaLabelEnd ||
|
|
144
|
+
(ariaLabel && `${ariaLabel} end`) ||
|
|
145
|
+
this.valueLabelEnd ||
|
|
146
|
+
(this.valueEnd !== undefined ? String(this.valueEnd) : ''));
|
|
147
|
+
}
|
|
148
|
+
return (ariaLabel ||
|
|
149
|
+
this.valueLabel ||
|
|
150
|
+
(this.value !== undefined ? String(this.value) : ''));
|
|
151
|
+
}
|
|
152
|
+
get renderAriaValueTextEnd() {
|
|
153
|
+
if (this.isRange) {
|
|
154
|
+
return (this.ariaValueTextEnd ||
|
|
155
|
+
this.valueLabelEnd ||
|
|
156
|
+
(this.valueEnd !== undefined ? String(this.valueEnd) : ''));
|
|
157
|
+
}
|
|
158
|
+
const { ariaValueText } = this;
|
|
159
|
+
return (ariaValueText ||
|
|
160
|
+
this.valueLabel ||
|
|
161
|
+
(this.value !== undefined ? String(this.value) : ''));
|
|
162
|
+
}
|
|
163
|
+
focus() {
|
|
164
|
+
if (this.disabled) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
this.inputEnd?.focus();
|
|
168
|
+
}
|
|
169
|
+
connectedCallback() {
|
|
170
|
+
super.connectedCallback();
|
|
171
|
+
this.measureAndObserve();
|
|
172
|
+
}
|
|
173
|
+
disconnectedCallback() {
|
|
174
|
+
this.isPointerDragging = false;
|
|
175
|
+
this.sliderResizeObserver?.disconnect();
|
|
176
|
+
this.sliderResizeObserver = undefined;
|
|
177
|
+
super.disconnectedCallback();
|
|
178
|
+
}
|
|
179
|
+
firstUpdated(changedProperties) {
|
|
180
|
+
super.firstUpdated(changedProperties);
|
|
181
|
+
this.measureAndObserve();
|
|
182
|
+
}
|
|
183
|
+
measureAndObserve() {
|
|
184
|
+
if (isServer || !this.sliderEl)
|
|
185
|
+
return;
|
|
186
|
+
const isVertical = this.orientation === 'vertical';
|
|
187
|
+
const rect = this.sliderEl.getBoundingClientRect();
|
|
188
|
+
const initialLength = Math.round(isVertical ? rect.height : rect.width);
|
|
189
|
+
if (initialLength > 0 && this.trackLength !== initialLength) {
|
|
190
|
+
this.trackLength = initialLength;
|
|
191
|
+
}
|
|
192
|
+
if (!this.sliderResizeObserver) {
|
|
193
|
+
this.sliderResizeObserver = new ResizeObserver((entries) => {
|
|
194
|
+
for (const entry of entries) {
|
|
195
|
+
const isVert = this.orientation === 'vertical';
|
|
196
|
+
const length = Math.round(isVert ? entry.contentRect.height : entry.contentRect.width);
|
|
197
|
+
if (this.trackLength === length)
|
|
198
|
+
continue;
|
|
199
|
+
this.trackLength = length;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
this.sliderResizeObserver.observe(this.sliderEl);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
willUpdate(changed) {
|
|
206
|
+
if (changed.has('disabled') && this.disabled) {
|
|
207
|
+
this.isPointerDragging = false;
|
|
208
|
+
this.pointerDownPending = false;
|
|
209
|
+
this.handleStartHover = false;
|
|
210
|
+
this.handleEndHover = false;
|
|
211
|
+
this.startFocusVisible = false;
|
|
212
|
+
this.endFocusVisible = false;
|
|
213
|
+
this.action = undefined;
|
|
214
|
+
}
|
|
215
|
+
const rangeModeChanged = changed.has('range') || changed.has('orientation');
|
|
216
|
+
this.renderValueStart =
|
|
217
|
+
changed.has('valueStart') || rangeModeChanged
|
|
218
|
+
? this.valueStart
|
|
219
|
+
: this.inputStart?.valueAsNumber;
|
|
220
|
+
const endValueChanged = (changed.has('valueEnd') && (this.isRange || this.value === undefined)) ||
|
|
221
|
+
changed.has('value') ||
|
|
222
|
+
rangeModeChanged;
|
|
223
|
+
this.renderValueEnd = endValueChanged
|
|
224
|
+
? this.isRange
|
|
225
|
+
? this.valueEnd
|
|
226
|
+
: (this.value ?? this.valueEnd)
|
|
227
|
+
: this.inputEnd?.valueAsNumber;
|
|
228
|
+
}
|
|
229
|
+
updated(changed) {
|
|
230
|
+
if (this.isRange && this.inputStart) {
|
|
231
|
+
this.renderValueStart = this.inputStart.valueAsNumber;
|
|
232
|
+
}
|
|
233
|
+
this.renderValueEnd = this.inputEnd.valueAsNumber;
|
|
234
|
+
if (this.isRange && this.inputStart) {
|
|
235
|
+
const segment = (this.max - this.min) / 3;
|
|
236
|
+
if (this.valueStart === undefined) {
|
|
237
|
+
this.inputStart.valueAsNumber = this.min + segment;
|
|
238
|
+
const v = this.inputStart.valueAsNumber;
|
|
239
|
+
this.valueStart = this.renderValueStart = v;
|
|
240
|
+
}
|
|
241
|
+
if (this.valueEnd === undefined) {
|
|
242
|
+
this.inputEnd.valueAsNumber = this.min + 2 * segment;
|
|
243
|
+
const v = this.inputEnd.valueAsNumber;
|
|
244
|
+
this.valueEnd = this.renderValueEnd = v;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
this.value ??= this.renderValueEnd;
|
|
249
|
+
}
|
|
250
|
+
if (changed.has('range') ||
|
|
251
|
+
changed.has('orientation') ||
|
|
252
|
+
changed.has('renderValueStart') ||
|
|
253
|
+
changed.has('renderValueEnd') ||
|
|
254
|
+
this.isUpdatePending) {
|
|
255
|
+
const startNub = this.handleStart?.querySelector('.slider-handle-nub');
|
|
256
|
+
const endNub = this.handleEnd?.querySelector('.slider-handle-nub');
|
|
257
|
+
this.handlesOverlapping = this.isRange && isOverlapping(startNub, endNub);
|
|
258
|
+
}
|
|
259
|
+
this.performUpdate();
|
|
260
|
+
}
|
|
261
|
+
startAction(event) {
|
|
262
|
+
const target = event.target;
|
|
263
|
+
const fixed = target === this.inputStart ? this.inputEnd : this.inputStart;
|
|
264
|
+
this.action = {
|
|
265
|
+
canFlip: event.type === 'pointerdown',
|
|
266
|
+
flipped: false,
|
|
267
|
+
target,
|
|
268
|
+
fixed,
|
|
269
|
+
values: new Map([
|
|
270
|
+
[target, target.valueAsNumber],
|
|
271
|
+
[fixed, fixed?.valueAsNumber],
|
|
272
|
+
]),
|
|
273
|
+
};
|
|
274
|
+
this.requestUpdate();
|
|
275
|
+
}
|
|
276
|
+
finishAction() {
|
|
277
|
+
this.action = undefined;
|
|
278
|
+
this.requestUpdate();
|
|
279
|
+
}
|
|
280
|
+
computeFocusVisible(target) {
|
|
281
|
+
return !this.pointerDownPending && target.matches(':focus-visible');
|
|
282
|
+
}
|
|
283
|
+
handleKeydown(event) {
|
|
284
|
+
if (this.disabled || event.key === 'Tab' || event.defaultPrevented) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
this.startAction(event);
|
|
288
|
+
const target = event.target;
|
|
289
|
+
const isStart = target === this.inputStart;
|
|
290
|
+
const isFocusVisible = this.computeFocusVisible(target);
|
|
291
|
+
if (isStart) {
|
|
292
|
+
this.startFocusVisible = isFocusVisible;
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
this.endFocusVisible = isFocusVisible;
|
|
296
|
+
}
|
|
297
|
+
const isVertical = this.orientation === 'vertical';
|
|
298
|
+
if (isVertical && !this.disabled) {
|
|
299
|
+
const stepSize = isFinite(Number(this.step)) && Number(this.step) > 0
|
|
300
|
+
? Number(this.step)
|
|
301
|
+
: (this.max - this.min) / 100 || 1;
|
|
302
|
+
if (event.key === 'ArrowUp' || event.key === 'ArrowRight') {
|
|
303
|
+
event.preventDefault();
|
|
304
|
+
const oldVal = target.valueAsNumber;
|
|
305
|
+
if (this.step === 'any') {
|
|
306
|
+
target.valueAsNumber = Math.min(this.max, target.valueAsNumber + stepSize);
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
target.stepUp();
|
|
310
|
+
}
|
|
311
|
+
if (target.valueAsNumber !== oldVal) {
|
|
312
|
+
target.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true }));
|
|
313
|
+
target.dispatchEvent(new Event('change', { bubbles: true }));
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
else if (event.key === 'ArrowDown' || event.key === 'ArrowLeft') {
|
|
317
|
+
event.preventDefault();
|
|
318
|
+
const oldVal = target.valueAsNumber;
|
|
319
|
+
if (this.step === 'any') {
|
|
320
|
+
target.valueAsNumber = Math.max(this.min, target.valueAsNumber - stepSize);
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
target.stepDown();
|
|
324
|
+
}
|
|
325
|
+
if (target.valueAsNumber !== oldVal) {
|
|
326
|
+
target.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true }));
|
|
327
|
+
target.dispatchEvent(new Event('change', { bubbles: true }));
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
handleKeyup() {
|
|
333
|
+
this.finishAction();
|
|
334
|
+
}
|
|
335
|
+
handleDown(event) {
|
|
336
|
+
if (this.disabled) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
this.pointerDownPending = true;
|
|
340
|
+
this.isPointerDragging = event.isPrimary && event.button === 0;
|
|
341
|
+
try {
|
|
342
|
+
event.target.setPointerCapture?.(event.pointerId);
|
|
343
|
+
}
|
|
344
|
+
catch { }
|
|
345
|
+
this.startAction(event);
|
|
346
|
+
const isStart = event.target === this.inputStart;
|
|
347
|
+
// Since handle moves to pointer on down and there may not be a move,
|
|
348
|
+
// it needs to be considered hovered.
|
|
349
|
+
this.handleStartHover =
|
|
350
|
+
!this.disabled && isStart && Boolean(this.handleStart);
|
|
351
|
+
this.handleEndHover = !this.disabled && !isStart && Boolean(this.handleEnd);
|
|
352
|
+
}
|
|
353
|
+
handleMove(event) {
|
|
354
|
+
if (this.isPointerDragging && event.buttons === 0) {
|
|
355
|
+
this.isPointerDragging = false;
|
|
356
|
+
}
|
|
357
|
+
if (this.disabled) {
|
|
358
|
+
this.handleStartHover = false;
|
|
359
|
+
this.handleEndHover = false;
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
const dragTarget = this.dragTarget;
|
|
363
|
+
if (dragTarget) {
|
|
364
|
+
const isStart = dragTarget === this.inputStart;
|
|
365
|
+
this.handleStartHover = isStart && inBounds(event, this.handleStart);
|
|
366
|
+
this.handleEndHover = !isStart && inBounds(event, this.handleEnd);
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
this.applyNearestHover(event);
|
|
370
|
+
}
|
|
371
|
+
handleEnter(event) {
|
|
372
|
+
this.handleMove(event);
|
|
373
|
+
}
|
|
374
|
+
handleLeave() {
|
|
375
|
+
this.handleStartHover = false;
|
|
376
|
+
this.handleEndHover = false;
|
|
377
|
+
}
|
|
378
|
+
handleCancel() {
|
|
379
|
+
this.isPointerDragging = false;
|
|
380
|
+
this.pointerDownPending = false;
|
|
381
|
+
this.handleLeave();
|
|
382
|
+
this.startOnTop = this.action?.target === this.inputStart;
|
|
383
|
+
this.finishAction();
|
|
384
|
+
}
|
|
385
|
+
handleLostPointerCapture() {
|
|
386
|
+
this.isPointerDragging = false;
|
|
387
|
+
}
|
|
388
|
+
applyNearestHover(event) {
|
|
389
|
+
if (this.disabled) {
|
|
390
|
+
this.handleStartHover = false;
|
|
391
|
+
this.handleEndHover = false;
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
const startInBounds = inBounds(event, this.handleStart);
|
|
395
|
+
const endInBounds = inBounds(event, this.handleEnd);
|
|
396
|
+
if (!this.handleStart || !this.handleEnd) {
|
|
397
|
+
this.handleStartHover = false;
|
|
398
|
+
this.handleEndHover = Boolean(this.handleEnd && endInBounds);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
if (startInBounds && endInBounds) {
|
|
402
|
+
const distStart = distanceToCenter(event, this.handleStart);
|
|
403
|
+
const distEnd = distanceToCenter(event, this.handleEnd);
|
|
404
|
+
if (Math.abs(distStart - distEnd) < 0.5) {
|
|
405
|
+
const isStart = event.target === this.inputStart;
|
|
406
|
+
this.handleStartHover = isStart;
|
|
407
|
+
this.handleEndHover = !isStart;
|
|
408
|
+
}
|
|
409
|
+
else if (distStart < distEnd) {
|
|
410
|
+
this.handleStartHover = true;
|
|
411
|
+
this.handleEndHover = false;
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
this.handleStartHover = false;
|
|
415
|
+
this.handleEndHover = true;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
this.handleStartHover = startInBounds;
|
|
420
|
+
this.handleEndHover = endInBounds;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
handleReleaseHover(event) {
|
|
424
|
+
if (event.pointerType === 'touch') {
|
|
425
|
+
this.handleStartHover = false;
|
|
426
|
+
this.handleEndHover = false;
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
this.applyNearestHover(event);
|
|
430
|
+
}
|
|
431
|
+
async handlePointerUp(event) {
|
|
432
|
+
this.isPointerDragging = false;
|
|
433
|
+
await this.handleUp(event);
|
|
434
|
+
this.pointerDownPending = false;
|
|
435
|
+
this.handleReleaseHover(event);
|
|
436
|
+
}
|
|
437
|
+
async handleUp(event) {
|
|
438
|
+
if (!this.action) {
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
const { target, values, flipped } = this.action;
|
|
442
|
+
await new Promise(requestAnimationFrame);
|
|
443
|
+
if (target !== undefined) {
|
|
444
|
+
target.focus();
|
|
445
|
+
if (flipped && target.valueAsNumber !== values.get(target)) {
|
|
446
|
+
target.dispatchEvent(new Event('change', { bubbles: true }));
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
this.finishAction();
|
|
450
|
+
}
|
|
451
|
+
updateOnTop(input) {
|
|
452
|
+
this.startOnTop = input.classList.contains('slider-start');
|
|
453
|
+
}
|
|
454
|
+
handleFocus(event) {
|
|
455
|
+
if (this.disabled) {
|
|
456
|
+
this.startFocusVisible = false;
|
|
457
|
+
this.endFocusVisible = false;
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
const target = event.target;
|
|
461
|
+
this.updateOnTop(target);
|
|
462
|
+
const isStart = target === this.inputStart;
|
|
463
|
+
const isFocusVisible = this.computeFocusVisible(target);
|
|
464
|
+
if (isStart) {
|
|
465
|
+
this.startFocusVisible = isFocusVisible;
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
this.endFocusVisible = isFocusVisible;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
handleBlur(event) {
|
|
472
|
+
const isStart = event.target === this.inputStart;
|
|
473
|
+
if (isStart) {
|
|
474
|
+
this.startFocusVisible = false;
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
this.endFocusVisible = false;
|
|
478
|
+
}
|
|
479
|
+
if (!this.isPointerDragging &&
|
|
480
|
+
!this.pointerDownPending &&
|
|
481
|
+
event.target === this.action?.target) {
|
|
482
|
+
this.finishAction();
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
needsClamping() {
|
|
486
|
+
if (!this.action) {
|
|
487
|
+
return false;
|
|
488
|
+
}
|
|
489
|
+
const { target, fixed } = this.action;
|
|
490
|
+
const isStart = target === this.inputStart;
|
|
491
|
+
return isStart
|
|
492
|
+
? target.valueAsNumber > fixed.valueAsNumber
|
|
493
|
+
: target.valueAsNumber < fixed.valueAsNumber;
|
|
494
|
+
}
|
|
495
|
+
isActionFlipped() {
|
|
496
|
+
const { action } = this;
|
|
497
|
+
if (!action) {
|
|
498
|
+
return false;
|
|
499
|
+
}
|
|
500
|
+
const { target, fixed, values } = action;
|
|
501
|
+
if (action.canFlip) {
|
|
502
|
+
action.canFlip = false;
|
|
503
|
+
const coincident = values.get(target) === values.get(fixed);
|
|
504
|
+
if (coincident && this.needsClamping()) {
|
|
505
|
+
action.flipped = true;
|
|
506
|
+
action.target = fixed;
|
|
507
|
+
action.fixed = target;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
return action.flipped;
|
|
511
|
+
}
|
|
512
|
+
flipAction() {
|
|
513
|
+
if (!this.action) {
|
|
514
|
+
return false;
|
|
515
|
+
}
|
|
516
|
+
const { target, fixed, values } = this.action;
|
|
517
|
+
const changed = target.valueAsNumber !== fixed.valueAsNumber;
|
|
518
|
+
target.valueAsNumber = fixed.valueAsNumber;
|
|
519
|
+
fixed.valueAsNumber = values.get(fixed);
|
|
520
|
+
return changed;
|
|
521
|
+
}
|
|
522
|
+
clampAction() {
|
|
523
|
+
if (!this.needsClamping() || !this.action) {
|
|
524
|
+
return false;
|
|
525
|
+
}
|
|
526
|
+
const { target, fixed } = this.action;
|
|
527
|
+
target.valueAsNumber = fixed.valueAsNumber;
|
|
528
|
+
return true;
|
|
529
|
+
}
|
|
530
|
+
handleInput(event) {
|
|
531
|
+
if (this.disabled || this.isRedispatchingEvent) {
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
const target = event.target;
|
|
535
|
+
let stopPropagation = false;
|
|
536
|
+
let redispatch = false;
|
|
537
|
+
if (this.isRange && this.inputStart && this.inputEnd) {
|
|
538
|
+
if (this.action) {
|
|
539
|
+
if (this.isActionFlipped()) {
|
|
540
|
+
stopPropagation = true;
|
|
541
|
+
redispatch = this.flipAction();
|
|
542
|
+
}
|
|
543
|
+
if (this.clampAction()) {
|
|
544
|
+
stopPropagation = true;
|
|
545
|
+
redispatch = false;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
else if (target === this.inputStart &&
|
|
549
|
+
this.inputStart.valueAsNumber > this.inputEnd.valueAsNumber) {
|
|
550
|
+
this.inputStart.valueAsNumber = this.inputEnd.valueAsNumber;
|
|
551
|
+
stopPropagation = true;
|
|
552
|
+
}
|
|
553
|
+
else if (target === this.inputEnd &&
|
|
554
|
+
this.inputEnd.valueAsNumber < this.inputStart.valueAsNumber) {
|
|
555
|
+
this.inputEnd.valueAsNumber = this.inputStart.valueAsNumber;
|
|
556
|
+
stopPropagation = true;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
this.updateOnTop(this.action?.target ?? target);
|
|
560
|
+
if (this.isRange) {
|
|
561
|
+
this.valueStart = this.inputStart.valueAsNumber;
|
|
562
|
+
this.valueEnd = this.inputEnd.valueAsNumber;
|
|
563
|
+
}
|
|
564
|
+
else {
|
|
565
|
+
this.value = this.inputEnd.valueAsNumber;
|
|
566
|
+
}
|
|
567
|
+
if (stopPropagation) {
|
|
568
|
+
event.stopPropagation();
|
|
569
|
+
}
|
|
570
|
+
if (redispatch) {
|
|
571
|
+
this.isRedispatchingEvent = true;
|
|
572
|
+
redispatchEvent(target, event);
|
|
573
|
+
this.isRedispatchingEvent = false;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
handleChange(event) {
|
|
577
|
+
const changeTarget = event.target;
|
|
578
|
+
const { target, values } = this.action ?? {};
|
|
579
|
+
const squelch = target && target.valueAsNumber === values?.get(changeTarget);
|
|
580
|
+
if (!squelch) {
|
|
581
|
+
redispatchEvent(this, event);
|
|
582
|
+
}
|
|
583
|
+
this.finishAction();
|
|
584
|
+
}
|
|
585
|
+
[getFormValue]() {
|
|
586
|
+
if (this.isRange) {
|
|
587
|
+
const data = new FormData();
|
|
588
|
+
data.append(this.nameStart, String(this.valueStart ?? this.renderValueStart ?? this.min));
|
|
589
|
+
data.append(this.nameEnd, String(this.valueEnd ?? this.renderValueEnd ?? this.max));
|
|
590
|
+
return data;
|
|
591
|
+
}
|
|
592
|
+
return String(this.value ?? this.renderValueEnd ?? this.min);
|
|
593
|
+
}
|
|
594
|
+
formResetCallback() {
|
|
595
|
+
if (this.isRange) {
|
|
596
|
+
const valueStart = this.getAttribute('value-start');
|
|
597
|
+
this.valueStart = valueStart !== null ? Number(valueStart) : undefined;
|
|
598
|
+
const valueEnd = this.getAttribute('value-end');
|
|
599
|
+
this.valueEnd = valueEnd !== null ? Number(valueEnd) : undefined;
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
const value = this.getAttribute('value');
|
|
603
|
+
this.value = value !== null ? Number(value) : undefined;
|
|
604
|
+
}
|
|
605
|
+
formStateRestoreCallback(state) {
|
|
606
|
+
if (Array.isArray(state)) {
|
|
607
|
+
const [[, valueStart], [, valueEnd]] = state;
|
|
608
|
+
this.valueStart = Number(valueStart);
|
|
609
|
+
this.valueEnd = Number(valueEnd);
|
|
610
|
+
this.range = true;
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
this.value = Number(state);
|
|
614
|
+
this.range = false;
|
|
615
|
+
}
|
|
616
|
+
render() {
|
|
617
|
+
let minSpacing;
|
|
618
|
+
if (!isServer) {
|
|
619
|
+
const raw = getComputedStyle(this).getPropertyValue('--stop-indicator-min-spacing') ||
|
|
620
|
+
(this.sliderEl
|
|
621
|
+
? getComputedStyle(this.sliderEl).getPropertyValue('--stop-indicator-min-spacing')
|
|
622
|
+
: '');
|
|
623
|
+
const parsed = Number(raw.replace('px', '').trim());
|
|
624
|
+
if (isFinite(parsed) && parsed > 0) {
|
|
625
|
+
minSpacing = parsed;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
const isVertical = this.orientation === 'vertical';
|
|
629
|
+
const { ariaDescription } = this;
|
|
630
|
+
const isRange = this.isRange;
|
|
631
|
+
const styles = computeSliderProperties({
|
|
632
|
+
min: this.min,
|
|
633
|
+
max: this.max,
|
|
634
|
+
step: this.step,
|
|
635
|
+
size: this.size,
|
|
636
|
+
range: isRange,
|
|
637
|
+
centered: this.centered,
|
|
638
|
+
vertical: isVertical,
|
|
639
|
+
valueStart: this.renderValueStart,
|
|
640
|
+
valueEnd: this.renderValueEnd,
|
|
641
|
+
value: this.renderValueEnd,
|
|
642
|
+
trackLength: this.trackLength,
|
|
643
|
+
minSpacing,
|
|
644
|
+
});
|
|
645
|
+
const labelStart = this.valueLabelStart || formatValueIndicatorLabel(this.renderValueStart);
|
|
646
|
+
const labelEnd = (isRange ? this.valueLabelEnd : this.valueLabel) ||
|
|
647
|
+
formatValueIndicatorLabel(this.renderValueEnd);
|
|
648
|
+
const dragTarget = this.dragTarget;
|
|
649
|
+
const startOnTop = dragTarget
|
|
650
|
+
? dragTarget === this.inputStart
|
|
651
|
+
: this.startOnTop;
|
|
652
|
+
const handleStartHover = !this.disabled &&
|
|
653
|
+
this.handleStartHover &&
|
|
654
|
+
(!dragTarget || dragTarget === this.inputStart);
|
|
655
|
+
const handleEndHover = !this.disabled &&
|
|
656
|
+
this.handleEndHover &&
|
|
657
|
+
(!dragTarget || dragTarget === this.inputEnd);
|
|
658
|
+
const isCoincident = isRange &&
|
|
659
|
+
this.renderValueStart !== undefined &&
|
|
660
|
+
this.renderValueStart === this.renderValueEnd;
|
|
661
|
+
const { '--__icon-over-active': _iconOverActive, '--__start-stop-selected': _startStopSelected, '--__end-stop-selected': _endStopSelected, ...cssStyles } = styles;
|
|
662
|
+
return html `
|
|
663
|
+
<div
|
|
664
|
+
class="${classMap(sliderClasses({
|
|
665
|
+
disabled: this.disabled,
|
|
666
|
+
ranged: isRange,
|
|
667
|
+
centered: this.centered,
|
|
668
|
+
vertical: isVertical,
|
|
669
|
+
}))}"
|
|
670
|
+
style=${styleMap(cssStyles)}>
|
|
671
|
+
${when(isRange, () => html `
|
|
672
|
+
<input
|
|
673
|
+
type="range"
|
|
674
|
+
class="slider-start"
|
|
675
|
+
orient=${isVertical ? 'vertical' : nothing}
|
|
676
|
+
.tabIndex=${1}
|
|
677
|
+
?disabled=${this.disabled}
|
|
678
|
+
.min=${String(this.min)}
|
|
679
|
+
.max=${String(this.max)}
|
|
680
|
+
.step=${String(this.step)}
|
|
681
|
+
.value=${String(this.renderValueStart)}
|
|
682
|
+
aria-label=${this.renderAriaLabelStart || nothing}
|
|
683
|
+
aria-description=${ariaDescription || nothing}
|
|
684
|
+
aria-valuetext=${this.renderAriaValueTextStart || nothing}
|
|
685
|
+
aria-valuemin=${this.min}
|
|
686
|
+
aria-valuemax=${this.valueEnd ?? this.max}
|
|
687
|
+
@keydown=${this.handleKeydown}
|
|
688
|
+
@keyup=${this.handleKeyup}
|
|
689
|
+
@pointerdown=${this.handleDown}
|
|
690
|
+
@pointerup=${this.handlePointerUp}
|
|
691
|
+
@pointercancel=${this.handleCancel}
|
|
692
|
+
@lostpointercapture=${this.handleLostPointerCapture}
|
|
693
|
+
@pointerenter=${this.handleEnter}
|
|
694
|
+
@pointermove=${this.handleMove}
|
|
695
|
+
@pointerleave=${this.handleLeave}
|
|
696
|
+
@input=${this.handleInput}
|
|
697
|
+
@change=${this.handleChange}
|
|
698
|
+
@focus=${this.handleFocus}
|
|
699
|
+
@blur=${this.handleBlur} />
|
|
700
|
+
`)}
|
|
701
|
+
<input
|
|
702
|
+
type="range"
|
|
703
|
+
class="slider-end"
|
|
704
|
+
orient=${isVertical ? 'vertical' : nothing}
|
|
705
|
+
.tabIndex=${0}
|
|
706
|
+
?disabled=${this.disabled}
|
|
707
|
+
.min=${String(this.min)}
|
|
708
|
+
.max=${String(this.max)}
|
|
709
|
+
.step=${String(this.step)}
|
|
710
|
+
.value=${String(this.renderValueEnd)}
|
|
711
|
+
aria-label=${this.renderAriaLabelEnd || nothing}
|
|
712
|
+
aria-description=${ariaDescription || nothing}
|
|
713
|
+
aria-valuetext=${this.renderAriaValueTextEnd || nothing}
|
|
714
|
+
aria-valuemin=${isRange ? (this.valueStart ?? this.min) : this.min}
|
|
715
|
+
aria-valuemax=${this.max}
|
|
716
|
+
@keydown=${this.handleKeydown}
|
|
717
|
+
@keyup=${this.handleKeyup}
|
|
718
|
+
@pointerdown=${this.handleDown}
|
|
719
|
+
@pointerup=${this.handlePointerUp}
|
|
720
|
+
@pointercancel=${this.handleCancel}
|
|
721
|
+
@lostpointercapture=${this.handleLostPointerCapture}
|
|
722
|
+
@pointerenter=${this.handleEnter}
|
|
723
|
+
@pointermove=${this.handleMove}
|
|
724
|
+
@pointerleave=${this.handleLeave}
|
|
725
|
+
@input=${this.handleInput}
|
|
726
|
+
@change=${this.handleChange}
|
|
727
|
+
@focus=${this.handleFocus}
|
|
728
|
+
@blur=${this.handleBlur} />
|
|
729
|
+
|
|
730
|
+
<div class="slider-track">
|
|
731
|
+
<div
|
|
732
|
+
class="slider-inactive-lead slider-track-box ${classMap({
|
|
733
|
+
'slider-ticks': this.ticks,
|
|
734
|
+
})}"></div>
|
|
735
|
+
<div
|
|
736
|
+
class="slider-active slider-track-box ${classMap({
|
|
737
|
+
'slider-ticks': this.ticks,
|
|
738
|
+
})}"></div>
|
|
739
|
+
<div
|
|
740
|
+
class="slider-inactive-trail slider-track-box ${classMap({
|
|
741
|
+
'slider-ticks': this.ticks,
|
|
742
|
+
})}"></div>
|
|
743
|
+
${when(!this.ticks, () => html `
|
|
744
|
+
${when(isRange || this.centered, () => html `<div
|
|
745
|
+
class="slider-boundary-stop slider-start ${classMap({
|
|
746
|
+
'slider-selected': styles['--__start-stop-selected'] === '1',
|
|
747
|
+
})}"></div>`)}
|
|
748
|
+
<div
|
|
749
|
+
class="slider-boundary-stop slider-end ${classMap({
|
|
750
|
+
'slider-selected': styles['--__end-stop-selected'] === '1',
|
|
751
|
+
})}"></div>
|
|
752
|
+
`)}
|
|
753
|
+
${when(!isRange &&
|
|
754
|
+
!this.centered &&
|
|
755
|
+
!isVertical &&
|
|
756
|
+
(this.size === 'md' || this.size === 'lg' || this.size === 'xl'), () => html `
|
|
757
|
+
<div
|
|
758
|
+
class="slider-icon ${classMap({
|
|
759
|
+
'slider-over-active': styles['--__icon-over-active'] === '1',
|
|
760
|
+
})}"
|
|
761
|
+
aria-hidden="true">
|
|
762
|
+
<slot name="icon"></slot>
|
|
763
|
+
</div>
|
|
764
|
+
`)}
|
|
765
|
+
</div>
|
|
766
|
+
|
|
767
|
+
<div class="slider-handles">
|
|
768
|
+
${when(isRange, () => html `
|
|
769
|
+
<div
|
|
770
|
+
class="${classMap({
|
|
771
|
+
...handleClasses({
|
|
772
|
+
start: true,
|
|
773
|
+
hover: handleStartHover,
|
|
774
|
+
active: Boolean(!this.disabled && this.action?.target === this.inputStart),
|
|
775
|
+
focusVisible: !this.disabled && this.startFocusVisible,
|
|
776
|
+
disabled: this.disabled,
|
|
777
|
+
onTop: !this.disabled && startOnTop,
|
|
778
|
+
isOverlapping: isRange && this.handlesOverlapping,
|
|
779
|
+
}),
|
|
780
|
+
'slider-is-coincident': isCoincident,
|
|
781
|
+
})}">
|
|
782
|
+
<div
|
|
783
|
+
class="${classMap(handleNubClasses({
|
|
784
|
+
focusVisible: !this.disabled && this.startFocusVisible,
|
|
785
|
+
}))}"></div>
|
|
786
|
+
${when(this.labeled, () => html `<div class="slider-label" aria-hidden="true">
|
|
787
|
+
<span class="slider-label-content">${labelStart}</span>
|
|
788
|
+
</div>`)}
|
|
789
|
+
</div>
|
|
790
|
+
`)}
|
|
791
|
+
<div
|
|
792
|
+
class="${classMap({
|
|
793
|
+
...handleClasses({
|
|
794
|
+
end: true,
|
|
795
|
+
hover: handleEndHover,
|
|
796
|
+
active: Boolean(!this.disabled && this.action?.target === this.inputEnd),
|
|
797
|
+
focusVisible: !this.disabled && this.endFocusVisible,
|
|
798
|
+
disabled: this.disabled,
|
|
799
|
+
onTop: !this.disabled && !startOnTop,
|
|
800
|
+
isOverlapping: isRange && this.handlesOverlapping,
|
|
801
|
+
}),
|
|
802
|
+
'slider-is-coincident': isCoincident,
|
|
803
|
+
})}">
|
|
804
|
+
<div
|
|
805
|
+
class="${classMap(handleNubClasses({
|
|
806
|
+
focusVisible: !this.disabled && this.endFocusVisible,
|
|
807
|
+
}))}"></div>
|
|
808
|
+
${when(this.labeled, () => html `<div class="slider-label" aria-hidden="true">
|
|
809
|
+
<span class="slider-label-content">${labelEnd}</span>
|
|
810
|
+
</div>`)}
|
|
811
|
+
</div>
|
|
812
|
+
</div>
|
|
813
|
+
</div>
|
|
814
|
+
`;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
/** @nocollapse */
|
|
818
|
+
SliderElement.shadowRootOptions = {
|
|
819
|
+
mode: 'open',
|
|
820
|
+
delegatesFocus: true,
|
|
821
|
+
};
|
|
822
|
+
/** @nocollapse */
|
|
823
|
+
SliderElement.styles = [focusRingStyles, sliderStyles];
|
|
824
|
+
__decorate([
|
|
825
|
+
property({ type: Number })
|
|
826
|
+
], SliderElement.prototype, "min", void 0);
|
|
827
|
+
__decorate([
|
|
828
|
+
property({ type: Number })
|
|
829
|
+
], SliderElement.prototype, "max", void 0);
|
|
830
|
+
__decorate([
|
|
831
|
+
property({ type: Number })
|
|
832
|
+
], SliderElement.prototype, "value", void 0);
|
|
833
|
+
__decorate([
|
|
834
|
+
property({ type: Number, attribute: 'value-start' })
|
|
835
|
+
], SliderElement.prototype, "valueStart", void 0);
|
|
836
|
+
__decorate([
|
|
837
|
+
property({ type: Number, attribute: 'value-end' })
|
|
838
|
+
], SliderElement.prototype, "valueEnd", void 0);
|
|
839
|
+
__decorate([
|
|
840
|
+
property({
|
|
841
|
+
converter: {
|
|
842
|
+
fromAttribute(value) {
|
|
843
|
+
if (value === 'any')
|
|
844
|
+
return 'any';
|
|
845
|
+
if (value === null || value === '')
|
|
846
|
+
return 1;
|
|
847
|
+
const num = Number(value);
|
|
848
|
+
return isNaN(num) || num <= 0 ? 1 : num;
|
|
849
|
+
},
|
|
850
|
+
toAttribute(value) {
|
|
851
|
+
return String(value);
|
|
852
|
+
},
|
|
853
|
+
},
|
|
854
|
+
})
|
|
855
|
+
], SliderElement.prototype, "step", void 0);
|
|
856
|
+
__decorate([
|
|
857
|
+
property({ type: String, reflect: true })
|
|
858
|
+
], SliderElement.prototype, "size", void 0);
|
|
859
|
+
__decorate([
|
|
860
|
+
property({ type: String, reflect: true })
|
|
861
|
+
], SliderElement.prototype, "orientation", void 0);
|
|
862
|
+
__decorate([
|
|
863
|
+
property({ type: Boolean, reflect: true })
|
|
864
|
+
], SliderElement.prototype, "range", void 0);
|
|
865
|
+
__decorate([
|
|
866
|
+
property({ type: Boolean, reflect: true })
|
|
867
|
+
], SliderElement.prototype, "centered", void 0);
|
|
868
|
+
__decorate([
|
|
869
|
+
property({ type: Boolean })
|
|
870
|
+
], SliderElement.prototype, "ticks", void 0);
|
|
871
|
+
__decorate([
|
|
872
|
+
property({ type: Boolean })
|
|
873
|
+
], SliderElement.prototype, "labeled", void 0);
|
|
874
|
+
__decorate([
|
|
875
|
+
property({ type: Boolean, reflect: true })
|
|
876
|
+
], SliderElement.prototype, "disabled", void 0);
|
|
877
|
+
__decorate([
|
|
878
|
+
property({ attribute: 'value-label' })
|
|
879
|
+
], SliderElement.prototype, "valueLabel", void 0);
|
|
880
|
+
__decorate([
|
|
881
|
+
property({ attribute: 'value-label-start' })
|
|
882
|
+
], SliderElement.prototype, "valueLabelStart", void 0);
|
|
883
|
+
__decorate([
|
|
884
|
+
property({ attribute: 'value-label-end' })
|
|
885
|
+
], SliderElement.prototype, "valueLabelEnd", void 0);
|
|
886
|
+
__decorate([
|
|
887
|
+
property({ attribute: 'aria-label-start' })
|
|
888
|
+
], SliderElement.prototype, "ariaLabelStart", void 0);
|
|
889
|
+
__decorate([
|
|
890
|
+
property({ attribute: 'aria-label-end' })
|
|
891
|
+
], SliderElement.prototype, "ariaLabelEnd", void 0);
|
|
892
|
+
__decorate([
|
|
893
|
+
property({ attribute: 'aria-valuetext-start' })
|
|
894
|
+
], SliderElement.prototype, "ariaValueTextStart", void 0);
|
|
895
|
+
__decorate([
|
|
896
|
+
property({ attribute: 'aria-valuetext-end' })
|
|
897
|
+
], SliderElement.prototype, "ariaValueTextEnd", void 0);
|
|
898
|
+
__decorate([
|
|
899
|
+
query('input.slider-start')
|
|
900
|
+
], SliderElement.prototype, "inputStart", void 0);
|
|
901
|
+
__decorate([
|
|
902
|
+
query('input.slider-end')
|
|
903
|
+
], SliderElement.prototype, "inputEnd", void 0);
|
|
904
|
+
__decorate([
|
|
905
|
+
query('.slider-handle.slider-start')
|
|
906
|
+
], SliderElement.prototype, "handleStart", void 0);
|
|
907
|
+
__decorate([
|
|
908
|
+
query('.slider-handle.slider-end')
|
|
909
|
+
], SliderElement.prototype, "handleEnd", void 0);
|
|
910
|
+
__decorate([
|
|
911
|
+
query('.slider')
|
|
912
|
+
], SliderElement.prototype, "sliderEl", void 0);
|
|
913
|
+
__decorate([
|
|
914
|
+
state()
|
|
915
|
+
], SliderElement.prototype, "renderValueStart", void 0);
|
|
916
|
+
__decorate([
|
|
917
|
+
state()
|
|
918
|
+
], SliderElement.prototype, "renderValueEnd", void 0);
|
|
919
|
+
__decorate([
|
|
920
|
+
state()
|
|
921
|
+
], SliderElement.prototype, "startOnTop", void 0);
|
|
922
|
+
__decorate([
|
|
923
|
+
state()
|
|
924
|
+
], SliderElement.prototype, "handleStartHover", void 0);
|
|
925
|
+
__decorate([
|
|
926
|
+
state()
|
|
927
|
+
], SliderElement.prototype, "handleEndHover", void 0);
|
|
928
|
+
__decorate([
|
|
929
|
+
state()
|
|
930
|
+
], SliderElement.prototype, "startFocusVisible", void 0);
|
|
931
|
+
__decorate([
|
|
932
|
+
state()
|
|
933
|
+
], SliderElement.prototype, "endFocusVisible", void 0);
|
|
934
|
+
__decorate([
|
|
935
|
+
state()
|
|
936
|
+
], SliderElement.prototype, "handlesOverlapping", void 0);
|
|
937
|
+
__decorate([
|
|
938
|
+
state()
|
|
939
|
+
], SliderElement.prototype, "trackLength", void 0);
|
|
940
|
+
/**
|
|
941
|
+
* Determines whether a pointer event falls within the bounds of a handle element,
|
|
942
|
+
* applying symmetric hit-area inflation based on `--state-layer-size`.
|
|
943
|
+
*
|
|
944
|
+
* Note: Fine pointers (40px state layer with 44px handle height and 4px handle width)
|
|
945
|
+
* produce inflateX = 18px and inflateY = 0px, maintaining bit-for-bit identical behavior
|
|
946
|
+
* to the legacy horizontal-only hit slop. Coarse pointers (48px state layer) intentionally
|
|
947
|
+
* yield inflateY = 2px ((48 - 44) / 2) because the coarse touch target exceeds the 44px
|
|
948
|
+
* handle height. This is a deliberate small vertical hit-area expansion,
|
|
949
|
+
* not a regression.
|
|
950
|
+
*/
|
|
951
|
+
function inBounds({ x, y }, element) {
|
|
952
|
+
if (!element) {
|
|
953
|
+
return false;
|
|
954
|
+
}
|
|
955
|
+
const { top, left, bottom, right } = element.getBoundingClientRect();
|
|
956
|
+
const rawSize = getComputedStyle(element).getPropertyValue('--state-layer-size');
|
|
957
|
+
const size = Number(rawSize.replace('px', '').trim()) || 0;
|
|
958
|
+
const inflateX = Math.max(0, (size - (right - left)) / 2);
|
|
959
|
+
const inflateY = Math.max(0, (size - (bottom - top)) / 2);
|
|
960
|
+
return (x >= left - inflateX &&
|
|
961
|
+
x <= right + inflateX &&
|
|
962
|
+
y >= top - inflateY &&
|
|
963
|
+
y <= bottom + inflateY);
|
|
964
|
+
}
|
|
965
|
+
function distanceToCenter({ x, y }, element) {
|
|
966
|
+
const { top, left, bottom, right } = element.getBoundingClientRect();
|
|
967
|
+
const cx = left + (right - left) / 2;
|
|
968
|
+
const cy = top + (bottom - top) / 2;
|
|
969
|
+
return Math.hypot(x - cx, y - cy);
|
|
970
|
+
}
|
|
971
|
+
function isOverlapping(elA, elB) {
|
|
972
|
+
if (!(elA && elB))
|
|
973
|
+
return false;
|
|
974
|
+
const a = elA.getBoundingClientRect();
|
|
975
|
+
const b = elB.getBoundingClientRect();
|
|
976
|
+
return !(a.top > b.bottom ||
|
|
977
|
+
a.right < b.left ||
|
|
978
|
+
a.bottom < b.top ||
|
|
979
|
+
a.left > b.right);
|
|
980
|
+
}
|
|
981
|
+
//# sourceMappingURL=slider-element.js.map
|