@material/web 1.0.0-pre.6 → 1.0.0-pre.8
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/README.md +8 -8
- package/aria/aria.d.ts +43 -0
- package/aria/aria.js +80 -0
- package/aria/aria.js.map +1 -0
- package/aria/delegate.d.ts +37 -0
- package/aria/delegate.js +53 -0
- package/aria/delegate.js.map +1 -0
- package/badge/badge.d.ts +0 -1
- package/badge/badge.js +0 -1
- package/badge/badge.js.map +1 -1
- package/badge/lib/badge.d.ts +5 -7
- package/badge/lib/badge.js +9 -12
- package/badge/lib/badge.js.map +1 -1
- package/button/lib/_elevated-button.scss +35 -6
- package/button/lib/_elevation.scss +13 -3
- package/button/lib/_filled-button.scss +35 -3
- package/button/lib/_outlined-button.scss +35 -6
- package/button/lib/_shared.scss +4 -2
- package/button/lib/_text-button.scss +35 -6
- package/button/lib/_tonal-button.scss +34 -7
- package/button/lib/button.d.ts +24 -38
- package/button/lib/button.js +40 -89
- package/button/lib/button.js.map +1 -1
- package/button/lib/elevated-button.d.ts +6 -4
- package/button/lib/elevated-button.js.map +1 -1
- package/button/lib/elevated-styles.css.js +1 -1
- package/button/lib/elevated-styles.css.js.map +1 -1
- package/button/lib/filled-button.d.ts +6 -4
- package/button/lib/filled-button.js.map +1 -1
- package/button/lib/filled-styles.css.js +1 -1
- package/button/lib/filled-styles.css.js.map +1 -1
- package/button/lib/outlined-button.d.ts +6 -4
- package/button/lib/outlined-button.js.map +1 -1
- package/button/lib/outlined-styles.css.js +1 -1
- package/button/lib/outlined-styles.css.js.map +1 -1
- package/button/lib/shared-elevation-styles.css.js +1 -1
- package/button/lib/shared-elevation-styles.css.js.map +1 -1
- package/button/lib/shared-styles.css.js +1 -1
- package/button/lib/shared-styles.css.js.map +1 -1
- package/button/lib/text-button.d.ts +5 -2
- package/button/lib/text-button.js.map +1 -1
- package/button/lib/text-styles.css.js +1 -1
- package/button/lib/text-styles.css.js.map +1 -1
- package/button/lib/tonal-button.d.ts +6 -4
- package/button/lib/tonal-button.js.map +1 -1
- package/button/lib/tonal-styles.css.js +1 -1
- package/button/lib/tonal-styles.css.js.map +1 -1
- package/checkbox/lib/_checkbox.scss +48 -47
- package/checkbox/lib/checkbox-styles.css.js +1 -1
- package/checkbox/lib/checkbox-styles.css.js.map +1 -1
- package/checkbox/lib/checkbox.d.ts +2 -7
- package/checkbox/lib/checkbox.js +35 -62
- package/checkbox/lib/checkbox.js.map +1 -1
- package/checkbox/lib/forced-colors-styles.css.js +1 -1
- package/checkbox/lib/forced-colors-styles.css.js.map +1 -1
- package/chips/_filter-chip.scss +6 -0
- package/chips/assist-chip.js +2 -1
- package/chips/assist-chip.js.map +1 -1
- package/chips/filter-chip.d.ts +20 -0
- package/chips/filter-chip.js +25 -0
- package/chips/filter-chip.js.map +1 -0
- package/chips/lib/_assist-chip.scss +37 -3
- package/chips/lib/_elevated.scss +60 -0
- package/chips/lib/_filter-chip.scss +175 -0
- package/chips/lib/_shared.scss +48 -84
- package/chips/lib/_suggestion-chip.scss +36 -5
- package/chips/lib/assist-chip.d.ts +12 -0
- package/chips/lib/assist-chip.js +64 -0
- package/chips/lib/assist-chip.js.map +1 -1
- package/chips/lib/assist-styles.css.js +1 -1
- package/chips/lib/assist-styles.css.js.map +1 -1
- package/chips/lib/chip.d.ts +24 -16
- package/chips/lib/chip.js +53 -74
- package/chips/lib/chip.js.map +1 -1
- package/chips/lib/elevated-styles.css.js +9 -0
- package/chips/lib/elevated-styles.css.js.map +1 -0
- package/{fab/lib/fab-extended-styles.scss → chips/lib/elevated-styles.scss} +3 -3
- package/chips/lib/filter-chip.d.ts +26 -0
- package/chips/lib/filter-chip.js +80 -0
- package/chips/lib/filter-chip.js.map +1 -0
- package/chips/lib/filter-styles.css.js +9 -0
- package/chips/lib/filter-styles.css.js.map +1 -0
- package/chips/lib/filter-styles.scss +10 -0
- package/chips/lib/shared-styles.css.js +1 -1
- package/chips/lib/shared-styles.css.js.map +1 -1
- package/chips/lib/suggestion-chip.d.ts +2 -2
- package/chips/lib/suggestion-chip.js +4 -2
- package/chips/lib/suggestion-chip.js.map +1 -1
- package/chips/lib/suggestion-styles.css.js +1 -1
- package/chips/lib/suggestion-styles.css.js.map +1 -1
- package/chips/suggestion-chip.js +2 -1
- package/chips/suggestion-chip.js.map +1 -1
- package/circularprogress/harness.d.ts +1 -0
- package/circularprogress/harness.js +4 -0
- package/circularprogress/harness.js.map +1 -1
- package/circularprogress/lib/_circular-progress.scss +13 -7
- package/circularprogress/lib/circular-progress-styles.css.js +1 -1
- package/circularprogress/lib/circular-progress-styles.css.js.map +1 -1
- package/circularprogress/lib/circular-progress.d.ts +5 -7
- package/circularprogress/lib/circular-progress.js +17 -21
- package/circularprogress/lib/circular-progress.js.map +1 -1
- package/dialog/lib/_dialog.scss +8 -9
- package/dialog/lib/_tokens.scss +0 -1
- package/dialog/lib/dialog-styles.css.js +1 -1
- package/dialog/lib/dialog-styles.css.js.map +1 -1
- package/dialog/lib/dialog.d.ts +10 -10
- package/dialog/lib/dialog.js +33 -56
- package/dialog/lib/dialog.js.map +1 -1
- package/divider/lib/divider.js +4 -7
- package/divider/lib/divider.js.map +1 -1
- package/elevation/lib/_elevation.scss +5 -7
- package/elevation/lib/elevation-styles.css.js +1 -1
- package/elevation/lib/elevation-styles.css.js.map +1 -1
- package/elevation/lib/elevation.d.ts +1 -1
- package/elevation/lib/elevation.js.map +1 -1
- package/fab/_fab.scss +1 -0
- package/fab/branded-fab.d.ts +56 -0
- package/fab/branded-fab.js +56 -0
- package/fab/branded-fab.js.map +1 -0
- package/fab/fab.d.ts +25 -5
- package/fab/fab.js +27 -10
- package/fab/fab.js.map +1 -1
- package/fab/harness.d.ts +1 -2
- package/fab/harness.js +1 -1
- package/fab/harness.js.map +1 -1
- package/fab/lib/_fab-branded.scss +81 -0
- package/fab/lib/_fab.scss +221 -19
- package/fab/lib/_shared.scss +161 -131
- package/fab/lib/fab-branded-styles.css.d.ts +1 -0
- package/fab/lib/fab-branded-styles.css.js +9 -0
- package/fab/lib/fab-branded-styles.css.js.map +1 -0
- package/fab/lib/fab-branded-styles.scss +10 -0
- package/fab/lib/fab-styles.css.js +1 -1
- package/fab/lib/fab-styles.css.js.map +1 -1
- package/fab/lib/fab.d.ts +18 -10
- package/fab/lib/fab.js +19 -12
- package/fab/lib/fab.js.map +1 -1
- package/fab/lib/forced-colors-styles.css.d.ts +1 -0
- package/fab/lib/forced-colors-styles.css.js +9 -0
- package/fab/lib/forced-colors-styles.css.js.map +1 -0
- package/fab/lib/forced-colors-styles.scss +26 -0
- package/fab/lib/shared-styles.css.d.ts +1 -0
- package/fab/lib/shared-styles.css.js +9 -0
- package/fab/lib/shared-styles.css.js.map +1 -0
- package/fab/lib/{fab-shared-styles.scss → shared-styles.scss} +1 -1
- package/fab/lib/shared.d.ts +49 -0
- package/fab/lib/shared.js +113 -0
- package/fab/lib/shared.js.map +1 -0
- package/field/lib/_filled-field.scss +47 -12
- package/field/lib/_outlined-field.scss +39 -12
- package/field/lib/field.js +14 -27
- package/field/lib/field.js.map +1 -1
- package/field/lib/filled-styles.css.js +1 -1
- package/field/lib/filled-styles.css.js.map +1 -1
- package/field/lib/outlined-styles.css.js +1 -1
- package/field/lib/outlined-styles.css.js.map +1 -1
- package/focus/focus-ring.d.ts +2 -1
- package/focus/focus-ring.js +2 -1
- package/focus/focus-ring.js.map +1 -1
- package/focus/lib/_focus-ring.scss +49 -34
- package/focus/lib/focus-ring-styles.css.js +1 -1
- package/focus/lib/focus-ring-styles.css.js.map +1 -1
- package/focus/lib/focus-ring.d.ts +59 -12
- package/focus/lib/focus-ring.js +118 -14
- package/focus/lib/focus-ring.js.map +1 -1
- package/icon/icon.d.ts +0 -1
- package/icon/icon.js +0 -1
- package/icon/icon.js.map +1 -1
- package/icon/lib/_icon.scss +2 -0
- package/icon/lib/icon-styles.css.js +1 -1
- package/icon/lib/icon-styles.css.js.map +1 -1
- package/icon/lib/icon.d.ts +5 -4
- package/icon/lib/icon.js +3 -2
- package/icon/lib/icon.js.map +1 -1
- package/iconbutton/filled-icon-button.d.ts +6 -2
- package/iconbutton/filled-icon-button.js.map +1 -1
- package/iconbutton/filled-tonal-icon-button.d.ts +6 -2
- package/iconbutton/filled-tonal-icon-button.js.map +1 -1
- package/iconbutton/harness.d.ts +1 -1
- package/iconbutton/harness.js +4 -1
- package/iconbutton/harness.js.map +1 -1
- package/iconbutton/lib/_filled-icon-button.scss +38 -13
- package/iconbutton/lib/_filled-tonal-icon-button.scss +38 -11
- package/iconbutton/lib/_outlined-icon-button.scss +38 -13
- package/iconbutton/lib/_shared.scss +4 -6
- package/iconbutton/lib/_standard-icon-button.scss +14 -14
- package/iconbutton/lib/filled-styles.css.js +1 -1
- package/iconbutton/lib/filled-styles.css.js.map +1 -1
- package/iconbutton/lib/filled-tonal-styles.css.js +1 -1
- package/iconbutton/lib/filled-tonal-styles.css.js.map +1 -1
- package/iconbutton/lib/icon-button.d.ts +17 -25
- package/iconbutton/lib/icon-button.js +37 -73
- package/iconbutton/lib/icon-button.js.map +1 -1
- package/iconbutton/lib/outlined-styles.css.js +1 -1
- package/iconbutton/lib/outlined-styles.css.js.map +1 -1
- package/iconbutton/lib/shared-styles.css.js +1 -1
- package/iconbutton/lib/shared-styles.css.js.map +1 -1
- package/iconbutton/lib/standard-styles.css.js +1 -1
- package/iconbutton/lib/standard-styles.css.js.map +1 -1
- package/iconbutton/outlined-icon-button.d.ts +5 -2
- package/iconbutton/outlined-icon-button.js.map +1 -1
- package/iconbutton/standard-icon-button.d.ts +5 -2
- package/iconbutton/standard-icon-button.js.map +1 -1
- package/linearprogress/_linear-progress.scss +6 -0
- package/linearprogress/harness.d.ts +13 -0
- package/linearprogress/harness.js +18 -0
- package/linearprogress/harness.js.map +1 -0
- package/linearprogress/lib/_linear-progress.scss +386 -0
- package/linearprogress/lib/linear-progress-styles.css.d.ts +1 -0
- package/linearprogress/lib/linear-progress-styles.css.js +9 -0
- package/linearprogress/lib/linear-progress-styles.css.js.map +1 -0
- package/linearprogress/lib/linear-progress-styles.scss +8 -0
- package/linearprogress/lib/linear-progress.d.ts +35 -0
- package/linearprogress/lib/linear-progress.js +127 -0
- package/linearprogress/lib/linear-progress.js.map +1 -0
- package/linearprogress/linear-progress.d.ts +23 -0
- package/linearprogress/linear-progress.js +26 -0
- package/linearprogress/linear-progress.js.map +1 -0
- package/list/lib/_list.scss +9 -50
- package/list/lib/list-styles.css.js +1 -1
- package/list/lib/list-styles.css.js.map +1 -1
- package/list/lib/list.d.ts +8 -15
- package/list/lib/list.js +20 -45
- package/list/lib/list.js.map +1 -1
- package/list/lib/listitem/_list-item.scss +17 -72
- package/list/lib/listitem/forced-colors-styles.css.js +1 -1
- package/list/lib/listitem/forced-colors-styles.css.js.map +1 -1
- package/list/lib/listitem/list-item-styles.css.js +1 -1
- package/list/lib/listitem/list-item-styles.css.js.map +1 -1
- package/list/lib/listitem/list-item.d.ts +29 -31
- package/list/lib/listitem/list-item.js +26 -80
- package/list/lib/listitem/list-item.js.map +1 -1
- package/list/lib/listitemlink/list-item-link.js +5 -9
- package/list/lib/listitemlink/list-item-link.js.map +1 -1
- package/menu/lib/_menu.scss +9 -29
- package/menu/lib/menu-styles.css.js +1 -1
- package/menu/lib/menu-styles.css.js.map +1 -1
- package/menu/lib/menu.d.ts +32 -41
- package/menu/lib/menu.js +51 -82
- package/menu/lib/menu.js.map +1 -1
- package/menu/lib/menuitem/_menu-item.scss +16 -33
- package/menu/lib/menuitem/menu-item-styles.css.js +1 -1
- package/menu/lib/menuitem/menu-item-styles.css.js.map +1 -1
- package/menu/lib/menuitem/menu-item.d.ts +1 -1
- package/menu/lib/menuitem/menu-item.js +4 -6
- package/menu/lib/menuitem/menu-item.js.map +1 -1
- package/menu/lib/menuitemlink/menu-item-link.d.ts +0 -2
- package/menu/lib/menuitemlink/menu-item-link.js +3 -6
- package/menu/lib/menuitemlink/menu-item-link.js.map +1 -1
- package/menu/lib/shared.d.ts +20 -2
- package/menu/lib/shared.js +18 -0
- package/menu/lib/shared.js.map +1 -1
- package/menu/lib/submenuitem/sub-menu-item.d.ts +16 -13
- package/menu/lib/submenuitem/sub-menu-item.js +27 -18
- package/menu/lib/submenuitem/sub-menu-item.js.map +1 -1
- package/menu/lib/typeaheadController.d.ts +9 -9
- package/menu/lib/typeaheadController.js.map +1 -1
- package/navigationbar/lib/_navigation-bar.scss +7 -1
- package/navigationbar/lib/navigation-bar-styles.css.js +1 -1
- package/navigationbar/lib/navigation-bar-styles.css.js.map +1 -1
- package/navigationbar/lib/navigation-bar.d.ts +6 -6
- package/navigationbar/lib/navigation-bar.js +17 -18
- package/navigationbar/lib/navigation-bar.js.map +1 -1
- package/navigationbar/navigation-bar.d.ts +0 -1
- package/navigationbar/navigation-bar.js +0 -1
- package/navigationbar/navigation-bar.js.map +1 -1
- package/navigationdrawer/lib/_navigation-drawer-modal.scss +0 -3
- package/navigationdrawer/lib/_navigation-drawer.scss +0 -3
- package/navigationdrawer/lib/_shared.scss +1 -4
- package/navigationdrawer/lib/navigation-drawer-modal-styles.css.js +1 -1
- package/navigationdrawer/lib/navigation-drawer-modal-styles.css.js.map +1 -1
- package/navigationdrawer/lib/navigation-drawer-modal.d.ts +7 -12
- package/navigationdrawer/lib/navigation-drawer-modal.js +19 -41
- package/navigationdrawer/lib/navigation-drawer-modal.js.map +1 -1
- package/navigationdrawer/lib/navigation-drawer-styles.css.js +1 -1
- package/navigationdrawer/lib/navigation-drawer-styles.css.js.map +1 -1
- package/navigationdrawer/lib/navigation-drawer.d.ts +6 -10
- package/navigationdrawer/lib/navigation-drawer.js +17 -38
- package/navigationdrawer/lib/navigation-drawer.js.map +1 -1
- package/navigationdrawer/lib/shared-styles.css.js +1 -1
- package/navigationdrawer/lib/shared-styles.css.js.map +1 -1
- package/navigationdrawer/navigation-drawer-modal.d.ts +0 -1
- package/navigationdrawer/navigation-drawer-modal.js +0 -1
- package/navigationdrawer/navigation-drawer-modal.js.map +1 -1
- package/navigationdrawer/navigation-drawer.d.ts +0 -1
- package/navigationdrawer/navigation-drawer.js +0 -1
- package/navigationdrawer/navigation-drawer.js.map +1 -1
- package/navigationtab/lib/_navigation-tab.scss +2 -2
- package/navigationtab/lib/navigation-tab-styles.css.js +1 -1
- package/navigationtab/lib/navigation-tab-styles.css.js.map +1 -1
- package/navigationtab/lib/navigation-tab.d.ts +16 -29
- package/navigationtab/lib/navigation-tab.js +49 -88
- package/navigationtab/lib/navigation-tab.js.map +1 -1
- package/navigationtab/lib/state.d.ts +1 -1
- package/navigationtab/lib/state.js.map +1 -1
- package/navigationtab/navigation-tab.d.ts +0 -1
- package/navigationtab/navigation-tab.js +0 -1
- package/navigationtab/navigation-tab.js.map +1 -1
- package/package.json +1 -1
- package/radio/lib/_radio.scss +1 -1
- package/radio/lib/radio-styles.css.js +1 -1
- package/radio/lib/radio-styles.css.js.map +1 -1
- package/radio/lib/radio.d.ts +2 -8
- package/radio/lib/radio.js +31 -58
- package/radio/lib/radio.js.map +1 -1
- package/ripple/lib/ripple.js +11 -13
- package/ripple/lib/ripple.js.map +1 -1
- package/segmentedbutton/lib/outlined-segmented-button.d.ts +16 -7
- package/segmentedbutton/lib/outlined-segmented-button.js +3 -3
- package/segmentedbutton/lib/outlined-segmented-button.js.map +1 -1
- package/segmentedbutton/lib/segmented-button.d.ts +28 -40
- package/segmentedbutton/lib/segmented-button.js +42 -96
- package/segmentedbutton/lib/segmented-button.js.map +1 -1
- package/segmentedbutton/outlined-segmented-button.d.ts +0 -1
- package/segmentedbutton/outlined-segmented-button.js +0 -1
- package/segmentedbutton/outlined-segmented-button.js.map +1 -1
- package/segmentedbuttonset/lib/_outlined-segmented-button-set.scss +32 -13
- package/segmentedbuttonset/lib/outlined-segmented-button-set.d.ts +6 -4
- package/segmentedbuttonset/lib/outlined-segmented-button-set.js +3 -2
- package/segmentedbuttonset/lib/outlined-segmented-button-set.js.map +1 -1
- package/segmentedbuttonset/lib/outlined-styles.css.js +1 -1
- package/segmentedbuttonset/lib/outlined-styles.css.js.map +1 -1
- package/segmentedbuttonset/lib/segmented-button-set.d.ts +3 -9
- package/segmentedbuttonset/lib/segmented-button-set.js +14 -20
- package/segmentedbuttonset/lib/segmented-button-set.js.map +1 -1
- package/segmentedbuttonset/outlined-segmented-button-set.d.ts +0 -1
- package/segmentedbuttonset/outlined-segmented-button-set.js +0 -1
- package/segmentedbuttonset/outlined-segmented-button-set.js.map +1 -1
- package/select/_filled-select.scss +6 -0
- package/select/_outlined-select.scss +6 -0
- package/select/filled-select.d.ts +41 -0
- package/select/filled-select.js +46 -0
- package/select/filled-select.js.map +1 -0
- package/select/harness.d.ts +24 -0
- package/select/harness.js +53 -0
- package/select/harness.js.map +1 -0
- package/select/lib/_filled-select.scss +222 -0
- package/select/lib/_outlined-select.scss +180 -0
- package/select/lib/_shared.scss +48 -0
- package/select/lib/filled-forced-colors-styles.css.d.ts +1 -0
- package/select/lib/filled-forced-colors-styles.css.js +9 -0
- package/select/lib/filled-forced-colors-styles.css.js.map +1 -0
- package/select/lib/filled-forced-colors-styles.scss +29 -0
- package/select/lib/filled-select-styles.css.d.ts +1 -0
- package/select/lib/filled-select-styles.css.js +9 -0
- package/select/lib/filled-select-styles.css.js.map +1 -0
- package/select/lib/filled-select-styles.scss +10 -0
- package/select/lib/filled-select.d.ts +10 -0
- package/select/lib/filled-select.js +16 -0
- package/select/lib/filled-select.js.map +1 -0
- package/select/lib/outlined-forced-colors-styles.css.d.ts +1 -0
- package/select/lib/outlined-forced-colors-styles.css.js +9 -0
- package/select/lib/outlined-forced-colors-styles.css.js.map +1 -0
- package/select/lib/outlined-forced-colors-styles.scss +29 -0
- package/select/lib/outlined-select-styles.css.d.ts +1 -0
- package/select/lib/outlined-select-styles.css.js +9 -0
- package/select/lib/outlined-select-styles.css.js.map +1 -0
- package/select/lib/outlined-select-styles.scss +10 -0
- package/select/lib/outlined-select.d.ts +10 -0
- package/select/lib/outlined-select.js +16 -0
- package/select/lib/outlined-select.js.map +1 -0
- package/select/lib/select.d.ts +216 -0
- package/select/lib/select.js +589 -0
- package/select/lib/select.js.map +1 -0
- package/select/lib/selectoption/harness.d.ts +11 -0
- package/select/lib/selectoption/harness.js +12 -0
- package/select/lib/selectoption/harness.js.map +1 -0
- package/select/lib/selectoption/select-option.d.ts +30 -0
- package/select/lib/selectoption/select-option.js +71 -0
- package/select/lib/selectoption/select-option.js.map +1 -0
- package/select/lib/shared-styles.css.d.ts +1 -0
- package/select/lib/shared-styles.css.js +9 -0
- package/select/lib/shared-styles.css.js.map +1 -0
- package/select/lib/shared-styles.scss +10 -0
- package/select/lib/shared.d.ts +52 -0
- package/select/lib/shared.js +41 -0
- package/select/lib/shared.js.map +1 -0
- package/select/outlined-select.d.ts +41 -0
- package/select/outlined-select.js +46 -0
- package/select/outlined-select.js.map +1 -0
- package/select/select-option.d.ts +44 -0
- package/select/select-option.js +51 -0
- package/select/select-option.js.map +1 -0
- package/slider/harness.d.ts +2 -1
- package/slider/harness.js +14 -9
- package/slider/harness.js.map +1 -1
- package/slider/lib/_slider.scss +149 -167
- package/slider/lib/forced-colors-styles.css.js +1 -1
- package/slider/lib/forced-colors-styles.css.js.map +1 -1
- package/slider/lib/forced-colors-styles.scss +2 -2
- package/slider/lib/slider-styles.css.js +1 -1
- package/slider/lib/slider-styles.css.js.map +1 -1
- package/slider/lib/slider.d.ts +23 -57
- package/slider/lib/slider.js +77 -167
- package/slider/lib/slider.js.map +1 -1
- package/switch/lib/_switch.scss +63 -18
- package/switch/lib/switch-styles.css.js +1 -1
- package/switch/lib/switch-styles.css.js.map +1 -1
- package/switch/lib/switch.d.ts +0 -7
- package/switch/lib/switch.js +32 -79
- package/switch/lib/switch.js.map +1 -1
- package/textfield/harness.d.ts +1 -1
- package/textfield/harness.js.map +1 -1
- package/textfield/lib/_filled-text-field.scss +70 -14
- package/textfield/lib/_outlined-text-field.scss +60 -35
- package/textfield/lib/filled-forced-colors-styles.css.js +1 -1
- package/textfield/lib/filled-forced-colors-styles.css.js.map +1 -1
- package/textfield/lib/filled-styles.css.js +1 -1
- package/textfield/lib/filled-styles.css.js.map +1 -1
- package/textfield/lib/outlined-forced-colors-styles.css.js +1 -1
- package/textfield/lib/outlined-forced-colors-styles.css.js.map +1 -1
- package/textfield/lib/outlined-styles.css.js +1 -1
- package/textfield/lib/outlined-styles.css.js.map +1 -1
- package/textfield/lib/text-field.d.ts +1 -11
- package/textfield/lib/text-field.js +45 -115
- package/textfield/lib/text-field.js.map +1 -1
- package/tokens/_index.scss +5 -18
- package/tokens/_md-comp-assist-chip.scss +25 -29
- package/tokens/_md-comp-checkbox.scss +78 -1
- package/tokens/_md-comp-circular-progress-indicator.scss +39 -13
- package/tokens/_md-comp-elevated-button.scss +0 -10
- package/tokens/_md-comp-elevation.scss +0 -4
- package/tokens/_md-comp-fab-branded.scss +84 -1
- package/tokens/_md-comp-fab.scss +249 -0
- package/tokens/_md-comp-filled-button.scss +0 -10
- package/{field/lib → tokens}/_md-comp-filled-field.scss +91 -9
- package/tokens/_md-comp-filled-icon-button.scss +46 -1
- package/tokens/_md-comp-filled-select.scss +124 -1
- package/tokens/_md-comp-filled-text-field.scss +93 -9
- package/tokens/_md-comp-filled-tonal-button.scss +0 -11
- package/tokens/_md-comp-filled-tonal-icon-button.scss +45 -3
- package/tokens/_md-comp-filter-chip.scss +103 -103
- package/tokens/_md-comp-focus-ring.scss +23 -24
- package/tokens/_md-comp-icon-button.scss +37 -1
- package/tokens/_md-comp-input-chip.scss +77 -95
- package/tokens/_md-comp-linear-progress-indicator.scss +31 -3
- package/tokens/_md-comp-list-item.scss +174 -0
- package/tokens/_md-comp-list.scss +81 -26
- package/tokens/_md-comp-menu-item.scss +50 -0
- package/tokens/_md-comp-menu.scss +29 -2
- package/tokens/_md-comp-outlined-button.scss +0 -10
- package/{field/lib → tokens}/_md-comp-outlined-field.scss +85 -9
- package/tokens/_md-comp-outlined-icon-button.scss +41 -1
- package/tokens/_md-comp-outlined-segmented-button.scss +57 -11
- package/tokens/_md-comp-outlined-select.scss +123 -1
- package/tokens/_md-comp-outlined-text-field.scss +85 -8
- package/tokens/_md-comp-slider.scss +13 -1
- package/tokens/_md-comp-suggestion-chip.scss +29 -30
- package/tokens/_md-comp-switch.scss +81 -1
- package/tokens/_md-comp-text-button.scss +0 -10
- package/tokens/_values.scss +2 -4
- package/types/aria.d.ts +59 -1
- package/actionelement/action-element.d.ts +0 -79
- package/actionelement/action-element.js +0 -97
- package/actionelement/action-element.js.map +0 -1
- package/button/lib/state.d.ts +0 -10
- package/button/lib/state.js +0 -7
- package/button/lib/state.js.map +0 -1
- package/controller/action-controller.d.ts +0 -147
- package/controller/action-controller.js +0 -286
- package/controller/action-controller.js.map +0 -1
- package/decorators/aria-property.d.ts +0 -32
- package/decorators/aria-property.js +0 -99
- package/decorators/aria-property.js.map +0 -1
- package/fab/_fab-extended.scss +0 -6
- package/fab/fab-extended.d.ts +0 -23
- package/fab/fab-extended.js +0 -29
- package/fab/fab-extended.js.map +0 -1
- package/fab/lib/_fab-extended.scss +0 -73
- package/fab/lib/fab-extended-styles.css.js +0 -9
- package/fab/lib/fab-extended-styles.css.js.map +0 -1
- package/fab/lib/fab-extended.d.ts +0 -19
- package/fab/lib/fab-extended.js +0 -28
- package/fab/lib/fab-extended.js.map +0 -1
- package/fab/lib/fab-shared-styles.css.js +0 -9
- package/fab/lib/fab-shared-styles.css.js.map +0 -1
- package/fab/lib/fab-shared.d.ts +0 -44
- package/fab/lib/fab-shared.js +0 -121
- package/fab/lib/fab-shared.js.map +0 -1
- package/focus/strong-focus.d.ts +0 -56
- package/focus/strong-focus.js +0 -96
- package/focus/strong-focus.js.map +0 -1
- package/sass/_shape.scss +0 -154
- package/slider/lib/_tokens.scss +0 -65
- package/tokens/_md-comp-extended-fab-branded.scss +0 -45
- package/tokens/_md-comp-extended-fab-primary.scss +0 -45
- package/tokens/_md-comp-extended-fab-secondary.scss +0 -48
- package/tokens/_md-comp-extended-fab-surface.scss +0 -45
- package/tokens/_md-comp-extended-fab-tertiary.scss +0 -48
- package/tokens/_md-comp-fab-branded-large.scss +0 -23
- package/tokens/_md-comp-fab-primary-large.scss +0 -23
- package/tokens/_md-comp-fab-primary-small.scss +0 -23
- package/tokens/_md-comp-fab-primary.scss +0 -23
- package/tokens/_md-comp-fab-secondary-large.scss +0 -23
- package/tokens/_md-comp-fab-secondary-small.scss +0 -23
- package/tokens/_md-comp-fab-secondary.scss +0 -23
- package/tokens/_md-comp-fab-surface-large.scss +0 -23
- package/tokens/_md-comp-fab-surface-small.scss +0 -23
- package/tokens/_md-comp-fab-surface.scss +0 -23
- package/tokens/_md-comp-fab-tertiary-large.scss +0 -23
- package/tokens/_md-comp-fab-tertiary-small.scss +0 -23
- package/tokens/_md-comp-fab-tertiary.scss +0 -23
- /package/{fab/lib/fab-extended-styles.css.d.ts → chips/lib/elevated-styles.css.d.ts} +0 -0
- /package/{fab/lib/fab-shared-styles.css.d.ts → chips/lib/filter-styles.css.d.ts} +0 -0
package/button/lib/state.js
DELETED
package/button/lib/state.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["state.ts"],"names":[],"mappings":"AAAA;;;;GAIG","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport interface ButtonState {\n disabled: boolean;\n label: string;\n trailingIcon: boolean;\n}\n"]}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2022 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
7
|
-
/**
|
|
8
|
-
* Delay time from touchstart to when element#beginPress is invoked.
|
|
9
|
-
*/
|
|
10
|
-
export declare const TOUCH_DELAY_MS = 150;
|
|
11
|
-
/**
|
|
12
|
-
* Delay time from beginning to wait for synthetic mouse events till giving up.
|
|
13
|
-
*/
|
|
14
|
-
export declare const WAIT_FOR_MOUSE_CLICK_MS = 500;
|
|
15
|
-
/**
|
|
16
|
-
* Interface for argument to beginPress.
|
|
17
|
-
*/
|
|
18
|
-
export interface BeginPressConfig {
|
|
19
|
-
/**
|
|
20
|
-
* Event that was recorded at the start of the interaction.
|
|
21
|
-
* `null` if the press happened via keyboard.
|
|
22
|
-
*/
|
|
23
|
-
positionEvent: Event | null;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Interface for argument to endPress.
|
|
27
|
-
*/
|
|
28
|
-
export interface EndPressConfig {
|
|
29
|
-
/**
|
|
30
|
-
* `true` if the press was cancelled.
|
|
31
|
-
*/
|
|
32
|
-
cancelled: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Data object to pass along to clients in the `action` event, if relevant.
|
|
35
|
-
*/
|
|
36
|
-
actionData?: {};
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* The necessary interface for using an ActionController
|
|
40
|
-
*/
|
|
41
|
-
export interface ActionControllerHost extends ReactiveControllerHost, HTMLElement {
|
|
42
|
-
disabled: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Determines if pointerdown or click events containing modifier keys should
|
|
45
|
-
* be ignored.
|
|
46
|
-
*/
|
|
47
|
-
ignoreClicksWithModifiers?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Called when a user interaction is determined to be a press.
|
|
50
|
-
*/
|
|
51
|
-
beginPress(config: BeginPressConfig): void;
|
|
52
|
-
/**
|
|
53
|
-
* Called when a press ends or is cancelled.
|
|
54
|
-
*/
|
|
55
|
-
endPress(config: EndPressConfig): void;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* ActionController normalizes user interaction on components and distills it
|
|
59
|
-
* into calling `beginPress` and `endPress` on the component.
|
|
60
|
-
*
|
|
61
|
-
* `beginPress` is a good hook to affect visuals for pressed state, including
|
|
62
|
-
* ripple.
|
|
63
|
-
*
|
|
64
|
-
* `endPress` is a good hook for firing events based on user interaction, and
|
|
65
|
-
* cleaning up the pressed visual state.
|
|
66
|
-
*
|
|
67
|
-
* A component using an ActionController need only implement the ActionElement
|
|
68
|
-
* interface and add the ActionController's event listeners to understand user
|
|
69
|
-
* interaction.
|
|
70
|
-
*/
|
|
71
|
-
export declare class ActionController implements ReactiveController {
|
|
72
|
-
private readonly element;
|
|
73
|
-
constructor(element: ActionControllerHost);
|
|
74
|
-
private get disabled();
|
|
75
|
-
private get ignoreClicksWithModifiers();
|
|
76
|
-
private phase;
|
|
77
|
-
private touchTimer;
|
|
78
|
-
private clickTimer;
|
|
79
|
-
private lastPositionEvent;
|
|
80
|
-
private pressed;
|
|
81
|
-
private checkBoundsAfterContextMenu;
|
|
82
|
-
private setPhase;
|
|
83
|
-
/**
|
|
84
|
-
* Calls beginPress and then endPress. Allows us to programmatically click
|
|
85
|
-
* on the element.
|
|
86
|
-
*/
|
|
87
|
-
private press;
|
|
88
|
-
/**
|
|
89
|
-
* Call `beginPress` on element with triggering event, if applicable.
|
|
90
|
-
*/
|
|
91
|
-
private beginPress;
|
|
92
|
-
/**
|
|
93
|
-
* Call `endPress` on element, and clean up timers.
|
|
94
|
-
*/
|
|
95
|
-
private endPress;
|
|
96
|
-
private cleanup;
|
|
97
|
-
/**
|
|
98
|
-
* Call `endPress` with cancelled state on element, and cleanup timers.
|
|
99
|
-
*/
|
|
100
|
-
private cancelPress;
|
|
101
|
-
private isTouch;
|
|
102
|
-
private touchDelayFinished;
|
|
103
|
-
private waitForClick;
|
|
104
|
-
/**
|
|
105
|
-
* Check if event should trigger actions on the element.
|
|
106
|
-
*/
|
|
107
|
-
private shouldRespondToEvent;
|
|
108
|
-
/**
|
|
109
|
-
* Check if the event is within the bounds of the element.
|
|
110
|
-
*
|
|
111
|
-
* This is only needed for the "stuck" contextmenu longpress on Chrome.
|
|
112
|
-
*/
|
|
113
|
-
private inBounds;
|
|
114
|
-
private eventHasModifiers;
|
|
115
|
-
/**
|
|
116
|
-
* Cancel interactions if the element is removed from the DOM.
|
|
117
|
-
*/
|
|
118
|
-
hostDisconnected(): void;
|
|
119
|
-
/**
|
|
120
|
-
* If the element becomes disabled, cancel interactions.
|
|
121
|
-
*/
|
|
122
|
-
hostUpdated(): void;
|
|
123
|
-
/**
|
|
124
|
-
* Pointer down event handler.
|
|
125
|
-
*/
|
|
126
|
-
pointerDown: (e: PointerEvent) => void;
|
|
127
|
-
/**
|
|
128
|
-
* Pointer up event handler.
|
|
129
|
-
*/
|
|
130
|
-
pointerUp: (e: PointerEvent) => void;
|
|
131
|
-
/**
|
|
132
|
-
* Click event handler.
|
|
133
|
-
*/
|
|
134
|
-
click: (e: MouseEvent) => void;
|
|
135
|
-
/**
|
|
136
|
-
* Pointer leave event handler.
|
|
137
|
-
*/
|
|
138
|
-
pointerLeave: (e: PointerEvent) => void;
|
|
139
|
-
/**
|
|
140
|
-
* Pointer cancel event handler.
|
|
141
|
-
*/
|
|
142
|
-
pointerCancel: (e: PointerEvent) => void;
|
|
143
|
-
/**
|
|
144
|
-
* Contextmenu event handler.
|
|
145
|
-
*/
|
|
146
|
-
contextMenu: () => void;
|
|
147
|
-
}
|
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2022 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Enumeration to keep track of the lifecycle of a touch event.
|
|
8
|
-
*/
|
|
9
|
-
// State transition diagram:
|
|
10
|
-
// +-----------------------------+
|
|
11
|
-
// | v
|
|
12
|
-
// | +------+------ WAITING_FOR_MOUSE_CLICK<----+
|
|
13
|
-
// | | | ^ |
|
|
14
|
-
// | V | | |
|
|
15
|
-
// => INACTIVE -> TOUCH_DELAY -> RELEASING HOLDING
|
|
16
|
-
// | ^
|
|
17
|
-
// | |
|
|
18
|
-
// +-----------------------------------+
|
|
19
|
-
var Phase;
|
|
20
|
-
(function (Phase) {
|
|
21
|
-
// Initial state of the control, no touch in progress.
|
|
22
|
-
// Transitions:
|
|
23
|
-
// on touch down: transition to TOUCH_DELAY.
|
|
24
|
-
// on mouse down: transition to WAITING_FOR_MOUSE_CLICK.
|
|
25
|
-
Phase["INACTIVE"] = "INACTIVE";
|
|
26
|
-
// Touch down has been received, waiting to determine if it's a swipe.
|
|
27
|
-
// Transitions:
|
|
28
|
-
// on touch up: beginPress(); transition to RELEASING.
|
|
29
|
-
// on cancel: transition to INACTIVE.
|
|
30
|
-
// after TOUCH_DELAY_MS: beginPress(); transition to HOLDING.
|
|
31
|
-
Phase["TOUCH_DELAY"] = "TOUCH_DELAY";
|
|
32
|
-
// A touch has been deemed to be a press
|
|
33
|
-
// Transitions:
|
|
34
|
-
// on pointerup: endPress(); transition to WAITING_FOR_MOUSE_CLICK.
|
|
35
|
-
Phase["HOLDING"] = "HOLDING";
|
|
36
|
-
// The user has released the mouse / touch, but we want to delay calling
|
|
37
|
-
// endPress for a little bit to avoid double clicks.
|
|
38
|
-
// Transitions:
|
|
39
|
-
// mouse sequence after debounceDelay: endPress(); transition to INACTIVE
|
|
40
|
-
// when in touch sequence: transitions directly to WAITING_FOR_MOUSE_CLICK
|
|
41
|
-
Phase["RELEASING"] = "RELEASING";
|
|
42
|
-
// The user has touched, but we want to delay endPress until synthetic mouse
|
|
43
|
-
// click event occurs. Stay in this state for a fixed amount of time before
|
|
44
|
-
// giving up and transitioning into rest state.
|
|
45
|
-
// Transitions:
|
|
46
|
-
// on click: endPress(); transition to INACTIVE.
|
|
47
|
-
// after WAIT_FOR_MOUSE_CLICK_MS: transition to INACTIVE.
|
|
48
|
-
Phase["WAITING_FOR_MOUSE_CLICK"] = "WAITING_FOR_MOUSE_CLICK";
|
|
49
|
-
})(Phase || (Phase = {}));
|
|
50
|
-
/**
|
|
51
|
-
* Delay time from touchstart to when element#beginPress is invoked.
|
|
52
|
-
*/
|
|
53
|
-
export const TOUCH_DELAY_MS = 150;
|
|
54
|
-
/**
|
|
55
|
-
* Delay time from beginning to wait for synthetic mouse events till giving up.
|
|
56
|
-
*/
|
|
57
|
-
export const WAIT_FOR_MOUSE_CLICK_MS = 500;
|
|
58
|
-
/**
|
|
59
|
-
* ActionController normalizes user interaction on components and distills it
|
|
60
|
-
* into calling `beginPress` and `endPress` on the component.
|
|
61
|
-
*
|
|
62
|
-
* `beginPress` is a good hook to affect visuals for pressed state, including
|
|
63
|
-
* ripple.
|
|
64
|
-
*
|
|
65
|
-
* `endPress` is a good hook for firing events based on user interaction, and
|
|
66
|
-
* cleaning up the pressed visual state.
|
|
67
|
-
*
|
|
68
|
-
* A component using an ActionController need only implement the ActionElement
|
|
69
|
-
* interface and add the ActionController's event listeners to understand user
|
|
70
|
-
* interaction.
|
|
71
|
-
*/
|
|
72
|
-
export class ActionController {
|
|
73
|
-
constructor(element) {
|
|
74
|
-
this.element = element;
|
|
75
|
-
this.phase = Phase.INACTIVE;
|
|
76
|
-
this.touchTimer = null;
|
|
77
|
-
this.clickTimer = null;
|
|
78
|
-
this.lastPositionEvent = null;
|
|
79
|
-
this.pressed = false;
|
|
80
|
-
this.checkBoundsAfterContextMenu = false;
|
|
81
|
-
// event listeners
|
|
82
|
-
/**
|
|
83
|
-
* Pointer down event handler.
|
|
84
|
-
*/
|
|
85
|
-
this.pointerDown = (e) => {
|
|
86
|
-
if (!this.shouldRespondToEvent(e) || this.phase !== Phase.INACTIVE) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
if (this.isTouch(e)) {
|
|
90
|
-
// after a longpress contextmenu event, an extra `pointerdown` can be
|
|
91
|
-
// dispatched to the pressed element. Check that the down is within
|
|
92
|
-
// bounds of the element in this case.
|
|
93
|
-
if (this.checkBoundsAfterContextMenu && !this.inBounds(e)) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
this.checkBoundsAfterContextMenu = false;
|
|
97
|
-
this.lastPositionEvent = e;
|
|
98
|
-
this.setPhase(Phase.TOUCH_DELAY);
|
|
99
|
-
this.touchTimer = setTimeout(() => {
|
|
100
|
-
this.touchDelayFinished();
|
|
101
|
-
}, TOUCH_DELAY_MS);
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
const leftButtonPressed = e.button === 0;
|
|
105
|
-
if (!leftButtonPressed ||
|
|
106
|
-
(this.ignoreClicksWithModifiers && this.eventHasModifiers(e))) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
this.setPhase(Phase.WAITING_FOR_MOUSE_CLICK);
|
|
110
|
-
this.beginPress(e);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Pointer up event handler.
|
|
115
|
-
*/
|
|
116
|
-
this.pointerUp = (e) => {
|
|
117
|
-
if (!this.isTouch(e) || !this.shouldRespondToEvent(e)) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
if (this.phase === Phase.HOLDING) {
|
|
121
|
-
this.waitForClick();
|
|
122
|
-
}
|
|
123
|
-
else if (this.phase === Phase.TOUCH_DELAY) {
|
|
124
|
-
this.setPhase(Phase.RELEASING);
|
|
125
|
-
this.beginPress();
|
|
126
|
-
this.waitForClick();
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* Click event handler.
|
|
131
|
-
*/
|
|
132
|
-
this.click = (e) => {
|
|
133
|
-
if (this.disabled ||
|
|
134
|
-
(this.ignoreClicksWithModifiers && this.eventHasModifiers(e))) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (this.phase === Phase.WAITING_FOR_MOUSE_CLICK) {
|
|
138
|
-
this.endPress();
|
|
139
|
-
this.setPhase(Phase.INACTIVE);
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
// keyboard synthesized click event
|
|
143
|
-
if (this.phase === Phase.INACTIVE && !this.pressed) {
|
|
144
|
-
this.press();
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
/**
|
|
148
|
-
* Pointer leave event handler.
|
|
149
|
-
*/
|
|
150
|
-
this.pointerLeave = (e) => {
|
|
151
|
-
// cancel a held press that moves outside the element
|
|
152
|
-
if (this.shouldRespondToEvent(e) && !this.isTouch(e) && this.pressed) {
|
|
153
|
-
this.cancelPress();
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
/**
|
|
157
|
-
* Pointer cancel event handler.
|
|
158
|
-
*/
|
|
159
|
-
this.pointerCancel = (e) => {
|
|
160
|
-
if (this.shouldRespondToEvent(e)) {
|
|
161
|
-
this.cancelPress();
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
/**
|
|
165
|
-
* Contextmenu event handler.
|
|
166
|
-
*/
|
|
167
|
-
this.contextMenu = () => {
|
|
168
|
-
if (!this.disabled) {
|
|
169
|
-
this.checkBoundsAfterContextMenu = true;
|
|
170
|
-
this.cancelPress();
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
this.element.addController(this);
|
|
174
|
-
}
|
|
175
|
-
get disabled() {
|
|
176
|
-
return this.element.disabled;
|
|
177
|
-
}
|
|
178
|
-
get ignoreClicksWithModifiers() {
|
|
179
|
-
return this.element.ignoreClicksWithModifiers ?? false;
|
|
180
|
-
}
|
|
181
|
-
setPhase(newPhase) {
|
|
182
|
-
this.phase = newPhase;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Calls beginPress and then endPress. Allows us to programmatically click
|
|
186
|
-
* on the element.
|
|
187
|
-
*/
|
|
188
|
-
press() {
|
|
189
|
-
this.beginPress(/* positionEvent= */ null);
|
|
190
|
-
this.setPhase(Phase.INACTIVE);
|
|
191
|
-
this.endPress();
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Call `beginPress` on element with triggering event, if applicable.
|
|
195
|
-
*/
|
|
196
|
-
beginPress(positionEvent = this.lastPositionEvent) {
|
|
197
|
-
this.pressed = true;
|
|
198
|
-
this.element.beginPress({ positionEvent });
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Call `endPress` on element, and clean up timers.
|
|
202
|
-
*/
|
|
203
|
-
endPress() {
|
|
204
|
-
this.pressed = false;
|
|
205
|
-
this.element.endPress({ cancelled: false });
|
|
206
|
-
this.cleanup();
|
|
207
|
-
}
|
|
208
|
-
cleanup() {
|
|
209
|
-
if (this.touchTimer) {
|
|
210
|
-
clearTimeout(this.touchTimer);
|
|
211
|
-
}
|
|
212
|
-
this.touchTimer = null;
|
|
213
|
-
if (this.clickTimer) {
|
|
214
|
-
clearTimeout(this.clickTimer);
|
|
215
|
-
}
|
|
216
|
-
this.clickTimer = null;
|
|
217
|
-
this.lastPositionEvent = null;
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Call `endPress` with cancelled state on element, and cleanup timers.
|
|
221
|
-
*/
|
|
222
|
-
cancelPress() {
|
|
223
|
-
this.pressed = false;
|
|
224
|
-
this.cleanup();
|
|
225
|
-
if (this.phase === Phase.TOUCH_DELAY) {
|
|
226
|
-
this.setPhase(Phase.INACTIVE);
|
|
227
|
-
}
|
|
228
|
-
else if (this.phase !== Phase.INACTIVE) {
|
|
229
|
-
this.setPhase(Phase.INACTIVE);
|
|
230
|
-
this.element.endPress({ cancelled: true });
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
isTouch(e) {
|
|
234
|
-
return e.pointerType === 'touch';
|
|
235
|
-
}
|
|
236
|
-
touchDelayFinished() {
|
|
237
|
-
if (this.phase !== Phase.TOUCH_DELAY) {
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
this.setPhase(Phase.HOLDING);
|
|
241
|
-
this.beginPress();
|
|
242
|
-
}
|
|
243
|
-
waitForClick() {
|
|
244
|
-
this.setPhase(Phase.WAITING_FOR_MOUSE_CLICK);
|
|
245
|
-
this.clickTimer = setTimeout(() => {
|
|
246
|
-
// If a click event does not occur, clean up the interaction state.
|
|
247
|
-
if (this.phase === Phase.WAITING_FOR_MOUSE_CLICK) {
|
|
248
|
-
this.cancelPress();
|
|
249
|
-
}
|
|
250
|
-
}, WAIT_FOR_MOUSE_CLICK_MS);
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Check if event should trigger actions on the element.
|
|
254
|
-
*/
|
|
255
|
-
shouldRespondToEvent(e) {
|
|
256
|
-
return !this.disabled && e.isPrimary;
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Check if the event is within the bounds of the element.
|
|
260
|
-
*
|
|
261
|
-
* This is only needed for the "stuck" contextmenu longpress on Chrome.
|
|
262
|
-
*/
|
|
263
|
-
inBounds(ev) {
|
|
264
|
-
const { top, left, bottom, right } = this.element.getBoundingClientRect();
|
|
265
|
-
const { x, y } = ev;
|
|
266
|
-
return x >= left && x <= right && y >= top && y <= bottom;
|
|
267
|
-
}
|
|
268
|
-
eventHasModifiers(e) {
|
|
269
|
-
return e.altKey || e.ctrlKey || e.shiftKey || e.metaKey;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Cancel interactions if the element is removed from the DOM.
|
|
273
|
-
*/
|
|
274
|
-
hostDisconnected() {
|
|
275
|
-
this.cancelPress();
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* If the element becomes disabled, cancel interactions.
|
|
279
|
-
*/
|
|
280
|
-
hostUpdated() {
|
|
281
|
-
if (this.disabled) {
|
|
282
|
-
this.cancelPress();
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
//# sourceMappingURL=action-controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-controller.js","sourceRoot":"","sources":["action-controller.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AAEH,4BAA4B;AAC5B,sCAAsC;AACtC,sCAAsC;AACtC,wDAAwD;AACxD,wDAAwD;AACxD,wDAAwD;AACxD,2DAA2D;AAC3D,wDAAwD;AACxD,wDAAwD;AACxD,wDAAwD;AACxD,IAAK,KAiCJ;AAjCD,WAAK,KAAK;IACR,sDA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AAC,qBAAqB,EAAE,CAAC;QACxE,MAAM,EAAC,CAAC,EAAE,CAAC,EAAC,GAAG,EAAE,CAAC;QAClB,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,MAAM,CAAC;IAC5D,CAAC;IAEO,iBAAiB,CAAC,CAAa;QACrC,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,OAAO,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,WAAW;QACT,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAI,CAAC,WAAW,EAAE,CAAC;SACpB;IACH,CAAC;CAuGF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ReactiveController, ReactiveControllerHost} from 'lit';\n\n/**\n * Enumeration to keep track of the lifecycle of a touch event.\n */\n\n// State transition diagram:\n// +-----------------------------+\n// | v\n// | +------+------ WAITING_FOR_MOUSE_CLICK<----+\n// | | | ^ |\n// | V | | |\n// => INACTIVE -> TOUCH_DELAY -> RELEASING HOLDING\n// | ^\n// | |\n// +-----------------------------------+\nenum Phase {\n // Initial state of the control, no touch in progress.\n // Transitions:\n // on touch down: transition to TOUCH_DELAY.\n // on mouse down: transition to WAITING_FOR_MOUSE_CLICK.\n INACTIVE = 'INACTIVE',\n\n // Touch down has been received, waiting to determine if it's a swipe.\n // Transitions:\n // on touch up: beginPress(); transition to RELEASING.\n // on cancel: transition to INACTIVE.\n // after TOUCH_DELAY_MS: beginPress(); transition to HOLDING.\n TOUCH_DELAY = 'TOUCH_DELAY',\n\n // A touch has been deemed to be a press\n // Transitions:\n // on pointerup: endPress(); transition to WAITING_FOR_MOUSE_CLICK.\n HOLDING = 'HOLDING',\n\n // The user has released the mouse / touch, but we want to delay calling\n // endPress for a little bit to avoid double clicks.\n // Transitions:\n // mouse sequence after debounceDelay: endPress(); transition to INACTIVE\n // when in touch sequence: transitions directly to WAITING_FOR_MOUSE_CLICK\n RELEASING = 'RELEASING',\n\n // The user has touched, but we want to delay endPress until synthetic mouse\n // click event occurs. Stay in this state for a fixed amount of time before\n // giving up and transitioning into rest state.\n // Transitions:\n // on click: endPress(); transition to INACTIVE.\n // after WAIT_FOR_MOUSE_CLICK_MS: transition to INACTIVE.\n WAITING_FOR_MOUSE_CLICK = 'WAITING_FOR_MOUSE_CLICK'\n}\n\n/**\n * Delay time from touchstart to when element#beginPress is invoked.\n */\nexport const TOUCH_DELAY_MS = 150;\n\n/**\n * Delay time from beginning to wait for synthetic mouse events till giving up.\n */\nexport const WAIT_FOR_MOUSE_CLICK_MS = 500;\n\n/**\n * Interface for argument to beginPress.\n */\nexport interface BeginPressConfig {\n /**\n * Event that was recorded at the start of the interaction.\n * `null` if the press happened via keyboard.\n */\n positionEvent: Event|null;\n}\n\n/**\n * Interface for argument to endPress.\n */\nexport interface EndPressConfig {\n /**\n * `true` if the press was cancelled.\n */\n cancelled: boolean;\n /**\n * Data object to pass along to clients in the `action` event, if relevant.\n */\n actionData?: {};\n}\n\n/**\n * The necessary interface for using an ActionController\n */\nexport interface ActionControllerHost extends ReactiveControllerHost,\n HTMLElement {\n disabled: boolean;\n /**\n * Determines if pointerdown or click events containing modifier keys should\n * be ignored.\n */\n ignoreClicksWithModifiers?: boolean;\n /**\n * Called when a user interaction is determined to be a press.\n */\n beginPress(config: BeginPressConfig): void;\n /**\n * Called when a press ends or is cancelled.\n */\n endPress(config: EndPressConfig): void;\n}\n\n/**\n * ActionController normalizes user interaction on components and distills it\n * into calling `beginPress` and `endPress` on the component.\n *\n * `beginPress` is a good hook to affect visuals for pressed state, including\n * ripple.\n *\n * `endPress` is a good hook for firing events based on user interaction, and\n * cleaning up the pressed visual state.\n *\n * A component using an ActionController need only implement the ActionElement\n * interface and add the ActionController's event listeners to understand user\n * interaction.\n */\nexport class ActionController implements ReactiveController {\n constructor(private readonly element: ActionControllerHost) {\n this.element.addController(this);\n }\n\n private get disabled() {\n return this.element.disabled;\n }\n\n private get ignoreClicksWithModifiers() {\n return this.element.ignoreClicksWithModifiers ?? false;\n }\n\n private phase = Phase.INACTIVE;\n\n private touchTimer: number|null = null;\n\n private clickTimer: number|null = null;\n\n private lastPositionEvent: PointerEvent|null = null;\n\n private pressed = false;\n\n private checkBoundsAfterContextMenu = false;\n\n private setPhase(newPhase: Phase) {\n this.phase = newPhase;\n }\n\n /**\n * Calls beginPress and then endPress. Allows us to programmatically click\n * on the element.\n */\n private press() {\n this.beginPress(/* positionEvent= */ null);\n this.setPhase(Phase.INACTIVE);\n this.endPress();\n }\n\n /**\n * Call `beginPress` on element with triggering event, if applicable.\n */\n private beginPress(positionEvent: Event|null = this.lastPositionEvent) {\n this.pressed = true;\n this.element.beginPress({positionEvent});\n }\n\n /**\n * Call `endPress` on element, and clean up timers.\n */\n private endPress() {\n this.pressed = false;\n this.element.endPress({cancelled: false});\n this.cleanup();\n }\n\n private cleanup() {\n if (this.touchTimer) {\n clearTimeout(this.touchTimer);\n }\n this.touchTimer = null;\n if (this.clickTimer) {\n clearTimeout(this.clickTimer);\n }\n this.clickTimer = null;\n this.lastPositionEvent = null;\n }\n\n /**\n * Call `endPress` with cancelled state on element, and cleanup timers.\n */\n private cancelPress() {\n this.pressed = false;\n this.cleanup();\n if (this.phase === Phase.TOUCH_DELAY) {\n this.setPhase(Phase.INACTIVE);\n } else if (this.phase !== Phase.INACTIVE) {\n this.setPhase(Phase.INACTIVE);\n this.element.endPress({cancelled: true});\n }\n }\n\n private isTouch(e: PointerEvent) {\n return e.pointerType === 'touch';\n }\n\n private touchDelayFinished() {\n if (this.phase !== Phase.TOUCH_DELAY) {\n return;\n }\n this.setPhase(Phase.HOLDING);\n this.beginPress();\n }\n\n private waitForClick() {\n this.setPhase(Phase.WAITING_FOR_MOUSE_CLICK);\n this.clickTimer = setTimeout(() => {\n // If a click event does not occur, clean up the interaction state.\n if (this.phase === Phase.WAITING_FOR_MOUSE_CLICK) {\n this.cancelPress();\n }\n }, WAIT_FOR_MOUSE_CLICK_MS);\n }\n\n /**\n * Check if event should trigger actions on the element.\n */\n private shouldRespondToEvent(e: PointerEvent) {\n return !this.disabled && e.isPrimary;\n }\n\n /**\n * Check if the event is within the bounds of the element.\n *\n * This is only needed for the \"stuck\" contextmenu longpress on Chrome.\n */\n private inBounds(ev: PointerEvent) {\n const {top, left, bottom, right} = this.element.getBoundingClientRect();\n const {x, y} = ev;\n return x >= left && x <= right && y >= top && y <= bottom;\n }\n\n private eventHasModifiers(e: MouseEvent) {\n return e.altKey || e.ctrlKey || e.shiftKey || e.metaKey;\n }\n\n /**\n * Cancel interactions if the element is removed from the DOM.\n */\n hostDisconnected() {\n this.cancelPress();\n }\n\n /**\n * If the element becomes disabled, cancel interactions.\n */\n hostUpdated() {\n if (this.disabled) {\n this.cancelPress();\n }\n }\n\n // event listeners\n /**\n * Pointer down event handler.\n */\n pointerDown =\n (e: PointerEvent) => {\n if (!this.shouldRespondToEvent(e) || this.phase !== Phase.INACTIVE) {\n return;\n }\n if (this.isTouch(e)) {\n // after a longpress contextmenu event, an extra `pointerdown` can be\n // dispatched to the pressed element. Check that the down is within\n // bounds of the element in this case.\n if (this.checkBoundsAfterContextMenu && !this.inBounds(e)) {\n return;\n }\n this.checkBoundsAfterContextMenu = false;\n this.lastPositionEvent = e;\n this.setPhase(Phase.TOUCH_DELAY);\n this.touchTimer = setTimeout(() => {\n this.touchDelayFinished();\n }, TOUCH_DELAY_MS);\n } else {\n const leftButtonPressed = e.button === 0;\n if (!leftButtonPressed ||\n (this.ignoreClicksWithModifiers && this.eventHasModifiers(e))) {\n return;\n }\n this.setPhase(Phase.WAITING_FOR_MOUSE_CLICK);\n this.beginPress(e);\n }\n }\n\n /**\n * Pointer up event handler.\n */\n pointerUp =\n (e: PointerEvent) => {\n if (!this.isTouch(e) || !this.shouldRespondToEvent(e)) {\n return;\n }\n if (this.phase === Phase.HOLDING) {\n this.waitForClick();\n } else if (this.phase === Phase.TOUCH_DELAY) {\n this.setPhase(Phase.RELEASING);\n this.beginPress();\n this.waitForClick();\n }\n }\n\n /**\n * Click event handler.\n */\n click =\n (e: MouseEvent) => {\n if (this.disabled ||\n (this.ignoreClicksWithModifiers && this.eventHasModifiers(e))) {\n return;\n }\n if (this.phase === Phase.WAITING_FOR_MOUSE_CLICK) {\n this.endPress();\n this.setPhase(Phase.INACTIVE);\n return;\n }\n\n // keyboard synthesized click event\n if (this.phase === Phase.INACTIVE && !this.pressed) {\n this.press();\n }\n }\n\n /**\n * Pointer leave event handler.\n */\n pointerLeave =\n (e: PointerEvent) => {\n // cancel a held press that moves outside the element\n if (this.shouldRespondToEvent(e) && !this.isTouch(e) && this.pressed) {\n this.cancelPress();\n }\n }\n\n /**\n * Pointer cancel event handler.\n */\n pointerCancel =\n (e: PointerEvent) => {\n if (this.shouldRespondToEvent(e)) {\n this.cancelPress();\n }\n }\n\n /**\n * Contextmenu event handler.\n */\n contextMenu = () => {\n if (!this.disabled) {\n this.checkBoundsAfterContextMenu = true;\n this.cancelPress();\n }\n }\n}\n"]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2021 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { ReactiveElement } from 'lit';
|
|
7
|
-
/**
|
|
8
|
-
* A property decorator that helps proxy an aria attribute to an internal node.
|
|
9
|
-
*
|
|
10
|
-
* This decorator is only intended for use with ARIAMixin properties,
|
|
11
|
-
* such as `ariaLabel`, to help with screen readers.
|
|
12
|
-
*
|
|
13
|
-
* This decorator will remove the host `aria-*` attribute at runtime and add it
|
|
14
|
-
* to a `data-aria-*` attribute to avoid screenreader conflicts between the
|
|
15
|
-
* host and internal node.
|
|
16
|
-
*
|
|
17
|
-
* `@ariaProperty` decorated properties should sync with LitElement to the
|
|
18
|
-
* `data-aria-*` attribute, not the native `aria-*` attribute.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```ts
|
|
22
|
-
* class MyElement extends LitElement {
|
|
23
|
-
* \@ariaProperty
|
|
24
|
-
* // TODO(b/210730484): replace with @soyParam annotation
|
|
25
|
-
* \@property({ type: String, attribute: 'data-aria-label', noAccessor: true})
|
|
26
|
-
* ariaLabel!: string;
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
* @category Decorator
|
|
30
|
-
* @ExportDecoratedItems
|
|
31
|
-
*/
|
|
32
|
-
export declare function ariaProperty<E extends ReactiveElement, K extends keyof E & (`aria${string}` | 'role')>(prototype: E, property: K): void;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2021 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* A property decorator that helps proxy an aria attribute to an internal node.
|
|
8
|
-
*
|
|
9
|
-
* This decorator is only intended for use with ARIAMixin properties,
|
|
10
|
-
* such as `ariaLabel`, to help with screen readers.
|
|
11
|
-
*
|
|
12
|
-
* This decorator will remove the host `aria-*` attribute at runtime and add it
|
|
13
|
-
* to a `data-aria-*` attribute to avoid screenreader conflicts between the
|
|
14
|
-
* host and internal node.
|
|
15
|
-
*
|
|
16
|
-
* `@ariaProperty` decorated properties should sync with LitElement to the
|
|
17
|
-
* `data-aria-*` attribute, not the native `aria-*` attribute.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* class MyElement extends LitElement {
|
|
22
|
-
* \@ariaProperty
|
|
23
|
-
* // TODO(b/210730484): replace with @soyParam annotation
|
|
24
|
-
* \@property({ type: String, attribute: 'data-aria-label', noAccessor: true})
|
|
25
|
-
* ariaLabel!: string;
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
* @category Decorator
|
|
29
|
-
* @ExportDecoratedItems
|
|
30
|
-
*/
|
|
31
|
-
export function ariaProperty(prototype, property) {
|
|
32
|
-
// Replace the ARIAMixin property with data-* attribute syncing instead of
|
|
33
|
-
// using the native aria-* attribute reflection. This preserves the attribute
|
|
34
|
-
// for SSR and avoids screenreader conflicts after delegating the attribute
|
|
35
|
-
// to a child node.
|
|
36
|
-
Object.defineProperty(prototype, property, {
|
|
37
|
-
configurable: true,
|
|
38
|
-
enumerable: true,
|
|
39
|
-
get() {
|
|
40
|
-
return this.dataset[property] ?? '';
|
|
41
|
-
},
|
|
42
|
-
set(value) {
|
|
43
|
-
// Coerce non-string values to a string
|
|
44
|
-
const strValue = String(value ?? '');
|
|
45
|
-
if (strValue) {
|
|
46
|
-
this.dataset[property] = strValue;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
delete this.dataset[property];
|
|
50
|
-
}
|
|
51
|
-
// lit will call this setter whenever the data-* attribute changes.
|
|
52
|
-
// However, this.dataset[property] will automatically be updated to the
|
|
53
|
-
// current value. To avoid bugs, always request an update regardless of
|
|
54
|
-
// the old value.
|
|
55
|
-
this.requestUpdate();
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
// Define an internal property that syncs from the `aria-*` attribute with lit
|
|
59
|
-
// and delegates to the real ARIAMixin property, which renders an update.
|
|
60
|
-
// This property will immediately remove the `aria-*` attribute, which doesn't
|
|
61
|
-
// work well with SSR (which is why there's a separate synced property).
|
|
62
|
-
const internalAriaProperty = Symbol(property);
|
|
63
|
-
// "ariaLabel" -> "aria-label" / "ariaLabelledBy" -> "aria-labelledby"
|
|
64
|
-
const ariaAttribute = property.replace('aria', 'aria-').toLowerCase();
|
|
65
|
-
const constructor = prototype.constructor;
|
|
66
|
-
let removingAttribute = false;
|
|
67
|
-
Object.defineProperty(prototype, internalAriaProperty, {
|
|
68
|
-
get() {
|
|
69
|
-
// tslint is failing here, but the types are correct (ARIAMixin
|
|
70
|
-
// properties do not obfuscate with closure)
|
|
71
|
-
// tslint:disable-next-line:no-dict-access-on-struct-type
|
|
72
|
-
return this[property];
|
|
73
|
-
},
|
|
74
|
-
set(value) {
|
|
75
|
-
if (removingAttribute) {
|
|
76
|
-
// Ignore this update, which is triggered below
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
// Set the ARIAMixin property, which will sync the `data-*` attribute
|
|
80
|
-
// and trigger rendering if the value changed.
|
|
81
|
-
// tslint is failing here, but the types are correct (ARIAMixin
|
|
82
|
-
// properties do not obfuscate with closure)
|
|
83
|
-
// tslint:disable-next-line:no-dict-access-on-struct-type
|
|
84
|
-
this[property] = value;
|
|
85
|
-
// Remove the `aria-*` attribute, which will call this setter again with
|
|
86
|
-
// the incorrect value. Ignore these updates.
|
|
87
|
-
removingAttribute = true;
|
|
88
|
-
this.removeAttribute(ariaAttribute);
|
|
89
|
-
removingAttribute = false;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
// Tell lit to observe the `aria-*` attribute and set the internal property,
|
|
93
|
-
// which acts as a "aria-* attribute changed" observer.
|
|
94
|
-
constructor.createProperty(internalAriaProperty, {
|
|
95
|
-
attribute: ariaAttribute,
|
|
96
|
-
noAccessor: true,
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
//# sourceMappingURL=aria-property.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aria-property.js","sourceRoot":"","sources":["aria-property.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,YAAY,CAExB,SAAY,EAAE,QAAW;IAC3B,0EAA0E;IAC1E,6EAA6E;IAC7E,2EAA2E;IAC3E,mBAAmB;IACnB,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,QAAQ,EAAE;QACzC,YAAY,EAAE,IAAI;QAClB,UAA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C,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;YACpC,iBAAiB,GAAG,KAAK,CAAC;QAC5B,CAAC;KACF,CAAC,CAAC;IAEH,4EAA4E;IAC5E,uDAAuD;IACvD,WAAW,CAAC,cAAc,CAAC,oBAAoB,EAAE;QAC/C,SAAS,EAAE,aAAa;QACxB,UAAU,EAAE,IAAI;KACjB,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ReactiveElement} from 'lit';\n\n/**\n * A property decorator that helps proxy an aria attribute to an internal node.\n *\n * This decorator is only intended for use with ARIAMixin properties,\n * such as `ariaLabel`, to help with screen readers.\n *\n * This decorator will remove the host `aria-*` attribute at runtime and add it\n * to a `data-aria-*` attribute to avoid screenreader conflicts between the\n * host and internal node.\n *\n * `@ariaProperty` decorated properties should sync with LitElement to the\n * `data-aria-*` attribute, not the native `aria-*` attribute.\n *\n * @example\n * ```ts\n * class MyElement extends LitElement {\n * \\@ariaProperty\n * // TODO(b/210730484): replace with @soyParam annotation\n * \\@property({ type: String, attribute: 'data-aria-label', noAccessor: true})\n * ariaLabel!: string;\n * }\n * ```\n * @category Decorator\n * @ExportDecoratedItems\n */\nexport function ariaProperty<E extends ReactiveElement, K extends keyof E&\n (`aria${string}` | 'role')>(\n prototype: E, property: K) {\n // Replace the ARIAMixin property with data-* attribute syncing instead of\n // using the native aria-* attribute reflection. This preserves the attribute\n // for SSR and avoids screenreader conflicts after delegating the attribute\n // to a child node.\n Object.defineProperty(prototype, property, {\n configurable: true,\n enumerable: true,\n get(this: ReactiveElement) {\n return this.dataset[property] ?? '';\n },\n set(this: ReactiveElement, value: unknown) {\n // Coerce non-string values to a string\n const strValue = String(value ?? '');\n if (strValue) {\n this.dataset[property] = strValue;\n } else {\n delete this.dataset[property];\n }\n\n // lit will call this setter whenever the data-* attribute changes.\n // However, this.dataset[property] will automatically be updated to the\n // current value. To avoid bugs, always request an update regardless of\n // the old value.\n this.requestUpdate();\n }\n });\n\n // Define an internal property that syncs from the `aria-*` attribute with lit\n // and delegates to the real ARIAMixin property, which renders an update.\n // This property will immediately remove the `aria-*` attribute, which doesn't\n // work well with SSR (which is why there's a separate synced property).\n const internalAriaProperty = Symbol(property);\n // \"ariaLabel\" -> \"aria-label\" / \"ariaLabelledBy\" -> \"aria-labelledby\"\n const ariaAttribute = property.replace('aria', 'aria-').toLowerCase();\n const constructor = (prototype.constructor as typeof ReactiveElement);\n let removingAttribute = false;\n Object.defineProperty(prototype, internalAriaProperty, {\n get(this: ReactiveElement) {\n // tslint is failing here, but the types are correct (ARIAMixin\n // properties do not obfuscate with closure)\n // tslint:disable-next-line:no-dict-access-on-struct-type\n return (this as E)[property];\n },\n set(this: ReactiveElement, value: E[K]) {\n if (removingAttribute) {\n // Ignore this update, which is triggered below\n return;\n }\n\n // Set the ARIAMixin property, which will sync the `data-*` attribute\n // and trigger rendering if the value changed.\n // tslint is failing here, but the types are correct (ARIAMixin\n // properties do not obfuscate with closure)\n // tslint:disable-next-line:no-dict-access-on-struct-type\n (this as E)[property] = value;\n // Remove the `aria-*` attribute, which will call this setter again with\n // the incorrect value. Ignore these updates.\n removingAttribute = true;\n this.removeAttribute(ariaAttribute);\n removingAttribute = false;\n }\n });\n\n // Tell lit to observe the `aria-*` attribute and set the internal property,\n // which acts as a \"aria-* attribute changed\" observer.\n constructor.createProperty(internalAriaProperty, {\n attribute: ariaAttribute,\n noAccessor: true,\n });\n}\n"]}
|
package/fab/_fab-extended.scss
DELETED
package/fab/fab-extended.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2022 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import '../icon/icon.js';
|
|
7
|
-
import { TemplateResult } from 'lit';
|
|
8
|
-
import { FabExtended } from './lib/fab-extended.js';
|
|
9
|
-
declare global {
|
|
10
|
-
interface HTMLElementTagNameMap {
|
|
11
|
-
'md-fab-extended': MdFabExtended;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* @soyCompatible
|
|
16
|
-
* @final
|
|
17
|
-
* @suppress {visibility}
|
|
18
|
-
*/
|
|
19
|
-
export declare class MdFabExtended extends FabExtended {
|
|
20
|
-
static styles: import("lit").CSSResult[];
|
|
21
|
-
/** @soyTemplate */
|
|
22
|
-
protected renderIcon(icon: string): TemplateResult | string;
|
|
23
|
-
}
|