@material/web 1.0.0-pre.3 → 1.0.0-pre.5
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/LICENSE +1 -1
- package/README.md +41 -41
- package/badge/lib/_badge.scss +2 -10
- package/button/lib/_elevated-button.scss +5 -30
- package/button/lib/_elevation.scss +1 -16
- package/button/lib/_filled-button.scss +4 -31
- package/button/lib/_icon.scss +1 -0
- package/button/lib/_outlined-button.scss +6 -23
- package/button/lib/_shared.scss +20 -54
- package/button/lib/_text-button.scss +8 -34
- package/button/lib/_tonal-button.scss +5 -28
- package/button/lib/button.d.ts +2 -0
- package/button/lib/button.js +5 -1
- package/button/lib/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-styles.css.js +1 -1
- package/button/lib/filled-styles.css.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-styles.css.js +1 -1
- package/button/lib/shared-styles.css.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-styles.css.js +1 -1
- package/button/lib/tonal-styles.css.js.map +1 -1
- package/checkbox/lib/_checkbox.scss +1 -2
- package/checkbox/lib/checkbox-styles.css.js +1 -1
- package/checkbox/lib/checkbox-styles.css.js.map +1 -1
- package/chips/_assist-chip.scss +6 -0
- package/chips/_suggestion-chip.scss +6 -0
- package/chips/assist-chip.d.ts +20 -0
- package/chips/assist-chip.js +24 -0
- package/chips/assist-chip.js.map +1 -0
- package/chips/lib/_assist-chip.scss +27 -0
- package/chips/lib/_shared.scss +183 -0
- package/chips/lib/_suggestion-chip.scss +30 -0
- package/chips/lib/assist-chip.d.ts +11 -0
- package/chips/lib/assist-chip.js +12 -0
- package/chips/lib/assist-chip.js.map +1 -0
- package/chips/lib/assist-styles.css.js +9 -0
- package/chips/lib/assist-styles.css.js.map +1 -0
- package/{list/lib/listitem/list-item-private-styles.scss → chips/lib/assist-styles.scss} +2 -2
- package/chips/lib/chip.d.ts +29 -0
- package/chips/lib/chip.js +110 -0
- package/chips/lib/chip.js.map +1 -0
- package/chips/lib/shared-styles.css.js +9 -0
- package/chips/lib/shared-styles.css.js.map +1 -0
- package/{autocomplete → chips}/lib/shared-styles.scss +1 -1
- package/chips/lib/suggestion-chip.d.ts +11 -0
- package/chips/lib/suggestion-chip.js +12 -0
- package/chips/lib/suggestion-chip.js.map +1 -0
- package/chips/lib/suggestion-styles.css.js +9 -0
- package/chips/lib/suggestion-styles.css.js.map +1 -0
- package/{menu/lib/menuitem/menu-item-private-styles.scss → chips/lib/suggestion-styles.scss} +2 -2
- package/chips/suggestion-chip.d.ts +20 -0
- package/chips/suggestion-chip.js +24 -0
- package/chips/suggestion-chip.js.map +1 -0
- package/controller/form-controller.d.ts +1 -1
- package/controller/form-controller.js +21 -29
- package/controller/form-controller.js.map +1 -1
- package/dialog/lib/_dialog.scss +7 -5
- package/dialog/lib/_tokens.scss +1 -2
- package/dialog/lib/dialog-styles.css.js +1 -1
- package/dialog/lib/dialog-styles.css.js.map +1 -1
- package/dialog/lib/dialog.js +1 -1
- package/dialog/lib/dialog.js.map +1 -1
- package/elevation/lib/_elevation.scss +1 -21
- package/elevation/lib/elevation-styles.css.js +1 -1
- package/elevation/lib/elevation-styles.css.js.map +1 -1
- package/fab/lib/_fab-extended.scss +3 -10
- package/fab/lib/_fab.scss +0 -3
- package/fab/lib/_shared.scss +3 -25
- package/fab/lib/fab-extended-styles.css.js +1 -1
- package/fab/lib/fab-extended-styles.css.js.map +1 -1
- package/fab/lib/fab-shared-styles.css.js +1 -1
- package/fab/lib/fab-shared-styles.css.js.map +1 -1
- package/fab/lib/fab-shared.d.ts +0 -1
- package/fab/lib/fab-shared.js +1 -7
- package/fab/lib/fab-shared.js.map +1 -1
- package/field/lib/_content.scss +91 -13
- package/field/lib/_filled-field.scss +19 -57
- package/field/lib/_label.scss +1 -2
- package/field/lib/_md-comp-filled-field.scss +123 -64
- package/field/lib/_md-comp-outlined-field.scss +100 -59
- package/field/lib/_outlined-field.scss +13 -11
- package/field/lib/_shared.scss +21 -17
- package/field/lib/field.d.ts +6 -2
- package/field/lib/field.js +80 -62
- package/field/lib/field.js.map +1 -1
- package/field/lib/filled-field.d.ts +0 -5
- package/field/lib/filled-field.js +2 -41
- package/field/lib/filled-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-field.js +1 -1
- package/field/lib/outlined-field.js.map +1 -1
- package/field/lib/outlined-styles.css.js +1 -1
- package/field/lib/outlined-styles.css.js.map +1 -1
- package/field/lib/shared-styles.css.js +1 -1
- package/field/lib/shared-styles.css.js.map +1 -1
- package/focus/lib/_focus-ring.scss +13 -7
- package/focus/lib/_md-comp-focus-ring.scss +1 -2
- package/focus/lib/focus-ring-styles.css.js +1 -1
- package/focus/lib/focus-ring-styles.css.js.map +1 -1
- package/icon/lib/_icon.scss +1 -1
- package/icon/lib/_md-comp-icon.scss +1 -2
- package/icon/lib/icon-styles.css.js +1 -1
- package/icon/lib/icon-styles.css.js.map +1 -1
- package/iconbutton/lib/_filled-icon-button.scss +1 -12
- package/iconbutton/lib/_filled-tonal-icon-button.scss +1 -12
- package/iconbutton/lib/_outlined-icon-button.scss +1 -13
- package/iconbutton/lib/_shared.scss +10 -6
- package/iconbutton/lib/_standard-icon-button.scss +5 -12
- 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.js +0 -2
- 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/list/lib/_list.scss +34 -17
- package/list/lib/list-styles.css.js +1 -1
- package/list/lib/list-styles.css.js.map +1 -1
- package/list/lib/listitem/_list-item.scss +312 -124
- 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 +8 -6
- package/list/lib/listitem/list-item.js +26 -27
- package/list/lib/listitem/list-item.js.map +1 -1
- package/list/list-item-link.d.ts +18 -0
- package/list/list-item-link.js +19 -2
- package/list/list-item-link.js.map +1 -1
- package/list/list-item.d.ts +19 -0
- package/list/list-item.js +20 -2
- package/list/list-item.js.map +1 -1
- package/menu/lib/_menu.scss +26 -8
- 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 +22 -9
- package/menu/lib/menu.js +76 -27
- package/menu/lib/menu.js.map +1 -1
- package/menu/lib/menuitem/_menu-item.scss +39 -79
- 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.js +1 -1
- package/menu/lib/menuitem/menu-item.js.map +1 -1
- package/menu/lib/menuitemlink/menu-item-link.js +2 -1
- package/menu/lib/menuitemlink/menu-item-link.js.map +1 -1
- package/menu/lib/shared.d.ts +16 -0
- package/menu/lib/shared.js +16 -0
- package/menu/lib/shared.js.map +1 -1
- package/menu/lib/submenuitem/sub-menu-item.d.ts +4 -1
- package/menu/lib/submenuitem/sub-menu-item.js +9 -3
- package/menu/lib/submenuitem/sub-menu-item.js.map +1 -1
- package/menu/lib/surfacePositionController.d.ts +10 -2
- package/menu/lib/surfacePositionController.js +6 -2
- package/menu/lib/surfacePositionController.js.map +1 -1
- package/menu/lib/typeaheadController.d.ts +5 -0
- package/menu/lib/typeaheadController.js +7 -3
- package/menu/lib/typeaheadController.js.map +1 -1
- package/menu/menu-item-link.js +1 -2
- package/menu/menu-item-link.js.map +1 -1
- package/menu/menu-item.js +2 -3
- package/menu/menu-item.js.map +1 -1
- package/menu/sub-menu-item.js +1 -2
- package/menu/sub-menu-item.js.map +1 -1
- package/navigationbar/lib/_navigation-bar.scss +1 -4
- package/navigationdrawer/lib/_navigation-drawer-modal.scss +0 -3
- package/navigationdrawer/lib/_navigation-drawer.scss +0 -3
- package/navigationdrawer/lib/_shared.scss +0 -9
- package/navigationtab/lib/_navigation-tab.scss +4 -10
- package/navigationtab/lib/navigation-tab-styles.css.js +1 -1
- package/navigationtab/lib/navigation-tab-styles.css.js.map +1 -1
- package/package.json +1 -1
- package/radio/lib/_radio.scss +1 -2
- package/radio/lib/radio-styles.css.js +1 -1
- package/radio/lib/radio-styles.css.js.map +1 -1
- package/segmentedbutton/lib/_shared.scss +0 -2
- package/segmentedbuttonset/lib/outlined-styles.css.js +1 -1
- package/segmentedbuttonset/lib/outlined-styles.css.js.map +1 -1
- package/slider/lib/_slider.scss +1 -4
- package/slider/lib/_tokens.scss +2 -8
- package/slider/lib/slider-styles.css.js +1 -1
- package/slider/lib/slider-styles.css.js.map +1 -1
- package/textfield/lib/_filled-text-field.scss +99 -103
- package/textfield/lib/_icon.scss +11 -55
- package/textfield/lib/_input.scss +4 -6
- package/textfield/lib/_outlined-text-field.scss +88 -95
- package/textfield/lib/filled-styles.css.js +1 -1
- package/textfield/lib/filled-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/shared-styles.css.js +1 -1
- package/textfield/lib/shared-styles.css.js.map +1 -1
- package/tokens/_index.scss +101 -2
- package/tokens/_md-comp-assist-chip.scss +68 -0
- package/tokens/_md-comp-badge.scss +34 -0
- package/tokens/_md-comp-banner.scss +23 -0
- package/tokens/_md-comp-bottom-app-bar.scss +21 -0
- package/tokens/_md-comp-carousel-item.scss +23 -0
- package/tokens/_md-comp-checkbox.scss +21 -0
- package/tokens/_md-comp-circular-progress-indicator.scss +22 -0
- package/tokens/_md-comp-data-table.scss +23 -0
- package/tokens/_md-comp-date-input-modal.scss +23 -0
- package/tokens/_md-comp-date-picker-docked.scss +25 -0
- package/tokens/_md-comp-date-picker-modal.scss +25 -0
- package/tokens/_md-comp-dialog.scss +43 -0
- package/tokens/_md-comp-divider.scss +17 -0
- package/tokens/_md-comp-elevated-button.scss +58 -0
- package/tokens/_md-comp-elevated-card.scss +23 -0
- package/tokens/_md-comp-extended-fab-branded.scss +38 -0
- package/tokens/_md-comp-extended-fab-primary.scss +38 -0
- package/tokens/_md-comp-extended-fab-secondary.scss +41 -0
- package/tokens/_md-comp-extended-fab-surface.scss +38 -0
- package/tokens/_md-comp-extended-fab-tertiary.scss +41 -0
- package/tokens/_md-comp-fab-branded-large.scss +23 -0
- package/tokens/_md-comp-fab-branded.scss +23 -0
- package/tokens/_md-comp-fab-primary-large.scss +23 -0
- package/tokens/_md-comp-fab-primary-small.scss +23 -0
- package/tokens/_md-comp-fab-primary.scss +23 -0
- package/tokens/_md-comp-fab-secondary-large.scss +23 -0
- package/tokens/_md-comp-fab-secondary-small.scss +23 -0
- package/tokens/_md-comp-fab-secondary.scss +23 -0
- package/tokens/_md-comp-fab-surface-large.scss +23 -0
- package/tokens/_md-comp-fab-surface-small.scss +23 -0
- package/tokens/_md-comp-fab-surface.scss +23 -0
- package/tokens/_md-comp-fab-tertiary-large.scss +23 -0
- package/tokens/_md-comp-fab-tertiary-small.scss +23 -0
- package/tokens/_md-comp-fab-tertiary.scss +23 -0
- package/tokens/_md-comp-filled-autocomplete.scss +25 -0
- package/tokens/_md-comp-filled-button.scss +58 -0
- package/tokens/_md-comp-filled-card.scss +23 -0
- package/tokens/_md-comp-filled-icon-button.scss +21 -0
- package/tokens/_md-comp-filled-menu-button.scss +25 -0
- package/tokens/_md-comp-filled-select.scss +25 -0
- package/tokens/_md-comp-filled-text-field.scss +46 -0
- package/tokens/_md-comp-filled-tonal-button.scss +59 -0
- package/tokens/_md-comp-filled-tonal-icon-button.scss +24 -0
- package/tokens/_md-comp-filter-chip.scss +38 -0
- package/tokens/_md-comp-full-screen-dialog.scss +25 -0
- package/tokens/_md-comp-icon-button.scss +21 -0
- package/tokens/_md-comp-input-chip.scss +38 -0
- package/tokens/_md-comp-linear-progress-indicator.scss +22 -0
- package/tokens/_md-comp-list.scss +58 -0
- package/tokens/_md-comp-menu.scss +21 -0
- package/tokens/_md-comp-navigation-bar.scss +25 -0
- package/tokens/_md-comp-navigation-drawer.scss +25 -0
- package/tokens/_md-comp-navigation-rail.scss +25 -0
- package/tokens/_md-comp-outlined-autocomplete.scss +28 -0
- package/tokens/_md-comp-outlined-button.scss +56 -0
- package/tokens/_md-comp-outlined-card.scss +23 -0
- package/tokens/_md-comp-outlined-icon-button.scss +21 -0
- package/tokens/_md-comp-outlined-menu-button.scss +23 -0
- package/tokens/_md-comp-outlined-segmented-button.scss +38 -0
- package/tokens/_md-comp-outlined-select.scss +25 -0
- package/tokens/_md-comp-outlined-text-field.scss +44 -0
- package/tokens/_md-comp-plain-tooltip.scss +21 -0
- package/tokens/_md-comp-primary-navigation-tab.scss +41 -0
- package/tokens/_md-comp-radio-button.scss +19 -0
- package/tokens/_md-comp-rich-tooltip.scss +25 -0
- package/tokens/_md-comp-scrim.scss +17 -0
- package/tokens/_md-comp-search-bar.scss +25 -0
- package/tokens/_md-comp-search-view.scss +23 -0
- package/tokens/_md-comp-secondary-navigation-tab.scss +41 -0
- package/tokens/_md-comp-sheet-bottom.scss +21 -0
- package/tokens/_md-comp-sheet-floating.scss +21 -0
- package/tokens/_md-comp-sheet-side.scss +25 -0
- package/tokens/_md-comp-slider.scss +38 -0
- package/tokens/_md-comp-snackbar.scss +25 -0
- package/tokens/_md-comp-standard-menu-button.scss +23 -0
- package/tokens/_md-comp-suggestion-chip.scss +72 -0
- package/tokens/_md-comp-switch.scss +21 -0
- package/tokens/_md-comp-text-button.scss +56 -0
- package/tokens/_md-comp-time-input.scss +25 -0
- package/tokens/_md-comp-time-picker.scss +25 -0
- package/tokens/_md-comp-top-app-bar-large.scss +23 -0
- package/tokens/_md-comp-top-app-bar-medium.scss +23 -0
- package/tokens/_md-comp-top-app-bar-small-centered.scss +26 -0
- package/tokens/_md-comp-top-app-bar-small.scss +23 -0
- package/tokens/_md-ref-palette.scss +12 -0
- package/tokens/_md-ref-typeface.scss +12 -0
- package/tokens/_md-sys-color.scss +25 -0
- package/tokens/_md-sys-elevation.scss +30 -0
- package/tokens/_md-sys-motion.scss +12 -0
- package/tokens/_md-sys-shape.scss +12 -0
- package/tokens/_md-sys-state.scss +12 -0
- package/tokens/_md-sys-typescale.scss +17 -0
- package/tokens/{v0_160 → v0_161}/_md-comp-assist-chip.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-badge.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-banner.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-bottom-app-bar.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-carousel-item.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-checkbox.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-circular-progress-indicator.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-data-table.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-date-input-modal.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-date-picker-docked.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-date-picker-modal.scss +3 -3
- package/tokens/{v0_160 → v0_161}/_md-comp-dialog.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-divider.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-elevated-button.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-elevated-card.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-extended-fab-branded.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-extended-fab-primary.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-extended-fab-secondary.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-extended-fab-surface.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-extended-fab-tertiary.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-fab-branded-large.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-fab-branded.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-fab-primary-large.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-fab-primary-small.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-fab-primary.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-fab-secondary-large.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-fab-secondary-small.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-fab-secondary.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-fab-surface-large.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-fab-surface-small.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-fab-surface.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-fab-tertiary-large.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-fab-tertiary-small.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-fab-tertiary.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-filled-autocomplete.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-filled-button.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-filled-card.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-filled-icon-button.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-filled-menu-button.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-filled-select.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-filled-text-field.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-filled-tonal-button.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-filled-tonal-icon-button.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-filter-chip.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-full-screen-dialog.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-icon-button.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-input-chip.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-linear-progress-indicator.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-list.scss +1 -1
- package/tokens/v0_161/_md-comp-menu.scss +37 -0
- package/tokens/{v0_160 → v0_161}/_md-comp-navigation-bar.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-navigation-drawer.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-navigation-rail.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-outlined-autocomplete.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-outlined-button.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-outlined-card.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-outlined-icon-button.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-outlined-menu-button.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-outlined-segmented-button.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-outlined-select.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-outlined-text-field.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-plain-tooltip.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-primary-navigation-tab.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-radio-button.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-rich-tooltip.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-scrim.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-search-bar.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-search-view.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-secondary-navigation-tab.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-sheet-bottom.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-sheet-floating.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-sheet-side.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-slider.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-snackbar.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-standard-menu-button.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-suggestion-chip.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-switch.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-text-button.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-time-input.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-time-picker.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-top-app-bar-large.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-top-app-bar-medium.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-top-app-bar-small-centered.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-comp-top-app-bar-small.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-ref-palette.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-ref-typeface.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-sys-color.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-sys-elevation.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-sys-motion.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-sys-shape.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-sys-state.scss +1 -1
- package/tokens/{v0_160 → v0_161}/_md-sys-typescale.scss +1 -1
- package/autocomplete/_filled-autocomplete.scss +0 -6
- package/autocomplete/_outlined-autocomplete.scss +0 -6
- package/autocomplete/autocomplete-item.d.ts +0 -19
- package/autocomplete/autocomplete-item.js +0 -22
- package/autocomplete/autocomplete-item.js.map +0 -1
- package/autocomplete/autocomplete-list.d.ts +0 -19
- package/autocomplete/autocomplete-list.js +0 -23
- package/autocomplete/autocomplete-list.js.map +0 -1
- package/autocomplete/autocomplete-surface.d.ts +0 -19
- package/autocomplete/autocomplete-surface.js +0 -23
- package/autocomplete/autocomplete-surface.js.map +0 -1
- package/autocomplete/filled-autocomplete.d.ts +0 -28
- package/autocomplete/filled-autocomplete.js +0 -46
- package/autocomplete/filled-autocomplete.js.map +0 -1
- package/autocomplete/lib/_filled-autocomplete.scss +0 -189
- package/autocomplete/lib/_outlined-autocomplete.scss +0 -178
- package/autocomplete/lib/_shared.scss +0 -25
- package/autocomplete/lib/autocomplete.d.ts +0 -54
- package/autocomplete/lib/autocomplete.js +0 -265
- package/autocomplete/lib/autocomplete.js.map +0 -1
- package/autocomplete/lib/autocompleteitem/autocomplete-item.d.ts +0 -11
- package/autocomplete/lib/autocompleteitem/autocomplete-item.js +0 -14
- package/autocomplete/lib/autocompleteitem/autocomplete-item.js.map +0 -1
- package/autocomplete/lib/autocompleteitem/harness.d.ts +0 -11
- package/autocomplete/lib/autocompleteitem/harness.js +0 -12
- package/autocomplete/lib/autocompleteitem/harness.js.map +0 -1
- package/autocomplete/lib/autocompletelist/_autocomplete-list.scss +0 -13
- package/autocomplete/lib/autocompletelist/autocomplete-list-styles.css.js +0 -9
- package/autocomplete/lib/autocompletelist/autocomplete-list-styles.css.js.map +0 -1
- package/autocomplete/lib/autocompletelist/autocomplete-list-styles.scss +0 -10
- package/autocomplete/lib/autocompletelist/autocomplete-list.d.ts +0 -14
- package/autocomplete/lib/autocompletelist/autocomplete-list.js +0 -21
- package/autocomplete/lib/autocompletelist/autocomplete-list.js.map +0 -1
- package/autocomplete/lib/autocompletelist/harness.d.ts +0 -11
- package/autocomplete/lib/autocompletelist/harness.js +0 -12
- package/autocomplete/lib/autocompletelist/harness.js.map +0 -1
- package/autocomplete/lib/autocompletesurface/_autocomplete-surface.scss +0 -13
- package/autocomplete/lib/autocompletesurface/autocomplete-surface-styles.css.js +0 -9
- package/autocomplete/lib/autocompletesurface/autocomplete-surface-styles.css.js.map +0 -1
- package/autocomplete/lib/autocompletesurface/autocomplete-surface-styles.scss +0 -10
- package/autocomplete/lib/autocompletesurface/autocomplete-surface.d.ts +0 -13
- package/autocomplete/lib/autocompletesurface/autocomplete-surface.js +0 -21
- package/autocomplete/lib/autocompletesurface/autocomplete-surface.js.map +0 -1
- package/autocomplete/lib/filled-styles.css.d.ts +0 -1
- package/autocomplete/lib/filled-styles.css.js +0 -9
- package/autocomplete/lib/filled-styles.css.js.map +0 -1
- package/autocomplete/lib/filled-styles.scss +0 -10
- package/autocomplete/lib/outlined-styles.css.d.ts +0 -1
- package/autocomplete/lib/outlined-styles.css.js +0 -9
- package/autocomplete/lib/outlined-styles.css.js.map +0 -1
- package/autocomplete/lib/outlined-styles.scss +0 -10
- package/autocomplete/lib/shared-styles.css.js +0 -9
- package/autocomplete/lib/shared-styles.css.js.map +0 -1
- package/autocomplete/outlined-autocomplete.d.ts +0 -28
- package/autocomplete/outlined-autocomplete.js +0 -46
- package/autocomplete/outlined-autocomplete.js.map +0 -1
- package/chips/action/delete-action.d.ts +0 -18
- package/chips/action/delete-action.js +0 -20
- package/chips/action/delete-action.js.map +0 -1
- package/chips/action/lib/action.d.ts +0 -47
- package/chips/action/lib/action.js +0 -162
- package/chips/action/lib/action.js.map +0 -1
- package/chips/action/lib/constants.d.ts +0 -62
- package/chips/action/lib/constants.js +0 -69
- package/chips/action/lib/constants.js.map +0 -1
- package/chips/action/lib/delete-action.d.ts +0 -20
- package/chips/action/lib/delete-action.js +0 -65
- package/chips/action/lib/delete-action.js.map +0 -1
- package/chips/action/lib/events.d.ts +0 -14
- package/chips/action/lib/events.js +0 -16
- package/chips/action/lib/events.js.map +0 -1
- package/chips/action/lib/link-action.d.ts +0 -19
- package/chips/action/lib/link-action.js +0 -55
- package/chips/action/lib/link-action.js.map +0 -1
- package/chips/action/lib/presentational-action.d.ts +0 -15
- package/chips/action/lib/presentational-action.js +0 -30
- package/chips/action/lib/presentational-action.js.map +0 -1
- package/chips/action/lib/primary-action.d.ts +0 -28
- package/chips/action/lib/primary-action.js +0 -88
- package/chips/action/lib/primary-action.js.map +0 -1
- package/chips/action/lib/selectable-action.d.ts +0 -17
- package/chips/action/lib/selectable-action.js +0 -67
- package/chips/action/lib/selectable-action.js.map +0 -1
- package/chips/action/lib/types.d.ts +0 -23
- package/chips/action/lib/types.js +0 -7
- package/chips/action/lib/types.js.map +0 -1
- package/chips/action/link-action.d.ts +0 -18
- package/chips/action/link-action.js +0 -20
- package/chips/action/link-action.js.map +0 -1
- package/chips/action/presentational-action.d.ts +0 -18
- package/chips/action/presentational-action.js +0 -20
- package/chips/action/presentational-action.js.map +0 -1
- package/chips/action/primary-action.d.ts +0 -18
- package/chips/action/primary-action.js +0 -20
- package/chips/action/primary-action.js.map +0 -1
- package/chips/action/selectable-action.d.ts +0 -18
- package/chips/action/selectable-action.js +0 -20
- package/chips/action/selectable-action.js.map +0 -1
- package/chips/chip/lib/_assist-chip-theme.scss +0 -99
- package/chips/chip/lib/_chip-theme.scss +0 -1285
- package/chips/chip/lib/_chip.scss +0 -444
- package/chips/chip/lib/_filter-chip-theme.scss +0 -130
- package/chips/chip/lib/_input-chip-theme.scss +0 -91
- package/chips/chip/lib/_suggestion-chip-theme.scss +0 -92
- package/chips/chip/lib/action-chip.d.ts +0 -18
- package/chips/chip/lib/action-chip.js +0 -39
- package/chips/chip/lib/action-chip.js.map +0 -1
- package/chips/chip/lib/adapter.d.ts +0 -50
- package/chips/chip/lib/adapter.js +0 -7
- package/chips/chip/lib/adapter.js.map +0 -1
- package/chips/chip/lib/animationframe.d.ts +0 -31
- package/chips/chip/lib/animationframe.js +0 -66
- package/chips/chip/lib/animationframe.js.map +0 -1
- package/chips/chip/lib/chip.d.ts +0 -43
- package/chips/chip/lib/chip.js +0 -134
- package/chips/chip/lib/chip.js.map +0 -1
- package/chips/chip/lib/constants.d.ts +0 -43
- package/chips/chip/lib/constants.js +0 -48
- package/chips/chip/lib/constants.js.map +0 -1
- package/chips/chip/lib/foundation.d.ts +0 -41
- package/chips/chip/lib/foundation.js +0 -255
- package/chips/chip/lib/foundation.js.map +0 -1
- package/chips/chip/lib/link-chip.d.ts +0 -21
- package/chips/chip/lib/link-chip.js +0 -53
- package/chips/chip/lib/link-chip.js.map +0 -1
- package/chips/chip/lib/presentational-chip.d.ts +0 -18
- package/chips/chip/lib/presentational-chip.js +0 -39
- package/chips/chip/lib/presentational-chip.js.map +0 -1
- package/chips/chip/lib/selectable-chip.d.ts +0 -22
- package/chips/chip/lib/selectable-chip.js +0 -57
- package/chips/chip/lib/selectable-chip.js.map +0 -1
- package/chips/chip/lib/types.d.ts +0 -42
- package/chips/chip/lib/types.js +0 -7
- package/chips/chip/lib/types.js.map +0 -1
- package/chips/chipset/lib/_chip-set-theme.scss +0 -50
- package/chips/chipset/lib/_chip-set.scss +0 -48
- package/chips/chipset/lib/adapter.d.ts +0 -45
- package/chips/chipset/lib/adapter.js +0 -7
- package/chips/chipset/lib/adapter.js.map +0 -1
- package/chips/chipset/lib/constants.d.ts +0 -26
- package/chips/chipset/lib/constants.js +0 -30
- package/chips/chipset/lib/constants.js.map +0 -1
- package/chips/chipset/lib/foundation.d.ts +0 -68
- package/chips/chipset/lib/foundation.js +0 -314
- package/chips/chipset/lib/foundation.js.map +0 -1
- package/chips/chipset/lib/types.d.ts +0 -41
- package/chips/chipset/lib/types.js +0 -7
- package/chips/chipset/lib/types.js.map +0 -1
- package/controller/foundation.d.ts +0 -24
- package/controller/foundation.js +0 -18
- package/controller/foundation.js.map +0 -1
- package/controller/observer-foundation.d.ts +0 -25
- package/controller/observer-foundation.js +0 -37
- package/controller/observer-foundation.js.map +0 -1
- package/controller/observer.d.ts +0 -52
- package/controller/observer.js +0 -149
- package/controller/observer.js.map +0 -1
- package/decorators/bound.d.ts +0 -40
- package/decorators/bound.js +0 -49
- package/decorators/bound.js.map +0 -1
- package/list/lib/avatar/_list-item-avatar.scss +0 -40
- package/list/lib/avatar/list-item-avatar-styles.css.d.ts +0 -1
- package/list/lib/avatar/list-item-avatar-styles.css.js +0 -9
- package/list/lib/avatar/list-item-avatar-styles.css.js.map +0 -1
- package/list/lib/avatar/list-item-avatar-styles.scss +0 -10
- package/list/lib/avatar/list-item-avatar.d.ts +0 -21
- package/list/lib/avatar/list-item-avatar.js +0 -48
- package/list/lib/avatar/list-item-avatar.js.map +0 -1
- package/list/lib/icon/_list-item-icon.scss +0 -71
- package/list/lib/icon/list-item-icon-styles.css.d.ts +0 -1
- package/list/lib/icon/list-item-icon-styles.css.js +0 -9
- package/list/lib/icon/list-item-icon-styles.css.js.map +0 -1
- package/list/lib/icon/list-item-icon-styles.scss +0 -10
- package/list/lib/icon/list-item-icon.d.ts +0 -9
- package/list/lib/icon/list-item-icon.js +0 -15
- package/list/lib/icon/list-item-icon.js.map +0 -1
- package/list/lib/image/_list-item-image.scss +0 -63
- package/list/lib/image/list-item-image-styles.css.d.ts +0 -1
- package/list/lib/image/list-item-image-styles.css.js +0 -9
- package/list/lib/image/list-item-image-styles.css.js.map +0 -1
- package/list/lib/image/list-item-image-styles.scss +0 -10
- package/list/lib/image/list-item-image.d.ts +0 -21
- package/list/lib/image/list-item-image.js +0 -48
- package/list/lib/image/list-item-image.js.map +0 -1
- package/list/lib/listitem/list-item-private-styles.css.d.ts +0 -1
- package/list/lib/listitem/list-item-private-styles.css.js +0 -9
- package/list/lib/listitem/list-item-private-styles.css.js.map +0 -1
- package/list/lib/video/_list-item-video.scss +0 -71
- package/list/lib/video/list-item-video-styles.css.d.ts +0 -1
- package/list/lib/video/list-item-video-styles.css.js +0 -9
- package/list/lib/video/list-item-video-styles.css.js.map +0 -1
- package/list/lib/video/list-item-video-styles.scss +0 -10
- package/list/lib/video/list-item-video.d.ts +0 -53
- package/list/lib/video/list-item-video.js +0 -115
- package/list/lib/video/list-item-video.js.map +0 -1
- package/list/list-item-avatar.d.ts +0 -20
- package/list/list-item-avatar.js +0 -23
- package/list/list-item-avatar.js.map +0 -1
- package/list/list-item-icon.d.ts +0 -20
- package/list/list-item-icon.js +0 -23
- package/list/list-item-icon.js.map +0 -1
- package/list/list-item-image.d.ts +0 -20
- package/list/list-item-image.js +0 -23
- package/list/list-item-image.js.map +0 -1
- package/list/list-item-video.d.ts +0 -20
- package/list/list-item-video.js +0 -23
- package/list/list-item-video.js.map +0 -1
- package/menu/lib/menuitem/menu-item-private-styles.css.d.ts +0 -1
- package/menu/lib/menuitem/menu-item-private-styles.css.js +0 -9
- package/menu/lib/menuitem/menu-item-private-styles.css.js.map +0 -1
- package/menusurface/_menu-surface.scss +0 -6
- package/menusurface/lib/_md-comp-menu-surface.scss +0 -31
- package/menusurface/lib/_menu-surface.scss +0 -122
- package/menusurface/lib/adapter.d.ts +0 -46
- package/menusurface/lib/adapter.js +0 -7
- package/menusurface/lib/adapter.js.map +0 -1
- package/menusurface/lib/constants.d.ts +0 -71
- package/menusurface/lib/constants.js +0 -83
- package/menusurface/lib/constants.js.map +0 -1
- package/menusurface/lib/foundation.d.ts +0 -176
- package/menusurface/lib/foundation.js +0 -544
- package/menusurface/lib/foundation.js.map +0 -1
- package/menusurface/lib/menu-surface-styles.css.d.ts +0 -1
- package/menusurface/lib/menu-surface-styles.css.js +0 -9
- package/menusurface/lib/menu-surface-styles.css.js.map +0 -1
- package/menusurface/lib/menu-surface-styles.scss +0 -10
- package/menusurface/lib/menu-surface.d.ts +0 -62
- package/menusurface/lib/menu-surface.js +0 -347
- package/menusurface/lib/menu-surface.js.map +0 -1
- package/menusurface/lib/types.d.ts +0 -19
- package/menusurface/lib/types.js +0 -7
- package/menusurface/lib/types.js.map +0 -1
- package/menusurface/menu-surface.d.ts +0 -14
- package/menusurface/menu-surface.js +0 -17
- package/menusurface/menu-surface.js.map +0 -1
- package/sass/_elevation.scss +0 -159
- package/sass/_resolvers.scss +0 -16
- package/sass/_typography.scss +0 -39
- package/tokens/v0_160/_md-comp-menu.scss +0 -121
- /package/{autocomplete/lib/autocompletelist/autocomplete-list-styles.css.d.ts → chips/lib/assist-styles.css.d.ts} +0 -0
- /package/{autocomplete → chips}/lib/shared-styles.css.d.ts +0 -0
- /package/{autocomplete/lib/autocompletesurface/autocomplete-surface-styles.css.d.ts → chips/lib/suggestion-styles.css.d.ts} +0 -0
- /package/tokens/{v0_160 → v0_161}/_index.scss +0 -0
- /package/tokens/{v0_160 → v0_161}/index.test.css.d.ts +0 -0
- /package/tokens/{v0_160 → v0_161}/index.test.css.js +0 -0
- /package/tokens/{v0_160 → v0_161}/index.test.css.js.map +0 -0
- /package/tokens/{v0_160 → v0_161}/index.test.scss +0 -0
- /package/tokens/{v0_160 → v0_161}/lib.test.css.d.ts +0 -0
- /package/tokens/{v0_160 → v0_161}/lib.test.css.js +0 -0
- /package/tokens/{v0_160 → v0_161}/lib.test.css.js.map +0 -0
- /package/tokens/{v0_160 → v0_161}/lib.test.scss +0 -0
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2022 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// go/keep-sorted start
|
|
8
|
-
@use './chip-set-theme';
|
|
9
|
-
// go/keep-sorted end
|
|
10
|
-
|
|
11
|
-
// stylelint-disable selector-class-pattern -- MDC internal usage.
|
|
12
|
-
|
|
13
|
-
@mixin core-styles() {
|
|
14
|
-
@include _static-styles();
|
|
15
|
-
@include _theme-styles();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@mixin _static-styles() {
|
|
19
|
-
.md3-chip-set {
|
|
20
|
-
display: flex;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.md3-chip-set:focus {
|
|
24
|
-
outline: none;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.md3-chip-set__chips {
|
|
28
|
-
display: flex;
|
|
29
|
-
flex-flow: wrap;
|
|
30
|
-
min-width: 0;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.md3-chip-set--overflow .md3-chip-set__chips {
|
|
34
|
-
flex-flow: nowrap;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
@mixin _theme-styles() {
|
|
39
|
-
.md3-chip-set {
|
|
40
|
-
@include chip-set-theme.horizontal-space-between-chips(
|
|
41
|
-
chip-set-theme.$space-between-chips
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
@include chip-set-theme.vertical-space-between-chips(
|
|
45
|
-
chip-set-theme.$space-between-chips
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2022 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { MDCChipActionFocusBehavior, MDCChipActionType } from '../../action/lib/constants.js';
|
|
7
|
-
import { MDCChipAnimation } from '../../chip/lib/constants.js';
|
|
8
|
-
import { MDCChipSetAttributes, MDCChipSetEvents } from './constants.js';
|
|
9
|
-
/**
|
|
10
|
-
* Defines the shape of the adapter expected by the foundation.
|
|
11
|
-
* Implement this adapter for your framework of choice to delegate updates to
|
|
12
|
-
* the component in your framework of choice. See architecture documentation
|
|
13
|
-
* for more details.
|
|
14
|
-
* https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
|
|
15
|
-
*/
|
|
16
|
-
export interface MDCChipSetAdapter {
|
|
17
|
-
/** Announces the message via an aria-live region */
|
|
18
|
-
announceMessage(message: string): void;
|
|
19
|
-
/** Emits the given event with the given detail. */
|
|
20
|
-
emitEvent<D extends object>(eventName: MDCChipSetEvents, eventDetail: D): void;
|
|
21
|
-
/** Returns the value for the given attribute, if it exists. */
|
|
22
|
-
getAttribute(attrName: MDCChipSetAttributes): string | null;
|
|
23
|
-
/** Returns the actions provided by the child chip at the given index. */
|
|
24
|
-
getChipActionsAtIndex(index: number): MDCChipActionType[];
|
|
25
|
-
/** Returns the number of child chips. */
|
|
26
|
-
getChipCount(): number;
|
|
27
|
-
/** Returns the ID of the chip at the given index. */
|
|
28
|
-
getChipIdAtIndex(index: number): string;
|
|
29
|
-
/** Returns the index of the child chip with the matching ID. */
|
|
30
|
-
getChipIndexById(chipID: string): number;
|
|
31
|
-
/** Proxies to the MDCChip#isActionFocusable method. */
|
|
32
|
-
isChipFocusableAtIndex(index: number, actionType: MDCChipActionType): boolean;
|
|
33
|
-
/** Proxies to the MDCChip#isActionSelectable method. */
|
|
34
|
-
isChipSelectableAtIndex(index: number, actionType: MDCChipActionType): boolean;
|
|
35
|
-
/** Proxies to the MDCChip#isActionSelected method. */
|
|
36
|
-
isChipSelectedAtIndex(index: number, actionType: MDCChipActionType): boolean;
|
|
37
|
-
/** Removes the chip at the given index. */
|
|
38
|
-
removeChipAtIndex(index: number): void;
|
|
39
|
-
/** Proxies to the MDCChip#setActionFocus method. */
|
|
40
|
-
setChipFocusAtIndex(index: number, action: MDCChipActionType, focus: MDCChipActionFocusBehavior): void;
|
|
41
|
-
/** Proxies to the MDCChip#setActionSelected method. */
|
|
42
|
-
setChipSelectedAtIndex(index: number, actionType: MDCChipActionType, isSelected: boolean): void;
|
|
43
|
-
/** Starts the chip animation at the given index. */
|
|
44
|
-
startChipAnimationAtIndex(index: number, animation: MDCChipAnimation): void;
|
|
45
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["adapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {MDCChipActionFocusBehavior, MDCChipActionType} from '../../action/lib/constants.js';\nimport {MDCChipAnimation} from '../../chip/lib/constants.js';\n\nimport {MDCChipSetAttributes, MDCChipSetEvents} from './constants.js';\n\n/**\n * Defines the shape of the adapter expected by the foundation.\n * Implement this adapter for your framework of choice to delegate updates to\n * the component in your framework of choice. See architecture documentation\n * for more details.\n * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md\n */\nexport interface MDCChipSetAdapter {\n /** Announces the message via an aria-live region */\n announceMessage(message: string): void;\n\n /** Emits the given event with the given detail. */\n emitEvent<D extends object>(eventName: MDCChipSetEvents, eventDetail: D):\n void;\n\n /** Returns the value for the given attribute, if it exists. */\n getAttribute(attrName: MDCChipSetAttributes): string|null;\n\n /** Returns the actions provided by the child chip at the given index. */\n getChipActionsAtIndex(index: number): MDCChipActionType[];\n\n /** Returns the number of child chips. */\n getChipCount(): number;\n\n /** Returns the ID of the chip at the given index. */\n getChipIdAtIndex(index: number): string;\n\n /** Returns the index of the child chip with the matching ID. */\n getChipIndexById(chipID: string): number;\n\n /** Proxies to the MDCChip#isActionFocusable method. */\n isChipFocusableAtIndex(index: number, actionType: MDCChipActionType): boolean;\n\n /** Proxies to the MDCChip#isActionSelectable method. */\n isChipSelectableAtIndex(index: number, actionType: MDCChipActionType):\n boolean;\n\n /** Proxies to the MDCChip#isActionSelected method. */\n isChipSelectedAtIndex(index: number, actionType: MDCChipActionType): boolean;\n\n /** Removes the chip at the given index. */\n removeChipAtIndex(index: number): void;\n\n /** Proxies to the MDCChip#setActionFocus method. */\n setChipFocusAtIndex(\n index: number, action: MDCChipActionType,\n focus: MDCChipActionFocusBehavior): void;\n\n /** Proxies to the MDCChip#setActionSelected method. */\n setChipSelectedAtIndex(\n index: number, actionType: MDCChipActionType, isSelected: boolean): void;\n\n /** Starts the chip animation at the given index. */\n startChipAnimationAtIndex(index: number, animation: MDCChipAnimation): void;\n}\n"]}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2022 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* MDCChipSetAttributes provides the named constants for attributes used by the
|
|
8
|
-
* foundation.
|
|
9
|
-
*/
|
|
10
|
-
export declare enum MDCChipSetAttributes {
|
|
11
|
-
ARIA_MULTISELECTABLE = "aria-multiselectable"
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* MDCChipSetCssClasses provides the named constants for class names.
|
|
15
|
-
*/
|
|
16
|
-
export declare enum MDCChipSetCssClasses {
|
|
17
|
-
CHIP = "md3-chip"
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* MDCChipSetEvents provides the constants for emitted events.
|
|
21
|
-
*/
|
|
22
|
-
export declare enum MDCChipSetEvents {
|
|
23
|
-
INTERACTION = "MDCChipSet:interaction",
|
|
24
|
-
REMOVAL = "MDCChipSet:removal",
|
|
25
|
-
SELECTION = "MDCChipSet:selection"
|
|
26
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2022 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* MDCChipSetAttributes provides the named constants for attributes used by the
|
|
8
|
-
* foundation.
|
|
9
|
-
*/
|
|
10
|
-
export var MDCChipSetAttributes;
|
|
11
|
-
(function (MDCChipSetAttributes) {
|
|
12
|
-
MDCChipSetAttributes["ARIA_MULTISELECTABLE"] = "aria-multiselectable";
|
|
13
|
-
})(MDCChipSetAttributes || (MDCChipSetAttributes = {}));
|
|
14
|
-
/**
|
|
15
|
-
* MDCChipSetCssClasses provides the named constants for class names.
|
|
16
|
-
*/
|
|
17
|
-
export var MDCChipSetCssClasses;
|
|
18
|
-
(function (MDCChipSetCssClasses) {
|
|
19
|
-
MDCChipSetCssClasses["CHIP"] = "md3-chip";
|
|
20
|
-
})(MDCChipSetCssClasses || (MDCChipSetCssClasses = {}));
|
|
21
|
-
/**
|
|
22
|
-
* MDCChipSetEvents provides the constants for emitted events.
|
|
23
|
-
*/
|
|
24
|
-
export var MDCChipSetEvents;
|
|
25
|
-
(function (MDCChipSetEvents) {
|
|
26
|
-
MDCChipSetEvents["INTERACTION"] = "MDCChipSet:interaction";
|
|
27
|
-
MDCChipSetEvents["REMOVAL"] = "MDCChipSet:removal";
|
|
28
|
-
MDCChipSetEvents["SELECTION"] = "MDCChipSet:selection";
|
|
29
|
-
})(MDCChipSetEvents || (MDCChipSetEvents = {}));
|
|
30
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,CAAN,IAAY,oBAEX;AAFD,WAAY,oBAAoB;IAC9B,qEAA6C,CAAA;AAC/C,CAAC,EAFW,oBAAoB,KAApB,oBAAoB,QAE/B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,oBAEX;AAFD,WAAY,oBAAoB;IAC9B,yCAAiB,CAAA;AACnB,CAAC,EAFW,oBAAoB,KAApB,oBAAoB,QAE/B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,0DAAsC,CAAA;IACtC,kDAA8B,CAAA;IAC9B,sDAAkC,CAAA;AACpC,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * MDCChipSetAttributes provides the named constants for attributes used by the\n * foundation.\n */\nexport enum MDCChipSetAttributes {\n ARIA_MULTISELECTABLE = 'aria-multiselectable',\n}\n\n/**\n * MDCChipSetCssClasses provides the named constants for class names.\n */\nexport enum MDCChipSetCssClasses {\n CHIP = 'md3-chip',\n}\n\n/**\n * MDCChipSetEvents provides the constants for emitted events.\n */\nexport enum MDCChipSetEvents {\n INTERACTION = 'MDCChipSet:interaction',\n REMOVAL = 'MDCChipSet:removal',\n SELECTION = 'MDCChipSet:selection',\n}\n"]}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2022 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { MDCChipActionType } from '../../action/lib/constants.js';
|
|
7
|
-
import { MDCChipSetAdapter } from './adapter.js';
|
|
8
|
-
import { ChipAnimationEvent, ChipInteractionEvent, ChipNavigationEvent } from './types.js';
|
|
9
|
-
/**
|
|
10
|
-
* MDCChipSetFoundation provides a foundation for all chips.
|
|
11
|
-
*/
|
|
12
|
-
export declare class MDCChipSetFoundation {
|
|
13
|
-
private readonly adapter;
|
|
14
|
-
static get defaultAdapter(): MDCChipSetAdapter;
|
|
15
|
-
constructor(adapter?: Partial<MDCChipSetAdapter>);
|
|
16
|
-
handleChipAnimation({ detail }: ChipAnimationEvent): void;
|
|
17
|
-
handleChipInteraction({ detail }: ChipInteractionEvent): void;
|
|
18
|
-
handleChipNavigation({ detail }: ChipNavigationEvent): void;
|
|
19
|
-
/** Returns the unique selected indexes of the chips. */
|
|
20
|
-
getSelectedChipIndexes(): ReadonlySet<number>;
|
|
21
|
-
/** Sets the selected state of the chip at the given index and action. */
|
|
22
|
-
setChipSelected(index: number, action: MDCChipActionType, isSelected: boolean): void;
|
|
23
|
-
/** Returns the selected state of the chip at the given index and action. */
|
|
24
|
-
isChipSelected(index: number, action: MDCChipActionType): boolean;
|
|
25
|
-
/** Removes the chip at the given index. */
|
|
26
|
-
removeChip(index: number): void;
|
|
27
|
-
addChip(index: number): void;
|
|
28
|
-
/**
|
|
29
|
-
* Increments to find the first focusable chip.
|
|
30
|
-
*/
|
|
31
|
-
private focusNextChipFrom;
|
|
32
|
-
/**
|
|
33
|
-
* Decrements to find the first focusable chip. Takes an optional target
|
|
34
|
-
* action that can be used to focus the first matching focusable action.
|
|
35
|
-
*/
|
|
36
|
-
private focusPrevChipFrom;
|
|
37
|
-
/** Returns the appropriate focusable action, or null if none exist. */
|
|
38
|
-
private getFocusableAction;
|
|
39
|
-
/**
|
|
40
|
-
* Returs the first focusable action, regardless of type, or null if no
|
|
41
|
-
* focusable actions exist.
|
|
42
|
-
*/
|
|
43
|
-
private getFirstFocusableAction;
|
|
44
|
-
/**
|
|
45
|
-
* If the actions contain a focusable action that matches the target action,
|
|
46
|
-
* return that. Otherwise, return the first focusable action, or null if no
|
|
47
|
-
* focusable action exists.
|
|
48
|
-
*/
|
|
49
|
-
private getMatchingFocusableAction;
|
|
50
|
-
private focusChip;
|
|
51
|
-
private supportsMultiSelect;
|
|
52
|
-
private setSelection;
|
|
53
|
-
private removeAfterAnimation;
|
|
54
|
-
/**
|
|
55
|
-
* Find the first focusable action by moving bidirectionally horizontally
|
|
56
|
-
* from the start index.
|
|
57
|
-
*
|
|
58
|
-
* Given chip set [A, B, C, D, E, F, G]...
|
|
59
|
-
* Let's say we remove chip "F". We don't know where the nearest focusable
|
|
60
|
-
* action is since any of them could be disabled. The nearest focusable
|
|
61
|
-
* action could be E, it could be G, it could even be A. To find it, we
|
|
62
|
-
* start from the source index (5 for "F" in this case) and move out
|
|
63
|
-
* horizontally, checking each chip at each index.
|
|
64
|
-
*
|
|
65
|
-
*/
|
|
66
|
-
private focusNearestFocusableAction;
|
|
67
|
-
private getNearestFocusableAction;
|
|
68
|
-
}
|
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2022 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { MDCChipActionFocusBehavior, MDCChipActionType } from '../../action/lib/constants.js';
|
|
7
|
-
import { MDCChipAnimation } from '../../chip/lib/constants.js';
|
|
8
|
-
import { MDCChipSetAttributes, MDCChipSetEvents } from './constants.js';
|
|
9
|
-
var Operator;
|
|
10
|
-
(function (Operator) {
|
|
11
|
-
Operator[Operator["INCREMENT"] = 0] = "INCREMENT";
|
|
12
|
-
Operator[Operator["DECREMENT"] = 1] = "DECREMENT";
|
|
13
|
-
})(Operator || (Operator = {}));
|
|
14
|
-
/**
|
|
15
|
-
* MDCChipSetFoundation provides a foundation for all chips.
|
|
16
|
-
*/
|
|
17
|
-
export class MDCChipSetFoundation {
|
|
18
|
-
static get defaultAdapter() {
|
|
19
|
-
return {
|
|
20
|
-
announceMessage: () => undefined,
|
|
21
|
-
emitEvent: () => undefined,
|
|
22
|
-
getAttribute: () => null,
|
|
23
|
-
getChipActionsAtIndex: () => [],
|
|
24
|
-
getChipCount: () => 0,
|
|
25
|
-
getChipIdAtIndex: () => '',
|
|
26
|
-
getChipIndexById: () => 0,
|
|
27
|
-
isChipFocusableAtIndex: () => false,
|
|
28
|
-
isChipSelectableAtIndex: () => false,
|
|
29
|
-
isChipSelectedAtIndex: () => false,
|
|
30
|
-
removeChipAtIndex: () => { },
|
|
31
|
-
setChipFocusAtIndex: () => undefined,
|
|
32
|
-
setChipSelectedAtIndex: () => undefined,
|
|
33
|
-
startChipAnimationAtIndex: () => undefined,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
constructor(adapter) {
|
|
37
|
-
this.adapter = { ...MDCChipSetFoundation.defaultAdapter, ...adapter };
|
|
38
|
-
}
|
|
39
|
-
handleChipAnimation({ detail }) {
|
|
40
|
-
const { chipID, animation, isComplete, addedAnnouncement, removedAnnouncement } = detail;
|
|
41
|
-
const index = this.adapter.getChipIndexById(chipID);
|
|
42
|
-
if (animation === MDCChipAnimation.EXIT && isComplete) {
|
|
43
|
-
if (removedAnnouncement) {
|
|
44
|
-
this.adapter.announceMessage(removedAnnouncement);
|
|
45
|
-
}
|
|
46
|
-
this.removeAfterAnimation(index, chipID);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (animation === MDCChipAnimation.ENTER && isComplete &&
|
|
50
|
-
addedAnnouncement) {
|
|
51
|
-
this.adapter.announceMessage(addedAnnouncement);
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
handleChipInteraction({ detail }) {
|
|
56
|
-
const { source, chipID, isSelectable, isSelected, shouldRemove } = detail;
|
|
57
|
-
const index = this.adapter.getChipIndexById(chipID);
|
|
58
|
-
if (shouldRemove) {
|
|
59
|
-
this.removeChip(index);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
this.focusChip(index, source, MDCChipActionFocusBehavior.FOCUSABLE);
|
|
63
|
-
this.adapter.emitEvent(MDCChipSetEvents.INTERACTION, {
|
|
64
|
-
chipIndex: index,
|
|
65
|
-
chipID,
|
|
66
|
-
});
|
|
67
|
-
if (isSelectable) {
|
|
68
|
-
this.setSelection(index, source, !isSelected);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
handleChipNavigation({ detail }) {
|
|
72
|
-
const { chipID, key, isRTL, source } = detail;
|
|
73
|
-
const index = this.adapter.getChipIndexById(chipID);
|
|
74
|
-
const toNextChip = (key === 'ArrowRight' && !isRTL) || (key === 'ArrowLeft' && isRTL);
|
|
75
|
-
if (toNextChip) {
|
|
76
|
-
// Start from the next chip so we increment the index
|
|
77
|
-
this.focusNextChipFrom(index + 1);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
const toPreviousChip = (key === 'ArrowLeft' && !isRTL) || (key === 'ArrowRight' && isRTL);
|
|
81
|
-
if (toPreviousChip) {
|
|
82
|
-
// Start from the previous chip so we decrement the index
|
|
83
|
-
this.focusPrevChipFrom(index - 1);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (key === 'ArrowDown') {
|
|
87
|
-
// Start from the next chip so we increment the index
|
|
88
|
-
this.focusNextChipFrom(index + 1, source);
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
if (key === 'ArrowUp') {
|
|
92
|
-
// Start from the previous chip so we decrement the index
|
|
93
|
-
this.focusPrevChipFrom(index - 1, source);
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
if (key === 'Home') {
|
|
97
|
-
this.focusNextChipFrom(0, source);
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
if (key === 'End') {
|
|
101
|
-
this.focusPrevChipFrom(this.adapter.getChipCount() - 1, source);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/** Returns the unique selected indexes of the chips. */
|
|
106
|
-
getSelectedChipIndexes() {
|
|
107
|
-
const selectedIndexes = new Set();
|
|
108
|
-
const chipCount = this.adapter.getChipCount();
|
|
109
|
-
for (let i = 0; i < chipCount; i++) {
|
|
110
|
-
const actions = this.adapter.getChipActionsAtIndex(i);
|
|
111
|
-
for (const action of actions) {
|
|
112
|
-
if (this.adapter.isChipSelectedAtIndex(i, action)) {
|
|
113
|
-
selectedIndexes.add(i);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return selectedIndexes;
|
|
118
|
-
}
|
|
119
|
-
/** Sets the selected state of the chip at the given index and action. */
|
|
120
|
-
setChipSelected(index, action, isSelected) {
|
|
121
|
-
if (this.adapter.isChipSelectableAtIndex(index, action)) {
|
|
122
|
-
this.setSelection(index, action, isSelected);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
/** Returns the selected state of the chip at the given index and action. */
|
|
126
|
-
isChipSelected(index, action) {
|
|
127
|
-
return this.adapter.isChipSelectedAtIndex(index, action);
|
|
128
|
-
}
|
|
129
|
-
/** Removes the chip at the given index. */
|
|
130
|
-
removeChip(index) {
|
|
131
|
-
// Early exit if the index is out of bounds
|
|
132
|
-
if (index >= this.adapter.getChipCount() || index < 0)
|
|
133
|
-
return;
|
|
134
|
-
this.adapter.startChipAnimationAtIndex(index, MDCChipAnimation.EXIT);
|
|
135
|
-
this.adapter.emitEvent(MDCChipSetEvents.REMOVAL, {
|
|
136
|
-
chipID: this.adapter.getChipIdAtIndex(index),
|
|
137
|
-
chipIndex: index,
|
|
138
|
-
isComplete: false,
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
addChip(index) {
|
|
142
|
-
// Early exit if the index is out of bounds
|
|
143
|
-
if (index >= this.adapter.getChipCount() || index < 0)
|
|
144
|
-
return;
|
|
145
|
-
this.adapter.startChipAnimationAtIndex(index, MDCChipAnimation.ENTER);
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Increments to find the first focusable chip.
|
|
149
|
-
*/
|
|
150
|
-
focusNextChipFrom(startIndex, targetAction) {
|
|
151
|
-
const chipCount = this.adapter.getChipCount();
|
|
152
|
-
for (let i = startIndex; i < chipCount; i++) {
|
|
153
|
-
const focusableAction = this.getFocusableAction(i, Operator.INCREMENT, targetAction);
|
|
154
|
-
if (focusableAction) {
|
|
155
|
-
this.focusChip(i, focusableAction, MDCChipActionFocusBehavior.FOCUSABLE_AND_FOCUSED);
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Decrements to find the first focusable chip. Takes an optional target
|
|
162
|
-
* action that can be used to focus the first matching focusable action.
|
|
163
|
-
*/
|
|
164
|
-
focusPrevChipFrom(startIndex, targetAction) {
|
|
165
|
-
for (let i = startIndex; i > -1; i--) {
|
|
166
|
-
const focusableAction = this.getFocusableAction(i, Operator.DECREMENT, targetAction);
|
|
167
|
-
if (focusableAction) {
|
|
168
|
-
this.focusChip(i, focusableAction, MDCChipActionFocusBehavior.FOCUSABLE_AND_FOCUSED);
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
/** Returns the appropriate focusable action, or null if none exist. */
|
|
174
|
-
getFocusableAction(index, op, targetAction) {
|
|
175
|
-
const actions = this.adapter.getChipActionsAtIndex(index);
|
|
176
|
-
// Reverse the actions if decrementing
|
|
177
|
-
if (op === Operator.DECREMENT)
|
|
178
|
-
actions.reverse();
|
|
179
|
-
if (targetAction) {
|
|
180
|
-
return this.getMatchingFocusableAction(index, actions, targetAction);
|
|
181
|
-
}
|
|
182
|
-
return this.getFirstFocusableAction(index, actions);
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Returs the first focusable action, regardless of type, or null if no
|
|
186
|
-
* focusable actions exist.
|
|
187
|
-
*/
|
|
188
|
-
getFirstFocusableAction(index, actions) {
|
|
189
|
-
for (const action of actions) {
|
|
190
|
-
if (this.adapter.isChipFocusableAtIndex(index, action)) {
|
|
191
|
-
return action;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
return null;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* If the actions contain a focusable action that matches the target action,
|
|
198
|
-
* return that. Otherwise, return the first focusable action, or null if no
|
|
199
|
-
* focusable action exists.
|
|
200
|
-
*/
|
|
201
|
-
getMatchingFocusableAction(index, actions, targetAction) {
|
|
202
|
-
let focusableAction = null;
|
|
203
|
-
for (const action of actions) {
|
|
204
|
-
if (this.adapter.isChipFocusableAtIndex(index, action)) {
|
|
205
|
-
focusableAction = action;
|
|
206
|
-
}
|
|
207
|
-
// Exit and return the focusable action if it matches the target
|
|
208
|
-
if (focusableAction === targetAction) {
|
|
209
|
-
return focusableAction;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
return focusableAction;
|
|
213
|
-
}
|
|
214
|
-
focusChip(index, action, focus) {
|
|
215
|
-
this.adapter.setChipFocusAtIndex(index, action, focus);
|
|
216
|
-
const chipCount = this.adapter.getChipCount();
|
|
217
|
-
for (let i = 0; i < chipCount; i++) {
|
|
218
|
-
const actions = this.adapter.getChipActionsAtIndex(i);
|
|
219
|
-
for (const chipAction of actions) {
|
|
220
|
-
// Skip the action and index provided since we set it above
|
|
221
|
-
if (chipAction === action && i === index)
|
|
222
|
-
continue;
|
|
223
|
-
this.adapter.setChipFocusAtIndex(i, chipAction, MDCChipActionFocusBehavior.NOT_FOCUSABLE);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
supportsMultiSelect() {
|
|
228
|
-
return this.adapter.getAttribute(MDCChipSetAttributes.ARIA_MULTISELECTABLE) === 'true';
|
|
229
|
-
}
|
|
230
|
-
setSelection(index, action, isSelected) {
|
|
231
|
-
this.adapter.setChipSelectedAtIndex(index, action, isSelected);
|
|
232
|
-
this.adapter.emitEvent(MDCChipSetEvents.SELECTION, {
|
|
233
|
-
chipID: this.adapter.getChipIdAtIndex(index),
|
|
234
|
-
chipIndex: index,
|
|
235
|
-
isSelected,
|
|
236
|
-
});
|
|
237
|
-
// Early exit if we support multi-selection
|
|
238
|
-
if (this.supportsMultiSelect()) {
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
// If we get here, we ony support single selection. This means we need to
|
|
242
|
-
// unselect all chips
|
|
243
|
-
const chipCount = this.adapter.getChipCount();
|
|
244
|
-
for (let i = 0; i < chipCount; i++) {
|
|
245
|
-
const actions = this.adapter.getChipActionsAtIndex(i);
|
|
246
|
-
for (const chipAction of actions) {
|
|
247
|
-
// Skip the action and index provided since we set it above
|
|
248
|
-
if (chipAction === action && i === index)
|
|
249
|
-
continue;
|
|
250
|
-
this.adapter.setChipSelectedAtIndex(i, chipAction, false);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
removeAfterAnimation(index, chipID) {
|
|
255
|
-
this.adapter.removeChipAtIndex(index);
|
|
256
|
-
this.adapter.emitEvent(MDCChipSetEvents.REMOVAL, {
|
|
257
|
-
chipIndex: index,
|
|
258
|
-
isComplete: true,
|
|
259
|
-
chipID,
|
|
260
|
-
});
|
|
261
|
-
const chipCount = this.adapter.getChipCount();
|
|
262
|
-
// Early exit if we have an empty chip set
|
|
263
|
-
if (chipCount <= 0)
|
|
264
|
-
return;
|
|
265
|
-
this.focusNearestFocusableAction(index);
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Find the first focusable action by moving bidirectionally horizontally
|
|
269
|
-
* from the start index.
|
|
270
|
-
*
|
|
271
|
-
* Given chip set [A, B, C, D, E, F, G]...
|
|
272
|
-
* Let's say we remove chip "F". We don't know where the nearest focusable
|
|
273
|
-
* action is since any of them could be disabled. The nearest focusable
|
|
274
|
-
* action could be E, it could be G, it could even be A. To find it, we
|
|
275
|
-
* start from the source index (5 for "F" in this case) and move out
|
|
276
|
-
* horizontally, checking each chip at each index.
|
|
277
|
-
*
|
|
278
|
-
*/
|
|
279
|
-
focusNearestFocusableAction(index) {
|
|
280
|
-
const chipCount = this.adapter.getChipCount();
|
|
281
|
-
let decrIndex = index;
|
|
282
|
-
let incrIndex = index;
|
|
283
|
-
while (decrIndex > -1 || incrIndex < chipCount) {
|
|
284
|
-
const focusAction = this.getNearestFocusableAction(decrIndex, incrIndex, MDCChipActionType.TRAILING);
|
|
285
|
-
if (focusAction) {
|
|
286
|
-
this.focusChip(focusAction.index, focusAction.action, MDCChipActionFocusBehavior.FOCUSABLE_AND_FOCUSED);
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
decrIndex--;
|
|
290
|
-
incrIndex++;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
getNearestFocusableAction(decrIndex, incrIndex, actionType) {
|
|
294
|
-
const decrAction = this.getFocusableAction(decrIndex, Operator.DECREMENT, actionType);
|
|
295
|
-
if (decrAction) {
|
|
296
|
-
return {
|
|
297
|
-
index: decrIndex,
|
|
298
|
-
action: decrAction,
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
// Early exit if the incremented and decremented indices are identical
|
|
302
|
-
if (incrIndex === decrIndex)
|
|
303
|
-
return null;
|
|
304
|
-
const incrAction = this.getFocusableAction(incrIndex, Operator.INCREMENT, actionType);
|
|
305
|
-
if (incrAction) {
|
|
306
|
-
return {
|
|
307
|
-
index: incrIndex,
|
|
308
|
-
action: incrAction,
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
return null;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
//# sourceMappingURL=foundation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"foundation.js","sourceRoot":"","sources":["foundation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,0BAA0B,EAAE,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAAC,gBAAgB,EAAC,MAAM,6BAA6B,CAAC;AAG7D,OAAO,EAAC,oBAAoB,EAAE,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AAQtE,IAAK,QAGJ;AAHD,WAAK,QAAQ;IACX,iDAAS,CAAA;IACT,iDAAS,CAAA;AACX,CAAC,EAHI,QAAQ,KAAR,QAAQ,QAGZ;AAED;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAG/B,MAAM,KAAK,cAAc;QACvB,OAAO;YACL,eAAe,EAAE,GAAG,EAAE,CAAC,SAAS;YAChC,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS;YAC1B,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI;YACxB,qBAAqB,EAAE,GAAG,EAAE,CAAC,EAAE;YAC/B,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC;YACrB,gBAAgB,EAAE,GAAG,EAAE,CAAC,EAAE;YAC1B,gBAAgB,EAAE,GAAG,EAAE,CAAC,CAAC;YACzB,sBAAsB,EAAE,GAAG,EAAE,CAAC,KAAK;YACnC,uBAAuB,EAAE,GAAG,EAAE,CAAC,KAAK;YACpC,qBAAqB,EAAE,GAAG,EAAE,CAAC,KAAK;YAClC,iBAAiB,EAAE,GAAG,EAAE,GAAE,CAAC;YAC3B,mBAAmB,EAAE,GAAG,EAAE,CAAC,SAAS;YACpC,sBAAsB,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AW,GAAG,IAAI,CAAC,yBAAyB,CAC9C,SAAS,EAAE,SAAS,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;YACtD,IAAI,WAAW,EAAE;gBACf,IAAI,CAAC,SAAS,CACV,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EACrC,0BAA0B,CAAC,qBAAqB,CAAC,CAAC;gBACtD,OAAO;aACR;YAED,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,CAAC;SACb;IACH,CAAC;IAEO,yBAAyB,CAC7B,SAAiB,EAAE,SAAiB,EACpC,UAA8B;QAChC,MAAM,UAAU,GACZ,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACvE,IAAI,UAAU,EAAE;YACd,OAAO;gBACL,KAAK,EAAE,SAAS;gBAChB,MAAM,EAAE,UAAU;aACnB,CAAC;SACH;QAED,sEAAsE;QACtE,IAAI,SAAS,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC;QAEzC,MAAM,UAAU,GACZ,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACvE,IAAI,UAAU,EAAE;YACd,OAAO;gBACL,KAAK,EAAE,SAAS;gBAChB,MAAM,EAAE,UAAU;aACnB,CAAC;SACH;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {MDCChipActionFocusBehavior, MDCChipActionType} from '../../action/lib/constants.js';\nimport {MDCChipAnimation} from '../../chip/lib/constants.js';\n\nimport {MDCChipSetAdapter} from './adapter.js';\nimport {MDCChipSetAttributes, MDCChipSetEvents} from './constants.js';\nimport {ChipAnimationEvent, ChipInteractionEvent, ChipNavigationEvent, MDCChipSetInteractionEventDetail, MDCChipSetRemovalEventDetail, MDCChipSetSelectionEventDetail} from './types.js';\n\ninterface FocusAction {\n action: MDCChipActionType;\n index: number;\n}\n\nenum Operator {\n INCREMENT,\n DECREMENT,\n}\n\n/**\n * MDCChipSetFoundation provides a foundation for all chips.\n */\nexport class MDCChipSetFoundation {\n private readonly adapter: MDCChipSetAdapter;\n\n static get defaultAdapter(): MDCChipSetAdapter {\n return {\n announceMessage: () => undefined,\n emitEvent: () => undefined,\n getAttribute: () => null,\n getChipActionsAtIndex: () => [],\n getChipCount: () => 0,\n getChipIdAtIndex: () => '',\n getChipIndexById: () => 0,\n isChipFocusableAtIndex: () => false,\n isChipSelectableAtIndex: () => false,\n isChipSelectedAtIndex: () => false,\n removeChipAtIndex: () => {},\n setChipFocusAtIndex: () => undefined,\n setChipSelectedAtIndex: () => undefined,\n startChipAnimationAtIndex: () => undefined,\n };\n }\n\n constructor(adapter?: Partial<MDCChipSetAdapter>) {\n this.adapter = {...MDCChipSetFoundation.defaultAdapter, ...adapter};\n }\n\n handleChipAnimation({detail}: ChipAnimationEvent) {\n const {\n chipID,\n animation,\n isComplete,\n addedAnnouncement,\n removedAnnouncement\n } = detail;\n const index = this.adapter.getChipIndexById(chipID);\n\n if (animation === MDCChipAnimation.EXIT && isComplete) {\n if (removedAnnouncement) {\n this.adapter.announceMessage(removedAnnouncement);\n }\n this.removeAfterAnimation(index, chipID);\n return;\n }\n\n if (animation === MDCChipAnimation.ENTER && isComplete &&\n addedAnnouncement) {\n this.adapter.announceMessage(addedAnnouncement);\n return;\n }\n }\n\n handleChipInteraction({detail}: ChipInteractionEvent) {\n const {source, chipID, isSelectable, isSelected, shouldRemove} = detail;\n const index = this.adapter.getChipIndexById(chipID);\n\n if (shouldRemove) {\n this.removeChip(index);\n return;\n }\n\n this.focusChip(index, source, MDCChipActionFocusBehavior.FOCUSABLE);\n this.adapter.emitEvent<MDCChipSetInteractionEventDetail>(\n MDCChipSetEvents.INTERACTION, {\n chipIndex: index,\n chipID,\n });\n\n if (isSelectable) {\n this.setSelection(index, source, !isSelected);\n }\n }\n\n handleChipNavigation({detail}: ChipNavigationEvent) {\n const {chipID, key, isRTL, source} = detail;\n const index = this.adapter.getChipIndexById(chipID);\n\n const toNextChip =\n (key === 'ArrowRight' && !isRTL) || (key === 'ArrowLeft' && isRTL);\n if (toNextChip) {\n // Start from the next chip so we increment the index\n this.focusNextChipFrom(index + 1);\n return;\n }\n\n const toPreviousChip =\n (key === 'ArrowLeft' && !isRTL) || (key === 'ArrowRight' && isRTL);\n if (toPreviousChip) {\n // Start from the previous chip so we decrement the index\n this.focusPrevChipFrom(index - 1);\n return;\n }\n\n if (key === 'ArrowDown') {\n // Start from the next chip so we increment the index\n this.focusNextChipFrom(index + 1, source);\n return;\n }\n\n if (key === 'ArrowUp') {\n // Start from the previous chip so we decrement the index\n this.focusPrevChipFrom(index - 1, source);\n return;\n }\n\n if (key === 'Home') {\n this.focusNextChipFrom(0, source);\n return;\n }\n\n if (key === 'End') {\n this.focusPrevChipFrom(this.adapter.getChipCount() - 1, source);\n return;\n }\n }\n\n /** Returns the unique selected indexes of the chips. */\n getSelectedChipIndexes(): ReadonlySet<number> {\n const selectedIndexes = new Set<number>();\n const chipCount = this.adapter.getChipCount();\n for (let i = 0; i < chipCount; i++) {\n const actions = this.adapter.getChipActionsAtIndex(i);\n for (const action of actions) {\n if (this.adapter.isChipSelectedAtIndex(i, action)) {\n selectedIndexes.add(i);\n }\n }\n }\n return selectedIndexes;\n }\n\n /** Sets the selected state of the chip at the given index and action. */\n setChipSelected(\n index: number, action: MDCChipActionType, isSelected: boolean) {\n if (this.adapter.isChipSelectableAtIndex(index, action)) {\n this.setSelection(index, action, isSelected);\n }\n }\n\n /** Returns the selected state of the chip at the given index and action. */\n isChipSelected(index: number, action: MDCChipActionType): boolean {\n return this.adapter.isChipSelectedAtIndex(index, action);\n }\n\n /** Removes the chip at the given index. */\n removeChip(index: number) {\n // Early exit if the index is out of bounds\n if (index >= this.adapter.getChipCount() || index < 0) return;\n this.adapter.startChipAnimationAtIndex(index, MDCChipAnimation.EXIT);\n this.adapter.emitEvent<MDCChipSetRemovalEventDetail>(\n MDCChipSetEvents.REMOVAL, {\n chipID: this.adapter.getChipIdAtIndex(index),\n chipIndex: index,\n isComplete: false,\n });\n }\n\n addChip(index: number) {\n // Early exit if the index is out of bounds\n if (index >= this.adapter.getChipCount() || index < 0) return;\n this.adapter.startChipAnimationAtIndex(index, MDCChipAnimation.ENTER);\n }\n\n /**\n * Increments to find the first focusable chip.\n */\n private focusNextChipFrom(\n startIndex: number, targetAction?: MDCChipActionType) {\n const chipCount = this.adapter.getChipCount();\n for (let i = startIndex; i < chipCount; i++) {\n const focusableAction =\n this.getFocusableAction(i, Operator.INCREMENT, targetAction);\n if (focusableAction) {\n this.focusChip(\n i, focusableAction,\n MDCChipActionFocusBehavior.FOCUSABLE_AND_FOCUSED);\n return;\n }\n }\n }\n\n /**\n * Decrements to find the first focusable chip. Takes an optional target\n * action that can be used to focus the first matching focusable action.\n */\n private focusPrevChipFrom(\n startIndex: number, targetAction?: MDCChipActionType) {\n for (let i = startIndex; i > -1; i--) {\n const focusableAction =\n this.getFocusableAction(i, Operator.DECREMENT, targetAction);\n if (focusableAction) {\n this.focusChip(\n i, focusableAction,\n MDCChipActionFocusBehavior.FOCUSABLE_AND_FOCUSED);\n return;\n }\n }\n }\n\n /** Returns the appropriate focusable action, or null if none exist. */\n private getFocusableAction(\n index: number, op: Operator,\n targetAction?: MDCChipActionType): MDCChipActionType|null {\n const actions = this.adapter.getChipActionsAtIndex(index);\n // Reverse the actions if decrementing\n if (op === Operator.DECREMENT) actions.reverse();\n\n if (targetAction) {\n return this.getMatchingFocusableAction(index, actions, targetAction);\n }\n\n return this.getFirstFocusableAction(index, actions);\n }\n\n /**\n * Returs the first focusable action, regardless of type, or null if no\n * focusable actions exist.\n */\n private getFirstFocusableAction(index: number, actions: MDCChipActionType[]):\n MDCChipActionType|null {\n for (const action of actions) {\n if (this.adapter.isChipFocusableAtIndex(index, action)) {\n return action;\n }\n }\n return null;\n }\n\n /**\n * If the actions contain a focusable action that matches the target action,\n * return that. Otherwise, return the first focusable action, or null if no\n * focusable action exists.\n */\n private getMatchingFocusableAction(\n index: number, actions: MDCChipActionType[],\n targetAction: MDCChipActionType): MDCChipActionType|null {\n let focusableAction = null;\n for (const action of actions) {\n if (this.adapter.isChipFocusableAtIndex(index, action)) {\n focusableAction = action;\n }\n\n // Exit and return the focusable action if it matches the target\n if (focusableAction === targetAction) {\n return focusableAction;\n }\n }\n return focusableAction;\n }\n\n private focusChip(\n index: number, action: MDCChipActionType,\n focus: MDCChipActionFocusBehavior) {\n this.adapter.setChipFocusAtIndex(index, action, focus);\n const chipCount = this.adapter.getChipCount();\n for (let i = 0; i < chipCount; i++) {\n const actions = this.adapter.getChipActionsAtIndex(i);\n for (const chipAction of actions) {\n // Skip the action and index provided since we set it above\n if (chipAction === action && i === index) continue;\n this.adapter.setChipFocusAtIndex(\n i, chipAction, MDCChipActionFocusBehavior.NOT_FOCUSABLE);\n }\n }\n }\n\n private supportsMultiSelect(): boolean {\n return this.adapter.getAttribute(\n MDCChipSetAttributes.ARIA_MULTISELECTABLE) === 'true';\n }\n\n private setSelection(\n index: number, action: MDCChipActionType, isSelected: boolean) {\n this.adapter.setChipSelectedAtIndex(index, action, isSelected);\n this.adapter.emitEvent<MDCChipSetSelectionEventDetail>(\n MDCChipSetEvents.SELECTION, {\n chipID: this.adapter.getChipIdAtIndex(index),\n chipIndex: index,\n isSelected,\n });\n // Early exit if we support multi-selection\n if (this.supportsMultiSelect()) {\n return;\n }\n\n // If we get here, we ony support single selection. This means we need to\n // unselect all chips\n const chipCount = this.adapter.getChipCount();\n for (let i = 0; i < chipCount; i++) {\n const actions = this.adapter.getChipActionsAtIndex(i);\n for (const chipAction of actions) {\n // Skip the action and index provided since we set it above\n if (chipAction === action && i === index) continue;\n this.adapter.setChipSelectedAtIndex(i, chipAction, false);\n }\n }\n }\n\n private removeAfterAnimation(index: number, chipID: string) {\n this.adapter.removeChipAtIndex(index);\n this.adapter.emitEvent<MDCChipSetRemovalEventDetail>(\n MDCChipSetEvents.REMOVAL, {\n chipIndex: index,\n isComplete: true,\n chipID,\n });\n\n const chipCount = this.adapter.getChipCount();\n // Early exit if we have an empty chip set\n if (chipCount <= 0) return;\n this.focusNearestFocusableAction(index);\n }\n\n /**\n * Find the first focusable action by moving bidirectionally horizontally\n * from the start index.\n *\n * Given chip set [A, B, C, D, E, F, G]...\n * Let's say we remove chip \"F\". We don't know where the nearest focusable\n * action is since any of them could be disabled. The nearest focusable\n * action could be E, it could be G, it could even be A. To find it, we\n * start from the source index (5 for \"F\" in this case) and move out\n * horizontally, checking each chip at each index.\n *\n */\n private focusNearestFocusableAction(index: number) {\n const chipCount = this.adapter.getChipCount();\n let decrIndex = index;\n let incrIndex = index;\n while (decrIndex > -1 || incrIndex < chipCount) {\n const focusAction = this.getNearestFocusableAction(\n decrIndex, incrIndex, MDCChipActionType.TRAILING);\n if (focusAction) {\n this.focusChip(\n focusAction.index, focusAction.action,\n MDCChipActionFocusBehavior.FOCUSABLE_AND_FOCUSED);\n return;\n }\n\n decrIndex--;\n incrIndex++;\n }\n }\n\n private getNearestFocusableAction(\n decrIndex: number, incrIndex: number,\n actionType?: MDCChipActionType): FocusAction|null {\n const decrAction =\n this.getFocusableAction(decrIndex, Operator.DECREMENT, actionType);\n if (decrAction) {\n return {\n index: decrIndex,\n action: decrAction,\n };\n }\n\n // Early exit if the incremented and decremented indices are identical\n if (incrIndex === decrIndex) return null;\n\n const incrAction =\n this.getFocusableAction(incrIndex, Operator.INCREMENT, actionType);\n if (incrAction) {\n return {\n index: incrIndex,\n action: incrAction,\n };\n }\n\n return null;\n }\n}\n"]}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2022 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { MDCChipAnimationEventDetail, MDCChipInteractionEventDetail, MDCChipNavigationEventDetail } from '../../chip/lib/types.js';
|
|
7
|
-
/**
|
|
8
|
-
* MDCChipSetInteractionEventDetail provides detail about the interaction event.
|
|
9
|
-
*/
|
|
10
|
-
export interface MDCChipSetInteractionEventDetail {
|
|
11
|
-
chipID: string;
|
|
12
|
-
chipIndex: number;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* MDCChipSetRemovalEventDetail provides detail about the removal event.
|
|
16
|
-
*/
|
|
17
|
-
export interface MDCChipSetRemovalEventDetail {
|
|
18
|
-
chipID: string;
|
|
19
|
-
chipIndex: number;
|
|
20
|
-
isComplete: boolean;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* MDCChipSetSelectionEventDetail provides detail about the selection event.
|
|
24
|
-
*/
|
|
25
|
-
export interface MDCChipSetSelectionEventDetail {
|
|
26
|
-
chipID: string;
|
|
27
|
-
chipIndex: number;
|
|
28
|
-
isSelected: boolean;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* ChipInteractionEvent is the custom event for the interaction event.
|
|
32
|
-
*/
|
|
33
|
-
export type ChipInteractionEvent = CustomEvent<MDCChipInteractionEventDetail>;
|
|
34
|
-
/**
|
|
35
|
-
* ChipNavigationEvent is the custom event for the navigation event.
|
|
36
|
-
*/
|
|
37
|
-
export type ChipNavigationEvent = CustomEvent<MDCChipNavigationEventDetail>;
|
|
38
|
-
/**
|
|
39
|
-
* ChipAnimationEvent is the custom event for the animation event.
|
|
40
|
-
*/
|
|
41
|
-
export type ChipAnimationEvent = CustomEvent<MDCChipAnimationEventDetail>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA;;;;GAIG","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {MDCChipAnimationEventDetail, MDCChipInteractionEventDetail, MDCChipNavigationEventDetail} from '../../chip/lib/types.js';\n\n/**\n * MDCChipSetInteractionEventDetail provides detail about the interaction event.\n */\nexport interface MDCChipSetInteractionEventDetail {\n chipID: string;\n chipIndex: number;\n}\n\n/**\n * MDCChipSetRemovalEventDetail provides detail about the removal event.\n */\nexport interface MDCChipSetRemovalEventDetail {\n chipID: string;\n chipIndex: number;\n isComplete: boolean;\n}\n\n/**\n * MDCChipSetSelectionEventDetail provides detail about the selection event.\n */\nexport interface MDCChipSetSelectionEventDetail {\n chipID: string;\n chipIndex: number;\n isSelected: boolean;\n}\n\n/**\n * ChipInteractionEvent is the custom event for the interaction event.\n */\nexport type ChipInteractionEvent = CustomEvent<MDCChipInteractionEventDetail>;\n\n/**\n * ChipNavigationEvent is the custom event for the navigation event.\n */\nexport type ChipNavigationEvent = CustomEvent<MDCChipNavigationEventDetail>;\n\n/**\n * ChipAnimationEvent is the custom event for the animation event.\n */\nexport type ChipAnimationEvent = CustomEvent<MDCChipAnimationEventDetail>;\n"]}
|