@luzmo/lucero 2.6.1 → 2.7.1
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/index.cjs +1 -1
- package/components/index.js +16 -16
- 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-BrpagtL6.js → options-BiA2h1-i.js} +94 -74
- package/components/question-box/index.cjs +1 -1
- package/components/question-box/index.js +1 -1
- package/components/question-box/question-box.d.ts +4 -1
- package/components/{question-box-BAyRPZ8j.js → question-box-CxzEveid.js} +148 -144
- package/components/question-box-DmTWFlRn.cjs +401 -0
- 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-BWTeIJdP.js → select-8gtm46qA.js} +82 -76
- package/components/select-ChM3Zfxd.cjs +159 -0
- package/components/utils.cjs +1 -1
- package/components/utils.js +3 -3
- package/custom-elements.json +1 -1
- package/package.json +1 -1
- package/standalone/chunks/options-CPaX-OWy.js +94 -0
- package/standalone/manifest.json +1 -1
- package/standalone/options.js +1 -1
- package/standalone/question-box.js +52 -52
- package/standalone/select.js +10 -9
- package/standalone/utils.js +1 -1
- package/components/options-DE7SelUz.cjs +0 -105
- package/components/question-box-D7s2xNAD.cjs +0 -401
- package/components/select-Ch8KCcDr.cjs +0 -158
- package/standalone/chunks/options-CMRXQfIE.js +0 -89
|
@@ -30,11 +30,12 @@ import "./text-field-SNbvQYOj.js";
|
|
|
30
30
|
import "./radio-CyxICbLM.js";
|
|
31
31
|
import { html as a, nothing as o, unsafeCSS as s } from "lit";
|
|
32
32
|
import { property as c, query as l, state as u } from "lit/decorators.js";
|
|
33
|
-
import { luzmoAngleLeft as d, luzmoAngleRight as
|
|
34
|
-
import { ifDefined as
|
|
35
|
-
import { repeat as
|
|
33
|
+
import { luzmoAngleLeft as d, luzmoAngleRight as ee, luzmoPencil as f } from "@luzmo/icons";
|
|
34
|
+
import { ifDefined as p } from "lit/directives/if-defined.js";
|
|
35
|
+
import { repeat as m } from "lit/directives/repeat.js";
|
|
36
|
+
import { keyed as te } from "lit/directives/keyed.js";
|
|
36
37
|
// src/components/question-box/question-box.module.scss?inline
|
|
37
|
-
var g = ":host{font-family:var(--question-box-font-family);font-size:var(--question-box-font-size);color:var(--highcontrast-question-box-color,var(--question-box-color));box-sizing:border-box;inline-size:100%;max-inline-size:var(--luzmo-question-box-max-inline-size,var(--question-box-max-inline-size));display:block}:host([disabled]){pointer-events:none}.card{gap:var(--question-box-gap);padding:var(--question-box-padding);box-sizing:border-box;border-width:var(--question-box-border-width);border-style:solid;border-color:var(--highcontrast-question-box-border-color,var(--question-box-border-color));border-radius:var(--question-box-border-radius);background-color:var(--highcontrast-question-box-background-color,var(--question-box-background-color));flex-direction:column;display:flex}.header{justify-content:space-between;align-items:flex-start;gap:var(--question-box-header-gap);display:flex}.header-actions,.step-navigation{align-items:center;display:flex}.header-actions{gap:var(--question-box-header-actions-gap);min-block-size:0;block-size:max(var(--question-box-title-font-size) * var(--question-box-title-line-height), var(--question-box-header-control-size) - 2 * (var(--question-box-padding) - var(--question-box-header-actions-inset)));flex-shrink:0;margin-inline-start:auto;overflow:visible}.step-navigation{gap:var(--question-box-copy-gap)}.heading{gap:var(--question-box-heading-copy-gap);flex-direction:column;min-inline-size:0;display:flex}.progress{font-size:var(--question-box-progress-font-size);color:var(--question-box-muted-color);margin:0}.title{font-size:var(--question-box-title-font-size);font-weight:var(--luzmo-font-weight-bold);line-height:var(--question-box-title-line-height);margin:0}.title:focus,.summary-heading:focus{outline:none}.title:focus-visible,.summary-heading:focus-visible{-webkit-text-decoration-color:var(--question-box-focus-ring-color);text-decoration-color:var(--question-box-focus-ring-color);text-decoration-line:underline;text-decoration-thickness:var(--question-box-focus-ring-width);text-underline-offset:var(--question-box-focus-ring-gap);outline:none}.description{color:var(--question-box-muted-color);font-size:inherit;margin:0;margin-block-start:var(--question-box-heading-copy-offset);line-height:1.4}.close{flex-shrink:0}.body{gap:var(--question-box-option-gap);max-block-size:var(--luzmo-question-box-body-max-block-size,var(--question-box-body-max-block-size));padding-block:var(--question-box-body-focus-inset);margin-block:calc(var(--question-box-body-focus-inset) * -1);flex-direction:column;display:flex;overflow:hidden auto}.body::-webkit-scrollbar{width:var(--luzmo-question-box-scrollbar-width,var(--question-box-scrollbar-width));height:var(--luzmo-question-box-scrollbar-width,var(--question-box-scrollbar-width))}.body::-webkit-scrollbar-track{background:var(--luzmo-question-box-scrollbar-track-background,var(--question-box-scrollbar-track-background));border-radius:var(--luzmo-question-box-scrollbar-track-border-radius,var(--question-box-scrollbar-track-border-radius))}.body::-webkit-scrollbar-thumb{background:var(--luzmo-question-box-scrollbar-thumb-background,var(--question-box-scrollbar-thumb-background));border-radius:var(--luzmo-question-box-scrollbar-thumb-border-radius,var(--question-box-scrollbar-thumb-border-radius))}.body::-webkit-scrollbar-thumb:hover{background:var(--luzmo-question-box-scrollbar-thumb-hover-background,var(--question-box-scrollbar-thumb-hover-background))}.body{scrollbar-width:var(--luzmo-scrollbar-width,thin);scrollbar-color:var(--luzmo-question-box-scrollbar-thumb-background,var(--question-box-scrollbar-thumb-background)) var(--luzmo-question-box-scrollbar-track-background,var(--question-box-scrollbar-track-background))}.options{box-sizing:border-box;flex-direction:column;inline-size:100%;min-inline-size:0;display:flex}.options--descriptive luzmo-radio,.options--descriptive luzmo-checkbox,.options--descriptive .other-option-answer{padding-block:var(--luzmo-question-box-descriptive-option-padding-block,var(--question-box-descriptive-option-padding-block))}.body:has(.options--descriptive){margin-block:calc(var(--question-box-option-padding-block) - var(--question-box-body-focus-inset) - var(--luzmo-question-box-descriptive-option-padding-block,var(--question-box-descriptive-option-padding-block)))}luzmo-radio,luzmo-checkbox{box-sizing:border-box;inline-size:100%;min-block-size:var(--question-box-option-min-block-size);padding-block:var(--question-box-option-padding-block);padding-inline:var(--question-box-option-padding-inline);border-block-end-width:var(--luzmo-question-box-divider-width,var(--question-box-divider-width));border-block-end-style:solid;border-block-end-color:var(--luzmo-question-box-divider-color,var(--question-box-divider-color));border-radius:var(--luzmo-border-radius-s);align-items:center;display:flex}luzmo-radio:hover,luzmo-checkbox:hover{background-color:var(--question-box-option-hover-background)}.other-option-row{align-items:center;gap:var(--question-box-option-gap);box-sizing:border-box;border-block-end-width:var(--luzmo-question-box-divider-width,var(--question-box-divider-width));border-block-end-style:solid;border-block-end-color:var(--luzmo-question-box-divider-color,var(--question-box-divider-color));inline-size:100%;max-inline-size:100%;display:flex}.other-option-answer{align-items:center;gap:var(--question-box-option-gap);box-sizing:border-box;min-inline-size:0;min-block-size:var(--question-box-option-min-block-size);padding-block:var(--question-box-option-padding-block);padding-inline:var(--question-box-option-padding-inline);border-radius:var(--luzmo-border-radius-s);flex:1;display:flex}.other-option-answer:hover{background-color:var(--question-box-option-hover-background)}luzmo-radio.other-option,luzmo-checkbox.other-option{border:0;flex:none;min-block-size:auto;inline-size:auto;padding:0}luzmo-radio.other-option{--luzmo-radio-button-top-to-control:0px}luzmo-radio.numbered-option{--luzmo-radio-button-control-size:0px;--luzmo-radio-button-top-to-control:0px;--luzmo-radio-text-to-control:0px;--luzmo-radio-border-width:0px;--luzmo-radio-focus-indicator-width:0px}luzmo-checkbox.numbered-option{--luzmo-checkbox-control-size:0px;--luzmo-checkbox-text-to-control:0px;--luzmo-checkbox-top-to-text:0px;--luzmo-checkbox-border-width:0px;--luzmo-checkbox-selected-border-width:0px;--luzmo-checkbox-focus-indicator-width:0px}luzmo-radio.numbered-option::part(control),luzmo-checkbox.numbered-option::part(control){display:none}luzmo-radio.other-option:hover,luzmo-checkbox.other-option:hover{background-color:#0000}.other-field{inline-size:auto;min-inline-size:0;max-inline-size:100%;min-block-size:var(--question-box-other-field-min-block-size);font-size:var(--question-box-other-field-font-size);--luzmo-text-field-width:100%;--luzmo-text-field-height:var(--question-box-other-field-min-block-size);--luzmo-text-field-background-color:transparent;--luzmo-text-field-background-color-disabled:transparent;--luzmo-text-field-placeholder-font-size:var(--question-box-other-field-font-size);--luzmo-text-field-border-width:0px;--luzmo-text-field-spacing-inline:0px;--luzmo-text-field-spacing-block-start:0px;--luzmo-text-field-spacing-block-end:0px;flex:1;justify-content:center}.other-primary{flex:none}.other-actions{box-sizing:border-box;justify-content:flex-end;align-items:center;gap:var(--question-box-copy-gap-detailed);inline-size:100%;padding-inline:var(--question-box-option-padding-inline);margin-block-start:var(--question-box-copy-gap-detailed);display:flex}.selected-count{font-size:var(--luzmo-question-box-selected-count-font-size,var(--question-box-selected-count-font-size))}.other-actions .selected-count{min-inline-size:0;margin-inline-end:auto}.other-actions luzmo-button{flex:none}.status-error{--luzmo-helptext-font-size:var(--luzmo-question-box-selected-count-font-size,var(--question-box-selected-count-font-size));--luzmo-helptext-min-height:0;--luzmo-helptext-top-to-text:0;--luzmo-helptext-bottom-to-text:0}.visually-hidden{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.option-content{align-items:flex-start;gap:var(--question-box-option-gap);inline-size:100%;display:flex}.option-number{forced-color-adjust:none;inline-size:var(--question-box-option-number-size);block-size:var(--question-box-option-number-size);box-sizing:border-box;border:var(--luzmo-border-width) solid var(--highcontrast-question-box-option-number-border-color,var(--question-box-option-number-border-color));border-radius:var(--luzmo-border-radius);color:var(--highcontrast-question-box-option-number-color,var(--question-box-option-number-color));background-color:var(--highcontrast-question-box-option-number-background,var(--question-box-option-number-background));transition:color var(--luzmo-animation-duration) ease-in-out, border-color var(--luzmo-animation-duration) ease-in-out, background-color var(--luzmo-animation-duration) ease-in-out;flex:none;justify-content:center;align-items:center;line-height:1;display:inline-flex}luzmo-radio[checked] .option-number,luzmo-checkbox[checked] .option-number{color:var(--highcontrast-question-box-option-number-selected-color,var(--question-box-option-number-selected-color));border-color:var(--highcontrast-question-box-option-number-selected-background,var(--question-box-option-number-selected-background));background-color:var(--highcontrast-question-box-option-number-selected-background,var(--question-box-option-number-selected-background))}luzmo-radio[data-focus-visible] .option-number,luzmo-checkbox[data-focus-visible] .option-number,.option-number--focused{outline:var(--luzmo-question-box-focus-ring-width,var(--question-box-focus-ring-width)) solid var(--highcontrast-question-box-focus-ring-color,var(--luzmo-question-box-focus-ring-color,var(--question-box-focus-ring-color)));outline-offset:var(--luzmo-question-box-focus-ring-gap,var(--question-box-focus-ring-gap))}luzmo-radio[disabled] .option-number,luzmo-checkbox[disabled] .option-number{opacity:.5}.option-copy{gap:var(--question-box-copy-gap);flex-direction:column;flex:1;min-inline-size:0;display:flex}.option-edit luzmo-icon{color:inherit}.option-heading{align-items:center;gap:var(--question-box-recommended-gap);min-block-size:var(--question-box-option-number-size);flex-wrap:wrap;display:flex}.option-text{align-items:baseline;gap:var(--question-box-recommended-gap);flex-wrap:wrap;min-inline-size:0;display:flex}.option-description{color:var(--question-box-muted-color);line-height:1.4}.option-hint{color:var(--question-box-muted-color);font-size:var(--luzmo-font-size-s)}.footer{justify-content:space-between;align-items:center;gap:var(--question-box-option-gap);flex-wrap:wrap;display:flex}.status{color:var(--question-box-muted-color);font-size:var(--luzmo-question-box-selected-count-font-size,var(--question-box-selected-count-font-size))}.actions{justify-content:flex-end;gap:var(--question-box-recommended-gap);flex-wrap:wrap;margin-inline-start:auto;display:flex}:host([dir=rtl]) .step-navigation luzmo-icon{transform:scaleX(-1)}.resolved{gap:var(--question-box-summary-gap)}.summary-actions{justify-content:flex-end;gap:var(--question-box-recommended-gap);flex-wrap:wrap;display:flex}.summary{gap:var(--question-box-option-gap);flex-direction:column;display:flex}.summary-heading{font-size:var(--question-box-title-font-size);line-height:var(--question-box-title-line-height);margin:0}.summary-row{gap:var(--question-box-copy-gap);flex-direction:column;display:flex}.summary-title{color:var(--question-box-muted-color);font-size:var(--luzmo-font-size-s)}.summary-answer{font-weight:var(--luzmo-font-weight-bold)}@media (prefers-reduced-motion:reduce){.option-number{transition-duration:0s}}@media (forced-colors:active){:host{--highcontrast-question-box-border-color:CanvasText;--highcontrast-question-box-background-color:Canvas;--highcontrast-question-box-color:CanvasText;--highcontrast-question-box-focus-ring-color:Highlight;--highcontrast-question-box-option-number-border-color:ButtonText;--highcontrast-question-box-option-number-color:ButtonText;--highcontrast-question-box-option-number-background:Canvas;--highcontrast-question-box-option-number-selected-background:Highlight;--highcontrast-question-box-option-number-selected-color:HighlightText}}:host{--question-box-font-family:var(--luzmo-font-family);--question-box-font-size:var(--luzmo-font-size-m);--question-box-color:var(--luzmo-font-color);--question-box-muted-color:color-mix(in srgb, var(--luzmo-font-color) 80%, var(--luzmo-background-color));--question-box-background-color:var(--luzmo-background-color);--question-box-border-color:var(--luzmo-border-color);--question-box-border-width:var(--luzmo-border-width);--question-box-border-radius:var(--luzmo-border-radius-l);--question-box-padding:var(--luzmo-spacing-5);--question-box-gap:var(--luzmo-spacing-4);--question-box-header-gap:var(--luzmo-spacing-3);--question-box-header-actions-gap:var(--luzmo-spacing-2);--question-box-header-actions-inset:var(--luzmo-spacing-2);--question-box-header-control-size:var(--luzmo-component-height);--question-box-max-inline-size:40rem;--question-box-body-max-block-size:24rem;--question-box-title-font-size:var(--question-box-font-size);--question-box-title-line-height:1.3;--question-box-progress-font-size:var(--luzmo-font-size-s);--question-box-selected-count-font-size:var(--luzmo-font-size-s);--question-box-option-min-block-size:var(--luzmo-component-height);--question-box-option-hover-background:var(--luzmo-background-color-hover);--question-box-option-number-size:var(--luzmo-component-height-xs);--question-box-descriptive-option-padding-block:var(--question-box-option-padding-block);--question-box-option-padding-block:var(--luzmo-spacing-1);--question-box-option-padding-inline:var(--luzmo-spacing-3);--question-box-option-gap:var(--luzmo-spacing-3);--question-box-heading-copy-gap:0px;--question-box-heading-copy-offset:calc(var(--question-box-font-size) * -.25);--question-box-copy-gap:var(--luzmo-spacing-1);--question-box-copy-gap-detailed:var(--luzmo-spacing-2);--question-box-recommended-gap:var(--luzmo-spacing-2);--question-box-summary-gap:var(--luzmo-spacing-4);--question-box-body-focus-inset:calc(var(--luzmo-indicator-gap) + var(--luzmo-indicator-width));--question-box-focus-ring-width:var(--luzmo-indicator-width);--question-box-focus-ring-gap:var(--luzmo-indicator-gap);--question-box-focus-ring-color:var(--luzmo-indicator-color);--question-box-divider-width:0px;--question-box-option-number-background:var(--luzmo-background-color);--question-box-option-number-border-color:var(--luzmo-border-color);--question-box-option-number-color:var(--luzmo-font-color);--question-box-option-number-selected-background:var(--luzmo-primary);--question-box-option-number-selected-color:var(--luzmo-primary-inverse-color);--question-box-other-field-min-block-size:var(--question-box-option-min-block-size);--question-box-other-field-font-size:var(--question-box-font-size);--question-box-divider-color:var(--luzmo-border-color);--question-box-scrollbar-width:var(--luzmo-scrollbar-size);--question-box-scrollbar-track-background:var(--luzmo-scrollbar-track-background);--question-box-scrollbar-track-border-radius:var(--luzmo-scrollbar-track-border-radius);--question-box-scrollbar-thumb-background:var(--luzmo-scrollbar-thumb-background);--question-box-scrollbar-thumb-border-radius:var(--luzmo-scrollbar-thumb-border-radius);--question-box-scrollbar-thumb-hover-background:var(--luzmo-scrollbar-thumb-hover-background)}:host([size=s]){--question-box-padding:var(--luzmo-spacing-4);--question-box-font-size:var(--luzmo-font-size-s);--question-box-selected-count-font-size:var(--luzmo-font-size-xs);--question-box-title-font-size:var(--question-box-font-size);--question-box-header-control-size:var(--luzmo-component-height-s);--question-box-option-min-block-size:var(--luzmo-component-height-s);--question-box-option-number-size:var(--luzmo-component-height-xs);--question-box-other-field-min-block-size:var(--question-box-option-min-block-size);--question-box-other-field-font-size:var(--question-box-font-size)}:host([size=l]){--question-box-font-size:var(--luzmo-font-size-l);--question-box-selected-count-font-size:var(--luzmo-font-size-m);--question-box-title-font-size:var(--question-box-font-size);--question-box-header-control-size:var(--luzmo-component-height-l);--question-box-option-min-block-size:var(--luzmo-component-height-l);--question-box-option-number-size:var(--luzmo-component-height-s);--question-box-other-field-min-block-size:var(--question-box-option-min-block-size);--question-box-other-field-font-size:var(--question-box-font-size)}:host([size=xl]){--question-box-font-size:var(--luzmo-font-size-xl);--question-box-selected-count-font-size:var(--luzmo-font-size-l);--question-box-title-font-size:var(--question-box-font-size);--question-box-header-control-size:var(--luzmo-component-height-xl);--question-box-option-min-block-size:var(--luzmo-component-height-xl);--question-box-option-number-size:var(--luzmo-component-height);--question-box-other-field-min-block-size:var(--question-box-option-min-block-size);--question-box-other-field-font-size:var(--question-box-font-size)}", _ = "__other__", v = {
|
|
38
|
+
var h = ":host{font-family:var(--question-box-font-family);font-size:var(--question-box-font-size);color:var(--highcontrast-question-box-color,var(--question-box-color));box-sizing:border-box;inline-size:100%;max-inline-size:var(--luzmo-question-box-max-inline-size,var(--question-box-max-inline-size));display:block}:host([disabled]){pointer-events:none}.card{gap:var(--question-box-gap);padding:var(--question-box-padding);box-sizing:border-box;border-width:var(--question-box-border-width);border-style:solid;border-color:var(--highcontrast-question-box-border-color,var(--question-box-border-color));border-radius:var(--question-box-border-radius);background-color:var(--highcontrast-question-box-background-color,var(--question-box-background-color));flex-direction:column;display:flex}.header{justify-content:space-between;align-items:flex-start;gap:var(--question-box-header-gap);display:flex}.header-actions,.step-navigation{align-items:center;display:flex}.header-actions{gap:var(--question-box-header-actions-gap);min-block-size:0;block-size:max(var(--question-box-title-font-size) * var(--question-box-title-line-height), var(--question-box-header-control-size) - 2 * (var(--question-box-padding) - var(--question-box-header-actions-inset)));flex-shrink:0;margin-inline-start:auto;overflow:visible}.step-navigation{gap:var(--question-box-copy-gap)}.heading{gap:var(--question-box-heading-copy-gap);flex-direction:column;min-inline-size:0;display:flex}.progress{font-size:var(--question-box-progress-font-size);color:var(--question-box-muted-color);margin:0}.title{font-size:var(--question-box-title-font-size);font-weight:var(--luzmo-font-weight-bold);line-height:var(--question-box-title-line-height);margin:0}.title:focus,.summary-heading:focus{outline:none}.title:focus-visible,.summary-heading:focus-visible{-webkit-text-decoration-color:var(--question-box-focus-ring-color);text-decoration-color:var(--question-box-focus-ring-color);text-decoration-line:underline;text-decoration-thickness:var(--question-box-focus-ring-width);text-underline-offset:var(--question-box-focus-ring-gap);outline:none}.description{color:var(--question-box-muted-color);font-size:inherit;margin:0;margin-block-start:var(--question-box-heading-copy-offset);line-height:1.4}.close{flex-shrink:0}.body{gap:var(--question-box-option-gap);max-block-size:var(--luzmo-question-box-body-max-block-size,var(--question-box-body-max-block-size));padding-block:var(--question-box-body-focus-inset);margin-block:calc(var(--question-box-body-focus-inset) * -1);flex-direction:column;display:flex;overflow:hidden auto}.body::-webkit-scrollbar{width:var(--luzmo-question-box-scrollbar-width,var(--question-box-scrollbar-width));height:var(--luzmo-question-box-scrollbar-width,var(--question-box-scrollbar-width))}.body::-webkit-scrollbar-track{background:var(--luzmo-question-box-scrollbar-track-background,var(--question-box-scrollbar-track-background));border-radius:var(--luzmo-question-box-scrollbar-track-border-radius,var(--question-box-scrollbar-track-border-radius))}.body::-webkit-scrollbar-thumb{background:var(--luzmo-question-box-scrollbar-thumb-background,var(--question-box-scrollbar-thumb-background));border-radius:var(--luzmo-question-box-scrollbar-thumb-border-radius,var(--question-box-scrollbar-thumb-border-radius))}.body::-webkit-scrollbar-thumb:hover{background:var(--luzmo-question-box-scrollbar-thumb-hover-background,var(--question-box-scrollbar-thumb-hover-background))}.body{scrollbar-width:var(--luzmo-scrollbar-width,thin);scrollbar-color:var(--luzmo-question-box-scrollbar-thumb-background,var(--question-box-scrollbar-thumb-background)) var(--luzmo-question-box-scrollbar-track-background,var(--question-box-scrollbar-track-background))}.options{box-sizing:border-box;flex-direction:column;inline-size:100%;min-inline-size:0;display:flex}.options--descriptive luzmo-radio,.options--descriptive luzmo-checkbox,.options--descriptive .other-option-answer{padding-block:var(--luzmo-question-box-descriptive-option-padding-block,var(--question-box-descriptive-option-padding-block))}.body:has(.options--descriptive){margin-block:calc(var(--question-box-option-padding-block) - var(--question-box-body-focus-inset) - var(--luzmo-question-box-descriptive-option-padding-block,var(--question-box-descriptive-option-padding-block)))}luzmo-radio,luzmo-checkbox{box-sizing:border-box;inline-size:100%;min-block-size:var(--question-box-option-min-block-size);padding-block:var(--question-box-option-padding-block);padding-inline:var(--question-box-option-padding-inline);border-block-end-width:var(--luzmo-question-box-divider-width,var(--question-box-divider-width));border-block-end-style:solid;border-block-end-color:var(--luzmo-question-box-divider-color,var(--question-box-divider-color));border-radius:var(--luzmo-border-radius-s);align-items:center;display:flex}luzmo-radio:hover,luzmo-checkbox:hover{background-color:var(--question-box-option-hover-background)}.other-option-row{align-items:center;gap:var(--question-box-option-gap);box-sizing:border-box;border-block-end-width:var(--luzmo-question-box-divider-width,var(--question-box-divider-width));border-block-end-style:solid;border-block-end-color:var(--luzmo-question-box-divider-color,var(--question-box-divider-color));inline-size:100%;max-inline-size:100%;display:flex}.other-option-answer{align-items:center;gap:var(--question-box-option-gap);box-sizing:border-box;min-inline-size:0;min-block-size:var(--question-box-option-min-block-size);padding-block:var(--question-box-option-padding-block);padding-inline:var(--question-box-option-padding-inline);border-radius:var(--luzmo-border-radius-s);flex:1;display:flex}.other-option-answer:hover{background-color:var(--question-box-option-hover-background)}luzmo-radio.other-option,luzmo-checkbox.other-option{border:0;flex:none;min-block-size:auto;inline-size:auto;padding:0}luzmo-radio.other-option{--luzmo-radio-button-top-to-control:0px}luzmo-radio.numbered-option{--luzmo-radio-button-control-size:0px;--luzmo-radio-button-top-to-control:0px;--luzmo-radio-text-to-control:0px;--luzmo-radio-border-width:0px;--luzmo-radio-focus-indicator-width:0px}luzmo-checkbox.numbered-option{--luzmo-checkbox-control-size:0px;--luzmo-checkbox-text-to-control:0px;--luzmo-checkbox-top-to-text:0px;--luzmo-checkbox-border-width:0px;--luzmo-checkbox-selected-border-width:0px;--luzmo-checkbox-focus-indicator-width:0px}luzmo-radio.numbered-option::part(control),luzmo-checkbox.numbered-option::part(control){display:none}luzmo-radio.other-option:hover,luzmo-checkbox.other-option:hover{background-color:#0000}.other-field{inline-size:auto;min-inline-size:0;max-inline-size:100%;min-block-size:var(--question-box-other-field-min-block-size);font-size:var(--question-box-other-field-font-size);--luzmo-text-field-width:100%;--luzmo-text-field-height:var(--question-box-other-field-min-block-size);--luzmo-text-field-background-color:transparent;--luzmo-text-field-background-color-disabled:transparent;--luzmo-text-field-placeholder-font-size:var(--question-box-other-field-font-size);--luzmo-text-field-border-width:0px;--luzmo-text-field-spacing-inline:0px;--luzmo-text-field-spacing-block-start:0px;--luzmo-text-field-spacing-block-end:0px;flex:1;justify-content:center}.other-primary{flex:none}.other-actions{box-sizing:border-box;justify-content:flex-end;align-items:center;gap:var(--question-box-copy-gap-detailed);inline-size:100%;padding-inline:var(--question-box-option-padding-inline);margin-block-start:var(--question-box-copy-gap-detailed);display:flex}.selected-count{font-size:var(--luzmo-question-box-selected-count-font-size,var(--question-box-selected-count-font-size))}.other-actions .selected-count{min-inline-size:0;margin-inline-end:auto}.other-actions luzmo-button{flex:none}.status-error{--luzmo-helptext-font-size:var(--luzmo-question-box-selected-count-font-size,var(--question-box-selected-count-font-size));--luzmo-helptext-min-height:0;--luzmo-helptext-top-to-text:0;--luzmo-helptext-bottom-to-text:0}.visually-hidden{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.option-content{align-items:flex-start;gap:var(--question-box-option-gap);inline-size:100%;display:flex}.option-number{forced-color-adjust:none;inline-size:var(--question-box-option-number-size);block-size:var(--question-box-option-number-size);box-sizing:border-box;border:var(--luzmo-border-width) solid var(--highcontrast-question-box-option-number-border-color,var(--question-box-option-number-border-color));border-radius:var(--luzmo-border-radius);color:var(--highcontrast-question-box-option-number-color,var(--question-box-option-number-color));background-color:var(--highcontrast-question-box-option-number-background,var(--question-box-option-number-background));transition:color var(--luzmo-animation-duration) ease-in-out, border-color var(--luzmo-animation-duration) ease-in-out, background-color var(--luzmo-animation-duration) ease-in-out;flex:none;justify-content:center;align-items:center;line-height:1;display:inline-flex}luzmo-radio[checked] .option-number,luzmo-checkbox[checked] .option-number{color:var(--highcontrast-question-box-option-number-selected-color,var(--question-box-option-number-selected-color));border-color:var(--highcontrast-question-box-option-number-selected-background,var(--question-box-option-number-selected-background));background-color:var(--highcontrast-question-box-option-number-selected-background,var(--question-box-option-number-selected-background))}luzmo-radio[data-focus-visible] .option-number,luzmo-checkbox[data-focus-visible] .option-number,.option-number--focused{outline:var(--luzmo-question-box-focus-ring-width,var(--question-box-focus-ring-width)) solid var(--highcontrast-question-box-focus-ring-color,var(--luzmo-question-box-focus-ring-color,var(--question-box-focus-ring-color)));outline-offset:var(--luzmo-question-box-focus-ring-gap,var(--question-box-focus-ring-gap))}luzmo-radio[disabled] .option-number,luzmo-checkbox[disabled] .option-number{opacity:.5}.option-copy{gap:var(--question-box-copy-gap);flex-direction:column;flex:1;min-inline-size:0;display:flex}.option-edit luzmo-icon{color:inherit}.option-heading{align-items:center;gap:var(--question-box-recommended-gap);min-block-size:var(--question-box-option-number-size);flex-wrap:wrap;display:flex}.option-text{align-items:baseline;gap:var(--question-box-recommended-gap);flex-wrap:wrap;min-inline-size:0;display:flex}.option-description{color:var(--question-box-muted-color);line-height:1.4}.option-hint{color:var(--question-box-muted-color);font-size:var(--luzmo-font-size-s)}.footer{justify-content:space-between;align-items:center;gap:var(--question-box-option-gap);flex-wrap:wrap;display:flex}.status{color:var(--question-box-muted-color);font-size:var(--luzmo-question-box-selected-count-font-size,var(--question-box-selected-count-font-size))}.actions{justify-content:flex-end;gap:var(--question-box-recommended-gap);flex-wrap:wrap;margin-inline-start:auto;display:flex}:host([dir=rtl]) .step-navigation luzmo-icon{transform:scaleX(-1)}.resolved{gap:var(--question-box-summary-gap)}.summary-actions{justify-content:flex-end;gap:var(--question-box-recommended-gap);flex-wrap:wrap;display:flex}.summary{gap:var(--question-box-option-gap);flex-direction:column;display:flex}.summary-heading{font-size:var(--question-box-title-font-size);line-height:var(--question-box-title-line-height);margin:0}.summary-row{gap:var(--question-box-copy-gap);flex-direction:column;display:flex}.summary-title{color:var(--question-box-muted-color);font-size:var(--luzmo-font-size-s)}.summary-answer{font-weight:var(--luzmo-font-weight-bold)}@media (prefers-reduced-motion:reduce){.option-number{transition-duration:0s}}@media (forced-colors:active){:host{--highcontrast-question-box-border-color:CanvasText;--highcontrast-question-box-background-color:Canvas;--highcontrast-question-box-color:CanvasText;--highcontrast-question-box-focus-ring-color:Highlight;--highcontrast-question-box-option-number-border-color:ButtonText;--highcontrast-question-box-option-number-color:ButtonText;--highcontrast-question-box-option-number-background:Canvas;--highcontrast-question-box-option-number-selected-background:Highlight;--highcontrast-question-box-option-number-selected-color:HighlightText}}:host{--question-box-font-family:var(--luzmo-font-family);--question-box-font-size:var(--luzmo-font-size-m);--question-box-color:var(--luzmo-font-color);--question-box-muted-color:color-mix(in srgb, var(--luzmo-font-color) 80%, var(--luzmo-background-color));--question-box-background-color:var(--luzmo-background-color);--question-box-border-color:var(--luzmo-border-color);--question-box-border-width:var(--luzmo-border-width);--question-box-border-radius:var(--luzmo-border-radius-l);--question-box-padding:var(--luzmo-spacing-5);--question-box-gap:var(--luzmo-spacing-4);--question-box-header-gap:var(--luzmo-spacing-3);--question-box-header-actions-gap:var(--luzmo-spacing-2);--question-box-header-actions-inset:var(--luzmo-spacing-2);--question-box-header-control-size:var(--luzmo-component-height);--question-box-max-inline-size:40rem;--question-box-body-max-block-size:24rem;--question-box-title-font-size:var(--question-box-font-size);--question-box-title-line-height:1.3;--question-box-progress-font-size:var(--luzmo-font-size-s);--question-box-selected-count-font-size:var(--luzmo-font-size-s);--question-box-option-min-block-size:var(--luzmo-component-height);--question-box-option-hover-background:var(--luzmo-background-color-hover);--question-box-option-number-size:var(--luzmo-component-height-xs);--question-box-descriptive-option-padding-block:var(--question-box-option-padding-block);--question-box-option-padding-block:var(--luzmo-spacing-1);--question-box-option-padding-inline:var(--luzmo-spacing-3);--question-box-option-gap:var(--luzmo-spacing-3);--question-box-heading-copy-gap:0px;--question-box-heading-copy-offset:calc(var(--question-box-font-size) * -.25);--question-box-copy-gap:var(--luzmo-spacing-1);--question-box-copy-gap-detailed:var(--luzmo-spacing-2);--question-box-recommended-gap:var(--luzmo-spacing-2);--question-box-summary-gap:var(--luzmo-spacing-4);--question-box-body-focus-inset:calc(var(--luzmo-indicator-gap) + var(--luzmo-indicator-width));--question-box-focus-ring-width:var(--luzmo-indicator-width);--question-box-focus-ring-gap:var(--luzmo-indicator-gap);--question-box-focus-ring-color:var(--luzmo-indicator-color);--question-box-divider-width:0px;--question-box-option-number-background:var(--luzmo-background-color);--question-box-option-number-border-color:var(--luzmo-border-color);--question-box-option-number-color:var(--luzmo-font-color);--question-box-option-number-selected-background:var(--luzmo-primary);--question-box-option-number-selected-color:var(--luzmo-primary-inverse-color);--question-box-other-field-min-block-size:var(--question-box-option-min-block-size);--question-box-other-field-font-size:var(--question-box-font-size);--question-box-divider-color:var(--luzmo-border-color);--question-box-scrollbar-width:var(--luzmo-scrollbar-size);--question-box-scrollbar-track-background:var(--luzmo-scrollbar-track-background);--question-box-scrollbar-track-border-radius:var(--luzmo-scrollbar-track-border-radius);--question-box-scrollbar-thumb-background:var(--luzmo-scrollbar-thumb-background);--question-box-scrollbar-thumb-border-radius:var(--luzmo-scrollbar-thumb-border-radius);--question-box-scrollbar-thumb-hover-background:var(--luzmo-scrollbar-thumb-hover-background)}:host([size=s]){--question-box-padding:var(--luzmo-spacing-4);--question-box-font-size:var(--luzmo-font-size-s);--question-box-selected-count-font-size:var(--luzmo-font-size-xs);--question-box-title-font-size:var(--question-box-font-size);--question-box-header-control-size:var(--luzmo-component-height-s);--question-box-option-min-block-size:var(--luzmo-component-height-s);--question-box-option-number-size:var(--luzmo-component-height-xs);--question-box-other-field-min-block-size:var(--question-box-option-min-block-size);--question-box-other-field-font-size:var(--question-box-font-size)}:host([size=l]){--question-box-font-size:var(--luzmo-font-size-l);--question-box-selected-count-font-size:var(--luzmo-font-size-m);--question-box-title-font-size:var(--question-box-font-size);--question-box-header-control-size:var(--luzmo-component-height-l);--question-box-option-min-block-size:var(--luzmo-component-height-l);--question-box-option-number-size:var(--luzmo-component-height-s);--question-box-other-field-min-block-size:var(--question-box-option-min-block-size);--question-box-other-field-font-size:var(--question-box-font-size)}:host([size=xl]){--question-box-font-size:var(--luzmo-font-size-xl);--question-box-selected-count-font-size:var(--luzmo-font-size-l);--question-box-title-font-size:var(--question-box-font-size);--question-box-header-control-size:var(--luzmo-component-height-xl);--question-box-option-min-block-size:var(--luzmo-component-height-xl);--question-box-option-number-size:var(--luzmo-component-height);--question-box-other-field-min-block-size:var(--question-box-option-min-block-size);--question-box-other-field-font-size:var(--question-box-font-size)}", g = "__other__", _ = {
|
|
38
39
|
continue: "Next",
|
|
39
40
|
back: "Back",
|
|
40
41
|
submit: "Submit",
|
|
@@ -56,14 +57,14 @@ var g = ":host{font-family:var(--question-box-font-family);font-size:var(--quest
|
|
|
56
57
|
minSelectedError: "Choose at least {min} options.",
|
|
57
58
|
maxSelectedError: "Choose at most {max} options.",
|
|
58
59
|
otherRequiredError: "Enter a value for this option."
|
|
59
|
-
},
|
|
60
|
+
}, v = (e) => `${e}Other`, y = (e) => !!e.other || e.options.length === 0, b = (e) => typeof e.other == "object" && e.other ? e.other : {}, x = (e) => Object.fromEntries(Object.entries(e)), S = (e, t, n) => {
|
|
60
61
|
Object.defineProperty(e, t, {
|
|
61
62
|
configurable: !0,
|
|
62
63
|
enumerable: !0,
|
|
63
64
|
value: n,
|
|
64
65
|
writable: !0
|
|
65
66
|
});
|
|
66
|
-
},
|
|
67
|
+
}, C = (e, t) => {
|
|
67
68
|
let n = /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]);
|
|
68
69
|
for (let r of n) {
|
|
69
70
|
let n = e[r], i = t[r];
|
|
@@ -72,20 +73,20 @@ var g = ":host{font-family:var(--question-box-font-family);font-size:var(--quest
|
|
|
72
73
|
} else if (n !== i) return !1;
|
|
73
74
|
}
|
|
74
75
|
return !0;
|
|
75
|
-
},
|
|
76
|
+
}, w = (e) => {
|
|
76
77
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
77
78
|
for (let r of e) t.has(r) || (t.add(r), n.push(r));
|
|
78
79
|
return n;
|
|
79
|
-
},
|
|
80
|
+
}, T = (e) => {
|
|
80
81
|
let t = new Set(e.options.map((e) => e.value));
|
|
81
|
-
return
|
|
82
|
-
},
|
|
82
|
+
return y(e) && t.add(g), t;
|
|
83
|
+
}, E = (e, t) => {
|
|
83
84
|
let n = t[e.id];
|
|
84
|
-
return e.type === "single" ? typeof n == "string" && n ? [n] : [] : Array.isArray(n) ?
|
|
85
|
-
},
|
|
85
|
+
return e.type === "single" ? typeof n == "string" && n ? [n] : [] : Array.isArray(n) ? w(n) : [];
|
|
86
|
+
}, D = (e, t) => E(e, t).includes(g), O = (e) => {
|
|
86
87
|
let t = Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
|
|
87
88
|
return {
|
|
88
|
-
...
|
|
89
|
+
..._,
|
|
89
90
|
...t
|
|
90
91
|
};
|
|
91
92
|
}, k = (e, t) => {
|
|
@@ -98,18 +99,18 @@ var g = ":host{font-family:var(--question-box-font-family);font-size:var(--quest
|
|
|
98
99
|
if (!n.id) throw TypeError("luzmo-question-box: every question needs an id.");
|
|
99
100
|
if (t.has(n.id)) throw TypeError(`luzmo-question-box: duplicate question id "${n.id}".`);
|
|
100
101
|
t.add(n.id);
|
|
101
|
-
let r =
|
|
102
|
+
let r = v(n.id);
|
|
102
103
|
if (e.some((e) => e.id === r)) throw TypeError(`luzmo-question-box: question id "${r}" collides with Other text for "${n.id}".`);
|
|
103
104
|
if (n.type !== "multiple" && (n.minSelected !== void 0 || n.maxSelected !== void 0)) throw TypeError(`luzmo-question-box: minSelected and maxSelected only apply to multiple-choice question "${n.id}".`);
|
|
104
105
|
for (let [e, t] of [["minSelected", n.minSelected], ["maxSelected", n.maxSelected]]) if (t !== void 0 && (!Number.isInteger(t) || t < 0)) throw TypeError(`luzmo-question-box: ${e} must be a non-negative integer on "${n.id}".`);
|
|
105
106
|
let i = n.minSelected ?? +!!n.required;
|
|
106
107
|
if (n.maxSelected !== void 0 && i > n.maxSelected) throw TypeError(`luzmo-question-box: minSelected cannot exceed maxSelected on "${n.id}".`);
|
|
107
|
-
let a = n.options.filter((e) => !e.disabled).length + +!!
|
|
108
|
+
let a = n.options.filter((e) => !e.disabled).length + +!!y(n);
|
|
108
109
|
if (n.type === "multiple" && i > a) throw TypeError(`luzmo-question-box: minSelected exceeds the available options on "${n.id}".`);
|
|
109
110
|
let o = /* @__PURE__ */ new Set();
|
|
110
111
|
for (let e of n.options) {
|
|
111
112
|
if (!e.value) throw TypeError(`luzmo-question-box: option values cannot be empty on "${n.id}".`);
|
|
112
|
-
if (e.value === "__other__") throw TypeError(`luzmo-question-box: "${
|
|
113
|
+
if (e.value === "__other__") throw TypeError(`luzmo-question-box: "${g}" is reserved on "${n.id}".`);
|
|
113
114
|
if (o.has(e.value)) throw TypeError(`luzmo-question-box: duplicate option value "${e.value}" on "${n.id}".`);
|
|
114
115
|
o.add(e.value);
|
|
115
116
|
}
|
|
@@ -117,18 +118,18 @@ var g = ":host{font-family:var(--question-box-font-family);font-size:var(--quest
|
|
|
117
118
|
}, j = (e, t) => {
|
|
118
119
|
let n = Object.fromEntries([]);
|
|
119
120
|
for (let r of e) {
|
|
120
|
-
let e =
|
|
121
|
-
if (r.type === "single") typeof i == "string" && e.has(i) ?
|
|
121
|
+
let e = T(r), i = t[r.id], a = Object.hasOwn(t, r.id);
|
|
122
|
+
if (r.type === "single") typeof i == "string" && e.has(i) ? S(n, r.id, i) : !a && typeof r.default == "string" && (e.has(r.default) || r.options.length === 0) && S(n, r.id, r.options.length === 0 ? g : r.default);
|
|
122
123
|
else {
|
|
123
|
-
let t = [...r.options.map((e) => e.value), ...
|
|
124
|
-
if (o.length > 0)
|
|
124
|
+
let t = [...r.options.map((e) => e.value), ...y(r) ? [g] : []], o = w(Array.isArray(i) ? i.filter((t) => e.has(t)) : []);
|
|
125
|
+
if (o.length > 0) S(n, r.id, t.filter((e) => o.includes(e)));
|
|
125
126
|
else if (!a && Array.isArray(r.default)) {
|
|
126
|
-
let i =
|
|
127
|
-
i.length > 0 &&
|
|
127
|
+
let i = w(r.default.filter((t) => e.has(t)));
|
|
128
|
+
i.length > 0 && S(n, r.id, t.filter((e) => i.includes(e)));
|
|
128
129
|
}
|
|
129
130
|
}
|
|
130
|
-
let o =
|
|
131
|
-
typeof s == "string" ?
|
|
131
|
+
let o = v(r.id), s = t[o];
|
|
132
|
+
typeof s == "string" ? S(n, o, s) : !a && r.options.length === 0 && typeof r.default == "string" && S(n, o, r.default);
|
|
132
133
|
}
|
|
133
134
|
return n;
|
|
134
135
|
}, M = (e) => e.minSelected ?? +!!e.required, N = (e, t) => {
|
|
@@ -138,23 +139,23 @@ var g = ":host{font-family:var(--question-box-font-family);font-size:var(--quest
|
|
|
138
139
|
max: String(r)
|
|
139
140
|
}) : n === 1 ? t.requiredSelectionDescription : n > 1 ? k(t.minSelectedError, { min: String(n) }) : r === void 0 ? void 0 : k(t.maxSelectedError, { max: String(r) });
|
|
140
141
|
}, P = (e, t) => {
|
|
141
|
-
let n =
|
|
142
|
+
let n = E(e, t), r = M(e), i = e.maxSelected;
|
|
142
143
|
if (n.length < r) return r <= 1 ? "missing" : "minimum";
|
|
143
144
|
if (i !== void 0 && n.length > i) return "maximum";
|
|
144
|
-
if (
|
|
145
|
-
},
|
|
145
|
+
if (D(e, t) && !String(t[v(e.id)] ?? "").trim()) return "otherText";
|
|
146
|
+
}, ne = (e, t) => P(e, t) !== void 0, re = (e, t, n) => {
|
|
146
147
|
switch (P(e, t)) {
|
|
147
148
|
case "minimum": return k(n.minSelectedError, { min: String(M(e)) });
|
|
148
149
|
case "maximum": return k(n.maxSelectedError, { max: String(e.maxSelected) });
|
|
149
150
|
case "otherText": return n.otherRequiredError;
|
|
150
151
|
default: return;
|
|
151
152
|
}
|
|
152
|
-
},
|
|
153
|
+
}, ie = (e, t, n, r, i) => {
|
|
153
154
|
if (i || t.disabled) return !0;
|
|
154
155
|
if (e.type !== "multiple" || n) return !1;
|
|
155
156
|
let a = e.maxSelected;
|
|
156
|
-
return a !== void 0 &&
|
|
157
|
-
},
|
|
157
|
+
return a !== void 0 && E(e, r).length >= a;
|
|
158
|
+
}, ae = (e, t) => k(e === 1 ? t.selectedCountOne : t.selectedCount, { count: String(e) }), F, oe = (e, t) => {
|
|
158
159
|
try {
|
|
159
160
|
return F?.language !== t && (F = {
|
|
160
161
|
language: t,
|
|
@@ -166,19 +167,19 @@ var g = ":host{font-family:var(--question-box-font-family);font-size:var(--quest
|
|
|
166
167
|
} catch {
|
|
167
168
|
return e.join(", ");
|
|
168
169
|
}
|
|
169
|
-
},
|
|
170
|
+
}, se = (e, t) => e.recommended ? k(t.recommendedSuffix, {
|
|
170
171
|
label: e.label,
|
|
171
172
|
recommended: t.recommended
|
|
172
|
-
}) : e.label,
|
|
173
|
+
}) : e.label, ce = (e) => {
|
|
173
174
|
let t = e.options.map((e) => ({
|
|
174
175
|
const: e.value,
|
|
175
176
|
title: e.label
|
|
176
177
|
}));
|
|
177
|
-
return
|
|
178
|
-
const:
|
|
179
|
-
title: typeof e.other == "object" && e.other.label ||
|
|
178
|
+
return y(e) && e.options.length > 0 && t.push({
|
|
179
|
+
const: g,
|
|
180
|
+
title: typeof e.other == "object" && e.other.label || _.other
|
|
180
181
|
}), t;
|
|
181
|
-
},
|
|
182
|
+
}, le = (e) => {
|
|
182
183
|
let t = { type: "string" };
|
|
183
184
|
return typeof e.other == "object" && e.other.label && (t.title = e.other.label), t;
|
|
184
185
|
}, I = (e) => {
|
|
@@ -189,7 +190,7 @@ var g = ":host{font-family:var(--question-box-font-family);font-size:var(--quest
|
|
|
189
190
|
r.title && (e.title = r.title), r.description && (e.description = r.description), typeof r.default == "string" && (e.default = r.default), t.push([r.id, e]), r.required && n.push(r.id);
|
|
190
191
|
continue;
|
|
191
192
|
}
|
|
192
|
-
let e =
|
|
193
|
+
let e = ce(r);
|
|
193
194
|
if (r.type === "single") {
|
|
194
195
|
let n = {
|
|
195
196
|
type: "string",
|
|
@@ -209,7 +210,7 @@ var g = ":host{font-family:var(--question-box-font-family);font-size:var(--quest
|
|
|
209
210
|
}
|
|
210
211
|
t.push([r.id, n]);
|
|
211
212
|
}
|
|
212
|
-
r.required && n.push(r.id),
|
|
213
|
+
r.required && n.push(r.id), y(r) && t.push([v(r.id), le(r)]);
|
|
213
214
|
}
|
|
214
215
|
let r = Object.fromEntries(t);
|
|
215
216
|
return n.length > 0 ? {
|
|
@@ -220,7 +221,7 @@ var g = ":host{font-family:var(--question-box-font-family);font-size:var(--quest
|
|
|
220
221
|
type: "object",
|
|
221
222
|
properties: r
|
|
222
223
|
};
|
|
223
|
-
}, L = (e, t) => String(t[
|
|
224
|
+
}, L = (e, t) => String(t[v(e.id)] ?? "").trim(), R = (e, t) => {
|
|
224
225
|
let n = [];
|
|
225
226
|
for (let r of e) {
|
|
226
227
|
let e = L(r, t);
|
|
@@ -228,8 +229,8 @@ var g = ":host{font-family:var(--question-box-font-family);font-size:var(--quest
|
|
|
228
229
|
e && n.push([r.id, e]);
|
|
229
230
|
continue;
|
|
230
231
|
}
|
|
231
|
-
let i =
|
|
232
|
-
r.type === "single" ? i[0] && n.push([r.id, i[0]]) : i.length > 0 && n.push([r.id, [...i]]),
|
|
232
|
+
let i = E(r, t);
|
|
233
|
+
r.type === "single" ? i[0] && n.push([r.id, i[0]]) : i.length > 0 && n.push([r.id, [...i]]), y(r) && D(r, t) && e && n.push([v(r.id), e]);
|
|
233
234
|
}
|
|
234
235
|
return Object.fromEntries(n);
|
|
235
236
|
}, z = (e) => !!e && typeof e == "object" && !Array.isArray(e), B = (e) => z(e) ? e : {}, V = (e) => {
|
|
@@ -266,19 +267,19 @@ var g = ":host{font-family:var(--question-box-font-family);font-size:var(--quest
|
|
|
266
267
|
declared: !1,
|
|
267
268
|
options: []
|
|
268
269
|
};
|
|
269
|
-
}, H = (e) =>
|
|
270
|
+
}, H = (e) => v(e), U = (e) => e.format !== void 0 || e.minLength !== void 0 || e.maxLength !== void 0 || e.pattern !== void 0, ue = (e) => e.type === "string" && !V(e).declared && !U(e), de = (e) => {
|
|
270
271
|
if (e.type !== "object" || !e.properties) return [];
|
|
271
272
|
let t = e.properties, n = new Set(e.required ?? []), r = /* @__PURE__ */ new Set();
|
|
272
273
|
for (let e of Object.keys(t)) {
|
|
273
274
|
let n = H(e), i = V(B(t[e])), a = B(t[n]);
|
|
274
|
-
n in t &&
|
|
275
|
+
n in t && ue(a) && i.options.some((e) => e.value === "__other__") && r.add(n);
|
|
275
276
|
}
|
|
276
277
|
let i = [];
|
|
277
278
|
for (let [e, a] of Object.entries(t)) {
|
|
278
279
|
if (r.has(e)) continue;
|
|
279
|
-
let o = B(a), s = V(o), c = s.options.some((e) => e.value ===
|
|
280
|
+
let o = B(a), s = V(o), c = s.options.some((e) => e.value === g), l = H(e);
|
|
280
281
|
if (c && !r.has(l)) continue;
|
|
281
|
-
let u = s.options.filter((e) => e.value !==
|
|
282
|
+
let u = s.options.filter((e) => e.value !== g);
|
|
282
283
|
if (o.type === "number" || o.type === "integer" || o.type === "boolean" || o.type !== "string" && o.type !== "array" || s.declared && s.options.length === 0 || o.type === "array" && !s.declared || o.type === "string" && !s.declared && U(o)) continue;
|
|
283
284
|
let d = {
|
|
284
285
|
id: e,
|
|
@@ -295,7 +296,7 @@ var g = ":host{font-family:var(--question-box-font-family);font-size:var(--quest
|
|
|
295
296
|
return i;
|
|
296
297
|
};
|
|
297
298
|
// src/components/question-box/question-box-templates.ts
|
|
298
|
-
function
|
|
299
|
+
function W(e) {
|
|
299
300
|
switch (e) {
|
|
300
301
|
case "s": return "xs";
|
|
301
302
|
case "m": return "s";
|
|
@@ -303,7 +304,7 @@ function G(e) {
|
|
|
303
304
|
default: return "l";
|
|
304
305
|
}
|
|
305
306
|
}
|
|
306
|
-
function
|
|
307
|
+
function G(e) {
|
|
307
308
|
switch (e) {
|
|
308
309
|
case "m": return "xs";
|
|
309
310
|
case "l": return "s";
|
|
@@ -312,22 +313,25 @@ function K(e) {
|
|
|
312
313
|
default: return "xxs";
|
|
313
314
|
}
|
|
314
315
|
}
|
|
315
|
-
function
|
|
316
|
+
function K(e) {
|
|
316
317
|
return e.step >= e.questions.length - 1;
|
|
317
318
|
}
|
|
318
|
-
function
|
|
319
|
+
function q(e, t) {
|
|
320
|
+
return e.disabled ? !0 : e.readonly ? K(e) : e.questionInvalid(t);
|
|
321
|
+
}
|
|
322
|
+
function fe(e, t) {
|
|
319
323
|
let n = e.selectedValues(t);
|
|
320
|
-
return n.length === 0 ? "" :
|
|
321
|
-
if (n === "__other__") return String(e.value[
|
|
324
|
+
return n.length === 0 ? "" : oe(n.map((n) => {
|
|
325
|
+
if (n === "__other__") return String(e.value[v(t.id)] ?? e.copy.other);
|
|
322
326
|
let r = t.options.find((e) => e.value === n);
|
|
323
|
-
return r ?
|
|
327
|
+
return r ? se(r, e.copy) : n;
|
|
324
328
|
}), e.language);
|
|
325
329
|
}
|
|
326
|
-
function
|
|
327
|
-
let n =
|
|
330
|
+
function pe(e, t) {
|
|
331
|
+
let n = fe(e, t), r = e.copy.answer.split("{answer}").map((e, t) => a`${t > 0 ? a`<span class="summary-answer">${n}</span>` : o}${e}`);
|
|
328
332
|
return a`<span class="summary-value">${r}</span>`;
|
|
329
333
|
}
|
|
330
|
-
function
|
|
334
|
+
function me(e) {
|
|
331
335
|
let t = e.copy, n = e.questions.reduce((t, n) => t + e.selectedValues(n).length, 0);
|
|
332
336
|
return a`
|
|
333
337
|
<div class="card resolved">
|
|
@@ -335,10 +339,10 @@ function fe(e) {
|
|
|
335
339
|
<h2 class="summary-heading" id="resolved-title" tabindex="-1">
|
|
336
340
|
${n === 1 ? t.answerTitle : t.answersTitle}
|
|
337
341
|
</h2>
|
|
338
|
-
${
|
|
342
|
+
${m(e.questions, (e) => e.id, (t) => a`
|
|
339
343
|
<div class="summary-row">
|
|
340
344
|
<span class="summary-title">${t.title}</span>
|
|
341
|
-
${
|
|
345
|
+
${pe(e, t)}
|
|
342
346
|
</div>
|
|
343
347
|
`)}
|
|
344
348
|
</div>
|
|
@@ -388,7 +392,7 @@ function J(e, t, n) {
|
|
|
388
392
|
dir=${e.dir}
|
|
389
393
|
variant="neutral"
|
|
390
394
|
treatment="subtle"
|
|
391
|
-
size=${
|
|
395
|
+
size=${W(e.size)}
|
|
392
396
|
>${e.copy.recommended}</luzmo-badge
|
|
393
397
|
>` : o}
|
|
394
398
|
</span>
|
|
@@ -404,7 +408,7 @@ function Y(e, t) {
|
|
|
404
408
|
>${e.disabledReason}</span
|
|
405
409
|
>` : o;
|
|
406
410
|
}
|
|
407
|
-
function
|
|
411
|
+
function he(e, t) {
|
|
408
412
|
return t ? a`
|
|
409
413
|
<luzmo-help-text
|
|
410
414
|
id="question-error"
|
|
@@ -425,11 +429,11 @@ function X(e, t) {
|
|
|
425
429
|
dir=${e.dir}
|
|
426
430
|
variant="negative"
|
|
427
431
|
>${n}</luzmo-help-text
|
|
428
|
-
>` :
|
|
432
|
+
>` : ae(e.selectedValues(t).length, e.copy)}</span
|
|
429
433
|
>
|
|
430
434
|
`;
|
|
431
435
|
}
|
|
432
|
-
function
|
|
436
|
+
function ge(e, t) {
|
|
433
437
|
return a`
|
|
434
438
|
<div class="other-actions">
|
|
435
439
|
${X(e, t)}
|
|
@@ -438,9 +442,9 @@ function me(e, t) {
|
|
|
438
442
|
id="other-skip-button"
|
|
439
443
|
dir=${e.dir}
|
|
440
444
|
variant="primary"
|
|
441
|
-
size=${
|
|
445
|
+
size=${W(e.size)}
|
|
442
446
|
quiet
|
|
443
|
-
?disabled=${e.disabled}
|
|
447
|
+
?disabled=${e.disabled || e.readonly}
|
|
444
448
|
@click=${e.handlers.skip}
|
|
445
449
|
>${e.copy.skip}</luzmo-button
|
|
446
450
|
>
|
|
@@ -451,20 +455,20 @@ function me(e, t) {
|
|
|
451
455
|
class="other-primary"
|
|
452
456
|
variant="primary"
|
|
453
457
|
treatment="outline"
|
|
454
|
-
size=${
|
|
455
|
-
?disabled=${e
|
|
458
|
+
size=${W(e.size)}
|
|
459
|
+
?disabled=${q(e, t)}
|
|
456
460
|
@click=${e.handlers.primary}
|
|
457
|
-
>${
|
|
461
|
+
>${K(e) ? e.copy.submit : e.copy.continue}</luzmo-button
|
|
458
462
|
>
|
|
459
463
|
</div>
|
|
460
464
|
`;
|
|
461
465
|
}
|
|
462
|
-
function
|
|
463
|
-
return e.isOtherSelected(t) && String(e.value[
|
|
466
|
+
function _e(e, t) {
|
|
467
|
+
return e.isOtherSelected(t) && String(e.value[v(t.id)] ?? "").trim().length > 0;
|
|
464
468
|
}
|
|
465
469
|
function Z(e, t) {
|
|
466
|
-
let n =
|
|
467
|
-
value:
|
|
470
|
+
let n = b(t), r = v(t.id), i = e.isOtherSelected(t), o = e.optionDisabled(t, {
|
|
471
|
+
value: g,
|
|
468
472
|
label: n.label || e.copy.other
|
|
469
473
|
}, i), s = e.showError && i && !!e.questionError(t);
|
|
470
474
|
return a`
|
|
@@ -489,8 +493,8 @@ function Z(e, t) {
|
|
|
489
493
|
></luzmo-text-field>
|
|
490
494
|
`;
|
|
491
495
|
}
|
|
492
|
-
function
|
|
493
|
-
let n =
|
|
496
|
+
function Q(e, t) {
|
|
497
|
+
let n = _e(e, t);
|
|
494
498
|
return t.type === "multiple" || e.hideSkip && !n ? o : a`
|
|
495
499
|
<luzmo-button
|
|
496
500
|
id="other-row-action"
|
|
@@ -498,14 +502,14 @@ function ge(e, t) {
|
|
|
498
502
|
class="other-primary"
|
|
499
503
|
variant="primary"
|
|
500
504
|
treatment="outline"
|
|
501
|
-
size=${
|
|
502
|
-
?disabled=${n ? e
|
|
505
|
+
size=${W(e.size)}
|
|
506
|
+
?disabled=${n ? q(e, t) : e.disabled || e.readonly}
|
|
503
507
|
@click=${n ? e.handlers.primary : e.handlers.skip}
|
|
504
|
-
>${n ?
|
|
508
|
+
>${n ? K(e) ? e.copy.submit : e.copy.continue : e.copy.skip}</luzmo-button
|
|
505
509
|
>
|
|
506
510
|
`;
|
|
507
511
|
}
|
|
508
|
-
function
|
|
512
|
+
function ve(e, t, n) {
|
|
509
513
|
let r = e.selectedValues(t)[0] ?? "", i = t.options.some((e) => e.description) ? "options options--descriptive" : "options";
|
|
510
514
|
return a`
|
|
511
515
|
<luzmo-radio-group
|
|
@@ -515,15 +519,15 @@ function _e(e, t, n) {
|
|
|
515
519
|
vertical
|
|
516
520
|
label=${t.title}
|
|
517
521
|
manual-selection
|
|
518
|
-
aria-readonly=${
|
|
519
|
-
aria-required=${
|
|
522
|
+
aria-readonly=${p(e.readonly ? "true" : void 0)}
|
|
523
|
+
aria-required=${p(t.required ? "true" : void 0)}
|
|
520
524
|
.selected=${r}
|
|
521
525
|
?invalid=${!!n}
|
|
522
526
|
@change=${e.handlers.radioChange}
|
|
523
527
|
@focusin=${e.handlers.focusIn}
|
|
524
528
|
@focusout=${e.handlers.focusOut}
|
|
525
529
|
>
|
|
526
|
-
${
|
|
530
|
+
${m(t.options, (e) => e.value, (n, i) => a`
|
|
527
531
|
<luzmo-radio
|
|
528
532
|
class="numbered-option"
|
|
529
533
|
dir=${e.dir}
|
|
@@ -533,7 +537,7 @@ function _e(e, t, n) {
|
|
|
533
537
|
emphasized
|
|
534
538
|
?disabled=${e.optionDisabled(t, n, n.value === r)}
|
|
535
539
|
?readonly=${e.readonly}
|
|
536
|
-
aria-describedby=${
|
|
540
|
+
aria-describedby=${p(n.disabledReason ? `option-reason-${i}` : void 0)}
|
|
537
541
|
@click=${e.handlers.radioClick}
|
|
538
542
|
@change=${e.handlers.radioChange}
|
|
539
543
|
>
|
|
@@ -541,17 +545,17 @@ function _e(e, t, n) {
|
|
|
541
545
|
${Y(n, i)}
|
|
542
546
|
</luzmo-radio>
|
|
543
547
|
`)}
|
|
544
|
-
${
|
|
548
|
+
${y(t) ? a`
|
|
545
549
|
<div class="other-option-row">
|
|
546
550
|
<div class="other-option-answer">
|
|
547
551
|
<luzmo-radio
|
|
548
552
|
class="numbered-option other-option"
|
|
549
553
|
dir=${e.dir}
|
|
550
|
-
value=${
|
|
554
|
+
value=${g}
|
|
551
555
|
data-option-index=${t.options.length}
|
|
552
556
|
size=${e.size}
|
|
553
557
|
emphasized
|
|
554
|
-
aria-label=${
|
|
558
|
+
aria-label=${b(t).label || e.copy.other}
|
|
555
559
|
?disabled=${e.disabled}
|
|
556
560
|
?readonly=${e.readonly}
|
|
557
561
|
@change=${e.handlers.radioChange}
|
|
@@ -560,21 +564,21 @@ function _e(e, t, n) {
|
|
|
560
564
|
<luzmo-icon
|
|
561
565
|
block
|
|
562
566
|
dir=${e.dir}
|
|
563
|
-
.size=${
|
|
564
|
-
.icon=${
|
|
567
|
+
.size=${G(e.size)}
|
|
568
|
+
.icon=${f}
|
|
565
569
|
></luzmo-icon>
|
|
566
570
|
</span>
|
|
567
571
|
</luzmo-radio>
|
|
568
572
|
${Z(e, t)}
|
|
569
573
|
</div>
|
|
570
|
-
${
|
|
574
|
+
${Q(e, t)}
|
|
571
575
|
</div>
|
|
572
576
|
` : o}
|
|
573
|
-
${
|
|
577
|
+
${he(e, n)}
|
|
574
578
|
</luzmo-radio-group>
|
|
575
579
|
`;
|
|
576
580
|
}
|
|
577
|
-
function
|
|
581
|
+
function ye(e, t, n) {
|
|
578
582
|
let r = new Set(e.selectedValues(t)), i = e.isOtherSelected(t), s = t.options.some((e) => e.description) ? "options options--descriptive" : "options", c = N(t, e.copy);
|
|
579
583
|
return a`
|
|
580
584
|
${c ? a`<span class="visually-hidden" id="selection-requirement"
|
|
@@ -586,12 +590,12 @@ function Q(e, t, n) {
|
|
|
586
590
|
class=${s}
|
|
587
591
|
vertical
|
|
588
592
|
label=${t.title}
|
|
589
|
-
aria-describedby=${
|
|
593
|
+
aria-describedby=${p(c ? "selection-requirement" : void 0)}
|
|
590
594
|
?invalid=${!!n}
|
|
591
595
|
@focusin=${e.handlers.focusIn}
|
|
592
596
|
@focusout=${e.handlers.focusOut}
|
|
593
597
|
>
|
|
594
|
-
${
|
|
598
|
+
${m(t.options, (e) => e.value, (n, i) => a`
|
|
595
599
|
<luzmo-checkbox
|
|
596
600
|
class="numbered-option"
|
|
597
601
|
dir=${e.dir}
|
|
@@ -602,26 +606,26 @@ function Q(e, t, n) {
|
|
|
602
606
|
?checked=${r.has(n.value)}
|
|
603
607
|
?disabled=${e.optionDisabled(t, n, r.has(n.value))}
|
|
604
608
|
?readonly=${e.readonly}
|
|
605
|
-
aria-describedby=${
|
|
609
|
+
aria-describedby=${p(n.disabledReason ? `option-reason-${i}` : void 0)}
|
|
606
610
|
@change=${e.handlers.checkboxChange}
|
|
607
611
|
>
|
|
608
612
|
${J(e, n, i)}
|
|
609
613
|
${Y(n, i)}
|
|
610
614
|
</luzmo-checkbox>
|
|
611
615
|
`)}
|
|
612
|
-
${
|
|
616
|
+
${y(t) ? a`
|
|
613
617
|
<div class="other-option-row other-option-row--multiple">
|
|
614
618
|
<div class="other-option-answer">
|
|
615
619
|
<luzmo-checkbox
|
|
616
620
|
class="numbered-option other-option"
|
|
617
621
|
dir=${e.dir}
|
|
618
|
-
data-value=${
|
|
622
|
+
data-value=${g}
|
|
619
623
|
data-option-index=${t.options.length}
|
|
620
624
|
size=${e.size}
|
|
621
625
|
emphasized
|
|
622
626
|
?checked=${i}
|
|
623
627
|
?disabled=${e.optionDisabled(t, {
|
|
624
|
-
value:
|
|
628
|
+
value: g,
|
|
625
629
|
label: e.copy.other
|
|
626
630
|
}, i)}
|
|
627
631
|
?readonly=${e.readonly}
|
|
@@ -631,27 +635,27 @@ function Q(e, t, n) {
|
|
|
631
635
|
<luzmo-icon
|
|
632
636
|
block
|
|
633
637
|
dir=${e.dir}
|
|
634
|
-
.size=${
|
|
635
|
-
.icon=${
|
|
638
|
+
.size=${G(e.size)}
|
|
639
|
+
.icon=${f}
|
|
636
640
|
></luzmo-icon>
|
|
637
641
|
</span>
|
|
638
642
|
<span class="visually-hidden"
|
|
639
|
-
>${
|
|
643
|
+
>${b(t).label || e.copy.other}</span
|
|
640
644
|
>
|
|
641
645
|
</luzmo-checkbox>
|
|
642
646
|
${Z(e, t)}
|
|
643
647
|
</div>
|
|
644
648
|
</div>
|
|
645
|
-
${
|
|
649
|
+
${ge(e, t)}
|
|
646
650
|
` : o}
|
|
647
651
|
</luzmo-field-group>
|
|
648
652
|
`;
|
|
649
653
|
}
|
|
650
|
-
function
|
|
654
|
+
function be(e, t) {
|
|
651
655
|
let n = e.copy, r = k(n.progress, {
|
|
652
656
|
current: String(e.step + 1),
|
|
653
657
|
total: String(e.questions.length)
|
|
654
|
-
})
|
|
658
|
+
});
|
|
655
659
|
return a`
|
|
656
660
|
<header class="header">
|
|
657
661
|
<div class="heading">
|
|
@@ -669,7 +673,7 @@ function ve(e, t) {
|
|
|
669
673
|
id="back-button"
|
|
670
674
|
dir=${e.dir}
|
|
671
675
|
quiet
|
|
672
|
-
size=${
|
|
676
|
+
size=${W(e.size)}
|
|
673
677
|
label=${n.back}
|
|
674
678
|
?disabled=${e.disabled || e.step === 0}
|
|
675
679
|
@click=${e.handlers.back}
|
|
@@ -678,7 +682,7 @@ function ve(e, t) {
|
|
|
678
682
|
<luzmo-icon
|
|
679
683
|
block
|
|
680
684
|
dir=${e.dir}
|
|
681
|
-
.size=${
|
|
685
|
+
.size=${W(e.size)}
|
|
682
686
|
.icon=${d}
|
|
683
687
|
></luzmo-icon>
|
|
684
688
|
</div>
|
|
@@ -690,17 +694,17 @@ function ve(e, t) {
|
|
|
690
694
|
id="continue-button"
|
|
691
695
|
dir=${e.dir}
|
|
692
696
|
quiet
|
|
693
|
-
size=${
|
|
697
|
+
size=${W(e.size)}
|
|
694
698
|
label=${n.continue}
|
|
695
|
-
?disabled=${e
|
|
699
|
+
?disabled=${q(e, t) || K(e)}
|
|
696
700
|
@click=${e.handlers.primary}
|
|
697
701
|
>
|
|
698
702
|
<div slot="icon">
|
|
699
703
|
<luzmo-icon
|
|
700
704
|
block
|
|
701
705
|
dir=${e.dir}
|
|
702
|
-
.size=${
|
|
703
|
-
.icon=${
|
|
706
|
+
.size=${W(e.size)}
|
|
707
|
+
.icon=${ee}
|
|
704
708
|
></luzmo-icon>
|
|
705
709
|
</div>
|
|
706
710
|
</luzmo-action-button>
|
|
@@ -721,8 +725,8 @@ function ve(e, t) {
|
|
|
721
725
|
</header>
|
|
722
726
|
`;
|
|
723
727
|
}
|
|
724
|
-
function
|
|
725
|
-
let n = e.copy
|
|
728
|
+
function xe(e, t) {
|
|
729
|
+
let n = e.copy;
|
|
726
730
|
return a`
|
|
727
731
|
<footer class="footer">
|
|
728
732
|
<div class="status">${X(e, t)}</div>
|
|
@@ -733,20 +737,20 @@ function ye(e, t) {
|
|
|
733
737
|
dir=${e.dir}
|
|
734
738
|
variant="primary"
|
|
735
739
|
treatment="outline"
|
|
736
|
-
size=${
|
|
737
|
-
?disabled=${e.disabled}
|
|
740
|
+
size=${W(e.size)}
|
|
741
|
+
?disabled=${e.disabled || e.readonly}
|
|
738
742
|
@click=${e.handlers.skip}
|
|
739
743
|
>${n.skip}</luzmo-button
|
|
740
744
|
>
|
|
741
745
|
`}
|
|
742
|
-
${
|
|
746
|
+
${K(e) && t.type === "multiple" ? a`
|
|
743
747
|
<luzmo-button
|
|
744
748
|
id="submit-button"
|
|
745
749
|
dir=${e.dir}
|
|
746
750
|
variant="primary"
|
|
747
751
|
treatment="outline"
|
|
748
|
-
size=${
|
|
749
|
-
?disabled=${e
|
|
752
|
+
size=${W(e.size)}
|
|
753
|
+
?disabled=${q(e, t)}
|
|
750
754
|
@click=${e.handlers.primary}
|
|
751
755
|
>${n.submit}</luzmo-button
|
|
752
756
|
>
|
|
@@ -755,28 +759,28 @@ function ye(e, t) {
|
|
|
755
759
|
</footer>
|
|
756
760
|
`;
|
|
757
761
|
}
|
|
758
|
-
function
|
|
762
|
+
function Se(e) {
|
|
759
763
|
if (e.questions.length === 0) return o;
|
|
760
|
-
if (e.resolved) return
|
|
764
|
+
if (e.resolved) return me(e);
|
|
761
765
|
let t = e.questions[e.step];
|
|
762
766
|
if (!t) return o;
|
|
763
|
-
let n = e.showError ? e.questionError(t) : void 0, r = !
|
|
767
|
+
let n = e.showError ? e.questionError(t) : void 0, r = !y(t) && (t.type === "multiple" || !e.hideSkip), i = [
|
|
764
768
|
e.questions.length > 1 ? "progress" : "",
|
|
765
769
|
t.description ? "question-description" : "",
|
|
766
770
|
n ? "question-error" : ""
|
|
767
771
|
].filter(Boolean).join(" ") || void 0;
|
|
768
772
|
return a`
|
|
769
773
|
<div class="card" @click=${e.handlers.contentClick}>
|
|
770
|
-
${
|
|
774
|
+
${be(e, t)}
|
|
771
775
|
<div
|
|
772
776
|
class="body"
|
|
773
777
|
role="group"
|
|
774
778
|
aria-labelledby="question-title"
|
|
775
|
-
aria-describedby=${
|
|
779
|
+
aria-describedby=${p(i)}
|
|
776
780
|
>
|
|
777
|
-
${t.type === "single" ?
|
|
781
|
+
${te(t.id, t.type === "single" ? ve(e, t, n) : ye(e, t, n))}
|
|
778
782
|
</div>
|
|
779
|
-
${r ?
|
|
783
|
+
${r ? xe(e, t) : o}
|
|
780
784
|
</div>
|
|
781
785
|
`;
|
|
782
786
|
}
|
|
@@ -838,12 +842,12 @@ var $ = class extends n(e, { validSizes: [
|
|
|
838
842
|
}, this.handleCancelClick = (e) => {
|
|
839
843
|
e.preventDefault(), this.cancel();
|
|
840
844
|
}, this.handleSkip = (e) => {
|
|
841
|
-
e.preventDefault(), !this.disabled && this.emitResult("decline");
|
|
845
|
+
e.preventDefault(), !(this.disabled || this.readonly) && this.emitResult("decline");
|
|
842
846
|
}, this.handleBack = (e) => {
|
|
843
847
|
e.preventDefault(), !(this.disabled || this._step === 0) && (this._showError = !1, --this._step, this.updateComplete.then(() => this.moveFocus(this.questionTitle)));
|
|
844
848
|
}, this.handlePrimary = () => {
|
|
845
849
|
let e = this.currentQuestion;
|
|
846
|
-
|
|
850
|
+
e && !this.disabled && (!this.readonly && this.questionInvalid(e) ? (this._showError = !0, this.focusOptions()) : (this._showError = !1, this._step < this.questions.length - 1 ? (this._step += 1, this.updateComplete.then(() => this.moveFocus(this.questionTitle))) : this.readonly || this.acceptFlow()));
|
|
847
851
|
}, this.handleChange = () => {
|
|
848
852
|
this._resolved = !1, this._submitted = !1, this._showError = !1, this.updateComplete.then(() => this.focusOptions());
|
|
849
853
|
}, this.handleRadioChange = (e) => {
|
|
@@ -851,7 +855,7 @@ var $ = class extends n(e, { validSizes: [
|
|
|
851
855
|
let t = this.currentQuestion;
|
|
852
856
|
if (!t) return;
|
|
853
857
|
let n = e.target.value || e.currentTarget.selected;
|
|
854
|
-
n && (n === "__other__" && !String(this.value[
|
|
858
|
+
n && (n === "__other__" && !String(this.value[v(t.id)] ?? "").trim() ? (this.requestUpdate(), this.updateComplete.then(() => this.moveFocus(this.otherField))) : (this.commitAnswer(t.id, n, !0), n !== "__other__" && (this._radioChangeAdvanced = !0, this.advanceAfterSingleSelection(), queueMicrotask(() => {
|
|
855
859
|
this._radioChangeAdvanced = !1;
|
|
856
860
|
}))));
|
|
857
861
|
}, this.handleRadioClick = (e) => {
|
|
@@ -865,13 +869,13 @@ var $ = class extends n(e, { validSizes: [
|
|
|
865
869
|
let n = e.currentTarget, r = n.dataset.value;
|
|
866
870
|
if (!r) return;
|
|
867
871
|
let i = new Set(this.selectedValues(t));
|
|
868
|
-
if (r === "__other__" && n.checked && !String(this.value[
|
|
872
|
+
if (r === "__other__" && n.checked && !String(this.value[v(t.id)] ?? "").trim()) {
|
|
869
873
|
n.checked = !1, this.moveFocus(this.otherField);
|
|
870
874
|
return;
|
|
871
875
|
}
|
|
872
876
|
n.checked ? i.add(r) : i.delete(r);
|
|
873
|
-
let a = [...t.options.map((e) => e.value), ...
|
|
874
|
-
this.commitAnswer(t.id,
|
|
877
|
+
let a = [...t.options.map((e) => e.value), ...y(t) ? [g] : []].filter((e) => i.has(e));
|
|
878
|
+
this.commitAnswer(t.id, w(a), !0), r === "__other__" && n.checked && this.updateComplete.then(() => this.moveFocus(this.otherField));
|
|
875
879
|
}, this.handleOtherInput = (e) => {
|
|
876
880
|
if (e.stopPropagation(), this.disabled || this.readonly) return;
|
|
877
881
|
let t = this.currentQuestion;
|
|
@@ -888,12 +892,12 @@ var $ = class extends n(e, { validSizes: [
|
|
|
888
892
|
if (e.key !== "Enter" || e.shiftKey || e.isComposing || this.disabled || this.readonly) return;
|
|
889
893
|
e.preventDefault();
|
|
890
894
|
let t = this.currentQuestion;
|
|
891
|
-
t && String(this.value[
|
|
895
|
+
t && String(this.value[v(t.id)] ?? "").trim() && this.handlePrimary();
|
|
892
896
|
};
|
|
893
897
|
}
|
|
894
898
|
static get styles() {
|
|
895
899
|
let e = super.styles;
|
|
896
|
-
return [...Array.isArray(e) ? e : e ? [e] : [], s(
|
|
900
|
+
return [...Array.isArray(e) ? e : e ? [e] : [], s(h)];
|
|
897
901
|
}
|
|
898
902
|
get optionIndicator() {
|
|
899
903
|
return this._optionIndicator;
|
|
@@ -934,7 +938,7 @@ var $ = class extends n(e, { validSizes: [
|
|
|
934
938
|
t.join("\0") !== n.join("\0") && (this._step = 0, this._resolved = !1, this._submitted = !1, this._showError = !1);
|
|
935
939
|
}
|
|
936
940
|
let t = j(this.questions, this.value);
|
|
937
|
-
|
|
941
|
+
C(t, this.value) || (this.value = t);
|
|
938
942
|
}
|
|
939
943
|
e.has("questions") && (this._step = Math.min(this._step, Math.max(0, this.questions.length - 1)));
|
|
940
944
|
}
|
|
@@ -942,7 +946,7 @@ var $ = class extends n(e, { validSizes: [
|
|
|
942
946
|
super.updated(e), (e.has("questions") || e.has("size") || e.has("disabled") || e.has("readonly") || e.has("_step") || e.has("_resolved")) && this.multipleChoiceRoving.clearElementCache();
|
|
943
947
|
}
|
|
944
948
|
render() {
|
|
945
|
-
return
|
|
949
|
+
return Se(this.renderContext);
|
|
946
950
|
}
|
|
947
951
|
get renderContext() {
|
|
948
952
|
return {
|
|
@@ -989,7 +993,7 @@ var $ = class extends n(e, { validSizes: [
|
|
|
989
993
|
};
|
|
990
994
|
}
|
|
991
995
|
get copy() {
|
|
992
|
-
return
|
|
996
|
+
return O(this.labels);
|
|
993
997
|
}
|
|
994
998
|
get currentQuestion() {
|
|
995
999
|
return this.questions[this._step];
|
|
@@ -1042,22 +1046,22 @@ var $ = class extends n(e, { validSizes: [
|
|
|
1042
1046
|
e === -1 ? (this._showError = !1, this._resolved = !0, this._submitted = !0, this.emitResult("accept", R(this.questions, this.value)), this.updateComplete.then(() => this.focus())) : (this._step = e, this._showError = !0, this.updateComplete.then(() => this.focusOptions()));
|
|
1043
1047
|
}
|
|
1044
1048
|
commitAnswer(e, t, n) {
|
|
1045
|
-
let r =
|
|
1046
|
-
|
|
1049
|
+
let r = x(this.value);
|
|
1050
|
+
S(r, e, t), this.assignValue(r, n);
|
|
1047
1051
|
}
|
|
1048
1052
|
commitOther(e, t, n) {
|
|
1049
|
-
let r =
|
|
1050
|
-
|
|
1053
|
+
let r = x(this.value);
|
|
1054
|
+
S(r, v(e.id), t);
|
|
1051
1055
|
let i = t.trim().length > 0;
|
|
1052
|
-
if (e.type === "single") i ?
|
|
1056
|
+
if (e.type === "single") i ? S(r, e.id, g) : r[e.id] === "__other__" && S(r, e.id, "");
|
|
1053
1057
|
else {
|
|
1054
1058
|
let t = new Set(this.selectedValues(e));
|
|
1055
|
-
i ? t.add(
|
|
1059
|
+
i ? t.add(g) : t.delete(g), S(r, e.id, [...e.options.map((e) => e.value), g].filter((e) => t.has(e)));
|
|
1056
1060
|
}
|
|
1057
1061
|
this.assignValue(r, n);
|
|
1058
1062
|
}
|
|
1059
1063
|
assignValue(e, t) {
|
|
1060
|
-
|
|
1064
|
+
C(e, this.value) || (this.value = e, this.dispatchEvent(new Event("input", {
|
|
1061
1065
|
bubbles: !0,
|
|
1062
1066
|
composed: !0
|
|
1063
1067
|
}))), t && this.dispatchEvent(new Event("change", {
|
|
@@ -1085,19 +1089,19 @@ var $ = class extends n(e, { validSizes: [
|
|
|
1085
1089
|
}));
|
|
1086
1090
|
}
|
|
1087
1091
|
selectedValues(e) {
|
|
1088
|
-
return
|
|
1092
|
+
return E(e, this.value);
|
|
1089
1093
|
}
|
|
1090
1094
|
isOtherSelected(e) {
|
|
1091
|
-
return
|
|
1095
|
+
return D(e, this.value);
|
|
1092
1096
|
}
|
|
1093
1097
|
questionError(e) {
|
|
1094
|
-
return
|
|
1098
|
+
return re(e, this.value, this.copy);
|
|
1095
1099
|
}
|
|
1096
1100
|
questionInvalid(e) {
|
|
1097
|
-
return
|
|
1101
|
+
return ne(e, this.value);
|
|
1098
1102
|
}
|
|
1099
1103
|
optionDisabled(e, t, n) {
|
|
1100
|
-
return
|
|
1104
|
+
return ie(e, t, n, this.value, this.disabled);
|
|
1101
1105
|
}
|
|
1102
1106
|
};
|
|
1103
1107
|
// src/components/question-box/index.ts
|
|
@@ -1123,4 +1127,4 @@ t([c({ attribute: !1 })], $.prototype, "questions", void 0), t([c({ attribute: !
|
|
|
1123
1127
|
reflect: !0,
|
|
1124
1128
|
attribute: "option-indicator"
|
|
1125
1129
|
})], $.prototype, "optionIndicator", null), t([u()], $.prototype, "_step", void 0), t([u()], $.prototype, "_resolved", void 0), t([u()], $.prototype, "_submitted", void 0), t([u()], $.prototype, "_showError", void 0), t([l("#question-title")], $.prototype, "questionTitle", void 0), t([l("#other-field")], $.prototype, "otherField", void 0), t([l("#options")], $.prototype, "optionsGroup", void 0), t([l("#resolved-title")], $.prototype, "resolvedTitle", void 0), typeof customElements < "u" && !customElements.get("luzmo-question-box") && customElements.define("luzmo-question-box", $);
|
|
1126
|
-
export {
|
|
1130
|
+
export { _ as a, R as i, I as n, g as o, de as r, v as s, $ as t };
|