@qaiddev/quests-embed 1.3.0 → 1.4.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/dist/embed.d.ts +2 -0
- package/dist/overflow.d.ts +49 -0
- package/dist/qaid-quests.js +144 -112
- package/dist/qaid-quests.js.map +1 -1
- package/dist/qaid-quests.umd.cjs +4 -4
- package/dist/qaid-quests.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/qaid-quests.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
const T = `*{box-sizing:border-box}button{cursor:pointer;font-family:inherit}:where(.qaid-q-root){--qaid-q-card-bg: light-dark(#ffffff, #1f2937);--qaid-q-card-fg: light-dark(#1f2937, #f9fafb);--qaid-q-card-border: light-dark(#e5e7eb, #374151);--qaid-q-card-radius: 1rem;--qaid-q-card-padding: 1.5rem;--qaid-q-card-shadow: 0 25px 50px -12px light-dark(rgba(0, 0, 0, .25), rgba(0, 0, 0, .6));--qaid-q-muted-fg: light-dark(#6b7280, #9ca3af);--qaid-q-progress-track: light-dark(#e5e7eb, #374151);--qaid-q-btn-radius: .5rem;--qaid-q-btn-padding-y: .625rem;--qaid-q-btn-padding-x: 1.125rem;--qaid-q-btn-font-weight: 500;--qaid-q-btn-primary-bg: var(--qaid-q-accent, #10b981);--qaid-q-btn-primary-fg: var(--qaid-q-accent-text, #ffffff);--qaid-q-btn-primary-border: transparent;--qaid-q-btn-secondary-bg: transparent;--qaid-q-btn-secondary-fg: light-dark(#374151, #d1d5db);--qaid-q-btn-secondary-border: light-dark(#d1d5db, #4b5563);--qaid-q-btn-secondary-hover-bg: light-dark(#f3f4f6, #374151);--qaid-q-option-bg: light-dark(#ffffff, #111827);--qaid-q-option-bg-selected: color-mix(in srgb, var(--qaid-q-accent, #10b981) 10%, transparent);--qaid-q-option-bg-hover: light-dark(#f9fafb, #1f2937);--qaid-q-option-fg: light-dark(#1f2937, #f9fafb);--qaid-q-option-border: light-dark(#e5e7eb, #374151);--qaid-q-option-border-selected: var(--qaid-q-accent, #10b981);--qaid-q-option-border-hover: light-dark(#9ca3af, #4b5563);--qaid-q-option-radius: .625rem;--qaid-q-option-padding: .75rem .875rem;--qaid-q-marker-bg: light-dark(#ffffff, #111827);--qaid-q-marker-bg-selected: var(--qaid-q-accent, #10b981);--qaid-q-marker-border: light-dark(#d1d5db, #4b5563);--qaid-q-marker-icon: light-dark(#ffffff, #1f2937);--qaid-q-marker-radius: 50%;--qaid-q-input-bg: light-dark(#ffffff, #111827);--qaid-q-input-fg: light-dark(#1f2937, #f9fafb);--qaid-q-input-border: light-dark(#d1d5db, #374151);--qaid-q-input-radius: .625rem;--qaid-q-input-padding: .75rem .875rem;--qaid-q-input-placeholder: light-dark(#9ca3af, #6b7280);--qaid-q-gap: .75rem;--qaid-q-section-gap: 1.25rem}:where(.qaid-q-root.qaid-q-theme-light){--qaid-q-card-bg: #ffffff;--qaid-q-card-fg: #1f2937;--qaid-q-card-border: #e5e7eb;--qaid-q-card-shadow: 0 25px 50px -12px rgba(0, 0, 0, .25);--qaid-q-muted-fg: #6b7280;--qaid-q-progress-track: #e5e7eb;--qaid-q-btn-secondary-fg: #374151;--qaid-q-btn-secondary-border: #d1d5db;--qaid-q-btn-secondary-hover-bg: #f3f4f6;--qaid-q-option-bg: #ffffff;--qaid-q-option-bg-hover: #f9fafb;--qaid-q-option-fg: #1f2937;--qaid-q-option-border: #e5e7eb;--qaid-q-option-border-hover: #9ca3af;--qaid-q-marker-bg: #ffffff;--qaid-q-marker-border: #d1d5db;--qaid-q-marker-icon: #ffffff;--qaid-q-input-bg: #ffffff;--qaid-q-input-fg: #1f2937;--qaid-q-input-border: #d1d5db;--qaid-q-input-placeholder: #9ca3af}:where(.qaid-q-root.qaid-q-theme-dark){--qaid-q-card-bg: #1f2937;--qaid-q-card-fg: #f9fafb;--qaid-q-card-border: #374151;--qaid-q-card-shadow: 0 25px 50px -12px rgba(0, 0, 0, .6);--qaid-q-muted-fg: #9ca3af;--qaid-q-progress-track: #374151;--qaid-q-btn-secondary-fg: #d1d5db;--qaid-q-btn-secondary-border: #4b5563;--qaid-q-btn-secondary-hover-bg: #374151;--qaid-q-option-bg: #111827;--qaid-q-option-bg-hover: #1f2937;--qaid-q-option-fg: #f9fafb;--qaid-q-option-border: #374151;--qaid-q-option-border-hover: #4b5563;--qaid-q-marker-bg: #111827;--qaid-q-marker-border: #4b5563;--qaid-q-marker-icon: #1f2937;--qaid-q-input-bg: #111827;--qaid-q-input-fg: #f9fafb;--qaid-q-input-border: #374151;--qaid-q-input-placeholder: #6b7280}.qaid-q-root{color-scheme:light dark;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px);color:var(--qaid-q-card-fg)}.qaid-q-root.qaid-q-theme-light{color-scheme:light}.qaid-q-root.qaid-q-theme-dark{color-scheme:dark}.qaid-q-backdrop{position:fixed;inset:0;z-index:45;background:rgba(0,0,0,var(--qaid-backdrop-opacity, .4));animation:qaid-q-fade .18s ease-out}@keyframes qaid-q-fade{0%{opacity:0}to{opacity:1}}.qaid-q-modal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:50;width:var(--qaid-modal-width, 480px);max-width:calc(100vw - 32px);max-height:calc(100vh - 32px);pointer-events:auto;display:flex;flex-direction:column}.qaid-q-card{background:var(--qaid-q-card-bg);color:var(--qaid-q-card-fg);border-radius:var(--qaid-q-card-radius);box-shadow:var(--qaid-q-card-shadow);padding:var(--qaid-q-card-padding);overflow:hidden;display:flex;flex-direction:column;min-height:0}:where(.qaid-q-root.qaid-q-inline) .qaid-q-card{box-shadow:none;border:1px solid var(--qaid-q-card-border);flex:1;min-height:0}:where(.qaid-q-root.qaid-q-inline){height:100%;display:flex;flex-direction:column;min-height:0}.qaid-q-header{display:flex;align-items:center;justify-content:space-between;gap:.75rem;margin-bottom:1rem}.qaid-q-title{font-size:1.125em;font-weight:700;margin:0;color:var(--qaid-q-card-fg)}.qaid-q-step-counter{font-size:.875em;color:var(--qaid-q-muted-fg);font-variant-numeric:tabular-nums;white-space:nowrap}.qaid-q-close{width:28px;height:28px;padding:0;border:none;border-radius:50%;background:transparent;color:var(--qaid-q-muted-fg);display:inline-flex;align-items:center;justify-content:center;-webkit-appearance:none;appearance:none}.qaid-q-close:hover{background:var(--qaid-q-btn-secondary-hover-bg);color:var(--qaid-q-card-fg)}.qaid-q-close:focus-visible{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 30%,transparent)}.qaid-q-progress{position:relative;height:4px;background:var(--qaid-q-progress-track);border-radius:9999px;overflow:hidden;margin-bottom:var(--qaid-q-section-gap)}.qaid-q-progress--inline{flex:1;min-width:60px;margin-bottom:0}.qaid-q-progress-fill{position:absolute;inset:0 auto 0 0;background:var(--qaid-q-accent, #10b981);border-radius:9999px;transition:width .3s ease;width:0%}.qaid-q-body{flex:1;min-height:0;overflow-y:auto}.qaid-q-step{display:flex;flex-direction:column;gap:var(--qaid-q-gap);animation:qaid-q-slide .22s ease-out}@keyframes qaid-q-slide{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.qaid-q-no-motion .qaid-q-step,.qaid-q-no-motion.qaid-q-root{animation:none!important}.qaid-q-label{font-size:1.125em;font-weight:600;margin:0;color:var(--qaid-q-card-fg);line-height:1.35}.qaid-q-label .qaid-q-required{color:var(--qaid-q-error, #ef4444);margin-left:.25rem}.qaid-q-description{font-size:.875em;color:var(--qaid-q-muted-fg);margin:0;line-height:1.4}.qaid-q-error{font-size:.8125em;color:var(--qaid-q-error, #ef4444);margin:0}.qaid-q-error:empty{display:none}.qaid-q-input,.qaid-q-textarea{width:100%;padding:var(--qaid-q-input-padding);border:1px solid var(--qaid-q-input-border);border-radius:var(--qaid-q-input-radius);font-family:inherit;font-size:1em;background:var(--qaid-q-input-bg);color:var(--qaid-q-input-fg);transition:border-color .15s,box-shadow .15s;-webkit-appearance:none;appearance:none}.qaid-q-textarea{min-height:7rem;resize:vertical;font-family:inherit}.qaid-q-input:focus,.qaid-q-textarea:focus{outline:none;border-color:var(--qaid-q-focus, #6366f1);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 20%,transparent)}.qaid-q-input::placeholder,.qaid-q-textarea::placeholder{color:var(--qaid-q-input-placeholder)}.qaid-q-currency{position:relative}.qaid-q-currency-prefix{position:absolute;left:.875rem;top:50%;transform:translateY(-50%);color:var(--qaid-q-muted-fg);font-size:1em;font-weight:500;pointer-events:none}.qaid-q-currency .qaid-q-input{padding-left:2.25rem}.qaid-q-range-wrap{display:flex;flex-direction:column;gap:.5rem;padding:.5rem 0}.qaid-q-range-value{font-size:2em;font-weight:700;text-align:center;font-variant-numeric:tabular-nums;color:var(--qaid-q-accent, #10b981)}.qaid-q-range-value .qaid-q-range-unit{font-size:.5em;font-weight:500;color:var(--qaid-q-muted-fg);margin-left:.25rem}.qaid-q-range{width:100%;-webkit-appearance:none;appearance:none;height:6px;border-radius:9999px;background:var(--qaid-q-progress-track);outline:none}.qaid-q-range::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:24px;height:24px;border-radius:50%;background:var(--qaid-q-accent, #10b981);border:3px solid var(--qaid-q-card-bg);box-shadow:0 2px 6px #0003;cursor:pointer;transition:transform .1s}.qaid-q-range::-moz-range-thumb{width:24px;height:24px;border-radius:50%;background:var(--qaid-q-accent, #10b981);border:3px solid var(--qaid-q-card-bg);box-shadow:0 2px 6px #0003;cursor:pointer}.qaid-q-range:focus-visible::-webkit-slider-thumb{box-shadow:0 0 0 6px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 30%,transparent)}.qaid-q-range:focus-visible::-moz-range-thumb{box-shadow:0 0 0 6px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 30%,transparent)}.qaid-q-range-bounds{display:flex;justify-content:space-between;font-size:.8125em;color:var(--qaid-q-muted-fg);font-variant-numeric:tabular-nums}.qaid-q-options{display:flex;flex-direction:column;gap:.5rem}.qaid-q-option{display:flex;align-items:flex-start;gap:.625rem;padding:var(--qaid-q-option-padding);border:1px solid var(--qaid-q-option-border);border-radius:var(--qaid-q-option-radius);background:var(--qaid-q-option-bg);text-align:left;font-size:1em;color:var(--qaid-q-option-fg);cursor:pointer;transition:border-color .12s,background .12s,box-shadow .12s;-webkit-appearance:none;appearance:none;width:100%}.qaid-q-option:hover{border-color:var(--qaid-q-option-border-hover);background:var(--qaid-q-option-bg-hover)}.qaid-q-option:focus-visible{outline:none;border-color:var(--qaid-q-focus, #6366f1);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 25%,transparent)}.qaid-q-option.qaid-q-selected{border-color:var(--qaid-q-option-border-selected);background:var(--qaid-q-option-bg-selected)}.qaid-q-option-marker{flex-shrink:0;width:1.25rem;height:1.25rem;border:2px solid var(--qaid-q-marker-border);border-radius:var(--qaid-q-marker-radius);display:inline-flex;align-items:center;justify-content:center;margin-top:.125rem;background:var(--qaid-q-marker-bg);transition:border-color .12s,background .12s}.qaid-q-option.qaid-q-multi .qaid-q-option-marker{border-radius:.25rem}.qaid-q-option.qaid-q-selected .qaid-q-option-marker{border-color:var(--qaid-q-marker-bg-selected);background:var(--qaid-q-marker-bg-selected)}.qaid-q-option.qaid-q-selected .qaid-q-option-marker:after{content:"";display:block;width:.5rem;height:.5rem;border-radius:50%;background:var(--qaid-q-marker-icon)}.qaid-q-option.qaid-q-multi.qaid-q-selected .qaid-q-option-marker:after{content:"";display:block;width:70%;height:70%;border-radius:0;background:var(--qaid-q-marker-icon);-webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' d='M5 12l4 4L19 7'/></svg>");mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' d='M5 12l4 4L19 7'/></svg>");-webkit-mask-size:contain;mask-size:contain;-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;transform:none}.qaid-q-option-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:.125rem}.qaid-q-option-image{display:block;width:48px;height:48px;aspect-ratio:1 / 1;object-fit:cover;border-radius:.375rem;background:var(--qaid-q-progress-track);flex-shrink:0}.qaid-q-options--image-horizontal .qaid-q-option-body{flex-direction:row;align-items:center;gap:.75rem}.qaid-q-options--image-horizontal .qaid-q-option-body>:not(.qaid-q-option-image){flex:1;min-width:0;display:flex;flex-direction:column;gap:.125rem}.qaid-q-options--image-vertical{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:.5rem}.qaid-q-options--image-vertical .qaid-q-option{flex-direction:column;align-items:stretch;text-align:center;padding:.75rem;gap:.5rem}.qaid-q-options--image-vertical .qaid-q-option-body{align-items:center;text-align:center}.qaid-q-options--image-vertical .qaid-q-option-image{width:100%;height:auto;max-width:100%}.qaid-q-options--image-vertical .qaid-q-option-marker{position:absolute;top:.5rem;right:.5rem;margin-top:0}.qaid-q-options--image-vertical .qaid-q-option{position:relative}.qaid-q-options--image-vertical .qaid-q-option-key{position:absolute;top:.5rem;left:.5rem;align-self:auto}.qaid-q-option-label{font-weight:500;line-height:1.3}.qaid-q-option-desc{font-size:.8125em;color:var(--qaid-q-muted-fg);line-height:1.4}.qaid-q-option-key{flex-shrink:0;align-self:center;font-size:.7em;font-weight:600;padding:.125rem .375rem;border-radius:.25rem;background:var(--qaid-q-progress-track);color:var(--qaid-q-muted-fg);font-variant-numeric:tabular-nums}.qaid-q-footer{display:flex;align-items:center;justify-content:space-between;gap:.5rem;margin-top:var(--qaid-q-section-gap)}.qaid-q-footer--inline-progress{justify-content:flex-start;gap:.75rem}.qaid-q-footer-left,.qaid-q-footer-right{display:flex;gap:.5rem}.qaid-q-btn{padding:var(--qaid-q-btn-padding-y) var(--qaid-q-btn-padding-x);border-radius:var(--qaid-q-btn-radius);font-size:var(--qaid-q-btn-font-size, .9375em);font-weight:var(--qaid-q-btn-font-weight);border:1px solid transparent;cursor:pointer;transition:filter .15s,background .15s,color .15s;-webkit-appearance:none;appearance:none}.qaid-q-btn:focus-visible{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 30%,transparent)}.qaid-q-btn-secondary{background:var(--qaid-q-btn-secondary-bg);border-color:var(--qaid-q-btn-secondary-border);color:var(--qaid-q-btn-secondary-fg)}.qaid-q-btn-secondary:hover{background:var(--qaid-q-btn-secondary-hover-bg)}.qaid-q-btn-primary{background:var(--qaid-q-btn-primary-bg);color:var(--qaid-q-btn-primary-fg);border-color:var(--qaid-q-btn-primary-border)}.qaid-q-btn-primary:hover{filter:brightness(.9)}.qaid-q-btn-primary:disabled{opacity:.5;cursor:not-allowed;filter:none}.qaid-q-done{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:.5rem;padding:1.5rem 0;flex:1;min-height:0}.qaid-q-done-icon{width:48px;height:48px;border-radius:50%;background:color-mix(in srgb,var(--qaid-q-accent, #10b981) 18%,transparent);color:var(--qaid-q-accent, #10b981);display:inline-flex;align-items:center;justify-content:center;margin-bottom:.5rem}.qaid-q-done-title{font-size:1.25em;font-weight:700;margin:0}.qaid-q-done-message{color:var(--qaid-q-muted-fg);margin:0}.qaid-q-saving{display:inline-flex;align-items:center;gap:.375rem;font-size:.75em;color:var(--qaid-q-muted-fg);opacity:0;transition:opacity .2s}.qaid-q-saving.qaid-q-visible{opacity:1}.qaid-q-saving-dot{width:6px;height:6px;border-radius:50%;background:var(--qaid-q-accent, #10b981);animation:qaid-q-pulse 1.2s ease-in-out infinite}@keyframes qaid-q-pulse{0%,to{opacity:.3}50%{opacity:1}}:where(.qaid-q-root.qaid-q-unstyled) :where(.qaid-q-card,.qaid-q-header,.qaid-q-title,.qaid-q-description,.qaid-q-step,.qaid-q-label,.qaid-q-options,.qaid-q-option,.qaid-q-option-marker,.qaid-q-option-body,.qaid-q-option-label,.qaid-q-option-desc,.qaid-q-input,.qaid-q-textarea,.qaid-q-currency,.qaid-q-currency-prefix,.qaid-q-range,.qaid-q-range-wrap,.qaid-q-range-value,.qaid-q-btn,.qaid-q-footer,.qaid-q-progress,.qaid-q-progress-fill,.qaid-q-step-counter,.qaid-q-error,.qaid-q-saving,.qaid-q-done,.qaid-q-done-icon,.qaid-q-done-title,.qaid-q-done-message){all:unset;display:revert;box-sizing:border-box}.qaid-q-input:focus-visible,.qaid-q-textarea:focus-visible,.qaid-q-option:focus-visible,.qaid-q-btn:focus-visible,.qaid-q-close:focus-visible,.qaid-q-range:focus-visible{outline:2px solid transparent;outline-offset:2px}@media(prefers-reduced-motion:reduce){.qaid-q-root *,.qaid-q-root *:before,.qaid-q-root *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}.qaid-q-range::-webkit-slider-thumb{transition:none!important}.qaid-q-range::-moz-range-thumb{transition:none!important}}@media(forced-colors:active){.qaid-q-input:focus-visible,.qaid-q-textarea:focus-visible,.qaid-q-option:focus-visible,.qaid-q-btn:focus-visible,.qaid-q-close:focus-visible,.qaid-q-range:focus-visible{outline:2px solid Highlight;outline-offset:2px}.qaid-q-card{border:1px solid CanvasText}.qaid-q-input,.qaid-q-textarea,.qaid-q-option{border-color:CanvasText}.qaid-q-option.qaid-q-selected{border-color:Highlight}.qaid-q-option.qaid-q-selected .qaid-q-option-marker{forced-color-adjust:none;background:Highlight;border-color:Highlight}.qaid-q-option.qaid-q-selected .qaid-q-option-marker:after{background:HighlightText}.qaid-q-progress{forced-color-adjust:none;background:Canvas;border:1px solid CanvasText}.qaid-q-progress-fill{forced-color-adjust:none;background:Highlight}}`;
|
|
2
|
-
const
|
|
1
|
+
const L = `*{box-sizing:border-box}button{cursor:pointer;font-family:inherit}:where(.qaid-q-root){--qaid-q-card-bg: light-dark(#ffffff, #1f2937);--qaid-q-card-fg: light-dark(#1f2937, #f9fafb);--qaid-q-card-border: light-dark(#e5e7eb, #374151);--qaid-q-card-radius: 1rem;--qaid-q-card-padding: 1.5rem;--qaid-q-card-shadow: 0 25px 50px -12px light-dark(rgba(0, 0, 0, .25), rgba(0, 0, 0, .6));--qaid-q-muted-fg: light-dark(#6b7280, #9ca3af);--qaid-q-progress-track: light-dark(#e5e7eb, #374151);--qaid-q-btn-radius: .5rem;--qaid-q-btn-padding-y: .625rem;--qaid-q-btn-padding-x: 1.125rem;--qaid-q-btn-font-weight: 500;--qaid-q-btn-primary-bg: var(--qaid-q-accent, #10b981);--qaid-q-btn-primary-fg: var(--qaid-q-accent-text, #ffffff);--qaid-q-btn-primary-border: transparent;--qaid-q-btn-secondary-bg: transparent;--qaid-q-btn-secondary-fg: light-dark(#374151, #d1d5db);--qaid-q-btn-secondary-border: light-dark(#d1d5db, #4b5563);--qaid-q-btn-secondary-hover-bg: light-dark(#f3f4f6, #374151);--qaid-q-option-bg: light-dark(#ffffff, #111827);--qaid-q-option-bg-selected: color-mix(in srgb, var(--qaid-q-accent, #10b981) 10%, transparent);--qaid-q-option-bg-hover: light-dark(#f9fafb, #1f2937);--qaid-q-option-fg: light-dark(#1f2937, #f9fafb);--qaid-q-option-border: light-dark(#e5e7eb, #374151);--qaid-q-option-border-selected: var(--qaid-q-accent, #10b981);--qaid-q-option-border-hover: light-dark(#9ca3af, #4b5563);--qaid-q-option-radius: .625rem;--qaid-q-option-padding: .75rem .875rem;--qaid-q-marker-bg: light-dark(#ffffff, #111827);--qaid-q-marker-bg-selected: var(--qaid-q-accent, #10b981);--qaid-q-marker-border: light-dark(#d1d5db, #4b5563);--qaid-q-marker-icon: light-dark(#ffffff, #1f2937);--qaid-q-marker-radius: 50%;--qaid-q-input-bg: light-dark(#ffffff, #111827);--qaid-q-input-fg: light-dark(#1f2937, #f9fafb);--qaid-q-input-border: light-dark(#d1d5db, #374151);--qaid-q-input-radius: .625rem;--qaid-q-input-padding: .75rem .875rem;--qaid-q-input-placeholder: light-dark(#9ca3af, #6b7280);--qaid-q-gap: .75rem;--qaid-q-section-gap: 1.25rem}:where(.qaid-q-root.qaid-q-theme-light){--qaid-q-card-bg: #ffffff;--qaid-q-card-fg: #1f2937;--qaid-q-card-border: #e5e7eb;--qaid-q-card-shadow: 0 25px 50px -12px rgba(0, 0, 0, .25);--qaid-q-muted-fg: #6b7280;--qaid-q-progress-track: #e5e7eb;--qaid-q-btn-secondary-fg: #374151;--qaid-q-btn-secondary-border: #d1d5db;--qaid-q-btn-secondary-hover-bg: #f3f4f6;--qaid-q-option-bg: #ffffff;--qaid-q-option-bg-hover: #f9fafb;--qaid-q-option-fg: #1f2937;--qaid-q-option-border: #e5e7eb;--qaid-q-option-border-hover: #9ca3af;--qaid-q-marker-bg: #ffffff;--qaid-q-marker-border: #d1d5db;--qaid-q-marker-icon: #ffffff;--qaid-q-input-bg: #ffffff;--qaid-q-input-fg: #1f2937;--qaid-q-input-border: #d1d5db;--qaid-q-input-placeholder: #9ca3af}:where(.qaid-q-root.qaid-q-theme-dark){--qaid-q-card-bg: #1f2937;--qaid-q-card-fg: #f9fafb;--qaid-q-card-border: #374151;--qaid-q-card-shadow: 0 25px 50px -12px rgba(0, 0, 0, .6);--qaid-q-muted-fg: #9ca3af;--qaid-q-progress-track: #374151;--qaid-q-btn-secondary-fg: #d1d5db;--qaid-q-btn-secondary-border: #4b5563;--qaid-q-btn-secondary-hover-bg: #374151;--qaid-q-option-bg: #111827;--qaid-q-option-bg-hover: #1f2937;--qaid-q-option-fg: #f9fafb;--qaid-q-option-border: #374151;--qaid-q-option-border-hover: #4b5563;--qaid-q-marker-bg: #111827;--qaid-q-marker-border: #4b5563;--qaid-q-marker-icon: #1f2937;--qaid-q-input-bg: #111827;--qaid-q-input-fg: #f9fafb;--qaid-q-input-border: #374151;--qaid-q-input-placeholder: #6b7280}.qaid-q-root{color-scheme:light dark;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px);color:var(--qaid-q-card-fg)}.qaid-q-root.qaid-q-theme-light{color-scheme:light}.qaid-q-root.qaid-q-theme-dark{color-scheme:dark}.qaid-q-backdrop{position:fixed;inset:0;z-index:45;background:rgba(0,0,0,var(--qaid-backdrop-opacity, .4));animation:qaid-q-fade .18s ease-out}@keyframes qaid-q-fade{0%{opacity:0}to{opacity:1}}.qaid-q-modal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:50;width:var(--qaid-modal-width, 480px);max-width:calc(100vw - 32px);max-height:calc(100vh - 32px);pointer-events:auto;display:flex;flex-direction:column}.qaid-q-card{background:var(--qaid-q-card-bg);color:var(--qaid-q-card-fg);border-radius:var(--qaid-q-card-radius);box-shadow:var(--qaid-q-card-shadow);padding:var(--qaid-q-card-padding);overflow:hidden;display:flex;flex-direction:column;min-height:0}:where(.qaid-q-root.qaid-q-inline) .qaid-q-card{box-shadow:none;border:1px solid var(--qaid-q-card-border);flex:1;min-height:0}:where(.qaid-q-root.qaid-q-inline){height:100%;display:flex;flex-direction:column;min-height:0}.qaid-q-header{display:flex;align-items:center;justify-content:space-between;gap:.75rem;margin-bottom:1rem}.qaid-q-title{font-size:1.125em;font-weight:700;margin:0;color:var(--qaid-q-card-fg)}.qaid-q-step-counter{font-size:.875em;color:var(--qaid-q-muted-fg);font-variant-numeric:tabular-nums;white-space:nowrap}.qaid-q-close{width:28px;height:28px;padding:0;border:none;border-radius:50%;background:transparent;color:var(--qaid-q-muted-fg);display:inline-flex;align-items:center;justify-content:center;-webkit-appearance:none;appearance:none}.qaid-q-close:hover{background:var(--qaid-q-btn-secondary-hover-bg);color:var(--qaid-q-card-fg)}.qaid-q-close:focus-visible{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 30%,transparent)}.qaid-q-progress{position:relative;height:4px;background:var(--qaid-q-progress-track);border-radius:9999px;overflow:hidden;margin-bottom:var(--qaid-q-section-gap)}.qaid-q-progress--inline{flex:1;min-width:60px;margin-bottom:0}.qaid-q-progress-fill{position:absolute;inset:0 auto 0 0;background:var(--qaid-q-accent, #10b981);border-radius:9999px;transition:width .3s ease;width:0%}.qaid-q-body{flex:1;min-height:0;overflow-y:auto;position:relative}.qaid-q-body[data-qaid-scroll=top]{-webkit-mask-image:linear-gradient(to bottom,#000 calc(100% - 2.5rem),transparent 100%);mask-image:linear-gradient(to bottom,#000 calc(100% - 2.5rem),transparent 100%)}.qaid-q-body[data-qaid-scroll=middle]{-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 2rem,#000 calc(100% - 2.5rem),transparent 100%);mask-image:linear-gradient(to bottom,transparent 0,#000 2rem,#000 calc(100% - 2.5rem),transparent 100%)}.qaid-q-body[data-qaid-scroll=bottom]{-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 2rem);mask-image:linear-gradient(to bottom,transparent 0,#000 2rem)}.qaid-q-scroll-cue{position:sticky;bottom:0;left:0;display:flex;justify-content:center;align-items:flex-end;height:1.5rem;margin-top:-1.5rem;pointer-events:none;color:var(--qaid-q-muted-fg)}.qaid-q-scroll-cue[hidden]{display:none}.qaid-q-scroll-cue svg{width:1.125rem;height:1.125rem;animation:qaid-q-nudge 1.6s ease-in-out infinite}@keyframes qaid-q-nudge{0%,to{transform:translateY(-2px);opacity:.55}50%{transform:translateY(2px);opacity:1}}.qaid-q-card[data-qaid-fit=compact] .qaid-q-options--image-vertical{grid-template-columns:repeat(auto-fit,minmax(104px,1fr));gap:.375rem}.qaid-q-card[data-qaid-fit=compact] .qaid-q-options--image-vertical .qaid-q-option{padding:.5rem;gap:.375rem}.qaid-q-card[data-qaid-fit=compact] .qaid-q-options--image-vertical .qaid-q-option-image{max-height:5.5rem;object-fit:contain}.qaid-q-card[data-qaid-fit=compact] .qaid-q-option-desc{font-size:.75em}.qaid-q-card[data-qaid-fit=compact] .qaid-q-step{gap:calc(var(--qaid-q-gap) * .6)}.qaid-q-card[data-qaid-fit=compact] .qaid-q-options--image-horizontal .qaid-q-option-image{width:36px;height:36px}.qaid-q-step{display:flex;flex-direction:column;gap:var(--qaid-q-gap);animation:qaid-q-slide .22s ease-out}@keyframes qaid-q-slide{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.qaid-q-no-motion .qaid-q-step,.qaid-q-no-motion.qaid-q-root{animation:none!important}.qaid-q-label{font-size:1.125em;font-weight:600;margin:0;color:var(--qaid-q-card-fg);line-height:1.35}.qaid-q-label .qaid-q-required{color:var(--qaid-q-error, #ef4444);margin-left:.25rem}.qaid-q-description{font-size:.875em;color:var(--qaid-q-muted-fg);margin:0;line-height:1.4}.qaid-q-error{font-size:.8125em;color:var(--qaid-q-error, #ef4444);margin:0}.qaid-q-error:empty{display:none}.qaid-q-input,.qaid-q-textarea{width:100%;padding:var(--qaid-q-input-padding);border:1px solid var(--qaid-q-input-border);border-radius:var(--qaid-q-input-radius);font-family:inherit;font-size:1em;background:var(--qaid-q-input-bg);color:var(--qaid-q-input-fg);transition:border-color .15s,box-shadow .15s;-webkit-appearance:none;appearance:none}.qaid-q-textarea{min-height:7rem;resize:vertical;font-family:inherit}.qaid-q-input:focus,.qaid-q-textarea:focus{outline:none;border-color:var(--qaid-q-focus, #6366f1);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 20%,transparent)}.qaid-q-input::placeholder,.qaid-q-textarea::placeholder{color:var(--qaid-q-input-placeholder)}.qaid-q-currency{position:relative}.qaid-q-currency-prefix{position:absolute;left:.875rem;top:50%;transform:translateY(-50%);color:var(--qaid-q-muted-fg);font-size:1em;font-weight:500;pointer-events:none}.qaid-q-currency .qaid-q-input{padding-left:2.25rem}.qaid-q-range-wrap{display:flex;flex-direction:column;gap:.5rem;padding:.5rem 0}.qaid-q-range-value{font-size:2em;font-weight:700;text-align:center;font-variant-numeric:tabular-nums;color:var(--qaid-q-accent, #10b981)}.qaid-q-range-value .qaid-q-range-unit{font-size:.5em;font-weight:500;color:var(--qaid-q-muted-fg);margin-left:.25rem}.qaid-q-range{width:100%;-webkit-appearance:none;appearance:none;height:6px;border-radius:9999px;background:var(--qaid-q-progress-track);outline:none}.qaid-q-range::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:24px;height:24px;border-radius:50%;background:var(--qaid-q-accent, #10b981);border:3px solid var(--qaid-q-card-bg);box-shadow:0 2px 6px #0003;cursor:pointer;transition:transform .1s}.qaid-q-range::-moz-range-thumb{width:24px;height:24px;border-radius:50%;background:var(--qaid-q-accent, #10b981);border:3px solid var(--qaid-q-card-bg);box-shadow:0 2px 6px #0003;cursor:pointer}.qaid-q-range:focus-visible::-webkit-slider-thumb{box-shadow:0 0 0 6px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 30%,transparent)}.qaid-q-range:focus-visible::-moz-range-thumb{box-shadow:0 0 0 6px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 30%,transparent)}.qaid-q-range-bounds{display:flex;justify-content:space-between;font-size:.8125em;color:var(--qaid-q-muted-fg);font-variant-numeric:tabular-nums}.qaid-q-options{display:flex;flex-direction:column;gap:.5rem}.qaid-q-option{display:flex;align-items:flex-start;gap:.625rem;padding:var(--qaid-q-option-padding);border:1px solid var(--qaid-q-option-border);border-radius:var(--qaid-q-option-radius);background:var(--qaid-q-option-bg);text-align:left;font-size:1em;color:var(--qaid-q-option-fg);cursor:pointer;transition:border-color .12s,background .12s,box-shadow .12s;-webkit-appearance:none;appearance:none;width:100%}.qaid-q-option:hover{border-color:var(--qaid-q-option-border-hover);background:var(--qaid-q-option-bg-hover)}.qaid-q-option:focus-visible{outline:none;border-color:var(--qaid-q-focus, #6366f1);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 25%,transparent)}.qaid-q-option.qaid-q-selected{border-color:var(--qaid-q-option-border-selected);background:var(--qaid-q-option-bg-selected)}.qaid-q-option-marker{flex-shrink:0;width:1.25rem;height:1.25rem;border:2px solid var(--qaid-q-marker-border);border-radius:var(--qaid-q-marker-radius);display:inline-flex;align-items:center;justify-content:center;margin-top:.125rem;background:var(--qaid-q-marker-bg);transition:border-color .12s,background .12s}.qaid-q-option.qaid-q-multi .qaid-q-option-marker{border-radius:.25rem}.qaid-q-option.qaid-q-selected .qaid-q-option-marker{border-color:var(--qaid-q-marker-bg-selected);background:var(--qaid-q-marker-bg-selected)}.qaid-q-option.qaid-q-selected .qaid-q-option-marker:after{content:"";display:block;width:.5rem;height:.5rem;border-radius:50%;background:var(--qaid-q-marker-icon)}.qaid-q-option.qaid-q-multi.qaid-q-selected .qaid-q-option-marker:after{content:"";display:block;width:70%;height:70%;border-radius:0;background:var(--qaid-q-marker-icon);-webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' d='M5 12l4 4L19 7'/></svg>");mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' d='M5 12l4 4L19 7'/></svg>");-webkit-mask-size:contain;mask-size:contain;-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;transform:none}.qaid-q-option-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:.125rem}.qaid-q-option-image{display:block;width:48px;height:48px;aspect-ratio:1 / 1;object-fit:cover;border-radius:.375rem;background:var(--qaid-q-progress-track);flex-shrink:0}.qaid-q-options--image-horizontal .qaid-q-option-body{flex-direction:row;align-items:center;gap:.75rem}.qaid-q-options--image-horizontal .qaid-q-option-body>:not(.qaid-q-option-image){flex:1;min-width:0;display:flex;flex-direction:column;gap:.125rem}.qaid-q-options--image-vertical{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:.5rem}.qaid-q-options--image-vertical .qaid-q-option{flex-direction:column;align-items:stretch;text-align:center;padding:.75rem;gap:.5rem}.qaid-q-options--image-vertical .qaid-q-option-body{align-items:center;text-align:center}.qaid-q-options--image-vertical .qaid-q-option-image{width:100%;height:auto;max-width:100%}.qaid-q-options--image-vertical .qaid-q-option-marker{position:absolute;top:.5rem;right:.5rem;margin-top:0}.qaid-q-options--image-vertical .qaid-q-option{position:relative}.qaid-q-options--image-vertical .qaid-q-option-key{position:absolute;top:.5rem;left:.5rem;align-self:auto}.qaid-q-option-label{font-weight:500;line-height:1.3}.qaid-q-option-desc{font-size:.8125em;color:var(--qaid-q-muted-fg);line-height:1.4}.qaid-q-option-key{flex-shrink:0;align-self:center;font-size:.7em;font-weight:600;padding:.125rem .375rem;border-radius:.25rem;background:var(--qaid-q-progress-track);color:var(--qaid-q-muted-fg);font-variant-numeric:tabular-nums}.qaid-q-footer{display:flex;align-items:center;justify-content:space-between;gap:.5rem;margin-top:var(--qaid-q-section-gap)}.qaid-q-footer--inline-progress{justify-content:flex-start;gap:.75rem}.qaid-q-footer-left,.qaid-q-footer-right{display:flex;gap:.5rem}.qaid-q-btn{padding:var(--qaid-q-btn-padding-y) var(--qaid-q-btn-padding-x);border-radius:var(--qaid-q-btn-radius);font-size:var(--qaid-q-btn-font-size, .9375em);font-weight:var(--qaid-q-btn-font-weight);border:1px solid transparent;cursor:pointer;transition:filter .15s,background .15s,color .15s;-webkit-appearance:none;appearance:none}.qaid-q-btn:focus-visible{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 30%,transparent)}.qaid-q-btn-secondary{background:var(--qaid-q-btn-secondary-bg);border-color:var(--qaid-q-btn-secondary-border);color:var(--qaid-q-btn-secondary-fg)}.qaid-q-btn-secondary:hover{background:var(--qaid-q-btn-secondary-hover-bg)}.qaid-q-btn-primary{background:var(--qaid-q-btn-primary-bg);color:var(--qaid-q-btn-primary-fg);border-color:var(--qaid-q-btn-primary-border)}.qaid-q-btn-primary:hover{filter:brightness(.9)}.qaid-q-btn-primary:disabled{opacity:.5;cursor:not-allowed;filter:none}.qaid-q-done{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:.5rem;padding:1.5rem 0;flex:1;min-height:0}.qaid-q-done-icon{width:48px;height:48px;border-radius:50%;background:color-mix(in srgb,var(--qaid-q-accent, #10b981) 18%,transparent);color:var(--qaid-q-accent, #10b981);display:inline-flex;align-items:center;justify-content:center;margin-bottom:.5rem}.qaid-q-done-title{font-size:1.25em;font-weight:700;margin:0}.qaid-q-done-message{color:var(--qaid-q-muted-fg);margin:0}.qaid-q-saving{display:inline-flex;align-items:center;gap:.375rem;font-size:.75em;color:var(--qaid-q-muted-fg);opacity:0;transition:opacity .2s}.qaid-q-saving.qaid-q-visible{opacity:1}.qaid-q-saving-dot{width:6px;height:6px;border-radius:50%;background:var(--qaid-q-accent, #10b981);animation:qaid-q-pulse 1.2s ease-in-out infinite}@keyframes qaid-q-pulse{0%,to{opacity:.3}50%{opacity:1}}:where(.qaid-q-root.qaid-q-unstyled) :where(.qaid-q-card,.qaid-q-header,.qaid-q-title,.qaid-q-description,.qaid-q-step,.qaid-q-label,.qaid-q-options,.qaid-q-option,.qaid-q-option-marker,.qaid-q-option-body,.qaid-q-option-label,.qaid-q-option-desc,.qaid-q-input,.qaid-q-textarea,.qaid-q-currency,.qaid-q-currency-prefix,.qaid-q-range,.qaid-q-range-wrap,.qaid-q-range-value,.qaid-q-btn,.qaid-q-footer,.qaid-q-progress,.qaid-q-progress-fill,.qaid-q-step-counter,.qaid-q-error,.qaid-q-saving,.qaid-q-done,.qaid-q-done-icon,.qaid-q-done-title,.qaid-q-done-message){all:unset;display:revert;box-sizing:border-box}.qaid-q-input:focus-visible,.qaid-q-textarea:focus-visible,.qaid-q-option:focus-visible,.qaid-q-btn:focus-visible,.qaid-q-close:focus-visible,.qaid-q-range:focus-visible{outline:2px solid transparent;outline-offset:2px}@media(prefers-reduced-motion:reduce){.qaid-q-root *,.qaid-q-root *:before,.qaid-q-root *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}.qaid-q-range::-webkit-slider-thumb{transition:none!important}.qaid-q-range::-moz-range-thumb{transition:none!important}}@media(forced-colors:active){.qaid-q-input:focus-visible,.qaid-q-textarea:focus-visible,.qaid-q-option:focus-visible,.qaid-q-btn:focus-visible,.qaid-q-close:focus-visible,.qaid-q-range:focus-visible{outline:2px solid Highlight;outline-offset:2px}.qaid-q-card{border:1px solid CanvasText}.qaid-q-input,.qaid-q-textarea,.qaid-q-option{border-color:CanvasText}.qaid-q-option.qaid-q-selected{border-color:Highlight}.qaid-q-option.qaid-q-selected .qaid-q-option-marker{forced-color-adjust:none;background:Highlight;border-color:Highlight}.qaid-q-option.qaid-q-selected .qaid-q-option-marker:after{background:HighlightText}.qaid-q-progress{forced-color-adjust:none;background:Canvas;border:1px solid CanvasText}.qaid-q-progress-fill{forced-color-adjust:none;background:Highlight}}`;
|
|
2
|
+
const z = ":where(.qaid-q-root){--qaid-q-card-radius: 0;--qaid-q-card-shadow: none;--qaid-q-btn-radius: 0;--qaid-q-option-radius: 0;--qaid-q-option-bg-selected: transparent;--qaid-q-input-radius: 0}", H = ":where(.qaid-q-root){--qaid-q-card-radius: 1.5rem;--qaid-q-btn-radius: 9999px;--qaid-q-btn-padding-x: 1.5rem;--qaid-q-option-radius: 9999px;--qaid-q-option-padding: .75rem 1.125rem;--qaid-q-input-radius: 9999px;--qaid-q-input-padding: .75rem 1.125rem}", D = ":where(.qaid-q-root){--qaid-q-card-padding: 1rem;--qaid-q-btn-padding-y: .5rem;--qaid-q-btn-padding-x: .875rem;--qaid-q-option-padding: .5rem .625rem;--qaid-q-input-padding: .5rem .625rem;--qaid-q-gap: .5rem;--qaid-q-section-gap: .875rem}", O = {
|
|
3
3
|
default: "",
|
|
4
|
-
minimal:
|
|
5
|
-
pill:
|
|
4
|
+
minimal: z,
|
|
5
|
+
pill: H,
|
|
6
6
|
dense: D
|
|
7
7
|
};
|
|
8
|
-
function
|
|
9
|
-
return
|
|
8
|
+
function V(t) {
|
|
9
|
+
return O[t] ?? "";
|
|
10
10
|
}
|
|
11
11
|
function R(t, e, i) {
|
|
12
12
|
const [a, n, o] = [t, e, i].map((r) => (r = r / 255, r <= 0.03928 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4)));
|
|
13
13
|
return 0.2126 * a + 0.7152 * n + 0.0722 * o;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function P(t) {
|
|
16
16
|
if (t.startsWith("#")) {
|
|
17
17
|
const i = t.slice(1), a = i.length === 3 ? i.split("").map((o) => o + o).join("") : i, n = parseInt(a, 16);
|
|
18
18
|
return { r: n >> 16 & 255, g: n >> 8 & 255, b: n & 255 };
|
|
@@ -20,23 +20,23 @@ function O(t) {
|
|
|
20
20
|
const e = t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
21
21
|
return e ? { r: parseInt(e[1]), g: parseInt(e[2]), b: parseInt(e[3]) } : null;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
const e =
|
|
23
|
+
function k(t) {
|
|
24
|
+
const e = P(t);
|
|
25
25
|
return e && R(e.r, e.g, e.b) > 0.4 ? "black" : "white";
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function j(t = {}) {
|
|
28
28
|
const e = {};
|
|
29
|
-
return t.accentColor !== void 0 && (e["--qaid-q-accent"] = t.accentColor, e["--qaid-q-accent-text"] =
|
|
29
|
+
return t.accentColor !== void 0 && (e["--qaid-q-accent"] = t.accentColor, e["--qaid-q-accent-text"] = k(t.accentColor)), t.errorColor !== void 0 && (e["--qaid-q-error"] = t.errorColor), t.focusColor !== void 0 && (e["--qaid-q-focus"] = t.focusColor, e["--qaid-q-focus-text"] = k(t.focusColor)), t.modalWidth !== void 0 && (e["--qaid-modal-width"] = `${t.modalWidth}px`), t.backdropOpacity !== void 0 && (e["--qaid-backdrop-opacity"] = String(t.backdropOpacity)), t.fontFamily !== void 0 && (e["--qaid-font-family"] = t.fontFamily), t.fontSize !== void 0 && (e["--qaid-font-size"] = `${t.fontSize}px`), e;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function U(t, e) {
|
|
32
32
|
for (const [i, a] of Object.entries(e))
|
|
33
33
|
t.style.setProperty(i, a);
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
return
|
|
35
|
+
function F() {
|
|
36
|
+
return L;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
return
|
|
38
|
+
function M(t) {
|
|
39
|
+
return V(t);
|
|
40
40
|
}
|
|
41
41
|
function b(t) {
|
|
42
42
|
let e = null;
|
|
@@ -54,21 +54,21 @@ function b(t) {
|
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function $(t) {
|
|
58
58
|
switch (t.question.type) {
|
|
59
59
|
case "text":
|
|
60
|
-
return
|
|
60
|
+
return Q(t.question, t);
|
|
61
61
|
case "currency":
|
|
62
|
-
return
|
|
62
|
+
return B(t.question, t);
|
|
63
63
|
case "range":
|
|
64
|
-
return
|
|
64
|
+
return _(t.question, t);
|
|
65
65
|
case "date":
|
|
66
66
|
return W(t.question, t);
|
|
67
67
|
case "multiple-choice":
|
|
68
|
-
return
|
|
68
|
+
return G(t.question, t);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function Q(t, e) {
|
|
72
72
|
const i = typeof e.initialValue == "string" ? e.initialValue : "";
|
|
73
73
|
let a;
|
|
74
74
|
if (t.multiline) {
|
|
@@ -76,7 +76,7 @@ function M(t, e) {
|
|
|
76
76
|
n.className = "qaid-q-textarea", n.value = i, t.placeholder && (n.placeholder = t.placeholder), t.maxLength && (n.maxLength = t.maxLength), a = n;
|
|
77
77
|
} else {
|
|
78
78
|
const n = document.createElement("input");
|
|
79
|
-
n.className = "qaid-q-input", n.type = t.inputType ?? "text", n.value = i, t.placeholder && (n.placeholder = t.placeholder), t.maxLength && (n.maxLength = t.maxLength), n.setAttribute("autocomplete",
|
|
79
|
+
n.className = "qaid-q-input", n.type = t.inputType ?? "text", n.value = i, t.placeholder && (n.placeholder = t.placeholder), t.maxLength && (n.maxLength = t.maxLength), n.setAttribute("autocomplete", K(t.inputType)), a = n;
|
|
80
80
|
}
|
|
81
81
|
return a.setAttribute("aria-label", t.label), t.required && a.setAttribute("aria-required", "true"), a.addEventListener("input", () => {
|
|
82
82
|
e.onChange(a.value);
|
|
@@ -107,7 +107,7 @@ function M(t, e) {
|
|
|
107
107
|
...b(a)
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function K(t) {
|
|
111
111
|
switch (t) {
|
|
112
112
|
case "email":
|
|
113
113
|
return "email";
|
|
@@ -119,11 +119,11 @@ function Q(t) {
|
|
|
119
119
|
return "off";
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function B(t, e) {
|
|
123
123
|
const i = document.createElement("div");
|
|
124
124
|
i.className = "qaid-q-currency";
|
|
125
125
|
const a = document.createElement("span");
|
|
126
|
-
a.className = "qaid-q-currency-prefix", a.textContent =
|
|
126
|
+
a.className = "qaid-q-currency-prefix", a.textContent = Y(t.currency ?? "USD", t.locale), i.appendChild(a);
|
|
127
127
|
const n = document.createElement("input");
|
|
128
128
|
return n.className = "qaid-q-input", n.type = "number", n.inputMode = "decimal", n.step = "0.01", typeof t.min == "number" && (n.min = String(t.min)), typeof t.max == "number" && (n.max = String(t.max)), t.placeholder && (n.placeholder = t.placeholder), typeof e.initialValue == "number" ? n.value = String(e.initialValue) : typeof e.initialValue == "string" && e.initialValue !== "" && (n.value = e.initialValue), n.setAttribute("aria-label", t.label), t.required && n.setAttribute("aria-required", "true"), n.addEventListener("input", () => {
|
|
129
129
|
const o = n.value;
|
|
@@ -150,7 +150,7 @@ function K(t, e) {
|
|
|
150
150
|
...b(n)
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function Y(t, e) {
|
|
154
154
|
try {
|
|
155
155
|
return new Intl.NumberFormat(e, {
|
|
156
156
|
style: "currency",
|
|
@@ -162,7 +162,7 @@ function B(t, e) {
|
|
|
162
162
|
return t;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function _(t, e) {
|
|
166
166
|
const i = document.createElement("div");
|
|
167
167
|
i.className = "qaid-q-range-wrap";
|
|
168
168
|
const a = document.createElement("div");
|
|
@@ -186,8 +186,8 @@ function Y(t, e) {
|
|
|
186
186
|
q.className = "qaid-q-range-bounds";
|
|
187
187
|
const p = document.createElement("span");
|
|
188
188
|
p.textContent = `${t.min}${t.unit ?? ""}`;
|
|
189
|
-
const
|
|
190
|
-
return
|
|
189
|
+
const f = document.createElement("span");
|
|
190
|
+
return f.textContent = `${t.max}${t.unit ?? ""}`, q.appendChild(p), q.appendChild(f), i.appendChild(a), i.appendChild(r), i.appendChild(q), queueMicrotask(() => e.onChange(Number(r.value))), {
|
|
191
191
|
element: i,
|
|
192
192
|
focus: () => r.focus(),
|
|
193
193
|
getValue: () => Number(r.value),
|
|
@@ -209,7 +209,7 @@ function W(t, e) {
|
|
|
209
209
|
...b(i)
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function G(t, e) {
|
|
213
213
|
const i = document.createElement("div"), a = t.imageAlignment ?? "horizontal", o = t.options.some((s) => !!s.image) ? a === "vertical" ? " qaid-q-options--image-vertical" : " qaid-q-options--image-horizontal" : "";
|
|
214
214
|
i.className = `qaid-q-options${o}`, i.setAttribute("role", t.multiple ? "group" : "radiogroup"), i.setAttribute("aria-label", t.label), t.required && i.setAttribute("aria-required", "true");
|
|
215
215
|
const r = /* @__PURE__ */ new Set();
|
|
@@ -220,8 +220,8 @@ function _(t, e) {
|
|
|
220
220
|
t.options.forEach((s, u) => {
|
|
221
221
|
const d = document.createElement("button");
|
|
222
222
|
d.type = "button", d.className = `qaid-q-option${t.multiple ? " qaid-q-multi" : ""}`, d.dataset.value = s.value, d.setAttribute("role", t.multiple ? "checkbox" : "radio"), d.setAttribute("aria-checked", r.has(s.value) ? "true" : "false"), r.has(s.value) && d.classList.add("qaid-q-selected");
|
|
223
|
-
const
|
|
224
|
-
|
|
223
|
+
const m = document.createElement("span");
|
|
224
|
+
m.className = "qaid-q-option-marker", m.setAttribute("aria-hidden", "true");
|
|
225
225
|
const g = document.createElement("span");
|
|
226
226
|
if (g.className = "qaid-q-option-body", s.image) {
|
|
227
227
|
const l = document.createElement("img");
|
|
@@ -232,7 +232,7 @@ function _(t, e) {
|
|
|
232
232
|
const l = document.createElement("span");
|
|
233
233
|
l.className = "qaid-q-option-desc", l.textContent = s.description, g.appendChild(l);
|
|
234
234
|
}
|
|
235
|
-
if (d.appendChild(
|
|
235
|
+
if (d.appendChild(m), d.appendChild(g), u < 9) {
|
|
236
236
|
const l = document.createElement("span");
|
|
237
237
|
l.className = "qaid-q-option-key", l.textContent = String(u + 1), l.setAttribute("aria-hidden", "true"), d.appendChild(l);
|
|
238
238
|
}
|
|
@@ -260,11 +260,11 @@ function _(t, e) {
|
|
|
260
260
|
function p(s) {
|
|
261
261
|
const u = t.options[s].value;
|
|
262
262
|
t.multiple ? r.has(u) ? r.delete(u) : r.add(u) : (r.clear(), r.add(u)), c.forEach((d) => {
|
|
263
|
-
const
|
|
263
|
+
const m = d.dataset.value, g = r.has(m);
|
|
264
264
|
d.classList.toggle("qaid-q-selected", g), d.setAttribute("aria-checked", g ? "true" : "false");
|
|
265
|
-
}), e.onChange(
|
|
265
|
+
}), e.onChange(f()), !t.multiple && e.autoAdvance && setTimeout(() => e.onAutoAdvance(), 180);
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function f() {
|
|
268
268
|
if (t.multiple) return Array.from(r);
|
|
269
269
|
const s = r.values().next();
|
|
270
270
|
return s.done ? null : s.value;
|
|
@@ -274,25 +274,25 @@ function _(t, e) {
|
|
|
274
274
|
focus: () => {
|
|
275
275
|
(c.find((u) => u.classList.contains("qaid-q-selected")) ?? c[0])?.focus();
|
|
276
276
|
},
|
|
277
|
-
getValue: () =>
|
|
277
|
+
getValue: () => f(),
|
|
278
278
|
isValid: () => t.required ? r.size > 0 : !0,
|
|
279
279
|
...b(i)
|
|
280
280
|
};
|
|
281
281
|
}
|
|
282
|
-
function
|
|
282
|
+
function J(t, e) {
|
|
283
283
|
return t.questions.filter(
|
|
284
|
-
(i) => i.visibleIf ?
|
|
284
|
+
(i) => i.visibleIf ? E(i.visibleIf, e) : !0
|
|
285
285
|
);
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function E(t, e) {
|
|
288
288
|
if ("allOf" in t) {
|
|
289
289
|
for (const n of t.allOf)
|
|
290
|
-
if (!
|
|
290
|
+
if (!E(n, e)) return !1;
|
|
291
291
|
return !0;
|
|
292
292
|
}
|
|
293
293
|
if ("anyOf" in t) {
|
|
294
294
|
for (const n of t.anyOf)
|
|
295
|
-
if (
|
|
295
|
+
if (E(n, e)) return !0;
|
|
296
296
|
return !1;
|
|
297
297
|
}
|
|
298
298
|
const i = e[t.questionId], a = i != null && !(typeof i == "string" && i.trim() === "") && !(Array.isArray(i) && i.length === 0);
|
|
@@ -301,7 +301,37 @@ function x(t, e) {
|
|
|
301
301
|
function y(t, e) {
|
|
302
302
|
return Array.isArray(t) ? t.some((i) => i === e) : t === e;
|
|
303
303
|
}
|
|
304
|
-
const
|
|
304
|
+
const X = 360, x = 2;
|
|
305
|
+
function Z(t) {
|
|
306
|
+
const e = t.scrollHeight - t.clientHeight;
|
|
307
|
+
return e <= x ? "none" : t.scrollTop <= x ? "top" : t.scrollTop >= e - x ? "bottom" : "middle";
|
|
308
|
+
}
|
|
309
|
+
function ee(t, e) {
|
|
310
|
+
const i = Z(t);
|
|
311
|
+
if (t.setAttribute("data-qaid-scroll", i), e) {
|
|
312
|
+
const a = i === "top" || i === "middle";
|
|
313
|
+
e.hidden = !a;
|
|
314
|
+
}
|
|
315
|
+
return i;
|
|
316
|
+
}
|
|
317
|
+
function te(t, e) {
|
|
318
|
+
const i = e > 0 && e < X ? "compact" : "roomy";
|
|
319
|
+
return t.setAttribute("data-qaid-fit", i), i;
|
|
320
|
+
}
|
|
321
|
+
function ie(t, e, i) {
|
|
322
|
+
const a = () => {
|
|
323
|
+
ee(t, i), te(e, t.clientHeight);
|
|
324
|
+
};
|
|
325
|
+
t.addEventListener("scroll", a, { passive: !0 });
|
|
326
|
+
let n = null;
|
|
327
|
+
return typeof ResizeObserver == "function" && (n = new ResizeObserver(a), n.observe(t)), a(), {
|
|
328
|
+
refresh: a,
|
|
329
|
+
destroy() {
|
|
330
|
+
t.removeEventListener("scroll", a), n?.disconnect();
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
const C = "data-qaid-a11y-live", ae = "position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;", ne = [
|
|
305
335
|
"a[href]",
|
|
306
336
|
"button",
|
|
307
337
|
"input",
|
|
@@ -309,25 +339,25 @@ const k = "data-qaid-a11y-live", J = "position:absolute;width:1px;height:1px;mar
|
|
|
309
339
|
"select",
|
|
310
340
|
"[tabindex]"
|
|
311
341
|
].join(",");
|
|
312
|
-
function
|
|
342
|
+
function re(t) {
|
|
313
343
|
return t.ownerDocument || document;
|
|
314
344
|
}
|
|
315
|
-
function
|
|
345
|
+
function oe(t, e) {
|
|
316
346
|
const i = e ? "assertive" : "polite", a = t.querySelector(
|
|
317
|
-
`[${
|
|
347
|
+
`[${C}="${i}"]`
|
|
318
348
|
);
|
|
319
349
|
if (a) return a;
|
|
320
|
-
const o =
|
|
321
|
-
return o.setAttribute(
|
|
350
|
+
const o = re(t).createElement("div");
|
|
351
|
+
return o.setAttribute(C, i), o.setAttribute("role", e ? "alert" : "status"), o.setAttribute("aria-live", e ? "assertive" : "polite"), o.setAttribute("aria-atomic", "true"), o.style.cssText = ae, t.appendChild(o), o;
|
|
322
352
|
}
|
|
323
353
|
function v(t, e, i = {}) {
|
|
324
|
-
const a =
|
|
354
|
+
const a = oe(t, !!i.assertive);
|
|
325
355
|
a.textContent = "", a.textContent = e;
|
|
326
356
|
}
|
|
327
|
-
function
|
|
357
|
+
function se(t) {
|
|
328
358
|
return t.hasAttribute("disabled") ? !0 : t.disabled === !0;
|
|
329
359
|
}
|
|
330
|
-
function
|
|
360
|
+
function de(t) {
|
|
331
361
|
let e = t;
|
|
332
362
|
for (; e; ) {
|
|
333
363
|
if (e.hasAttribute("hidden")) return !0;
|
|
@@ -338,52 +368,52 @@ function ie(t) {
|
|
|
338
368
|
}
|
|
339
369
|
return !1;
|
|
340
370
|
}
|
|
341
|
-
function
|
|
371
|
+
function A(t) {
|
|
342
372
|
return Array.from(
|
|
343
|
-
t.querySelectorAll(
|
|
344
|
-
).filter((i) => !(i.getAttribute("tabindex") === "-1" || i instanceof HTMLInputElement && i.type === "hidden" || i instanceof HTMLAnchorElement && !i.getAttribute("href") ||
|
|
373
|
+
t.querySelectorAll(ne)
|
|
374
|
+
).filter((i) => !(i.getAttribute("tabindex") === "-1" || i instanceof HTMLInputElement && i.type === "hidden" || i instanceof HTMLAnchorElement && !i.getAttribute("href") || se(i) || de(i)));
|
|
345
375
|
}
|
|
346
|
-
function
|
|
376
|
+
function I(t) {
|
|
347
377
|
let e = t.activeElement;
|
|
348
378
|
for (; e && e.shadowRoot && e.shadowRoot.activeElement; )
|
|
349
379
|
e = e.shadowRoot.activeElement;
|
|
350
380
|
return e instanceof HTMLElement ? e : null;
|
|
351
381
|
}
|
|
352
|
-
function
|
|
382
|
+
function le(t) {
|
|
353
383
|
const e = t.ownerDocument || document;
|
|
354
384
|
let i = !1;
|
|
355
385
|
const a = (o) => {
|
|
356
386
|
if (o.key !== "Tab") return;
|
|
357
|
-
const r =
|
|
387
|
+
const r = A(t);
|
|
358
388
|
if (r.length === 0) {
|
|
359
389
|
o.preventDefault(), t.focus();
|
|
360
390
|
return;
|
|
361
391
|
}
|
|
362
|
-
const c = r[0], q = r[r.length - 1], p =
|
|
363
|
-
o.shiftKey ? (!
|
|
392
|
+
const c = r[0], q = r[r.length - 1], p = I(e), f = p ? r.indexOf(p) !== -1 : !1;
|
|
393
|
+
o.shiftKey ? (!f || p === c) && (o.preventDefault(), q.focus()) : (!f || p === q) && (o.preventDefault(), c.focus());
|
|
364
394
|
};
|
|
365
395
|
t.addEventListener("keydown", a);
|
|
366
|
-
const n =
|
|
396
|
+
const n = A(t);
|
|
367
397
|
return n.length > 0 ? n[0].focus() : (t.hasAttribute("tabindex") || (t.setAttribute("tabindex", "-1"), i = !0), t.focus()), {
|
|
368
398
|
release() {
|
|
369
399
|
t.removeEventListener("keydown", a), i && (t.removeAttribute("tabindex"), i = !1);
|
|
370
400
|
}
|
|
371
401
|
};
|
|
372
402
|
}
|
|
373
|
-
function
|
|
374
|
-
return
|
|
403
|
+
function ce() {
|
|
404
|
+
return I(document);
|
|
375
405
|
}
|
|
376
|
-
function
|
|
406
|
+
function ue(t) {
|
|
377
407
|
if (!(!t || typeof t.focus != "function"))
|
|
378
408
|
try {
|
|
379
409
|
t.focus();
|
|
380
410
|
} catch {
|
|
381
411
|
}
|
|
382
412
|
}
|
|
383
|
-
function
|
|
413
|
+
function he(t, e = {}) {
|
|
384
414
|
t.setAttribute("role", "dialog"), t.setAttribute("aria-modal", "true"), e.labelledbyId && t.setAttribute("aria-labelledby", e.labelledbyId), e.describedbyId && t.setAttribute("aria-describedby", e.describedbyId), e.label && t.setAttribute("aria-label", e.label);
|
|
385
415
|
}
|
|
386
|
-
function
|
|
416
|
+
function qe(t, e) {
|
|
387
417
|
let i = t;
|
|
388
418
|
for (; i && i !== e; ) {
|
|
389
419
|
const a = i.parentNode;
|
|
@@ -397,11 +427,11 @@ function se(t, e) {
|
|
|
397
427
|
}
|
|
398
428
|
return null;
|
|
399
429
|
}
|
|
400
|
-
function
|
|
430
|
+
function pe(t) {
|
|
401
431
|
const i = (t.ownerDocument || document).body;
|
|
402
432
|
if (!i) return () => {
|
|
403
433
|
};
|
|
404
|
-
const a =
|
|
434
|
+
const a = qe(t, i), n = [];
|
|
405
435
|
return Array.from(i.children).forEach((o) => {
|
|
406
436
|
if (!(o instanceof HTMLElement) || a && o === a) return;
|
|
407
437
|
const r = o.inert === !0, c = o.getAttribute("aria-hidden");
|
|
@@ -413,17 +443,17 @@ function de(t) {
|
|
|
413
443
|
}
|
|
414
444
|
};
|
|
415
445
|
}
|
|
416
|
-
const
|
|
417
|
-
function
|
|
446
|
+
const S = "qaid_visitor_id";
|
|
447
|
+
function me() {
|
|
418
448
|
try {
|
|
419
|
-
let t = localStorage.getItem(
|
|
420
|
-
return t || (t = crypto.randomUUID(), localStorage.setItem(
|
|
449
|
+
let t = localStorage.getItem(S);
|
|
450
|
+
return t || (t = crypto.randomUUID(), localStorage.setItem(S, t)), t;
|
|
421
451
|
} catch {
|
|
422
452
|
return crypto.randomUUID();
|
|
423
453
|
}
|
|
424
454
|
}
|
|
425
|
-
const
|
|
426
|
-
class
|
|
455
|
+
const fe = '<svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true"><path d="M2 2l10 10M12 2L2 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" fill="none"/></svg>', ge = '<svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12l4 4L19 7" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" fill="none"/></svg>';
|
|
456
|
+
class be {
|
|
427
457
|
config;
|
|
428
458
|
questionnaire = null;
|
|
429
459
|
inlineQuestionnaire;
|
|
@@ -463,6 +493,8 @@ class he {
|
|
|
463
493
|
progressEl = null;
|
|
464
494
|
progressFillEl = null;
|
|
465
495
|
bodyEl = null;
|
|
496
|
+
scrollCueEl = null;
|
|
497
|
+
overflow = null;
|
|
466
498
|
footerEl = null;
|
|
467
499
|
savingEl = null;
|
|
468
500
|
backdropEl = null;
|
|
@@ -538,10 +570,10 @@ class he {
|
|
|
538
570
|
backdropOpacity: e.backdropOpacity,
|
|
539
571
|
fontFamily: e.fontFamily,
|
|
540
572
|
fontSize: e.fontSize
|
|
541
|
-
}, this.themeUrl = e.themeUrl, this.themeDocument = e.themeDocument, this.hostCss = e.css ?? "", this.metadata = e.metadata, this.onCompleteCb = e.onComplete, this.onCloseCb = e.onClose, this.inlineQuestionnaire = e.questionnaire, this.configUrl = e.configUrl, this.visitorId =
|
|
573
|
+
}, this.themeUrl = e.themeUrl, this.themeDocument = e.themeDocument, this.hostCss = e.css ?? "", this.metadata = e.metadata, this.onCompleteCb = e.onComplete, this.onCloseCb = e.onClose, this.inlineQuestionnaire = e.questionnaire, this.configUrl = e.configUrl, this.visitorId = me(), this.boundKeyDown = this.handleKeyDown.bind(this), this.init();
|
|
542
574
|
}
|
|
543
575
|
async init() {
|
|
544
|
-
this.cssVars =
|
|
576
|
+
this.cssVars = j(this.hostInlineVars), this.mountShell(), this.renderLoading();
|
|
545
577
|
try {
|
|
546
578
|
const [e, i] = await Promise.all([
|
|
547
579
|
this.loadQuestionnaire(),
|
|
@@ -608,7 +640,7 @@ ${r}
|
|
|
608
640
|
}`);
|
|
609
641
|
}
|
|
610
642
|
if (i && i !== "default") {
|
|
611
|
-
const r =
|
|
643
|
+
const r = M(i);
|
|
612
644
|
r && o.push(r);
|
|
613
645
|
}
|
|
614
646
|
if (e?.css && e.css.trim() !== "" && o.push(e.css), this.hostCss && this.hostCss.trim() !== "" && o.push(this.hostCss), o.length > 0) {
|
|
@@ -638,20 +670,20 @@ ${r}
|
|
|
638
670
|
mountShell() {
|
|
639
671
|
this.shadowHost = document.createElement("div"), this.shadowHost.setAttribute("data-qaid-quests", "");
|
|
640
672
|
const e = this.config.container ? document.querySelector(this.config.container) : null;
|
|
641
|
-
e ? (this.shadowHost.style.display = "block", this.shadowHost.style.height = "100%", this.shadowHost.style.minHeight = "0", e.appendChild(this.shadowHost), this.isUserContainer = !0) : (this.savedOpener =
|
|
673
|
+
e ? (this.shadowHost.style.display = "block", this.shadowHost.style.height = "100%", this.shadowHost.style.minHeight = "0", e.appendChild(this.shadowHost), this.isUserContainer = !0) : (this.savedOpener = ce(), this.shadowHost.style.position = "fixed", this.shadowHost.style.inset = "0", this.shadowHost.style.zIndex = String(this.config.zIndex), this.shadowHost.style.pointerEvents = "none", document.body.appendChild(this.shadowHost)), this.shadowRoot = this.shadowHost.attachShadow({ mode: "open" });
|
|
642
674
|
const i = document.createElement("style");
|
|
643
|
-
if (i.textContent =
|
|
675
|
+
if (i.textContent = F(), this.shadowRoot.appendChild(i), this.rootEl = document.createElement("div"), this.rootEl.className = [
|
|
644
676
|
"qaid-q-root",
|
|
645
677
|
this.isUserContainer ? "qaid-q-inline" : "",
|
|
646
678
|
this.config.animate ? "" : "qaid-q-no-motion"
|
|
647
|
-
].filter(Boolean).join(" "),
|
|
679
|
+
].filter(Boolean).join(" "), U(this.rootEl, this.cssVars), this.isUserContainer)
|
|
648
680
|
this.cardEl = document.createElement("div"), this.cardEl.className = "qaid-q-card", this.rootEl.appendChild(this.cardEl);
|
|
649
681
|
else {
|
|
650
682
|
this.backdropEl = document.createElement("div"), this.backdropEl.className = "qaid-q-backdrop", this.backdropEl.addEventListener("click", () => this.close()), this.rootEl.appendChild(this.backdropEl);
|
|
651
683
|
const a = document.createElement("div");
|
|
652
684
|
a.className = "qaid-q-modal", this.cardEl = document.createElement("div"), this.cardEl.className = "qaid-q-card", a.appendChild(this.cardEl), this.rootEl.appendChild(a);
|
|
653
685
|
}
|
|
654
|
-
this.shadowRoot.appendChild(this.rootEl), !this.isUserContainer && this.shadowHost && (this.shadowHost.style.pointerEvents = "auto"), !this.isUserContainer && this.cardEl &&
|
|
686
|
+
this.shadowRoot.appendChild(this.rootEl), !this.isUserContainer && this.shadowHost && (this.shadowHost.style.pointerEvents = "auto"), !this.isUserContainer && this.cardEl && he(this.cardEl), document.addEventListener("keydown", this.boundKeyDown);
|
|
655
687
|
}
|
|
656
688
|
renderLoading() {
|
|
657
689
|
if (!this.cardEl) return;
|
|
@@ -681,16 +713,16 @@ ${r}
|
|
|
681
713
|
q.className = "qaid-q-saving-dot";
|
|
682
714
|
const p = document.createElement("span");
|
|
683
715
|
p.textContent = "Saving…", this.savingEl.appendChild(q), this.savingEl.appendChild(p), this.stepCounterEl = document.createElement("div"), this.stepCounterEl.className = "qaid-q-step-counter", this.progressEl = document.createElement("div"), this.progressEl.className = i ? "qaid-q-progress qaid-q-progress--inline" : "qaid-q-progress", this.progressFillEl = document.createElement("div"), this.progressFillEl.className = "qaid-q-progress-fill", this.progressEl.appendChild(this.progressFillEl);
|
|
684
|
-
const
|
|
685
|
-
if (
|
|
716
|
+
const f = n || c;
|
|
717
|
+
if (f) {
|
|
686
718
|
const s = document.createElement("div");
|
|
687
719
|
s.className = "qaid-q-header";
|
|
688
720
|
const u = document.createElement("div");
|
|
689
721
|
n && (this.titleEl = document.createElement("h2"), this.titleEl.className = "qaid-q-title", this.titleEl.textContent = this.questionnaire.title, u.appendChild(this.titleEl));
|
|
690
722
|
const d = document.createElement("div");
|
|
691
723
|
if (d.style.display = "flex", d.style.alignItems = "center", d.style.gap = "0.5rem", i || (d.appendChild(this.savingEl), e || d.appendChild(this.stepCounterEl)), r) {
|
|
692
|
-
const
|
|
693
|
-
|
|
724
|
+
const m = document.createElement("button");
|
|
725
|
+
m.type = "button", m.className = "qaid-q-close", m.setAttribute("aria-label", "Close form"), m.innerHTML = fe, m.addEventListener("click", () => this.close()), d.appendChild(m);
|
|
694
726
|
}
|
|
695
727
|
s.appendChild(u), s.appendChild(d), this.cardEl.appendChild(s);
|
|
696
728
|
}
|
|
@@ -699,9 +731,9 @@ ${r}
|
|
|
699
731
|
this.questionnaire.title ?? "Questionnaire"
|
|
700
732
|
))), o) {
|
|
701
733
|
const s = document.createElement("p");
|
|
702
|
-
s.className = "qaid-q-description", s.textContent = this.questionnaire.description, s.style.marginTop =
|
|
734
|
+
s.className = "qaid-q-description", s.textContent = this.questionnaire.description, s.style.marginTop = f ? "-0.5rem" : "0", s.style.marginBottom = "0.75rem", this.cardEl.appendChild(s);
|
|
703
735
|
}
|
|
704
|
-
!i && !e && this.cardEl.appendChild(this.progressEl), this.bodyEl = document.createElement("div"), this.bodyEl.className = "qaid-q-body", this.cardEl.appendChild(this.bodyEl), this.footerEl = document.createElement("div"), this.footerEl.className = "qaid-q-footer", this.cardEl.appendChild(this.footerEl);
|
|
736
|
+
!i && !e && this.cardEl.appendChild(this.progressEl), this.bodyEl = document.createElement("div"), this.bodyEl.className = "qaid-q-body", this.cardEl.appendChild(this.bodyEl), this.footerEl = document.createElement("div"), this.footerEl.className = "qaid-q-footer", this.cardEl.appendChild(this.footerEl), this.scrollCueEl = document.createElement("div"), this.scrollCueEl.className = "qaid-q-scroll-cue", this.scrollCueEl.setAttribute("aria-hidden", "true"), this.scrollCueEl.hidden = !0, this.scrollCueEl.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>', this.bodyEl.appendChild(this.scrollCueEl), this.overflow = ie(this.bodyEl, this.cardEl, this.scrollCueEl);
|
|
705
737
|
}
|
|
706
738
|
// ------------------------------------------------------------------
|
|
707
739
|
// Step rendering
|
|
@@ -736,7 +768,7 @@ ${r}
|
|
|
736
768
|
}
|
|
737
769
|
const r = document.createElement("p");
|
|
738
770
|
r.className = "qaid-q-error", r.id = `qaid-q-error-${i}`, r.setAttribute("aria-live", "polite");
|
|
739
|
-
const c = this.answers[a.id] ?? null, q = i === e - 1, p =
|
|
771
|
+
const c = this.answers[a.id] ?? null, q = i === e - 1, p = $({
|
|
740
772
|
question: a,
|
|
741
773
|
initialValue: c,
|
|
742
774
|
onChange: (h) => {
|
|
@@ -746,7 +778,7 @@ ${r}
|
|
|
746
778
|
onAutoAdvance: () => this.advance(a, r),
|
|
747
779
|
autoAdvance: this.config.autoAdvance
|
|
748
780
|
});
|
|
749
|
-
this.currentInput = p, n.appendChild(p.element), n.appendChild(r), this.bodyEl.replaceChildren(n), this.footerEl.replaceChildren();
|
|
781
|
+
this.currentInput = p, n.appendChild(p.element), n.appendChild(r), this.bodyEl.replaceChildren(n), this.scrollCueEl && this.bodyEl.appendChild(this.scrollCueEl), this.bodyEl.scrollTop = 0, this.overflow?.refresh(), this.footerEl.replaceChildren();
|
|
750
782
|
const s = !(!!this.questionnaire.hideProgress || this.questionnaire.questions.length <= 1) && this.effectiveProgressPosition() === "bottom", u = i > 0 ? (() => {
|
|
751
783
|
const h = document.createElement("button");
|
|
752
784
|
return h.type = "button", h.className = "qaid-q-btn qaid-q-btn-secondary", h.textContent = this.questionnaire.backLabel ?? "Back", h.addEventListener("click", () => this.back()), h;
|
|
@@ -760,8 +792,8 @@ ${r}
|
|
|
760
792
|
const l = document.createElement("div");
|
|
761
793
|
l.className = "qaid-q-footer-right", u && h.appendChild(u), l.appendChild(d), this.footerEl.appendChild(h), this.footerEl.appendChild(l);
|
|
762
794
|
}
|
|
763
|
-
const
|
|
764
|
-
this.hasRenderedStep = !0, (!
|
|
795
|
+
const m = !this.hasRenderedStep;
|
|
796
|
+
this.hasRenderedStep = !0, (!m || this.config.autoFocus) && requestAnimationFrame(() => p.focus());
|
|
765
797
|
}
|
|
766
798
|
renderDone() {
|
|
767
799
|
if (!this.cardEl || !this.questionnaire) return;
|
|
@@ -769,7 +801,7 @@ ${r}
|
|
|
769
801
|
const e = document.createElement("div");
|
|
770
802
|
e.className = "qaid-q-done";
|
|
771
803
|
const i = document.createElement("div");
|
|
772
|
-
i.className = "qaid-q-done-icon", i.innerHTML =
|
|
804
|
+
i.className = "qaid-q-done-icon", i.innerHTML = ge, e.appendChild(i);
|
|
773
805
|
const a = document.createElement("h3");
|
|
774
806
|
a.className = "qaid-q-done-title";
|
|
775
807
|
const n = this.questionnaire.thankYouTitle ?? "Thank you!";
|
|
@@ -792,7 +824,7 @@ ${r}
|
|
|
792
824
|
advance(e, i) {
|
|
793
825
|
if (!this.currentInput || !this.questionnaire) return;
|
|
794
826
|
if (!this.currentInput.isValid()) {
|
|
795
|
-
i.textContent =
|
|
827
|
+
i.textContent = ve(e), this.currentInput.setInvalid(i.id), this.currentInput.focus();
|
|
796
828
|
return;
|
|
797
829
|
}
|
|
798
830
|
if (this.handleAnswerChange(e, this.currentInput.getValue(), { immediate: !0 }), this.stepIndex === this.visibleQuestions.length - 1) {
|
|
@@ -808,7 +840,7 @@ ${r}
|
|
|
808
840
|
// Answer handling + autosave
|
|
809
841
|
// ------------------------------------------------------------------
|
|
810
842
|
recomputeVisible() {
|
|
811
|
-
this.questionnaire && (this.visibleQuestions =
|
|
843
|
+
this.questionnaire && (this.visibleQuestions = J(this.questionnaire, this.answers));
|
|
812
844
|
}
|
|
813
845
|
handleAnswerChange(e, i, a = {}) {
|
|
814
846
|
this.answers[e.id] = i, this.recomputeVisible();
|
|
@@ -912,14 +944,14 @@ ${r}
|
|
|
912
944
|
* never trapped or isolated.
|
|
913
945
|
*/
|
|
914
946
|
setupModalA11y() {
|
|
915
|
-
this.isUserContainer || !this.cardEl || this.focusTrap || (this.focusTrap =
|
|
947
|
+
this.isUserContainer || !this.cardEl || this.focusTrap || (this.focusTrap = le(this.cardEl), this.inertRestore = pe(this.cardEl));
|
|
916
948
|
}
|
|
917
949
|
close() {
|
|
918
950
|
this.flushPendingSave(), this.destroy();
|
|
919
951
|
}
|
|
920
952
|
/** Destroy the embed and clean up all resources */
|
|
921
953
|
destroy() {
|
|
922
|
-
if (document.removeEventListener("keydown", this.boundKeyDown), this.pendingSaveTimer && (clearTimeout(this.pendingSaveTimer), this.pendingSaveTimer = null), this.focusTrap && (this.focusTrap.release(), this.focusTrap = null), this.inertRestore && (this.inertRestore(), this.inertRestore = null), !this.isUserContainer && this.savedOpener &&
|
|
954
|
+
if (document.removeEventListener("keydown", this.boundKeyDown), this.pendingSaveTimer && (clearTimeout(this.pendingSaveTimer), this.pendingSaveTimer = null), this.focusTrap && (this.focusTrap.release(), this.focusTrap = null), this.inertRestore && (this.inertRestore(), this.inertRestore = null), !this.isUserContainer && this.savedOpener && ue(this.savedOpener), this.savedOpener = null, this.shadowHost && (this.shadowHost.remove(), this.shadowHost = null, this.shadowRoot = null), this.rootEl = null, this.cardEl = null, this.overflow?.destroy(), this.overflow = null, this.bodyEl = null, this.scrollCueEl = null, this.footerEl = null, this.titleEl = null, this.stepCounterEl = null, this.progressFillEl = null, this.savingEl = null, this.backdropEl = null, this.currentInput = null, !this.closed && (this.closed = !0, this.onCloseCb))
|
|
923
955
|
try {
|
|
924
956
|
this.onCloseCb();
|
|
925
957
|
} catch (e) {
|
|
@@ -957,7 +989,7 @@ ${r}
|
|
|
957
989
|
return i === -1 ? !1 : (i === this.stepIndex || (this.flushPendingSave(), this.stepIndex = i, this.renderStep()), !0);
|
|
958
990
|
}
|
|
959
991
|
}
|
|
960
|
-
function
|
|
992
|
+
function ve(t) {
|
|
961
993
|
switch (t.type) {
|
|
962
994
|
case "text":
|
|
963
995
|
return t.minLength ? `Please enter at least ${t.minLength} characters.` : "This field is required.";
|
|
@@ -971,10 +1003,10 @@ function qe(t) {
|
|
|
971
1003
|
return "Please choose a value.";
|
|
972
1004
|
}
|
|
973
1005
|
}
|
|
974
|
-
function
|
|
1006
|
+
function N(t) {
|
|
975
1007
|
return document.querySelector(t)?.textContent?.trim() ?? "";
|
|
976
1008
|
}
|
|
977
|
-
function
|
|
1009
|
+
function ye() {
|
|
978
1010
|
const t = document.querySelector(
|
|
979
1011
|
'script[type="application/json"][data-quests-config]'
|
|
980
1012
|
);
|
|
@@ -983,15 +1015,15 @@ function pe() {
|
|
|
983
1015
|
if (!e) return null;
|
|
984
1016
|
try {
|
|
985
1017
|
const i = JSON.parse(e);
|
|
986
|
-
return i.cssSelector && !i.css && (i.css =
|
|
1018
|
+
return i.cssSelector && !i.css && (i.css = N(i.cssSelector), delete i.cssSelector), i;
|
|
987
1019
|
} catch {
|
|
988
1020
|
return null;
|
|
989
1021
|
}
|
|
990
1022
|
}
|
|
991
|
-
function
|
|
1023
|
+
function xe(t) {
|
|
992
1024
|
const e = t.getAttribute("data-endpoint");
|
|
993
1025
|
if (!e) return null;
|
|
994
|
-
const i = t.getAttribute("data-config-url"), a = t.getAttribute("data-api-key"), n = t.getAttribute("data-container"), o = t.getAttribute("data-zindex"), r = t.getAttribute("data-positive-color"), c = t.getAttribute("data-negative-color"), q = t.getAttribute("data-marker-color"), p = t.getAttribute("data-modal-width"),
|
|
1026
|
+
const i = t.getAttribute("data-config-url"), a = t.getAttribute("data-api-key"), n = t.getAttribute("data-container"), o = t.getAttribute("data-zindex"), r = t.getAttribute("data-positive-color"), c = t.getAttribute("data-negative-color"), q = t.getAttribute("data-marker-color"), p = t.getAttribute("data-modal-width"), f = t.getAttribute("data-backdrop-opacity"), s = t.getAttribute("data-font-family"), u = t.getAttribute("data-font-size"), d = t.getAttribute("data-css-selector"), m = t.getAttribute("data-auto-advance"), g = t.getAttribute("data-save-debounce-ms"), h = t.getAttribute("data-theme-url"), l = t.getAttribute("data-preset"), w = t.getAttribute("data-theme"), T = t.getAttribute("data-unstyled");
|
|
995
1027
|
return {
|
|
996
1028
|
endpoint: e,
|
|
997
1029
|
configUrl: i ?? void 0,
|
|
@@ -1004,28 +1036,28 @@ function fe(t) {
|
|
|
1004
1036
|
marker: q ?? void 0
|
|
1005
1037
|
},
|
|
1006
1038
|
modalWidth: p ? parseInt(p, 10) : void 0,
|
|
1007
|
-
backdropOpacity:
|
|
1039
|
+
backdropOpacity: f ? parseFloat(f) : void 0,
|
|
1008
1040
|
fontFamily: s ?? void 0,
|
|
1009
1041
|
fontSize: u ? parseInt(u, 10) : void 0,
|
|
1010
|
-
css: d ?
|
|
1011
|
-
autoAdvance:
|
|
1042
|
+
css: d ? N(d) : void 0,
|
|
1043
|
+
autoAdvance: m === "true" ? !0 : void 0,
|
|
1012
1044
|
saveDebounceMs: g ? parseInt(g, 10) : void 0,
|
|
1013
1045
|
themeUrl: h ?? void 0,
|
|
1014
1046
|
preset: l || void 0,
|
|
1015
|
-
theme:
|
|
1016
|
-
unstyled:
|
|
1047
|
+
theme: w || void 0,
|
|
1048
|
+
unstyled: T === "true" ? !0 : void 0
|
|
1017
1049
|
};
|
|
1018
1050
|
}
|
|
1019
1051
|
if (typeof document < "u") {
|
|
1020
1052
|
const t = () => {
|
|
1021
|
-
const e = document.currentScript, i =
|
|
1022
|
-
n?.endpoint && (n.configUrl || n.questionnaire) && new
|
|
1053
|
+
const e = document.currentScript, i = ye(), a = e ? xe(e) : null, n = i ?? a;
|
|
1054
|
+
n?.endpoint && (n.configUrl || n.questionnaire) && new be(n);
|
|
1023
1055
|
};
|
|
1024
1056
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", t) : t();
|
|
1025
1057
|
}
|
|
1026
1058
|
export {
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1059
|
+
be as QaidQuests,
|
|
1060
|
+
E as evaluateRule,
|
|
1061
|
+
J as getVisibleQuestions
|
|
1030
1062
|
};
|
|
1031
1063
|
//# sourceMappingURL=qaid-quests.js.map
|