@luzmo/lucero 2.6.0 → 2.7.0
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/action-menu/index.cjs +1 -1
- package/components/action-menu/index.js +1 -1
- package/components/{action-menu-LnXQ7reF.js → action-menu-Bv9EA7__.js} +1 -1
- package/components/{action-menu-BW-XpCVO.cjs → action-menu-DphCCjvX.cjs} +1 -1
- package/components/checkbox/index.cjs +1 -1
- package/components/checkbox/index.js +1 -1
- package/components/{checkbox-CVi4GMoo.cjs → checkbox-NSSgVzJg.cjs} +1 -1
- package/components/{checkbox-CvRvgRzh.js → checkbox-fW7WI915.js} +1 -1
- package/components/color-field/index.cjs +1 -1
- package/components/color-field/index.js +1 -1
- package/components/{color-field-CVyDNZ4b.js → color-field-BZljmVHt.js} +1 -1
- package/components/{color-field-CN8shDl_.cjs → color-field-l-aJ6O4a.cjs} +1 -1
- package/components/color-menu/index.cjs +1 -1
- package/components/color-menu/index.js +1 -1
- package/components/{color-menu-COhe5VUB.cjs → color-menu-C56xj5Oe.cjs} +1 -1
- package/components/{color-menu-Ct3f01bI.js → color-menu-CEtmpeN7.js} +1 -1
- package/components/color-picker/index.cjs +1 -1
- package/components/color-picker/index.js +1 -1
- package/components/{color-picker-DWERcNZi.js → color-picker-BDqJodTR.js} +1 -1
- package/components/{color-picker-ELa0yF2F.cjs → color-picker-CLGNQIkK.cjs} +1 -1
- package/components/index.cjs +1 -1
- package/components/index.js +28 -28
- package/components/menu/index.cjs +1 -1
- package/components/menu/index.js +1 -1
- package/components/{menu-BKwt6rnv.cjs → menu-CoJ5oERs.cjs} +1 -1
- package/components/{menu-L5qYivn6.js → menu-f2S0m6h9.js} +1 -1
- package/components/multi-language-field/index.cjs +1 -1
- package/components/multi-language-field/index.js +1 -1
- package/components/{multi-language-field-NY2XwK2M.js → multi-language-field-SZObnneZ.js} +1 -1
- package/components/{multi-language-field-djoM4Okc.cjs → multi-language-field-nJmWDtPL.cjs} +1 -1
- package/components/number-field/index.cjs +1 -1
- package/components/number-field/index.js +1 -1
- package/components/number-field/number-field.d.ts +35 -0
- package/components/{number-field-Crol6vc9.js → number-field-BEt0cfcB.js} +32 -10
- package/components/{number-field-CV7g2Q20.cjs → number-field-DrarDCm4.cjs} +3 -2
- package/components/options/index.cjs +1 -1
- package/components/options/index.d.ts +1 -1
- package/components/options/index.js +1 -1
- package/components/options/options.d.ts +14 -28
- package/components/options/types.d.ts +42 -0
- package/components/options-BH_Y3UB6.cjs +110 -0
- package/components/{options-BHDesKbF.js → options-BiA2h1-i.js} +94 -74
- package/components/picker/index.cjs +1 -1
- package/components/picker/index.js +1 -1
- package/components/{picker-CQCAt4Mx.cjs → picker-Dd25S3rP.cjs} +1 -1
- package/components/{picker-C5eX5WBl.js → picker-JhsRAtSd.js} +1 -1
- package/components/prompt-box/index.cjs +1 -1
- package/components/prompt-box/index.js +1 -1
- package/components/{prompt-box-D7owyhfG.cjs → prompt-box-B1rmo4DX.cjs} +2 -2
- package/components/{prompt-box-CrtFGmjm.js → prompt-box-CL0ld3Na.js} +2 -2
- package/components/question-box/index.cjs +1 -1
- package/components/question-box/index.js +1 -1
- package/components/{question-box-BJYYLghb.js → question-box-BAyRPZ8j.js} +2 -2
- package/components/{question-box-ym1eakXA.cjs → question-box-D7s2xNAD.cjs} +1 -1
- package/components/search/index.cjs +1 -1
- package/components/search/index.js +1 -1
- package/components/{search-DiCwSHFf.cjs → search-1KUNWKWg.cjs} +1 -1
- package/components/{search-C5uFmm6S.js → search-_NUUJLz0.js} +1 -1
- package/components/select/index.cjs +1 -1
- package/components/select/index.d.ts +1 -0
- package/components/select/index.js +1 -1
- package/components/select/select.d.ts +9 -1
- package/components/{select-HqF3tcHz.js → select-8gtm46qA.js} +82 -76
- package/components/select-ChM3Zfxd.cjs +159 -0
- package/components/slider/index.cjs +1 -1
- package/components/slider/index.js +1 -1
- package/components/{slider-Ce6qgPZ4.cjs → slider-B1cCAj1x.cjs} +1 -1
- package/components/{slider-BFTuAXK1.js → slider-CD-aGN9I.js} +1 -1
- package/components/table/index.cjs +1 -1
- package/components/table/index.js +1 -1
- package/components/{table-CLMLGloR.cjs → table-Bf-00FYb.cjs} +1 -1
- package/components/{table-DlOWqm5C.js → table-CfFwBCp1.js} +1 -1
- package/components/text-field/index.cjs +1 -1
- package/components/text-field/index.js +2 -2
- package/components/{text-field-DpvP_tCP.js → text-field-CBsx1CVo.js} +1 -1
- package/components/{text-field-DCcOZSvY.cjs → text-field-CZixBD87.cjs} +1 -1
- package/components/{text-field-BVl-HWzb.cjs → text-field-DwvDSctG.cjs} +1 -1
- package/components/{text-field-D49lAD7L.js → text-field-SNbvQYOj.js} +1 -1
- package/components/utils.cjs +1 -1
- package/components/utils.js +3 -3
- package/custom-elements.json +1 -1
- package/package.json +2 -2
- package/standalone/accordion.js +2 -2
- package/standalone/action-bar.js +1 -1
- package/standalone/action-button.js +1 -1
- package/standalone/action-menu.js +3 -3
- package/standalone/avatar.js +1 -1
- package/standalone/calendar.js +1 -1
- package/standalone/checkbox.js +1 -1
- package/standalone/chunks/action-button-C946JGIA.js +6 -0
- package/standalone/chunks/button-COqfQNJv.js +2 -0
- package/standalone/chunks/calendar-BVrT8uqP.js +122 -0
- package/standalone/chunks/checkbox-4PoS7Uft.js +9 -0
- package/standalone/chunks/clear-button-qIMg8hR4.js +2 -0
- package/standalone/chunks/close-button-DEiL5kEh.js +2 -0
- package/standalone/chunks/{color-field-BaVvupq0.js → color-field-BKDaLJQo.js} +1 -1
- package/standalone/chunks/color-menu-6LhE-qWn.js +73 -0
- package/standalone/chunks/icon-D69mOw1X.js +2 -0
- package/standalone/chunks/luzmo-icon-markup-DaKoHMY8.js +13 -0
- package/standalone/chunks/luzmoAlert-lLzK3UPQ.js +2 -0
- package/standalone/chunks/luzmoAlertOutline-C7rw3G3h.js +2 -0
- package/standalone/chunks/luzmoAngleDown-PNrItYzK.js +2 -0
- package/standalone/chunks/luzmoAngleLeft-ebJO7ROy.js +2 -0
- package/standalone/chunks/luzmoAngleRight-B-rZQuxv.js +2 -0
- package/standalone/chunks/luzmoAngleUp-BQ2D4OjY.js +2 -0
- package/standalone/chunks/luzmoArrowUp-Bz_z0IO5.js +2 -0
- package/standalone/chunks/luzmoCheckCircleOutline-B8qAhKxa.js +2 -0
- package/standalone/chunks/luzmoCheckHeavy-JAzxJeXk.js +2 -0
- package/standalone/chunks/luzmoClose14-CpeGUk1z.js +2 -0
- package/standalone/chunks/luzmoDash-oXMu8wBK.js +2 -0
- package/standalone/chunks/luzmoInfoCircleOutline-EEKa5x7I.js +2 -0
- package/standalone/chunks/luzmoSearch-WSfXYol0.js +2 -0
- package/standalone/chunks/{menu-CefrRBIS.js → menu-DtUgXalL.js} +4 -4
- package/standalone/chunks/number-field-aOOuxxRh.js +42 -0
- package/standalone/chunks/options-CPaX-OWy.js +94 -0
- package/standalone/chunks/picker-5IvNnimu.js +108 -0
- package/standalone/chunks/picker-button-BIqlIkET.js +21 -0
- package/standalone/chunks/segments-factory-DWNY1AUE.js +2 -0
- package/standalone/chunks/{swatch-DivHeYOK.js → swatch-zFOV4NtM.js} +2 -2
- package/standalone/chunks/text-field-C4D5FNRe.js +5 -0
- package/standalone/chunks/{text-field-DXzpM1Qn.js → text-field-DwD97PEo.js} +3 -3
- package/standalone/clear-button.js +1 -1
- package/standalone/close-button.js +1 -1
- package/standalone/color-field.js +1 -1
- package/standalone/color-menu.js +1 -1
- package/standalone/color-picker.js +1 -1
- package/standalone/date-range-picker.js +8 -8
- package/standalone/date-time-picker.js +9 -9
- package/standalone/icon.js +1 -1
- package/standalone/manifest.json +32 -19
- package/standalone/menu.js +1 -1
- package/standalone/multi-language-field.js +1 -1
- package/standalone/notice.js +1 -1
- package/standalone/number-field.js +1 -1
- package/standalone/options.js +1 -1
- package/standalone/picker-button.js +1 -1
- package/standalone/picker.js +1 -1
- package/standalone/progress-steps.js +6 -6
- package/standalone/prompt-box.js +19 -19
- package/standalone/question-box.js +20 -20
- package/standalone/search.js +1 -1
- package/standalone/select.js +17 -16
- package/standalone/slider.js +1 -1
- package/standalone/swatch.js +1 -1
- package/standalone/table.js +25 -25
- package/standalone/tabs.js +3 -3
- package/standalone/tags.js +1 -1
- package/standalone/text-field.js +1 -1
- package/standalone/toast.js +3 -3
- package/standalone/utils.js +1 -1
- package/components/options-Dk1uFeUT.cjs +0 -105
- package/components/select-2Fvb7tpj.cjs +0 -158
- package/standalone/chunks/action-button-0d4u0dWv.js +0 -6
- package/standalone/chunks/button-Bgc3zdEa.js +0 -2
- package/standalone/chunks/calendar-BxARYymw.js +0 -122
- package/standalone/chunks/checkbox-Cl6YBcGA.js +0 -9
- package/standalone/chunks/clear-button-B4r_oxfc.js +0 -2
- package/standalone/chunks/close-button-DVCeu3_f.js +0 -2
- package/standalone/chunks/color-menu-DIX2y9m_.js +0 -73
- package/standalone/chunks/icon-6P1RsbD1.js +0 -2
- package/standalone/chunks/luzmo-icons-vtQE0BSI.js +0 -13
- package/standalone/chunks/number-field-BoIKbmIv.js +0 -41
- package/standalone/chunks/options-rb_zaAJ6.js +0 -89
- package/standalone/chunks/picker-HoERLlkx.js +0 -108
- package/standalone/chunks/picker-button-DbamPU-T.js +0 -21
- package/standalone/chunks/segments-factory-B6oGyosS.js +0 -2
- package/standalone/chunks/text-field-D5ncaa2n.js +0 -5
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/*! * Lucero - The design system for Luzmo.
|
|
2
|
+
*
|
|
3
|
+
* Copyright © 2026 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
|
+
require("./tokens.cjs");const e=require("./decorate-SO02l0A6.cjs"),t=require("./sized-mixin-CSajkMro.cjs"),n=require("./focusable-BIHTrJd6.cjs");require("./icon-BlbMP3mJ.cjs"),require("./popover-CFzz83f8.cjs");const r=require("./dependency-manger-BSaHw9ju.cjs"),i=require("./match-media-B_0cVVtk.cjs");require("./progress-circle-C_9UZs2Y.cjs");const a=require("./pending-state-A6NrvaQj.cjs");require("./overlay-DAOyrYJL.cjs"),require("./tooltip-BE01O3Sg.cjs");const o=require("./strategies-C6hzAW86.cjs"),s=require("./options-BH_Y3UB6.cjs"),c=require("./template-property-yhcAmPXk.cjs");let l=require("lit"),u=require("lit/decorators.js"),d=require("@luzmo/icons"),f=require("lit/directives/if-defined.js"),p=require("lit/directives/class-map.js");var m=(e,t)=>{let n=getComputedStyle(e).getPropertyValue(t);for(;!n&&e.parentElement;)e=e.parentElement,n=getComputedStyle(e).getPropertyValue(t);return n.trim()},h=`:host{font-family:var(--luzmo-select-font-family,var(--select-font-family));font-size:var(--luzmo-select-font-size,var(--select-font-size))}#button{cursor:pointer;-webkit-user-select:none;user-select:none;font-family:var(--luzmo-button-font-family,var(--luzmo-font-family));-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:var(--luzmo-button-line-height,var(--luzmo-line-height,1.3));text-transform:none;vertical-align:top;-webkit-appearance:button;transition:background var(--luzmo-button-animation-duration,var(--luzmo-animation-duration)) ease-out, border-color var(--luzmo-button-animation-duration,var(--luzmo-animation-duration)) ease-out, color var(--luzmo-button-animation-duration,var(--luzmo-animation-duration)) ease-out, box-shadow var(--luzmo-button-animation-duration,var(--luzmo-animation-duration)) ease-out;justify-content:center;align-items:center;margin:0;-webkit-text-decoration:none;text-decoration:none;display:inline-flex;position:relative;overflow:visible}#button::-moz-focus-inner{border-style:none;padding:0}#button:focus{outline:none}#icon{font-size:var(--luzmo-select-font-size,var(--select-font-size));margin-inline-end:var(--luzmo-select-spacing-text-to-icon,var(--select-spacing-text-to-icon))}@media (forced-colors:active){:host{--highcontrast-select-focus-indicator-color:Highlight;--highcontrast-select-border-color-default:ButtonBorder;--highcontrast-select-border-color-hover:Highlight;--highcontrast-select-border-color-disabled:GrayText;--highcontrast-select-content-color-default:ButtonText;--highcontrast-select-content-color-disabled:GrayText;--highcontrast-select-background-color:ButtonFace}#button:focus-visible{--highcontrast-select-border-color-hover:ButtonText}#button .label,#button:after{forced-color-adjust:none}}#button{box-sizing:border-box;max-inline-size:100%;min-inline-size:calc(var(--select-minimum-width-multiplier) * var(--luzmo-select-button-block-size,var(--select-button-block-size)));block-size:var(--luzmo-select-button-block-size,var(--select-button-block-size));border-width:var(--luzmo-select-button-border-width,var(--select-button-border-width));border-radius:var(--luzmo-select-button-border-radius,var(--select-button-border-radius));box-shadow:var(--luzmo-select-button-box-shadow,var(--select-button-box-shadow));transition:background-color var(--luzmo-select-animation-duration,var(--select-animation-duration)), box-shadow var(--luzmo-select-animation-duration,var(--select-animation-duration)), border-color var(--luzmo-select-animation-duration,var(--select-animation-duration)) ease-in-out;color:var(--highcontrast-select-content-color-default,var(--luzmo-select-font-color-default,var(--select-font-color-default)));background-color:var(--highcontrast-select-background-color,var(--luzmo-select-background-color-default,var(--select-background-color-default)));border-style:solid;border-color:var(--highcontrast-select-border-color-default,var(--luzmo-select-border-color-default,var(--select-border-color-default)));margin-block-start:var(--luzmo-select-spacing-label-to-select,var(--select-spacing-label-to-select));padding-block:0;padding-inline-start:var(--luzmo-select-inline-edge-to-content,var(--select-inline-edge-to-content));padding-inline-end:var(--luzmo-select-spacing-edge-to-disclosure-icon,var(--select-spacing-edge-to-disclosure-icon));display:flex}#button:after{pointer-events:none;content:"";block-size:calc(100% + var(--luzmo-select-focus-indicator-gap,var(--select-focus-indicator-gap)) * 2 + var(--luzmo-select-button-border-width,var(--select-button-border-width)) * 2);inline-size:calc(100% + var(--luzmo-select-focus-indicator-gap,var(--select-focus-indicator-gap)) * 2 + var(--luzmo-select-button-border-width,var(--select-button-border-width)) * 2);border-style:solid;border-width:var(--luzmo-select-focus-indicator-width,var(--select-focus-indicator-width));border-radius:calc(var(--luzmo-select-button-border-radius,var(--select-button-border-radius)) + var(--luzmo-select-focus-indicator-gap,var(--select-focus-indicator-gap)) + var(--luzmo-select-button-border-width,var(--select-button-border-width)));border-color:#0000;margin-block-start:calc((var(--luzmo-select-focus-indicator-gap,var(--select-focus-indicator-gap)) + var(--luzmo-select-focus-indicator-width,var(--select-focus-indicator-width)) + var(--luzmo-select-button-border-width,var(--select-button-border-width))) * -1);margin-inline-start:calc((var(--luzmo-select-focus-indicator-gap,var(--select-focus-indicator-gap)) + var(--luzmo-select-focus-indicator-width,var(--select-focus-indicator-width)) + var(--luzmo-select-button-border-width,var(--select-button-border-width))) * -1);position:absolute;inset-block:0;inset-inline:0}#button:active{background-color:var(--highcontrast-select-background-color,var(--luzmo-select-background-color-active,var(--select-background-color-active)));border-color:var(--highcontrast-select-border-color-default,var(--luzmo-select-border-active,var(--select-border-color-active)))}#button:active:after{border-color:#0000}#button.placeholder:active .label{color:var(--highcontrast-select-content-color-default,var(--luzmo-select-font-color-active,var(--select-font-color-active)))}#button:focus-visible{background-color:var(--highcontrast-select-background-color,var(--luzmo-select-background-color-key-focus,var(--select-background-color-key-focus)));border-color:var(--highcontrast-select-border-color-default,var(--luzmo-select-border-color-key-focus,var(--select-border-color-key-focus)));color:var(--highcontrast-select-content-color-default,var(--luzmo-select-font-color-key-focus,var(--select-font-color-key-focus)));outline:none}#button:focus-visible:after{border-color:var(--highcontrast-select-focus-indicator-color,var(--luzmo-select-focus-indicator-color,var(--select-focus-indicator-color)))}#button.placeholder:focus-visible{color:var(--highcontrast-select-content-color-default,var(--luzmo-select-font-color-key-focus,var(--select-font-color-key-focus)))}#button:focus-visible .disclosure-icon,#button:focus-visible .clear-icon{color:var(--highcontrast-select-content-color-default,var(--luzmo-select-icon-color-key-focus,var(--select-icon-color-key-focus)))}:host([open]) #button:not(:disabled,.is-disabled){color:var(--highcontrast-select-content-color-default,var(--luzmo-select-font-color-default-open,var(--select-font-color-default-open)));background-color:var(--highcontrast-select-background-color,var(--luzmo-select-background-color-default-open,var(--select-background-color-default-open)));border-color:var(--highcontrast-select-border-color-default,var(--luzmo-select-border-default-open,var(--select-border-color-default-open)))}:host([open]) #button:not(:disabled,.is-disabled) .disclosure-icon,:host([open]) #button:not(:disabled,.is-disabled) .clear-icon{color:var(--highcontrast-select-content-color-default,var(--luzmo-select-icon-color-default-open,var(--select-icon-color-default-open)))}:host([invalid]) #button:not(:disabled,.is-disabled){border-color:var(--highcontrast-select-border-color-default,var(--luzmo-select-border-color-error-default,var(--select-border-color-error-default)))}:host([invalid]) #button:not(:disabled,.is-disabled) .validation-icon{color:var(--highcontrast-select-content-color-default,var(--luzmo-select-icon-color-error,var(--select-icon-color-error)))}:host([invalid]) #button:not(:disabled,.is-disabled):active{border-color:var(--highcontrast-select-border-color-default,var(--luzmo-select-border-color-error-active,var(--select-border-color-error-active)))}:host([invalid][open]) #button:not(:disabled,.is-disabled){border-color:var(--highcontrast-select-border-color-default,var(--luzmo-select-border-color-error-default-open,var(--select-border-color-error-default-open)))}:host([invalid]) #button:not(:disabled,.is-disabled):focus-visible{border-color:var(--highcontrast-select-border-color-default,var(--luzmo-select-border-color-error-key-focus,var(--select-border-color-error-key-focus)))}:host([pending]) #button .disclosure-icon,:host([pending]) #button .clear-icon{color:var(--highcontrast-select-content-color-disabled,var(--luzmo-select-icon-color-disabled,var(--select-icon-color-disabled)))}.icon{flex-shrink:0}.label{white-space:nowrap;font-size:var(--luzmo-select-font-size,var(--select-font-size));line-height:var(--luzmo-select-button-line-height,var(--select-button-line-height));font-weight:var(--luzmo-select-font-weight,var(--select-font-weight));text-overflow:ellipsis;text-align:start;flex:auto;overflow:hidden}.label.placeholder{font-weight:var(--luzmo-select-placeholder-font-weight,var(--select-font-weight));font-style:var(--luzmo-select-placeholder-font-style,var(--select-placeholder-font-style));transition:color var(--luzmo-select-animation-duration,var(--select-animation-duration)) ease-in-out;color:var(--highcontrast-select-content-color-default,var(--luzmo-select-font-color-default,var(--select-font-color-default)))}.label.placeholder:active{color:var(--highcontrast-select-content-color-default,var(--luzmo-select-font-color-active,var(--select-font-color-active)))}.clear-icon,.disclosure-icon{vertical-align:top;transition:color var(--luzmo-select-animation-duration,var(--select-animation-duration)) ease-out;color:var(--highcontrast-select-content-color-default,var(--luzmo-select-icon-color-default,var(--select-icon-color-default)));flex-shrink:0;display:inline-block;position:relative}.disclosure-icon{margin-inline-start:var(--luzmo-select-spacing-icon-to-disclosure-icon,var(--select-spacing-icon-to-disclosure-icon))}.clear-icon{margin-inline-start:var(--luzmo-select-spacing-icon-to-clear-icon,var(--select-spacing-icon-to-clear-icon))}.disclosure-icon:active{color:var(--highcontrast-select-content-color-default,var(--luzmo-select-icon-color-active,var(--select-icon-color-active)))}luzmo-progress-circle,.validation-icon{margin-inline-start:var(--luzmo-select-spacing-text-to-icon,var(--select-spacing-text-to-icon))}.icon-container{height:100%;font-size:var(--luzmo-select-disclosure-icon-size,var(--select-disclosure-icon-size));align-items:center;display:flex;position:relative}.icon-container.disclosure-icon{margin-inline-end:0}.label~.disclosure-icon,.label~.clear-icon{margin-inline-start:var(--luzmo-select-spacing-text-to-icon,var(--select-spacing-text-to-icon))}:host([quiet]) #button{inline-size:auto;min-inline-size:0;padding-inline:var(--luzmo-select-inline-edge-to-content-quiet,var(--select-inline-edge-to-content-quiet));color:var(--highcontrast-select-content-color-default,var(--luzmo-select-font-color-default,var(--select-font-color-default)));background-color:initial;background-color:var(--highcontrast-select-background-color,transparent);box-shadow:none;border:none;border-radius:0;margin-block-start:calc(var(--luzmo-select-spacing-label-to-select-quiet,var(--select-spacing-label-to-select-quiet)) + 1px)}:host([quiet]) #button.label-inline{margin-block-start:0}:host([quiet]) #button .disclosure-icon{margin-inline-end:var(--luzmo-select-spacing-edge-to-disclosure-icon-quiet,var(--select-spacing-edge-to-disclosure-icon-quiet))}:host([quiet]) #button:after{border:none;block-size:auto;inline-size:auto}@media (hover:hover){#button:hover{color:var(--highcontrast-select-content-color-default,var(--luzmo-select-font-color-hover,var(--select-font-color-hover)));background-color:var(--highcontrast-select-background-color,var(--luzmo-select-background-color-hover,var(--select-background-color-hover)));border-color:var(--highcontrast-select-border-color-hover,var(--luzmo-select-border-color-hover,var(--select-border-color-hover)))}#button:hover .disclosure-icon,#button:hover .clear-icon{color:var(--highcontrast-select-content-color-default,var(--luzmo-select-icon-color-hover,var(--select-icon-color-hover)))}#button:hover .clear-icon:hover{color:var(--highcontrast-select-content-color-default,var(--luzmo-select-clear-icon-color-hover,var(--select-icon-color-focus)))}:host([open]):not([quiet]) #button:not(:disabled,.is-disabled):hover{color:var(--highcontrast-select-content-color-default,var(--luzmo-select-font-color-hover-open,var(--select-font-color-hover-open)));background-color:var(--highcontrast-select-background-color,var(--luzmo-select-background-color-hover-open,var(--select-background-color-hover-open)));border-color:var(--highcontrast-select-border-color-hover,var(--luzmo-select-border-color-hover-open,var(--select-border-color-hover-open)))}:host([open]) #button:not(:disabled,.is-disabled):hover .disclosure-icon,:host([open]) #button:not(:disabled,.is-disabled):hover .clear-icon{color:var(--highcontrast-select-content-color-default,var(--luzmo-select-icon-color-hover-open,var(--select-icon-color-hover-open)))}:host([invalid]) #button:not(:disabled,.is-disabled):hover{border-color:var(--highcontrast-select-border-color-hover,var(--luzmo-select-border-color-error-hover,var(--select-border-color-error-hover)))}:host([invalid][open]) #button:not(:disabled,.is-disabled):hover{border-color:var(--highcontrast-select-border-color-hover,var(--luzmo-select-border-color-error-hover-open,var(--select-border-color-error-hover-open)))}.label.placeholder:hover{color:var(--highcontrast-select-content-color-default,var(--luzmo-select-font-color-hover,var(--select-font-color-hover)))}:host([quiet]) #button:hover{background-color:initial;background-color:var(--highcontrast-select-background-color,transparent)!important}}:host([quiet]) #button:focus-visible{background-color:initial;background-color:var(--highcontrast-select-background-color,transparent)}:host([quiet]) #button:focus-visible:after{box-shadow:0 var(--luzmo-select-focus-indicator-width,var(--select-focus-indicator-width)) 0 0 var(--highcontrast-select-focus-indicator-color,var(--luzmo-select-focus-indicator-color,var(--select-focus-indicator-color)));margin:calc((var(--luzmo-select-focus-indicator-gap,var(--select-focus-indicator-gap)) + var(--luzmo-select-button-border-width,var(--select-button-border-width))) * -1) 0;border:none;border-radius:0}:host([quiet][open]) #button,:host([quiet][disabled]) #button#button,:host([quiet]) #button#button:disabled,:host([quiet]) #button:active{background-color:initial;background-color:var(--highcontrast-select-background-color,transparent)}.label-inline{vertical-align:top;display:inline-flex}:host([disabled]) #button,#button:disabled{cursor:default;background-color:var(--highcontrast-select-background-color,var(--luzmo-select-background-color-disabled,var(--select-background-color-disabled)));border-color:#0000;border-color:var(--highcontrast-select-border-color-disabled,transparent);color:var(--highcontrast-select-content-color-disabled,var(--luzmo-select-font-color-disabled,var(--select-font-color-disabled)))}:host([disabled]) #button .icon,:host([disabled]) #button .disclosure-icon,:host([disabled]) #button .clear-icon,:host([disabled]) #button .validation-icon,#button:disabled .icon,#button:disabled .disclosure-icon,#button:disabled .clear-icon,#button:disabled .validation-icon{color:var(--highcontrast-select-content-color-disabled,var(--luzmo-select-icon-color-disabled,var(--select-icon-color-disabled)))}:host([disabled]) #button .label.placeholder,#button:disabled .label.placeholder{color:var(--highcontrast-select-content-color-disabled,var(--luzmo-select-font-color-disabled,var(--select-font-color-disabled)))}#popover{max-width:var(--luzmo-select-popover-max-width,var(--select-popover-max-width));min-width:var(--luzmo-select-popover-min-width,var(--select-popover-min-width));width:var(--luzmo-select-popover-width,var(--select-popover-width))}#popover.search-on{padding:0 0 var(--luzmo-popover-content-area-spacing-vertical,var(--popover-content-area-spacing-vertical)) 0!important}#search-container{border-bottom:var(--luzmo-select-search-container-border-bottom-width,var(--select-search-container-border-bottom-width)) solid var(--luzmo-select-search-container-border-bottom-color,var(--select-search-container-border-bottom-color));flex:none;display:flex;position:relative}#search-icon{left:var(--luzmo-select-inline-edge-to-content,var(--select-inline-edge-to-content));color:var(--luzmo-select-search-icon-color,var(--select-search-icon-color));font-size:var(--luzmo-select-search-icon-height,var(--select-search-icon-height));width:var(--luzmo-select-search-icon-width,var(--select-search-icon-width));text-align:center;pointer-events:none;justify-content:center;align-items:center;display:flex;position:absolute;top:0;bottom:0}#search:focus-within+#search-icon,#search:focus+#search-icon{color:var(--luzmo-select-search-icon-color-focus,var(--select-search-icon-color-focus))}#search{box-sizing:border-box;border-top-left-radius:var(--luzmo-popover-border-radius,var(--popover-border-radius));border-top-right-radius:var(--luzmo-popover-border-radius,var(--popover-border-radius));background-color:var(--luzmo-select-search-background-color,var(--select-search-background-color));width:100%;color:var(--luzmo-select-search-color,var(--select-search-color));height:var(--luzmo-select-button-block-size,var(--select-button-block-size));line-height:var(--luzmo-select-button-block-size,var(--select-button-block-size));padding-left:calc(var(--luzmo-select-inline-edge-to-content,var(--select-inline-edge-to-content)) + var(--luzmo-select-spacing-search-icon-to-text,var(--select-spacing-search-icon-to-text)) + var(--luzmo-select-search-icon-width,var(--select-search-icon-width)));padding-right:var(--luzmo-select-inline-edge-to-content,var(--select-inline-edge-to-content));font-size:var(--luzmo-select-font-size,var(--select-font-size));font-family:var(--luzmo-select-font-family,var(--select-font-family));line-height:var(--luzmo-select-button-line-height,var(--select-button-line-height));font-weight:var(--luzmo-select-font-weight,var(--select-font-weight));border:var(--luzmo-select-search-input-border-bottom-width,var(--select-search-input-border-bottom-width)) solid var(--luzmo-select-search-input-border-bottom-color,var(--select-search-input-border-bottom-color));outline:none}#no-results{color:var(--luzmo-select-no-results-color,var(--select-no-results-color));font-style:var(--luzmo-select-no-results-font-style,var(--select-no-results-font-style));height:var(--luzmo-select-no-results-height,var(--select-no-results-height));padding-inline:var(--luzmo-select-no-results-spacing-edge-to-text,var(--select-no-results-spacing-edge-to-text));align-items:center;display:flex}:host{--select-popover-max-width:300px;--select-popover-min-width:160px;--select-font-family:var(--luzmo-font-family);--select-font-size:var(--luzmo-font-size);--select-font-weight:var(--luzmo-font-weight);--select-spacing-search-icon-to-text:calc(var(--luzmo-spacing-3) + var(--luzmo-spacing-1));--select-search-icon-height:var(--luzmo-font-size);--select-search-icon-width:var(--luzmo-font-size);--select-search-icon-color:var(--luzmo-disabled-color);--select-search-icon-color-focus:var(--luzmo-font-color);--select-search-color:var(--luzmo-font-color);--select-search-background-color:var(--luzmo-background-color);--select-search-container-border-bottom-width:var(--luzmo-border-width);--select-search-container-border-bottom-color:var(--luzmo-border-color);--select-search-input-border-bottom-width:var(--luzmo-border-width);--select-search-input-border-bottom-color:transparent;--select-background-color-default:var(--luzmo-background-color);--select-background-color-default-open:var(--luzmo-background-color-hover);--select-background-color-active:var(--luzmo-background-color-down);--select-background-color-hover:var(--luzmo-background-color-hover);--select-background-color-hover-open:var(--luzmo-background-color-down);--select-background-color-key-focus:var(--luzmo-background-color-down);--select-border-color-default:var(--luzmo-border-color);--select-border-color-default-open:var(--luzmo-border-color-hover);--select-border-color-hover:var(--luzmo-border-color);--select-border-color-hover-open:var(--luzmo-border-color-hover);--select-border-color-active:var(--luzmo-border-color);--select-border-color-key-focus:var(--luzmo-border-color);--select-button-border-width:var(--luzmo-border-width);--select-placeholder-font-style:var(--luzmo-font-style);--select-button-line-height:var(--luzmo-line-height);--select-button-box-shadow:0px 1px 3px 0px var(--luzmo-shadow-color);--select-button-block-size:var(--luzmo-component-height);--select-button-border-radius:var(--luzmo-border-radius);--select-button-border-radius-reset:0;--select-inline-edge-to-content:calc(var(--luzmo-spacing-3) + var(--luzmo-spacing-1));--select-spacing-text-to-icon:calc(var(--luzmo-spacing-3) + var(--luzmo-spacing-1));--select-spacing-text-to-icon-inline-end:calc(var(--luzmo-spacing-3) + var(--luzmo-spacing-1));--select-spacing-icon-to-disclosure-icon:calc(var(--luzmo-spacing-3) + var(--luzmo-spacing-1));--select-spacing-icon-to-clear-icon:var(--select-spacing-icon-to-disclosure-icon);--select-inline-edge-to-content-quiet:0px;--select-spacing-label-to-select:0px;--select-spacing-label-to-select-quiet:calc(-1 * var(--luzmo-spacing-3) + var(--luzmo-spacing-1));--select-spacing-edge-to-disclosure-icon:calc(var(--luzmo-spacing-3) + var(--luzmo-spacing-1));--select-spacing-edge-to-disclosure-icon-quiet:0px;--select-animation-duration:var(--luzmo-animation-duration);--select-font-color-default:var(--luzmo-font-color);--select-font-color-default-open:var(--luzmo-font-color-hover);--select-font-color-hover:var(--luzmo-font-color-hover);--select-font-color-hover-open:var(--luzmo-font-color-down);--select-font-color-active:var(--luzmo-font-color-focus);--select-font-color-key-focus:var(--luzmo-font-color-focus);--select-icon-color-default:var(--luzmo-font-color);--select-icon-color-default-open:var(--luzmo-font-color-hover);--select-icon-color-hover:var(--luzmo-font-color-hover);--select-icon-color-hover-open:var(--luzmo-font-color-hover);--select-icon-color-active:var(--luzmo-font-color-focus);--select-icon-color-key-focus:var(--luzmo-font-color-focus);--select-border-color-error-default:var(--luzmo-negative-color);--select-border-color-error-default-open:var(--luzmo-negative-color-down);--select-border-color-error-hover:var(--luzmo-negative-color-hover);--select-border-color-error-hover-open:var(--luzmo-negative-color-down);--select-border-color-error-active:var(--luzmo-negative-color-down);--select-border-color-error-key-focus:var(--luzmo-negative-color-focus);--select-icon-color-error:var(--luzmo-negative-color);--select-background-color-disabled:var(--luzmo-background-color-disabled);--select-font-color-disabled:var(--luzmo-disabled-color);--select-icon-color-disabled:var(--luzmo-disabled-color);--select-focus-indicator-gap:var(--luzmo-indicator-gap);--select-focus-indicator-width:var(--luzmo-indicator-width);--select-focus-indicator-color:var(--luzmo-indicator-color);--select-disclosure-icon-size:var(--luzmo-font-size-s);--select-no-results-height:var(--select-button-block-size);--select-no-results-color:var(--select-font-color-disabled);--select-no-results-font-style:italic;--select-no-results-spacing-edge-to-text:var(--select-inline-edge-to-content)}:host([size=s]){--select-button-block-size:var(--luzmo-component-height-s);--select-font-size:var(--luzmo-font-size-s);--select-search-icon-height:var(--luzmo-font-size-s);--select-search-icon-width:var(--luzmo-font-size-s);--select-popover-max-width:280px;--select-popover-min-width:140px;--select-spacing-search-icon-to-text:var(--luzmo-spacing-3);--select-inline-edge-to-content:var(--luzmo-spacing-3);--select-spacing-text-to-icon:var(--luzmo-spacing-3);--select-spacing-text-to-icon-inline-end:var(--luzmo-spacing-3);--select-spacing-icon-to-disclosure-icon:var(--luzmo-spacing-3);--select-spacing-label-to-select-quiet:calc(-1 * var(--luzmo-spacing-3));--select-spacing-edge-to-disclosure-icon:var(--luzmo-spacing-3);--select-disclosure-icon-size:var(--luzmo-font-size-s)}:host([size=l]){--select-button-block-size:var(--luzmo-component-height-l);--select-font-size:var(--luzmo-font-size-l);--select-search-icon-height:var(--luzmo-font-size-l);--select-search-icon-width:var(--luzmo-font-size-l);--select-popover-max-width:360px;--select-popover-min-width:220px;--select-spacing-search-icon-to-text:var(--luzmo-spacing-4);--select-inline-edge-to-content:var(--luzmo-spacing-4);--select-spacing-text-to-icon:var(--luzmo-spacing-4);--select-spacing-text-to-icon-inline-end:var(--luzmo-spacing-4);--select-spacing-icon-to-disclosure-icon:var(--luzmo-spacing-4);--select-spacing-label-to-select-quiet:calc(-1 * var(--luzmo-spacing-4));--select-spacing-edge-to-disclosure-icon:var(--luzmo-spacing-4);--select-disclosure-icon-size:var(--luzmo-font-size)}:host([size=xl]){--select-button-block-size:var(--luzmo-component-height-xl);--select-font-size:var(--luzmo-font-size-xl);--select-search-icon-height:var(--luzmo-font-size-xl);--select-search-icon-width:var(--luzmo-font-size-xl);--select-popover-max-width:400px;--select-popover-min-width:260px;--select-spacing-search-icon-to-text:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--select-inline-edge-to-content:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--select-spacing-text-to-icon:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--select-spacing-text-to-icon-inline-end:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--select-spacing-icon-to-disclosure-icon:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--select-spacing-label-to-select-quiet:calc(-1 * var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--select-spacing-edge-to-disclosure-icon:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--select-disclosure-icon-size:var(--luzmo-font-size-l)}:host([variant=highlight]) ::slotted(luzmo-option[selected]){--option-highlight-label-content-color:var(--luzmo-primary-inverse-color);--option-label-icon-color-default:var(--luzmo-primary-inverse-color);--menu-checkmark-display:var(--menu-checkmark-display-hidden);background-color:var(--luzmo-option-highlight-label-background-color,var(--option-highlight-label-background-color,var(--luzmo-border-color)));padding-inline-start:var(--luzmo-option-label-inline-edge-to-content,var(--option-label-inline-edge-to-content))}:host{vertical-align:top;max-inline-size:100%;inline-size:var(--luzmo-select-inline-size,var(--select-inline-size));min-inline-size:calc(var(--select-minimum-width-multiplier) * var(--luzmo-select-block-size,var(--select-block-size)));display:inline-flex}:host([quiet]){width:auto;min-width:0}:host([disabled]){pointer-events:none}#button{width:100%;min-width:100%;max-width:100%}#icon:not([hidden]){display:inline-flex}:host([readonly]) #button{user-select:inherit}.validation-icon{flex-shrink:0}luzmo-overlay{pointer-events:none}luzmo-options{pointer-events:initial}:host>#no-results,:host>luzmo-options{display:none}:host([focused]:not([quiet])) #button #label.placeholder{color:var(--select-placeholder-text-color-key-focus,var(--alias-placeholder-text-color-hover))}.visually-hidden{clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:0 -1px -1px 0;padding:0;position:absolute;overflow:hidden}luzmo-overlay:not(:defined){display:none}#button.remove-focus-ring-safari-hack:focus-visible{background-color:var(--highcontrast-select-background-color,var(--luzmo-select-background-color-default,var(--select-background-color-default)));border-color:var(--highcontrast-select-border-color-default,var(--luzmo-select-border-color-default,var(--select-border-color-default)));color:var(--highcontrast-select-content-color-default,var(--luzmo-select-font-color-default,var(--select-font-color-default)))}#button.remove-focus-ring-safari-hack:after{border:none}#button.remove-focus-ring-safari-hack:focus-visible:after{box-shadow:none}#button.remove-focus-ring-safari-hack:active{background-color:var(--highcontrast-select-background-color,var(--luzmo-select-background-color-default,var(--select-background-color-default)));border-color:var(--highcontrast-select-border-color-default,var(--luzmo-select-border-color-default,var(--select-border-color-default)));color:var(--highcontrast-select-content-color-default,var(--luzmo-select-font-color-default,var(--select-font-color-default)))}`,g=()=>l.html`
|
|
19
|
+
<div class="disclosure-icon icon">
|
|
20
|
+
${(0,d.luzmoIcon)(d.luzmoAngleDown,{className:`indicator`})}
|
|
21
|
+
</div>
|
|
22
|
+
`,_=()=>l.html`
|
|
23
|
+
<div class="icon-container validation-icon icon">
|
|
24
|
+
${(0,d.luzmoIcon)(d.luzmoAlert)}
|
|
25
|
+
</div>
|
|
26
|
+
`,v=()=>l.html`
|
|
27
|
+
<div class="icon-container search-icon icon" id="search-icon">
|
|
28
|
+
${(0,d.luzmoIcon)(d.luzmoSearch)}
|
|
29
|
+
</div>
|
|
30
|
+
`,y=`select-option-menu`,b=class extends t.n(n.t,{noDefaultSize:!0}){static get styles(){return[(0,l.unsafeCSS)(h)]}get selfManageFocusElement(){return this._selfManageFocusElement}constructor(){super(),this.disabled=!1,this.focused=!1,this.variant=`checkmarks`,this.emphasized=!1,this.invalid=!1,this.search=`auto`,this.noWrap=!1,this.retrieving=!1,this.pending=!1,this.clearable=!1,this.hideDropdownIcon=!1,this.pendingLabel=`Pending`,this.searchLabel=`Search`,this.noResultsLabel=`No results`,this.noDataLabel=`No data`,this.multipleLabelTemplate=`Selected {count} items`,this.label=`Select`,this.open=!1,this.readonly=!1,this.placement=`bottom-end`,this.quiet=!1,this.value=[],this.options=[],this.selects=`multiple`,this.dependencyManager=new r.t(this),this.isMobile=new i.r(this,i.t),this.listRole=`listbox`,this.itemRole=`option`,this.hasRenderedOverlay=!1,this._selfManageFocusElement=!1,this.selectionPromise=Promise.resolve(),this.enterKeydownOn=null,this._selectedOptions=[],this.handleSlottableRequest=e=>{},this.renderAngleIcon=()=>g(),this.renderAlertIcon=()=>_(),this._popoverDependencyRegistered=!1,this.handleEnterKeydown=e=>{e.code===`Enter`&&(this.enterKeydownOn?e.preventDefault():(this.enterKeydownOn=e.target,this.addEventListener(`keyup`,e=>{e.code===`Enter`&&(this.enterKeydownOn=null)},{once:!0})))},this.clearValue=e=>{e.preventDefault(),e.stopPropagation(),this.value=[],this.strategy&&(this.strategy.preventNextToggle=`no`),this.open=!1,this.strategy&&(this.strategy.open=!1),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,cancelable:!0,composed:!0,detail:{value:this.value??[]}}))},this.handleEscape=e=>{e.code===`Escape`&&this.open&&(e.stopPropagation(),e.preventDefault(),this.toggle(!1))},this.handleKeydown=e=>{let{code:t}=e;if(t===`Escape`)this.handleEscape(e);else if([`Delete`,`Backspace`].includes(t))this.clearValue(e);else if(this.focused=!0,!(!t.startsWith(`Arrow`)||this.readonly||this.pending)){if(t===`ArrowUp`||t===`ArrowDown`)this.toggle(!0),e.preventDefault();else if(e.preventDefault(),this.selects===`single`){let e=t===`ArrowRight`?1:-1,n=this.options.findIndex(e=>e?.value?.toString()===this.value?.[0]?.toString()),r=(this.options.length+n+e)%this.options.length,i=this.options.length;for(;(this.options?.[r]?.disabled||s.r(this.options?.[r]))&&i;)--i,r=(this.options.length+r+e)%this.options.length;let a=this.options[r];if(a?.disabled||s.r(a))return;this.value=[a.value??null],this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,cancelable:!0,composed:!0,detail:{value:this.value??[]}}))}}},this.pendingStateController=new a.t(this)}get focusElement(){return this.open?this.search===`on`||this.search===`auto`&&this.options?.length>20?this.searchInput:this.optionsMenu:this.button}forceFocusVisible(){this.disabled||(this.focused=!0)}click(){this.disabled||this.toggle()}handleButtonBlur(){this.focused=!1}focus(e){super.focus(e),!this.disabled&&this.focusElement&&(this.focused=this.hasVisibleFocusInTree())}handleHelperFocus(){this.focused=!0,this.button.focus()}handleChange(e){let t=e?.detail?.value??[];JSON.stringify(this.value)!==JSON.stringify(t)&&(this.value=t),this.strategy&&(this.strategy.preventNextToggle=`no`),e.stopPropagation(),e.cancelable&&this.selects!==`single`||(this.open=!1,this.strategy&&(this.strategy.open=!1)),e.preventDefault(),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,cancelable:!0,composed:!0,detail:{value:this.value??[]}}))}handleButtonFocus(e){this.strategy?.handleButtonFocus(e)}toggle(e){this.readonly||this.pending||(this.open=e===void 0?!this.open:e,this.strategy&&(this.strategy.open=this.open),this._selfManageFocusElement=this.open)}close(){this.readonly||this.strategy&&(this.open=!1,this.strategy.open=!1)}bindEvents(){this.strategy?.abort(),this.strategy=new o.t.desktop(this.button,this),this.strategy?.overlay&&(this.strategy.overlay.type=`auto`,this.strategy.overlay.placement=this.placement)}connectedCallback(){super.connectedCallback(),this.ensurePopoverDependency()}disconnectedCallback(){this.close(),this.strategy?.releaseDescription(),super.disconnectedCallback()}handleTooltipSlotchange(e){this.tooltipEl=e.target.assignedElements()[0]}get labelTemplate(){let e=this._selectedOptions?.length===1&&this._selectedOptions[0]?.icon,t=l.html`<div
|
|
31
|
+
id="icon"
|
|
32
|
+
?hidden=${typeof this.icons==`string`||this.value?.length>1||!e}
|
|
33
|
+
>
|
|
34
|
+
${e?(0,d.luzmoIcon)(this._selectedOptions[0].icon):l.nothing}
|
|
35
|
+
</div>`,n=e=>e.replaceAll(/{([^}]+)}/g,(e,t)=>t===`count`?String(this.value?.length):e),r={"visually-hidden":this.icons===`only`&&this.value?.length>0,placeholder:!this.value?.length,label:!0},i;i=this.value?.length?this.value.length===1?l.html`<span
|
|
36
|
+
>${this._selectedOptions?.[0]?.shortLabel??this._selectedOptions?.[0]?.label??this.value?.[0]}</span
|
|
37
|
+
>`:l.html`<span
|
|
38
|
+
>${n(this.multipleLabelTemplate)}</span
|
|
39
|
+
>`:l.html`
|
|
40
|
+
<slot name="label" id="label">
|
|
41
|
+
<span aria-hidden="true"> ${this.label} </span>
|
|
42
|
+
</slot>
|
|
43
|
+
`;let a=this.value?.length?l.html`
|
|
44
|
+
<div aria-hidden="true" class="visually-hidden" id="applied-label">
|
|
45
|
+
${this.label}
|
|
46
|
+
<slot name="label"></slot>
|
|
47
|
+
</div>
|
|
48
|
+
`:l.html` <span hidden id="applied-label">${this.label}</span> `;return[l.html`
|
|
49
|
+
${this.value?.length===1?t:l.nothing}
|
|
50
|
+
<div
|
|
51
|
+
id=${(0,f.ifDefined)(this.value?.length?`label`:void 0)}
|
|
52
|
+
class=${(0,p.classMap)(r)}
|
|
53
|
+
>
|
|
54
|
+
${i}
|
|
55
|
+
</div>
|
|
56
|
+
${a}
|
|
57
|
+
${this.invalid&&!this.pending?l.html` ${this.renderAlertIcon()} `:l.nothing}
|
|
58
|
+
${this.pendingStateController.renderPendingState()}
|
|
59
|
+
${this.clearable&&!this.readonly&&this.value?.length>0?l.html`
|
|
60
|
+
<div class="icon-container clear-icon icon" @click=${this.clearValue}>
|
|
61
|
+
${(0,d.luzmoIcon)(d.luzmoClose14)}
|
|
62
|
+
</div>
|
|
63
|
+
`:l.nothing}
|
|
64
|
+
${this.readonly||this.hideDropdownIcon?l.nothing:this.renderAngleIcon()}
|
|
65
|
+
<slot
|
|
66
|
+
aria-hidden="true"
|
|
67
|
+
name="tooltip"
|
|
68
|
+
id="tooltip"
|
|
69
|
+
@slotchange=${this.handleTooltipSlotchange}
|
|
70
|
+
></slot>
|
|
71
|
+
`]}update(e){e.has(`disabled`)&&this.disabled&&this.strategy&&(this.open=!1,this.strategy.open=!1),e.has(`pending`)&&this.pending&&this.strategy&&(this.open=!1,this.strategy.open=!1),super.update(e)}bindButtonKeydownListener(){this.button.addEventListener(`keydown`,this.handleKeydown)}willUpdate(e){let t=e.has(`open`),n=e.has(`value`),r=e.has(`options`),i=e.has(`selects`),a=e.get(`open`);i&&this.selects===`single`&&this.value?.length>1&&(console.warn(`luzmo-select is being set to a single value given the selects property changed to 'single'`),this.value=this.value.slice(0,1)),t&&a===!1&&this.open&&this.searchString&&(this.searchString=``),(n||r)&&this.setSelectedOptionsFromValue()}updated(e){super.updated(e);let t=e.has(`options`),n=e.has(`open`),r=e.has(`placement`);if(n&&(this.strategy.open=this.open,this.open===!1&&this.optionsMenu.scrollToTop()),t){let e=this.options?.length??0;for(let t of this.options??[])t.children?.length&&(e+=t.children.length);if(e>25){let e=(e,t=e.label)=>(t?.length??0)+(e.children?.length?0:e.shortcut?.length??0),t=this.options[0];for(let n of this.options)e(n)>e(t)&&(t=n);for(let n of this.options)if(n.children?.length)for(let r of n.children){let i=`${n.label} (${r.label})`;e(r,i)>e(t)&&(t={...r,label:i})}this._estimatePopoverWidth(t)}else this.style.removeProperty(`--select-popover-width`)}this.strategy?.overlay&&(this.strategy.overlay.type!==`auto`&&(this.strategy.overlay.type=`auto`),(r||this.strategy.overlay.type===`auto`)&&(this.strategy.overlay.placement=this.placement))}firstUpdated(e){super.firstUpdated(e),this.bindButtonKeydownListener(),this.bindEvents()}_getCssVarInPixels(e){let t=m(this,e),n;if(t.endsWith(`rem`)){let e=Number.parseFloat(getComputedStyle(document.documentElement).fontSize);n=Number.parseFloat(t)*e}else if(t.endsWith(`em`)){let e=Number.parseFloat(getComputedStyle(this).fontSize);n=Number.parseFloat(t)*e}else n=Number.parseFloat(t);return n>=0?n:void 0}_estimatePopoverWidth(e){let t=this._getCssVarInPixels(`--luzmo-select-font-size`)??this._getCssVarInPixels(`--select-font-size`),n=this._getCssVarInPixels(`--luzmo-select-popover-min-width`)??this._getCssVarInPixels(`--select-popover-min-width`),r=this._getCssVarInPixels(`--luzmo-spacing-5`),i=document.createElement(`luzmo-options`);i.style.setProperty(`--luzmo-select-font-size`,`${t}px`),i.options=[e],i.value=[e.value??null],i.variant=this.variant,i.size=this.size,i.style.position=`absolute`,i.style.left=`-9999px`,i.style.top=`-9999px`,i.style.opacity=`0`,i.style.width=`auto`,document.body.append(i),i.updateComplete.then(()=>{let e=i.offsetWidth+(r??0);return e>(n??0)?this.style.setProperty(`--select-popover-width`,`${e}px`):this.style.removeProperty(`--select-popover-width`),i.remove(),e}).catch(e=>{console.error(e),i.remove()})}get dismissHelper(){return l.html`
|
|
72
|
+
<div class="visually-hidden">
|
|
73
|
+
<button
|
|
74
|
+
tabindex="-1"
|
|
75
|
+
aria-label="Dismiss"
|
|
76
|
+
@click=${this.close}
|
|
77
|
+
></button>
|
|
78
|
+
</div>
|
|
79
|
+
`}render(){return this.tooltipEl&&(this.tooltipEl.disabled=this.open),l.html`
|
|
80
|
+
<span
|
|
81
|
+
id="focus-helper"
|
|
82
|
+
tabindex=${this.focused||this.open?`-1`:`0`}
|
|
83
|
+
@focus=${this.handleHelperFocus}
|
|
84
|
+
aria-describedby=${y}
|
|
85
|
+
></span>
|
|
86
|
+
<button
|
|
87
|
+
aria-controls=${(0,f.ifDefined)(this.open?`menu`:void 0)}
|
|
88
|
+
aria-describedby="tooltip"
|
|
89
|
+
aria-expanded=${this.open?`true`:`false`}
|
|
90
|
+
aria-haspopup="true"
|
|
91
|
+
aria-labelledby="loader icon label applied-label"
|
|
92
|
+
id="button"
|
|
93
|
+
class=${(0,f.ifDefined)(this.labelAlignment?`label-${this.labelAlignment}`:void 0)}
|
|
94
|
+
@blur=${this.handleButtonBlur}
|
|
95
|
+
@keydown=${{handleEvent:this.handleEnterKeydown,capture:!0}}
|
|
96
|
+
?disabled=${this.disabled}
|
|
97
|
+
tabindex="-1"
|
|
98
|
+
>
|
|
99
|
+
${this.labelTemplate}
|
|
100
|
+
</button>
|
|
101
|
+
${this.renderMenu} ${this.renderDescriptionSlot}
|
|
102
|
+
`}get renderDescriptionSlot(){return l.html`
|
|
103
|
+
<div id=${y}>
|
|
104
|
+
<slot name="description"></slot>
|
|
105
|
+
</div>
|
|
106
|
+
`}setSelectedOptionsFromValue(){let e=[];for(let t of this.options){let n=t?.value;!t.children?.length&&this.value?.includes(n??null)&&e.push(t);for(let n of t.children??[]){let r=n?.value;this.value?.includes(r??null)&&e.push({...n,label:`${t.label} (${n.label})`})}}this._selectedOptions=e}renderSearchInput(){return l.html`
|
|
107
|
+
<div id="search-container">
|
|
108
|
+
<input
|
|
109
|
+
type="text"
|
|
110
|
+
id="search"
|
|
111
|
+
.placeholder=${this.searchLabel}
|
|
112
|
+
@input=${this.handleSearchInput}
|
|
113
|
+
@keydown=${this.handleSearchKeydown}
|
|
114
|
+
.value=${this.searchString??``}
|
|
115
|
+
.aria-label=${this.searchLabel}
|
|
116
|
+
autocomplete="off"
|
|
117
|
+
tabindex="0"
|
|
118
|
+
role="searchbox"
|
|
119
|
+
/>
|
|
120
|
+
${v()}
|
|
121
|
+
</div>
|
|
122
|
+
`}filterOptions(){let e=this.searchString?.toLowerCase()??``,t=this.options.filter(t=>s.r(t)?!0:!!(typeof t==`string`?t:t?.label)?.toString()?.toLowerCase()?.includes(e));if(!e)return t;let n=t.filter((e,n)=>{if(!s.r(e))return!0;for(let e of t.slice(n+1)){if(e?.header)return!1;if(!s.r(e))return!0}return!1});return n.filter((e,t)=>!e?.divider||t>0&&!n[t-1]?.divider)}get renderMenu(){let e=this.filterOptions(),t=e.some(e=>!s.r(e)),n=l.html`
|
|
123
|
+
<luzmo-options
|
|
124
|
+
.variant=${this.variant}
|
|
125
|
+
aria-labelledby="applied-label"
|
|
126
|
+
id="menu"
|
|
127
|
+
?emphasized=${this.emphasized}
|
|
128
|
+
.selects=${this.selects??`multiple`}
|
|
129
|
+
.options=${e}
|
|
130
|
+
.value=${this.value}
|
|
131
|
+
.optionIconRenderer=${this.optionIconRenderer}
|
|
132
|
+
.renderOption=${this.renderOption}
|
|
133
|
+
?pending=${this.retrieving}
|
|
134
|
+
?no-wrap=${this.noWrap}
|
|
135
|
+
@change=${this.handleChange}
|
|
136
|
+
@keydown=${{handleEvent:this.handleEnterKeydown,capture:!0}}
|
|
137
|
+
@luzmo-scrolled=${this.handleScrolled}
|
|
138
|
+
@luzmo-exceeded-top=${this.handleExceededTop}
|
|
139
|
+
role=${this.listRole}
|
|
140
|
+
size=${this.size}
|
|
141
|
+
tabindex="0"
|
|
142
|
+
>
|
|
143
|
+
</luzmo-options>
|
|
144
|
+
${!t&&!this.retrieving&&!this.pending?l.html`<div id="no-results">
|
|
145
|
+
${this.searchString?this.noResultsLabel:this.noDataLabel}
|
|
146
|
+
</div>`:l.nothing}
|
|
147
|
+
`;return this.hasRenderedOverlay=this.hasRenderedOverlay||this.focused||this.open,this.hasRenderedOverlay?(this.dependencyManager.loaded&&this.dependencyManager.add(`luzmo-overlay`),this.renderOverlay(n)):n}renderOverlay(e){if(this.strategy?.overlay===void 0)return e;let t=this.renderContainer(e);return(0,l.render)(t,this.strategy?.overlay,{host:this}),this.strategy?.overlay}ensurePopoverDependency(){this._popoverDependencyRegistered||(this._popoverDependencyRegistered=!0,this.dependencyManager.add(`luzmo-popover`))}renderContainer(e){let t=this.search===`on`||this.searchString&&this.searchString?.length>0||this.search===`auto`&&this.options?.length>20,n=t?this.renderSearchInput():l.nothing,r=l.html`
|
|
148
|
+
${n} ${this.dismissHelper} ${e} ${this.dismissHelper}
|
|
149
|
+
`;return l.html`
|
|
150
|
+
<luzmo-popover
|
|
151
|
+
class=${(0,f.ifDefined)(t?`search-on`:void 0)}
|
|
152
|
+
id="popover"
|
|
153
|
+
size=${this.size}
|
|
154
|
+
role="presentation"
|
|
155
|
+
placement=${this.placement}
|
|
156
|
+
>
|
|
157
|
+
${r}
|
|
158
|
+
</luzmo-popover>
|
|
159
|
+
`}async getUpdateComplete(){let e=await super.getUpdateComplete();return await this.selectionPromise,this.overlayElement&&await this.overlayElement.updateComplete,e}handleScrolled(e){e.stopPropagation(),e.preventDefault(),this.dispatchEvent(new CustomEvent(`luzmo-scrolled`,{bubbles:!0,composed:!0,cancelable:!0,detail:{first:e?.detail?.first,last:e?.detail?.last}}))}handleExceededTop(e){e.preventDefault(),e.stopPropagation(),this.searchInput?this.searchInput.focus():this.toggle(!1)}handleSearchInput(e){let t=e.target.value;t!==this.searchString&&(this.searchString=t,this.dispatchEvent(new CustomEvent(`luzmo-search`,{bubbles:!0,composed:!0,cancelable:!0,detail:{string:this.searchString}})))}handleSearchKeydown(e){e.code===`Escape`?this.searchString?this.searchString=``:this.handleEscape(e):e.code===`ArrowDown`?(this.optionsMenu.focus(),e.preventDefault(),e.stopPropagation()):e.code===`ArrowUp`&&this.toggle(!1)}};e.t([(0,u.query)(`#button`)],b.prototype,`button`,void 0),e.t([(0,u.property)({type:Boolean,reflect:!0})],b.prototype,`disabled`,void 0),e.t([(0,u.property)({type:Boolean,reflect:!0})],b.prototype,`focused`,void 0),e.t([(0,u.property)({type:String,reflect:!0})],b.prototype,`icons`,void 0),e.t([(0,u.property)({type:String,reflect:!0})],b.prototype,`variant`,void 0),e.t([(0,u.property)({type:Boolean,reflect:!0})],b.prototype,`emphasized`,void 0),e.t([(0,u.property)({type:Boolean,reflect:!0})],b.prototype,`invalid`,void 0),e.t([(0,u.property)({type:String,reflect:!0})],b.prototype,`search`,void 0),e.t([(0,u.property)({type:Boolean,reflect:!0,attribute:`no-wrap`})],b.prototype,`noWrap`,void 0),e.t([(0,u.property)({type:Boolean,reflect:!0})],b.prototype,`retrieving`,void 0),e.t([(0,u.property)({type:Boolean,reflect:!0})],b.prototype,`pending`,void 0),e.t([(0,u.property)({type:Boolean,reflect:!0})],b.prototype,`clearable`,void 0),e.t([(0,u.property)({type:Boolean,reflect:!0,attribute:`hide-dropdown-icon`})],b.prototype,`hideDropdownIcon`,void 0),e.t([(0,u.property)({type:String,attribute:`pending-label`})],b.prototype,`pendingLabel`,void 0),e.t([(0,u.property)({type:String,attribute:`search-label`})],b.prototype,`searchLabel`,void 0),e.t([(0,u.property)({type:String,attribute:`no-results-label`})],b.prototype,`noResultsLabel`,void 0),e.t([(0,u.property)({type:String,attribute:`no-data-label`})],b.prototype,`noDataLabel`,void 0),e.t([(0,u.property)({type:String,attribute:`multiple-label-template`,reflect:!0})],b.prototype,`multipleLabelTemplate`,void 0),e.t([(0,u.property)({type:String,reflect:!0})],b.prototype,`label`,void 0),e.t([(0,u.property)({type:Boolean,reflect:!0})],b.prototype,`open`,void 0),e.t([(0,u.property)({type:Boolean,reflect:!0})],b.prototype,`readonly`,void 0),e.t([(0,u.state)()],b.prototype,`labelAlignment`,void 0),e.t([(0,u.state)()],b.prototype,`displayLabelContent`,void 0),e.t([(0,u.state)()],b.prototype,`searchString`,void 0),e.t([(0,u.query)(`luzmo-options`)],b.prototype,`optionsMenu`,void 0),e.t([(0,u.query)(`#search`)],b.prototype,`searchInput`,void 0),e.t([(0,u.query)(`luzmo-overlay`)],b.prototype,`overlayElement`,void 0),e.t([(0,u.property)({type:String,reflect:!0})],b.prototype,`placement`,void 0),e.t([(0,u.property)({type:Boolean,reflect:!0})],b.prototype,`quiet`,void 0),e.t([(0,u.property)({type:Array,hasChanged(e,t){return JSON.stringify(e??[])!==JSON.stringify(t??[])},converter:{fromAttribute:e=>{if(!e||e===``)return[];try{return JSON.parse(e)}catch{return[]}},toAttribute:e=>JSON.stringify(e)}})],b.prototype,`value`,void 0),e.t([(0,u.property)({type:Array,hasChanged(e,t){return JSON.stringify(e??[])!==JSON.stringify(t??[])}})],b.prototype,`options`,void 0),e.t([(0,u.property)({attribute:!1})],b.prototype,`optionIconRenderer`,void 0),e.t([c.n({slot:`option`,context:[`option`,`ctx`],implicit:`option`})],b.prototype,`renderOption`,void 0),e.t([(0,u.property)({type:String,reflect:!0})],b.prototype,`selects`,void 0),customElements.get(`luzmo-select`)||customElements.define(`luzmo-select`,b),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return b}});
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../tokens.cjs");const e=require("../slider-
|
|
18
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../tokens.cjs");const e=require("../slider-B1cCAj1x.cjs");exports.DEFAULT_SLIDER_LABELS=e.r,exports.LuzmoSlider=e.n,exports.LuzmoSliderHandle=e.t;
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
18
|
import "../tokens.js";
|
|
19
|
-
export { r as DEFAULT_SLIDER_LABELS, n as LuzmoSlider, t as LuzmoSliderHandle } from "../slider-
|
|
19
|
+
export { r as DEFAULT_SLIDER_LABELS, n as LuzmoSlider, t as LuzmoSliderHandle } from "../slider-CD-aGN9I.js";
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
require("./tokens.cjs");const e=require("./decorate-SO02l0A6.cjs"),t=require("./sized-mixin-CSajkMro.cjs"),n=require("./focusable-BIHTrJd6.cjs"),r=require("./language-resolution-B7D3hQ6_.cjs"),i=require("./interaction-BjXWVy_C.cjs"),a=require("./manage-help-text-DtFJsl0k.cjs");require("./number-field-
|
|
18
|
+
require("./tokens.cjs");const e=require("./decorate-SO02l0A6.cjs"),t=require("./sized-mixin-CSajkMro.cjs"),n=require("./focusable-BIHTrJd6.cjs"),r=require("./language-resolution-B7D3hQ6_.cjs"),i=require("./interaction-BjXWVy_C.cjs"),a=require("./manage-help-text-DtFJsl0k.cjs");require("./number-field-DrarDCm4.cjs");let o=require("lit"),s=require("lit/decorators.js"),c=require("lit/directives/if-defined.js"),l=require("lit/directives/class-map.js"),u=require("lit/directives/style-map.js"),d=require("@internationalized/number"),f=require("lit/directives/repeat.js");var p={toNormalized(e,t,n){return n===t?0:(e-t)/(n-t)},fromNormalized(e,t,n){return e*(n-t)+t}},m=(e,t)=>{let n=e;for(let[e,r]of Object.entries(t))n=n.replaceAll(`{${e}}`,r);return n},h=e=>{if(!Number.isFinite(e))return 0;let t=Math.abs(e).toString(),n=t.match(/^\d+(?:\.(?<fraction>\d+))?e(?<exponent>[+-]\d+)$/);if(n?.groups){let{fraction:e=``,exponent:t}=n.groups;return Math.min(Math.max(e.length-Number(t),0),20)}let[,r=``]=t.split(`.`);return Math.min(r.length,20)},g=(e,t)=>{let n;try{n=e()}catch{n=void 0}if(typeof n==`number`&&!Number.isNaN(n))return n;let r=t();return Number.isNaN(r)?0:r},_=(e,t)=>Number.isFinite(e)?e:t,v=(e,t,n)=>Math.min(Math.max(e,Math.min(t,n)),Math.max(t,n)),y=(e,t,n,r)=>{let i=_(t,0),a=_(n,i),o=Number.isFinite(r)&&r>0?r:1,s=Number.isNaN(e)?i:e,c=Math.max(h(o),h(i),h(a)),l=i+Math.round((v(s,i,a)-i)/o)*o;return v(Number(l.toFixed(c)),i,a)},b=(e,t,n,r=p)=>v(g(()=>r.toNormalized(e,t,n),()=>p.toNormalized(e,t,n)),0,1),x=(e,t,n,r,i=p)=>{let a=v(e,0,1);return y(g(()=>i.fromNormalized(a,t,n),()=>p.fromNormalized(a,t,n)),t,n,r)},S=(e,t,n)=>{if(!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(n)||n<=0||t<=e)return[];let r=Math.floor((t-e)/n)+1;if(r>250)return[];let i=Math.max(h(e),h(n));return Array.from({length:r},(t,r)=>Number((e+r*n).toFixed(i)))},C=(e,t,n,r,i=p)=>{let a=t+(n-t)/2,o=r===!0?a:r===void 0?t:r,s=b(Number.isNaN(o)?t:o,t,n,i),c=b(e,t,n,i);return[Math.min(s,c),Math.max(s,c)]},w=(e,t)=>e+(t-e)/2,T=class{constructor(e,t,n,r){this._applySingleValue=t,this._formatHandleValue=n,this._formatHandleLabel=r,this._attachedHandles=new Set,this._inputMap=new WeakMap,this.activeIndex=0,this.draggingIndex=-1,this._host=e,this._host.addController(this)}hostConnected(){this.invalidate(),this._syncAttachments()}hostDisconnected(){this.draggingIndex=-1,this._detachHandles(),this._inputMap=new WeakMap,this._cachedModels=void 0}hostUpdate(){this._syncAttachments(),this._cachedModels=this._resolveModels()}hostUpdated(){this._syncInputReferences(),this._commitClampedValues()}get handles(){let e=this._host.shadowRoot?.querySelector(`slot[name="handle"]`);return(e?e.assignedElements():[...this._host.children]).filter(e=>e.localName===`luzmo-slider-handle`&&e.slot===`handle`)}get models(){return this._cachedModels??this._resolveModels()}get values(){return Object.fromEntries(this.models.map(({name:e,value:t})=>[e,t]))}invalidate(){this._cachedModels=void 0}requestHostUpdate(){this.invalidate(),this._host.requestUpdate()}inputForHandle(e){return this._inputMap.get(e)}setValue(e,t){let n=this.models[e];if(!n)return!1;this.activeIndex=e;let r=y(t,n.effectiveMin,n.effectiveMax,n.step);return r!==n.value&&(n.handle?n.handle.value=r:this._applySingleValue(r),this._cachedModels=this._resolveModels(),!0)}setNormalizedValue(e,t){let n=this.models[e];return n?this.setValue(e,x(t,n.min,n.max,n.step,n.normalization)):!1}nearestIndex(e){let t=this.models;return t.reduce((n,r,i)=>Math.abs(r.normalizedValue-e)<Math.abs(t[n].normalizedValue-e)?i:n,Math.min(Math.max(this.activeIndex,0),t.length-1))}reset(e){let t=this.models[e];return!t||t.defaultValue===void 0||!this.setValue(e,t.defaultValue)?!1:(this.dispatchInput(e),this.dispatchChange(e),!0)}dispatchInput(e){this._eventTarget(e).dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0}))}dispatchChange(e){this._eventTarget(e).dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0}))}formatValue(e){let t=this.models[e];return t?this._formatHandleValue(t):``}_eventTarget(e){return this.models[e]?.handle??this._host}_syncInputReferences(){this._inputMap=new WeakMap;let e=this._host.shadowRoot?.querySelectorAll(`input[type="range"]`)??[];this.models.forEach((t,n)=>{t.handle&&e[n]&&this._inputMap.set(t.handle,e[n])})}_commitClampedValues(){for(let e of this.models)e.handle&&e.handle.value!==e.value&&(e.handle.value=e.value)}_syncAttachments(){let e=new Set(this._host.isConnected?this.handles:[]);for(let t of this._attachedHandles)e.has(t)||t.detachController(this);for(let t of e)t.attachController(this);this._attachedHandles=e}_detachHandles(){for(let e of this._attachedHandles)e.detachController(this);this._attachedHandles.clear()}_resolveModels(){let e=this.handles;if(e.length===0)return[this._resolveSingleModel()];let t=e.map(e=>{let t=typeof e.min==`number`&&Number.isFinite(e.min)?e.min:this._host.min,n=typeof e.max==`number`&&Number.isFinite(e.max)?e.max:this._host.max;return{min:t,max:Math.max(t,n)}}),n=e.map((e,n)=>{let{min:r,max:i}=t[n],a=this._resolveStep(e.step);return y(Number.isFinite(e.value)?e.value:w(r,i),r,i,a)}),r=new Set;return e.map((i,a)=>{let{min:o,max:s}=t[a],c=this._resolveStep(i.step),l=i.min===`previous`&&a>0?Math.max(o,n[a-1]):o,u=Math.max(l,i.max===`next`&&a<e.length-1?Math.min(s,n[a+1]):s),d=y(n[a],l,u,c),f=i.normalization;return{handle:i,name:this._uniqueName(i.name,a,r),label:this._formatHandleLabel(i,a),value:d,min:o,max:s,effectiveMin:l,effectiveMax:u,step:c,defaultValue:i.defaultValue,normalizedValue:b(d,o,s,f),normalization:f}})}_resolveSingleModel(){let{min:e,max:t,step:n,normalization:r}=this._host,i=y(this._host.value,e,t,n);return{name:`value`,label:this._host.label,value:i,min:e,max:t,effectiveMin:e,effectiveMax:t,step:n,defaultValue:this._host.defaultValue,normalizedValue:b(i,e,t,r),normalization:r}}_resolveStep(e){return e!==void 0&&Number.isFinite(e)&&e>0?e:this._host.step}_uniqueName(e,t,n){let r=e||`handle${t+1}`;if(!n.has(r))return n.add(r),r;let i=t+1;for(;n.has(`${r}${i}`);)i+=1;let a=`${r}${i}`;return n.add(a),a}};function E({model:e,index:t,total:n,grouped:r,label:i,appliedLabel:a,helpTextId:s,labelVisibility:d,formattedValue:f,activeIndex:p,draggingIndex:m,focusedIndex:h,invalid:g,readonly:_,disabled:v}){let y=n>1?e.label:i||a||e.label;return o.html`
|
|
19
19
|
<span
|
|
20
20
|
class=${(0,l.classMap)({handle:!0,"tooltip-open":m===t||h===t})}
|
|
21
21
|
data-handle-index=${t}
|
|
@@ -22,7 +22,7 @@ import { t as r } from "./focusable-xjv79E40.js";
|
|
|
22
22
|
import { r as i, t as a } from "./language-resolution-7rc0khIK.js";
|
|
23
23
|
import { n as o, t as s } from "./interaction-BpCLJ1OV.js";
|
|
24
24
|
import { t as c } from "./manage-help-text-CFUaqINN.js";
|
|
25
|
-
import "./number-field-
|
|
25
|
+
import "./number-field-BEt0cfcB.js";
|
|
26
26
|
import { html as l, nothing as u, unsafeCSS as d } from "lit";
|
|
27
27
|
import { property as f, queryAll as p, state as m } from "lit/decorators.js";
|
|
28
28
|
import { ifDefined as h } from "lit/directives/if-defined.js";
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../tokens.cjs");const e=require("../table-
|
|
18
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../tokens.cjs");const e=require("../table-Bf-00FYb.cjs");exports.DEFAULT_TABLE_LABELS=e.u,exports.LuzmoTable=e.c,exports.LuzmoTableBody=e.s,exports.LuzmoTableCell=e.o,exports.LuzmoTableCheckboxCell=e.a,exports.LuzmoTableDisclosureCell=e.n,exports.LuzmoTableHead=e.i,exports.LuzmoTableHeadCell=e.r,exports.LuzmoTableRow=e.t,exports.LuzmoTableRowDetails=e.l;
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
18
|
import "../tokens.js";
|
|
19
|
-
export { u as DEFAULT_TABLE_LABELS, c as LuzmoTable, s as LuzmoTableBody, o as LuzmoTableCell, a as LuzmoTableCheckboxCell, n as LuzmoTableDisclosureCell, i as LuzmoTableHead, r as LuzmoTableHeadCell, t as LuzmoTableRow, l as LuzmoTableRowDetails } from "../table-
|
|
19
|
+
export { u as DEFAULT_TABLE_LABELS, c as LuzmoTable, s as LuzmoTableBody, o as LuzmoTableCell, a as LuzmoTableCheckboxCell, n as LuzmoTableDisclosureCell, i as LuzmoTableHead, r as LuzmoTableHeadCell, t as LuzmoTableRow, l as LuzmoTableRowDetails } from "../table-CfFwBCp1.js";
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
require("./tokens.cjs");const e=require("./decorate-SO02l0A6.cjs"),t=require("./sized-mixin-CSajkMro.cjs"),n=require("./roving-tabindex-BUFR8hPH.cjs"),r=require("./language-resolution-B7D3hQ6_.cjs"),i=require("./match-media-B_0cVVtk.cjs");require("./checkbox-CVi4GMoo.cjs");const a=require("./template-property-yhcAmPXk.cjs");let o=require("lit"),s=require("lit/decorators.js"),c=require("@luzmo/icons"),l=require("lit/directives/if-defined.js"),u=require("lit/directives/class-map.js"),d=require("lit/directives/style-map.js"),f=require("lit/directives/repeat.js"),p=require("@tanstack/table-core"),m=require("@tanstack/virtual-core");var h=`data-luzmo-table-announcer`,g,_=0,v=0,ee=()=>{let e=document.createElement(`div`);return e.setAttribute(h,``),e.setAttribute(`aria-live`,`polite`),e.setAttribute(`aria-atomic`,`true`),Object.assign(e.style,{position:`absolute`,inlineSize:`1px`,blockSize:`1px`,margin:`-1px`,padding:`0`,border:`0`,overflow:`hidden`,clipPath:`inset(50%)`,whiteSpace:`nowrap`}),e},te=class{constructor(e){e.addController(this)}announce(e){if(typeof document>`u`||!v)return;g??=ee(),g.isConnected||document.body.append(g);let t=g;t.textContent=``,cancelAnimationFrame(_),_=requestAnimationFrame(()=>{t.textContent=e})}hostConnected(){v+=1}hostDisconnected(){--v,v===0&&(cancelAnimationFrame(_),g?.remove(),g=void 0)}},y=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,b=e=>`luzmo-table-details-${[...e].map(e=>/^[A-Za-z0-9]$/.test(e)?e:`_${e.codePointAt(0).toString(16)}_`).join(``)}`,x=e=>y(e.minWidth)??(e.resizable?48:0),S=e=>y(e.maxWidth)??1e4,C=(e,t)=>Math.min(S(t),Math.max(x(t),Math.round(e))),ne=(e,t)=>{let n=y(t)??y(e.width);if(n!==void 0)return`${C(n,e)}px`;let r=y(e.minWidth)??(e.resizable?48:0),i=y(e.maxWidth);return i===void 0?r>0?`minmax(${r}px, 1fr)`:`minmax(0px, 1fr)`:`minmax(${r}px, ${i}px)`},re=(e,t,n)=>{let r=[];n.selects&&r.push(`var(--table-checkbox-cell-inline-size)`),n.expandable&&r.push(`var(--table-disclosure-cell-inline-size)`);for(let n of e)r.push(ne(n,y(t[n.id])));return r.join(` `)},w=(e,t)=>{let n=y(t)??y(e.width);return n===void 0?y(e.minWidth)??(e.resizable?48:0):C(n,e)},ie=(e,t,n)=>{let r=[];n.selects&&r.push(`var(--table-checkbox-cell-inline-size)`),n.expandable&&r.push(`var(--table-disclosure-cell-inline-size)`);let i=e.reduce((e,n)=>e+w(n,y(t[n.id])),0);return r.push(`${i}px`),`calc(${r.join(` + `)})`},ae=e=>({id:e.id,header:typeof e.header==`string`?e.header:e.id,width:y(e.width),minWidth:y(e.minWidth),maxWidth:y(e.maxWidth),resizable:e.resizable!==!1,lineClamp:y(e.lineClamp)}),oe=(e,t)=>{let n=e===`PageDown`||e===`PageUp`;switch(e){case`ArrowRight`:case`PageDown`:return{action:t?`increase`:`decrease`,amount:n?64:16};case`ArrowLeft`:case`PageUp`:return{action:t?`decrease`:`increase`,amount:n?64:16};case`Home`:return{action:`min`,amount:0};case`End`:return{action:`max`,amount:0};default:return}},se=(e,t,n)=>t.action===`min`?x(n):t.action===`max`?S(n):C(e+(t.action===`increase`?1:-1)*t.amount,n),T={selectAll:`Select All`,selectRow:`Select row {index}`,sortAscending:`Sorted by {column}, ascending`,sortDescending:`Sorted by {column}, descending`,expandRow:`Expand {label}`,collapseRow:`Collapse {label}`,resizeColumn:`Resize {column}`,columnWidth:`{column}, {width} pixels`},ce=e=>e.rowType===`information`||e._$rowType$===1,le=e=>e===`asc`?`ascending`:e===`desc`?`descending`:`none`,ue=e=>e===`asc`?`desc`:`asc`,E=(e={},t)=>{let n=Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`string`&&e!==``)),r={...T,...n};return t&&(r.selectAll=t),r},D=(e,t)=>{let n=e;for(let[e,r]of Object.entries(t))n=n.replaceAll(`{${e}}`,r);return n},de=(e,t)=>e.map((e,n)=>({item:e,value:t?t(e,n):String(n),index:n,information:ce(e)})),fe=(e,t)=>typeof e==`function`?e(t):e,pe=class{constructor(){this.records=[],this.sorting=[],this.manualSorting=!1,this.rowSelection={},this.selectedOrder=[],this.columns=[],this.table=(0,p.createTable)({data:[],columns:[],state:{},onStateChange:()=>{},renderFallbackValue:null,getCoreRowModel:(0,p.getCoreRowModel)(),getSortedRowModel:(0,p.getSortedRowModel)(),getRowId:e=>e.value,enableRowSelection:e=>!!this.selects&&!e.original.information,enableMultiRowSelection:()=>this.selects===`multiple`,onRowSelectionChange:e=>{this.pendingSelection=fe(e,this.rowSelection)}}),this.compare=(e,t)=>typeof e==`number`&&typeof t==`number`?e-t:(this.collator&&this.collatorLocale===this.locale||(this.collatorLocale=this.locale,this.collator=new Intl.Collator(this.locale,{numeric:!0,sensitivity:`base`})),this.collator.compare(String(e),String(t)))}setRecords(e){this.records=e}setSelected(e){this.selectedOrder=[...e],this.rowSelection=Object.fromEntries(e.map(e=>[e,!0]))}setSorting(e,t=!1){this.manualSorting=t,e?(this.columns.some(t=>t.id===e.key)||(this.columns=[...this.columns,this.createSortColumn(e.key)]),this.sorting=[{id:e.key,desc:e.direction===`desc`}]):this.sorting=[]}get rows(){this.sync();let e=this.table.getRowModel().rows.map(e=>e.original).filter(e=>!e.information);return e.length===this.records.length?e:this.records.map(t=>t.information?t:e.shift())}isSelected(e){return!!this.rowSelection[e]}get allSelected(){let e=this.selectableRecords;return e.length>0&&e.every(e=>this.isSelected(e.value))}get someSelected(){return this.selectableRecords.some(e=>this.isSelected(e.value))}toggle(e){this.sync();let t=this.findRow(e);if(t?.getCanSelect())return this.capture(()=>t.toggleSelected())}toggleAll(e){return this.sync(),this.capture(()=>this.table.toggleAllRowsSelected(e))}get selectableRecords(){return this.selects?this.records.filter(e=>!e.information):[]}findRow(e){return this.table.getCoreRowModel().rows.find(t=>t.original.value===e)}capture(e){this.pendingSelection=void 0,e();let t=this.pendingSelection??this.rowSelection;this.pendingSelection=void 0;let n=this.selectedOrder.filter(e=>t[e]),r=[...new Set([...this.records.map(e=>e.value),...Object.keys(t)])].filter(e=>t[e]&&!n.includes(e));return[...n,...r]}createSortColumn(e){return{id:e,accessorFn:t=>t.item[e],sortUndefined:`last`,sortingFn:(e,t,n)=>this.compare(e.getValue(n),t.getValue(n))}}sync(){this.table.setOptions(e=>({...e,data:this.records,columns:this.columns,manualSorting:this.manualSorting,state:{...this.table.initialState,sorting:this.sorting,rowSelection:this.rowSelection}}))}},me=new Set([`luzmo-table-cell`,`luzmo-table-head-cell`,`luzmo-table-checkbox-cell`]),O=e=>e.find(e=>e instanceof HTMLElement&&e.classList.contains(`resize-handle`)),k=class{constructor(e,t){this.handlePointerDown=e=>{if(!this.options.owns(e)||e.button!==0)return;let t=e.composedPath(),n=O(t),r=this.cellFromPath(t);if(!n||r?.localName!==`luzmo-table-head-cell`||!r.resizable)return;let i=r;e.preventDefault();let a=this.options.headCells().indexOf(i),o=i.toLayout(Math.max(a,0));this.drag={id:o.id,pointerId:e.pointerId,startWidth:i.getBoundingClientRect().width,startX:e.clientX};try{n.setPointerCapture(e.pointerId)}catch{}},this.handlePointerMove=e=>{let t=this.drag;if(!t||e.pointerId!==t.pointerId)return;let n=this.options.layouts().find(e=>e.id===t.id);if(!n)return;let r=(e.clientX-t.startX)*(this.options.isLTR()?1:-1);this.setColumnWidth(n,t.startWidth+r,!1)},this.handlePointerUp=e=>{let t=this.drag;if(!t||e.pointerId!==t.pointerId)return;let n=this.options.layouts().find(e=>e.id===t.id);if(this.drag=void 0,!n)return;let r=(e.clientX-t.startX)*(this.options.isLTR()?1:-1);this.setColumnWidth(n,t.startWidth+r,!0)},this.host=e,this.options=t,e.addController(this)}hostConnected(){this.host.addEventListener(`pointerdown`,this.handlePointerDown),this.host.addEventListener(`pointermove`,this.handlePointerMove),this.host.addEventListener(`pointerup`,this.handlePointerUp),this.host.addEventListener(`pointercancel`,this.handlePointerUp)}hostDisconnected(){this.host.removeEventListener(`pointerdown`,this.handlePointerDown),this.host.removeEventListener(`pointermove`,this.handlePointerMove),this.host.removeEventListener(`pointerup`,this.handlePointerUp),this.host.removeEventListener(`pointercancel`,this.handlePointerUp),this.drag=void 0}handleKeydown(e){if(e.defaultPrevented||!this.options.owns(e))return;let t=e.composedPath();if(!O(t))return;let n=oe(e.code,this.options.isLTR()),r=this.cellFromPath(t);n&&r?.localName===`luzmo-table-head-cell`&&(e.preventDefault(),e.stopPropagation(),this.resizeColumn(r,n))}resizeColumn(e,t){let n=this.options.headCells().indexOf(e),r=e.toLayout(Math.max(n,0)),i=e.currentWidth||Math.round(e.getBoundingClientRect().width);this.setColumnWidth(r,se(i,t,r),!0)}setColumnWidth(e,t,n){let r=C(t,e),i={...this.host.columnWidths,[e.id]:r};this.host.columnWidths=i;let a=this.options.headCells().find((t,n)=>t.toLayout(n).id===e.id);if(a&&(a.currentWidth=r),!n)return;let o=E(this.options.labels(),this.options.selectAllLabel());this.host.dispatchEvent(new CustomEvent(`luzmo-column-resized`,{bubbles:!0,composed:!0,detail:{columnId:e.id,width:r,columnWidths:{...i}}})),this.options.announce(D(o.columnWidth,{column:e.header,width:this.formatWidth(r)}))}formatWidth(e){let t=this.options.language();return this.widthFormatter&&this.formatterLanguage===t||(this.formatterLanguage=t,this.widthFormatter=new Intl.NumberFormat(t)),this.widthFormatter.format(e)}cellFromPath(e){return e.find(e=>e instanceof HTMLElement&&me.has(e.localName))}},he=`textarea, select, [contenteditable=""], [contenteditable="true"], input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"])`,ge=class extends n.t{constructor(e,{rows:t,isLTR:n,...r}){super(e,r),this.handleFocusout=e=>{let t=e.relatedTarget;t instanceof HTMLElement&&(this.elements.includes(t)||this.elements.some(e=>e.contains(t)))||queueMicrotask(()=>{this.activeGridCell()||this.hostNoLongerContainsFocus()})},this.handleKeydown=e=>{if(e.defaultPrevented||!this.acceptsEventCode(e.code)||!this.owns(e))return;let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.matches(he))return;let n=this.cellFromPath(e.composedPath());if(!n)return;let r=this.navigationTarget(n,e);r&&(e.preventDefault(),this.focusElement(r))},this.rows=t,this.isLTR=n}acceptsEventCode(e){return e===`ArrowLeft`||e===`ArrowRight`||e===`ArrowUp`||e===`ArrowDown`||e===`Home`||e===`End`}focusElement(e,t){let n=this.elements.indexOf(e);if(n===-1)return;let r=this.elements[this.currentIndex];r&&r!==e&&(r.tabIndex=-1),this.currentIndex=n,this.focus(t)}owns(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.localName===`luzmo-table`)return t===this.host;return!0}cellFromPath(e){let t=new Set(this.rows().flat());return e.find(e=>e instanceof HTMLElement&&t.has(e))}activeGridCell(){let e=this.host.ownerDocument.activeElement;for(;e instanceof HTMLElement&&e.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e instanceof HTMLElement&&this.rows().flat().includes(e)?e:void 0}navigationTarget(e,t){let n=this.rows(),r=n.findIndex(t=>t.includes(e));if(r===-1)return;let i=n[r].indexOf(e),a=n.length-1,o=(e,t)=>{let r=n[Math.min(Math.max(e,0),a)];return r[Math.min(Math.max(t,0),r.length-1)]},s=t=>{let i=n[Math.min(Math.max(t,0),a)];return this.cellForKey(i,this.columnKey(n[r],e))},c=this.isLTR()?1:-1,l=t.ctrlKey||t.metaKey;switch(t.code){case`ArrowRight`:return o(r,i+c);case`ArrowLeft`:return o(r,i-c);case`ArrowDown`:return s(r+1);case`ArrowUp`:return s(r-1);case`Home`:return o(l?0:r,0);case`End`:return l?o(a,n[a].length-1):o(r,n[r].length-1);default:return}}columnKey(e,t){if(t.classList.contains(`resize-handle`)){let n=e[e.indexOf(t)-1];return n?this.columnKey(e,n):`data:0`}if(t.localName===`luzmo-table-checkbox-cell`)return`select`;if(t.localName===`luzmo-table-disclosure-cell`)return`expand`;if(t.classList.contains(`cell`))return`details`;let n=e.filter(e=>e.localName===`luzmo-table-cell`||e.localName===`luzmo-table-head-cell`);return`data:${Math.max(n.indexOf(t),0)}`}cellForKey(e,t){return t===`expand`?e.find(e=>e.localName===`luzmo-table-disclosure-cell`)??this.cellForKey(e,`data:0`):t===`details`?this.cellForKey(e,`data:0`):e.find(n=>!n.classList.contains(`resize-handle`)&&this.columnKey(e,n)===t)??e[0]}},A=Symbol(`table-details-closing`),j=e=>{let t=e.nextElementSibling;return t?.localName===`luzmo-table-row-details`?t:null},M=e=>e instanceof HTMLElement,_e=class{constructor(e,t){this.closingDetails=new Set,this.handleDetailsCollapsed=e=>{if(!this.options.owns(e))return;let t=e.target,n=[...this.closingDetails].find(e=>b(e)===t?.id);if(!n)return;let r=new Set(this.closingDetails);r.delete(n),this.closingDetails=r,this.host.requestUpdate(A)},this.host=e,this.options=t,e.addController(this)}get closing(){return this.closingDetails}hostConnected(){this.host.addEventListener(`luzmo-table-details-collapsed`,this.handleDetailsCollapsed)}hostDisconnected(){this.host.removeEventListener(`luzmo-table-details-collapsed`,this.handleDetailsCollapsed)}clear(){this.closingDetails=new Set,this.host.requestUpdate(A)}toggle(e){if(!e.expandable&&!j(e))return;let t=this.isDataMode(),n=t?e.value:e.value||String(this.declarativeRows().indexOf(e)),r=t?!this.host.expanded.includes(n):!e.expanded;if(t){let e=this.host.expanded;this.setClosing(n,!r),this.host.expanded=r?[...e,n]:e.filter(e=>e!==n),this.dispatchToggle(n,r)||(this.host.expanded=e,this.setClosing(n,!1));return}if(e.expanded=r,!this.dispatchToggle(n,r)){e.expanded=!r;return}let i=j(e);i&&(i.open=r),e.disclosureLabel=this.expandLabel(n,e.checkboxLabel||e.querySelector(`:scope > luzmo-table-cell`)?.textContent?.trim()||n,this.declarativeRows().indexOf(e))}collapseFromPath(e){let t=e.find(e=>M(e)&&e.localName===`luzmo-table-row-details`),n=(t?.previousElementSibling?.localName===`luzmo-table-row`?t.previousElementSibling:void 0)??e.find(e=>M(e)&&e.localName===`luzmo-table-row`);if(!n?.expanded)return;this.toggle(n);let r=n.shadowRoot?.querySelector(`luzmo-table-disclosure-cell`);r&&this.options.focusDisclosure(r)}setClosing(e,t){let n=new Set([...this.closingDetails].filter(t=>t!==e));t&&n.add(e),this.closingDetails=n,this.host.requestUpdate(A)}dispatchToggle(e,t){return this.host.dispatchEvent(new CustomEvent(`luzmo-table-row-toggle`,{bubbles:!0,composed:!0,cancelable:!0,detail:{value:e,expanded:t}}))}expandLabel(e,t,n){let r=E(this.host.labels,this.host.selectAllLabel);return D(this.host.expanded.includes(e)||this.rowByValue(e)?.expanded?r.collapseRow:r.expandRow,{label:t,index:String(n+1)})}rowByValue(e){return this.rows().find(t=>t.value===e)}isDataMode(){return Array.isArray(this.host.items)}declarativeRows(){return[...this.host.querySelectorAll(`:scope > luzmo-table-body > luzmo-table-row`)]}rows(){return this.isDataMode()?[...this.host.shadowRoot?.querySelectorAll(`luzmo-table-row`)??[]]:this.declarativeRows()}},N=e=>e instanceof HTMLElement,P=class{constructor(e,t){this.handleBodyScroll=e=>{this.options.owns(e)&&e.composedPath().find(e=>N(e)&&e.localName===`luzmo-table-body`)&&this.host.requestUpdate()},this.host=e,this.options=t,e.addController(this)}hostConnected(){this.host.addEventListener(`luzmo-table-body-scroll`,this.handleBodyScroll)}hostDisconnected(){this.host.removeEventListener(`luzmo-table-body-scroll`,this.handleBodyScroll),this.bodyObserver?.disconnect(),this.observedBody=void 0}hostUpdated(){this.syncHeadScroll(),this.watchBodyScrollbar()}hasExpansion(){return this.isDataMode()?typeof this.host.renderDetails==`function`:this.declarativeRows().some(e=>e.nextElementSibling?.localName===`luzmo-table-row-details`)}layouts(){return this.isDataMode()&&!this.slottedHead()?this.host.columns.map(ae):this.headCells().map((e,t)=>e.toLayout(t))}headCells(){return[...this.head()?.querySelectorAll(`:scope > luzmo-table-head-cell`)??[]]}applyGridMetrics(){let e={selects:!!this.host.selects,expandable:this.hasExpansion()},t=this.layouts();this.host.style.setProperty(`--table-grid-columns`,re(t,this.host.columnWidths,e)||`none`),this.host.style.setProperty(`--table-min-inline-size`,ie(t,this.host.columnWidths,e))}syncPresentation(){this.syncHead(),this.syncColumns(),this.isDataMode()||this.syncDeclarativeRows()}syncHeadTabStops(){let e=this.head();if(!e)return;let t=e.shadowRoot?.querySelector(`luzmo-table-checkbox-cell`);t&&t.getAttribute(`aria-hidden`)!==`true`&&t.tabIndex!==0&&(t.tabIndex=0);for(let e of this.headCells())e.tabIndex!==0&&(e.tabIndex=0)}syncHead(){let e=this.body();e&&this.syncGridColumns(e);let t=this.head();if(!t)return;this.syncGridColumns(t),this.syncHeadScroll(e,t);let n=E(this.host.labels,this.host.selectAllLabel),r=this.options.model.allSelected,i=this.options.model.someSelected,a=this.host.selects===`multiple`;t.selects=this.host.selects,t.checked=a&&r,t.indeterminate=a&&i&&!r,t.selected=i,t.emphasized=this.host.emphasized,t.checkboxLabel=n.selectAll,t.checkboxSize=this.host.size,t.expandable=this.hasExpansion()}watchBodyScrollbar(){let e=this.body();e&&e!==this.observedBody&&(this.bodyObserver?.disconnect(),this.observedBody=e,this.bodyObserver??=new ResizeObserver(()=>{this.syncHeadScroll()}),this.bodyObserver.observe(e,{box:`content-box`}))}syncHeadScroll(e=this.body(),t=this.head()){if(!e||!t)return;let n=Math.max(0,e.offsetWidth-e.clientWidth),r=e.scrollWidth>e.clientWidth+1;t.style.paddingInlineEnd=n>0&&!r?`${n}px`:``,t.style.transform=`translateX(${-e.scrollLeft}px)`}syncColumns(){let e=this.layouts(),t=E(this.host.labels,this.host.selectAllLabel);this.headCells().forEach((n,r)=>{let i=e[r];if(!i)return;let a=n.textContent?.trim()||i.header;if(n.resizeLabel=D(t.resizeColumn,{column:a}),!n.resizable)return;let o=y(this.host.columnWidths[i.id])??i.width,s=Math.round(n.getBoundingClientRect().width),c=o??s;c>0&&n.currentWidth!==c&&(n.currentWidth=c)});for(let t of this.rows()){this.syncGridColumns(t);let n=j(t);n&&this.syncGridColumns(n),!t.spanAll&&[...t.children].filter(e=>N(e)&&e.localName===`luzmo-table-cell`).forEach((t,n)=>{let r=e[n]?.lineClamp;t.columnLineClamp!==r&&(t.columnLineClamp=r)})}}syncDeclarativeRows(){let e=this.host.selects,t=E(this.host.labels,this.host.selectAllLabel),n=this.hasExpansion(),r=this.declarativeRows();r.forEach((i,a)=>{this.syncGridColumns(i);let o=i.value||String(a),s=j(i),c=a===r.length-1;i.toggleAttribute(`data-last-row`,c),s&&(this.syncGridColumns(s),s.toggleAttribute(`data-last-row`,c));let l=i.querySelector(`:scope > luzmo-table-cell`)?.textContent?.trim()||o;i.selectable=!!e,i.selectionColumn=!!e,i.selected=!!e&&this.options.model.isSelected(o),i.selectsSingle=e===`single`,i.emphasized=this.host.emphasized,i.checkboxSize=this.host.size,i.checkboxLabel=l,i.expandable=!!s,i.expansionColumn=n&&!s,i.detailsId=s?.id??``,i.disclosureLabel=D(i.expanded?t.collapseRow:t.expandRow,{label:l,index:String(a+1)}),s&&(s.id||(s.id=b(o),i.detailsId=s.id),s.open=i.expanded)})}syncGridColumns(e){for(let t of[`--table-grid-columns`,`--table-min-inline-size`])e.style.setProperty(t,this.host.style.getPropertyValue(t))}isDataMode(){return Array.isArray(this.host.items)}slottedHead(){return this.host.querySelector(`:scope > luzmo-table-head`)}head(){return this.slottedHead()??(this.isDataMode()?this.host.shadowRoot?.querySelector(`luzmo-table-head`)??null:null)}body(){return this.isDataMode()?this.host.shadowRoot?.querySelector(`luzmo-table-body`)??null:this.host.querySelector(`:scope > luzmo-table-body`)}declarativeRows(){return[...this.host.querySelectorAll(`:scope > luzmo-table-body > luzmo-table-row`)]}rows(){return this.isDataMode()?[...this.host.shadowRoot?.querySelectorAll(`luzmo-table-row`)??[]]:this.declarativeRows()}},F=Symbol(`table-virtual-range-updated`),I=40,ve=4,L=e=>e.getBoundingClientRect().height,ye=class{constructor(e,t){this.connected=!1,this.keys=[],this.estimatedSize=I,this.host=e,this.options=t,e.addController(this)}get enabled(){return!!this.virtualizer}set enabled(e){e!==this.enabled&&(e?(this.virtualizer=new m.Virtualizer(this.createOptions()),this.connected&&(this.cleanup=this.virtualizer._didMount())):(this.cleanup?.(),this.cleanup=void 0,this.virtualizer=void 0,this.range=void 0))}sync(e){return this.virtualizer?(e!==this.keys&&(this.keys=e,this.virtualizer.setOptions(this.createOptions())),this.virtualizer.getVirtualItems()):[]}get totalSize(){return this.virtualizer?.getTotalSize()??0}scrollToIndex(e){this.virtualizer?.scrollToIndex(e,{align:`start`})}hostConnected(){this.connected=!0,this.virtualizer&&!this.cleanup&&(this.cleanup=this.virtualizer._didMount())}hostUpdated(){if(!this.virtualizer)return;this.virtualizer._willUpdate();let e=this.options.getRowElements();this.syncEstimate(e);for(let t of e)this.virtualizer.measureElement(t)}hostDisconnected(){this.connected=!1,this.cleanup?.(),this.cleanup=void 0}syncEstimate(e){let t=e.filter(e=>this.options.isRendered(e)).map(e=>L(e)).filter(Boolean).sort((e,t)=>e-t);if(t.length===0)return;let n=t[Math.floor(t.length/2)];Math.abs(n-this.estimatedSize)>=.5&&(this.estimatedSize=n,this.virtualizer?.measure())}createOptions(){return{count:this.keys.length,getScrollElement:this.options.getScrollElement,estimateSize:()=>this.estimatedSize,getItemKey:e=>this.keys[e]??e,overscan:ve,useAnimationFrameWithResizeObserver:!0,scrollToFn:m.elementScroll,observeElementRect:m.observeElementRect,observeElementOffset:m.observeElementOffset,measureElement:e=>this.options.isRendered(e)&&L(e)||this.estimatedSize,onChange:e=>{let t=this.reportRange(e);queueMicrotask(()=>{t?this.host.requestUpdate(F,!1):this.host.requestUpdate()})}}}reportRange(e){let t=e.range;if(!t||t.endIndex<t.startIndex)return!1;let n=t.startIndex,r=t.endIndex;return this.range?.first===n&&this.range.last===r?!1:(this.range={first:n,last:r},this.options.onRangeChanged({first:n,last:r}),!0)}},be=`:host{grid-template-columns:var(--table-grid-columns);min-inline-size:var(--table-min-inline-size,0);box-sizing:border-box;display:grid;overflow:hidden;border-block-start:none!important;border-inline:none!important;border-block-end-width:var(--table-row-divider-width)!important;border-block-end-style:solid!important;border-block-end-color:var(--highcontrast-table-row-divider-color,var(--luzmo-table-border-color,var(--table-row-divider-color)))!important}:host([data-last-row]){border-block-end-width:0!important}:host([hidden]){display:none!important}.cell{outline:none;grid-column:1/-1;grid-template-rows:1fr;min-inline-size:0;display:grid;overflow:hidden}:host([data-last-row]) .cell{--table-focus-end-start-radius:var(--table-corner-radius);--table-focus-end-end-radius:var(--table-corner-radius)}.cell:focus-visible{outline:var(--luzmo-indicator-width,2px) solid var(--highcontrast-table-details-focus-indicator-color,var(--luzmo-indicator-color,currentColor));outline-offset:calc(var(--luzmo-indicator-width,2px) * -1);border-start-start-radius:var(--table-focus-start-start-radius,0);border-start-end-radius:var(--table-focus-start-end-radius,0);border-end-end-radius:var(--table-focus-end-end-radius,0);border-end-start-radius:var(--table-focus-end-start-radius,0)}.content{padding-block:var(--table-details-padding-block);padding-inline:var(--table-details-padding-inline);overflow:hidden}:host([opening]) .content,:host([closing]) .content{min-block-size:0}:host([opening]) .cell{animation:table-details-open var(--luzmo-animation-duration) ease-out}:host([closing]) .cell{animation:table-details-close var(--luzmo-animation-duration) ease-in}@keyframes table-details-open{0%{opacity:0;grid-template-rows:0fr}}@keyframes table-details-close{to{opacity:0;grid-template-rows:0fr}}@media (prefers-reduced-motion:reduce){:host([opening]) .cell,:host([closing]) .cell{animation:none}}:host{--table-row-divider-color:var(--luzmo-border-color);--table-row-divider-width:var(--luzmo-border-width);--table-details-padding-block:var(--luzmo-spacing-4);--table-details-padding-inline:var(--luzmo-table-cell-padding-inline,var(--table-cell-padding-inline))}@media (forced-colors:active){:host{--highcontrast-table-row-divider-color:CanvasText;--highcontrast-table-details-focus-indicator-color:Highlight}}`;function R(e,t){return[...Array.isArray(e)?e:e?[e]:[],(0,o.unsafeCSS)(t)]}var z=class extends e.n{constructor(...e){super(...e),this.role=`row`,this.open=!1,this._phase=`closed`,this.reducedMotion=new i.r(this,`(prefers-reduced-motion: reduce)`),this.handleAnimationEnd=e=>{e.target===this.renderRoot.querySelector(`.cell`)&&(this._phase===`closing`?this._finishClosing():this._phase===`opening`&&(this._phase=`open`),this.requestUpdate())},this._finishClosing=()=>{this._phase===`closing`&&(window.clearTimeout(this._closeFallback),this._phase=`closed`,this.hidden=!0,this.dispatchEvent(new Event(`luzmo-table-details-collapsed`,{bubbles:!0,composed:!0})),this.requestUpdate())}}static get styles(){return R(super.styles,be)}disconnectedCallback(){window.clearTimeout(this._closeFallback),super.disconnectedCallback()}willUpdate(e){super.willUpdate(e),(e.has(`open`)||!this.hasUpdated)&&(this.open?(this.hidden=!1,this._phase=this.hasUpdated&&!this.reducedMotion.matches?`opening`:`open`):!this.hasUpdated||this.reducedMotion.matches||this._phase===`closed`?(this._phase=`closed`,this.hidden=!0):this._phase=`closing`)}render(){return o.html`
|
|
18
|
+
require("./tokens.cjs");const e=require("./decorate-SO02l0A6.cjs"),t=require("./sized-mixin-CSajkMro.cjs"),n=require("./roving-tabindex-BUFR8hPH.cjs"),r=require("./language-resolution-B7D3hQ6_.cjs"),i=require("./match-media-B_0cVVtk.cjs");require("./checkbox-NSSgVzJg.cjs");const a=require("./template-property-yhcAmPXk.cjs");let o=require("lit"),s=require("lit/decorators.js"),c=require("@luzmo/icons"),l=require("lit/directives/if-defined.js"),u=require("lit/directives/class-map.js"),d=require("lit/directives/style-map.js"),f=require("lit/directives/repeat.js"),p=require("@tanstack/table-core"),m=require("@tanstack/virtual-core");var h=`data-luzmo-table-announcer`,g,_=0,v=0,ee=()=>{let e=document.createElement(`div`);return e.setAttribute(h,``),e.setAttribute(`aria-live`,`polite`),e.setAttribute(`aria-atomic`,`true`),Object.assign(e.style,{position:`absolute`,inlineSize:`1px`,blockSize:`1px`,margin:`-1px`,padding:`0`,border:`0`,overflow:`hidden`,clipPath:`inset(50%)`,whiteSpace:`nowrap`}),e},te=class{constructor(e){e.addController(this)}announce(e){if(typeof document>`u`||!v)return;g??=ee(),g.isConnected||document.body.append(g);let t=g;t.textContent=``,cancelAnimationFrame(_),_=requestAnimationFrame(()=>{t.textContent=e})}hostConnected(){v+=1}hostDisconnected(){--v,v===0&&(cancelAnimationFrame(_),g?.remove(),g=void 0)}},y=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,b=e=>`luzmo-table-details-${[...e].map(e=>/^[A-Za-z0-9]$/.test(e)?e:`_${e.codePointAt(0).toString(16)}_`).join(``)}`,x=e=>y(e.minWidth)??(e.resizable?48:0),S=e=>y(e.maxWidth)??1e4,C=(e,t)=>Math.min(S(t),Math.max(x(t),Math.round(e))),ne=(e,t)=>{let n=y(t)??y(e.width);if(n!==void 0)return`${C(n,e)}px`;let r=y(e.minWidth)??(e.resizable?48:0),i=y(e.maxWidth);return i===void 0?r>0?`minmax(${r}px, 1fr)`:`minmax(0px, 1fr)`:`minmax(${r}px, ${i}px)`},re=(e,t,n)=>{let r=[];n.selects&&r.push(`var(--table-checkbox-cell-inline-size)`),n.expandable&&r.push(`var(--table-disclosure-cell-inline-size)`);for(let n of e)r.push(ne(n,y(t[n.id])));return r.join(` `)},w=(e,t)=>{let n=y(t)??y(e.width);return n===void 0?y(e.minWidth)??(e.resizable?48:0):C(n,e)},ie=(e,t,n)=>{let r=[];n.selects&&r.push(`var(--table-checkbox-cell-inline-size)`),n.expandable&&r.push(`var(--table-disclosure-cell-inline-size)`);let i=e.reduce((e,n)=>e+w(n,y(t[n.id])),0);return r.push(`${i}px`),`calc(${r.join(` + `)})`},ae=e=>({id:e.id,header:typeof e.header==`string`?e.header:e.id,width:y(e.width),minWidth:y(e.minWidth),maxWidth:y(e.maxWidth),resizable:e.resizable!==!1,lineClamp:y(e.lineClamp)}),oe=(e,t)=>{let n=e===`PageDown`||e===`PageUp`;switch(e){case`ArrowRight`:case`PageDown`:return{action:t?`increase`:`decrease`,amount:n?64:16};case`ArrowLeft`:case`PageUp`:return{action:t?`decrease`:`increase`,amount:n?64:16};case`Home`:return{action:`min`,amount:0};case`End`:return{action:`max`,amount:0};default:return}},se=(e,t,n)=>t.action===`min`?x(n):t.action===`max`?S(n):C(e+(t.action===`increase`?1:-1)*t.amount,n),T={selectAll:`Select All`,selectRow:`Select row {index}`,sortAscending:`Sorted by {column}, ascending`,sortDescending:`Sorted by {column}, descending`,expandRow:`Expand {label}`,collapseRow:`Collapse {label}`,resizeColumn:`Resize {column}`,columnWidth:`{column}, {width} pixels`},ce=e=>e.rowType===`information`||e._$rowType$===1,le=e=>e===`asc`?`ascending`:e===`desc`?`descending`:`none`,ue=e=>e===`asc`?`desc`:`asc`,E=(e={},t)=>{let n=Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`string`&&e!==``)),r={...T,...n};return t&&(r.selectAll=t),r},D=(e,t)=>{let n=e;for(let[e,r]of Object.entries(t))n=n.replaceAll(`{${e}}`,r);return n},de=(e,t)=>e.map((e,n)=>({item:e,value:t?t(e,n):String(n),index:n,information:ce(e)})),fe=(e,t)=>typeof e==`function`?e(t):e,pe=class{constructor(){this.records=[],this.sorting=[],this.manualSorting=!1,this.rowSelection={},this.selectedOrder=[],this.columns=[],this.table=(0,p.createTable)({data:[],columns:[],state:{},onStateChange:()=>{},renderFallbackValue:null,getCoreRowModel:(0,p.getCoreRowModel)(),getSortedRowModel:(0,p.getSortedRowModel)(),getRowId:e=>e.value,enableRowSelection:e=>!!this.selects&&!e.original.information,enableMultiRowSelection:()=>this.selects===`multiple`,onRowSelectionChange:e=>{this.pendingSelection=fe(e,this.rowSelection)}}),this.compare=(e,t)=>typeof e==`number`&&typeof t==`number`?e-t:(this.collator&&this.collatorLocale===this.locale||(this.collatorLocale=this.locale,this.collator=new Intl.Collator(this.locale,{numeric:!0,sensitivity:`base`})),this.collator.compare(String(e),String(t)))}setRecords(e){this.records=e}setSelected(e){this.selectedOrder=[...e],this.rowSelection=Object.fromEntries(e.map(e=>[e,!0]))}setSorting(e,t=!1){this.manualSorting=t,e?(this.columns.some(t=>t.id===e.key)||(this.columns=[...this.columns,this.createSortColumn(e.key)]),this.sorting=[{id:e.key,desc:e.direction===`desc`}]):this.sorting=[]}get rows(){this.sync();let e=this.table.getRowModel().rows.map(e=>e.original).filter(e=>!e.information);return e.length===this.records.length?e:this.records.map(t=>t.information?t:e.shift())}isSelected(e){return!!this.rowSelection[e]}get allSelected(){let e=this.selectableRecords;return e.length>0&&e.every(e=>this.isSelected(e.value))}get someSelected(){return this.selectableRecords.some(e=>this.isSelected(e.value))}toggle(e){this.sync();let t=this.findRow(e);if(t?.getCanSelect())return this.capture(()=>t.toggleSelected())}toggleAll(e){return this.sync(),this.capture(()=>this.table.toggleAllRowsSelected(e))}get selectableRecords(){return this.selects?this.records.filter(e=>!e.information):[]}findRow(e){return this.table.getCoreRowModel().rows.find(t=>t.original.value===e)}capture(e){this.pendingSelection=void 0,e();let t=this.pendingSelection??this.rowSelection;this.pendingSelection=void 0;let n=this.selectedOrder.filter(e=>t[e]),r=[...new Set([...this.records.map(e=>e.value),...Object.keys(t)])].filter(e=>t[e]&&!n.includes(e));return[...n,...r]}createSortColumn(e){return{id:e,accessorFn:t=>t.item[e],sortUndefined:`last`,sortingFn:(e,t,n)=>this.compare(e.getValue(n),t.getValue(n))}}sync(){this.table.setOptions(e=>({...e,data:this.records,columns:this.columns,manualSorting:this.manualSorting,state:{...this.table.initialState,sorting:this.sorting,rowSelection:this.rowSelection}}))}},me=new Set([`luzmo-table-cell`,`luzmo-table-head-cell`,`luzmo-table-checkbox-cell`]),O=e=>e.find(e=>e instanceof HTMLElement&&e.classList.contains(`resize-handle`)),k=class{constructor(e,t){this.handlePointerDown=e=>{if(!this.options.owns(e)||e.button!==0)return;let t=e.composedPath(),n=O(t),r=this.cellFromPath(t);if(!n||r?.localName!==`luzmo-table-head-cell`||!r.resizable)return;let i=r;e.preventDefault();let a=this.options.headCells().indexOf(i),o=i.toLayout(Math.max(a,0));this.drag={id:o.id,pointerId:e.pointerId,startWidth:i.getBoundingClientRect().width,startX:e.clientX};try{n.setPointerCapture(e.pointerId)}catch{}},this.handlePointerMove=e=>{let t=this.drag;if(!t||e.pointerId!==t.pointerId)return;let n=this.options.layouts().find(e=>e.id===t.id);if(!n)return;let r=(e.clientX-t.startX)*(this.options.isLTR()?1:-1);this.setColumnWidth(n,t.startWidth+r,!1)},this.handlePointerUp=e=>{let t=this.drag;if(!t||e.pointerId!==t.pointerId)return;let n=this.options.layouts().find(e=>e.id===t.id);if(this.drag=void 0,!n)return;let r=(e.clientX-t.startX)*(this.options.isLTR()?1:-1);this.setColumnWidth(n,t.startWidth+r,!0)},this.host=e,this.options=t,e.addController(this)}hostConnected(){this.host.addEventListener(`pointerdown`,this.handlePointerDown),this.host.addEventListener(`pointermove`,this.handlePointerMove),this.host.addEventListener(`pointerup`,this.handlePointerUp),this.host.addEventListener(`pointercancel`,this.handlePointerUp)}hostDisconnected(){this.host.removeEventListener(`pointerdown`,this.handlePointerDown),this.host.removeEventListener(`pointermove`,this.handlePointerMove),this.host.removeEventListener(`pointerup`,this.handlePointerUp),this.host.removeEventListener(`pointercancel`,this.handlePointerUp),this.drag=void 0}handleKeydown(e){if(e.defaultPrevented||!this.options.owns(e))return;let t=e.composedPath();if(!O(t))return;let n=oe(e.code,this.options.isLTR()),r=this.cellFromPath(t);n&&r?.localName===`luzmo-table-head-cell`&&(e.preventDefault(),e.stopPropagation(),this.resizeColumn(r,n))}resizeColumn(e,t){let n=this.options.headCells().indexOf(e),r=e.toLayout(Math.max(n,0)),i=e.currentWidth||Math.round(e.getBoundingClientRect().width);this.setColumnWidth(r,se(i,t,r),!0)}setColumnWidth(e,t,n){let r=C(t,e),i={...this.host.columnWidths,[e.id]:r};this.host.columnWidths=i;let a=this.options.headCells().find((t,n)=>t.toLayout(n).id===e.id);if(a&&(a.currentWidth=r),!n)return;let o=E(this.options.labels(),this.options.selectAllLabel());this.host.dispatchEvent(new CustomEvent(`luzmo-column-resized`,{bubbles:!0,composed:!0,detail:{columnId:e.id,width:r,columnWidths:{...i}}})),this.options.announce(D(o.columnWidth,{column:e.header,width:this.formatWidth(r)}))}formatWidth(e){let t=this.options.language();return this.widthFormatter&&this.formatterLanguage===t||(this.formatterLanguage=t,this.widthFormatter=new Intl.NumberFormat(t)),this.widthFormatter.format(e)}cellFromPath(e){return e.find(e=>e instanceof HTMLElement&&me.has(e.localName))}},he=`textarea, select, [contenteditable=""], [contenteditable="true"], input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"])`,ge=class extends n.t{constructor(e,{rows:t,isLTR:n,...r}){super(e,r),this.handleFocusout=e=>{let t=e.relatedTarget;t instanceof HTMLElement&&(this.elements.includes(t)||this.elements.some(e=>e.contains(t)))||queueMicrotask(()=>{this.activeGridCell()||this.hostNoLongerContainsFocus()})},this.handleKeydown=e=>{if(e.defaultPrevented||!this.acceptsEventCode(e.code)||!this.owns(e))return;let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.matches(he))return;let n=this.cellFromPath(e.composedPath());if(!n)return;let r=this.navigationTarget(n,e);r&&(e.preventDefault(),this.focusElement(r))},this.rows=t,this.isLTR=n}acceptsEventCode(e){return e===`ArrowLeft`||e===`ArrowRight`||e===`ArrowUp`||e===`ArrowDown`||e===`Home`||e===`End`}focusElement(e,t){let n=this.elements.indexOf(e);if(n===-1)return;let r=this.elements[this.currentIndex];r&&r!==e&&(r.tabIndex=-1),this.currentIndex=n,this.focus(t)}owns(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.localName===`luzmo-table`)return t===this.host;return!0}cellFromPath(e){let t=new Set(this.rows().flat());return e.find(e=>e instanceof HTMLElement&&t.has(e))}activeGridCell(){let e=this.host.ownerDocument.activeElement;for(;e instanceof HTMLElement&&e.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e instanceof HTMLElement&&this.rows().flat().includes(e)?e:void 0}navigationTarget(e,t){let n=this.rows(),r=n.findIndex(t=>t.includes(e));if(r===-1)return;let i=n[r].indexOf(e),a=n.length-1,o=(e,t)=>{let r=n[Math.min(Math.max(e,0),a)];return r[Math.min(Math.max(t,0),r.length-1)]},s=t=>{let i=n[Math.min(Math.max(t,0),a)];return this.cellForKey(i,this.columnKey(n[r],e))},c=this.isLTR()?1:-1,l=t.ctrlKey||t.metaKey;switch(t.code){case`ArrowRight`:return o(r,i+c);case`ArrowLeft`:return o(r,i-c);case`ArrowDown`:return s(r+1);case`ArrowUp`:return s(r-1);case`Home`:return o(l?0:r,0);case`End`:return l?o(a,n[a].length-1):o(r,n[r].length-1);default:return}}columnKey(e,t){if(t.classList.contains(`resize-handle`)){let n=e[e.indexOf(t)-1];return n?this.columnKey(e,n):`data:0`}if(t.localName===`luzmo-table-checkbox-cell`)return`select`;if(t.localName===`luzmo-table-disclosure-cell`)return`expand`;if(t.classList.contains(`cell`))return`details`;let n=e.filter(e=>e.localName===`luzmo-table-cell`||e.localName===`luzmo-table-head-cell`);return`data:${Math.max(n.indexOf(t),0)}`}cellForKey(e,t){return t===`expand`?e.find(e=>e.localName===`luzmo-table-disclosure-cell`)??this.cellForKey(e,`data:0`):t===`details`?this.cellForKey(e,`data:0`):e.find(n=>!n.classList.contains(`resize-handle`)&&this.columnKey(e,n)===t)??e[0]}},A=Symbol(`table-details-closing`),j=e=>{let t=e.nextElementSibling;return t?.localName===`luzmo-table-row-details`?t:null},M=e=>e instanceof HTMLElement,_e=class{constructor(e,t){this.closingDetails=new Set,this.handleDetailsCollapsed=e=>{if(!this.options.owns(e))return;let t=e.target,n=[...this.closingDetails].find(e=>b(e)===t?.id);if(!n)return;let r=new Set(this.closingDetails);r.delete(n),this.closingDetails=r,this.host.requestUpdate(A)},this.host=e,this.options=t,e.addController(this)}get closing(){return this.closingDetails}hostConnected(){this.host.addEventListener(`luzmo-table-details-collapsed`,this.handleDetailsCollapsed)}hostDisconnected(){this.host.removeEventListener(`luzmo-table-details-collapsed`,this.handleDetailsCollapsed)}clear(){this.closingDetails=new Set,this.host.requestUpdate(A)}toggle(e){if(!e.expandable&&!j(e))return;let t=this.isDataMode(),n=t?e.value:e.value||String(this.declarativeRows().indexOf(e)),r=t?!this.host.expanded.includes(n):!e.expanded;if(t){let e=this.host.expanded;this.setClosing(n,!r),this.host.expanded=r?[...e,n]:e.filter(e=>e!==n),this.dispatchToggle(n,r)||(this.host.expanded=e,this.setClosing(n,!1));return}if(e.expanded=r,!this.dispatchToggle(n,r)){e.expanded=!r;return}let i=j(e);i&&(i.open=r),e.disclosureLabel=this.expandLabel(n,e.checkboxLabel||e.querySelector(`:scope > luzmo-table-cell`)?.textContent?.trim()||n,this.declarativeRows().indexOf(e))}collapseFromPath(e){let t=e.find(e=>M(e)&&e.localName===`luzmo-table-row-details`),n=(t?.previousElementSibling?.localName===`luzmo-table-row`?t.previousElementSibling:void 0)??e.find(e=>M(e)&&e.localName===`luzmo-table-row`);if(!n?.expanded)return;this.toggle(n);let r=n.shadowRoot?.querySelector(`luzmo-table-disclosure-cell`);r&&this.options.focusDisclosure(r)}setClosing(e,t){let n=new Set([...this.closingDetails].filter(t=>t!==e));t&&n.add(e),this.closingDetails=n,this.host.requestUpdate(A)}dispatchToggle(e,t){return this.host.dispatchEvent(new CustomEvent(`luzmo-table-row-toggle`,{bubbles:!0,composed:!0,cancelable:!0,detail:{value:e,expanded:t}}))}expandLabel(e,t,n){let r=E(this.host.labels,this.host.selectAllLabel);return D(this.host.expanded.includes(e)||this.rowByValue(e)?.expanded?r.collapseRow:r.expandRow,{label:t,index:String(n+1)})}rowByValue(e){return this.rows().find(t=>t.value===e)}isDataMode(){return Array.isArray(this.host.items)}declarativeRows(){return[...this.host.querySelectorAll(`:scope > luzmo-table-body > luzmo-table-row`)]}rows(){return this.isDataMode()?[...this.host.shadowRoot?.querySelectorAll(`luzmo-table-row`)??[]]:this.declarativeRows()}},N=e=>e instanceof HTMLElement,P=class{constructor(e,t){this.handleBodyScroll=e=>{this.options.owns(e)&&e.composedPath().find(e=>N(e)&&e.localName===`luzmo-table-body`)&&this.host.requestUpdate()},this.host=e,this.options=t,e.addController(this)}hostConnected(){this.host.addEventListener(`luzmo-table-body-scroll`,this.handleBodyScroll)}hostDisconnected(){this.host.removeEventListener(`luzmo-table-body-scroll`,this.handleBodyScroll),this.bodyObserver?.disconnect(),this.observedBody=void 0}hostUpdated(){this.syncHeadScroll(),this.watchBodyScrollbar()}hasExpansion(){return this.isDataMode()?typeof this.host.renderDetails==`function`:this.declarativeRows().some(e=>e.nextElementSibling?.localName===`luzmo-table-row-details`)}layouts(){return this.isDataMode()&&!this.slottedHead()?this.host.columns.map(ae):this.headCells().map((e,t)=>e.toLayout(t))}headCells(){return[...this.head()?.querySelectorAll(`:scope > luzmo-table-head-cell`)??[]]}applyGridMetrics(){let e={selects:!!this.host.selects,expandable:this.hasExpansion()},t=this.layouts();this.host.style.setProperty(`--table-grid-columns`,re(t,this.host.columnWidths,e)||`none`),this.host.style.setProperty(`--table-min-inline-size`,ie(t,this.host.columnWidths,e))}syncPresentation(){this.syncHead(),this.syncColumns(),this.isDataMode()||this.syncDeclarativeRows()}syncHeadTabStops(){let e=this.head();if(!e)return;let t=e.shadowRoot?.querySelector(`luzmo-table-checkbox-cell`);t&&t.getAttribute(`aria-hidden`)!==`true`&&t.tabIndex!==0&&(t.tabIndex=0);for(let e of this.headCells())e.tabIndex!==0&&(e.tabIndex=0)}syncHead(){let e=this.body();e&&this.syncGridColumns(e);let t=this.head();if(!t)return;this.syncGridColumns(t),this.syncHeadScroll(e,t);let n=E(this.host.labels,this.host.selectAllLabel),r=this.options.model.allSelected,i=this.options.model.someSelected,a=this.host.selects===`multiple`;t.selects=this.host.selects,t.checked=a&&r,t.indeterminate=a&&i&&!r,t.selected=i,t.emphasized=this.host.emphasized,t.checkboxLabel=n.selectAll,t.checkboxSize=this.host.size,t.expandable=this.hasExpansion()}watchBodyScrollbar(){let e=this.body();e&&e!==this.observedBody&&(this.bodyObserver?.disconnect(),this.observedBody=e,this.bodyObserver??=new ResizeObserver(()=>{this.syncHeadScroll()}),this.bodyObserver.observe(e,{box:`content-box`}))}syncHeadScroll(e=this.body(),t=this.head()){if(!e||!t)return;let n=Math.max(0,e.offsetWidth-e.clientWidth),r=e.scrollWidth>e.clientWidth+1;t.style.paddingInlineEnd=n>0&&!r?`${n}px`:``,t.style.transform=`translateX(${-e.scrollLeft}px)`}syncColumns(){let e=this.layouts(),t=E(this.host.labels,this.host.selectAllLabel);this.headCells().forEach((n,r)=>{let i=e[r];if(!i)return;let a=n.textContent?.trim()||i.header;if(n.resizeLabel=D(t.resizeColumn,{column:a}),!n.resizable)return;let o=y(this.host.columnWidths[i.id])??i.width,s=Math.round(n.getBoundingClientRect().width),c=o??s;c>0&&n.currentWidth!==c&&(n.currentWidth=c)});for(let t of this.rows()){this.syncGridColumns(t);let n=j(t);n&&this.syncGridColumns(n),!t.spanAll&&[...t.children].filter(e=>N(e)&&e.localName===`luzmo-table-cell`).forEach((t,n)=>{let r=e[n]?.lineClamp;t.columnLineClamp!==r&&(t.columnLineClamp=r)})}}syncDeclarativeRows(){let e=this.host.selects,t=E(this.host.labels,this.host.selectAllLabel),n=this.hasExpansion(),r=this.declarativeRows();r.forEach((i,a)=>{this.syncGridColumns(i);let o=i.value||String(a),s=j(i),c=a===r.length-1;i.toggleAttribute(`data-last-row`,c),s&&(this.syncGridColumns(s),s.toggleAttribute(`data-last-row`,c));let l=i.querySelector(`:scope > luzmo-table-cell`)?.textContent?.trim()||o;i.selectable=!!e,i.selectionColumn=!!e,i.selected=!!e&&this.options.model.isSelected(o),i.selectsSingle=e===`single`,i.emphasized=this.host.emphasized,i.checkboxSize=this.host.size,i.checkboxLabel=l,i.expandable=!!s,i.expansionColumn=n&&!s,i.detailsId=s?.id??``,i.disclosureLabel=D(i.expanded?t.collapseRow:t.expandRow,{label:l,index:String(a+1)}),s&&(s.id||(s.id=b(o),i.detailsId=s.id),s.open=i.expanded)})}syncGridColumns(e){for(let t of[`--table-grid-columns`,`--table-min-inline-size`])e.style.setProperty(t,this.host.style.getPropertyValue(t))}isDataMode(){return Array.isArray(this.host.items)}slottedHead(){return this.host.querySelector(`:scope > luzmo-table-head`)}head(){return this.slottedHead()??(this.isDataMode()?this.host.shadowRoot?.querySelector(`luzmo-table-head`)??null:null)}body(){return this.isDataMode()?this.host.shadowRoot?.querySelector(`luzmo-table-body`)??null:this.host.querySelector(`:scope > luzmo-table-body`)}declarativeRows(){return[...this.host.querySelectorAll(`:scope > luzmo-table-body > luzmo-table-row`)]}rows(){return this.isDataMode()?[...this.host.shadowRoot?.querySelectorAll(`luzmo-table-row`)??[]]:this.declarativeRows()}},F=Symbol(`table-virtual-range-updated`),I=40,ve=4,L=e=>e.getBoundingClientRect().height,ye=class{constructor(e,t){this.connected=!1,this.keys=[],this.estimatedSize=I,this.host=e,this.options=t,e.addController(this)}get enabled(){return!!this.virtualizer}set enabled(e){e!==this.enabled&&(e?(this.virtualizer=new m.Virtualizer(this.createOptions()),this.connected&&(this.cleanup=this.virtualizer._didMount())):(this.cleanup?.(),this.cleanup=void 0,this.virtualizer=void 0,this.range=void 0))}sync(e){return this.virtualizer?(e!==this.keys&&(this.keys=e,this.virtualizer.setOptions(this.createOptions())),this.virtualizer.getVirtualItems()):[]}get totalSize(){return this.virtualizer?.getTotalSize()??0}scrollToIndex(e){this.virtualizer?.scrollToIndex(e,{align:`start`})}hostConnected(){this.connected=!0,this.virtualizer&&!this.cleanup&&(this.cleanup=this.virtualizer._didMount())}hostUpdated(){if(!this.virtualizer)return;this.virtualizer._willUpdate();let e=this.options.getRowElements();this.syncEstimate(e);for(let t of e)this.virtualizer.measureElement(t)}hostDisconnected(){this.connected=!1,this.cleanup?.(),this.cleanup=void 0}syncEstimate(e){let t=e.filter(e=>this.options.isRendered(e)).map(e=>L(e)).filter(Boolean).sort((e,t)=>e-t);if(t.length===0)return;let n=t[Math.floor(t.length/2)];Math.abs(n-this.estimatedSize)>=.5&&(this.estimatedSize=n,this.virtualizer?.measure())}createOptions(){return{count:this.keys.length,getScrollElement:this.options.getScrollElement,estimateSize:()=>this.estimatedSize,getItemKey:e=>this.keys[e]??e,overscan:ve,useAnimationFrameWithResizeObserver:!0,scrollToFn:m.elementScroll,observeElementRect:m.observeElementRect,observeElementOffset:m.observeElementOffset,measureElement:e=>this.options.isRendered(e)&&L(e)||this.estimatedSize,onChange:e=>{let t=this.reportRange(e);queueMicrotask(()=>{t?this.host.requestUpdate(F,!1):this.host.requestUpdate()})}}}reportRange(e){let t=e.range;if(!t||t.endIndex<t.startIndex)return!1;let n=t.startIndex,r=t.endIndex;return this.range?.first===n&&this.range.last===r?!1:(this.range={first:n,last:r},this.options.onRangeChanged({first:n,last:r}),!0)}},be=`:host{grid-template-columns:var(--table-grid-columns);min-inline-size:var(--table-min-inline-size,0);box-sizing:border-box;display:grid;overflow:hidden;border-block-start:none!important;border-inline:none!important;border-block-end-width:var(--table-row-divider-width)!important;border-block-end-style:solid!important;border-block-end-color:var(--highcontrast-table-row-divider-color,var(--luzmo-table-border-color,var(--table-row-divider-color)))!important}:host([data-last-row]){border-block-end-width:0!important}:host([hidden]){display:none!important}.cell{outline:none;grid-column:1/-1;grid-template-rows:1fr;min-inline-size:0;display:grid;overflow:hidden}:host([data-last-row]) .cell{--table-focus-end-start-radius:var(--table-corner-radius);--table-focus-end-end-radius:var(--table-corner-radius)}.cell:focus-visible{outline:var(--luzmo-indicator-width,2px) solid var(--highcontrast-table-details-focus-indicator-color,var(--luzmo-indicator-color,currentColor));outline-offset:calc(var(--luzmo-indicator-width,2px) * -1);border-start-start-radius:var(--table-focus-start-start-radius,0);border-start-end-radius:var(--table-focus-start-end-radius,0);border-end-end-radius:var(--table-focus-end-end-radius,0);border-end-start-radius:var(--table-focus-end-start-radius,0)}.content{padding-block:var(--table-details-padding-block);padding-inline:var(--table-details-padding-inline);overflow:hidden}:host([opening]) .content,:host([closing]) .content{min-block-size:0}:host([opening]) .cell{animation:table-details-open var(--luzmo-animation-duration) ease-out}:host([closing]) .cell{animation:table-details-close var(--luzmo-animation-duration) ease-in}@keyframes table-details-open{0%{opacity:0;grid-template-rows:0fr}}@keyframes table-details-close{to{opacity:0;grid-template-rows:0fr}}@media (prefers-reduced-motion:reduce){:host([opening]) .cell,:host([closing]) .cell{animation:none}}:host{--table-row-divider-color:var(--luzmo-border-color);--table-row-divider-width:var(--luzmo-border-width);--table-details-padding-block:var(--luzmo-spacing-4);--table-details-padding-inline:var(--luzmo-table-cell-padding-inline,var(--table-cell-padding-inline))}@media (forced-colors:active){:host{--highcontrast-table-row-divider-color:CanvasText;--highcontrast-table-details-focus-indicator-color:Highlight}}`;function R(e,t){return[...Array.isArray(e)?e:e?[e]:[],(0,o.unsafeCSS)(t)]}var z=class extends e.n{constructor(...e){super(...e),this.role=`row`,this.open=!1,this._phase=`closed`,this.reducedMotion=new i.r(this,`(prefers-reduced-motion: reduce)`),this.handleAnimationEnd=e=>{e.target===this.renderRoot.querySelector(`.cell`)&&(this._phase===`closing`?this._finishClosing():this._phase===`opening`&&(this._phase=`open`),this.requestUpdate())},this._finishClosing=()=>{this._phase===`closing`&&(window.clearTimeout(this._closeFallback),this._phase=`closed`,this.hidden=!0,this.dispatchEvent(new Event(`luzmo-table-details-collapsed`,{bubbles:!0,composed:!0})),this.requestUpdate())}}static get styles(){return R(super.styles,be)}disconnectedCallback(){window.clearTimeout(this._closeFallback),super.disconnectedCallback()}willUpdate(e){super.willUpdate(e),(e.has(`open`)||!this.hasUpdated)&&(this.open?(this.hidden=!1,this._phase=this.hasUpdated&&!this.reducedMotion.matches?`opening`:`open`):!this.hasUpdated||this.reducedMotion.matches||this._phase===`closed`?(this._phase=`closed`,this.hidden=!0):this._phase=`closing`)}render(){return o.html`
|
|
19
19
|
<div
|
|
20
20
|
class="cell"
|
|
21
21
|
role="gridcell"
|
|
@@ -21,7 +21,7 @@ import { n } from "./sized-mixin-BmxIAuoH.js";
|
|
|
21
21
|
import { t as r } from "./roving-tabindex-BKMkfzY0.js";
|
|
22
22
|
import { r as i, t as a } from "./language-resolution-7rc0khIK.js";
|
|
23
23
|
import { r as o } from "./match-media-UNh23w4s.js";
|
|
24
|
-
import "./checkbox-
|
|
24
|
+
import "./checkbox-fW7WI915.js";
|
|
25
25
|
import { n as s } from "./template-property-Bks4Db5C.js";
|
|
26
26
|
import { html as c, nothing as l, unsafeCSS as u } from "lit";
|
|
27
27
|
import { property as d, query as f, state as p } from "lit/decorators.js";
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../tokens.cjs");const e=require("../text-field-
|
|
18
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../tokens.cjs");const e=require("../text-field-DwvDSctG.cjs"),t=require("../text-field-CZixBD87.cjs");exports.LuzmoHelpText=t.t,exports.LuzmoTextField=e.t;
|
|
@@ -16,6 +16,6 @@
|
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
18
|
import "../tokens.js";
|
|
19
|
-
import { t as e } from "../text-field-
|
|
20
|
-
import { t } from "../text-field-
|
|
19
|
+
import { t as e } from "../text-field-CBsx1CVo.js";
|
|
20
|
+
import { t } from "../text-field-SNbvQYOj.js";
|
|
21
21
|
export { t as LuzmoHelpText, e as LuzmoTextField };
|
|
@@ -22,7 +22,7 @@ import { t as r } from "./manage-help-text-CFUaqINN.js";
|
|
|
22
22
|
import { t as i } from "./text-field.module-hEHhPVFf.js";
|
|
23
23
|
import { html as a, nothing as o, unsafeCSS as s } from "lit";
|
|
24
24
|
import { property as c, query as l, state as u } from "lit/decorators.js";
|
|
25
|
-
import { luzmoAlert as d,
|
|
25
|
+
import { luzmoAlert as d, luzmoCheckHeavy as f, luzmoIcon as p } from "@luzmo/icons";
|
|
26
26
|
import { ifDefined as m } from "lit/directives/if-defined.js";
|
|
27
27
|
import { live as h } from "lit/directives/live.js";
|
|
28
28
|
// src/components/text-field/text-field.ts
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
require("./tokens.cjs");const e=require("./decorate-SO02l0A6.cjs"),t=require("./sized-mixin-CSajkMro.cjs"),n=require("./text-field-
|
|
18
|
+
require("./tokens.cjs");const e=require("./decorate-SO02l0A6.cjs"),t=require("./sized-mixin-CSajkMro.cjs"),n=require("./text-field-DwvDSctG.cjs");let r=require("lit"),i=require("lit/decorators.js"),a=require("@luzmo/icons");var o=`@media (forced-colors:active){:host{--highcontrast-helptext-content-color-default:CanvasText;--highcontrast-helptext-icon-color-default:CanvasText}:host,.text,.icon{forced-color-adjust:none}}:host{--helptext-bottom-to-workflow-icon:3px;color:var(--highcontrast-helptext-content-color-default,var(--luzmo-helptext-content-color-default,var(--helptext-content-color-default)));font-family:var(--luzmo-helptext-font-family,var(--luzmo-font-family));font-weight:var(--luzmo-helptext-font-weight,var(--luzmo-font-weight));font-size:var(--luzmo-helptext-font-size,var(--helptext-font-size,var(--luzmo-font-size-s)));min-block-size:var(--luzmo-helptext-min-height,var(--helptext-min-height,24px));display:flex}.icon{block-size:var(--luzmo-helptext-icon-size,var(--helptext-icon-size,18px));inline-size:var(--luzmo-helptext-icon-size,var(--helptext-icon-size,18px));flex-shrink:0;margin-inline-end:var(--luzmo-helptext-text-to-visual,var(--helptext-text-to-visual,7px));padding-block-start:var(--luzmo-helptext-top-to-workflow-icon,var(--helptext-top-to-workflow-icon,3px));padding-block-end:var(--luzmo-helptext-bottom-to-workflow-icon,var(--helptext-bottom-to-workflow-icon,3px))}.text{line-height:var(--luzmo-helptext-line-height,var(--helptext-line-height,1.3));padding-block-start:var(--luzmo-helptext-top-to-text,var(--helptext-top-to-text,4px));padding-block-end:var(--luzmo-helptext-bottom-to-text,var(--helptext-bottom-to-text,5px))}:host(:lang(ja)) .text,:host(:lang(ko)) .text,:host(:lang(zh)) .text{line-height:var(--luzmo-helptext-line-height-cjk,var(--helptext-line-height-cjk,1.4))}:host([variant=neutral]) .text{color:var(--highcontrast-helptext-content-color-default,var(--luzmo-helptext-content-color-default,var(--helptext-content-color-default)))}:host([variant=neutral]) .icon{color:var(--highcontrast-helptext-icon-color-default,var(--luzmo-helptext-icon-color-default,var(--helptext-icon-color-default)))}:host([variant=negative]) .text{color:var(--highcontrast-helptext-content-color-default,var(--luzmo-helptext-content-color-default,var(--luzmo-negative-color-down)))}:host([variant=negative]) .icon{color:var(--highcontrast-helptext-icon-color-default,var(--luzmo-helptext-icon-color-default,var(--helptext-icon-color-default)))}:host([disabled]) .text{color:var(--highcontrast-helptext-content-color-default,var(--luzmo-helptext-content-color-default,var(--luzmo-font-color)))}:host([disabled]) .icon{color:var(--highcontrast-helptext-icon-color-default,var(--luzmo-helptext-icon-color-default,var(--helptext-icon-color-default)))}:host{--helptext-line-height:1.3;--helptext-content-color-default:var(--luzmo-font-color);--helptext-icon-color-default:var(--luzmo-font-color);--helptext-disabled-content-color:var(--luzmo-font-color-disabled)}:host([variant=neutral]){--helptext-content-color-default:var(--luzmo-font-color);--helptext-icon-color-default:var(--luzmo-font-color)}:host([variant=negative]){--helptext-content-color-default:var(--luzmo-negative-color);--helptext-icon-color-default:var(--luzmo-negative-color)}:host([disabled]){--helptext-content-color-default:var(--luzmo-font-color-disabled);--helptext-icon-color-default:var(--luzmo-font-color-disabled)}:host(:lang(ja)),:host(:lang(zh)),:host(:lang(ko)){--helptext-line-height-cjk:1.4}:host([size=s]){--helptext-min-height:24px;--helptext-icon-size:16px;--helptext-font-size:12px;--helptext-text-to-visual:7px;--helptext-top-to-workflow-icon:4px;--helptext-top-to-text:4px;--helptext-bottom-to-text:5px}:host{--helptext-min-height:24px;--helptext-icon-size:18px;--helptext-font-size:12px;--helptext-text-to-visual:7px;--helptext-top-to-workflow-icon:3px;--helptext-top-to-text:4px;--helptext-bottom-to-text:5px}:host([size=l]){--helptext-min-height:32px;--helptext-icon-size:20px;--helptext-font-size:14px;--helptext-text-to-visual:8px;--helptext-top-to-workflow-icon:6px;--helptext-top-to-text:6px;--helptext-bottom-to-text:5px}:host([size=xl]){--helptext-min-height:40px;--helptext-icon-size:22px;--helptext-font-size:16px;--helptext-text-to-visual:9px;--helptext-top-to-workflow-icon:9px;--helptext-top-to-text:9px;--helptext-bottom-to-text:12px}`,s=class extends t.n(e.n,{noDefaultSize:!0}){constructor(...e){super(...e),this.icon=!1,this.variant=`neutral`}static get styles(){return[(0,r.unsafeCSS)(o)]}render(){return r.html`
|
|
19
19
|
${this.variant===`negative`&&this.icon?r.html` ${(0,a.luzmoIcon)(a.luzmoClose14)} `:r.nothing}
|
|
20
20
|
<div class="text"><slot></slot></div>
|
|
21
21
|
`}};e.t([(0,i.property)({type:Boolean,reflect:!0})],s.prototype,`icon`,void 0),e.t([(0,i.property)({reflect:!0})],s.prototype,`variant`,void 0),customElements.get(`luzmo-text-field`)||customElements.define(`luzmo-text-field`,n.t),customElements.get(`luzmo-help-text`)||customElements.define(`luzmo-help-text`,s),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
const e=require("./decorate-SO02l0A6.cjs"),t=require("./sized-mixin-CSajkMro.cjs"),n=require("./focusable-BIHTrJd6.cjs"),r=require("./manage-help-text-DtFJsl0k.cjs"),i=require("./text-field.module-l8CaTCwE.cjs");let a=require("lit"),o=require("lit/decorators.js"),s=require("@luzmo/icons"),c=require("lit/directives/if-defined.js"),l=require("lit/directives/live.js");var u=[`text`,`url`,`tel`,`email`,`password`],d=class extends r.t(t.n(n.t,{noDefaultSize:!0})){constructor(...e){super(...e),this.allowedKeys=``,this.focused=!1,this.invalid=!1,this.label=``,this.placeholder=``,this._type=`text`,this.grows=!1,this.maxlength=-1,this.minlength=-1,this.multiline=!1,this.readonly=!1,this.rows=-1,this.maxRows=-1,this.valid=!1,this.hideValidationIcons=!1,this._value=``,this.quiet=!1,this.required=!1}static get styles(){return[(0,a.unsafeCSS)(i.t)]}applyFocusElementLabel(e){this.appliedLabel=e}set type(e){let t=this._type;this._type=e,this.requestUpdate(`type`,t)}get type(){return u.find(e=>e===this._type)??`text`}set value(e){if(e===this.value)return;let t=this._value;this._value=e,this.requestUpdate(`value`,t)}get value(){return this._value}get focusElement(){return this.inputElement}setSelectionRange(e,t,n=`none`){this.inputElement.setSelectionRange(e,t,n)}select(){this.inputElement.select()}handleInput(e){if(this.allowedKeys&&this.inputElement.value&&!RegExp(`^[${this.allowedKeys}]*$`,`u`).test(this.inputElement.value)){let e=this.inputElement.selectionStart-1;this.inputElement.value=this.value.toString(),this.inputElement.setSelectionRange(e,e)}else this.value=this.inputElement.value}handleChange(){this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0}))}onFocus(){this.focused=!this.readonly&&!0}onBlur(e){this.focused=!this.readonly&&!1}handleInputElementPointerdown(){}renderStateIcons(){return this.hideValidationIcons?a.nothing:this.invalid?a.html`
|
|
19
19
|
<div id="invalid" class="icon">${(0,s.luzmoIcon)(s.luzmoAlert)}</div>
|
|
20
20
|
`:this.valid?a.html`
|
|
21
|
-
<div id="valid" class="icon">${(0,s.luzmoIcon)(s.
|
|
21
|
+
<div id="valid" class="icon">${(0,s.luzmoIcon)(s.luzmoCheckHeavy)}</div>
|
|
22
22
|
`:a.nothing}get displayValue(){return this.value.toString()}calculateMaxHeight(){if(this.maxRows<1||!this.multiline||!this.grows||!this.inputElement)return;let e=window.getComputedStyle(this.inputElement),t=Number.parseFloat(e.lineHeight),n=Number.parseFloat(e.paddingTop),r=Number.parseFloat(e.paddingBottom),i=Number.parseFloat(e.borderTopWidth),a=Number.parseFloat(e.borderBottomWidth),o=Number.parseFloat(e.fontSize),s=Number.isNaN(t)||t===0?o*1.2:t;return this.maxRows*s+n+r+i+a}get renderMultiline(){let e=``;return this.calculatedMaxHeight!==void 0&&(e=`max-height: ${this.calculatedMaxHeight}px;`),a.html`
|
|
23
23
|
${this.multiline&&this.grows?a.html`
|
|
24
24
|
<div id="sizer" class="input" aria-hidden="true" style=${e}>${this.value}​
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import "./tokens.js";
|
|
19
19
|
import { n as e, t } from "./decorate-CpKsOs9z.js";
|
|
20
20
|
import { n } from "./sized-mixin-BmxIAuoH.js";
|
|
21
|
-
import { t as r } from "./text-field-
|
|
21
|
+
import { t as r } from "./text-field-CBsx1CVo.js";
|
|
22
22
|
import { html as i, nothing as a, unsafeCSS as o } from "lit";
|
|
23
23
|
import { property as s } from "lit/decorators.js";
|
|
24
24
|
import { luzmoClose14 as c, luzmoIcon as l } from "@luzmo/icons";
|
package/components/utils.cjs
CHANGED
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./decorate-SO02l0A6.cjs"),t=require("./sized-mixin-CSajkMro.cjs"),n=require("./focus-visible-BQAhwoxi.cjs"),r=require("./focusable-BIHTrJd6.cjs"),i=require("./platform-BAjeJp2W.cjs"),a=require("./streaming-listener-BzGZUHkj.cjs"),o=require("./
|
|
18
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./decorate-SO02l0A6.cjs"),t=require("./sized-mixin-CSajkMro.cjs"),n=require("./focus-visible-BQAhwoxi.cjs"),r=require("./focusable-BIHTrJd6.cjs"),i=require("./platform-BAjeJp2W.cjs"),a=require("./streaming-listener-BzGZUHkj.cjs"),o=require("./template-property-yhcAmPXk.cjs"),s=require("./voice-recorder-B1tBrGTV.cjs");exports.ElementSizes=t.t,exports.FocusVisiblePolyfillMixin=n.t,exports.Focusable=r.t,exports.LuzmoElement=e.n,exports.LuzmoMixin=e.r,exports.SizedMixin=t.n,exports.VoiceRecorder=s.t,exports.createTemplateRenderer=o.t,exports.isAndroid=i.t,exports.isAppleDevice=i.n,exports.isChrome=i.r,exports.isFirefox=i.i,exports.isIOS=i.a,exports.isIPad=i.o,exports.isIPhone=i.s,exports.isMac=i.c,exports.isSeamonkey=i.l,exports.isWebKit=i.u,exports.streamingListener=a.t,exports.templateProperty=o.n;
|
package/components/utils.js
CHANGED
|
@@ -21,6 +21,6 @@ import { t as i } from "./focus-visible-D6TRtUd7.js";
|
|
|
21
21
|
import { t as a } from "./focusable-xjv79E40.js";
|
|
22
22
|
import { a as o, c as s, i as c, l, n as u, o as d, r as f, s as p, t as m, u as h } from "./platform-CDW-WdXN.js";
|
|
23
23
|
import { t as g } from "./streaming-listener-DyS3scAi.js";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
export { r as ElementSizes, i as FocusVisiblePolyfillMixin, a as Focusable, e as LuzmoElement, t as LuzmoMixin, n as SizedMixin,
|
|
24
|
+
import { n as _, t as v } from "./template-property-Bks4Db5C.js";
|
|
25
|
+
import { t as y } from "./voice-recorder-BXY_l_78.js";
|
|
26
|
+
export { r as ElementSizes, i as FocusVisiblePolyfillMixin, a as Focusable, e as LuzmoElement, t as LuzmoMixin, n as SizedMixin, y as VoiceRecorder, v as createTemplateRenderer, m as isAndroid, u as isAppleDevice, f as isChrome, c as isFirefox, o as isIOS, d as isIPad, p as isIPhone, s as isMac, l as isSeamonkey, h as isWebKit, g as streamingListener, _ as templateProperty };
|