@luzmo/lucero 1.0.1-alpha.15 → 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 +155 -131
- package/components/tooltip/tooltip.d.ts +1 -12
- 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/custom-elements.json +1 -1
- 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-BbVqNU-g.js +0 -53
- package/components/clear-button-DYdeFsS8.cjs +0 -18
- package/components/close-button-CpfKibqg.cjs +0 -18
- package/components/close-button-DzOZZmkY.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-BQoI8AD3.cjs +0 -113
- package/components/index-BwxgAdzi.cjs +0 -57
- package/components/index-Cb9zsiz6.js +0 -1490
- package/components/index-HjQa8tew.js +0 -1174
- 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-D47EGj-3.cjs +0 -29
- package/components/luzmo-icons-NEyaMpEM.js +0 -229
- 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-CAYj4hBD.js +0 -461
- package/components/picker-apS0Zrly.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-BYF2RHY8.cjs +0 -85
- package/components/text-field-PYafEYeO.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,75 +15,87 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
import { O as lo } from "../observe-slot-text-BPfIQQtz.js";
|
|
25
|
-
import { r as ro } from "../random-id-ByCz1xaq.js";
|
|
26
|
-
import { p as D, v as no, z as so, F as ao } from "../luzmo-icons-NEyaMpEM.js";
|
|
27
|
-
import { e as q, i as co, t as K } from "../directive-oAbCiebi.js";
|
|
28
|
-
import { f as ho } from "../async-directive-BfcqVjDp.js";
|
|
29
|
-
import { p as uo, v as w, r as S, M, m as po } from "../directive-helpers-Cm6gitnu.js";
|
|
30
|
-
import { e as mo } from "../base-D76d76ww.js";
|
|
31
|
-
import { S as G } from "../sized-mixin-D4ACoVUr.js";
|
|
32
|
-
import "../progress-circle/index.js";
|
|
33
|
-
import { d as vo } from "../divider.module-DoQWQEIJ.js";
|
|
34
|
-
const Y = () => {
|
|
35
|
-
if (typeof document < "u" && !document.querySelector("style[data-luzmo-vars]")) {
|
|
36
|
-
const n = document.createElement("style");
|
|
37
|
-
n.setAttribute("data-luzmo-vars", ""), n.textContent = 'html{--luzmo-animation-duration: 0.15s;--luzmo-border-color: rgba(var(--luzmo-border-color-rgb), 0.1);--luzmo-border-color-hover: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-down: rgba(var(--luzmo-border-color-rgb), 0.3);--luzmo-border-color-focus: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-rgb: 0, 0, 0;--luzmo-border-color-full: rgb(180, 180, 180);--luzmo-border-color-full-hover: rgb(140, 140, 140);--luzmo-border-color-full-down: rgb(110, 110, 110);--luzmo-border-color-full-focus: rgb(140, 140, 140);--luzmo-border-color-disabled: #dddddd;--luzmo-border-radius: 6px;--luzmo-border-radius-s: 4px;--luzmo-border-radius-l: 8px;--luzmo-border-radius-xl: 12px;--luzmo-border-radius-full: 999rem;--luzmo-background-color: #ffffff;--luzmo-background-color-rgb: 255, 255, 255;--luzmo-background-color-disabled: #eeeeee;--luzmo-background-color-hover: #f0f0fc;--luzmo-background-color-down: #f1f1ff;--luzmo-background-color-focus: #f0f0fc;--luzmo-background-color-highlight: rgb(240, 240, 240);--luzmo-background-color-highlight-disabled: rgb(245, 245, 245);--luzmo-background-color-highlight-hover: rgb(225, 225, 225);--luzmo-background-color-highlight-down: rgb(215, 215, 215);--luzmo-background-color-highlight-focus: rgb(225, 225, 225);--luzmo-border-width: 1px;--luzmo-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;--luzmo-font-size-xs: 10px;--luzmo-font-size-s: 12px;--luzmo-font-size-m: 14px;--luzmo-font-size: 14px;--luzmo-font-size-l: 16px;--luzmo-font-size-xl: 18px;--luzmo-font-size-xxl: 20px;--luzmo-font-style: normal;--luzmo-line-height: normal;--luzmo-font-weight: 400;--luzmo-font-weight-semibold: 500;--luzmo-font-weight-bold: 600;--luzmo-font-color: #333;--luzmo-font-color-hard: #000;--luzmo-font-color-disabled: var(--luzmo-disabled-color);--luzmo-font-color-extra-dimmed: #888;--luzmo-font-color-hover: #333;--luzmo-font-color-down: #111;--luzmo-font-color-focus: #333;--luzmo-primary: #4434ff;--luzmo-primary-hover: #4234e4;--luzmo-primary-down: #392cc7;--luzmo-primary-focus: #4234e4;--luzmo-primary-inverse-color: #ffffff;--luzmo-primary-rgb: 68, 52, 255;--luzmo-secondary: #ff00ff;--luzmo-secondary-hover: #e309e3;--luzmo-secondary-down: #c711c7;--luzmo-secondary-focus: #e309e3;--luzmo-secondary-inverse-color: #ffffff;--luzmo-secondary-rgb: 255, 0, 255;--luzmo-negative-color: #ca221c;--luzmo-negative-color-hover: #b3241f;--luzmo-negative-color-down: #9f231f;--luzmo-negative-color-focus: #b3241f;--luzmo-negative-color-rgb: 202, 34, 28;--luzmo-positive-color: rgb(20, 150, 101);--luzmo-positive-color-hover: rgb(17, 128, 86);--luzmo-positive-color-down: rgb(16, 105, 71);--luzmo-positive-color-focus: rgb(17, 128, 86);--luzmo-positive-color-rgb: 20, 150, 101;--luzmo-selected-color: rgb(110, 110, 110);--luzmo-selected-color-hover: rgb(70, 70, 70);--luzmo-selected-color-down: rgb(40, 40, 40);--luzmo-selected-color-focus: rgb(70, 70, 70);--luzmo-selected-color-hard: #1e1e1e;--luzmo-selected-color-hard-hover: rgb(0, 0, 0);--luzmo-selected-color-hard-down: rgb(0, 0, 0);--luzmo-selected-color-hard-focus: rgb(0, 0, 0);--luzmo-informative-color: #1a77e9;--luzmo-informative-color-rgb: 26, 119, 233;--luzmo-disabled-color: #aaaaaa;--luzmo-spacing-1: 2px;--luzmo-spacing-2: 4px;--luzmo-spacing-3: 8px;--luzmo-spacing-4: 12px;--luzmo-spacing-5: 16px;--luzmo-indicator-gap: 2px;--luzmo-indicator-width: 1px;--luzmo-indicator-color: var(--luzmo-primary);--luzmo-component-height-xxs: 20px;--luzmo-component-height-xs: 24px;--luzmo-component-height-s: 28px;--luzmo-component-height: 32px;--luzmo-component-height-l: 40px;--luzmo-component-height-xl: 48px;--luzmo-component-height-xxl: 64px;--luzmo-icon-size-xxs: 12px;--luzmo-icon-size-xs: 14px;--luzmo-icon-size-s: 16px;--luzmo-icon-size-m: 18px;--luzmo-icon-size-l: 20px;--luzmo-icon-size-xl: 22px;--luzmo-icon-size-xxl: 32px}', document.head.appendChild(n);
|
|
18
|
+
const initializeGlobalLuzmoCSSVariables = () => {
|
|
19
|
+
if (typeof document !== "undefined" && !document.querySelector("style[data-luzmo-vars]")) {
|
|
20
|
+
const styleElement = document.createElement("style");
|
|
21
|
+
styleElement.setAttribute("data-luzmo-vars", "");
|
|
22
|
+
styleElement.textContent = `html{--luzmo-animation-duration: 0.15s;--luzmo-border-color: rgba(var(--luzmo-border-color-rgb), 0.1);--luzmo-border-color-hover: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-down: rgba(var(--luzmo-border-color-rgb), 0.3);--luzmo-border-color-focus: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-rgb: 0, 0, 0;--luzmo-border-color-full: rgb(180, 180, 180);--luzmo-border-color-full-hover: rgb(140, 140, 140);--luzmo-border-color-full-down: rgb(110, 110, 110);--luzmo-border-color-full-focus: rgb(140, 140, 140);--luzmo-border-color-disabled: #dddddd;--luzmo-border-radius: 6px;--luzmo-border-radius-s: 4px;--luzmo-border-radius-l: 8px;--luzmo-border-radius-xl: 12px;--luzmo-border-radius-full: 999rem;--luzmo-background-color: #ffffff;--luzmo-background-color-rgb: 255, 255, 255;--luzmo-background-color-disabled: #eeeeee;--luzmo-background-color-hover: #f0f0fc;--luzmo-background-color-down: #f1f1ff;--luzmo-background-color-focus: #f0f0fc;--luzmo-background-color-highlight: rgb(240, 240, 240);--luzmo-background-color-highlight-disabled: rgb(245, 245, 245);--luzmo-background-color-highlight-hover: rgb(225, 225, 225);--luzmo-background-color-highlight-down: rgb(215, 215, 215);--luzmo-background-color-highlight-focus: rgb(225, 225, 225);--luzmo-border-width: 1px;--luzmo-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;--luzmo-font-size-xs: 10px;--luzmo-font-size-s: 12px;--luzmo-font-size-m: 14px;--luzmo-font-size: 14px;--luzmo-font-size-l: 16px;--luzmo-font-size-xl: 18px;--luzmo-font-size-xxl: 20px;--luzmo-font-style: normal;--luzmo-line-height: normal;--luzmo-font-weight: 400;--luzmo-font-weight-semibold: 500;--luzmo-font-weight-bold: 600;--luzmo-font-color: #333;--luzmo-font-color-hard: #000;--luzmo-font-color-disabled: var(--luzmo-disabled-color);--luzmo-font-color-extra-dimmed: #888;--luzmo-font-color-hover: #333;--luzmo-font-color-down: #111;--luzmo-font-color-focus: #333;--luzmo-primary: #4434ff;--luzmo-primary-hover: #4234e4;--luzmo-primary-down: #392cc7;--luzmo-primary-focus: #4234e4;--luzmo-primary-inverse-color: #ffffff;--luzmo-primary-rgb: 68, 52, 255;--luzmo-secondary: #ff00ff;--luzmo-secondary-hover: #e309e3;--luzmo-secondary-down: #c711c7;--luzmo-secondary-focus: #e309e3;--luzmo-secondary-inverse-color: #ffffff;--luzmo-secondary-rgb: 255, 0, 255;--luzmo-negative-color: #ca221c;--luzmo-negative-color-hover: #b3241f;--luzmo-negative-color-down: #9f231f;--luzmo-negative-color-focus: #b3241f;--luzmo-negative-color-rgb: 202, 34, 28;--luzmo-positive-color: rgb(20, 150, 101);--luzmo-positive-color-hover: rgb(17, 128, 86);--luzmo-positive-color-down: rgb(16, 105, 71);--luzmo-positive-color-focus: rgb(17, 128, 86);--luzmo-positive-color-rgb: 20, 150, 101;--luzmo-selected-color: rgb(110, 110, 110);--luzmo-selected-color-hover: rgb(70, 70, 70);--luzmo-selected-color-down: rgb(40, 40, 40);--luzmo-selected-color-focus: rgb(70, 70, 70);--luzmo-selected-color-hard: #1e1e1e;--luzmo-selected-color-hard-hover: rgb(0, 0, 0);--luzmo-selected-color-hard-down: rgb(0, 0, 0);--luzmo-selected-color-hard-focus: rgb(0, 0, 0);--luzmo-informative-color: #1a77e9;--luzmo-informative-color-rgb: 26, 119, 233;--luzmo-disabled-color: #aaaaaa;--luzmo-spacing-1: 2px;--luzmo-spacing-2: 4px;--luzmo-spacing-3: 8px;--luzmo-spacing-4: 12px;--luzmo-spacing-5: 16px;--luzmo-indicator-gap: 2px;--luzmo-indicator-width: 1px;--luzmo-indicator-color: var(--luzmo-primary);--luzmo-component-height-xxs: 20px;--luzmo-component-height-xs: 24px;--luzmo-component-height-s: 28px;--luzmo-component-height: 32px;--luzmo-component-height-l: 40px;--luzmo-component-height-xl: 48px;--luzmo-component-height-xxl: 64px;--luzmo-icon-size-xxs: 12px;--luzmo-icon-size-xs: 14px;--luzmo-icon-size-s: 16px;--luzmo-icon-size-m: 18px;--luzmo-icon-size-l: 20px;--luzmo-icon-size-xl: 22px;--luzmo-icon-size-xxl: 32px}`;
|
|
23
|
+
document.head.appendChild(styleElement);
|
|
38
24
|
}
|
|
39
25
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
const bo = '#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}';
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return e && i && zo(o, t, i), i;
|
|
26
|
+
initializeGlobalLuzmoCSSVariables();
|
|
27
|
+
import { MutationController } from "@lit-labs/observers/mutation-controller.js";
|
|
28
|
+
import { html, unsafeCSS, nothing } from "lit";
|
|
29
|
+
import { property, query, queryAll } from "lit/decorators.js";
|
|
30
|
+
import { F as Focusable } from "../focusable-ChCLg1k4.js";
|
|
31
|
+
import { L as LikeAnchor } from "../like-anchor-v3cJ9RWM.js";
|
|
32
|
+
import { O as ObserveSlotPresence } from "../observe-slot-presence-DcMdoumP.js";
|
|
33
|
+
import { O as ObserveSlotText } from "../observe-slot-text-CjnkkBPn.js";
|
|
34
|
+
import { r as randomID } from "../random-id-BEc6QIUL.js";
|
|
35
|
+
import { luzmoIcon, luzmoCheckboxChecked, luzmoCheckbox, luzmoCheck } from "@luzmo/icons";
|
|
36
|
+
import "@lit-labs/virtualizer";
|
|
37
|
+
import { repeat } from "lit/directives/repeat.js";
|
|
38
|
+
import { a as LuzmoElement } from "../base-DmeVy0cq.js";
|
|
39
|
+
import { S as SizedMixin } from "../sized-mixin-DmkrNdWB.js";
|
|
40
|
+
import "../progress-circle/index.js";
|
|
41
|
+
import { d as dividerStyles } from "../divider.module-DauH6k2_.js";
|
|
42
|
+
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}';
|
|
43
|
+
var __defProp$1 = Object.defineProperty;
|
|
44
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
45
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
46
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
47
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
48
|
+
if (decorator = decorators[i])
|
|
49
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
50
|
+
if (kind && result) __defProp$1(target, key, result);
|
|
51
|
+
return result;
|
|
57
52
|
};
|
|
58
|
-
const
|
|
59
|
-
<span class="icon-container icon checkmark ${
|
|
60
|
-
${
|
|
53
|
+
const checkIcon = (classes) => html`
|
|
54
|
+
<span class="icon-container icon checkmark ${classes.join(" ")}">
|
|
55
|
+
${luzmoIcon(luzmoCheck)}
|
|
61
56
|
</span>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
`;
|
|
58
|
+
const checkboxIcon = (classes) => html`
|
|
59
|
+
<span class="icon-container icon checkbox ${classes.join(" ")}">
|
|
60
|
+
${luzmoIcon(luzmoCheckbox)}
|
|
65
61
|
</span>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
`;
|
|
63
|
+
const checkboxCheckedIcon = (classes) => html`
|
|
64
|
+
<span class="icon-container icon checkbox ${classes.join(" ")}">
|
|
65
|
+
${luzmoIcon(luzmoCheckboxChecked)}
|
|
69
66
|
</span>
|
|
70
67
|
`;
|
|
71
|
-
class
|
|
72
|
-
|
|
68
|
+
class LuzmoOption extends LikeAnchor(
|
|
69
|
+
ObserveSlotText(ObserveSlotPresence(Focusable, '[slot="icon"]'))
|
|
73
70
|
) {
|
|
74
71
|
constructor() {
|
|
75
|
-
super()
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
super();
|
|
73
|
+
this.active = false;
|
|
74
|
+
this.focused = false;
|
|
75
|
+
this.selected = false;
|
|
76
|
+
this.emphasized = false;
|
|
77
|
+
this.variant = "checkmarks";
|
|
78
|
+
this._value = "";
|
|
79
|
+
this.noWrap = false;
|
|
80
|
+
this.renderCheckIcon = (selected, hasIcon) => {
|
|
81
|
+
const classes = hasIcon ? ["check-icon--with-adjacent-icon"] : [];
|
|
82
|
+
if (this.variant === "checkboxes") {
|
|
83
|
+
return selected ? checkboxCheckedIcon(classes) : checkboxIcon(classes);
|
|
84
|
+
}
|
|
85
|
+
return selected && this.variant !== "highlight" ? checkIcon(classes) : html``;
|
|
86
|
+
};
|
|
87
|
+
this.proxyFocus = () => {
|
|
79
88
|
this.focus();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
89
|
+
};
|
|
90
|
+
this.willDispatchUpdate = false;
|
|
91
|
+
this.addEventListener("click", this.handleClickCapture, {
|
|
92
|
+
capture: true
|
|
93
|
+
});
|
|
94
|
+
new MutationController(this, {
|
|
83
95
|
config: {
|
|
84
|
-
characterData:
|
|
85
|
-
childList:
|
|
86
|
-
subtree:
|
|
96
|
+
characterData: true,
|
|
97
|
+
childList: true,
|
|
98
|
+
subtree: true
|
|
87
99
|
},
|
|
88
100
|
callback: () => {
|
|
89
101
|
this.breakItemChildrenCache();
|
|
@@ -91,20 +103,28 @@ class b extends eo(
|
|
|
91
103
|
});
|
|
92
104
|
}
|
|
93
105
|
static get styles() {
|
|
94
|
-
return [
|
|
106
|
+
return [unsafeCSS(menuItemStyles)];
|
|
95
107
|
}
|
|
96
108
|
get value() {
|
|
97
109
|
return this._value || this.itemText;
|
|
98
110
|
}
|
|
99
|
-
set value(
|
|
100
|
-
|
|
111
|
+
set value(value) {
|
|
112
|
+
if (value === this._value) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
this._value = value || "";
|
|
116
|
+
if (this._value) {
|
|
117
|
+
this.setAttribute("value", this._value);
|
|
118
|
+
} else {
|
|
119
|
+
this.removeAttribute("value");
|
|
120
|
+
}
|
|
101
121
|
}
|
|
102
122
|
/**
|
|
103
123
|
* @private
|
|
104
124
|
*/
|
|
105
125
|
get itemText() {
|
|
106
126
|
return this.itemChildren.content.reduce(
|
|
107
|
-
(
|
|
127
|
+
(acc, node) => acc + (node.textContent || "").trim(),
|
|
108
128
|
""
|
|
109
129
|
);
|
|
110
130
|
}
|
|
@@ -115,35 +135,56 @@ class b extends eo(
|
|
|
115
135
|
return this.slotContentIsPresent;
|
|
116
136
|
}
|
|
117
137
|
get itemChildren() {
|
|
118
|
-
if (!this.iconSlot || !this.contentSlot)
|
|
138
|
+
if (!this.iconSlot || !this.contentSlot) {
|
|
119
139
|
return {
|
|
120
140
|
icon: [],
|
|
121
141
|
content: []
|
|
122
142
|
};
|
|
123
|
-
|
|
143
|
+
}
|
|
144
|
+
if (this._itemChildren) {
|
|
124
145
|
return this._itemChildren;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
146
|
+
}
|
|
147
|
+
const icon = this.iconSlot.assignedElements().map((element) => {
|
|
148
|
+
const newElement = element.cloneNode(true);
|
|
149
|
+
newElement.removeAttribute("slot");
|
|
150
|
+
newElement.classList.toggle("icon");
|
|
151
|
+
return newElement;
|
|
152
|
+
});
|
|
153
|
+
const content = this.contentSlot.assignedNodes().map((node) => node.cloneNode(true));
|
|
154
|
+
this._itemChildren = { icon, content };
|
|
155
|
+
return this._itemChildren;
|
|
130
156
|
}
|
|
131
157
|
click() {
|
|
132
|
-
this.disabled
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if (this.
|
|
136
|
-
return
|
|
158
|
+
if (this.disabled) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (this.shouldProxyClick()) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
super.click();
|
|
165
|
+
}
|
|
166
|
+
handleClickCapture(event) {
|
|
167
|
+
if (this.disabled) {
|
|
168
|
+
event.preventDefault();
|
|
169
|
+
event.stopImmediatePropagation();
|
|
170
|
+
event.stopPropagation();
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
137
173
|
}
|
|
138
174
|
shouldProxyClick() {
|
|
139
|
-
let
|
|
140
|
-
|
|
175
|
+
let handled = false;
|
|
176
|
+
if (this.anchorElement) {
|
|
177
|
+
this.anchorElement.click();
|
|
178
|
+
handled = true;
|
|
179
|
+
}
|
|
180
|
+
return handled;
|
|
141
181
|
}
|
|
142
182
|
breakItemChildrenCache() {
|
|
143
|
-
this._itemChildren = void 0
|
|
183
|
+
this._itemChildren = void 0;
|
|
184
|
+
this.triggerUpdate();
|
|
144
185
|
}
|
|
145
186
|
render() {
|
|
146
|
-
return
|
|
187
|
+
return html`
|
|
147
188
|
${this.renderCheckIcon(this.selected, this.hasIcon)}
|
|
148
189
|
<div id="icon">
|
|
149
190
|
<slot name="icon"></slot>
|
|
@@ -155,771 +196,204 @@ class b extends eo(
|
|
|
155
196
|
<slot name="value"></slot>
|
|
156
197
|
${this.href && this.href.length > 0 ? super.renderAnchor({
|
|
157
198
|
id: "button",
|
|
158
|
-
ariaHidden:
|
|
199
|
+
ariaHidden: true,
|
|
159
200
|
className: "button anchor hidden"
|
|
160
|
-
}) :
|
|
201
|
+
}) : nothing}
|
|
161
202
|
`;
|
|
162
203
|
}
|
|
163
204
|
handlePointerdown() {
|
|
164
205
|
}
|
|
165
|
-
firstUpdated(
|
|
166
|
-
super.firstUpdated(
|
|
206
|
+
firstUpdated(changes) {
|
|
207
|
+
super.firstUpdated(changes);
|
|
208
|
+
this.setAttribute("tabindex", "-1");
|
|
209
|
+
this.addEventListener("pointerdown", this.handlePointerdown);
|
|
210
|
+
if (!this.hasAttribute("id")) {
|
|
211
|
+
this.id = `luzmo-option-${randomID()}`;
|
|
212
|
+
}
|
|
167
213
|
}
|
|
168
214
|
updateAriaSelected() {
|
|
169
|
-
const
|
|
170
|
-
|
|
215
|
+
const role = this.getAttribute("role");
|
|
216
|
+
if (role === "option") {
|
|
217
|
+
this.setAttribute("aria-selected", this.selected ? "true" : "false");
|
|
218
|
+
} else if (role === "optioncheckbox") {
|
|
219
|
+
this.setAttribute("aria-checked", this.selected ? "true" : "false");
|
|
220
|
+
}
|
|
171
221
|
}
|
|
172
|
-
setRole(
|
|
173
|
-
this.setAttribute("role",
|
|
222
|
+
setRole(role) {
|
|
223
|
+
this.setAttribute("role", role);
|
|
224
|
+
this.updateAriaSelected();
|
|
174
225
|
}
|
|
175
|
-
updated(
|
|
176
|
-
super.updated(
|
|
226
|
+
updated(changes) {
|
|
227
|
+
super.updated(changes);
|
|
228
|
+
if (changes.has("label") && (this.label || changes.get("label") !== void 0)) {
|
|
229
|
+
this.setAttribute("aria-label", this.label || "");
|
|
230
|
+
}
|
|
231
|
+
if (this.anchorElement) {
|
|
232
|
+
this.anchorElement.addEventListener("focus", this.proxyFocus);
|
|
233
|
+
this.anchorElement.tabIndex = -1;
|
|
234
|
+
}
|
|
235
|
+
if (changes.has("selected")) {
|
|
236
|
+
this.updateAriaSelected();
|
|
237
|
+
}
|
|
177
238
|
}
|
|
178
239
|
connectedCallback() {
|
|
179
|
-
super.connectedCallback()
|
|
240
|
+
super.connectedCallback();
|
|
241
|
+
this.triggerUpdate();
|
|
180
242
|
}
|
|
181
243
|
async triggerUpdate() {
|
|
182
|
-
|
|
244
|
+
if (this.willDispatchUpdate) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
this.willDispatchUpdate = true;
|
|
248
|
+
await new Promise((ready) => requestAnimationFrame(ready));
|
|
249
|
+
this.dispatchUpdate();
|
|
183
250
|
}
|
|
184
251
|
dispatchUpdate() {
|
|
185
|
-
|
|
252
|
+
if (!this.isConnected) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
this.willDispatchUpdate = false;
|
|
186
256
|
}
|
|
187
257
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
],
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
],
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
],
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
],
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
],
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
],
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
],
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
],
|
|
212
|
-
|
|
213
|
-
|
|
258
|
+
__decorateClass$1([
|
|
259
|
+
property({ type: Boolean, reflect: true })
|
|
260
|
+
], LuzmoOption.prototype, "active", 2);
|
|
261
|
+
__decorateClass$1([
|
|
262
|
+
property({ type: Boolean, reflect: true })
|
|
263
|
+
], LuzmoOption.prototype, "focused", 2);
|
|
264
|
+
__decorateClass$1([
|
|
265
|
+
property({ type: Boolean, reflect: true })
|
|
266
|
+
], LuzmoOption.prototype, "selected", 2);
|
|
267
|
+
__decorateClass$1([
|
|
268
|
+
property({ type: Boolean, reflect: true })
|
|
269
|
+
], LuzmoOption.prototype, "emphasized", 2);
|
|
270
|
+
__decorateClass$1([
|
|
271
|
+
property({ type: String, reflect: true })
|
|
272
|
+
], LuzmoOption.prototype, "variant", 2);
|
|
273
|
+
__decorateClass$1([
|
|
274
|
+
property({ type: String })
|
|
275
|
+
], LuzmoOption.prototype, "value", 1);
|
|
276
|
+
__decorateClass$1([
|
|
277
|
+
query("slot:not([name])")
|
|
278
|
+
], LuzmoOption.prototype, "contentSlot", 2);
|
|
279
|
+
__decorateClass$1([
|
|
280
|
+
query('slot[name="icon"]')
|
|
281
|
+
], LuzmoOption.prototype, "iconSlot", 2);
|
|
282
|
+
__decorateClass$1([
|
|
283
|
+
property({
|
|
214
284
|
type: Boolean,
|
|
215
|
-
reflect:
|
|
285
|
+
reflect: true,
|
|
216
286
|
attribute: "no-wrap",
|
|
217
287
|
hasChanged() {
|
|
218
|
-
return
|
|
288
|
+
return false;
|
|
219
289
|
}
|
|
220
290
|
})
|
|
221
|
-
],
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
],
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") l = Reflect.decorate(n, o, t, e);
|
|
228
|
-
else for (var r = n.length - 1; r >= 0; r--) (s = n[r]) && (l = (i < 3 ? s(l) : i > 3 ? s(o, t, l) : s(o, t)) || l);
|
|
229
|
-
return i > 3 && l && Object.defineProperty(o, t, l), l;
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* @license
|
|
233
|
-
* Copyright 2017 Google LLC
|
|
234
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
235
|
-
*/
|
|
236
|
-
const P = (n, o, t) => {
|
|
237
|
-
const e = /* @__PURE__ */ new Map();
|
|
238
|
-
for (let i = o; i <= t; i++) e.set(n[i], i);
|
|
239
|
-
return e;
|
|
240
|
-
}, Z = q(class extends co {
|
|
241
|
-
constructor(n) {
|
|
242
|
-
if (super(n), n.type !== K.CHILD) throw Error("repeat() can only be used in text expressions");
|
|
243
|
-
}
|
|
244
|
-
dt(n, o, t) {
|
|
245
|
-
let e;
|
|
246
|
-
t === void 0 ? t = o : o !== void 0 && (e = o);
|
|
247
|
-
const i = [], l = [];
|
|
248
|
-
let s = 0;
|
|
249
|
-
for (const r of n) i[s] = e ? e(r, s) : s, l[s] = t(r, s), s++;
|
|
250
|
-
return { values: l, keys: i };
|
|
251
|
-
}
|
|
252
|
-
render(n, o, t) {
|
|
253
|
-
return this.dt(n, o, t).values;
|
|
254
|
-
}
|
|
255
|
-
update(n, [o, t, e]) {
|
|
256
|
-
const i = uo(n), { values: l, keys: s } = this.dt(o, t, e);
|
|
257
|
-
if (!Array.isArray(i)) return this.ut = s, l;
|
|
258
|
-
const r = this.ut ?? (this.ut = []), a = [];
|
|
259
|
-
let c, m, u = 0, d = i.length - 1, h = 0, p = l.length - 1;
|
|
260
|
-
for (; u <= d && h <= p; ) if (i[u] === null) u++;
|
|
261
|
-
else if (i[d] === null) d--;
|
|
262
|
-
else if (r[u] === s[h]) a[h] = w(i[u], l[h]), u++, h++;
|
|
263
|
-
else if (r[d] === s[p]) a[p] = w(i[d], l[p]), d--, p--;
|
|
264
|
-
else if (r[u] === s[p]) a[p] = w(i[u], l[p]), S(n, a[p + 1], i[u]), u++, p--;
|
|
265
|
-
else if (r[d] === s[h]) a[h] = w(i[d], l[h]), S(n, i[u], i[d]), d--, h++;
|
|
266
|
-
else if (c === void 0 && (c = P(s, h, p), m = P(r, u, d)), c.has(r[u])) if (c.has(r[d])) {
|
|
267
|
-
const v = m.get(s[h]), k = v !== void 0 ? i[v] : null;
|
|
268
|
-
if (k === null) {
|
|
269
|
-
const x = S(n, i[u]);
|
|
270
|
-
w(x, l[h]), a[h] = x;
|
|
271
|
-
} else a[h] = w(k, l[h]), S(n, i[u], k), i[v] = null;
|
|
272
|
-
h++;
|
|
273
|
-
} else M(i[d]), d--;
|
|
274
|
-
else M(i[u]), u++;
|
|
275
|
-
for (; h <= p; ) {
|
|
276
|
-
const v = S(n, a[p + 1]);
|
|
277
|
-
w(v, l[h]), a[h++] = v;
|
|
278
|
-
}
|
|
279
|
-
for (; u <= d; ) {
|
|
280
|
-
const v = i[u++];
|
|
281
|
-
v !== null && M(v);
|
|
282
|
-
}
|
|
283
|
-
return this.ut = s, po(n, a), H;
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
/**
|
|
287
|
-
* @license
|
|
288
|
-
* Copyright 2021 Google LLC
|
|
289
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
290
|
-
*/
|
|
291
|
-
class R extends Event {
|
|
292
|
-
constructor(o) {
|
|
293
|
-
super(R.eventName, { bubbles: !1 }), this.first = o.first, this.last = o.last;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
R.eventName = "rangeChanged";
|
|
297
|
-
class $ extends Event {
|
|
298
|
-
constructor(o) {
|
|
299
|
-
super($.eventName, { bubbles: !1 }), this.first = o.first, this.last = o.last;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
$.eventName = "visibilityChanged";
|
|
303
|
-
class F extends Event {
|
|
304
|
-
constructor() {
|
|
305
|
-
super(F.eventName, { bubbles: !1 });
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
F.eventName = "unpinned";
|
|
309
|
-
/**
|
|
310
|
-
* @license
|
|
311
|
-
* Copyright 2021 Google LLC
|
|
312
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
313
|
-
*/
|
|
314
|
-
class wo {
|
|
315
|
-
constructor(o) {
|
|
316
|
-
this._element = null;
|
|
317
|
-
const t = o ?? window;
|
|
318
|
-
this._node = t, o && (this._element = o);
|
|
319
|
-
}
|
|
320
|
-
get element() {
|
|
321
|
-
return this._element || document.scrollingElement || document.documentElement;
|
|
322
|
-
}
|
|
323
|
-
get scrollTop() {
|
|
324
|
-
return this.element.scrollTop || window.scrollY;
|
|
325
|
-
}
|
|
326
|
-
get scrollLeft() {
|
|
327
|
-
return this.element.scrollLeft || window.scrollX;
|
|
328
|
-
}
|
|
329
|
-
get scrollHeight() {
|
|
330
|
-
return this.element.scrollHeight;
|
|
331
|
-
}
|
|
332
|
-
get scrollWidth() {
|
|
333
|
-
return this.element.scrollWidth;
|
|
334
|
-
}
|
|
335
|
-
get viewportHeight() {
|
|
336
|
-
return this._element ? this._element.getBoundingClientRect().height : window.innerHeight;
|
|
337
|
-
}
|
|
338
|
-
get viewportWidth() {
|
|
339
|
-
return this._element ? this._element.getBoundingClientRect().width : window.innerWidth;
|
|
340
|
-
}
|
|
341
|
-
get maxScrollTop() {
|
|
342
|
-
return this.scrollHeight - this.viewportHeight;
|
|
343
|
-
}
|
|
344
|
-
get maxScrollLeft() {
|
|
345
|
-
return this.scrollWidth - this.viewportWidth;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
class Eo extends wo {
|
|
349
|
-
constructor(o, t) {
|
|
350
|
-
super(t), this._clients = /* @__PURE__ */ new Set(), this._retarget = null, this._end = null, this.__destination = null, this.correctingScrollError = !1, this._checkForArrival = this._checkForArrival.bind(this), this._updateManagedScrollTo = this._updateManagedScrollTo.bind(this), this.scrollTo = this.scrollTo.bind(this), this.scrollBy = this.scrollBy.bind(this);
|
|
351
|
-
const e = this._node;
|
|
352
|
-
this._originalScrollTo = e.scrollTo, this._originalScrollBy = e.scrollBy, this._originalScroll = e.scroll, this._attach(o);
|
|
353
|
-
}
|
|
354
|
-
get _destination() {
|
|
355
|
-
return this.__destination;
|
|
356
|
-
}
|
|
357
|
-
get scrolling() {
|
|
358
|
-
return this._destination !== null;
|
|
359
|
-
}
|
|
360
|
-
scrollTo(o, t) {
|
|
361
|
-
const e = typeof o == "number" && typeof t == "number" ? { left: o, top: t } : o;
|
|
362
|
-
this._scrollTo(e);
|
|
363
|
-
}
|
|
364
|
-
scrollBy(o, t) {
|
|
365
|
-
const e = typeof o == "number" && typeof t == "number" ? { left: o, top: t } : o;
|
|
366
|
-
e.top !== void 0 && (e.top += this.scrollTop), e.left !== void 0 && (e.left += this.scrollLeft), this._scrollTo(e);
|
|
367
|
-
}
|
|
368
|
-
_nativeScrollTo(o) {
|
|
369
|
-
this._originalScrollTo.bind(this._element || window)(o);
|
|
370
|
-
}
|
|
371
|
-
_scrollTo(o, t = null, e = null) {
|
|
372
|
-
this._end !== null && this._end(), o.behavior === "smooth" ? (this._setDestination(o), this._retarget = t, this._end = e) : this._resetScrollState(), this._nativeScrollTo(o);
|
|
373
|
-
}
|
|
374
|
-
_setDestination(o) {
|
|
375
|
-
let { top: t, left: e } = o;
|
|
376
|
-
return t = t === void 0 ? void 0 : Math.max(0, Math.min(t, this.maxScrollTop)), e = e === void 0 ? void 0 : Math.max(0, Math.min(e, this.maxScrollLeft)), this._destination !== null && e === this._destination.left && t === this._destination.top ? !1 : (this.__destination = { top: t, left: e, behavior: "smooth" }, !0);
|
|
377
|
-
}
|
|
378
|
-
_resetScrollState() {
|
|
379
|
-
this.__destination = null, this._retarget = null, this._end = null;
|
|
380
|
-
}
|
|
381
|
-
_updateManagedScrollTo(o) {
|
|
382
|
-
this._destination && this._setDestination(o) && this._nativeScrollTo(this._destination);
|
|
383
|
-
}
|
|
384
|
-
managedScrollTo(o, t, e) {
|
|
385
|
-
return this._scrollTo(o, t, e), this._updateManagedScrollTo;
|
|
386
|
-
}
|
|
387
|
-
correctScrollError(o) {
|
|
388
|
-
this.correctingScrollError = !0, requestAnimationFrame(() => requestAnimationFrame(() => this.correctingScrollError = !1)), this._nativeScrollTo(o), this._retarget && this._setDestination(this._retarget()), this._destination && this._nativeScrollTo(this._destination);
|
|
389
|
-
}
|
|
390
|
-
_checkForArrival() {
|
|
391
|
-
if (this._destination !== null) {
|
|
392
|
-
const { scrollTop: o, scrollLeft: t } = this;
|
|
393
|
-
let { top: e, left: i } = this._destination;
|
|
394
|
-
e = Math.min(e || 0, this.maxScrollTop), i = Math.min(i || 0, this.maxScrollLeft);
|
|
395
|
-
const l = Math.abs(e - o), s = Math.abs(i - t);
|
|
396
|
-
l < 1 && s < 1 && (this._end && this._end(), this._resetScrollState());
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
detach(o) {
|
|
400
|
-
return this._clients.delete(o), this._clients.size === 0 && (this._node.scrollTo = this._originalScrollTo, this._node.scrollBy = this._originalScrollBy, this._node.scroll = this._originalScroll, this._node.removeEventListener("scroll", this._checkForArrival)), null;
|
|
401
|
-
}
|
|
402
|
-
_attach(o) {
|
|
403
|
-
this._clients.add(o), this._clients.size === 1 && (this._node.scrollTo = this.scrollTo, this._node.scrollBy = this.scrollBy, this._node.scroll = this.scrollTo, this._node.addEventListener("scroll", this._checkForArrival));
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
/**
|
|
407
|
-
* @license
|
|
408
|
-
* Copyright 2021 Google LLC
|
|
409
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
410
|
-
*/
|
|
411
|
-
let j = typeof window < "u" ? window.ResizeObserver : void 0;
|
|
412
|
-
const B = Symbol("virtualizerRef"), I = "virtualizer-sizer";
|
|
413
|
-
let U;
|
|
414
|
-
class Co {
|
|
415
|
-
constructor(o) {
|
|
416
|
-
if (this._benchmarkStart = null, this._layout = null, this._clippingAncestors = [], this._scrollSize = null, this._scrollError = null, this._childrenPos = null, this._childMeasurements = null, this._toBeMeasured = /* @__PURE__ */ 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 = {
|
|
417
|
-
passive: !0
|
|
418
|
-
}, 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 = /* @__PURE__ */ 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, !o)
|
|
419
|
-
throw new Error("Virtualizer constructor requires a configuration object");
|
|
420
|
-
if (o.hostElement)
|
|
421
|
-
this._init(o);
|
|
422
|
-
else
|
|
423
|
-
throw new Error('Virtualizer configuration requires the "hostElement" property');
|
|
424
|
-
}
|
|
425
|
-
set items(o) {
|
|
426
|
-
Array.isArray(o) && o !== this._items && (this._itemsChanged = !0, this._items = o, this._schedule(this._updateLayout));
|
|
427
|
-
}
|
|
428
|
-
_init(o) {
|
|
429
|
-
this._isScroller = !!o.scroller, this._initHostElement(o);
|
|
430
|
-
const t = o.layout || {};
|
|
431
|
-
this._layoutInitialized = this._initLayout(t);
|
|
432
|
-
}
|
|
433
|
-
_initObservers() {
|
|
434
|
-
this._mutationObserver = new MutationObserver(this._finishDOMUpdate.bind(this)), this._hostElementRO = new j(() => this._hostElementSizeChanged()), this._childrenRO = new j(this._childrenSizeChanged.bind(this));
|
|
435
|
-
}
|
|
436
|
-
_initHostElement(o) {
|
|
437
|
-
const t = this._hostElement = o.hostElement;
|
|
438
|
-
this._applyVirtualizerStyles(), t[B] = this;
|
|
439
|
-
}
|
|
440
|
-
connected() {
|
|
441
|
-
this._initObservers();
|
|
442
|
-
const o = this._isScroller;
|
|
443
|
-
this._clippingAncestors = Io(this._hostElement, o), this._scrollerController = new Eo(this, this._clippingAncestors[0]), this._schedule(this._updateLayout), this._observeAndListen(), this._connected = !0;
|
|
444
|
-
}
|
|
445
|
-
_observeAndListen() {
|
|
446
|
-
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((o) => {
|
|
447
|
-
o.addEventListener("scroll", this, this._scrollEventListenerOptions), this._scrollEventListeners.push(o), this._hostElementRO.observe(o);
|
|
448
|
-
}), this._hostElementRO.observe(this._scrollerController.element), this._children.forEach((o) => this._childrenRO.observe(o)), this._scrollEventListeners.forEach((o) => o.addEventListener("scroll", this, this._scrollEventListenerOptions));
|
|
449
|
-
}
|
|
450
|
-
disconnected() {
|
|
451
|
-
var o, t, e, i;
|
|
452
|
-
this._scrollEventListeners.forEach((l) => l.removeEventListener("scroll", this, this._scrollEventListenerOptions)), this._scrollEventListeners = [], this._clippingAncestors = [], (o = this._scrollerController) == null || o.detach(this), this._scrollerController = null, (t = this._mutationObserver) == null || t.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;
|
|
453
|
-
}
|
|
454
|
-
_applyVirtualizerStyles() {
|
|
455
|
-
const t = this._hostElement.style;
|
|
456
|
-
t.display = t.display || "block", t.position = t.position || "relative", t.contain = t.contain || "size layout", this._isScroller && (t.overflow = t.overflow || "auto", t.minHeight = t.minHeight || "150px");
|
|
457
|
-
}
|
|
458
|
-
_getSizer() {
|
|
459
|
-
const o = this._hostElement;
|
|
460
|
-
if (!this._sizer) {
|
|
461
|
-
let t = o.querySelector(`[${I}]`);
|
|
462
|
-
t || (t = document.createElement("div"), t.setAttribute(I, ""), o.appendChild(t)), Object.assign(t.style, {
|
|
463
|
-
position: "absolute",
|
|
464
|
-
margin: "-2px 0 0 0",
|
|
465
|
-
padding: 0,
|
|
466
|
-
visibility: "hidden",
|
|
467
|
-
fontSize: "2px"
|
|
468
|
-
}), t.textContent = " ", t.setAttribute(I, ""), this._sizer = t;
|
|
469
|
-
}
|
|
470
|
-
return this._sizer;
|
|
471
|
-
}
|
|
472
|
-
async updateLayoutConfig(o) {
|
|
473
|
-
await this._layoutInitialized;
|
|
474
|
-
const t = o.type || // The new config is compatible with the current layout,
|
|
475
|
-
// so we update the config and return true to indicate
|
|
476
|
-
// a successful update
|
|
477
|
-
U;
|
|
478
|
-
if (typeof t == "function" && this._layout instanceof t) {
|
|
479
|
-
const e = { ...o };
|
|
480
|
-
return delete e.type, this._layout.config = e, !0;
|
|
481
|
-
}
|
|
482
|
-
return !1;
|
|
483
|
-
}
|
|
484
|
-
async _initLayout(o) {
|
|
485
|
-
let t, e;
|
|
486
|
-
if (typeof o.type == "function") {
|
|
487
|
-
e = o.type;
|
|
488
|
-
const i = { ...o };
|
|
489
|
-
delete i.type, t = i;
|
|
490
|
-
} else
|
|
491
|
-
t = o;
|
|
492
|
-
e === void 0 && (U = e = (await import("../flow-D-0MTYCm.js")).FlowLayout), this._layout = new e((i) => this._handleLayoutMessage(i), t), 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);
|
|
493
|
-
}
|
|
494
|
-
// TODO (graynorton): Rework benchmarking so that it has no API and
|
|
495
|
-
// instead is always on except in production builds
|
|
496
|
-
startBenchmarking() {
|
|
497
|
-
this._benchmarkStart === null && (this._benchmarkStart = window.performance.now());
|
|
498
|
-
}
|
|
499
|
-
stopBenchmarking() {
|
|
500
|
-
if (this._benchmarkStart !== null) {
|
|
501
|
-
const o = window.performance.now(), t = o - this._benchmarkStart, i = performance.getEntriesByName("uv-virtualizing", "measure").filter((l) => l.startTime >= this._benchmarkStart && l.startTime < o).reduce((l, s) => l + s.duration, 0);
|
|
502
|
-
return this._benchmarkStart = null, { timeElapsed: t, virtualizationTime: i };
|
|
503
|
-
}
|
|
504
|
-
return null;
|
|
505
|
-
}
|
|
506
|
-
_measureChildren() {
|
|
507
|
-
const o = {}, t = this._children, e = this._measureChildOverride || this._measureChild;
|
|
508
|
-
for (let i = 0; i < t.length; i++) {
|
|
509
|
-
const l = t[i], s = this._first + i;
|
|
510
|
-
(this._itemsChanged || this._toBeMeasured.has(l)) && (o[s] = e.call(this, l, this._items[s]));
|
|
511
|
-
}
|
|
512
|
-
this._childMeasurements = o, this._schedule(this._updateLayout), this._toBeMeasured.clear();
|
|
513
|
-
}
|
|
514
|
-
/**
|
|
515
|
-
* Returns the width, height, and margins of the given child.
|
|
516
|
-
*/
|
|
517
|
-
_measureChild(o) {
|
|
518
|
-
const { width: t, height: e } = o.getBoundingClientRect();
|
|
519
|
-
return Object.assign({ width: t, height: e }, So(o));
|
|
520
|
-
}
|
|
521
|
-
async _schedule(o) {
|
|
522
|
-
this._scheduled.has(o) || (this._scheduled.add(o), await Promise.resolve(), this._scheduled.delete(o), o.call(this));
|
|
523
|
-
}
|
|
524
|
-
async _updateDOM(o) {
|
|
525
|
-
this._scrollSize = o.scrollSize, this._adjustRange(o.range), this._childrenPos = o.childPositions, this._scrollError = o.scrollError || null;
|
|
526
|
-
const { _rangeChanged: t, _itemsChanged: e } = this;
|
|
527
|
-
this._visibilityChanged && (this._notifyVisibility(), this._visibilityChanged = !1), (t || e) && (this._notifyRange(), this._rangeChanged = !1), this._finishDOMUpdate();
|
|
528
|
-
}
|
|
529
|
-
_finishDOMUpdate() {
|
|
530
|
-
this._connected && (this._children.forEach((o) => this._childrenRO.observe(o)), 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"));
|
|
531
|
-
}
|
|
532
|
-
_updateLayout() {
|
|
533
|
-
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"));
|
|
534
|
-
}
|
|
535
|
-
_handleScrollEvent() {
|
|
536
|
-
var o;
|
|
537
|
-
if (this._benchmarkStart && "mark" in window.performance) {
|
|
538
|
-
try {
|
|
539
|
-
window.performance.measure("uv-virtualizing", "uv-start", "uv-end");
|
|
540
|
-
} catch (t) {
|
|
541
|
-
console.warn("Error measuring performance data: ", t);
|
|
542
|
-
}
|
|
543
|
-
window.performance.mark("uv-start");
|
|
544
|
-
}
|
|
545
|
-
this._scrollerController.correctingScrollError === !1 && ((o = this._layout) == null || o.unpin()), this._schedule(this._updateLayout);
|
|
546
|
-
}
|
|
547
|
-
handleEvent(o) {
|
|
548
|
-
switch (o.type) {
|
|
549
|
-
case "scroll":
|
|
550
|
-
(o.currentTarget === window || this._clippingAncestors.includes(o.currentTarget)) && this._handleScrollEvent();
|
|
551
|
-
break;
|
|
552
|
-
default:
|
|
553
|
-
console.warn("event not handled", o);
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
_handleLayoutMessage(o) {
|
|
557
|
-
o.type === "stateChanged" ? this._updateDOM(o) : o.type === "visibilityChanged" ? (this._firstVisible = o.firstVisible, this._lastVisible = o.lastVisible, this._notifyVisibility()) : o.type === "unpinned" && this._hostElement.dispatchEvent(new F());
|
|
558
|
-
}
|
|
559
|
-
get _children() {
|
|
560
|
-
const o = [];
|
|
561
|
-
let t = this._hostElement.firstElementChild;
|
|
562
|
-
for (; t; )
|
|
563
|
-
t.hasAttribute(I) || o.push(t), t = t.nextElementSibling;
|
|
564
|
-
return o;
|
|
565
|
-
}
|
|
566
|
-
_updateView() {
|
|
567
|
-
var i;
|
|
568
|
-
const o = this._hostElement, t = (i = this._scrollerController) == null ? void 0 : i.element, e = this._layout;
|
|
569
|
-
if (o && t && e) {
|
|
570
|
-
let l, s, r, a;
|
|
571
|
-
const c = o.getBoundingClientRect();
|
|
572
|
-
l = 0, s = 0, r = window.innerHeight, a = window.innerWidth;
|
|
573
|
-
const m = this._clippingAncestors.map((E) => E.getBoundingClientRect());
|
|
574
|
-
m.unshift(c);
|
|
575
|
-
for (const E of m)
|
|
576
|
-
l = Math.max(l, E.top), s = Math.max(s, E.left), r = Math.min(r, E.bottom), a = Math.min(a, E.right);
|
|
577
|
-
const u = t.getBoundingClientRect(), d = {
|
|
578
|
-
left: c.left - u.left,
|
|
579
|
-
top: c.top - u.top
|
|
580
|
-
}, h = {
|
|
581
|
-
width: t.scrollWidth,
|
|
582
|
-
height: t.scrollHeight
|
|
583
|
-
}, p = l - c.top + o.scrollTop, v = s - c.left + o.scrollLeft, k = Math.max(0, r - l), x = Math.max(0, a - s);
|
|
584
|
-
e.viewportSize = { width: x, height: k }, e.viewportScroll = { top: p, left: v }, e.totalScrollSize = h, e.offsetWithinScroller = d;
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
/**
|
|
588
|
-
* Styles the host element so that its size reflects the
|
|
589
|
-
* total size of all items.
|
|
590
|
-
*/
|
|
591
|
-
_sizeHostElement(o) {
|
|
592
|
-
const e = o && o.width !== null ? Math.min(82e5, o.width) : 0, i = o && o.height !== null ? Math.min(82e5, o.height) : 0;
|
|
593
|
-
if (this._isScroller)
|
|
594
|
-
this._getSizer().style.transform = `translate(${e}px, ${i}px)`;
|
|
595
|
-
else {
|
|
596
|
-
const l = this._hostElement.style;
|
|
597
|
-
l.minWidth = e ? `${e}px` : "100%", l.minHeight = i ? `${i}px` : "100%";
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
/**
|
|
601
|
-
* Sets the top and left transform style of the children from the values in
|
|
602
|
-
* pos.
|
|
603
|
-
*/
|
|
604
|
-
_positionChildren(o) {
|
|
605
|
-
o && o.forEach(({ top: t, left: e, width: i, height: l, xOffset: s, yOffset: r }, a) => {
|
|
606
|
-
const c = this._children[a - this._first];
|
|
607
|
-
c && (c.style.position = "absolute", c.style.boxSizing = "border-box", c.style.transform = `translate(${e}px, ${t}px)`, i !== void 0 && (c.style.width = i + "px"), l !== void 0 && (c.style.height = l + "px"), c.style.left = s === void 0 ? null : s + "px", c.style.top = r === void 0 ? null : r + "px");
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
async _adjustRange(o) {
|
|
611
|
-
const { _first: t, _last: e, _firstVisible: i, _lastVisible: l } = this;
|
|
612
|
-
this._first = o.first, this._last = o.last, this._firstVisible = o.firstVisible, this._lastVisible = o.lastVisible, this._rangeChanged = this._rangeChanged || this._first !== t || this._last !== e, this._visibilityChanged = this._visibilityChanged || this._firstVisible !== i || this._lastVisible !== l;
|
|
613
|
-
}
|
|
614
|
-
_correctScrollError() {
|
|
615
|
-
if (this._scrollError) {
|
|
616
|
-
const { scrollTop: o, scrollLeft: t } = this._scrollerController, { top: e, left: i } = this._scrollError;
|
|
617
|
-
this._scrollError = null, this._scrollerController.correctScrollError({
|
|
618
|
-
top: o - e,
|
|
619
|
-
left: t - i
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
element(o) {
|
|
624
|
-
var t;
|
|
625
|
-
return o === 1 / 0 && (o = this._items.length - 1), ((t = this._items) == null ? void 0 : t[o]) === void 0 ? void 0 : {
|
|
626
|
-
scrollIntoView: (e = {}) => this._scrollElementIntoView({ ...e, index: o })
|
|
627
|
-
};
|
|
628
|
-
}
|
|
629
|
-
_scrollElementIntoView(o) {
|
|
630
|
-
if (o.index >= this._first && o.index <= this._last)
|
|
631
|
-
this._children[o.index - this._first].scrollIntoView(o);
|
|
632
|
-
else if (o.index = Math.min(o.index, this._items.length - 1), o.behavior === "smooth") {
|
|
633
|
-
const t = this._layout.getScrollIntoViewCoordinates(o), { behavior: e } = o;
|
|
634
|
-
this._updateScrollIntoViewCoordinates = this._scrollerController.managedScrollTo(Object.assign(t, { behavior: e }), () => this._layout.getScrollIntoViewCoordinates(o), () => this._scrollIntoViewTarget = null), this._scrollIntoViewTarget = o;
|
|
635
|
-
} else
|
|
636
|
-
this._layout.pin = o;
|
|
637
|
-
}
|
|
638
|
-
/**
|
|
639
|
-
* If we are smoothly scrolling to an element and the target element
|
|
640
|
-
* is in the DOM, we update our target coordinates as needed
|
|
641
|
-
*/
|
|
642
|
-
_checkScrollIntoViewTarget(o) {
|
|
643
|
-
const { index: t } = this._scrollIntoViewTarget || {};
|
|
644
|
-
t && (o != null && o.has(t)) && this._updateScrollIntoViewCoordinates(this._layout.getScrollIntoViewCoordinates(this._scrollIntoViewTarget));
|
|
645
|
-
}
|
|
646
|
-
/**
|
|
647
|
-
* Emits a rangechange event with the current first, last, firstVisible, and
|
|
648
|
-
* lastVisible.
|
|
649
|
-
*/
|
|
650
|
-
_notifyRange() {
|
|
651
|
-
this._hostElement.dispatchEvent(new R({ first: this._first, last: this._last }));
|
|
652
|
-
}
|
|
653
|
-
_notifyVisibility() {
|
|
654
|
-
this._hostElement.dispatchEvent(new $({
|
|
655
|
-
first: this._firstVisible,
|
|
656
|
-
last: this._lastVisible
|
|
657
|
-
}));
|
|
658
|
-
}
|
|
659
|
-
get layoutComplete() {
|
|
660
|
-
return this._layoutCompletePromise || (this._layoutCompletePromise = new Promise((o, t) => {
|
|
661
|
-
this._layoutCompleteResolver = o, this._layoutCompleteRejecter = t;
|
|
662
|
-
})), this._layoutCompletePromise;
|
|
663
|
-
}
|
|
664
|
-
_rejectLayoutCompletePromise(o) {
|
|
665
|
-
this._layoutCompleteRejecter !== null && this._layoutCompleteRejecter(o), this._resetLayoutCompleteState();
|
|
666
|
-
}
|
|
667
|
-
_scheduleLayoutComplete() {
|
|
668
|
-
this._layoutCompletePromise && this._pendingLayoutComplete === null && (this._pendingLayoutComplete = requestAnimationFrame(() => requestAnimationFrame(() => this._resolveLayoutCompletePromise())));
|
|
669
|
-
}
|
|
670
|
-
_resolveLayoutCompletePromise() {
|
|
671
|
-
this._layoutCompleteResolver !== null && this._layoutCompleteResolver(), this._resetLayoutCompleteState();
|
|
672
|
-
}
|
|
673
|
-
_resetLayoutCompleteState() {
|
|
674
|
-
this._layoutCompletePromise = null, this._layoutCompleteResolver = null, this._layoutCompleteRejecter = null, this._pendingLayoutComplete = null;
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* Render and update the view at the next opportunity with the given
|
|
678
|
-
* hostElement size.
|
|
679
|
-
*/
|
|
680
|
-
_hostElementSizeChanged() {
|
|
681
|
-
this._schedule(this._updateLayout);
|
|
682
|
-
}
|
|
683
|
-
// TODO (graynorton): Rethink how this works. Probably child loading is too specific
|
|
684
|
-
// to have dedicated support for; might want some more generic lifecycle hooks for
|
|
685
|
-
// layouts to use. Possibly handle measurement this way, too, or maybe that remains
|
|
686
|
-
// a first-class feature?
|
|
687
|
-
_childLoaded() {
|
|
688
|
-
}
|
|
689
|
-
// This is the callback for the ResizeObserver that watches the
|
|
690
|
-
// virtualizer's children. We land here at the end of every virtualizer
|
|
691
|
-
// update cycle that results in changes to physical items, and we also
|
|
692
|
-
// end up here if one or more children change size independently of
|
|
693
|
-
// the virtualizer update cycle.
|
|
694
|
-
_childrenSizeChanged(o) {
|
|
695
|
-
var t;
|
|
696
|
-
if ((t = this._layout) != null && t.measureChildren) {
|
|
697
|
-
for (const e of o)
|
|
698
|
-
this._toBeMeasured.set(e.target, e.contentRect);
|
|
699
|
-
this._measureChildren();
|
|
700
|
-
}
|
|
701
|
-
this._scheduleLayoutComplete(), this._itemsChanged = !1, this._rangeChanged = !1;
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
function So(n) {
|
|
705
|
-
const o = window.getComputedStyle(n);
|
|
706
|
-
return {
|
|
707
|
-
marginTop: A(o.marginTop),
|
|
708
|
-
marginRight: A(o.marginRight),
|
|
709
|
-
marginBottom: A(o.marginBottom),
|
|
710
|
-
marginLeft: A(o.marginLeft)
|
|
711
|
-
};
|
|
712
|
-
}
|
|
713
|
-
function A(n) {
|
|
714
|
-
const o = n ? parseFloat(n) : NaN;
|
|
715
|
-
return Number.isNaN(o) ? 0 : o;
|
|
716
|
-
}
|
|
717
|
-
function N(n) {
|
|
718
|
-
if (n.assignedSlot !== null)
|
|
719
|
-
return n.assignedSlot;
|
|
720
|
-
if (n.parentElement !== null)
|
|
721
|
-
return n.parentElement;
|
|
722
|
-
const o = n.parentNode;
|
|
723
|
-
return o && o.nodeType === Node.DOCUMENT_FRAGMENT_NODE && o.host || null;
|
|
724
|
-
}
|
|
725
|
-
function Oo(n, o = !1) {
|
|
726
|
-
const t = [];
|
|
727
|
-
let e = o ? n : N(n);
|
|
728
|
-
for (; e !== null; )
|
|
729
|
-
t.push(e), e = N(e);
|
|
730
|
-
return t;
|
|
731
|
-
}
|
|
732
|
-
function Io(n, o = !1) {
|
|
733
|
-
let t = !1;
|
|
734
|
-
return Oo(n, o).filter((e) => {
|
|
735
|
-
if (t)
|
|
736
|
-
return !1;
|
|
737
|
-
const i = getComputedStyle(e);
|
|
738
|
-
return t = i.position === "fixed", i.overflow !== "visible";
|
|
739
|
-
});
|
|
740
|
-
}
|
|
741
|
-
/**
|
|
742
|
-
* @license
|
|
743
|
-
* Copyright 2021 Google LLC
|
|
744
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
745
|
-
*/
|
|
746
|
-
const J = (n) => n, X = (n, o) => g`${o}: ${JSON.stringify(n, null, 2)}`;
|
|
747
|
-
class Ao extends ho {
|
|
748
|
-
constructor(o) {
|
|
749
|
-
if (super(o), this._virtualizer = null, this._first = 0, this._last = -1, this._renderItem = (t, e) => X(t, e + this._first), this._keyFunction = (t, e) => J(t, e + this._first), this._items = [], o.type !== K.CHILD)
|
|
750
|
-
throw new Error("The virtualize directive can only be used in child expressions");
|
|
751
|
-
}
|
|
752
|
-
render(o) {
|
|
753
|
-
o && this._setFunctions(o);
|
|
754
|
-
const t = [];
|
|
755
|
-
if (this._first >= 0 && this._last >= this._first)
|
|
756
|
-
for (let e = this._first; e <= this._last; e++)
|
|
757
|
-
t.push(this._items[e]);
|
|
758
|
-
return Z(t, this._keyFunction, this._renderItem);
|
|
759
|
-
}
|
|
760
|
-
update(o, [t]) {
|
|
761
|
-
this._setFunctions(t);
|
|
762
|
-
const e = this._items !== t.items;
|
|
763
|
-
return this._items = t.items || [], this._virtualizer ? this._updateVirtualizerConfig(o, t) : this._initialize(o, t), e ? H : this.render();
|
|
764
|
-
}
|
|
765
|
-
async _updateVirtualizerConfig(o, t) {
|
|
766
|
-
if (!await this._virtualizer.updateLayoutConfig(t.layout || {})) {
|
|
767
|
-
const i = o.parentNode;
|
|
768
|
-
this._makeVirtualizer(i, t);
|
|
769
|
-
}
|
|
770
|
-
this._virtualizer.items = this._items;
|
|
771
|
-
}
|
|
772
|
-
_setFunctions(o) {
|
|
773
|
-
const { renderItem: t, keyFunction: e } = o;
|
|
774
|
-
t && (this._renderItem = (i, l) => t(i, l + this._first)), e && (this._keyFunction = (i, l) => e(i, l + this._first));
|
|
775
|
-
}
|
|
776
|
-
_makeVirtualizer(o, t) {
|
|
777
|
-
this._virtualizer && this._virtualizer.disconnected();
|
|
778
|
-
const { layout: e, scroller: i, items: l } = t;
|
|
779
|
-
this._virtualizer = new Co({ hostElement: o, layout: e, scroller: i }), this._virtualizer.items = l, this._virtualizer.connected();
|
|
780
|
-
}
|
|
781
|
-
_initialize(o, t) {
|
|
782
|
-
const e = o.parentNode;
|
|
783
|
-
e && e.nodeType === 1 && (e.addEventListener("rangeChanged", (i) => {
|
|
784
|
-
this._first = i.first, this._last = i.last, this.setValue(this.render());
|
|
785
|
-
}), this._makeVirtualizer(e, t));
|
|
786
|
-
}
|
|
787
|
-
disconnected() {
|
|
788
|
-
var o;
|
|
789
|
-
(o = this._virtualizer) == null || o.disconnected();
|
|
790
|
-
}
|
|
791
|
-
reconnected() {
|
|
792
|
-
var o;
|
|
793
|
-
(o = this._virtualizer) == null || o.connected();
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
const Lo = q(Ao);
|
|
797
|
-
/**
|
|
798
|
-
* @license
|
|
799
|
-
* Copyright 2021 Google LLC
|
|
800
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
801
|
-
*/
|
|
802
|
-
class C extends oo {
|
|
803
|
-
constructor() {
|
|
804
|
-
super(...arguments), this.items = [], this.renderItem = X, this.keyFunction = J, this.layout = {}, this.scroller = !1;
|
|
805
|
-
}
|
|
806
|
-
createRenderRoot() {
|
|
807
|
-
return this;
|
|
808
|
-
}
|
|
809
|
-
render() {
|
|
810
|
-
const { items: o, renderItem: t, keyFunction: e, layout: i, scroller: l } = this;
|
|
811
|
-
return g`${Lo({
|
|
812
|
-
items: o,
|
|
813
|
-
renderItem: t,
|
|
814
|
-
keyFunction: e,
|
|
815
|
-
layout: i,
|
|
816
|
-
scroller: l
|
|
817
|
-
})}`;
|
|
818
|
-
}
|
|
819
|
-
element(o) {
|
|
820
|
-
var t;
|
|
821
|
-
return (t = this[B]) == null ? void 0 : t.element(o);
|
|
822
|
-
}
|
|
823
|
-
get layoutComplete() {
|
|
824
|
-
var o;
|
|
825
|
-
return (o = this[B]) == null ? void 0 : o.layoutComplete;
|
|
826
|
-
}
|
|
827
|
-
/**
|
|
828
|
-
* This scrollToIndex() shim is here to provide backwards compatibility with other 0.x versions of
|
|
829
|
-
* lit-virtualizer. It is deprecated and will likely be removed in the 1.0.0 release.
|
|
830
|
-
*/
|
|
831
|
-
scrollToIndex(o, t = "start") {
|
|
832
|
-
var e;
|
|
833
|
-
(e = this.element(o)) == null || e.scrollIntoView({ block: t });
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
O([
|
|
837
|
-
f({ attribute: !1 })
|
|
838
|
-
], C.prototype, "items", void 0);
|
|
839
|
-
O([
|
|
840
|
-
f()
|
|
841
|
-
], C.prototype, "renderItem", void 0);
|
|
842
|
-
O([
|
|
843
|
-
f()
|
|
844
|
-
], C.prototype, "keyFunction", void 0);
|
|
845
|
-
O([
|
|
846
|
-
f({ attribute: !1 })
|
|
847
|
-
], C.prototype, "layout", void 0);
|
|
848
|
-
O([
|
|
849
|
-
f({ reflect: !0, type: Boolean })
|
|
850
|
-
], C.prototype, "scroller", void 0);
|
|
851
|
-
/**
|
|
852
|
-
* @license
|
|
853
|
-
* Copyright 2021 Google LLC
|
|
854
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
855
|
-
*/
|
|
856
|
-
customElements.define("lit-virtualizer", C);
|
|
857
|
-
const To = ":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}";
|
|
858
|
-
class Vo extends G(W, {
|
|
291
|
+
], LuzmoOption.prototype, "noWrap", 2);
|
|
292
|
+
__decorateClass$1([
|
|
293
|
+
query(".anchor")
|
|
294
|
+
], LuzmoOption.prototype, "anchorElement", 2);
|
|
295
|
+
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}";
|
|
296
|
+
class LuzmoOptionsDivider extends SizedMixin(LuzmoElement, {
|
|
859
297
|
validSizes: ["s", "m", "l"]
|
|
860
298
|
}) {
|
|
861
299
|
static get styles() {
|
|
862
|
-
return [
|
|
300
|
+
return [unsafeCSS(dividerStyles), unsafeCSS(optionsDividerStyles)];
|
|
863
301
|
}
|
|
864
|
-
firstUpdated(
|
|
865
|
-
super.firstUpdated(
|
|
302
|
+
firstUpdated(changed) {
|
|
303
|
+
super.firstUpdated(changed);
|
|
304
|
+
this.setAttribute("role", "separator");
|
|
866
305
|
}
|
|
867
306
|
}
|
|
868
|
-
const
|
|
869
|
-
var
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
307
|
+
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}";
|
|
308
|
+
var __defProp = Object.defineProperty;
|
|
309
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
310
|
+
var result = void 0;
|
|
311
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
312
|
+
if (decorator = decorators[i])
|
|
313
|
+
result = decorator(target, key, result) || result;
|
|
314
|
+
if (result) __defProp(target, key, result);
|
|
315
|
+
return result;
|
|
873
316
|
};
|
|
874
|
-
const
|
|
875
|
-
function
|
|
876
|
-
return !!
|
|
317
|
+
const VIRTUALIZE_AS_OF_NUM_ITEMS = 25;
|
|
318
|
+
function elementIsOrContains(el, isOrContains) {
|
|
319
|
+
return !!isOrContains && (el === isOrContains || el.contains(isOrContains));
|
|
877
320
|
}
|
|
878
|
-
class
|
|
879
|
-
noDefaultSize:
|
|
321
|
+
class LuzmoOptions extends SizedMixin(LuzmoElement, {
|
|
322
|
+
noDefaultSize: true
|
|
880
323
|
}) {
|
|
881
324
|
constructor() {
|
|
882
|
-
super()
|
|
325
|
+
super();
|
|
326
|
+
this.label = "";
|
|
327
|
+
this.variant = "highlight";
|
|
328
|
+
this.selects = "single";
|
|
329
|
+
this.emphasized = false;
|
|
330
|
+
this.pending = false;
|
|
331
|
+
this.options = [];
|
|
332
|
+
this.value = [];
|
|
333
|
+
this.focusedOptionIndex = 0;
|
|
334
|
+
this._selectedOptions = [];
|
|
335
|
+
this._firstVisibleIndex = 0;
|
|
336
|
+
this.addEventListener("focusin", this.handleFocusin);
|
|
337
|
+
this.addEventListener("blur", this.handleBlur);
|
|
883
338
|
}
|
|
884
339
|
/**
|
|
885
340
|
* @internal
|
|
886
341
|
*/
|
|
887
342
|
static get styles() {
|
|
888
|
-
return [
|
|
343
|
+
return [unsafeCSS(optionsStyles)];
|
|
889
344
|
}
|
|
890
345
|
/**
|
|
891
346
|
* @internal
|
|
892
347
|
*/
|
|
893
348
|
get _virtualizeActive() {
|
|
894
|
-
return this.options.length >
|
|
349
|
+
return this.options.length > VIRTUALIZE_AS_OF_NUM_ITEMS;
|
|
895
350
|
}
|
|
896
|
-
firstUpdated(
|
|
897
|
-
super.firstUpdated(
|
|
898
|
-
|
|
899
|
-
|
|
351
|
+
firstUpdated(changed) {
|
|
352
|
+
super.firstUpdated(changed);
|
|
353
|
+
if (!this.hasAttribute("tabindex")) {
|
|
354
|
+
this.tabIndex = 0;
|
|
355
|
+
}
|
|
356
|
+
const updates = [
|
|
357
|
+
new Promise((res) => requestAnimationFrame(() => res(true)))
|
|
900
358
|
];
|
|
901
|
-
[...this.children].forEach((
|
|
902
|
-
|
|
903
|
-
|
|
359
|
+
[...this.children].forEach((item) => {
|
|
360
|
+
if (item.localName === "luzmo-option") {
|
|
361
|
+
updates.push(item.updateComplete);
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
this.optionElementsUpdated = Promise.all(updates);
|
|
904
365
|
}
|
|
905
|
-
willUpdate(
|
|
906
|
-
var
|
|
907
|
-
|
|
366
|
+
willUpdate(changes) {
|
|
367
|
+
var _a;
|
|
368
|
+
const hasChangedSelects = changes.has("selects");
|
|
369
|
+
if (hasChangedSelects && this.selects === "single" && ((_a = this.value) == null ? void 0 : _a.length) > 1) {
|
|
370
|
+
this.value = this.value.slice(0, 1);
|
|
371
|
+
}
|
|
908
372
|
}
|
|
909
|
-
updated(
|
|
910
|
-
super.updated(
|
|
373
|
+
updated(changes) {
|
|
374
|
+
super.updated(changes);
|
|
375
|
+
const changedLabel = changes.has("label");
|
|
376
|
+
if (changedLabel && (this.label || changes.get("label") !== void 0)) {
|
|
377
|
+
if (this.label) {
|
|
378
|
+
this.setAttribute("aria-label", this.label);
|
|
379
|
+
} else {
|
|
380
|
+
this.removeAttribute("aria-label");
|
|
381
|
+
}
|
|
382
|
+
}
|
|
911
383
|
}
|
|
912
384
|
async getUpdateComplete() {
|
|
913
|
-
const
|
|
914
|
-
|
|
385
|
+
const complete = await super.getUpdateComplete();
|
|
386
|
+
await this.optionElementsUpdated;
|
|
387
|
+
return complete;
|
|
915
388
|
}
|
|
916
|
-
focus({ preventScroll
|
|
917
|
-
super.focus({ preventScroll
|
|
389
|
+
focus({ preventScroll } = {}) {
|
|
390
|
+
super.focus({ preventScroll });
|
|
391
|
+
this.focusOptionByOffset(0);
|
|
918
392
|
}
|
|
919
393
|
_removeFocusedPropertyOnOptions() {
|
|
920
394
|
requestAnimationFrame(() => {
|
|
921
|
-
this.visibleOptionElements.forEach((
|
|
922
|
-
|
|
395
|
+
this.visibleOptionElements.forEach((item) => {
|
|
396
|
+
item.focused = false;
|
|
923
397
|
});
|
|
924
398
|
});
|
|
925
399
|
}
|
|
@@ -930,8 +404,13 @@ class z extends G(W, {
|
|
|
930
404
|
this.startListeningToKeyboard();
|
|
931
405
|
}
|
|
932
406
|
// 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
|
|
933
|
-
handleBlur(
|
|
934
|
-
|
|
407
|
+
handleBlur(event) {
|
|
408
|
+
if (elementIsOrContains(this, event.relatedTarget)) {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
this.stopListeningToKeyboard();
|
|
412
|
+
this._removeFocusedPropertyOnOptions();
|
|
413
|
+
this.removeAttribute("aria-activedescendant");
|
|
935
414
|
}
|
|
936
415
|
startListeningToKeyboard() {
|
|
937
416
|
this.addEventListener("keydown", this.handleKeydown);
|
|
@@ -939,167 +418,242 @@ class z extends G(W, {
|
|
|
939
418
|
stopListeningToKeyboard() {
|
|
940
419
|
this.removeEventListener("keydown", this.handleKeydown);
|
|
941
420
|
}
|
|
942
|
-
handleKeydown(
|
|
943
|
-
var
|
|
944
|
-
if (
|
|
421
|
+
handleKeydown(event) {
|
|
422
|
+
var _a;
|
|
423
|
+
if (event.defaultPrevented) {
|
|
945
424
|
return;
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
425
|
+
}
|
|
426
|
+
const lastFocusedIndex = this.focusedOptionIndex;
|
|
427
|
+
const lastFocusedItem = [...this.visibleOptionElements].find(
|
|
428
|
+
(item) => {
|
|
429
|
+
var _a2, _b, _c, _d;
|
|
430
|
+
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());
|
|
950
431
|
}
|
|
951
|
-
)
|
|
952
|
-
|
|
432
|
+
);
|
|
433
|
+
const { key } = event;
|
|
434
|
+
if (key === "Tab") {
|
|
953
435
|
this.prepareToCleanUp();
|
|
954
436
|
return;
|
|
955
437
|
}
|
|
956
|
-
if (
|
|
957
|
-
|
|
438
|
+
if (key === " " || key === "Enter") {
|
|
439
|
+
event.preventDefault();
|
|
440
|
+
if (lastFocusedItem) {
|
|
441
|
+
this.toggleOption(event, (_a = this.options) == null ? void 0 : _a[lastFocusedIndex]);
|
|
442
|
+
}
|
|
958
443
|
return;
|
|
959
444
|
}
|
|
960
|
-
if (
|
|
961
|
-
|
|
445
|
+
if (key === "ArrowDown" || key === "ArrowUp") {
|
|
446
|
+
event.preventDefault();
|
|
447
|
+
this.navigateWithinOptions(event, lastFocusedItem);
|
|
962
448
|
return;
|
|
963
449
|
}
|
|
964
450
|
}
|
|
965
|
-
navigateWithinOptions(
|
|
966
|
-
const { key
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
451
|
+
navigateWithinOptions(event, optionElement) {
|
|
452
|
+
const { key } = event;
|
|
453
|
+
const direction = key === "ArrowDown" ? 1 : -1;
|
|
454
|
+
event.preventDefault();
|
|
455
|
+
event.stopPropagation();
|
|
456
|
+
const itemToFocus = this.focusOptionByOffset(
|
|
457
|
+
direction,
|
|
458
|
+
optionElement,
|
|
459
|
+
true
|
|
972
460
|
);
|
|
973
|
-
|
|
461
|
+
if (itemToFocus === optionElement) {
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
if (!this._virtualizeActive) {
|
|
465
|
+
itemToFocus == null ? void 0 : itemToFocus.scrollIntoView({ block: "nearest" });
|
|
466
|
+
}
|
|
974
467
|
}
|
|
975
|
-
focusOptionByOffset(
|
|
976
|
-
var
|
|
977
|
-
const
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
(
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
(
|
|
995
|
-
|
|
996
|
-
|
|
468
|
+
focusOptionByOffset(offset, optionElement, scrollIntoView) {
|
|
469
|
+
var _a;
|
|
470
|
+
const step = offset || 1;
|
|
471
|
+
if (optionElement) {
|
|
472
|
+
optionElement.focused = false;
|
|
473
|
+
}
|
|
474
|
+
const previousFocusedOptionIndex = this.focusedOptionIndex;
|
|
475
|
+
this.focusedOptionIndex = this.options.length > 0 ? (this.options.length + this.focusedOptionIndex + offset) % this.options.length : 0;
|
|
476
|
+
let optionToFocus = this.options[this.focusedOptionIndex];
|
|
477
|
+
let availableItems = this.options.length;
|
|
478
|
+
while (((optionToFocus == null ? void 0 : optionToFocus.disabled) || (optionToFocus == null ? void 0 : optionToFocus.divider)) && availableItems) {
|
|
479
|
+
availableItems -= 1;
|
|
480
|
+
this.focusedOptionIndex = (this.options.length + this.focusedOptionIndex + step) % this.options.length;
|
|
481
|
+
optionToFocus = this.options[this.focusedOptionIndex];
|
|
482
|
+
}
|
|
483
|
+
const reachedStart = previousFocusedOptionIndex < this.focusedOptionIndex && offset === -1;
|
|
484
|
+
const reachedEnd = previousFocusedOptionIndex > this.focusedOptionIndex && offset === 1;
|
|
485
|
+
if (reachedStart || reachedEnd) {
|
|
486
|
+
this.focusedOptionIndex = previousFocusedOptionIndex;
|
|
487
|
+
this.dispatchEvent(
|
|
488
|
+
new Event(`luzmo-exceeded-${reachedStart ? "top" : "bottom"}`, {
|
|
489
|
+
bubbles: true,
|
|
490
|
+
composed: true,
|
|
491
|
+
cancelable: true
|
|
492
|
+
})
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
let itemToFocus;
|
|
496
|
+
if (scrollIntoView && this._virtualizeActive) {
|
|
497
|
+
itemToFocus = [...this.visibleOptionElements].find(
|
|
498
|
+
(item) => {
|
|
499
|
+
var _a2, _b, _c;
|
|
500
|
+
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());
|
|
501
|
+
}
|
|
502
|
+
);
|
|
503
|
+
if (!itemToFocus) {
|
|
504
|
+
this.focusedOptionIndex = this._firstVisibleIndex;
|
|
997
505
|
}
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
506
|
+
}
|
|
507
|
+
if (this._virtualizeActive && scrollIntoView) {
|
|
508
|
+
(_a = this.virtualizer.element(this.focusedOptionIndex)) == null ? void 0 : _a.scrollIntoView({
|
|
509
|
+
behavior: "smooth",
|
|
510
|
+
block: "nearest"
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
itemToFocus = itemToFocus ?? [...this.visibleOptionElements].find(
|
|
514
|
+
(item) => {
|
|
515
|
+
var _a2, _b, _c, _d, _e;
|
|
516
|
+
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());
|
|
1005
517
|
}
|
|
1006
|
-
)
|
|
518
|
+
);
|
|
519
|
+
if (!(optionToFocus == null ? void 0 : optionToFocus.disabled)) {
|
|
520
|
+
this.setFocusedAndActiveDescendant(itemToFocus);
|
|
521
|
+
}
|
|
522
|
+
return itemToFocus;
|
|
1007
523
|
}
|
|
1008
524
|
updateSelectedItemIndex() {
|
|
1009
525
|
this.focusedOptionIndex = this._virtualizeActive ? this._firstVisibleIndex : 0;
|
|
1010
526
|
}
|
|
1011
527
|
setSelectedOptionsFromValue() {
|
|
1012
528
|
this._selectedOptions = this.options.filter(
|
|
1013
|
-
(
|
|
1014
|
-
var
|
|
1015
|
-
return Array.isArray(this.value) && ((
|
|
529
|
+
(option) => {
|
|
530
|
+
var _a;
|
|
531
|
+
return Array.isArray(this.value) && ((_a = this.value) == null ? void 0 : _a.includes((option == null ? void 0 : option.value) ?? null));
|
|
1016
532
|
}
|
|
1017
533
|
);
|
|
1018
534
|
}
|
|
1019
|
-
visibilityChanged(
|
|
1020
|
-
this._firstVisibleIndex = (
|
|
1021
|
-
}
|
|
1022
|
-
rangeChange(
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
535
|
+
visibilityChanged(event) {
|
|
536
|
+
this._firstVisibleIndex = (event == null ? void 0 : event.first) ?? 0;
|
|
537
|
+
}
|
|
538
|
+
rangeChange(event) {
|
|
539
|
+
event.stopPropagation();
|
|
540
|
+
event.preventDefault();
|
|
541
|
+
if ((event == null ? void 0 : event.first) !== -1 && (event == null ? void 0 : event.last) !== -1) {
|
|
542
|
+
this.dispatchEvent(
|
|
543
|
+
new CustomEvent("luzmo-scrolled", {
|
|
544
|
+
bubbles: true,
|
|
545
|
+
composed: true,
|
|
546
|
+
cancelable: true,
|
|
547
|
+
detail: {
|
|
548
|
+
first: event.first,
|
|
549
|
+
last: event.last
|
|
550
|
+
}
|
|
551
|
+
})
|
|
552
|
+
);
|
|
553
|
+
}
|
|
1034
554
|
}
|
|
1035
|
-
async toggleOption(
|
|
1036
|
-
var
|
|
1037
|
-
const
|
|
1038
|
-
|
|
555
|
+
async toggleOption(event, choice) {
|
|
556
|
+
var _a;
|
|
557
|
+
const keyboardEvent = event instanceof KeyboardEvent;
|
|
558
|
+
const index = this.options.findIndex(
|
|
559
|
+
(option) => (option == null ? void 0 : option.value) === (choice == null ? void 0 : choice.value)
|
|
1039
560
|
);
|
|
1040
|
-
this.focusedOptionIndex =
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
561
|
+
this.focusedOptionIndex = index;
|
|
562
|
+
this.visibleOptionElements.forEach((item) => {
|
|
563
|
+
var _a2, _b;
|
|
564
|
+
if (keyboardEvent) {
|
|
565
|
+
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());
|
|
566
|
+
item.focused = focused;
|
|
567
|
+
if (focused) {
|
|
568
|
+
this.setFocusedAndActiveDescendant(item);
|
|
569
|
+
}
|
|
570
|
+
} else {
|
|
571
|
+
item.focused = false;
|
|
572
|
+
}
|
|
1047
573
|
});
|
|
1048
|
-
const
|
|
1049
|
-
this.selects === "single"
|
|
1050
|
-
|
|
1051
|
-
|
|
574
|
+
const hasOption = Array.isArray(this.value) && ((_a = this.value) == null ? void 0 : _a.includes((choice == null ? void 0 : choice.value) ?? null));
|
|
575
|
+
if (this.selects === "single") {
|
|
576
|
+
this.value = [choice == null ? void 0 : choice.value];
|
|
577
|
+
this._selectedOptions = [choice];
|
|
578
|
+
} else {
|
|
579
|
+
this.value = hasOption ? this.value.filter((value) => value !== (choice == null ? void 0 : choice.value)) : [...this.value ?? [], choice == null ? void 0 : choice.value];
|
|
580
|
+
this._selectedOptions = hasOption ? this._selectedOptions.filter(
|
|
581
|
+
(option) => option.value !== choice.value
|
|
582
|
+
) : [...this._selectedOptions, choice];
|
|
583
|
+
}
|
|
584
|
+
await this.updateComplete;
|
|
585
|
+
this.dispatchEvent(
|
|
1052
586
|
new CustomEvent("change", {
|
|
1053
|
-
bubbles:
|
|
1054
|
-
cancelable:
|
|
1055
|
-
composed:
|
|
587
|
+
bubbles: true,
|
|
588
|
+
cancelable: true,
|
|
589
|
+
composed: true,
|
|
1056
590
|
detail: {
|
|
1057
591
|
value: this.value ?? []
|
|
1058
592
|
}
|
|
1059
593
|
})
|
|
1060
|
-
)
|
|
594
|
+
);
|
|
595
|
+
this.prepareToCleanUp();
|
|
1061
596
|
}
|
|
1062
|
-
handleOptionClick(
|
|
1063
|
-
this.toggleOption(
|
|
597
|
+
handleOptionClick(option, event) {
|
|
598
|
+
this.toggleOption(event, option);
|
|
1064
599
|
}
|
|
1065
600
|
render() {
|
|
1066
|
-
const
|
|
601
|
+
const renderIcon = (icon) => {
|
|
602
|
+
return html`<luzmo-icon
|
|
1067
603
|
slot="icon"
|
|
1068
|
-
.icon=${
|
|
604
|
+
.icon=${icon}
|
|
1069
605
|
.size=${this.size}
|
|
1070
|
-
></luzmo-icon
|
|
606
|
+
></luzmo-icon>`;
|
|
607
|
+
};
|
|
608
|
+
const renderDescription = (description) => {
|
|
609
|
+
return html`<span slot="description">${description}</span>`;
|
|
610
|
+
};
|
|
611
|
+
const renderImg = (imgSrc) => {
|
|
612
|
+
return html`<luzmo-icon
|
|
1071
613
|
slot="icon"
|
|
1072
|
-
.src=${
|
|
614
|
+
.src=${imgSrc}
|
|
1073
615
|
.size=${this.size}
|
|
1074
|
-
></luzmo-icon
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
616
|
+
></luzmo-icon>`;
|
|
617
|
+
};
|
|
618
|
+
const renderOption = (option) => {
|
|
619
|
+
var _a;
|
|
620
|
+
const value = option == null ? void 0 : option.value;
|
|
621
|
+
const label = option == null ? void 0 : option.label;
|
|
622
|
+
const description = option == null ? void 0 : option.description;
|
|
623
|
+
const icon = option == null ? void 0 : option.icon;
|
|
624
|
+
const imgSrc = option == null ? void 0 : option.imgSrc;
|
|
625
|
+
const divider = option == null ? void 0 : option.divider;
|
|
626
|
+
const disabled = typeof option === "string" ? void 0 : option == null ? void 0 : option.disabled;
|
|
627
|
+
return divider ? html`<luzmo-options-divider></luzmo-options-divider>` : html`<luzmo-option
|
|
628
|
+
.value=${value}
|
|
1079
629
|
.size=${this.size}
|
|
1080
630
|
.variant=${this.variant}
|
|
1081
631
|
?emphasized=${this.emphasized}
|
|
1082
632
|
?no-wrap=${this.noWrap}
|
|
1083
|
-
?disabled=${
|
|
1084
|
-
.selected=${Array.isArray(this.value) ? (
|
|
633
|
+
?disabled=${disabled}
|
|
634
|
+
.selected=${Array.isArray(this.value) ? (_a = this.value) == null ? void 0 : _a.includes(value) : false}
|
|
1085
635
|
.role=${this.selects === "single" ? "option" : "optioncheckbox"}
|
|
1086
|
-
@click=${this.handleOptionClick.bind(this,
|
|
636
|
+
@click=${this.handleOptionClick.bind(this, option)}
|
|
1087
637
|
>
|
|
1088
|
-
${
|
|
1089
|
-
${
|
|
638
|
+
${icon ? renderIcon(icon) : imgSrc ? renderImg(imgSrc) : nothing}
|
|
639
|
+
${label} ${description ? renderDescription(description) : nothing}
|
|
1090
640
|
</luzmo-option>`;
|
|
1091
|
-
}
|
|
641
|
+
};
|
|
642
|
+
const renderedOptions = this._virtualizeActive ? html`<lit-virtualizer
|
|
1092
643
|
.items=${this.options}
|
|
1093
|
-
.renderItem=${
|
|
644
|
+
.renderItem=${renderOption}
|
|
1094
645
|
@rangeChanged=${this.rangeChange}
|
|
1095
646
|
@visibilityChanged=${this.visibilityChanged}
|
|
1096
|
-
></lit-virtualizer>` :
|
|
647
|
+
></lit-virtualizer>` : repeat(this.options, renderOption);
|
|
648
|
+
const pendingOption = this.pending ? html`<div id="pending">
|
|
1097
649
|
<luzmo-progress-circle indeterminate></luzmo-progress-circle>
|
|
1098
|
-
</div>` :
|
|
1099
|
-
return
|
|
650
|
+
</div>` : nothing;
|
|
651
|
+
return html`${renderedOptions} ${pendingOption}`;
|
|
1100
652
|
}
|
|
1101
653
|
connectedCallback() {
|
|
1102
|
-
super.connectedCallback()
|
|
654
|
+
super.connectedCallback();
|
|
655
|
+
this.setAttribute("role", "listbox");
|
|
656
|
+
this.updateComplete.then(() => this.updateItemFocus());
|
|
1103
657
|
}
|
|
1104
658
|
disconnectedCallback() {
|
|
1105
659
|
super.disconnectedCallback();
|
|
@@ -1112,66 +666,78 @@ class z extends G(W, {
|
|
|
1112
666
|
this.updateSelectedItemIndex();
|
|
1113
667
|
});
|
|
1114
668
|
},
|
|
1115
|
-
{ once:
|
|
669
|
+
{ once: true }
|
|
1116
670
|
);
|
|
1117
671
|
}
|
|
1118
672
|
updateItemFocus() {
|
|
1119
|
-
if (this.visibleOptionElements.length === 0)
|
|
673
|
+
if (this.visibleOptionElements.length === 0) {
|
|
1120
674
|
return;
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
675
|
+
}
|
|
676
|
+
const lastFocusedIndex = this.focusedOptionIndex;
|
|
677
|
+
const lastFocusedItem = [...this.visibleOptionElements].find(
|
|
678
|
+
(item) => {
|
|
679
|
+
var _a, _b, _c, _d, _e, _f;
|
|
680
|
+
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());
|
|
1125
681
|
}
|
|
1126
682
|
);
|
|
1127
|
-
this.setFocusedAndActiveDescendant(
|
|
683
|
+
this.setFocusedAndActiveDescendant(lastFocusedItem);
|
|
1128
684
|
}
|
|
1129
|
-
setFocusedAndActiveDescendant(
|
|
1130
|
-
var
|
|
1131
|
-
if (!
|
|
685
|
+
setFocusedAndActiveDescendant(item) {
|
|
686
|
+
var _a, _b;
|
|
687
|
+
if (!item) {
|
|
1132
688
|
return;
|
|
1133
|
-
|
|
1134
|
-
|
|
689
|
+
}
|
|
690
|
+
const focused = this.hasVisibleFocusInTree() || !!(((_a = this.visibleOptionElements) == null ? void 0 : _a.some) && ((_b = this.visibleOptionElements) == null ? void 0 : _b.some(
|
|
691
|
+
(child) => child.hasVisibleFocusInTree()
|
|
1135
692
|
)));
|
|
1136
|
-
|
|
693
|
+
item.focused = focused;
|
|
694
|
+
if (focused) {
|
|
695
|
+
this.setAttribute("aria-activedescendant", item.id);
|
|
696
|
+
}
|
|
1137
697
|
}
|
|
1138
698
|
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
],
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
],
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
],
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
],
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
],
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
],
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
],
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
],
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
],
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
],
|
|
1169
|
-
customElements.get("luzmo-options")
|
|
1170
|
-
customElements.
|
|
1171
|
-
|
|
699
|
+
__decorateClass([
|
|
700
|
+
property({ type: String, reflect: true })
|
|
701
|
+
], LuzmoOptions.prototype, "label");
|
|
702
|
+
__decorateClass([
|
|
703
|
+
property({ type: String, reflect: true })
|
|
704
|
+
], LuzmoOptions.prototype, "variant");
|
|
705
|
+
__decorateClass([
|
|
706
|
+
property({ type: String, reflect: true })
|
|
707
|
+
], LuzmoOptions.prototype, "selects");
|
|
708
|
+
__decorateClass([
|
|
709
|
+
property({ type: Boolean, reflect: true })
|
|
710
|
+
], LuzmoOptions.prototype, "emphasized");
|
|
711
|
+
__decorateClass([
|
|
712
|
+
property({ type: Boolean, reflect: true })
|
|
713
|
+
], LuzmoOptions.prototype, "pending");
|
|
714
|
+
__decorateClass([
|
|
715
|
+
property({ type: Array })
|
|
716
|
+
], LuzmoOptions.prototype, "options");
|
|
717
|
+
__decorateClass([
|
|
718
|
+
property({ type: Boolean, reflect: true, attribute: "no-wrap" })
|
|
719
|
+
], LuzmoOptions.prototype, "noWrap");
|
|
720
|
+
__decorateClass([
|
|
721
|
+
property({ type: Array })
|
|
722
|
+
], LuzmoOptions.prototype, "value");
|
|
723
|
+
__decorateClass([
|
|
724
|
+
query("lit-virtualizer")
|
|
725
|
+
], LuzmoOptions.prototype, "virtualizer");
|
|
726
|
+
__decorateClass([
|
|
727
|
+
queryAll("luzmo-option")
|
|
728
|
+
], LuzmoOptions.prototype, "visibleOptionElements");
|
|
729
|
+
if (!customElements.get("luzmo-options")) {
|
|
730
|
+
customElements.define("luzmo-options", LuzmoOptions);
|
|
731
|
+
}
|
|
732
|
+
if (!customElements.get("luzmo-options-divider")) {
|
|
733
|
+
customElements.define("luzmo-options-divider", LuzmoOptionsDivider);
|
|
734
|
+
}
|
|
735
|
+
if (!customElements.get("luzmo-option")) {
|
|
736
|
+
customElements.define("luzmo-option", LuzmoOption);
|
|
737
|
+
}
|
|
1172
738
|
export {
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
739
|
+
LuzmoOption,
|
|
740
|
+
LuzmoOptions,
|
|
741
|
+
LuzmoOptionsDivider,
|
|
742
|
+
VIRTUALIZE_AS_OF_NUM_ITEMS
|
|
1177
743
|
};
|