@luzmo/lucero 1.0.1-alpha.18 → 1.0.1-alpha.19
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/components/NumberFormatter-DewVDY5w.cjs +18 -0
- package/components/NumberFormatter-DgOUVrge.js +136 -0
- package/components/NumberParser-Dik4a0h-.cjs +18 -0
- package/components/NumberParser-ci9J5EKv.js +173 -0
- package/components/accordion/index.cjs +6 -183
- package/components/accordion/index.js +88 -136
- package/components/action-bar/index.cjs +4 -85
- package/components/action-bar/index.js +50 -72
- package/components/action-button/index.cjs +3 -205
- package/components/action-button/index.js +93 -167
- package/components/action-group/index.cjs +1 -7
- package/components/action-group/index.js +8 -12
- package/components/action-group-C54IxNZk.cjs +20 -0
- package/components/action-group-C9dsPJg-.js +258 -0
- package/components/action-menu/index.cjs +11 -91
- package/components/action-menu/index.js +47 -66
- package/components/async-directive-BwIAw5tB.js +82 -0
- package/components/async-directive-DLz6JB0v.cjs +22 -0
- package/components/avatar/index.cjs +3 -63
- package/components/avatar/index.js +42 -54
- package/components/{focusable-selectors-D0t_5P7C.cjs → base-BjTwmyRF.cjs} +5 -16
- package/components/base-CFWO09N1.js +684 -0
- package/components/base-Cy0MQrPT.cjs +40 -0
- package/components/base-D76d76ww.js +26 -0
- package/components/button/index.cjs +2 -134
- package/components/button/index.js +72 -106
- package/components/button-base-B8bWcklV.js +144 -0
- package/components/button-base-tf95Lyl4.cjs +25 -0
- package/components/button-group/index.cjs +1 -45
- package/components/button-group/index.js +25 -37
- package/components/calendar/index.cjs +1 -632
- package/components/calendar/index.js +7 -637
- package/components/checkbox/index.cjs +4 -111
- package/components/checkbox/index.js +53 -98
- package/components/checkbox-mixin-BOTvuPEu.js +70 -0
- package/components/checkbox-mixin-BVPpXtsq.cjs +27 -0
- package/components/class-map-CGfNk3Ee.js +51 -0
- package/components/class-map-D-Y-hsN5.cjs +22 -0
- package/components/clear-button-CuPbWwZY.cjs +18 -0
- package/components/clear-button-DzZ5ulBW.js +53 -0
- package/components/close-button-BTo4yrFR.cjs +18 -0
- package/components/close-button-CuQdsez5.js +51 -0
- package/components/color-area/index.cjs +13 -440
- package/components/color-area/index.js +187 -322
- package/components/color-controller-B0uX6Zso.js +3230 -0
- package/components/color-controller-CoUL5f9K.cjs +18 -0
- package/components/color-field/index.cjs +2 -95
- package/components/color-field/index.js +41 -77
- package/components/color-handle/index.cjs +3 -64
- package/components/color-handle/index.js +37 -58
- package/components/color-loupe/index.cjs +1 -7
- package/components/color-loupe/index.js +8 -12
- package/components/color-loupe-CrM2DVY3.cjs +56 -0
- package/components/color-loupe-DmQe3SpP.js +81 -0
- package/components/color-menu/index.cjs +12 -217
- package/components/color-menu/index.js +93 -187
- package/components/color-palette/index.cjs +1 -89
- package/components/color-palette/index.js +51 -78
- package/components/color-palette-group/index.cjs +3 -259
- package/components/color-palette-group/index.js +105 -193
- package/components/color-picker/index.cjs +6 -114
- package/components/color-picker/index.js +72 -92
- package/components/color-slider/index.cjs +1 -585
- package/components/color-slider/index.js +7 -590
- package/components/condition-attribute-with-id-DrQYZzFS.cjs +18 -0
- package/components/condition-attribute-with-id-Dv4lSRbe.js +31 -0
- package/components/date-time-picker/index.cjs +31 -1357
- package/components/date-time-picker/index.js +637 -951
- package/components/{dependency-manger-XHpQjFgK.js → dependency-manger-CO-VPlqq.js} +14 -24
- package/components/dependency-manger-uthev62E.cjs +18 -0
- package/components/directive-C7oCP5Bh.cjs +22 -0
- package/components/directive-helpers-D4KMv2dC.js +62 -0
- package/components/directive-helpers-t-TVum7J.cjs +22 -0
- package/components/{slottable-request-event-CANixJnR.cjs → directive-oAbCiebi.js} +25 -14
- package/components/divider/index.cjs +1 -54
- package/components/divider/index.js +30 -49
- package/components/divider.module-DDvBo9zo.cjs +18 -0
- package/components/divider.module-DoQWQEIJ.js +21 -0
- package/components/element-resolution-BvRLGqIU.cjs +18 -0
- package/components/element-resolution-FCUT-wql.js +91 -0
- package/components/field-group/index.cjs +1 -7
- package/components/field-group/index.js +8 -12
- package/components/field-group-5WQMBOk4.cjs +23 -0
- package/components/field-group-D4B0IOdA.js +66 -0
- package/components/field-label/index.cjs +1 -7
- package/components/field-label/index.js +8 -12
- package/components/field-label-DxmPiC5p.js +106 -0
- package/components/field-label-Dz9kisdW.cjs +25 -0
- package/components/flow-D-0MTYCm.js +527 -0
- package/components/flow-DM3dNAKs.cjs +30 -0
- package/components/focus-group-DHeTq18L.js +218 -0
- package/components/focus-group-DnxZUBhQ.cjs +18 -0
- package/components/focus-visible-BvScGDCE.js +74 -0
- package/components/focus-visible-D4BXb5RB.cjs +18 -0
- package/components/focusable-B_KwfEec.cjs +18 -0
- package/components/focusable-C5JjRZmT.js +153 -0
- package/components/{focusable-selectors-IltOAOd9.js → focusable-selectors-B4YgbghQ.js} +4 -7
- package/components/focusable-selectors-BgFlyFcY.cjs +18 -0
- package/components/icon/index.cjs +1 -90
- package/components/icon/index.js +46 -74
- package/components/if-defined-DULpqYwi.js +27 -0
- package/components/if-defined-DaXWqfzc.cjs +22 -0
- package/components/index-CNK8wHXu.cjs +57 -0
- package/components/index-Cf6G4q52.js +1490 -0
- package/components/index-D3ICqC7S.js +1174 -0
- package/components/index-hqVbNKYy.cjs +113 -0
- package/components/index.cjs +1 -174
- package/components/index.js +172 -174
- package/components/infield-button/index.cjs +2 -46
- package/components/infield-button/index.js +30 -41
- package/components/label/index.cjs +1 -37
- package/components/label/index.js +24 -36
- package/components/{language-resolution-BSGJAWiQ.js → language-resolution-B-wjV5bb.js} +17 -21
- package/components/language-resolution-EUER43cg.cjs +18 -0
- package/components/like-anchor-Bu3pXbjT.cjs +32 -0
- package/components/like-anchor-DCFJN0LV.js +69 -0
- package/components/luzmo-icons-CiSek5iM.js +229 -0
- package/components/luzmo-icons-CtA-TJPd.cjs +29 -0
- package/components/manage-help-text-CHfMLzSa.js +92 -0
- package/components/manage-help-text-DNqdEkTA.cjs +30 -0
- package/components/menu/index.cjs +29 -1297
- package/components/menu/index.js +499 -954
- package/components/multi-language-field/index.cjs +2 -132
- package/components/multi-language-field/index.js +88 -118
- package/components/mutation-controller-DH7YOCyj.js +52 -0
- package/components/mutation-controller-DkOMCW-c.cjs +22 -0
- package/components/number-field/index.cjs +10 -613
- package/components/number-field/index.js +243 -442
- package/components/observe-slot-presence-CmVi0zTc.js +68 -0
- package/components/observe-slot-presence-bc9chhsi.cjs +18 -0
- package/components/observe-slot-text-C3moTjwy.js +87 -0
- package/components/observe-slot-text-D2VAEFSd.cjs +18 -0
- package/components/options/index.cjs +60 -693
- package/components/options/index.js +953 -519
- package/components/overlay/index.cjs +21 -367
- package/components/overlay/index.js +189 -273
- package/components/overlay-B3ajDLLq.cjs +47 -0
- package/components/overlay-CUKs69yr.js +2745 -0
- package/components/{pending-state-CXbe-Xul.js → pending-state-B2wWssTo.js} +13 -28
- package/components/pending-state-bJr-nEJl.cjs +26 -0
- package/components/picker/index.cjs +1 -9
- package/components/picker/index.js +11 -15
- package/components/picker-C0LvseZe.cjs +123 -0
- package/components/picker-W1qNmtsh.js +461 -0
- package/components/picker-button/index.cjs +4 -56
- package/components/picker-button/index.js +34 -45
- package/components/{condition-attribute-with-id-Cn815e9W.js → platform-BM-uMWpX.js} +49 -24
- package/components/platform-BiXhwqk3.cjs +18 -0
- package/components/popover/index.cjs +1 -7
- package/components/popover/index.js +8 -12
- package/components/popover-fwJeZHMQ.cjs +30 -0
- package/components/popover-iD8f5Jkp.js +67 -0
- package/components/progress-circle/index.cjs +1 -7
- package/components/progress-circle/index.js +8 -12
- package/components/progress-circle-DZxaMe8L.cjs +33 -0
- package/components/progress-circle-USIIU1up.js +97 -0
- package/components/query-BL-TJj7K.cjs +22 -0
- package/components/query-D_KR_GUc.js +51 -0
- package/components/query-assigned-elements-DjfhL1cl.js +36 -0
- package/components/query-assigned-elements-DsKsfk7G.cjs +22 -0
- package/components/query-assigned-nodes-BcKWmGzy.cjs +22 -0
- package/components/query-assigned-nodes-C76XVPWY.js +36 -0
- package/components/radio/index.cjs +2 -244
- package/components/radio/index.js +110 -192
- package/components/{random-id-BEc6QIUL.js → random-id-ByCz1xaq.js} +3 -3
- package/components/random-id-CqvckpWe.cjs +18 -0
- package/components/roving-tabindex-By_fCy_e.cjs +18 -0
- package/components/roving-tabindex-DOg4z6ZU.js +66 -0
- package/components/search/index.cjs +8 -115
- package/components/search/index.js +66 -96
- package/components/select/index.cjs +51 -720
- package/components/select/index.js +347 -563
- package/components/sized-mixin-CJbBHWRQ.js +63 -0
- package/components/sized-mixin-WPHH0a_D.cjs +18 -0
- package/components/slider/index.cjs +1 -119
- package/components/slider/index.js +1113 -100
- package/components/slottable-request-event-BfUUt1Mh.cjs +18 -0
- package/components/{slottable-request-event-D9WzrdWv.js → slottable-request-event-DggLA4Rx.js} +9 -12
- package/components/state-DwIwYPvt.js +29 -0
- package/components/state-vf0PJN3_.cjs +22 -0
- package/components/strategies-C6HsQpU2.cjs +18 -0
- package/components/strategies-CUMLHtQI.js +195 -0
- package/components/streaming-listener-BQ68fKMa.js +91 -0
- package/components/streaming-listener-DeGQYM-9.cjs +18 -0
- package/components/style-map-Bnhf_mVZ.js +53 -0
- package/components/style-map-DuMd5xlY.cjs +22 -0
- package/components/swatch/index.cjs +7 -436
- package/components/swatch/index.js +205 -350
- package/components/switch/index.cjs +2 -61
- package/components/switch/index.js +34 -51
- package/components/tabs/index.cjs +26 -693
- package/components/tabs/index.js +388 -521
- package/components/tags/index.cjs +4 -201
- package/components/tags/index.js +87 -152
- package/components/text-field/index.cjs +3 -49
- package/components/text-field/index.js +30 -44
- package/components/text-field-BkFPYo7S.cjs +85 -0
- package/components/text-field-C2n3rzCK.js +314 -0
- package/components/text-field.module-C2KVUJcX.js +21 -0
- package/components/text-field.module-DXhFA9G-.cjs +18 -0
- package/components/toast/index.cjs +12 -177
- package/components/toast/index.js +73 -145
- package/components/tooltip/index.cjs +6 -250
- package/components/tooltip/index.js +124 -177
- package/components/unit-input/index.cjs +8 -232
- package/components/unit-input/index.js +108 -201
- package/components/utils.cjs +1 -25
- package/components/utils.js +22 -22
- package/components/{random-id-BE6HA503.cjs → when-CDK1Tt5Y.js} +10 -7
- package/components/when-CDZyJPvd.cjs +22 -0
- package/package.json +1 -1
- package/components/action-group-DHp8RHDf.js +0 -392
- package/components/action-group-MPf19RPV.cjs +0 -391
- package/components/base-COw9n7UR.cjs +0 -119
- package/components/base-DmeVy0cq.js +0 -120
- package/components/button-base-7Ak55xFd.cjs +0 -206
- package/components/button-base-C3kf6BTK.js +0 -207
- package/components/checkbox-mixin-8cL-vfDy.js +0 -84
- package/components/checkbox-mixin-CE7dJj3J.cjs +0 -83
- package/components/clear-button-Co6oKSgl.js +0 -59
- package/components/clear-button-X_HDY2eH.cjs +0 -58
- package/components/close-button-DPBK6Kpu.cjs +0 -59
- package/components/close-button-Miw9ZjoJ.js +0 -60
- package/components/color-controller-BjDZaxhX.js +0 -491
- package/components/color-controller-C3c_vb2P.cjs +0 -490
- package/components/color-loupe-BQqNR8YD.cjs +0 -88
- package/components/color-loupe-B_DDFv8l.js +0 -89
- package/components/condition-attribute-with-id-DEc2Yjne.cjs +0 -43
- package/components/dependency-manger-CcIE1uvQ.cjs +0 -63
- package/components/divider.module-Cm5LcDRV.cjs +0 -20
- package/components/divider.module-DauH6k2_.js +0 -21
- package/components/element-resolution-DCsrhGZO.cjs +0 -112
- package/components/element-resolution-nMlmW4Jy.js +0 -113
- package/components/field-group-DNmY8W9v.cjs +0 -86
- package/components/field-group-DVdAWCQF.js +0 -87
- package/components/field-label-CKH9EXpR.cjs +0 -156
- package/components/field-label-Dpsecoc6.js +0 -157
- package/components/focus-group-BqDAk9Is.js +0 -337
- package/components/focus-group-DFzOlalL.cjs +0 -336
- package/components/focus-visible-B-B8-P9R.cjs +0 -104
- package/components/focus-visible-BUPRWlsh.js +0 -105
- package/components/focusable-BPrTcZPd.cjs +0 -262
- package/components/focusable-ChCLg1k4.js +0 -263
- package/components/language-resolution-iN9EImbb.cjs +0 -57
- package/components/like-anchor-D62faRNG.cjs +0 -79
- package/components/like-anchor-v3cJ9RWM.js +0 -80
- package/components/manage-help-text-BYx84zZR.cjs +0 -125
- package/components/manage-help-text-DOuMTGht.js +0 -126
- package/components/observe-slot-presence-9AwLGUQ_.cjs +0 -78
- package/components/observe-slot-presence-DcMdoumP.js +0 -79
- package/components/observe-slot-text-CSofZeeF.cjs +0 -104
- package/components/observe-slot-text-CjnkkBPn.js +0 -105
- package/components/overlay-CN8ISP1F.js +0 -2485
- package/components/overlay-LViy9VWM.cjs +0 -2484
- package/components/pending-state-e4RbXe9u.cjs +0 -75
- package/components/picker-DNde3awt.cjs +0 -672
- package/components/picker-PfUAF05y.js +0 -673
- package/components/platform-CxDar3Dn.cjs +0 -68
- package/components/platform-Cxn0WbyT.js +0 -69
- package/components/popover-BkbYhl3i.js +0 -74
- package/components/popover-BkgUf0kL.cjs +0 -74
- package/components/progress-circle-Hu_ivPHf.js +0 -133
- package/components/progress-circle-_Etqsj9f.cjs +0 -132
- package/components/roving-tabindex-AsmAh2In.cjs +0 -95
- package/components/roving-tabindex-DPF9NmrH.js +0 -96
- package/components/sized-mixin-DmkrNdWB.js +0 -80
- package/components/sized-mixin-UaTVa-AE.cjs +0 -79
- package/components/strategies-DlMlaSJR.cjs +0 -317
- package/components/strategies-DlPQoTFE.js +0 -318
- package/components/streaming-listener-D4sHaMub.cjs +0 -145
- package/components/streaming-listener-cAz5zJyk.js +0 -146
- package/components/text-field-11tcnftU.cjs +0 -338
- package/components/text-field-Chi9J2Cz.js +0 -339
- package/components/text-field.module-CMBS0jSL.js +0 -21
- package/components/text-field.module-DIJdV_sA.cjs +0 -20
|
@@ -1,672 +0,0 @@
|
|
|
1
|
-
/*! * Lucero - The design system for Luzmo.
|
|
2
|
-
*
|
|
3
|
-
* Copyright © 2025 Luzmo
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
|
|
6
|
-
* This license allows users with a current active Luzmo account to use Lucero.
|
|
7
|
-
* This license terminates automatically if a user no longer has an active Luzmo account.
|
|
8
|
-
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
|
9
|
-
*
|
|
10
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
12
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
13
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
14
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
|
-
* SOFTWARE.
|
|
17
|
-
* */
|
|
18
|
-
"use strict";
|
|
19
|
-
const lit = require("lit");
|
|
20
|
-
const decorators_js = require("lit/decorators.js");
|
|
21
|
-
const classMap_js = require("lit/directives/class-map.js");
|
|
22
|
-
const ifDefined_js = require("lit/directives/if-defined.js");
|
|
23
|
-
const styleMap_js = require("lit/directives/style-map.js");
|
|
24
|
-
const focusable = require("./focusable-BPrTcZPd.cjs");
|
|
25
|
-
const dependencyManger = require("./dependency-manger-CcIE1uvQ.cjs");
|
|
26
|
-
const strategies = require("./strategies-DlMlaSJR.cjs");
|
|
27
|
-
const pendingState = require("./pending-state-e4RbXe9u.cjs");
|
|
28
|
-
const sizedMixin = require("./sized-mixin-UaTVa-AE.cjs");
|
|
29
|
-
const icons = require("@luzmo/icons");
|
|
30
|
-
require("./menu/index.cjs");
|
|
31
|
-
require("./overlay/index.cjs");
|
|
32
|
-
require("./progress-circle/index.cjs");
|
|
33
|
-
require("./tooltip/index.cjs");
|
|
34
|
-
const pickerStyles = '#button{cursor:pointer;-webkit-user-select:none;user-select:none;font-family:var(--luzmo-button-font-family, var(--luzmo-font-family));-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:var(--luzmo-button-line-height, var(--luzmo-line-height, 1.3));text-transform:none;vertical-align:top;-webkit-appearance:button;transition:background var(--luzmo-button-animation-duration, var(--luzmo-animation-duration)) ease-out,border-color var(--luzmo-button-animation-duration, var(--luzmo-animation-duration)) ease-out,color var(--luzmo-button-animation-duration, var(--luzmo-animation-duration)) ease-out,box-shadow var(--luzmo-button-animation-duration, var(--luzmo-animation-duration)) ease-out;justify-content:center;align-items:center;margin:0;-webkit-text-decoration:none;text-decoration:none;display:inline-flex;position:relative;overflow:visible}#button::-moz-focus-inner{border-style:none;padding:0}#button:focus{outline:none}#icon{margin-inline-end:var(--luzmo-picker-spacing-text-to-icon, var(--picker-spacing-text-to-icon));font-size:var(--luzmo-picker-font-size, var(--picker-font-size))}@media (forced-colors: active){:host{--highcontrast-picker-focus-indicator-color: Highlight;--highcontrast-picker-border-color-default: ButtonBorder;--highcontrast-picker-border-color-hover: Highlight;--highcontrast-picker-border-color-disabled: GrayText;--highcontrast-picker-content-color-default: ButtonText;--highcontrast-picker-content-color-disabled: GrayText;--highcontrast-picker-background-color: ButtonFace}#button:focus-visible{--highcontrast-picker-border-color-hover: ButtonText}#button .label,#button:after{forced-color-adjust:none}}#button{box-sizing:border-box;max-inline-size:100%;min-inline-size:calc(var(--picker-minimum-width-multiplier) * var(--luzmo-picker-block-size, var(--picker-block-size)));block-size:var(--luzmo-picker-block-size, var(--picker-block-size));border-width:var(--luzmo-picker-border-width, var(--picker-border-width));border-radius:var(--luzmo-picker-border-radius, var(--picker-border-radius));box-shadow:var(--luzmo-picker-box-shadow, var(--picker-box-shadow));transition:background-color var(--luzmo-picker-animation-duration, var(--picker-animation-duration)),box-shadow var(--luzmo-picker-animation-duration, var(--picker-animation-duration)),border-color var(--luzmo-picker-animation-duration, var(--picker-animation-duration)) ease-in-out;color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-default, var(--picker-font-color-default)));background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-default, var(--picker-background-color-default)));border-style:solid;border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-color-default, var(--picker-border-color-default)));margin-block-start:var(--luzmo-picker-spacing-label-to-picker, var(--picker-spacing-label-to-picker));padding-block:0;padding-inline-start:var(--luzmo-picker-spacing-edge-to-text, var(--picker-spacing-edge-to-text));padding-inline-end:var(--luzmo-picker-spacing-edge-to-disclosure-icon, var(--picker-spacing-edge-to-disclosure-icon));display:flex}#button:after{pointer-events:none;content:"";block-size:calc(100% + var(--luzmo-picker-focus-indicator-gap, var(--picker-focus-indicator-gap)) * 2 + var(--luzmo-picker-border-width, var(--picker-border-width)) * 2);inline-size:calc(100% + var(--luzmo-picker-focus-indicator-gap, var(--picker-focus-indicator-gap)) * 2 + var(--luzmo-picker-border-width, var(--picker-border-width)) * 2);border-style:solid;border-width:var(--luzmo-picker-focus-indicator-width, var(--picker-focus-indicator-width));border-radius:calc(var(--luzmo-picker-border-radius, var(--picker-border-radius)) + var(--luzmo-picker-focus-indicator-gap, var(--picker-focus-indicator-gap)) + var(--luzmo-picker-border-width, var(--picker-border-width)));border-color:#0000;margin-block-start:calc((var(--luzmo-picker-focus-indicator-gap, var(--picker-focus-indicator-gap)) + var(--luzmo-picker-focus-indicator-width, var(--picker-focus-indicator-width)) + var(--luzmo-picker-border-width, var(--picker-border-width))) * -1);margin-inline-start:calc((var(--luzmo-picker-focus-indicator-gap, var(--picker-focus-indicator-gap)) + var(--luzmo-picker-focus-indicator-width, var(--picker-focus-indicator-width)) + var(--luzmo-picker-border-width, var(--picker-border-width))) * -1);position:absolute;inset-block:0;inset-inline:0}#button:active{background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-active, var(--picker-background-color-active)));border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-active, var(--picker-border-color-active)))}#button:active:after{border-color:#0000}#button.placeholder:active .label{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-active, var(--picker-font-color-active)))}#button:focus-visible{background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-key-focus, var(--picker-background-color-key-focus)));border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-color-key-focus, var(--picker-border-color-key-focus)));color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-key-focus, var(--picker-font-color-key-focus)));outline:none}#button:focus-visible:after{border-color:var(--highcontrast-picker-focus-indicator-color, var(--luzmo-picker-focus-indicator-color, var(--picker-focus-indicator-color)))}#button.placeholder:focus-visible{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-key-focus, var(--picker-font-color-key-focus)))}#button:focus-visible .disclosure-icon{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-icon-color-key-focus, var(--picker-icon-color-key-focus)))}:host([open]) #button:not(:disabled,.is-disabled){color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-default-open, var(--picker-font-color-default-open)));background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-default-open, var(--picker-background-color-default-open)));border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-default-open, var(--picker-border-color-default-open)))}:host([open]) #button:not(:disabled,.is-disabled) .disclosure-icon{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-icon-color-default-open, var(--picker-icon-color-default-open)))}:host([invalid]) #button:not(:disabled,.is-disabled){border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-color-error-default, var(--picker-border-color-error-default)))}:host([invalid]) #button:not(:disabled,.is-disabled) .validation-icon{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-icon-color-error, var(--picker-icon-color-error)))}:host([invalid]) #button:not(:disabled,.is-disabled):active{border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-color-error-active, var(--picker-border-color-error-active)))}:host([invalid][open]) #button:not(:disabled,.is-disabled){border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-color-error-default-open, var(--picker-border-color-error-default-open)))}:host([invalid]) #button:not(:disabled,.is-disabled):focus-visible{border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-color-error-key-focus, var(--picker-border-color-error-key-focus)))}:host([pending]) #button .disclosure-icon{color:var(--highcontrast-picker-content-color-disabled, var(--luzmo-picker-icon-color-disabled, var(--picker-icon-color-disabled)))}.icon{flex-shrink:0}.label{white-space:nowrap;font-size:var(--luzmo-picker-font-size, var(--picker-font-size));line-height:var(--luzmo-picker-line-height, var(--picker-line-height));font-weight:var(--luzmo-picker-font-weight, var(--picker-font-weight));text-overflow:ellipsis;text-align:start;flex:auto;overflow:hidden}.label.placeholder{font-weight:var(--luzmo-picker-placeholder-font-weight, var(--picker-font-weight));font-style:var(--luzmo-picker-placeholder-font-style, var(--picker-placeholder-font-style));transition:color var(--luzmo-picker-animation-duration, var(--picker-animation-duration)) ease-in-out;color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-default, var(--picker-font-color-default)))}.label.placeholder:active{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-active, var(--picker-font-color-active)))}.disclosure-icon{vertical-align:top;transition:color var(--luzmo-picker-animation-duration, var(--picker-animation-duration)) ease-out;margin-inline-start:var(--luzmo-picker-spacing-icon-to-disclosure-icon, var(--picker-spacing-icon-to-disclosure-icon));color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-icon-color-default, var(--picker-icon-color-default)));flex-shrink:0;display:inline-block;position:relative}.disclosure-icon:active{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-icon-color-active, var(--picker-icon-color-active)))}luzmo-progress-circle,.validation-icon{margin-inline-start:var(--luzmo-picker-spacing-text-to-icon, var(--picker-spacing-text-to-icon))}.icon-container{display:flex;position:relative;height:100%;align-items:center;font-size:var(--luzmo-picker-disclosure-icon-size, var(--picker-disclosure-icon-size))}.icon-container.disclosure-icon{margin-inline-end:0}.label~.disclosure-icon{margin-inline-start:var(--luzmo-picker-spacing-text-to-icon, var(--picker-spacing-text-to-icon))}:host([quiet]) #button{inline-size:auto;min-inline-size:0;padding-inline:var(--luzmo-picker-spacing-edge-to-text-quiet, var(--picker-spacing-edge-to-text-quiet));color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-default, var(--picker-font-color-default)));background-color:initial;background-color:var(--highcontrast-picker-background-color, transparent);border:none;border-radius:0;box-shadow:none;margin-block-start:calc(var(--luzmo-picker-spacing-label-to-picker-quiet, var(--picker-spacing-label-to-picker-quiet)) + 1px)}:host([quiet]) #button.label-inline{margin-block-start:0}:host([quiet]) #button .disclosure-icon{margin-inline-end:var(--luzmo-picker-spacing-edge-to-disclosure-icon-quiet, var(--picker-spacing-edge-to-disclosure-icon-quiet))}:host([quiet]) #button:after{block-size:auto;inline-size:auto;border:none}@media (hover: hover){#button:hover{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-hover, var(--picker-font-color-hover)));background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-hover, var(--picker-background-color-hover)));border-color:var(--highcontrast-picker-border-color-hover, var(--luzmo-picker-border-color-hover, var(--picker-border-color-hover)))}#button:hover .disclosure-icon{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-icon-color-hover, var(--picker-icon-color-hover)))}:host([open]):not([quiet]) #button:not(:disabled,.is-disabled):hover{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-hover-open, var(--picker-font-color-hover-open)));background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-hover-open, var(--picker-background-color-hover-open)));border-color:var(--highcontrast-picker-border-color-hover, var(--luzmo-picker-border-color-hover-open, var(--picker-border-color-hover-open)))}:host([open]) #button:not(:disabled,.is-disabled):hover .disclosure-icon{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-icon-color-hover-open, var(--picker-icon-color-hover-open)))}:host([invalid]) #button:not(:disabled,.is-disabled):hover{border-color:var(--highcontrast-picker-border-color-hover, var(--luzmo-picker-border-color-error-hover, var(--picker-border-color-error-hover)))}:host([invalid][open]) #button:not(:disabled,.is-disabled):hover{border-color:var(--highcontrast-picker-border-color-hover, var(--luzmo-picker-border-color-error-hover-open, var(--picker-border-color-error-hover-open)))}.label.placeholder:hover{color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-hover, var(--picker-font-color-hover)))}:host([quiet]) #button:hover{background-color:initial;background-color:var(--highcontrast-picker-background-color, transparent)!important}}:host([quiet]) #button:focus-visible{background-color:initial;background-color:var(--highcontrast-picker-background-color, transparent)}:host([quiet]) #button:focus-visible:after{box-shadow:0 var(--luzmo-picker-focus-indicator-width, var(--picker-focus-indicator-width)) 0 0 var(--highcontrast-picker-focus-indicator-color, var(--luzmo-picker-focus-indicator-color, var(--picker-focus-indicator-color)));margin:calc((var(--luzmo-picker-focus-indicator-gap, var(--picker-focus-indicator-gap)) + var(--luzmo-picker-border-width, var(--picker-border-width))) * -1) 0;border:none;border-radius:0}:host([quiet][open]) #button,:host([quiet][disabled]) #button#button,:host([quiet]) #button#button:disabled,:host([quiet]) #button:active{background-color:initial;background-color:var(--highcontrast-picker-background-color, transparent)}.label-inline{vertical-align:top;display:inline-flex}:host([disabled]) #button,#button:disabled{cursor:default;background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-disabled, var(--picker-background-color-disabled)));border-color:#0000;border-color:var(--highcontrast-picker-border-color-disabled, transparent);color:var(--highcontrast-picker-content-color-disabled, var(--luzmo-picker-font-color-disabled, var(--picker-font-color-disabled)))}:host([disabled]) #button .icon,:host([disabled]) #button .disclosure-icon,:host([disabled]) #button .validation-icon,#button:disabled .icon,#button:disabled .disclosure-icon,#button:disabled .validation-icon{color:var(--highcontrast-picker-content-color-disabled, var(--luzmo-picker-icon-color-disabled, var(--picker-icon-color-disabled)))}:host([disabled]) #button .label.placeholder,#button:disabled .label.placeholder{color:var(--highcontrast-picker-content-color-disabled, var(--luzmo-picker-font-color-disabled, var(--picker-font-color-disabled)))}:host{--picker-box-shadow: 0px 1px 3px 0px rgba(var(--luzmo-border-color-rgb), .06);--picker-background-color-default: var(--luzmo-background-color);--picker-background-color-default-open: var(--luzmo-background-color-hover);--picker-background-color-active: var(--luzmo-background-color-down);--picker-background-color-hover: var(--luzmo-background-color-hover);--picker-background-color-hover-open: var(--luzmo-background-color-down);--picker-background-color-key-focus: var(--luzmo-background-color-down);--picker-border-color-default: var(--luzmo-border-color);--picker-border-color-default-open: var(--luzmo-border-color-hover);--picker-border-color-hover: var(--luzmo-border-color);--picker-border-color-hover-open: var(--luzmo-border-color-hover);--picker-border-color-active: var(--luzmo-border-color);--picker-border-color-key-focus: var(--luzmo-border-color);--picker-border-width: var(--luzmo-border-width);--picker-font-size: var(--luzmo-font-size);--picker-font-weight: var(--luzmo-font-weight);--picker-placeholder-font-style: var(--luzmo-font-style);--picker-line-height: var(--luzmo-line-height);--picker-block-size: 32px;--picker-border-radius: var(--luzmo-border-radius);--picker-spacing-edge-to-text: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--picker-spacing-text-to-icon: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--picker-spacing-text-to-icon-inline-end: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--picker-spacing-icon-to-disclosure-icon: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--picker-spacing-edge-to-text-quiet: 0px;--picker-spacing-label-to-picker: 0px;--picker-spacing-label-to-picker-quiet: calc( -1 * var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--picker-spacing-edge-to-disclosure-icon: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--picker-spacing-edge-to-disclosure-icon-quiet: 0px;--picker-animation-duration: var(--luzmo-animation-duration);--picker-font-color-default: var(--luzmo-font-color);--picker-font-color-default-open: var(--luzmo-font-color-hover);--picker-font-color-hover: var(--luzmo-font-color-hover);--picker-font-color-hover-open: var(--luzmo-font-color-down);--picker-font-color-active: var(--luzmo-font-color-focus);--picker-font-color-key-focus: var(--luzmo-font-color-focus);--picker-icon-color-default: var(--luzmo-font-color);--picker-icon-color-default-open: var(--luzmo-font-color-hover);--picker-icon-color-hover: var(--luzmo-font-color-hover);--picker-icon-color-hover-open: var(--luzmo-font-color-hover);--picker-icon-color-active: var(--luzmo-font-color-focus);--picker-icon-color-key-focus: var(--luzmo-font-color-focus);--picker-border-color-error-default: var(--luzmo-negative-color);--picker-border-color-error-default-open: var(--luzmo-negative-color-down);--picker-border-color-error-hover: var(--luzmo-negative-color-hover);--picker-border-color-error-hover-open: var(--luzmo-negative-color-down);--picker-border-color-error-active: var(--luzmo-negative-color-down);--picker-border-color-error-key-focus: var(--luzmo-negative-color-focus);--picker-icon-color-error: var(--luzmo-negative-color);--picker-background-color-disabled: var(--luzmo-background-color-disabled);--picker-font-color-disabled: var(--luzmo-disabled-color);--picker-icon-color-disabled: var(--luzmo-disabled-color);--picker-focus-indicator-gap: var(--luzmo-indicator-gap);--picker-focus-indicator-width: var(--luzmo-indicator-width);--picker-focus-indicator-color: var(--luzmo-indicator-color);--picker-disclosure-icon-size: var(--luzmo-font-size-s)}:host([size=s]){--picker-block-size: 28px;--picker-font-size: var(--luzmo-font-size-s);--picker-border-radius: var(--luzmo-border-radius);--picker-spacing-edge-to-text: var(--luzmo-spacing-3);--picker-spacing-text-to-icon: var(--luzmo-spacing-3);--picker-spacing-text-to-icon-inline-end: var(--luzmo-spacing-3);--picker-spacing-icon-to-disclosure-icon: var(--luzmo-spacing-3);--picker-spacing-label-to-picker-quiet: calc(-1 * var(--luzmo-spacing-3));--picker-spacing-edge-to-disclosure-icon: var(--luzmo-spacing-3);--picker-disclosure-icon-size: var(--luzmo-font-size-s)}:host([size=l]){--picker-block-size: 40px;--picker-font-size: var(--luzmo-font-size-l);--picker-border-radius: var(--luzmo-border-radius);--picker-spacing-edge-to-text: var(--luzmo-spacing-4);--picker-spacing-text-to-icon: var(--luzmo-spacing-4);--picker-spacing-text-to-icon-inline-end: var(--luzmo-spacing-4);--picker-spacing-icon-to-disclosure-icon: var(--luzmo-spacing-4);--picker-spacing-label-to-picker-quiet: calc(-1 * var(--luzmo-spacing-4));--picker-spacing-edge-to-disclosure-icon: var(--luzmo-spacing-4);--picker-disclosure-icon-size: var(--luzmo-font-size)}:host([size=xl]){--picker-block-size: 48px;--picker-font-size: var(--luzmo-font-size-xl);--picker-border-radius: var(--luzmo-border-radius-l);--picker-spacing-edge-to-text: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--picker-spacing-text-to-icon: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--picker-spacing-text-to-icon-inline-end: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--picker-spacing-icon-to-disclosure-icon: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--picker-spacing-label-to-picker-quiet: calc( -1 * var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--picker-spacing-edge-to-disclosure-icon: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--picker-disclosure-icon-size: var(--luzmo-font-size-l)}:host([variant=highlight]) ::slotted(luzmo-menu-item[selected]){--menu-item-highlight-label-content-color: var(--luzmo-primary-inverse-color);--menu-item-label-icon-color-default: var(--luzmo-primary-inverse-color);--menu-checkmark-display: var(--menu-checkmark-display-hidden);padding-inline-start:var(--luzmo-menu-item-label-inline-edge-to-content, var(--menu-item-label-inline-edge-to-content));background-color:var(--luzmo-menu-item-highlight-label-background-color, var(--menu-item-highlight-label-background-color, var(--luzmo-border-color)))}:host{display:inline-flex;vertical-align:top;max-inline-size:100%;inline-size:var(--luzmo-picker-inline-size, var(--picker-inline-size));min-inline-size:calc(var(--picker-minimum-width-multiplier) * var(--luzmo-picker-block-size, var(--picker-block-size)))}:host([quiet]){width:auto;min-width:0}:host([disabled]){pointer-events:none}#button{width:100%;min-width:100%;max-width:100%}#icon:not([hidden]){display:inline-flex}:host([readonly]) #button{-webkit-user-select:inherit;user-select:inherit}.picker,.validation-icon{flex-shrink:0}luzmo-overlay{pointer-events:none}luzmo-menu{pointer-events:initial}:host>luzmo-menu{display:none}:host([focused]:not([quiet])) #button #label.placeholder{color:var(--picker-placeholder-text-color-key-focus, var(--alias-placeholder-text-color-hover))}#label.visually-hidden~.picker{margin-inline-start:auto}:host([focused]:not([quiet],[pending])) #button .picker{color:var(--picker-icon-color-key-focus, var(--alias-icon-color-focus))}.visually-hidden{border:0;clip:rect(0,0,0,0);clip-path:inset(50%);height:1px;margin:0 -1px -1px 0;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}luzmo-overlay:not(:defined){display:none}#button.remove-focus-ring-safari-hack:focus-visible{background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-default, var(--picker-background-color-default)));border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-color-default, var(--picker-border-color-default)));color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-default, var(--picker-font-color-default)))}#button.remove-focus-ring-safari-hack:after{border:none}#button.remove-focus-ring-safari-hack:focus-visible:after{box-shadow:none}#button.remove-focus-ring-safari-hack:active{background-color:var(--highcontrast-picker-background-color, var(--luzmo-picker-background-color-default, var(--picker-background-color-default)));border-color:var(--highcontrast-picker-border-color-default, var(--luzmo-picker-border-color-default, var(--picker-border-color-default)));color:var(--highcontrast-picker-content-color-default, var(--luzmo-picker-font-color-default, var(--picker-font-color-default)))}';
|
|
35
|
-
var __defProp = Object.defineProperty;
|
|
36
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
37
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
38
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
39
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
40
|
-
if (decorator = decorators[i])
|
|
41
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
42
|
-
if (kind && result) __defProp(target, key, result);
|
|
43
|
-
return result;
|
|
44
|
-
};
|
|
45
|
-
const angleIcon = () => lit.html`
|
|
46
|
-
<div class="disclosure-icon icon">
|
|
47
|
-
${icons.luzmoIcon(icons.luzmoAngleDown, { className: "indicator" })}
|
|
48
|
-
</div>
|
|
49
|
-
`;
|
|
50
|
-
const alertIcon = () => lit.html`
|
|
51
|
-
<div class="icon-container validation-icon icon">
|
|
52
|
-
${icons.luzmoIcon(icons.luzmoAlert)}
|
|
53
|
-
</div>
|
|
54
|
-
`;
|
|
55
|
-
const DESCRIPTION_ID = "option-picker";
|
|
56
|
-
class LuzmoPickerBase extends sizedMixin.SizedMixin(focusable.Focusable, {
|
|
57
|
-
noDefaultSize: true
|
|
58
|
-
}) {
|
|
59
|
-
/**
|
|
60
|
-
* Initializes the `PendingStateController` for the Picker component.
|
|
61
|
-
* The `PendingStateController` manages the pending state of the Picker.
|
|
62
|
-
*/
|
|
63
|
-
constructor() {
|
|
64
|
-
super();
|
|
65
|
-
this.disabled = false;
|
|
66
|
-
this.focused = false;
|
|
67
|
-
this.invalid = false;
|
|
68
|
-
this.pending = false;
|
|
69
|
-
this.pendingLabel = "Pending";
|
|
70
|
-
this.open = false;
|
|
71
|
-
this.readonly = false;
|
|
72
|
-
this.placement = "bottom-start";
|
|
73
|
-
this.quiet = false;
|
|
74
|
-
this.value = "";
|
|
75
|
-
this.selects = "single";
|
|
76
|
-
this.dependencyManager = new dependencyManger.DependencyManagerController(this);
|
|
77
|
-
this.isMobile = new strategies.MatchMediaController(this, strategies.IS_MOBILE);
|
|
78
|
-
this.listRole = "listbox";
|
|
79
|
-
this.itemRole = "option";
|
|
80
|
-
this.hasRenderedOverlay = false;
|
|
81
|
-
this._selfManageFocusElement = false;
|
|
82
|
-
this.deprecatedMenu = null;
|
|
83
|
-
this.selectionPromise = Promise.resolve();
|
|
84
|
-
this.willManageSelection = false;
|
|
85
|
-
this.recentlyConnected = false;
|
|
86
|
-
this.enterKeydownOn = null;
|
|
87
|
-
this.handleSlottableRequest = (_event) => {
|
|
88
|
-
};
|
|
89
|
-
this.applyFocusElementLabel = (value, labelElement) => {
|
|
90
|
-
this.appliedLabel = value;
|
|
91
|
-
this.labelAlignment = labelElement.sideAligned ? "inline" : void 0;
|
|
92
|
-
};
|
|
93
|
-
this.handleKeydown = (event) => {
|
|
94
|
-
this.focused = true;
|
|
95
|
-
if (event.code !== "ArrowDown" && event.code !== "ArrowUp") {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
event.stopPropagation();
|
|
99
|
-
event.preventDefault();
|
|
100
|
-
this.toggle(true);
|
|
101
|
-
};
|
|
102
|
-
this.renderAngleIcon = () => angleIcon();
|
|
103
|
-
this.renderAlertIcon = () => alertIcon();
|
|
104
|
-
this.handleEnterKeydown = (event) => {
|
|
105
|
-
if (event.code !== "Enter") {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
if (this.enterKeydownOn) {
|
|
109
|
-
event.preventDefault();
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
this.enterKeydownOn = event.target;
|
|
113
|
-
this.addEventListener(
|
|
114
|
-
"keyup",
|
|
115
|
-
(keyupEvent) => {
|
|
116
|
-
if (keyupEvent.code !== "Enter") {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
this.enterKeydownOn = null;
|
|
120
|
-
},
|
|
121
|
-
{ once: true }
|
|
122
|
-
);
|
|
123
|
-
};
|
|
124
|
-
this.pendingStateController = new pendingState.PendingStateController(this);
|
|
125
|
-
}
|
|
126
|
-
get selectedItem() {
|
|
127
|
-
return this._selectedItem;
|
|
128
|
-
}
|
|
129
|
-
get selectedItemContent() {
|
|
130
|
-
return this._selectedItemContent || { icon: [], content: [] };
|
|
131
|
-
}
|
|
132
|
-
get selfManageFocusElement() {
|
|
133
|
-
return this._selfManageFocusElement;
|
|
134
|
-
}
|
|
135
|
-
get menuItems() {
|
|
136
|
-
return this.optionsMenu.childItems;
|
|
137
|
-
}
|
|
138
|
-
set selectedItem(selectedItem) {
|
|
139
|
-
const iconSlot = selectedItem == null ? void 0 : selectedItem.querySelector('[slot="icon"]');
|
|
140
|
-
this.selectedItemContent = selectedItem ? selectedItem.itemChildren : void 0;
|
|
141
|
-
if (selectedItem === this.selectedItem) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
const oldSelectedItem = this.selectedItem;
|
|
145
|
-
this._selectedItem = selectedItem;
|
|
146
|
-
this._selectedItemIcon = (iconSlot == null ? void 0 : iconSlot.icon) ?? void 0;
|
|
147
|
-
this.requestUpdate("selectedItem", oldSelectedItem);
|
|
148
|
-
}
|
|
149
|
-
get focusElement() {
|
|
150
|
-
if (this.open) {
|
|
151
|
-
return this.optionsMenu;
|
|
152
|
-
}
|
|
153
|
-
return this.button;
|
|
154
|
-
}
|
|
155
|
-
forceFocusVisible() {
|
|
156
|
-
if (this.disabled) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
this.focused = true;
|
|
160
|
-
}
|
|
161
|
-
click() {
|
|
162
|
-
if (this.disabled) {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
this.toggle();
|
|
166
|
-
}
|
|
167
|
-
handleButtonBlur() {
|
|
168
|
-
this.focused = false;
|
|
169
|
-
}
|
|
170
|
-
focus(options) {
|
|
171
|
-
super.focus(options);
|
|
172
|
-
if (!this.disabled && this.focusElement) {
|
|
173
|
-
this.focused = this.hasVisibleFocusInTree();
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
handleHelperFocus() {
|
|
177
|
-
this.focused = true;
|
|
178
|
-
this.button.focus();
|
|
179
|
-
}
|
|
180
|
-
handleChange(event) {
|
|
181
|
-
if (this.strategy) {
|
|
182
|
-
this.strategy.preventNextToggle = "no";
|
|
183
|
-
}
|
|
184
|
-
const target = event.target;
|
|
185
|
-
const [selected] = target.selectedItems;
|
|
186
|
-
event.stopPropagation();
|
|
187
|
-
if (event.cancelable) {
|
|
188
|
-
this.setValueFromItem(selected, event);
|
|
189
|
-
} else {
|
|
190
|
-
this.open = false;
|
|
191
|
-
if (this.strategy) {
|
|
192
|
-
this.strategy.open = false;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
handleButtonFocus(event) {
|
|
197
|
-
var _a;
|
|
198
|
-
(_a = this.strategy) == null ? void 0 : _a.handleButtonFocus(event);
|
|
199
|
-
}
|
|
200
|
-
toggle(target) {
|
|
201
|
-
if (this.readonly || this.pending) {
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
this.open = target === void 0 ? !this.open : target;
|
|
205
|
-
if (this.strategy) {
|
|
206
|
-
this.strategy.open = this.open;
|
|
207
|
-
}
|
|
208
|
-
this._selfManageFocusElement = this.open;
|
|
209
|
-
}
|
|
210
|
-
close() {
|
|
211
|
-
if (this.readonly) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
if (this.strategy) {
|
|
215
|
-
this.open = false;
|
|
216
|
-
this.strategy.open = false;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
bindEvents() {
|
|
220
|
-
var _a;
|
|
221
|
-
(_a = this.strategy) == null ? void 0 : _a.abort();
|
|
222
|
-
this.strategy = this.isMobile.matches ? new strategies.strategies.mobile(this.button, this) : new strategies.strategies.desktop(this.button, this);
|
|
223
|
-
}
|
|
224
|
-
connectedCallback() {
|
|
225
|
-
super.connectedCallback();
|
|
226
|
-
this.recentlyConnected = this.hasUpdated;
|
|
227
|
-
}
|
|
228
|
-
disconnectedCallback() {
|
|
229
|
-
var _a;
|
|
230
|
-
this.close();
|
|
231
|
-
(_a = this.strategy) == null ? void 0 : _a.releaseDescription();
|
|
232
|
-
super.disconnectedCallback();
|
|
233
|
-
}
|
|
234
|
-
async setValueFromItem(item, menuChangeEvent) {
|
|
235
|
-
this.open = false;
|
|
236
|
-
if (this.strategy) {
|
|
237
|
-
this.strategy.open = false;
|
|
238
|
-
}
|
|
239
|
-
const oldSelectedItem = this.selectedItem;
|
|
240
|
-
const oldValue = this.value;
|
|
241
|
-
this.selectedItem = item;
|
|
242
|
-
this.value = (item == null ? void 0 : item.value) ?? "";
|
|
243
|
-
await this.updateComplete;
|
|
244
|
-
const applyDefault = this.dispatchEvent(
|
|
245
|
-
new CustomEvent("change", {
|
|
246
|
-
bubbles: true,
|
|
247
|
-
// Allow it to be prevented.
|
|
248
|
-
cancelable: true,
|
|
249
|
-
composed: true,
|
|
250
|
-
detail: this.value
|
|
251
|
-
})
|
|
252
|
-
);
|
|
253
|
-
if (!applyDefault && this.selects) {
|
|
254
|
-
if (menuChangeEvent) {
|
|
255
|
-
menuChangeEvent.preventDefault();
|
|
256
|
-
}
|
|
257
|
-
this.setMenuItemSelected(this.selectedItem, false);
|
|
258
|
-
if (oldSelectedItem) {
|
|
259
|
-
this.setMenuItemSelected(oldSelectedItem, true);
|
|
260
|
-
}
|
|
261
|
-
this.selectedItem = oldSelectedItem;
|
|
262
|
-
this.value = oldValue;
|
|
263
|
-
this.open = true;
|
|
264
|
-
if (this.strategy) {
|
|
265
|
-
this.strategy.open = true;
|
|
266
|
-
}
|
|
267
|
-
return;
|
|
268
|
-
} else if (!this.selects) {
|
|
269
|
-
this.selectedItem = oldSelectedItem;
|
|
270
|
-
this.value = oldValue;
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
if (oldSelectedItem) {
|
|
274
|
-
this.setMenuItemSelected(oldSelectedItem, false);
|
|
275
|
-
}
|
|
276
|
-
this.setMenuItemSelected(item, !!this.selects);
|
|
277
|
-
}
|
|
278
|
-
setMenuItemSelected(item, value) {
|
|
279
|
-
if (this.selects == null) {
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
item.selected = value;
|
|
283
|
-
}
|
|
284
|
-
get containerStyles() {
|
|
285
|
-
if (this.isMobile.matches) {
|
|
286
|
-
return {
|
|
287
|
-
"--swc-menu-width": "100%"
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
return {};
|
|
291
|
-
}
|
|
292
|
-
set selectedItemContent(selectedItemContent) {
|
|
293
|
-
if (selectedItemContent === this.selectedItemContent) {
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
const oldContent = this.selectedItemContent;
|
|
297
|
-
this._selectedItemContent = selectedItemContent;
|
|
298
|
-
this.requestUpdate("selectedItemContent", oldContent);
|
|
299
|
-
}
|
|
300
|
-
handleTooltipSlotchange(event) {
|
|
301
|
-
this.tooltipEl = event.target.assignedElements()[0];
|
|
302
|
-
}
|
|
303
|
-
renderLabelContent(content) {
|
|
304
|
-
if (this.value && this.selectedItem) {
|
|
305
|
-
return content;
|
|
306
|
-
}
|
|
307
|
-
return lit.html`
|
|
308
|
-
<slot name="label" id="label">
|
|
309
|
-
<span aria-hidden=${ifDefined_js.ifDefined(this.appliedLabel ? void 0 : "true")}>
|
|
310
|
-
${this.label}
|
|
311
|
-
</span>
|
|
312
|
-
</slot>
|
|
313
|
-
`;
|
|
314
|
-
}
|
|
315
|
-
get buttonContent() {
|
|
316
|
-
const labelClasses = {
|
|
317
|
-
"visually-hidden": this.icons === "only" && !!this.value,
|
|
318
|
-
placeholder: !this.value,
|
|
319
|
-
label: true
|
|
320
|
-
};
|
|
321
|
-
const appliedLabel = this.appliedLabel || this.label;
|
|
322
|
-
const iconTemplate = lit.html` <div id="icon" ?hidden=${this.icons === "none"}>
|
|
323
|
-
${this._selectedItemIcon ? icons.luzmoIcon(this._selectedItemIcon) : lit.nothing}
|
|
324
|
-
</div>`;
|
|
325
|
-
return [
|
|
326
|
-
lit.html`
|
|
327
|
-
${this._selectedItemIcon ? iconTemplate : lit.nothing}
|
|
328
|
-
<div
|
|
329
|
-
id=${ifDefined_js.ifDefined(this.value && this.selectedItem ? "label" : void 0)}
|
|
330
|
-
class=${classMap_js.classMap(labelClasses)}
|
|
331
|
-
>
|
|
332
|
-
${this.renderLabelContent(this.selectedItemContent.content)}
|
|
333
|
-
</div>
|
|
334
|
-
${this.value && this.selectedItem ? lit.html`
|
|
335
|
-
<div
|
|
336
|
-
aria-hidden="true"
|
|
337
|
-
class="visually-hidden"
|
|
338
|
-
id="applied-label"
|
|
339
|
-
>
|
|
340
|
-
${appliedLabel}
|
|
341
|
-
<slot name="label"></slot>
|
|
342
|
-
</div>
|
|
343
|
-
` : lit.html` <span hidden id="applied-label">${appliedLabel}</span> `}
|
|
344
|
-
${this.invalid && !this.pending ? lit.html` ${this.renderAlertIcon()} ` : lit.nothing}
|
|
345
|
-
${this.pendingStateController.renderPendingState()}
|
|
346
|
-
${this.readonly ? lit.nothing : this.renderAngleIcon()}
|
|
347
|
-
<slot
|
|
348
|
-
aria-hidden="true"
|
|
349
|
-
name="tooltip"
|
|
350
|
-
id="tooltip"
|
|
351
|
-
@slotchange=${this.handleTooltipSlotchange}
|
|
352
|
-
></slot>
|
|
353
|
-
`
|
|
354
|
-
];
|
|
355
|
-
}
|
|
356
|
-
renderOverlay(menu) {
|
|
357
|
-
var _a, _b, _c;
|
|
358
|
-
if (((_a = this.strategy) == null ? void 0 : _a.overlay) === void 0) {
|
|
359
|
-
return menu;
|
|
360
|
-
}
|
|
361
|
-
const container = this.renderContainer(menu);
|
|
362
|
-
lit.render(container, (_b = this.strategy) == null ? void 0 : _b.overlay, {
|
|
363
|
-
host: this
|
|
364
|
-
});
|
|
365
|
-
return (_c = this.strategy) == null ? void 0 : _c.overlay;
|
|
366
|
-
}
|
|
367
|
-
get renderDescriptionSlot() {
|
|
368
|
-
return lit.html`
|
|
369
|
-
<div id=${DESCRIPTION_ID}>
|
|
370
|
-
<slot name="description"></slot>
|
|
371
|
-
</div>
|
|
372
|
-
`;
|
|
373
|
-
}
|
|
374
|
-
// a helper to throw focus to the button is needed because Safari
|
|
375
|
-
// won't include buttons in the tab order even with tabindex="0"
|
|
376
|
-
render() {
|
|
377
|
-
if (this.tooltipEl) {
|
|
378
|
-
this.tooltipEl.disabled = this.open;
|
|
379
|
-
}
|
|
380
|
-
return lit.html`
|
|
381
|
-
<span
|
|
382
|
-
id="focus-helper"
|
|
383
|
-
tabindex=${this.focused || this.open ? "-1" : "0"}
|
|
384
|
-
@focus=${this.handleHelperFocus}
|
|
385
|
-
aria-describedby=${DESCRIPTION_ID}
|
|
386
|
-
></span>
|
|
387
|
-
<button
|
|
388
|
-
aria-controls=${ifDefined_js.ifDefined(this.open ? "menu" : void 0)}
|
|
389
|
-
aria-describedby="tooltip"
|
|
390
|
-
aria-expanded=${this.open ? "true" : "false"}
|
|
391
|
-
aria-haspopup="true"
|
|
392
|
-
aria-labelledby="loader icon label applied-label"
|
|
393
|
-
id="button"
|
|
394
|
-
class=${ifDefined_js.ifDefined(
|
|
395
|
-
this.labelAlignment ? `label-${this.labelAlignment}` : void 0
|
|
396
|
-
)}
|
|
397
|
-
@blur=${this.handleButtonBlur}
|
|
398
|
-
@keydown=${{
|
|
399
|
-
handleEvent: this.handleEnterKeydown,
|
|
400
|
-
capture: true
|
|
401
|
-
}}
|
|
402
|
-
?disabled=${this.disabled}
|
|
403
|
-
tabindex="-1"
|
|
404
|
-
>
|
|
405
|
-
${this.buttonContent}
|
|
406
|
-
</button>
|
|
407
|
-
${this.renderMenu} ${this.renderDescriptionSlot}
|
|
408
|
-
`;
|
|
409
|
-
}
|
|
410
|
-
update(changes) {
|
|
411
|
-
var _a, _b;
|
|
412
|
-
if (this.selects) {
|
|
413
|
-
this.selects = "single";
|
|
414
|
-
}
|
|
415
|
-
if (changes.has("disabled") && this.disabled && this.strategy) {
|
|
416
|
-
this.open = false;
|
|
417
|
-
this.strategy.open = false;
|
|
418
|
-
}
|
|
419
|
-
if (changes.has("pending") && this.pending && this.strategy) {
|
|
420
|
-
this.open = false;
|
|
421
|
-
this.strategy.open = false;
|
|
422
|
-
}
|
|
423
|
-
if (changes.has("value")) {
|
|
424
|
-
this.shouldScheduleManageSelection();
|
|
425
|
-
}
|
|
426
|
-
if (!this.hasUpdated) {
|
|
427
|
-
this.deprecatedMenu = this.querySelector(":scope > luzmo-menu");
|
|
428
|
-
(_a = this.deprecatedMenu) == null ? void 0 : _a.toggleAttribute("ignore", true);
|
|
429
|
-
(_b = this.deprecatedMenu) == null ? void 0 : _b.setAttribute("selects", "inherit");
|
|
430
|
-
}
|
|
431
|
-
super.update(changes);
|
|
432
|
-
}
|
|
433
|
-
bindButtonKeydownListener() {
|
|
434
|
-
this.button.addEventListener("keydown", this.handleKeydown);
|
|
435
|
-
}
|
|
436
|
-
updated(changes) {
|
|
437
|
-
super.updated(changes);
|
|
438
|
-
if (changes.has("open")) {
|
|
439
|
-
this.strategy.open = this.open;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
firstUpdated(changes) {
|
|
443
|
-
super.firstUpdated(changes);
|
|
444
|
-
this.bindButtonKeydownListener();
|
|
445
|
-
this.bindEvents();
|
|
446
|
-
}
|
|
447
|
-
get dismissHelper() {
|
|
448
|
-
return lit.html`
|
|
449
|
-
<div class="visually-hidden">
|
|
450
|
-
<button
|
|
451
|
-
tabindex="-1"
|
|
452
|
-
aria-label="Dismiss"
|
|
453
|
-
@click=${this.close}
|
|
454
|
-
></button>
|
|
455
|
-
</div>
|
|
456
|
-
`;
|
|
457
|
-
}
|
|
458
|
-
renderContainer(menu) {
|
|
459
|
-
const accessibleMenu = lit.html`
|
|
460
|
-
${this.dismissHelper} ${menu} ${this.dismissHelper}
|
|
461
|
-
`;
|
|
462
|
-
this.dependencyManager.add("luzmo-popover");
|
|
463
|
-
Promise.resolve().then(() => require("./popover/index.cjs"));
|
|
464
|
-
return lit.html`
|
|
465
|
-
<luzmo-popover
|
|
466
|
-
id="popover"
|
|
467
|
-
size=${this.size}
|
|
468
|
-
role="presentation"
|
|
469
|
-
style=${styleMap_js.styleMap(this.containerStyles)}
|
|
470
|
-
placement=${this.placement}
|
|
471
|
-
>
|
|
472
|
-
${accessibleMenu}
|
|
473
|
-
</luzmo-popover>
|
|
474
|
-
`;
|
|
475
|
-
}
|
|
476
|
-
get renderMenu() {
|
|
477
|
-
const menu = lit.html`
|
|
478
|
-
<luzmo-menu
|
|
479
|
-
aria-labelledby="applied-label"
|
|
480
|
-
@change=${this.handleChange}
|
|
481
|
-
id="menu"
|
|
482
|
-
@keydown=${{
|
|
483
|
-
handleEvent: this.handleEnterKeydown,
|
|
484
|
-
capture: true
|
|
485
|
-
}}
|
|
486
|
-
@scroll=${this.onScroll}
|
|
487
|
-
role=${this.listRole}
|
|
488
|
-
.selects=${this.selects}
|
|
489
|
-
.selected=${this.value ? [this.value] : []}
|
|
490
|
-
size=${this.size}
|
|
491
|
-
@luzmo-menu-item-added-or-updated=${this.shouldManageSelection}
|
|
492
|
-
>
|
|
493
|
-
<slot @slotchange=${this.shouldScheduleManageSelection}></slot>
|
|
494
|
-
</luzmo-menu>
|
|
495
|
-
`;
|
|
496
|
-
this.hasRenderedOverlay = this.hasRenderedOverlay || this.focused || this.open || !!this.deprecatedMenu;
|
|
497
|
-
if (this.hasRenderedOverlay) {
|
|
498
|
-
if (this.dependencyManager.loaded) {
|
|
499
|
-
this.dependencyManager.add("luzmo-overlay");
|
|
500
|
-
}
|
|
501
|
-
return this.renderOverlay(menu);
|
|
502
|
-
}
|
|
503
|
-
return menu;
|
|
504
|
-
}
|
|
505
|
-
shouldScheduleManageSelection(event) {
|
|
506
|
-
if (!this.willManageSelection && (!event || event.target.getRootNode().host === this)) {
|
|
507
|
-
this.willManageSelection = true;
|
|
508
|
-
requestAnimationFrame(() => {
|
|
509
|
-
requestAnimationFrame(() => {
|
|
510
|
-
this.manageSelection();
|
|
511
|
-
});
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
shouldManageSelection() {
|
|
516
|
-
if (this.willManageSelection) {
|
|
517
|
-
return;
|
|
518
|
-
}
|
|
519
|
-
this.willManageSelection = true;
|
|
520
|
-
this.manageSelection();
|
|
521
|
-
}
|
|
522
|
-
async manageSelection() {
|
|
523
|
-
if (this.selects == null) {
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
this.selectionPromise = new Promise(
|
|
527
|
-
(res) => this.selectionResolver = res
|
|
528
|
-
);
|
|
529
|
-
let selectedItem;
|
|
530
|
-
await this.optionsMenu.updateComplete;
|
|
531
|
-
if (this.recentlyConnected) {
|
|
532
|
-
await new Promise((res) => requestAnimationFrame(() => res(true)));
|
|
533
|
-
this.recentlyConnected = false;
|
|
534
|
-
}
|
|
535
|
-
this.menuItems.forEach((item) => {
|
|
536
|
-
if (this.value === item.value && !item.disabled) {
|
|
537
|
-
selectedItem = item;
|
|
538
|
-
} else {
|
|
539
|
-
item.selected = false;
|
|
540
|
-
}
|
|
541
|
-
});
|
|
542
|
-
if (selectedItem) {
|
|
543
|
-
selectedItem.selected = !!this.selects;
|
|
544
|
-
this.selectedItem = selectedItem;
|
|
545
|
-
} else {
|
|
546
|
-
this.value = "";
|
|
547
|
-
this.selectedItem = void 0;
|
|
548
|
-
}
|
|
549
|
-
if (this.open) {
|
|
550
|
-
await this.optionsMenu.updateComplete;
|
|
551
|
-
this.optionsMenu.updateSelectedItemIndex();
|
|
552
|
-
}
|
|
553
|
-
this.selectionResolver();
|
|
554
|
-
this.willManageSelection = false;
|
|
555
|
-
}
|
|
556
|
-
async getUpdateComplete() {
|
|
557
|
-
const complete = await super.getUpdateComplete();
|
|
558
|
-
await this.selectionPromise;
|
|
559
|
-
return complete;
|
|
560
|
-
}
|
|
561
|
-
onScroll() {
|
|
562
|
-
this.dispatchEvent(
|
|
563
|
-
new Event("scroll", {
|
|
564
|
-
cancelable: true,
|
|
565
|
-
composed: true
|
|
566
|
-
})
|
|
567
|
-
);
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
__decorateClass([
|
|
571
|
-
decorators_js.state()
|
|
572
|
-
], LuzmoPickerBase.prototype, "appliedLabel", 2);
|
|
573
|
-
__decorateClass([
|
|
574
|
-
decorators_js.query("#button")
|
|
575
|
-
], LuzmoPickerBase.prototype, "button", 2);
|
|
576
|
-
__decorateClass([
|
|
577
|
-
decorators_js.property({ type: Boolean, reflect: true })
|
|
578
|
-
], LuzmoPickerBase.prototype, "disabled", 2);
|
|
579
|
-
__decorateClass([
|
|
580
|
-
decorators_js.property({ type: Boolean, reflect: true })
|
|
581
|
-
], LuzmoPickerBase.prototype, "focused", 2);
|
|
582
|
-
__decorateClass([
|
|
583
|
-
decorators_js.property({ type: String, reflect: true })
|
|
584
|
-
], LuzmoPickerBase.prototype, "icons", 2);
|
|
585
|
-
__decorateClass([
|
|
586
|
-
decorators_js.property({ type: String, reflect: true })
|
|
587
|
-
], LuzmoPickerBase.prototype, "variant", 2);
|
|
588
|
-
__decorateClass([
|
|
589
|
-
decorators_js.property({ type: Boolean, reflect: true })
|
|
590
|
-
], LuzmoPickerBase.prototype, "invalid", 2);
|
|
591
|
-
__decorateClass([
|
|
592
|
-
decorators_js.property({ type: Boolean, reflect: true })
|
|
593
|
-
], LuzmoPickerBase.prototype, "pending", 2);
|
|
594
|
-
__decorateClass([
|
|
595
|
-
decorators_js.property({ type: String, attribute: "pending-label" })
|
|
596
|
-
], LuzmoPickerBase.prototype, "pendingLabel", 2);
|
|
597
|
-
__decorateClass([
|
|
598
|
-
decorators_js.property()
|
|
599
|
-
], LuzmoPickerBase.prototype, "label", 2);
|
|
600
|
-
__decorateClass([
|
|
601
|
-
decorators_js.property({ type: Boolean, reflect: true })
|
|
602
|
-
], LuzmoPickerBase.prototype, "open", 2);
|
|
603
|
-
__decorateClass([
|
|
604
|
-
decorators_js.property({ type: Boolean, reflect: true })
|
|
605
|
-
], LuzmoPickerBase.prototype, "readonly", 2);
|
|
606
|
-
__decorateClass([
|
|
607
|
-
decorators_js.state()
|
|
608
|
-
], LuzmoPickerBase.prototype, "labelAlignment", 2);
|
|
609
|
-
__decorateClass([
|
|
610
|
-
decorators_js.query("luzmo-menu")
|
|
611
|
-
], LuzmoPickerBase.prototype, "optionsMenu", 2);
|
|
612
|
-
__decorateClass([
|
|
613
|
-
decorators_js.query("luzmo-overlay")
|
|
614
|
-
], LuzmoPickerBase.prototype, "overlayElement", 2);
|
|
615
|
-
__decorateClass([
|
|
616
|
-
decorators_js.property()
|
|
617
|
-
], LuzmoPickerBase.prototype, "placement", 2);
|
|
618
|
-
__decorateClass([
|
|
619
|
-
decorators_js.property({ type: Boolean, reflect: true })
|
|
620
|
-
], LuzmoPickerBase.prototype, "quiet", 2);
|
|
621
|
-
__decorateClass([
|
|
622
|
-
decorators_js.property({ type: String })
|
|
623
|
-
], LuzmoPickerBase.prototype, "value", 2);
|
|
624
|
-
__decorateClass([
|
|
625
|
-
decorators_js.property({ attribute: false })
|
|
626
|
-
], LuzmoPickerBase.prototype, "selectedItem", 1);
|
|
627
|
-
__decorateClass([
|
|
628
|
-
decorators_js.state()
|
|
629
|
-
], LuzmoPickerBase.prototype, "selectedItemContent", 1);
|
|
630
|
-
class LuzmoPicker extends LuzmoPickerBase {
|
|
631
|
-
constructor() {
|
|
632
|
-
super(...arguments);
|
|
633
|
-
this.handleKeydown = (event) => {
|
|
634
|
-
const { code } = event;
|
|
635
|
-
this.focused = true;
|
|
636
|
-
if (!code.startsWith("Arrow") || this.readonly || this.pending) {
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
if (code === "ArrowUp" || code === "ArrowDown") {
|
|
640
|
-
this.toggle(true);
|
|
641
|
-
event.preventDefault();
|
|
642
|
-
return;
|
|
643
|
-
}
|
|
644
|
-
event.preventDefault();
|
|
645
|
-
const selectedIndex = this.selectedItem ? this.menuItems.indexOf(this.selectedItem) : -1;
|
|
646
|
-
const nextOffset = selectedIndex < 0 || code === "ArrowRight" ? 1 : -1;
|
|
647
|
-
let nextIndex = selectedIndex + nextOffset;
|
|
648
|
-
while (this.menuItems[nextIndex] && this.menuItems[nextIndex].disabled) {
|
|
649
|
-
nextIndex += nextOffset;
|
|
650
|
-
}
|
|
651
|
-
if (!this.menuItems[nextIndex] || this.menuItems[nextIndex].disabled) {
|
|
652
|
-
return;
|
|
653
|
-
}
|
|
654
|
-
if (!this.value || nextIndex !== selectedIndex) {
|
|
655
|
-
void this.setValueFromItem(this.menuItems[nextIndex]);
|
|
656
|
-
}
|
|
657
|
-
};
|
|
658
|
-
}
|
|
659
|
-
static get styles() {
|
|
660
|
-
return [lit.unsafeCSS(pickerStyles)];
|
|
661
|
-
}
|
|
662
|
-
get containerStyles() {
|
|
663
|
-
const styles = super.containerStyles;
|
|
664
|
-
if (!this.quiet) {
|
|
665
|
-
styles["min-width"] = `${this.offsetWidth}px`;
|
|
666
|
-
}
|
|
667
|
-
return styles;
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
exports.DESCRIPTION_ID = DESCRIPTION_ID;
|
|
671
|
-
exports.LuzmoPicker = LuzmoPicker;
|
|
672
|
-
exports.LuzmoPickerBase = LuzmoPickerBase;
|