@luzmo/lucero 1.0.1-alpha.18 → 1.0.1-alpha.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/NumberFormatter-DewVDY5w.cjs +18 -0
- package/components/NumberFormatter-DgOUVrge.js +136 -0
- package/components/NumberParser-Dik4a0h-.cjs +18 -0
- package/components/NumberParser-ci9J5EKv.js +173 -0
- package/components/accordion/index.cjs +6 -183
- package/components/accordion/index.js +88 -136
- package/components/action-bar/index.cjs +4 -85
- package/components/action-bar/index.js +50 -72
- package/components/action-button/index.cjs +3 -205
- package/components/action-button/index.js +93 -167
- package/components/action-group/index.cjs +1 -7
- package/components/action-group/index.js +8 -12
- package/components/action-group-C54IxNZk.cjs +20 -0
- package/components/action-group-C9dsPJg-.js +258 -0
- package/components/action-menu/index.cjs +11 -91
- package/components/action-menu/index.js +47 -66
- package/components/async-directive-BwIAw5tB.js +82 -0
- package/components/async-directive-DLz6JB0v.cjs +22 -0
- package/components/avatar/index.cjs +3 -63
- package/components/avatar/index.js +42 -54
- package/components/{focusable-selectors-D0t_5P7C.cjs → base-BjTwmyRF.cjs} +5 -16
- package/components/base-CFWO09N1.js +684 -0
- package/components/base-Cy0MQrPT.cjs +40 -0
- package/components/base-D76d76ww.js +26 -0
- package/components/button/index.cjs +2 -134
- package/components/button/index.js +72 -106
- package/components/button-base-B8bWcklV.js +144 -0
- package/components/button-base-tf95Lyl4.cjs +25 -0
- package/components/button-group/index.cjs +1 -45
- package/components/button-group/index.js +25 -37
- package/components/calendar/index.cjs +1 -632
- package/components/calendar/index.js +7 -637
- package/components/checkbox/index.cjs +4 -111
- package/components/checkbox/index.js +53 -98
- package/components/checkbox-mixin-BOTvuPEu.js +70 -0
- package/components/checkbox-mixin-BVPpXtsq.cjs +27 -0
- package/components/class-map-CGfNk3Ee.js +51 -0
- package/components/class-map-D-Y-hsN5.cjs +22 -0
- package/components/clear-button-CuPbWwZY.cjs +18 -0
- package/components/clear-button-DzZ5ulBW.js +53 -0
- package/components/close-button-BTo4yrFR.cjs +18 -0
- package/components/close-button-CuQdsez5.js +51 -0
- package/components/color-area/index.cjs +13 -440
- package/components/color-area/index.js +187 -322
- package/components/color-controller-B0uX6Zso.js +3230 -0
- package/components/color-controller-CoUL5f9K.cjs +18 -0
- package/components/color-field/index.cjs +2 -95
- package/components/color-field/index.js +41 -77
- package/components/color-handle/index.cjs +3 -64
- package/components/color-handle/index.js +37 -58
- package/components/color-loupe/index.cjs +1 -7
- package/components/color-loupe/index.js +8 -12
- package/components/color-loupe-CrM2DVY3.cjs +56 -0
- package/components/color-loupe-DmQe3SpP.js +81 -0
- package/components/color-menu/index.cjs +12 -217
- package/components/color-menu/index.js +93 -187
- package/components/color-palette/index.cjs +1 -89
- package/components/color-palette/index.js +51 -78
- package/components/color-palette-group/index.cjs +3 -259
- package/components/color-palette-group/index.js +105 -193
- package/components/color-picker/index.cjs +6 -114
- package/components/color-picker/index.js +72 -92
- package/components/color-slider/index.cjs +1 -585
- package/components/color-slider/index.js +7 -590
- package/components/condition-attribute-with-id-DrQYZzFS.cjs +18 -0
- package/components/condition-attribute-with-id-Dv4lSRbe.js +31 -0
- package/components/date-time-picker/index.cjs +31 -1357
- package/components/date-time-picker/index.js +637 -951
- package/components/{dependency-manger-XHpQjFgK.js → dependency-manger-CO-VPlqq.js} +14 -24
- package/components/dependency-manger-uthev62E.cjs +18 -0
- package/components/directive-C7oCP5Bh.cjs +22 -0
- package/components/directive-helpers-D4KMv2dC.js +62 -0
- package/components/directive-helpers-t-TVum7J.cjs +22 -0
- package/components/{slottable-request-event-CANixJnR.cjs → directive-oAbCiebi.js} +25 -14
- package/components/divider/index.cjs +1 -54
- package/components/divider/index.js +30 -49
- package/components/divider.module-DDvBo9zo.cjs +18 -0
- package/components/divider.module-DoQWQEIJ.js +21 -0
- package/components/element-resolution-BvRLGqIU.cjs +18 -0
- package/components/element-resolution-FCUT-wql.js +91 -0
- package/components/field-group/index.cjs +1 -7
- package/components/field-group/index.js +8 -12
- package/components/field-group-5WQMBOk4.cjs +23 -0
- package/components/field-group-D4B0IOdA.js +66 -0
- package/components/field-label/index.cjs +1 -7
- package/components/field-label/index.js +8 -12
- package/components/field-label-DxmPiC5p.js +106 -0
- package/components/field-label-Dz9kisdW.cjs +25 -0
- package/components/flow-D-0MTYCm.js +527 -0
- package/components/flow-DM3dNAKs.cjs +30 -0
- package/components/focus-group-DHeTq18L.js +218 -0
- package/components/focus-group-DnxZUBhQ.cjs +18 -0
- package/components/focus-visible-BvScGDCE.js +74 -0
- package/components/focus-visible-D4BXb5RB.cjs +18 -0
- package/components/focusable-B_KwfEec.cjs +18 -0
- package/components/focusable-C5JjRZmT.js +153 -0
- package/components/{focusable-selectors-IltOAOd9.js → focusable-selectors-B4YgbghQ.js} +4 -7
- package/components/focusable-selectors-BgFlyFcY.cjs +18 -0
- package/components/icon/index.cjs +1 -90
- package/components/icon/index.js +46 -74
- package/components/if-defined-DULpqYwi.js +27 -0
- package/components/if-defined-DaXWqfzc.cjs +22 -0
- package/components/index-CNK8wHXu.cjs +57 -0
- package/components/index-Cf6G4q52.js +1490 -0
- package/components/index-D3ICqC7S.js +1174 -0
- package/components/index-hqVbNKYy.cjs +113 -0
- package/components/index.cjs +1 -174
- package/components/index.js +172 -174
- package/components/infield-button/index.cjs +2 -46
- package/components/infield-button/index.js +30 -41
- package/components/label/index.cjs +1 -37
- package/components/label/index.js +24 -36
- package/components/{language-resolution-BSGJAWiQ.js → language-resolution-B-wjV5bb.js} +17 -21
- package/components/language-resolution-EUER43cg.cjs +18 -0
- package/components/like-anchor-Bu3pXbjT.cjs +32 -0
- package/components/like-anchor-DCFJN0LV.js +69 -0
- package/components/luzmo-icons-CiSek5iM.js +229 -0
- package/components/luzmo-icons-CtA-TJPd.cjs +29 -0
- package/components/manage-help-text-CHfMLzSa.js +92 -0
- package/components/manage-help-text-DNqdEkTA.cjs +30 -0
- package/components/menu/index.cjs +29 -1297
- package/components/menu/index.js +499 -954
- package/components/multi-language-field/index.cjs +2 -132
- package/components/multi-language-field/index.js +88 -118
- package/components/mutation-controller-DH7YOCyj.js +52 -0
- package/components/mutation-controller-DkOMCW-c.cjs +22 -0
- package/components/number-field/index.cjs +10 -613
- package/components/number-field/index.js +243 -442
- package/components/observe-slot-presence-CmVi0zTc.js +68 -0
- package/components/observe-slot-presence-bc9chhsi.cjs +18 -0
- package/components/observe-slot-text-C3moTjwy.js +87 -0
- package/components/observe-slot-text-D2VAEFSd.cjs +18 -0
- package/components/options/index.cjs +60 -693
- package/components/options/index.js +953 -519
- package/components/overlay/index.cjs +21 -367
- package/components/overlay/index.js +189 -273
- package/components/overlay-B3ajDLLq.cjs +47 -0
- package/components/overlay-CUKs69yr.js +2745 -0
- package/components/{pending-state-CXbe-Xul.js → pending-state-B2wWssTo.js} +13 -28
- package/components/pending-state-bJr-nEJl.cjs +26 -0
- package/components/picker/index.cjs +1 -9
- package/components/picker/index.js +11 -15
- package/components/picker-C0LvseZe.cjs +123 -0
- package/components/picker-W1qNmtsh.js +461 -0
- package/components/picker-button/index.cjs +4 -56
- package/components/picker-button/index.js +34 -45
- package/components/{condition-attribute-with-id-Cn815e9W.js → platform-BM-uMWpX.js} +49 -24
- package/components/platform-BiXhwqk3.cjs +18 -0
- package/components/popover/index.cjs +1 -7
- package/components/popover/index.js +8 -12
- package/components/popover-fwJeZHMQ.cjs +30 -0
- package/components/popover-iD8f5Jkp.js +67 -0
- package/components/progress-circle/index.cjs +1 -7
- package/components/progress-circle/index.js +8 -12
- package/components/progress-circle-DZxaMe8L.cjs +33 -0
- package/components/progress-circle-USIIU1up.js +97 -0
- package/components/query-BL-TJj7K.cjs +22 -0
- package/components/query-D_KR_GUc.js +51 -0
- package/components/query-assigned-elements-DjfhL1cl.js +36 -0
- package/components/query-assigned-elements-DsKsfk7G.cjs +22 -0
- package/components/query-assigned-nodes-BcKWmGzy.cjs +22 -0
- package/components/query-assigned-nodes-C76XVPWY.js +36 -0
- package/components/radio/index.cjs +2 -244
- package/components/radio/index.js +110 -192
- package/components/{random-id-BEc6QIUL.js → random-id-ByCz1xaq.js} +3 -3
- package/components/random-id-CqvckpWe.cjs +18 -0
- package/components/roving-tabindex-By_fCy_e.cjs +18 -0
- package/components/roving-tabindex-DOg4z6ZU.js +66 -0
- package/components/search/index.cjs +8 -115
- package/components/search/index.js +66 -96
- package/components/select/index.cjs +51 -720
- package/components/select/index.js +347 -563
- package/components/sized-mixin-CJbBHWRQ.js +63 -0
- package/components/sized-mixin-WPHH0a_D.cjs +18 -0
- package/components/slider/index.cjs +1 -119
- package/components/slider/index.js +1113 -100
- package/components/slottable-request-event-BfUUt1Mh.cjs +18 -0
- package/components/{slottable-request-event-D9WzrdWv.js → slottable-request-event-DggLA4Rx.js} +9 -12
- package/components/state-DwIwYPvt.js +29 -0
- package/components/state-vf0PJN3_.cjs +22 -0
- package/components/strategies-C6HsQpU2.cjs +18 -0
- package/components/strategies-CUMLHtQI.js +195 -0
- package/components/streaming-listener-BQ68fKMa.js +91 -0
- package/components/streaming-listener-DeGQYM-9.cjs +18 -0
- package/components/style-map-Bnhf_mVZ.js +53 -0
- package/components/style-map-DuMd5xlY.cjs +22 -0
- package/components/swatch/index.cjs +7 -436
- package/components/swatch/index.js +205 -350
- package/components/switch/index.cjs +2 -61
- package/components/switch/index.js +34 -51
- package/components/tabs/index.cjs +26 -693
- package/components/tabs/index.js +388 -521
- package/components/tags/index.cjs +4 -201
- package/components/tags/index.js +87 -152
- package/components/text-field/index.cjs +3 -49
- package/components/text-field/index.js +30 -44
- package/components/text-field-BkFPYo7S.cjs +85 -0
- package/components/text-field-C2n3rzCK.js +314 -0
- package/components/text-field.module-C2KVUJcX.js +21 -0
- package/components/text-field.module-DXhFA9G-.cjs +18 -0
- package/components/toast/index.cjs +12 -177
- package/components/toast/index.js +73 -145
- package/components/tooltip/index.cjs +6 -250
- package/components/tooltip/index.js +124 -177
- package/components/unit-input/index.cjs +8 -232
- package/components/unit-input/index.js +108 -201
- package/components/utils.cjs +1 -25
- package/components/utils.js +22 -22
- package/components/{random-id-BE6HA503.cjs → when-CDK1Tt5Y.js} +10 -7
- package/components/when-CDZyJPvd.cjs +22 -0
- package/package.json +1 -1
- package/components/action-group-DHp8RHDf.js +0 -392
- package/components/action-group-MPf19RPV.cjs +0 -391
- package/components/base-COw9n7UR.cjs +0 -119
- package/components/base-DmeVy0cq.js +0 -120
- package/components/button-base-7Ak55xFd.cjs +0 -206
- package/components/button-base-C3kf6BTK.js +0 -207
- package/components/checkbox-mixin-8cL-vfDy.js +0 -84
- package/components/checkbox-mixin-CE7dJj3J.cjs +0 -83
- package/components/clear-button-Co6oKSgl.js +0 -59
- package/components/clear-button-X_HDY2eH.cjs +0 -58
- package/components/close-button-DPBK6Kpu.cjs +0 -59
- package/components/close-button-Miw9ZjoJ.js +0 -60
- package/components/color-controller-BjDZaxhX.js +0 -491
- package/components/color-controller-C3c_vb2P.cjs +0 -490
- package/components/color-loupe-BQqNR8YD.cjs +0 -88
- package/components/color-loupe-B_DDFv8l.js +0 -89
- package/components/condition-attribute-with-id-DEc2Yjne.cjs +0 -43
- package/components/dependency-manger-CcIE1uvQ.cjs +0 -63
- package/components/divider.module-Cm5LcDRV.cjs +0 -20
- package/components/divider.module-DauH6k2_.js +0 -21
- package/components/element-resolution-DCsrhGZO.cjs +0 -112
- package/components/element-resolution-nMlmW4Jy.js +0 -113
- package/components/field-group-DNmY8W9v.cjs +0 -86
- package/components/field-group-DVdAWCQF.js +0 -87
- package/components/field-label-CKH9EXpR.cjs +0 -156
- package/components/field-label-Dpsecoc6.js +0 -157
- package/components/focus-group-BqDAk9Is.js +0 -337
- package/components/focus-group-DFzOlalL.cjs +0 -336
- package/components/focus-visible-B-B8-P9R.cjs +0 -104
- package/components/focus-visible-BUPRWlsh.js +0 -105
- package/components/focusable-BPrTcZPd.cjs +0 -262
- package/components/focusable-ChCLg1k4.js +0 -263
- package/components/language-resolution-iN9EImbb.cjs +0 -57
- package/components/like-anchor-D62faRNG.cjs +0 -79
- package/components/like-anchor-v3cJ9RWM.js +0 -80
- package/components/manage-help-text-BYx84zZR.cjs +0 -125
- package/components/manage-help-text-DOuMTGht.js +0 -126
- package/components/observe-slot-presence-9AwLGUQ_.cjs +0 -78
- package/components/observe-slot-presence-DcMdoumP.js +0 -79
- package/components/observe-slot-text-CSofZeeF.cjs +0 -104
- package/components/observe-slot-text-CjnkkBPn.js +0 -105
- package/components/overlay-CN8ISP1F.js +0 -2485
- package/components/overlay-LViy9VWM.cjs +0 -2484
- package/components/pending-state-e4RbXe9u.cjs +0 -75
- package/components/picker-DNde3awt.cjs +0 -672
- package/components/picker-PfUAF05y.js +0 -673
- package/components/platform-CxDar3Dn.cjs +0 -68
- package/components/platform-Cxn0WbyT.js +0 -69
- package/components/popover-BkbYhl3i.js +0 -74
- package/components/popover-BkgUf0kL.cjs +0 -74
- package/components/progress-circle-Hu_ivPHf.js +0 -133
- package/components/progress-circle-_Etqsj9f.cjs +0 -132
- package/components/roving-tabindex-AsmAh2In.cjs +0 -95
- package/components/roving-tabindex-DPF9NmrH.js +0 -96
- package/components/sized-mixin-DmkrNdWB.js +0 -80
- package/components/sized-mixin-UaTVa-AE.cjs +0 -79
- package/components/strategies-DlMlaSJR.cjs +0 -317
- package/components/strategies-DlPQoTFE.js +0 -318
- package/components/streaming-listener-D4sHaMub.cjs +0 -145
- package/components/streaming-listener-cAz5zJyk.js +0 -146
- package/components/text-field-11tcnftU.cjs +0 -338
- package/components/text-field-Chi9J2Cz.js +0 -339
- package/components/text-field.module-CMBS0jSL.js +0 -21
- package/components/text-field.module-DIJdV_sA.cjs +0 -20
|
@@ -15,43 +15,7 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
"use strict";
|
|
19
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
20
|
-
const icons = require("@luzmo/icons");
|
|
21
|
-
const lit = require("lit");
|
|
22
|
-
const decorators_js = require("lit/decorators.js");
|
|
23
|
-
const ifDefined_js = require("lit/directives/if-defined.js");
|
|
24
|
-
const when_js = require("lit/directives/when.js");
|
|
25
|
-
const focusable = require("../focusable-BPrTcZPd.cjs");
|
|
26
|
-
const sizedMixin = require("../sized-mixin-UaTVa-AE.cjs");
|
|
27
|
-
const mutationController_js = require("@lit-labs/observers/mutation-controller.js");
|
|
28
|
-
const base = require("../base-COw9n7UR.cjs");
|
|
29
|
-
const rovingTabindex = require("../roving-tabindex-AsmAh2In.cjs");
|
|
30
|
-
const styles$1 = '@media (forced-colors: active){:host{--highcontrast-swatch-disabled-icon-color: GrayText;--highcontrast-swatch-focus-indicator-color: ButtonText;--highcontrast-swatch-background-color-selected: Background;--highcontrast-swatch-border-color-selected: Highlight;--highcontrast-swatch-border-color: ButtonText;--highcontrast-swatch-fill-foreground-color: ButtonText}.fill{forced-color-adjust:none}:host([disabled]){--highcontrast-swatch-border-color: GrayText}}:host{box-sizing:border-box;inline-size:var(--luzmo-swatch-size, var(--swatch-size));block-size:var(--luzmo-swatch-size, var(--swatch-size));-webkit-user-select:none;user-select:none;outline:none;justify-content:center;align-items:center;display:flex;position:relative}.disabled-icon{inline-size:var(--luzmo-swatch-disabled-icon-size, var(--swatch-disabled-icon-size));block-size:var(--luzmo-swatch-disabled-icon-size, var(--swatch-disabled-icon-size))}:host,:host:before{border-radius:var(--luzmo-swatch-border-radius, var(--swatch-border-radius))}:host([selected]){background-color:var(--highcontrast-swatch-background-color-selected, var(--luzmo-swatch-inner-border-color-selected, var(--swatch-inner-border-color-selected)))}:host([selected]) .fill:before{box-shadow:none;border-radius:0}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:initial}:host([mixed-value]) .fill{background:none;background:var(--picked-color, transparent)}:host([mixed-value]) .mixed-value-icon{color:var(--swatch-dash-icon-color);display:block}:host([nothing]) .fill{background-color:initial;background-color:var(--picked-color, transparent);background-image:none}:host([nothing]) .fill:after{inline-size:var(--luzmo-swatch-slash-thickness, var(--swatch-slash-thickness));content:"";block-size:200%;background:var(--highcontrast-swatch-fill-foreground-color, var(--luzmo-swatch-slash-icon-color, var(--swatch-slash-icon-color)));position:absolute;transform:rotate(-45deg)}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabled-icon{display:block}:host:before{content:"";border-width:var(--luzmo-swatch-border-thickness-selected, var(--swatch-border-thickness-selected));border-style:solid;border-color:var(--highcontrast-swatch-border-color-selected, var(--luzmo-swatch-border-color-selected, var(--swatch-border-color-selected)));opacity:0;pointer-events:none;position:absolute;top:0;right:0;bottom:0;left:0}:host:after{content:"";inset:calc(var(--luzmo-swatch-focus-indicator-gap, var(--swatch-focus-indicator-gap)) * -2);background-color:var(--luzmo-swatch-focus-indicator-background-color, var(--luzmo-background-color));z-index:-1;opacity:0;border-width:var(--luzmo-swatch-focus-indicator-width, var(--swatch-focus-indicator-width));border-style:solid;border-color:var(--highcontrast-swatch-focus-indicator-color, var(--luzmo-swatch-focus-indicator-color, var(--swatch-focus-indicator-color)));border-radius:var(--luzmo-swatch-focus-indicator-border-radius, var(--swatch-focus-indicator-border-radius));transition:opacity var(--luzmo-animation-duration) ease-in-out;position:absolute}:host(:focus-visible):after{opacity:1}.fill{inline-size:100%;block-size:100%;box-sizing:border-box;border-radius:var(--luzmo-swatch-border-radius, var(--swatch-border-radius));justify-content:center;align-items:center;display:flex;position:relative;overflow:hidden}.fill:before{content:"";z-index:0;box-sizing:border-box;box-shadow:inset 0 0 0 var(--luzmo-swatch-border-thickness, var(--swatch-border-thickness)) var(--highcontrast-swatch-border-color, var(--luzmo-swatch-border-color, var(--swatch-border-color)));border-radius:var(--luzmo-swatch-border-radius, var(--swatch-border-radius));position:absolute;top:0;right:0;bottom:0;left:0}:host([border=none]) .fill:before,.fill:before{background-color:initial;background-color:var(--picked-color, transparent)}:host([border=none]) .fill:before{box-shadow:none}.mixed-value-icon{pointer-events:none;color:#0000;color:var(--picked-color, transparent);display:none}.disabled-icon{z-index:1;pointer-events:none;color:var(--highcontrast-swatch-disabled-icon-color, var(--luzmo-swatch-disabled-icon-color, var(--swatch-disabled-icon-color)));stroke:var(--highcontrast-swatch-disabled-icon-color, var(--luzmo-swatch-disabled-icon-color, var(--swatch-disabled-icon-color)));display:none;position:relative}.disabled-icon path:first-child{fill:var(--highcontrast-swatch-disabled-icon-color, var(--luzmo-swatch-disabled-icon-color, var(--swatch-disabled-icon-color)))}.disabled-icon path:last-child{fill:var(--luzmo-swatch-icon-border-color, var(--swatch-icon-border-color))}:host([shape=rectangle]){inline-size:calc(var(--luzmo-swatch-size, var(--swatch-size)) * 2)}:host([rounding=none]),:host([rounding=none]) .fill,:host([rounding=none]) .fill:before,:host([rounding=none][selected]) .fill,:host([rounding=none][selected]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before{border-radius:0}:host([rounding=full][selected]:not([shape=rectangle])) .fill,:host([rounding=full][selected]:not([shape=rectangle])) .fill:before,:host([rounding=full]:not([shape=rectangle])),:host([rounding=full]:not([shape=rectangle])) .fill,:host([rounding=full]:not([shape=rectangle])) .fill:before,:host([rounding=full]:not([shape=rectangle])):after,:host([rounding=full]:not([shape=rectangle])):before{border-radius:100%}:host([selected]) .fill{width:calc(var(--luzmo-swatch-size, var(--swatch-size)) - 2 * var(--luzmo-swatch-border-thickness-selected, var(--swatch-border-thickness-selected)) + -2 * var(--luzmo-swatch-focus-indicator-gap, var(--swatch-focus-indicator-gap)));height:calc(var(--luzmo-swatch-size, var(--swatch-size)) - 2 * var(--luzmo-swatch-border-thickness-selected, var(--swatch-border-thickness-selected)) + -2 * var(--luzmo-swatch-focus-indicator-gap, var(--swatch-focus-indicator-gap)))}:host([selected][shape=rectangle]) .fill{width:calc(var(--luzmo-swatch-size, var(--swatch-size)) * 2 - 2 * var(--luzmo-swatch-border-thickness-selected, var(--swatch-border-thickness-selected)) + -2 * var(--luzmo-swatch-focus-indicator-gap, var(--swatch-focus-indicator-gap)))}::slotted([slot=image]){object-fit:contain;inline-size:100%;block-size:100%;transition:width var(--luzmo-animation-duration) ease-in-out,height var(--luzmo-animation-duration) ease-in-out}:host([size=xl]){--swatch-size: var(--luzmo-component-height-xl);--swatch-disabled-icon-size: 24px;--swatch-slash-thickness: 6px}:host([size=l]){--swatch-size: var(--luzmo-component-height-l);--swatch-disabled-icon-size: 20px;--swatch-slash-thickness: 5px}:host([size=s]){--swatch-size: var(--luzmo-component-height-s);--swatch-disabled-icon-size: 16px;--swatch-slash-thickness: 3px}:host([size=xs]){--swatch-size: var(--luzmo-component-height-xs);--swatch-disabled-icon-size: 16px;--swatch-slash-thickness: 2px}:host([size=xxs]){--swatch-size: var(--luzmo-component-height-xxs);--swatch-disabled-icon-size: 14px;--swatch-slash-thickness: 2px}:host{--swatch-size: var(--luzmo-component-height);--swatch-disabled-icon-size: 18px;--swatch-slash-thickness: 4px}:host{--swatch-border-radius: var(--luzmo-border-radius-s);--swatch-focus-indicator-border-radius: var(--luzmo-border-radius-s);--swatch-border-thickness: var(--luzmo-border-width);--swatch-border-thickness-selected: var(--luzmo-border-width);--swatch-focus-indicator-width: var(--luzmo-indicator-width);--swatch-focus-indicator-gap: var(--luzmo-indicator-gap);--swatch-border-color: var(--luzmo-border-color-down);--swatch-icon-border-color: var(--luzmo-border-color);--swatch-border-color-selected: var(--luzmo-border-color-full-down);--swatch-inner-border-color-selected: var(--luzmo-background-color);--swatch-disabled-icon-color: rgb(255, 255, 255);--swatch-dash-icon-color: var(--luzmo-font-color);--swatch-slash-icon-color: var(--luzmo-negative-color);--swatch-focus-indicator-color: var(--luzmo-primary)}.fill:before{background:var(--picked-color, transparent)}:host([border=none]) .fill:before{background:var(--picked-color, transparent)}:host .is-image .fill:before{background:#0000}:host .opacity-checkerboard{background:repeating-conic-gradient(var(--luzmo-swatch-checkerboard-light, rgb(255, 255, 255)) 0 25%,var(--luzmo-swatch-checkerboard-dark, rgb(230, 230, 230)) 0 50%) var(--luzmo-swatch-checkerboard-position, left top)/calc(var(--luzmo-swatch-checkerboard-size, 8px) * 2) calc(var(--luzmo-swatch-checkerboard-size, 8px) * 2)}';
|
|
31
|
-
var __defProp$1 = Object.defineProperty;
|
|
32
|
-
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
33
|
-
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
34
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
35
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
36
|
-
if (decorator = decorators[i])
|
|
37
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
38
|
-
if (kind && result) __defProp$1(target, key, result);
|
|
39
|
-
return result;
|
|
40
|
-
};
|
|
41
|
-
class LuzmoSwatch extends sizedMixin.SizedMixin(focusable.Focusable, {
|
|
42
|
-
validSizes: ["xxs", "xs", "s", "m", "l", "xl"],
|
|
43
|
-
noDefaultSize: true
|
|
44
|
-
}) {
|
|
45
|
-
constructor() {
|
|
46
|
-
super(...arguments);
|
|
47
|
-
this.color = "";
|
|
48
|
-
this.label = "";
|
|
49
|
-
this.mixedValue = false;
|
|
50
|
-
this.nothing = false;
|
|
51
|
-
this.role = "button";
|
|
52
|
-
this.selected = false;
|
|
53
|
-
this.readonly = false;
|
|
54
|
-
this.renderDisabled = () => lit.html`
|
|
18
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../luzmo-icons-CtA-TJPd.cjs"),r=require("../base-Cy0MQrPT.cjs"),g=require("../if-defined-DaXWqfzc.cjs"),b=require("../when-CDZyJPvd.cjs"),v=require("../focusable-B_KwfEec.cjs"),p=require("../sized-mixin-WPHH0a_D.cjs"),w=require("../mutation-controller-DkOMCW-c.cjs"),m=require("../query-assigned-elements-DsKsfk7G.cjs"),z=require("../roving-tabindex-By_fCy_e.cjs"),x='@media (forced-colors: active){:host{--highcontrast-swatch-disabled-icon-color: GrayText;--highcontrast-swatch-focus-indicator-color: ButtonText;--highcontrast-swatch-background-color-selected: Background;--highcontrast-swatch-border-color-selected: Highlight;--highcontrast-swatch-border-color: ButtonText;--highcontrast-swatch-fill-foreground-color: ButtonText}.fill{forced-color-adjust:none}:host([disabled]){--highcontrast-swatch-border-color: GrayText}}:host{box-sizing:border-box;inline-size:var(--luzmo-swatch-size, var(--swatch-size));block-size:var(--luzmo-swatch-size, var(--swatch-size));-webkit-user-select:none;user-select:none;outline:none;justify-content:center;align-items:center;display:flex;position:relative}.disabled-icon{inline-size:var(--luzmo-swatch-disabled-icon-size, var(--swatch-disabled-icon-size));block-size:var(--luzmo-swatch-disabled-icon-size, var(--swatch-disabled-icon-size))}:host,:host:before{border-radius:var(--luzmo-swatch-border-radius, var(--swatch-border-radius))}:host([selected]){background-color:var(--highcontrast-swatch-background-color-selected, var(--luzmo-swatch-inner-border-color-selected, var(--swatch-inner-border-color-selected)))}:host([selected]) .fill:before{box-shadow:none;border-radius:0}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:initial}:host([mixed-value]) .fill{background:none;background:var(--picked-color, transparent)}:host([mixed-value]) .mixed-value-icon{color:var(--swatch-dash-icon-color);display:block}:host([nothing]) .fill{background-color:initial;background-color:var(--picked-color, transparent);background-image:none}:host([nothing]) .fill:after{inline-size:var(--luzmo-swatch-slash-thickness, var(--swatch-slash-thickness));content:"";block-size:200%;background:var(--highcontrast-swatch-fill-foreground-color, var(--luzmo-swatch-slash-icon-color, var(--swatch-slash-icon-color)));position:absolute;transform:rotate(-45deg)}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabled-icon{display:block}:host:before{content:"";border-width:var(--luzmo-swatch-border-thickness-selected, var(--swatch-border-thickness-selected));border-style:solid;border-color:var(--highcontrast-swatch-border-color-selected, var(--luzmo-swatch-border-color-selected, var(--swatch-border-color-selected)));opacity:0;pointer-events:none;position:absolute;top:0;right:0;bottom:0;left:0}:host:after{content:"";inset:calc(var(--luzmo-swatch-focus-indicator-gap, var(--swatch-focus-indicator-gap)) * -2);background-color:var(--luzmo-swatch-focus-indicator-background-color, var(--luzmo-background-color));z-index:-1;opacity:0;border-width:var(--luzmo-swatch-focus-indicator-width, var(--swatch-focus-indicator-width));border-style:solid;border-color:var(--highcontrast-swatch-focus-indicator-color, var(--luzmo-swatch-focus-indicator-color, var(--swatch-focus-indicator-color)));border-radius:var(--luzmo-swatch-focus-indicator-border-radius, var(--swatch-focus-indicator-border-radius));transition:opacity var(--luzmo-animation-duration) ease-in-out;position:absolute}:host(:focus-visible):after{opacity:1}.fill{inline-size:100%;block-size:100%;box-sizing:border-box;border-radius:var(--luzmo-swatch-border-radius, var(--swatch-border-radius));justify-content:center;align-items:center;display:flex;position:relative;overflow:hidden}.fill:before{content:"";z-index:0;box-sizing:border-box;box-shadow:inset 0 0 0 var(--luzmo-swatch-border-thickness, var(--swatch-border-thickness)) var(--highcontrast-swatch-border-color, var(--luzmo-swatch-border-color, var(--swatch-border-color)));border-radius:var(--luzmo-swatch-border-radius, var(--swatch-border-radius));position:absolute;top:0;right:0;bottom:0;left:0}:host([border=none]) .fill:before,.fill:before{background-color:initial;background-color:var(--picked-color, transparent)}:host([border=none]) .fill:before{box-shadow:none}.mixed-value-icon{pointer-events:none;color:#0000;color:var(--picked-color, transparent);display:none}.disabled-icon{z-index:1;pointer-events:none;color:var(--highcontrast-swatch-disabled-icon-color, var(--luzmo-swatch-disabled-icon-color, var(--swatch-disabled-icon-color)));stroke:var(--highcontrast-swatch-disabled-icon-color, var(--luzmo-swatch-disabled-icon-color, var(--swatch-disabled-icon-color)));display:none;position:relative}.disabled-icon path:first-child{fill:var(--highcontrast-swatch-disabled-icon-color, var(--luzmo-swatch-disabled-icon-color, var(--swatch-disabled-icon-color)))}.disabled-icon path:last-child{fill:var(--luzmo-swatch-icon-border-color, var(--swatch-icon-border-color))}:host([shape=rectangle]){inline-size:calc(var(--luzmo-swatch-size, var(--swatch-size)) * 2)}:host([rounding=none]),:host([rounding=none]) .fill,:host([rounding=none]) .fill:before,:host([rounding=none][selected]) .fill,:host([rounding=none][selected]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before{border-radius:0}:host([rounding=full][selected]:not([shape=rectangle])) .fill,:host([rounding=full][selected]:not([shape=rectangle])) .fill:before,:host([rounding=full]:not([shape=rectangle])),:host([rounding=full]:not([shape=rectangle])) .fill,:host([rounding=full]:not([shape=rectangle])) .fill:before,:host([rounding=full]:not([shape=rectangle])):after,:host([rounding=full]:not([shape=rectangle])):before{border-radius:100%}:host([selected]) .fill{width:calc(var(--luzmo-swatch-size, var(--swatch-size)) - 2 * var(--luzmo-swatch-border-thickness-selected, var(--swatch-border-thickness-selected)) + -2 * var(--luzmo-swatch-focus-indicator-gap, var(--swatch-focus-indicator-gap)));height:calc(var(--luzmo-swatch-size, var(--swatch-size)) - 2 * var(--luzmo-swatch-border-thickness-selected, var(--swatch-border-thickness-selected)) + -2 * var(--luzmo-swatch-focus-indicator-gap, var(--swatch-focus-indicator-gap)))}:host([selected][shape=rectangle]) .fill{width:calc(var(--luzmo-swatch-size, var(--swatch-size)) * 2 - 2 * var(--luzmo-swatch-border-thickness-selected, var(--swatch-border-thickness-selected)) + -2 * var(--luzmo-swatch-focus-indicator-gap, var(--swatch-focus-indicator-gap)))}::slotted([slot=image]){object-fit:contain;inline-size:100%;block-size:100%;transition:width var(--luzmo-animation-duration) ease-in-out,height var(--luzmo-animation-duration) ease-in-out}:host([size=xl]){--swatch-size: var(--luzmo-component-height-xl);--swatch-disabled-icon-size: 24px;--swatch-slash-thickness: 6px}:host([size=l]){--swatch-size: var(--luzmo-component-height-l);--swatch-disabled-icon-size: 20px;--swatch-slash-thickness: 5px}:host([size=s]){--swatch-size: var(--luzmo-component-height-s);--swatch-disabled-icon-size: 16px;--swatch-slash-thickness: 3px}:host([size=xs]){--swatch-size: var(--luzmo-component-height-xs);--swatch-disabled-icon-size: 16px;--swatch-slash-thickness: 2px}:host([size=xxs]){--swatch-size: var(--luzmo-component-height-xxs);--swatch-disabled-icon-size: 14px;--swatch-slash-thickness: 2px}:host{--swatch-size: var(--luzmo-component-height);--swatch-disabled-icon-size: 18px;--swatch-slash-thickness: 4px}:host{--swatch-border-radius: var(--luzmo-border-radius-s);--swatch-focus-indicator-border-radius: var(--luzmo-border-radius-s);--swatch-border-thickness: var(--luzmo-border-width);--swatch-border-thickness-selected: var(--luzmo-border-width);--swatch-focus-indicator-width: var(--luzmo-indicator-width);--swatch-focus-indicator-gap: var(--luzmo-indicator-gap);--swatch-border-color: var(--luzmo-border-color-down);--swatch-icon-border-color: var(--luzmo-border-color);--swatch-border-color-selected: var(--luzmo-border-color-full-down);--swatch-inner-border-color-selected: var(--luzmo-background-color);--swatch-disabled-icon-color: rgb(255, 255, 255);--swatch-dash-icon-color: var(--luzmo-font-color);--swatch-slash-icon-color: var(--luzmo-negative-color);--swatch-focus-indicator-color: var(--luzmo-primary)}.fill:before{background:var(--picked-color, transparent)}:host([border=none]) .fill:before{background:var(--picked-color, transparent)}:host .is-image .fill:before{background:#0000}:host .opacity-checkerboard{background:repeating-conic-gradient(var(--luzmo-swatch-checkerboard-light, rgb(255, 255, 255)) 0 25%,var(--luzmo-swatch-checkerboard-dark, rgb(230, 230, 230)) 0 50%) var(--luzmo-swatch-checkerboard-position, left top)/calc(var(--luzmo-swatch-checkerboard-size, 8px) * 2) calc(var(--luzmo-swatch-checkerboard-size, 8px) * 2)}';var y=Object.defineProperty,k=Object.getOwnPropertyDescriptor,l=(h,e,t,o)=>{for(var s=o>1?void 0:o?k(e,t):e,i=h.length-1,a;i>=0;i--)(a=h[i])&&(s=(o?a(e,t,s):a(s))||s);return o&&s&&y(e,t,s),s};class c extends p.SizedMixin(v.Focusable,{validSizes:["xxs","xs","s","m","l","xl"],noDefaultSize:!0}){constructor(){super(...arguments),this.color="",this.label="",this.mixedValue=!1,this.nothing=!1,this.role="button",this.selected=!1,this.readonly=!1,this.renderDisabled=()=>r.x`
|
|
55
19
|
<svg
|
|
56
20
|
xmlns="http://www.w3.org/2000/svg"
|
|
57
21
|
class="disabled-icon"
|
|
@@ -68,411 +32,18 @@ class LuzmoSwatch extends sizedMixin.SizedMixin(focusable.Focusable, {
|
|
|
68
32
|
fill="var(--swatch-disabled-icon-stroke-color)"
|
|
69
33
|
/>
|
|
70
34
|
</svg>
|
|
71
|
-
|
|
72
|
-
this.renderMixedValue = () => icons.luzmoIcon(icons.luzmoDash);
|
|
73
|
-
}
|
|
74
|
-
static get styles() {
|
|
75
|
-
return [lit.unsafeCSS(styles$1)];
|
|
76
|
-
}
|
|
77
|
-
get value() {
|
|
78
|
-
return this._value || this.color || this.label;
|
|
79
|
-
}
|
|
80
|
-
set value(value) {
|
|
81
|
-
if (value === this._value) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
const oldValue = this.value;
|
|
85
|
-
this._value = value;
|
|
86
|
-
this.requestUpdate("value", oldValue);
|
|
87
|
-
}
|
|
88
|
-
get focusElement() {
|
|
89
|
-
return this;
|
|
90
|
-
}
|
|
91
|
-
toggle(force) {
|
|
92
|
-
if (!this.readonly) {
|
|
93
|
-
this.selected = force ?? !this.selected;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
handleClick() {
|
|
97
|
-
if (this.disabled || this.mixedValue) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
this.toggle();
|
|
101
|
-
const applyDefault = this.dispatchEvent(
|
|
102
|
-
new Event("change", {
|
|
103
|
-
cancelable: true,
|
|
104
|
-
bubbles: true
|
|
105
|
-
})
|
|
106
|
-
);
|
|
107
|
-
if (!applyDefault) {
|
|
108
|
-
this.toggle();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
handleKeydown(event) {
|
|
112
|
-
const { code } = event;
|
|
113
|
-
switch (code) {
|
|
114
|
-
case "Space": {
|
|
115
|
-
event.preventDefault();
|
|
116
|
-
this.addEventListener("keyup", this.handleKeyup);
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
handleKeypress(event) {
|
|
122
|
-
const { code } = event;
|
|
123
|
-
switch (code) {
|
|
124
|
-
case "Enter":
|
|
125
|
-
case "NumpadEnter": {
|
|
126
|
-
this.click();
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
handleKeyup(event) {
|
|
132
|
-
const { code } = event;
|
|
133
|
-
switch (code) {
|
|
134
|
-
case "Space": {
|
|
135
|
-
this.removeEventListener("keyup", this.handleKeyup);
|
|
136
|
-
this.click();
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
render() {
|
|
142
|
-
return lit.html`
|
|
35
|
+
`,this.renderMixedValue=()=>u.T3(u.R)}static get styles(){return[r.r(x)]}get value(){return this._value||this.color||this.label}set value(e){if(e===this._value)return;const t=this.value;this._value=e,this.requestUpdate("value",t)}get focusElement(){return this}toggle(e){this.readonly||(this.selected=e??!this.selected)}handleClick(){if(this.disabled||this.mixedValue)return;this.toggle(),this.dispatchEvent(new Event("change",{cancelable:!0,bubbles:!0}))||this.toggle()}handleKeydown(e){const{code:t}=e;switch(t){case"Space":{e.preventDefault(),this.addEventListener("keyup",this.handleKeyup);break}}}handleKeypress(e){const{code:t}=e;switch(t){case"Enter":case"NumpadEnter":{this.click();break}}}handleKeyup(e){const{code:t}=e;switch(t){case"Space":{this.removeEventListener("keyup",this.handleKeyup),this.click();break}}}render(){return r.x`
|
|
143
36
|
<div
|
|
144
37
|
class="opacity-checkerboard fill"
|
|
145
|
-
style=${
|
|
146
|
-
this.color ? `--picked-color: ${this.color}` : void 0
|
|
147
|
-
)}
|
|
38
|
+
style=${g.o(this.color?`--picked-color: ${this.color}`:void 0)}
|
|
148
39
|
>
|
|
149
40
|
<slot name="image"></slot>
|
|
150
|
-
${
|
|
151
|
-
${
|
|
41
|
+
${b.n(this.disabled,this.renderDisabled)}
|
|
42
|
+
${b.n(this.mixedValue,this.renderMixedValue)}
|
|
152
43
|
</div>
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
willUpdate(changes) {
|
|
156
|
-
var _a;
|
|
157
|
-
if (!this.getAttribute("role")) {
|
|
158
|
-
this.setAttribute("role", "button");
|
|
159
|
-
}
|
|
160
|
-
if ((changes.has("selected") || changes.has("role")) && !this.readonly) {
|
|
161
|
-
const selectedAttribute = this.role === "button" ? "aria-pressed" : "aria-checked";
|
|
162
|
-
const removedSelectedAttribute = this.role === "button" ? "aria-checked" : "aria-pressed";
|
|
163
|
-
if (changes.has("role")) {
|
|
164
|
-
this.removeAttribute(removedSelectedAttribute);
|
|
165
|
-
}
|
|
166
|
-
this.setAttribute(selectedAttribute, this.selected ? "true" : "false");
|
|
167
|
-
}
|
|
168
|
-
if (changes.has("label") || changes.has("color") || changes.has("mixedValue")) {
|
|
169
|
-
if (this.label !== this.color && ((_a = this.label) == null ? void 0 : _a.length)) {
|
|
170
|
-
this.setAttribute("aria-label", this.label);
|
|
171
|
-
} else if (this.color) {
|
|
172
|
-
this.setAttribute("aria-label", this.color);
|
|
173
|
-
} else if (this.mixedValue) {
|
|
174
|
-
this.setAttribute("aria-label", "Mixed");
|
|
175
|
-
} else {
|
|
176
|
-
this.removeAttribute("aria-label");
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
firstUpdated(changes) {
|
|
181
|
-
super.firstUpdated(changes);
|
|
182
|
-
this.addEventListener("click", this.handleClick);
|
|
183
|
-
this.addEventListener("keydown", this.handleKeydown);
|
|
184
|
-
this.addEventListener("keypress", this.handleKeypress);
|
|
185
|
-
if (!this.hasAttribute("tabindex")) {
|
|
186
|
-
this.setAttribute("tabindex", "0");
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
__decorateClass$1([
|
|
191
|
-
decorators_js.property({ reflect: true })
|
|
192
|
-
], LuzmoSwatch.prototype, "border", 2);
|
|
193
|
-
__decorateClass$1([
|
|
194
|
-
decorators_js.property()
|
|
195
|
-
], LuzmoSwatch.prototype, "color", 2);
|
|
196
|
-
__decorateClass$1([
|
|
197
|
-
decorators_js.property()
|
|
198
|
-
], LuzmoSwatch.prototype, "label", 2);
|
|
199
|
-
__decorateClass$1([
|
|
200
|
-
decorators_js.property({ type: Boolean, reflect: true, attribute: "mixed-value" })
|
|
201
|
-
], LuzmoSwatch.prototype, "mixedValue", 2);
|
|
202
|
-
__decorateClass$1([
|
|
203
|
-
decorators_js.property({ type: Boolean, reflect: true })
|
|
204
|
-
], LuzmoSwatch.prototype, "nothing", 2);
|
|
205
|
-
__decorateClass$1([
|
|
206
|
-
decorators_js.property({ reflect: true })
|
|
207
|
-
], LuzmoSwatch.prototype, "role", 2);
|
|
208
|
-
__decorateClass$1([
|
|
209
|
-
decorators_js.property({ reflect: true })
|
|
210
|
-
], LuzmoSwatch.prototype, "rounding", 2);
|
|
211
|
-
__decorateClass$1([
|
|
212
|
-
decorators_js.property({ type: Boolean, reflect: true })
|
|
213
|
-
], LuzmoSwatch.prototype, "selected", 2);
|
|
214
|
-
__decorateClass$1([
|
|
215
|
-
decorators_js.property({ type: Boolean, reflect: true })
|
|
216
|
-
], LuzmoSwatch.prototype, "readonly", 2);
|
|
217
|
-
__decorateClass$1([
|
|
218
|
-
decorators_js.property({ reflect: true })
|
|
219
|
-
], LuzmoSwatch.prototype, "shape", 2);
|
|
220
|
-
__decorateClass$1([
|
|
221
|
-
decorators_js.property()
|
|
222
|
-
], LuzmoSwatch.prototype, "value", 1);
|
|
223
|
-
const styles = ":host{justify-content:flex-start;align-items:flex-start;gap:var(--luzmo-swatch-group-spacing-regular, var(--swatch-group-spacing-regular));flex-flow:wrap;display:inline-flex}:host([density=compact]){gap:var(--luzmo-swatch-group-spacing-compact, var(--swatch-group-spacing-compact))}:host([density=spacious]){gap:var(--luzmo-swatch-group-spacing-spacious, var(--swatch-group-spacing-spacious))}:host{--swatch-group-spacing-compact: 2px;--swatch-group-spacing-regular: 4px;--swatch-group-spacing-spacious: 8px}";
|
|
224
|
-
var __defProp = Object.defineProperty;
|
|
225
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
226
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
227
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
228
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
229
|
-
if (decorator = decorators[i])
|
|
230
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
231
|
-
if (kind && result) __defProp(target, key, result);
|
|
232
|
-
return result;
|
|
233
|
-
};
|
|
234
|
-
class LuzmoSwatchGroup extends sizedMixin.SizedMixin(base.LuzmoElement, {
|
|
235
|
-
validSizes: ["xs", "s", "m", "l"],
|
|
236
|
-
noDefaultSize: true
|
|
237
|
-
}) {
|
|
238
|
-
constructor() {
|
|
239
|
-
super();
|
|
240
|
-
this._selected = [];
|
|
241
|
-
this.selectedSet = /* @__PURE__ */ new Set();
|
|
242
|
-
this.rovingTabindexController = new rovingTabindex.RovingTabindexController(this, {
|
|
243
|
-
focusInIndex: (elements) => {
|
|
244
|
-
let firstEnabledIndex = -1;
|
|
245
|
-
const firstSelectedIndex = elements.findIndex((el, index) => {
|
|
246
|
-
if (!elements[firstEnabledIndex] && !el.disabled) {
|
|
247
|
-
firstEnabledIndex = index;
|
|
248
|
-
}
|
|
249
|
-
return el.selected && !el.disabled;
|
|
250
|
-
});
|
|
251
|
-
return elements[firstSelectedIndex] ? firstSelectedIndex : firstEnabledIndex;
|
|
252
|
-
},
|
|
253
|
-
elements: () => this.swatches,
|
|
254
|
-
isFocusableElement: (el) => !el.disabled
|
|
255
|
-
});
|
|
256
|
-
this.manageChange = async () => {
|
|
257
|
-
const presentSet = /* @__PURE__ */ new Set();
|
|
258
|
-
this.selectedSet = new Set(this.selected);
|
|
259
|
-
await Promise.all(this.swatches.map((swatch) => swatch.updateComplete));
|
|
260
|
-
this.swatches.forEach((swatch) => {
|
|
261
|
-
presentSet.add(swatch.value);
|
|
262
|
-
if (swatch.selected) {
|
|
263
|
-
this.selectedSet.add(swatch.value);
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
this.selectedSet.forEach((value) => {
|
|
267
|
-
if (!presentSet.has(value)) {
|
|
268
|
-
this.selectedSet.delete(value);
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
this._selected = [...this.selectedSet];
|
|
272
|
-
this.rovingTabindexController.clearElementCache();
|
|
273
|
-
};
|
|
274
|
-
new mutationController_js.MutationController(this, {
|
|
275
|
-
config: {
|
|
276
|
-
attributes: true,
|
|
277
|
-
childList: true,
|
|
278
|
-
subtree: true
|
|
279
|
-
},
|
|
280
|
-
callback: () => {
|
|
281
|
-
this.manageChange();
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
static get styles() {
|
|
286
|
-
return [lit.unsafeCSS(styles)];
|
|
287
|
-
}
|
|
288
|
-
get selected() {
|
|
289
|
-
return this._selected;
|
|
290
|
-
}
|
|
291
|
-
set selected(selected) {
|
|
292
|
-
if (selected === this.selected) {
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
const oldSelected = this.selected;
|
|
296
|
-
this._selected = selected;
|
|
297
|
-
this.requestUpdate("selected", oldSelected);
|
|
298
|
-
}
|
|
299
|
-
focus(options) {
|
|
300
|
-
this.rovingTabindexController.focus(options);
|
|
301
|
-
}
|
|
302
|
-
handleChange(event) {
|
|
303
|
-
event.stopPropagation();
|
|
304
|
-
const oldSelected = this.selected;
|
|
305
|
-
if (!this.selects) {
|
|
306
|
-
event.preventDefault();
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
if (this.selects === "single") {
|
|
310
|
-
const { target } = event;
|
|
311
|
-
target.tabIndex = 0;
|
|
312
|
-
target.selected = true;
|
|
313
|
-
if (this.selectedSet.has(target.value)) {
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
this.selectedSet.clear();
|
|
317
|
-
this.selectedSet.add(target.value);
|
|
318
|
-
this.rovingTabindexController.elements.forEach((child) => {
|
|
319
|
-
if (child === target) {
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
child.selected = false;
|
|
323
|
-
});
|
|
324
|
-
} else if (this.selects === "multiple") {
|
|
325
|
-
const { target } = event;
|
|
326
|
-
if (target.selected) {
|
|
327
|
-
this.selectedSet.add(target.value);
|
|
328
|
-
} else {
|
|
329
|
-
this.selectedSet.delete(target.value);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
this._selected = [...this.selectedSet];
|
|
333
|
-
const applyDefault = this.dispatchEvent(
|
|
334
|
-
new Event("change", {
|
|
335
|
-
cancelable: true,
|
|
336
|
-
bubbles: true
|
|
337
|
-
})
|
|
338
|
-
);
|
|
339
|
-
if (!applyDefault) {
|
|
340
|
-
this._selected = oldSelected;
|
|
341
|
-
event.preventDefault();
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
getPassthroughSwatchActions(changes) {
|
|
345
|
-
const targetValues = {};
|
|
346
|
-
if (changes.has("selects") && (this.selects || changes.get("selects") !== void 0)) {
|
|
347
|
-
targetValues.selects = this.selects;
|
|
348
|
-
}
|
|
349
|
-
if (changes.has("border") && (this.border || changes.get("border") !== void 0)) {
|
|
350
|
-
targetValues.border = this.border;
|
|
351
|
-
}
|
|
352
|
-
if (changes.has("rounding") && (this.rounding || changes.get("rounding") !== void 0)) {
|
|
353
|
-
targetValues.rounding = this.rounding;
|
|
354
|
-
}
|
|
355
|
-
if (changes.has("size") && (this.size !== "m" || changes.get("size") !== void 0)) {
|
|
356
|
-
targetValues.size = this.size;
|
|
357
|
-
}
|
|
358
|
-
if (changes.has("shape") && (this.shape || changes.get("shape") !== void 0)) {
|
|
359
|
-
targetValues.shape = this.shape;
|
|
360
|
-
}
|
|
361
|
-
const passThroughSwatchActions = [];
|
|
362
|
-
if (Object.keys(targetValues).length > 0) {
|
|
363
|
-
passThroughSwatchActions.push((swatch) => {
|
|
364
|
-
if ("border" in targetValues) {
|
|
365
|
-
swatch.border = targetValues.border;
|
|
366
|
-
}
|
|
367
|
-
if ("rounding" in targetValues) {
|
|
368
|
-
swatch.rounding = targetValues.rounding;
|
|
369
|
-
}
|
|
370
|
-
if ("shape" in targetValues) {
|
|
371
|
-
swatch.shape = targetValues.shape;
|
|
372
|
-
}
|
|
373
|
-
if ("size" in targetValues) {
|
|
374
|
-
swatch.size = targetValues.size;
|
|
375
|
-
}
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
return passThroughSwatchActions;
|
|
379
|
-
}
|
|
380
|
-
getSelectionSwatchActions(changes) {
|
|
381
|
-
const selectionSwatchActions = [];
|
|
382
|
-
if (!changes.has("selects")) {
|
|
383
|
-
return selectionSwatchActions;
|
|
384
|
-
}
|
|
385
|
-
if (this.selects) {
|
|
386
|
-
this.setAttribute(
|
|
387
|
-
"role",
|
|
388
|
-
this.selects === "single" ? "radiogroup" : "group"
|
|
389
|
-
);
|
|
390
|
-
} else {
|
|
391
|
-
this.removeAttribute("role");
|
|
392
|
-
}
|
|
393
|
-
const swatchRoles = {
|
|
394
|
-
single: "radio",
|
|
395
|
-
multiple: "checkbox"
|
|
396
|
-
};
|
|
397
|
-
const swatchRole = this.selects ? swatchRoles[this.selects] : "button";
|
|
398
|
-
selectionSwatchActions.push((swatch) => {
|
|
399
|
-
swatch.setAttribute("role", swatchRole);
|
|
400
|
-
});
|
|
401
|
-
return selectionSwatchActions;
|
|
402
|
-
}
|
|
403
|
-
render() {
|
|
404
|
-
return lit.html`
|
|
44
|
+
`}willUpdate(e){var t;if(this.getAttribute("role")||this.setAttribute("role","button"),(e.has("selected")||e.has("role"))&&!this.readonly){const o=this.role==="button"?"aria-pressed":"aria-checked",s=this.role==="button"?"aria-checked":"aria-pressed";e.has("role")&&this.removeAttribute(s),this.setAttribute(o,this.selected?"true":"false")}(e.has("label")||e.has("color")||e.has("mixedValue"))&&(this.label!==this.color&&((t=this.label)!=null&&t.length)?this.setAttribute("aria-label",this.label):this.color?this.setAttribute("aria-label",this.color):this.mixedValue?this.setAttribute("aria-label","Mixed"):this.removeAttribute("aria-label"))}firstUpdated(e){super.firstUpdated(e),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeydown),this.addEventListener("keypress",this.handleKeypress),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0")}}l([r.n({reflect:!0})],c.prototype,"border",2);l([r.n()],c.prototype,"color",2);l([r.n()],c.prototype,"label",2);l([r.n({type:Boolean,reflect:!0,attribute:"mixed-value"})],c.prototype,"mixedValue",2);l([r.n({type:Boolean,reflect:!0})],c.prototype,"nothing",2);l([r.n({reflect:!0})],c.prototype,"role",2);l([r.n({reflect:!0})],c.prototype,"rounding",2);l([r.n({type:Boolean,reflect:!0})],c.prototype,"selected",2);l([r.n({type:Boolean,reflect:!0})],c.prototype,"readonly",2);l([r.n({reflect:!0})],c.prototype,"shape",2);l([r.n()],c.prototype,"value",1);const S=":host{justify-content:flex-start;align-items:flex-start;gap:var(--luzmo-swatch-group-spacing-regular, var(--swatch-group-spacing-regular));flex-flow:wrap;display:inline-flex}:host([density=compact]){gap:var(--luzmo-swatch-group-spacing-compact, var(--swatch-group-spacing-compact))}:host([density=spacious]){gap:var(--luzmo-swatch-group-spacing-spacious, var(--swatch-group-spacing-spacious))}:host{--swatch-group-spacing-compact: 2px;--swatch-group-spacing-regular: 4px;--swatch-group-spacing-spacious: 8px}";var C=Object.defineProperty,A=Object.getOwnPropertyDescriptor,d=(h,e,t,o)=>{for(var s=o>1?void 0:o?A(e,t):e,i=h.length-1,a;i>=0;i--)(a=h[i])&&(s=(o?a(e,t,s):a(s))||s);return o&&s&&C(e,t,s),s};class n extends p.SizedMixin(r.LuzmoElement,{validSizes:["xs","s","m","l"],noDefaultSize:!0}){constructor(){super(),this._selected=[],this.selectedSet=new Set,this.rovingTabindexController=new z.RovingTabindexController(this,{focusInIndex:e=>{let t=-1;const o=e.findIndex((s,i)=>(!e[t]&&!s.disabled&&(t=i),s.selected&&!s.disabled));return e[o]?o:t},elements:()=>this.swatches,isFocusableElement:e=>!e.disabled}),this.manageChange=async()=>{const e=new Set;this.selectedSet=new Set(this.selected),await Promise.all(this.swatches.map(t=>t.updateComplete)),this.swatches.forEach(t=>{e.add(t.value),t.selected&&this.selectedSet.add(t.value)}),this.selectedSet.forEach(t=>{e.has(t)||this.selectedSet.delete(t)}),this._selected=[...this.selectedSet],this.rovingTabindexController.clearElementCache()},new w.s(this,{config:{attributes:!0,childList:!0,subtree:!0},callback:()=>{this.manageChange()}})}static get styles(){return[r.r(S)]}get selected(){return this._selected}set selected(e){if(e===this.selected)return;const t=this.selected;this._selected=e,this.requestUpdate("selected",t)}focus(e){this.rovingTabindexController.focus(e)}handleChange(e){e.stopPropagation();const t=this.selected;if(!this.selects){e.preventDefault();return}if(this.selects==="single"){const{target:s}=e;if(s.tabIndex=0,s.selected=!0,this.selectedSet.has(s.value))return;this.selectedSet.clear(),this.selectedSet.add(s.value),this.rovingTabindexController.elements.forEach(i=>{i!==s&&(i.selected=!1)})}else if(this.selects==="multiple"){const{target:s}=e;s.selected?this.selectedSet.add(s.value):this.selectedSet.delete(s.value)}this._selected=[...this.selectedSet],this.dispatchEvent(new Event("change",{cancelable:!0,bubbles:!0}))||(this._selected=t,e.preventDefault())}getPassthroughSwatchActions(e){const t={};e.has("selects")&&(this.selects||e.get("selects")!==void 0)&&(t.selects=this.selects),e.has("border")&&(this.border||e.get("border")!==void 0)&&(t.border=this.border),e.has("rounding")&&(this.rounding||e.get("rounding")!==void 0)&&(t.rounding=this.rounding),e.has("size")&&(this.size!=="m"||e.get("size")!==void 0)&&(t.size=this.size),e.has("shape")&&(this.shape||e.get("shape")!==void 0)&&(t.shape=this.shape);const o=[];return Object.keys(t).length>0&&o.push(s=>{"border"in t&&(s.border=t.border),"rounding"in t&&(s.rounding=t.rounding),"shape"in t&&(s.shape=t.shape),"size"in t&&(s.size=t.size)}),o}getSelectionSwatchActions(e){const t=[];if(!e.has("selects"))return t;this.selects?this.setAttribute("role",this.selects==="single"?"radiogroup":"group"):this.removeAttribute("role");const o={single:"radio",multiple:"checkbox"},s=this.selects?o[this.selects]:"button";return t.push(i=>{i.setAttribute("role",s)}),t}render(){return r.x`
|
|
405
45
|
<slot
|
|
406
46
|
@change=${this.handleChange}
|
|
407
47
|
@slotchange=${this.manageChange}
|
|
408
48
|
></slot>
|
|
409
|
-
|
|
410
|
-
}
|
|
411
|
-
willUpdate(changes) {
|
|
412
|
-
const swatchActions = [
|
|
413
|
-
...this.getPassthroughSwatchActions(changes),
|
|
414
|
-
...this.getSelectionSwatchActions(changes)
|
|
415
|
-
];
|
|
416
|
-
let nextSelected = new Set(this.selected);
|
|
417
|
-
const currentValues = /* @__PURE__ */ new Set();
|
|
418
|
-
if (changes.has("selected")) {
|
|
419
|
-
swatchActions.push((swatch) => {
|
|
420
|
-
currentValues.add(swatch.value);
|
|
421
|
-
swatch.selected = nextSelected.has(swatch.value) || !this.hasUpdated && swatch.selected ? true : false;
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
const doActions = () => {
|
|
425
|
-
nextSelected = new Set(this.selected);
|
|
426
|
-
this.swatches.forEach((swatch) => {
|
|
427
|
-
swatchActions.forEach((action) => {
|
|
428
|
-
action(swatch);
|
|
429
|
-
});
|
|
430
|
-
});
|
|
431
|
-
if (changes.has("selected")) {
|
|
432
|
-
this._selected = [...nextSelected.values()].filter(
|
|
433
|
-
(selectedValue) => currentValues.has(selectedValue)
|
|
434
|
-
);
|
|
435
|
-
}
|
|
436
|
-
};
|
|
437
|
-
if (this.hasUpdated) {
|
|
438
|
-
doActions();
|
|
439
|
-
} else {
|
|
440
|
-
this.renderRoot.addEventListener(
|
|
441
|
-
"slotchange",
|
|
442
|
-
() => {
|
|
443
|
-
requestAnimationFrame(doActions);
|
|
444
|
-
},
|
|
445
|
-
{ once: true }
|
|
446
|
-
);
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
__decorateClass([
|
|
451
|
-
decorators_js.property({ reflect: true })
|
|
452
|
-
], LuzmoSwatchGroup.prototype, "border", 2);
|
|
453
|
-
__decorateClass([
|
|
454
|
-
decorators_js.property({ reflect: true })
|
|
455
|
-
], LuzmoSwatchGroup.prototype, "density", 2);
|
|
456
|
-
__decorateClass([
|
|
457
|
-
decorators_js.property({ reflect: true })
|
|
458
|
-
], LuzmoSwatchGroup.prototype, "rounding", 2);
|
|
459
|
-
__decorateClass([
|
|
460
|
-
decorators_js.property({ type: Array })
|
|
461
|
-
], LuzmoSwatchGroup.prototype, "selected", 1);
|
|
462
|
-
__decorateClass([
|
|
463
|
-
decorators_js.property()
|
|
464
|
-
], LuzmoSwatchGroup.prototype, "selects", 2);
|
|
465
|
-
__decorateClass([
|
|
466
|
-
decorators_js.property({ reflect: true })
|
|
467
|
-
], LuzmoSwatchGroup.prototype, "shape", 2);
|
|
468
|
-
__decorateClass([
|
|
469
|
-
decorators_js.queryAssignedElements({ flatten: true })
|
|
470
|
-
], LuzmoSwatchGroup.prototype, "swatches", 2);
|
|
471
|
-
if (!customElements.get("luzmo-swatch")) {
|
|
472
|
-
customElements.define("luzmo-swatch", LuzmoSwatch);
|
|
473
|
-
}
|
|
474
|
-
if (!customElements.get("luzmo-swatch-group")) {
|
|
475
|
-
customElements.define("luzmo-swatch-group", LuzmoSwatchGroup);
|
|
476
|
-
}
|
|
477
|
-
exports.LuzmoSwatch = LuzmoSwatch;
|
|
478
|
-
exports.LuzmoSwatchGroup = LuzmoSwatchGroup;
|
|
49
|
+
`}willUpdate(e){const t=[...this.getPassthroughSwatchActions(e),...this.getSelectionSwatchActions(e)];let o=new Set(this.selected);const s=new Set;e.has("selected")&&t.push(a=>{s.add(a.value),a.selected=!!(o.has(a.value)||!this.hasUpdated&&a.selected)});const i=()=>{o=new Set(this.selected),this.swatches.forEach(a=>{t.forEach(f=>{f(a)})}),e.has("selected")&&(this._selected=[...o.values()].filter(a=>s.has(a)))};this.hasUpdated?i():this.renderRoot.addEventListener("slotchange",()=>{requestAnimationFrame(i)},{once:!0})}}d([r.n({reflect:!0})],n.prototype,"border",2);d([r.n({reflect:!0})],n.prototype,"density",2);d([r.n({reflect:!0})],n.prototype,"rounding",2);d([r.n({type:Array})],n.prototype,"selected",1);d([r.n()],n.prototype,"selects",2);d([r.n({reflect:!0})],n.prototype,"shape",2);d([m.o({flatten:!0})],n.prototype,"swatches",2);customElements.get("luzmo-swatch")||customElements.define("luzmo-swatch",c);customElements.get("luzmo-swatch-group")||customElements.define("luzmo-swatch-group",n);exports.LuzmoSwatch=c;exports.LuzmoSwatchGroup=n;
|