@material/web 1.0.1 → 1.0.2-nightly.33c1afe.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all.d.ts +2 -0
- package/all.js +2 -0
- package/all.js.map +1 -1
- package/button/elevated-button.js +5 -1
- package/button/elevated-button.js.map +1 -1
- package/button/internal/_elevation.scss +32 -32
- package/button/internal/_icon.scss +22 -23
- package/button/internal/_outlined-button.scss +21 -19
- package/button/internal/_shared.scss +84 -77
- package/button/internal/_touch-target.scss +4 -0
- package/button/internal/button.d.ts +7 -11
- package/button/internal/button.js +52 -38
- package/button/internal/button.js.map +1 -1
- package/button/internal/elevated-button.d.ts +1 -1
- package/button/internal/elevated-button.js +1 -1
- package/button/internal/elevated-button.js.map +1 -1
- package/button/internal/filled-button.d.ts +1 -1
- package/button/internal/filled-button.js +1 -1
- package/button/internal/filled-button.js.map +1 -1
- package/button/internal/filled-tonal-button.d.ts +1 -1
- package/button/internal/filled-tonal-button.js +1 -1
- package/button/internal/filled-tonal-button.js.map +1 -1
- package/button/internal/outlined-button.d.ts +1 -1
- package/button/internal/outlined-button.js +2 -2
- package/button/internal/outlined-button.js.map +1 -1
- package/button/internal/outlined-styles.css.js +1 -1
- package/button/internal/outlined-styles.css.js.map +1 -1
- package/button/internal/shared-elevation-styles.css.js +1 -1
- package/button/internal/shared-elevation-styles.css.js.map +1 -1
- package/button/internal/shared-styles.css.js +1 -1
- package/button/internal/shared-styles.css.js.map +1 -1
- package/checkbox/internal/checkbox.d.ts +20 -87
- package/checkbox/internal/checkbox.js +35 -153
- package/checkbox/internal/checkbox.js.map +1 -1
- package/chips/filter-chip.js +5 -1
- package/chips/filter-chip.js.map +1 -1
- package/chips/harness.js.map +1 -1
- package/chips/input-chip.js +6 -1
- package/chips/input-chip.js.map +1 -1
- package/chips/internal/_shared.scss +1 -0
- package/chips/internal/assist-chip.js +8 -4
- package/chips/internal/assist-chip.js.map +1 -1
- package/chips/internal/chip-set.js +6 -4
- package/chips/internal/chip-set.js.map +1 -1
- package/chips/internal/chip.d.ts +3 -0
- package/chips/internal/chip.js +7 -5
- package/chips/internal/chip.js.map +1 -1
- package/chips/internal/filter-chip.d.ts +2 -0
- package/chips/internal/filter-chip.js +11 -5
- package/chips/internal/filter-chip.js.map +1 -1
- package/chips/internal/input-chip.d.ts +2 -0
- package/chips/internal/input-chip.js +10 -4
- package/chips/internal/input-chip.js.map +1 -1
- package/chips/internal/multi-action-chip.js.map +1 -1
- package/chips/internal/shared-styles.css.js +1 -1
- package/chips/internal/shared-styles.css.js.map +1 -1
- package/chips/internal/trailing-icons.d.ts +1 -1
- package/chips/internal/trailing-icons.js +6 -5
- package/chips/internal/trailing-icons.js.map +1 -1
- package/common.d.ts +2 -0
- package/common.js +2 -0
- package/common.js.map +1 -1
- package/dialog/harness.js +1 -2
- package/dialog/harness.js.map +1 -1
- package/dialog/internal/_dialog.scss +1 -1
- package/dialog/internal/animations.js +14 -12
- package/dialog/internal/animations.js.map +1 -1
- package/dialog/internal/dialog-styles.css.js +1 -1
- package/dialog/internal/dialog-styles.css.js.map +1 -1
- package/dialog/internal/dialog.d.ts +6 -6
- package/dialog/internal/dialog.js +24 -24
- package/dialog/internal/dialog.js.map +1 -1
- package/fab/harness.js.map +1 -1
- package/fab/internal/_shared.scss +1 -0
- package/fab/internal/fab.js.map +1 -1
- package/fab/internal/shared-styles.css.js +1 -1
- package/fab/internal/shared-styles.css.js.map +1 -1
- package/fab/internal/shared.js +10 -11
- package/fab/internal/shared.js.map +1 -1
- package/field/harness.js.map +1 -1
- package/field/internal/_content.scss +185 -174
- package/field/internal/_filled-field.scss +147 -136
- package/field/internal/_label.scss +83 -72
- package/field/internal/_outlined-field.scss +276 -262
- package/field/internal/_supporting-text.scss +53 -42
- package/field/internal/field.js +26 -22
- package/field/internal/field.js.map +1 -1
- package/field/internal/filled-styles.css.js +1 -1
- package/field/internal/filled-styles.css.js.map +1 -1
- package/field/internal/outlined-styles.css.js +1 -1
- package/field/internal/outlined-styles.css.js.map +1 -1
- package/field/internal/shared-styles.css.js +1 -1
- package/field/internal/shared-styles.css.js.map +1 -1
- package/focus/internal/focus-ring.d.ts +2 -0
- package/focus/internal/focus-ring.js +3 -3
- package/focus/internal/focus-ring.js.map +1 -1
- package/icon/internal/_icon.scss +7 -4
- package/icon/internal/icon-styles.css.js +1 -1
- package/icon/internal/icon-styles.css.js.map +1 -1
- package/iconbutton/internal/icon-button.d.ts +9 -4
- package/iconbutton/internal/icon-button.js +35 -22
- package/iconbutton/internal/icon-button.js.map +1 -1
- package/internal/aria/aria.d.ts +4 -26
- package/internal/aria/aria.js +10 -28
- package/internal/aria/aria.js.map +1 -1
- package/internal/aria/delegate.js +2 -2
- package/internal/aria/delegate.js.map +1 -1
- package/internal/controller/attachable-controller.js +3 -5
- package/internal/controller/attachable-controller.js.map +1 -1
- package/internal/controller/form-submitter.d.ts +3 -5
- package/internal/controller/form-submitter.js +5 -7
- package/internal/controller/form-submitter.js.map +1 -1
- package/internal/controller/is-rtl.js +2 -2
- package/internal/controller/is-rtl.js.map +1 -1
- package/internal/controller/string-converter.js +1 -1
- package/internal/controller/string-converter.js.map +1 -1
- package/internal/motion/animation.js.map +1 -1
- package/labs/behaviors/constraint-validation.d.ts +133 -0
- package/labs/behaviors/constraint-validation.js +114 -0
- package/labs/behaviors/constraint-validation.js.map +1 -0
- package/labs/behaviors/element-internals.d.ts +45 -0
- package/labs/behaviors/element-internals.js +50 -0
- package/labs/behaviors/element-internals.js.map +1 -0
- package/labs/behaviors/focusable.d.ts +39 -0
- package/labs/behaviors/focusable.js +82 -0
- package/labs/behaviors/focusable.js.map +1 -0
- package/labs/behaviors/form-associated.d.ts +199 -0
- package/labs/behaviors/form-associated.js +155 -0
- package/labs/behaviors/form-associated.js.map +1 -0
- package/labs/behaviors/mixin.d.ts +54 -0
- package/labs/behaviors/mixin.js +7 -0
- package/labs/behaviors/mixin.js.map +1 -0
- package/labs/behaviors/on-report-validity.d.ts +70 -0
- package/labs/behaviors/on-report-validity.js +150 -0
- package/labs/behaviors/on-report-validity.js.map +1 -0
- package/labs/behaviors/validators/checkbox-validator.d.ts +31 -0
- package/labs/behaviors/validators/checkbox-validator.js +29 -0
- package/labs/behaviors/validators/checkbox-validator.js.map +1 -0
- package/labs/behaviors/validators/select-validator.d.ts +31 -0
- package/labs/behaviors/validators/select-validator.js +30 -0
- package/labs/behaviors/validators/select-validator.js.map +1 -0
- package/labs/behaviors/validators/validator.d.ts +92 -0
- package/labs/behaviors/validators/validator.js +83 -0
- package/labs/behaviors/validators/validator.js.map +1 -0
- package/labs/card/_elevated-card.scss +6 -0
- package/labs/card/_filled-card.scss +6 -0
- package/labs/card/_outlined-card.scss +6 -0
- package/labs/card/elevated-card.d.ts +18 -0
- package/labs/card/elevated-card.js +21 -0
- package/labs/card/elevated-card.js.map +1 -0
- package/labs/card/filled-card.d.ts +18 -0
- package/labs/card/filled-card.js +21 -0
- package/labs/card/filled-card.js.map +1 -0
- package/labs/card/internal/_elevated-card.scss +35 -0
- package/labs/card/internal/_filled-card.scss +35 -0
- package/labs/card/internal/_outlined-card.scss +39 -0
- package/labs/card/internal/_shared.scss +40 -0
- package/labs/card/internal/card.d.ts +13 -0
- package/labs/card/internal/card.js +20 -0
- package/labs/card/internal/card.js.map +1 -0
- package/labs/card/internal/elevated-styles.css.js +9 -0
- package/labs/card/internal/elevated-styles.css.js.map +1 -0
- package/labs/card/internal/elevated-styles.scss +10 -0
- package/labs/card/internal/filled-styles.css.js +9 -0
- package/labs/card/internal/filled-styles.css.js.map +1 -0
- package/labs/card/internal/filled-styles.scss +10 -0
- package/labs/card/internal/outlined-styles.css.js +9 -0
- package/labs/card/internal/outlined-styles.css.js.map +1 -0
- package/labs/card/internal/outlined-styles.scss +10 -0
- package/labs/card/internal/shared-styles.css.js +9 -0
- package/labs/card/internal/shared-styles.css.js.map +1 -0
- package/labs/card/internal/shared-styles.scss +10 -0
- package/labs/card/outlined-card.d.ts +18 -0
- package/labs/card/outlined-card.js +21 -0
- package/labs/card/outlined-card.js.map +1 -0
- package/labs/item/internal/item.js +8 -8
- package/labs/item/internal/item.js.map +1 -1
- package/labs/navigationbar/internal/constants.js.map +1 -1
- package/labs/navigationbar/internal/navigation-bar.d.ts +3 -0
- package/labs/navigationbar/internal/navigation-bar.js +18 -11
- package/labs/navigationbar/internal/navigation-bar.js.map +1 -1
- package/labs/navigationdrawer/internal/navigation-drawer-modal.d.ts +3 -0
- package/labs/navigationdrawer/internal/navigation-drawer-modal.js +10 -3
- package/labs/navigationdrawer/internal/navigation-drawer-modal.js.map +1 -1
- package/labs/navigationdrawer/internal/navigation-drawer.d.ts +3 -0
- package/labs/navigationdrawer/internal/navigation-drawer.js +8 -1
- package/labs/navigationdrawer/internal/navigation-drawer.js.map +1 -1
- package/labs/navigationtab/harness.js.map +1 -1
- package/labs/navigationtab/internal/navigation-tab.d.ts +6 -0
- package/labs/navigationtab/internal/navigation-tab.js +43 -27
- package/labs/navigationtab/internal/navigation-tab.js.map +1 -1
- package/labs/navigationtab/internal/state.js.map +1 -1
- package/labs/segmentedbutton/internal/_shared.scss +1 -0
- package/labs/segmentedbutton/internal/segmented-button.d.ts +3 -0
- package/labs/segmentedbutton/internal/segmented-button.js +26 -12
- package/labs/segmentedbutton/internal/segmented-button.js.map +1 -1
- package/labs/segmentedbutton/internal/shared-styles.css.js +1 -1
- package/labs/segmentedbutton/internal/shared-styles.css.js.map +1 -1
- package/labs/segmentedbuttonset/internal/segmented-button-set.d.ts +5 -0
- package/labs/segmentedbuttonset/internal/segmented-button-set.js +14 -9
- package/labs/segmentedbuttonset/internal/segmented-button-set.js.map +1 -1
- package/list/harness.d.ts +1 -1
- package/list/harness.js.map +1 -1
- package/list/internal/list-controller.d.ts +1 -1
- package/list/internal/list-controller.js +7 -3
- package/list/internal/list-controller.js.map +1 -1
- package/list/internal/list-navigation-helpers.js.map +1 -1
- package/list/internal/list.d.ts +2 -2
- package/list/internal/list.js +8 -6
- package/list/internal/list.js.map +1 -1
- package/list/internal/listitem/_list-item.scss +1 -0
- package/list/internal/listitem/harness.d.ts +1 -1
- package/list/internal/listitem/harness.js.map +1 -1
- package/list/internal/listitem/list-item-styles.css.js +1 -1
- package/list/internal/listitem/list-item-styles.css.js.map +1 -1
- package/list/internal/listitem/list-item.d.ts +3 -2
- package/list/internal/listitem/list-item.js +19 -20
- package/list/internal/listitem/list-item.js.map +1 -1
- package/list/list-item.d.ts +4 -12
- package/list/list-item.js +4 -12
- package/list/list-item.js.map +1 -1
- package/menu/harness.js.map +1 -1
- package/menu/internal/_menu.scss +12 -1
- package/menu/internal/controllers/menuItemController.js +9 -4
- package/menu/internal/controllers/menuItemController.js.map +1 -1
- package/menu/internal/controllers/shared.d.ts +9 -1
- package/menu/internal/controllers/shared.js +4 -4
- package/menu/internal/controllers/shared.js.map +1 -1
- package/menu/internal/controllers/surfacePositionController.d.ts +16 -2
- package/menu/internal/controllers/surfacePositionController.js +124 -54
- package/menu/internal/controllers/surfacePositionController.js.map +1 -1
- package/menu/internal/controllers/typeaheadController.js +19 -14
- package/menu/internal/controllers/typeaheadController.js.map +1 -1
- package/menu/internal/menu-styles.css.js +1 -1
- package/menu/internal/menu-styles.css.js.map +1 -1
- package/menu/internal/menu.d.ts +43 -12
- package/menu/internal/menu.js +124 -57
- package/menu/internal/menu.js.map +1 -1
- package/menu/internal/menuitem/harness.js.map +1 -1
- package/menu/internal/menuitem/menu-item.d.ts +3 -2
- package/menu/internal/menuitem/menu-item.js +18 -19
- package/menu/internal/menuitem/menu-item.js.map +1 -1
- package/menu/internal/submenu/sub-menu.d.ts +8 -8
- package/menu/internal/submenu/sub-menu.js +31 -22
- package/menu/internal/submenu/sub-menu.js.map +1 -1
- package/menu/internal/types.js.map +1 -1
- package/package.json +1 -1
- package/progress/internal/_circular-progress.scss +2 -2
- package/progress/internal/_linear-progress.scss +1 -1
- package/progress/internal/circular-progress-styles.css.js +1 -1
- package/progress/internal/circular-progress-styles.css.js.map +1 -1
- package/progress/internal/circular-progress.js +11 -10
- package/progress/internal/circular-progress.js.map +1 -1
- package/progress/internal/linear-progress-styles.css.js +1 -1
- package/progress/internal/linear-progress-styles.css.js.map +1 -1
- package/progress/internal/linear-progress.d.ts +1 -1
- package/progress/internal/linear-progress.js +3 -3
- package/progress/internal/linear-progress.js.map +1 -1
- package/progress/internal/progress.js +4 -2
- package/progress/internal/progress.js.map +1 -1
- package/radio/internal/radio.d.ts +11 -27
- package/radio/internal/radio.js +30 -54
- package/radio/internal/radio.js.map +1 -1
- package/radio/internal/single-selection-controller.js +1 -1
- package/radio/internal/single-selection-controller.js.map +1 -1
- package/ripple/internal/ripple.js +14 -9
- package/ripple/internal/ripple.js.map +1 -1
- package/select/filled-select.js +1 -2
- package/select/filled-select.js.map +1 -1
- package/select/harness.js +1 -1
- package/select/harness.js.map +1 -1
- package/select/internal/select.d.ts +26 -99
- package/select/internal/select.js +78 -187
- package/select/internal/select.js.map +1 -1
- package/select/internal/selectoption/select-option.d.ts +8 -6
- package/select/internal/selectoption/select-option.js +23 -22
- package/select/internal/selectoption/select-option.js.map +1 -1
- package/select/internal/selectoption/selectOptionController.js +1 -1
- package/select/internal/selectoption/selectOptionController.js.map +1 -1
- package/select/outlined-select.js +1 -2
- package/select/outlined-select.js.map +1 -1
- package/slider/harness.js +5 -5
- package/slider/harness.js.map +1 -1
- package/slider/internal/slider.d.ts +16 -25
- package/slider/internal/slider.js +110 -114
- package/slider/internal/slider.js.map +1 -1
- package/switch/internal/switch.d.ts +13 -89
- package/switch/internal/switch.js +32 -159
- package/switch/internal/switch.js.map +1 -1
- package/tabs/harness.js +3 -3
- package/tabs/harness.js.map +1 -1
- package/tabs/internal/_tab.scss +27 -35
- package/tabs/internal/primary-tab.d.ts +0 -2
- package/tabs/internal/tab-styles.css.js +1 -1
- package/tabs/internal/tab-styles.css.js.map +1 -1
- package/tabs/internal/tab.d.ts +4 -5
- package/tabs/internal/tab.js +34 -22
- package/tabs/internal/tab.js.map +1 -1
- package/tabs/internal/tabs.d.ts +6 -2
- package/tabs/internal/tabs.js +18 -11
- package/tabs/internal/tabs.js.map +1 -1
- package/textfield/filled-text-field.js +1 -2
- package/textfield/filled-text-field.js.map +1 -1
- package/textfield/harness.js +3 -2
- package/textfield/harness.js.map +1 -1
- package/textfield/internal/text-field.d.ts +26 -18
- package/textfield/internal/text-field.js +81 -58
- package/textfield/internal/text-field.js.map +1 -1
- package/textfield/outlined-text-field.js +1 -2
- package/textfield/outlined-text-field.js.map +1 -1
- package/tokens/_index.scss +3 -0
- package/tokens/_md-comp-elevated-card.scss +63 -0
- package/tokens/_md-comp-filled-card.scss +63 -0
- package/tokens/_md-comp-icon.scss +2 -0
- package/tokens/_md-comp-outlined-card.scss +69 -0
- package/tokens/_md-comp-test-table.scss +1 -0
- package/internal/controller/element-internals.d.ts +0 -35
- package/internal/controller/element-internals.js +0 -24
- package/internal/controller/element-internals.js.map +0 -1
- package/select/internal/filled-forced-colors-styles.css.js +0 -9
- package/select/internal/filled-forced-colors-styles.css.js.map +0 -1
- package/select/internal/filled-forced-colors-styles.scss +0 -29
- package/select/internal/outlined-forced-colors-styles.css.js +0 -9
- package/select/internal/outlined-forced-colors-styles.css.js.map +0 -1
- package/select/internal/outlined-forced-colors-styles.scss +0 -29
- package/textfield/internal/filled-forced-colors-styles.css.js +0 -9
- package/textfield/internal/filled-forced-colors-styles.css.js.map +0 -1
- package/textfield/internal/filled-forced-colors-styles.scss +0 -29
- package/textfield/internal/outlined-forced-colors-styles.css.js +0 -9
- package/textfield/internal/outlined-forced-colors-styles.css.js.map +0 -1
- package/textfield/internal/outlined-forced-colors-styles.scss +0 -29
- /package/{select/internal/filled-forced-colors-styles.css.d.ts → labs/card/internal/elevated-styles.css.d.ts} +0 -0
- /package/{select/internal/outlined-forced-colors-styles.css.d.ts → labs/card/internal/filled-styles.css.d.ts} +0 -0
- /package/{textfield/internal/filled-forced-colors-styles.css.d.ts → labs/card/internal/outlined-styles.css.d.ts} +0 -0
- /package/{textfield/internal/outlined-forced-colors-styles.css.d.ts → labs/card/internal/shared-styles.css.d.ts} +0 -0
package/select/harness.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAG9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AAEvE;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,OAAe;IACtC,QAAQ;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAU,CAAC;IAClE,CAAC;IACD;;OAEG;IACgB,KAAK,CAAC,qBAAqB;QAC5C,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IAEQ,KAAK,CAAC,UAAU;QACvB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAG9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AAEvE;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,OAAe;IACtC,QAAQ;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAU,CAAC;IAClE,CAAC;IACD;;OAEG;IACgB,KAAK,CAAC,qBAAqB;QAC5C,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IAEQ,KAAK,CAAC,UAAU;QACvB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,MAAM,IAAI,mBAAmB,CAC3C,KAAK,CACN,CAAC,qBAAqB,EAAE,CAAC;QAC1B,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,uDAAuD;IACvD,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAC7B,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,IAAgC,CAAC,CACpE,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;QAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,SAAS,CAAE,CAAC;QAC/D,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACd,OAAO,CAAC,IAAI,CACV,wEAAwE,CACzE,CAAC;SACH;QACD,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,qBAAqB,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;IACjE,CAAC;CACF;AAED,+BAA+B;AAC/B,MAAM,mBAAoB,SAAQ,YAAY;IAC5C,4EAA4E;IACnE,qBAAqB;QAC5B,OAAO,KAAK,CAAC,qBAAqB,EAAE,CAAC;IACvC,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {LitElement} from 'lit';\n\nimport {FieldHarness} from '../field/harness.js';\nimport {Field} from '../field/internal/field.js';\nimport {Harness} from '../testing/harness.js';\n\nimport {Select} from './internal/select.js';\nimport {SelectOptionHarness} from './internal/selectoption/harness.js';\n\n/**\n * Test harness for menu.\n */\nexport class SelectHarness extends Harness<Select> {\n protected getField() {\n return this.element.renderRoot.querySelector('.field') as Field;\n }\n /**\n * Shows the menu and returns the first list item element.\n */\n protected override async getInteractiveElement() {\n await this.element.updateComplete;\n return this.getField();\n }\n\n override async startHover() {\n const field = await this.getField();\n const element = await new SelectFieldHardness(\n field,\n ).getInteractiveElement();\n this.simulateStartHover(element);\n }\n\n /** @return ListItem harnesses for the menu's items. */\n getItems() {\n return this.element.options.map(\n (item) => new SelectOptionHarness(item as typeof item & LitElement),\n );\n }\n\n async click() {\n const field = await this.getField();\n field.click();\n }\n\n async clickOption(index: number) {\n const menu = this.element.renderRoot.querySelector('md-menu')!;\n if (!menu.open) {\n console.warn(\n 'Internal menu is not open. Try calling SelectHarness.prototype.click()',\n );\n }\n (await this.getItems()[index].getInteractiveElement()).click();\n }\n}\n\n// Private class (not exported)\nclass SelectFieldHardness extends FieldHarness {\n /* Expose so that we can call it from our internal code in SelectHarness. */\n override getInteractiveElement() {\n return super.getInteractiveElement();\n }\n}\n"]}
|
|
@@ -6,23 +6,29 @@
|
|
|
6
6
|
import '../../menu/menu.js';
|
|
7
7
|
import { LitElement, PropertyValues } from 'lit';
|
|
8
8
|
import { StaticValue } from 'lit/static-html.js';
|
|
9
|
+
import { Field } from '../../field/internal/field.js';
|
|
10
|
+
import { createValidator, getValidityAnchor } from '../../labs/behaviors/constraint-validation.js';
|
|
11
|
+
import { getFormValue } from '../../labs/behaviors/form-associated.js';
|
|
12
|
+
import { onReportValidity } from '../../labs/behaviors/on-report-validity.js';
|
|
13
|
+
import { SelectValidator } from '../../labs/behaviors/validators/select-validator.js';
|
|
9
14
|
import { SelectOption } from './selectoption/selectOptionController.js';
|
|
10
15
|
declare const VALUE: unique symbol;
|
|
16
|
+
declare const selectBaseClass: import("../../labs/behaviors/mixin.js").MixinReturn<import("../../labs/behaviors/mixin.js").MixinReturn<import("../../labs/behaviors/mixin.js").MixinReturn<(abstract new (...args: any[]) => import("../../labs/behaviors/element-internals.js").WithElementInternals) & typeof LitElement & import("../../labs/behaviors/form-associated.js").FormAssociatedConstructor, import("../../labs/behaviors/form-associated.js").FormAssociated>, import("../../labs/behaviors/constraint-validation.js").ConstraintValidation>, import("../../labs/behaviors/on-report-validity.js").OnReportValidity>;
|
|
11
17
|
/**
|
|
12
|
-
* @fires
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @fires
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* @fires change {Event} The native `change` event on
|
|
19
|
+
* [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event)
|
|
20
|
+
* --bubbles
|
|
21
|
+
* @fires input {InputEvent} The native `input` event on
|
|
22
|
+
* [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event)
|
|
23
|
+
* --bubbles --composed
|
|
24
|
+
* @fires opening {Event} Fired when the select's menu is about to open.
|
|
25
|
+
* @fires opened {Event} Fired when the select's menu has finished animations
|
|
26
|
+
* and opened.
|
|
27
|
+
* @fires closing {Event} Fired when the select's menu is about to close.
|
|
28
|
+
* @fires closed {Event} Fired when the select's menu has finished animations
|
|
29
|
+
* and closed.
|
|
22
30
|
*/
|
|
23
|
-
export declare abstract class Select extends
|
|
24
|
-
/** @nocollapse */
|
|
25
|
-
static readonly formAssociated = true;
|
|
31
|
+
export declare abstract class Select extends selectBaseClass {
|
|
26
32
|
/**
|
|
27
33
|
* Opens the menu synchronously with no animation.
|
|
28
34
|
*/
|
|
@@ -31,10 +37,6 @@ export declare abstract class Select extends LitElement {
|
|
|
31
37
|
* Whether or not the select is required.
|
|
32
38
|
*/
|
|
33
39
|
required: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Disables the select.
|
|
36
|
-
*/
|
|
37
|
-
disabled: boolean;
|
|
38
40
|
/**
|
|
39
41
|
* The error message that replaces supporting text when `error` is true. If
|
|
40
42
|
* `errorText` is an empty string, then the supporting text will continue to
|
|
@@ -67,7 +69,7 @@ export declare abstract class Select extends LitElement {
|
|
|
67
69
|
* position:fixed is useful for cases where select is inside of another
|
|
68
70
|
* element with stacking context and hidden overflows such as `md-dialog`.
|
|
69
71
|
*/
|
|
70
|
-
menuPositioning: 'absolute' | 'fixed';
|
|
72
|
+
menuPositioning: 'absolute' | 'fixed' | 'popover';
|
|
71
73
|
/**
|
|
72
74
|
* The max time between the keystrokes of the typeahead select / menu behavior
|
|
73
75
|
* before it clears the typeahead buffer.
|
|
@@ -106,40 +108,6 @@ export declare abstract class Select extends LitElement {
|
|
|
106
108
|
* NOTE: md-select only suppoprts single selection.
|
|
107
109
|
*/
|
|
108
110
|
get selectedOptions(): SelectOption[];
|
|
109
|
-
/**
|
|
110
|
-
* The HTML name to use in form submission.
|
|
111
|
-
*/
|
|
112
|
-
get name(): string;
|
|
113
|
-
set name(name: string);
|
|
114
|
-
/**
|
|
115
|
-
* The associated form element with which this element's value will submit.
|
|
116
|
-
*/
|
|
117
|
-
get form(): HTMLFormElement;
|
|
118
|
-
/**
|
|
119
|
-
* The labels this element is associated with.
|
|
120
|
-
*/
|
|
121
|
-
get labels(): NodeList;
|
|
122
|
-
/**
|
|
123
|
-
* Returns a ValidityState object that represents the validity states of the
|
|
124
|
-
* checkbox.
|
|
125
|
-
*
|
|
126
|
-
* Note that selects will only set `valueMissing` if unselected and
|
|
127
|
-
* `required`.
|
|
128
|
-
*/
|
|
129
|
-
get validity(): ValidityState;
|
|
130
|
-
/**
|
|
131
|
-
* Returns the native validation error message.
|
|
132
|
-
*
|
|
133
|
-
* https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation#constraint_validation_process
|
|
134
|
-
*/
|
|
135
|
-
get validationMessage(): string;
|
|
136
|
-
/**
|
|
137
|
-
* Returns whether an element will successfully validate based on forms
|
|
138
|
-
* validation rules and constraints.
|
|
139
|
-
*
|
|
140
|
-
* https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation#constraint_validation_process
|
|
141
|
-
*/
|
|
142
|
-
get willValidate(): boolean;
|
|
143
111
|
protected abstract readonly fieldTag: StaticValue;
|
|
144
112
|
/**
|
|
145
113
|
* Used for initializing select when the user sets the `value` directly.
|
|
@@ -171,8 +139,6 @@ export declare abstract class Select extends LitElement {
|
|
|
171
139
|
private readonly menu;
|
|
172
140
|
private readonly labelEl;
|
|
173
141
|
private readonly leadingIcons;
|
|
174
|
-
private customValidationMessage;
|
|
175
|
-
private readonly internals;
|
|
176
142
|
/**
|
|
177
143
|
* Selects an option given the value of the option, and updates MdSelect's
|
|
178
144
|
* value.
|
|
@@ -187,49 +153,9 @@ export declare abstract class Select extends LitElement {
|
|
|
187
153
|
* Reset the select to its default value.
|
|
188
154
|
*/
|
|
189
155
|
reset(): void;
|
|
190
|
-
|
|
191
|
-
* Checks the select's native validation and returns whether or not the
|
|
192
|
-
* element is valid.
|
|
193
|
-
*
|
|
194
|
-
* If invalid, this method will dispatch the `invalid` event.
|
|
195
|
-
*
|
|
196
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/checkValidity
|
|
197
|
-
*
|
|
198
|
-
* @return true if the select is valid, or false if not.
|
|
199
|
-
*/
|
|
200
|
-
checkValidity(): boolean;
|
|
201
|
-
/**
|
|
202
|
-
* Checks the select's native validation and returns whether or not the
|
|
203
|
-
* element is valid.
|
|
204
|
-
*
|
|
205
|
-
* If invalid, this method will dispatch the `invalid` event.
|
|
206
|
-
*
|
|
207
|
-
* This method will display or clear an error text message equal to the
|
|
208
|
-
* select's `validationMessage`, unless the invalid event is canceled.
|
|
209
|
-
*
|
|
210
|
-
* Use `setCustomValidity()` to customize the `validationMessage`.
|
|
211
|
-
*
|
|
212
|
-
* This method can also be used to re-announce error messages to screen
|
|
213
|
-
* readers.
|
|
214
|
-
*
|
|
215
|
-
* @return true if the select is valid, or false if not.
|
|
216
|
-
*/
|
|
217
|
-
reportValidity(): boolean;
|
|
218
|
-
/**
|
|
219
|
-
* Sets the select's native validation error message. This is used to
|
|
220
|
-
* customize `validationMessage`.
|
|
221
|
-
*
|
|
222
|
-
* When the error is not an empty string, the select is considered invalid
|
|
223
|
-
* and `validity.customError` will be true.
|
|
224
|
-
*
|
|
225
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/setCustomValidity
|
|
226
|
-
*
|
|
227
|
-
* @param error The error message to display.
|
|
228
|
-
*/
|
|
229
|
-
setCustomValidity(error: string): void;
|
|
156
|
+
[onReportValidity](invalidEvent: Event | null): void;
|
|
230
157
|
protected update(changed: PropertyValues<Select>): void;
|
|
231
158
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
232
|
-
protected updated(changed: PropertyValues<Select>): void;
|
|
233
159
|
protected firstUpdated(changed: PropertyValues<Select>): Promise<void>;
|
|
234
160
|
private getRenderClasses;
|
|
235
161
|
private renderField;
|
|
@@ -303,11 +229,12 @@ export declare abstract class Select extends LitElement {
|
|
|
303
229
|
*/
|
|
304
230
|
private dispatchInteractionEvents;
|
|
305
231
|
private getErrorText;
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
232
|
+
disabled: boolean;
|
|
233
|
+
name: string;
|
|
234
|
+
[getFormValue](): string;
|
|
309
235
|
formResetCallback(): void;
|
|
310
|
-
/** @private */
|
|
311
236
|
formStateRestoreCallback(state: string): void;
|
|
237
|
+
[createValidator](): SelectValidator;
|
|
238
|
+
[getValidityAnchor](): Field;
|
|
312
239
|
}
|
|
313
240
|
export {};
|
|
@@ -12,25 +12,34 @@ import { classMap } from 'lit/directives/class-map.js';
|
|
|
12
12
|
import { html as staticHtml } from 'lit/static-html.js';
|
|
13
13
|
import { requestUpdateOnAriaChange } from '../../internal/aria/delegate.js';
|
|
14
14
|
import { redispatchEvent } from '../../internal/controller/events.js';
|
|
15
|
+
import { createValidator, getValidityAnchor, mixinConstraintValidation, } from '../../labs/behaviors/constraint-validation.js';
|
|
16
|
+
import { mixinElementInternals } from '../../labs/behaviors/element-internals.js';
|
|
17
|
+
import { getFormValue, mixinFormAssociated, } from '../../labs/behaviors/form-associated.js';
|
|
18
|
+
import { mixinOnReportValidity, onReportValidity, } from '../../labs/behaviors/on-report-validity.js';
|
|
19
|
+
import { SelectValidator } from '../../labs/behaviors/validators/select-validator.js';
|
|
15
20
|
import { getActiveItem } from '../../list/internal/list-navigation-helpers.js';
|
|
16
|
-
import { isElementInSubtree, isSelectableKey } from '../../menu/internal/controllers/shared.js';
|
|
21
|
+
import { isElementInSubtree, isSelectableKey, } from '../../menu/internal/controllers/shared.js';
|
|
17
22
|
import { TYPEAHEAD_RECORD } from '../../menu/internal/controllers/typeaheadController.js';
|
|
18
23
|
import { DEFAULT_TYPEAHEAD_BUFFER_TIME } from '../../menu/internal/menu.js';
|
|
19
24
|
import { getSelectedItems } from './shared.js';
|
|
20
25
|
const VALUE = Symbol('value');
|
|
26
|
+
// Separate variable needed for closure.
|
|
27
|
+
const selectBaseClass = mixinOnReportValidity(mixinConstraintValidation(mixinFormAssociated(mixinElementInternals(LitElement))));
|
|
21
28
|
/**
|
|
22
|
-
* @fires
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* @fires
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* @fires change {Event} The native `change` event on
|
|
30
|
+
* [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event)
|
|
31
|
+
* --bubbles
|
|
32
|
+
* @fires input {InputEvent} The native `input` event on
|
|
33
|
+
* [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event)
|
|
34
|
+
* --bubbles --composed
|
|
35
|
+
* @fires opening {Event} Fired when the select's menu is about to open.
|
|
36
|
+
* @fires opened {Event} Fired when the select's menu has finished animations
|
|
37
|
+
* and opened.
|
|
38
|
+
* @fires closing {Event} Fired when the select's menu is about to close.
|
|
39
|
+
* @fires closed {Event} Fired when the select's menu has finished animations
|
|
40
|
+
* and closed.
|
|
32
41
|
*/
|
|
33
|
-
export class Select extends
|
|
42
|
+
export class Select extends selectBaseClass {
|
|
34
43
|
constructor() {
|
|
35
44
|
super(...arguments);
|
|
36
45
|
/**
|
|
@@ -41,10 +50,6 @@ export class Select extends LitElement {
|
|
|
41
50
|
* Whether or not the select is required.
|
|
42
51
|
*/
|
|
43
52
|
this.required = false;
|
|
44
|
-
/**
|
|
45
|
-
* Disables the select.
|
|
46
|
-
*/
|
|
47
|
-
this.disabled = false;
|
|
48
53
|
/**
|
|
49
54
|
* The error message that replaces supporting text when `error` is true. If
|
|
50
55
|
* `errorText` is an empty string, then the supporting text will continue to
|
|
@@ -77,7 +82,7 @@ export class Select extends LitElement {
|
|
|
77
82
|
* position:fixed is useful for cases where select is inside of another
|
|
78
83
|
* element with stacking context and hidden overflows such as `md-dialog`.
|
|
79
84
|
*/
|
|
80
|
-
this.menuPositioning = '
|
|
85
|
+
this.menuPositioning = 'popover';
|
|
81
86
|
/**
|
|
82
87
|
* The max time between the keystrokes of the typeahead select / menu behavior
|
|
83
88
|
* before it clears the typeahead buffer.
|
|
@@ -118,8 +123,6 @@ export class Select extends LitElement {
|
|
|
118
123
|
this.nativeErrorText = '';
|
|
119
124
|
this.focused = false;
|
|
120
125
|
this.open = false;
|
|
121
|
-
this.customValidationMessage = '';
|
|
122
|
-
this.internals = this /* needed for closure */.attachInternals();
|
|
123
126
|
}
|
|
124
127
|
/**
|
|
125
128
|
* The value of the currently selected option.
|
|
@@ -164,57 +167,6 @@ export class Select extends LitElement {
|
|
|
164
167
|
get selectedOptions() {
|
|
165
168
|
return (this.getSelectedOptions() ?? []).map(([option]) => option);
|
|
166
169
|
}
|
|
167
|
-
/**
|
|
168
|
-
* The HTML name to use in form submission.
|
|
169
|
-
*/
|
|
170
|
-
get name() {
|
|
171
|
-
return this.getAttribute('name') ?? '';
|
|
172
|
-
}
|
|
173
|
-
set name(name) {
|
|
174
|
-
this.setAttribute('name', name);
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* The associated form element with which this element's value will submit.
|
|
178
|
-
*/
|
|
179
|
-
get form() {
|
|
180
|
-
return this.internals.form;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* The labels this element is associated with.
|
|
184
|
-
*/
|
|
185
|
-
get labels() {
|
|
186
|
-
return this.internals.labels;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Returns a ValidityState object that represents the validity states of the
|
|
190
|
-
* checkbox.
|
|
191
|
-
*
|
|
192
|
-
* Note that selects will only set `valueMissing` if unselected and
|
|
193
|
-
* `required`.
|
|
194
|
-
*/
|
|
195
|
-
get validity() {
|
|
196
|
-
this.syncValidity();
|
|
197
|
-
return this.internals.validity;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Returns the native validation error message.
|
|
201
|
-
*
|
|
202
|
-
* https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation#constraint_validation_process
|
|
203
|
-
*/
|
|
204
|
-
get validationMessage() {
|
|
205
|
-
this.syncValidity();
|
|
206
|
-
return this.internals.validationMessage;
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Returns whether an element will successfully validate based on forms
|
|
210
|
-
* validation rules and constraints.
|
|
211
|
-
*
|
|
212
|
-
* https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation#constraint_validation_process
|
|
213
|
-
*/
|
|
214
|
-
get willValidate() {
|
|
215
|
-
this.syncValidity();
|
|
216
|
-
return this.internals.willValidate;
|
|
217
|
-
}
|
|
218
170
|
get hasError() {
|
|
219
171
|
return this.error || this.nativeError;
|
|
220
172
|
}
|
|
@@ -223,7 +175,7 @@ export class Select extends LitElement {
|
|
|
223
175
|
* value.
|
|
224
176
|
*/
|
|
225
177
|
select(value) {
|
|
226
|
-
const optionToSelect = this.options.find(option => option.value === value);
|
|
178
|
+
const optionToSelect = this.options.find((option) => option.value === value);
|
|
227
179
|
if (optionToSelect) {
|
|
228
180
|
this.selectItem(optionToSelect);
|
|
229
181
|
}
|
|
@@ -249,67 +201,17 @@ export class Select extends LitElement {
|
|
|
249
201
|
this.nativeError = false;
|
|
250
202
|
this.nativeErrorText = '';
|
|
251
203
|
}
|
|
252
|
-
|
|
253
|
-
* Checks the select's native validation and returns whether or not the
|
|
254
|
-
* element is valid.
|
|
255
|
-
*
|
|
256
|
-
* If invalid, this method will dispatch the `invalid` event.
|
|
257
|
-
*
|
|
258
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/checkValidity
|
|
259
|
-
*
|
|
260
|
-
* @return true if the select is valid, or false if not.
|
|
261
|
-
*/
|
|
262
|
-
checkValidity() {
|
|
263
|
-
this.syncValidity();
|
|
264
|
-
return this.internals.checkValidity();
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Checks the select's native validation and returns whether or not the
|
|
268
|
-
* element is valid.
|
|
269
|
-
*
|
|
270
|
-
* If invalid, this method will dispatch the `invalid` event.
|
|
271
|
-
*
|
|
272
|
-
* This method will display or clear an error text message equal to the
|
|
273
|
-
* select's `validationMessage`, unless the invalid event is canceled.
|
|
274
|
-
*
|
|
275
|
-
* Use `setCustomValidity()` to customize the `validationMessage`.
|
|
276
|
-
*
|
|
277
|
-
* This method can also be used to re-announce error messages to screen
|
|
278
|
-
* readers.
|
|
279
|
-
*
|
|
280
|
-
* @return true if the select is valid, or false if not.
|
|
281
|
-
*/
|
|
282
|
-
reportValidity() {
|
|
283
|
-
let invalidEvent;
|
|
284
|
-
this.addEventListener('invalid', event => {
|
|
285
|
-
invalidEvent = event;
|
|
286
|
-
}, { once: true });
|
|
287
|
-
const valid = this.checkValidity();
|
|
204
|
+
[(_a = VALUE, onReportValidity)](invalidEvent) {
|
|
288
205
|
if (invalidEvent?.defaultPrevented) {
|
|
289
|
-
return
|
|
206
|
+
return;
|
|
290
207
|
}
|
|
208
|
+
invalidEvent?.preventDefault();
|
|
291
209
|
const prevMessage = this.getErrorText();
|
|
292
|
-
this.nativeError =
|
|
210
|
+
this.nativeError = !!invalidEvent;
|
|
293
211
|
this.nativeErrorText = this.validationMessage;
|
|
294
212
|
if (prevMessage === this.getErrorText()) {
|
|
295
213
|
this.field?.reannounceError();
|
|
296
214
|
}
|
|
297
|
-
return valid;
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Sets the select's native validation error message. This is used to
|
|
301
|
-
* customize `validationMessage`.
|
|
302
|
-
*
|
|
303
|
-
* When the error is not an empty string, the select is considered invalid
|
|
304
|
-
* and `validity.customError` will be true.
|
|
305
|
-
*
|
|
306
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/setCustomValidity
|
|
307
|
-
*
|
|
308
|
-
* @param error The error message to display.
|
|
309
|
-
*/
|
|
310
|
-
setCustomValidity(error) {
|
|
311
|
-
this.customValidationMessage = error;
|
|
312
|
-
this.syncValidity();
|
|
313
215
|
}
|
|
314
216
|
update(changed) {
|
|
315
217
|
// In SSR the options will be ready to query, so try to figure out what
|
|
@@ -322,18 +224,12 @@ export class Select extends LitElement {
|
|
|
322
224
|
render() {
|
|
323
225
|
return html `
|
|
324
226
|
<span
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
${this.renderField()}
|
|
328
|
-
${this.renderMenu()}
|
|
227
|
+
class="select ${classMap(this.getRenderClasses())}"
|
|
228
|
+
@focusout=${this.handleFocusout}>
|
|
229
|
+
${this.renderField()} ${this.renderMenu()}
|
|
329
230
|
</span>
|
|
330
231
|
`;
|
|
331
232
|
}
|
|
332
|
-
updated(changed) {
|
|
333
|
-
if (changed.has('required')) {
|
|
334
|
-
this.syncValidity();
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
233
|
async firstUpdated(changed) {
|
|
338
234
|
await this.menu?.updateComplete;
|
|
339
235
|
// If this has been handled on update already due to SSR, try again.
|
|
@@ -342,7 +238,8 @@ export class Select extends LitElement {
|
|
|
342
238
|
}
|
|
343
239
|
// Case for when the DOM is streaming, there are no children, and a child
|
|
344
240
|
// has [selected] set on it, we need to wait for DOM to render something.
|
|
345
|
-
if (!this.lastSelectedOptionRecords.length &&
|
|
241
|
+
if (!this.lastSelectedOptionRecords.length &&
|
|
242
|
+
!isServer &&
|
|
346
243
|
!this.options.length) {
|
|
347
244
|
setTimeout(() => {
|
|
348
245
|
this.updateValueAndDisplayText();
|
|
@@ -399,21 +296,29 @@ export class Select extends LitElement {
|
|
|
399
296
|
renderLeadingIcon() {
|
|
400
297
|
return html `
|
|
401
298
|
<span class="icon leading" slot="start">
|
|
402
|
-
|
|
299
|
+
<slot name="leading-icon" @slotchange=${this.handleIconChange}></slot>
|
|
403
300
|
</span>
|
|
404
|
-
|
|
301
|
+
`;
|
|
405
302
|
}
|
|
406
303
|
renderTrailingIcon() {
|
|
407
304
|
return html `
|
|
408
305
|
<span class="icon trailing" slot="end">
|
|
409
306
|
<slot name="trailing-icon" @slotchange=${this.handleIconChange}>
|
|
410
307
|
<svg height="5" viewBox="7 10 10 5" focusable="false">
|
|
411
|
-
<polygon
|
|
412
|
-
|
|
308
|
+
<polygon
|
|
309
|
+
class="down"
|
|
310
|
+
stroke="none"
|
|
311
|
+
fill-rule="evenodd"
|
|
312
|
+
points="7 10 12 15 17 10"></polygon>
|
|
313
|
+
<polygon
|
|
314
|
+
class="up"
|
|
315
|
+
stroke="none"
|
|
316
|
+
fill-rule="evenodd"
|
|
317
|
+
points="7 15 12 10 17 15"></polygon>
|
|
413
318
|
</svg>
|
|
414
319
|
</slot>
|
|
415
320
|
</span>
|
|
416
|
-
|
|
321
|
+
`;
|
|
417
322
|
}
|
|
418
323
|
renderLabel() {
|
|
419
324
|
// need to render so that line-height can apply and give it a
|
|
@@ -422,30 +327,29 @@ export class Select extends LitElement {
|
|
|
422
327
|
}
|
|
423
328
|
renderMenu() {
|
|
424
329
|
const ariaLabel = this.label || this.ariaLabel;
|
|
425
|
-
return html `
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
</md-menu>`;
|
|
330
|
+
return html ` <md-menu
|
|
331
|
+
id="listbox"
|
|
332
|
+
default-focus="none"
|
|
333
|
+
role="listbox"
|
|
334
|
+
tabindex="-1"
|
|
335
|
+
aria-label=${ariaLabel || nothing}
|
|
336
|
+
stay-open-on-focusout
|
|
337
|
+
part="menu"
|
|
338
|
+
exportparts="focus-ring: menu-focus-ring"
|
|
339
|
+
anchor="field"
|
|
340
|
+
.open=${this.open}
|
|
341
|
+
.quick=${this.quick}
|
|
342
|
+
.positioning=${this.menuPositioning}
|
|
343
|
+
.typeaheadDelay=${this.typeaheadDelay}
|
|
344
|
+
@opening=${this.handleOpening}
|
|
345
|
+
@opened=${this.redispatchEvent}
|
|
346
|
+
@closing=${this.redispatchEvent}
|
|
347
|
+
@closed=${this.handleClosed}
|
|
348
|
+
@close-menu=${this.handleCloseMenu}
|
|
349
|
+
@request-selection=${this.handleRequestSelection}
|
|
350
|
+
@request-deselection=${this.handleRequestDeselection}>
|
|
351
|
+
${this.renderMenuContent()}
|
|
352
|
+
</md-menu>`;
|
|
449
353
|
}
|
|
450
354
|
renderMenuContent() {
|
|
451
355
|
return html `<slot></slot>`;
|
|
@@ -459,7 +363,8 @@ export class Select extends LitElement {
|
|
|
459
363
|
return;
|
|
460
364
|
}
|
|
461
365
|
const typeaheadController = this.menu.typeaheadController;
|
|
462
|
-
const isOpenKey = event.code === 'Space' ||
|
|
366
|
+
const isOpenKey = event.code === 'Space' ||
|
|
367
|
+
event.code === 'ArrowDown' ||
|
|
463
368
|
event.code === 'Enter';
|
|
464
369
|
// Do not open if currently typing ahead because the user may be typing the
|
|
465
370
|
// spacebar to match a word with a space
|
|
@@ -549,8 +454,6 @@ export class Select extends LitElement {
|
|
|
549
454
|
this[VALUE] = '';
|
|
550
455
|
this.displayText = '';
|
|
551
456
|
}
|
|
552
|
-
this.internals.setFormValue(this.value);
|
|
553
|
-
this.syncValidity();
|
|
554
457
|
return hasSelectedOptionChanged;
|
|
555
458
|
}
|
|
556
459
|
/**
|
|
@@ -679,43 +582,31 @@ export class Select extends LitElement {
|
|
|
679
582
|
getErrorText() {
|
|
680
583
|
return this.error ? this.errorText : this.nativeErrorText;
|
|
681
584
|
}
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
const customError = !!this.customValidationMessage;
|
|
685
|
-
const validationMessage = this.customValidationMessage ||
|
|
686
|
-
valueMissing && this.getRequiredValidationMessage() || '';
|
|
687
|
-
this.internals.setValidity({ valueMissing, customError }, validationMessage);
|
|
688
|
-
}
|
|
689
|
-
// Returns the platform `<select>` validation message for i18n.
|
|
690
|
-
getRequiredValidationMessage() {
|
|
691
|
-
const select = document.createElement('select');
|
|
692
|
-
select.required = true;
|
|
693
|
-
return select.validationMessage;
|
|
585
|
+
[getFormValue]() {
|
|
586
|
+
return this.value;
|
|
694
587
|
}
|
|
695
|
-
/** @private */
|
|
696
588
|
formResetCallback() {
|
|
697
589
|
this.reset();
|
|
698
590
|
}
|
|
699
|
-
/** @private */
|
|
700
591
|
formStateRestoreCallback(state) {
|
|
701
592
|
this.value = state;
|
|
702
593
|
}
|
|
594
|
+
[createValidator]() {
|
|
595
|
+
return new SelectValidator(() => this);
|
|
596
|
+
}
|
|
597
|
+
[getValidityAnchor]() {
|
|
598
|
+
return this.field;
|
|
599
|
+
}
|
|
703
600
|
}
|
|
704
|
-
_a = VALUE;
|
|
705
601
|
(() => {
|
|
706
602
|
requestUpdateOnAriaChange(Select);
|
|
707
603
|
})();
|
|
708
|
-
/** @nocollapse */
|
|
709
|
-
Select.formAssociated = true;
|
|
710
604
|
__decorate([
|
|
711
605
|
property({ type: Boolean })
|
|
712
606
|
], Select.prototype, "quick", void 0);
|
|
713
607
|
__decorate([
|
|
714
608
|
property({ type: Boolean })
|
|
715
609
|
], Select.prototype, "required", void 0);
|
|
716
|
-
__decorate([
|
|
717
|
-
property({ type: Boolean, reflect: true })
|
|
718
|
-
], Select.prototype, "disabled", void 0);
|
|
719
610
|
__decorate([
|
|
720
611
|
property({ type: String, attribute: 'error-text' })
|
|
721
612
|
], Select.prototype, "errorText", void 0);
|