@luzmo/lucero 1.0.1-alpha.17 → 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 -221
- package/components/tooltip/index.js +131 -155
- package/components/tooltip/tooltip.d.ts +12 -1
- 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/custom-elements.json +1 -1
- package/package.json +1 -1
- package/components/action-group-DHp8RHDf.js +0 -392
- package/components/action-group-MPf19RPV.cjs +0 -391
- package/components/base-COw9n7UR.cjs +0 -119
- package/components/base-DmeVy0cq.js +0 -120
- package/components/button-base-7Ak55xFd.cjs +0 -206
- package/components/button-base-C3kf6BTK.js +0 -207
- package/components/checkbox-mixin-8cL-vfDy.js +0 -84
- package/components/checkbox-mixin-CE7dJj3J.cjs +0 -83
- package/components/clear-button-Co6oKSgl.js +0 -59
- package/components/clear-button-X_HDY2eH.cjs +0 -58
- package/components/close-button-DPBK6Kpu.cjs +0 -59
- package/components/close-button-Miw9ZjoJ.js +0 -60
- package/components/color-controller-BjDZaxhX.js +0 -491
- package/components/color-controller-C3c_vb2P.cjs +0 -490
- package/components/color-loupe-BQqNR8YD.cjs +0 -88
- package/components/color-loupe-B_DDFv8l.js +0 -89
- package/components/condition-attribute-with-id-DEc2Yjne.cjs +0 -43
- package/components/dependency-manger-CcIE1uvQ.cjs +0 -63
- package/components/divider.module-Cm5LcDRV.cjs +0 -20
- package/components/divider.module-DauH6k2_.js +0 -21
- package/components/element-resolution-DCsrhGZO.cjs +0 -112
- package/components/element-resolution-nMlmW4Jy.js +0 -113
- package/components/field-group-DNmY8W9v.cjs +0 -86
- package/components/field-group-DVdAWCQF.js +0 -87
- package/components/field-label-CKH9EXpR.cjs +0 -156
- package/components/field-label-Dpsecoc6.js +0 -157
- package/components/focus-group-BqDAk9Is.js +0 -337
- package/components/focus-group-DFzOlalL.cjs +0 -336
- package/components/focus-visible-B-B8-P9R.cjs +0 -104
- package/components/focus-visible-BUPRWlsh.js +0 -105
- package/components/focusable-BPrTcZPd.cjs +0 -262
- package/components/focusable-ChCLg1k4.js +0 -263
- package/components/language-resolution-iN9EImbb.cjs +0 -57
- package/components/like-anchor-D62faRNG.cjs +0 -79
- package/components/like-anchor-v3cJ9RWM.js +0 -80
- package/components/manage-help-text-BYx84zZR.cjs +0 -125
- package/components/manage-help-text-DOuMTGht.js +0 -126
- package/components/observe-slot-presence-9AwLGUQ_.cjs +0 -78
- package/components/observe-slot-presence-DcMdoumP.js +0 -79
- package/components/observe-slot-text-CSofZeeF.cjs +0 -104
- package/components/observe-slot-text-CjnkkBPn.js +0 -105
- package/components/overlay-CN8ISP1F.js +0 -2485
- package/components/overlay-LViy9VWM.cjs +0 -2484
- package/components/pending-state-e4RbXe9u.cjs +0 -75
- package/components/picker-DNde3awt.cjs +0 -672
- package/components/picker-PfUAF05y.js +0 -673
- package/components/platform-CxDar3Dn.cjs +0 -68
- package/components/platform-Cxn0WbyT.js +0 -69
- package/components/popover-BkbYhl3i.js +0 -74
- package/components/popover-BkgUf0kL.cjs +0 -74
- package/components/progress-circle-Hu_ivPHf.js +0 -133
- package/components/progress-circle-_Etqsj9f.cjs +0 -132
- package/components/roving-tabindex-AsmAh2In.cjs +0 -95
- package/components/roving-tabindex-DPF9NmrH.js +0 -96
- package/components/sized-mixin-DmkrNdWB.js +0 -80
- package/components/sized-mixin-UaTVa-AE.cjs +0 -79
- package/components/strategies-DlMlaSJR.cjs +0 -317
- package/components/strategies-DlPQoTFE.js +0 -318
- package/components/streaming-listener-D4sHaMub.cjs +0 -145
- package/components/streaming-listener-cAz5zJyk.js +0 -146
- package/components/text-field-11tcnftU.cjs +0 -338
- package/components/text-field-Chi9J2Cz.js +0 -339
- package/components/text-field.module-CMBS0jSL.js +0 -21
- package/components/text-field.module-DIJdV_sA.cjs +0 -20
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
/*! * Lucero - The design system for Luzmo.
|
|
2
|
-
*
|
|
3
|
-
* Copyright © 2025 Luzmo
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
|
|
6
|
-
* This license allows users with a current active Luzmo account to use Lucero.
|
|
7
|
-
* This license terminates automatically if a user no longer has an active Luzmo account.
|
|
8
|
-
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
|
9
|
-
*
|
|
10
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
12
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
13
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
14
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
|
-
* SOFTWARE.
|
|
17
|
-
* */
|
|
18
|
-
"use strict";
|
|
19
|
-
const lit = require("lit");
|
|
20
|
-
const decorators_js = require("lit/decorators.js");
|
|
21
|
-
const base = require("./base-COw9n7UR.cjs");
|
|
22
|
-
const conditionAttributeWithId = require("./condition-attribute-with-id-DEc2Yjne.cjs");
|
|
23
|
-
const randomId = require("./random-id-BE6HA503.cjs");
|
|
24
|
-
const elementResolution = require("./element-resolution-DCsrhGZO.cjs");
|
|
25
|
-
const sizedMixin = require("./sized-mixin-UaTVa-AE.cjs");
|
|
26
|
-
const styles = ":host{box-sizing:border-box;min-block-size:var(--luzmo-field-label-min-height, var(--field-label-min-height));padding-block:var(--luzmo-field-label-padding-block, var(--luzmo-field-label-top-to-text, var(--field-label-top-to-text)) var(--luzmo-field-label-bottom-to-text, var(--field-label-bottom-to-text)));padding-inline:0;padding-inline:var(--luzmo-field-label-padding-inline, 0);margin-block:0;margin-block:var(--luzmo-field-label-margin-block, var(--luzmo-field-label-margin-block-start, 0) var(--luzmo-field-label-margin-block-end, 0));margin-inline:0;margin-inline:var(--luzmo-field-label-margin-inline, var(--luzmo-field-label-margin-inline-start, 0) var(--luzmo-field-label-margin-inline-end, 0));font-size:var(--luzmo-field-label-font-size, var(--field-label-font-size));font-weight:var(--luzmo-field-label-font-weight, var(--field-label-font-weight));line-height:var(--luzmo-field-label-line-height, var(--field-label-line-height));-webkit-font-smoothing:subpixel-antialiased;-moz-osx-font-smoothing:auto;color:var(--luzmo-field-label-color, var(--field-label-color));display:block;font-family:var(--luzmo-field-label-font-family, var(--luzmo-font-family))}:host(:lang(ja)),:host(:lang(ko)),:host(:lang(zh)){--luzmo-field-label-line-height: var( --luzmo-field-label-line-height-cjk, var(--field-label-line-height-cjk) )}:host([disabled]),:host([disabled]) .required-icon{--luzmo-field-label-color: var( --highcontrast-field-label-disabled-content-color, var( --luzmo-disabled-content-color, var(--field-label-disabled-content-color) ) )}.required-icon{display:inline-block;margin-block:0;margin-inline:var(--luzmo-field-label-text-to-asterisk, var(--field-label-text-to-asterisk)) 0;vertical-align:initial;vertical-align:var(--luzmo-field-label-asterisk-vertical-align, baseline)}:host([side-aligned=start]),:host([side-aligned=end]){vertical-align:top;margin-block-start:0;margin-block-end:0;margin-inline-end:var(--luzmo-field-label-side-padding-right, var(--field-label-side-padding-right));display:inline-flex;align-items:center;font-size:var(--luzmo-field-label-side-aligned-font-size, var(--field-label-side-aligned-font-size));block-size:var(--luzmo-field-label-side-aligned-height, var(--field-label-side-aligned-height))}:host([side-aligned=end]){text-align:end}@media (forced-colors: active){:host{--highcontrast-field-label-disabled-content-color: GrayText}}:host{--field-label-color: var(--luzmo-font-color);--field-label-font-weight: var(--luzmo-font-weight);--field-label-line-height: var(--luzmo-line-height);--field-label-line-height-cjk: 1.5;--field-label-disabled-content-color: var(--luzmo-font-color-disabled)}:host{--field-label-min-height: var(--luzmo-component-height-xs);--field-label-side-aligned-height: var(--luzmo-component-height);--field-label-top-to-text: calc(var(--luzmo-spacing-2));--field-label-bottom-to-text: var(--luzmo-spacing-2);--field-label-side-aligned-font-size: var(--luzmo-font-size);--field-label-font-size: var(--luzmo-font-size-s);--field-label-side-padding-right: var(--luzmo-spacing-4);--field-label-text-to-asterisk: 0px}:host([size=s]){--field-label-min-height: var(--luzmo-component-height-xxs);--field-label-side-aligned-height: var(--luzmo-component-height-s);--field-label-top-to-text: calc(var(--luzmo-spacing-1));--field-label-bottom-to-text: var(--luzmo-spacing-1);--field-label-side-aligned-font-size: var(--luzmo-font-size-s);--field-label-font-size: var(--luzmo-font-size-xs);--field-label-side-padding-right: var(--luzmo-spacing-3);--field-label-text-to-asterisk: 0px}:host([size=l]){--field-label-min-height: var(--luzmo-component-height-xs);--field-label-side-aligned-height: var(--luzmo-component-height-l);--field-label-top-to-text: var(--luzmo-spacing-3);--field-label-bottom-to-text: calc( var(--luzmo-spacing-2) + var(--luzmo-spacing-1) );--field-label-side-aligned-font-size: var(--luzmo-font-size-l);--field-label-font-size: var(--luzmo-font-size);--field-label-side-padding-right: var(--luzmo-spacing-4);--field-label-text-to-asterisk: var(--luzmo-spacing-1)}:host([size=xl]){--field-label-min-height: var(--luzmo-component-height-s);--field-label-side-aligned-height: var(--luzmo-component-height-xl);--field-label-top-to-text: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--field-label-bottom-to-text: var(--luzmo-spacing-3);--field-label-side-aligned-font-size: var(--luzmo-font-size-xl);--field-label-font-size: var(--luzmo-font-size-l);--field-label-side-padding-right: var(--luzmo-spacing-4);--field-label-text-to-asterisk: var(--luzmo-spacing-1)}label{display:inline-block}";
|
|
27
|
-
var __defProp = Object.defineProperty;
|
|
28
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
29
|
-
var result = void 0;
|
|
30
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
31
|
-
if (decorator = decorators[i])
|
|
32
|
-
result = decorator(target, key, result) || result;
|
|
33
|
-
if (result) __defProp(target, key, result);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
|
-
const astrickIcon = () => lit.html`
|
|
37
|
-
<div class="icon-container required-icon">*</div>
|
|
38
|
-
`;
|
|
39
|
-
class LuzmoFieldLabel extends sizedMixin.SizedMixin(base.LuzmoElement, {
|
|
40
|
-
noDefaultSize: true
|
|
41
|
-
}) {
|
|
42
|
-
constructor() {
|
|
43
|
-
super(...arguments);
|
|
44
|
-
this.disabled = false;
|
|
45
|
-
this.id = "";
|
|
46
|
-
this.for = "";
|
|
47
|
-
this.required = false;
|
|
48
|
-
this.resolvedElement = new elementResolution.ElementResolutionController(this);
|
|
49
|
-
}
|
|
50
|
-
static get styles() {
|
|
51
|
-
return [lit.unsafeCSS(styles)];
|
|
52
|
-
}
|
|
53
|
-
handleClick(event) {
|
|
54
|
-
if (!this.target || this.disabled || event.defaultPrevented) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
this.target.focus();
|
|
58
|
-
const parent = this.getRootNode();
|
|
59
|
-
const target = this.target;
|
|
60
|
-
const targetParent = target.getRootNode();
|
|
61
|
-
const targetHost = targetParent.host;
|
|
62
|
-
if (targetParent === parent && target.forceFocusVisible) {
|
|
63
|
-
target.forceFocusVisible();
|
|
64
|
-
} else if (targetHost && targetHost.forceFocusVisible) {
|
|
65
|
-
targetHost.forceFocusVisible();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
applyTargetLabel(target) {
|
|
69
|
-
this.target = target || this.target;
|
|
70
|
-
if (this.target) {
|
|
71
|
-
const applyLabel = this.target.applyFocusElementLabel;
|
|
72
|
-
const focusable = this.target.focusElement || this.target;
|
|
73
|
-
const targetParent = focusable.getRootNode();
|
|
74
|
-
if (applyLabel !== void 0) {
|
|
75
|
-
applyLabel(this.labelText, this);
|
|
76
|
-
} else if (targetParent === this.getRootNode()) {
|
|
77
|
-
const conditionAttribute = target ? conditionAttributeWithId.conditionAttributeWithId : conditionAttributeWithId.conditionAttributeWithoutId;
|
|
78
|
-
conditionAttribute(focusable, "aria-labelledby", [this.id]);
|
|
79
|
-
} else {
|
|
80
|
-
if (target) {
|
|
81
|
-
focusable.setAttribute("aria-label", this.labelText);
|
|
82
|
-
} else {
|
|
83
|
-
focusable.removeAttribute("aria-label");
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
async manageTarget() {
|
|
89
|
-
this.applyTargetLabel();
|
|
90
|
-
const target = this.resolvedElement.element;
|
|
91
|
-
if (!target) {
|
|
92
|
-
this.target = target;
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
if (target.localName.search("-") > 0) {
|
|
96
|
-
await customElements.whenDefined(target.localName);
|
|
97
|
-
}
|
|
98
|
-
if (target.updateComplete !== void 0) {
|
|
99
|
-
await target.updateComplete;
|
|
100
|
-
}
|
|
101
|
-
this.applyTargetLabel(target);
|
|
102
|
-
}
|
|
103
|
-
get labelText() {
|
|
104
|
-
const assignedNodes = this.slotEl.assignedNodes({ flatten: true });
|
|
105
|
-
if (assignedNodes.length === 0) {
|
|
106
|
-
return "";
|
|
107
|
-
}
|
|
108
|
-
const labelText = assignedNodes.map(
|
|
109
|
-
(node) => (node.textContent || /* c8 ignore next */
|
|
110
|
-
"").trim()
|
|
111
|
-
);
|
|
112
|
-
return labelText.join(" ");
|
|
113
|
-
}
|
|
114
|
-
render() {
|
|
115
|
-
return lit.html`
|
|
116
|
-
<label>
|
|
117
|
-
<slot></slot>
|
|
118
|
-
${this.required ? lit.html` ${astrickIcon()} ` : lit.nothing}
|
|
119
|
-
</label>
|
|
120
|
-
`;
|
|
121
|
-
}
|
|
122
|
-
firstUpdated(changes) {
|
|
123
|
-
super.firstUpdated(changes);
|
|
124
|
-
this.addEventListener("click", this.handleClick);
|
|
125
|
-
}
|
|
126
|
-
willUpdate(changes) {
|
|
127
|
-
if (!this.hasAttribute("id")) {
|
|
128
|
-
this.setAttribute("id", `${this.tagName.toLowerCase()}-${randomId.randomID()}`);
|
|
129
|
-
}
|
|
130
|
-
if (changes.has("for")) {
|
|
131
|
-
this.resolvedElement.selector = this.for ? `#${this.for}` : "";
|
|
132
|
-
}
|
|
133
|
-
if (changes.has("id") || changes.has(elementResolution.elementResolverUpdatedSymbol)) {
|
|
134
|
-
this.manageTarget();
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
__decorateClass([
|
|
139
|
-
decorators_js.property({ type: Boolean, reflect: true })
|
|
140
|
-
], LuzmoFieldLabel.prototype, "disabled");
|
|
141
|
-
__decorateClass([
|
|
142
|
-
decorators_js.property({ type: String })
|
|
143
|
-
], LuzmoFieldLabel.prototype, "id");
|
|
144
|
-
__decorateClass([
|
|
145
|
-
decorators_js.property({ type: String })
|
|
146
|
-
], LuzmoFieldLabel.prototype, "for");
|
|
147
|
-
__decorateClass([
|
|
148
|
-
decorators_js.property({ type: Boolean, reflect: true })
|
|
149
|
-
], LuzmoFieldLabel.prototype, "required");
|
|
150
|
-
__decorateClass([
|
|
151
|
-
decorators_js.query("slot")
|
|
152
|
-
], LuzmoFieldLabel.prototype, "slotEl");
|
|
153
|
-
__decorateClass([
|
|
154
|
-
decorators_js.property({ type: String, reflect: true, attribute: "side-aligned" })
|
|
155
|
-
], LuzmoFieldLabel.prototype, "sideAligned");
|
|
156
|
-
exports.LuzmoFieldLabel = LuzmoFieldLabel;
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
/*! * Lucero - The design system for Luzmo.
|
|
2
|
-
*
|
|
3
|
-
* Copyright © 2025 Luzmo
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
|
|
6
|
-
* This license allows users with a current active Luzmo account to use Lucero.
|
|
7
|
-
* This license terminates automatically if a user no longer has an active Luzmo account.
|
|
8
|
-
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
|
9
|
-
*
|
|
10
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
12
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
13
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
14
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
|
-
* SOFTWARE.
|
|
17
|
-
* */
|
|
18
|
-
import { unsafeCSS, nothing, html } from "lit";
|
|
19
|
-
import { property, query } from "lit/decorators.js";
|
|
20
|
-
import { a as LuzmoElement } from "./base-DmeVy0cq.js";
|
|
21
|
-
import { c as conditionAttributeWithId, a as conditionAttributeWithoutId } from "./condition-attribute-with-id-Cn815e9W.js";
|
|
22
|
-
import { r as randomID } from "./random-id-BEc6QIUL.js";
|
|
23
|
-
import { E as ElementResolutionController, e as elementResolverUpdatedSymbol } from "./element-resolution-nMlmW4Jy.js";
|
|
24
|
-
import { S as SizedMixin } from "./sized-mixin-DmkrNdWB.js";
|
|
25
|
-
const styles = ":host{box-sizing:border-box;min-block-size:var(--luzmo-field-label-min-height, var(--field-label-min-height));padding-block:var(--luzmo-field-label-padding-block, var(--luzmo-field-label-top-to-text, var(--field-label-top-to-text)) var(--luzmo-field-label-bottom-to-text, var(--field-label-bottom-to-text)));padding-inline:0;padding-inline:var(--luzmo-field-label-padding-inline, 0);margin-block:0;margin-block:var(--luzmo-field-label-margin-block, var(--luzmo-field-label-margin-block-start, 0) var(--luzmo-field-label-margin-block-end, 0));margin-inline:0;margin-inline:var(--luzmo-field-label-margin-inline, var(--luzmo-field-label-margin-inline-start, 0) var(--luzmo-field-label-margin-inline-end, 0));font-size:var(--luzmo-field-label-font-size, var(--field-label-font-size));font-weight:var(--luzmo-field-label-font-weight, var(--field-label-font-weight));line-height:var(--luzmo-field-label-line-height, var(--field-label-line-height));-webkit-font-smoothing:subpixel-antialiased;-moz-osx-font-smoothing:auto;color:var(--luzmo-field-label-color, var(--field-label-color));display:block;font-family:var(--luzmo-field-label-font-family, var(--luzmo-font-family))}:host(:lang(ja)),:host(:lang(ko)),:host(:lang(zh)){--luzmo-field-label-line-height: var( --luzmo-field-label-line-height-cjk, var(--field-label-line-height-cjk) )}:host([disabled]),:host([disabled]) .required-icon{--luzmo-field-label-color: var( --highcontrast-field-label-disabled-content-color, var( --luzmo-disabled-content-color, var(--field-label-disabled-content-color) ) )}.required-icon{display:inline-block;margin-block:0;margin-inline:var(--luzmo-field-label-text-to-asterisk, var(--field-label-text-to-asterisk)) 0;vertical-align:initial;vertical-align:var(--luzmo-field-label-asterisk-vertical-align, baseline)}:host([side-aligned=start]),:host([side-aligned=end]){vertical-align:top;margin-block-start:0;margin-block-end:0;margin-inline-end:var(--luzmo-field-label-side-padding-right, var(--field-label-side-padding-right));display:inline-flex;align-items:center;font-size:var(--luzmo-field-label-side-aligned-font-size, var(--field-label-side-aligned-font-size));block-size:var(--luzmo-field-label-side-aligned-height, var(--field-label-side-aligned-height))}:host([side-aligned=end]){text-align:end}@media (forced-colors: active){:host{--highcontrast-field-label-disabled-content-color: GrayText}}:host{--field-label-color: var(--luzmo-font-color);--field-label-font-weight: var(--luzmo-font-weight);--field-label-line-height: var(--luzmo-line-height);--field-label-line-height-cjk: 1.5;--field-label-disabled-content-color: var(--luzmo-font-color-disabled)}:host{--field-label-min-height: var(--luzmo-component-height-xs);--field-label-side-aligned-height: var(--luzmo-component-height);--field-label-top-to-text: calc(var(--luzmo-spacing-2));--field-label-bottom-to-text: var(--luzmo-spacing-2);--field-label-side-aligned-font-size: var(--luzmo-font-size);--field-label-font-size: var(--luzmo-font-size-s);--field-label-side-padding-right: var(--luzmo-spacing-4);--field-label-text-to-asterisk: 0px}:host([size=s]){--field-label-min-height: var(--luzmo-component-height-xxs);--field-label-side-aligned-height: var(--luzmo-component-height-s);--field-label-top-to-text: calc(var(--luzmo-spacing-1));--field-label-bottom-to-text: var(--luzmo-spacing-1);--field-label-side-aligned-font-size: var(--luzmo-font-size-s);--field-label-font-size: var(--luzmo-font-size-xs);--field-label-side-padding-right: var(--luzmo-spacing-3);--field-label-text-to-asterisk: 0px}:host([size=l]){--field-label-min-height: var(--luzmo-component-height-xs);--field-label-side-aligned-height: var(--luzmo-component-height-l);--field-label-top-to-text: var(--luzmo-spacing-3);--field-label-bottom-to-text: calc( var(--luzmo-spacing-2) + var(--luzmo-spacing-1) );--field-label-side-aligned-font-size: var(--luzmo-font-size-l);--field-label-font-size: var(--luzmo-font-size);--field-label-side-padding-right: var(--luzmo-spacing-4);--field-label-text-to-asterisk: var(--luzmo-spacing-1)}:host([size=xl]){--field-label-min-height: var(--luzmo-component-height-s);--field-label-side-aligned-height: var(--luzmo-component-height-xl);--field-label-top-to-text: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--field-label-bottom-to-text: var(--luzmo-spacing-3);--field-label-side-aligned-font-size: var(--luzmo-font-size-xl);--field-label-font-size: var(--luzmo-font-size-l);--field-label-side-padding-right: var(--luzmo-spacing-4);--field-label-text-to-asterisk: var(--luzmo-spacing-1)}label{display:inline-block}";
|
|
26
|
-
var __defProp = Object.defineProperty;
|
|
27
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
28
|
-
var result = void 0;
|
|
29
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
30
|
-
if (decorator = decorators[i])
|
|
31
|
-
result = decorator(target, key, result) || result;
|
|
32
|
-
if (result) __defProp(target, key, result);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
const astrickIcon = () => html`
|
|
36
|
-
<div class="icon-container required-icon">*</div>
|
|
37
|
-
`;
|
|
38
|
-
class LuzmoFieldLabel extends SizedMixin(LuzmoElement, {
|
|
39
|
-
noDefaultSize: true
|
|
40
|
-
}) {
|
|
41
|
-
constructor() {
|
|
42
|
-
super(...arguments);
|
|
43
|
-
this.disabled = false;
|
|
44
|
-
this.id = "";
|
|
45
|
-
this.for = "";
|
|
46
|
-
this.required = false;
|
|
47
|
-
this.resolvedElement = new ElementResolutionController(this);
|
|
48
|
-
}
|
|
49
|
-
static get styles() {
|
|
50
|
-
return [unsafeCSS(styles)];
|
|
51
|
-
}
|
|
52
|
-
handleClick(event) {
|
|
53
|
-
if (!this.target || this.disabled || event.defaultPrevented) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
this.target.focus();
|
|
57
|
-
const parent = this.getRootNode();
|
|
58
|
-
const target = this.target;
|
|
59
|
-
const targetParent = target.getRootNode();
|
|
60
|
-
const targetHost = targetParent.host;
|
|
61
|
-
if (targetParent === parent && target.forceFocusVisible) {
|
|
62
|
-
target.forceFocusVisible();
|
|
63
|
-
} else if (targetHost && targetHost.forceFocusVisible) {
|
|
64
|
-
targetHost.forceFocusVisible();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
applyTargetLabel(target) {
|
|
68
|
-
this.target = target || this.target;
|
|
69
|
-
if (this.target) {
|
|
70
|
-
const applyLabel = this.target.applyFocusElementLabel;
|
|
71
|
-
const focusable = this.target.focusElement || this.target;
|
|
72
|
-
const targetParent = focusable.getRootNode();
|
|
73
|
-
if (applyLabel !== void 0) {
|
|
74
|
-
applyLabel(this.labelText, this);
|
|
75
|
-
} else if (targetParent === this.getRootNode()) {
|
|
76
|
-
const conditionAttribute = target ? conditionAttributeWithId : conditionAttributeWithoutId;
|
|
77
|
-
conditionAttribute(focusable, "aria-labelledby", [this.id]);
|
|
78
|
-
} else {
|
|
79
|
-
if (target) {
|
|
80
|
-
focusable.setAttribute("aria-label", this.labelText);
|
|
81
|
-
} else {
|
|
82
|
-
focusable.removeAttribute("aria-label");
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
async manageTarget() {
|
|
88
|
-
this.applyTargetLabel();
|
|
89
|
-
const target = this.resolvedElement.element;
|
|
90
|
-
if (!target) {
|
|
91
|
-
this.target = target;
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if (target.localName.search("-") > 0) {
|
|
95
|
-
await customElements.whenDefined(target.localName);
|
|
96
|
-
}
|
|
97
|
-
if (target.updateComplete !== void 0) {
|
|
98
|
-
await target.updateComplete;
|
|
99
|
-
}
|
|
100
|
-
this.applyTargetLabel(target);
|
|
101
|
-
}
|
|
102
|
-
get labelText() {
|
|
103
|
-
const assignedNodes = this.slotEl.assignedNodes({ flatten: true });
|
|
104
|
-
if (assignedNodes.length === 0) {
|
|
105
|
-
return "";
|
|
106
|
-
}
|
|
107
|
-
const labelText = assignedNodes.map(
|
|
108
|
-
(node) => (node.textContent || /* c8 ignore next */
|
|
109
|
-
"").trim()
|
|
110
|
-
);
|
|
111
|
-
return labelText.join(" ");
|
|
112
|
-
}
|
|
113
|
-
render() {
|
|
114
|
-
return html`
|
|
115
|
-
<label>
|
|
116
|
-
<slot></slot>
|
|
117
|
-
${this.required ? html` ${astrickIcon()} ` : nothing}
|
|
118
|
-
</label>
|
|
119
|
-
`;
|
|
120
|
-
}
|
|
121
|
-
firstUpdated(changes) {
|
|
122
|
-
super.firstUpdated(changes);
|
|
123
|
-
this.addEventListener("click", this.handleClick);
|
|
124
|
-
}
|
|
125
|
-
willUpdate(changes) {
|
|
126
|
-
if (!this.hasAttribute("id")) {
|
|
127
|
-
this.setAttribute("id", `${this.tagName.toLowerCase()}-${randomID()}`);
|
|
128
|
-
}
|
|
129
|
-
if (changes.has("for")) {
|
|
130
|
-
this.resolvedElement.selector = this.for ? `#${this.for}` : "";
|
|
131
|
-
}
|
|
132
|
-
if (changes.has("id") || changes.has(elementResolverUpdatedSymbol)) {
|
|
133
|
-
this.manageTarget();
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
__decorateClass([
|
|
138
|
-
property({ type: Boolean, reflect: true })
|
|
139
|
-
], LuzmoFieldLabel.prototype, "disabled");
|
|
140
|
-
__decorateClass([
|
|
141
|
-
property({ type: String })
|
|
142
|
-
], LuzmoFieldLabel.prototype, "id");
|
|
143
|
-
__decorateClass([
|
|
144
|
-
property({ type: String })
|
|
145
|
-
], LuzmoFieldLabel.prototype, "for");
|
|
146
|
-
__decorateClass([
|
|
147
|
-
property({ type: Boolean, reflect: true })
|
|
148
|
-
], LuzmoFieldLabel.prototype, "required");
|
|
149
|
-
__decorateClass([
|
|
150
|
-
query("slot")
|
|
151
|
-
], LuzmoFieldLabel.prototype, "slotEl");
|
|
152
|
-
__decorateClass([
|
|
153
|
-
property({ type: String, reflect: true, attribute: "side-aligned" })
|
|
154
|
-
], LuzmoFieldLabel.prototype, "sideAligned");
|
|
155
|
-
export {
|
|
156
|
-
LuzmoFieldLabel as L
|
|
157
|
-
};
|
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
/*! * Lucero - The design system for Luzmo.
|
|
2
|
-
*
|
|
3
|
-
* Copyright © 2025 Luzmo
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
|
|
6
|
-
* This license allows users with a current active Luzmo account to use Lucero.
|
|
7
|
-
* This license terminates automatically if a user no longer has an active Luzmo account.
|
|
8
|
-
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
|
9
|
-
*
|
|
10
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
12
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
13
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
14
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
|
-
* SOFTWARE.
|
|
17
|
-
* */
|
|
18
|
-
function ensureMethod(value, type, fallback) {
|
|
19
|
-
if (typeof value === type) {
|
|
20
|
-
return () => value;
|
|
21
|
-
} else if (typeof value === "function") {
|
|
22
|
-
return value;
|
|
23
|
-
}
|
|
24
|
-
return fallback;
|
|
25
|
-
}
|
|
26
|
-
class FocusGroupController {
|
|
27
|
-
constructor(host, {
|
|
28
|
-
direction,
|
|
29
|
-
elementEnterAction,
|
|
30
|
-
elements,
|
|
31
|
-
focusInIndex,
|
|
32
|
-
isFocusableElement,
|
|
33
|
-
listenerScope
|
|
34
|
-
} = { elements: () => [] }) {
|
|
35
|
-
this._currentIndex = -1;
|
|
36
|
-
this.prevIndex = -1;
|
|
37
|
-
this._direction = () => "both";
|
|
38
|
-
this.directionLength = 5;
|
|
39
|
-
this.elementEnterAction = (_el) => {
|
|
40
|
-
};
|
|
41
|
-
this._focused = false;
|
|
42
|
-
this._focusInIndex = (_elements) => 0;
|
|
43
|
-
this.isFocusableElement = (_el) => true;
|
|
44
|
-
this._listenerScope = () => this.host;
|
|
45
|
-
this.offset = 0;
|
|
46
|
-
this.recentlyConnected = false;
|
|
47
|
-
this.handleFocusin = (event) => {
|
|
48
|
-
if (!this.isEventWithinListenerScope(event)) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const path = event.composedPath();
|
|
52
|
-
let targetIndex = -1;
|
|
53
|
-
path.find((el) => {
|
|
54
|
-
targetIndex = this.elements.indexOf(el);
|
|
55
|
-
return targetIndex !== -1;
|
|
56
|
-
});
|
|
57
|
-
this.prevIndex = this.currentIndex;
|
|
58
|
-
this.currentIndex = targetIndex > -1 ? targetIndex : this.currentIndex;
|
|
59
|
-
if (this.isRelatedTargetOrContainAnElement(event)) {
|
|
60
|
-
this.hostContainsFocus();
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
this.handleClick = () => {
|
|
64
|
-
var _a;
|
|
65
|
-
const elements2 = this.elements;
|
|
66
|
-
if (elements2.length === 0) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
let focusElement = elements2[this.currentIndex];
|
|
70
|
-
if (this.currentIndex < 0) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
if (!focusElement || !this.isFocusableElement(focusElement)) {
|
|
74
|
-
this.setCurrentIndexCircularly(1);
|
|
75
|
-
focusElement = elements2[this.currentIndex];
|
|
76
|
-
}
|
|
77
|
-
if (focusElement && this.isFocusableElement(focusElement)) {
|
|
78
|
-
(_a = elements2[this.prevIndex]) == null ? void 0 : _a.setAttribute("tabindex", "-1");
|
|
79
|
-
focusElement.setAttribute("tabindex", "0");
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
this.handleFocusout = (event) => {
|
|
83
|
-
if (this.isRelatedTargetOrContainAnElement(event)) {
|
|
84
|
-
this.hostNoLongerContainsFocus();
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
this.handleKeydown = (event) => {
|
|
88
|
-
if (!this.acceptsEventCode(event.code) || event.defaultPrevented) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
let diff = 0;
|
|
92
|
-
this.prevIndex = this.currentIndex;
|
|
93
|
-
switch (event.code) {
|
|
94
|
-
case "ArrowRight": {
|
|
95
|
-
diff += 1;
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
case "ArrowDown": {
|
|
99
|
-
diff += this.direction === "grid" ? this.directionLength : 1;
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
case "ArrowLeft": {
|
|
103
|
-
diff -= 1;
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
case "ArrowUp": {
|
|
107
|
-
diff -= this.direction === "grid" ? this.directionLength : 1;
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
case "End": {
|
|
111
|
-
this.currentIndex = 0;
|
|
112
|
-
diff -= 1;
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
case "Home": {
|
|
116
|
-
this.currentIndex = this.elements.length - 1;
|
|
117
|
-
diff += 1;
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
event.preventDefault();
|
|
122
|
-
if (this.direction === "grid" && this.currentIndex + diff < 0) {
|
|
123
|
-
this.currentIndex = 0;
|
|
124
|
-
} else if (this.direction === "grid" && this.currentIndex + diff > this.elements.length - 1) {
|
|
125
|
-
this.currentIndex = this.elements.length - 1;
|
|
126
|
-
} else {
|
|
127
|
-
this.setCurrentIndexCircularly(diff);
|
|
128
|
-
}
|
|
129
|
-
this.elementEnterAction(this.elements[this.currentIndex]);
|
|
130
|
-
this.focus();
|
|
131
|
-
};
|
|
132
|
-
this.mutationObserver = new MutationObserver(() => {
|
|
133
|
-
this.handleItemMutation();
|
|
134
|
-
});
|
|
135
|
-
this.host = host;
|
|
136
|
-
this.host.addController(this);
|
|
137
|
-
this._elements = elements;
|
|
138
|
-
this.isFocusableElement = isFocusableElement || this.isFocusableElement;
|
|
139
|
-
this._direction = ensureMethod(
|
|
140
|
-
direction,
|
|
141
|
-
"string",
|
|
142
|
-
this._direction
|
|
143
|
-
);
|
|
144
|
-
this.elementEnterAction = elementEnterAction || this.elementEnterAction;
|
|
145
|
-
this._focusInIndex = ensureMethod(
|
|
146
|
-
focusInIndex,
|
|
147
|
-
"number",
|
|
148
|
-
this._focusInIndex
|
|
149
|
-
);
|
|
150
|
-
this._listenerScope = ensureMethod(
|
|
151
|
-
listenerScope,
|
|
152
|
-
"object",
|
|
153
|
-
this._listenerScope
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
get currentIndex() {
|
|
157
|
-
if (this._currentIndex === -1) {
|
|
158
|
-
this._currentIndex = this.focusInIndex;
|
|
159
|
-
}
|
|
160
|
-
return this._currentIndex - this.offset;
|
|
161
|
-
}
|
|
162
|
-
set currentIndex(currentIndex) {
|
|
163
|
-
this._currentIndex = currentIndex + this.offset;
|
|
164
|
-
}
|
|
165
|
-
get direction() {
|
|
166
|
-
return this._direction();
|
|
167
|
-
}
|
|
168
|
-
get elements() {
|
|
169
|
-
if (!this.cachedElements) {
|
|
170
|
-
this.cachedElements = this._elements();
|
|
171
|
-
}
|
|
172
|
-
return this.cachedElements;
|
|
173
|
-
}
|
|
174
|
-
set focused(focused) {
|
|
175
|
-
if (focused === this.focused) {
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
this._focused = focused;
|
|
179
|
-
}
|
|
180
|
-
get focused() {
|
|
181
|
-
return this._focused;
|
|
182
|
-
}
|
|
183
|
-
get focusInElement() {
|
|
184
|
-
return this.elements[this.focusInIndex];
|
|
185
|
-
}
|
|
186
|
-
get focusInIndex() {
|
|
187
|
-
return this._focusInIndex(this.elements);
|
|
188
|
-
}
|
|
189
|
-
isEventWithinListenerScope(event) {
|
|
190
|
-
if (this._listenerScope() === this.host) {
|
|
191
|
-
return true;
|
|
192
|
-
}
|
|
193
|
-
return event.composedPath().includes(this._listenerScope());
|
|
194
|
-
}
|
|
195
|
-
/* In handleItemMutation() method the first if condition is checking if the element is not focused or if the element's children's length is not decreasing then it means no element has been deleted and we must return.
|
|
196
|
-
Then we are checking if the deleted element was the focused one before the deletion if so then we need to proceed else we casn return;
|
|
197
|
-
*/
|
|
198
|
-
handleItemMutation() {
|
|
199
|
-
if (this._currentIndex === -1 || this.elements.length <= this._elements().length) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
const focusedElement = this.elements[this.currentIndex];
|
|
203
|
-
this.clearElementCache();
|
|
204
|
-
if (this.elements.includes(focusedElement)) {
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
const moveToNextElement = this.currentIndex !== this.elements.length;
|
|
208
|
-
const diff = moveToNextElement ? 1 : -1;
|
|
209
|
-
if (moveToNextElement) {
|
|
210
|
-
this.setCurrentIndexCircularly(-1);
|
|
211
|
-
}
|
|
212
|
-
this.setCurrentIndexCircularly(diff);
|
|
213
|
-
this.focus();
|
|
214
|
-
}
|
|
215
|
-
update({ elements } = { elements: () => [] }) {
|
|
216
|
-
this.unmanage();
|
|
217
|
-
this._elements = elements;
|
|
218
|
-
this.clearElementCache();
|
|
219
|
-
this.manage();
|
|
220
|
-
}
|
|
221
|
-
focus(options) {
|
|
222
|
-
var _a;
|
|
223
|
-
const elements = this.elements;
|
|
224
|
-
if (elements.length === 0) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
let focusElement = elements[this.currentIndex];
|
|
228
|
-
if (!focusElement || !this.isFocusableElement(focusElement)) {
|
|
229
|
-
this.setCurrentIndexCircularly(1);
|
|
230
|
-
focusElement = elements[this.currentIndex];
|
|
231
|
-
}
|
|
232
|
-
if (focusElement && this.isFocusableElement(focusElement)) {
|
|
233
|
-
(_a = elements[this.prevIndex]) == null ? void 0 : _a.setAttribute("tabindex", "-1");
|
|
234
|
-
focusElement.tabIndex = 0;
|
|
235
|
-
focusElement.focus(options);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
clearElementCache(offset = 0) {
|
|
239
|
-
this.mutationObserver.disconnect();
|
|
240
|
-
delete this.cachedElements;
|
|
241
|
-
this.offset = offset;
|
|
242
|
-
requestAnimationFrame(() => {
|
|
243
|
-
this.elements.forEach((element) => {
|
|
244
|
-
this.mutationObserver.observe(element, {
|
|
245
|
-
attributes: true
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
setCurrentIndexCircularly(diff) {
|
|
251
|
-
const { length } = this.elements;
|
|
252
|
-
let steps = length;
|
|
253
|
-
this.prevIndex = this.currentIndex;
|
|
254
|
-
let nextIndex = (length + this.currentIndex + diff) % length;
|
|
255
|
-
while (
|
|
256
|
-
// don't cycle the elements more than once
|
|
257
|
-
steps && this.elements[nextIndex] && !this.isFocusableElement(this.elements[nextIndex])
|
|
258
|
-
) {
|
|
259
|
-
nextIndex = (length + nextIndex + diff) % length;
|
|
260
|
-
steps -= 1;
|
|
261
|
-
}
|
|
262
|
-
this.currentIndex = nextIndex;
|
|
263
|
-
}
|
|
264
|
-
hostContainsFocus() {
|
|
265
|
-
this.host.addEventListener("focusout", this.handleFocusout);
|
|
266
|
-
this.host.addEventListener("keydown", this.handleKeydown);
|
|
267
|
-
this.focused = true;
|
|
268
|
-
}
|
|
269
|
-
hostNoLongerContainsFocus() {
|
|
270
|
-
this.host.addEventListener("focusin", this.handleFocusin);
|
|
271
|
-
this.host.removeEventListener("focusout", this.handleFocusout);
|
|
272
|
-
this.host.removeEventListener("keydown", this.handleKeydown);
|
|
273
|
-
this.focused = false;
|
|
274
|
-
}
|
|
275
|
-
isRelatedTargetOrContainAnElement(event) {
|
|
276
|
-
const relatedTarget = event.relatedTarget;
|
|
277
|
-
const isRelatedTargetAnElement = this.elements.includes(relatedTarget);
|
|
278
|
-
const isRelatedTargetContainedWithinElements = this.elements.some(
|
|
279
|
-
(el) => el.contains(relatedTarget)
|
|
280
|
-
);
|
|
281
|
-
return !(isRelatedTargetAnElement || isRelatedTargetContainedWithinElements);
|
|
282
|
-
}
|
|
283
|
-
acceptsEventCode(code) {
|
|
284
|
-
if (code === "End" || code === "Home") {
|
|
285
|
-
return true;
|
|
286
|
-
}
|
|
287
|
-
switch (this.direction) {
|
|
288
|
-
case "horizontal": {
|
|
289
|
-
return code === "ArrowLeft" || code === "ArrowRight";
|
|
290
|
-
}
|
|
291
|
-
case "vertical": {
|
|
292
|
-
return code === "ArrowUp" || code === "ArrowDown";
|
|
293
|
-
}
|
|
294
|
-
case "both":
|
|
295
|
-
case "grid": {
|
|
296
|
-
return code.startsWith("Arrow");
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
manage() {
|
|
301
|
-
this.addEventListeners();
|
|
302
|
-
}
|
|
303
|
-
unmanage() {
|
|
304
|
-
this.removeEventListeners();
|
|
305
|
-
}
|
|
306
|
-
addEventListeners() {
|
|
307
|
-
this.host.addEventListener("focusin", this.handleFocusin);
|
|
308
|
-
this.host.addEventListener("click", this.handleClick);
|
|
309
|
-
}
|
|
310
|
-
removeEventListeners() {
|
|
311
|
-
this.host.removeEventListener("focusin", this.handleFocusin);
|
|
312
|
-
this.host.removeEventListener("focusout", this.handleFocusout);
|
|
313
|
-
this.host.removeEventListener("keydown", this.handleKeydown);
|
|
314
|
-
this.host.removeEventListener("click", this.handleClick);
|
|
315
|
-
}
|
|
316
|
-
hostConnected() {
|
|
317
|
-
this.recentlyConnected = true;
|
|
318
|
-
this.addEventListeners();
|
|
319
|
-
}
|
|
320
|
-
hostDisconnected() {
|
|
321
|
-
this.mutationObserver.disconnect();
|
|
322
|
-
this.removeEventListeners();
|
|
323
|
-
}
|
|
324
|
-
hostUpdated() {
|
|
325
|
-
if (this.recentlyConnected) {
|
|
326
|
-
this.recentlyConnected = false;
|
|
327
|
-
this.elements.forEach((element) => {
|
|
328
|
-
this.mutationObserver.observe(element, {
|
|
329
|
-
attributes: true
|
|
330
|
-
});
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
export {
|
|
336
|
-
FocusGroupController as F
|
|
337
|
-
};
|