@openelement/ui 1.0.0-alpha.14 → 1.0.0-alpha.16

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 (43) hide show
  1. package/CUSTOMIZATION.md +106 -112
  2. package/README.md +19 -39
  3. package/custom-elements.json +369 -0
  4. package/package.json +3 -2
  5. package/src/button-machine.js +54 -0
  6. package/src/component-config.js +7 -0
  7. package/src/component-recipes.js +2 -24
  8. package/src/copy-feedback.js +32 -0
  9. package/src/dialog-machine.js +104 -0
  10. package/src/dropdown-machine.js +253 -0
  11. package/src/generated-manifest.json +135 -87
  12. package/src/index.d.ts +7 -8
  13. package/src/index.js +7 -8
  14. package/src/input-machine.js +33 -0
  15. package/src/open-button.css +119 -108
  16. package/src/open-button.d.ts +34 -342
  17. package/src/open-button.generated.js +592 -0
  18. package/src/open-button.js +115 -1140
  19. package/src/open-code-block.css +24 -44
  20. package/src/open-code-block.d.ts +15 -175
  21. package/src/open-code-block.generated.js +293 -0
  22. package/src/open-code-block.js +112 -224
  23. package/src/open-dialog.css +114 -127
  24. package/src/open-dialog.d.ts +22 -261
  25. package/src/open-dialog.generated.js +501 -0
  26. package/src/open-dialog.js +137 -632
  27. package/src/open-dropdown.css +26 -26
  28. package/src/open-dropdown.d.ts +15 -218
  29. package/src/open-dropdown.generated.js +211 -0
  30. package/src/open-dropdown.js +74 -355
  31. package/src/open-input.css +69 -74
  32. package/src/open-input.d.ts +34 -461
  33. package/src/open-input.generated.js +685 -0
  34. package/src/open-input.js +161 -1802
  35. package/src/open-theme-toggle.css +37 -47
  36. package/src/open-theme-toggle.d.ts +19 -190
  37. package/src/open-theme-toggle.generated.js +564 -0
  38. package/src/open-theme-toggle.js +209 -509
  39. package/src/theme-contract.js +40 -0
  40. package/src/theme.css +26 -8
  41. package/src/control-recipe.css +0 -21
  42. package/src/register.d.ts +0 -4
  43. package/src/register.js +0 -22
package/src/open-input.js CHANGED
@@ -1,1807 +1,166 @@
1
- import { nextInstanceId, syncDisabledState } from "./component-recipes.js";
2
- import { OpenElement, computed } from "@openelement/element";
3
- import controlRecipe from "./control-recipe.css";
4
- import openInputStyles from "./open-input.css";
1
+ import { defineComponentConfig } from "./component-config.js";
2
+ import { syncInputDisabled, syncInputValue } from "./input-machine.js";
3
+ import { jsx, jsxs } from "@openelement/element/jsx-runtime";
4
+ import { onConnect, onPropertyChange } from "@openelement/element/lifecycle";
5
5
  //#region src/open-input.tsx
6
- const __partProgram = {
7
- "version": 1,
8
- "tag": "open-input",
9
- "root": {
10
- "id": "root",
11
- "kind": "shadow-open",
12
- "nodes": ["e0"]
13
- },
14
- "template": [{
15
- "k": "el",
16
- "id": "e0",
17
- "tag": "div",
18
- "attrs": [["class", "input-wrapper"], ["part", "wrapper"]],
19
- "children": [
20
- {
21
- "k": "el",
22
- "id": "e1",
23
- "tag": "label",
24
- "attrs": [["part", "label"]],
25
- "children": [{
26
- "k": "part",
27
- "id": "p2",
28
- "index": 2
29
- }, {
30
- "k": "el",
31
- "id": "e2",
32
- "tag": "span",
33
- "attrs": [["class", "req"]],
34
- "children": [{
35
- "k": "part",
36
- "id": "p3",
37
- "index": 3
38
- }]
39
- }]
40
- },
41
- {
42
- "k": "el",
43
- "id": "e3",
44
- "tag": "input",
45
- "attrs": [["part", "control"]],
46
- "children": []
47
- },
48
- {
49
- "k": "el",
50
- "id": "e4",
51
- "tag": "small",
52
- "attrs": [
53
- ["role", "alert"],
54
- ["class", "error-message"],
55
- ["part", "error"]
56
- ],
57
- "children": [{
58
- "k": "part",
59
- "id": "p21",
60
- "index": 21
61
- }]
62
- }
63
- ]
64
- }],
65
- "parts": [
66
- {
67
- "k": "attr",
68
- "signal": "idAttr",
69
- "name": "for",
70
- "path": [0, 0],
71
- "index": 0,
72
- "location": {
73
- "id": "p0",
74
- "kind": "sink",
75
- "path": [0, 0],
76
- "node": "e1"
77
- }
78
- },
79
- {
80
- "k": "bool",
81
- "signal": "noLabel",
82
- "name": "hidden",
83
- "path": [0, 0],
84
- "index": 1,
85
- "location": {
86
- "id": "p1",
87
- "kind": "sink",
88
- "path": [0, 0],
89
- "node": "e1"
90
- }
91
- },
92
- {
93
- "k": "text",
94
- "signal": "label",
95
- "index": 2,
96
- "location": {
97
- "id": "p2",
98
- "kind": "anchor",
99
- "path": [
100
- 0,
101
- 0,
102
- 0
103
- ]
104
- }
105
- },
106
- {
107
- "k": "text",
108
- "signal": "requiredMark",
109
- "index": 3,
110
- "location": {
111
- "id": "p3",
112
- "kind": "anchor",
113
- "path": [
114
- 0,
115
- 0,
116
- 1,
117
- 0
118
- ]
119
- }
120
- },
121
- {
122
- "k": "attr",
123
- "signal": "idAttr",
124
- "name": "id",
125
- "path": [0, 1],
126
- "index": 4,
127
- "location": {
128
- "id": "p4",
129
- "kind": "sink",
130
- "path": [0, 1],
131
- "node": "e3"
132
- }
133
- },
134
- {
135
- "k": "class",
136
- "signal": "inputClass",
137
- "path": [0, 1],
138
- "index": 5,
139
- "location": {
140
- "id": "p5",
141
- "kind": "sink",
142
- "path": [0, 1],
143
- "node": "e3"
144
- }
145
- },
146
- {
147
- "k": "attr",
148
- "signal": "type",
149
- "name": "type",
150
- "path": [0, 1],
151
- "index": 6,
152
- "location": {
153
- "id": "p6",
154
- "kind": "sink",
155
- "path": [0, 1],
156
- "node": "e3"
157
- }
158
- },
159
- {
160
- "k": "attr",
161
- "signal": "placeholder",
162
- "name": "placeholder",
163
- "path": [0, 1],
164
- "index": 7,
165
- "location": {
166
- "id": "p7",
167
- "kind": "sink",
168
- "path": [0, 1],
169
- "node": "e3"
170
- }
171
- },
172
- {
173
- "k": "prop",
174
- "signal": "value",
175
- "name": "value",
176
- "path": [0, 1],
177
- "index": 8,
178
- "location": {
179
- "id": "p8",
180
- "kind": "sink",
181
- "path": [0, 1],
182
- "node": "e3"
183
- }
184
- },
185
- {
186
- "k": "attr",
187
- "signal": "name",
188
- "name": "name",
189
- "path": [0, 1],
190
- "index": 9,
191
- "location": {
192
- "id": "p9",
193
- "kind": "sink",
194
- "path": [0, 1],
195
- "node": "e3"
196
- }
197
- },
198
- {
199
- "k": "bool",
200
- "signal": "disabled",
201
- "name": "disabled",
202
- "path": [0, 1],
203
- "index": 10,
204
- "location": {
205
- "id": "p10",
206
- "kind": "sink",
207
- "path": [0, 1],
208
- "node": "e3"
209
- }
210
- },
211
- {
212
- "k": "bool",
213
- "signal": "required",
214
- "name": "required",
215
- "path": [0, 1],
216
- "index": 11,
217
- "location": {
218
- "id": "p11",
219
- "kind": "sink",
220
- "path": [0, 1],
221
- "node": "e3"
222
- }
223
- },
224
- {
225
- "k": "attr",
226
- "signal": "ariaInvalidAttr",
227
- "name": "aria-invalid",
228
- "path": [0, 1],
229
- "index": 12,
230
- "location": {
231
- "id": "p12",
232
- "kind": "sink",
233
- "path": [0, 1],
234
- "node": "e3"
235
- }
236
- },
237
- {
238
- "k": "attr",
239
- "signal": "describedByAttr",
240
- "name": "aria-describedby",
241
- "path": [0, 1],
242
- "index": 13,
243
- "location": {
244
- "id": "p13",
245
- "kind": "sink",
246
- "path": [0, 1],
247
- "node": "e3"
248
- }
249
- },
250
- {
251
- "k": "attr",
252
- "signal": "describedByAttr",
253
- "name": "aria-errormessage",
254
- "path": [0, 1],
255
- "index": 14,
256
- "location": {
257
- "id": "p14",
258
- "kind": "sink",
259
- "path": [0, 1],
260
- "node": "e3"
261
- }
262
- },
263
- {
264
- "k": "event",
265
- "event": "input",
266
- "handler": "handleInput",
267
- "action": {
268
- "kind": "method",
269
- "name": "handleInput"
270
- },
271
- "path": [0, 1],
272
- "index": 15,
273
- "location": {
274
- "id": "p15",
275
- "kind": "sink",
276
- "path": [0, 1],
277
- "node": "e3"
278
- }
279
- },
280
- {
281
- "k": "event",
282
- "event": "change",
283
- "handler": "handleChange",
284
- "action": {
285
- "kind": "method",
286
- "name": "handleChange"
287
- },
288
- "path": [0, 1],
289
- "index": 16,
290
- "location": {
291
- "id": "p16",
292
- "kind": "sink",
293
- "path": [0, 1],
294
- "node": "e3"
295
- }
296
- },
297
- {
298
- "k": "event",
299
- "event": "focus",
300
- "handler": "handleFocus",
301
- "action": {
302
- "kind": "method",
303
- "name": "handleFocus"
304
- },
305
- "path": [0, 1],
306
- "index": 17,
307
- "location": {
308
- "id": "p17",
309
- "kind": "sink",
310
- "path": [0, 1],
311
- "node": "e3"
312
- }
313
- },
314
- {
315
- "k": "event",
316
- "event": "blur",
317
- "handler": "handleBlur",
318
- "action": {
319
- "kind": "method",
320
- "name": "handleBlur"
321
- },
322
- "path": [0, 1],
323
- "index": 18,
324
- "location": {
325
- "id": "p18",
326
- "kind": "sink",
327
- "path": [0, 1],
328
- "node": "e3"
329
- }
330
- },
331
- {
332
- "k": "attr",
333
- "signal": "errorIdAttr",
334
- "name": "id",
335
- "path": [0, 2],
336
- "index": 19,
337
- "location": {
338
- "id": "p19",
339
- "kind": "sink",
340
- "path": [0, 2],
341
- "node": "e4"
342
- }
343
- },
344
- {
345
- "k": "bool",
346
- "signal": "noError",
347
- "name": "hidden",
348
- "path": [0, 2],
349
- "index": 20,
350
- "location": {
351
- "id": "p20",
352
- "kind": "sink",
353
- "path": [0, 2],
354
- "node": "e4"
355
- }
356
- },
357
- {
358
- "k": "text",
359
- "signal": "error",
360
- "index": 21,
361
- "location": {
362
- "id": "p21",
363
- "kind": "anchor",
364
- "path": [
365
- 0,
366
- 2,
367
- 0
368
- ]
369
- }
370
- }
371
- ],
372
- "regions": [],
373
- "dependencies": [
374
- {
375
- "signal": "idAttr",
376
- "owner": {
377
- "kind": "part",
378
- "index": 0
379
- },
380
- "location": "p0"
381
- },
382
- {
383
- "signal": "noLabel",
384
- "owner": {
385
- "kind": "part",
386
- "index": 1
387
- },
388
- "location": "p1"
389
- },
390
- {
391
- "signal": "label",
392
- "owner": {
393
- "kind": "part",
394
- "index": 2
395
- },
396
- "location": "p2"
397
- },
398
- {
399
- "signal": "requiredMark",
400
- "owner": {
401
- "kind": "part",
402
- "index": 3
403
- },
404
- "location": "p3"
405
- },
406
- {
407
- "signal": "idAttr",
408
- "owner": {
409
- "kind": "part",
410
- "index": 4
411
- },
412
- "location": "p4"
413
- },
414
- {
415
- "signal": "inputClass",
416
- "owner": {
417
- "kind": "part",
418
- "index": 5
419
- },
420
- "location": "p5"
421
- },
422
- {
423
- "signal": "type",
424
- "owner": {
425
- "kind": "part",
426
- "index": 6
427
- },
428
- "location": "p6"
429
- },
430
- {
431
- "signal": "placeholder",
432
- "owner": {
433
- "kind": "part",
434
- "index": 7
435
- },
436
- "location": "p7"
437
- },
438
- {
439
- "signal": "value",
440
- "owner": {
441
- "kind": "part",
442
- "index": 8
443
- },
444
- "location": "p8"
445
- },
446
- {
447
- "signal": "name",
448
- "owner": {
449
- "kind": "part",
450
- "index": 9
451
- },
452
- "location": "p9"
453
- },
454
- {
455
- "signal": "disabled",
456
- "owner": {
457
- "kind": "part",
458
- "index": 10
459
- },
460
- "location": "p10"
461
- },
462
- {
463
- "signal": "required",
464
- "owner": {
465
- "kind": "part",
466
- "index": 11
467
- },
468
- "location": "p11"
469
- },
470
- {
471
- "signal": "ariaInvalidAttr",
472
- "owner": {
473
- "kind": "part",
474
- "index": 12
475
- },
476
- "location": "p12"
477
- },
478
- {
479
- "signal": "describedByAttr",
480
- "owner": {
481
- "kind": "part",
482
- "index": 13
483
- },
484
- "location": "p13"
485
- },
486
- {
487
- "signal": "describedByAttr",
488
- "owner": {
489
- "kind": "part",
490
- "index": 14
491
- },
492
- "location": "p14"
493
- },
494
- {
495
- "signal": "errorIdAttr",
496
- "owner": {
497
- "kind": "part",
498
- "index": 19
499
- },
500
- "location": "p19"
501
- },
502
- {
503
- "signal": "noError",
504
- "owner": {
505
- "kind": "part",
506
- "index": 20
507
- },
508
- "location": "p20"
509
- },
510
- {
511
- "signal": "error",
512
- "owner": {
513
- "kind": "part",
514
- "index": 21
515
- },
516
- "location": "p21"
6
+ /**
7
+ * @openelement/ui - open-input
8
+ *
9
+ * Form-associated text input with a label, an inline error slot, and native
10
+ * constraint validation (required and email constraints through the shell's
11
+ * M09-2d form mapping).
12
+ *
13
+ * Experimental (owner ruling C1, #1468): internal implementation may change or
14
+ * be removed before 1.0; the declared `::part` names follow the
15
+ * CUSTOMIZATION.md contract (`::part` names never shrink).
16
+ *
17
+ * Generated authoring. The declared rows drive the compiled sinks; the derived
18
+ * visibility/ARIA surface is authored as inline JSX expressions (the generated
19
+ * lane has no authoring `computed`), and the FORM CONTRACT (setFormValue,
20
+ * validity, reset/restore, fieldset states) is the SHELL's mapping.
21
+ * `input-machine.ts` only projects the live value and the disabled surface.
22
+ *
23
+ * TWO CONSTRAINTS SHAPE THIS TEMPLATE, and both come from the generated lane:
24
+ *
25
+ * 1. No `value={…}` binding. That name classifies as a DOM-IDL `property`
26
+ * channel, and a property slot makes the whole component mount-only — losing
27
+ * the SSR producer and the claim path.
28
+ * 2. Every id is STATIC and therefore part of the compiled attribute seed. A
29
+ * claim verifies each node's static attributes, so an id written at connect
30
+ * time would fail it with OEIR_LEAF_CLAIM_MISMATCH. A shadow root is its own
31
+ * id scope, so the same spelling in every instance is correct — the class
32
+ * lane's realm-unique counter existed only to keep SSR and CSR agreeing on a
33
+ * document-wide identity, which the shadow boundary makes unnecessary.
34
+ *
35
+ * @csspart wrapper -The outer input-wrapper div
36
+ * @csspart label -The label element
37
+ * @csspart control -The input element
38
+ * @csspart error -The error message small element
39
+ *
40
+ * Usage:
41
+ * ```html
42
+ * <open-input placeholder="Enter text"></open-input>
43
+ * <open-input type="email" label="Email"></open-input>
44
+ * <form>
45
+ * <open-input name="username" label="Username"></open-input>
46
+ * <button type="submit">Submit</button>
47
+ * </form>
48
+ * ```
49
+ */
50
+ /**
51
+ * Platform facts for the generated element: shadow root with delegated focus,
52
+ * form association (value publication, required and email validity, reset/restore and
53
+ * the fieldset-effective disabled state are the SHELL's mapping), the authored
54
+ * stylesheet, and the eight declared property rows. Only `value` has no
55
+ * attribute wire — it is the live property the form contract and the compiled
56
+ * sinks read.
57
+ */
58
+ const openElement = /* @__PURE__ */ defineComponentConfig({
59
+ root: "shadow",
60
+ delegatesFocus: true,
61
+ formAssociated: true,
62
+ styles: ["./open-input.css"],
63
+ properties: {
64
+ type: { default: "text" },
65
+ placeholder: { default: "" },
66
+ label: { default: "" },
67
+ name: { default: "" },
68
+ value: { default: "" },
69
+ disabled: { default: false },
70
+ required: { default: false },
71
+ error: { default: "" }
72
+ }
73
+ });
74
+ /** Form-associated text input with a label, an error slot and native validity. */
75
+ function OpenInput(props) {
76
+ const hostOf = (event) => event.currentTarget.getRootNode().host;
77
+ const lockedByFieldset = (event) => hostOf(event).matches(":state(disabled)");
78
+ onConnect((env) => {
79
+ syncInputValue(env.host);
80
+ });
81
+ onPropertyChange((event) => {
82
+ const host = event.host;
83
+ if (event.name === "value") {
84
+ syncInputValue(host);
85
+ return;
517
86
  }
518
- ],
519
- "locations": [
520
- {
521
- "id": "e0",
522
- "kind": "element",
523
- "tag": "div",
524
- "path": [0]
525
- },
526
- {
527
- "id": "e1",
528
- "kind": "element",
529
- "tag": "label",
530
- "path": [0, 0]
531
- },
532
- {
533
- "id": "p0",
534
- "kind": "sink",
535
- "part": 0,
536
- "node": "e1",
537
- "path": [0, 0]
538
- },
539
- {
540
- "id": "p1",
541
- "kind": "sink",
542
- "part": 1,
543
- "node": "e1",
544
- "path": [0, 0]
545
- },
546
- {
547
- "id": "p2",
548
- "kind": "anchor",
549
- "part": 2,
550
- "path": [
551
- 0,
552
- 0,
553
- 0
554
- ]
555
- },
556
- {
557
- "id": "e2",
558
- "kind": "element",
559
- "tag": "span",
560
- "path": [
561
- 0,
562
- 0,
563
- 1
564
- ]
565
- },
566
- {
567
- "id": "p3",
568
- "kind": "anchor",
569
- "part": 3,
570
- "path": [
571
- 0,
572
- 0,
573
- 1,
574
- 0
575
- ]
576
- },
577
- {
578
- "id": "e3",
579
- "kind": "element",
580
- "tag": "input",
581
- "path": [0, 1]
582
- },
583
- {
584
- "id": "p4",
585
- "kind": "sink",
586
- "part": 4,
587
- "node": "e3",
588
- "path": [0, 1]
589
- },
590
- {
591
- "id": "p5",
592
- "kind": "sink",
593
- "part": 5,
594
- "node": "e3",
595
- "path": [0, 1]
596
- },
597
- {
598
- "id": "p6",
599
- "kind": "sink",
600
- "part": 6,
601
- "node": "e3",
602
- "path": [0, 1]
603
- },
604
- {
605
- "id": "p7",
606
- "kind": "sink",
607
- "part": 7,
608
- "node": "e3",
609
- "path": [0, 1]
610
- },
611
- {
612
- "id": "p8",
613
- "kind": "sink",
614
- "part": 8,
615
- "node": "e3",
616
- "path": [0, 1]
617
- },
618
- {
619
- "id": "p9",
620
- "kind": "sink",
621
- "part": 9,
622
- "node": "e3",
623
- "path": [0, 1]
624
- },
625
- {
626
- "id": "p10",
627
- "kind": "sink",
628
- "part": 10,
629
- "node": "e3",
630
- "path": [0, 1]
631
- },
632
- {
633
- "id": "p11",
634
- "kind": "sink",
635
- "part": 11,
636
- "node": "e3",
637
- "path": [0, 1]
638
- },
639
- {
640
- "id": "p12",
641
- "kind": "sink",
642
- "part": 12,
643
- "node": "e3",
644
- "path": [0, 1]
645
- },
646
- {
647
- "id": "p13",
648
- "kind": "sink",
649
- "part": 13,
650
- "node": "e3",
651
- "path": [0, 1]
652
- },
653
- {
654
- "id": "p14",
655
- "kind": "sink",
656
- "part": 14,
657
- "node": "e3",
658
- "path": [0, 1]
659
- },
660
- {
661
- "id": "p15",
662
- "kind": "sink",
663
- "part": 15,
664
- "node": "e3",
665
- "path": [0, 1]
666
- },
667
- {
668
- "id": "p16",
669
- "kind": "sink",
670
- "part": 16,
671
- "node": "e3",
672
- "path": [0, 1]
673
- },
674
- {
675
- "id": "p17",
676
- "kind": "sink",
677
- "part": 17,
678
- "node": "e3",
679
- "path": [0, 1]
680
- },
681
- {
682
- "id": "p18",
683
- "kind": "sink",
684
- "part": 18,
685
- "node": "e3",
686
- "path": [0, 1]
687
- },
688
- {
689
- "id": "e4",
690
- "kind": "element",
691
- "tag": "small",
692
- "path": [0, 2]
693
- },
694
- {
695
- "id": "p19",
696
- "kind": "sink",
697
- "part": 19,
698
- "node": "e4",
699
- "path": [0, 2]
700
- },
701
- {
702
- "id": "p20",
703
- "kind": "sink",
704
- "part": 20,
705
- "node": "e4",
706
- "path": [0, 2]
707
- },
708
- {
709
- "id": "p21",
710
- "kind": "anchor",
711
- "part": 21,
712
- "path": [
713
- 0,
714
- 2,
715
- 0
716
- ]
717
- }
718
- ],
719
- "metadata": {
720
- "tag": "open-input",
721
- "className": "OpenInput",
722
- "sourceFile": "open-input.tsx",
723
- "properties": [
724
- {
725
- "name": "type",
726
- "attribute": "type",
727
- "type": "string",
728
- "converter": "string",
729
- "reflect": false,
730
- "default": "text"
731
- },
732
- {
733
- "name": "placeholder",
734
- "attribute": "placeholder",
735
- "type": "string",
736
- "converter": "string",
737
- "reflect": false,
738
- "default": ""
739
- },
740
- {
741
- "name": "label",
742
- "attribute": "label",
743
- "type": "string",
744
- "converter": "string",
745
- "reflect": false,
746
- "default": ""
747
- },
748
- {
749
- "name": "name",
750
- "attribute": "name",
751
- "type": "string",
752
- "converter": "string",
753
- "reflect": false,
754
- "default": ""
755
- },
756
- {
757
- "name": "value",
758
- "attribute": "value",
759
- "type": "string",
760
- "converter": "string",
761
- "reflect": false,
762
- "default": ""
763
- },
764
- {
765
- "name": "disabled",
766
- "attribute": "disabled",
767
- "type": "boolean",
768
- "converter": "boolean",
769
- "reflect": false,
770
- "default": false
771
- },
772
- {
773
- "name": "required",
774
- "attribute": "required",
775
- "type": "boolean",
776
- "converter": "boolean",
777
- "reflect": false,
778
- "default": false
779
- },
780
- {
781
- "name": "error",
782
- "attribute": "error",
783
- "type": "string",
784
- "converter": "string",
785
- "reflect": false,
786
- "default": ""
787
- },
788
- {
789
- "name": "inputId",
790
- "attribute": null,
791
- "type": "string",
792
- "converter": "string",
793
- "reflect": false,
794
- "default": ""
795
- },
796
- {
797
- "name": "noLabel",
798
- "attribute": null,
799
- "type": "boolean",
800
- "converter": "boolean",
801
- "reflect": false,
802
- "default": null,
803
- "computed": true,
804
- "deps": ["label"]
805
- },
806
- {
807
- "name": "noError",
808
- "attribute": null,
809
- "type": "boolean",
810
- "converter": "boolean",
811
- "reflect": false,
812
- "default": null,
813
- "computed": true,
814
- "deps": ["error"]
815
- },
816
- {
817
- "name": "inputClass",
818
- "attribute": null,
819
- "type": "string",
820
- "converter": "string",
821
- "reflect": false,
822
- "default": null,
823
- "computed": true,
824
- "deps": ["error"]
825
- },
826
- {
827
- "name": "idAttr",
828
- "attribute": null,
829
- "type": "string",
830
- "converter": "string",
831
- "reflect": false,
832
- "default": null,
833
- "computed": true,
834
- "deps": ["inputId"]
835
- },
836
- {
837
- "name": "errorIdAttr",
838
- "attribute": null,
839
- "type": "string",
840
- "converter": "string",
841
- "reflect": false,
842
- "default": null,
843
- "computed": true,
844
- "deps": ["inputId"]
845
- },
846
- {
847
- "name": "ariaInvalidAttr",
848
- "attribute": null,
849
- "type": "string",
850
- "converter": "string",
851
- "reflect": false,
852
- "default": null,
853
- "computed": true,
854
- "deps": ["error"]
855
- },
856
- {
857
- "name": "requiredMark",
858
- "attribute": null,
859
- "type": "string",
860
- "converter": "string",
861
- "reflect": false,
862
- "default": null,
863
- "computed": true,
864
- "deps": ["required"]
865
- },
866
- {
867
- "name": "describedByAttr",
868
- "attribute": null,
869
- "type": "string",
870
- "converter": "string",
871
- "reflect": false,
872
- "default": null,
873
- "computed": true,
874
- "deps": ["error", "inputId"]
875
- }
876
- ],
877
- "observedAttributes": [
878
- "type",
879
- "placeholder",
880
- "label",
881
- "name",
882
- "value",
883
- "disabled",
884
- "required",
885
- "error"
886
- ],
887
- "cem": {
888
- "tagName": "open-input",
889
- "className": "OpenInput",
890
- "declaration": {
891
- "name": "OpenInput",
892
- "module": "open-input.tsx"
893
- },
894
- "attributes": [
895
- {
896
- "name": "type",
897
- "fieldName": "type",
898
- "type": "string",
899
- "reflect": false
900
- },
901
- {
902
- "name": "placeholder",
903
- "fieldName": "placeholder",
904
- "type": "string",
905
- "reflect": false
906
- },
907
- {
908
- "name": "label",
909
- "fieldName": "label",
910
- "type": "string",
911
- "reflect": false
912
- },
913
- {
914
- "name": "name",
915
- "fieldName": "name",
916
- "type": "string",
917
- "reflect": false
918
- },
919
- {
920
- "name": "value",
921
- "fieldName": "value",
922
- "type": "string",
923
- "reflect": false
924
- },
925
- {
926
- "name": "disabled",
927
- "fieldName": "disabled",
928
- "type": "boolean",
929
- "reflect": false
930
- },
931
- {
932
- "name": "required",
933
- "fieldName": "required",
934
- "type": "boolean",
935
- "reflect": false
936
- },
937
- {
938
- "name": "error",
939
- "fieldName": "error",
940
- "type": "string",
941
- "reflect": false
87
+ if (event.name === "disabled") syncInputDisabled(host);
88
+ });
89
+ return /* @__PURE__ */ jsxs("div", {
90
+ class: "flex flex-col gap-2",
91
+ part: "wrapper",
92
+ children: [
93
+ /* @__PURE__ */ jsxs("label", {
94
+ class: "text-sm font-medium text-muted-foreground tracking-normal",
95
+ part: "label",
96
+ for: "open-input-control",
97
+ hidden: props.label === "",
98
+ children: [props.label, /* @__PURE__ */ jsx("span", { class: "required-mark" })]
99
+ }),
100
+ /* @__PURE__ */ jsx("input", {
101
+ class: "control w-full px-3 py-2 font-sans text-base text-foreground rounded-md outline-none transition-[border-color,box-shadow] duration-200 ease-out placeholder:text-muted-foreground",
102
+ part: "control",
103
+ id: "open-input-control",
104
+ "data-form-validation": "email",
105
+ type: props.type,
106
+ placeholder: props.placeholder,
107
+ name: props.name,
108
+ disabled: props.disabled,
109
+ required: props.required,
110
+ "aria-invalid": props.error === "" ? null : "true",
111
+ "aria-describedby": props.error === "" ? null : "open-input-error",
112
+ "aria-errormessage": props.error === "" ? null : "open-input-error",
113
+ onInput: (event) => {
114
+ const host = hostOf(event);
115
+ const control = event.target;
116
+ if (lockedByFieldset(event)) {
117
+ syncInputValue(host);
118
+ return;
119
+ }
120
+ host.value = control.value;
121
+ if (host.getAttribute("value") !== control.value) host.setAttribute("value", control.value);
122
+ host.dispatchEvent(new globalThis.CustomEvent("open-input", {
123
+ detail: { value: control.value },
124
+ bubbles: true,
125
+ composed: true
126
+ }));
127
+ },
128
+ onChange: (event) => {
129
+ if (lockedByFieldset(event)) return;
130
+ const control = event.target;
131
+ hostOf(event).dispatchEvent(new globalThis.CustomEvent("open-change", {
132
+ detail: { value: control.value },
133
+ bubbles: true,
134
+ composed: true
135
+ }));
136
+ },
137
+ onFocus: (event) => {
138
+ hostOf(event).dispatchEvent(new globalThis.CustomEvent("open-focus", {
139
+ bubbles: true,
140
+ composed: true
141
+ }));
142
+ },
143
+ onBlur: (event) => {
144
+ hostOf(event).dispatchEvent(new globalThis.CustomEvent("open-blur", {
145
+ bubbles: true,
146
+ composed: true
147
+ }));
942
148
  }
943
- ],
944
- "members": [
945
- {
946
- "name": "type",
947
- "fieldName": "type",
948
- "type": "string",
949
- "attribute": "type",
950
- "reflect": false
951
- },
952
- {
953
- "name": "placeholder",
954
- "fieldName": "placeholder",
955
- "type": "string",
956
- "attribute": "placeholder",
957
- "reflect": false
958
- },
959
- {
960
- "name": "label",
961
- "fieldName": "label",
962
- "type": "string",
963
- "attribute": "label",
964
- "reflect": false
965
- },
966
- {
967
- "name": "name",
968
- "fieldName": "name",
969
- "type": "string",
970
- "attribute": "name",
971
- "reflect": false
972
- },
973
- {
974
- "name": "value",
975
- "fieldName": "value",
976
- "type": "string",
977
- "attribute": "value",
978
- "reflect": false
979
- },
980
- {
981
- "name": "disabled",
982
- "fieldName": "disabled",
983
- "type": "boolean",
984
- "attribute": "disabled",
985
- "reflect": false
986
- },
987
- {
988
- "name": "required",
989
- "fieldName": "required",
990
- "type": "boolean",
991
- "attribute": "required",
992
- "reflect": false
993
- },
994
- {
995
- "name": "error",
996
- "fieldName": "error",
997
- "type": "string",
998
- "attribute": "error",
999
- "reflect": false
1000
- },
1001
- {
1002
- "name": "inputId",
1003
- "fieldName": "inputId",
1004
- "type": "string",
1005
- "attribute": null,
1006
- "reflect": false
1007
- },
1008
- {
1009
- "name": "noLabel",
1010
- "fieldName": "noLabel",
1011
- "type": "boolean",
1012
- "attribute": null,
1013
- "reflect": false
1014
- },
1015
- {
1016
- "name": "noError",
1017
- "fieldName": "noError",
1018
- "type": "boolean",
1019
- "attribute": null,
1020
- "reflect": false
1021
- },
1022
- {
1023
- "name": "inputClass",
1024
- "fieldName": "inputClass",
1025
- "type": "string",
1026
- "attribute": null,
1027
- "reflect": false
1028
- },
1029
- {
1030
- "name": "idAttr",
1031
- "fieldName": "idAttr",
1032
- "type": "string",
1033
- "attribute": null,
1034
- "reflect": false
1035
- },
1036
- {
1037
- "name": "errorIdAttr",
1038
- "fieldName": "errorIdAttr",
1039
- "type": "string",
1040
- "attribute": null,
1041
- "reflect": false
1042
- },
1043
- {
1044
- "name": "ariaInvalidAttr",
1045
- "fieldName": "ariaInvalidAttr",
1046
- "type": "string",
1047
- "attribute": null,
1048
- "reflect": false
1049
- },
1050
- {
1051
- "name": "requiredMark",
1052
- "fieldName": "requiredMark",
1053
- "type": "string",
1054
- "attribute": null,
1055
- "reflect": false
1056
- },
1057
- {
1058
- "name": "describedByAttr",
1059
- "fieldName": "describedByAttr",
1060
- "type": "string",
1061
- "attribute": null,
1062
- "reflect": false
1063
- }
1064
- ]
1065
- }
1066
- }
1067
- };
1068
- const __compiledProperties = [
1069
- {
1070
- "name": "type",
1071
- "attribute": "type",
1072
- "type": "string",
1073
- "converter": "string",
1074
- "reflect": false,
1075
- "default": "text"
1076
- },
1077
- {
1078
- "name": "placeholder",
1079
- "attribute": "placeholder",
1080
- "type": "string",
1081
- "converter": "string",
1082
- "reflect": false,
1083
- "default": ""
1084
- },
1085
- {
1086
- "name": "label",
1087
- "attribute": "label",
1088
- "type": "string",
1089
- "converter": "string",
1090
- "reflect": false,
1091
- "default": ""
1092
- },
1093
- {
1094
- "name": "name",
1095
- "attribute": "name",
1096
- "type": "string",
1097
- "converter": "string",
1098
- "reflect": false,
1099
- "default": ""
1100
- },
1101
- {
1102
- "name": "value",
1103
- "attribute": "value",
1104
- "type": "string",
1105
- "converter": "string",
1106
- "reflect": false,
1107
- "default": ""
1108
- },
1109
- {
1110
- "name": "disabled",
1111
- "attribute": "disabled",
1112
- "type": "boolean",
1113
- "converter": "boolean",
1114
- "reflect": false,
1115
- "default": false
1116
- },
1117
- {
1118
- "name": "required",
1119
- "attribute": "required",
1120
- "type": "boolean",
1121
- "converter": "boolean",
1122
- "reflect": false,
1123
- "default": false
1124
- },
1125
- {
1126
- "name": "error",
1127
- "attribute": "error",
1128
- "type": "string",
1129
- "converter": "string",
1130
- "reflect": false,
1131
- "default": ""
1132
- },
1133
- {
1134
- "name": "inputId",
1135
- "attribute": null,
1136
- "type": "string",
1137
- "converter": "string",
1138
- "reflect": false,
1139
- "default": ""
1140
- },
1141
- {
1142
- "name": "noLabel",
1143
- "attribute": null,
1144
- "type": "boolean",
1145
- "converter": "boolean",
1146
- "reflect": false,
1147
- "default": null,
1148
- "computed": true,
1149
- "deps": ["label"]
1150
- },
1151
- {
1152
- "name": "noError",
1153
- "attribute": null,
1154
- "type": "boolean",
1155
- "converter": "boolean",
1156
- "reflect": false,
1157
- "default": null,
1158
- "computed": true,
1159
- "deps": ["error"]
1160
- },
1161
- {
1162
- "name": "inputClass",
1163
- "attribute": null,
1164
- "type": "string",
1165
- "converter": "string",
1166
- "reflect": false,
1167
- "default": null,
1168
- "computed": true,
1169
- "deps": ["error"]
1170
- },
1171
- {
1172
- "name": "idAttr",
1173
- "attribute": null,
1174
- "type": "string",
1175
- "converter": "string",
1176
- "reflect": false,
1177
- "default": null,
1178
- "computed": true,
1179
- "deps": ["inputId"]
1180
- },
1181
- {
1182
- "name": "errorIdAttr",
1183
- "attribute": null,
1184
- "type": "string",
1185
- "converter": "string",
1186
- "reflect": false,
1187
- "default": null,
1188
- "computed": true,
1189
- "deps": ["inputId"]
1190
- },
1191
- {
1192
- "name": "ariaInvalidAttr",
1193
- "attribute": null,
1194
- "type": "string",
1195
- "converter": "string",
1196
- "reflect": false,
1197
- "default": null,
1198
- "computed": true,
1199
- "deps": ["error"]
1200
- },
1201
- {
1202
- "name": "requiredMark",
1203
- "attribute": null,
1204
- "type": "string",
1205
- "converter": "string",
1206
- "reflect": false,
1207
- "default": null,
1208
- "computed": true,
1209
- "deps": ["required"]
1210
- },
1211
- {
1212
- "name": "describedByAttr",
1213
- "attribute": null,
1214
- "type": "string",
1215
- "converter": "string",
1216
- "reflect": false,
1217
- "default": null,
1218
- "computed": true,
1219
- "deps": ["error", "inputId"]
1220
- }
1221
- ];
1222
- const __elementMetadata = {
1223
- "tag": "open-input",
1224
- "className": "OpenInput",
1225
- "sourceFile": "open-input.tsx",
1226
- "properties": [
1227
- {
1228
- "name": "type",
1229
- "attribute": "type",
1230
- "type": "string",
1231
- "converter": "string",
1232
- "reflect": false,
1233
- "default": "text"
1234
- },
1235
- {
1236
- "name": "placeholder",
1237
- "attribute": "placeholder",
1238
- "type": "string",
1239
- "converter": "string",
1240
- "reflect": false,
1241
- "default": ""
1242
- },
1243
- {
1244
- "name": "label",
1245
- "attribute": "label",
1246
- "type": "string",
1247
- "converter": "string",
1248
- "reflect": false,
1249
- "default": ""
1250
- },
1251
- {
1252
- "name": "name",
1253
- "attribute": "name",
1254
- "type": "string",
1255
- "converter": "string",
1256
- "reflect": false,
1257
- "default": ""
1258
- },
1259
- {
1260
- "name": "value",
1261
- "attribute": "value",
1262
- "type": "string",
1263
- "converter": "string",
1264
- "reflect": false,
1265
- "default": ""
1266
- },
1267
- {
1268
- "name": "disabled",
1269
- "attribute": "disabled",
1270
- "type": "boolean",
1271
- "converter": "boolean",
1272
- "reflect": false,
1273
- "default": false
1274
- },
1275
- {
1276
- "name": "required",
1277
- "attribute": "required",
1278
- "type": "boolean",
1279
- "converter": "boolean",
1280
- "reflect": false,
1281
- "default": false
1282
- },
1283
- {
1284
- "name": "error",
1285
- "attribute": "error",
1286
- "type": "string",
1287
- "converter": "string",
1288
- "reflect": false,
1289
- "default": ""
1290
- },
1291
- {
1292
- "name": "inputId",
1293
- "attribute": null,
1294
- "type": "string",
1295
- "converter": "string",
1296
- "reflect": false,
1297
- "default": ""
1298
- },
1299
- {
1300
- "name": "noLabel",
1301
- "attribute": null,
1302
- "type": "boolean",
1303
- "converter": "boolean",
1304
- "reflect": false,
1305
- "default": null,
1306
- "computed": true,
1307
- "deps": ["label"]
1308
- },
1309
- {
1310
- "name": "noError",
1311
- "attribute": null,
1312
- "type": "boolean",
1313
- "converter": "boolean",
1314
- "reflect": false,
1315
- "default": null,
1316
- "computed": true,
1317
- "deps": ["error"]
1318
- },
1319
- {
1320
- "name": "inputClass",
1321
- "attribute": null,
1322
- "type": "string",
1323
- "converter": "string",
1324
- "reflect": false,
1325
- "default": null,
1326
- "computed": true,
1327
- "deps": ["error"]
1328
- },
1329
- {
1330
- "name": "idAttr",
1331
- "attribute": null,
1332
- "type": "string",
1333
- "converter": "string",
1334
- "reflect": false,
1335
- "default": null,
1336
- "computed": true,
1337
- "deps": ["inputId"]
1338
- },
1339
- {
1340
- "name": "errorIdAttr",
1341
- "attribute": null,
1342
- "type": "string",
1343
- "converter": "string",
1344
- "reflect": false,
1345
- "default": null,
1346
- "computed": true,
1347
- "deps": ["inputId"]
1348
- },
1349
- {
1350
- "name": "ariaInvalidAttr",
1351
- "attribute": null,
1352
- "type": "string",
1353
- "converter": "string",
1354
- "reflect": false,
1355
- "default": null,
1356
- "computed": true,
1357
- "deps": ["error"]
1358
- },
1359
- {
1360
- "name": "requiredMark",
1361
- "attribute": null,
1362
- "type": "string",
1363
- "converter": "string",
1364
- "reflect": false,
1365
- "default": null,
1366
- "computed": true,
1367
- "deps": ["required"]
1368
- },
1369
- {
1370
- "name": "describedByAttr",
1371
- "attribute": null,
1372
- "type": "string",
1373
- "converter": "string",
1374
- "reflect": false,
1375
- "default": null,
1376
- "computed": true,
1377
- "deps": ["error", "inputId"]
1378
- }
1379
- ],
1380
- "observedAttributes": [
1381
- "type",
1382
- "placeholder",
1383
- "label",
1384
- "name",
1385
- "value",
1386
- "disabled",
1387
- "required",
1388
- "error"
1389
- ],
1390
- "cem": {
1391
- "tagName": "open-input",
1392
- "className": "OpenInput",
1393
- "declaration": {
1394
- "name": "OpenInput",
1395
- "module": "open-input.tsx"
1396
- },
1397
- "attributes": [
1398
- {
1399
- "name": "type",
1400
- "fieldName": "type",
1401
- "type": "string",
1402
- "reflect": false
1403
- },
1404
- {
1405
- "name": "placeholder",
1406
- "fieldName": "placeholder",
1407
- "type": "string",
1408
- "reflect": false
1409
- },
1410
- {
1411
- "name": "label",
1412
- "fieldName": "label",
1413
- "type": "string",
1414
- "reflect": false
1415
- },
1416
- {
1417
- "name": "name",
1418
- "fieldName": "name",
1419
- "type": "string",
1420
- "reflect": false
1421
- },
1422
- {
1423
- "name": "value",
1424
- "fieldName": "value",
1425
- "type": "string",
1426
- "reflect": false
1427
- },
1428
- {
1429
- "name": "disabled",
1430
- "fieldName": "disabled",
1431
- "type": "boolean",
1432
- "reflect": false
1433
- },
1434
- {
1435
- "name": "required",
1436
- "fieldName": "required",
1437
- "type": "boolean",
1438
- "reflect": false
1439
- },
1440
- {
1441
- "name": "error",
1442
- "fieldName": "error",
1443
- "type": "string",
1444
- "reflect": false
1445
- }
1446
- ],
1447
- "members": [
1448
- {
1449
- "name": "type",
1450
- "fieldName": "type",
1451
- "type": "string",
1452
- "attribute": "type",
1453
- "reflect": false
1454
- },
1455
- {
1456
- "name": "placeholder",
1457
- "fieldName": "placeholder",
1458
- "type": "string",
1459
- "attribute": "placeholder",
1460
- "reflect": false
1461
- },
1462
- {
1463
- "name": "label",
1464
- "fieldName": "label",
1465
- "type": "string",
1466
- "attribute": "label",
1467
- "reflect": false
1468
- },
1469
- {
1470
- "name": "name",
1471
- "fieldName": "name",
1472
- "type": "string",
1473
- "attribute": "name",
1474
- "reflect": false
1475
- },
1476
- {
1477
- "name": "value",
1478
- "fieldName": "value",
1479
- "type": "string",
1480
- "attribute": "value",
1481
- "reflect": false
1482
- },
1483
- {
1484
- "name": "disabled",
1485
- "fieldName": "disabled",
1486
- "type": "boolean",
1487
- "attribute": "disabled",
1488
- "reflect": false
1489
- },
1490
- {
1491
- "name": "required",
1492
- "fieldName": "required",
1493
- "type": "boolean",
1494
- "attribute": "required",
1495
- "reflect": false
1496
- },
1497
- {
1498
- "name": "error",
1499
- "fieldName": "error",
1500
- "type": "string",
1501
- "attribute": "error",
1502
- "reflect": false
1503
- },
1504
- {
1505
- "name": "inputId",
1506
- "fieldName": "inputId",
1507
- "type": "string",
1508
- "attribute": null,
1509
- "reflect": false
1510
- },
1511
- {
1512
- "name": "noLabel",
1513
- "fieldName": "noLabel",
1514
- "type": "boolean",
1515
- "attribute": null,
1516
- "reflect": false
1517
- },
1518
- {
1519
- "name": "noError",
1520
- "fieldName": "noError",
1521
- "type": "boolean",
1522
- "attribute": null,
1523
- "reflect": false
1524
- },
1525
- {
1526
- "name": "inputClass",
1527
- "fieldName": "inputClass",
1528
- "type": "string",
1529
- "attribute": null,
1530
- "reflect": false
1531
- },
1532
- {
1533
- "name": "idAttr",
1534
- "fieldName": "idAttr",
1535
- "type": "string",
1536
- "attribute": null,
1537
- "reflect": false
1538
- },
1539
- {
1540
- "name": "errorIdAttr",
1541
- "fieldName": "errorIdAttr",
1542
- "type": "string",
1543
- "attribute": null,
1544
- "reflect": false
1545
- },
1546
- {
1547
- "name": "ariaInvalidAttr",
1548
- "fieldName": "ariaInvalidAttr",
1549
- "type": "string",
1550
- "attribute": null,
1551
- "reflect": false
1552
- },
1553
- {
1554
- "name": "requiredMark",
1555
- "fieldName": "requiredMark",
1556
- "type": "string",
1557
- "attribute": null,
1558
- "reflect": false
1559
- },
1560
- {
1561
- "name": "describedByAttr",
1562
- "fieldName": "describedByAttr",
1563
- "type": "string",
1564
- "attribute": null,
1565
- "reflect": false
1566
- }
149
+ }),
150
+ /* @__PURE__ */ jsx("small", {
151
+ id: "open-input-error",
152
+ role: "alert",
153
+ class: "text-xs text-destructive",
154
+ part: "error",
155
+ hidden: props.error === "",
156
+ children: props.error
157
+ })
1567
158
  ]
1568
- }
1569
- };
1570
- const __observedAttributes = [
1571
- "type",
1572
- "placeholder",
1573
- "label",
1574
- "name",
1575
- "value",
1576
- "disabled",
1577
- "required",
1578
- "error"
1579
- ];
1580
- const __compiledProps = {
1581
- type: {
1582
- type: String,
1583
- default: "text",
1584
- reflect: false,
1585
- attribute: "type"
1586
- },
1587
- placeholder: {
1588
- type: String,
1589
- default: "",
1590
- reflect: false,
1591
- attribute: "placeholder"
1592
- },
1593
- label: {
1594
- type: String,
1595
- default: "",
1596
- reflect: false,
1597
- attribute: "label"
1598
- },
1599
- name: {
1600
- type: String,
1601
- default: "",
1602
- reflect: false,
1603
- attribute: "name"
1604
- },
1605
- value: {
1606
- type: String,
1607
- default: "",
1608
- reflect: false,
1609
- attribute: "value"
1610
- },
1611
- disabled: {
1612
- type: Boolean,
1613
- default: false,
1614
- reflect: false,
1615
- attribute: "disabled"
1616
- },
1617
- required: {
1618
- type: Boolean,
1619
- default: false,
1620
- reflect: false,
1621
- attribute: "required"
1622
- },
1623
- error: {
1624
- type: String,
1625
- default: "",
1626
- reflect: false,
1627
- attribute: "error"
1628
- },
1629
- inputId: {
1630
- type: String,
1631
- default: "",
1632
- reflect: false,
1633
- attribute: false
1634
- },
1635
- noLabel: {
1636
- type: Object,
1637
- default: void 0,
1638
- reflect: false,
1639
- attribute: false
1640
- },
1641
- noError: {
1642
- type: Object,
1643
- default: void 0,
1644
- reflect: false,
1645
- attribute: false
1646
- },
1647
- inputClass: {
1648
- type: Object,
1649
- default: void 0,
1650
- reflect: false,
1651
- attribute: false
1652
- },
1653
- idAttr: {
1654
- type: Object,
1655
- default: void 0,
1656
- reflect: false,
1657
- attribute: false
1658
- },
1659
- errorIdAttr: {
1660
- type: Object,
1661
- default: void 0,
1662
- reflect: false,
1663
- attribute: false
1664
- },
1665
- ariaInvalidAttr: {
1666
- type: Object,
1667
- default: void 0,
1668
- reflect: false,
1669
- attribute: false
1670
- },
1671
- requiredMark: {
1672
- type: Object,
1673
- default: void 0,
1674
- reflect: false,
1675
- attribute: false
1676
- },
1677
- describedByAttr: {
1678
- type: Object,
1679
- default: void 0,
1680
- reflect: false,
1681
- attribute: false
1682
- }
1683
- };
1684
- var OpenInput = class extends OpenElement {
1685
- static __partProgram = __partProgram;
1686
- static __compiledProperties = __compiledProperties;
1687
- static __elementMetadata = __elementMetadata;
1688
- static props = __compiledProps;
1689
- static observedAttributes = __observedAttributes;
1690
- static delegatesFocus = true;
1691
- static formAssociated = true;
1692
- static __computedFields = {
1693
- noLabel: (__s) => computed(() => __s.label.value === ""),
1694
- noError: (__s) => computed(() => __s.error.value === ""),
1695
- inputClass: (__s) => computed(() => __s.error.value === "" ? "control input" : "control input input--error"),
1696
- idAttr: (__s) => computed(() => __s.inputId.value === "" ? null : __s.inputId.value),
1697
- errorIdAttr: (__s) => computed(() => __s.inputId.value === "" ? null : `${__s.inputId.value}-error`),
1698
- ariaInvalidAttr: (__s) => computed(() => __s.error.value === "" ? null : "true"),
1699
- requiredMark: (__s) => computed(() => __s.required.value ? " *" : ""),
1700
- describedByAttr: (__s) => computed(() => __s.error.value === "" || __s.inputId.value === "" ? null : `${__s.inputId.value}-error`)
1701
- };
1702
- static styles = [controlRecipe, openInputStyles];
1703
- type = "text";
1704
- placeholder = "";
1705
- label = "";
1706
- name = "";
1707
- value = "";
1708
- disabled = false;
1709
- required = false;
1710
- error = "";
1711
- inputId = "";
1712
- onDsdHydrated() {
1713
- this.activate();
1714
- }
1715
- onCsrRendered() {
1716
- this.activate();
1717
- }
1718
- activate() {
1719
- if (this.inputId === "") this.inputId = `input-${nextInstanceId()}`;
1720
- this.syncFormValue();
1721
- this.syncValidity();
1722
- this.updateStates();
1723
- }
1724
- attributeChangedCallback(name, old, val) {
1725
- try {
1726
- super.attributeChangedCallback(name, old, val);
1727
- if (old === val) return;
1728
- if (name === "value") {
1729
- this.syncFormValue();
1730
- this.syncValidity();
1731
- return;
1732
- }
1733
- if (name === "disabled" || name === "error") this.updateStates();
1734
- if (name === "required") this.syncValidity();
1735
- } catch (error) {
1736
- if (!this._captureError(error)) throw error;
1737
- }
1738
- }
1739
- updateStates() {
1740
- if (!this._internals?.states) return;
1741
- syncDisabledState(this._internals, this.disabled);
1742
- if (this.error !== "") this._internals.states.add("invalid");
1743
- else this._internals.states.delete("invalid");
1744
- }
1745
- syncFormValue() {
1746
- this._internals?.setFormValue(this.value);
1747
- }
1748
- syncValidity() {
1749
- const internals = this._internals;
1750
- if (!internals || typeof internals.setValidity !== "function") return;
1751
- if (this.required && this.value === "") {
1752
- const inner = this.shadowRoot?.querySelector("input");
1753
- internals.setValidity({ valueMissing: true }, inner?.validationMessage || "Please fill out this field.");
1754
- } else internals.setValidity({});
1755
- }
1756
- handleInput(e) {
1757
- const input = e.target;
1758
- this.setAttribute("value", input.value);
1759
- this.syncFormValue();
1760
- this.syncValidity();
1761
- this.dispatchEvent(new CustomEvent("open-input", {
1762
- detail: { value: input.value },
1763
- bubbles: true,
1764
- composed: true
1765
- }));
1766
- }
1767
- handleChange(e) {
1768
- const input = e.target;
1769
- this.dispatchEvent(new CustomEvent("open-change", {
1770
- detail: { value: input.value },
1771
- bubbles: true,
1772
- composed: true
1773
- }));
1774
- }
1775
- handleFocus() {
1776
- this.dispatchEvent(new CustomEvent("open-focus", {
1777
- bubbles: true,
1778
- composed: true
1779
- }));
1780
- }
1781
- handleBlur() {
1782
- this.dispatchEvent(new CustomEvent("open-blur", {
1783
- bubbles: true,
1784
- composed: true
1785
- }));
1786
- }
1787
- formResetCallback() {
1788
- try {
1789
- super.formResetCallback();
1790
- this.setAttribute("value", "");
1791
- this.removeAttribute("error");
1792
- this.syncFormValue();
1793
- this.syncValidity();
1794
- } catch (error) {
1795
- if (!this._captureError(error)) throw error;
1796
- }
1797
- }
1798
- formDisabledCallback(disabled) {
1799
- this.disabled = disabled;
1800
- this.updateStates();
1801
- }
1802
- render() {
1803
- throw new Error("[open:compiled-element] open-input is compiled to a Part Program; the runtime JSX render path is not available.");
1804
- }
1805
- };
159
+ });
160
+ }
1806
161
  //#endregion
1807
- export { OpenInput, __elementMetadata, __partProgram };
162
+ export { OpenInput as default, openElement };
163
+
164
+ export { OpenInputElement, OpenInput__ssrHost } from './open-input.generated.js';
165
+
166
+ // openElement:class-candidates ["control","duration-200","ease-out","flex","flex-col","font-medium","font-sans","gap-2","outline-none","placeholder:text-muted-foreground","px-3","py-2","required-mark","rounded-md","text-base","text-destructive","text-foreground","text-muted-foreground","text-sm","text-xs","tracking-normal","transition-[border-color,box-shadow]","w-full"]