@prolibu-suite/cobalt-form 0.2.2 → 1.0.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.
Files changed (29) hide show
  1. package/dist/cjs/co-form-wizard.cjs.entry.js +40 -11
  2. package/dist/cjs/co-form.cjs.entry.js +1 -1
  3. package/dist/cjs/cobalt-form.cjs.js +1 -1
  4. package/dist/cjs/{index-CLL7Ervz.js → index-Brpri7nS.js} +120 -19
  5. package/dist/cjs/index.cjs.js +146 -5
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cobalt-form/cobalt-form.esm.js +1 -1
  8. package/dist/cobalt-form/index.esm.js +1 -1
  9. package/dist/cobalt-form/p-296094ec.entry.js +1 -0
  10. package/dist/cobalt-form/{p-2168be6b.entry.js → p-95e1cedb.entry.js} +1 -1
  11. package/dist/cobalt-form/{p-CPE0t-C2.js → p-CzvtCEKX.js} +3 -3
  12. package/dist/collection/components/co-form/co-form.css +326 -4
  13. package/dist/collection/components/co-form/co-form.js +167 -4
  14. package/dist/collection/components/co-form-wizard/co-form-wizard.css +5 -0
  15. package/dist/collection/components/co-form-wizard/co-form-wizard.js +92 -10
  16. package/dist/components/co-form-wizard.js +1 -1
  17. package/dist/components/index.js +7 -7
  18. package/dist/esm/co-form-wizard.entry.js +40 -11
  19. package/dist/esm/co-form.entry.js +1 -1
  20. package/dist/esm/cobalt-form.js +1 -1
  21. package/dist/esm/{index-CPE0t-C2.js → index-CzvtCEKX.js} +120 -19
  22. package/dist/esm/index.js +146 -5
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/types/components/co-form/co-form.d.ts +7 -0
  25. package/dist/types/components/co-form-wizard/co-form-wizard.d.ts +15 -1
  26. package/dist/types/components.d.ts +33 -0
  27. package/dist/types/jsx-cobalt.d.ts +3 -0
  28. package/package.json +3 -3
  29. package/dist/cobalt-form/p-0a2a284f.entry.js +0 -1
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-C1670_IO.js';
2
- import { c as collectQuizFields, a as computeScore, r as resolveTheme, t as themeToStyles, b as toPagedSchema, e as evaluateExpression } from './index-CPE0t-C2.js';
2
+ import { c as collectQuizFields, a as computeScore, r as resolveTheme, t as themeToStyles, b as toPagedSchema, e as evaluateExpression } from './index-CzvtCEKX.js';
3
3
 
4
- const coFormWizardCss = () => `:host{display:block;font-family:var(--co-font-family-primary, sans-serif)}.co-form-wizard{max-width:720px;margin:0 auto;padding:var(--co-spacing-2xl, 24px);display:flex;flex-direction:column;gap:var(--co-spacing-lg, 16px)}.co-form-wizard[data-has-bg]{padding:var(--co-spacing-3xl, 32px) var(--co-spacing-2xl, 24px);background-repeat:no-repeat}.co-form-wizard__title-block{background:var(--co-form-header-bg, var(--co-semantic-surface-page, #fff));border:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));border-radius:var(--co-border-radius-lg, 16px);padding:var(--co-spacing-2xl, 24px) var(--co-spacing-3xl, 28px);box-shadow:0 1px 2px rgba(0, 0, 0, 0.04);min-height:var(--co-form-header-height, auto)}.co-form-wizard[data-hide-header] .co-form-wizard__title-block{display:none}.co-form-wizard[data-density="compact"] .co-form-wizard{gap:var(--co-spacing-sm, 8px)}.co-form-wizard[data-density="compact"] .co-form-wizard__title-block{padding:var(--co-spacing-lg, 16px) var(--co-spacing-xl, 20px)}.co-form-wizard[data-density="compact"] .co-form-wizard__page-head,.co-form-wizard[data-density="compact"] .co-form-wizard__nav{padding-top:var(--co-spacing-sm, 8px);padding-bottom:var(--co-spacing-sm, 8px)}.co-form-wizard__title{margin:0;font-size:24px;font-weight:700;letter-spacing:-0.02em;line-height:1.2;color:var(--co-semantic-text-default, #111827)}.co-form-wizard__title-desc{margin:6px 0 0;font-size:var(--co-font-size-14, 14px);color:var(--co-semantic-text-secondary, #6b7280)}.co-form-wizard__stepper{display:flex;align-items:center;gap:var(--co-spacing-sm, 8px);list-style:none;padding:0;margin:0;flex-wrap:wrap}.co-form-wizard__step{display:flex;align-items:center;color:var(--co-semantic-text-secondary, #6b7280);font-size:var(--co-font-size-12, 12px)}.co-form-wizard__step-btn{display:inline-flex;align-items:center;gap:var(--co-spacing-xs, 4px);padding:4px 6px;border:0;background:transparent;border-radius:var(--co-border-radius-xxs, 4px);font:inherit;color:inherit;cursor:pointer}.co-form-wizard__step-btn:hover{background:var(--co-semantic-surface-hover, #f3f4f6);color:var(--co-semantic-text-default, #111827)}.co-form-wizard__step-num{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:var(--co-border-radius-full, 9999px);background:var(--co-semantic-surface-hover, #f3f4f6);font-weight:600}.co-form-wizard__step.is-active .co-form-wizard__step-num{background:var(--co-color-primary-azul, #2563eb);color:white}.co-form-wizard__step.is-done .co-form-wizard__step-num{background:var(--co-color-primary-verde, #02a270);color:white}.co-form-wizard__step.is-active{color:var(--co-semantic-text-default, #111827);font-weight:600}.co-form-wizard__page-card{background:var(--co-semantic-surface-page, #fff);border:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));border-radius:var(--co-border-radius-lg, 16px);box-shadow:0 1px 2px rgba(0, 0, 0, 0.04);overflow:hidden;display:flex;flex-direction:column}.co-form-wizard__page-head{padding:var(--co-spacing-xl, 20px) var(--co-spacing-2xl, 24px);border-bottom:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));background:var(--co-semantic-surface-hover, #f9fafb)}.co-form-wizard__page-pill{display:inline-flex;font-size:10px;font-weight:700;letter-spacing:0.08em;color:var(--co-color-primary-azul, #2563eb);background:color-mix(in srgb, var(--co-color-primary-azul) 10%, transparent);padding:3px 8px;border-radius:var(--co-border-radius-full, 9999px);margin-bottom:6px}.co-form-wizard__page-title{margin:0;font-size:var(--co-font-size-18, 18px);font-weight:600;line-height:1.3;letter-spacing:-0.01em;color:var(--co-semantic-text-default, #111827)}.co-form-wizard__page-desc{margin:4px 0 0;font-size:var(--co-font-size-13, 13px);color:var(--co-semantic-text-secondary, #6b7280)}.co-form-wizard__page-card>co-form{display:block;padding:var(--co-spacing-xl, 20px) var(--co-spacing-2xl, 24px)}.co-form-wizard__nav{display:flex;justify-content:space-between;gap:var(--co-spacing-sm, 8px);padding:var(--co-spacing-md, 12px) var(--co-spacing-2xl, 24px);border-top:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));background:var(--co-semantic-surface-hover, #f9fafb)}.co-form-wizard__empty{padding:var(--co-spacing-lg, 16px);text-align:center;color:var(--co-semantic-text-secondary, #6b7280)}.co-form-wizard__score{text-align:center;padding:var(--co-spacing-2xl, 24px);background:var(--co-semantic-surface-page, #fff);border:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));border-radius:var(--co-border-radius-lg, 16px);box-shadow:0 1px 2px rgba(0, 0, 0, 0.04)}.co-form-wizard__score-title{margin:0;font-size:var(--co-font-size-18, 18px)}.co-form-wizard__score-num{font-size:48px;font-weight:600;color:var(--co-color-primary-azul, #2563eb);margin:var(--co-spacing-md, 12px) 0}.co-form-wizard__score-pct{font-size:var(--co-font-size-16, 16px);color:var(--co-semantic-text-secondary, #6b7280);margin-left:var(--co-spacing-sm, 8px)}.co-form-wizard__score-pass{display:inline-block;padding:var(--co-spacing-xs, 4px) var(--co-spacing-md, 12px);border-radius:var(--co-border-radius-full, 9999px);font-weight:600;margin-bottom:var(--co-spacing-md, 12px)}.co-form-wizard__score-pass.is-pass{background:var(--co-color-status-success, #0a7724);color:white}.co-form-wizard__score-pass.is-fail{background:var(--co-color-status-error, #aa2e1b);color:white}.co-form-wizard__score-feedback{text-align:left;list-style:disc;padding-left:var(--co-spacing-2xl, 24px);color:var(--co-semantic-text-default, #111827)}.co-form-wizard[data-has-bg] .co-form-wizard__title-block,.co-form-wizard[data-has-bg] .co-form-wizard__page-card,.co-form-wizard[data-has-bg] .co-form-wizard__score{border:0;box-shadow:0 4px 24px rgba(0, 0, 0, 0.08)}.co-form-wizard[data-theme="dark"]{--co-semantic-surface-page:#1a1f2b;--co-semantic-surface-secondary:#1a1f2b;--co-semantic-surface-primary:#ffffff;--co-semantic-surface-muted:#2a3142;--co-semantic-surface-hover:rgba(255, 255, 255, 0.06);--co-semantic-surface-disabled:rgba(255, 255, 255, 0.04);--co-semantic-on-primary:#1a1f2b;--co-semantic-on-secondary:#f9fafb;--co-semantic-text-default:#f9fafb;--co-semantic-text-secondary:#9ca3af;--co-semantic-text-muted:#6b7280;--co-semantic-text-disabled:#4b5563;--co-semantic-border-default:rgba(255, 255, 255, 0.12);--co-semantic-border-subtle:rgba(255, 255, 255, 0.14);--co-semantic-border-strong:rgba(255, 255, 255, 0.25);--co-semantic-border-focus:rgba(255, 255, 255, 0.25);--co-semantic-border-focus-ring:rgba(255, 255, 255, 0.1);color:#f9fafb}.co-form-wizard[data-theme="dark"] .co-form-wizard__page-card,.co-form-wizard[data-theme="dark"] .co-form-wizard__score{background:var(--co-semantic-surface-page);border-color:var(--co-semantic-border-default);color:#f9fafb}.co-form-wizard[data-theme="dark"] .co-form-wizard__title-block{background:var(--co-form-header-bg, var(--co-semantic-surface-page));border-color:var(--co-semantic-border-default);color:#f9fafb}.co-form-wizard[data-theme="dark"] .co-form-wizard__title,.co-form-wizard[data-theme="dark"] .co-form-wizard__page-title{color:#f9fafb}.co-form-wizard[data-theme="dark"] .co-form-wizard__title-desc,.co-form-wizard[data-theme="dark"] .co-form-wizard__page-desc{color:#9ca3af}.co-form-wizard[data-theme="dark"] .co-form-wizard__page-head,.co-form-wizard[data-theme="dark"] .co-form-wizard__nav{background:rgba(255, 255, 255, 0.03);border-color:var(--co-semantic-border-default)}.co-form-wizard[data-theme="dark"] .co-form-wizard__step-num{background:rgba(255, 255, 255, 0.1);color:#f9fafb}.co-form-wizard[data-theme="dark"][data-has-bg] .co-form-wizard__title-block,.co-form-wizard[data-theme="dark"][data-has-bg] .co-form-wizard__page-card,.co-form-wizard[data-theme="dark"][data-has-bg] .co-form-wizard__score{box-shadow:0 4px 24px rgba(0, 0, 0, 0.4)}.co-form-wizard[data-appearance="flat"] .co-form-wizard__title-block,.co-form-wizard[data-appearance="flat"] .co-form-wizard__page-card{background:transparent !important;border:0 !important;box-shadow:none !important;padding:0 !important}.co-form-wizard[data-appearance="flat"] .co-form-wizard__page-head{background:transparent !important;border-bottom:0 !important;padding:0 0 var(--co-spacing-md, 12px) 0 !important}.co-form-wizard[data-appearance="flat"] .co-form-wizard__nav{background:transparent !important;border-top:0 !important;padding:var(--co-spacing-md, 12px) 0 0 !important}.co-form-wizard[data-appearance="flat"] .co-form-wizard__page-card>co-form{padding:0 !important}.co-form-wizard[data-appearance="flat"][data-theme="dark"] .co-form-wizard__title-block,.co-form-wizard[data-appearance="flat"][data-theme="dark"] .co-form-wizard__page-card{color:#f9fafb}`;
4
+ const coFormWizardCss = () => `:host{display:block;font-family:var(--co-font-family-primary, sans-serif)}.co-form-wizard{max-width:720px;margin:0 auto;padding:var(--co-spacing-2xl, 24px);display:flex;flex-direction:column;gap:var(--co-spacing-lg, 16px)}.co-form-wizard[data-has-bg]{padding:var(--co-spacing-3xl, 32px) var(--co-spacing-2xl, 24px);background-repeat:no-repeat}.co-form-wizard__title-block{background:var(--co-form-header-bg, var(--co-semantic-surface-page, #fff));border:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));border-radius:var(--co-border-radius-lg, 16px);padding:var(--co-spacing-2xl, 24px) var(--co-spacing-3xl, 28px);box-shadow:0 1px 2px rgba(0, 0, 0, 0.04);min-height:var(--co-form-header-height, auto)}.co-form-wizard[data-hide-header] .co-form-wizard__title-block{display:none}.co-form-wizard[data-density="compact"] .co-form-wizard{gap:var(--co-spacing-sm, 8px)}.co-form-wizard[data-density="compact"] .co-form-wizard__title-block{padding:var(--co-spacing-lg, 16px) var(--co-spacing-xl, 20px)}.co-form-wizard[data-density="compact"] .co-form-wizard__page-head,.co-form-wizard[data-density="compact"] .co-form-wizard__nav{padding-top:var(--co-spacing-sm, 8px);padding-bottom:var(--co-spacing-sm, 8px)}.co-form-wizard__title{margin:0;font-size:24px;font-weight:700;letter-spacing:-0.02em;line-height:1.2;color:var(--co-semantic-text-default, #111827)}.co-form-wizard__title-desc{margin:6px 0 0;font-size:var(--co-font-size-14, 14px);color:var(--co-semantic-text-secondary, #6b7280)}.co-form-wizard__stepper{display:flex;align-items:center;gap:var(--co-spacing-sm, 8px);list-style:none;padding:0;margin:0;flex-wrap:wrap}.co-form-wizard__step{display:flex;align-items:center;color:var(--co-semantic-text-secondary, #6b7280);font-size:var(--co-font-size-12, 12px)}.co-form-wizard__step-btn{display:inline-flex;align-items:center;gap:var(--co-spacing-xs, 4px);padding:4px 6px;border:0;background:transparent;border-radius:var(--co-border-radius-xxs, 4px);font:inherit;color:inherit;cursor:pointer}.co-form-wizard__step-btn:hover{background:var(--co-semantic-surface-hover, #f3f4f6);color:var(--co-semantic-text-default, #111827)}.co-form-wizard__step-num{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:var(--co-border-radius-full, 9999px);background:var(--co-semantic-surface-hover, #f3f4f6);font-weight:600}.co-form-wizard__step.is-active .co-form-wizard__step-num{background:var(--co-color-primary-azul, #2563eb);color:white}.co-form-wizard__step.is-done .co-form-wizard__step-num{background:var(--co-color-primary-verde, #02a270);color:white}.co-form-wizard__step.is-active{color:var(--co-semantic-text-default, #111827);font-weight:600}.co-form-wizard__page-card{background:var(--co-semantic-surface-page, #fff);border:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));border-radius:var(--co-border-radius-lg, 16px);box-shadow:0 1px 2px rgba(0, 0, 0, 0.04);overflow:hidden;display:flex;flex-direction:column}.co-form-wizard__page-head{padding:var(--co-spacing-xl, 20px) var(--co-spacing-2xl, 24px);border-bottom:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));background:var(--co-semantic-surface-hover, #f9fafb)}.co-form-wizard__page-pill{display:inline-flex;font-size:10px;font-weight:700;letter-spacing:0.08em;color:var(--co-color-primary-azul, #2563eb);background:color-mix(in srgb, var(--co-color-primary-azul) 10%, transparent);padding:3px 8px;border-radius:var(--co-border-radius-full, 9999px);margin-bottom:6px}.co-form-wizard__page-title{margin:0;font-size:var(--co-font-size-18, 18px);font-weight:600;line-height:1.3;letter-spacing:-0.01em;color:var(--co-semantic-text-default, #111827)}.co-form-wizard__page-desc{margin:4px 0 0;font-size:var(--co-font-size-13, 13px);color:var(--co-semantic-text-secondary, #6b7280)}.co-form-wizard__page-card>co-form{display:block;padding:var(--co-spacing-xl, 20px) var(--co-spacing-2xl, 24px)}.co-form-wizard__nav{display:flex;justify-content:space-between;gap:var(--co-spacing-sm, 8px);padding:var(--co-spacing-md, 12px) var(--co-spacing-2xl, 24px);border-top:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));background:var(--co-semantic-surface-hover, #f9fafb)}.co-form-wizard__nav co-button:only-child{margin-left:auto}.co-form-wizard__empty{padding:var(--co-spacing-lg, 16px);text-align:center;color:var(--co-semantic-text-secondary, #6b7280)}.co-form-wizard__score{text-align:center;padding:var(--co-spacing-2xl, 24px);background:var(--co-semantic-surface-page, #fff);border:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));border-radius:var(--co-border-radius-lg, 16px);box-shadow:0 1px 2px rgba(0, 0, 0, 0.04)}.co-form-wizard__score-title{margin:0;font-size:var(--co-font-size-18, 18px)}.co-form-wizard__score-num{font-size:48px;font-weight:600;color:var(--co-color-primary-azul, #2563eb);margin:var(--co-spacing-md, 12px) 0}.co-form-wizard__score-pct{font-size:var(--co-font-size-16, 16px);color:var(--co-semantic-text-secondary, #6b7280);margin-left:var(--co-spacing-sm, 8px)}.co-form-wizard__score-pass{display:inline-block;padding:var(--co-spacing-xs, 4px) var(--co-spacing-md, 12px);border-radius:var(--co-border-radius-full, 9999px);font-weight:600;margin-bottom:var(--co-spacing-md, 12px)}.co-form-wizard__score-pass.is-pass{background:var(--co-color-status-success, #0a7724);color:white}.co-form-wizard__score-pass.is-fail{background:var(--co-color-status-error, #aa2e1b);color:white}.co-form-wizard__score-feedback{text-align:left;list-style:disc;padding-left:var(--co-spacing-2xl, 24px);color:var(--co-semantic-text-default, #111827)}.co-form-wizard[data-has-bg] .co-form-wizard__title-block,.co-form-wizard[data-has-bg] .co-form-wizard__page-card,.co-form-wizard[data-has-bg] .co-form-wizard__score{border:0;box-shadow:0 4px 24px rgba(0, 0, 0, 0.08)}.co-form-wizard[data-theme="dark"]{--co-semantic-surface-page:#1a1f2b;--co-semantic-surface-secondary:#1a1f2b;--co-semantic-surface-primary:#ffffff;--co-semantic-surface-muted:#2a3142;--co-semantic-surface-hover:rgba(255, 255, 255, 0.06);--co-semantic-surface-disabled:rgba(255, 255, 255, 0.04);--co-semantic-on-primary:#1a1f2b;--co-semantic-on-secondary:#f9fafb;--co-semantic-text-default:#f9fafb;--co-semantic-text-secondary:#9ca3af;--co-semantic-text-muted:#6b7280;--co-semantic-text-disabled:#4b5563;--co-semantic-border-default:rgba(255, 255, 255, 0.12);--co-semantic-border-subtle:rgba(255, 255, 255, 0.14);--co-semantic-border-strong:rgba(255, 255, 255, 0.25);--co-semantic-border-focus:rgba(255, 255, 255, 0.25);--co-semantic-border-focus-ring:rgba(255, 255, 255, 0.1);color:#f9fafb}.co-form-wizard[data-theme="dark"] .co-form-wizard__page-card,.co-form-wizard[data-theme="dark"] .co-form-wizard__score{background:var(--co-semantic-surface-page);border-color:var(--co-semantic-border-default);color:#f9fafb}.co-form-wizard[data-theme="dark"] .co-form-wizard__title-block{background:var(--co-form-header-bg, var(--co-semantic-surface-page));border-color:var(--co-semantic-border-default);color:#f9fafb}.co-form-wizard[data-theme="dark"] .co-form-wizard__title,.co-form-wizard[data-theme="dark"] .co-form-wizard__page-title{color:#f9fafb}.co-form-wizard[data-theme="dark"] .co-form-wizard__title-desc,.co-form-wizard[data-theme="dark"] .co-form-wizard__page-desc{color:#9ca3af}.co-form-wizard[data-theme="dark"] .co-form-wizard__page-head,.co-form-wizard[data-theme="dark"] .co-form-wizard__nav{background:rgba(255, 255, 255, 0.03);border-color:var(--co-semantic-border-default)}.co-form-wizard[data-theme="dark"] .co-form-wizard__step-num{background:rgba(255, 255, 255, 0.1);color:#f9fafb}.co-form-wizard[data-theme="dark"][data-has-bg] .co-form-wizard__title-block,.co-form-wizard[data-theme="dark"][data-has-bg] .co-form-wizard__page-card,.co-form-wizard[data-theme="dark"][data-has-bg] .co-form-wizard__score{box-shadow:0 4px 24px rgba(0, 0, 0, 0.4)}.co-form-wizard[data-appearance="flat"] .co-form-wizard__title-block,.co-form-wizard[data-appearance="flat"] .co-form-wizard__page-card{background:transparent !important;border:0 !important;box-shadow:none !important;padding:0 !important}.co-form-wizard[data-appearance="flat"] .co-form-wizard__page-head{background:transparent !important;border-bottom:0 !important;padding:0 0 var(--co-spacing-md, 12px) 0 !important}.co-form-wizard[data-appearance="flat"] .co-form-wizard__nav{background:transparent !important;border-top:0 !important;padding:var(--co-spacing-md, 12px) 0 0 !important}.co-form-wizard[data-appearance="flat"] .co-form-wizard__page-card>co-form{padding:0 !important}.co-form-wizard[data-appearance="flat"][data-theme="dark"] .co-form-wizard__title-block,.co-form-wizard[data-appearance="flat"][data-theme="dark"] .co-form-wizard__page-card{color:#f9fafb}`;
5
5
 
6
6
  var __rest = (undefined && undefined.__rest) || function (s, e) {
7
7
  var t = {};
@@ -23,17 +23,30 @@ function safeJsonParse(s) {
23
23
  return null;
24
24
  }
25
25
  }
26
+ const DEFAULT_LABELS = {
27
+ result: 'Result',
28
+ passed: 'Passed',
29
+ failed: 'Failed',
30
+ prev: 'Previous',
31
+ next: 'Next',
32
+ submit: 'Submit',
33
+ empty: 'No pages to display.',
34
+ pagePrefix: 'PAGE',
35
+ };
26
36
  const CoFormWizard = class {
27
37
  constructor(hostRef) {
28
38
  registerInstance(this, hostRef);
29
39
  this.coSubmit = createEvent(this, "coSubmit");
30
40
  this.coPageChange = createEvent(this, "coPageChange");
41
+ this.coChange = createEvent(this, "coChange");
31
42
  /** Locale for AJV error messages. */
32
43
  this.locale = 'es';
33
44
  /** Layout passed to each page's <co-form>. */
34
45
  this.layout = 'grid';
35
46
  /** Number of columns per page. */
36
47
  this.columns = 1;
48
+ /** When to run validation. Forwarded to each page's `<co-form>`. */
49
+ this.validateOn = 'change';
37
50
  this.currentIndex = 0;
38
51
  this.values = {};
39
52
  this.finalScore = null;
@@ -55,13 +68,13 @@ const CoFormWizard = class {
55
68
  return;
56
69
  if (this.currentIndex < this.activePages.length - 1) {
57
70
  this.currentIndex += 1;
58
- this.coPageChange.emit({ index: this.currentIndex, page: this.currentPage });
71
+ this.emitPageChange();
59
72
  }
60
73
  };
61
74
  this.handlePrev = () => {
62
75
  if (this.currentIndex > 0) {
63
76
  this.currentIndex -= 1;
64
- this.coPageChange.emit({ index: this.currentIndex, page: this.currentPage });
77
+ this.emitPageChange();
65
78
  }
66
79
  };
67
80
  /**
@@ -75,7 +88,7 @@ const CoFormWizard = class {
75
88
  return;
76
89
  if (targetIndex < this.currentIndex) {
77
90
  this.currentIndex = targetIndex;
78
- this.coPageChange.emit({ index: this.currentIndex, page: this.currentPage });
91
+ this.emitPageChange();
79
92
  return;
80
93
  }
81
94
  // Forward jump — validate-and-advance one step at a time.
@@ -85,7 +98,7 @@ const CoFormWizard = class {
85
98
  return;
86
99
  this.currentIndex += 1;
87
100
  }
88
- this.coPageChange.emit({ index: this.currentIndex, page: this.currentPage });
101
+ this.emitPageChange();
89
102
  };
90
103
  this.handleSubmit = async () => {
91
104
  const ok = await this.commitCurrentPage();
@@ -101,8 +114,17 @@ const CoFormWizard = class {
101
114
  };
102
115
  this.handlePageChange = (ev) => {
103
116
  this.values = Object.assign(Object.assign({}, this.values), { [ev.detail.name]: ev.detail.value });
117
+ this.coChange.emit(ev.detail);
104
118
  };
105
119
  }
120
+ get mergedLabels() {
121
+ if (!this.labels)
122
+ return DEFAULT_LABELS;
123
+ const parsed = safeJsonParse(this.labels);
124
+ if (!parsed || typeof parsed !== 'object')
125
+ return DEFAULT_LABELS;
126
+ return Object.assign(Object.assign({}, DEFAULT_LABELS), parsed);
127
+ }
106
128
  componentWillLoad() {
107
129
  this.parseSchema();
108
130
  this.values = this.parseInitialValues();
@@ -196,6 +218,12 @@ const CoFormWizard = class {
196
218
  var _a;
197
219
  return (_a = this.activePages[this.currentIndex]) !== null && _a !== void 0 ? _a : null;
198
220
  }
221
+ emitPageChange() {
222
+ const page = this.currentPage;
223
+ if (page) {
224
+ this.coPageChange.emit({ index: this.currentIndex, page });
225
+ }
226
+ }
199
227
  async commitCurrentPage() {
200
228
  var _a, _b;
201
229
  if (!this.currentFormEl)
@@ -231,7 +259,7 @@ const CoFormWizard = class {
231
259
  var _a;
232
260
  const pages = this.activePages;
233
261
  if (pages.length === 0) {
234
- return (h(Host, Object.assign({}, this.hostProps()), h("div", { class: "co-form-wizard__empty" }, "No pages to display.")));
262
+ return (h(Host, Object.assign({}, this.hostProps()), h("div", { class: "co-form-wizard__empty" }, this.mergedLabels.empty)));
235
263
  }
236
264
  // Quiz finished — show the score panel.
237
265
  if (this.finalScore && ((_a = this.paged.scoring) === null || _a === void 0 ? void 0 : _a.showScore)) {
@@ -258,7 +286,7 @@ const CoFormWizard = class {
258
286
  'co-form-wizard__step': true,
259
287
  'is-active': i === this.currentIndex,
260
288
  'is-done': i < this.currentIndex,
261
- }, key: p.name }, h("button", { type: "button", class: "co-form-wizard__step-btn", onClick: () => this.handleStepClick(i) }, h("span", { class: "co-form-wizard__step-num" }, i + 1), h("span", { class: "co-form-wizard__step-label" }, p.title || p.name))))))), h("section", { class: "co-form-wizard__page-card" }, this.renderPageHead(current, pages.length > 1), h("co-form", { ref: (el) => (this.currentFormEl = el), schema: JSON.stringify(current.fields), "initial-values": JSON.stringify(pageInitial), locale: this.locale, layout: this.layout, columns: this.columns, theme: this.themeForChildren, "hide-footer": true, onCoChange: this.handlePageChange }), h("div", { class: "co-form-wizard__nav" }, h("co-button", { label: "Anterior", variant: "outlined", disabled: isFirst, onClick: this.handlePrev }), isLast ? (h("co-button", { label: "Enviar", variant: "primary", onClick: this.handleSubmit })) : (h("co-button", { label: "Siguiente", variant: "primary", onClick: this.handleNext })))), h("slot", { name: "footer" })));
289
+ }, key: p.name }, h("button", { type: "button", class: "co-form-wizard__step-btn", onClick: () => this.handleStepClick(i) }, h("span", { class: "co-form-wizard__step-num" }, i + 1), h("span", { class: "co-form-wizard__step-label" }, p.title || p.name))))))), h("section", { class: "co-form-wizard__page-card" }, this.renderPageHead(current, pages.length > 1), h("co-form", { ref: (el) => (this.currentFormEl = el), schema: JSON.stringify(current.fields), "initial-values": JSON.stringify(pageInitial), locale: this.locale, layout: this.layout, columns: this.columns, theme: this.themeForChildren, "validate-on": this.validateOn, "hide-footer": true, onCoChange: this.handlePageChange }), h("div", { class: "co-form-wizard__nav" }, pages.length > 1 && (h("co-button", { label: this.mergedLabels.prev, variant: "stroke", disabled: isFirst, onClick: this.handlePrev })), isLast ? (h("co-button", { label: this.mergedLabels.submit, variant: "primary", onClick: this.handleSubmit })) : (h("co-button", { label: this.mergedLabels.next, variant: "primary", onClick: this.handleNext })))), h("slot", { name: "footer" })));
262
290
  }
263
291
  /**
264
292
  * Smart page-head visibility:
@@ -280,11 +308,12 @@ const CoFormWizard = class {
280
308
  const wantsPill = isMulti && !current.hideTitle;
281
309
  if (!wantsPill && !wantsTitle && !wantsDesc)
282
310
  return null;
283
- return (h("header", { class: "co-form-wizard__page-head" }, wantsPill && (h("span", { class: "co-form-wizard__page-pill" }, "PAGE ", this.currentIndex + 1)), wantsTitle && (h("h2", { class: "co-form-wizard__page-title" }, current.title)), wantsDesc && (h("p", { class: "co-form-wizard__page-desc" }, current.description))));
311
+ return (h("header", { class: "co-form-wizard__page-head" }, wantsPill && (h("span", { class: "co-form-wizard__page-pill" }, this.mergedLabels.pagePrefix, " ", this.currentIndex + 1)), wantsTitle && (h("h2", { class: "co-form-wizard__page-title" }, current.title)), wantsDesc && (h("p", { class: "co-form-wizard__page-desc" }, current.description))));
284
312
  }
285
313
  renderScorePanel(score) {
286
- const passText = score.passed === true ? 'Aprobado' : score.passed === false ? 'No aprobado' : null;
287
- return (h("div", { class: "co-form-wizard co-form-wizard__score" }, h("h2", { class: "co-form-wizard__score-title" }, "Resultado"), h("div", { class: "co-form-wizard__score-num" }, score.total, " / ", score.max, h("span", { class: "co-form-wizard__score-pct" }, "(", score.percent, "%)")), passText && (h("div", { class: {
314
+ const labels = this.mergedLabels;
315
+ const passText = score.passed === true ? labels.passed : score.passed === false ? labels.failed : null;
316
+ return (h("div", { class: "co-form-wizard co-form-wizard__score" }, h("h2", { class: "co-form-wizard__score-title" }, labels.result), h("div", { class: "co-form-wizard__score-num" }, score.total, " / ", score.max, h("span", { class: "co-form-wizard__score-pct" }, "(", score.percent, "%)")), passText && (h("div", { class: {
288
317
  'co-form-wizard__score-pass': true,
289
318
  'is-pass': score.passed === true,
290
319
  'is-fail': score.passed === false,
@@ -1,3 +1,3 @@
1
1
  export { CoForm as co_form } from './index.js';
2
2
  import './index-C1670_IO.js';
3
- import './index-CPE0t-C2.js';
3
+ import './index-CzvtCEKX.js';
@@ -17,5 +17,5 @@ var patchBrowser = () => {
17
17
 
18
18
  patchBrowser().then(async (options) => {
19
19
  await globalScripts();
20
- return bootstrapLazy([["co-form",[[260,"co-form",{"schema":[1],"initialValues":[1,"initial-values"],"schemaInstance":[16],"refResolver":[16],"locale":[1],"layout":[1],"excludeFields":[1,"exclude-fields"],"disabled":[4],"readOnly":[4,"read-only"],"columns":[2],"gap":[1],"footerAlign":[1,"footer-align"],"hideFooter":[4,"hide-footer"],"theme":[1],"snapshot":[32],"refStates":[32],"themeStyles":[32],"hasBg":[32],"setValue":[64],"getValue":[64],"touch":[64],"validateAndCollect":[64]},null,{"schema":[{"onSchemaChange":0}],"schemaInstance":[{"onSchemaChange":0}],"locale":[{"onSchemaChange":0}],"theme":[{"onThemeChange":0}]}]]],["co-form-wizard",[[260,"co-form-wizard",{"schema":[1],"initialValues":[1,"initial-values"],"locale":[1],"layout":[1],"columns":[2],"theme":[1],"currentIndex":[32],"values":[32],"finalScore":[32],"themeStyles":[32],"hasBg":[32]},null,{"schema":[{"onSchemaChange":0}],"theme":[{"onThemeChange":0}]}]]]], options);
20
+ return bootstrapLazy([["co-form",[[260,"co-form",{"schema":[1],"initialValues":[1,"initial-values"],"schemaInstance":[16],"refResolver":[16],"locale":[1],"layout":[1],"excludeFields":[1,"exclude-fields"],"disabled":[4],"readOnly":[4,"read-only"],"columns":[2],"gap":[1],"footerAlign":[1,"footer-align"],"hideFooter":[4,"hide-footer"],"validateOn":[1,"validate-on"],"theme":[1],"snapshot":[32],"refStates":[32],"themeStyles":[32],"hasBg":[32],"orderingDragIdx":[32],"orderingDropIdx":[32],"setValue":[64],"getValue":[64],"touch":[64],"validateAndCollect":[64]},null,{"schema":[{"onSchemaChange":0}],"schemaInstance":[{"onSchemaChange":0}],"locale":[{"onSchemaChange":0}],"theme":[{"onThemeChange":0}]}]]],["co-form-wizard",[[260,"co-form-wizard",{"schema":[1],"initialValues":[1,"initial-values"],"locale":[1],"layout":[1],"columns":[2],"theme":[1],"validateOn":[1,"validate-on"],"labels":[1],"currentIndex":[32],"values":[32],"finalScore":[32],"themeStyles":[32],"hasBg":[32]},null,{"schema":[{"onSchemaChange":0}],"theme":[{"onThemeChange":0}]}]]]], options);
21
21
  });
@@ -7388,7 +7388,31 @@ var RESOLVERS = [
7388
7388
  (orig) => orig.uiCom === "ColorPicker" ? "color" : void 0,
7389
7389
  (orig) => orig.uiCom === "Section" ? "section" : void 0,
7390
7390
  (orig) => orig.uiCom === "File" || orig.uiCom === "FileUpload" ? "file" : void 0,
7391
+ // FillBlank deprecated — resolve to 'text' for backward compatibility.
7392
+ (orig) => orig.uiCom === "FillBlank" ? "text" : void 0,
7393
+ (orig) => orig.uiCom === "Ordering" ? "ordering" : void 0,
7394
+ (orig) => orig.uiCom === "Matching" ? "matching" : void 0,
7395
+ (orig) => orig.uiCom === "ImageRadioGroup" ? "image-choice" : void 0,
7391
7396
  (orig) => orig.uiCom === "Repeater" || orig.uiCom === "objectEditor" ? "array" : void 0,
7397
+ // Phone with country code indicator.
7398
+ (orig) => orig.uiCom === "PhoneWithIndicative" ? "phone" : void 0,
7399
+ // Explicit date picker (renderer override, not a domain type). The
7400
+ // underlying value stays a date-only string.
7401
+ (orig) => orig.uiCom === "DatePicker" ? "date" : void 0,
7402
+ // Radio / Checkbox group — explicit uiCom before the generic enum→select.
7403
+ (orig) => orig.uiCom === "RadioGroup" ? "radio" : void 0,
7404
+ (orig) => orig.uiCom === "CheckboxGroup" ? "checkbox" : void 0,
7405
+ // Masked is a renderer behavior (not a domain type). Keep it after explicit
7406
+ // uiCom mappings, but before ref/enum/type fallbacks.
7407
+ (orig) => {
7408
+ const mask = orig.mask;
7409
+ if (typeof mask === "string") return mask.trim() ? "masked" : void 0;
7410
+ if (mask && typeof mask === "object") return "masked";
7411
+ return void 0;
7412
+ },
7413
+ // A `File` ref is an upload field, not a model picker — route it before the
7414
+ // generic ref rule.
7415
+ (orig) => orig.ref === "File" ? "file" : void 0,
7392
7416
  // Ref binds to a backend model.
7393
7417
  (orig) => orig.ref ? "ref" : void 0,
7394
7418
  // Enum → select.
@@ -7396,12 +7420,17 @@ var RESOLVERS = [
7396
7420
  // Array of objects → repeater (when no other uiCom matches).
7397
7421
  (orig) => Array.isArray(orig.type) && orig.type[0] && typeof orig.type[0] === "object" ? "array" : void 0,
7398
7422
  (orig) => orig.type === "array" && orig.itemSchema ? "array" : void 0,
7423
+ // Array of primitives (e.g. Mongoose `type: [String]`) → free-text tags.
7424
+ // Placed after the array-of-objects (repeater) rule so only primitive arrays
7425
+ // reach it, and after `ref` so arrays of object-id refs stay multi-ref.
7426
+ (orig) => Array.isArray(orig.type) && orig.type[0] && typeof orig.type[0] !== "object" ? "tags" : void 0,
7399
7427
  // File ref / file format.
7400
7428
  (orig) => orig.format === "file" || orig.type === "File" ? "file" : void 0,
7401
7429
  // Primitive types.
7402
7430
  (orig) => orig.type === "boolean" ? "boolean" : void 0,
7403
7431
  (orig) => orig.type === "number" || orig.type === "integer" ? "number" : void 0,
7404
7432
  (orig) => orig.type === "date" ? "date" : void 0,
7433
+ (orig) => orig.type === "mixed" ? "mixed" : void 0,
7405
7434
  (orig) => orig.type === "string" ? "text" : void 0
7406
7435
  ];
7407
7436
  function resolveFieldKind(ajvProperty) {
@@ -7419,8 +7448,46 @@ function resolveFieldKind(ajvProperty) {
7419
7448
  function labelFromName(name) {
7420
7449
  return String(name).replace(/([a-z])([A-Z])/g, "$1 $2").replace(/_/g, " ").toLowerCase().replace(/^./, (c) => c.toUpperCase());
7421
7450
  }
7422
- function describeField(name, ajvProperty) {
7451
+ function readColSpan(orig) {
7452
+ const raw = orig.colSpan ?? orig.cols;
7453
+ const n = Number(raw);
7454
+ return Number.isFinite(n) && n >= 1 ? Math.floor(n) : void 0;
7455
+ }
7456
+ function resolveNestedSchema(ajvProperty, resolveRef) {
7457
+ if (!ajvProperty || typeof ajvProperty !== "object") return null;
7458
+ if (typeof ajvProperty.$ref === "string" && typeof resolveRef === "function") {
7459
+ const sub = resolveRef(ajvProperty.$ref);
7460
+ if (sub && sub.properties && typeof sub.properties === "object") return sub;
7461
+ }
7462
+ if (ajvProperty.properties && typeof ajvProperty.properties === "object") {
7463
+ return ajvProperty;
7464
+ }
7465
+ return null;
7466
+ }
7467
+ function describeField(name, ajvProperty, resolveRef, path = name, requiredFromParent = false) {
7423
7468
  const orig = ajvProperty?.originalAttrs || {};
7469
+ const required = !!orig.required || requiredFromParent;
7470
+ if (!orig.hidden) {
7471
+ const sub = resolveNestedSchema(ajvProperty, resolveRef);
7472
+ if (sub) {
7473
+ return {
7474
+ name,
7475
+ kind: "object",
7476
+ label: orig.label || labelFromName(name),
7477
+ placeholder: orig.placeholder || orig.eg || "",
7478
+ required,
7479
+ disabled: !!(orig.readOnly || orig.disabled),
7480
+ hidden: false,
7481
+ fullWidth: true,
7482
+ // fieldsets span the full grid width
7483
+ helperText: orig.helperText || orig.description || "",
7484
+ originalAttrs: orig,
7485
+ ajvProperty,
7486
+ path,
7487
+ children: describeFields(sub.properties, resolveRef, path, sub.required)
7488
+ };
7489
+ }
7490
+ }
7424
7491
  const kind = resolveFieldKind(ajvProperty);
7425
7492
  if (kind === null) return null;
7426
7493
  return {
@@ -7428,19 +7495,23 @@ function describeField(name, ajvProperty) {
7428
7495
  kind,
7429
7496
  label: orig.label || labelFromName(name),
7430
7497
  placeholder: orig.placeholder || orig.eg || "",
7431
- required: !!orig.required,
7498
+ required,
7432
7499
  disabled: !!(orig.readOnly || orig.disabled),
7433
7500
  hidden: !!orig.hidden,
7434
7501
  fullWidth: !!orig.full,
7502
+ colSpan: readColSpan(orig),
7435
7503
  helperText: orig.helperText || orig.description || "",
7436
7504
  originalAttrs: orig,
7437
- ajvProperty
7505
+ ajvProperty,
7506
+ path
7438
7507
  };
7439
7508
  }
7440
- function describeFields(properties) {
7509
+ function describeFields(properties, resolveRef, parentPath = "", requiredKeys) {
7510
+ const requiredSet = new Set(Array.isArray(requiredKeys) ? requiredKeys : []);
7441
7511
  const out = [];
7442
7512
  for (const [name, property] of Object.entries(properties)) {
7443
- const desc = describeField(name, property);
7513
+ const path = parentPath ? `${parentPath}.${name}` : name;
7514
+ const desc = describeField(name, property, resolveRef, path, requiredSet.has(name));
7444
7515
  if (desc) out.push(desc);
7445
7516
  }
7446
7517
  return out;
@@ -7610,15 +7681,16 @@ function normalizeForValidation(data, properties) {
7610
7681
  }
7611
7682
  return out;
7612
7683
  }
7684
+ function instancePathToDot(instancePath) {
7685
+ if (typeof instancePath !== "string" || instancePath.length === 0) return "";
7686
+ return instancePath.split("/").filter((s) => s.length > 0 && !/^\d+$/.test(s)).join(".");
7687
+ }
7613
7688
  function extractFieldName(err) {
7614
- if (err.keyword === "required" && err.params?.missingProperty) {
7615
- return err.params.missingProperty;
7616
- }
7617
- if (typeof err.instancePath === "string" && err.instancePath.length > 0) {
7618
- const segments = err.instancePath.split("/").filter(Boolean);
7619
- return segments[0] || null;
7689
+ const base = instancePathToDot(err.instancePath);
7690
+ if ((err.keyword === "required" || err.keyword === "requiredNotNull") && err.params?.missingProperty) {
7691
+ return base ? `${base}.${err.params.missingProperty}` : err.params.missingProperty;
7620
7692
  }
7621
- return null;
7693
+ return base || null;
7622
7694
  }
7623
7695
  function groupErrorsByField(errors) {
7624
7696
  const out = {};
@@ -7659,10 +7731,16 @@ function fieldToJsonSchema(def) {
7659
7731
  break;
7660
7732
  case "date":
7661
7733
  out.type = "string";
7662
- out.format = "date-time";
7734
+ out.format = "date";
7663
7735
  break;
7664
7736
  case "mixed":
7665
7737
  break;
7738
+ case "array":
7739
+ out.type = "array";
7740
+ if (Array.isArray(def.enum) && def.enum.length > 0) {
7741
+ out.items = { type: "string", enum: def.enum };
7742
+ }
7743
+ break;
7666
7744
  default:
7667
7745
  if (Array.isArray(def.type)) {
7668
7746
  const inner = typeof def.type[0] === "string" ? def.type[0].toLowerCase() : "string";
@@ -7670,7 +7748,7 @@ function fieldToJsonSchema(def) {
7670
7748
  out.items = { type: inner === "number" ? "number" : "string" };
7671
7749
  }
7672
7750
  }
7673
- if (Array.isArray(def.enum) && def.enum.length > 0) out.enum = def.enum;
7751
+ if (Array.isArray(def.enum) && def.enum.length > 0 && out.type !== "array") out.enum = def.enum;
7674
7752
  if (typeof def.min === "number") out.minimum = def.min;
7675
7753
  if (typeof def.max === "number") out.maximum = def.max;
7676
7754
  if (typeof def.minLength === "number") out.minLength = def.minLength;
@@ -7769,7 +7847,7 @@ var FormController = class {
7769
7847
  __publicField(this, "listeners", /* @__PURE__ */ new Set());
7770
7848
  __publicField(this, "notifyScheduled", false);
7771
7849
  this.schemaInstance = resolveSchema(options.schema);
7772
- this.fields = describeFields(this.schemaInstance.formSchema.properties);
7850
+ this.fields = this.describe();
7773
7851
  this.validateOn = options.validateOn ?? "change";
7774
7852
  const defaults = this.collectDefaults();
7775
7853
  const userInitial = options.initialValues ?? {};
@@ -7835,10 +7913,17 @@ var FormController = class {
7835
7913
  if (this.state.touched[name]) return;
7836
7914
  this.commit({ touched: { ...this.state.touched, [name]: true } });
7837
7915
  }
7838
- /** Mark every field as touched. Useful right before showing errors on submit. */
7916
+ /** Mark every field as touched (recursing into nested object children by
7917
+ * their dot-`path`), so a submit reveals nested-field errors too. */
7839
7918
  touchAll() {
7840
7919
  const touched = { ...this.state.touched };
7841
- for (const f of this.fields) touched[f.name] = true;
7920
+ const walk = (fields) => {
7921
+ for (const f of fields) {
7922
+ touched[f.path ?? f.name] = true;
7923
+ if (f.children?.length) walk(f.children);
7924
+ }
7925
+ };
7926
+ walk(this.fields);
7842
7927
  this.commit({ touched });
7843
7928
  }
7844
7929
  /**
@@ -7848,10 +7933,21 @@ var FormController = class {
7848
7933
  */
7849
7934
  setSchema(instance) {
7850
7935
  this.schemaInstance = instance;
7851
- this.fields = describeFields(instance.formSchema.properties);
7936
+ this.fields = this.describe();
7852
7937
  this.runValidation();
7853
7938
  this.scheduleNotify();
7854
7939
  }
7940
+ /** Build field descriptors, threading `$ref` resolution for nested objects. */
7941
+ describe() {
7942
+ const getSchema = this.schemaInstance.getSchema;
7943
+ const resolveRef = typeof getSchema === "function" ? (ref) => getSchema.call(this.schemaInstance, ref) : void 0;
7944
+ return describeFields(
7945
+ this.schemaInstance.formSchema.properties,
7946
+ resolveRef,
7947
+ "",
7948
+ this.schemaInstance.formSchema.required
7949
+ );
7950
+ }
7855
7951
  async submit() {
7856
7952
  this.commit({ isSubmitting: true });
7857
7953
  try {
@@ -7902,7 +7998,12 @@ var FormController = class {
7902
7998
  for (const f of this.fields) {
7903
7999
  const runtime = this.getFieldStateNoSnapshot(f, this.state.values);
7904
8000
  if (!runtime.visible) {
7905
- delete errors[f.name];
8001
+ const key = f.path ?? f.name;
8002
+ delete errors[key];
8003
+ const prefix = `${key}.`;
8004
+ for (const k of Object.keys(errors)) {
8005
+ if (k.startsWith(prefix)) delete errors[k];
8006
+ }
7906
8007
  continue;
7907
8008
  }
7908
8009
  if (runtime.required) {