@material/web 1.0.0-pre.7 → 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 +3 -3
- package/aria/aria.js +37 -13
- package/aria/aria.js.map +1 -1
- package/aria/delegate.d.ts +1 -1
- package/aria/delegate.js +1 -1
- package/aria/delegate.js.map +1 -1
- package/badge/lib/badge.d.ts +0 -3
- package/badge/lib/badge.js +4 -6
- package/badge/lib/badge.js.map +1 -1
- package/button/lib/_elevated-button.scss +35 -6
- 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 +23 -26
- package/button/lib/button.js +12 -30
- 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-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 -6
- package/checkbox/lib/checkbox.js +3 -20
- 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/assist-chip.js +2 -1
- package/chips/assist-chip.js.map +1 -1
- package/chips/filter-chip.js +2 -1
- package/chips/filter-chip.js.map +1 -1
- package/chips/lib/_assist-chip.scss +37 -3
- package/chips/lib/_elevated.scss +60 -0
- package/chips/lib/_filter-chip.scss +43 -9
- package/chips/lib/_shared.scss +36 -76
- 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 +19 -16
- package/chips/lib/chip.js +43 -63
- package/chips/lib/chip.js.map +1 -1
- package/chips/lib/elevated-styles.css.d.ts +1 -0
- package/chips/lib/elevated-styles.css.js +9 -0
- package/chips/lib/elevated-styles.css.js.map +1 -0
- package/chips/lib/elevated-styles.scss +10 -0
- package/chips/lib/filter-chip.d.ts +6 -1
- package/chips/lib/filter-chip.js +38 -5
- package/chips/lib/filter-chip.js.map +1 -1
- package/chips/lib/filter-styles.css.js +1 -1
- package/chips/lib/filter-styles.css.js.map +1 -1
- 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/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 -6
- package/circularprogress/lib/circular-progress.js +1 -2
- package/circularprogress/lib/circular-progress.js.map +1 -1
- package/dialog/lib/_dialog.scss +0 -1
- package/dialog/lib/_tokens.scss +0 -1
- package/dialog/lib/dialog.d.ts +10 -10
- package/dialog/lib/dialog.js +8 -7
- package/dialog/lib/dialog.js.map +1 -1
- package/elevation/lib/elevation.d.ts +1 -1
- package/elevation/lib/elevation.js.map +1 -1
- package/fab/branded-fab.d.ts +3 -0
- package/fab/lib/_fab-branded.scss +58 -4
- package/fab/lib/_fab.scss +80 -6
- package/fab/lib/_shared.scss +8 -3
- package/fab/lib/fab-branded-styles.css.js +1 -1
- package/fab/lib/fab-branded-styles.css.js.map +1 -1
- 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 +4 -0
- package/fab/lib/forced-colors-styles.css.js +1 -1
- package/fab/lib/forced-colors-styles.css.js.map +1 -1
- package/fab/lib/shared-styles.css.js +1 -1
- package/fab/lib/shared-styles.css.js.map +1 -1
- package/fab/lib/shared.d.ts +12 -15
- package/fab/lib/shared.js +2 -26
- package/fab/lib/shared.js.map +1 -1
- package/field/lib/_filled-field.scss +47 -12
- package/field/lib/_outlined-field.scss +39 -12
- 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 -0
- package/focus/focus-ring.js +2 -0
- 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 +116 -11
- package/focus/lib/focus-ring.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 -21
- package/iconbutton/lib/icon-button.js +12 -28
- 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/lib/_linear-progress.scss +78 -72
- package/linearprogress/lib/linear-progress.d.ts +5 -5
- package/linearprogress/lib/linear-progress.js +1 -1
- package/linearprogress/lib/linear-progress.js.map +1 -1
- package/list/lib/_list.scss +4 -2
- package/list/lib/list.d.ts +7 -12
- package/list/lib/list.js +2 -11
- package/list/lib/list.js.map +1 -1
- package/list/lib/listitem/_list-item.scss +8 -4
- 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 +27 -27
- package/list/lib/listitem/list-item.js +4 -29
- package/list/lib/listitem/list-item.js.map +1 -1
- package/list/lib/listitemlink/list-item-link.js +1 -3
- package/list/lib/listitemlink/list-item-link.js.map +1 -1
- package/menu/lib/_menu.scss +4 -2
- 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 +31 -39
- package/menu/lib/menu.js +14 -20
- package/menu/lib/menu.js.map +1 -1
- package/menu/lib/menuitem/_menu-item.scss +4 -2
- package/menu/lib/shared.d.ts +14 -0
- 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 -11
- package/menu/lib/submenuitem/sub-menu-item.js +20 -3
- 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.d.ts +2 -2
- package/navigationbar/lib/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 +3 -3
- 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 +2 -2
- 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/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 +9 -17
- package/navigationtab/lib/navigation-tab.js +3 -22
- 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/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 -7
- package/radio/lib/radio.js +2 -22
- package/radio/lib/radio.js.map +1 -1
- package/ripple/lib/ripple.js +4 -0
- package/ripple/lib/ripple.js.map +1 -1
- package/segmentedbutton/lib/segmented-button.d.ts +15 -21
- package/segmentedbutton/lib/segmented-button.js +3 -24
- package/segmentedbutton/lib/segmented-button.js.map +1 -1
- package/segmentedbuttonset/lib/_outlined-segmented-button-set.scss +32 -13
- 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 +1 -1
- package/segmentedbuttonset/lib/segmented-button-set.js.map +1 -1
- package/select/lib/_filled-select.scss +66 -7
- package/select/lib/_outlined-select.scss +41 -7
- package/select/lib/filled-select-styles.css.js +1 -1
- package/select/lib/filled-select-styles.css.js.map +1 -1
- package/select/lib/outlined-select-styles.css.js +1 -1
- package/select/lib/outlined-select-styles.css.js.map +1 -1
- package/select/lib/select.d.ts +46 -48
- package/select/lib/select.js +21 -19
- package/select/lib/select.js.map +1 -1
- package/slider/harness.d.ts +1 -1
- package/slider/harness.js +9 -9
- package/slider/harness.js.map +1 -1
- package/slider/lib/_slider.scss +6 -6
- 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 +22 -51
- package/slider/lib/slider.js +18 -54
- 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 -5
- package/switch/lib/switch.js +2 -27
- 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 -1
- package/textfield/lib/text-field.js.map +1 -1
- package/tokens/_index.scss +2 -18
- package/tokens/_md-comp-assist-chip.scss +0 -9
- 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-fab-branded.scss +6 -31
- package/tokens/_md-comp-fab.scss +9 -50
- 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 +4 -30
- 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 +0 -10
- 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 +0 -10
- package/tokens/_md-comp-linear-progress-indicator.scss +23 -8
- package/tokens/_md-comp-list-item.scss +0 -27
- package/tokens/_md-comp-list.scss +3 -29
- package/tokens/_md-comp-menu-item.scss +3 -29
- package/tokens/_md-comp-menu.scss +0 -23
- 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 +1 -28
- package/tokens/_md-comp-outlined-text-field.scss +85 -8
- package/tokens/_md-comp-suggestion-chip.scss +0 -9
- package/tokens/_md-comp-switch.scss +81 -1
- package/tokens/_md-comp-text-button.scss +0 -10
- package/tokens/_values.scss +2 -7
- package/types/aria.d.ts +0 -2
- package/focus/strong-focus.d.ts +0 -56
- package/focus/strong-focus.js +0 -101
- package/focus/strong-focus.js.map +0 -1
- package/sass/_shape.scss +0 -154
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-tab.js","sourceRoot":"","sources":["navigation-tab.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,2BAA2B,CAAC;AACnC,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,KAAK,CAAC;AAC9D,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAE5C,OAAO,EAAC,yBAAyB,EAAC,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"navigation-tab.js","sourceRoot":"","sources":["navigation-tab.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,2BAA2B,CAAC;AACnC,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,KAAK,CAAC;AAC9D,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAE5C,OAAO,EAAC,yBAAyB,EAAC,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAC,MAAM,EAAC,MAAM,2BAA2B,CAAC;AAMjD;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,UAAU;IAA7C;;QAK6B,aAAQ,GAAG,KAAK,CAAC;QACF,WAAM,GAAG,KAA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OAAO,EAAE,IAAI,EAAC,CAAC;6CAAgB;AAC9B;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;wDAA2B;AACzC;IAAX,QAAQ,EAAE;4CAAgB;AACf;IAAX,QAAQ,EAAE;iDAAiB;AACD;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;gDAAmB;AAEpC;IAAR,KAAK,EAAE;iDAA4B;AAEnB;IAAhB,KAAK,CAAC,QAAQ,CAAC;oDAAkC;AAEzB;IAAxB,UAAU,CAAC,WAAW,CAAC;6CAAiC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../badge/badge.js';\nimport '../../focus/focus-ring.js';\nimport '../../ripple/ripple.js';\n\nimport {html, LitElement, nothing, PropertyValues} from 'lit';\nimport {property, query, queryAsync, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {when} from 'lit/directives/when.js';\n\nimport {requestUpdateOnAriaChange} from '../../aria/delegate.js';\nimport {ripple} from '../../ripple/directive.js';\nimport {MdRipple} from '../../ripple/ripple.js';\nimport {ARIAMixinStrict} from '../../types/aria.js';\n\nimport {NavigationTabState} from './state.js';\n\n/**\n * TODO(b/265346501): add docs\n */\nexport class NavigationTab extends LitElement implements NavigationTabState {\n static {\n requestUpdateOnAriaChange(this);\n }\n\n @property({type: Boolean}) disabled = false;\n @property({type: Boolean, reflect: true}) active = false;\n @property({type: Boolean}) hideInactiveLabel = false;\n @property() label?: string;\n @property() badgeValue = '';\n @property({type: Boolean}) showBadge = false;\n\n @state() private showRipple = false;\n\n @query('button') buttonElement!: HTMLElement|null;\n\n @queryAsync('md-ripple') ripple!: Promise<MdRipple|null>;\n\n protected override render() {\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n <button\n class=\"md3-navigation-tab ${classMap(this.getRenderClasses())}\"\n role=\"tab\"\n aria-selected=\"${this.active}\"\n aria-label=${ariaLabel || nothing}\n tabindex=\"${this.active ? 0 : -1}\"\n @click=\"${this.handleClick}\"\n ${ripple(this.getRipple)}>\n <md-focus-ring></md-focus-ring>\n ${when(this.showRipple, this.renderRipple)}\n <span aria-hidden=\"true\" class=\"md3-navigation-tab__icon-content\"\n ><span class=\"md3-navigation-tab__active-indicator\"\n ></span><span class=\"md3-navigation-tab__icon\"\n ><slot name=\"inactiveIcon\"></slot\n ></span>\n <span class=\"md3-navigation-tab__icon md3-navigation-tab__icon--active\"\n ><slot name=\"activeIcon\"></slot\n ></span>${this.renderBadge()}</span\n >${this.renderLabel()}\n </button>`;\n }\n\n private getRenderClasses() {\n return {\n 'md3-navigation-tab--hide-inactive-label': this.hideInactiveLabel,\n 'md3-navigation-tab--active': this.active,\n };\n }\n\n private readonly getRipple = () => {\n this.showRipple = true;\n return this.ripple;\n };\n\n private readonly renderRipple = () => {\n return html`<md-ripple ?disabled=\"${\n this.disabled}\" class=\"md3-navigation-tab__ripple\"></md-ripple>`;\n };\n\n private renderBadge() {\n return this.showBadge ?\n html`<md-badge .value=\"${this.badgeValue}\"></md-badge>` :\n nothing;\n }\n\n private renderLabel() {\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n const ariaHidden = ariaLabel ? 'true' : 'false';\n return !this.label ?\n nothing :\n html`\n <span aria-hidden=\"${\n ariaHidden}\" class=\"md3-navigation-tab__label-text\">${\n this.label}</span>`;\n }\n\n override firstUpdated(changedProperties: PropertyValues) {\n super.firstUpdated(changedProperties);\n const event =\n new Event('navigation-tab-rendered', {bubbles: true, composed: true});\n this.dispatchEvent(event);\n }\n\n override focus() {\n const buttonElement = this.buttonElement;\n if (buttonElement) {\n buttonElement.focus();\n }\n }\n\n override blur() {\n const buttonElement = this.buttonElement;\n if (buttonElement) {\n buttonElement.blur();\n }\n }\n\n handleClick() {\n // TODO(b/269772145): connect to ripple\n this.dispatchEvent(new CustomEvent(\n 'navigation-tab-interaction',\n {detail: {state: this}, bubbles: true, composed: true}));\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["state.ts"],"names":[],"mappings":"AAAA;;;;GAIG","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The state of a navigation tab.\n */\nexport interface NavigationTabState {\n /**\n * Active state of the navigation tab.\n */\n active: boolean;\n /**\n * If true, when inactive label will be hidden.\n */\n hideInactiveLabel: boolean;\n\n /**\n * Inner button for the tab\n * TODO(b/229015424): Remove this when the jscompiler rename issue is\n * understood.\n */\n buttonElement: HTMLElement;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["state.ts"],"names":[],"mappings":"AAAA;;;;GAIG","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * The state of a navigation tab.\n */\nexport interface NavigationTabState {\n /**\n * Active state of the navigation tab.\n */\n active: boolean;\n /**\n * If true, when inactive label will be hidden.\n */\n hideInactiveLabel: boolean;\n\n /**\n * Inner button for the tab\n * TODO(b/229015424): Remove this when the jscompiler rename issue is\n * understood.\n */\n buttonElement: HTMLElement|null;\n}\n"]}
|
package/package.json
CHANGED
package/radio/lib/_radio.scss
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { css } from 'lit';
|
|
7
|
-
export const styles = css `:host{--_disabled-selected-icon-color: var(--md-radio-disabled-selected-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-selected-icon-opacity: var(--md-radio-disabled-selected-icon-opacity, 0.38);--_disabled-unselected-icon-color: var(--md-radio-disabled-unselected-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-unselected-icon-opacity: var(--md-radio-disabled-unselected-icon-opacity, 0.38);--_icon-size: var(--md-radio-icon-size, 20px);--_selected-focus-icon-color: var(--md-radio-selected-focus-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-focus-state-layer-color: var(--md-radio-selected-focus-state-layer-color, var(--md-sys-color-primary, #6750a4));--_selected-focus-state-layer-opacity: var(--md-radio-selected-focus-state-layer-opacity, 0.12);--_selected-hover-icon-color: var(--md-radio-selected-hover-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-hover-state-layer-color: var(--md-radio-selected-hover-state-layer-color, var(--md-sys-color-primary, #6750a4));--_selected-hover-state-layer-opacity: var(--md-radio-selected-hover-state-layer-opacity, 0.08);--_selected-icon-color: var(--md-radio-selected-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-pressed-icon-color: var(--md-radio-selected-pressed-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-pressed-state-layer-color: var(--md-radio-selected-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_selected-pressed-state-layer-opacity: var(--md-radio-selected-pressed-state-layer-opacity, 0.12);--_state-layer-size: var(--md-radio-state-layer-size, 40px);--_unselected-focus-icon-color: var(--md-radio-unselected-focus-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-focus-state-layer-color: var(--md-radio-unselected-focus-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-focus-state-layer-opacity: var(--md-radio-unselected-focus-state-layer-opacity, 0.12);--_unselected-hover-icon-color: var(--md-radio-unselected-hover-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-state-layer-color: var(--md-radio-unselected-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-state-layer-opacity: var(--md-radio-unselected-hover-state-layer-opacity, 0.08);--_unselected-icon-color: var(--md-radio-unselected-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_unselected-pressed-icon-color: var(--md-radio-unselected-pressed-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-state-layer-color: var(--md-radio-unselected-pressed-state-layer-color, var(--md-sys-color-primary, #6750a4));--_unselected-pressed-state-layer-opacity: var(--md-radio-unselected-pressed-state-layer-opacity, 0.12);--md-ripple-focus-color:var(--_unselected-focus-state-layer-color);--md-ripple-focus-opacity:var(--_unselected-focus-state-layer-opacity);--md-ripple-hover-color:var(--_unselected-hover-state-layer-color);--md-ripple-hover-opacity:var(--_unselected-hover-state-layer-opacity);--md-ripple-pressed-color:var(--_unselected-pressed-state-layer-color);--md-ripple-pressed-opacity:var(--_unselected-pressed-state-layer-opacity);--md-focus-ring-offset
|
|
7
|
+
export const styles = css `:host{--_disabled-selected-icon-color: var(--md-radio-disabled-selected-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-selected-icon-opacity: var(--md-radio-disabled-selected-icon-opacity, 0.38);--_disabled-unselected-icon-color: var(--md-radio-disabled-unselected-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-unselected-icon-opacity: var(--md-radio-disabled-unselected-icon-opacity, 0.38);--_icon-size: var(--md-radio-icon-size, 20px);--_selected-focus-icon-color: var(--md-radio-selected-focus-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-focus-state-layer-color: var(--md-radio-selected-focus-state-layer-color, var(--md-sys-color-primary, #6750a4));--_selected-focus-state-layer-opacity: var(--md-radio-selected-focus-state-layer-opacity, 0.12);--_selected-hover-icon-color: var(--md-radio-selected-hover-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-hover-state-layer-color: var(--md-radio-selected-hover-state-layer-color, var(--md-sys-color-primary, #6750a4));--_selected-hover-state-layer-opacity: var(--md-radio-selected-hover-state-layer-opacity, 0.08);--_selected-icon-color: var(--md-radio-selected-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-pressed-icon-color: var(--md-radio-selected-pressed-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-pressed-state-layer-color: var(--md-radio-selected-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_selected-pressed-state-layer-opacity: var(--md-radio-selected-pressed-state-layer-opacity, 0.12);--_state-layer-size: var(--md-radio-state-layer-size, 40px);--_unselected-focus-icon-color: var(--md-radio-unselected-focus-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-focus-state-layer-color: var(--md-radio-unselected-focus-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-focus-state-layer-opacity: var(--md-radio-unselected-focus-state-layer-opacity, 0.12);--_unselected-hover-icon-color: var(--md-radio-unselected-hover-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-state-layer-color: var(--md-radio-unselected-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-state-layer-opacity: var(--md-radio-unselected-hover-state-layer-opacity, 0.08);--_unselected-icon-color: var(--md-radio-unselected-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_unselected-pressed-icon-color: var(--md-radio-unselected-pressed-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-state-layer-color: var(--md-radio-unselected-pressed-state-layer-color, var(--md-sys-color-primary, #6750a4));--_unselected-pressed-state-layer-opacity: var(--md-radio-unselected-pressed-state-layer-opacity, 0.12);--md-ripple-focus-color:var(--_unselected-focus-state-layer-color);--md-ripple-focus-opacity:var(--_unselected-focus-state-layer-opacity);--md-ripple-hover-color:var(--_unselected-hover-state-layer-color);--md-ripple-hover-opacity:var(--_unselected-hover-state-layer-opacity);--md-ripple-pressed-color:var(--_unselected-pressed-state-layer-color);--md-ripple-pressed-opacity:var(--_unselected-pressed-state-layer-opacity);--md-focus-ring-offset: -2px;display:inline-flex;height:48px;position:relative;vertical-align:top;width:48px;-webkit-tap-highlight-color:rgba(0,0,0,0)}:host([checked]){--md-ripple-focus-color:var(--_selected-focus-state-layer-color);--md-ripple-focus-opacity:var(--_selected-focus-state-layer-opacity);--md-ripple-hover-color:var(--_selected-hover-state-layer-color);--md-ripple-hover-opacity:var(--_selected-hover-state-layer-opacity);--md-ripple-pressed-color:var(--_selected-pressed-state-layer-color);--md-ripple-pressed-opacity:var(--_selected-pressed-state-layer-opacity)}input,md-ripple,.icon{inset:0;margin:auto;position:absolute}input{appearance:none;outline:none}md-ripple{height:var(--_state-layer-size);width:var(--_state-layer-size)}.icon{fill:var(--_unselected-icon-color);height:var(--_icon-size);width:var(--_icon-size)}.outer.circle{transition:fill 50ms linear}.inner.circle{opacity:0;transform-origin:center;transition:opacity 50ms linear}:host([checked]) .icon{fill:var(--_selected-icon-color)}:host([checked]) .inner.circle{animation:inner-circle-grow 300ms cubic-bezier(0.05, 0.7, 0.1, 1);opacity:1}@keyframes inner-circle-grow{from{transform:scale(0)}to{transform:scale(1)}}:host([disabled]) .circle{animation-duration:0s;transition-duration:0s}:host(:hover) .icon{fill:var(--_unselected-hover-icon-color)}:host(:focus-within) .icon{fill:var(--_unselected-focus-icon-color)}:host(:active) .icon{fill:var(--_unselected-pressed-icon-color)}:host([disabled]) .icon{fill:var(--_disabled-unselected-icon-color);opacity:var(--_disabled-unselected-icon-opacity)}:host([checked]:hover) .icon{fill:var(--_selected-hover-icon-color)}:host([checked]:focus-within) .icon{fill:var(--_selected-focus-icon-color)}:host([checked]:active) .icon{fill:var(--_selected-pressed-icon-color)}:host([checked][disabled]) .icon{fill:var(--_disabled-selected-icon-color);opacity:var(--_disabled-selected-icon-opacity)}/*# sourceMappingURL=radio-styles.css.map */
|
|
8
8
|
`;
|
|
9
9
|
//# sourceMappingURL=radio-styles.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-styles.css.js","sourceRoot":"","sources":["radio-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{--_disabled-selected-icon-color: var(--md-radio-disabled-selected-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-selected-icon-opacity: var(--md-radio-disabled-selected-icon-opacity, 0.38);--_disabled-unselected-icon-color: var(--md-radio-disabled-unselected-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-unselected-icon-opacity: var(--md-radio-disabled-unselected-icon-opacity, 0.38);--_icon-size: var(--md-radio-icon-size, 20px);--_selected-focus-icon-color: var(--md-radio-selected-focus-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-focus-state-layer-color: var(--md-radio-selected-focus-state-layer-color, var(--md-sys-color-primary, #6750a4));--_selected-focus-state-layer-opacity: var(--md-radio-selected-focus-state-layer-opacity, 0.12);--_selected-hover-icon-color: var(--md-radio-selected-hover-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-hover-state-layer-color: var(--md-radio-selected-hover-state-layer-color, var(--md-sys-color-primary, #6750a4));--_selected-hover-state-layer-opacity: var(--md-radio-selected-hover-state-layer-opacity, 0.08);--_selected-icon-color: var(--md-radio-selected-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-pressed-icon-color: var(--md-radio-selected-pressed-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-pressed-state-layer-color: var(--md-radio-selected-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_selected-pressed-state-layer-opacity: var(--md-radio-selected-pressed-state-layer-opacity, 0.12);--_state-layer-size: var(--md-radio-state-layer-size, 40px);--_unselected-focus-icon-color: var(--md-radio-unselected-focus-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-focus-state-layer-color: var(--md-radio-unselected-focus-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-focus-state-layer-opacity: var(--md-radio-unselected-focus-state-layer-opacity, 0.12);--_unselected-hover-icon-color: var(--md-radio-unselected-hover-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-state-layer-color: var(--md-radio-unselected-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-state-layer-opacity: var(--md-radio-unselected-hover-state-layer-opacity, 0.08);--_unselected-icon-color: var(--md-radio-unselected-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_unselected-pressed-icon-color: var(--md-radio-unselected-pressed-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-state-layer-color: var(--md-radio-unselected-pressed-state-layer-color, var(--md-sys-color-primary, #6750a4));--_unselected-pressed-state-layer-opacity: var(--md-radio-unselected-pressed-state-layer-opacity, 0.12);--md-ripple-focus-color:var(--_unselected-focus-state-layer-color);--md-ripple-focus-opacity:var(--_unselected-focus-state-layer-opacity);--md-ripple-hover-color:var(--_unselected-hover-state-layer-color);--md-ripple-hover-opacity:var(--_unselected-hover-state-layer-opacity);--md-ripple-pressed-color:var(--_unselected-pressed-state-layer-color);--md-ripple-pressed-opacity:var(--_unselected-pressed-state-layer-opacity);--md-focus-ring-offset
|
|
1
|
+
{"version":3,"file":"radio-styles.css.js","sourceRoot":"","sources":["radio-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{--_disabled-selected-icon-color: var(--md-radio-disabled-selected-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-selected-icon-opacity: var(--md-radio-disabled-selected-icon-opacity, 0.38);--_disabled-unselected-icon-color: var(--md-radio-disabled-unselected-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-unselected-icon-opacity: var(--md-radio-disabled-unselected-icon-opacity, 0.38);--_icon-size: var(--md-radio-icon-size, 20px);--_selected-focus-icon-color: var(--md-radio-selected-focus-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-focus-state-layer-color: var(--md-radio-selected-focus-state-layer-color, var(--md-sys-color-primary, #6750a4));--_selected-focus-state-layer-opacity: var(--md-radio-selected-focus-state-layer-opacity, 0.12);--_selected-hover-icon-color: var(--md-radio-selected-hover-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-hover-state-layer-color: var(--md-radio-selected-hover-state-layer-color, var(--md-sys-color-primary, #6750a4));--_selected-hover-state-layer-opacity: var(--md-radio-selected-hover-state-layer-opacity, 0.08);--_selected-icon-color: var(--md-radio-selected-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-pressed-icon-color: var(--md-radio-selected-pressed-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-pressed-state-layer-color: var(--md-radio-selected-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_selected-pressed-state-layer-opacity: var(--md-radio-selected-pressed-state-layer-opacity, 0.12);--_state-layer-size: var(--md-radio-state-layer-size, 40px);--_unselected-focus-icon-color: var(--md-radio-unselected-focus-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-focus-state-layer-color: var(--md-radio-unselected-focus-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-focus-state-layer-opacity: var(--md-radio-unselected-focus-state-layer-opacity, 0.12);--_unselected-hover-icon-color: var(--md-radio-unselected-hover-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-state-layer-color: var(--md-radio-unselected-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-state-layer-opacity: var(--md-radio-unselected-hover-state-layer-opacity, 0.08);--_unselected-icon-color: var(--md-radio-unselected-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_unselected-pressed-icon-color: var(--md-radio-unselected-pressed-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-state-layer-color: var(--md-radio-unselected-pressed-state-layer-color, var(--md-sys-color-primary, #6750a4));--_unselected-pressed-state-layer-opacity: var(--md-radio-unselected-pressed-state-layer-opacity, 0.12);--md-ripple-focus-color:var(--_unselected-focus-state-layer-color);--md-ripple-focus-opacity:var(--_unselected-focus-state-layer-opacity);--md-ripple-hover-color:var(--_unselected-hover-state-layer-color);--md-ripple-hover-opacity:var(--_unselected-hover-state-layer-opacity);--md-ripple-pressed-color:var(--_unselected-pressed-state-layer-color);--md-ripple-pressed-opacity:var(--_unselected-pressed-state-layer-opacity);--md-focus-ring-offset: -2px;display:inline-flex;height:48px;position:relative;vertical-align:top;width:48px;-webkit-tap-highlight-color:rgba(0,0,0,0)}:host([checked]){--md-ripple-focus-color:var(--_selected-focus-state-layer-color);--md-ripple-focus-opacity:var(--_selected-focus-state-layer-opacity);--md-ripple-hover-color:var(--_selected-hover-state-layer-color);--md-ripple-hover-opacity:var(--_selected-hover-state-layer-opacity);--md-ripple-pressed-color:var(--_selected-pressed-state-layer-color);--md-ripple-pressed-opacity:var(--_selected-pressed-state-layer-opacity)}input,md-ripple,.icon{inset:0;margin:auto;position:absolute}input{appearance:none;outline:none}md-ripple{height:var(--_state-layer-size);width:var(--_state-layer-size)}.icon{fill:var(--_unselected-icon-color);height:var(--_icon-size);width:var(--_icon-size)}.outer.circle{transition:fill 50ms linear}.inner.circle{opacity:0;transform-origin:center;transition:opacity 50ms linear}:host([checked]) .icon{fill:var(--_selected-icon-color)}:host([checked]) .inner.circle{animation:inner-circle-grow 300ms cubic-bezier(0.05, 0.7, 0.1, 1);opacity:1}@keyframes inner-circle-grow{from{transform:scale(0)}to{transform:scale(1)}}:host([disabled]) .circle{animation-duration:0s;transition-duration:0s}:host(:hover) .icon{fill:var(--_unselected-hover-icon-color)}:host(:focus-within) .icon{fill:var(--_unselected-focus-icon-color)}:host(:active) .icon{fill:var(--_unselected-pressed-icon-color)}:host([disabled]) .icon{fill:var(--_disabled-unselected-icon-color);opacity:var(--_disabled-unselected-icon-opacity)}:host([checked]:hover) .icon{fill:var(--_selected-hover-icon-color)}:host([checked]:focus-within) .icon{fill:var(--_selected-focus-icon-color)}:host([checked]:active) .icon{fill:var(--_selected-pressed-icon-color)}:host([checked][disabled]) .icon{fill:var(--_disabled-selected-icon-color);opacity:var(--_disabled-selected-icon-opacity)}/*# sourceMappingURL=radio-styles.css.map */\n`;\n "]}
|
package/radio/lib/radio.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import '../../focus/focus-ring.js';
|
|
7
7
|
import '../../ripple/ripple.js';
|
|
8
|
-
import { LitElement
|
|
8
|
+
import { LitElement } from 'lit';
|
|
9
9
|
import { getFormValue } from '../../controller/form-controller.js';
|
|
10
10
|
declare const CHECKED: unique symbol;
|
|
11
11
|
/**
|
|
@@ -42,18 +42,13 @@ export declare class Radio extends LitElement {
|
|
|
42
42
|
private readonly input;
|
|
43
43
|
private readonly ripple;
|
|
44
44
|
private readonly selectionController;
|
|
45
|
-
private showFocusRing;
|
|
46
45
|
private showRipple;
|
|
47
46
|
constructor();
|
|
48
47
|
[getFormValue](): string;
|
|
49
48
|
focus(): void;
|
|
50
|
-
protected render(): TemplateResult
|
|
51
|
-
private handleBlur;
|
|
52
|
-
private handleFocus;
|
|
49
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
53
50
|
private handleChange;
|
|
54
|
-
private handlePointerDown;
|
|
55
51
|
private readonly getRipple;
|
|
56
52
|
private readonly renderRipple;
|
|
57
|
-
private renderFocusRing;
|
|
58
53
|
}
|
|
59
54
|
export {};
|
package/radio/lib/radio.js
CHANGED
|
@@ -13,7 +13,6 @@ import { when } from 'lit/directives/when.js';
|
|
|
13
13
|
import { requestUpdateOnAriaChange } from '../../aria/delegate.js';
|
|
14
14
|
import { dispatchActivationClick, isActivationClick, redispatchEvent } from '../../controller/events.js';
|
|
15
15
|
import { FormController, getFormValue } from '../../controller/form-controller.js';
|
|
16
|
-
import { pointerPress, shouldShowStrongFocus } from '../../focus/strong-focus.js';
|
|
17
16
|
import { ripple } from '../../ripple/directive.js';
|
|
18
17
|
import { SingleSelectionController } from './single-selection-controller.js';
|
|
19
18
|
const CHECKED = Symbol('checked');
|
|
@@ -58,7 +57,6 @@ export class Radio extends LitElement {
|
|
|
58
57
|
*/
|
|
59
58
|
this.name = '';
|
|
60
59
|
this.selectionController = new SingleSelectionController(this);
|
|
61
|
-
this.showFocusRing = false;
|
|
62
60
|
this.showRipple = false;
|
|
63
61
|
this.getRipple = () => {
|
|
64
62
|
this.showRipple = true;
|
|
@@ -90,7 +88,7 @@ export class Radio extends LitElement {
|
|
|
90
88
|
const { ariaLabel } = this;
|
|
91
89
|
return html `
|
|
92
90
|
${when(this.showRipple, this.renderRipple)}
|
|
93
|
-
|
|
91
|
+
<md-focus-ring for="input"></md-focus-ring>
|
|
94
92
|
<svg class="icon" viewBox="0 0 20 20">
|
|
95
93
|
<mask id="cutout">
|
|
96
94
|
<rect width="100%" height="100%" fill="white" />
|
|
@@ -100,6 +98,7 @@ export class Radio extends LitElement {
|
|
|
100
98
|
<circle class="inner circle" cx="10" cy="10" r="5" />
|
|
101
99
|
</svg>
|
|
102
100
|
<input
|
|
101
|
+
id="input"
|
|
103
102
|
type="radio"
|
|
104
103
|
name=${this.name}
|
|
105
104
|
aria-label=${ariaLabel || nothing}
|
|
@@ -107,19 +106,10 @@ export class Radio extends LitElement {
|
|
|
107
106
|
.value=${this.value}
|
|
108
107
|
?disabled=${this.disabled}
|
|
109
108
|
@change=${this.handleChange}
|
|
110
|
-
@focus=${this.handleFocus}
|
|
111
|
-
@blur=${this.handleBlur}
|
|
112
|
-
@pointerdown=${this.handlePointerDown}
|
|
113
109
|
${ripple(this.getRipple)}
|
|
114
110
|
>
|
|
115
111
|
`;
|
|
116
112
|
}
|
|
117
|
-
handleBlur() {
|
|
118
|
-
this.showFocusRing = false;
|
|
119
|
-
}
|
|
120
|
-
handleFocus() {
|
|
121
|
-
this.showFocusRing = shouldShowStrongFocus();
|
|
122
|
-
}
|
|
123
113
|
handleChange(event) {
|
|
124
114
|
if (this.disabled) {
|
|
125
115
|
return;
|
|
@@ -128,13 +118,6 @@ export class Radio extends LitElement {
|
|
|
128
118
|
this.checked = true;
|
|
129
119
|
redispatchEvent(this, event);
|
|
130
120
|
}
|
|
131
|
-
handlePointerDown() {
|
|
132
|
-
pointerPress();
|
|
133
|
-
this.showFocusRing = shouldShowStrongFocus();
|
|
134
|
-
}
|
|
135
|
-
renderFocusRing() {
|
|
136
|
-
return html `<md-focus-ring .visible=${this.showFocusRing}></md-focus-ring>`;
|
|
137
|
-
}
|
|
138
121
|
}
|
|
139
122
|
_a = Radio;
|
|
140
123
|
(() => {
|
|
@@ -163,9 +146,6 @@ __decorate([
|
|
|
163
146
|
__decorate([
|
|
164
147
|
queryAsync('md-ripple')
|
|
165
148
|
], Radio.prototype, "ripple", void 0);
|
|
166
|
-
__decorate([
|
|
167
|
-
state()
|
|
168
|
-
], Radio.prototype, "showFocusRing", void 0);
|
|
169
149
|
__decorate([
|
|
170
150
|
state()
|
|
171
151
|
], Radio.prototype, "showRipple", void 0);
|
package/radio/lib/radio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.js","sourceRoot":"","sources":["radio.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,2BAA2B,CAAC;AACnC,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"radio.js","sourceRoot":"","sources":["radio.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,2BAA2B,CAAC;AACnC,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AACxD,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAE5C,OAAO,EAAC,yBAAyB,EAAC,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAC,uBAAuB,EAA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O;SACR;QAED,yEAAyE;QACzE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;;;AAtHD;IACE,yBAAyB,CAAC,EAAI,CAAC,CAAC;AAClC,CAAC,GAAA,CAAA;AAEe,uBAAiB,GACZ,EAAC,GAAG,UAAU,CAAC,iBAAiB,EAAE,cAAc,EAAE,IAAI,EAAC,CAAC;AAE7E;;GAEG;AACI,oBAAc,GAAG,IAAI,CAAC;AAM7B;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;oCAGxC;AAiByC;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;uCAAkB;AAK/C;IAAX,QAAQ,EAAE;oCAAc;AAKE;IAA1B,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;mCAAW;AASrB;IAAf,KAAK,CAAC,OAAO,CAAC;oCAAgD;AACtC;IAAxB,UAAU,CAAC,WAAW,CAAC;qCAAkD;AAEjE;IAAR,KAAK,EAAE;yCAA4B","sourcesContent":["/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../focus/focus-ring.js';\nimport '../../ripple/ripple.js';\n\nimport {html, isServer, LitElement, nothing} from 'lit';\nimport {property, query, queryAsync, state} from 'lit/decorators.js';\nimport {when} from 'lit/directives/when.js';\n\nimport {requestUpdateOnAriaChange} from '../../aria/delegate.js';\nimport {dispatchActivationClick, isActivationClick, redispatchEvent} from '../../controller/events.js';\nimport {FormController, getFormValue} from '../../controller/form-controller.js';\nimport {ripple} from '../../ripple/directive.js';\nimport {MdRipple} from '../../ripple/ripple.js';\nimport {ARIAMixinStrict} from '../../types/aria.js';\n\nimport {SingleSelectionController} from './single-selection-controller.js';\n\nconst CHECKED = Symbol('checked');\n\n/**\n * A radio component.\n */\nexport class Radio extends LitElement {\n static {\n requestUpdateOnAriaChange(this);\n }\n\n static override shadowRootOptions:\n ShadowRootInit = {...LitElement.shadowRootOptions, delegatesFocus: true};\n\n /**\n * @nocollapse\n */\n static formAssociated = true;\n\n /**\n * Whether or not the radio is selected.\n */\n @property({type: Boolean, reflect: true})\n get checked() {\n return this[CHECKED];\n }\n set checked(checked: boolean) {\n const wasChecked = this.checked;\n if (wasChecked === checked) {\n return;\n }\n\n this[CHECKED] = checked;\n this.requestUpdate('checked', wasChecked);\n this.selectionController.handleCheckedChange();\n }\n\n [CHECKED] = false;\n\n /**\n * Whether or not the radio is disabled.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * The element value to use in form submission when checked.\n */\n @property() value = 'on';\n\n /**\n * The HTML name to use in form submission.\n */\n @property({reflect: true}) name = '';\n\n /**\n * The associated form element with which this element's value will submit.\n */\n get form() {\n return this.closest('form');\n }\n\n @query('input') private readonly input!: HTMLInputElement|null;\n @queryAsync('md-ripple') private readonly ripple!: Promise<MdRipple|null>;\n private readonly selectionController = new SingleSelectionController(this);\n @state() private showRipple = false;\n\n constructor() {\n super();\n this.addController(new FormController(this));\n this.addController(this.selectionController);\n if (!isServer) {\n this.addEventListener('click', (event: Event) => {\n if (!isActivationClick(event)) {\n return;\n }\n this.focus();\n dispatchActivationClick(this.input!);\n });\n }\n }\n\n [getFormValue]() {\n return this.checked ? this.value : null;\n }\n\n override focus() {\n this.input?.focus();\n }\n\n protected override render() {\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n ${when(this.showRipple, this.renderRipple)}\n <md-focus-ring for=\"input\"></md-focus-ring>\n <svg class=\"icon\" viewBox=\"0 0 20 20\">\n <mask id=\"cutout\">\n <rect width=\"100%\" height=\"100%\" fill=\"white\" />\n <circle cx=\"10\" cy=\"10\" r=\"8\" fill=\"black\" />\n </mask>\n <circle class=\"outer circle\" cx=\"10\" cy=\"10\" r=\"10\" mask=\"url(#cutout)\" />\n <circle class=\"inner circle\" cx=\"10\" cy=\"10\" r=\"5\" />\n </svg>\n <input\n id=\"input\"\n type=\"radio\"\n name=${this.name}\n aria-label=${ariaLabel || nothing}\n .checked=${this.checked}\n .value=${this.value}\n ?disabled=${this.disabled}\n @change=${this.handleChange}\n ${ripple(this.getRipple)}\n >\n `;\n }\n\n private handleChange(event: Event) {\n if (this.disabled) {\n return;\n }\n\n // Per spec, the change event on a radio input always represents checked.\n this.checked = true;\n redispatchEvent(this, event);\n }\n\n private readonly getRipple = () => {\n this.showRipple = true;\n return this.ripple;\n };\n\n private readonly renderRipple = () => {\n return html`<md-ripple unbounded ?disabled=${this.disabled}></md-ripple>`;\n };\n}\n"]}
|
package/ripple/lib/ripple.js
CHANGED
|
@@ -254,6 +254,9 @@ export class Ripple extends LitElement {
|
|
|
254
254
|
return { startPoint, endPoint };
|
|
255
255
|
}
|
|
256
256
|
startPressAnimation(positionEvent) {
|
|
257
|
+
if (!this.mdRoot) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
257
260
|
this.pressed = true;
|
|
258
261
|
this.growAnimation?.cancel();
|
|
259
262
|
this.determineRippleSize();
|
|
@@ -277,6 +280,7 @@ export class Ripple extends LitElement {
|
|
|
277
280
|
});
|
|
278
281
|
}
|
|
279
282
|
async endPressAnimation() {
|
|
283
|
+
this.state = State.INACTIVE;
|
|
280
284
|
const animation = this.growAnimation;
|
|
281
285
|
const pressAnimationPlayState = animation?.currentTime ?? Infinity;
|
|
282
286
|
if (pressAnimationPlayState >= MINIMUM_PRESS_MS) {
|
package/ripple/lib/ripple.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ripple.js","sourceRoot":"","sources":["ripple.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,IAAI,EAAE,UAAU,EAAiB,MAAM,KAAK,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,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AAO,CAAC,KAAK,CAAC,IAAI,eAAe,CAAC;IAChD,CAAC;IAED;;;;OAIG;IACK,QAAQ,CAAC,EAAC,CAAC,EAAE,CAAC,EAAe;QACnC,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAChE,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,MAAM,CAAC;IAC5D,CAAC;IAEO,OAAO,CAAC,EAAC,WAAW,EAAe;QACzC,OAAO,WAAW,KAAK,OAAO,CAAC;IACjC,CAAC;CACF;AAtT2C;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;yCAAmB;AAKlB;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;wCAAkB;AAElD;IAAR,KAAK,EAAE;uCAAyB;AACxB;IAAR,KAAK,EAAE;uCAAyB;AACxB;IAAR,KAAK,EAAE;uCAAyB;AAEd;IAAlB,KAAK,CAAC,UAAU,CAAC;sCAAuC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html, LitElement, PropertyValues} from 'lit';\nimport {property, query, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\nimport {EASING} from '../../motion/animation.js';\n\nconst PRESS_GROW_MS = 450;\nconst MINIMUM_PRESS_MS = 225;\nconst INITIAL_ORIGIN_SCALE = 0.2;\nconst PADDING = 10;\nconst SOFT_EDGE_MINIMUM_SIZE = 75;\nconst SOFT_EDGE_CONTAINER_RATIO = 0.35;\nconst PRESS_PSEUDO = '::after';\nconst ANIMATION_FILL = 'forwards';\n\n/**\n * Interaction states for the ripple.\n *\n * On Touch:\n * - `INACTIVE -> TOUCH_DELAY -> WAITING_FOR_CLICK -> INACTIVE`\n * - `INACTIVE -> TOUCH_DELAY -> HOLDING -> WAITING_FOR_CLICK -> INACTIVE`\n *\n * On Mouse or Pen:\n * - `INACTIVE -> WAITING_FOR_CLICK -> INACTIVE`\n */\nenum State {\n /**\n * Initial state of the control, no touch in progress.\n *\n * Transitions:\n * - on touch down: transition to `TOUCH_DELAY`.\n * - on mouse down: transition to `WAITING_FOR_CLICK`.\n */\n INACTIVE,\n /**\n * Touch down has been received, waiting to determine if it's a swipe or\n * scroll.\n *\n * Transitions:\n * - on touch up: begin press; transition to `WAITING_FOR_CLICK`.\n * - on cancel: transition to `INACTIVE`.\n * - after `TOUCH_DELAY_MS`: begin press; transition to `HOLDING`.\n */\n TOUCH_DELAY,\n /**\n * A touch has been deemed to be a press\n *\n * Transitions:\n * - on up: transition to `WAITING_FOR_CLICK`.\n */\n HOLDING,\n /**\n * The user touch has finished, transition into rest state.\n *\n * Transitions:\n * - on click end press; transition to `INACTIVE`.\n */\n WAITING_FOR_CLICK\n}\n\n/**\n * Delay reacting to touch so that we do not show the ripple for a swipe or\n * scroll interaction.\n */\nconst TOUCH_DELAY_MS = 150;\n\n/**\n * A ripple component.\n */\nexport class Ripple extends LitElement {\n // TODO(https://bugs.webkit.org/show_bug.cgi?id=247546)\n // Remove Safari workaround that requires reflecting `unbounded` so\n // it can be styled against.\n /**\n * Sets the ripple to be an unbounded circle.\n */\n @property({type: Boolean, reflect: true}) unbounded = false;\n\n /**\n * Disables the ripple.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n @state() private hovered = false;\n @state() private focused = false;\n @state() private pressed = false;\n\n @query('.surface') private readonly mdRoot!: HTMLElement;\n private rippleSize = '';\n private rippleScale = '';\n private initialSize = 0;\n private growAnimation?: Animation;\n private state = State.INACTIVE;\n private rippleStartEvent?: PointerEvent;\n private checkBoundsAfterContextMenu = false;\n\n handlePointerenter(event: PointerEvent) {\n if (!this.shouldReactToEvent(event)) {\n return;\n }\n\n this.hovered = true;\n }\n\n handlePointerleave(event: PointerEvent) {\n if (!this.shouldReactToEvent(event)) {\n return;\n }\n\n this.hovered = false;\n\n // release a held mouse or pen press that moves outside the element\n if (this.state !== State.INACTIVE) {\n this.endPressAnimation();\n }\n }\n\n handleFocusin() {\n this.focused = true;\n }\n\n handleFocusout() {\n this.focused = false;\n }\n\n handlePointerup(event: PointerEvent) {\n if (!this.shouldReactToEvent(event)) {\n return;\n }\n\n if (this.state === State.HOLDING) {\n this.state = State.WAITING_FOR_CLICK;\n return;\n }\n\n if (this.state === State.TOUCH_DELAY) {\n this.state = State.WAITING_FOR_CLICK;\n this.startPressAnimation(this.rippleStartEvent);\n return;\n }\n }\n\n async handlePointerdown(event: PointerEvent) {\n if (!this.shouldReactToEvent(event)) {\n return;\n }\n\n this.rippleStartEvent = event;\n if (!this.isTouch(event)) {\n this.state = State.WAITING_FOR_CLICK;\n this.startPressAnimation(event);\n return;\n }\n\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(event)) {\n return;\n }\n\n this.checkBoundsAfterContextMenu = false;\n\n // Wait for a hold after touch delay\n this.state = State.TOUCH_DELAY;\n await new Promise(resolve => {\n setTimeout(resolve, TOUCH_DELAY_MS);\n });\n\n if (this.state !== State.TOUCH_DELAY) {\n return;\n }\n\n this.state = State.HOLDING;\n this.startPressAnimation(event);\n }\n\n handleClick() {\n // Click is a MouseEvent in Firefox and Safari, so we cannot use\n // `shouldReactToEvent`\n if (this.disabled) {\n return;\n }\n\n if (this.state === State.WAITING_FOR_CLICK) {\n this.endPressAnimation();\n return;\n }\n\n if (this.state === State.INACTIVE) {\n // keyboard synthesized click event\n this.startPressAnimation();\n this.endPressAnimation();\n }\n }\n\n handlePointercancel(event: PointerEvent) {\n if (!this.shouldReactToEvent(event)) {\n return;\n }\n\n this.endPressAnimation();\n }\n\n handleContextmenu() {\n if (this.disabled) {\n return;\n }\n\n this.checkBoundsAfterContextMenu = true;\n this.endPressAnimation();\n }\n\n protected override render() {\n const classes = {\n 'hovered': this.hovered,\n 'focused': this.focused,\n 'pressed': this.pressed,\n 'unbounded': this.unbounded,\n };\n\n return html`<div class=\"surface ${classMap(classes)}\"></div>`;\n }\n\n protected override update(changedProps: PropertyValues<this>) {\n if (changedProps.has('disabled') && this.disabled) {\n this.hovered = false;\n this.focused = false;\n this.pressed = false;\n }\n super.update(changedProps);\n }\n\n private getDimensions() {\n return (this.parentElement ?? this).getBoundingClientRect();\n }\n\n private determineRippleSize() {\n const {height, width} = this.getDimensions();\n const maxDim = Math.max(height, width);\n const softEdgeSize =\n Math.max(SOFT_EDGE_CONTAINER_RATIO * maxDim, SOFT_EDGE_MINIMUM_SIZE);\n\n\n let maxRadius = maxDim;\n let initialSize = Math.floor(maxDim * INITIAL_ORIGIN_SCALE);\n\n const hypotenuse = Math.sqrt(width ** 2 + height ** 2);\n maxRadius = hypotenuse + PADDING;\n\n // ensure `initialSize` is even for unbounded\n if (this.unbounded) {\n initialSize = initialSize - (initialSize % 2);\n }\n\n this.initialSize = initialSize;\n this.rippleScale = `${(maxRadius + softEdgeSize) / initialSize}`;\n this.rippleSize = `${this.initialSize}px`;\n }\n\n private getNormalizedPointerEventCoords(pointerEvent: PointerEvent):\n {x: number, y: number} {\n const {scrollX, scrollY} = window;\n const {left, top} = this.getDimensions();\n const documentX = scrollX + left;\n const documentY = scrollY + top;\n const {pageX, pageY} = pointerEvent;\n return {x: pageX - documentX, y: pageY - documentY};\n }\n\n private getTranslationCoordinates(positionEvent?: Event) {\n const {height, width} = this.getDimensions();\n // end in the center\n const endPoint = {\n x: (width - this.initialSize) / 2,\n y: (height - this.initialSize) / 2,\n };\n\n let startPoint;\n if (positionEvent instanceof PointerEvent) {\n startPoint = this.getNormalizedPointerEventCoords(positionEvent);\n } else {\n startPoint = {\n x: width / 2,\n y: height / 2,\n };\n }\n\n // center around start point\n startPoint = {\n x: startPoint.x - (this.initialSize / 2),\n y: startPoint.y - (this.initialSize / 2),\n };\n\n return {startPoint, endPoint};\n }\n\n private startPressAnimation(positionEvent?: Event) {\n this.pressed = true;\n this.growAnimation?.cancel();\n this.determineRippleSize();\n const {startPoint, endPoint} =\n this.getTranslationCoordinates(positionEvent);\n const translateStart = `${startPoint.x}px, ${startPoint.y}px`;\n const translateEnd = `${endPoint.x}px, ${endPoint.y}px`;\n\n this.growAnimation = this.mdRoot.animate(\n {\n top: [0, 0],\n left: [0, 0],\n height: [this.rippleSize, this.rippleSize],\n width: [this.rippleSize, this.rippleSize],\n transform: [\n `translate(${translateStart}) scale(1)`,\n `translate(${translateEnd}) scale(${this.rippleScale})`\n ],\n },\n {\n pseudoElement: PRESS_PSEUDO,\n duration: PRESS_GROW_MS,\n easing: EASING.STANDARD,\n fill: ANIMATION_FILL\n });\n }\n\n private async endPressAnimation() {\n const animation = this.growAnimation;\n const pressAnimationPlayState = animation?.currentTime ?? Infinity;\n if (pressAnimationPlayState >= MINIMUM_PRESS_MS) {\n this.pressed = false;\n return;\n }\n\n await new Promise(resolve => {\n setTimeout(resolve, MINIMUM_PRESS_MS - pressAnimationPlayState);\n });\n\n if (this.growAnimation !== animation) {\n // A new press animation was started. The old animation was canceled and\n // should not finish the pressed state.\n return;\n }\n\n this.pressed = false;\n }\n\n /**\n * Returns `true` if\n * - the ripple element is enabled\n * - the pointer is primary for the input type\n * - the pointer is the pointer that started the interaction, or will start\n * the interaction\n * - the pointer is a touch, or the pointer state has the primary button\n * held, or the pointer is hovering\n */\n private shouldReactToEvent(event: PointerEvent) {\n if (this.disabled || !event.isPrimary) {\n return false;\n }\n\n if (this.rippleStartEvent &&\n this.rippleStartEvent.pointerId !== event.pointerId) {\n return false;\n }\n\n if (event.type === 'pointerenter' || event.type === 'pointerleave') {\n return !this.isTouch(event);\n }\n\n const isPrimaryButton = event.buttons === 1;\n return this.isTouch(event) || isPrimaryButton;\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({x, y}: PointerEvent) {\n const {top, left, bottom, right} = this.getBoundingClientRect();\n return x >= left && x <= right && y >= top && y <= bottom;\n }\n\n private isTouch({pointerType}: PointerEvent) {\n return pointerType === 'touch';\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ripple.js","sourceRoot":"","sources":["ripple.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,IAAI,EAAE,UAAU,EAAiB,MAAM,KAAK,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAErD,OAAO,EAAC,MAAM,EAAC,MAAM,2BAA2B,CAAC;AAEjD,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,OAAO,GAAG,EAAE,CAAC;AACnB,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AACvC,MAAM,YAAY,GAAG,SAAS,CAAC;AAC/B,MAAM,cAAc,GAAG,UAAU,CAAC;AAElC;;;;;;;;;GASG;AACH,IAAK,KAiCJ;AAjCD,WAAK,KAAK;IACR;;;;;;OAMG;IACH,yCAAQ,CAAA;IACR;;;;;;;;OAQG;IACH,+CAAW,CAAA;IACX;;;;;OAKG;IACH,uCAAO,CAAA;IACP;;;;;OAKG;IACH,2DAAiB,CAAA;AACnB,CAAC,EAjCI,KAAK,KAAL,KAAK,QAiCT;AAED;;;GAGG;AACH,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,UAAU;IAAtC;;QACE,uDAAuD;QACvD,mEAAmE;QACnE,4BAA4B;QAC5B;;WAEG;QACuC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B;AAEd;IAAlB,KAAK,CAAC,UAAU,CAAC;sCAA4C","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html, LitElement, PropertyValues} from 'lit';\nimport {property, query, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\nimport {EASING} from '../../motion/animation.js';\n\nconst PRESS_GROW_MS = 450;\nconst MINIMUM_PRESS_MS = 225;\nconst INITIAL_ORIGIN_SCALE = 0.2;\nconst PADDING = 10;\nconst SOFT_EDGE_MINIMUM_SIZE = 75;\nconst SOFT_EDGE_CONTAINER_RATIO = 0.35;\nconst PRESS_PSEUDO = '::after';\nconst ANIMATION_FILL = 'forwards';\n\n/**\n * Interaction states for the ripple.\n *\n * On Touch:\n * - `INACTIVE -> TOUCH_DELAY -> WAITING_FOR_CLICK -> INACTIVE`\n * - `INACTIVE -> TOUCH_DELAY -> HOLDING -> WAITING_FOR_CLICK -> INACTIVE`\n *\n * On Mouse or Pen:\n * - `INACTIVE -> WAITING_FOR_CLICK -> INACTIVE`\n */\nenum State {\n /**\n * Initial state of the control, no touch in progress.\n *\n * Transitions:\n * - on touch down: transition to `TOUCH_DELAY`.\n * - on mouse down: transition to `WAITING_FOR_CLICK`.\n */\n INACTIVE,\n /**\n * Touch down has been received, waiting to determine if it's a swipe or\n * scroll.\n *\n * Transitions:\n * - on touch up: begin press; transition to `WAITING_FOR_CLICK`.\n * - on cancel: transition to `INACTIVE`.\n * - after `TOUCH_DELAY_MS`: begin press; transition to `HOLDING`.\n */\n TOUCH_DELAY,\n /**\n * A touch has been deemed to be a press\n *\n * Transitions:\n * - on up: transition to `WAITING_FOR_CLICK`.\n */\n HOLDING,\n /**\n * The user touch has finished, transition into rest state.\n *\n * Transitions:\n * - on click end press; transition to `INACTIVE`.\n */\n WAITING_FOR_CLICK\n}\n\n/**\n * Delay reacting to touch so that we do not show the ripple for a swipe or\n * scroll interaction.\n */\nconst TOUCH_DELAY_MS = 150;\n\n/**\n * A ripple component.\n */\nexport class Ripple extends LitElement {\n // TODO(https://bugs.webkit.org/show_bug.cgi?id=247546)\n // Remove Safari workaround that requires reflecting `unbounded` so\n // it can be styled against.\n /**\n * Sets the ripple to be an unbounded circle.\n */\n @property({type: Boolean, reflect: true}) unbounded = false;\n\n /**\n * Disables the ripple.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n @state() private hovered = false;\n @state() private focused = false;\n @state() private pressed = false;\n\n @query('.surface') private readonly mdRoot!: HTMLElement|null;\n private rippleSize = '';\n private rippleScale = '';\n private initialSize = 0;\n private growAnimation?: Animation;\n private state = State.INACTIVE;\n private rippleStartEvent?: PointerEvent;\n private checkBoundsAfterContextMenu = false;\n\n handlePointerenter(event: PointerEvent) {\n if (!this.shouldReactToEvent(event)) {\n return;\n }\n\n this.hovered = true;\n }\n\n handlePointerleave(event: PointerEvent) {\n if (!this.shouldReactToEvent(event)) {\n return;\n }\n\n this.hovered = false;\n\n // release a held mouse or pen press that moves outside the element\n if (this.state !== State.INACTIVE) {\n this.endPressAnimation();\n }\n }\n\n handleFocusin() {\n this.focused = true;\n }\n\n handleFocusout() {\n this.focused = false;\n }\n\n handlePointerup(event: PointerEvent) {\n if (!this.shouldReactToEvent(event)) {\n return;\n }\n\n if (this.state === State.HOLDING) {\n this.state = State.WAITING_FOR_CLICK;\n return;\n }\n\n if (this.state === State.TOUCH_DELAY) {\n this.state = State.WAITING_FOR_CLICK;\n this.startPressAnimation(this.rippleStartEvent);\n return;\n }\n }\n\n async handlePointerdown(event: PointerEvent) {\n if (!this.shouldReactToEvent(event)) {\n return;\n }\n\n this.rippleStartEvent = event;\n if (!this.isTouch(event)) {\n this.state = State.WAITING_FOR_CLICK;\n this.startPressAnimation(event);\n return;\n }\n\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(event)) {\n return;\n }\n\n this.checkBoundsAfterContextMenu = false;\n\n // Wait for a hold after touch delay\n this.state = State.TOUCH_DELAY;\n await new Promise(resolve => {\n setTimeout(resolve, TOUCH_DELAY_MS);\n });\n\n if (this.state !== State.TOUCH_DELAY) {\n return;\n }\n\n this.state = State.HOLDING;\n this.startPressAnimation(event);\n }\n\n handleClick() {\n // Click is a MouseEvent in Firefox and Safari, so we cannot use\n // `shouldReactToEvent`\n if (this.disabled) {\n return;\n }\n\n if (this.state === State.WAITING_FOR_CLICK) {\n this.endPressAnimation();\n return;\n }\n\n if (this.state === State.INACTIVE) {\n // keyboard synthesized click event\n this.startPressAnimation();\n this.endPressAnimation();\n }\n }\n\n handlePointercancel(event: PointerEvent) {\n if (!this.shouldReactToEvent(event)) {\n return;\n }\n\n this.endPressAnimation();\n }\n\n handleContextmenu() {\n if (this.disabled) {\n return;\n }\n\n this.checkBoundsAfterContextMenu = true;\n this.endPressAnimation();\n }\n\n protected override render() {\n const classes = {\n 'hovered': this.hovered,\n 'focused': this.focused,\n 'pressed': this.pressed,\n 'unbounded': this.unbounded,\n };\n\n return html`<div class=\"surface ${classMap(classes)}\"></div>`;\n }\n\n protected override update(changedProps: PropertyValues<this>) {\n if (changedProps.has('disabled') && this.disabled) {\n this.hovered = false;\n this.focused = false;\n this.pressed = false;\n }\n super.update(changedProps);\n }\n\n private getDimensions() {\n return (this.parentElement ?? this).getBoundingClientRect();\n }\n\n private determineRippleSize() {\n const {height, width} = this.getDimensions();\n const maxDim = Math.max(height, width);\n const softEdgeSize =\n Math.max(SOFT_EDGE_CONTAINER_RATIO * maxDim, SOFT_EDGE_MINIMUM_SIZE);\n\n\n let maxRadius = maxDim;\n let initialSize = Math.floor(maxDim * INITIAL_ORIGIN_SCALE);\n\n const hypotenuse = Math.sqrt(width ** 2 + height ** 2);\n maxRadius = hypotenuse + PADDING;\n\n // ensure `initialSize` is even for unbounded\n if (this.unbounded) {\n initialSize = initialSize - (initialSize % 2);\n }\n\n this.initialSize = initialSize;\n this.rippleScale = `${(maxRadius + softEdgeSize) / initialSize}`;\n this.rippleSize = `${this.initialSize}px`;\n }\n\n private getNormalizedPointerEventCoords(pointerEvent: PointerEvent):\n {x: number, y: number} {\n const {scrollX, scrollY} = window;\n const {left, top} = this.getDimensions();\n const documentX = scrollX + left;\n const documentY = scrollY + top;\n const {pageX, pageY} = pointerEvent;\n return {x: pageX - documentX, y: pageY - documentY};\n }\n\n private getTranslationCoordinates(positionEvent?: Event) {\n const {height, width} = this.getDimensions();\n // end in the center\n const endPoint = {\n x: (width - this.initialSize) / 2,\n y: (height - this.initialSize) / 2,\n };\n\n let startPoint;\n if (positionEvent instanceof PointerEvent) {\n startPoint = this.getNormalizedPointerEventCoords(positionEvent);\n } else {\n startPoint = {\n x: width / 2,\n y: height / 2,\n };\n }\n\n // center around start point\n startPoint = {\n x: startPoint.x - (this.initialSize / 2),\n y: startPoint.y - (this.initialSize / 2),\n };\n\n return {startPoint, endPoint};\n }\n\n private startPressAnimation(positionEvent?: Event) {\n if (!this.mdRoot) {\n return;\n }\n\n this.pressed = true;\n this.growAnimation?.cancel();\n this.determineRippleSize();\n const {startPoint, endPoint} =\n this.getTranslationCoordinates(positionEvent);\n const translateStart = `${startPoint.x}px, ${startPoint.y}px`;\n const translateEnd = `${endPoint.x}px, ${endPoint.y}px`;\n\n this.growAnimation = this.mdRoot.animate(\n {\n top: [0, 0],\n left: [0, 0],\n height: [this.rippleSize, this.rippleSize],\n width: [this.rippleSize, this.rippleSize],\n transform: [\n `translate(${translateStart}) scale(1)`,\n `translate(${translateEnd}) scale(${this.rippleScale})`\n ],\n },\n {\n pseudoElement: PRESS_PSEUDO,\n duration: PRESS_GROW_MS,\n easing: EASING.STANDARD,\n fill: ANIMATION_FILL\n });\n }\n\n private async endPressAnimation() {\n this.state = State.INACTIVE;\n const animation = this.growAnimation;\n const pressAnimationPlayState = animation?.currentTime ?? Infinity;\n if (pressAnimationPlayState >= MINIMUM_PRESS_MS) {\n this.pressed = false;\n return;\n }\n\n await new Promise(resolve => {\n setTimeout(resolve, MINIMUM_PRESS_MS - pressAnimationPlayState);\n });\n\n if (this.growAnimation !== animation) {\n // A new press animation was started. The old animation was canceled and\n // should not finish the pressed state.\n return;\n }\n\n this.pressed = false;\n }\n\n /**\n * Returns `true` if\n * - the ripple element is enabled\n * - the pointer is primary for the input type\n * - the pointer is the pointer that started the interaction, or will start\n * the interaction\n * - the pointer is a touch, or the pointer state has the primary button\n * held, or the pointer is hovering\n */\n private shouldReactToEvent(event: PointerEvent) {\n if (this.disabled || !event.isPrimary) {\n return false;\n }\n\n if (this.rippleStartEvent &&\n this.rippleStartEvent.pointerId !== event.pointerId) {\n return false;\n }\n\n if (event.type === 'pointerenter' || event.type === 'pointerleave') {\n return !this.isTouch(event);\n }\n\n const isPrimaryButton = event.buttons === 1;\n return this.isTouch(event) || isPrimaryButton;\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({x, y}: PointerEvent) {\n const {top, left, bottom, right} = this.getBoundingClientRect();\n return x >= left && x <= right && y >= top && y <= bottom;\n }\n\n private isTouch({pointerType}: PointerEvent) {\n return pointerType === 'touch';\n }\n}\n"]}
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import '../../focus/focus-ring.js';
|
|
7
7
|
import '../../ripple/ripple.js';
|
|
8
|
-
import { LitElement, PropertyValues } from 'lit';
|
|
9
|
-
import { MdRipple } from '../../ripple/ripple.js';
|
|
8
|
+
import { LitElement, nothing, PropertyValues, TemplateResult } from 'lit';
|
|
10
9
|
/**
|
|
11
10
|
* SegmentedButton is a web component implementation of the Material Design
|
|
12
11
|
* segmented button component. It is intended **only** for use as a child of a
|
|
@@ -19,18 +18,14 @@ export declare class SegmentedButton extends LitElement {
|
|
|
19
18
|
label: string;
|
|
20
19
|
noCheckmark: boolean;
|
|
21
20
|
hasIcon: boolean;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
protected ripple: Promise<MdRipple | null>;
|
|
21
|
+
private animState;
|
|
22
|
+
private showRipple;
|
|
23
|
+
private readonly iconElement;
|
|
24
|
+
private readonly ripple;
|
|
27
25
|
protected update(props: PropertyValues<SegmentedButton>): void;
|
|
28
26
|
private nextAnimationState;
|
|
29
|
-
handleClick
|
|
30
|
-
|
|
31
|
-
protected handleFocus(): void;
|
|
32
|
-
protected handleBlur(): void;
|
|
33
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
27
|
+
private handleClick;
|
|
28
|
+
protected render(): TemplateResult<1>;
|
|
34
29
|
protected getRenderClasses(): {
|
|
35
30
|
'md3-segmented-button--selected': boolean;
|
|
36
31
|
'md3-segmented-button--unselected': boolean;
|
|
@@ -42,13 +37,12 @@ export declare class SegmentedButton extends LitElement {
|
|
|
42
37
|
'md3-segmented-button--selecting': boolean;
|
|
43
38
|
'md3-segmented-button--deselecting': boolean;
|
|
44
39
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
protected
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
protected renderTouchTarget(): import("lit-html").TemplateResult<1>;
|
|
40
|
+
private readonly getRipple;
|
|
41
|
+
private readonly renderRipple;
|
|
42
|
+
protected renderOutline(): TemplateResult | typeof nothing;
|
|
43
|
+
private renderLeading;
|
|
44
|
+
private renderLeadingWithoutLabel;
|
|
45
|
+
private renderLeadingWithLabel;
|
|
46
|
+
private renderLabel;
|
|
47
|
+
private renderTouchTarget;
|
|
54
48
|
}
|
|
@@ -12,7 +12,6 @@ import { property, queryAssignedElements, queryAsync, state } from 'lit/decorato
|
|
|
12
12
|
import { classMap } from 'lit/directives/class-map.js';
|
|
13
13
|
import { when } from 'lit/directives/when.js';
|
|
14
14
|
import { requestUpdateOnAriaChange } from '../../aria/delegate.js';
|
|
15
|
-
import { pointerPress, shouldShowStrongFocus } from '../../focus/strong-focus.js';
|
|
16
15
|
import { ripple } from '../../ripple/directive.js';
|
|
17
16
|
/**
|
|
18
17
|
* SegmentedButton is a web component implementation of the Material Design
|
|
@@ -29,7 +28,6 @@ export class SegmentedButton extends LitElement {
|
|
|
29
28
|
this.noCheckmark = false;
|
|
30
29
|
this.hasIcon = false;
|
|
31
30
|
this.animState = '';
|
|
32
|
-
this.showFocusRing = false;
|
|
33
31
|
this.showRipple = false;
|
|
34
32
|
this.getRipple = () => {
|
|
35
33
|
this.showRipple = true;
|
|
@@ -61,20 +59,10 @@ export class SegmentedButton extends LitElement {
|
|
|
61
59
|
}
|
|
62
60
|
return '';
|
|
63
61
|
}
|
|
64
|
-
handleClick(
|
|
62
|
+
handleClick() {
|
|
65
63
|
const event = new Event('segmented-button-interaction', { bubbles: true, composed: true });
|
|
66
64
|
this.dispatchEvent(event);
|
|
67
65
|
}
|
|
68
|
-
handlePointerDown(e) {
|
|
69
|
-
pointerPress();
|
|
70
|
-
this.showFocusRing = shouldShowStrongFocus();
|
|
71
|
-
}
|
|
72
|
-
handleFocus() {
|
|
73
|
-
this.showFocusRing = shouldShowStrongFocus();
|
|
74
|
-
}
|
|
75
|
-
handleBlur() {
|
|
76
|
-
this.showFocusRing = false;
|
|
77
|
-
}
|
|
78
66
|
render() {
|
|
79
67
|
// Needed for closure conformance
|
|
80
68
|
const { ariaLabel } = this;
|
|
@@ -84,13 +72,10 @@ export class SegmentedButton extends LitElement {
|
|
|
84
72
|
aria-label=${ariaLabel || nothing}
|
|
85
73
|
aria-pressed=${this.selected}
|
|
86
74
|
?disabled=${this.disabled}
|
|
87
|
-
@focus="${this.handleFocus}"
|
|
88
|
-
@blur="${this.handleBlur}"
|
|
89
|
-
@pointerdown="${this.handlePointerDown}"
|
|
90
75
|
@click="${this.handleClick}"
|
|
91
76
|
class="md3-segmented-button ${classMap(this.getRenderClasses())}"
|
|
92
77
|
${ripple(this.getRipple)}>
|
|
93
|
-
|
|
78
|
+
<md-focus-ring class="md3-segmented-button__focus-ring"></md-focus-ring>
|
|
94
79
|
${when(this.showRipple, this.renderRipple)}
|
|
95
80
|
${this.renderOutline()}
|
|
96
81
|
${this.renderLeading()}
|
|
@@ -112,11 +97,8 @@ export class SegmentedButton extends LitElement {
|
|
|
112
97
|
'md3-segmented-button--deselecting': this.animState === 'deselecting',
|
|
113
98
|
};
|
|
114
99
|
}
|
|
115
|
-
renderFocusRing() {
|
|
116
|
-
return html `<md-focus-ring .visible="${this.showFocusRing}" class="md3-segmented-button__focus-ring"></md-focus-ring>`;
|
|
117
|
-
}
|
|
118
100
|
renderOutline() {
|
|
119
|
-
return
|
|
101
|
+
return nothing;
|
|
120
102
|
}
|
|
121
103
|
renderLeading() {
|
|
122
104
|
return this.label === '' ? this.renderLeadingWithoutLabel() :
|
|
@@ -181,9 +163,6 @@ __decorate([
|
|
|
181
163
|
__decorate([
|
|
182
164
|
state()
|
|
183
165
|
], SegmentedButton.prototype, "animState", void 0);
|
|
184
|
-
__decorate([
|
|
185
|
-
state()
|
|
186
|
-
], SegmentedButton.prototype, "showFocusRing", void 0);
|
|
187
166
|
__decorate([
|
|
188
167
|
state()
|
|
189
168
|
], SegmentedButton.prototype, "showRipple", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmented-button.js","sourceRoot":"","sources":["segmented-button.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,2BAA2B,CAAC;AACnC,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,KAAK,CAAC;AAC9D,OAAO,EAAC,QAAQ,EAAE,qBAAqB,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAE5C,OAAO,EAAC,yBAAyB,EAAC,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAC,Y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C,CAAC,GAAA,CAAA;AAE0B;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;iDAAkB;AACjB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;iDAAkB;AAChC;IAAX,QAAQ,EAAE;8CAAY;AACI;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;oDAAqB;AACpB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;gDAAiB;AAElC;IAAR,KAAK,EAAE;kDAA0B;AACzB;IAAR,KAAK,EAAE;sDAAiC;AAChC;IAAR,KAAK,EAAE;mDAA8B;AAEtC;IADC,qBAAqB,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;oDACf;AACb;IAAxB,UAAU,CAAC,WAAW,CAAC;+CAA2C","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../focus/focus-ring.js';\nimport '../../ripple/ripple.js';\n\nimport {html, LitElement, nothing, PropertyValues} from 'lit';\nimport {property, queryAssignedElements, queryAsync, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {when} from 'lit/directives/when.js';\n\nimport {requestUpdateOnAriaChange} from '../../aria/delegate.js';\nimport {pointerPress, shouldShowStrongFocus} from '../../focus/strong-focus.js';\nimport {ripple} from '../../ripple/directive.js';\nimport {MdRipple} from '../../ripple/ripple.js';\nimport {ARIAMixinStrict} from '../../types/aria.js';\n\n/**\n * SegmentedButton is a web component implementation of the Material Design\n * segmented button component. It is intended **only** for use as a child of a\n * `SementedButtonSet` component. It is **not** intended for use in any other\n * context.\n */\nexport class SegmentedButton extends LitElement {\n static {\n requestUpdateOnAriaChange(this);\n }\n\n @property({type: Boolean}) disabled = false;\n @property({type: Boolean}) selected = false;\n @property() label = '';\n @property({type: Boolean}) noCheckmark = false;\n @property({type: Boolean}) hasIcon = false;\n\n @state() protected animState = '';\n @state() protected showFocusRing = false;\n @state() protected showRipple = false;\n @queryAssignedElements({slot: 'icon', flatten: true})\n protected iconElement!: HTMLElement[];\n @queryAsync('md-ripple') protected ripple!: Promise<MdRipple|null>;\n\n protected override update(props: PropertyValues<SegmentedButton>) {\n this.animState = this.nextAnimationState(props);\n super.update(props);\n // NOTE: This needs to be set *after* calling super.update() to ensure the\n // appropriate CSS classes are applied.\n this.hasIcon = this.iconElement.length > 0;\n }\n\n private nextAnimationState(changedProps: PropertyValues<SegmentedButton>):\n string {\n const prevSelected = changedProps.get('selected');\n // Early exit for first update.\n if (prevSelected === undefined) return '';\n\n const nextSelected = this.selected;\n const nextHasCheckmark = !this.noCheckmark;\n if (!prevSelected && nextSelected && nextHasCheckmark) {\n return 'selecting';\n }\n if (prevSelected && !nextSelected && nextHasCheckmark) {\n return 'deselecting';\n }\n return '';\n }\n\n handleClick(e: MouseEvent) {\n const event = new Event(\n 'segmented-button-interaction', {bubbles: true, composed: true});\n this.dispatchEvent(event);\n }\n\n handlePointerDown(e: PointerEvent) {\n pointerPress();\n this.showFocusRing = shouldShowStrongFocus();\n }\n\n protected handleFocus() {\n this.showFocusRing = shouldShowStrongFocus();\n }\n\n protected handleBlur() {\n this.showFocusRing = false;\n }\n\n override render() {\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n <button\n tabindex=\"${this.disabled ? '-1' : '0'}\"\n aria-label=${ariaLabel || nothing}\n aria-pressed=${this.selected}\n ?disabled=${this.disabled}\n @focus=\"${this.handleFocus}\"\n @blur=\"${this.handleBlur}\"\n @pointerdown=\"${this.handlePointerDown}\"\n @click=\"${this.handleClick}\"\n class=\"md3-segmented-button ${classMap(this.getRenderClasses())}\"\n ${ripple(this.getRipple)}>\n ${this.renderFocusRing()}\n ${when(this.showRipple, this.renderRipple)}\n ${this.renderOutline()}\n ${this.renderLeading()}\n ${this.renderLabel()}\n ${this.renderTouchTarget()}\n </button>\n `;\n }\n\n protected getRenderClasses() {\n return {\n 'md3-segmented-button--selected': this.selected,\n 'md3-segmented-button--unselected': !this.selected,\n 'md3-segmented-button--with-label': this.label !== '',\n 'md3-segmented-button--without-label': this.label === '',\n 'md3-segmented-button--with-icon': this.hasIcon,\n 'md3-segmented-button--with-checkmark': !this.noCheckmark,\n 'md3-segmented-button--without-checkmark': this.noCheckmark,\n 'md3-segmented-button--selecting': this.animState === 'selecting',\n 'md3-segmented-button--deselecting': this.animState === 'deselecting',\n };\n }\n\n protected renderFocusRing() {\n return html`<md-focus-ring .visible=\"${\n this.showFocusRing}\" class=\"md3-segmented-button__focus-ring\"></md-focus-ring>`;\n }\n\n protected readonly getRipple = () => {\n this.showRipple = true;\n return this.ripple;\n };\n\n protected renderRipple = () => {\n return html`<md-ripple ?disabled=\"${\n this.disabled}\" class=\"md3-segmented-button__ripple\"> </md-ripple>`;\n };\n\n protected renderOutline() {\n return html``;\n }\n\n protected renderLeading() {\n return this.label === '' ? this.renderLeadingWithoutLabel() :\n this.renderLeadingWithLabel();\n }\n\n protected renderLeadingWithoutLabel() {\n return html`\n <span class=\"md3-segmented-button__leading\" aria-hidden=\"true\">\n <span class=\"md3-segmented-button__graphic\">\n <svg class=\"md3-segmented-button__checkmark\" viewBox=\"0 0 24 24\">\n <path class=\"md3-segmented-button__checkmark-path\" fill=\"none\" d=\"M1.73,12.91 8.1,19.28 22.79,4.59\"></path>\n </svg>\n </span>\n <span class=\"md3-segmented-button__icon\" aria-hidden=\"true\">\n <slot name=\"icon\"></slot>\n </span>\n </span>\n `;\n }\n\n protected renderLeadingWithLabel() {\n return html`\n <span class=\"md3-segmented-button__leading\" aria-hidden=\"true\">\n <span class=\"md3-segmented-button__graphic\">\n <svg class=\"md3-segmented-button__checkmark\" viewBox=\"0 0 24 24\">\n <path class=\"md3-segmented-button__checkmark-path\" fill=\"none\" d=\"M1.73,12.91 8.1,19.28 22.79,4.59\"></path>\n </svg>\n <span class=\"md3-segmented-button__icon\" aria-hidden=\"true\">\n <slot name=\"icon\"></slot>\n </span>\n </span>\n </span>\n `;\n }\n\n protected renderLabel() {\n return html`\n <span class=\"md3-segmented-button__label-text\">${this.label}</span>\n `;\n }\n\n protected renderTouchTarget() {\n return html`<span class=\"md3-segmented-button__touch\"></span>`;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"segmented-button.js","sourceRoot":"","sources":["segmented-button.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,2BAA2B,CAAC;AACnC,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiC,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAC,QAAQ,EAAE,qBAAqB,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAE5C,OAAO,EAAC,yBAAyB,EAAC,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAC,MAAM,EAAC,MAAM,2BAA2B,CAAC;AAIjD;;;;;GAKG;AACH,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAA/C;;QAK6B,aAAQ,GAAG,KAAK,CAAC;QACjB,aAAQ,GAAG,KAAK,CAAC;QAChC,UAAK,GAAG,EAAE,CAAC;QACI,gBAAW,GAAG,KAAK,CAAC;QACpB,YAAO,GAAG,KAAK,CAAC;QAE1B,cAAS,GAAG,EAAE,CAAC;QACf,eAAU,GAAG,KAAK,CAAC;QAwEnB,cAAS,GAAG,GAAG,EAAE;YAChC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC,CAAC;QAEe,iBAAY,GAAG,GAAG,EAAE;YACnC,OAAO,IAAI,CAAA,yBACP,IAAI,CAAC,QAAQ,sDAAsD,CAAC;QA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D,CAAC;IACJ,CAAC;IAEO,iBAAiB;QACvB,OAAO,IAAI,CAAA,mDAAmD,CAAC;IACjE,CAAC;CACF;;AA7IC;IACE,yBAAyB,CAAC,EAAI,CAAC,CAAC;AAClC,CAAC,GAAA,CAAA;AAE0B;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;iDAAkB;AACjB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;iDAAkB;AAChC;IAAX,QAAQ,EAAE;8CAAY;AACI;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;oDAAqB;AACpB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;gDAAiB;AAElC;IAAR,KAAK,EAAE;kDAAwB;AACvB;IAAR,KAAK,EAAE;mDAA4B;AAEpC;IADC,qBAAqB,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;oDACR;AACpB;IAAxB,UAAU,CAAC,WAAW,CAAC;+CAAkD","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../focus/focus-ring.js';\nimport '../../ripple/ripple.js';\n\nimport {html, LitElement, nothing, PropertyValues, TemplateResult} from 'lit';\nimport {property, queryAssignedElements, queryAsync, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {when} from 'lit/directives/when.js';\n\nimport {requestUpdateOnAriaChange} from '../../aria/delegate.js';\nimport {ripple} from '../../ripple/directive.js';\nimport {MdRipple} from '../../ripple/ripple.js';\nimport {ARIAMixinStrict} from '../../types/aria.js';\n\n/**\n * SegmentedButton is a web component implementation of the Material Design\n * segmented button component. It is intended **only** for use as a child of a\n * `SementedButtonSet` component. It is **not** intended for use in any other\n * context.\n */\nexport class SegmentedButton extends LitElement {\n static {\n requestUpdateOnAriaChange(this);\n }\n\n @property({type: Boolean}) disabled = false;\n @property({type: Boolean}) selected = false;\n @property() label = '';\n @property({type: Boolean}) noCheckmark = false;\n @property({type: Boolean}) hasIcon = false;\n\n @state() private animState = '';\n @state() private showRipple = false;\n @queryAssignedElements({slot: 'icon', flatten: true})\n private readonly iconElement!: HTMLElement[];\n @queryAsync('md-ripple') private readonly ripple!: Promise<MdRipple|null>;\n\n protected override update(props: PropertyValues<SegmentedButton>) {\n this.animState = this.nextAnimationState(props);\n super.update(props);\n // NOTE: This needs to be set *after* calling super.update() to ensure the\n // appropriate CSS classes are applied.\n this.hasIcon = this.iconElement.length > 0;\n }\n\n private nextAnimationState(changedProps: PropertyValues<SegmentedButton>):\n string {\n const prevSelected = changedProps.get('selected');\n // Early exit for first update.\n if (prevSelected === undefined) return '';\n\n const nextSelected = this.selected;\n const nextHasCheckmark = !this.noCheckmark;\n if (!prevSelected && nextSelected && nextHasCheckmark) {\n return 'selecting';\n }\n if (prevSelected && !nextSelected && nextHasCheckmark) {\n return 'deselecting';\n }\n return '';\n }\n\n private handleClick() {\n const event = new Event(\n 'segmented-button-interaction', {bubbles: true, composed: true});\n this.dispatchEvent(event);\n }\n\n protected override render() {\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n <button\n tabindex=\"${this.disabled ? '-1' : '0'}\"\n aria-label=${ariaLabel || nothing}\n aria-pressed=${this.selected}\n ?disabled=${this.disabled}\n @click=\"${this.handleClick}\"\n class=\"md3-segmented-button ${classMap(this.getRenderClasses())}\"\n ${ripple(this.getRipple)}>\n <md-focus-ring class=\"md3-segmented-button__focus-ring\"></md-focus-ring>\n ${when(this.showRipple, this.renderRipple)}\n ${this.renderOutline()}\n ${this.renderLeading()}\n ${this.renderLabel()}\n ${this.renderTouchTarget()}\n </button>\n `;\n }\n\n protected getRenderClasses() {\n return {\n 'md3-segmented-button--selected': this.selected,\n 'md3-segmented-button--unselected': !this.selected,\n 'md3-segmented-button--with-label': this.label !== '',\n 'md3-segmented-button--without-label': this.label === '',\n 'md3-segmented-button--with-icon': this.hasIcon,\n 'md3-segmented-button--with-checkmark': !this.noCheckmark,\n 'md3-segmented-button--without-checkmark': this.noCheckmark,\n 'md3-segmented-button--selecting': this.animState === 'selecting',\n 'md3-segmented-button--deselecting': this.animState === 'deselecting',\n };\n }\n\n private readonly getRipple = () => {\n this.showRipple = true;\n return this.ripple;\n };\n\n private readonly renderRipple = () => {\n return html`<md-ripple ?disabled=\"${\n this.disabled}\" class=\"md3-segmented-button__ripple\"> </md-ripple>`;\n };\n\n protected renderOutline(): TemplateResult|typeof nothing {\n return nothing;\n }\n\n private renderLeading() {\n return this.label === '' ? this.renderLeadingWithoutLabel() :\n this.renderLeadingWithLabel();\n }\n\n private renderLeadingWithoutLabel() {\n return html`\n <span class=\"md3-segmented-button__leading\" aria-hidden=\"true\">\n <span class=\"md3-segmented-button__graphic\">\n <svg class=\"md3-segmented-button__checkmark\" viewBox=\"0 0 24 24\">\n <path class=\"md3-segmented-button__checkmark-path\" fill=\"none\" d=\"M1.73,12.91 8.1,19.28 22.79,4.59\"></path>\n </svg>\n </span>\n <span class=\"md3-segmented-button__icon\" aria-hidden=\"true\">\n <slot name=\"icon\"></slot>\n </span>\n </span>\n `;\n }\n\n private renderLeadingWithLabel() {\n return html`\n <span class=\"md3-segmented-button__leading\" aria-hidden=\"true\">\n <span class=\"md3-segmented-button__graphic\">\n <svg class=\"md3-segmented-button__checkmark\" viewBox=\"0 0 24 24\">\n <path class=\"md3-segmented-button__checkmark-path\" fill=\"none\" d=\"M1.73,12.91 8.1,19.28 22.79,4.59\"></path>\n </svg>\n <span class=\"md3-segmented-button__icon\" aria-hidden=\"true\">\n <slot name=\"icon\"></slot>\n </span>\n </span>\n </span>\n `;\n }\n\n private renderLabel() {\n return html`\n <span class=\"md3-segmented-button__label-text\">${this.label}</span>\n `;\n }\n\n private renderTouchTarget() {\n return html`<span class=\"md3-segmented-button__touch\"></span>`;\n }\n}\n"]}
|