@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,34 +15,50 @@
|
|
|
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 { s as k } from "../mutation-controller-DH7YOCyj.js";
|
|
25
|
-
import { o as S } from "../query-assigned-elements-DjfhL1cl.js";
|
|
26
|
-
import { R as C } from "../roving-tabindex-DOg4z6ZU.js";
|
|
27
|
-
const g = () => {
|
|
28
|
-
if (typeof document < "u" && !document.querySelector("style[data-luzmo-vars]")) {
|
|
29
|
-
const c = document.createElement("style");
|
|
30
|
-
c.setAttribute("data-luzmo-vars", ""), c.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(c);
|
|
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);
|
|
31
24
|
}
|
|
32
25
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
initializeGlobalLuzmoCSSVariables();
|
|
27
|
+
import { luzmoIcon, luzmoDash } from "@luzmo/icons";
|
|
28
|
+
import { html, unsafeCSS } from "lit";
|
|
29
|
+
import { property, queryAssignedElements } from "lit/decorators.js";
|
|
30
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
31
|
+
import { when } from "lit/directives/when.js";
|
|
32
|
+
import { F as Focusable } from "../focusable-ChCLg1k4.js";
|
|
33
|
+
import { S as SizedMixin } from "../sized-mixin-DmkrNdWB.js";
|
|
34
|
+
import { MutationController } from "@lit-labs/observers/mutation-controller.js";
|
|
35
|
+
import { a as LuzmoElement } from "../base-DmeVy0cq.js";
|
|
36
|
+
import { R as RovingTabindexController } from "../roving-tabindex-DPF9NmrH.js";
|
|
37
|
+
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)}';
|
|
38
|
+
var __defProp$1 = Object.defineProperty;
|
|
39
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
40
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
41
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
42
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
43
|
+
if (decorator = decorators[i])
|
|
44
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
45
|
+
if (kind && result) __defProp$1(target, key, result);
|
|
46
|
+
return result;
|
|
39
47
|
};
|
|
40
|
-
class
|
|
48
|
+
class LuzmoSwatch extends SizedMixin(Focusable, {
|
|
41
49
|
validSizes: ["xxs", "xs", "s", "m", "l", "xl"],
|
|
42
|
-
noDefaultSize:
|
|
50
|
+
noDefaultSize: true
|
|
43
51
|
}) {
|
|
44
52
|
constructor() {
|
|
45
|
-
super(...arguments)
|
|
53
|
+
super(...arguments);
|
|
54
|
+
this.color = "";
|
|
55
|
+
this.label = "";
|
|
56
|
+
this.mixedValue = false;
|
|
57
|
+
this.nothing = false;
|
|
58
|
+
this.role = "button";
|
|
59
|
+
this.selected = false;
|
|
60
|
+
this.readonly = false;
|
|
61
|
+
this.renderDisabled = () => html`
|
|
46
62
|
<svg
|
|
47
63
|
xmlns="http://www.w3.org/2000/svg"
|
|
48
64
|
class="disabled-icon"
|
|
@@ -59,48 +75,59 @@ class a extends m(y, {
|
|
|
59
75
|
fill="var(--swatch-disabled-icon-stroke-color)"
|
|
60
76
|
/>
|
|
61
77
|
</svg>
|
|
62
|
-
|
|
78
|
+
`;
|
|
79
|
+
this.renderMixedValue = () => luzmoIcon(luzmoDash);
|
|
63
80
|
}
|
|
64
81
|
static get styles() {
|
|
65
|
-
return [
|
|
82
|
+
return [unsafeCSS(styles$1)];
|
|
66
83
|
}
|
|
67
84
|
get value() {
|
|
68
85
|
return this._value || this.color || this.label;
|
|
69
86
|
}
|
|
70
|
-
set value(
|
|
71
|
-
if (
|
|
87
|
+
set value(value) {
|
|
88
|
+
if (value === this._value) {
|
|
72
89
|
return;
|
|
73
|
-
|
|
74
|
-
|
|
90
|
+
}
|
|
91
|
+
const oldValue = this.value;
|
|
92
|
+
this._value = value;
|
|
93
|
+
this.requestUpdate("value", oldValue);
|
|
75
94
|
}
|
|
76
95
|
get focusElement() {
|
|
77
96
|
return this;
|
|
78
97
|
}
|
|
79
|
-
toggle(
|
|
80
|
-
|
|
98
|
+
toggle(force) {
|
|
99
|
+
if (!this.readonly) {
|
|
100
|
+
this.selected = force ?? !this.selected;
|
|
101
|
+
}
|
|
81
102
|
}
|
|
82
103
|
handleClick() {
|
|
83
|
-
if (this.disabled || this.mixedValue)
|
|
104
|
+
if (this.disabled || this.mixedValue) {
|
|
84
105
|
return;
|
|
85
|
-
|
|
106
|
+
}
|
|
107
|
+
this.toggle();
|
|
108
|
+
const applyDefault = this.dispatchEvent(
|
|
86
109
|
new Event("change", {
|
|
87
|
-
cancelable:
|
|
88
|
-
bubbles:
|
|
110
|
+
cancelable: true,
|
|
111
|
+
bubbles: true
|
|
89
112
|
})
|
|
90
|
-
)
|
|
113
|
+
);
|
|
114
|
+
if (!applyDefault) {
|
|
115
|
+
this.toggle();
|
|
116
|
+
}
|
|
91
117
|
}
|
|
92
|
-
handleKeydown(
|
|
93
|
-
const { code
|
|
94
|
-
switch (
|
|
118
|
+
handleKeydown(event) {
|
|
119
|
+
const { code } = event;
|
|
120
|
+
switch (code) {
|
|
95
121
|
case "Space": {
|
|
96
|
-
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
this.addEventListener("keyup", this.handleKeyup);
|
|
97
124
|
break;
|
|
98
125
|
}
|
|
99
126
|
}
|
|
100
127
|
}
|
|
101
|
-
handleKeypress(
|
|
102
|
-
const { code
|
|
103
|
-
switch (
|
|
128
|
+
handleKeypress(event) {
|
|
129
|
+
const { code } = event;
|
|
130
|
+
switch (code) {
|
|
104
131
|
case "Enter":
|
|
105
132
|
case "NumpadEnter": {
|
|
106
133
|
this.click();
|
|
@@ -108,105 +135,154 @@ class a extends m(y, {
|
|
|
108
135
|
}
|
|
109
136
|
}
|
|
110
137
|
}
|
|
111
|
-
handleKeyup(
|
|
112
|
-
const { code
|
|
113
|
-
switch (
|
|
138
|
+
handleKeyup(event) {
|
|
139
|
+
const { code } = event;
|
|
140
|
+
switch (code) {
|
|
114
141
|
case "Space": {
|
|
115
|
-
this.removeEventListener("keyup", this.handleKeyup)
|
|
142
|
+
this.removeEventListener("keyup", this.handleKeyup);
|
|
143
|
+
this.click();
|
|
116
144
|
break;
|
|
117
145
|
}
|
|
118
146
|
}
|
|
119
147
|
}
|
|
120
148
|
render() {
|
|
121
|
-
return
|
|
149
|
+
return html`
|
|
122
150
|
<div
|
|
123
151
|
class="opacity-checkerboard fill"
|
|
124
|
-
style=${
|
|
152
|
+
style=${ifDefined(
|
|
125
153
|
this.color ? `--picked-color: ${this.color}` : void 0
|
|
126
154
|
)}
|
|
127
155
|
>
|
|
128
156
|
<slot name="image"></slot>
|
|
129
|
-
${
|
|
130
|
-
${
|
|
157
|
+
${when(this.disabled, this.renderDisabled)}
|
|
158
|
+
${when(this.mixedValue, this.renderMixedValue)}
|
|
131
159
|
</div>
|
|
132
160
|
`;
|
|
133
161
|
}
|
|
134
|
-
willUpdate(
|
|
135
|
-
var
|
|
136
|
-
if (this.getAttribute("role")
|
|
137
|
-
|
|
138
|
-
|
|
162
|
+
willUpdate(changes) {
|
|
163
|
+
var _a;
|
|
164
|
+
if (!this.getAttribute("role")) {
|
|
165
|
+
this.setAttribute("role", "button");
|
|
166
|
+
}
|
|
167
|
+
if ((changes.has("selected") || changes.has("role")) && !this.readonly) {
|
|
168
|
+
const selectedAttribute = this.role === "button" ? "aria-pressed" : "aria-checked";
|
|
169
|
+
const removedSelectedAttribute = this.role === "button" ? "aria-checked" : "aria-pressed";
|
|
170
|
+
if (changes.has("role")) {
|
|
171
|
+
this.removeAttribute(removedSelectedAttribute);
|
|
172
|
+
}
|
|
173
|
+
this.setAttribute(selectedAttribute, this.selected ? "true" : "false");
|
|
174
|
+
}
|
|
175
|
+
if (changes.has("label") || changes.has("color") || changes.has("mixedValue")) {
|
|
176
|
+
if (this.label !== this.color && ((_a = this.label) == null ? void 0 : _a.length)) {
|
|
177
|
+
this.setAttribute("aria-label", this.label);
|
|
178
|
+
} else if (this.color) {
|
|
179
|
+
this.setAttribute("aria-label", this.color);
|
|
180
|
+
} else if (this.mixedValue) {
|
|
181
|
+
this.setAttribute("aria-label", "Mixed");
|
|
182
|
+
} else {
|
|
183
|
+
this.removeAttribute("aria-label");
|
|
184
|
+
}
|
|
139
185
|
}
|
|
140
|
-
(e.has("label") || e.has("color") || e.has("mixedValue")) && (this.label !== this.color && ((o = this.label) != null && o.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"));
|
|
141
186
|
}
|
|
142
|
-
firstUpdated(
|
|
143
|
-
super.firstUpdated(
|
|
187
|
+
firstUpdated(changes) {
|
|
188
|
+
super.firstUpdated(changes);
|
|
189
|
+
this.addEventListener("click", this.handleClick);
|
|
190
|
+
this.addEventListener("keydown", this.handleKeydown);
|
|
191
|
+
this.addEventListener("keypress", this.handleKeypress);
|
|
192
|
+
if (!this.hasAttribute("tabindex")) {
|
|
193
|
+
this.setAttribute("tabindex", "0");
|
|
194
|
+
}
|
|
144
195
|
}
|
|
145
196
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
],
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
],
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
],
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
],
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
],
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
],
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
],
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
],
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
],
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
],
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
],
|
|
179
|
-
const
|
|
180
|
-
var
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
197
|
+
__decorateClass$1([
|
|
198
|
+
property({ reflect: true })
|
|
199
|
+
], LuzmoSwatch.prototype, "border", 2);
|
|
200
|
+
__decorateClass$1([
|
|
201
|
+
property()
|
|
202
|
+
], LuzmoSwatch.prototype, "color", 2);
|
|
203
|
+
__decorateClass$1([
|
|
204
|
+
property()
|
|
205
|
+
], LuzmoSwatch.prototype, "label", 2);
|
|
206
|
+
__decorateClass$1([
|
|
207
|
+
property({ type: Boolean, reflect: true, attribute: "mixed-value" })
|
|
208
|
+
], LuzmoSwatch.prototype, "mixedValue", 2);
|
|
209
|
+
__decorateClass$1([
|
|
210
|
+
property({ type: Boolean, reflect: true })
|
|
211
|
+
], LuzmoSwatch.prototype, "nothing", 2);
|
|
212
|
+
__decorateClass$1([
|
|
213
|
+
property({ reflect: true })
|
|
214
|
+
], LuzmoSwatch.prototype, "role", 2);
|
|
215
|
+
__decorateClass$1([
|
|
216
|
+
property({ reflect: true })
|
|
217
|
+
], LuzmoSwatch.prototype, "rounding", 2);
|
|
218
|
+
__decorateClass$1([
|
|
219
|
+
property({ type: Boolean, reflect: true })
|
|
220
|
+
], LuzmoSwatch.prototype, "selected", 2);
|
|
221
|
+
__decorateClass$1([
|
|
222
|
+
property({ type: Boolean, reflect: true })
|
|
223
|
+
], LuzmoSwatch.prototype, "readonly", 2);
|
|
224
|
+
__decorateClass$1([
|
|
225
|
+
property({ reflect: true })
|
|
226
|
+
], LuzmoSwatch.prototype, "shape", 2);
|
|
227
|
+
__decorateClass$1([
|
|
228
|
+
property()
|
|
229
|
+
], LuzmoSwatch.prototype, "value", 1);
|
|
230
|
+
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}";
|
|
231
|
+
var __defProp = Object.defineProperty;
|
|
232
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
233
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
234
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
235
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
236
|
+
if (decorator = decorators[i])
|
|
237
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
238
|
+
if (kind && result) __defProp(target, key, result);
|
|
239
|
+
return result;
|
|
184
240
|
};
|
|
185
|
-
class
|
|
241
|
+
class LuzmoSwatchGroup extends SizedMixin(LuzmoElement, {
|
|
186
242
|
validSizes: ["xs", "s", "m", "l"],
|
|
187
|
-
noDefaultSize:
|
|
243
|
+
noDefaultSize: true
|
|
188
244
|
}) {
|
|
189
245
|
constructor() {
|
|
190
|
-
super()
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
246
|
+
super();
|
|
247
|
+
this._selected = [];
|
|
248
|
+
this.selectedSet = /* @__PURE__ */ new Set();
|
|
249
|
+
this.rovingTabindexController = new RovingTabindexController(this, {
|
|
250
|
+
focusInIndex: (elements) => {
|
|
251
|
+
let firstEnabledIndex = -1;
|
|
252
|
+
const firstSelectedIndex = elements.findIndex((el, index) => {
|
|
253
|
+
if (!elements[firstEnabledIndex] && !el.disabled) {
|
|
254
|
+
firstEnabledIndex = index;
|
|
255
|
+
}
|
|
256
|
+
return el.selected && !el.disabled;
|
|
257
|
+
});
|
|
258
|
+
return elements[firstSelectedIndex] ? firstSelectedIndex : firstEnabledIndex;
|
|
195
259
|
},
|
|
196
260
|
elements: () => this.swatches,
|
|
197
|
-
isFocusableElement: (
|
|
198
|
-
})
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
261
|
+
isFocusableElement: (el) => !el.disabled
|
|
262
|
+
});
|
|
263
|
+
this.manageChange = async () => {
|
|
264
|
+
const presentSet = /* @__PURE__ */ new Set();
|
|
265
|
+
this.selectedSet = new Set(this.selected);
|
|
266
|
+
await Promise.all(this.swatches.map((swatch) => swatch.updateComplete));
|
|
267
|
+
this.swatches.forEach((swatch) => {
|
|
268
|
+
presentSet.add(swatch.value);
|
|
269
|
+
if (swatch.selected) {
|
|
270
|
+
this.selectedSet.add(swatch.value);
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
this.selectedSet.forEach((value) => {
|
|
274
|
+
if (!presentSet.has(value)) {
|
|
275
|
+
this.selectedSet.delete(value);
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
this._selected = [...this.selectedSet];
|
|
279
|
+
this.rovingTabindexController.clearElementCache();
|
|
280
|
+
};
|
|
281
|
+
new MutationController(this, {
|
|
206
282
|
config: {
|
|
207
|
-
attributes:
|
|
208
|
-
childList:
|
|
209
|
-
subtree:
|
|
283
|
+
attributes: true,
|
|
284
|
+
childList: true,
|
|
285
|
+
subtree: true
|
|
210
286
|
},
|
|
211
287
|
callback: () => {
|
|
212
288
|
this.manageChange();
|
|
@@ -214,129 +290,198 @@ class d extends m(w, {
|
|
|
214
290
|
});
|
|
215
291
|
}
|
|
216
292
|
static get styles() {
|
|
217
|
-
return [
|
|
293
|
+
return [unsafeCSS(styles)];
|
|
218
294
|
}
|
|
219
295
|
get selected() {
|
|
220
296
|
return this._selected;
|
|
221
297
|
}
|
|
222
|
-
set selected(
|
|
223
|
-
if (
|
|
298
|
+
set selected(selected) {
|
|
299
|
+
if (selected === this.selected) {
|
|
224
300
|
return;
|
|
225
|
-
|
|
226
|
-
|
|
301
|
+
}
|
|
302
|
+
const oldSelected = this.selected;
|
|
303
|
+
this._selected = selected;
|
|
304
|
+
this.requestUpdate("selected", oldSelected);
|
|
227
305
|
}
|
|
228
|
-
focus(
|
|
229
|
-
this.rovingTabindexController.focus(
|
|
306
|
+
focus(options) {
|
|
307
|
+
this.rovingTabindexController.focus(options);
|
|
230
308
|
}
|
|
231
|
-
handleChange(
|
|
232
|
-
|
|
233
|
-
const
|
|
309
|
+
handleChange(event) {
|
|
310
|
+
event.stopPropagation();
|
|
311
|
+
const oldSelected = this.selected;
|
|
234
312
|
if (!this.selects) {
|
|
235
|
-
|
|
313
|
+
event.preventDefault();
|
|
236
314
|
return;
|
|
237
315
|
}
|
|
238
316
|
if (this.selects === "single") {
|
|
239
|
-
const { target
|
|
240
|
-
|
|
317
|
+
const { target } = event;
|
|
318
|
+
target.tabIndex = 0;
|
|
319
|
+
target.selected = true;
|
|
320
|
+
if (this.selectedSet.has(target.value)) {
|
|
241
321
|
return;
|
|
242
|
-
|
|
243
|
-
|
|
322
|
+
}
|
|
323
|
+
this.selectedSet.clear();
|
|
324
|
+
this.selectedSet.add(target.value);
|
|
325
|
+
this.rovingTabindexController.elements.forEach((child) => {
|
|
326
|
+
if (child === target) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
child.selected = false;
|
|
244
330
|
});
|
|
245
331
|
} else if (this.selects === "multiple") {
|
|
246
|
-
const { target
|
|
247
|
-
|
|
332
|
+
const { target } = event;
|
|
333
|
+
if (target.selected) {
|
|
334
|
+
this.selectedSet.add(target.value);
|
|
335
|
+
} else {
|
|
336
|
+
this.selectedSet.delete(target.value);
|
|
337
|
+
}
|
|
248
338
|
}
|
|
249
|
-
this._selected = [...this.selectedSet]
|
|
339
|
+
this._selected = [...this.selectedSet];
|
|
340
|
+
const applyDefault = this.dispatchEvent(
|
|
250
341
|
new Event("change", {
|
|
251
|
-
cancelable:
|
|
252
|
-
bubbles:
|
|
342
|
+
cancelable: true,
|
|
343
|
+
bubbles: true
|
|
253
344
|
})
|
|
254
|
-
)
|
|
345
|
+
);
|
|
346
|
+
if (!applyDefault) {
|
|
347
|
+
this._selected = oldSelected;
|
|
348
|
+
event.preventDefault();
|
|
349
|
+
}
|
|
255
350
|
}
|
|
256
|
-
getPassthroughSwatchActions(
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
351
|
+
getPassthroughSwatchActions(changes) {
|
|
352
|
+
const targetValues = {};
|
|
353
|
+
if (changes.has("selects") && (this.selects || changes.get("selects") !== void 0)) {
|
|
354
|
+
targetValues.selects = this.selects;
|
|
355
|
+
}
|
|
356
|
+
if (changes.has("border") && (this.border || changes.get("border") !== void 0)) {
|
|
357
|
+
targetValues.border = this.border;
|
|
358
|
+
}
|
|
359
|
+
if (changes.has("rounding") && (this.rounding || changes.get("rounding") !== void 0)) {
|
|
360
|
+
targetValues.rounding = this.rounding;
|
|
361
|
+
}
|
|
362
|
+
if (changes.has("size") && (this.size !== "m" || changes.get("size") !== void 0)) {
|
|
363
|
+
targetValues.size = this.size;
|
|
364
|
+
}
|
|
365
|
+
if (changes.has("shape") && (this.shape || changes.get("shape") !== void 0)) {
|
|
366
|
+
targetValues.shape = this.shape;
|
|
367
|
+
}
|
|
368
|
+
const passThroughSwatchActions = [];
|
|
369
|
+
if (Object.keys(targetValues).length > 0) {
|
|
370
|
+
passThroughSwatchActions.push((swatch) => {
|
|
371
|
+
if ("border" in targetValues) {
|
|
372
|
+
swatch.border = targetValues.border;
|
|
373
|
+
}
|
|
374
|
+
if ("rounding" in targetValues) {
|
|
375
|
+
swatch.rounding = targetValues.rounding;
|
|
376
|
+
}
|
|
377
|
+
if ("shape" in targetValues) {
|
|
378
|
+
swatch.shape = targetValues.shape;
|
|
379
|
+
}
|
|
380
|
+
if ("size" in targetValues) {
|
|
381
|
+
swatch.size = targetValues.size;
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
return passThroughSwatchActions;
|
|
263
386
|
}
|
|
264
|
-
getSelectionSwatchActions(
|
|
265
|
-
const
|
|
266
|
-
if (!
|
|
267
|
-
return
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
this.
|
|
271
|
-
|
|
272
|
-
|
|
387
|
+
getSelectionSwatchActions(changes) {
|
|
388
|
+
const selectionSwatchActions = [];
|
|
389
|
+
if (!changes.has("selects")) {
|
|
390
|
+
return selectionSwatchActions;
|
|
391
|
+
}
|
|
392
|
+
if (this.selects) {
|
|
393
|
+
this.setAttribute(
|
|
394
|
+
"role",
|
|
395
|
+
this.selects === "single" ? "radiogroup" : "group"
|
|
396
|
+
);
|
|
397
|
+
} else {
|
|
398
|
+
this.removeAttribute("role");
|
|
399
|
+
}
|
|
400
|
+
const swatchRoles = {
|
|
273
401
|
single: "radio",
|
|
274
402
|
multiple: "checkbox"
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
403
|
+
};
|
|
404
|
+
const swatchRole = this.selects ? swatchRoles[this.selects] : "button";
|
|
405
|
+
selectionSwatchActions.push((swatch) => {
|
|
406
|
+
swatch.setAttribute("role", swatchRole);
|
|
407
|
+
});
|
|
408
|
+
return selectionSwatchActions;
|
|
279
409
|
}
|
|
280
410
|
render() {
|
|
281
|
-
return
|
|
411
|
+
return html`
|
|
282
412
|
<slot
|
|
283
413
|
@change=${this.handleChange}
|
|
284
414
|
@slotchange=${this.manageChange}
|
|
285
415
|
></slot>
|
|
286
416
|
`;
|
|
287
417
|
}
|
|
288
|
-
willUpdate(
|
|
289
|
-
const
|
|
290
|
-
...this.getPassthroughSwatchActions(
|
|
291
|
-
...this.getSelectionSwatchActions(
|
|
418
|
+
willUpdate(changes) {
|
|
419
|
+
const swatchActions = [
|
|
420
|
+
...this.getPassthroughSwatchActions(changes),
|
|
421
|
+
...this.getSelectionSwatchActions(changes)
|
|
292
422
|
];
|
|
293
|
-
let
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
423
|
+
let nextSelected = new Set(this.selected);
|
|
424
|
+
const currentValues = /* @__PURE__ */ new Set();
|
|
425
|
+
if (changes.has("selected")) {
|
|
426
|
+
swatchActions.push((swatch) => {
|
|
427
|
+
currentValues.add(swatch.value);
|
|
428
|
+
swatch.selected = nextSelected.has(swatch.value) || !this.hasUpdated && swatch.selected ? true : false;
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
const doActions = () => {
|
|
432
|
+
nextSelected = new Set(this.selected);
|
|
433
|
+
this.swatches.forEach((swatch) => {
|
|
434
|
+
swatchActions.forEach((action) => {
|
|
435
|
+
action(swatch);
|
|
302
436
|
});
|
|
303
|
-
})
|
|
304
|
-
|
|
305
|
-
|
|
437
|
+
});
|
|
438
|
+
if (changes.has("selected")) {
|
|
439
|
+
this._selected = [...nextSelected.values()].filter(
|
|
440
|
+
(selectedValue) => currentValues.has(selectedValue)
|
|
441
|
+
);
|
|
442
|
+
}
|
|
306
443
|
};
|
|
307
|
-
this.hasUpdated
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
444
|
+
if (this.hasUpdated) {
|
|
445
|
+
doActions();
|
|
446
|
+
} else {
|
|
447
|
+
this.renderRoot.addEventListener(
|
|
448
|
+
"slotchange",
|
|
449
|
+
() => {
|
|
450
|
+
requestAnimationFrame(doActions);
|
|
451
|
+
},
|
|
452
|
+
{ once: true }
|
|
453
|
+
);
|
|
454
|
+
}
|
|
314
455
|
}
|
|
315
456
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
],
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
],
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
],
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
],
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
],
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
],
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
],
|
|
337
|
-
customElements.get("luzmo-swatch")
|
|
338
|
-
customElements.
|
|
457
|
+
__decorateClass([
|
|
458
|
+
property({ reflect: true })
|
|
459
|
+
], LuzmoSwatchGroup.prototype, "border", 2);
|
|
460
|
+
__decorateClass([
|
|
461
|
+
property({ reflect: true })
|
|
462
|
+
], LuzmoSwatchGroup.prototype, "density", 2);
|
|
463
|
+
__decorateClass([
|
|
464
|
+
property({ reflect: true })
|
|
465
|
+
], LuzmoSwatchGroup.prototype, "rounding", 2);
|
|
466
|
+
__decorateClass([
|
|
467
|
+
property({ type: Array })
|
|
468
|
+
], LuzmoSwatchGroup.prototype, "selected", 1);
|
|
469
|
+
__decorateClass([
|
|
470
|
+
property()
|
|
471
|
+
], LuzmoSwatchGroup.prototype, "selects", 2);
|
|
472
|
+
__decorateClass([
|
|
473
|
+
property({ reflect: true })
|
|
474
|
+
], LuzmoSwatchGroup.prototype, "shape", 2);
|
|
475
|
+
__decorateClass([
|
|
476
|
+
queryAssignedElements({ flatten: true })
|
|
477
|
+
], LuzmoSwatchGroup.prototype, "swatches", 2);
|
|
478
|
+
if (!customElements.get("luzmo-swatch")) {
|
|
479
|
+
customElements.define("luzmo-swatch", LuzmoSwatch);
|
|
480
|
+
}
|
|
481
|
+
if (!customElements.get("luzmo-swatch-group")) {
|
|
482
|
+
customElements.define("luzmo-swatch-group", LuzmoSwatchGroup);
|
|
483
|
+
}
|
|
339
484
|
export {
|
|
340
|
-
|
|
341
|
-
|
|
485
|
+
LuzmoSwatch,
|
|
486
|
+
LuzmoSwatchGroup
|
|
342
487
|
};
|