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