@spark-ui/components 10.0.2 → 10.0.4
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/CHANGELOG.md +10 -0
- package/dist/checkbox/index.js +117 -478
- package/dist/checkbox/index.js.map +1 -1
- package/dist/checkbox/index.mjs +3 -4
- package/dist/checkbox/index.mjs.map +1 -1
- package/dist/{chunk-JC6KKYUQ.mjs → chunk-7BTJUYP3.mjs} +6 -5
- package/dist/{chunk-JC6KKYUQ.mjs.map → chunk-7BTJUYP3.mjs.map} +1 -1
- package/dist/combobox/index.js +301 -710
- package/dist/combobox/index.js.map +1 -1
- package/dist/combobox/index.mjs +3 -5
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/dropdown/index.js +252 -662
- package/dist/dropdown/index.js.map +1 -1
- package/dist/dropdown/index.mjs +1 -4
- package/dist/dropdown/index.mjs.map +1 -1
- package/dist/form-field/index.mjs +373 -7
- package/dist/form-field/index.mjs.map +1 -1
- package/dist/input/index.js +47 -454
- package/dist/input/index.js.map +1 -1
- package/dist/input/index.mjs +1 -3
- package/dist/radio-group/index.js +47 -553
- package/dist/radio-group/index.js.map +1 -1
- package/dist/radio-group/index.mjs +3 -9
- package/dist/radio-group/index.mjs.map +1 -1
- package/dist/select/index.js +159 -569
- package/dist/select/index.js.map +1 -1
- package/dist/select/index.mjs +1 -4
- package/dist/select/index.mjs.map +1 -1
- package/dist/stepper/index.js +110 -516
- package/dist/stepper/index.js.map +1 -1
- package/dist/stepper/index.mjs +2 -5
- package/dist/stepper/index.mjs.map +1 -1
- package/dist/switch/index.js +96 -545
- package/dist/switch/index.js.map +1 -1
- package/dist/switch/index.mjs +3 -6
- package/dist/switch/index.mjs.map +1 -1
- package/dist/textarea/index.js +58 -465
- package/dist/textarea/index.js.map +1 -1
- package/dist/textarea/index.mjs +1 -3
- package/dist/textarea/index.mjs.map +1 -1
- package/package.json +20 -10
- package/tsup.config.ts +2 -1
- package/dist/chunk-7PMPYEHJ.mjs +0 -379
- package/dist/chunk-7PMPYEHJ.mjs.map +0 -1
package/dist/textarea/index.js
CHANGED
|
@@ -170,425 +170,15 @@ var InputClearButton = Object.assign(Root, {
|
|
|
170
170
|
});
|
|
171
171
|
Root.displayName = "InputGroup.ClearButton";
|
|
172
172
|
|
|
173
|
-
// src/form-field/FormField.tsx
|
|
174
|
-
var import_class_variance_authority3 = require("class-variance-authority");
|
|
175
|
-
var import_react6 = require("react");
|
|
176
|
-
|
|
177
|
-
// src/form-field/FormFieldContext.tsx
|
|
178
|
-
var import_react4 = require("react");
|
|
179
|
-
var FormFieldContext = (0, import_react4.createContext)(null);
|
|
180
|
-
var ID_PREFIX = ":form-field";
|
|
181
|
-
var useFormField = () => {
|
|
182
|
-
const context = (0, import_react4.useContext)(FormFieldContext);
|
|
183
|
-
if (!context) {
|
|
184
|
-
throw Error("useFormField must be used within a FormField provider");
|
|
185
|
-
}
|
|
186
|
-
return context;
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
// src/form-field/FormFieldProvider.tsx
|
|
190
|
-
var import_react5 = require("react");
|
|
191
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
192
|
-
var FormFieldProvider = ({
|
|
193
|
-
id,
|
|
194
|
-
name,
|
|
195
|
-
disabled = false,
|
|
196
|
-
readOnly = false,
|
|
197
|
-
state,
|
|
198
|
-
isRequired,
|
|
199
|
-
children
|
|
200
|
-
}) => {
|
|
201
|
-
const labelId = `${ID_PREFIX}-label-${(0, import_react5.useId)()}`;
|
|
202
|
-
const [messageIds, setMessageIds] = (0, import_react5.useState)([]);
|
|
203
|
-
const description = messageIds.length > 0 ? messageIds.join(" ") : void 0;
|
|
204
|
-
const handleMessageIdAdd = (0, import_react5.useCallback)((msgId) => {
|
|
205
|
-
setMessageIds((ids) => [...ids, msgId]);
|
|
206
|
-
}, []);
|
|
207
|
-
const handleMessageIdRemove = (0, import_react5.useCallback)((msgId) => {
|
|
208
|
-
setMessageIds((ids) => ids.filter((current) => current !== msgId));
|
|
209
|
-
}, []);
|
|
210
|
-
const value = (0, import_react5.useMemo)(() => {
|
|
211
|
-
const isInvalid = state === "error";
|
|
212
|
-
return {
|
|
213
|
-
id,
|
|
214
|
-
labelId,
|
|
215
|
-
name,
|
|
216
|
-
disabled,
|
|
217
|
-
readOnly,
|
|
218
|
-
state,
|
|
219
|
-
isRequired,
|
|
220
|
-
isInvalid,
|
|
221
|
-
description,
|
|
222
|
-
onMessageIdAdd: handleMessageIdAdd,
|
|
223
|
-
onMessageIdRemove: handleMessageIdRemove
|
|
224
|
-
};
|
|
225
|
-
}, [
|
|
226
|
-
id,
|
|
227
|
-
labelId,
|
|
228
|
-
name,
|
|
229
|
-
disabled,
|
|
230
|
-
readOnly,
|
|
231
|
-
description,
|
|
232
|
-
state,
|
|
233
|
-
isRequired,
|
|
234
|
-
handleMessageIdAdd,
|
|
235
|
-
handleMessageIdRemove
|
|
236
|
-
]);
|
|
237
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FormFieldContext.Provider, { value, children });
|
|
238
|
-
};
|
|
239
|
-
FormFieldProvider.displayName = "FormFieldProvider";
|
|
240
|
-
|
|
241
|
-
// src/form-field/FormField.tsx
|
|
242
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
243
|
-
var FormField = ({
|
|
244
|
-
className,
|
|
245
|
-
disabled = false,
|
|
246
|
-
readOnly = false,
|
|
247
|
-
name,
|
|
248
|
-
state,
|
|
249
|
-
isRequired = false,
|
|
250
|
-
asChild = false,
|
|
251
|
-
ref,
|
|
252
|
-
...others
|
|
253
|
-
}) => {
|
|
254
|
-
const id = `${ID_PREFIX}-${(0, import_react6.useId)()}`;
|
|
255
|
-
const Component = asChild ? Slot : "div";
|
|
256
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
257
|
-
FormFieldProvider,
|
|
258
|
-
{
|
|
259
|
-
id,
|
|
260
|
-
name,
|
|
261
|
-
isRequired,
|
|
262
|
-
disabled,
|
|
263
|
-
readOnly,
|
|
264
|
-
state,
|
|
265
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
266
|
-
Component,
|
|
267
|
-
{
|
|
268
|
-
ref,
|
|
269
|
-
"data-spark-component": "form-field",
|
|
270
|
-
className: (0, import_class_variance_authority3.cx)(className, "gap-sm flex flex-col"),
|
|
271
|
-
...others
|
|
272
|
-
}
|
|
273
|
-
)
|
|
274
|
-
}
|
|
275
|
-
);
|
|
276
|
-
};
|
|
277
|
-
FormField.displayName = "FormField";
|
|
278
|
-
|
|
279
|
-
// src/form-field/FormFieldStateMessage.tsx
|
|
280
|
-
var import_AlertOutline = require("@spark-ui/icons/AlertOutline");
|
|
281
|
-
var import_Check = require("@spark-ui/icons/Check");
|
|
282
|
-
var import_WarningOutline = require("@spark-ui/icons/WarningOutline");
|
|
283
|
-
var import_class_variance_authority5 = require("class-variance-authority");
|
|
284
|
-
|
|
285
|
-
// src/form-field/FormFieldMessage.tsx
|
|
286
|
-
var import_class_variance_authority4 = require("class-variance-authority");
|
|
287
|
-
var import_react7 = require("react");
|
|
288
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
289
|
-
var FormFieldMessage = ({
|
|
290
|
-
id: idProp,
|
|
291
|
-
className,
|
|
292
|
-
ref,
|
|
293
|
-
...others
|
|
294
|
-
}) => {
|
|
295
|
-
const { onMessageIdAdd, onMessageIdRemove } = useFormField();
|
|
296
|
-
const currentId = `${ID_PREFIX}-message-${(0, import_react7.useId)()}`;
|
|
297
|
-
const id = idProp || currentId;
|
|
298
|
-
(0, import_react7.useEffect)(() => {
|
|
299
|
-
onMessageIdAdd(id);
|
|
300
|
-
return () => {
|
|
301
|
-
onMessageIdRemove(id);
|
|
302
|
-
};
|
|
303
|
-
}, [id, onMessageIdAdd, onMessageIdRemove]);
|
|
304
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
305
|
-
"span",
|
|
306
|
-
{
|
|
307
|
-
ref,
|
|
308
|
-
id,
|
|
309
|
-
"data-spark-component": "form-field-message",
|
|
310
|
-
className: (0, import_class_variance_authority4.cx)(className, "text-caption"),
|
|
311
|
-
...others
|
|
312
|
-
}
|
|
313
|
-
);
|
|
314
|
-
};
|
|
315
|
-
FormFieldMessage.displayName = "FormField.Message";
|
|
316
|
-
|
|
317
|
-
// src/form-field/FormFieldStateMessage.tsx
|
|
318
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
319
|
-
var FormFieldStateMessage = ({
|
|
320
|
-
className,
|
|
321
|
-
state,
|
|
322
|
-
children,
|
|
323
|
-
ref,
|
|
324
|
-
...others
|
|
325
|
-
}) => {
|
|
326
|
-
const field = useFormField();
|
|
327
|
-
if (field.state !== state) {
|
|
328
|
-
return null;
|
|
329
|
-
}
|
|
330
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
331
|
-
FormFieldMessage,
|
|
332
|
-
{
|
|
333
|
-
ref,
|
|
334
|
-
"data-spark-component": "form-field-state-message",
|
|
335
|
-
"aria-live": "polite",
|
|
336
|
-
className: (0, import_class_variance_authority5.cx)(
|
|
337
|
-
"gap-sm flex items-center",
|
|
338
|
-
state === "error" ? "text-error" : "text-on-surface/dim-1",
|
|
339
|
-
className
|
|
340
|
-
),
|
|
341
|
-
...others,
|
|
342
|
-
children: [
|
|
343
|
-
state === "alert" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_WarningOutline.WarningOutline, {}) }),
|
|
344
|
-
state === "error" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { size: "sm", intent: "error", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_AlertOutline.AlertOutline, {}) }),
|
|
345
|
-
state === "success" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_Check.Check, {}) }),
|
|
346
|
-
children
|
|
347
|
-
]
|
|
348
|
-
}
|
|
349
|
-
);
|
|
350
|
-
};
|
|
351
|
-
FormFieldStateMessage.displayName = "FormField.StateMessage";
|
|
352
|
-
|
|
353
|
-
// src/form-field/FormFieldAlertMessage.tsx
|
|
354
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
355
|
-
var FormFieldAlertMessage = ({ ref, ...props }) => {
|
|
356
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
357
|
-
FormFieldStateMessage,
|
|
358
|
-
{
|
|
359
|
-
ref,
|
|
360
|
-
"data-spark-component": "form-field-alert-message",
|
|
361
|
-
state: "alert",
|
|
362
|
-
...props
|
|
363
|
-
}
|
|
364
|
-
);
|
|
365
|
-
};
|
|
366
|
-
FormFieldAlertMessage.displayName = "FormField.AlertMessage";
|
|
367
|
-
|
|
368
|
-
// src/form-field/FormFieldCharactersCount.tsx
|
|
369
|
-
var import_class_variance_authority6 = require("class-variance-authority");
|
|
370
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
371
|
-
var FormFieldCharactersCount = ({
|
|
372
|
-
className,
|
|
373
|
-
value = "",
|
|
374
|
-
maxLength,
|
|
375
|
-
ref,
|
|
376
|
-
...others
|
|
377
|
-
}) => {
|
|
378
|
-
const displayValue = `${value.length}/${maxLength}`;
|
|
379
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
380
|
-
"span",
|
|
381
|
-
{
|
|
382
|
-
ref,
|
|
383
|
-
"data-spark-component": "form-field-characters-count",
|
|
384
|
-
className: (0, import_class_variance_authority6.cx)(className, "text-caption", "text-neutral"),
|
|
385
|
-
...others,
|
|
386
|
-
children: displayValue
|
|
387
|
-
}
|
|
388
|
-
);
|
|
389
|
-
};
|
|
390
|
-
FormFieldCharactersCount.displayName = "FormField.CharactersCount";
|
|
391
|
-
|
|
392
|
-
// src/form-field/FormFieldControl.tsx
|
|
393
|
-
var import_react8 = require("react");
|
|
394
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
395
|
-
var useFormFieldControl = () => {
|
|
396
|
-
const { id, name, description, disabled, readOnly, state, labelId, isInvalid, isRequired } = (0, import_react8.useContext)(FormFieldContext) || {};
|
|
397
|
-
return {
|
|
398
|
-
id,
|
|
399
|
-
name,
|
|
400
|
-
description,
|
|
401
|
-
disabled,
|
|
402
|
-
readOnly,
|
|
403
|
-
state,
|
|
404
|
-
labelId,
|
|
405
|
-
isInvalid,
|
|
406
|
-
isRequired
|
|
407
|
-
};
|
|
408
|
-
};
|
|
409
|
-
var FormFieldControl = ({ children }) => {
|
|
410
|
-
const props = useFormFieldControl();
|
|
411
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: children(props) });
|
|
412
|
-
};
|
|
413
|
-
FormFieldControl.displayName = "FormField.Control";
|
|
414
|
-
|
|
415
|
-
// src/form-field/FormFieldErrorMessage.tsx
|
|
416
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
417
|
-
var FormFieldErrorMessage = ({ ref, ...props }) => {
|
|
418
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
419
|
-
FormFieldStateMessage,
|
|
420
|
-
{
|
|
421
|
-
ref,
|
|
422
|
-
"data-spark-component": "form-field-error-message",
|
|
423
|
-
state: "error",
|
|
424
|
-
...props
|
|
425
|
-
}
|
|
426
|
-
);
|
|
427
|
-
};
|
|
428
|
-
FormFieldErrorMessage.displayName = "FormField.ErrorMessage";
|
|
429
|
-
|
|
430
|
-
// src/form-field/FormFieldHelperMessage.tsx
|
|
431
|
-
var import_class_variance_authority7 = require("class-variance-authority");
|
|
432
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
433
|
-
var FormFieldHelperMessage = ({
|
|
434
|
-
className,
|
|
435
|
-
ref,
|
|
436
|
-
...others
|
|
437
|
-
}) => {
|
|
438
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
439
|
-
FormFieldMessage,
|
|
440
|
-
{
|
|
441
|
-
ref,
|
|
442
|
-
"data-spark-component": "form-field-helper-message",
|
|
443
|
-
className: (0, import_class_variance_authority7.cx)("text-on-surface/dim-1", className),
|
|
444
|
-
...others
|
|
445
|
-
}
|
|
446
|
-
);
|
|
447
|
-
};
|
|
448
|
-
FormFieldHelperMessage.displayName = "FormField.HelperMessage";
|
|
449
|
-
|
|
450
|
-
// src/form-field/FormFieldLabel.tsx
|
|
451
|
-
var import_class_variance_authority11 = require("class-variance-authority");
|
|
452
|
-
|
|
453
|
-
// src/label/Label.tsx
|
|
454
|
-
var import_class_variance_authority8 = require("class-variance-authority");
|
|
455
|
-
var import_radix_ui2 = require("radix-ui");
|
|
456
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
457
|
-
var Label = ({ className, ref, ...others }) => {
|
|
458
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
459
|
-
import_radix_ui2.Label.Label,
|
|
460
|
-
{
|
|
461
|
-
ref,
|
|
462
|
-
"data-spark-component": "label",
|
|
463
|
-
className: (0, import_class_variance_authority8.cx)("text-body-1", className),
|
|
464
|
-
...others
|
|
465
|
-
}
|
|
466
|
-
);
|
|
467
|
-
};
|
|
468
|
-
Label.displayName = "Label";
|
|
469
|
-
|
|
470
|
-
// src/label/LabelRequiredIndicator.tsx
|
|
471
|
-
var import_class_variance_authority9 = require("class-variance-authority");
|
|
472
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
473
|
-
var LabelRequiredIndicator = ({
|
|
474
|
-
className,
|
|
475
|
-
children = "*",
|
|
476
|
-
ref,
|
|
477
|
-
...others
|
|
478
|
-
}) => {
|
|
479
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
480
|
-
"span",
|
|
481
|
-
{
|
|
482
|
-
ref,
|
|
483
|
-
"data-spark-component": "label-required-indicator",
|
|
484
|
-
role: "presentation",
|
|
485
|
-
"aria-hidden": "true",
|
|
486
|
-
className: (0, import_class_variance_authority9.cx)(className, "text-caption text-on-surface/dim-1"),
|
|
487
|
-
...others,
|
|
488
|
-
children
|
|
489
|
-
}
|
|
490
|
-
);
|
|
491
|
-
};
|
|
492
|
-
LabelRequiredIndicator.displayName = "Label.RequiredIndicator";
|
|
493
|
-
|
|
494
|
-
// src/label/index.ts
|
|
495
|
-
var Label2 = Object.assign(Label, {
|
|
496
|
-
RequiredIndicator: LabelRequiredIndicator
|
|
497
|
-
});
|
|
498
|
-
Label2.displayName = "Label";
|
|
499
|
-
LabelRequiredIndicator.displayName = "Label.RequiredIndicator";
|
|
500
|
-
|
|
501
|
-
// src/form-field/FormFieldRequiredIndicator.tsx
|
|
502
|
-
var import_class_variance_authority10 = require("class-variance-authority");
|
|
503
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
504
|
-
var FormFieldRequiredIndicator = ({
|
|
505
|
-
className,
|
|
506
|
-
ref,
|
|
507
|
-
...props
|
|
508
|
-
}) => {
|
|
509
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label2.RequiredIndicator, { ref, className: (0, import_class_variance_authority10.cx)("ml-sm", className), ...props });
|
|
510
|
-
};
|
|
511
|
-
FormFieldRequiredIndicator.displayName = "FormField.RequiredIndicator";
|
|
512
|
-
|
|
513
|
-
// src/form-field/FormFieldLabel.tsx
|
|
514
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
515
|
-
var FormFieldLabel = ({
|
|
516
|
-
htmlFor: htmlForProp,
|
|
517
|
-
className,
|
|
518
|
-
children,
|
|
519
|
-
requiredIndicator = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FormFieldRequiredIndicator, {}),
|
|
520
|
-
asChild,
|
|
521
|
-
ref,
|
|
522
|
-
...others
|
|
523
|
-
}) => {
|
|
524
|
-
const control = useFormField();
|
|
525
|
-
const { disabled, labelId, isRequired } = control;
|
|
526
|
-
const htmlFor = asChild ? void 0 : htmlForProp || control.id;
|
|
527
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
528
|
-
Label2,
|
|
529
|
-
{
|
|
530
|
-
ref,
|
|
531
|
-
id: labelId,
|
|
532
|
-
"data-spark-component": "form-field-label",
|
|
533
|
-
htmlFor,
|
|
534
|
-
className: (0, import_class_variance_authority11.cx)(className, disabled ? "text-on-surface/dim-3 pointer-events-none" : void 0),
|
|
535
|
-
asChild,
|
|
536
|
-
...others,
|
|
537
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
538
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Slottable, { children }),
|
|
539
|
-
isRequired && requiredIndicator
|
|
540
|
-
] })
|
|
541
|
-
}
|
|
542
|
-
);
|
|
543
|
-
};
|
|
544
|
-
FormFieldLabel.displayName = "FormField.Label";
|
|
545
|
-
|
|
546
|
-
// src/form-field/FormFieldSuccessMessage.tsx
|
|
547
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
548
|
-
var FormFieldSuccessMessage = ({ ref, ...props }) => {
|
|
549
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
550
|
-
FormFieldStateMessage,
|
|
551
|
-
{
|
|
552
|
-
ref,
|
|
553
|
-
"data-spark-component": "form-field-success-message",
|
|
554
|
-
state: "success",
|
|
555
|
-
...props
|
|
556
|
-
}
|
|
557
|
-
);
|
|
558
|
-
};
|
|
559
|
-
FormFieldSuccessMessage.displayName = "FormField.SuccessMessage";
|
|
560
|
-
|
|
561
|
-
// src/form-field/index.ts
|
|
562
|
-
var FormField2 = Object.assign(FormField, {
|
|
563
|
-
Label: FormFieldLabel,
|
|
564
|
-
Control: FormFieldControl,
|
|
565
|
-
StateMessage: FormFieldStateMessage,
|
|
566
|
-
SuccessMessage: FormFieldSuccessMessage,
|
|
567
|
-
AlertMessage: FormFieldAlertMessage,
|
|
568
|
-
ErrorMessage: FormFieldErrorMessage,
|
|
569
|
-
HelperMessage: FormFieldHelperMessage,
|
|
570
|
-
RequiredIndicator: FormFieldRequiredIndicator,
|
|
571
|
-
CharactersCount: FormFieldCharactersCount
|
|
572
|
-
});
|
|
573
|
-
FormField2.displayName = "FormField";
|
|
574
|
-
FormFieldLabel.displayName = "FormField.Label";
|
|
575
|
-
FormFieldControl.displayName = "FormField.Control";
|
|
576
|
-
FormFieldStateMessage.displayName = "FormField.StateMessage";
|
|
577
|
-
FormFieldSuccessMessage.displayName = "FormField.SuccessMessage";
|
|
578
|
-
FormFieldAlertMessage.displayName = "FormField.AlertMessage";
|
|
579
|
-
FormFieldErrorMessage.displayName = "FormField.ErrorMessage";
|
|
580
|
-
FormFieldHelperMessage.displayName = "FormField.HelperMessage";
|
|
581
|
-
FormFieldRequiredIndicator.displayName = "FormField.RequiredIndicator";
|
|
582
|
-
FormFieldCharactersCount.displayName = "FormField.CharactersCount";
|
|
583
|
-
|
|
584
173
|
// src/input/InputGroup.tsx
|
|
174
|
+
var import_form_field = require("@spark-ui/components/form-field");
|
|
585
175
|
var import_use_combined_state = require("@spark-ui/use-combined-state");
|
|
586
176
|
var import_use_merge_refs = require("@spark-ui/use-merge-refs");
|
|
587
|
-
var
|
|
177
|
+
var import_react4 = require("react");
|
|
588
178
|
|
|
589
179
|
// src/input/InputGroup.styles.ts
|
|
590
|
-
var
|
|
591
|
-
var inputGroupStyles = (0,
|
|
180
|
+
var import_class_variance_authority3 = require("class-variance-authority");
|
|
181
|
+
var inputGroupStyles = (0, import_class_variance_authority3.cva)(["relative inline-flex w-full"], {
|
|
592
182
|
variants: {
|
|
593
183
|
/**
|
|
594
184
|
* When `true`, prevents the user from interacting.
|
|
@@ -625,7 +215,7 @@ var inputGroupStyles = (0, import_class_variance_authority12.cva)(["relative inl
|
|
|
625
215
|
});
|
|
626
216
|
|
|
627
217
|
// src/input/InputGroup.tsx
|
|
628
|
-
var
|
|
218
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
629
219
|
var InputGroup = ({
|
|
630
220
|
className,
|
|
631
221
|
children: childrenProp,
|
|
@@ -642,18 +232,18 @@ var InputGroup = ({
|
|
|
642
232
|
const findElement = (...values) => {
|
|
643
233
|
return children.find((child) => values.includes(getElementId(child) || ""));
|
|
644
234
|
};
|
|
645
|
-
const children =
|
|
235
|
+
const children = import_react4.Children.toArray(childrenProp).filter(import_react4.isValidElement);
|
|
646
236
|
const input = findElement("Input");
|
|
647
237
|
const props = input?.props || {};
|
|
648
|
-
const inputRef = (0,
|
|
649
|
-
const onClearRef = (0,
|
|
238
|
+
const inputRef = (0, import_react4.useRef)(null);
|
|
239
|
+
const onClearRef = (0, import_react4.useRef)(onClear);
|
|
650
240
|
const ref = (0, import_use_merge_refs.useMergeRefs)(input?.ref, inputRef);
|
|
651
241
|
const [value, onChange] = (0, import_use_combined_state.useCombinedState)(
|
|
652
242
|
props.value,
|
|
653
243
|
props.defaultValue,
|
|
654
244
|
props.onValueChange
|
|
655
245
|
);
|
|
656
|
-
const field = useFormFieldControl();
|
|
246
|
+
const field = (0, import_form_field.useFormFieldControl)();
|
|
657
247
|
const state = field.state ?? stateProp;
|
|
658
248
|
const disabled = field.disabled || !!disabledProp;
|
|
659
249
|
const readOnly = field.readOnly || !!readOnlyProp;
|
|
@@ -673,14 +263,14 @@ var InputGroup = ({
|
|
|
673
263
|
}
|
|
674
264
|
onChange(event.target.value);
|
|
675
265
|
};
|
|
676
|
-
const handleClear = (0,
|
|
266
|
+
const handleClear = (0, import_react4.useCallback)(() => {
|
|
677
267
|
if (onClearRef.current) {
|
|
678
268
|
onClearRef.current();
|
|
679
269
|
}
|
|
680
270
|
onChange("");
|
|
681
271
|
inputRef.current.focus();
|
|
682
272
|
}, [onChange]);
|
|
683
|
-
const current = (0,
|
|
273
|
+
const current = (0, import_react4.useMemo)(() => {
|
|
684
274
|
return {
|
|
685
275
|
state,
|
|
686
276
|
disabled,
|
|
@@ -703,10 +293,10 @@ var InputGroup = ({
|
|
|
703
293
|
hasClearButton,
|
|
704
294
|
handleClear
|
|
705
295
|
]);
|
|
706
|
-
(0,
|
|
296
|
+
(0, import_react4.useEffect)(() => {
|
|
707
297
|
onClearRef.current = onClear;
|
|
708
298
|
}, [onClear]);
|
|
709
|
-
return /* @__PURE__ */ (0,
|
|
299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(InputGroupContext.Provider, { value: current, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
710
300
|
"div",
|
|
711
301
|
{
|
|
712
302
|
ref: forwardedRef,
|
|
@@ -714,8 +304,8 @@ var InputGroup = ({
|
|
|
714
304
|
...others,
|
|
715
305
|
children: [
|
|
716
306
|
hasLeadingAddon && leadingAddon,
|
|
717
|
-
/* @__PURE__ */ (0,
|
|
718
|
-
input && (0,
|
|
307
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative inline-flex w-full", children: [
|
|
308
|
+
input && (0, import_react4.cloneElement)(input, {
|
|
719
309
|
ref,
|
|
720
310
|
defaultValue: void 0,
|
|
721
311
|
value: value ?? "",
|
|
@@ -733,14 +323,14 @@ var InputGroup = ({
|
|
|
733
323
|
InputGroup.displayName = "InputGroup";
|
|
734
324
|
|
|
735
325
|
// src/input/InputLeadingAddon.tsx
|
|
736
|
-
var
|
|
326
|
+
var import_class_variance_authority5 = require("class-variance-authority");
|
|
737
327
|
|
|
738
328
|
// src/input/InputAddon.tsx
|
|
739
|
-
var
|
|
329
|
+
var import_react5 = require("react");
|
|
740
330
|
|
|
741
331
|
// src/input/InputAddon.styles.ts
|
|
742
|
-
var
|
|
743
|
-
var inputAddonStyles = (0,
|
|
332
|
+
var import_class_variance_authority4 = require("class-variance-authority");
|
|
333
|
+
var inputAddonStyles = (0, import_class_variance_authority4.cva)(
|
|
744
334
|
[
|
|
745
335
|
"overflow-hidden",
|
|
746
336
|
"border-sm",
|
|
@@ -806,7 +396,7 @@ var inputAddonStyles = (0, import_class_variance_authority13.cva)(
|
|
|
806
396
|
);
|
|
807
397
|
|
|
808
398
|
// src/input/InputAddon.tsx
|
|
809
|
-
var
|
|
399
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
810
400
|
var InputAddon = ({
|
|
811
401
|
asChild: asChildProp,
|
|
812
402
|
className,
|
|
@@ -817,14 +407,14 @@ var InputAddon = ({
|
|
|
817
407
|
const { state, disabled, readOnly } = useInputGroup();
|
|
818
408
|
const isRawText = typeof children === "string";
|
|
819
409
|
const asChild = !!(isRawText ? false : asChildProp);
|
|
820
|
-
const child = isRawText ? children :
|
|
410
|
+
const child = isRawText ? children : import_react5.Children.only(children);
|
|
821
411
|
const Component = asChild && !isRawText ? Slot : "div";
|
|
822
412
|
const getDesign = () => {
|
|
823
413
|
if (isRawText) return "text";
|
|
824
414
|
return asChild ? "solid" : "inline";
|
|
825
415
|
};
|
|
826
416
|
const design = getDesign();
|
|
827
|
-
return /* @__PURE__ */ (0,
|
|
417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
828
418
|
Component,
|
|
829
419
|
{
|
|
830
420
|
ref,
|
|
@@ -845,15 +435,15 @@ var InputAddon = ({
|
|
|
845
435
|
InputAddon.displayName = "InputGroup.Addon";
|
|
846
436
|
|
|
847
437
|
// src/input/InputLeadingAddon.tsx
|
|
848
|
-
var
|
|
438
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
849
439
|
var Root2 = ({ className, ref, ...others }) => {
|
|
850
440
|
const { disabled, readOnly } = useInputGroup();
|
|
851
441
|
const isInactive = disabled || readOnly;
|
|
852
|
-
return /* @__PURE__ */ (0,
|
|
442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: (0, import_class_variance_authority5.cx)("rounded-l-lg", isInactive ? "bg-on-surface/dim-5" : null), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
853
443
|
InputAddon,
|
|
854
444
|
{
|
|
855
445
|
ref,
|
|
856
|
-
className: (0,
|
|
446
|
+
className: (0, import_class_variance_authority5.cx)(className, "rounded-r-0! mr-[-1px] rounded-l-lg"),
|
|
857
447
|
...others
|
|
858
448
|
}
|
|
859
449
|
) });
|
|
@@ -864,19 +454,19 @@ var InputLeadingAddon = Object.assign(Root2, {
|
|
|
864
454
|
Root2.displayName = "InputGroup.LeadingAddon";
|
|
865
455
|
|
|
866
456
|
// src/input/InputLeadingIcon.tsx
|
|
867
|
-
var
|
|
457
|
+
var import_class_variance_authority7 = require("class-variance-authority");
|
|
868
458
|
|
|
869
459
|
// src/input/InputIcon.tsx
|
|
870
|
-
var
|
|
871
|
-
var
|
|
460
|
+
var import_class_variance_authority6 = require("class-variance-authority");
|
|
461
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
872
462
|
var InputIcon = ({ className, intent, children, ...others }) => {
|
|
873
463
|
const { disabled, readOnly } = useInputGroup();
|
|
874
464
|
const isInactive = disabled || readOnly;
|
|
875
|
-
return /* @__PURE__ */ (0,
|
|
465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
876
466
|
Icon,
|
|
877
467
|
{
|
|
878
468
|
intent,
|
|
879
|
-
className: (0,
|
|
469
|
+
className: (0, import_class_variance_authority6.cx)(
|
|
880
470
|
className,
|
|
881
471
|
"pointer-events-none absolute top-[calc(var(--spacing-sz-44)/2)] -translate-y-1/2",
|
|
882
472
|
intent ? void 0 : "text-neutral peer-focus:text-outline-high",
|
|
@@ -890,22 +480,22 @@ var InputIcon = ({ className, intent, children, ...others }) => {
|
|
|
890
480
|
InputIcon.displayName = "InputGroup.Icon";
|
|
891
481
|
|
|
892
482
|
// src/input/InputLeadingIcon.tsx
|
|
893
|
-
var
|
|
894
|
-
var InputLeadingIcon = ({ className, ...others }) => /* @__PURE__ */ (0,
|
|
483
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
484
|
+
var InputLeadingIcon = ({ className, ...others }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(InputIcon, { className: (0, import_class_variance_authority7.cx)(className, "left-lg text-body-1"), ...others });
|
|
895
485
|
InputLeadingIcon.id = "LeadingIcon";
|
|
896
486
|
InputLeadingIcon.displayName = "InputGroup.LeadingIcon";
|
|
897
487
|
|
|
898
488
|
// src/input/InputTrailingAddon.tsx
|
|
899
|
-
var
|
|
900
|
-
var
|
|
489
|
+
var import_class_variance_authority8 = require("class-variance-authority");
|
|
490
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
901
491
|
var Root3 = ({ className, ref, ...others }) => {
|
|
902
492
|
const { disabled, readOnly } = useInputGroup();
|
|
903
493
|
const isInactive = disabled || readOnly;
|
|
904
|
-
return /* @__PURE__ */ (0,
|
|
494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_class_variance_authority8.cx)("rounded-r-lg", isInactive ? "bg-on-surface/dim-5" : null), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
905
495
|
InputAddon,
|
|
906
496
|
{
|
|
907
497
|
ref,
|
|
908
|
-
className: (0,
|
|
498
|
+
className: (0, import_class_variance_authority8.cx)(className, "rounded-l-0! ml-[-1px] rounded-r-lg"),
|
|
909
499
|
...others
|
|
910
500
|
}
|
|
911
501
|
) });
|
|
@@ -916,15 +506,18 @@ var InputTrailingAddon = Object.assign(Root3, {
|
|
|
916
506
|
Root3.displayName = "InputGroup.TrailingAddon";
|
|
917
507
|
|
|
918
508
|
// src/input/InputTrailingIcon.tsx
|
|
919
|
-
var
|
|
920
|
-
var
|
|
921
|
-
var InputTrailingIcon = ({ className, ...others }) => /* @__PURE__ */ (0,
|
|
509
|
+
var import_class_variance_authority9 = require("class-variance-authority");
|
|
510
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
511
|
+
var InputTrailingIcon = ({ className, ...others }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(InputIcon, { className: (0, import_class_variance_authority9.cx)(className, "right-lg text-body-1"), ...others });
|
|
922
512
|
InputTrailingIcon.id = "TrailingIcon";
|
|
923
513
|
InputTrailingIcon.displayName = "InputGroup.TrailingIcon";
|
|
924
514
|
|
|
515
|
+
// src/input/Input.tsx
|
|
516
|
+
var import_form_field2 = require("@spark-ui/components/form-field");
|
|
517
|
+
|
|
925
518
|
// src/input/Input.styles.ts
|
|
926
|
-
var
|
|
927
|
-
var inputStyles = (0,
|
|
519
|
+
var import_class_variance_authority10 = require("class-variance-authority");
|
|
520
|
+
var inputStyles = (0, import_class_variance_authority10.cva)(
|
|
928
521
|
[
|
|
929
522
|
"relative",
|
|
930
523
|
"border-sm",
|
|
@@ -1020,7 +613,7 @@ var inputStyles = (0, import_class_variance_authority19.cva)(
|
|
|
1020
613
|
);
|
|
1021
614
|
|
|
1022
615
|
// src/input/Input.tsx
|
|
1023
|
-
var
|
|
616
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1024
617
|
var Root4 = ({
|
|
1025
618
|
className,
|
|
1026
619
|
asChild = false,
|
|
@@ -1032,7 +625,7 @@ var Root4 = ({
|
|
|
1032
625
|
ref,
|
|
1033
626
|
...others
|
|
1034
627
|
}) => {
|
|
1035
|
-
const field = useFormFieldControl();
|
|
628
|
+
const field = (0, import_form_field2.useFormFieldControl)();
|
|
1036
629
|
const group = useInputGroup();
|
|
1037
630
|
const { id, name, isInvalid, isRequired, description } = field;
|
|
1038
631
|
const {
|
|
@@ -1063,7 +656,7 @@ var Root4 = ({
|
|
|
1063
656
|
onClear();
|
|
1064
657
|
}
|
|
1065
658
|
};
|
|
1066
|
-
return /* @__PURE__ */ (0,
|
|
659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1067
660
|
Component,
|
|
1068
661
|
{
|
|
1069
662
|
ref,
|
|
@@ -1111,31 +704,31 @@ InputTrailingIcon.displayName = "InputGroup.TrailingIcon";
|
|
|
1111
704
|
InputClearButton.displayName = "InputGroup.ClearButton";
|
|
1112
705
|
|
|
1113
706
|
// src/textarea/TextareaGroup.tsx
|
|
1114
|
-
var
|
|
707
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1115
708
|
var TextareaGroup = (props) => {
|
|
1116
|
-
return /* @__PURE__ */ (0,
|
|
709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(InputGroup2, { ...props });
|
|
1117
710
|
};
|
|
1118
711
|
TextareaGroup.displayName = "TextareaGroup";
|
|
1119
712
|
|
|
1120
713
|
// src/textarea/TextareaLeadingIcon.tsx
|
|
1121
|
-
var
|
|
714
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1122
715
|
var TextareaLeadingIcon = (props) => {
|
|
1123
|
-
return /* @__PURE__ */ (0,
|
|
716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(InputGroup2.LeadingIcon, { "data-spark-component": "textarea-group-leading-icon", ...props });
|
|
1124
717
|
};
|
|
1125
718
|
TextareaLeadingIcon.id = InputGroup2.LeadingIcon.id;
|
|
1126
719
|
TextareaLeadingIcon.displayName = "TextareaGroup.LeadingIcon";
|
|
1127
720
|
|
|
1128
721
|
// src/textarea/TextareaTrailingIcon.tsx
|
|
1129
|
-
var
|
|
722
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1130
723
|
var TextareaTrailingIcon = (props) => {
|
|
1131
|
-
return /* @__PURE__ */ (0,
|
|
724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(InputGroup2.TrailingIcon, { "data-spark-component": "textarea-group-trailing-icon", ...props });
|
|
1132
725
|
};
|
|
1133
726
|
TextareaTrailingIcon.id = InputGroup2.TrailingIcon.id;
|
|
1134
727
|
TextareaTrailingIcon.displayName = "TextareaGroup.TrailingIcon";
|
|
1135
728
|
|
|
1136
729
|
// src/textarea/Textarea.tsx
|
|
1137
|
-
var
|
|
1138
|
-
var
|
|
730
|
+
var import_class_variance_authority11 = require("class-variance-authority");
|
|
731
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1139
732
|
var Root5 = ({
|
|
1140
733
|
className,
|
|
1141
734
|
disabled,
|
|
@@ -1144,10 +737,10 @@ var Root5 = ({
|
|
|
1144
737
|
ref,
|
|
1145
738
|
...others
|
|
1146
739
|
}) => {
|
|
1147
|
-
return /* @__PURE__ */ (0,
|
|
740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1148
741
|
Input,
|
|
1149
742
|
{
|
|
1150
|
-
className: (0,
|
|
743
|
+
className: (0, import_class_variance_authority11.cx)(
|
|
1151
744
|
className,
|
|
1152
745
|
"py-[var(--spacing-sz-10)]",
|
|
1153
746
|
isResizable ? "resize-y" : "resize-none"
|
|
@@ -1155,7 +748,7 @@ var Root5 = ({
|
|
|
1155
748
|
"data-spark-component": "textarea",
|
|
1156
749
|
disabled,
|
|
1157
750
|
asChild: true,
|
|
1158
|
-
children: /* @__PURE__ */ (0,
|
|
751
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("textarea", { ref, rows, ...others })
|
|
1159
752
|
}
|
|
1160
753
|
);
|
|
1161
754
|
};
|