@luzmo/lucero 1.0.1-alpha.14 → 1.0.1-alpha.16
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/accordion/index.cjs +183 -6
- package/components/accordion/index.js +136 -88
- package/components/action-bar/index.cjs +85 -4
- package/components/action-bar/index.js +72 -50
- package/components/action-button/index.cjs +205 -3
- package/components/action-button/index.js +167 -93
- package/components/action-group/index.cjs +7 -1
- package/components/action-group/index.js +12 -8
- package/components/action-group-DHp8RHDf.js +392 -0
- package/components/action-group-MPf19RPV.cjs +391 -0
- package/components/action-menu/index.cjs +91 -11
- package/components/action-menu/index.js +66 -47
- package/components/avatar/index.cjs +63 -3
- package/components/avatar/index.js +54 -42
- package/components/base-COw9n7UR.cjs +119 -0
- package/components/base-DmeVy0cq.js +120 -0
- package/components/button/index.cjs +134 -2
- package/components/button/index.js +106 -72
- package/components/button-base-7Ak55xFd.cjs +206 -0
- package/components/button-base-C3kf6BTK.js +207 -0
- package/components/button-group/index.cjs +45 -1
- package/components/button-group/index.js +37 -25
- package/components/calendar/index.cjs +632 -1
- package/components/calendar/index.js +637 -7
- package/components/checkbox/index.cjs +111 -4
- package/components/checkbox/index.js +98 -53
- package/components/checkbox-mixin-8cL-vfDy.js +84 -0
- package/components/checkbox-mixin-CE7dJj3J.cjs +83 -0
- package/components/clear-button-Co6oKSgl.js +59 -0
- package/components/clear-button-X_HDY2eH.cjs +58 -0
- package/components/close-button-DPBK6Kpu.cjs +59 -0
- package/components/close-button-Miw9ZjoJ.js +60 -0
- package/components/color-area/index.cjs +440 -13
- package/components/color-area/index.js +322 -187
- package/components/color-controller-BjDZaxhX.js +491 -0
- package/components/color-controller-C3c_vb2P.cjs +490 -0
- package/components/color-field/index.cjs +95 -2
- package/components/color-field/index.js +77 -41
- package/components/color-handle/index.cjs +64 -3
- package/components/color-handle/index.js +58 -37
- package/components/color-loupe/index.cjs +7 -1
- package/components/color-loupe/index.js +12 -8
- package/components/color-loupe-BQqNR8YD.cjs +88 -0
- package/components/color-loupe-B_DDFv8l.js +89 -0
- package/components/color-menu/index.cjs +217 -12
- package/components/color-menu/index.js +187 -93
- package/components/color-palette/index.cjs +89 -1
- package/components/color-palette/index.js +78 -51
- package/components/color-palette-group/index.cjs +259 -3
- package/components/color-palette-group/index.js +193 -105
- package/components/color-picker/index.cjs +114 -6
- package/components/color-picker/index.js +92 -72
- package/components/color-slider/index.cjs +585 -1
- package/components/color-slider/index.js +590 -7
- package/components/{directive-oAbCiebi.js → condition-attribute-with-id-Cn815e9W.js} +22 -22
- package/components/condition-attribute-with-id-DEc2Yjne.cjs +43 -0
- package/components/date-time-picker/index.cjs +1357 -31
- package/components/date-time-picker/index.js +951 -637
- package/components/dependency-manger-CcIE1uvQ.cjs +63 -0
- package/components/{dependency-manger-CEXvGQUV.js → dependency-manger-XHpQjFgK.js} +24 -14
- package/components/divider/index.cjs +54 -1
- package/components/divider/index.js +49 -30
- package/components/divider.module-Cm5LcDRV.cjs +20 -0
- package/components/divider.module-DauH6k2_.js +21 -0
- package/components/element-resolution-DCsrhGZO.cjs +112 -0
- package/components/element-resolution-nMlmW4Jy.js +113 -0
- package/components/field-group/index.cjs +7 -1
- package/components/field-group/index.js +12 -8
- package/components/field-group-DNmY8W9v.cjs +86 -0
- package/components/field-group-DVdAWCQF.js +87 -0
- package/components/field-label/index.cjs +7 -1
- package/components/field-label/index.js +12 -8
- package/components/field-label-CKH9EXpR.cjs +156 -0
- package/components/field-label-Dpsecoc6.js +157 -0
- package/components/focus-group-BqDAk9Is.js +337 -0
- package/components/focus-group-DFzOlalL.cjs +336 -0
- package/components/focus-visible-B-B8-P9R.cjs +104 -0
- package/components/focus-visible-BUPRWlsh.js +105 -0
- package/components/focusable-BPrTcZPd.cjs +262 -0
- package/components/focusable-ChCLg1k4.js +263 -0
- package/components/{directive-C7oCP5Bh.cjs → focusable-selectors-D0t_5P7C.cjs} +16 -5
- package/components/{focusable-selectors-B4YgbghQ.js → focusable-selectors-IltOAOd9.js} +7 -4
- package/components/icon/index.cjs +90 -1
- package/components/icon/index.js +74 -46
- package/components/index.cjs +174 -1
- package/components/index.js +174 -172
- package/components/infield-button/index.cjs +46 -2
- package/components/infield-button/index.js +41 -30
- package/components/label/index.cjs +37 -1
- package/components/label/index.js +36 -24
- package/components/{language-resolution-8yZa5r_P.js → language-resolution-BSGJAWiQ.js} +21 -16
- package/components/language-resolution-iN9EImbb.cjs +57 -0
- package/components/like-anchor-D62faRNG.cjs +79 -0
- package/components/like-anchor-v3cJ9RWM.js +80 -0
- package/components/manage-help-text-BYx84zZR.cjs +125 -0
- package/components/manage-help-text-DOuMTGht.js +126 -0
- package/components/menu/index.cjs +1297 -29
- package/components/menu/index.js +954 -499
- package/components/multi-language-field/index.cjs +132 -2
- package/components/multi-language-field/index.js +118 -88
- package/components/number-field/index.cjs +613 -10
- package/components/number-field/index.js +442 -243
- package/components/observe-slot-presence-9AwLGUQ_.cjs +78 -0
- package/components/observe-slot-presence-DcMdoumP.js +79 -0
- package/components/observe-slot-text-CSofZeeF.cjs +104 -0
- package/components/observe-slot-text-CjnkkBPn.js +105 -0
- package/components/options/index.cjs +693 -60
- package/components/options/index.js +519 -953
- package/components/overlay/index.cjs +367 -21
- package/components/overlay/index.js +273 -189
- package/components/overlay-CN8ISP1F.js +2485 -0
- package/components/overlay-LViy9VWM.cjs +2484 -0
- package/components/{pending-state-DTX7ggyF.js → pending-state-CXbe-Xul.js} +28 -13
- package/components/pending-state-e4RbXe9u.cjs +75 -0
- package/components/picker/index.cjs +9 -1
- package/components/picker/index.js +15 -11
- package/components/picker-DNde3awt.cjs +672 -0
- package/components/picker-PfUAF05y.js +673 -0
- package/components/picker-button/index.cjs +56 -4
- package/components/picker-button/index.js +45 -34
- package/components/platform-CxDar3Dn.cjs +68 -0
- package/components/platform-Cxn0WbyT.js +69 -0
- package/components/popover/index.cjs +7 -1
- package/components/popover/index.js +12 -8
- package/components/popover-BkbYhl3i.js +74 -0
- package/components/popover-BkgUf0kL.cjs +74 -0
- package/components/progress-circle/index.cjs +7 -1
- package/components/progress-circle/index.js +12 -8
- package/components/progress-circle-Hu_ivPHf.js +133 -0
- package/components/progress-circle-_Etqsj9f.cjs +132 -0
- package/components/radio/index.cjs +244 -2
- package/components/radio/index.js +192 -110
- package/components/{when-CDK1Tt5Y.js → random-id-BE6HA503.cjs} +7 -10
- package/components/{random-id-ByCz1xaq.js → random-id-BEc6QIUL.js} +3 -3
- package/components/roving-tabindex-AsmAh2In.cjs +95 -0
- package/components/roving-tabindex-DPF9NmrH.js +96 -0
- package/components/search/index.cjs +115 -8
- package/components/search/index.js +96 -66
- package/components/select/index.cjs +720 -51
- package/components/select/index.js +563 -347
- package/components/sized-mixin-DmkrNdWB.js +80 -0
- package/components/sized-mixin-UaTVa-AE.cjs +79 -0
- package/components/slider/index.cjs +119 -1
- package/components/slider/index.js +100 -1113
- package/components/{condition-attribute-with-id-Dv4lSRbe.js → slottable-request-event-CANixJnR.cjs} +15 -13
- package/components/{slottable-request-event-DggLA4Rx.js → slottable-request-event-D9WzrdWv.js} +12 -9
- package/components/strategies-DlMlaSJR.cjs +317 -0
- package/components/strategies-DlPQoTFE.js +318 -0
- package/components/streaming-listener-D4sHaMub.cjs +145 -0
- package/components/streaming-listener-cAz5zJyk.js +146 -0
- package/components/swatch/index.cjs +436 -7
- package/components/swatch/index.js +350 -205
- package/components/switch/index.cjs +61 -2
- package/components/switch/index.js +51 -34
- package/components/tabs/index.cjs +693 -26
- package/components/tabs/index.js +521 -388
- package/components/tags/index.cjs +201 -4
- package/components/tags/index.js +152 -87
- package/components/text-field/index.cjs +49 -3
- package/components/text-field/index.js +44 -30
- package/components/text-field-11tcnftU.cjs +338 -0
- package/components/text-field-Chi9J2Cz.js +339 -0
- package/components/text-field.module-CMBS0jSL.js +21 -0
- package/components/text-field.module-DIJdV_sA.cjs +20 -0
- package/components/toast/index.cjs +177 -12
- package/components/toast/index.js +145 -73
- package/components/tooltip/index.cjs +221 -6
- package/components/tooltip/index.js +156 -109
- package/components/unit-input/index.cjs +232 -8
- package/components/unit-input/index.js +201 -108
- package/components/utils.cjs +25 -1
- package/components/utils.js +22 -22
- package/package.json +1 -1
- package/components/NumberFormatter-DewVDY5w.cjs +0 -18
- package/components/NumberFormatter-DgOUVrge.js +0 -136
- package/components/NumberParser-Dik4a0h-.cjs +0 -18
- package/components/NumberParser-ci9J5EKv.js +0 -173
- package/components/action-group-DBImibFn.js +0 -258
- package/components/action-group-DJGMcRHb.cjs +0 -20
- package/components/async-directive-BX1T1e1_.cjs +0 -22
- package/components/async-directive-BfcqVjDp.js +0 -82
- package/components/base-BjTwmyRF.cjs +0 -22
- package/components/base-CBCg3yyw.cjs +0 -40
- package/components/base-D76d76ww.js +0 -26
- package/components/base-WsynuqaS.js +0 -677
- package/components/button-base-DbkDzb71.js +0 -144
- package/components/button-base-XgPLmwP-.cjs +0 -25
- package/components/checkbox-mixin-BDN0dBtS.cjs +0 -27
- package/components/checkbox-mixin-Do7EgtpQ.js +0 -70
- package/components/class-map-Di1D_rCm.cjs +0 -22
- package/components/class-map-NbVXqBU0.js +0 -51
- package/components/clear-button-DQcRdcUa.js +0 -53
- package/components/clear-button-OFUFFe7G.cjs +0 -18
- package/components/close-button-Cbnb7XXj.cjs +0 -18
- package/components/close-button-CqHYZhum.js +0 -51
- package/components/color-controller-B0uX6Zso.js +0 -3230
- package/components/color-controller-CoUL5f9K.cjs +0 -18
- package/components/color-loupe-CaA_Lfkk.cjs +0 -56
- package/components/color-loupe-CmMsXbjT.js +0 -81
- package/components/condition-attribute-with-id-DrQYZzFS.cjs +0 -18
- package/components/dependency-manger-C5HCkMMB.cjs +0 -18
- package/components/directive-helpers-Cm6gitnu.js +0 -62
- package/components/directive-helpers-DyIRTWwA.cjs +0 -22
- package/components/divider.module-DDvBo9zo.cjs +0 -18
- package/components/divider.module-DoQWQEIJ.js +0 -21
- package/components/element-resolution-BvRLGqIU.cjs +0 -18
- package/components/element-resolution-FCUT-wql.js +0 -91
- package/components/field-group-DXfBWrkO.js +0 -66
- package/components/field-group-DkGst3r5.cjs +0 -23
- package/components/field-label-CZ2zzChK.js +0 -106
- package/components/field-label-mO1AkUgR.cjs +0 -25
- package/components/flow-D-0MTYCm.js +0 -527
- package/components/flow-DM3dNAKs.cjs +0 -30
- package/components/focus-group-DHeTq18L.js +0 -218
- package/components/focus-group-DnxZUBhQ.cjs +0 -18
- package/components/focus-visible-B0P9aY_G.cjs +0 -18
- package/components/focus-visible-DBlJGoEW.js +0 -74
- package/components/focusable-BxtpnzWp.js +0 -153
- package/components/focusable-EbipgXRh.cjs +0 -18
- package/components/focusable-selectors-BgFlyFcY.cjs +0 -18
- package/components/if-defined-C9YGdo33.cjs +0 -22
- package/components/if-defined-DOaE2coe.js +0 -27
- package/components/index-BwxgAdzi.cjs +0 -57
- package/components/index-Cl54m8Yh.js +0 -1490
- package/components/index-HjQa8tew.js +0 -1174
- package/components/index-Wq3qZJGh.cjs +0 -113
- package/components/language-resolution-DJzmyzZq.cjs +0 -18
- package/components/like-anchor-Bvn_vLQ8.js +0 -69
- package/components/like-anchor-sod1C1fR.cjs +0 -32
- package/components/luzmo-icons-4nDFv1Lq.js +0 -229
- package/components/luzmo-icons-D4IvHgVd.cjs +0 -29
- package/components/manage-help-text-DhgARkZX.cjs +0 -30
- package/components/manage-help-text-syYnjKGL.js +0 -92
- package/components/mutation-controller-DH7YOCyj.js +0 -52
- package/components/mutation-controller-DkOMCW-c.cjs +0 -22
- package/components/observe-slot-presence-CmVi0zTc.js +0 -68
- package/components/observe-slot-presence-bc9chhsi.cjs +0 -18
- package/components/observe-slot-text-BPfIQQtz.js +0 -87
- package/components/observe-slot-text-Ceb7SvYT.cjs +0 -18
- package/components/overlay-Cig9r6uU.js +0 -2747
- package/components/overlay-KSKMzzkh.cjs +0 -47
- package/components/pending-state-CaH1si5b.cjs +0 -26
- package/components/picker-BfBP7XJN.js +0 -461
- package/components/picker-xIphqE6d.cjs +0 -123
- package/components/platform-BM-uMWpX.js +0 -69
- package/components/platform-BiXhwqk3.cjs +0 -18
- package/components/popover-DjX0aAnY.js +0 -67
- package/components/popover-KFfO0IYL.cjs +0 -30
- package/components/progress-circle-BvRJNuNo.cjs +0 -33
- package/components/progress-circle-DXH9z8-6.js +0 -97
- package/components/query-BL-TJj7K.cjs +0 -22
- package/components/query-D_KR_GUc.js +0 -51
- package/components/query-assigned-elements-DjfhL1cl.js +0 -36
- package/components/query-assigned-elements-DsKsfk7G.cjs +0 -22
- package/components/query-assigned-nodes-BcKWmGzy.cjs +0 -22
- package/components/query-assigned-nodes-C76XVPWY.js +0 -36
- package/components/random-id-CqvckpWe.cjs +0 -18
- package/components/roving-tabindex-By_fCy_e.cjs +0 -18
- package/components/roving-tabindex-DOg4z6ZU.js +0 -66
- package/components/sized-mixin-CPxE5C96.cjs +0 -18
- package/components/sized-mixin-D4ACoVUr.js +0 -63
- package/components/slottable-request-event-BfUUt1Mh.cjs +0 -18
- package/components/state-D8JEtYqe.cjs +0 -22
- package/components/state-Deh-vKYE.js +0 -29
- package/components/strategies-9indNIEb.js +0 -195
- package/components/strategies-BACP6MhR.cjs +0 -18
- package/components/streaming-listener-B00MvALi.cjs +0 -18
- package/components/streaming-listener-CP-JE6Fa.js +0 -91
- package/components/style-map-CeilmSgs.cjs +0 -22
- package/components/style-map-IgqIKvlE.js +0 -53
- package/components/text-field-CeG75PPO.cjs +0 -85
- package/components/text-field-DCl-AFM-.js +0 -314
- package/components/text-field.module-C2KVUJcX.js +0 -21
- package/components/text-field.module-DXhFA9G-.cjs +0 -18
- package/components/when-CDZyJPvd.cjs +0 -22
|
@@ -15,24 +15,170 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
"use strict";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*/let ot;function et(r){return(t,o)=>Q.e(t,o,{get(){return(this.renderRoot??ot??(ot=document.createDocumentFragment())).querySelectorAll(r)}})}const it='#icon{grid-area:iconArea;align-self:start;height:var(--luzmo-option-icon-container-height, var(--option-icon-container-height));display:flex;align-items:center;justify-content:center;color:var(--highcontrast-option-color-default, var(--luzmo-option-label-icon-color-default, var(--option-label-icon-color-default)))}::slotted([slot=icon]){fill:var(--highcontrast-option-color-default, var(--luzmo-option-label-icon-color-default, var(--option-label-icon-color-default)));margin-inline-end:var(--luzmo-option-label-text-to-visual, var(--option-label-text-to-visual));block-size:var(--luzmo-option-icon-size, var(--option-icon-height));inline-size:var(--luzmo-option-icon-width, var(--option-icon-height));font-size:var(--luzmo-option-icon-size, var(--option-icon-height));text-align:center;--luzmo-icon-vertical-align: 0}:host{cursor:pointer;box-sizing:border-box;background-color:var(--highcontrast-option-background-color-default, var(--luzmo-option-background-color-default, var(--option-background-color-default)));line-height:var(--luzmo-option-label-line-height, var(--option-label-line-height));min-block-size:var(--luzmo-option-min-height, var(--option-min-height));padding-block-start:var(--luzmo-option-top-edge-to-text, var(--option-top-edge-to-text));padding-block-end:var(--luzmo-option-bottom-edge-to-text, var(--option-bottom-edge-to-text));padding-inline:var(--luzmo-option-label-inline-edge-to-content, var(--option-label-inline-edge-to-content));grid-template:". . headingIconArea sectionHeadingArea . ." "selectedArea checkArea iconArea labelArea valueArea actionsArea" 1fr ". . . descriptionArea . ." ". . . . . ."/auto auto auto 1fr auto auto;justify-content:start;margin:0;-webkit-text-decoration:none;text-decoration:none;display:grid;outline:none;align-items:center;position:relative;flex-shrink:0}:host:focus-visible{outline:none}#label{grid-area:submenuItemLabelArea}.checkmark,.checkbox{opacity:1;grid-area:checkArea;align-self:start;display:block}.checkmark{font-size:var(--luzmo-option-checkmark-size, var(--option-checkmark-size));fill:var(--highcontrast-options-checkmark-icon-color-default, var(--luzmo-options-checkmark-icon-color-default, var(--options-checkmark-icon-color-default)));color:var(--highcontrast-options-checkmark-icon-color-default, var(--luzmo-options-checkmark-icon-color-default, var(--options-checkmark-icon-color-default)));margin-block-start:calc(var(--luzmo-option-top-to-checkmark, var(--option-top-to-checkmark)) - var(--luzmo-option-top-edge-to-text, var(--option-top-edge-to-text)));margin-inline-end:var(--luzmo-option-text-to-control, var(--option-label-text-to-control))}.checkbox{font-size:var(--luzmo-option-checkbox-size, var(--option-checkbox-size));fill:var(--highcontrast-options-checkbox-icon-color-default, var(--luzmo-options-checkbox-icon-color-default, var(--options-checkbox-icon-color-default)));color:var(--highcontrast-options-checkbox-icon-color-default, var(--luzmo-options-checkbox-icon-color-default, var(--options-checkbox-icon-color-default)));margin-block-start:calc(var(--luzmo-option-top-to-checkbox, var(--option-top-to-checkbox)) - var(--luzmo-option-top-edge-to-text, var(--option-top-edge-to-text)));margin-inline-end:var(--luzmo-option-text-to-control, var(--option-label-text-to-control))}::slotted([slot=value]){grid-area:submenuItemValueArea}:host([focused]){background-color:var(--highcontrast-option-background-color-focus, var(--luzmo-option-background-color-key-focus, var(--option-background-color-key-focus)));outline:none}:host([focused])>#label,:host(:focus)>#label{color:var(--highcontrast-option-color-focus, var(--luzmo-option-label-content-color-focus, var(--option-label-content-color-focus)))}:host([focused])>[name=description]::slotted(*),:host(:focus)>[name=description]::slotted(*){color:var(--highcontrast-option-color-focus, var(--luzmo-option-description-color-focus, var(--option-description-color-focus)))}:host([focused])>::slotted([slot=value]),:host(:focus)>::slotted([slot=value]){color:var(--highcontrast-option-color-focus, var(--luzmo-option-value-color-focus, var(--option-value-color-focus)))}:host([focused])>.icon:not(.checkmark,.checkbox),:host(:focus)>.icon:not(.checkmark,.checkbox){fill:var(--highcontrast-option-color-focus, var(--luzmo-option-label-icon-color-focus, var(--option-label-icon-color-focus)));color:var(--highcontrast-option-color-focus, var(--luzmo-option-label-icon-color-focus, var(--option-label-icon-color-focus)))}:host([focused])>.checkmark,:host(:focus)>.checkmark{fill:var(--highcontrast-option-color-focus, var(--luzmo-options-checkmark-icon-color-focus, var(--options-checkmark-icon-color-focus)));color:var(--highcontrast-option-color-focus, var(--luzmo-options-checkmark-icon-color-focus, var(--options-checkmark-icon-color-focus)))}:host([focused])>.checkbox,:host(:focus)>.checkbox{fill:var(--highcontrast-option-color-focus, var(--luzmo-options-checkbox-icon-color-focus, var(--options-checkbox-icon-color-focus)));color:var(--highcontrast-option-color-focus, var(--luzmo-options-checkbox-icon-color-focus, var(--options-checkbox-icon-color-focus)))}:host:dir(rtl),:host([dir=rtl]){--option-focus-indicator-direction-scalar: -1}:host(:is(:active,[active])){background-color:var(--highcontrast-option-background-color-focus, var(--luzmo-option-background-color-down, var(--option-background-color-down)))}:host(:is(:active,[active]))>#label{color:var(--highcontrast-option-color-focus, var(--luzmo-option-label-content-color-down, var(--option-label-content-color-down)))}:host(:is(:active,[active]))>[name=description]::slotted(*){color:var(--highcontrast-option-color-focus, var(--luzmo-option-description-color-down, var(--option-description-color-down)))}:host(:is(:active,[active]))>::slotted([slot=value]){color:var(--highcontrast-option-color-focus, var(--luzmo-option-value-color-down, var(--option-value-color-down)))}:host(:is(:active,[active]))>.icon:not(.checkmark,.checkbox){fill:var(--highcontrast-option-color-focus, var(--luzmo-option-label-icon-color-down, var(--option-label-icon-color-down)));color:var(--highcontrast-option-color-focus, var(--luzmo-option-label-icon-color-down, var(--option-label-icon-color-down)))}:host(:is(:active,[active]))>.checkmark{fill:var(--highcontrast-option-color-focus, var(--luzmo-options-checkmark-icon-color-down, var(--options-checkmark-icon-color-down)));color:var(--highcontrast-option-color-focus, var(--luzmo-options-checkmark-icon-color-down, var(--options-checkmark-icon-color-down)))}:host(:is(:active,[active]))>.checkbox{fill:var(--highcontrast-option-color-focus, var(--luzmo-options-checkbox-icon-color-down, var(--options-checkbox-icon-color-down)));color:var(--highcontrast-option-color-focus, var(--luzmo-options-checkbox-icon-color-down, var(--options-checkbox-icon-color-down)))}:host([disabled]),:host([aria-disabled=true]){background-color:initial}:host([disabled]) #label,:host([disabled]) ::slotted([slot=value]),:host([aria-disabled=true]) #label,:host([aria-disabled=true]) ::slotted([slot=value]){color:var(--highcontrast-option-color-disabled, var(--luzmo-option-label-content-color-disabled, var(--option-label-content-color-disabled)))}:host([disabled]) [name=description]::slotted(*),:host([aria-disabled=true]) [name=description]::slotted(*){color:var(--highcontrast-option-color-disabled, var(--luzmo-option-description-color-disabled, var(--option-description-color-disabled)))}:host([disabled]) ::slotted([slot=icon]),:host([aria-disabled=true]) ::slotted([slot=icon]){color:var(--highcontrast-option-color-disabled, var(--luzmo-option-label-icon-color-disabled, var(--option-label-icon-color-disabled)));fill:var(--highcontrast-option-color-disabled, var(--luzmo-option-label-icon-color-disabled, var(--option-label-icon-color-disabled)))}:host([focused]){box-shadow:inset calc(var(--luzmo-option-focus-indicator-width, var(--option-focus-indicator-width)) * 1) 0 0 0 var(--highcontrast-option-focus-indicator-color, var(--luzmo-option-focus-indicator-color, var(--option-focus-indicator-color)));box-shadow:inset calc(var(--luzmo-option-focus-indicator-width, var(--option-focus-indicator-width)) * var(--option-focus-indicator-direction-scalar, 1)) 0 0 0 var(--highcontrast-option-focus-indicator-color, var(--luzmo-option-focus-indicator-color, var(--option-focus-indicator-color)))}#label{font-size:var(--luzmo-option-label-font-size, var(--option-label-font-size));color:var(--highcontrast-option-color-default, var(--luzmo-option-label-content-color-default, var(--option-label-content-color-default)));-webkit-hyphens:auto;hyphens:auto;overflow-wrap:break-word;grid-area:labelArea}:host([variant=highlight][selected]){background-color:var(--luzmo-option-highlight-selected-label-background-color, var(--option-highlight-selected-label-background-color))}:host([variant=highlight][selected]) #label{color:var(--luzmo-option-highlight-selected-label-content-color, var(--option-highlight-selected-label-content-color))}:host([variant=highlight][selected]):hover #label{color:var(--luzmo-option-highlight-selected-label-content-color-hover, var(--option-highlight-selected-label-content-color-hover))}:host([variant=highlight][selected]):active #label{color:var(--luzmo-option-highlight-selected-label-content-color-down, var(--option-highlight-selected-label-content-color-down))}:host([variant=highlight][selected]):focus #label{color:var(--luzmo-option-highlight-selected-label-content-color-focus, var(--option-highlight-selected-label-content-color-focus))}:host([variant=highlight][selected]) ::slotted([slot=icon]){color:var(--highcontrast-option-color-disabled, var(--luzmo-option-highlight-selected-label-content-color, var(--option-highlight-selected-label-content-color)));fill:var(--highcontrast-option-color-disabled, var(--luzmo-option-highlight-selected-label-content-color, var(--option-highlight-selected-label-content-color)))}::slotted([slot=value]){color:var(--highcontrast-option-color-default, var(--luzmo-option-value-color-default, var(--option-value-color-default)));font-size:var(--luzmo-option-label-font-size, var(--option-label-font-size));grid-area:valueArea;justify-self:end}[name=description]::slotted(*){color:var(--highcontrast-option-color-default, var(--luzmo-option-description-color-default, var(--option-description-color-default)));font-size:var(--luzmo-option-description-font-size, var(--option-description-font-size));-webkit-hyphens:auto;hyphens:auto;overflow-wrap:break-word;line-height:var(--luzmo-option-description-line-height, var(--option-description-line-height));grid-area:descriptionArea;margin-block-start:var(--luzmo-option-label-to-description-spacing, var(--option-label-to-description-spacing))}:host([no-wrap]) #label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}@media (hover: hover){:host(:hover){background-color:var(--highcontrast-option-background-color-focus, var(--luzmo-option-background-color-hover, var(--option-background-color-hover)))}:host(:hover)>#label{color:var(--highcontrast-option-color-focus, var(--luzmo-option-label-content-color-hover, var(--option-label-content-color-hover)))}:host([variant=highlight][selected]:hover)>#label{color:var(--luzmo-option-highlight-selected-label-content-color-hover, var(--option-highlight-selected-label-content-color-hover))}:host(:hover)>[name=description]::slotted(*){color:var(--highcontrast-option-color-focus, var(--luzmo-option-description-color-hover, var(--option-description-color-hover)))}:host(:hover)>::slotted([slot=value]){color:var(--highcontrast-option-color-focus, var(--luzmo-option-value-color-hover, var(--option-value-color-hover)))}:host(:hover)>.icon:not(.checkmark,.checkbox){fill:var(--highcontrast-option-color-focus, var(--luzmo-option-label-icon-color-hover, var(--option-label-icon-color-hover)));color:var(--highcontrast-option-color-focus, var(--luzmo-option-label-icon-color-hover, var(--option-label-icon-color-hover)))}:host([variant=highlight][selected]:hover)>.icon:not(.checkmark,.checkbox){fill:var(--luzmo-option-highlight-selected-label-icon-color-hover, var(--option-highlight-selected-label-icon-color-hover))}:host(:hover)>.checkmark{fill:var(--highcontrast-option-color-focus, var(--luzmo-options-checkmark-icon-color-hover, var(--options-checkmark-icon-color-hover)));color:var(--highcontrast-option-color-focus, var(--luzmo-options-checkmark-icon-color-hover, var(--options-checkmark-icon-color-hover)))}:host(:hover)>.checkbox{fill:var(--highcontrast-option-color-focus, var(--luzmo-options-checkbox-icon-color-hover, var(--options-checkbox-icon-color-hover)));color:var(--highcontrast-option-color-focus, var(--luzmo-options-checkbox-icon-color-hover, var(--options-checkbox-icon-color-hover)))}:host([disabled]:hover),:host([aria-disabled=true]:hover){cursor:default;background-color:initial}:host([disabled]:hover) #label,:host([disabled]:hover) ::slotted([slot=value]),:host([aria-disabled=true]:hover) #label,:host([aria-disabled=true]:hover) ::slotted([slot=value]){color:var(--highcontrast-option-color-disabled, var(--luzmo-option-label-content-color-disabled, var(--option-label-content-color-disabled)))}:host([disabled]:hover) [name=description]::slotted(*),:host([aria-disabled=true]:hover) [name=description]::slotted(*){color:var(--highcontrast-option-color-disabled, var(--luzmo-option-description-color-disabled, var(--option-description-color-disabled)))}:host([disabled]:hover) ::slotted([slot=icon]),:host([aria-disabled=true]:hover) ::slotted([slot=icon]){color:var(--highcontrast-option-color-disabled, var(--luzmo-option-label-icon-color-disabled, var(--option-label-icon-color-disabled)));fill:var(--highcontrast-option-color-disabled, var(--luzmo-option-label-icon-color-disabled, var(--option-label-icon-color-disabled)))}}:host([emphasized]){--options-checkmark-icon-color-default: var(--luzmo-primary);--options-checkmark-icon-color-hover: var(--luzmo-primary-hover);--options-checkmark-icon-color-down: var(--luzmo-primary-down);--options-checkmark-icon-color-focus: var(--luzmo-primary-focus);--options-checkbox-icon-color-default: var(--luzmo-primary);--options-checkbox-icon-color-hover: var(--luzmo-primary-hover);--options-checkbox-icon-color-down: var(--luzmo-primary-down);--options-checkbox-icon-color-focus: var(--luzmo-primary-focus)}:host{text-align:initial;font-family:var(--luzmo-option-font-family, var(--luzmo-font-family))}:host([hidden]){display:none}:host([disabled]){pointer-events:none}:host([disabled]) [name=value]::slotted(*){color:var(--luzmo-option-label-icon-color-disabled, var(--luzmo-disabled-color))}#button{position:absolute;top:0;right:0;bottom:0;left:0}.icon-container>svg{vertical-align:top}:host([dir=ltr]) [icon-only]::slotted(:last-of-type){margin-right:auto}:host([dir=rtl]) [icon-only]::slotted(:last-of-type){margin-left:auto}@media (forced-colors: active){:host{forced-color-adjust:none}}:host([no-wrap]) #label{display:block}';var nt=Object.defineProperty,lt=Object.getOwnPropertyDescriptor,z=(r,t,o,e)=>{for(var i=e>1?void 0:e?lt(t,o):t,n=r.length-1,s;n>=0;n--)(s=r[n])&&(i=(e?s(t,o,i):s(i))||i);return e&&i&&nt(t,o,i),i};const rt=r=>a.x`
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
"use strict";
|
|
19
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
20
|
+
const mutationController_js = require("@lit-labs/observers/mutation-controller.js");
|
|
21
|
+
const lit = require("lit");
|
|
22
|
+
const decorators_js = require("lit/decorators.js");
|
|
23
|
+
const focusable = require("../focusable-BPrTcZPd.cjs");
|
|
24
|
+
const likeAnchor = require("../like-anchor-D62faRNG.cjs");
|
|
25
|
+
const observeSlotPresence = require("../observe-slot-presence-9AwLGUQ_.cjs");
|
|
26
|
+
const observeSlotText = require("../observe-slot-text-CSofZeeF.cjs");
|
|
27
|
+
const randomId = require("../random-id-BE6HA503.cjs");
|
|
28
|
+
const icons = require("@luzmo/icons");
|
|
29
|
+
require("@lit-labs/virtualizer");
|
|
30
|
+
const repeat_js = require("lit/directives/repeat.js");
|
|
31
|
+
const base = require("../base-COw9n7UR.cjs");
|
|
32
|
+
const sizedMixin = require("../sized-mixin-UaTVa-AE.cjs");
|
|
33
|
+
require("../progress-circle/index.cjs");
|
|
34
|
+
const divider_module = require("../divider.module-Cm5LcDRV.cjs");
|
|
35
|
+
const menuItemStyles = '#icon{grid-area:iconArea;align-self:start;height:var(--luzmo-option-icon-container-height, var(--option-icon-container-height));display:flex;align-items:center;justify-content:center;color:var(--highcontrast-option-color-default, var(--luzmo-option-label-icon-color-default, var(--option-label-icon-color-default)))}::slotted([slot=icon]){fill:var(--highcontrast-option-color-default, var(--luzmo-option-label-icon-color-default, var(--option-label-icon-color-default)));margin-inline-end:var(--luzmo-option-label-text-to-visual, var(--option-label-text-to-visual));block-size:var(--luzmo-option-icon-size, var(--option-icon-height));inline-size:var(--luzmo-option-icon-width, var(--option-icon-height));font-size:var(--luzmo-option-icon-size, var(--option-icon-height));text-align:center;--luzmo-icon-vertical-align: 0}:host{cursor:pointer;box-sizing:border-box;background-color:var(--highcontrast-option-background-color-default, var(--luzmo-option-background-color-default, var(--option-background-color-default)));line-height:var(--luzmo-option-label-line-height, var(--option-label-line-height));min-block-size:var(--luzmo-option-min-height, var(--option-min-height));padding-block-start:var(--luzmo-option-top-edge-to-text, var(--option-top-edge-to-text));padding-block-end:var(--luzmo-option-bottom-edge-to-text, var(--option-bottom-edge-to-text));padding-inline:var(--luzmo-option-label-inline-edge-to-content, var(--option-label-inline-edge-to-content));grid-template:". . headingIconArea sectionHeadingArea . ." "selectedArea checkArea iconArea labelArea valueArea actionsArea" 1fr ". . . descriptionArea . ." ". . . . . ."/auto auto auto 1fr auto auto;justify-content:start;margin:0;-webkit-text-decoration:none;text-decoration:none;display:grid;outline:none;align-items:center;position:relative;flex-shrink:0}:host:focus-visible{outline:none}#label{grid-area:submenuItemLabelArea}.checkmark,.checkbox{opacity:1;grid-area:checkArea;align-self:start;display:block}.checkmark{font-size:var(--luzmo-option-checkmark-size, var(--option-checkmark-size));fill:var(--highcontrast-options-checkmark-icon-color-default, var(--luzmo-options-checkmark-icon-color-default, var(--options-checkmark-icon-color-default)));color:var(--highcontrast-options-checkmark-icon-color-default, var(--luzmo-options-checkmark-icon-color-default, var(--options-checkmark-icon-color-default)));margin-block-start:calc(var(--luzmo-option-top-to-checkmark, var(--option-top-to-checkmark)) - var(--luzmo-option-top-edge-to-text, var(--option-top-edge-to-text)));margin-inline-end:var(--luzmo-option-text-to-control, var(--option-label-text-to-control))}.checkbox{font-size:var(--luzmo-option-checkbox-size, var(--option-checkbox-size));fill:var(--highcontrast-options-checkbox-icon-color-default, var(--luzmo-options-checkbox-icon-color-default, var(--options-checkbox-icon-color-default)));color:var(--highcontrast-options-checkbox-icon-color-default, var(--luzmo-options-checkbox-icon-color-default, var(--options-checkbox-icon-color-default)));margin-block-start:calc(var(--luzmo-option-top-to-checkbox, var(--option-top-to-checkbox)) - var(--luzmo-option-top-edge-to-text, var(--option-top-edge-to-text)));margin-inline-end:var(--luzmo-option-text-to-control, var(--option-label-text-to-control))}::slotted([slot=value]){grid-area:submenuItemValueArea}:host([focused]){background-color:var(--highcontrast-option-background-color-focus, var(--luzmo-option-background-color-key-focus, var(--option-background-color-key-focus)));outline:none}:host([focused])>#label,:host(:focus)>#label{color:var(--highcontrast-option-color-focus, var(--luzmo-option-label-content-color-focus, var(--option-label-content-color-focus)))}:host([focused])>[name=description]::slotted(*),:host(:focus)>[name=description]::slotted(*){color:var(--highcontrast-option-color-focus, var(--luzmo-option-description-color-focus, var(--option-description-color-focus)))}:host([focused])>::slotted([slot=value]),:host(:focus)>::slotted([slot=value]){color:var(--highcontrast-option-color-focus, var(--luzmo-option-value-color-focus, var(--option-value-color-focus)))}:host([focused])>.icon:not(.checkmark,.checkbox),:host(:focus)>.icon:not(.checkmark,.checkbox){fill:var(--highcontrast-option-color-focus, var(--luzmo-option-label-icon-color-focus, var(--option-label-icon-color-focus)));color:var(--highcontrast-option-color-focus, var(--luzmo-option-label-icon-color-focus, var(--option-label-icon-color-focus)))}:host([focused])>.checkmark,:host(:focus)>.checkmark{fill:var(--highcontrast-option-color-focus, var(--luzmo-options-checkmark-icon-color-focus, var(--options-checkmark-icon-color-focus)));color:var(--highcontrast-option-color-focus, var(--luzmo-options-checkmark-icon-color-focus, var(--options-checkmark-icon-color-focus)))}:host([focused])>.checkbox,:host(:focus)>.checkbox{fill:var(--highcontrast-option-color-focus, var(--luzmo-options-checkbox-icon-color-focus, var(--options-checkbox-icon-color-focus)));color:var(--highcontrast-option-color-focus, var(--luzmo-options-checkbox-icon-color-focus, var(--options-checkbox-icon-color-focus)))}:host:dir(rtl),:host([dir=rtl]){--option-focus-indicator-direction-scalar: -1}:host(:is(:active,[active])){background-color:var(--highcontrast-option-background-color-focus, var(--luzmo-option-background-color-down, var(--option-background-color-down)))}:host(:is(:active,[active]))>#label{color:var(--highcontrast-option-color-focus, var(--luzmo-option-label-content-color-down, var(--option-label-content-color-down)))}:host(:is(:active,[active]))>[name=description]::slotted(*){color:var(--highcontrast-option-color-focus, var(--luzmo-option-description-color-down, var(--option-description-color-down)))}:host(:is(:active,[active]))>::slotted([slot=value]){color:var(--highcontrast-option-color-focus, var(--luzmo-option-value-color-down, var(--option-value-color-down)))}:host(:is(:active,[active]))>.icon:not(.checkmark,.checkbox){fill:var(--highcontrast-option-color-focus, var(--luzmo-option-label-icon-color-down, var(--option-label-icon-color-down)));color:var(--highcontrast-option-color-focus, var(--luzmo-option-label-icon-color-down, var(--option-label-icon-color-down)))}:host(:is(:active,[active]))>.checkmark{fill:var(--highcontrast-option-color-focus, var(--luzmo-options-checkmark-icon-color-down, var(--options-checkmark-icon-color-down)));color:var(--highcontrast-option-color-focus, var(--luzmo-options-checkmark-icon-color-down, var(--options-checkmark-icon-color-down)))}:host(:is(:active,[active]))>.checkbox{fill:var(--highcontrast-option-color-focus, var(--luzmo-options-checkbox-icon-color-down, var(--options-checkbox-icon-color-down)));color:var(--highcontrast-option-color-focus, var(--luzmo-options-checkbox-icon-color-down, var(--options-checkbox-icon-color-down)))}:host([disabled]),:host([aria-disabled=true]){background-color:initial}:host([disabled]) #label,:host([disabled]) ::slotted([slot=value]),:host([aria-disabled=true]) #label,:host([aria-disabled=true]) ::slotted([slot=value]){color:var(--highcontrast-option-color-disabled, var(--luzmo-option-label-content-color-disabled, var(--option-label-content-color-disabled)))}:host([disabled]) [name=description]::slotted(*),:host([aria-disabled=true]) [name=description]::slotted(*){color:var(--highcontrast-option-color-disabled, var(--luzmo-option-description-color-disabled, var(--option-description-color-disabled)))}:host([disabled]) ::slotted([slot=icon]),:host([aria-disabled=true]) ::slotted([slot=icon]){color:var(--highcontrast-option-color-disabled, var(--luzmo-option-label-icon-color-disabled, var(--option-label-icon-color-disabled)));fill:var(--highcontrast-option-color-disabled, var(--luzmo-option-label-icon-color-disabled, var(--option-label-icon-color-disabled)))}:host([focused]){box-shadow:inset calc(var(--luzmo-option-focus-indicator-width, var(--option-focus-indicator-width)) * 1) 0 0 0 var(--highcontrast-option-focus-indicator-color, var(--luzmo-option-focus-indicator-color, var(--option-focus-indicator-color)));box-shadow:inset calc(var(--luzmo-option-focus-indicator-width, var(--option-focus-indicator-width)) * var(--option-focus-indicator-direction-scalar, 1)) 0 0 0 var(--highcontrast-option-focus-indicator-color, var(--luzmo-option-focus-indicator-color, var(--option-focus-indicator-color)))}#label{font-size:var(--luzmo-option-label-font-size, var(--option-label-font-size));color:var(--highcontrast-option-color-default, var(--luzmo-option-label-content-color-default, var(--option-label-content-color-default)));-webkit-hyphens:auto;hyphens:auto;overflow-wrap:break-word;grid-area:labelArea}:host([variant=highlight][selected]){background-color:var(--luzmo-option-highlight-selected-label-background-color, var(--option-highlight-selected-label-background-color))}:host([variant=highlight][selected]) #label{color:var(--luzmo-option-highlight-selected-label-content-color, var(--option-highlight-selected-label-content-color))}:host([variant=highlight][selected]):hover #label{color:var(--luzmo-option-highlight-selected-label-content-color-hover, var(--option-highlight-selected-label-content-color-hover))}:host([variant=highlight][selected]):active #label{color:var(--luzmo-option-highlight-selected-label-content-color-down, var(--option-highlight-selected-label-content-color-down))}:host([variant=highlight][selected]):focus #label{color:var(--luzmo-option-highlight-selected-label-content-color-focus, var(--option-highlight-selected-label-content-color-focus))}:host([variant=highlight][selected]) ::slotted([slot=icon]){color:var(--highcontrast-option-color-disabled, var(--luzmo-option-highlight-selected-label-content-color, var(--option-highlight-selected-label-content-color)));fill:var(--highcontrast-option-color-disabled, var(--luzmo-option-highlight-selected-label-content-color, var(--option-highlight-selected-label-content-color)))}::slotted([slot=value]){color:var(--highcontrast-option-color-default, var(--luzmo-option-value-color-default, var(--option-value-color-default)));font-size:var(--luzmo-option-label-font-size, var(--option-label-font-size));grid-area:valueArea;justify-self:end}[name=description]::slotted(*){color:var(--highcontrast-option-color-default, var(--luzmo-option-description-color-default, var(--option-description-color-default)));font-size:var(--luzmo-option-description-font-size, var(--option-description-font-size));-webkit-hyphens:auto;hyphens:auto;overflow-wrap:break-word;line-height:var(--luzmo-option-description-line-height, var(--option-description-line-height));grid-area:descriptionArea;margin-block-start:var(--luzmo-option-label-to-description-spacing, var(--option-label-to-description-spacing))}:host([no-wrap]) #label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}@media (hover: hover){:host(:hover){background-color:var(--highcontrast-option-background-color-focus, var(--luzmo-option-background-color-hover, var(--option-background-color-hover)))}:host(:hover)>#label{color:var(--highcontrast-option-color-focus, var(--luzmo-option-label-content-color-hover, var(--option-label-content-color-hover)))}:host([variant=highlight][selected]:hover)>#label{color:var(--luzmo-option-highlight-selected-label-content-color-hover, var(--option-highlight-selected-label-content-color-hover))}:host(:hover)>[name=description]::slotted(*){color:var(--highcontrast-option-color-focus, var(--luzmo-option-description-color-hover, var(--option-description-color-hover)))}:host(:hover)>::slotted([slot=value]){color:var(--highcontrast-option-color-focus, var(--luzmo-option-value-color-hover, var(--option-value-color-hover)))}:host(:hover)>.icon:not(.checkmark,.checkbox){fill:var(--highcontrast-option-color-focus, var(--luzmo-option-label-icon-color-hover, var(--option-label-icon-color-hover)));color:var(--highcontrast-option-color-focus, var(--luzmo-option-label-icon-color-hover, var(--option-label-icon-color-hover)))}:host([variant=highlight][selected]:hover)>.icon:not(.checkmark,.checkbox){fill:var(--luzmo-option-highlight-selected-label-icon-color-hover, var(--option-highlight-selected-label-icon-color-hover))}:host(:hover)>.checkmark{fill:var(--highcontrast-option-color-focus, var(--luzmo-options-checkmark-icon-color-hover, var(--options-checkmark-icon-color-hover)));color:var(--highcontrast-option-color-focus, var(--luzmo-options-checkmark-icon-color-hover, var(--options-checkmark-icon-color-hover)))}:host(:hover)>.checkbox{fill:var(--highcontrast-option-color-focus, var(--luzmo-options-checkbox-icon-color-hover, var(--options-checkbox-icon-color-hover)));color:var(--highcontrast-option-color-focus, var(--luzmo-options-checkbox-icon-color-hover, var(--options-checkbox-icon-color-hover)))}:host([disabled]:hover),:host([aria-disabled=true]:hover){cursor:default;background-color:initial}:host([disabled]:hover) #label,:host([disabled]:hover) ::slotted([slot=value]),:host([aria-disabled=true]:hover) #label,:host([aria-disabled=true]:hover) ::slotted([slot=value]){color:var(--highcontrast-option-color-disabled, var(--luzmo-option-label-content-color-disabled, var(--option-label-content-color-disabled)))}:host([disabled]:hover) [name=description]::slotted(*),:host([aria-disabled=true]:hover) [name=description]::slotted(*){color:var(--highcontrast-option-color-disabled, var(--luzmo-option-description-color-disabled, var(--option-description-color-disabled)))}:host([disabled]:hover) ::slotted([slot=icon]),:host([aria-disabled=true]:hover) ::slotted([slot=icon]){color:var(--highcontrast-option-color-disabled, var(--luzmo-option-label-icon-color-disabled, var(--option-label-icon-color-disabled)));fill:var(--highcontrast-option-color-disabled, var(--luzmo-option-label-icon-color-disabled, var(--option-label-icon-color-disabled)))}}:host([emphasized]){--options-checkmark-icon-color-default: var(--luzmo-primary);--options-checkmark-icon-color-hover: var(--luzmo-primary-hover);--options-checkmark-icon-color-down: var(--luzmo-primary-down);--options-checkmark-icon-color-focus: var(--luzmo-primary-focus);--options-checkbox-icon-color-default: var(--luzmo-primary);--options-checkbox-icon-color-hover: var(--luzmo-primary-hover);--options-checkbox-icon-color-down: var(--luzmo-primary-down);--options-checkbox-icon-color-focus: var(--luzmo-primary-focus)}:host{text-align:initial;font-family:var(--luzmo-option-font-family, var(--luzmo-font-family))}:host([hidden]){display:none}:host([disabled]){pointer-events:none}:host([disabled]) [name=value]::slotted(*){color:var(--luzmo-option-label-icon-color-disabled, var(--luzmo-disabled-color))}#button{position:absolute;top:0;right:0;bottom:0;left:0}.icon-container>svg{vertical-align:top}:host([dir=ltr]) [icon-only]::slotted(:last-of-type){margin-right:auto}:host([dir=rtl]) [icon-only]::slotted(:last-of-type){margin-left:auto}@media (forced-colors: active){:host{forced-color-adjust:none}}:host([no-wrap]) #label{display:block}';
|
|
36
|
+
var __defProp$1 = Object.defineProperty;
|
|
37
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
38
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
39
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
40
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
41
|
+
if (decorator = decorators[i])
|
|
42
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
43
|
+
if (kind && result) __defProp$1(target, key, result);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
const checkIcon = (classes) => lit.html`
|
|
47
|
+
<span class="icon-container icon checkmark ${classes.join(" ")}">
|
|
48
|
+
${icons.luzmoIcon(icons.luzmoCheck)}
|
|
25
49
|
</span>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
50
|
+
`;
|
|
51
|
+
const checkboxIcon = (classes) => lit.html`
|
|
52
|
+
<span class="icon-container icon checkbox ${classes.join(" ")}">
|
|
53
|
+
${icons.luzmoIcon(icons.luzmoCheckbox)}
|
|
29
54
|
</span>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
55
|
+
`;
|
|
56
|
+
const checkboxCheckedIcon = (classes) => lit.html`
|
|
57
|
+
<span class="icon-container icon checkbox ${classes.join(" ")}">
|
|
58
|
+
${icons.luzmoIcon(icons.luzmoCheckboxChecked)}
|
|
33
59
|
</span>
|
|
34
|
-
`;
|
|
35
|
-
|
|
60
|
+
`;
|
|
61
|
+
class LuzmoOption extends likeAnchor.LikeAnchor(
|
|
62
|
+
observeSlotText.ObserveSlotText(observeSlotPresence.ObserveSlotPresence(focusable.Focusable, '[slot="icon"]'))
|
|
63
|
+
) {
|
|
64
|
+
constructor() {
|
|
65
|
+
super();
|
|
66
|
+
this.active = false;
|
|
67
|
+
this.focused = false;
|
|
68
|
+
this.selected = false;
|
|
69
|
+
this.emphasized = false;
|
|
70
|
+
this.variant = "checkmarks";
|
|
71
|
+
this._value = "";
|
|
72
|
+
this.noWrap = false;
|
|
73
|
+
this.renderCheckIcon = (selected, hasIcon) => {
|
|
74
|
+
const classes = hasIcon ? ["check-icon--with-adjacent-icon"] : [];
|
|
75
|
+
if (this.variant === "checkboxes") {
|
|
76
|
+
return selected ? checkboxCheckedIcon(classes) : checkboxIcon(classes);
|
|
77
|
+
}
|
|
78
|
+
return selected && this.variant !== "highlight" ? checkIcon(classes) : lit.html``;
|
|
79
|
+
};
|
|
80
|
+
this.proxyFocus = () => {
|
|
81
|
+
this.focus();
|
|
82
|
+
};
|
|
83
|
+
this.willDispatchUpdate = false;
|
|
84
|
+
this.addEventListener("click", this.handleClickCapture, {
|
|
85
|
+
capture: true
|
|
86
|
+
});
|
|
87
|
+
new mutationController_js.MutationController(this, {
|
|
88
|
+
config: {
|
|
89
|
+
characterData: true,
|
|
90
|
+
childList: true,
|
|
91
|
+
subtree: true
|
|
92
|
+
},
|
|
93
|
+
callback: () => {
|
|
94
|
+
this.breakItemChildrenCache();
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
static get styles() {
|
|
99
|
+
return [lit.unsafeCSS(menuItemStyles)];
|
|
100
|
+
}
|
|
101
|
+
get value() {
|
|
102
|
+
return this._value || this.itemText;
|
|
103
|
+
}
|
|
104
|
+
set value(value) {
|
|
105
|
+
if (value === this._value) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
this._value = value || "";
|
|
109
|
+
if (this._value) {
|
|
110
|
+
this.setAttribute("value", this._value);
|
|
111
|
+
} else {
|
|
112
|
+
this.removeAttribute("value");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* @private
|
|
117
|
+
*/
|
|
118
|
+
get itemText() {
|
|
119
|
+
return this.itemChildren.content.reduce(
|
|
120
|
+
(acc, node) => acc + (node.textContent || "").trim(),
|
|
121
|
+
""
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
get focusElement() {
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
127
|
+
get hasIcon() {
|
|
128
|
+
return this.slotContentIsPresent;
|
|
129
|
+
}
|
|
130
|
+
get itemChildren() {
|
|
131
|
+
if (!this.iconSlot || !this.contentSlot) {
|
|
132
|
+
return {
|
|
133
|
+
icon: [],
|
|
134
|
+
content: []
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
if (this._itemChildren) {
|
|
138
|
+
return this._itemChildren;
|
|
139
|
+
}
|
|
140
|
+
const icon = this.iconSlot.assignedElements().map((element) => {
|
|
141
|
+
const newElement = element.cloneNode(true);
|
|
142
|
+
newElement.removeAttribute("slot");
|
|
143
|
+
newElement.classList.toggle("icon");
|
|
144
|
+
return newElement;
|
|
145
|
+
});
|
|
146
|
+
const content = this.contentSlot.assignedNodes().map((node) => node.cloneNode(true));
|
|
147
|
+
this._itemChildren = { icon, content };
|
|
148
|
+
return this._itemChildren;
|
|
149
|
+
}
|
|
150
|
+
click() {
|
|
151
|
+
if (this.disabled) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (this.shouldProxyClick()) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
super.click();
|
|
158
|
+
}
|
|
159
|
+
handleClickCapture(event) {
|
|
160
|
+
if (this.disabled) {
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
event.stopImmediatePropagation();
|
|
163
|
+
event.stopPropagation();
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
shouldProxyClick() {
|
|
168
|
+
let handled = false;
|
|
169
|
+
if (this.anchorElement) {
|
|
170
|
+
this.anchorElement.click();
|
|
171
|
+
handled = true;
|
|
172
|
+
}
|
|
173
|
+
return handled;
|
|
174
|
+
}
|
|
175
|
+
breakItemChildrenCache() {
|
|
176
|
+
this._itemChildren = void 0;
|
|
177
|
+
this.triggerUpdate();
|
|
178
|
+
}
|
|
179
|
+
render() {
|
|
180
|
+
return lit.html`
|
|
181
|
+
${this.renderCheckIcon(this.selected, this.hasIcon)}
|
|
36
182
|
<div id="icon">
|
|
37
183
|
<slot name="icon"></slot>
|
|
38
184
|
</div>
|
|
@@ -41,61 +187,548 @@
|
|
|
41
187
|
</div>
|
|
42
188
|
<slot name="description"></slot>
|
|
43
189
|
<slot name="value"></slot>
|
|
44
|
-
${this.href&&this.href.length>0?super.renderAnchor({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
*/let $=typeof window<"u"?window.ResizeObserver:void 0;const R=Symbol("virtualizerRef"),I="virtualizer-sizer";let B;class ut{constructor(t){if(this._benchmarkStart=null,this._layout=null,this._clippingAncestors=[],this._scrollSize=null,this._scrollError=null,this._childrenPos=null,this._childMeasurements=null,this._toBeMeasured=new Map,this._rangeChanged=!0,this._itemsChanged=!0,this._visibilityChanged=!0,this._scrollerController=null,this._isScroller=!1,this._sizer=null,this._hostElementRO=null,this._childrenRO=null,this._mutationObserver=null,this._scrollEventListeners=[],this._scrollEventListenerOptions={passive:!0},this._loadListener=this._childLoaded.bind(this),this._scrollIntoViewTarget=null,this._updateScrollIntoViewCoordinates=null,this._items=[],this._first=-1,this._last=-1,this._firstVisible=-1,this._lastVisible=-1,this._scheduled=new WeakSet,this._measureCallback=null,this._measureChildOverride=null,this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null,this._layoutInitialized=null,this._connected=!1,!t)throw new Error("Virtualizer constructor requires a configuration object");if(t.hostElement)this._init(t);else throw new Error('Virtualizer configuration requires the "hostElement" property')}set items(t){Array.isArray(t)&&t!==this._items&&(this._itemsChanged=!0,this._items=t,this._schedule(this._updateLayout))}_init(t){this._isScroller=!!t.scroller,this._initHostElement(t);const o=t.layout||{};this._layoutInitialized=this._initLayout(o)}_initObservers(){this._mutationObserver=new MutationObserver(this._finishDOMUpdate.bind(this)),this._hostElementRO=new $(()=>this._hostElementSizeChanged()),this._childrenRO=new $(this._childrenSizeChanged.bind(this))}_initHostElement(t){const o=this._hostElement=t.hostElement;this._applyVirtualizerStyles(),o[R]=this}connected(){this._initObservers();const t=this._isScroller;this._clippingAncestors=vt(this._hostElement,t),this._scrollerController=new ht(this,this._clippingAncestors[0]),this._schedule(this._updateLayout),this._observeAndListen(),this._connected=!0}_observeAndListen(){this._mutationObserver.observe(this._hostElement,{childList:!0}),this._hostElementRO.observe(this._hostElement),this._scrollEventListeners.push(window),window.addEventListener("scroll",this,this._scrollEventListenerOptions),this._clippingAncestors.forEach(t=>{t.addEventListener("scroll",this,this._scrollEventListenerOptions),this._scrollEventListeners.push(t),this._hostElementRO.observe(t)}),this._hostElementRO.observe(this._scrollerController.element),this._children.forEach(t=>this._childrenRO.observe(t)),this._scrollEventListeners.forEach(t=>t.addEventListener("scroll",this,this._scrollEventListenerOptions))}disconnected(){var t,o,e,i;this._scrollEventListeners.forEach(n=>n.removeEventListener("scroll",this,this._scrollEventListenerOptions)),this._scrollEventListeners=[],this._clippingAncestors=[],(t=this._scrollerController)==null||t.detach(this),this._scrollerController=null,(o=this._mutationObserver)==null||o.disconnect(),this._mutationObserver=null,(e=this._hostElementRO)==null||e.disconnect(),this._hostElementRO=null,(i=this._childrenRO)==null||i.disconnect(),this._childrenRO=null,this._rejectLayoutCompletePromise("disconnected"),this._connected=!1}_applyVirtualizerStyles(){const o=this._hostElement.style;o.display=o.display||"block",o.position=o.position||"relative",o.contain=o.contain||"size layout",this._isScroller&&(o.overflow=o.overflow||"auto",o.minHeight=o.minHeight||"150px")}_getSizer(){const t=this._hostElement;if(!this._sizer){let o=t.querySelector(`[${I}]`);o||(o=document.createElement("div"),o.setAttribute(I,""),t.appendChild(o)),Object.assign(o.style,{position:"absolute",margin:"-2px 0 0 0",padding:0,visibility:"hidden",fontSize:"2px"}),o.textContent=" ",o.setAttribute(I,""),this._sizer=o}return this._sizer}async updateLayoutConfig(t){await this._layoutInitialized;const o=t.type||B;if(typeof o=="function"&&this._layout instanceof o){const e={...t};return delete e.type,this._layout.config=e,!0}return!1}async _initLayout(t){let o,e;if(typeof t.type=="function"){e=t.type;const i={...t};delete i.type,o=i}else o=t;e===void 0&&(B=e=(await Promise.resolve().then(()=>require("../flow-DM3dNAKs.cjs"))).FlowLayout),this._layout=new e(i=>this._handleLayoutMessage(i),o),this._layout.measureChildren&&typeof this._layout.updateItemSizes=="function"&&(typeof this._layout.measureChildren=="function"&&(this._measureChildOverride=this._layout.measureChildren),this._measureCallback=this._layout.updateItemSizes.bind(this._layout)),this._layout.listenForChildLoadEvents&&this._hostElement.addEventListener("load",this._loadListener,!0),this._schedule(this._updateLayout)}startBenchmarking(){this._benchmarkStart===null&&(this._benchmarkStart=window.performance.now())}stopBenchmarking(){if(this._benchmarkStart!==null){const t=window.performance.now(),o=t-this._benchmarkStart,i=performance.getEntriesByName("uv-virtualizing","measure").filter(n=>n.startTime>=this._benchmarkStart&&n.startTime<t).reduce((n,s)=>n+s.duration,0);return this._benchmarkStart=null,{timeElapsed:o,virtualizationTime:i}}return null}_measureChildren(){const t={},o=this._children,e=this._measureChildOverride||this._measureChild;for(let i=0;i<o.length;i++){const n=o[i],s=this._first+i;(this._itemsChanged||this._toBeMeasured.has(n))&&(t[s]=e.call(this,n,this._items[s]))}this._childMeasurements=t,this._schedule(this._updateLayout),this._toBeMeasured.clear()}_measureChild(t){const{width:o,height:e}=t.getBoundingClientRect();return Object.assign({width:o,height:e},dt(t))}async _schedule(t){this._scheduled.has(t)||(this._scheduled.add(t),await Promise.resolve(),this._scheduled.delete(t),t.call(this))}async _updateDOM(t){this._scrollSize=t.scrollSize,this._adjustRange(t.range),this._childrenPos=t.childPositions,this._scrollError=t.scrollError||null;const{_rangeChanged:o,_itemsChanged:e}=this;this._visibilityChanged&&(this._notifyVisibility(),this._visibilityChanged=!1),(o||e)&&(this._notifyRange(),this._rangeChanged=!1),this._finishDOMUpdate()}_finishDOMUpdate(){this._connected&&(this._children.forEach(t=>this._childrenRO.observe(t)),this._checkScrollIntoViewTarget(this._childrenPos),this._positionChildren(this._childrenPos),this._sizeHostElement(this._scrollSize),this._correctScrollError(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_updateLayout(){this._layout&&this._connected&&(this._layout.items=this._items,this._updateView(),this._childMeasurements!==null&&(this._measureCallback&&this._measureCallback(this._childMeasurements),this._childMeasurements=null),this._layout.reflowIfNeeded(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_handleScrollEvent(){var t;if(this._benchmarkStart&&"mark"in window.performance){try{window.performance.measure("uv-virtualizing","uv-start","uv-end")}catch(o){console.warn("Error measuring performance data: ",o)}window.performance.mark("uv-start")}this._scrollerController.correctingScrollError===!1&&((t=this._layout)==null||t.unpin()),this._schedule(this._updateLayout)}handleEvent(t){switch(t.type){case"scroll":(t.currentTarget===window||this._clippingAncestors.includes(t.currentTarget))&&this._handleScrollEvent();break;default:console.warn("event not handled",t)}}_handleLayoutMessage(t){t.type==="stateChanged"?this._updateDOM(t):t.type==="visibilityChanged"?(this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._notifyVisibility()):t.type==="unpinned"&&this._hostElement.dispatchEvent(new M)}get _children(){const t=[];let o=this._hostElement.firstElementChild;for(;o;)o.hasAttribute(I)||t.push(o),o=o.nextElementSibling;return t}_updateView(){var i;const t=this._hostElement,o=(i=this._scrollerController)==null?void 0:i.element,e=this._layout;if(t&&o&&e){let n,s,l,c;const h=t.getBoundingClientRect();n=0,s=0,l=window.innerHeight,c=window.innerWidth;const m=this._clippingAncestors.map(w=>w.getBoundingClientRect());m.unshift(h);for(const w of m)n=Math.max(n,w.top),s=Math.max(s,w.left),l=Math.min(l,w.bottom),c=Math.min(c,w.right);const d=o.getBoundingClientRect(),p={left:h.left-d.left,top:h.top-d.top},u={width:o.scrollWidth,height:o.scrollHeight},v=n-h.top+t.scrollTop,f=s-h.left+t.scrollLeft,k=Math.max(0,l-n),x=Math.max(0,c-s);e.viewportSize={width:x,height:k},e.viewportScroll={top:v,left:f},e.totalScrollSize=u,e.offsetWithinScroller=p}}_sizeHostElement(t){const e=t&&t.width!==null?Math.min(82e5,t.width):0,i=t&&t.height!==null?Math.min(82e5,t.height):0;if(this._isScroller)this._getSizer().style.transform=`translate(${e}px, ${i}px)`;else{const n=this._hostElement.style;n.minWidth=e?`${e}px`:"100%",n.minHeight=i?`${i}px`:"100%"}}_positionChildren(t){t&&t.forEach(({top:o,left:e,width:i,height:n,xOffset:s,yOffset:l},c)=>{const h=this._children[c-this._first];h&&(h.style.position="absolute",h.style.boxSizing="border-box",h.style.transform=`translate(${e}px, ${o}px)`,i!==void 0&&(h.style.width=i+"px"),n!==void 0&&(h.style.height=n+"px"),h.style.left=s===void 0?null:s+"px",h.style.top=l===void 0?null:l+"px")})}async _adjustRange(t){const{_first:o,_last:e,_firstVisible:i,_lastVisible:n}=this;this._first=t.first,this._last=t.last,this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._rangeChanged=this._rangeChanged||this._first!==o||this._last!==e,this._visibilityChanged=this._visibilityChanged||this._firstVisible!==i||this._lastVisible!==n}_correctScrollError(){if(this._scrollError){const{scrollTop:t,scrollLeft:o}=this._scrollerController,{top:e,left:i}=this._scrollError;this._scrollError=null,this._scrollerController.correctScrollError({top:t-e,left:o-i})}}element(t){var o;return t===1/0&&(t=this._items.length-1),((o=this._items)==null?void 0:o[t])===void 0?void 0:{scrollIntoView:(e={})=>this._scrollElementIntoView({...e,index:t})}}_scrollElementIntoView(t){if(t.index>=this._first&&t.index<=this._last)this._children[t.index-this._first].scrollIntoView(t);else if(t.index=Math.min(t.index,this._items.length-1),t.behavior==="smooth"){const o=this._layout.getScrollIntoViewCoordinates(t),{behavior:e}=t;this._updateScrollIntoViewCoordinates=this._scrollerController.managedScrollTo(Object.assign(o,{behavior:e}),()=>this._layout.getScrollIntoViewCoordinates(t),()=>this._scrollIntoViewTarget=null),this._scrollIntoViewTarget=t}else this._layout.pin=t}_checkScrollIntoViewTarget(t){const{index:o}=this._scrollIntoViewTarget||{};o&&(t!=null&&t.has(o))&&this._updateScrollIntoViewCoordinates(this._layout.getScrollIntoViewCoordinates(this._scrollIntoViewTarget))}_notifyRange(){this._hostElement.dispatchEvent(new T({first:this._first,last:this._last}))}_notifyVisibility(){this._hostElement.dispatchEvent(new V({first:this._firstVisible,last:this._lastVisible}))}get layoutComplete(){return this._layoutCompletePromise||(this._layoutCompletePromise=new Promise((t,o)=>{this._layoutCompleteResolver=t,this._layoutCompleteRejecter=o})),this._layoutCompletePromise}_rejectLayoutCompletePromise(t){this._layoutCompleteRejecter!==null&&this._layoutCompleteRejecter(t),this._resetLayoutCompleteState()}_scheduleLayoutComplete(){this._layoutCompletePromise&&this._pendingLayoutComplete===null&&(this._pendingLayoutComplete=requestAnimationFrame(()=>requestAnimationFrame(()=>this._resolveLayoutCompletePromise())))}_resolveLayoutCompletePromise(){this._layoutCompleteResolver!==null&&this._layoutCompleteResolver(),this._resetLayoutCompleteState()}_resetLayoutCompleteState(){this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null}_hostElementSizeChanged(){this._schedule(this._updateLayout)}_childLoaded(){}_childrenSizeChanged(t){var o;if((o=this._layout)!=null&&o.measureChildren){for(const e of t)this._toBeMeasured.set(e.target,e.contentRect);this._measureChildren()}this._scheduleLayoutComplete(),this._itemsChanged=!1,this._rangeChanged=!1}}function dt(r){const t=window.getComputedStyle(r);return{marginTop:A(t.marginTop),marginRight:A(t.marginRight),marginBottom:A(t.marginBottom),marginLeft:A(t.marginLeft)}}function A(r){const t=r?parseFloat(r):NaN;return Number.isNaN(t)?0:t}function P(r){if(r.assignedSlot!==null)return r.assignedSlot;if(r.parentElement!==null)return r.parentElement;const t=r.parentNode;return t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host||null}function pt(r,t=!1){const o=[];let e=t?r:P(r);for(;e!==null;)o.push(e),e=P(e);return o}function vt(r,t=!1){let o=!1;return pt(r,t).filter(e=>{if(o)return!1;const i=getComputedStyle(e);return o=i.position==="fixed",i.overflow!=="visible"})}/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
*/customElements.define("lit-virtualizer",C);const gt=":host{--options-divider-thickness: var( --divider-thickness-medium, var(--luzmo-border-width) );inline-size:auto;margin-block:var(--luzmo-options-section-divider-margin-block, max(0px, (var(--option-section-divider-height) - var(--options-divider-thickness)) / 2));margin-inline:var(--luzmo-option-label-inline-edge-to-content, var(--option-label-inline-edge-to-content));overflow:visible}:host{display:block;flex-shrink:0}";class N extends D.SizedMixin(a.LuzmoElement,{validSizes:["s","m","l"]}){static get styles(){return[a.r(tt.dividerStyles),a.r(gt)]}firstUpdated(t){super.firstUpdated(t),this.setAttribute("role","separator")}}const bt=":host{--option-top-to-action: var(--luzmo-spacing-1);--option-top-to-checkbox: var(--luzmo-spacing-1);--option-label-line-height: var(--luzmo-line-height);--option-label-line-height-cjk: 1.5;--option-label-to-description-spacing: 1px;--option-focus-indicator-width: var(--luzmo-indicator-width);--option-focus-indicator-color: var(--luzmo-indicator-color);--option-label-to-value-area-min-spacing: var(--luzmo-spacing-3);--option-label-content-color-default: var(--luzmo-font-color);--option-label-content-color-hover: var(--luzmo-font-color-hover);--option-label-content-color-down: var(--luzmo-font-color-down);--option-label-content-color-focus: var(--luzmo-font-color-focus);--option-label-icon-color-default: var(--luzmo-font-color);--option-label-icon-color-hover: var(--luzmo-font-color-hover);--option-label-icon-color-down: var(--luzmo-font-color-down);--option-label-icon-color-focus: var(--luzmo-font-color-focus);--option-highlight-selected-label-background-color: var(--luzmo-primary);--option-highlight-selected-label-content-color: var( --luzmo-primary-inverse-color );--option-highlight-selected-label-content-color-hover: var( --luzmo-primary-inverse-color );--option-highlight-selected-label-content-color-down: var( --luzmo-primary-inverse-color );--option-highlight-selected-label-content-color-focus: var( --luzmo-primary-inverse-color );--option-label-content-color-disabled: var(--luzmo-font-color-disabled);--option-label-icon-color-disabled: var(--luzmo-font-color-disabled);--option-description-line-height: var(--luzmo-line-height);--option-description-line-height-cjk: 1.5;--option-description-color-default: var(--luzmo-font-color);--option-description-color-hover: var(--luzmo-font-color-hover);--option-description-color-down: var(--luzmo-font-color-down);--option-description-color-focus: var(--luzmo-font-color-focus);--option-description-color-disabled: var(--luzmo-disabled-color);--options-section-header-line-height: var(--luzmo-line-height);--options-section-header-line-height-cjk: 1.5;--options-section-header-font-weight: bold;--options-section-header-color: var(--luzmo-font-color-hard);--options-collapsible-icon-color: var(--luzmo-font-color-hard);--options-checkmark-icon-color-default: var(--luzmo-font-color);--options-checkmark-icon-color-hover: var(--luzmo-font-color-hover);--options-checkmark-icon-color-down: var(--luzmo-font-color-down);--options-checkmark-icon-color-focus: var(--luzmo-font-color-focus);--options-checkbox-icon-color-default: var(--luzmo-font-color);--options-checkbox-icon-color-hover: var(--luzmo-font-color-hover);--options-checkbox-icon-color-down: var(--luzmo-font-color-down);--options-checkbox-icon-color-focus: var(--luzmo-font-color-focus);--options-drillin-icon-color-default: var(--luzmo-font-color);--options-drillin-icon-color-hover: var(--luzmo-font-color-hover);--options-drillin-icon-color-down: var(--luzmo-font-color-down);--options-drillin-icon-color-focus: var(--luzmo-font-color-focus);--option-value-color-default: var(--luzmo-font-color);--option-value-color-hover: var(--luzmo-font-color-hover);--option-value-color-down: var(--luzmo-font-color-down);--option-value-color-focus: var(--luzmo-font-color-focus);--option-collapsible-no-icon-suboption-padding-x-start: 28px;--option-background-color-selected: var(--luzmo-background-color);--option-background-color-default: var(--luzmo-background-color);--option-background-color-hover: var(--luzmo-background-color-hover);--option-background-color-down: var(--luzmo-background-color-down);--option-background-color-key-focus: var(--luzmo-background-color-focus)}:host{--option-min-height: var(--luzmo-component-height);--option-icon-container-height: 18px;--options-pending-height: var(--option-min-height);--progress-circle-size: calc( var(--options-pending-height) - var(--option-top-edge-to-text) - var( --option-bottom-edge-to-text ) );--option-icon-height: var(--luzmo-font-size-l);--option-icon-width: var(--luzmo-font-size-l);--option-label-font-size: var(--luzmo-font-size);--option-label-text-to-visual: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--option-label-text-to-control: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--option-label-inline-edge-to-content: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--pending-inline-edge-to-content: var(--option-label-inline-edge-to-content);--option-top-edge-to-text: calc( var(--luzmo-spacing-2) + var(--luzmo-spacing-1) );--option-bottom-edge-to-text: var(--luzmo-spacing-3);--option-description-font-size: var(--luzmo-font-size-xs);--options-section-header-font-size: var(--luzmo-font-size);--options-section-header-min-width: var(--luzmo-component-height);--option-selectable-edge-to-text-not-selected: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--option-checkmark-size: var(--luzmo-font-size-xs);--option-checkbox-size: var(--luzmo-font-size-xs);--option-top-to-checkmark: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--option-top-to-checkbox: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) )}:host([size=s]){--option-min-height: var(--luzmo-component-height-s);--option-icon-container-height: 17px;--option-icon-height: var(--luzmo-font-size);--option-icon-width: var(--luzmo-font-size);--option-label-font-size: var(--luzmo-font-size-s);--option-label-text-to-visual: var(--luzmo-spacing-3);--option-label-text-to-control: var(--luzmo-spacing-3);--option-label-inline-edge-to-content: var(--luzmo-spacing-3);--option-top-edge-to-text: calc( var(--luzmo-spacing-1) + var(--luzmo-spacing-2) );--option-bottom-edge-to-text: var(--luzmo-spacing-2);--option-description-font-size: var(--luzmo-font-size-xs);--options-section-header-font-size: var(--luzmo-font-size-s);--options-section-header-min-width: var(--luzmo-component-height-s);--option-selectable-edge-to-text-not-selected: var(--luzmo-spacing-3);--option-checkmark-size: var(--luzmo-font-size-xs);--option-checkbox-size: var(--luzmo-font-size-xs);--option-top-to-checkmark: var(--luzmo-spacing-3);--option-top-to-checkbox: var(--luzmo-spacing-3)}:host([size=l]){--option-min-height: var(--luzmo-component-height-l);--option-icon-container-height: calc( var(--luzmo-spacing-5) + var(--luzmo-spacing-1) );--option-icon-height: var(--luzmo-font-size-l);--option-icon-width: var(--luzmo-font-size-l);--option-label-font-size: var(--luzmo-font-size-l);--option-label-text-to-visual: var(--luzmo-spacing-4);--option-label-text-to-control: var(--luzmo-spacing-4);--option-label-inline-edge-to-content: var(--luzmo-spacing-4);--option-top-edge-to-text: var(--luzmo-spacing-4);--option-bottom-edge-to-text: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--option-description-font-size: var(--luzmo-font-size-s);--options-section-header-font-size: var(--luzmo-font-size-l);--options-section-header-min-width: var(--luzmo-component-height-l);--option-selectable-edge-to-text-not-selected: var(--luzmo-spacing-4);--option-checkmark-size: var(--luzmo-font-size-s);--option-checkbox-size: var(--luzmo-font-size-s);--option-top-to-checkmark: var(--luzmo-spacing-4);--option-top-to-checkbox: var(--luzmo-spacing-4)}:host([size=xl]){--option-min-height: var(--luzmo-component-height-xl);--option-icon-container-height: 26px;--option-icon-height: var(--luzmo-font-size-xl);--option-icon-width: var(--luzmo-font-size-xl);--option-label-font-size: var(--luzmo-font-size-xl);--option-label-text-to-visual: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--option-label-text-to-control: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--option-label-inline-edge-to-content: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--option-top-edge-to-text: var(--luzmo-spacing-4);--option-bottom-edge-to-text: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--option-description-font-size: var(--luzmo-font-size);--options-section-header-font-size: var(--luzmo-font-size-xl);--options-section-header-min-width: var(--luzmo-component-height-xl);--option-selectable-edge-to-text-not-selected: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--option-checkmark-size: var(--luzmo-font-size);--option-checkbox-size: var(--luzmo-font-size);--option-top-to-checkmark: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--option-top-to-checkbox: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) )}@media (forced-colors: active){:host{--highcontrast-option-background-color-default: ButtonFace;--highcontrast-option-color-default: ButtonText;--highcontrast-option-background-color-focus: Highlight;--highcontrast-option-color-focus: HighlightText;--highcontrast-options-checkmark-icon-color-default: Highlight;--highcontrast-options-checkbox-icon-color-default: Highlight;--highcontrast-option-color-disabled: GrayText;--highcontrast-option-focus-indicator-color: Highlight;--highcontrast-option-selected-background-color: Highlight;--highcontrast-option-selected-color: HighlightText}@supports (color: SelectedItem){:host{--highcontrast-option-selected-background-color: SelectedItem;--highcontrast-option-selected-color: SelectedItemText}}}:host{inline-size:auto;inline-size:var(--luzmo-options-inline-size, auto);box-sizing:border-box;margin:0;padding:0;list-style-type:none;display:inline-block;overflow:auto}:host:lang(ja),:host:lang(ko),:host:lang(zh){--option-label-line-height: var( --luzmo-option-label-line-height-cjk, var(--option-label-line-height-cjk) );--option-description-line-height: var( --luzmo-option-description-line-height-cjk, var(--option-description-line-height-cjk) );--options-section-header-line-height: var( --luzmo-options-section-header-line-height-cjk, var(--options-section-header-line-height-cjk) )}luzmo-option{width:100%}#pending{display:flex;flex-shrink:0;align-items:center;height:var(--options-pending-height);padding-inline:var(--pending-inline-edge-to-content)}:host{display:inline-flex;flex-direction:column;width:100%}:host(:focus){outline:none}::slotted(*){flex-shrink:0}";var _t=Object.defineProperty,y=(r,t,o,e)=>{for(var i=void 0,n=r.length-1,s;n>=0;n--)(s=r[n])&&(i=s(t,o,i)||i);return i&&_t(t,o,i),i};const H=25;function zt(r,t){return!!t&&(r===t||r.contains(t))}class _ extends D.SizedMixin(a.LuzmoElement,{noDefaultSize:!0}){constructor(){super(),this.label="",this.variant="highlight",this.selects="single",this.emphasized=!1,this.pending=!1,this.options=[],this.value=[],this.focusedOptionIndex=0,this._selectedOptions=[],this._firstVisibleIndex=0,this.addEventListener("focusin",this.handleFocusin),this.addEventListener("blur",this.handleBlur)}static get styles(){return[a.r(bt)]}get _virtualizeActive(){return this.options.length>H}firstUpdated(t){super.firstUpdated(t),this.hasAttribute("tabindex")||(this.tabIndex=0);const o=[new Promise(e=>requestAnimationFrame(()=>e(!0)))];[...this.children].forEach(e=>{e.localName==="luzmo-option"&&o.push(e.updateComplete)}),this.optionElementsUpdated=Promise.all(o)}willUpdate(t){var e;t.has("selects")&&this.selects==="single"&&((e=this.value)==null?void 0:e.length)>1&&(this.value=this.value.slice(0,1))}updated(t){super.updated(t),t.has("label")&&(this.label||t.get("label")!==void 0)&&(this.label?this.setAttribute("aria-label",this.label):this.removeAttribute("aria-label"))}async getUpdateComplete(){const t=await super.getUpdateComplete();return await this.optionElementsUpdated,t}focus({preventScroll:t}={}){super.focus({preventScroll:t}),this.focusOptionByOffset(0)}_removeFocusedPropertyOnOptions(){requestAnimationFrame(()=>{this.visibleOptionElements.forEach(t=>{t.focused=!1})})}scrollToTop(){this.scrollTop=0}handleFocusin(){this.startListeningToKeyboard()}handleBlur(t){zt(this,t.relatedTarget)||(this.stopListeningToKeyboard(),this._removeFocusedPropertyOnOptions(),this.removeAttribute("aria-activedescendant"))}startListeningToKeyboard(){this.addEventListener("keydown",this.handleKeydown)}stopListeningToKeyboard(){this.removeEventListener("keydown",this.handleKeydown)}handleKeydown(t){var n;if(t.defaultPrevented)return;const o=this.focusedOptionIndex,e=[...this.visibleOptionElements].find(s=>{var l,c,h,m;return((l=s.value)==null?void 0:l.toString())===((m=(h=(c=this.options)==null?void 0:c[o])==null?void 0:h.value)==null?void 0:m.toString())}),{key:i}=t;if(i==="Tab"){this.prepareToCleanUp();return}if(i===" "||i==="Enter"){t.preventDefault(),e&&this.toggleOption(t,(n=this.options)==null?void 0:n[o]);return}if(i==="ArrowDown"||i==="ArrowUp"){t.preventDefault(),this.navigateWithinOptions(t,e);return}}navigateWithinOptions(t,o){const{key:e}=t,i=e==="ArrowDown"?1:-1;t.preventDefault(),t.stopPropagation();const n=this.focusOptionByOffset(i,o,!0);n!==o&&(this._virtualizeActive||n==null||n.scrollIntoView({block:"nearest"}))}focusOptionByOffset(t,o,e){var d;const i=t||1;o&&(o.focused=!1);const n=this.focusedOptionIndex;this.focusedOptionIndex=this.options.length>0?(this.options.length+this.focusedOptionIndex+t)%this.options.length:0;let s=this.options[this.focusedOptionIndex],l=this.options.length;for(;(s!=null&&s.disabled||s!=null&&s.divider)&&l;)l-=1,this.focusedOptionIndex=(this.options.length+this.focusedOptionIndex+i)%this.options.length,s=this.options[this.focusedOptionIndex];const c=n<this.focusedOptionIndex&&t===-1,h=n>this.focusedOptionIndex&&t===1;(c||h)&&(this.focusedOptionIndex=n,this.dispatchEvent(new Event(`luzmo-exceeded-${c?"top":"bottom"}`,{bubbles:!0,composed:!0,cancelable:!0})));let m;return e&&this._virtualizeActive&&(m=[...this.visibleOptionElements].find(p=>{var u,v,f;return((u=p.value)==null?void 0:u.toString())===((f=(v=this.options[this.focusedOptionIndex])==null?void 0:v.value)==null?void 0:f.toString())}),m||(this.focusedOptionIndex=this._firstVisibleIndex)),this._virtualizeActive&&e&&((d=this.virtualizer.element(this.focusedOptionIndex))==null||d.scrollIntoView({behavior:"smooth",block:"nearest"})),m=m??[...this.visibleOptionElements].find(p=>{var u,v,f,k,x;return(p.value===null?null:(u=p.value)==null?void 0:u.toString())===(((v=this.options[this.focusedOptionIndex])==null?void 0:v.value)===null?(f=this.options[this.focusedOptionIndex])==null?void 0:f.value:(x=(k=this.options[this.focusedOptionIndex])==null?void 0:k.value)==null?void 0:x.toString())}),s!=null&&s.disabled||this.setFocusedAndActiveDescendant(m),m}updateSelectedItemIndex(){this.focusedOptionIndex=this._virtualizeActive?this._firstVisibleIndex:0}setSelectedOptionsFromValue(){this._selectedOptions=this.options.filter(t=>{var o;return Array.isArray(this.value)&&((o=this.value)==null?void 0:o.includes((t==null?void 0:t.value)??null))})}visibilityChanged(t){this._firstVisibleIndex=(t==null?void 0:t.first)??0}rangeChange(t){t.stopPropagation(),t.preventDefault(),(t==null?void 0:t.first)!==-1&&(t==null?void 0:t.last)!==-1&&this.dispatchEvent(new CustomEvent("luzmo-scrolled",{bubbles:!0,composed:!0,cancelable:!0,detail:{first:t.first,last:t.last}}))}async toggleOption(t,o){var s;const e=t instanceof KeyboardEvent,i=this.options.findIndex(l=>(l==null?void 0:l.value)===(o==null?void 0:o.value));this.focusedOptionIndex=i,this.visibleOptionElements.forEach(l=>{var c,h;if(e){const m=((l==null?void 0:l.value)===null?null:(c=l.value)==null?void 0:c.toString())===((o==null?void 0:o.value)===null?null:(h=o==null?void 0:o.value)==null?void 0:h.toString());l.focused=m,m&&this.setFocusedAndActiveDescendant(l)}else l.focused=!1});const n=Array.isArray(this.value)&&((s=this.value)==null?void 0:s.includes((o==null?void 0:o.value)??null));this.selects==="single"?(this.value=[o==null?void 0:o.value],this._selectedOptions=[o]):(this.value=n?this.value.filter(l=>l!==(o==null?void 0:o.value)):[...this.value??[],o==null?void 0:o.value],this._selectedOptions=n?this._selectedOptions.filter(l=>l.value!==o.value):[...this._selectedOptions,o]),await this.updateComplete,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,composed:!0,detail:{value:this.value??[]}})),this.prepareToCleanUp()}handleOptionClick(t,o){this.toggleOption(o,t)}render(){const t=l=>a.x`<luzmo-icon
|
|
190
|
+
${this.href && this.href.length > 0 ? super.renderAnchor({
|
|
191
|
+
id: "button",
|
|
192
|
+
ariaHidden: true,
|
|
193
|
+
className: "button anchor hidden"
|
|
194
|
+
}) : lit.nothing}
|
|
195
|
+
`;
|
|
196
|
+
}
|
|
197
|
+
handlePointerdown() {
|
|
198
|
+
}
|
|
199
|
+
firstUpdated(changes) {
|
|
200
|
+
super.firstUpdated(changes);
|
|
201
|
+
this.setAttribute("tabindex", "-1");
|
|
202
|
+
this.addEventListener("pointerdown", this.handlePointerdown);
|
|
203
|
+
if (!this.hasAttribute("id")) {
|
|
204
|
+
this.id = `luzmo-option-${randomId.randomID()}`;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
updateAriaSelected() {
|
|
208
|
+
const role = this.getAttribute("role");
|
|
209
|
+
if (role === "option") {
|
|
210
|
+
this.setAttribute("aria-selected", this.selected ? "true" : "false");
|
|
211
|
+
} else if (role === "optioncheckbox") {
|
|
212
|
+
this.setAttribute("aria-checked", this.selected ? "true" : "false");
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
setRole(role) {
|
|
216
|
+
this.setAttribute("role", role);
|
|
217
|
+
this.updateAriaSelected();
|
|
218
|
+
}
|
|
219
|
+
updated(changes) {
|
|
220
|
+
super.updated(changes);
|
|
221
|
+
if (changes.has("label") && (this.label || changes.get("label") !== void 0)) {
|
|
222
|
+
this.setAttribute("aria-label", this.label || "");
|
|
223
|
+
}
|
|
224
|
+
if (this.anchorElement) {
|
|
225
|
+
this.anchorElement.addEventListener("focus", this.proxyFocus);
|
|
226
|
+
this.anchorElement.tabIndex = -1;
|
|
227
|
+
}
|
|
228
|
+
if (changes.has("selected")) {
|
|
229
|
+
this.updateAriaSelected();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
connectedCallback() {
|
|
233
|
+
super.connectedCallback();
|
|
234
|
+
this.triggerUpdate();
|
|
235
|
+
}
|
|
236
|
+
async triggerUpdate() {
|
|
237
|
+
if (this.willDispatchUpdate) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
this.willDispatchUpdate = true;
|
|
241
|
+
await new Promise((ready) => requestAnimationFrame(ready));
|
|
242
|
+
this.dispatchUpdate();
|
|
243
|
+
}
|
|
244
|
+
dispatchUpdate() {
|
|
245
|
+
if (!this.isConnected) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
this.willDispatchUpdate = false;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
__decorateClass$1([
|
|
252
|
+
decorators_js.property({ type: Boolean, reflect: true })
|
|
253
|
+
], LuzmoOption.prototype, "active", 2);
|
|
254
|
+
__decorateClass$1([
|
|
255
|
+
decorators_js.property({ type: Boolean, reflect: true })
|
|
256
|
+
], LuzmoOption.prototype, "focused", 2);
|
|
257
|
+
__decorateClass$1([
|
|
258
|
+
decorators_js.property({ type: Boolean, reflect: true })
|
|
259
|
+
], LuzmoOption.prototype, "selected", 2);
|
|
260
|
+
__decorateClass$1([
|
|
261
|
+
decorators_js.property({ type: Boolean, reflect: true })
|
|
262
|
+
], LuzmoOption.prototype, "emphasized", 2);
|
|
263
|
+
__decorateClass$1([
|
|
264
|
+
decorators_js.property({ type: String, reflect: true })
|
|
265
|
+
], LuzmoOption.prototype, "variant", 2);
|
|
266
|
+
__decorateClass$1([
|
|
267
|
+
decorators_js.property({ type: String })
|
|
268
|
+
], LuzmoOption.prototype, "value", 1);
|
|
269
|
+
__decorateClass$1([
|
|
270
|
+
decorators_js.query("slot:not([name])")
|
|
271
|
+
], LuzmoOption.prototype, "contentSlot", 2);
|
|
272
|
+
__decorateClass$1([
|
|
273
|
+
decorators_js.query('slot[name="icon"]')
|
|
274
|
+
], LuzmoOption.prototype, "iconSlot", 2);
|
|
275
|
+
__decorateClass$1([
|
|
276
|
+
decorators_js.property({
|
|
277
|
+
type: Boolean,
|
|
278
|
+
reflect: true,
|
|
279
|
+
attribute: "no-wrap",
|
|
280
|
+
hasChanged() {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
})
|
|
284
|
+
], LuzmoOption.prototype, "noWrap", 2);
|
|
285
|
+
__decorateClass$1([
|
|
286
|
+
decorators_js.query(".anchor")
|
|
287
|
+
], LuzmoOption.prototype, "anchorElement", 2);
|
|
288
|
+
const optionsDividerStyles = ":host{--options-divider-thickness: var( --divider-thickness-medium, var(--luzmo-border-width) );inline-size:auto;margin-block:var(--luzmo-options-section-divider-margin-block, max(0px, (var(--option-section-divider-height) - var(--options-divider-thickness)) / 2));margin-inline:var(--luzmo-option-label-inline-edge-to-content, var(--option-label-inline-edge-to-content));overflow:visible}:host{display:block;flex-shrink:0}";
|
|
289
|
+
class LuzmoOptionsDivider extends sizedMixin.SizedMixin(base.LuzmoElement, {
|
|
290
|
+
validSizes: ["s", "m", "l"]
|
|
291
|
+
}) {
|
|
292
|
+
static get styles() {
|
|
293
|
+
return [lit.unsafeCSS(divider_module.dividerStyles), lit.unsafeCSS(optionsDividerStyles)];
|
|
294
|
+
}
|
|
295
|
+
firstUpdated(changed) {
|
|
296
|
+
super.firstUpdated(changed);
|
|
297
|
+
this.setAttribute("role", "separator");
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
const optionsStyles = ":host{--option-top-to-action: var(--luzmo-spacing-1);--option-top-to-checkbox: var(--luzmo-spacing-1);--option-label-line-height: var(--luzmo-line-height);--option-label-line-height-cjk: 1.5;--option-label-to-description-spacing: 1px;--option-focus-indicator-width: var(--luzmo-indicator-width);--option-focus-indicator-color: var(--luzmo-indicator-color);--option-label-to-value-area-min-spacing: var(--luzmo-spacing-3);--option-label-content-color-default: var(--luzmo-font-color);--option-label-content-color-hover: var(--luzmo-font-color-hover);--option-label-content-color-down: var(--luzmo-font-color-down);--option-label-content-color-focus: var(--luzmo-font-color-focus);--option-label-icon-color-default: var(--luzmo-font-color);--option-label-icon-color-hover: var(--luzmo-font-color-hover);--option-label-icon-color-down: var(--luzmo-font-color-down);--option-label-icon-color-focus: var(--luzmo-font-color-focus);--option-highlight-selected-label-background-color: var(--luzmo-primary);--option-highlight-selected-label-content-color: var( --luzmo-primary-inverse-color );--option-highlight-selected-label-content-color-hover: var( --luzmo-primary-inverse-color );--option-highlight-selected-label-content-color-down: var( --luzmo-primary-inverse-color );--option-highlight-selected-label-content-color-focus: var( --luzmo-primary-inverse-color );--option-label-content-color-disabled: var(--luzmo-font-color-disabled);--option-label-icon-color-disabled: var(--luzmo-font-color-disabled);--option-description-line-height: var(--luzmo-line-height);--option-description-line-height-cjk: 1.5;--option-description-color-default: var(--luzmo-font-color);--option-description-color-hover: var(--luzmo-font-color-hover);--option-description-color-down: var(--luzmo-font-color-down);--option-description-color-focus: var(--luzmo-font-color-focus);--option-description-color-disabled: var(--luzmo-disabled-color);--options-section-header-line-height: var(--luzmo-line-height);--options-section-header-line-height-cjk: 1.5;--options-section-header-font-weight: bold;--options-section-header-color: var(--luzmo-font-color-hard);--options-collapsible-icon-color: var(--luzmo-font-color-hard);--options-checkmark-icon-color-default: var(--luzmo-font-color);--options-checkmark-icon-color-hover: var(--luzmo-font-color-hover);--options-checkmark-icon-color-down: var(--luzmo-font-color-down);--options-checkmark-icon-color-focus: var(--luzmo-font-color-focus);--options-checkbox-icon-color-default: var(--luzmo-font-color);--options-checkbox-icon-color-hover: var(--luzmo-font-color-hover);--options-checkbox-icon-color-down: var(--luzmo-font-color-down);--options-checkbox-icon-color-focus: var(--luzmo-font-color-focus);--options-drillin-icon-color-default: var(--luzmo-font-color);--options-drillin-icon-color-hover: var(--luzmo-font-color-hover);--options-drillin-icon-color-down: var(--luzmo-font-color-down);--options-drillin-icon-color-focus: var(--luzmo-font-color-focus);--option-value-color-default: var(--luzmo-font-color);--option-value-color-hover: var(--luzmo-font-color-hover);--option-value-color-down: var(--luzmo-font-color-down);--option-value-color-focus: var(--luzmo-font-color-focus);--option-collapsible-no-icon-suboption-padding-x-start: 28px;--option-background-color-selected: var(--luzmo-background-color);--option-background-color-default: var(--luzmo-background-color);--option-background-color-hover: var(--luzmo-background-color-hover);--option-background-color-down: var(--luzmo-background-color-down);--option-background-color-key-focus: var(--luzmo-background-color-focus)}:host{--option-min-height: var(--luzmo-component-height);--option-icon-container-height: 18px;--options-pending-height: var(--option-min-height);--progress-circle-size: calc( var(--options-pending-height) - var(--option-top-edge-to-text) - var( --option-bottom-edge-to-text ) );--option-icon-height: var(--luzmo-font-size-l);--option-icon-width: var(--luzmo-font-size-l);--option-label-font-size: var(--luzmo-font-size);--option-label-text-to-visual: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--option-label-text-to-control: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--option-label-inline-edge-to-content: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--pending-inline-edge-to-content: var(--option-label-inline-edge-to-content);--option-top-edge-to-text: calc( var(--luzmo-spacing-2) + var(--luzmo-spacing-1) );--option-bottom-edge-to-text: var(--luzmo-spacing-3);--option-description-font-size: var(--luzmo-font-size-xs);--options-section-header-font-size: var(--luzmo-font-size);--options-section-header-min-width: var(--luzmo-component-height);--option-selectable-edge-to-text-not-selected: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--option-checkmark-size: var(--luzmo-font-size-xs);--option-checkbox-size: var(--luzmo-font-size-xs);--option-top-to-checkmark: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--option-top-to-checkbox: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) )}:host([size=s]){--option-min-height: var(--luzmo-component-height-s);--option-icon-container-height: 17px;--option-icon-height: var(--luzmo-font-size);--option-icon-width: var(--luzmo-font-size);--option-label-font-size: var(--luzmo-font-size-s);--option-label-text-to-visual: var(--luzmo-spacing-3);--option-label-text-to-control: var(--luzmo-spacing-3);--option-label-inline-edge-to-content: var(--luzmo-spacing-3);--option-top-edge-to-text: calc( var(--luzmo-spacing-1) + var(--luzmo-spacing-2) );--option-bottom-edge-to-text: var(--luzmo-spacing-2);--option-description-font-size: var(--luzmo-font-size-xs);--options-section-header-font-size: var(--luzmo-font-size-s);--options-section-header-min-width: var(--luzmo-component-height-s);--option-selectable-edge-to-text-not-selected: var(--luzmo-spacing-3);--option-checkmark-size: var(--luzmo-font-size-xs);--option-checkbox-size: var(--luzmo-font-size-xs);--option-top-to-checkmark: var(--luzmo-spacing-3);--option-top-to-checkbox: var(--luzmo-spacing-3)}:host([size=l]){--option-min-height: var(--luzmo-component-height-l);--option-icon-container-height: calc( var(--luzmo-spacing-5) + var(--luzmo-spacing-1) );--option-icon-height: var(--luzmo-font-size-l);--option-icon-width: var(--luzmo-font-size-l);--option-label-font-size: var(--luzmo-font-size-l);--option-label-text-to-visual: var(--luzmo-spacing-4);--option-label-text-to-control: var(--luzmo-spacing-4);--option-label-inline-edge-to-content: var(--luzmo-spacing-4);--option-top-edge-to-text: var(--luzmo-spacing-4);--option-bottom-edge-to-text: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--option-description-font-size: var(--luzmo-font-size-s);--options-section-header-font-size: var(--luzmo-font-size-l);--options-section-header-min-width: var(--luzmo-component-height-l);--option-selectable-edge-to-text-not-selected: var(--luzmo-spacing-4);--option-checkmark-size: var(--luzmo-font-size-s);--option-checkbox-size: var(--luzmo-font-size-s);--option-top-to-checkmark: var(--luzmo-spacing-4);--option-top-to-checkbox: var(--luzmo-spacing-4)}:host([size=xl]){--option-min-height: var(--luzmo-component-height-xl);--option-icon-container-height: 26px;--option-icon-height: var(--luzmo-font-size-xl);--option-icon-width: var(--luzmo-font-size-xl);--option-label-font-size: var(--luzmo-font-size-xl);--option-label-text-to-visual: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--option-label-text-to-control: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--option-label-inline-edge-to-content: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--option-top-edge-to-text: var(--luzmo-spacing-4);--option-bottom-edge-to-text: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--option-description-font-size: var(--luzmo-font-size);--options-section-header-font-size: var(--luzmo-font-size-xl);--options-section-header-min-width: var(--luzmo-component-height-xl);--option-selectable-edge-to-text-not-selected: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--option-checkmark-size: var(--luzmo-font-size);--option-checkbox-size: var(--luzmo-font-size);--option-top-to-checkmark: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--option-top-to-checkbox: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) )}@media (forced-colors: active){:host{--highcontrast-option-background-color-default: ButtonFace;--highcontrast-option-color-default: ButtonText;--highcontrast-option-background-color-focus: Highlight;--highcontrast-option-color-focus: HighlightText;--highcontrast-options-checkmark-icon-color-default: Highlight;--highcontrast-options-checkbox-icon-color-default: Highlight;--highcontrast-option-color-disabled: GrayText;--highcontrast-option-focus-indicator-color: Highlight;--highcontrast-option-selected-background-color: Highlight;--highcontrast-option-selected-color: HighlightText}@supports (color: SelectedItem){:host{--highcontrast-option-selected-background-color: SelectedItem;--highcontrast-option-selected-color: SelectedItemText}}}:host{inline-size:auto;inline-size:var(--luzmo-options-inline-size, auto);box-sizing:border-box;margin:0;padding:0;list-style-type:none;display:inline-block;overflow:auto}:host:lang(ja),:host:lang(ko),:host:lang(zh){--option-label-line-height: var( --luzmo-option-label-line-height-cjk, var(--option-label-line-height-cjk) );--option-description-line-height: var( --luzmo-option-description-line-height-cjk, var(--option-description-line-height-cjk) );--options-section-header-line-height: var( --luzmo-options-section-header-line-height-cjk, var(--options-section-header-line-height-cjk) )}luzmo-option{width:100%}#pending{display:flex;flex-shrink:0;align-items:center;height:var(--options-pending-height);padding-inline:var(--pending-inline-edge-to-content)}:host{display:inline-flex;flex-direction:column;width:100%}:host(:focus){outline:none}::slotted(*){flex-shrink:0}";
|
|
301
|
+
var __defProp = Object.defineProperty;
|
|
302
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
303
|
+
var result = void 0;
|
|
304
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
305
|
+
if (decorator = decorators[i])
|
|
306
|
+
result = decorator(target, key, result) || result;
|
|
307
|
+
if (result) __defProp(target, key, result);
|
|
308
|
+
return result;
|
|
309
|
+
};
|
|
310
|
+
const VIRTUALIZE_AS_OF_NUM_ITEMS = 25;
|
|
311
|
+
function elementIsOrContains(el, isOrContains) {
|
|
312
|
+
return !!isOrContains && (el === isOrContains || el.contains(isOrContains));
|
|
313
|
+
}
|
|
314
|
+
class LuzmoOptions extends sizedMixin.SizedMixin(base.LuzmoElement, {
|
|
315
|
+
noDefaultSize: true
|
|
316
|
+
}) {
|
|
317
|
+
constructor() {
|
|
318
|
+
super();
|
|
319
|
+
this.label = "";
|
|
320
|
+
this.variant = "highlight";
|
|
321
|
+
this.selects = "single";
|
|
322
|
+
this.emphasized = false;
|
|
323
|
+
this.pending = false;
|
|
324
|
+
this.options = [];
|
|
325
|
+
this.value = [];
|
|
326
|
+
this.focusedOptionIndex = 0;
|
|
327
|
+
this._selectedOptions = [];
|
|
328
|
+
this._firstVisibleIndex = 0;
|
|
329
|
+
this.addEventListener("focusin", this.handleFocusin);
|
|
330
|
+
this.addEventListener("blur", this.handleBlur);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* @internal
|
|
334
|
+
*/
|
|
335
|
+
static get styles() {
|
|
336
|
+
return [lit.unsafeCSS(optionsStyles)];
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* @internal
|
|
340
|
+
*/
|
|
341
|
+
get _virtualizeActive() {
|
|
342
|
+
return this.options.length > VIRTUALIZE_AS_OF_NUM_ITEMS;
|
|
343
|
+
}
|
|
344
|
+
firstUpdated(changed) {
|
|
345
|
+
super.firstUpdated(changed);
|
|
346
|
+
if (!this.hasAttribute("tabindex")) {
|
|
347
|
+
this.tabIndex = 0;
|
|
348
|
+
}
|
|
349
|
+
const updates = [
|
|
350
|
+
new Promise((res) => requestAnimationFrame(() => res(true)))
|
|
351
|
+
];
|
|
352
|
+
[...this.children].forEach((item) => {
|
|
353
|
+
if (item.localName === "luzmo-option") {
|
|
354
|
+
updates.push(item.updateComplete);
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
this.optionElementsUpdated = Promise.all(updates);
|
|
358
|
+
}
|
|
359
|
+
willUpdate(changes) {
|
|
360
|
+
var _a;
|
|
361
|
+
const hasChangedSelects = changes.has("selects");
|
|
362
|
+
if (hasChangedSelects && this.selects === "single" && ((_a = this.value) == null ? void 0 : _a.length) > 1) {
|
|
363
|
+
this.value = this.value.slice(0, 1);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
updated(changes) {
|
|
367
|
+
super.updated(changes);
|
|
368
|
+
const changedLabel = changes.has("label");
|
|
369
|
+
if (changedLabel && (this.label || changes.get("label") !== void 0)) {
|
|
370
|
+
if (this.label) {
|
|
371
|
+
this.setAttribute("aria-label", this.label);
|
|
372
|
+
} else {
|
|
373
|
+
this.removeAttribute("aria-label");
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
async getUpdateComplete() {
|
|
378
|
+
const complete = await super.getUpdateComplete();
|
|
379
|
+
await this.optionElementsUpdated;
|
|
380
|
+
return complete;
|
|
381
|
+
}
|
|
382
|
+
focus({ preventScroll } = {}) {
|
|
383
|
+
super.focus({ preventScroll });
|
|
384
|
+
this.focusOptionByOffset(0);
|
|
385
|
+
}
|
|
386
|
+
_removeFocusedPropertyOnOptions() {
|
|
387
|
+
requestAnimationFrame(() => {
|
|
388
|
+
this.visibleOptionElements.forEach((item) => {
|
|
389
|
+
item.focused = false;
|
|
390
|
+
});
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
scrollToTop() {
|
|
394
|
+
this.scrollTop = 0;
|
|
395
|
+
}
|
|
396
|
+
handleFocusin() {
|
|
397
|
+
this.startListeningToKeyboard();
|
|
398
|
+
}
|
|
399
|
+
// when the focus is lost in the options menu, we need to remove the focus from the item, stop listening to keyboard events and clean up the aria-activedescendant
|
|
400
|
+
handleBlur(event) {
|
|
401
|
+
if (elementIsOrContains(this, event.relatedTarget)) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
this.stopListeningToKeyboard();
|
|
405
|
+
this._removeFocusedPropertyOnOptions();
|
|
406
|
+
this.removeAttribute("aria-activedescendant");
|
|
407
|
+
}
|
|
408
|
+
startListeningToKeyboard() {
|
|
409
|
+
this.addEventListener("keydown", this.handleKeydown);
|
|
410
|
+
}
|
|
411
|
+
stopListeningToKeyboard() {
|
|
412
|
+
this.removeEventListener("keydown", this.handleKeydown);
|
|
413
|
+
}
|
|
414
|
+
handleKeydown(event) {
|
|
415
|
+
var _a;
|
|
416
|
+
if (event.defaultPrevented) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
const lastFocusedIndex = this.focusedOptionIndex;
|
|
420
|
+
const lastFocusedItem = [...this.visibleOptionElements].find(
|
|
421
|
+
(item) => {
|
|
422
|
+
var _a2, _b, _c, _d;
|
|
423
|
+
return ((_a2 = item.value) == null ? void 0 : _a2.toString()) === ((_d = (_c = (_b = this.options) == null ? void 0 : _b[lastFocusedIndex]) == null ? void 0 : _c.value) == null ? void 0 : _d.toString());
|
|
424
|
+
}
|
|
425
|
+
);
|
|
426
|
+
const { key } = event;
|
|
427
|
+
if (key === "Tab") {
|
|
428
|
+
this.prepareToCleanUp();
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
if (key === " " || key === "Enter") {
|
|
432
|
+
event.preventDefault();
|
|
433
|
+
if (lastFocusedItem) {
|
|
434
|
+
this.toggleOption(event, (_a = this.options) == null ? void 0 : _a[lastFocusedIndex]);
|
|
435
|
+
}
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
if (key === "ArrowDown" || key === "ArrowUp") {
|
|
439
|
+
event.preventDefault();
|
|
440
|
+
this.navigateWithinOptions(event, lastFocusedItem);
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
navigateWithinOptions(event, optionElement) {
|
|
445
|
+
const { key } = event;
|
|
446
|
+
const direction = key === "ArrowDown" ? 1 : -1;
|
|
447
|
+
event.preventDefault();
|
|
448
|
+
event.stopPropagation();
|
|
449
|
+
const itemToFocus = this.focusOptionByOffset(
|
|
450
|
+
direction,
|
|
451
|
+
optionElement,
|
|
452
|
+
true
|
|
453
|
+
);
|
|
454
|
+
if (itemToFocus === optionElement) {
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
if (!this._virtualizeActive) {
|
|
458
|
+
itemToFocus == null ? void 0 : itemToFocus.scrollIntoView({ block: "nearest" });
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
focusOptionByOffset(offset, optionElement, scrollIntoView) {
|
|
462
|
+
var _a;
|
|
463
|
+
const step = offset || 1;
|
|
464
|
+
if (optionElement) {
|
|
465
|
+
optionElement.focused = false;
|
|
466
|
+
}
|
|
467
|
+
const previousFocusedOptionIndex = this.focusedOptionIndex;
|
|
468
|
+
this.focusedOptionIndex = this.options.length > 0 ? (this.options.length + this.focusedOptionIndex + offset) % this.options.length : 0;
|
|
469
|
+
let optionToFocus = this.options[this.focusedOptionIndex];
|
|
470
|
+
let availableItems = this.options.length;
|
|
471
|
+
while (((optionToFocus == null ? void 0 : optionToFocus.disabled) || (optionToFocus == null ? void 0 : optionToFocus.divider)) && availableItems) {
|
|
472
|
+
availableItems -= 1;
|
|
473
|
+
this.focusedOptionIndex = (this.options.length + this.focusedOptionIndex + step) % this.options.length;
|
|
474
|
+
optionToFocus = this.options[this.focusedOptionIndex];
|
|
475
|
+
}
|
|
476
|
+
const reachedStart = previousFocusedOptionIndex < this.focusedOptionIndex && offset === -1;
|
|
477
|
+
const reachedEnd = previousFocusedOptionIndex > this.focusedOptionIndex && offset === 1;
|
|
478
|
+
if (reachedStart || reachedEnd) {
|
|
479
|
+
this.focusedOptionIndex = previousFocusedOptionIndex;
|
|
480
|
+
this.dispatchEvent(
|
|
481
|
+
new Event(`luzmo-exceeded-${reachedStart ? "top" : "bottom"}`, {
|
|
482
|
+
bubbles: true,
|
|
483
|
+
composed: true,
|
|
484
|
+
cancelable: true
|
|
485
|
+
})
|
|
486
|
+
);
|
|
487
|
+
}
|
|
488
|
+
let itemToFocus;
|
|
489
|
+
if (scrollIntoView && this._virtualizeActive) {
|
|
490
|
+
itemToFocus = [...this.visibleOptionElements].find(
|
|
491
|
+
(item) => {
|
|
492
|
+
var _a2, _b, _c;
|
|
493
|
+
return ((_a2 = item.value) == null ? void 0 : _a2.toString()) === ((_c = (_b = this.options[this.focusedOptionIndex]) == null ? void 0 : _b.value) == null ? void 0 : _c.toString());
|
|
494
|
+
}
|
|
495
|
+
);
|
|
496
|
+
if (!itemToFocus) {
|
|
497
|
+
this.focusedOptionIndex = this._firstVisibleIndex;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
if (this._virtualizeActive && scrollIntoView) {
|
|
501
|
+
(_a = this.virtualizer.element(this.focusedOptionIndex)) == null ? void 0 : _a.scrollIntoView({
|
|
502
|
+
behavior: "smooth",
|
|
503
|
+
block: "nearest"
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
itemToFocus = itemToFocus ?? [...this.visibleOptionElements].find(
|
|
507
|
+
(item) => {
|
|
508
|
+
var _a2, _b, _c, _d, _e;
|
|
509
|
+
return (item.value === null ? null : (_a2 = item.value) == null ? void 0 : _a2.toString()) === (((_b = this.options[this.focusedOptionIndex]) == null ? void 0 : _b.value) === null ? (_c = this.options[this.focusedOptionIndex]) == null ? void 0 : _c.value : (_e = (_d = this.options[this.focusedOptionIndex]) == null ? void 0 : _d.value) == null ? void 0 : _e.toString());
|
|
510
|
+
}
|
|
511
|
+
);
|
|
512
|
+
if (!(optionToFocus == null ? void 0 : optionToFocus.disabled)) {
|
|
513
|
+
this.setFocusedAndActiveDescendant(itemToFocus);
|
|
514
|
+
}
|
|
515
|
+
return itemToFocus;
|
|
516
|
+
}
|
|
517
|
+
updateSelectedItemIndex() {
|
|
518
|
+
this.focusedOptionIndex = this._virtualizeActive ? this._firstVisibleIndex : 0;
|
|
519
|
+
}
|
|
520
|
+
setSelectedOptionsFromValue() {
|
|
521
|
+
this._selectedOptions = this.options.filter(
|
|
522
|
+
(option) => {
|
|
523
|
+
var _a;
|
|
524
|
+
return Array.isArray(this.value) && ((_a = this.value) == null ? void 0 : _a.includes((option == null ? void 0 : option.value) ?? null));
|
|
525
|
+
}
|
|
526
|
+
);
|
|
527
|
+
}
|
|
528
|
+
visibilityChanged(event) {
|
|
529
|
+
this._firstVisibleIndex = (event == null ? void 0 : event.first) ?? 0;
|
|
530
|
+
}
|
|
531
|
+
rangeChange(event) {
|
|
532
|
+
event.stopPropagation();
|
|
533
|
+
event.preventDefault();
|
|
534
|
+
if ((event == null ? void 0 : event.first) !== -1 && (event == null ? void 0 : event.last) !== -1) {
|
|
535
|
+
this.dispatchEvent(
|
|
536
|
+
new CustomEvent("luzmo-scrolled", {
|
|
537
|
+
bubbles: true,
|
|
538
|
+
composed: true,
|
|
539
|
+
cancelable: true,
|
|
540
|
+
detail: {
|
|
541
|
+
first: event.first,
|
|
542
|
+
last: event.last
|
|
543
|
+
}
|
|
544
|
+
})
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
async toggleOption(event, choice) {
|
|
549
|
+
var _a;
|
|
550
|
+
const keyboardEvent = event instanceof KeyboardEvent;
|
|
551
|
+
const index = this.options.findIndex(
|
|
552
|
+
(option) => (option == null ? void 0 : option.value) === (choice == null ? void 0 : choice.value)
|
|
553
|
+
);
|
|
554
|
+
this.focusedOptionIndex = index;
|
|
555
|
+
this.visibleOptionElements.forEach((item) => {
|
|
556
|
+
var _a2, _b;
|
|
557
|
+
if (keyboardEvent) {
|
|
558
|
+
const focused = ((item == null ? void 0 : item.value) === null ? null : (_a2 = item.value) == null ? void 0 : _a2.toString()) === ((choice == null ? void 0 : choice.value) === null ? null : (_b = choice == null ? void 0 : choice.value) == null ? void 0 : _b.toString());
|
|
559
|
+
item.focused = focused;
|
|
560
|
+
if (focused) {
|
|
561
|
+
this.setFocusedAndActiveDescendant(item);
|
|
562
|
+
}
|
|
563
|
+
} else {
|
|
564
|
+
item.focused = false;
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
const hasOption = Array.isArray(this.value) && ((_a = this.value) == null ? void 0 : _a.includes((choice == null ? void 0 : choice.value) ?? null));
|
|
568
|
+
if (this.selects === "single") {
|
|
569
|
+
this.value = [choice == null ? void 0 : choice.value];
|
|
570
|
+
this._selectedOptions = [choice];
|
|
571
|
+
} else {
|
|
572
|
+
this.value = hasOption ? this.value.filter((value) => value !== (choice == null ? void 0 : choice.value)) : [...this.value ?? [], choice == null ? void 0 : choice.value];
|
|
573
|
+
this._selectedOptions = hasOption ? this._selectedOptions.filter(
|
|
574
|
+
(option) => option.value !== choice.value
|
|
575
|
+
) : [...this._selectedOptions, choice];
|
|
576
|
+
}
|
|
577
|
+
await this.updateComplete;
|
|
578
|
+
this.dispatchEvent(
|
|
579
|
+
new CustomEvent("change", {
|
|
580
|
+
bubbles: true,
|
|
581
|
+
cancelable: true,
|
|
582
|
+
composed: true,
|
|
583
|
+
detail: {
|
|
584
|
+
value: this.value ?? []
|
|
585
|
+
}
|
|
586
|
+
})
|
|
587
|
+
);
|
|
588
|
+
this.prepareToCleanUp();
|
|
589
|
+
}
|
|
590
|
+
handleOptionClick(option, event) {
|
|
591
|
+
this.toggleOption(event, option);
|
|
592
|
+
}
|
|
593
|
+
render() {
|
|
594
|
+
const renderIcon = (icon) => {
|
|
595
|
+
return lit.html`<luzmo-icon
|
|
74
596
|
slot="icon"
|
|
75
|
-
.icon=${
|
|
597
|
+
.icon=${icon}
|
|
76
598
|
.size=${this.size}
|
|
77
|
-
></luzmo-icon
|
|
599
|
+
></luzmo-icon>`;
|
|
600
|
+
};
|
|
601
|
+
const renderDescription = (description) => {
|
|
602
|
+
return lit.html`<span slot="description">${description}</span>`;
|
|
603
|
+
};
|
|
604
|
+
const renderImg = (imgSrc) => {
|
|
605
|
+
return lit.html`<luzmo-icon
|
|
78
606
|
slot="icon"
|
|
79
|
-
.src=${
|
|
607
|
+
.src=${imgSrc}
|
|
80
608
|
.size=${this.size}
|
|
81
|
-
></luzmo-icon
|
|
82
|
-
|
|
609
|
+
></luzmo-icon>`;
|
|
610
|
+
};
|
|
611
|
+
const renderOption = (option) => {
|
|
612
|
+
var _a;
|
|
613
|
+
const value = option == null ? void 0 : option.value;
|
|
614
|
+
const label = option == null ? void 0 : option.label;
|
|
615
|
+
const description = option == null ? void 0 : option.description;
|
|
616
|
+
const icon = option == null ? void 0 : option.icon;
|
|
617
|
+
const imgSrc = option == null ? void 0 : option.imgSrc;
|
|
618
|
+
const divider = option == null ? void 0 : option.divider;
|
|
619
|
+
const disabled = typeof option === "string" ? void 0 : option == null ? void 0 : option.disabled;
|
|
620
|
+
return divider ? lit.html`<luzmo-options-divider></luzmo-options-divider>` : lit.html`<luzmo-option
|
|
621
|
+
.value=${value}
|
|
83
622
|
.size=${this.size}
|
|
84
623
|
.variant=${this.variant}
|
|
85
624
|
?emphasized=${this.emphasized}
|
|
86
625
|
?no-wrap=${this.noWrap}
|
|
87
|
-
?disabled=${
|
|
88
|
-
.selected=${Array.isArray(this.value)?(
|
|
89
|
-
.role=${this.selects==="single"?"option":"optioncheckbox"}
|
|
90
|
-
@click=${this.handleOptionClick.bind(this,
|
|
626
|
+
?disabled=${disabled}
|
|
627
|
+
.selected=${Array.isArray(this.value) ? (_a = this.value) == null ? void 0 : _a.includes(value) : false}
|
|
628
|
+
.role=${this.selects === "single" ? "option" : "optioncheckbox"}
|
|
629
|
+
@click=${this.handleOptionClick.bind(this, option)}
|
|
91
630
|
>
|
|
92
|
-
${
|
|
93
|
-
${
|
|
94
|
-
</luzmo-option
|
|
631
|
+
${icon ? renderIcon(icon) : imgSrc ? renderImg(imgSrc) : lit.nothing}
|
|
632
|
+
${label} ${description ? renderDescription(description) : lit.nothing}
|
|
633
|
+
</luzmo-option>`;
|
|
634
|
+
};
|
|
635
|
+
const renderedOptions = this._virtualizeActive ? lit.html`<lit-virtualizer
|
|
95
636
|
.items=${this.options}
|
|
96
|
-
.renderItem=${
|
|
637
|
+
.renderItem=${renderOption}
|
|
97
638
|
@rangeChanged=${this.rangeChange}
|
|
98
639
|
@visibilityChanged=${this.visibilityChanged}
|
|
99
|
-
></lit-virtualizer
|
|
640
|
+
></lit-virtualizer>` : repeat_js.repeat(this.options, renderOption);
|
|
641
|
+
const pendingOption = this.pending ? lit.html`<div id="pending">
|
|
100
642
|
<luzmo-progress-circle indeterminate></luzmo-progress-circle>
|
|
101
|
-
</div
|
|
643
|
+
</div>` : lit.nothing;
|
|
644
|
+
return lit.html`${renderedOptions} ${pendingOption}`;
|
|
645
|
+
}
|
|
646
|
+
connectedCallback() {
|
|
647
|
+
super.connectedCallback();
|
|
648
|
+
this.setAttribute("role", "listbox");
|
|
649
|
+
this.updateComplete.then(() => this.updateItemFocus());
|
|
650
|
+
}
|
|
651
|
+
disconnectedCallback() {
|
|
652
|
+
super.disconnectedCallback();
|
|
653
|
+
}
|
|
654
|
+
prepareToCleanUp() {
|
|
655
|
+
document.addEventListener(
|
|
656
|
+
"focusout",
|
|
657
|
+
() => {
|
|
658
|
+
requestAnimationFrame(() => {
|
|
659
|
+
this.updateSelectedItemIndex();
|
|
660
|
+
});
|
|
661
|
+
},
|
|
662
|
+
{ once: true }
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
updateItemFocus() {
|
|
666
|
+
if (this.visibleOptionElements.length === 0) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
const lastFocusedIndex = this.focusedOptionIndex;
|
|
670
|
+
const lastFocusedItem = [...this.visibleOptionElements].find(
|
|
671
|
+
(item) => {
|
|
672
|
+
var _a, _b, _c, _d, _e, _f;
|
|
673
|
+
return (item.value === null ? null : (_a = item.value) == null ? void 0 : _a.toString()) === (((_c = (_b = this.options) == null ? void 0 : _b[lastFocusedIndex]) == null ? void 0 : _c.value) === null ? null : (_f = (_e = (_d = this.options) == null ? void 0 : _d[lastFocusedIndex]) == null ? void 0 : _e.value) == null ? void 0 : _f.toString());
|
|
674
|
+
}
|
|
675
|
+
);
|
|
676
|
+
this.setFocusedAndActiveDescendant(lastFocusedItem);
|
|
677
|
+
}
|
|
678
|
+
setFocusedAndActiveDescendant(item) {
|
|
679
|
+
var _a, _b;
|
|
680
|
+
if (!item) {
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
const focused = this.hasVisibleFocusInTree() || !!(((_a = this.visibleOptionElements) == null ? void 0 : _a.some) && ((_b = this.visibleOptionElements) == null ? void 0 : _b.some(
|
|
684
|
+
(child) => child.hasVisibleFocusInTree()
|
|
685
|
+
)));
|
|
686
|
+
item.focused = focused;
|
|
687
|
+
if (focused) {
|
|
688
|
+
this.setAttribute("aria-activedescendant", item.id);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
__decorateClass([
|
|
693
|
+
decorators_js.property({ type: String, reflect: true })
|
|
694
|
+
], LuzmoOptions.prototype, "label");
|
|
695
|
+
__decorateClass([
|
|
696
|
+
decorators_js.property({ type: String, reflect: true })
|
|
697
|
+
], LuzmoOptions.prototype, "variant");
|
|
698
|
+
__decorateClass([
|
|
699
|
+
decorators_js.property({ type: String, reflect: true })
|
|
700
|
+
], LuzmoOptions.prototype, "selects");
|
|
701
|
+
__decorateClass([
|
|
702
|
+
decorators_js.property({ type: Boolean, reflect: true })
|
|
703
|
+
], LuzmoOptions.prototype, "emphasized");
|
|
704
|
+
__decorateClass([
|
|
705
|
+
decorators_js.property({ type: Boolean, reflect: true })
|
|
706
|
+
], LuzmoOptions.prototype, "pending");
|
|
707
|
+
__decorateClass([
|
|
708
|
+
decorators_js.property({ type: Array })
|
|
709
|
+
], LuzmoOptions.prototype, "options");
|
|
710
|
+
__decorateClass([
|
|
711
|
+
decorators_js.property({ type: Boolean, reflect: true, attribute: "no-wrap" })
|
|
712
|
+
], LuzmoOptions.prototype, "noWrap");
|
|
713
|
+
__decorateClass([
|
|
714
|
+
decorators_js.property({ type: Array })
|
|
715
|
+
], LuzmoOptions.prototype, "value");
|
|
716
|
+
__decorateClass([
|
|
717
|
+
decorators_js.query("lit-virtualizer")
|
|
718
|
+
], LuzmoOptions.prototype, "virtualizer");
|
|
719
|
+
__decorateClass([
|
|
720
|
+
decorators_js.queryAll("luzmo-option")
|
|
721
|
+
], LuzmoOptions.prototype, "visibleOptionElements");
|
|
722
|
+
if (!customElements.get("luzmo-options")) {
|
|
723
|
+
customElements.define("luzmo-options", LuzmoOptions);
|
|
724
|
+
}
|
|
725
|
+
if (!customElements.get("luzmo-options-divider")) {
|
|
726
|
+
customElements.define("luzmo-options-divider", LuzmoOptionsDivider);
|
|
727
|
+
}
|
|
728
|
+
if (!customElements.get("luzmo-option")) {
|
|
729
|
+
customElements.define("luzmo-option", LuzmoOption);
|
|
730
|
+
}
|
|
731
|
+
exports.LuzmoOption = LuzmoOption;
|
|
732
|
+
exports.LuzmoOptions = LuzmoOptions;
|
|
733
|
+
exports.LuzmoOptionsDivider = LuzmoOptionsDivider;
|
|
734
|
+
exports.VIRTUALIZE_AS_OF_NUM_ITEMS = VIRTUALIZE_AS_OF_NUM_ITEMS;
|