@prolibu-suite/cobalt-form 0.1.0 → 0.2.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 (35) hide show
  1. package/README.md +106 -0
  2. package/dist/cjs/co-form-wizard.cjs.entry.js +307 -0
  3. package/dist/cjs/co-form.cjs.entry.js +2 -1
  4. package/dist/cjs/cobalt-form.cjs.js +2 -2
  5. package/dist/cjs/index-CLL7Ervz.js +8155 -0
  6. package/dist/cjs/{index-8raPCV5a.js → index-Mpsm3UE7.js} +8 -0
  7. package/dist/cjs/index.cjs.js +151 -8869
  8. package/dist/cjs/loader.cjs.js +2 -2
  9. package/dist/cobalt-form/cobalt-form.esm.js +1 -1
  10. package/dist/cobalt-form/index.esm.js +1 -7
  11. package/dist/cobalt-form/p-2168be6b.entry.js +1 -0
  12. package/dist/cobalt-form/p-7b8f67bc.entry.js +1 -0
  13. package/dist/cobalt-form/p-C1670_IO.js +2 -0
  14. package/dist/cobalt-form/p-CPE0t-C2.js +7 -0
  15. package/dist/collection/collection-manifest.json +2 -1
  16. package/dist/collection/components/co-form/co-form.css +167 -1
  17. package/dist/collection/components/co-form/co-form.js +278 -9
  18. package/dist/collection/components/co-form-wizard/co-form-wizard.css +363 -0
  19. package/dist/collection/components/co-form-wizard/co-form-wizard.js +502 -0
  20. package/dist/components/co-form-wizard.d.ts +11 -0
  21. package/dist/components/co-form-wizard.js +1 -0
  22. package/dist/components/index.js +5 -5
  23. package/dist/esm/co-form-wizard.entry.js +305 -0
  24. package/dist/esm/co-form.entry.js +2 -1
  25. package/dist/esm/cobalt-form.js +3 -3
  26. package/dist/esm/{index-X0Keifac.js → index-C1670_IO.js} +8 -1
  27. package/dist/esm/index-CPE0t-C2.js +8144 -0
  28. package/dist/esm/index.js +147 -8865
  29. package/dist/esm/loader.js +3 -3
  30. package/dist/types/components/co-form/co-form.d.ts +53 -1
  31. package/dist/types/components/co-form-wizard/co-form-wizard.d.ts +118 -0
  32. package/dist/types/components.d.ts +184 -2
  33. package/package.json +7 -4
  34. package/dist/cobalt-form/p-X0Keifac.js +0 -2
  35. package/dist/cobalt-form/p-ef70e055.entry.js +0 -1
@@ -0,0 +1,363 @@
1
+ :host {
2
+ display: block;
3
+ font-family: var(--co-font-family-primary, sans-serif);
4
+ }
5
+
6
+ /* The wizard is a stack of cards: title-block, optional stepper, and the
7
+ * active page card. Mirrors the layered structure from the builder's
8
+ * Designer (title card → page card → fields) so the two views feel
9
+ * coherent. */
10
+ .co-form-wizard {
11
+ max-width: 720px;
12
+ margin: 0 auto;
13
+ padding: var(--co-spacing-2xl, 24px);
14
+ display: flex;
15
+ flex-direction: column;
16
+ gap: var(--co-spacing-lg, 16px);
17
+ }
18
+
19
+ /* When a background (color or image) is set, the cards "float" with a
20
+ * heavier drop shadow and no border so the bg can breathe around them. */
21
+ .co-form-wizard[data-has-bg] {
22
+ padding: var(--co-spacing-3xl, 32px) var(--co-spacing-2xl, 24px);
23
+ background-repeat: no-repeat;
24
+ }
25
+
26
+ /* ── Title block — its own card. Honors theme.header.* overrides. ───── */
27
+ .co-form-wizard__title-block {
28
+ background: var(--co-form-header-bg, var(--co-semantic-surface-page, #fff));
29
+ border: 1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));
30
+ border-radius: var(--co-border-radius-lg, 16px);
31
+ padding: var(--co-spacing-2xl, 24px) var(--co-spacing-3xl, 28px);
32
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
33
+ min-height: var(--co-form-header-height, auto);
34
+ }
35
+
36
+ /* When `show header = off`, hide the title block entirely. */
37
+ .co-form-wizard[data-hide-header] .co-form-wizard__title-block {
38
+ display: none;
39
+ }
40
+
41
+ /* Compact density — tighter gaps between cards and inside them. */
42
+ .co-form-wizard[data-density="compact"] .co-form-wizard {
43
+ gap: var(--co-spacing-sm, 8px);
44
+ }
45
+
46
+ .co-form-wizard[data-density="compact"] .co-form-wizard__title-block {
47
+ padding: var(--co-spacing-lg, 16px) var(--co-spacing-xl, 20px);
48
+ }
49
+
50
+ .co-form-wizard[data-density="compact"] .co-form-wizard__page-head,
51
+ .co-form-wizard[data-density="compact"] .co-form-wizard__nav {
52
+ padding-top: var(--co-spacing-sm, 8px);
53
+ padding-bottom: var(--co-spacing-sm, 8px);
54
+ }
55
+
56
+ .co-form-wizard__title {
57
+ margin: 0;
58
+ font-size: 24px;
59
+ font-weight: 700;
60
+ letter-spacing: -0.02em;
61
+ line-height: 1.2;
62
+ color: var(--co-semantic-text-default, #111827);
63
+ }
64
+
65
+ .co-form-wizard__title-desc {
66
+ margin: 6px 0 0;
67
+ font-size: var(--co-font-size-14, 14px);
68
+ color: var(--co-semantic-text-secondary, #6b7280);
69
+ }
70
+
71
+ /* ── Stepper — floats between cards, no card chrome ─────────────────── */
72
+ .co-form-wizard__stepper {
73
+ display: flex;
74
+ align-items: center;
75
+ gap: var(--co-spacing-sm, 8px);
76
+ list-style: none;
77
+ padding: 0;
78
+ margin: 0;
79
+ flex-wrap: wrap;
80
+ }
81
+
82
+ .co-form-wizard__step {
83
+ display: flex;
84
+ align-items: center;
85
+ color: var(--co-semantic-text-secondary, #6b7280);
86
+ font-size: var(--co-font-size-12, 12px);
87
+ }
88
+
89
+ .co-form-wizard__step-btn {
90
+ display: inline-flex;
91
+ align-items: center;
92
+ gap: var(--co-spacing-xs, 4px);
93
+ padding: 4px 6px;
94
+ border: 0;
95
+ background: transparent;
96
+ border-radius: var(--co-border-radius-xxs, 4px);
97
+ font: inherit;
98
+ color: inherit;
99
+ cursor: pointer;
100
+ }
101
+
102
+ .co-form-wizard__step-btn:hover {
103
+ background: var(--co-semantic-surface-hover, #f3f4f6);
104
+ color: var(--co-semantic-text-default, #111827);
105
+ }
106
+
107
+ .co-form-wizard__step-num {
108
+ display: inline-flex;
109
+ align-items: center;
110
+ justify-content: center;
111
+ width: 24px;
112
+ height: 24px;
113
+ border-radius: var(--co-border-radius-full, 9999px);
114
+ background: var(--co-semantic-surface-hover, #f3f4f6);
115
+ font-weight: 600;
116
+ }
117
+
118
+ .co-form-wizard__step.is-active .co-form-wizard__step-num {
119
+ background: var(--co-color-primary-azul, #2563eb);
120
+ color: white;
121
+ }
122
+
123
+ .co-form-wizard__step.is-done .co-form-wizard__step-num {
124
+ background: var(--co-color-primary-verde, #02a270);
125
+ color: white;
126
+ }
127
+
128
+ .co-form-wizard__step.is-active {
129
+ color: var(--co-semantic-text-default, #111827);
130
+ font-weight: 600;
131
+ }
132
+
133
+ /* ── Page card — wraps page header + form + nav ─────────────────────── */
134
+ .co-form-wizard__page-card {
135
+ background: var(--co-semantic-surface-page, #fff);
136
+ border: 1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));
137
+ border-radius: var(--co-border-radius-lg, 16px);
138
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
139
+ overflow: hidden;
140
+ display: flex;
141
+ flex-direction: column;
142
+ }
143
+
144
+ .co-form-wizard__page-head {
145
+ padding: var(--co-spacing-xl, 20px) var(--co-spacing-2xl, 24px);
146
+ border-bottom: 1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));
147
+ background: var(--co-semantic-surface-hover, #f9fafb);
148
+ }
149
+
150
+ .co-form-wizard__page-pill {
151
+ display: inline-flex;
152
+ font-size: 10px;
153
+ font-weight: 700;
154
+ letter-spacing: 0.08em;
155
+ color: var(--co-color-primary-azul, #2563eb);
156
+ background: color-mix(in srgb, var(--co-color-primary-azul) 10%, transparent);
157
+ padding: 3px 8px;
158
+ border-radius: var(--co-border-radius-full, 9999px);
159
+ margin-bottom: 6px;
160
+ }
161
+
162
+ .co-form-wizard__page-title {
163
+ margin: 0;
164
+ font-size: var(--co-font-size-18, 18px);
165
+ font-weight: 600;
166
+ line-height: 1.3;
167
+ letter-spacing: -0.01em;
168
+ color: var(--co-semantic-text-default, #111827);
169
+ }
170
+
171
+ .co-form-wizard__page-desc {
172
+ margin: 4px 0 0;
173
+ font-size: var(--co-font-size-13, 13px);
174
+ color: var(--co-semantic-text-secondary, #6b7280);
175
+ }
176
+
177
+ /* Inner <co-form> sits in the page card body with its own padding. */
178
+ .co-form-wizard__page-card > co-form {
179
+ display: block;
180
+ padding: var(--co-spacing-xl, 20px) var(--co-spacing-2xl, 24px);
181
+ }
182
+
183
+ /* ── Nav (Anterior / Siguiente / Enviar) ────────────────────────────── */
184
+ .co-form-wizard__nav {
185
+ display: flex;
186
+ justify-content: space-between;
187
+ gap: var(--co-spacing-sm, 8px);
188
+ padding: var(--co-spacing-md, 12px) var(--co-spacing-2xl, 24px);
189
+ border-top: 1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));
190
+ background: var(--co-semantic-surface-hover, #f9fafb);
191
+ }
192
+
193
+ .co-form-wizard__empty {
194
+ padding: var(--co-spacing-lg, 16px);
195
+ text-align: center;
196
+ color: var(--co-semantic-text-secondary, #6b7280);
197
+ }
198
+
199
+ /* ── Score panel (quiz mode) ────────────────────────────────────────── */
200
+ .co-form-wizard__score {
201
+ text-align: center;
202
+ padding: var(--co-spacing-2xl, 24px);
203
+ background: var(--co-semantic-surface-page, #fff);
204
+ border: 1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));
205
+ border-radius: var(--co-border-radius-lg, 16px);
206
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
207
+ }
208
+
209
+ .co-form-wizard__score-title {
210
+ margin: 0;
211
+ font-size: var(--co-font-size-18, 18px);
212
+ }
213
+
214
+ .co-form-wizard__score-num {
215
+ font-size: 48px;
216
+ font-weight: 600;
217
+ color: var(--co-color-primary-azul, #2563eb);
218
+ margin: var(--co-spacing-md, 12px) 0;
219
+ }
220
+
221
+ .co-form-wizard__score-pct {
222
+ font-size: var(--co-font-size-16, 16px);
223
+ color: var(--co-semantic-text-secondary, #6b7280);
224
+ margin-left: var(--co-spacing-sm, 8px);
225
+ }
226
+
227
+ .co-form-wizard__score-pass {
228
+ display: inline-block;
229
+ padding: var(--co-spacing-xs, 4px) var(--co-spacing-md, 12px);
230
+ border-radius: var(--co-border-radius-full, 9999px);
231
+ font-weight: 600;
232
+ margin-bottom: var(--co-spacing-md, 12px);
233
+ }
234
+
235
+ .co-form-wizard__score-pass.is-pass {
236
+ background: var(--co-color-status-success, #0a7724);
237
+ color: white;
238
+ }
239
+
240
+ .co-form-wizard__score-pass.is-fail {
241
+ background: var(--co-color-status-error, #aa2e1b);
242
+ color: white;
243
+ }
244
+
245
+ .co-form-wizard__score-feedback {
246
+ text-align: left;
247
+ list-style: disc;
248
+ padding-left: var(--co-spacing-2xl, 24px);
249
+ color: var(--co-semantic-text-default, #111827);
250
+ }
251
+
252
+ /* ── With background image / color: heavier shadow, no border ───────── */
253
+ .co-form-wizard[data-has-bg] .co-form-wizard__title-block,
254
+ .co-form-wizard[data-has-bg] .co-form-wizard__page-card,
255
+ .co-form-wizard[data-has-bg] .co-form-wizard__score {
256
+ border: 0;
257
+ box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
258
+ }
259
+
260
+ /* ── Dark mode ───────────────────────────────────────────────────────
261
+ * Re-bind the semantic surface tokens at this scope so EVERY descendant
262
+ * (cards, inputs, buttons) inherits a coherent dark palette. Inputs use
263
+ * `--co-semantic-surface-secondary` for their background — we set it to
264
+ * the same value as the card surface so inputs read as "part of the
265
+ * card" with their border (--co-semantic-border-subtle) doing the
266
+ * delineation work. Cobalt's global dark tokens (loaded via
267
+ * cobalt-tokens/css/dark) would put inputs on a different darker shade
268
+ * than the card; that mismatch was producing the "almost black box on
269
+ * dark gray card" effect.
270
+ */
271
+ .co-form-wizard[data-theme="dark"] {
272
+ --co-semantic-surface-page: #1a1f2b;
273
+ --co-semantic-surface-secondary: #1a1f2b;
274
+ --co-semantic-surface-primary: #ffffff;
275
+ --co-semantic-surface-muted: #2a3142;
276
+ --co-semantic-surface-hover: rgba(255, 255, 255, 0.06);
277
+ --co-semantic-surface-disabled: rgba(255, 255, 255, 0.04);
278
+ --co-semantic-text-default: #f9fafb;
279
+ --co-semantic-text-secondary: #9ca3af;
280
+ --co-semantic-text-muted: #6b7280;
281
+ --co-semantic-text-disabled: #4b5563;
282
+ --co-semantic-border-default: rgba(255, 255, 255, 0.12);
283
+ --co-semantic-border-subtle: rgba(255, 255, 255, 0.14);
284
+ --co-semantic-border-strong: rgba(255, 255, 255, 0.25);
285
+ --co-semantic-border-focus: rgba(255, 255, 255, 0.25);
286
+ --co-semantic-border-focus-ring: rgba(255, 255, 255, 0.1);
287
+ color: #f9fafb;
288
+ }
289
+
290
+ .co-form-wizard[data-theme="dark"] .co-form-wizard__page-card,
291
+ .co-form-wizard[data-theme="dark"] .co-form-wizard__score {
292
+ background: var(--co-semantic-surface-page);
293
+ border-color: var(--co-semantic-border-default);
294
+ color: #f9fafb;
295
+ }
296
+
297
+ /* Title block honors the header bg override (set when the user picks a
298
+ * color in Theme → Header) BEFORE falling back to the dark card surface. */
299
+ .co-form-wizard[data-theme="dark"] .co-form-wizard__title-block {
300
+ background: var(--co-form-header-bg, var(--co-semantic-surface-page));
301
+ border-color: var(--co-semantic-border-default);
302
+ color: #f9fafb;
303
+ }
304
+
305
+ .co-form-wizard[data-theme="dark"] .co-form-wizard__title,
306
+ .co-form-wizard[data-theme="dark"] .co-form-wizard__page-title {
307
+ color: #f9fafb;
308
+ }
309
+
310
+ .co-form-wizard[data-theme="dark"] .co-form-wizard__title-desc,
311
+ .co-form-wizard[data-theme="dark"] .co-form-wizard__page-desc {
312
+ color: #9ca3af;
313
+ }
314
+
315
+ .co-form-wizard[data-theme="dark"] .co-form-wizard__page-head,
316
+ .co-form-wizard[data-theme="dark"] .co-form-wizard__nav {
317
+ background: rgba(255, 255, 255, 0.03);
318
+ border-color: var(--co-semantic-border-default);
319
+ }
320
+
321
+ .co-form-wizard[data-theme="dark"] .co-form-wizard__step-num {
322
+ background: rgba(255, 255, 255, 0.1);
323
+ color: #f9fafb;
324
+ }
325
+
326
+ .co-form-wizard[data-theme="dark"][data-has-bg] .co-form-wizard__title-block,
327
+ .co-form-wizard[data-theme="dark"][data-has-bg] .co-form-wizard__page-card,
328
+ .co-form-wizard[data-theme="dark"][data-has-bg] .co-form-wizard__score {
329
+ box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
330
+ }
331
+
332
+ /* ── "Without panels" appearance ────────────────────────────────────── *
333
+ * Strips all card chrome so the form lives directly on the canvas bg.
334
+ */
335
+ .co-form-wizard[data-appearance="flat"] .co-form-wizard__title-block,
336
+ .co-form-wizard[data-appearance="flat"] .co-form-wizard__page-card {
337
+ background: transparent !important;
338
+ border: 0 !important;
339
+ box-shadow: none !important;
340
+ padding: 0 !important;
341
+ }
342
+
343
+ .co-form-wizard[data-appearance="flat"] .co-form-wizard__page-head {
344
+ background: transparent !important;
345
+ border-bottom: 0 !important;
346
+ padding: 0 0 var(--co-spacing-md, 12px) 0 !important;
347
+ }
348
+
349
+ .co-form-wizard[data-appearance="flat"] .co-form-wizard__nav {
350
+ background: transparent !important;
351
+ border-top: 0 !important;
352
+ padding: var(--co-spacing-md, 12px) 0 0 !important;
353
+ }
354
+
355
+ .co-form-wizard[data-appearance="flat"] .co-form-wizard__page-card > co-form {
356
+ padding: 0 !important;
357
+ }
358
+
359
+ /* In flat + dark, just keep the text colors readable. */
360
+ .co-form-wizard[data-appearance="flat"][data-theme="dark"] .co-form-wizard__title-block,
361
+ .co-form-wizard[data-appearance="flat"][data-theme="dark"] .co-form-wizard__page-card {
362
+ color: #f9fafb;
363
+ }