@petrarca/sonnet-playground 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +142 -0
  2. package/dist/PlayAdvancedComponents-ZYK66UII.js +8 -0
  3. package/dist/PlayColorPalette-IWECRZUS.js +8 -0
  4. package/dist/PlayCoreComponents-GXFMB24T.js +8 -0
  5. package/dist/PlayDataComponents-M4SJ4XEL.js +8 -0
  6. package/dist/PlayFormComponents-4E2A2Y2W.js +8 -0
  7. package/dist/PlayFormWidgets-IWJJQ5XL.js +8 -0
  8. package/dist/PlayForms-FOF3XE6G.js +7 -0
  9. package/dist/PlayGraph-3F56PREG.js +7 -0
  10. package/dist/PlayJsonEditor-SYZYEJEA.js +7 -0
  11. package/dist/PlayShellApi-5O6VYR2X.js +8 -0
  12. package/dist/PlayShellApi-5O6VYR2X.js.map +1 -0
  13. package/dist/PlayTypography-T6SMPHUB.js +8 -0
  14. package/dist/PlayTypography-T6SMPHUB.js.map +1 -0
  15. package/dist/chunk-32DDRRWU.js +617 -0
  16. package/dist/chunk-32DDRRWU.js.map +1 -0
  17. package/dist/chunk-4Y4JFKAK.js +240 -0
  18. package/dist/chunk-4Y4JFKAK.js.map +1 -0
  19. package/dist/{chunk-QIETZUEN.js → chunk-6DZ3TSV4.js} +66 -71
  20. package/dist/chunk-6DZ3TSV4.js.map +1 -0
  21. package/dist/{chunk-CYNK2P2Q.js → chunk-7IBZEHLI.js} +14 -13
  22. package/dist/chunk-7IBZEHLI.js.map +1 -0
  23. package/dist/chunk-C2EZ2ECG.js +40 -0
  24. package/dist/chunk-C2EZ2ECG.js.map +1 -0
  25. package/dist/chunk-CQ6PGFRV.js +341 -0
  26. package/dist/chunk-CQ6PGFRV.js.map +1 -0
  27. package/dist/{chunk-A3IK3CVW.js → chunk-DA3BIB5N.js} +24 -25
  28. package/dist/{chunk-A3IK3CVW.js.map → chunk-DA3BIB5N.js.map} +1 -1
  29. package/dist/chunk-DZB6WFHA.js +401 -0
  30. package/dist/chunk-DZB6WFHA.js.map +1 -0
  31. package/dist/{chunk-KAT24CQQ.js → chunk-FZ3ZC7VM.js} +8 -6
  32. package/dist/chunk-FZ3ZC7VM.js.map +1 -0
  33. package/dist/{chunk-PGI54O43.js → chunk-VOC5VZG2.js} +84 -46
  34. package/dist/chunk-VOC5VZG2.js.map +1 -0
  35. package/dist/{chunk-TZGJH7YS.js → chunk-YEBK2TUW.js} +325 -331
  36. package/dist/chunk-YEBK2TUW.js.map +1 -0
  37. package/dist/chunk-YOOWJORD.js +934 -0
  38. package/dist/chunk-YOOWJORD.js.map +1 -0
  39. package/dist/index.d.ts +10 -6
  40. package/dist/index.js +41 -17
  41. package/dist/index.js.map +1 -1
  42. package/dist/pages/index.d.ts +15 -11
  43. package/dist/pages/index.js +20 -12
  44. package/package.json +6 -6
  45. package/dist/PlayColorPalette-UFMTJTUB.js +0 -8
  46. package/dist/PlayCoreComponents-7QCDFQLT.js +0 -7
  47. package/dist/PlayDataComponents-GZSRTW4F.js +0 -7
  48. package/dist/PlayFormComponents-RJB6WZHD.js +0 -7
  49. package/dist/PlayFormWidgets-OFV7TJKH.js +0 -7
  50. package/dist/PlayForms-24XX5DC6.js +0 -7
  51. package/dist/PlayGraph-FLGLSUWV.js +0 -8
  52. package/dist/PlayJsonEditor-4L5INQPU.js +0 -7
  53. package/dist/PlayTypography-ID6DLFZD.js +0 -8
  54. package/dist/chunk-5V27QDAY.js +0 -617
  55. package/dist/chunk-5V27QDAY.js.map +0 -1
  56. package/dist/chunk-CYNK2P2Q.js.map +0 -1
  57. package/dist/chunk-FTN2A5YL.js +0 -20
  58. package/dist/chunk-FTN2A5YL.js.map +0 -1
  59. package/dist/chunk-GYKEPHHA.js +0 -1154
  60. package/dist/chunk-GYKEPHHA.js.map +0 -1
  61. package/dist/chunk-KAT24CQQ.js.map +0 -1
  62. package/dist/chunk-P7I5IDXA.js +0 -432
  63. package/dist/chunk-P7I5IDXA.js.map +0 -1
  64. package/dist/chunk-PGI54O43.js.map +0 -1
  65. package/dist/chunk-QIETZUEN.js.map +0 -1
  66. package/dist/chunk-TZGJH7YS.js.map +0 -1
  67. /package/dist/{PlayColorPalette-UFMTJTUB.js.map → PlayAdvancedComponents-ZYK66UII.js.map} +0 -0
  68. /package/dist/{PlayCoreComponents-7QCDFQLT.js.map → PlayColorPalette-IWECRZUS.js.map} +0 -0
  69. /package/dist/{PlayDataComponents-GZSRTW4F.js.map → PlayCoreComponents-GXFMB24T.js.map} +0 -0
  70. /package/dist/{PlayFormComponents-RJB6WZHD.js.map → PlayDataComponents-M4SJ4XEL.js.map} +0 -0
  71. /package/dist/{PlayFormWidgets-OFV7TJKH.js.map → PlayFormComponents-4E2A2Y2W.js.map} +0 -0
  72. /package/dist/{PlayForms-24XX5DC6.js.map → PlayFormWidgets-IWJJQ5XL.js.map} +0 -0
  73. /package/dist/{PlayGraph-FLGLSUWV.js.map → PlayForms-FOF3XE6G.js.map} +0 -0
  74. /package/dist/{PlayJsonEditor-4L5INQPU.js.map → PlayGraph-3F56PREG.js.map} +0 -0
  75. /package/dist/{PlayTypography-ID6DLFZD.js.map → PlayJsonEditor-SYZYEJEA.js.map} +0 -0
@@ -0,0 +1,617 @@
1
+ import {
2
+ ExampleBlock
3
+ } from "./chunk-C2EZ2ECG.js";
4
+
5
+ // src/pages/PlayFormComponents.tsx
6
+ import { useState, useCallback, useRef } from "react";
7
+ import { SimpleStack, Card } from "@petrarca/sonnet-ui";
8
+ import {
9
+ FormInput,
10
+ FormTextarea,
11
+ FormNumberInput,
12
+ FormCheckbox,
13
+ FormSelect,
14
+ FormMultiSelect,
15
+ FormTagsInput
16
+ } from "@petrarca/sonnet-forms";
17
+ import { jsx, jsxs } from "react/jsx-runtime";
18
+ function PlayFormComponents() {
19
+ const [textValue, setTextValue] = useState("");
20
+ const [emailValue, setEmailValue] = useState("");
21
+ const [emailError, setEmailError] = useState("");
22
+ const [passwordValue, setPasswordValue] = useState("");
23
+ const validateEmail = useCallback((value) => {
24
+ if (!value) {
25
+ setEmailError("");
26
+ return;
27
+ }
28
+ const valid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
29
+ setEmailError(valid ? "" : "Invalid email address");
30
+ }, []);
31
+ const [textareaValue, setTextareaValue] = useState("");
32
+ const [textareaError, setTextareaError] = useState("");
33
+ const [numberValue, setNumberValue] = useState(void 0);
34
+ const [rangeValue, setRangeValue] = useState(5);
35
+ const [decimalValue, setDecimalValue] = useState(
36
+ void 0
37
+ );
38
+ const [rangeValidated, setRangeValidated] = useState(
39
+ void 0
40
+ );
41
+ const [rangeError, setRangeError] = useState("");
42
+ const rangeValidatedRef = useRef(void 0);
43
+ const validateRange = useCallback((value) => {
44
+ if (value === void 0) {
45
+ setRangeError("");
46
+ return;
47
+ }
48
+ if (value < 1 || value > 10) setRangeError("Must be between 1 and 10");
49
+ else setRangeError("");
50
+ }, []);
51
+ const [checkboxValue, setCheckboxValue] = useState(false);
52
+ const [checkboxIndeterminate, setCheckboxIndeterminate] = useState("indeterminate");
53
+ const [selectValue, setSelectValue] = useState("");
54
+ const [selectRequired, setSelectRequired] = useState("");
55
+ const [multiSelectValue, setMultiSelectValue] = useState([]);
56
+ const [tagsValue, setTagsValue] = useState(["react", "typescript"]);
57
+ const colorOptions = [
58
+ { label: "Red", value: "red" },
59
+ { label: "Green", value: "green" },
60
+ { label: "Blue", value: "blue" },
61
+ { label: "Yellow", value: "yellow" },
62
+ { label: "Purple", value: "purple" }
63
+ ];
64
+ const countryOptions = [
65
+ { label: "United States", value: "us" },
66
+ { label: "Canada", value: "ca" },
67
+ { label: "United Kingdom", value: "uk" },
68
+ { label: "Germany", value: "de" },
69
+ { label: "France", value: "fr" },
70
+ { label: "Japan", value: "jp" },
71
+ { label: "Australia", value: "au" }
72
+ ];
73
+ return /* @__PURE__ */ jsxs("div", { className: "w-full max-w-4xl space-y-6", children: [
74
+ /* @__PURE__ */ jsxs("div", { children: [
75
+ /* @__PURE__ */ jsx("h1", { children: "Form Components Playground" }),
76
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-3", children: "Test all custom Form wrapper components with labels, descriptions, and error states" })
77
+ ] }),
78
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(SimpleStack, { gap: "md", style: { maxWidth: "900px" }, children: [
79
+ /* @__PURE__ */ jsx(Card, { className: "border shadow-sm p-4", children: /* @__PURE__ */ jsxs(SimpleStack, { gap: "sm", children: [
80
+ /* @__PURE__ */ jsx("h2", { children: "FormInput" }),
81
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Text input wrapper with label, description, and error support. Supports all HTML input types." }),
82
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 pt-2", children: [
83
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Basic", children: /* @__PURE__ */ jsx(
84
+ FormInput,
85
+ {
86
+ label: "Username",
87
+ value: textValue,
88
+ onChange: (e) => setTextValue(e.target.value),
89
+ placeholder: "Enter username"
90
+ }
91
+ ) }),
92
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "With description", children: /* @__PURE__ */ jsx(
93
+ FormInput,
94
+ {
95
+ label: "Full Name",
96
+ description: "Your first and last name",
97
+ value: textValue,
98
+ onChange: (e) => setTextValue(e.target.value),
99
+ placeholder: "John Doe"
100
+ }
101
+ ) }),
102
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Required", children: /* @__PURE__ */ jsx(
103
+ FormInput,
104
+ {
105
+ label: "Email",
106
+ required: true,
107
+ value: emailValue,
108
+ onChange: (e) => setEmailValue(e.target.value),
109
+ placeholder: "john@example.com"
110
+ }
111
+ ) }),
112
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "WITH ERROR (STATIC)", children: /* @__PURE__ */ jsx(
113
+ FormInput,
114
+ {
115
+ label: "Email",
116
+ value: emailValue,
117
+ onChange: (e) => setEmailValue(e.target.value),
118
+ error: "Invalid email format",
119
+ placeholder: "john@example.com"
120
+ }
121
+ ) }),
122
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Email (on-blur validation)", children: /* @__PURE__ */ jsx(
123
+ FormInput,
124
+ {
125
+ label: "Email",
126
+ type: "email",
127
+ value: emailValue,
128
+ onChange: (e) => {
129
+ setEmailValue(e.target.value);
130
+ if (emailError) validateEmail(e.target.value);
131
+ },
132
+ onBlur: (e) => validateEmail(e.target.value),
133
+ error: emailError,
134
+ placeholder: "user@example.com"
135
+ }
136
+ ) }),
137
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Password", children: /* @__PURE__ */ jsx(
138
+ FormInput,
139
+ {
140
+ label: "Password",
141
+ type: "password",
142
+ value: passwordValue,
143
+ onChange: (e) => setPasswordValue(e.target.value),
144
+ placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"
145
+ }
146
+ ) }),
147
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Disabled", children: /* @__PURE__ */ jsx(
148
+ FormInput,
149
+ {
150
+ label: "Readonly Field",
151
+ value: "Cannot edit this",
152
+ onChange: () => {
153
+ },
154
+ disabled: true
155
+ }
156
+ ) })
157
+ ] }),
158
+ /* @__PURE__ */ jsx("pre", { className: "text-xs bg-muted p-2 rounded overflow-x-auto", children: /* @__PURE__ */ jsx("code", { children: `<FormInput
159
+ label="Username"
160
+ value={textValue}
161
+ onChange={(e) => setTextValue(e.target.value)}
162
+ placeholder="Enter username"
163
+ description="Optional description"
164
+ error="Optional error message"
165
+ required={false}
166
+ disabled={false}
167
+ />` }) }),
168
+ /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
169
+ "Current value: ",
170
+ textValue || "(empty)"
171
+ ] })
172
+ ] }) }),
173
+ /* @__PURE__ */ jsx(Card, { className: "border shadow-sm p-4", children: /* @__PURE__ */ jsxs(SimpleStack, { gap: "sm", children: [
174
+ /* @__PURE__ */ jsx("h2", { children: "FormTextarea" }),
175
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Multi-line text input with label, description, and error support." }),
176
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 pt-2", children: [
177
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Basic", children: /* @__PURE__ */ jsx(
178
+ FormTextarea,
179
+ {
180
+ label: "Description",
181
+ value: textareaValue,
182
+ onChange: (e) => setTextareaValue(e.target.value),
183
+ placeholder: "Enter a detailed description...",
184
+ rows: 4
185
+ }
186
+ ) }),
187
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "With description", children: /* @__PURE__ */ jsx(
188
+ FormTextarea,
189
+ {
190
+ label: "Bio",
191
+ description: "Tell us about yourself (max 500 characters)",
192
+ value: textareaValue,
193
+ onChange: (e) => setTextareaValue(e.target.value),
194
+ placeholder: "I am a...",
195
+ rows: 3
196
+ }
197
+ ) }),
198
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "With error validation", children: /* @__PURE__ */ jsx(
199
+ FormTextarea,
200
+ {
201
+ label: "Comments",
202
+ value: textareaValue,
203
+ onChange: (e) => {
204
+ setTextareaValue(e.target.value);
205
+ setTextareaError(
206
+ e.target.value.length > 100 ? "Maximum 100 characters allowed" : ""
207
+ );
208
+ },
209
+ error: textareaError,
210
+ placeholder: "Enter your comments...",
211
+ rows: 3
212
+ }
213
+ ) }),
214
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Disabled", children: /* @__PURE__ */ jsx(
215
+ FormTextarea,
216
+ {
217
+ label: "Readonly Text",
218
+ value: "This cannot be edited",
219
+ onChange: () => {
220
+ },
221
+ disabled: true,
222
+ rows: 2
223
+ }
224
+ ) })
225
+ ] }),
226
+ /* @__PURE__ */ jsx("pre", { className: "text-xs bg-muted p-2 rounded overflow-x-auto", children: /* @__PURE__ */ jsx("code", { children: `<FormTextarea
227
+ label="Description"
228
+ value={textareaValue}
229
+ onChange={(e) => setTextareaValue(e.target.value)}
230
+ placeholder="Enter text..."
231
+ rows={4}
232
+ description="Optional description"
233
+ error="Optional error message"
234
+ />` }) }),
235
+ /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
236
+ "Current value: ",
237
+ textareaValue || "(empty)"
238
+ ] })
239
+ ] }) }),
240
+ /* @__PURE__ */ jsx(Card, { className: "border shadow-sm p-4", children: /* @__PURE__ */ jsxs(SimpleStack, { gap: "sm", children: [
241
+ /* @__PURE__ */ jsx("h2", { children: "FormNumberInput" }),
242
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Number input with min/max validation and step control." }),
243
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 pt-2", children: [
244
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Basic", children: /* @__PURE__ */ jsx(
245
+ FormNumberInput,
246
+ {
247
+ label: "Age",
248
+ value: numberValue,
249
+ onChange: setNumberValue,
250
+ placeholder: "Enter age"
251
+ }
252
+ ) }),
253
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "With min/max/step", children: /* @__PURE__ */ jsx(
254
+ FormNumberInput,
255
+ {
256
+ label: "Rating (1-10)",
257
+ value: rangeValue,
258
+ onChange: setRangeValue,
259
+ min: 1,
260
+ max: 10,
261
+ step: 1,
262
+ description: "Rate from 1 to 10"
263
+ }
264
+ ) }),
265
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Decimal", children: /* @__PURE__ */ jsx(
266
+ FormNumberInput,
267
+ {
268
+ label: "Price",
269
+ value: decimalValue,
270
+ onChange: setDecimalValue,
271
+ allowDecimal: true,
272
+ step: 0.01,
273
+ placeholder: "0.00",
274
+ description: "Enter price with cents"
275
+ }
276
+ ) }),
277
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Required", children: /* @__PURE__ */ jsx(
278
+ FormNumberInput,
279
+ {
280
+ label: "Quantity",
281
+ required: true,
282
+ value: numberValue,
283
+ onChange: setNumberValue,
284
+ min: 0,
285
+ placeholder: "0"
286
+ }
287
+ ) }),
288
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "WITH ERROR (STATIC)", children: /* @__PURE__ */ jsx(
289
+ FormNumberInput,
290
+ {
291
+ label: "Invalid Input",
292
+ value: numberValue,
293
+ onChange: setNumberValue,
294
+ error: "Value must be greater than 0"
295
+ }
296
+ ) }),
297
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Range (on-blur validation)", children: /* @__PURE__ */ jsx(
298
+ FormNumberInput,
299
+ {
300
+ label: "Rating (1\u201310)",
301
+ value: rangeValidated,
302
+ onChange: (v) => {
303
+ setRangeValidated(v);
304
+ rangeValidatedRef.current = v;
305
+ if (rangeError) validateRange(v);
306
+ },
307
+ onBlur: () => validateRange(rangeValidatedRef.current),
308
+ error: rangeError,
309
+ min: 1,
310
+ max: 10,
311
+ step: 1,
312
+ placeholder: "1\u201310"
313
+ }
314
+ ) })
315
+ ] }),
316
+ /* @__PURE__ */ jsx("pre", { className: "text-xs bg-muted p-2 rounded overflow-x-auto", children: /* @__PURE__ */ jsx("code", { children: `<FormNumberInput
317
+ label="Age"
318
+ value={numberValue}
319
+ onChange={setNumberValue}
320
+ min={0}
321
+ max={120}
322
+ step={1}
323
+ allowDecimal={false}
324
+ />` }) }),
325
+ /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
326
+ "Current value: ",
327
+ numberValue ?? "(empty)"
328
+ ] })
329
+ ] }) }),
330
+ /* @__PURE__ */ jsx(Card, { className: "border shadow-sm p-4", children: /* @__PURE__ */ jsxs(SimpleStack, { gap: "sm", children: [
331
+ /* @__PURE__ */ jsx("h2", { children: "FormCheckbox" }),
332
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Checkbox with label, description, and indeterminate state support." }),
333
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 pt-2", children: [
334
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Basic", children: /* @__PURE__ */ jsx(
335
+ FormCheckbox,
336
+ {
337
+ label: "Accept terms and conditions",
338
+ checked: checkboxValue,
339
+ onChange: (checked) => setCheckboxValue(checked === true)
340
+ }
341
+ ) }),
342
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "With description", children: /* @__PURE__ */ jsx(
343
+ FormCheckbox,
344
+ {
345
+ label: "Subscribe to newsletter",
346
+ description: "Receive weekly updates about new features",
347
+ checked: checkboxValue,
348
+ onChange: (checked) => setCheckboxValue(checked === true)
349
+ }
350
+ ) }),
351
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Required", children: /* @__PURE__ */ jsx(
352
+ FormCheckbox,
353
+ {
354
+ label: "I agree to the privacy policy",
355
+ required: true,
356
+ checked: checkboxValue,
357
+ onChange: (checked) => setCheckboxValue(checked === true)
358
+ }
359
+ ) }),
360
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Indeterminate", children: /* @__PURE__ */ jsx(
361
+ FormCheckbox,
362
+ {
363
+ label: "Select all items",
364
+ description: "Some items are selected",
365
+ checked: checkboxIndeterminate,
366
+ onChange: setCheckboxIndeterminate
367
+ }
368
+ ) }),
369
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Disabled", children: /* @__PURE__ */ jsx(
370
+ FormCheckbox,
371
+ {
372
+ label: "Cannot change this",
373
+ checked: true,
374
+ onChange: () => {
375
+ },
376
+ disabled: true
377
+ }
378
+ ) }),
379
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "WITH ERROR (STATIC)", children: /* @__PURE__ */ jsx(
380
+ FormCheckbox,
381
+ {
382
+ label: "Required checkbox",
383
+ checked: checkboxValue,
384
+ onChange: (checked) => setCheckboxValue(checked === true),
385
+ error: "You must accept to continue"
386
+ }
387
+ ) })
388
+ ] }),
389
+ /* @__PURE__ */ jsx("pre", { className: "text-xs bg-muted p-2 rounded overflow-x-auto", children: /* @__PURE__ */ jsx("code", { children: `<FormCheckbox
390
+ label="Accept terms"
391
+ checked={checkboxValue}
392
+ onChange={(checked) => setCheckboxValue(checked === true)}
393
+ description="Optional description"
394
+ required={false}
395
+ />` }) }),
396
+ /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
397
+ "Current value: ",
398
+ String(checkboxValue)
399
+ ] })
400
+ ] }) }),
401
+ /* @__PURE__ */ jsx(Card, { className: "border shadow-sm p-4", children: /* @__PURE__ */ jsxs(SimpleStack, { gap: "sm", children: [
402
+ /* @__PURE__ */ jsx("h2", { children: "FormSelect" }),
403
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Searchable single-select dropdown with label and error support." }),
404
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 pt-2", children: [
405
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Basic", children: /* @__PURE__ */ jsx(
406
+ FormSelect,
407
+ {
408
+ label: "Favorite Color",
409
+ value: selectValue,
410
+ onChange: (value) => setSelectValue(value || ""),
411
+ options: colorOptions,
412
+ placeholder: "Choose a color"
413
+ }
414
+ ) }),
415
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "With description", children: /* @__PURE__ */ jsx(
416
+ FormSelect,
417
+ {
418
+ label: "Country",
419
+ description: "Select your country of residence",
420
+ value: selectValue,
421
+ onChange: (value) => setSelectValue(value || ""),
422
+ options: countryOptions,
423
+ placeholder: "Select country"
424
+ }
425
+ ) }),
426
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Required", children: /* @__PURE__ */ jsx(
427
+ FormSelect,
428
+ {
429
+ label: "Required Selection",
430
+ required: true,
431
+ value: selectRequired,
432
+ onChange: (value) => setSelectRequired(value || ""),
433
+ options: colorOptions,
434
+ placeholder: "Must select one"
435
+ }
436
+ ) }),
437
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Disabled", children: /* @__PURE__ */ jsx(
438
+ FormSelect,
439
+ {
440
+ label: "Disabled Select",
441
+ value: "blue",
442
+ onChange: () => {
443
+ },
444
+ options: colorOptions,
445
+ disabled: true,
446
+ placeholder: "Cannot change"
447
+ }
448
+ ) }),
449
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "WITH ERROR (STATIC)", children: /* @__PURE__ */ jsx(
450
+ FormSelect,
451
+ {
452
+ label: "Invalid Selection",
453
+ value: selectValue,
454
+ onChange: (value) => setSelectValue(value || ""),
455
+ options: colorOptions,
456
+ error: "This field is required",
457
+ placeholder: "Select option"
458
+ }
459
+ ) })
460
+ ] }),
461
+ /* @__PURE__ */ jsx("pre", { className: "text-xs bg-muted p-2 rounded overflow-x-auto", children: /* @__PURE__ */ jsx("code", { children: `<FormSelect
462
+ label="Country"
463
+ value={selectValue}
464
+ onChange={(value) => setSelectValue(value || '')}
465
+ options={[
466
+ { label: 'USA', value: 'us' },
467
+ { label: 'UK', value: 'uk' }
468
+ ]}
469
+ placeholder="Select..."
470
+ />` }) }),
471
+ /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
472
+ "Current value: ",
473
+ selectValue || "(none selected)"
474
+ ] })
475
+ ] }) }),
476
+ /* @__PURE__ */ jsx(Card, { className: "border shadow-sm p-4", children: /* @__PURE__ */ jsxs(SimpleStack, { gap: "sm", children: [
477
+ /* @__PURE__ */ jsx("h2", { children: "FormMultiSelect" }),
478
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Searchable multi-select dropdown with badges." }),
479
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 pt-2", children: [
480
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Basic", children: /* @__PURE__ */ jsx(
481
+ FormMultiSelect,
482
+ {
483
+ label: "Favorite Colors",
484
+ value: multiSelectValue,
485
+ onChange: setMultiSelectValue,
486
+ options: colorOptions,
487
+ placeholder: "Select multiple colors"
488
+ }
489
+ ) }),
490
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "With description", children: /* @__PURE__ */ jsx(
491
+ FormMultiSelect,
492
+ {
493
+ label: "Visited Countries",
494
+ description: "Select all countries you've visited",
495
+ value: multiSelectValue,
496
+ onChange: setMultiSelectValue,
497
+ options: countryOptions,
498
+ placeholder: "Select countries"
499
+ }
500
+ ) }),
501
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Required", children: /* @__PURE__ */ jsx(
502
+ FormMultiSelect,
503
+ {
504
+ label: "Skills",
505
+ required: true,
506
+ value: multiSelectValue,
507
+ onChange: setMultiSelectValue,
508
+ options: [
509
+ { label: "JavaScript", value: "js" },
510
+ { label: "TypeScript", value: "ts" },
511
+ { label: "Python", value: "py" },
512
+ { label: "Java", value: "java" }
513
+ ],
514
+ placeholder: "Select at least one skill"
515
+ }
516
+ ) }),
517
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "WITH ERROR (STATIC)", children: /* @__PURE__ */ jsx(
518
+ FormMultiSelect,
519
+ {
520
+ label: "Categories",
521
+ value: multiSelectValue,
522
+ onChange: setMultiSelectValue,
523
+ options: colorOptions,
524
+ error: "Please select at least 2 categories",
525
+ placeholder: "Select categories"
526
+ }
527
+ ) })
528
+ ] }),
529
+ /* @__PURE__ */ jsx("pre", { className: "text-xs bg-muted p-2 rounded overflow-x-auto", children: /* @__PURE__ */ jsx("code", { children: `<FormMultiSelect
530
+ label="Skills"
531
+ value={multiSelectValue}
532
+ onChange={setMultiSelectValue}
533
+ options={skillOptions}
534
+ placeholder="Select skills"
535
+ />` }) }),
536
+ /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
537
+ "Current value:",
538
+ " ",
539
+ multiSelectValue.length > 0 ? multiSelectValue.join(", ") : "(none selected)"
540
+ ] })
541
+ ] }) }),
542
+ /* @__PURE__ */ jsx(Card, { className: "border shadow-sm p-4", children: /* @__PURE__ */ jsxs(SimpleStack, { gap: "sm", children: [
543
+ /* @__PURE__ */ jsx("h2", { children: "FormTagsInput" }),
544
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Free-text tag input with creation and deletion." }),
545
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 pt-2", children: [
546
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Basic", children: /* @__PURE__ */ jsx(
547
+ FormTagsInput,
548
+ {
549
+ label: "Technologies",
550
+ value: tagsValue,
551
+ onChange: setTagsValue,
552
+ placeholder: "Type and press Enter to add tags"
553
+ }
554
+ ) }),
555
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "With description", children: /* @__PURE__ */ jsx(
556
+ FormTagsInput,
557
+ {
558
+ label: "Skills",
559
+ description: "Add your programming skills (press Enter after each)",
560
+ value: tagsValue,
561
+ onChange: setTagsValue,
562
+ placeholder: "e.g., React, Node.js"
563
+ }
564
+ ) }),
565
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Required", children: /* @__PURE__ */ jsx(
566
+ FormTagsInput,
567
+ {
568
+ label: "Keywords",
569
+ required: true,
570
+ value: tagsValue,
571
+ onChange: setTagsValue,
572
+ placeholder: "Add at least one keyword"
573
+ }
574
+ ) }),
575
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "WITH ERROR (STATIC)", children: /* @__PURE__ */ jsx(
576
+ FormTagsInput,
577
+ {
578
+ label: "Tags",
579
+ value: tagsValue,
580
+ onChange: setTagsValue,
581
+ error: "Maximum 5 tags allowed",
582
+ placeholder: "Add tags"
583
+ }
584
+ ) }),
585
+ /* @__PURE__ */ jsx(ExampleBlock, { label: "Disabled", children: /* @__PURE__ */ jsx(
586
+ FormTagsInput,
587
+ {
588
+ label: "Fixed Tags",
589
+ value: ["readonly", "tags"],
590
+ onChange: () => {
591
+ },
592
+ disabled: true,
593
+ placeholder: "Cannot edit"
594
+ }
595
+ ) })
596
+ ] }),
597
+ /* @__PURE__ */ jsx("pre", { className: "text-xs bg-muted p-2 rounded overflow-x-auto", children: /* @__PURE__ */ jsx("code", { children: `<FormTagsInput
598
+ label="Technologies"
599
+ value={tagsValue}
600
+ onChange={setTagsValue}
601
+ placeholder="Type and press Enter"
602
+ description="Optional description"
603
+ />` }) }),
604
+ /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
605
+ "Current tags:",
606
+ " ",
607
+ tagsValue.length > 0 ? tagsValue.join(", ") : "(none)"
608
+ ] })
609
+ ] }) })
610
+ ] }) })
611
+ ] });
612
+ }
613
+
614
+ export {
615
+ PlayFormComponents
616
+ };
617
+ //# sourceMappingURL=chunk-32DDRRWU.js.map