@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.
- package/dist/cjs/co-form-wizard.cjs.entry.js +40 -11
- package/dist/cjs/co-form.cjs.entry.js +1 -1
- package/dist/cjs/cobalt-form.cjs.js +1 -1
- package/dist/cjs/{index-CLL7Ervz.js → index-Brpri7nS.js} +120 -19
- package/dist/cjs/index.cjs.js +146 -5
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cobalt-form/cobalt-form.esm.js +1 -1
- package/dist/cobalt-form/index.esm.js +1 -1
- package/dist/cobalt-form/p-296094ec.entry.js +1 -0
- package/dist/cobalt-form/{p-2168be6b.entry.js → p-95e1cedb.entry.js} +1 -1
- package/dist/cobalt-form/{p-CPE0t-C2.js → p-CzvtCEKX.js} +3 -3
- package/dist/collection/components/co-form/co-form.css +326 -4
- package/dist/collection/components/co-form/co-form.js +167 -4
- package/dist/collection/components/co-form-wizard/co-form-wizard.css +5 -0
- package/dist/collection/components/co-form-wizard/co-form-wizard.js +92 -10
- package/dist/components/co-form-wizard.js +1 -1
- package/dist/components/index.js +7 -7
- package/dist/esm/co-form-wizard.entry.js +40 -11
- package/dist/esm/co-form.entry.js +1 -1
- package/dist/esm/cobalt-form.js +1 -1
- package/dist/esm/{index-CPE0t-C2.js → index-CzvtCEKX.js} +120 -19
- package/dist/esm/index.js +146 -5
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/co-form/co-form.d.ts +7 -0
- package/dist/types/components/co-form-wizard/co-form-wizard.d.ts +15 -1
- package/dist/types/components.d.ts +33 -0
- package/dist/types/jsx-cobalt.d.ts +3 -0
- package/package.json +3 -3
- package/dist/cobalt-form/p-0a2a284f.entry.js +0 -1
|
@@ -10,8 +10,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
-
import { h, Host } from "@stencil/core";
|
|
14
13
|
import { collectQuizFields, computeScore, evaluateExpression, resolveTheme, themeToStyles, toPagedSchema, } from "@prolibu-suite/cobalt-form-core";
|
|
14
|
+
import { h, Host } from "@stencil/core";
|
|
15
15
|
function safeJsonParse(s) {
|
|
16
16
|
try {
|
|
17
17
|
return JSON.parse(s);
|
|
@@ -20,6 +20,16 @@ function safeJsonParse(s) {
|
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
const DEFAULT_LABELS = {
|
|
24
|
+
result: 'Result',
|
|
25
|
+
passed: 'Passed',
|
|
26
|
+
failed: 'Failed',
|
|
27
|
+
prev: 'Previous',
|
|
28
|
+
next: 'Next',
|
|
29
|
+
submit: 'Submit',
|
|
30
|
+
empty: 'No pages to display.',
|
|
31
|
+
pagePrefix: 'PAGE',
|
|
32
|
+
};
|
|
23
33
|
/**
|
|
24
34
|
* Multi-page wrapper around `<co-form>`. Consumes a paged schema (or a flat
|
|
25
35
|
* one, which it auto-wraps as a single page) and renders one page at a time
|
|
@@ -40,6 +50,8 @@ export class CoFormWizard {
|
|
|
40
50
|
this.layout = 'grid';
|
|
41
51
|
/** Number of columns per page. */
|
|
42
52
|
this.columns = 1;
|
|
53
|
+
/** When to run validation. Forwarded to each page's `<co-form>`. */
|
|
54
|
+
this.validateOn = 'change';
|
|
43
55
|
this.currentIndex = 0;
|
|
44
56
|
this.values = {};
|
|
45
57
|
this.finalScore = null;
|
|
@@ -61,13 +73,13 @@ export class CoFormWizard {
|
|
|
61
73
|
return;
|
|
62
74
|
if (this.currentIndex < this.activePages.length - 1) {
|
|
63
75
|
this.currentIndex += 1;
|
|
64
|
-
this.
|
|
76
|
+
this.emitPageChange();
|
|
65
77
|
}
|
|
66
78
|
};
|
|
67
79
|
this.handlePrev = () => {
|
|
68
80
|
if (this.currentIndex > 0) {
|
|
69
81
|
this.currentIndex -= 1;
|
|
70
|
-
this.
|
|
82
|
+
this.emitPageChange();
|
|
71
83
|
}
|
|
72
84
|
};
|
|
73
85
|
/**
|
|
@@ -81,7 +93,7 @@ export class CoFormWizard {
|
|
|
81
93
|
return;
|
|
82
94
|
if (targetIndex < this.currentIndex) {
|
|
83
95
|
this.currentIndex = targetIndex;
|
|
84
|
-
this.
|
|
96
|
+
this.emitPageChange();
|
|
85
97
|
return;
|
|
86
98
|
}
|
|
87
99
|
// Forward jump — validate-and-advance one step at a time.
|
|
@@ -91,7 +103,7 @@ export class CoFormWizard {
|
|
|
91
103
|
return;
|
|
92
104
|
this.currentIndex += 1;
|
|
93
105
|
}
|
|
94
|
-
this.
|
|
106
|
+
this.emitPageChange();
|
|
95
107
|
};
|
|
96
108
|
this.handleSubmit = async () => {
|
|
97
109
|
const ok = await this.commitCurrentPage();
|
|
@@ -107,8 +119,17 @@ export class CoFormWizard {
|
|
|
107
119
|
};
|
|
108
120
|
this.handlePageChange = (ev) => {
|
|
109
121
|
this.values = Object.assign(Object.assign({}, this.values), { [ev.detail.name]: ev.detail.value });
|
|
122
|
+
this.coChange.emit(ev.detail);
|
|
110
123
|
};
|
|
111
124
|
}
|
|
125
|
+
get mergedLabels() {
|
|
126
|
+
if (!this.labels)
|
|
127
|
+
return DEFAULT_LABELS;
|
|
128
|
+
const parsed = safeJsonParse(this.labels);
|
|
129
|
+
if (!parsed || typeof parsed !== 'object')
|
|
130
|
+
return DEFAULT_LABELS;
|
|
131
|
+
return Object.assign(Object.assign({}, DEFAULT_LABELS), parsed);
|
|
132
|
+
}
|
|
112
133
|
componentWillLoad() {
|
|
113
134
|
this.parseSchema();
|
|
114
135
|
this.values = this.parseInitialValues();
|
|
@@ -203,6 +224,12 @@ export class CoFormWizard {
|
|
|
203
224
|
var _a;
|
|
204
225
|
return (_a = this.activePages[this.currentIndex]) !== null && _a !== void 0 ? _a : null;
|
|
205
226
|
}
|
|
227
|
+
emitPageChange() {
|
|
228
|
+
const page = this.currentPage;
|
|
229
|
+
if (page) {
|
|
230
|
+
this.coPageChange.emit({ index: this.currentIndex, page });
|
|
231
|
+
}
|
|
232
|
+
}
|
|
206
233
|
async commitCurrentPage() {
|
|
207
234
|
var _a, _b;
|
|
208
235
|
if (!this.currentFormEl)
|
|
@@ -238,7 +265,7 @@ export class CoFormWizard {
|
|
|
238
265
|
var _a;
|
|
239
266
|
const pages = this.activePages;
|
|
240
267
|
if (pages.length === 0) {
|
|
241
|
-
return (h(Host, Object.assign({}, this.hostProps()), h("div", { class: "co-form-wizard__empty" },
|
|
268
|
+
return (h(Host, Object.assign({}, this.hostProps()), h("div", { class: "co-form-wizard__empty" }, this.mergedLabels.empty)));
|
|
242
269
|
}
|
|
243
270
|
// Quiz finished — show the score panel.
|
|
244
271
|
if (this.finalScore && ((_a = this.paged.scoring) === null || _a === void 0 ? void 0 : _a.showScore)) {
|
|
@@ -265,7 +292,7 @@ export class CoFormWizard {
|
|
|
265
292
|
'co-form-wizard__step': true,
|
|
266
293
|
'is-active': i === this.currentIndex,
|
|
267
294
|
'is-done': i < this.currentIndex,
|
|
268
|
-
}, 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:
|
|
295
|
+
}, 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" })));
|
|
269
296
|
}
|
|
270
297
|
/**
|
|
271
298
|
* Smart page-head visibility:
|
|
@@ -287,11 +314,12 @@ export class CoFormWizard {
|
|
|
287
314
|
const wantsPill = isMulti && !current.hideTitle;
|
|
288
315
|
if (!wantsPill && !wantsTitle && !wantsDesc)
|
|
289
316
|
return null;
|
|
290
|
-
return (h("header", { class: "co-form-wizard__page-head" }, wantsPill && (h("span", { class: "co-form-wizard__page-pill" }, "
|
|
317
|
+
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))));
|
|
291
318
|
}
|
|
292
319
|
renderScorePanel(score) {
|
|
293
|
-
const
|
|
294
|
-
|
|
320
|
+
const labels = this.mergedLabels;
|
|
321
|
+
const passText = score.passed === true ? labels.passed : score.passed === false ? labels.failed : null;
|
|
322
|
+
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: {
|
|
295
323
|
'co-form-wizard__score-pass': true,
|
|
296
324
|
'is-pass': score.passed === true,
|
|
297
325
|
'is-fail': score.passed === false,
|
|
@@ -426,6 +454,45 @@ export class CoFormWizard {
|
|
|
426
454
|
"setter": false,
|
|
427
455
|
"reflect": false,
|
|
428
456
|
"attribute": "theme"
|
|
457
|
+
},
|
|
458
|
+
"validateOn": {
|
|
459
|
+
"type": "string",
|
|
460
|
+
"mutable": false,
|
|
461
|
+
"complexType": {
|
|
462
|
+
"original": "'change' | 'blur' | 'submit'",
|
|
463
|
+
"resolved": "\"blur\" | \"change\" | \"submit\"",
|
|
464
|
+
"references": {}
|
|
465
|
+
},
|
|
466
|
+
"required": false,
|
|
467
|
+
"optional": false,
|
|
468
|
+
"docs": {
|
|
469
|
+
"tags": [],
|
|
470
|
+
"text": "When to run validation. Forwarded to each page's `<co-form>`."
|
|
471
|
+
},
|
|
472
|
+
"getter": false,
|
|
473
|
+
"setter": false,
|
|
474
|
+
"reflect": false,
|
|
475
|
+
"attribute": "validate-on",
|
|
476
|
+
"defaultValue": "'change'"
|
|
477
|
+
},
|
|
478
|
+
"labels": {
|
|
479
|
+
"type": "string",
|
|
480
|
+
"mutable": false,
|
|
481
|
+
"complexType": {
|
|
482
|
+
"original": "string",
|
|
483
|
+
"resolved": "string | undefined",
|
|
484
|
+
"references": {}
|
|
485
|
+
},
|
|
486
|
+
"required": false,
|
|
487
|
+
"optional": true,
|
|
488
|
+
"docs": {
|
|
489
|
+
"tags": [],
|
|
490
|
+
"text": "UI labels as a JSON string. Allows consumers to override any label\nfor i18n without coupling the component to a specific i18n library.\nPass a partial object \u2014 unset keys fall back to English defaults."
|
|
491
|
+
},
|
|
492
|
+
"getter": false,
|
|
493
|
+
"setter": false,
|
|
494
|
+
"reflect": false,
|
|
495
|
+
"attribute": "labels"
|
|
429
496
|
}
|
|
430
497
|
};
|
|
431
498
|
}
|
|
@@ -487,6 +554,21 @@ export class CoFormWizard {
|
|
|
487
554
|
}
|
|
488
555
|
}
|
|
489
556
|
}
|
|
557
|
+
}, {
|
|
558
|
+
"method": "coChange",
|
|
559
|
+
"name": "coChange",
|
|
560
|
+
"bubbles": true,
|
|
561
|
+
"cancelable": true,
|
|
562
|
+
"composed": true,
|
|
563
|
+
"docs": {
|
|
564
|
+
"tags": [],
|
|
565
|
+
"text": ""
|
|
566
|
+
},
|
|
567
|
+
"complexType": {
|
|
568
|
+
"original": "{ name: string; value: any }",
|
|
569
|
+
"resolved": "{ name: string; value: any; }",
|
|
570
|
+
"references": {}
|
|
571
|
+
}
|
|
490
572
|
}];
|
|
491
573
|
}
|
|
492
574
|
static get elementRef() { return "host"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as a,d as r,p as o,H as t,c as e,a as i,b as c,r as s,e as d,f as n,g as l,h as f,i as m}from"./index.js";function p(a){try{return JSON.parse(a)}catch(a){return null}}const h=o(class extends t{constructor(a){super(),!1!==a&&this.__registerHost(),this.coSubmit=e(this,"coSubmit"),this.coPageChange=e(this,"coPageChange"),this.locale="es",this.layout="grid",this.columns=1,this.currentIndex=0,this.values={},this.finalScore=null,this.themeStyles=null,this.hasBg=!1,this.paged={pages:[]},this.currentFormEl=null,this.handleNext=async()=>{await this.commitCurrentPage()&&this.currentIndex<this.activePages.length-1&&(this.currentIndex+=1,this.coPageChange.emit({index:this.currentIndex,page:this.currentPage}))},this.handlePrev=()=>{this.currentIndex>0&&(this.currentIndex-=1,this.coPageChange.emit({index:this.currentIndex,page:this.currentPage}))},this.handleStepClick=async a=>{if(a!==this.currentIndex){if(a<this.currentIndex)return this.currentIndex=a,void this.coPageChange.emit({index:this.currentIndex,page:this.currentPage});for(;this.currentIndex<a;){if(!await this.commitCurrentPage())return;this.currentIndex+=1}this.coPageChange.emit({index:this.currentIndex,page:this.currentPage})}},this.handleSubmit=async()=>{if(!await this.commitCurrentPage())return;let a;if("quiz"===this.paged.mode){const r=i(this.paged.pages);a=c(this.values,r,this.paged.scoring),this.finalScore=a}this.coSubmit.emit({values:this.values,score:a})},this.handlePageChange=a=>{this.values=Object.assign(Object.assign({},this.values),{[a.detail.name]:a.detail.value})}}componentWillLoad(){this.parseSchema(),this.values=this.parseInitialValues(),this.applyTheme()}onSchemaChange(){this.parseSchema(),this.currentIndex=0,this.applyTheme()}onThemeChange(){this.applyTheme()}applyTheme(){var a;const r=this.theme?"string"==typeof this.theme?p(this.theme):this.theme:this.paged.theme;if(console.log("[co-form-wizard] applyTheme called",{themeProp:this.theme,pagedTheme:null===(a=this.paged)||void 0===a?void 0:a.theme,raw:r}),!r)return this.themeStyles=null,this.hasBg=!1,void console.log("[co-form-wizard] no theme — cleared");const o=s(r);this.themeStyles=d(o),this.hasBg=!(!o.background.color&&!o.background.imageUrl),console.log("[co-form-wizard] theme resolved",{resolved:o,modifiers:this.themeStyles.modifiers,customProps:this.themeStyles.customProperties,hasBg:this.hasBg})}parseSchema(){try{const a=JSON.parse(this.schema);this.paged=n(a)}catch(a){console.error("[co-form-wizard] failed to parse schema:",a),this.paged={pages:[]}}}parseInitialValues(){if(!this.initialValues)return{};try{return JSON.parse(this.initialValues)||{}}catch(a){return console.error("[co-form-wizard] failed to parse initialValues:",a),{}}}get themeForChildren(){var a;const r=this.theme?"string"==typeof this.theme?p(this.theme):this.theme:null===(a=this.paged)||void 0===a?void 0:a.theme;if(!r||"object"!=typeof r)return;const o=function(a,r){var o={};for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&r.indexOf(t)<0&&(o[t]=a[t]);if(null!=a&&"function"==typeof Object.getOwnPropertySymbols){var e=0;for(t=Object.getOwnPropertySymbols(a);e<t.length;e++)r.indexOf(t[e])<0&&Object.prototype.propertyIsEnumerable.call(a,t[e])&&(o[t[e]]=a[t[e]])}return o}(r,["background"]);return JSON.stringify(o)}get activePages(){return this.paged.pages.filter((a=>!a.visibleIf||l(a.visibleIf,this.values)))}get currentPage(){var a;return null!==(a=this.activePages[this.currentIndex])&&void 0!==a?a:null}async commitCurrentPage(){var a,r;if(!this.currentFormEl)return!0;const o=await(null===(r=(a=this.currentFormEl).validateAndCollect)||void 0===r?void 0:r.call(a));return!!(null==o?void 0:o.valid)&&(this.values=Object.assign(Object.assign({},this.values),o.values),!0)}hostProps(){return{}}wrapperProps(){const a=this.themeStyles;return a?Object.assign(Object.assign(Object.assign({class:"co-form-wizard","data-theme":a.modifiers.colorScheme,"data-density":a.modifiers.density,"data-appearance":a.modifiers.appearance,"data-radius":a.modifiers.radius},this.hasBg?{"data-has-bg":""}:{}),a.modifiers.hideHeader?{"data-hide-header":""}:{}),{style:Object.assign(Object.assign({},a.customProperties),a.inlineStyles)}):{class:"co-form-wizard"}}render(){var a;const r=this.activePages;if(0===r.length)return f(m,Object.assign({},this.hostProps()),f("div",{class:"co-form-wizard__empty"},"No pages to display."));if(this.finalScore&&(null===(a=this.paged.scoring)||void 0===a?void 0:a.showScore))return f(m,Object.assign({},this.hostProps()),this.renderScorePanel(this.finalScore));const o=r[this.currentIndex],t=0===this.currentIndex,e=this.currentIndex===r.length-1,i=Object.keys(o.fields),c={};for(const a of i)a in this.values&&(c[a]=this.values[a]);return f(m,Object.assign({},this.hostProps()),this.renderInner(r,o,t,e,c))}renderInner(a,r,o,t,e){var i;const c=null===(i=this.themeStyles)||void 0===i?void 0:i.customCss;return f("div",Object.assign({},this.wrapperProps()),c&&f("style",null,c),f("slot",{name:"header"},(this.paged.title||this.paged.description)&&f("header",{class:"co-form-wizard__title-block"},this.paged.title&&f("h1",{class:"co-form-wizard__title"},this.paged.title),this.paged.description&&f("p",{class:"co-form-wizard__title-desc"},this.paged.description))),a.length>1&&f("ol",{class:"co-form-wizard__stepper"},a.map(((a,r)=>f("li",{class:{"co-form-wizard__step":!0,"is-active":r===this.currentIndex,"is-done":r<this.currentIndex},key:a.name},f("button",{type:"button",class:"co-form-wizard__step-btn",onClick:()=>this.handleStepClick(r)},f("span",{class:"co-form-wizard__step-num"},r+1),f("span",{class:"co-form-wizard__step-label"},a.title||a.name)))))),f("section",{class:"co-form-wizard__page-card"},this.renderPageHead(r,a.length>1),f("co-form",{ref:a=>this.currentFormEl=a,schema:JSON.stringify(r.fields),"initial-values":JSON.stringify(e),locale:this.locale,layout:this.layout,columns:this.columns,theme:this.themeForChildren,"hide-footer":!0,onCoChange:this.handlePageChange}),f("div",{class:"co-form-wizard__nav"},f("co-button",{label:"Anterior",variant:"outlined",disabled:o,onClick:this.handlePrev}),f("co-button",t?{label:"Enviar",variant:"primary",onClick:this.handleSubmit}:{label:"Siguiente",variant:"primary",onClick:this.handleNext}))),f("slot",{name:"footer"}))}renderPageHead(a,r){const o=(!!a.title&&!(!a.title||/^Page \d+$/i.test(a.title))||r&&a.title)&&!a.hideTitle,t=!!a.description&&!a.hideDescription,e=r&&!a.hideTitle;return e||o||t?f("header",{class:"co-form-wizard__page-head"},e&&f("span",{class:"co-form-wizard__page-pill"},"PAGE ",this.currentIndex+1),o&&f("h2",{class:"co-form-wizard__page-title"},a.title),t&&f("p",{class:"co-form-wizard__page-desc"},a.description)):null}renderScorePanel(a){const r=!0===a.passed?"Aprobado":!1===a.passed?"No aprobado":null;return f("div",{class:"co-form-wizard co-form-wizard__score"},f("h2",{class:"co-form-wizard__score-title"},"Resultado"),f("div",{class:"co-form-wizard__score-num"},a.total," / ",a.max,f("span",{class:"co-form-wizard__score-pct"},"(",a.percent,"%)")),r&&f("div",{class:{"co-form-wizard__score-pass":!0,"is-pass":!0===a.passed,"is-fail":!1===a.passed}},r),a.feedback.length>0&&f("ul",{class:"co-form-wizard__score-feedback"},a.feedback.map((a=>f("li",null,a)))))}get host(){return this}static get watchers(){return{schema:[{onSchemaChange:0}],theme:[{onThemeChange:0}]}}static get style(){return':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}'}},[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]},void 0,{schema:[{onSchemaChange:0}],theme:[{onThemeChange:0}]}]);function g(){"undefined"!=typeof customElements&&["co-form-wizard","co-form"].forEach((o=>{switch(o){case"co-form-wizard":customElements.get(a(o))||customElements.define(a(o),h);break;case"co-form":customElements.get(a(o))||r()}}))}g();const b=h,u=g;export{b as CoFormWizard,u as defineCustomElement}
|
|
1
|
+
import{t as a,d as r,p as o,H as t,c as e,a as i,b as c,r as s,e as d,f as n,g as l,h as m,i as f}from"./index.js";function p(a){try{return JSON.parse(a)}catch(a){return null}}const h={result:"Result",passed:"Passed",failed:"Failed",prev:"Previous",next:"Next",submit:"Submit",empty:"No pages to display.",pagePrefix:"PAGE"},g=o(class extends t{constructor(a){super(),!1!==a&&this.__registerHost(),this.coSubmit=e(this,"coSubmit"),this.coPageChange=e(this,"coPageChange"),this.coChange=e(this,"coChange"),this.locale="es",this.layout="grid",this.columns=1,this.validateOn="change",this.currentIndex=0,this.values={},this.finalScore=null,this.themeStyles=null,this.hasBg=!1,this.paged={pages:[]},this.currentFormEl=null,this.handleNext=async()=>{await this.commitCurrentPage()&&this.currentIndex<this.activePages.length-1&&(this.currentIndex+=1,this.emitPageChange())},this.handlePrev=()=>{this.currentIndex>0&&(this.currentIndex-=1,this.emitPageChange())},this.handleStepClick=async a=>{if(a!==this.currentIndex){if(a<this.currentIndex)return this.currentIndex=a,void this.emitPageChange();for(;this.currentIndex<a;){if(!await this.commitCurrentPage())return;this.currentIndex+=1}this.emitPageChange()}},this.handleSubmit=async()=>{if(!await this.commitCurrentPage())return;let a;if("quiz"===this.paged.mode){const r=i(this.paged.pages);a=c(this.values,r,this.paged.scoring),this.finalScore=a}this.coSubmit.emit({values:this.values,score:a})},this.handlePageChange=a=>{this.values=Object.assign(Object.assign({},this.values),{[a.detail.name]:a.detail.value}),this.coChange.emit(a.detail)}}get mergedLabels(){if(!this.labels)return h;const a=p(this.labels);return a&&"object"==typeof a?Object.assign(Object.assign({},h),a):h}componentWillLoad(){this.parseSchema(),this.values=this.parseInitialValues(),this.applyTheme()}onSchemaChange(){this.parseSchema(),this.currentIndex=0,this.applyTheme()}onThemeChange(){this.applyTheme()}applyTheme(){var a;const r=this.theme?"string"==typeof this.theme?p(this.theme):this.theme:this.paged.theme;if(console.log("[co-form-wizard] applyTheme called",{themeProp:this.theme,pagedTheme:null===(a=this.paged)||void 0===a?void 0:a.theme,raw:r}),!r)return this.themeStyles=null,this.hasBg=!1,void console.log("[co-form-wizard] no theme — cleared");const o=s(r);this.themeStyles=d(o),this.hasBg=!(!o.background.color&&!o.background.imageUrl),console.log("[co-form-wizard] theme resolved",{resolved:o,modifiers:this.themeStyles.modifiers,customProps:this.themeStyles.customProperties,hasBg:this.hasBg})}parseSchema(){try{const a=JSON.parse(this.schema);this.paged=n(a)}catch(a){console.error("[co-form-wizard] failed to parse schema:",a),this.paged={pages:[]}}}parseInitialValues(){if(!this.initialValues)return{};try{return JSON.parse(this.initialValues)||{}}catch(a){return console.error("[co-form-wizard] failed to parse initialValues:",a),{}}}get themeForChildren(){var a;const r=this.theme?"string"==typeof this.theme?p(this.theme):this.theme:null===(a=this.paged)||void 0===a?void 0:a.theme;if(!r||"object"!=typeof r)return;const o=function(a,r){var o={};for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&r.indexOf(t)<0&&(o[t]=a[t]);if(null!=a&&"function"==typeof Object.getOwnPropertySymbols){var e=0;for(t=Object.getOwnPropertySymbols(a);e<t.length;e++)r.indexOf(t[e])<0&&Object.prototype.propertyIsEnumerable.call(a,t[e])&&(o[t[e]]=a[t[e]])}return o}(r,["background"]);return JSON.stringify(o)}get activePages(){return this.paged.pages.filter((a=>!a.visibleIf||l(a.visibleIf,this.values)))}get currentPage(){var a;return null!==(a=this.activePages[this.currentIndex])&&void 0!==a?a:null}emitPageChange(){const a=this.currentPage;a&&this.coPageChange.emit({index:this.currentIndex,page:a})}async commitCurrentPage(){var a,r;if(!this.currentFormEl)return!0;const o=await(null===(r=(a=this.currentFormEl).validateAndCollect)||void 0===r?void 0:r.call(a));return!!(null==o?void 0:o.valid)&&(this.values=Object.assign(Object.assign({},this.values),o.values),!0)}hostProps(){return{}}wrapperProps(){const a=this.themeStyles;return a?Object.assign(Object.assign(Object.assign({class:"co-form-wizard","data-theme":a.modifiers.colorScheme,"data-density":a.modifiers.density,"data-appearance":a.modifiers.appearance,"data-radius":a.modifiers.radius},this.hasBg?{"data-has-bg":""}:{}),a.modifiers.hideHeader?{"data-hide-header":""}:{}),{style:Object.assign(Object.assign({},a.customProperties),a.inlineStyles)}):{class:"co-form-wizard"}}render(){var a;const r=this.activePages;if(0===r.length)return m(f,Object.assign({},this.hostProps()),m("div",{class:"co-form-wizard__empty"},this.mergedLabels.empty));if(this.finalScore&&(null===(a=this.paged.scoring)||void 0===a?void 0:a.showScore))return m(f,Object.assign({},this.hostProps()),this.renderScorePanel(this.finalScore));const o=r[this.currentIndex],t=0===this.currentIndex,e=this.currentIndex===r.length-1,i=Object.keys(o.fields),c={};for(const a of i)a in this.values&&(c[a]=this.values[a]);return m(f,Object.assign({},this.hostProps()),this.renderInner(r,o,t,e,c))}renderInner(a,r,o,t,e){var i;const c=null===(i=this.themeStyles)||void 0===i?void 0:i.customCss;return m("div",Object.assign({},this.wrapperProps()),c&&m("style",null,c),m("slot",{name:"header"},(this.paged.title||this.paged.description)&&m("header",{class:"co-form-wizard__title-block"},this.paged.title&&m("h1",{class:"co-form-wizard__title"},this.paged.title),this.paged.description&&m("p",{class:"co-form-wizard__title-desc"},this.paged.description))),a.length>1&&m("ol",{class:"co-form-wizard__stepper"},a.map(((a,r)=>m("li",{class:{"co-form-wizard__step":!0,"is-active":r===this.currentIndex,"is-done":r<this.currentIndex},key:a.name},m("button",{type:"button",class:"co-form-wizard__step-btn",onClick:()=>this.handleStepClick(r)},m("span",{class:"co-form-wizard__step-num"},r+1),m("span",{class:"co-form-wizard__step-label"},a.title||a.name)))))),m("section",{class:"co-form-wizard__page-card"},this.renderPageHead(r,a.length>1),m("co-form",{ref:a=>this.currentFormEl=a,schema:JSON.stringify(r.fields),"initial-values":JSON.stringify(e),locale:this.locale,layout:this.layout,columns:this.columns,theme:this.themeForChildren,"validate-on":this.validateOn,"hide-footer":!0,onCoChange:this.handlePageChange}),m("div",{class:"co-form-wizard__nav"},a.length>1&&m("co-button",{label:this.mergedLabels.prev,variant:"stroke",disabled:o,onClick:this.handlePrev}),m("co-button",t?{label:this.mergedLabels.submit,variant:"primary",onClick:this.handleSubmit}:{label:this.mergedLabels.next,variant:"primary",onClick:this.handleNext}))),m("slot",{name:"footer"}))}renderPageHead(a,r){const o=(!!a.title&&!(!a.title||/^Page \d+$/i.test(a.title))||r&&a.title)&&!a.hideTitle,t=!!a.description&&!a.hideDescription,e=r&&!a.hideTitle;return e||o||t?m("header",{class:"co-form-wizard__page-head"},e&&m("span",{class:"co-form-wizard__page-pill"},this.mergedLabels.pagePrefix," ",this.currentIndex+1),o&&m("h2",{class:"co-form-wizard__page-title"},a.title),t&&m("p",{class:"co-form-wizard__page-desc"},a.description)):null}renderScorePanel(a){const r=this.mergedLabels,o=!0===a.passed?r.passed:!1===a.passed?r.failed:null;return m("div",{class:"co-form-wizard co-form-wizard__score"},m("h2",{class:"co-form-wizard__score-title"},r.result),m("div",{class:"co-form-wizard__score-num"},a.total," / ",a.max,m("span",{class:"co-form-wizard__score-pct"},"(",a.percent,"%)")),o&&m("div",{class:{"co-form-wizard__score-pass":!0,"is-pass":!0===a.passed,"is-fail":!1===a.passed}},o),a.feedback.length>0&&m("ul",{class:"co-form-wizard__score-feedback"},a.feedback.map((a=>m("li",null,a)))))}get host(){return this}static get watchers(){return{schema:[{onSchemaChange:0}],theme:[{onThemeChange:0}]}}static get style(){return':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}'}},[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]},void 0,{schema:[{onSchemaChange:0}],theme:[{onThemeChange:0}]}]);function b(){"undefined"!=typeof customElements&&["co-form-wizard","co-form"].forEach((o=>{switch(o){case"co-form-wizard":customElements.get(a(o))||customElements.define(a(o),g);break;case"co-form":customElements.get(a(o))||r()}}))}b();const u=g,_=b;export{u as CoFormWizard,_ as defineCustomElement}
|