@geckoui/geckoui 1.6.4 → 2.0.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.
- package/dist/index.d.mts +2992 -917
- package/dist/index.d.ts +2992 -917
- package/dist/index.js +6262 -1719
- package/dist/index.mjs +6226 -1674
- package/dist/styles.css +3553 -829
- package/package.json +18 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import react__default, { RefObject, InputHTMLAttributes, FC, ReactNode, JSX, ForwardedRef, LabelHTMLAttributes, PropsWithChildren, ButtonHTMLAttributes, DetailedHTMLProps, ReactElement, RefCallback, Dispatch, SetStateAction, HtmlHTMLAttributes, ChangeEvent,
|
|
2
|
+
import react__default, { RefObject, InputHTMLAttributes, FC, ReactNode, JSX, ForwardedRef, LabelHTMLAttributes, PropsWithChildren, ButtonHTMLAttributes, TextareaHTMLAttributes, HTMLAttributes, DetailedHTMLProps, ReactElement, RefCallback, Dispatch, SetStateAction, HtmlHTMLAttributes, ChangeEvent, AnchorHTMLAttributes, CSSProperties, SVGProps } from 'react';
|
|
3
3
|
import { ControllerProps, Control, FieldValues, ControllerRenderProps, ControllerFieldState, UseFormStateReturn } from 'react-hook-form';
|
|
4
4
|
import { Placement, Strategy, useFloating } from '@floating-ui/react';
|
|
5
|
-
import { TextareaAutosizeProps } from 'react-textarea-autosize';
|
|
6
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
|
-
import { ToasterProps } from 'sonner';
|
|
8
|
-
export { toast } from 'sonner';
|
|
9
6
|
|
|
10
7
|
/**
|
|
11
8
|
* Reuseable hook to detect clicks outside of a ref element that is passed as an argument
|
|
@@ -70,6 +67,13 @@ interface UseFilePickerOptions {
|
|
|
70
67
|
* Default: *
|
|
71
68
|
* */
|
|
72
69
|
accept?: string;
|
|
70
|
+
/** Nothing can be picked or dropped.(Default: false) */
|
|
71
|
+
disabled?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Whether more than one file may be held. `false` keeps one, whether it was browsed to
|
|
74
|
+
* or dropped in.(Default: true)
|
|
75
|
+
* */
|
|
76
|
+
multiple?: boolean;
|
|
73
77
|
/**
|
|
74
78
|
* Function to transform files before returning them
|
|
75
79
|
* */
|
|
@@ -83,8 +87,10 @@ interface UseFilePickerOptions {
|
|
|
83
87
|
* */
|
|
84
88
|
keepOldFiles?: boolean;
|
|
85
89
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
90
|
+
* Drop a file that is already held, or that arrived twice in the same batch — a folder
|
|
91
|
+
* and a subfolder that both contain it, say.
|
|
92
|
+
*
|
|
93
|
+
* Compared by size first, then by sampling the start, middle and end of the file.
|
|
88
94
|
*
|
|
89
95
|
* Default: false
|
|
90
96
|
* */
|
|
@@ -236,6 +242,17 @@ declare const usePreventDefault: () => {
|
|
|
236
242
|
* */
|
|
237
243
|
declare const useEscListener: (callback?: () => void) => void;
|
|
238
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Stops the page behind an overlay from scrolling, without the sideways jump that
|
|
247
|
+
* hiding the scrollbar normally causes.
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```tsx
|
|
251
|
+
* useScrollLock(open);
|
|
252
|
+
* ```
|
|
253
|
+
* */
|
|
254
|
+
declare const useScrollLock: (enabled: boolean) => void;
|
|
255
|
+
|
|
239
256
|
interface RHFBaseProps {
|
|
240
257
|
/**
|
|
241
258
|
* Name of the input field.(required)
|
|
@@ -260,45 +277,36 @@ interface RHFRenderArgs<T extends FieldValues> {
|
|
|
260
277
|
|
|
261
278
|
interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type"> {
|
|
262
279
|
/**
|
|
263
|
-
* If true, the checkbox
|
|
280
|
+
* If true, the checkbox shows the IndeterminateIcon instead of the check icon.
|
|
264
281
|
* */
|
|
265
|
-
|
|
282
|
+
indeterminate?: boolean;
|
|
266
283
|
}
|
|
267
284
|
|
|
268
285
|
/**
|
|
269
|
-
* A customizable checkbox component with support for indeterminate state.
|
|
286
|
+
* A customizable checkbox component with support for the indeterminate state.
|
|
270
287
|
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
288
|
+
* `indeterminate` mirrors the native DOM property: it is purely visual and independent
|
|
289
|
+
* of `checked`, so a "select all" box with only some rows selected stays unchecked while
|
|
290
|
+
* showing the dash. Clicking it still reports `checked` as usual.
|
|
274
291
|
*
|
|
275
292
|
* @example
|
|
276
293
|
* ```tsx
|
|
277
294
|
* // Basic usage
|
|
278
295
|
* const [checked, setChecked] = useState(false);
|
|
279
|
-
* <Checkbox
|
|
280
|
-
* checked={checked}
|
|
281
|
-
* onChange={(e) => setChecked(e.target.checked)}
|
|
282
|
-
* />
|
|
296
|
+
* <Checkbox checked={checked} onChange={(e) => setChecked(e.target.checked)} />
|
|
283
297
|
*
|
|
284
|
-
* //
|
|
298
|
+
* // Select all: unchecked while only some rows are selected
|
|
285
299
|
* <Checkbox
|
|
286
|
-
* checked={
|
|
287
|
-
*
|
|
300
|
+
* checked={allSelected}
|
|
301
|
+
* indeterminate={someSelected && !allSelected}
|
|
288
302
|
* onChange={handleSelectAll}
|
|
289
303
|
* />
|
|
290
304
|
*
|
|
291
305
|
* // With label
|
|
292
306
|
* <label className="flex items-center gap-2">
|
|
293
|
-
* <Checkbox
|
|
294
|
-
* checked={agreed}
|
|
295
|
-
* onChange={(e) => setAgreed(e.target.checked)}
|
|
296
|
-
* />
|
|
307
|
+
* <Checkbox checked={agreed} onChange={(e) => setAgreed(e.target.checked)} />
|
|
297
308
|
* <span>I agree to the terms</span>
|
|
298
309
|
* </label>
|
|
299
|
-
*
|
|
300
|
-
* // Disabled state
|
|
301
|
-
* <Checkbox checked disabled />
|
|
302
310
|
* ```
|
|
303
311
|
*/
|
|
304
312
|
declare const Checkbox: react.ForwardRefExoticComponent<CheckboxProps & react.RefAttributes<HTMLInputElement>>;
|
|
@@ -309,10 +317,14 @@ interface CounterInputSizeMap {
|
|
|
309
317
|
lg: unknown;
|
|
310
318
|
}
|
|
311
319
|
interface CounterInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "onChange"> {
|
|
312
|
-
/**
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
320
|
+
/**
|
|
321
|
+
* Current value, held as a string so a half-typed value like "2." is not
|
|
322
|
+
* collapsed to "2" while the user is still typing. Convert with `Number(value)`
|
|
323
|
+
* when you need a number.
|
|
324
|
+
* */
|
|
325
|
+
value: string;
|
|
326
|
+
/** Callback when the value changes. Receives the sanitised string. */
|
|
327
|
+
onChange: (value: string) => void;
|
|
316
328
|
/** Minimum allowed value */
|
|
317
329
|
min?: number;
|
|
318
330
|
/** Maximum allowed value */
|
|
@@ -326,20 +338,37 @@ interface CounterInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
|
|
|
326
338
|
/** Read-only mode - buttons and input are non-interactive */
|
|
327
339
|
readOnly?: boolean;
|
|
328
340
|
/** Allow typing in input field (default: false) */
|
|
329
|
-
|
|
341
|
+
allowTyping?: boolean;
|
|
330
342
|
/** Class name for the input element */
|
|
331
343
|
inputClassName?: string;
|
|
332
344
|
/** Class name for the buttons */
|
|
333
345
|
buttonClassName?: string;
|
|
346
|
+
/**
|
|
347
|
+
* Drop leading zeros and normalise the whole part (default: true)
|
|
348
|
+
* */
|
|
349
|
+
strict?: boolean;
|
|
350
|
+
/** Reject a leading minus sign (default: false) */
|
|
351
|
+
positiveOnly?: boolean;
|
|
352
|
+
/** Digits kept after the decimal point. `0` makes the field integer only. */
|
|
353
|
+
maxFractionDigits?: number;
|
|
354
|
+
/** Digits kept before the decimal point */
|
|
355
|
+
maxWholeDigitPlaces?: number;
|
|
334
356
|
}
|
|
335
357
|
|
|
336
358
|
/**
|
|
337
359
|
* A numeric input component with increment/decrement buttons.
|
|
338
360
|
*
|
|
361
|
+
* The value is a string, not a number, so a half-typed value like "2." survives
|
|
362
|
+
* until the field is left. Converting on every keystroke would collapse it to
|
|
363
|
+
* "2" and delete the decimal point as the user types.
|
|
364
|
+
*
|
|
339
365
|
* @example
|
|
340
366
|
* ```tsx
|
|
341
|
-
* const [count, setCount] = useState(0);
|
|
367
|
+
* const [count, setCount] = useState("0");
|
|
342
368
|
* <CounterInput value={count} onChange={setCount} min={0} max={10} />
|
|
369
|
+
*
|
|
370
|
+
* // Read it back as a number when you need one
|
|
371
|
+
* const quantity = Number(count || 0);
|
|
343
372
|
* ```
|
|
344
373
|
*/
|
|
345
374
|
declare const CounterInput: react.ForwardRefExoticComponent<CounterInputProps & react.RefAttributes<HTMLInputElement>>;
|
|
@@ -358,7 +387,11 @@ interface BaseDateInputProps {
|
|
|
358
387
|
readOnly?: boolean;
|
|
359
388
|
prefix?: FC | ReactNode;
|
|
360
389
|
suffix?: FC | ReactNode;
|
|
361
|
-
|
|
390
|
+
/**
|
|
391
|
+
* Marks the field invalid, to a screen reader and in its colours. The field also marks
|
|
392
|
+
* itself when the date typed cannot exist, such as the 31st of February.
|
|
393
|
+
* */
|
|
394
|
+
"aria-invalid"?: boolean | "true" | "false";
|
|
362
395
|
className?: string;
|
|
363
396
|
format?: DateFormat$2;
|
|
364
397
|
separator?: string;
|
|
@@ -377,6 +410,12 @@ interface DateInputProps extends Omit<BaseDateInputProps, "hasFocus" | "renderCa
|
|
|
377
410
|
* @default false
|
|
378
411
|
*/
|
|
379
412
|
hideCalendar?: boolean;
|
|
413
|
+
/**
|
|
414
|
+
* Always render six weeks in the calendar, so the popup keeps the same height as you
|
|
415
|
+
* page between months. A month otherwise takes the 4 to 6 weeks it needs.
|
|
416
|
+
* @default false
|
|
417
|
+
*/
|
|
418
|
+
fixedWeeks?: boolean;
|
|
380
419
|
/**
|
|
381
420
|
* Additional CSS class name for the wrapper div that contains input field and calendar
|
|
382
421
|
*/
|
|
@@ -425,7 +464,7 @@ interface DateInputProps extends Omit<BaseDateInputProps, "hasFocus" | "renderCa
|
|
|
425
464
|
* <DateInput
|
|
426
465
|
* value={birthDate}
|
|
427
466
|
* onChange={handleDateChange}
|
|
428
|
-
*
|
|
467
|
+
* aria-invalid={error}
|
|
429
468
|
* placeholder="Enter your birth date"
|
|
430
469
|
* format="DD/MM/YYYY"
|
|
431
470
|
* separator="/"
|
|
@@ -468,7 +507,7 @@ interface DateInputProps extends Omit<BaseDateInputProps, "hasFocus" | "renderCa
|
|
|
468
507
|
* value={endDate}
|
|
469
508
|
* onChange={setEndDate}
|
|
470
509
|
* placeholder="End date"
|
|
471
|
-
*
|
|
510
|
+
* aria-invalid={endDate < startDate}
|
|
472
511
|
* hideCalendarIcon
|
|
473
512
|
* />
|
|
474
513
|
* </div>
|
|
@@ -540,6 +579,13 @@ interface BaseCalendarProps {
|
|
|
540
579
|
* Use this to customize the appearance of individual day cells
|
|
541
580
|
* */
|
|
542
581
|
renderDayCell?: (props: DayCellRenderProps) => ReactNode;
|
|
582
|
+
/**
|
|
583
|
+
* Always render six weeks, so the calendar keeps the same height as you page
|
|
584
|
+
* between months. A month otherwise takes the 4 to 6 weeks it needs, which means
|
|
585
|
+
* the container resizes as you navigate.
|
|
586
|
+
* @default false
|
|
587
|
+
* */
|
|
588
|
+
fixedWeeks?: boolean;
|
|
543
589
|
}
|
|
544
590
|
interface CalendarSingleModeProps extends BaseCalendarProps {
|
|
545
591
|
/**
|
|
@@ -610,7 +656,11 @@ interface BaseDateRangeInputProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
610
656
|
readOnly?: boolean;
|
|
611
657
|
prefix?: FC | ReactNode;
|
|
612
658
|
suffix?: FC | ReactNode;
|
|
613
|
-
|
|
659
|
+
/**
|
|
660
|
+
* Marks the field invalid, to a screen reader and in its colours. The field also marks
|
|
661
|
+
* itself when the date typed cannot exist, such as the 31st of February.
|
|
662
|
+
* */
|
|
663
|
+
"aria-invalid"?: boolean | "true" | "false";
|
|
614
664
|
className?: string;
|
|
615
665
|
format?: DateFormat;
|
|
616
666
|
separator?: string;
|
|
@@ -623,10 +673,14 @@ interface BaseDateRangeInputProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
623
673
|
hasFocus?: boolean;
|
|
624
674
|
}
|
|
625
675
|
|
|
626
|
-
declare const BaseDateRangeInput: FC<BaseDateRangeInputProps>;
|
|
627
|
-
|
|
628
676
|
interface DateRangeInputProps extends Omit<BaseDateRangeInputProps, "hasFocus" | "renderCalendarIcon"> {
|
|
629
677
|
hideCalendar?: boolean;
|
|
678
|
+
/**
|
|
679
|
+
* Always render six weeks in the calendar, so the popup keeps the same height as you
|
|
680
|
+
* page between months. A month otherwise takes the 4 to 6 weeks it needs.
|
|
681
|
+
* @default false
|
|
682
|
+
*/
|
|
683
|
+
fixedWeeks?: boolean;
|
|
630
684
|
wrapperClassName?: string;
|
|
631
685
|
calendarClassName?: string;
|
|
632
686
|
calendarPlacement?: Placement;
|
|
@@ -956,7 +1010,7 @@ interface LoadingButtonProps extends ButtonProps {
|
|
|
956
1010
|
*/
|
|
957
1011
|
declare const LoadingButton: FC<LoadingButtonProps>;
|
|
958
1012
|
|
|
959
|
-
interface RHFCheckboxProps extends RHFBaseProps, Omit<CheckboxProps, "name" | "value" | "onChange" | "
|
|
1013
|
+
interface RHFCheckboxProps extends RHFBaseProps, Omit<CheckboxProps, "name" | "value" | "onChange" | "onBlur" | "indeterminate"> {
|
|
960
1014
|
/**
|
|
961
1015
|
* Label that will be displayed next to the checkbox
|
|
962
1016
|
* */
|
|
@@ -1000,19 +1054,24 @@ interface RHFCheckboxProps extends RHFBaseProps, Omit<CheckboxProps, "name" | "v
|
|
|
1000
1054
|
* <RHFCheckbox
|
|
1001
1055
|
* name="checkbox"
|
|
1002
1056
|
* value="js"
|
|
1003
|
-
*
|
|
1057
|
+
* indeterminate={({ field }) => field.value.length !== 2}
|
|
1004
1058
|
* label="JavaScript"
|
|
1005
1059
|
* />
|
|
1006
1060
|
* <RHFCheckbox
|
|
1007
1061
|
* name="checkbox"
|
|
1008
1062
|
* value="ts"
|
|
1009
|
-
*
|
|
1063
|
+
* indeterminate={({ field }) => field.value.length !== 2}
|
|
1010
1064
|
* label="TypeScript"
|
|
1011
1065
|
* />
|
|
1012
1066
|
* </>
|
|
1013
1067
|
* ```
|
|
1014
1068
|
* */
|
|
1015
|
-
|
|
1069
|
+
indeterminate?: boolean | ((args: RHFRenderArgs<Record<string, unknown>>) => boolean);
|
|
1070
|
+
/**
|
|
1071
|
+
* Callback fired when the field is blurred
|
|
1072
|
+
* Called alongside React Hook Form's onBlur
|
|
1073
|
+
* */
|
|
1074
|
+
onBlur?: () => void;
|
|
1016
1075
|
}
|
|
1017
1076
|
|
|
1018
1077
|
/**
|
|
@@ -1055,7 +1114,7 @@ interface RHFCheckboxProps extends RHFBaseProps, Omit<CheckboxProps, "name" | "v
|
|
|
1055
1114
|
* <RHFCheckbox
|
|
1056
1115
|
* name="languages"
|
|
1057
1116
|
* value="js"
|
|
1058
|
-
*
|
|
1117
|
+
* indeterminate={({ field }) => field.value.length !== 2}
|
|
1059
1118
|
* label="JavaScript"
|
|
1060
1119
|
* />
|
|
1061
1120
|
*
|
|
@@ -1071,7 +1130,7 @@ interface RHFCheckboxProps extends RHFBaseProps, Omit<CheckboxProps, "name" | "v
|
|
|
1071
1130
|
declare const RHFCheckbox: FC<RHFCheckboxProps>;
|
|
1072
1131
|
|
|
1073
1132
|
interface RHFCounterInputProps extends RHFBaseProps, Omit<CounterInputProps, "name" | "value" | "onChange"> {
|
|
1074
|
-
onChange?: (value:
|
|
1133
|
+
onChange?: (value: string) => void;
|
|
1075
1134
|
}
|
|
1076
1135
|
|
|
1077
1136
|
/**
|
|
@@ -1445,46 +1504,35 @@ interface RHFCurrencyInputProps extends Omit<RHFNumberInputProps, "strict"> {
|
|
|
1445
1504
|
*/
|
|
1446
1505
|
declare const RHFCurrencyInput: FC<RHFCurrencyInputProps>;
|
|
1447
1506
|
|
|
1448
|
-
interface TextareaProps extends
|
|
1507
|
+
interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
1449
1508
|
/**
|
|
1450
|
-
*
|
|
1509
|
+
* Grow to fit what is typed, between `rows` and `maxRows`.
|
|
1451
1510
|
* @default false
|
|
1452
1511
|
* */
|
|
1453
1512
|
autoResize?: boolean;
|
|
1513
|
+
/** The height it starts at, and the shortest it gets while growing. @default 2 */
|
|
1514
|
+
rows?: number;
|
|
1515
|
+
/** How tall it may grow. Past it the textarea scrolls. `autoResize` only. */
|
|
1516
|
+
maxRows?: number;
|
|
1454
1517
|
}
|
|
1455
1518
|
|
|
1456
1519
|
/**
|
|
1457
|
-
* A textarea
|
|
1520
|
+
* A textarea, optionally growing to fit what is typed.
|
|
1458
1521
|
*
|
|
1459
|
-
*
|
|
1460
|
-
*
|
|
1461
|
-
* of rows displayed.
|
|
1522
|
+
* Without `autoResize` it is a plain textarea: `rows` sets the height, CSS can change it,
|
|
1523
|
+
* and the user can drag it.
|
|
1462
1524
|
*
|
|
1463
1525
|
* @example
|
|
1464
1526
|
* ```tsx
|
|
1465
|
-
* // Basic usage
|
|
1466
1527
|
* <Textarea placeholder="Type something..." />
|
|
1528
|
+
* <Textarea rows={5} placeholder="Five rows tall" />
|
|
1529
|
+
* ```
|
|
1467
1530
|
*
|
|
1468
|
-
*
|
|
1469
|
-
*
|
|
1470
|
-
*
|
|
1471
|
-
* // With row constraints
|
|
1472
|
-
* <Textarea rows={3} placeholder="Minimum 3 rows" />
|
|
1473
|
-
*
|
|
1474
|
-
* // Auto-resize with max rows
|
|
1475
|
-
* <Textarea
|
|
1476
|
-
* autoResize
|
|
1477
|
-
* rows={2}
|
|
1478
|
-
* maxRows={10}
|
|
1479
|
-
* placeholder="Grows from 2 to 10 rows"
|
|
1480
|
-
* />
|
|
1531
|
+
* @example
|
|
1532
|
+
* Growing from two rows to ten, then scrolling:
|
|
1481
1533
|
*
|
|
1482
|
-
*
|
|
1483
|
-
* <Textarea
|
|
1484
|
-
* value={text}
|
|
1485
|
-
* onChange={(e) => setText(e.target.value)}
|
|
1486
|
-
* placeholder="Enter description"
|
|
1487
|
-
* />
|
|
1534
|
+
* ```tsx
|
|
1535
|
+
* <Textarea autoResize rows={2} maxRows={10} placeholder="Say something" />
|
|
1488
1536
|
* ```
|
|
1489
1537
|
*/
|
|
1490
1538
|
declare const Textarea: react.ForwardRefExoticComponent<TextareaProps & react.RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -1568,7 +1616,7 @@ interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>,
|
|
|
1568
1616
|
|
|
1569
1617
|
declare const Switch: react.ForwardRefExoticComponent<SwitchProps & react.RefAttributes<HTMLInputElement>>;
|
|
1570
1618
|
|
|
1571
|
-
interface RHFSwitchProps extends RHFBaseProps, Omit<SwitchProps, "name" | "value"> {
|
|
1619
|
+
interface RHFSwitchProps extends RHFBaseProps, Omit<SwitchProps, "name" | "value" | "onBlur"> {
|
|
1572
1620
|
/**
|
|
1573
1621
|
* Value to set in the form data when the switch is toggled
|
|
1574
1622
|
* If value is not provided, value will be toggled between true and false
|
|
@@ -1583,6 +1631,11 @@ interface RHFSwitchProps extends RHFBaseProps, Omit<SwitchProps, "name" | "value
|
|
|
1583
1631
|
* Callback fired when the value changes
|
|
1584
1632
|
* */
|
|
1585
1633
|
onChange?: (value: unknown) => void;
|
|
1634
|
+
/**
|
|
1635
|
+
* Callback fired when the field is blurred
|
|
1636
|
+
* Called alongside React Hook Form's onBlur
|
|
1637
|
+
* */
|
|
1638
|
+
onBlur?: () => void;
|
|
1586
1639
|
}
|
|
1587
1640
|
|
|
1588
1641
|
/**
|
|
@@ -1656,7 +1709,7 @@ type RadioProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type">;
|
|
|
1656
1709
|
*/
|
|
1657
1710
|
declare const Radio: react.ForwardRefExoticComponent<RadioProps & react.RefAttributes<HTMLInputElement>>;
|
|
1658
1711
|
|
|
1659
|
-
interface RHFRadioProps extends RHFBaseProps, Omit<RadioProps, "name" | "value" | "onChange"> {
|
|
1712
|
+
interface RHFRadioProps extends RHFBaseProps, Omit<RadioProps, "name" | "value" | "onChange" | "onBlur"> {
|
|
1660
1713
|
/**
|
|
1661
1714
|
* Label to display next to the radio button
|
|
1662
1715
|
* */
|
|
@@ -1675,6 +1728,11 @@ interface RHFRadioProps extends RHFBaseProps, Omit<RadioProps, "name" | "value"
|
|
|
1675
1728
|
* Callback fired when the value changes
|
|
1676
1729
|
* */
|
|
1677
1730
|
onChange?: (value: unknown) => void;
|
|
1731
|
+
/**
|
|
1732
|
+
* Callback fired when the field is blurred
|
|
1733
|
+
* Called alongside React Hook Form's onBlur
|
|
1734
|
+
* */
|
|
1735
|
+
onBlur?: () => void;
|
|
1678
1736
|
}
|
|
1679
1737
|
|
|
1680
1738
|
/**
|
|
@@ -1716,7 +1774,7 @@ interface RHFRadioProps extends RHFBaseProps, Omit<RadioProps, "name" | "value"
|
|
|
1716
1774
|
*/
|
|
1717
1775
|
declare const RHFRadio: FC<RHFRadioProps>;
|
|
1718
1776
|
|
|
1719
|
-
interface RHFDateInputProps extends RHFBaseProps,
|
|
1777
|
+
interface RHFDateInputProps extends RHFBaseProps, DateInputProps {
|
|
1720
1778
|
/**
|
|
1721
1779
|
* Whether the input is disabled
|
|
1722
1780
|
*/
|
|
@@ -1759,712 +1817,1485 @@ interface RHFDateInputProps extends RHFBaseProps, Omit<DateInputProps, "hasError
|
|
|
1759
1817
|
*/
|
|
1760
1818
|
declare const RHFDateInput: FC<RHFDateInputProps>;
|
|
1761
1819
|
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1820
|
+
interface TimeParts {
|
|
1821
|
+
/** 0 to 23, whatever the format shows. */
|
|
1822
|
+
hour: number;
|
|
1823
|
+
minute: number;
|
|
1824
|
+
second: number;
|
|
1767
1825
|
}
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
type FileWithPreview = File & {
|
|
1772
|
-
preview?: string;
|
|
1773
|
-
};
|
|
1774
|
-
interface RHFFileInputProps extends RHFBaseProps, Omit<InputHTMLAttributes<HTMLInputElement>, "multiple" | "children" | "name" | "type" | "onChange"> {
|
|
1826
|
+
type TimeFormat = "HH:mm" | "hh:mm A" | "HH:mm:ss" | "hh:mm:ss A";
|
|
1827
|
+
interface TimeInputProps {
|
|
1775
1828
|
/**
|
|
1776
|
-
*
|
|
1777
|
-
*
|
|
1778
|
-
* So if you want to style the input element, eg. placeholder, or even the input itself, use this prop.
|
|
1829
|
+
* The time, always as 24 hour `HH:mm`, or `HH:mm:ss` when the format asks for seconds.
|
|
1830
|
+
* What is on screen follows `format`; this does not.
|
|
1779
1831
|
* */
|
|
1780
|
-
|
|
1832
|
+
value?: string | null;
|
|
1781
1833
|
/**
|
|
1782
|
-
*
|
|
1783
|
-
* This is the actual value of the file input not the event object
|
|
1834
|
+
* Called with the new time, or `null` while it is incomplete or out of bounds.
|
|
1784
1835
|
* */
|
|
1785
|
-
onChange?: (
|
|
1836
|
+
onChange?: (value: string | null) => void;
|
|
1786
1837
|
/**
|
|
1787
|
-
*
|
|
1838
|
+
* Called once the last segment is filled, for moving focus on.
|
|
1788
1839
|
* */
|
|
1789
|
-
|
|
1840
|
+
onSubmit?: () => void;
|
|
1841
|
+
/**
|
|
1842
|
+
* How the time is shown. 24 or 12 hour, with or without seconds.(Default: 'HH:mm')
|
|
1843
|
+
* */
|
|
1844
|
+
format?: TimeFormat;
|
|
1845
|
+
/**
|
|
1846
|
+
* Which times cannot be chosen. Called with 24 hour numbers, whatever the format shows,
|
|
1847
|
+
* and with the segments that are not filled in yet standing at zero.
|
|
1848
|
+
*
|
|
1849
|
+
* @example
|
|
1850
|
+
* ```tsx
|
|
1851
|
+
* disabledTime={({ hour }) => hour < 9 || hour >= 17}
|
|
1852
|
+
* disabledTime={({ hour, minute }) => hour === 12 && minute < 30}
|
|
1853
|
+
* ```
|
|
1854
|
+
* */
|
|
1855
|
+
disabledTime?: (time: TimeParts) => boolean;
|
|
1856
|
+
/**
|
|
1857
|
+
* Minutes between the entries in the minute column. Every minute by default, the way the
|
|
1858
|
+
* platform's own picker lists them. Raise it for booking slots.(Default: 1)
|
|
1859
|
+
* */
|
|
1860
|
+
step?: number;
|
|
1861
|
+
disabled?: boolean;
|
|
1862
|
+
readOnly?: boolean;
|
|
1790
1863
|
/**
|
|
1791
|
-
*
|
|
1792
|
-
* You also have access to the Controller renderProps object
|
|
1793
|
-
* So that you can access the field, fieldState, and formState objects and use accordingly
|
|
1864
|
+
* Marks the field invalid, to a screen reader and in its colours.
|
|
1794
1865
|
*
|
|
1795
|
-
*
|
|
1866
|
+
* The standard attribute rather than a prop of the library's own, so it works the same
|
|
1867
|
+
* here as on a native input.
|
|
1868
|
+
* */
|
|
1869
|
+
"aria-invalid"?: boolean | "true" | "false";
|
|
1870
|
+
prefix?: FC | ReactNode;
|
|
1871
|
+
suffix?: FC | ReactNode;
|
|
1872
|
+
placeholder?: string;
|
|
1873
|
+
placeholderClassName?: string;
|
|
1874
|
+
hideClearIcon?: boolean;
|
|
1875
|
+
hideClockIcon?: boolean;
|
|
1876
|
+
className?: string;
|
|
1877
|
+
wrapperClassName?: string;
|
|
1878
|
+
listClassName?: string;
|
|
1879
|
+
/**
|
|
1880
|
+
* Where the list opens, relative to the field.(Default: 'bottom-start')
|
|
1796
1881
|
* */
|
|
1797
|
-
|
|
1882
|
+
listPlacement?: Placement;
|
|
1883
|
+
floatingStrategy?: Strategy;
|
|
1798
1884
|
}
|
|
1799
1885
|
|
|
1800
1886
|
/**
|
|
1801
|
-
*
|
|
1887
|
+
* A time field that reads like the platform's own, with a list of times behind it.
|
|
1802
1888
|
*
|
|
1803
|
-
*
|
|
1804
|
-
*
|
|
1805
|
-
* You have access to the Controller renderProps object in the `render` function
|
|
1806
|
-
* So that you can access the field, fieldState, and formState objects and use them accordingly
|
|
1889
|
+
* `value` is always 24 hour `HH:mm`, or `HH:mm:ss` when the format asks for seconds, so it
|
|
1890
|
+
* sorts and compares without being parsed. `format` decides only what is on screen.
|
|
1807
1891
|
*
|
|
1808
1892
|
* @example
|
|
1809
1893
|
* ```tsx
|
|
1810
|
-
*
|
|
1811
|
-
*
|
|
1812
|
-
* <
|
|
1813
|
-
*
|
|
1814
|
-
|
|
1815
|
-
|
|
1894
|
+
* <TimeInput value={time} onChange={setTime} />
|
|
1895
|
+
* <TimeInput value={time} onChange={setTime} format="hh:mm A" />
|
|
1896
|
+
* <TimeInput value={time} onChange={setTime} step={30} min="09:00" max="17:00" />
|
|
1897
|
+
* ```
|
|
1898
|
+
*/
|
|
1899
|
+
declare const TimeInput: FC<TimeInputProps>;
|
|
1900
|
+
|
|
1901
|
+
interface RHFTimeInputProps extends RHFBaseProps, TimeInputProps {
|
|
1902
|
+
/**
|
|
1903
|
+
* Whether the input is disabled
|
|
1904
|
+
*/
|
|
1905
|
+
disabled?: boolean;
|
|
1906
|
+
/**
|
|
1907
|
+
* Callback function when the time changes (in addition to the form field update)
|
|
1908
|
+
*/
|
|
1909
|
+
onChange?: (time: string | null) => void;
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
/**
|
|
1913
|
+
* React Hook Form wrapper for the TimeInput component.
|
|
1816
1914
|
*
|
|
1817
|
-
*
|
|
1818
|
-
*
|
|
1915
|
+
* The field holds the 24 hour value, whatever the display format is, so a resolver can
|
|
1916
|
+
* compare two times without parsing them.
|
|
1819
1917
|
*
|
|
1820
|
-
*
|
|
1821
|
-
*
|
|
1822
|
-
*
|
|
1823
|
-
*
|
|
1824
|
-
* render={({ field: { value } }) => {
|
|
1825
|
-
* return (
|
|
1826
|
-
* <div className="flex rounded overflow-hidden items-center justify-center cursor-pointer border-2 p-4 w-full border-dotted border-gray-300 h-[200px]">
|
|
1827
|
-
* {value ? (
|
|
1828
|
-
* <img
|
|
1829
|
-
* className="inline-block object-contain w-full h-full"
|
|
1830
|
-
* src={value.preview}
|
|
1831
|
-
* alt="Preview"
|
|
1832
|
-
* />
|
|
1833
|
-
* ) : (
|
|
1834
|
-
* <span>Upload File</span>
|
|
1835
|
-
* )}
|
|
1836
|
-
* </div>
|
|
1837
|
-
* );
|
|
1838
|
-
* }}
|
|
1839
|
-
* />
|
|
1918
|
+
* @example
|
|
1919
|
+
* ```tsx
|
|
1920
|
+
* <RHFTimeInput name="startsAt" />
|
|
1921
|
+
* <RHFTimeInput name="startsAt" format="hh:mm A" step={15} min="09:00" max="17:00" />
|
|
1840
1922
|
* ```
|
|
1841
1923
|
*/
|
|
1842
|
-
declare const
|
|
1924
|
+
declare const RHFTimeInput: FC<RHFTimeInputProps>;
|
|
1843
1925
|
|
|
1844
|
-
|
|
1926
|
+
/** Extensible size map - To allow module augmentation */
|
|
1927
|
+
interface SliderSizeMap {
|
|
1928
|
+
sm: unknown;
|
|
1929
|
+
md: unknown;
|
|
1930
|
+
lg: unknown;
|
|
1931
|
+
}
|
|
1932
|
+
/** Extensible color map - To allow module augmentation */
|
|
1933
|
+
interface SliderColorMap {
|
|
1934
|
+
default: unknown;
|
|
1935
|
+
primary: unknown;
|
|
1936
|
+
success: unknown;
|
|
1937
|
+
error: unknown;
|
|
1938
|
+
warning: unknown;
|
|
1939
|
+
info: unknown;
|
|
1940
|
+
}
|
|
1941
|
+
interface SliderMark {
|
|
1942
|
+
/** Where on the track it sits. Outside `min` and `max` it is dropped. */
|
|
1943
|
+
value: number;
|
|
1944
|
+
/** What it says. Leave it out for a tick with no text. */
|
|
1945
|
+
label?: ReactNode;
|
|
1946
|
+
}
|
|
1947
|
+
/** What the bubble is told about the thumb it belongs to. */
|
|
1948
|
+
interface SliderLabel {
|
|
1949
|
+
value: number;
|
|
1950
|
+
/** 0 for the only thumb, and for the lower of a range. */
|
|
1951
|
+
index: number;
|
|
1952
|
+
}
|
|
1953
|
+
/** Everything a thumb knows about itself, for drawing one yourself. */
|
|
1954
|
+
interface SliderThumb extends SliderLabel {
|
|
1955
|
+
/** How far along the track it sits, 0 to 100. */
|
|
1956
|
+
percent: number;
|
|
1957
|
+
/** Whether it is being dragged right now. */
|
|
1958
|
+
dragging: boolean;
|
|
1959
|
+
/** Whether the keyboard is on it. */
|
|
1960
|
+
focused: boolean;
|
|
1961
|
+
}
|
|
1962
|
+
interface SliderSharedProps {
|
|
1963
|
+
/** Bottom of the range.(Default: 0) */
|
|
1964
|
+
min?: number;
|
|
1965
|
+
/** Top of the range.(Default: 100) */
|
|
1966
|
+
max?: number;
|
|
1967
|
+
/** How far one move goes.(Default: 1) */
|
|
1968
|
+
step?: number;
|
|
1969
|
+
/** Ticks along the track, with a label each if you want one. */
|
|
1970
|
+
marks?: SliderMark[];
|
|
1845
1971
|
/**
|
|
1846
|
-
*
|
|
1972
|
+
* A bubble above the thumb while it is being dragged or has the focus. A function is
|
|
1973
|
+
* given the value it belongs to.
|
|
1847
1974
|
* */
|
|
1848
|
-
|
|
1975
|
+
label?: ReactNode | ((thumb: SliderLabel) => ReactNode);
|
|
1976
|
+
/** What the filled part means. Drives the accent colour.(Default: 'primary') */
|
|
1977
|
+
color?: keyof SliderColorMap;
|
|
1978
|
+
/** Track and thumb size.(Default: 'md') */
|
|
1979
|
+
size?: keyof SliderSizeMap;
|
|
1849
1980
|
/**
|
|
1850
|
-
*
|
|
1981
|
+
* Draw the thumb yourself. Everything it knows is handed over and nothing of its own is
|
|
1982
|
+
* rendered, so a labelled handle or a grip needs no working around the component.
|
|
1983
|
+
*
|
|
1984
|
+
* It is still placed on the track, still takes the drag and the keyboard, and still
|
|
1985
|
+
* carries its own `role` and `aria` — only what it looks like is yours.
|
|
1986
|
+
*
|
|
1987
|
+
* @example
|
|
1988
|
+
* ```tsx
|
|
1989
|
+
* renderThumb={({ value, dragging }) => (
|
|
1990
|
+
* <span className={dragging ? "handle handle--held" : "handle"}>{value}</span>
|
|
1991
|
+
* )}
|
|
1992
|
+
* ```
|
|
1851
1993
|
* */
|
|
1852
|
-
|
|
1994
|
+
renderThumb?: (thumb: SliderThumb) => ReactNode;
|
|
1995
|
+
disabled?: boolean;
|
|
1996
|
+
className?: string;
|
|
1997
|
+
}
|
|
1998
|
+
interface SliderProps extends SliderSharedProps {
|
|
1999
|
+
/** Where the thumb sits. */
|
|
2000
|
+
value: number;
|
|
2001
|
+
/** Called on every move, so the slider stays controlled as it is dragged. */
|
|
2002
|
+
onChange: (value: number) => void;
|
|
1853
2003
|
/**
|
|
1854
|
-
*
|
|
2004
|
+
* Called once, when the drag or key press finishes. Put the expensive work here rather
|
|
2005
|
+
* than in `onChange`, which fires all the way through a drag.
|
|
1855
2006
|
* */
|
|
1856
|
-
|
|
2007
|
+
onChangeEnd?: (value: number) => void;
|
|
2008
|
+
/** Names the thumb for a screen reader. */
|
|
2009
|
+
"aria-label"?: string;
|
|
2010
|
+
}
|
|
2011
|
+
interface RangeSliderProps extends SliderSharedProps {
|
|
2012
|
+
/** Where the two thumbs sit, lower first. */
|
|
2013
|
+
value: [number, number];
|
|
2014
|
+
/** Called on every move, so the slider stays controlled as it is dragged. */
|
|
2015
|
+
onChange: (value: [number, number]) => void;
|
|
2016
|
+
/** Called once, when the drag or key press finishes. */
|
|
2017
|
+
onChangeEnd?: (value: [number, number]) => void;
|
|
2018
|
+
/**
|
|
2019
|
+
* How close the two thumbs may get. They stop rather than swap, so the lower one stays
|
|
2020
|
+
* the lower one.(Default: 0)
|
|
2021
|
+
* */
|
|
2022
|
+
minGap?: number;
|
|
2023
|
+
/** Names each thumb for a screen reader.(Default: ['Minimum', 'Maximum']) */
|
|
2024
|
+
thumbLabels?: [string, string];
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
/**
|
|
2028
|
+
* Pick a number by dragging.
|
|
2029
|
+
*
|
|
2030
|
+
* `onChange` fires all the way through a drag so the slider stays controlled; put anything
|
|
2031
|
+
* expensive in `onChangeEnd`, which fires once when it is let go.
|
|
2032
|
+
*
|
|
2033
|
+
* @example
|
|
2034
|
+
* ```tsx
|
|
2035
|
+
* <Slider value={volume} onChange={setVolume} />
|
|
2036
|
+
* <Slider value={volume} onChange={setVolume} onChangeEnd={save} step={5} />
|
|
2037
|
+
* <Slider value={volume} onChange={setVolume} label={({ value }) => `${value}%`} />
|
|
2038
|
+
* <Slider
|
|
2039
|
+
* value={volume}
|
|
2040
|
+
* onChange={setVolume}
|
|
2041
|
+
* marks={[{ value: 0, label: "Off" }, { value: 100, label: "Max" }]}
|
|
2042
|
+
* />
|
|
2043
|
+
* ```
|
|
2044
|
+
*/
|
|
2045
|
+
declare const Slider: FC<SliderProps>;
|
|
2046
|
+
|
|
2047
|
+
/**
|
|
2048
|
+
* Pick a span by dragging either end.
|
|
2049
|
+
*
|
|
2050
|
+
* The thumbs stop at each other rather than swapping, so the lower one stays the lower one
|
|
2051
|
+
* and `value` is always in order.
|
|
2052
|
+
*
|
|
2053
|
+
* @example
|
|
2054
|
+
* ```tsx
|
|
2055
|
+
* <RangeSlider value={price} onChange={setPrice} />
|
|
2056
|
+
* <RangeSlider value={price} onChange={setPrice} minGap={10} onChangeEnd={search} />
|
|
2057
|
+
* <RangeSlider value={price} onChange={setPrice} label={({ value }) => `£${value}`} />
|
|
2058
|
+
* ```
|
|
2059
|
+
*/
|
|
2060
|
+
declare const RangeSlider: FC<RangeSliderProps>;
|
|
2061
|
+
|
|
2062
|
+
interface RHFSliderProps extends RHFBaseProps, Omit<SliderProps, "value" | "onChange"> {
|
|
2063
|
+
/** Where the thumb starts when the form has nothing for it.(Default: `min`) */
|
|
2064
|
+
defaultValue?: number;
|
|
2065
|
+
/** Called alongside the form update, on every move. */
|
|
2066
|
+
onChange?: (value: number) => void;
|
|
2067
|
+
}
|
|
2068
|
+
interface RHFRangeSliderProps extends RHFBaseProps, Omit<RangeSliderProps, "value" | "onChange"> {
|
|
2069
|
+
/** Where the thumbs start when the form has nothing for them.(Default: `[min, max]`) */
|
|
2070
|
+
defaultValue?: [number, number];
|
|
2071
|
+
/** Called alongside the form update, on every move. */
|
|
2072
|
+
onChange?: (value: [number, number]) => void;
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
/**
|
|
2076
|
+
* React Hook Form wrapper for the Slider component.
|
|
2077
|
+
*
|
|
2078
|
+
* The field holds a number. `onChange` fires all the way through a drag, so put anything
|
|
2079
|
+
* expensive in `onChangeEnd`.
|
|
2080
|
+
*
|
|
2081
|
+
* @example
|
|
2082
|
+
* ```tsx
|
|
2083
|
+
* <RHFSlider name="volume" />
|
|
2084
|
+
* <RHFSlider name="volume" min={0} max={11} step={1} label={({ value }) => value} />
|
|
2085
|
+
* ```
|
|
2086
|
+
*/
|
|
2087
|
+
declare const RHFSlider: FC<RHFSliderProps>;
|
|
2088
|
+
|
|
2089
|
+
interface TagInputTag {
|
|
2090
|
+
/** The tag itself, as it sits in `value`. */
|
|
2091
|
+
value: string;
|
|
2092
|
+
/** Where it is in `value`. */
|
|
2093
|
+
index: number;
|
|
2094
|
+
/** Takes it out. */
|
|
2095
|
+
remove: () => void;
|
|
2096
|
+
}
|
|
2097
|
+
interface TagInputProps extends PropsWithChildren {
|
|
2098
|
+
/** The tags, in the order they were added. */
|
|
2099
|
+
value: string[];
|
|
2100
|
+
/** Called with the new list whenever one is added or taken out. */
|
|
2101
|
+
onChange: (value: string[]) => void;
|
|
1857
2102
|
/**
|
|
1858
|
-
*
|
|
1859
|
-
*
|
|
2103
|
+
* Called with whatever was turned away, so a paste that drops half its addresses can say
|
|
2104
|
+
* so rather than swallowing them. A tag is turned away when it is a duplicate, when
|
|
2105
|
+
* `max` is reached, or when `validate` says no.
|
|
1860
2106
|
* */
|
|
1861
|
-
|
|
2107
|
+
onReject?: (tags: string[]) => void;
|
|
1862
2108
|
/**
|
|
1863
|
-
*
|
|
2109
|
+
* Whether a tag is allowed. A tag it turns down is not added, and stays in the field so
|
|
2110
|
+
* it can be corrected.
|
|
1864
2111
|
* */
|
|
1865
|
-
|
|
2112
|
+
validate?: (tag: string) => boolean;
|
|
1866
2113
|
/**
|
|
1867
|
-
*
|
|
2114
|
+
* Keys that finish a tag, alongside the text they split a paste on.(Default: ['Enter', ','])
|
|
1868
2115
|
* */
|
|
1869
|
-
|
|
2116
|
+
separators?: string[];
|
|
1870
2117
|
/**
|
|
1871
|
-
*
|
|
2118
|
+
* Take the spelling from the options when what was typed matches one but for its case or
|
|
2119
|
+
* spacing, so `vue` becomes `Vue` and `united state` becomes `United State`. Anything
|
|
2120
|
+
* that matches no option is added exactly as typed.(Default: true)
|
|
1872
2121
|
* */
|
|
1873
|
-
|
|
2122
|
+
preferOption?: boolean;
|
|
1874
2123
|
/**
|
|
1875
|
-
*
|
|
1876
|
-
*
|
|
2124
|
+
* How many tags there may be. Once it is reached the list stays away, anything further
|
|
2125
|
+
* goes to `onReject`, and the field carries `data-full` for the styles to key off.
|
|
1877
2126
|
* */
|
|
1878
|
-
|
|
2127
|
+
max?: number;
|
|
2128
|
+
/** Let the same tag be added twice.(Default: false) */
|
|
2129
|
+
allowDuplicates?: boolean;
|
|
2130
|
+
/** Finish the tag being typed when the field loses focus.(Default: true) */
|
|
2131
|
+
addOnBlur?: boolean;
|
|
2132
|
+
/** Draw each tag yourself. */
|
|
2133
|
+
renderTag?: (tag: TagInputTag) => ReactNode;
|
|
2134
|
+
placeholder?: string;
|
|
2135
|
+
/** Extra class for the placeholder text. */
|
|
2136
|
+
placeholderClassName?: string;
|
|
2137
|
+
disabled?: boolean;
|
|
2138
|
+
readOnly?: boolean;
|
|
1879
2139
|
/**
|
|
1880
|
-
*
|
|
2140
|
+
* Marks the field invalid, to a screen reader and in its colours.
|
|
2141
|
+
*
|
|
2142
|
+
* This is the standard attribute rather than a prop of the library's own, so it works the
|
|
2143
|
+
* same here as on a native input.
|
|
1881
2144
|
* */
|
|
1882
|
-
|
|
2145
|
+
"aria-invalid"?: boolean | "true" | "false";
|
|
2146
|
+
prefix?: FC | ReactNode;
|
|
2147
|
+
suffix?: FC | ReactNode;
|
|
2148
|
+
className?: string;
|
|
2149
|
+
wrapperClassName?: string;
|
|
2150
|
+
menuClassName?: string;
|
|
2151
|
+
/** Where the list of options opens.(Default: 'bottom-start') */
|
|
2152
|
+
menuPlacement?: Placement;
|
|
2153
|
+
floatingStrategy?: Strategy;
|
|
2154
|
+
}
|
|
2155
|
+
interface TagInputOptionProps extends PropsWithChildren {
|
|
2156
|
+
/** What gets added when it is picked. */
|
|
2157
|
+
value: string;
|
|
1883
2158
|
/**
|
|
1884
|
-
*
|
|
2159
|
+
* What it is matched against while typing. Falls back to `value` when the children are
|
|
2160
|
+
* not plain text.
|
|
1885
2161
|
* */
|
|
2162
|
+
label?: string;
|
|
2163
|
+
/** Cannot be picked. */
|
|
1886
2164
|
disabled?: boolean;
|
|
2165
|
+
className?: string;
|
|
1887
2166
|
}
|
|
1888
2167
|
|
|
1889
2168
|
/**
|
|
1890
|
-
*
|
|
1891
|
-
*
|
|
1892
|
-
* Supports both numeric-only mode (default) and alphanumeric input.
|
|
2169
|
+
* A field that turns what you type into tags, with a list of the ones you already have to
|
|
2170
|
+
* hand.
|
|
1893
2171
|
*
|
|
1894
|
-
*
|
|
1895
|
-
*
|
|
2172
|
+
* Options are declared as children, the way they are for `Select`, and filter as you type.
|
|
2173
|
+
* Anything that is not an option can still be typed in, which is what separates this from
|
|
2174
|
+
* a multi `Select`.
|
|
1896
2175
|
*
|
|
2176
|
+
* @example
|
|
1897
2177
|
* ```tsx
|
|
1898
|
-
*
|
|
1899
|
-
*
|
|
1900
|
-
*
|
|
1901
|
-
*
|
|
1902
|
-
* onChange={setVerificationCode}
|
|
1903
|
-
* length={6}
|
|
1904
|
-
* numberOnly
|
|
1905
|
-
* onOTPComplete={async (code) => {
|
|
1906
|
-
* await verifyTwoFactorCode(code);
|
|
1907
|
-
* }}
|
|
1908
|
-
* />
|
|
2178
|
+
* <TagInput value={tags} onChange={setTags} placeholder="Add a tag">
|
|
2179
|
+
* <TagInputOption value="react">React</TagInputOption>
|
|
2180
|
+
* <TagInputOption value="vue">Vue</TagInputOption>
|
|
2181
|
+
* </TagInput>
|
|
1909
2182
|
* ```
|
|
1910
2183
|
*
|
|
1911
2184
|
* @example
|
|
1912
|
-
*
|
|
2185
|
+
* Emails, where a tag has to look like one:
|
|
1913
2186
|
*
|
|
1914
2187
|
* ```tsx
|
|
1915
|
-
* <
|
|
1916
|
-
* value={
|
|
1917
|
-
* onChange={
|
|
1918
|
-
*
|
|
1919
|
-
*
|
|
1920
|
-
* className="gap-2"
|
|
1921
|
-
* inputClassName="border-2 rounded-md"
|
|
2188
|
+
* <TagInput
|
|
2189
|
+
* value={emails}
|
|
2190
|
+
* onChange={setEmails}
|
|
2191
|
+
* validate={(tag) => tag.includes("@")}
|
|
2192
|
+
* onReject={(tags) => toast.error(`${tags.length} were not addresses`)}
|
|
1922
2193
|
* />
|
|
1923
2194
|
* ```
|
|
2195
|
+
*/
|
|
2196
|
+
declare const TagInput: {
|
|
2197
|
+
({ value, onChange, onReject, validate, separators, preferOption, max, allowDuplicates, addOnBlur, renderTag, placeholder, placeholderClassName, disabled, readOnly, prefix, suffix, className, wrapperClassName, menuClassName, menuPlacement, floatingStrategy, children, "aria-invalid": invalid }: TagInputProps): react_jsx_runtime.JSX.Element;
|
|
2198
|
+
displayName: string;
|
|
2199
|
+
};
|
|
2200
|
+
|
|
2201
|
+
/**
|
|
2202
|
+
* One suggestion in a `TagInput`.
|
|
2203
|
+
*
|
|
2204
|
+
* Declared as a child of `TagInput`, the way `SelectOption` is for `Select`. An option
|
|
2205
|
+
* already added drops out of the list, because the chip in the field is where it is now.
|
|
1924
2206
|
*
|
|
1925
2207
|
* @example
|
|
1926
|
-
*
|
|
2208
|
+
* ```tsx
|
|
2209
|
+
* <TagInputOption value="react">React</TagInputOption>
|
|
2210
|
+
* ```
|
|
2211
|
+
*/
|
|
2212
|
+
declare const TagInputOption: {
|
|
2213
|
+
({ value, disabled, className, children }: TagInputOptionProps): react_jsx_runtime.JSX.Element;
|
|
2214
|
+
displayName: string;
|
|
2215
|
+
};
|
|
2216
|
+
|
|
2217
|
+
interface TagInputContextValue {
|
|
2218
|
+
/** The option the keyboard is on, by its value. */
|
|
2219
|
+
focused: string | null;
|
|
2220
|
+
setFocused: (value: string | null) => void;
|
|
2221
|
+
/** Adds the option as a tag and puts the focus back in the field. */
|
|
2222
|
+
pick: (tag: string) => void;
|
|
2223
|
+
}
|
|
2224
|
+
declare const useTagInput: () => TagInputContextValue;
|
|
2225
|
+
|
|
2226
|
+
interface RHFTagInputProps extends RHFBaseProps, Omit<TagInputProps, "value" | "onChange"> {
|
|
2227
|
+
/** Called alongside the form update. */
|
|
2228
|
+
onChange?: (value: string[]) => void;
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
/**
|
|
2232
|
+
* React Hook Form wrapper for the TagInput component.
|
|
1927
2233
|
*
|
|
2234
|
+
* The field holds a `string[]`. A field the form has nothing for reads as an empty list, so
|
|
2235
|
+
* the input never has to guard against it.
|
|
2236
|
+
*
|
|
2237
|
+
* @example
|
|
1928
2238
|
* ```tsx
|
|
1929
|
-
* <
|
|
1930
|
-
*
|
|
1931
|
-
* onChange={setSmsCode}
|
|
1932
|
-
* length={4}
|
|
1933
|
-
* aspectRatio={1}
|
|
1934
|
-
* onOTPComplete={(code) => submitVerification(code)}
|
|
1935
|
-
* disabled={isVerifying}
|
|
1936
|
-
* />
|
|
2239
|
+
* <RHFTagInput name="tags" rules={{ required: "Add at least one tag" }} />
|
|
2240
|
+
* <RHFTagInput name="emails" validate={(tag) => tag.includes("@")} />
|
|
1937
2241
|
* ```
|
|
1938
2242
|
*/
|
|
1939
|
-
declare const
|
|
2243
|
+
declare const RHFTagInput: FC<RHFTagInputProps>;
|
|
1940
2244
|
|
|
1941
|
-
|
|
2245
|
+
/** Extensible size map - To allow module augmentation */
|
|
2246
|
+
interface RatingSizeMap {
|
|
2247
|
+
sm: unknown;
|
|
2248
|
+
md: unknown;
|
|
2249
|
+
lg: unknown;
|
|
2250
|
+
}
|
|
2251
|
+
/** Extensible color map - To allow module augmentation */
|
|
2252
|
+
interface RatingColorMap {
|
|
2253
|
+
gold: unknown;
|
|
2254
|
+
default: unknown;
|
|
2255
|
+
primary: unknown;
|
|
2256
|
+
success: unknown;
|
|
2257
|
+
error: unknown;
|
|
2258
|
+
warning: unknown;
|
|
2259
|
+
info: unknown;
|
|
2260
|
+
}
|
|
2261
|
+
interface RatingProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
1942
2262
|
/**
|
|
1943
|
-
*
|
|
1944
|
-
*
|
|
2263
|
+
* How many are filled. Any fraction is drawn exactly, whether it can be picked or not, so
|
|
2264
|
+
* an average of 4.3 reads as 4.3.
|
|
1945
2265
|
* */
|
|
1946
|
-
|
|
2266
|
+
value: number;
|
|
2267
|
+
/** Called with the new rating, or `0` when the current one is picked again. */
|
|
2268
|
+
onChange?: (value: number) => void;
|
|
2269
|
+
/** How many icons there are.(Default: 5) */
|
|
2270
|
+
max?: number;
|
|
1947
2271
|
/**
|
|
1948
|
-
*
|
|
1949
|
-
*
|
|
2272
|
+
* What a click lands on, as a fraction of one icon: `1` for whole ones, `0.5` for halves.
|
|
2273
|
+
* Only what can be picked, never what is drawn.(Default: 1)
|
|
1950
2274
|
* */
|
|
1951
|
-
|
|
2275
|
+
precision?: number;
|
|
2276
|
+
/**
|
|
2277
|
+
* Whether picking the current rating again sets it back to zero. Without it there is no
|
|
2278
|
+
* way to undo a mis-click with a mouse.(Default: true)
|
|
2279
|
+
* */
|
|
2280
|
+
clearable?: boolean;
|
|
2281
|
+
/** Shown rather than picked. Any fraction is drawn exactly. */
|
|
2282
|
+
readOnly?: boolean;
|
|
2283
|
+
disabled?: boolean;
|
|
2284
|
+
/** The icon. A star when it is left out. */
|
|
2285
|
+
icon?: ReactNode;
|
|
2286
|
+
/** A different icon for the empty part. Falls back to `icon`. */
|
|
2287
|
+
emptyIcon?: ReactNode;
|
|
2288
|
+
/**
|
|
2289
|
+
* What each one is called, for a screen reader.(Default: '1 of 5' and so on)
|
|
2290
|
+
* */
|
|
2291
|
+
getLabel?: (value: number) => string;
|
|
2292
|
+
/** What the whole thing is called. */
|
|
2293
|
+
"aria-label"?: string;
|
|
2294
|
+
/** Ties the radios together. One is made from `name` or generated when left out. */
|
|
2295
|
+
name?: string;
|
|
2296
|
+
/** What colour the filled part is.(Default: 'gold') */
|
|
2297
|
+
color?: keyof RatingColorMap;
|
|
2298
|
+
size?: keyof RatingSizeMap;
|
|
2299
|
+
className?: string;
|
|
1952
2300
|
}
|
|
1953
2301
|
|
|
1954
2302
|
/**
|
|
1955
|
-
*
|
|
2303
|
+
* A rating, picked or shown.
|
|
1956
2304
|
*
|
|
1957
|
-
*
|
|
1958
|
-
*
|
|
2305
|
+
* Built as a radio group, because a rating is a one of many choice: the arrow keys move
|
|
2306
|
+
* between the values, it is announced as a group, and it posts in a plain form.
|
|
1959
2307
|
*
|
|
1960
2308
|
* @example
|
|
1961
2309
|
* ```tsx
|
|
1962
|
-
*
|
|
1963
|
-
* <
|
|
1964
|
-
*
|
|
1965
|
-
*
|
|
1966
|
-
*
|
|
2310
|
+
* <Rating value={rating} onChange={setRating} />
|
|
2311
|
+
* <Rating value={rating} onChange={setRating} precision={0.5} />
|
|
2312
|
+
* <Rating value={4.3} readOnly />
|
|
2313
|
+
* <Rating value={rating} onChange={setRating} icon={<HeartIcon />} color="error" />
|
|
2314
|
+
* ```
|
|
2315
|
+
*/
|
|
2316
|
+
declare const Rating: {
|
|
2317
|
+
({ value, onChange, max, precision, clearable, readOnly, disabled, icon, emptyIcon, getLabel, name, color, size, className, "aria-label": ariaLabel, ...rest }: RatingProps): react_jsx_runtime.JSX.Element;
|
|
2318
|
+
displayName: string;
|
|
2319
|
+
};
|
|
2320
|
+
|
|
2321
|
+
interface RHFRatingProps extends RHFBaseProps, Omit<RatingProps, "value" | "onChange" | "name"> {
|
|
2322
|
+
/** Where it starts when the form has nothing for it.(Default: 0) */
|
|
2323
|
+
defaultValue?: number;
|
|
2324
|
+
/** Called alongside the form update. */
|
|
2325
|
+
onChange?: (value: number) => void;
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
/**
|
|
2329
|
+
* React Hook Form wrapper for the Rating component.
|
|
1967
2330
|
*
|
|
1968
|
-
*
|
|
1969
|
-
* <RHFOTPInput
|
|
1970
|
-
* name="verificationCode"
|
|
1971
|
-
* numberOnly={false}
|
|
1972
|
-
* length={8}
|
|
1973
|
-
* />
|
|
2331
|
+
* The field holds a number, `0` for nothing picked, so `required` catches an untouched one.
|
|
1974
2332
|
*
|
|
1975
|
-
*
|
|
1976
|
-
*
|
|
1977
|
-
*
|
|
1978
|
-
*
|
|
1979
|
-
* console.log('OTP entered:', value);
|
|
1980
|
-
* // Auto-submit or verify OTP
|
|
1981
|
-
* }}
|
|
1982
|
-
* />
|
|
2333
|
+
* @example
|
|
2334
|
+
* ```tsx
|
|
2335
|
+
* <RHFRating name="score" rules={{ min: { value: 1, message: "Pick a rating" } }} />
|
|
2336
|
+
* <RHFRating name="score" allowHalf max={10} />
|
|
1983
2337
|
* ```
|
|
1984
2338
|
*/
|
|
1985
|
-
declare const
|
|
2339
|
+
declare const RHFRating: FC<RHFRatingProps>;
|
|
1986
2340
|
|
|
1987
|
-
interface
|
|
2341
|
+
interface Hsva {
|
|
2342
|
+
/** 0 to 360 */
|
|
2343
|
+
h: number;
|
|
2344
|
+
/** 0 to 100 */
|
|
2345
|
+
s: number;
|
|
2346
|
+
/** 0 to 100 */
|
|
2347
|
+
v: number;
|
|
2348
|
+
/** 0 to 1 */
|
|
2349
|
+
a: number;
|
|
1988
2350
|
}
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
2351
|
+
interface Rgba {
|
|
2352
|
+
r: number;
|
|
2353
|
+
g: number;
|
|
2354
|
+
b: number;
|
|
2355
|
+
a: number;
|
|
1994
2356
|
}
|
|
1995
|
-
|
|
2357
|
+
type ColorFormat = "hex" | "rgb" | "hsl";
|
|
2358
|
+
interface ColorPickerProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "color"> {
|
|
2359
|
+
/** The colour, as a string. Leave it out to let the picker hold its own. */
|
|
2360
|
+
value?: string;
|
|
2361
|
+
/** What it starts on when uncontrolled. @default "#000000" */
|
|
2362
|
+
defaultValue?: string;
|
|
2363
|
+
/** Called on every move while dragging. */
|
|
2364
|
+
onChange?: (color: string) => void;
|
|
2365
|
+
/**
|
|
2366
|
+
* Called once the drag ends, the text is committed or a swatch is picked.
|
|
2367
|
+
*
|
|
2368
|
+
* Use it for the expensive thing — a save, a canvas redraw — and `onChange` for the
|
|
2369
|
+
* live preview.
|
|
2370
|
+
*/
|
|
2371
|
+
onChangeComplete?: (color: string) => void;
|
|
2372
|
+
/**
|
|
2373
|
+
* Which formats the dropdown beside the text field offers, and in what order.
|
|
2374
|
+
*
|
|
2375
|
+
* The first is what it starts on. Pass one to pin the format and drop the dropdown.
|
|
2376
|
+
*
|
|
2377
|
+
* ```tsx
|
|
2378
|
+
* formats={["rgb", "hex"]} // starts on RGB, offers both
|
|
2379
|
+
* formats={["hex"]} // hex only, no dropdown
|
|
2380
|
+
* ```
|
|
2381
|
+
*
|
|
2382
|
+
* @default ["hex", "rgb", "hsl"]
|
|
2383
|
+
*/
|
|
2384
|
+
formats?: ColorFormat[];
|
|
2385
|
+
/** Called when the format is switched, with the colour rewritten in it. */
|
|
2386
|
+
onFormatChange?: (format: ColorFormat, color: string) => void;
|
|
2387
|
+
/** Show the field you can type or paste a colour into. @default true */
|
|
2388
|
+
showInput?: boolean;
|
|
2389
|
+
/** Colours to offer below the panel. Nothing is shown when it is empty. */
|
|
2390
|
+
swatches?: string[];
|
|
2391
|
+
/** What the swatches are called, for a reader. @default "Preset colours" */
|
|
2392
|
+
swatchesLabel?: string;
|
|
2393
|
+
/**
|
|
2394
|
+
* Offer the eyedropper. The button only renders where the browser has the API, so it is
|
|
2395
|
+
* absent rather than dead in browsers without it.
|
|
2396
|
+
* @default false
|
|
2397
|
+
*/
|
|
2398
|
+
eyeDropper?: boolean;
|
|
2399
|
+
/** Nothing can be moved, typed or picked. @default false */
|
|
2400
|
+
disabled?: boolean;
|
|
2401
|
+
/** Draw your own saturation area. Position and dragging stay with the picker. */
|
|
2402
|
+
renderSaturation?: (state: ColorPickerRenderState) => ReactNode;
|
|
2403
|
+
/** Draw your own hue handle. */
|
|
2404
|
+
renderHueThumb?: (state: ColorPickerRenderState) => ReactNode;
|
|
2405
|
+
/** Draw your own alpha handle. */
|
|
2406
|
+
renderAlphaThumb?: (state: ColorPickerRenderState) => ReactNode;
|
|
2407
|
+
/** Goes under the panel, above the swatches. */
|
|
2408
|
+
footer?: ReactNode;
|
|
2409
|
+
className?: string;
|
|
1996
2410
|
}
|
|
1997
|
-
interface
|
|
2411
|
+
interface ColorPickerRenderState {
|
|
2412
|
+
/** The colour as the caller's `format` would give it. */
|
|
2413
|
+
color: string;
|
|
2414
|
+
/** The same colour in parts, for drawing with. */
|
|
2415
|
+
hsva: Hsva;
|
|
2416
|
+
/** Whether a pointer is down on this control. */
|
|
2417
|
+
dragging: boolean;
|
|
1998
2418
|
}
|
|
1999
2419
|
|
|
2420
|
+
declare global {
|
|
2421
|
+
interface Window {
|
|
2422
|
+
EyeDropper?: new () => {
|
|
2423
|
+
open: () => Promise<{
|
|
2424
|
+
sRGBHex: string;
|
|
2425
|
+
}>;
|
|
2426
|
+
};
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2000
2429
|
/**
|
|
2001
|
-
*
|
|
2430
|
+
* The colour picker panel: a saturation square, a hue slider, and whatever else you turn
|
|
2431
|
+
* on.
|
|
2002
2432
|
*
|
|
2003
|
-
*
|
|
2004
|
-
*
|
|
2005
|
-
* - Drag-and-drop support
|
|
2006
|
-
* - File preview URLs
|
|
2007
|
-
* - Duplicate detection and optional removal
|
|
2008
|
-
* - Custom UI via render prop
|
|
2433
|
+
* It works in HSV internally, which is what the square is a plane of, and hands you back a
|
|
2434
|
+
* string in whichever `format` you asked for.
|
|
2009
2435
|
*
|
|
2010
|
-
*
|
|
2011
|
-
*
|
|
2012
|
-
* - `duplicatedWith`: Array of files this file duplicates
|
|
2436
|
+
* `onChange` fires on every move so a preview can follow the drag. `onChangeComplete`
|
|
2437
|
+
* fires once the drag ends, which is where the expensive work belongs.
|
|
2013
2438
|
*
|
|
2014
2439
|
* @example
|
|
2015
2440
|
* ```tsx
|
|
2016
|
-
*
|
|
2017
|
-
* <RHFFilePicker name="files" />
|
|
2441
|
+
* const [color, setColor] = useState("#3b82f6");
|
|
2018
2442
|
*
|
|
2019
|
-
*
|
|
2020
|
-
*
|
|
2443
|
+
* <ColorPicker value={color} onChange={setColor} />
|
|
2444
|
+
* ```
|
|
2445
|
+
*
|
|
2446
|
+
* @example
|
|
2447
|
+
* With alpha, swatches and the eyedropper:
|
|
2021
2448
|
*
|
|
2022
|
-
*
|
|
2023
|
-
* <
|
|
2024
|
-
*
|
|
2025
|
-
*
|
|
2026
|
-
*
|
|
2449
|
+
* ```tsx
|
|
2450
|
+
* <ColorPicker
|
|
2451
|
+
* alpha
|
|
2452
|
+
* eyeDropper
|
|
2453
|
+
* format="rgb"
|
|
2454
|
+
* swatches={["#ef4444", "#f59e0b", "#10b981", "#3b82f6"]}
|
|
2455
|
+
* value={color}
|
|
2456
|
+
* onChange={setColor}
|
|
2457
|
+
* onChangeComplete={save}
|
|
2027
2458
|
* />
|
|
2028
2459
|
* ```
|
|
2460
|
+
*/
|
|
2461
|
+
declare const ColorPicker: {
|
|
2462
|
+
({ value, defaultValue, onChange, onChangeComplete, formats, onFormatChange, showInput, swatches, swatchesLabel, eyeDropper, disabled, renderSaturation, renderHueThumb, renderAlphaThumb, footer, className, ...rest }: ColorPickerProps): react_jsx_runtime.JSX.Element;
|
|
2463
|
+
displayName: string;
|
|
2464
|
+
};
|
|
2465
|
+
|
|
2466
|
+
declare const formatColor: (hsva: Hsva, format: ColorFormat, withAlpha: boolean) => string;
|
|
2467
|
+
/**
|
|
2468
|
+
* What a caller's string means, or `null` when it means nothing.
|
|
2469
|
+
*
|
|
2470
|
+
* Returning null rather than guessing at black lets the text field reject what was typed
|
|
2471
|
+
* and put back what was there, instead of silently swallowing a typo.
|
|
2472
|
+
*/
|
|
2473
|
+
declare const parseColor: (input: string | undefined | null) => Hsva | null;
|
|
2474
|
+
|
|
2475
|
+
interface ColorInputProps extends Omit<ColorPickerProps, "className" | "footer" | "defaultValue"> {
|
|
2476
|
+
/** What it starts on when uncontrolled. @default "#000000" */
|
|
2477
|
+
defaultValue?: string;
|
|
2478
|
+
/** Shown in place of the value when there is none. @default "Pick a colour" */
|
|
2479
|
+
placeholder?: ReactNode;
|
|
2480
|
+
/**
|
|
2481
|
+
* Draw the field yourself: a swatch on its own, a swatch with your own label, anything.
|
|
2482
|
+
*
|
|
2483
|
+
* It is drawn **inside** the trigger, so opening, closing, focus and the aria stay with
|
|
2484
|
+
* the component. You are handing over what it looks like, not how it works.
|
|
2485
|
+
*
|
|
2486
|
+
* ```tsx
|
|
2487
|
+
* <ColorInput
|
|
2488
|
+
* render={({ color }) => <span className="size-6 rounded" style={{ background: color }} />}
|
|
2489
|
+
* />
|
|
2490
|
+
* ```
|
|
2491
|
+
*/
|
|
2492
|
+
render?: (state: ColorInputRenderState) => ReactNode;
|
|
2493
|
+
/** Cannot be opened. @default false */
|
|
2494
|
+
disabled?: boolean;
|
|
2495
|
+
/** Shows the value, but the picker does not open. @default false */
|
|
2496
|
+
readOnly?: boolean;
|
|
2497
|
+
/** @default "bottom-start" */
|
|
2498
|
+
pickerPlacement?: Placement;
|
|
2499
|
+
/** @default "absolute" */
|
|
2500
|
+
floatingStrategy?: Strategy;
|
|
2501
|
+
className?: string;
|
|
2502
|
+
wrapperClassName?: string;
|
|
2503
|
+
pickerClassName?: string;
|
|
2504
|
+
/** Called when the panel opens or closes. */
|
|
2505
|
+
onOpenChange?: (open: boolean) => void;
|
|
2506
|
+
}
|
|
2507
|
+
interface ColorInputRenderState {
|
|
2508
|
+
/** The colour as the caller's `format` would give it, or `""` when there is none. */
|
|
2509
|
+
color: string;
|
|
2510
|
+
/** Whether the picker is open. */
|
|
2511
|
+
open: boolean;
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
/**
|
|
2515
|
+
* A field showing the colour you picked, opening the picker in a popover.
|
|
2516
|
+
*
|
|
2517
|
+
* `ColorPicker` is the panel on its own, the way `Calendar` is to `DateInput`. Reach for
|
|
2518
|
+
* that one when the panel lives somewhere of its own.
|
|
2029
2519
|
*
|
|
2030
|
-
*
|
|
2520
|
+
* @example
|
|
2031
2521
|
* ```tsx
|
|
2032
|
-
*
|
|
2033
|
-
* name="customImages"
|
|
2034
|
-
* accept="image/*"
|
|
2035
|
-
* render={({
|
|
2036
|
-
* dropzoneRef,
|
|
2037
|
-
* dragging,
|
|
2038
|
-
* loading,
|
|
2039
|
-
* field: { value: files, onChange },
|
|
2040
|
-
* openFilePicker,
|
|
2041
|
-
* }) => {
|
|
2042
|
-
* const handleRemove = (preview: string) => {
|
|
2043
|
-
* onChange(files.filter((f) => f.preview !== preview));
|
|
2044
|
-
* };
|
|
2522
|
+
* const [brand, setBrand] = useState("#3b82f6");
|
|
2045
2523
|
*
|
|
2046
|
-
*
|
|
2047
|
-
*
|
|
2048
|
-
* <div
|
|
2049
|
-
* ref={dropzoneRef}
|
|
2050
|
-
* onClick={() => openFilePicker()}
|
|
2051
|
-
* className={`relative flex cursor-pointer items-center justify-center rounded-lg border-2 border-dashed p-4 transition-colors ${
|
|
2052
|
-
* dragging ? 'border-primary-400 bg-primary-50' : 'border-gray-300 hover:border-primary-300'
|
|
2053
|
-
* }`}
|
|
2054
|
-
* >
|
|
2055
|
-
* <div className="flex items-center gap-3 text-sm text-gray-500">
|
|
2056
|
-
* <UploadIcon className="h-5 w-5" />
|
|
2057
|
-
* <span>{dragging ? 'Drop images here' : 'Click to upload or drag and drop'}</span>
|
|
2058
|
-
* </div>
|
|
2059
|
-
* {loading && (
|
|
2060
|
-
* <div className="absolute inset-0 flex items-center justify-center rounded-lg bg-white/50">
|
|
2061
|
-
* <Spinner className="h-5 w-5" />
|
|
2062
|
-
* </div>
|
|
2063
|
-
* )}
|
|
2064
|
-
* </div>
|
|
2524
|
+
* <ColorInput value={brand} onChange={setBrand} />
|
|
2525
|
+
* ```
|
|
2065
2526
|
*
|
|
2066
|
-
*
|
|
2067
|
-
*
|
|
2068
|
-
*
|
|
2069
|
-
*
|
|
2070
|
-
*
|
|
2071
|
-
*
|
|
2072
|
-
*
|
|
2073
|
-
*
|
|
2074
|
-
*
|
|
2075
|
-
* <button
|
|
2076
|
-
* type="button"
|
|
2077
|
-
* onClick={() => handleRemove(file.preview)}
|
|
2078
|
-
* className="absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-full bg-red-500 text-white opacity-0 shadow-sm hover:bg-red-600 group-hover:opacity-100"
|
|
2079
|
-
* >
|
|
2080
|
-
* <XIcon className="h-3 w-3" />
|
|
2081
|
-
* </button>
|
|
2082
|
-
* </div>
|
|
2083
|
-
* ))}
|
|
2084
|
-
* </div>
|
|
2085
|
-
* )}
|
|
2086
|
-
* </div>
|
|
2087
|
-
* );
|
|
2088
|
-
* }}
|
|
2527
|
+
* @example
|
|
2528
|
+
* ```tsx
|
|
2529
|
+
* <ColorInput
|
|
2530
|
+
* alpha
|
|
2531
|
+
* format="rgb"
|
|
2532
|
+
* swatches={["#ef4444", "#3b82f6"]}
|
|
2533
|
+
* value={brand}
|
|
2534
|
+
* onChange={setBrand}
|
|
2535
|
+
* onChangeComplete={save}
|
|
2089
2536
|
* />
|
|
2090
2537
|
* ```
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2538
|
+
*/
|
|
2539
|
+
declare const ColorInput: {
|
|
2540
|
+
({ value, defaultValue, onChange, onChangeComplete, onOpenChange, placeholder, render, disabled, readOnly, pickerPlacement, floatingStrategy, className, wrapperClassName, pickerClassName, ...picker }: ColorInputProps): react_jsx_runtime.JSX.Element;
|
|
2541
|
+
displayName: string;
|
|
2542
|
+
};
|
|
2543
|
+
|
|
2544
|
+
interface RHFColorInputProps extends RHFBaseProps, Omit<ColorInputProps, "value" | "onChange"> {
|
|
2545
|
+
/** What the field shows when the form has nothing for it.(Default: "") */
|
|
2546
|
+
defaultValue?: string;
|
|
2547
|
+
/** Called alongside the form update. */
|
|
2548
|
+
onChange?: (color: string) => void;
|
|
2096
2549
|
}
|
|
2097
2550
|
|
|
2098
2551
|
/**
|
|
2099
|
-
*
|
|
2552
|
+
* React Hook Form wrapper for the ColorInput component.
|
|
2100
2553
|
*
|
|
2101
|
-
*
|
|
2102
|
-
*
|
|
2554
|
+
* The field holds the colour as a string in whichever format is on show. Untouched and
|
|
2555
|
+
* with no default it is `undefined`, the way any React Hook Form field is, so `required`
|
|
2556
|
+
* catches one nobody picked.
|
|
2103
2557
|
*
|
|
2104
|
-
*
|
|
2105
|
-
*
|
|
2106
|
-
* specific form instance. For example, when one form is rendered inside another FormProvider,
|
|
2107
|
-
* you'll need to pass the parent form's control explicitly to avoid using the inner form's context.
|
|
2558
|
+
* `onChangeComplete` is not wired to the form: the form is updated on every move, so a
|
|
2559
|
+
* drag does not leave the value behind. Pass it yourself where a save should wait.
|
|
2108
2560
|
*
|
|
2109
2561
|
* @example
|
|
2110
2562
|
* ```tsx
|
|
2111
|
-
*
|
|
2112
|
-
* <
|
|
2113
|
-
*
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
*
|
|
2119
|
-
* placeholder="Enter email"
|
|
2120
|
-
* />
|
|
2121
|
-
* )}
|
|
2122
|
-
* />
|
|
2123
|
-
* </FormProvider>
|
|
2124
|
-
*
|
|
2125
|
-
* // With validation rules
|
|
2126
|
-
* <RHFController
|
|
2127
|
-
* name="username"
|
|
2128
|
-
* rules={{ required: 'Username is required' }}
|
|
2129
|
-
* render={({ field, fieldState }) => (
|
|
2130
|
-
* <div>
|
|
2131
|
-
* <input {...field} />
|
|
2132
|
-
* {fieldState.error && <span>{fieldState.error.message}</span>}
|
|
2133
|
-
* </div>
|
|
2134
|
-
* )}
|
|
2135
|
-
* />
|
|
2136
|
-
*
|
|
2137
|
-
* // Custom component integration
|
|
2138
|
-
* <RHFController
|
|
2139
|
-
* name="customField"
|
|
2140
|
-
* render={({ field, fieldState, formState }) => (
|
|
2141
|
-
* <CustomComponent
|
|
2142
|
-
* value={field.value}
|
|
2143
|
-
* onChange={field.onChange}
|
|
2144
|
-
* error={fieldState.error}
|
|
2145
|
-
* isDirty={formState.isDirty}
|
|
2146
|
-
* />
|
|
2147
|
-
* )}
|
|
2148
|
-
* />
|
|
2563
|
+
* <RHFColorInput name="brand" rules={{ required: "Pick a colour" }} />
|
|
2564
|
+
* <RHFColorInput name="overlay" alpha format="rgb" />
|
|
2565
|
+
* ```
|
|
2566
|
+
*/
|
|
2567
|
+
declare const RHFColorInput: FC<RHFColorInputProps>;
|
|
2568
|
+
|
|
2569
|
+
/**
|
|
2570
|
+
* React Hook Form wrapper for the RangeSlider component.
|
|
2149
2571
|
*
|
|
2150
|
-
*
|
|
2151
|
-
* <FormProvider {...outerForm}>
|
|
2152
|
-
* <FormProvider {...innerForm}>
|
|
2153
|
-
* // This will use innerForm's control by default
|
|
2154
|
-
* <RHFController name="innerField" render={...} />
|
|
2572
|
+
* The field holds a `[low, high]` pair, always in order.
|
|
2155
2573
|
*
|
|
2156
|
-
*
|
|
2157
|
-
*
|
|
2158
|
-
*
|
|
2159
|
-
* control={outerForm.control}
|
|
2160
|
-
* render={({ field }) => <input {...field} />}
|
|
2161
|
-
* />
|
|
2162
|
-
* </FormProvider>
|
|
2163
|
-
* </FormProvider>
|
|
2574
|
+
* @example
|
|
2575
|
+
* ```tsx
|
|
2576
|
+
* <RHFRangeSlider name="price" min={0} max={500} step={10} minGap={50} />
|
|
2164
2577
|
* ```
|
|
2165
2578
|
*/
|
|
2166
|
-
declare const
|
|
2579
|
+
declare const RHFRangeSlider: FC<RHFRangeSliderProps>;
|
|
2167
2580
|
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
/**
|
|
2174
|
-
* Prefix for the select button
|
|
2175
|
-
* */
|
|
2176
|
-
prefix?: FC | ReactNode;
|
|
2177
|
-
/**
|
|
2178
|
-
* Suffix for the select button
|
|
2179
|
-
* */
|
|
2180
|
-
suffix?: FC | ReactNode;
|
|
2581
|
+
declare const _default: CalendarOverload;
|
|
2582
|
+
|
|
2583
|
+
interface RHFDateRangeInputProps extends RHFBaseProps, Omit<DateRangeInputProps, "value" | "onChange"> {
|
|
2584
|
+
disabled?: boolean;
|
|
2585
|
+
onChange?: (value: DateRange | null) => void;
|
|
2181
2586
|
}
|
|
2182
2587
|
|
|
2183
|
-
|
|
2184
|
-
|
|
2588
|
+
declare const RHFDateRangeInput: FC<RHFDateRangeInputProps>;
|
|
2589
|
+
|
|
2590
|
+
/** A file that has been picked, with where it sat in any folder it came from. */
|
|
2591
|
+
type PickedFile = File & {
|
|
2185
2592
|
/**
|
|
2186
|
-
*
|
|
2593
|
+
* Where the file sat in the folder it came from, or `""` for a file picked on its own.
|
|
2594
|
+
* Taken from `webkitRelativePath` when the browser gives one.
|
|
2187
2595
|
* */
|
|
2188
|
-
|
|
2596
|
+
path: string;
|
|
2597
|
+
};
|
|
2598
|
+
/** A picked file with an object URL, which only exists when `preview` is set. */
|
|
2599
|
+
type PreviewFile = PickedFile & {
|
|
2189
2600
|
/**
|
|
2190
|
-
*
|
|
2191
|
-
*
|
|
2601
|
+
* An object URL for showing the file. Revoked for you when the file leaves the field or
|
|
2602
|
+
* the field unmounts.
|
|
2192
2603
|
* */
|
|
2193
|
-
|
|
2194
|
-
|
|
2604
|
+
preview: string;
|
|
2605
|
+
};
|
|
2606
|
+
/** Why a file was turned away. */
|
|
2607
|
+
type FileRejectionReason =
|
|
2608
|
+
/** It did not match `accept`. */
|
|
2609
|
+
"type"
|
|
2610
|
+
/** It is already held, and `unique` is set. */
|
|
2611
|
+
| "duplicate"
|
|
2612
|
+
/** There was no room: past `max`, or a second file in a single field. */
|
|
2613
|
+
| "max";
|
|
2614
|
+
interface FileRejection {
|
|
2615
|
+
file: File;
|
|
2616
|
+
reason: FileRejectionReason;
|
|
2617
|
+
}
|
|
2618
|
+
interface CommonFileInputProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
2195
2619
|
/**
|
|
2196
|
-
*
|
|
2620
|
+
* What may be picked, as the `accept` attribute is written: `"image/*"`, `".pdf,.docx"`.
|
|
2621
|
+
*
|
|
2622
|
+
* Enforced on a drop as well as in the dialog, unlike the native attribute, which only
|
|
2623
|
+
* filters what the dialog offers.
|
|
2624
|
+
* @default "*"
|
|
2197
2625
|
* */
|
|
2198
|
-
|
|
2626
|
+
accept?: string;
|
|
2627
|
+
/** Called with every file turned away, and why. */
|
|
2628
|
+
onReject?: (rejected: FileRejection[]) => void;
|
|
2629
|
+
/** Shown while there is nothing picked. */
|
|
2630
|
+
placeholder?: ReactNode;
|
|
2631
|
+
/** Drop the × that empties the field. @default false */
|
|
2632
|
+
hideClearIcon?: boolean;
|
|
2633
|
+
/** @default false */
|
|
2634
|
+
disabled?: boolean;
|
|
2635
|
+
/** Shows what is picked, but nothing can be picked or dropped. @default false */
|
|
2636
|
+
readOnly?: boolean;
|
|
2637
|
+
className?: string;
|
|
2638
|
+
wrapperClassName?: string;
|
|
2199
2639
|
}
|
|
2200
|
-
interface
|
|
2201
|
-
/**
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2640
|
+
interface CommonRenderState {
|
|
2641
|
+
/** Whether a file is being dragged over the field. */
|
|
2642
|
+
dragging: boolean;
|
|
2643
|
+
/** Whether the files are still being read. */
|
|
2644
|
+
loading: boolean;
|
|
2645
|
+
disabled: boolean;
|
|
2646
|
+
readOnly: boolean;
|
|
2647
|
+
/** Opens the file dialog. */
|
|
2648
|
+
browse: () => void;
|
|
2649
|
+
/** Empties the field. */
|
|
2650
|
+
clear: () => void;
|
|
2209
2651
|
}
|
|
2210
|
-
interface
|
|
2211
|
-
/**
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
* Callback to close the select menu
|
|
2225
|
-
* */
|
|
2226
|
-
closeMenu: () => void;
|
|
2652
|
+
interface SingleFileRenderState<T extends PickedFile = PickedFile> extends CommonRenderState {
|
|
2653
|
+
/** What is held, or `null`. */
|
|
2654
|
+
file: T | null;
|
|
2655
|
+
}
|
|
2656
|
+
interface MultiFileRenderState<T extends PickedFile = PickedFile> extends CommonRenderState {
|
|
2657
|
+
/** What is held. */
|
|
2658
|
+
files: T[];
|
|
2659
|
+
/** Drops one file from the list. */
|
|
2660
|
+
remove: (file: T) => void;
|
|
2661
|
+
}
|
|
2662
|
+
interface SingleShape<T extends PickedFile> {
|
|
2663
|
+
value?: T | null;
|
|
2664
|
+
onChange?: (file: T | null) => void;
|
|
2665
|
+
multiple?: false;
|
|
2227
2666
|
/**
|
|
2228
|
-
*
|
|
2667
|
+
* Draw the field yourself.
|
|
2668
|
+
*
|
|
2669
|
+
* Drawn **inside** the field, so browsing, dropping, the drag state and the keyboard stay
|
|
2670
|
+
* with the component.
|
|
2229
2671
|
* */
|
|
2230
|
-
|
|
2672
|
+
render?: (state: SingleFileRenderState<T>) => ReactNode;
|
|
2231
2673
|
}
|
|
2232
|
-
interface
|
|
2674
|
+
interface MultiShape<T extends PickedFile> {
|
|
2675
|
+
value?: T[];
|
|
2676
|
+
onChange?: (files: T[]) => void;
|
|
2677
|
+
multiple: true;
|
|
2233
2678
|
/**
|
|
2234
|
-
*
|
|
2679
|
+
* Keep what is already held and add to it, rather than replacing it.
|
|
2680
|
+
*
|
|
2681
|
+
* Off by default, which is what a native file input does.
|
|
2682
|
+
* @default false
|
|
2235
2683
|
* */
|
|
2236
|
-
|
|
2237
|
-
className?: string | ((props: CustomSelectOptionBaseArgs<T>) => string);
|
|
2238
|
-
children?: ReactNode | ((props: Omit<CustomSelectOptionArgs<T>, "preventDefault">) => ReactNode);
|
|
2239
|
-
onClick?: (args: CustomSelectOptionArgs<T>) => void;
|
|
2684
|
+
append?: boolean;
|
|
2240
2685
|
/**
|
|
2241
|
-
*
|
|
2686
|
+
* Turn away a file that is already held.
|
|
2687
|
+
*
|
|
2688
|
+
* Compared by size first, then by sampling the start, middle and end, so a large file is
|
|
2689
|
+
* never read end to end. Reaches `onReject` with `"duplicate"`.
|
|
2690
|
+
* @default false
|
|
2242
2691
|
* */
|
|
2243
|
-
|
|
2692
|
+
unique?: boolean;
|
|
2693
|
+
/** How many may be held. Anything past it reaches `onReject` with `"max"`. */
|
|
2694
|
+
max?: number;
|
|
2695
|
+
/** Draw the field yourself. Drawn **inside** it, so the wiring stays put. */
|
|
2696
|
+
render?: (state: MultiFileRenderState<T>) => ReactNode;
|
|
2697
|
+
}
|
|
2698
|
+
interface Previewless {
|
|
2244
2699
|
/**
|
|
2245
|
-
*
|
|
2246
|
-
* i.e. when the user is filtering the options and no option is found
|
|
2247
|
-
*
|
|
2248
|
-
* if you want to display the option only when the options are empty
|
|
2249
|
-
* then you can pass "empty" as value and if you want to display the option always
|
|
2250
|
-
* then you can pass "always" as value
|
|
2700
|
+
* Give each file an object URL on `preview`.
|
|
2251
2701
|
*
|
|
2252
|
-
*
|
|
2253
|
-
* and
|
|
2254
|
-
*
|
|
2255
|
-
* Default: "default"
|
|
2702
|
+
* Off by default: an object URL pins the file's bytes until it is revoked, which is work
|
|
2703
|
+
* and memory you have not asked for. `path` is always there.
|
|
2704
|
+
* @default false
|
|
2256
2705
|
* */
|
|
2257
|
-
|
|
2706
|
+
preview?: false;
|
|
2258
2707
|
}
|
|
2259
|
-
|
|
2708
|
+
interface Previewed {
|
|
2709
|
+
/** Gives each file an object URL on `preview`, revoked for you once it is done with. */
|
|
2710
|
+
preview: true;
|
|
2711
|
+
}
|
|
2712
|
+
/**
|
|
2713
|
+
* `multiple` decides whether the value is one file or a list, and `preview` decides whether
|
|
2714
|
+
* those files carry an object URL. Both are read off the props, so neither `value` nor what
|
|
2715
|
+
* `render` is given ever needs a cast.
|
|
2716
|
+
* */
|
|
2717
|
+
type FileInputProps = (CommonFileInputProps & MultiShape<PreviewFile> & Previewed) | (CommonFileInputProps & MultiShape<PickedFile> & Previewless) | (CommonFileInputProps & SingleShape<PreviewFile> & Previewed) | (CommonFileInputProps & SingleShape<PickedFile> & Previewless);
|
|
2260
2718
|
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2719
|
+
/**
|
|
2720
|
+
* A file field: click it to browse, or drop files onto it.
|
|
2721
|
+
*
|
|
2722
|
+
* One file unless `multiple` is set, which is what a native file input does. A second pick
|
|
2723
|
+
* replaces what is held unless `append` is set, again as native does.
|
|
2724
|
+
*
|
|
2725
|
+
* `preview` is off by default. An object URL pins the file's bytes until it is revoked, so
|
|
2726
|
+
* it is opt in — and revoked for you once the file leaves or the field unmounts. `path` is
|
|
2727
|
+
* always there.
|
|
2728
|
+
*
|
|
2729
|
+
* @example
|
|
2730
|
+
* ```tsx
|
|
2731
|
+
* const [file, setFile] = useState<PickedFile | null>(null);
|
|
2732
|
+
*
|
|
2733
|
+
* <FileInput value={file} onChange={setFile} accept="image/*" />
|
|
2734
|
+
* ```
|
|
2735
|
+
*
|
|
2736
|
+
* @example
|
|
2737
|
+
* ```tsx
|
|
2738
|
+
* <FileInput
|
|
2739
|
+
* multiple
|
|
2740
|
+
* append
|
|
2741
|
+
* unique
|
|
2742
|
+
* preview
|
|
2743
|
+
* max={5}
|
|
2744
|
+
* value={files}
|
|
2745
|
+
* onChange={setFiles}
|
|
2746
|
+
* onReject={(rejected) => toast.error(`${rejected.length} turned away`)}
|
|
2747
|
+
* />
|
|
2748
|
+
* ```
|
|
2749
|
+
*/
|
|
2750
|
+
declare const FileInput: {
|
|
2751
|
+
(props: FileInputProps): react_jsx_runtime.JSX.Element;
|
|
2752
|
+
displayName: string;
|
|
2753
|
+
};
|
|
2754
|
+
|
|
2755
|
+
/**
|
|
2756
|
+
* `Omit` over a union collapses it into one object, which would lose the discrimination on
|
|
2757
|
+
* `multiple` and `preview` that decides the value type and what `render` is handed.
|
|
2758
|
+
* Distributing keeps every branch.
|
|
2759
|
+
* */
|
|
2760
|
+
type OmitEach<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
2761
|
+
type RHFFileInputProps = RHFBaseProps & OmitEach<FileInputProps, "value">;
|
|
2762
|
+
|
|
2763
|
+
/**
|
|
2764
|
+
* React Hook Form wrapper for [FileInput](/docs/file-input).
|
|
2765
|
+
*
|
|
2766
|
+
* The field holds one `PickedFile` when single, or a `PickedFile[]` when `multiple`, so
|
|
2767
|
+
* `required` catches an empty one either way.
|
|
2768
|
+
*
|
|
2769
|
+
* @example
|
|
2770
|
+
* ```tsx
|
|
2771
|
+
* <RHFFileInput name="avatar" accept="image/*" rules={{ required: "Pick a file" }} />
|
|
2772
|
+
* <RHFFileInput name="photos" multiple append unique preview max={5} />
|
|
2773
|
+
* ```
|
|
2774
|
+
*/
|
|
2775
|
+
declare const RHFFileInput: {
|
|
2776
|
+
({ name, control, rules, onChange, ...rest }: RHFFileInputProps): react_jsx_runtime.JSX.Element;
|
|
2777
|
+
displayName: string;
|
|
2778
|
+
};
|
|
2779
|
+
|
|
2780
|
+
interface OTPInputProps {
|
|
2272
2781
|
/**
|
|
2273
|
-
*
|
|
2782
|
+
* Marks the field invalid, to a screen reader and in its colours.
|
|
2783
|
+
*
|
|
2784
|
+
* The standard attribute rather than a prop of the library's own.
|
|
2274
2785
|
* */
|
|
2275
|
-
|
|
2786
|
+
"aria-invalid"?: boolean | "true" | "false";
|
|
2276
2787
|
/**
|
|
2277
|
-
*
|
|
2788
|
+
* Value of the OTP input
|
|
2278
2789
|
* */
|
|
2279
|
-
|
|
2790
|
+
value: string;
|
|
2280
2791
|
/**
|
|
2281
|
-
*
|
|
2282
|
-
* Default is false
|
|
2792
|
+
* Function to call when the OTP input value changes
|
|
2283
2793
|
* */
|
|
2284
|
-
|
|
2794
|
+
onChange: (value: string) => void;
|
|
2285
2795
|
/**
|
|
2286
|
-
*
|
|
2287
|
-
* Default is true for single select and false for multi select
|
|
2796
|
+
* Function to call when the OTP input is blurred
|
|
2288
2797
|
* */
|
|
2289
|
-
|
|
2798
|
+
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
2290
2799
|
/**
|
|
2291
|
-
*
|
|
2292
|
-
*
|
|
2800
|
+
* Function to call when the OTP input completely filled
|
|
2801
|
+
* i.e when the length of the OTP input is equal to the length prop
|
|
2293
2802
|
* */
|
|
2294
|
-
|
|
2803
|
+
onOTPComplete?: (value: string) => void;
|
|
2295
2804
|
/**
|
|
2296
|
-
*
|
|
2805
|
+
* If true, only numbers can be entered in the OTP input. (Default: true)
|
|
2297
2806
|
* */
|
|
2298
|
-
|
|
2807
|
+
numberOnly?: boolean;
|
|
2299
2808
|
/**
|
|
2300
|
-
*
|
|
2301
|
-
* If you pass `SelectEmpty` as children, this will set to true
|
|
2809
|
+
* Classname for the wrapper div that contains input fields
|
|
2302
2810
|
* */
|
|
2303
|
-
|
|
2811
|
+
className?: string;
|
|
2304
2812
|
/**
|
|
2305
|
-
*
|
|
2306
|
-
* Default is false
|
|
2813
|
+
* Classname for the input fields
|
|
2307
2814
|
* */
|
|
2308
|
-
|
|
2309
|
-
}
|
|
2310
|
-
interface SingleSelectProps<T> extends BaseSelectProps {
|
|
2815
|
+
inputClassName?: string;
|
|
2311
2816
|
/**
|
|
2312
|
-
*
|
|
2817
|
+
* Length of the OTP input(Default: 6)
|
|
2818
|
+
* Inputs will be created based on this length
|
|
2313
2819
|
* */
|
|
2314
|
-
|
|
2820
|
+
length?: number;
|
|
2315
2821
|
/**
|
|
2316
|
-
*
|
|
2822
|
+
* Aspect ratio of the OTP input (Default: 0.94)
|
|
2317
2823
|
* */
|
|
2318
|
-
|
|
2824
|
+
aspectRatio?: string | number;
|
|
2319
2825
|
/**
|
|
2320
|
-
*
|
|
2826
|
+
* If true, the OTP input will be disabled
|
|
2321
2827
|
* */
|
|
2322
|
-
|
|
2828
|
+
disabled?: boolean;
|
|
2323
2829
|
}
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2830
|
+
|
|
2831
|
+
/**
|
|
2832
|
+
* OTPInput provides a segmented input field for entering one-time passwords or verification codes.
|
|
2833
|
+
* Each digit is displayed in a separate box with automatic focus management and keyboard navigation.
|
|
2834
|
+
* Supports both numeric-only mode (default) and alphanumeric input.
|
|
2835
|
+
*
|
|
2836
|
+
* @example
|
|
2837
|
+
* Two-factor authentication:
|
|
2838
|
+
*
|
|
2839
|
+
* ```tsx
|
|
2840
|
+
* const [verificationCode, setVerificationCode] = useState('');
|
|
2841
|
+
*
|
|
2842
|
+
* <OTPInput
|
|
2843
|
+
* value={verificationCode}
|
|
2844
|
+
* onChange={setVerificationCode}
|
|
2845
|
+
* length={6}
|
|
2846
|
+
* numberOnly
|
|
2847
|
+
* onOTPComplete={async (code) => {
|
|
2848
|
+
* await verifyTwoFactorCode(code);
|
|
2849
|
+
* }}
|
|
2850
|
+
* />
|
|
2851
|
+
* ```
|
|
2852
|
+
*
|
|
2853
|
+
* @example
|
|
2854
|
+
* Alphanumeric code with custom styling:
|
|
2855
|
+
*
|
|
2856
|
+
* ```tsx
|
|
2857
|
+
* <OTPInput
|
|
2858
|
+
* value={activationCode}
|
|
2859
|
+
* onChange={setActivationCode}
|
|
2860
|
+
* length={8}
|
|
2861
|
+
* numberOnly={false}
|
|
2862
|
+
* className="gap-2"
|
|
2863
|
+
* inputClassName="border-2 rounded-md"
|
|
2864
|
+
* />
|
|
2865
|
+
* ```
|
|
2866
|
+
*
|
|
2867
|
+
* @example
|
|
2868
|
+
* SMS verification with aspect ratio:
|
|
2869
|
+
*
|
|
2870
|
+
* ```tsx
|
|
2871
|
+
* <OTPInput
|
|
2872
|
+
* value={smsCode}
|
|
2873
|
+
* onChange={setSmsCode}
|
|
2874
|
+
* length={4}
|
|
2875
|
+
* aspectRatio={1}
|
|
2876
|
+
* onOTPComplete={(code) => submitVerification(code)}
|
|
2877
|
+
* disabled={isVerifying}
|
|
2878
|
+
* />
|
|
2879
|
+
* ```
|
|
2880
|
+
*/
|
|
2881
|
+
declare const OTPInput: react__default.ForwardRefExoticComponent<OTPInputProps & react__default.RefAttributes<HTMLInputElement>>;
|
|
2882
|
+
|
|
2883
|
+
interface RHFOTPInputProps extends RHFBaseProps, Omit<OTPInputProps, "value" | "onChange" | "onBlur"> {
|
|
2329
2884
|
/**
|
|
2330
|
-
* Callback
|
|
2885
|
+
* Callback fired when the value changes
|
|
2886
|
+
* Called alongside React Hook Form's onChange with the new code
|
|
2331
2887
|
* */
|
|
2332
|
-
onChange
|
|
2888
|
+
onChange?: (value: string) => void;
|
|
2333
2889
|
/**
|
|
2334
|
-
*
|
|
2890
|
+
* Callback fired when the input is blurred
|
|
2891
|
+
* Called alongside React Hook Form's onBlur
|
|
2335
2892
|
* */
|
|
2336
|
-
|
|
2337
|
-
}
|
|
2338
|
-
type SelectProps<T> = SingleSelectProps<T> | MultiSelectProps<T>;
|
|
2339
|
-
interface SelectOverload {
|
|
2340
|
-
<T>(props: SingleSelectProps<T>): JSX.Element;
|
|
2341
|
-
<T>(props: MultiSelectProps<T>): JSX.Element;
|
|
2342
|
-
<T>(props: SelectProps<T>): JSX.Element;
|
|
2343
|
-
displayName: string;
|
|
2344
|
-
}
|
|
2345
|
-
interface FocusedOption<T = unknown> extends SelectOptionConfig<T> {
|
|
2346
|
-
focusType?: "keyboard" | "mouse" | "initial";
|
|
2893
|
+
onBlur?: () => void;
|
|
2347
2894
|
}
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2895
|
+
|
|
2896
|
+
/**
|
|
2897
|
+
* An OTP (One-Time Password) input component integrated with React Hook Form.
|
|
2898
|
+
*
|
|
2899
|
+
* By default, only numeric input is allowed. You can change this behavior
|
|
2900
|
+
* by setting the `numberOnly` prop to false to allow alphanumeric input.
|
|
2901
|
+
*
|
|
2902
|
+
* @example
|
|
2903
|
+
* ```tsx
|
|
2904
|
+
* // Basic usage - numbers only, default 6 digits
|
|
2905
|
+
* <RHFOTPInput name="otp" />
|
|
2906
|
+
*
|
|
2907
|
+
* // Custom length
|
|
2908
|
+
* <RHFOTPInput name="code" length={4} />
|
|
2909
|
+
*
|
|
2910
|
+
* // Allow alphanumeric input
|
|
2911
|
+
* <RHFOTPInput
|
|
2912
|
+
* name="verificationCode"
|
|
2913
|
+
* numberOnly={false}
|
|
2914
|
+
* length={8}
|
|
2915
|
+
* />
|
|
2916
|
+
*
|
|
2917
|
+
* // With completion callback
|
|
2918
|
+
* <RHFOTPInput
|
|
2919
|
+
* name="otp"
|
|
2920
|
+
* onOTPComplete={(value) => {
|
|
2921
|
+
* console.log('OTP entered:', value);
|
|
2922
|
+
* // Auto-submit or verify OTP
|
|
2923
|
+
* }}
|
|
2924
|
+
* />
|
|
2925
|
+
* ```
|
|
2926
|
+
*/
|
|
2927
|
+
declare const RHFOTPInput: FC<RHFOTPInputProps>;
|
|
2928
|
+
|
|
2929
|
+
/**
|
|
2930
|
+
* A wrapper around React Hook Form's Controller component that auto-injects the control prop.
|
|
2931
|
+
*
|
|
2932
|
+
* Automatically retrieves the `control` prop from `useFormContext`, eliminating the need to
|
|
2933
|
+
* pass it manually. This simplifies usage with FormProvider and reduces boilerplate code.
|
|
2934
|
+
*
|
|
2935
|
+
* **When to pass `control` explicitly:**
|
|
2936
|
+
* Only pass the `control` prop when you have nested FormProviders and need to connect to a
|
|
2937
|
+
* specific form instance. For example, when one form is rendered inside another FormProvider,
|
|
2938
|
+
* you'll need to pass the parent form's control explicitly to avoid using the inner form's context.
|
|
2939
|
+
*
|
|
2940
|
+
* @example
|
|
2941
|
+
* ```tsx
|
|
2942
|
+
* // Basic usage - control auto-injected from FormProvider
|
|
2943
|
+
* <FormProvider {...methods}>
|
|
2944
|
+
* <RHFController
|
|
2945
|
+
* name="email"
|
|
2946
|
+
* render={({ field }) => (
|
|
2947
|
+
* <input
|
|
2948
|
+
* {...field}
|
|
2949
|
+
* type="email"
|
|
2950
|
+
* placeholder="Enter email"
|
|
2951
|
+
* />
|
|
2952
|
+
* )}
|
|
2953
|
+
* />
|
|
2954
|
+
* </FormProvider>
|
|
2955
|
+
*
|
|
2956
|
+
* // With validation rules
|
|
2957
|
+
* <RHFController
|
|
2958
|
+
* name="username"
|
|
2959
|
+
* rules={{ required: 'Username is required' }}
|
|
2960
|
+
* render={({ field, fieldState }) => (
|
|
2961
|
+
* <div>
|
|
2962
|
+
* <input {...field} />
|
|
2963
|
+
* {fieldState.error && <span>{fieldState.error.message}</span>}
|
|
2964
|
+
* </div>
|
|
2965
|
+
* )}
|
|
2966
|
+
* />
|
|
2967
|
+
*
|
|
2968
|
+
* // Custom component integration
|
|
2969
|
+
* <RHFController
|
|
2970
|
+
* name="customField"
|
|
2971
|
+
* render={({ field, fieldState, formState }) => (
|
|
2972
|
+
* <CustomComponent
|
|
2973
|
+
* value={field.value}
|
|
2974
|
+
* onChange={field.onChange}
|
|
2975
|
+
* error={fieldState.error}
|
|
2976
|
+
* isDirty={formState.isDirty}
|
|
2977
|
+
* />
|
|
2978
|
+
* )}
|
|
2979
|
+
* />
|
|
2980
|
+
*
|
|
2981
|
+
* // Nested FormProviders - explicit control needed
|
|
2982
|
+
* <FormProvider {...outerForm}>
|
|
2983
|
+
* <FormProvider {...innerForm}>
|
|
2984
|
+
* // This will use innerForm's control by default
|
|
2985
|
+
* <RHFController name="innerField" render={...} />
|
|
2986
|
+
*
|
|
2987
|
+
* // Pass control explicitly to use outerForm
|
|
2988
|
+
* <RHFController
|
|
2989
|
+
* name="outerField"
|
|
2990
|
+
* control={outerForm.control}
|
|
2991
|
+
* render={({ field }) => <input {...field} />}
|
|
2992
|
+
* />
|
|
2993
|
+
* </FormProvider>
|
|
2994
|
+
* </FormProvider>
|
|
2995
|
+
* ```
|
|
2996
|
+
*/
|
|
2997
|
+
declare const RHFController: FC<ControllerProps>;
|
|
2998
|
+
|
|
2999
|
+
interface SelectButtonProps {
|
|
2357
3000
|
/**
|
|
2358
|
-
*
|
|
2359
|
-
* Use this to work with keyword filter in custom select
|
|
3001
|
+
* Additional class name for the select button
|
|
2360
3002
|
* */
|
|
2361
|
-
|
|
3003
|
+
className?: string;
|
|
2362
3004
|
/**
|
|
2363
|
-
*
|
|
3005
|
+
* Prefix for the select button
|
|
2364
3006
|
* */
|
|
2365
|
-
|
|
3007
|
+
prefix?: FC | ReactNode;
|
|
2366
3008
|
/**
|
|
2367
|
-
*
|
|
3009
|
+
* Suffix for the select button
|
|
2368
3010
|
* */
|
|
2369
|
-
|
|
3011
|
+
suffix?: FC | ReactNode;
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
type HtmlButtonProps = DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
3015
|
+
interface SelectOptionConfig<T> {
|
|
2370
3016
|
/**
|
|
2371
|
-
*
|
|
3017
|
+
* Value of the option
|
|
2372
3018
|
* */
|
|
2373
|
-
|
|
3019
|
+
value: T;
|
|
2374
3020
|
/**
|
|
2375
|
-
*
|
|
3021
|
+
* Used to identify the option in the list and filtering
|
|
3022
|
+
* If you don't pass anything, children textContent will be used as label
|
|
2376
3023
|
* */
|
|
2377
|
-
|
|
3024
|
+
label: string;
|
|
3025
|
+
visibility?: SelectOptionProps<T>["visibility"];
|
|
2378
3026
|
/**
|
|
2379
|
-
*
|
|
2380
|
-
* If you use custom `SelectButton` you should bind this to the input
|
|
3027
|
+
* This is just a placeholder for the rest of the props in case we might need them in the future
|
|
2381
3028
|
* */
|
|
2382
|
-
|
|
3029
|
+
props: Omit<SelectOptionProps<T>, "children">;
|
|
3030
|
+
}
|
|
3031
|
+
interface CustomSelectOptionBaseArgs<T> extends Pick<SelectOptionConfig<T>, "value"> {
|
|
2383
3032
|
/**
|
|
2384
|
-
*
|
|
3033
|
+
* Whether the option is selected or not
|
|
2385
3034
|
* */
|
|
2386
|
-
|
|
3035
|
+
selected: boolean;
|
|
2387
3036
|
/**
|
|
2388
|
-
*
|
|
2389
|
-
* *you rarely need to use this if you build custom select*
|
|
3037
|
+
* Whether the option has focus or not
|
|
2390
3038
|
* */
|
|
2391
|
-
|
|
3039
|
+
focused: boolean;
|
|
3040
|
+
}
|
|
3041
|
+
interface CustomSelectOptionArgs<T> extends CustomSelectOptionBaseArgs<T> {
|
|
2392
3042
|
/**
|
|
2393
|
-
*
|
|
3043
|
+
* Function to prevent the default onClick function
|
|
3044
|
+
* If you call this function, You need to handle the onClick function yourself
|
|
3045
|
+
* You can use `selectCurrentOption` to trigger the default onClick function
|
|
3046
|
+
* or you can write your own onClick function according to your needs
|
|
2394
3047
|
* */
|
|
2395
|
-
|
|
3048
|
+
preventDefault: () => void;
|
|
2396
3049
|
/**
|
|
2397
|
-
*
|
|
3050
|
+
* Default onClick function that is called when the option is clicked
|
|
3051
|
+
* It will select or deselect the option and close the menu if it's a single select
|
|
3052
|
+
* */
|
|
3053
|
+
selectCurrentOption: () => void;
|
|
3054
|
+
/**
|
|
3055
|
+
* Callback to close the select menu
|
|
2398
3056
|
* */
|
|
2399
3057
|
closeMenu: () => void;
|
|
2400
3058
|
/**
|
|
2401
|
-
*
|
|
3059
|
+
* Filtered keyword that is currently being used to filter the options
|
|
2402
3060
|
* */
|
|
2403
|
-
|
|
3061
|
+
filteredKeyword: string;
|
|
3062
|
+
}
|
|
3063
|
+
interface SelectOptionProps<T> extends Omit<SelectOptionConfig<T>, "props">, Omit<HtmlButtonProps, "children" | "value" | "className" | "onClick"> {
|
|
2404
3064
|
/**
|
|
2405
|
-
*
|
|
2406
|
-
* Usage:
|
|
2407
|
-
* ```js
|
|
2408
|
-
* isSelected("optionValue")
|
|
2409
|
-
* ```
|
|
3065
|
+
* If you want to hide default check icon
|
|
2410
3066
|
* */
|
|
2411
|
-
|
|
3067
|
+
hideCheckIcon?: boolean;
|
|
3068
|
+
className?: string | ((props: CustomSelectOptionBaseArgs<T>) => string);
|
|
3069
|
+
children?: ReactNode | ((props: Omit<CustomSelectOptionArgs<T>, "preventDefault">) => ReactNode);
|
|
3070
|
+
onClick?: (args: CustomSelectOptionArgs<T>) => void;
|
|
2412
3071
|
/**
|
|
2413
|
-
*
|
|
2414
|
-
*
|
|
2415
|
-
|
|
2416
|
-
|
|
3072
|
+
* This will only be called when the option is selected and multiple is true
|
|
3073
|
+
* */
|
|
3074
|
+
onRemove?: (args: CustomSelectOptionArgs<T>) => void;
|
|
3075
|
+
/**
|
|
3076
|
+
* If you want to display the option always, even if it's empty
|
|
3077
|
+
* i.e. when the user is filtering the options and no option is found
|
|
2417
3078
|
*
|
|
2418
|
-
*
|
|
2419
|
-
*
|
|
2420
|
-
*
|
|
2421
|
-
*
|
|
3079
|
+
* if you want to display the option only when the options are empty
|
|
3080
|
+
* then you can pass "empty" as value and if you want to display the option always
|
|
3081
|
+
* then you can pass "always" as value
|
|
3082
|
+
*
|
|
3083
|
+
* If you want to display the option only when the options are empty and the user is filtering
|
|
3084
|
+
* and that filter matches the option then you can pass "filtered-and-empty" as value
|
|
3085
|
+
*
|
|
3086
|
+
* Default: "default"
|
|
2422
3087
|
* */
|
|
2423
|
-
|
|
3088
|
+
visibility?: "default" | "always" | "empty" | "filtered-and-empty";
|
|
3089
|
+
}
|
|
3090
|
+
type SelectOptionElement<T = unknown> = ReactElement<SelectOptionProps<T>>;
|
|
3091
|
+
|
|
3092
|
+
interface BaseSelectProps extends PropsWithChildren, SelectButtonProps {
|
|
3093
|
+
inputRef?: RefCallback<HTMLInputElement | null> | RefObject<HTMLInputElement | null>;
|
|
2424
3094
|
/**
|
|
2425
|
-
*
|
|
3095
|
+
* Placeholder that will be shown when the select is empty
|
|
2426
3096
|
* */
|
|
2427
|
-
|
|
3097
|
+
placeholder?: string;
|
|
2428
3098
|
/**
|
|
2429
|
-
*
|
|
3099
|
+
* Additional class name for the placeholder
|
|
2430
3100
|
* */
|
|
2431
|
-
|
|
3101
|
+
placeholderClassName?: string;
|
|
3102
|
+
wrapperClassName?: string;
|
|
2432
3103
|
/**
|
|
2433
|
-
*
|
|
3104
|
+
* Additional class name for the menu
|
|
2434
3105
|
* */
|
|
2435
|
-
|
|
3106
|
+
menuClassName?: string;
|
|
2436
3107
|
/**
|
|
2437
|
-
*
|
|
2438
|
-
* Used internally for scrolling focused options into view
|
|
3108
|
+
* Select is disabled or not
|
|
2439
3109
|
* */
|
|
2440
|
-
|
|
3110
|
+
disabled?: boolean;
|
|
2441
3111
|
/**
|
|
2442
|
-
*
|
|
3112
|
+
* Whether to show the input for filtering the options
|
|
3113
|
+
* Default is false
|
|
2443
3114
|
* */
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
3115
|
+
filterable?: boolean | "inline" | "dropdown";
|
|
3116
|
+
/**
|
|
3117
|
+
* Whether to close the menu when an option is selected
|
|
3118
|
+
* Default is true for single select and false for multi select
|
|
3119
|
+
* */
|
|
3120
|
+
closeMenuOnSelect?: boolean;
|
|
3121
|
+
/**
|
|
3122
|
+
* Placement of the menu
|
|
3123
|
+
* Default is "bottom-start"
|
|
3124
|
+
* */
|
|
3125
|
+
placement?: Placement;
|
|
3126
|
+
/**
|
|
3127
|
+
* Floating strategy for the menu
|
|
3128
|
+
* */
|
|
3129
|
+
floatingStrategy?: Strategy;
|
|
3130
|
+
/**
|
|
3131
|
+
* Whether to hide the default empty UI when the select is empty
|
|
3132
|
+
* If you pass `SelectEmpty` as children, this will set to true
|
|
3133
|
+
* */
|
|
3134
|
+
hideDefaultEmptyUI?: boolean;
|
|
3135
|
+
/**
|
|
3136
|
+
* If true, a clear button will be shown to clear the selected value
|
|
3137
|
+
* Default is false
|
|
3138
|
+
* */
|
|
3139
|
+
clearable?: boolean;
|
|
3140
|
+
}
|
|
3141
|
+
interface SingleSelectProps<T> extends BaseSelectProps {
|
|
3142
|
+
/**
|
|
3143
|
+
* The value of the select
|
|
3144
|
+
* */
|
|
3145
|
+
value: T;
|
|
3146
|
+
/**
|
|
3147
|
+
* Callback to be called when the value changes
|
|
3148
|
+
* */
|
|
3149
|
+
onChange: (value: T) => void;
|
|
3150
|
+
/**
|
|
3151
|
+
* Disabling multiple select
|
|
3152
|
+
* */
|
|
3153
|
+
multiple?: false;
|
|
3154
|
+
}
|
|
3155
|
+
interface MultiSelectProps<T> extends BaseSelectProps {
|
|
3156
|
+
/**
|
|
3157
|
+
* The value of the select in array format
|
|
3158
|
+
* */
|
|
3159
|
+
value: T[];
|
|
3160
|
+
/**
|
|
3161
|
+
* Callback to be called when the value changes
|
|
3162
|
+
* */
|
|
3163
|
+
onChange: (value: T[]) => void;
|
|
3164
|
+
/**
|
|
3165
|
+
* For enabling multiple select
|
|
3166
|
+
* */
|
|
3167
|
+
multiple: true;
|
|
3168
|
+
}
|
|
3169
|
+
type SelectProps<T> = SingleSelectProps<T> | MultiSelectProps<T>;
|
|
3170
|
+
interface SelectOverload {
|
|
3171
|
+
<T>(props: SingleSelectProps<T>): JSX.Element;
|
|
3172
|
+
<T>(props: MultiSelectProps<T>): JSX.Element;
|
|
3173
|
+
<T>(props: SelectProps<T>): JSX.Element;
|
|
3174
|
+
displayName: string;
|
|
3175
|
+
}
|
|
3176
|
+
interface FocusedOption<T = unknown> extends SelectOptionConfig<T> {
|
|
3177
|
+
focusType?: "keyboard" | "mouse" | "initial";
|
|
3178
|
+
}
|
|
3179
|
+
interface SelectContextProps<T> extends Pick<BaseSelectProps, "disabled" | "prefix" | "suffix" | "placeholder" | "closeMenuOnSelect">, Omit<MultiSelectProps<T>, "value" | "onChange" | "multiple" | "renderDisplay"> {
|
|
3180
|
+
/**
|
|
3181
|
+
* The value of the select
|
|
3182
|
+
* */
|
|
3183
|
+
value: T | T[];
|
|
3184
|
+
/**
|
|
3185
|
+
* For checking if the select is multiple or single
|
|
3186
|
+
* */
|
|
3187
|
+
multiple?: boolean;
|
|
3188
|
+
/**
|
|
3189
|
+
* Input ref for the filter input
|
|
3190
|
+
* Use this to work with keyword filter in custom select
|
|
3191
|
+
* */
|
|
3192
|
+
setInputRef: (_: any) => RefCallback<HTMLElement | null> | RefObject<HTMLElement | null> | undefined;
|
|
3193
|
+
/**
|
|
3194
|
+
* Ref for the input
|
|
3195
|
+
* */
|
|
3196
|
+
inputRef: RefObject<HTMLInputElement | null>;
|
|
3197
|
+
/**
|
|
3198
|
+
* For managing the open state of the menu
|
|
3199
|
+
* */
|
|
3200
|
+
open: boolean;
|
|
3201
|
+
/**
|
|
3202
|
+
* Setter for open state for the menu
|
|
3203
|
+
* */
|
|
3204
|
+
setOpen: Dispatch<SetStateAction<boolean>>;
|
|
3205
|
+
/**
|
|
3206
|
+
* Array of labels and values that are passed down as `SelectOption` to children
|
|
3207
|
+
* */
|
|
3208
|
+
options: SelectOptionConfig<T>[];
|
|
3209
|
+
/**
|
|
3210
|
+
* For filtering options that are binded to the input
|
|
3211
|
+
* If you use custom `SelectButton` you should bind this to the input
|
|
3212
|
+
* */
|
|
3213
|
+
keyword: string;
|
|
3214
|
+
/**
|
|
3215
|
+
* Setter for filter keyword
|
|
3216
|
+
* */
|
|
3217
|
+
setKeyword: Dispatch<SetStateAction<string>>;
|
|
3218
|
+
/**
|
|
3219
|
+
* For managing the floating state of the menu
|
|
3220
|
+
* *you rarely need to use this if you build custom select*
|
|
3221
|
+
* */
|
|
3222
|
+
floating: ReturnType<typeof useFloating>;
|
|
3223
|
+
/**
|
|
3224
|
+
* Open the select menu
|
|
3225
|
+
* */
|
|
3226
|
+
openMenu: () => void;
|
|
3227
|
+
/**
|
|
3228
|
+
* Close the select menu
|
|
3229
|
+
* */
|
|
3230
|
+
closeMenu: () => void;
|
|
3231
|
+
/**
|
|
3232
|
+
* Toggle the select menu
|
|
3233
|
+
* */
|
|
3234
|
+
toggleMenu: () => void;
|
|
3235
|
+
/**
|
|
3236
|
+
* Reusable function to check if the option is selected
|
|
3237
|
+
* Usage:
|
|
3238
|
+
* ```js
|
|
3239
|
+
* isSelected("optionValue")
|
|
3240
|
+
* ```
|
|
3241
|
+
* */
|
|
3242
|
+
isSelected: (optionValue: T) => boolean;
|
|
3243
|
+
/**
|
|
3244
|
+
* Reusable function to handle the change of the select
|
|
3245
|
+
* This function handle the option value base on the select type(multiple or single)
|
|
3246
|
+
* If multiple select, it will add or remove the value from the array
|
|
3247
|
+
* and if single select, it will replace the value
|
|
3248
|
+
*
|
|
3249
|
+
* Usage:
|
|
3250
|
+
* ```js
|
|
3251
|
+
* handleChange("optionValue")
|
|
3252
|
+
* ```
|
|
3253
|
+
* */
|
|
3254
|
+
handleChange: (optionValue: T) => void;
|
|
3255
|
+
/**
|
|
3256
|
+
* Current focused option that is selected by keyboard or mouse hover
|
|
3257
|
+
* */
|
|
3258
|
+
focusedOption: FocusedOption<T> | null;
|
|
3259
|
+
/**
|
|
3260
|
+
* Setter for focused option in case you want to update the focused option to a specific option
|
|
3261
|
+
* */
|
|
3262
|
+
setFocusedOption: Dispatch<SetStateAction<FocusedOption<T> | null>>;
|
|
3263
|
+
/**
|
|
3264
|
+
* Whether the select is empty when the filter is applied
|
|
3265
|
+
* */
|
|
3266
|
+
isEmpty: boolean;
|
|
3267
|
+
/**
|
|
3268
|
+
* Ref for the menu scroll container
|
|
3269
|
+
* Used internally for scrolling focused options into view
|
|
3270
|
+
* */
|
|
3271
|
+
menuScrollContainerRef: RefObject<HTMLDivElement | null>;
|
|
3272
|
+
/**
|
|
3273
|
+
* Callback to be called when the value changes
|
|
3274
|
+
* */
|
|
3275
|
+
onChange?: (value: T | T[]) => void;
|
|
3276
|
+
}
|
|
3277
|
+
|
|
3278
|
+
/**
|
|
3279
|
+
* A customizable select dropdown component with support for single and multiple selections.
|
|
3280
|
+
*
|
|
3281
|
+
* Features include:
|
|
3282
|
+
* - Single or multiple selection modes
|
|
3283
|
+
* - Keyboard navigation and search
|
|
3284
|
+
* - Custom positioning with floating-ui
|
|
3285
|
+
* - Click-outside to close
|
|
3286
|
+
* - Customizable trigger and menu components
|
|
3287
|
+
*
|
|
3288
|
+
* @example
|
|
3289
|
+
* ```tsx
|
|
3290
|
+
* // Basic single select
|
|
3291
|
+
* <Select value={selectedValue} onChange={setSelectedValue}>
|
|
3292
|
+
* <SelectOption value="option1" label="Option 1" />
|
|
3293
|
+
* <SelectOption value="option2" label="Option 2" />
|
|
3294
|
+
* </Select>
|
|
3295
|
+
*
|
|
3296
|
+
* // Multiple select
|
|
3297
|
+
* <Select
|
|
3298
|
+
* multiple
|
|
2468
3299
|
* value={selectedValues}
|
|
2469
3300
|
* onChange={setSelectedValues}
|
|
2470
3301
|
* >
|
|
@@ -2854,200 +3685,1175 @@ declare const SelectConsumer: {
|
|
|
2854
3685
|
displayName: string;
|
|
2855
3686
|
};
|
|
2856
3687
|
|
|
2857
|
-
declare const useSelect: <T = unknown>() => SelectContextProps<T>;
|
|
3688
|
+
declare const useSelect: <T = unknown>() => SelectContextProps<T>;
|
|
3689
|
+
|
|
3690
|
+
interface RHFSingleSelectProps<T> extends Omit<SingleSelectProps<T>, "value" | "onChange">, RHFBaseProps {
|
|
3691
|
+
onChange?: (value: T) => void;
|
|
3692
|
+
}
|
|
3693
|
+
interface RHFMultiSelectProps<T> extends Omit<MultiSelectProps<T>, "value" | "onChange">, RHFBaseProps {
|
|
3694
|
+
onChange?: (value: T[]) => void;
|
|
3695
|
+
}
|
|
3696
|
+
type RHFSelectProps<T> = RHFSingleSelectProps<T> | RHFMultiSelectProps<T>;
|
|
3697
|
+
interface RHFSelectOverload {
|
|
3698
|
+
displayName: string;
|
|
3699
|
+
<T>(props: RHFSingleSelectProps<T>): JSX.Element;
|
|
3700
|
+
<T>(props: RHFMultiSelectProps<T>): JSX.Element;
|
|
3701
|
+
}
|
|
3702
|
+
|
|
3703
|
+
/**
|
|
3704
|
+
* A select dropdown component integrated with React Hook Form.
|
|
3705
|
+
*
|
|
3706
|
+
* Supports both single and multiple selection modes with automatic error state display.
|
|
3707
|
+
* Built on the Select component with full React Hook Form integration.
|
|
3708
|
+
*
|
|
3709
|
+
* @example
|
|
3710
|
+
* ```tsx
|
|
3711
|
+
* // Basic single select
|
|
3712
|
+
* <RHFSelect name="country">
|
|
3713
|
+
* <SelectOption value="us" label="United States" />
|
|
3714
|
+
* <SelectOption value="uk" label="United Kingdom" />
|
|
3715
|
+
* <SelectOption value="ca" label="Canada" />
|
|
3716
|
+
* </RHFSelect>
|
|
3717
|
+
*
|
|
3718
|
+
* // Multiple selection
|
|
3719
|
+
* <RHFSelect name="skills" multiple>
|
|
3720
|
+
* <SelectOption value="js" label="JavaScript" />
|
|
3721
|
+
* <SelectOption value="ts" label="TypeScript" />
|
|
3722
|
+
* <SelectOption value="react" label="React" />
|
|
3723
|
+
* </RHFSelect>
|
|
3724
|
+
*
|
|
3725
|
+
* // With custom option styling
|
|
3726
|
+
* <RHFSelect name="priority">
|
|
3727
|
+
* {['low', 'medium', 'high'].map((priority) => (
|
|
3728
|
+
* <SelectOption
|
|
3729
|
+
* key={priority}
|
|
3730
|
+
* value={priority}
|
|
3731
|
+
* label={priority.charAt(0).toUpperCase() + priority.slice(1)}
|
|
3732
|
+
* className={({ selected }) =>
|
|
3733
|
+
* selected ? "text-blue-600 font-bold" : "text-gray-700"
|
|
3734
|
+
* }
|
|
3735
|
+
* />
|
|
3736
|
+
* ))}
|
|
3737
|
+
* </RHFSelect>
|
|
3738
|
+
*
|
|
3739
|
+
* // With onChange callback
|
|
3740
|
+
* <RHFSelect
|
|
3741
|
+
* name="category"
|
|
3742
|
+
* onChange={(value) => {
|
|
3743
|
+
* console.log('Selected:', value);
|
|
3744
|
+
* fetchSubcategories(value);
|
|
3745
|
+
* }}
|
|
3746
|
+
* >
|
|
3747
|
+
* <SelectOption value="1" label="Category 1" />
|
|
3748
|
+
* <SelectOption value="2" label="Category 2" />
|
|
3749
|
+
* </RHFSelect>
|
|
3750
|
+
* ```
|
|
3751
|
+
*/
|
|
3752
|
+
declare const RHFSelect: RHFSelectOverload;
|
|
3753
|
+
|
|
3754
|
+
interface TooltipProps extends PropsWithChildren {
|
|
3755
|
+
/**
|
|
3756
|
+
* The content of the tooltip
|
|
3757
|
+
* */
|
|
3758
|
+
content?: string | ReactNode | FC;
|
|
3759
|
+
/**
|
|
3760
|
+
* How long the pointer has to rest on the trigger before the tooltip appears, in ms.
|
|
3761
|
+
*
|
|
3762
|
+
* @default 200
|
|
3763
|
+
* */
|
|
3764
|
+
delayDuration?: number;
|
|
3765
|
+
/**
|
|
3766
|
+
* Classname to apply to the tooltip
|
|
3767
|
+
* */
|
|
3768
|
+
className?: string;
|
|
3769
|
+
/**
|
|
3770
|
+
* Classname to apply to the tooltip trigger
|
|
3771
|
+
* ie. the element that triggers the tooltip to appear
|
|
3772
|
+
* @example
|
|
3773
|
+
*
|
|
3774
|
+
* ```js
|
|
3775
|
+
* <Tooltip content="hello world">
|
|
3776
|
+
* <Button>Hover me</Button> // <-- This is the tooltip trigger
|
|
3777
|
+
* </Tooltip>
|
|
3778
|
+
* ```
|
|
3779
|
+
* */
|
|
3780
|
+
triggerClassName?: string;
|
|
3781
|
+
/**
|
|
3782
|
+
* Classname to apply to the tooltip arrow
|
|
3783
|
+
* */
|
|
3784
|
+
arrowClassName?: string;
|
|
3785
|
+
/**
|
|
3786
|
+
* Whether to use the child element directly as the trigger.
|
|
3787
|
+
* Use this to avoid invalid button nesting errors when using a button as the trigger.
|
|
3788
|
+
* */
|
|
3789
|
+
triggerAsChild?: boolean;
|
|
3790
|
+
/**
|
|
3791
|
+
* The background color of the tooltip and the arrow pointing to the target
|
|
3792
|
+
* */
|
|
3793
|
+
backgroundColor?: string;
|
|
3794
|
+
/**
|
|
3795
|
+
* The side of the tooltip to display
|
|
3796
|
+
* */
|
|
3797
|
+
placement?: Placement;
|
|
3798
|
+
/**
|
|
3799
|
+
* The offset of the tooltip from the trigger
|
|
3800
|
+
* */
|
|
3801
|
+
sideOffset?: number;
|
|
3802
|
+
}
|
|
3803
|
+
|
|
3804
|
+
declare const Tooltip: FC<TooltipProps>;
|
|
3805
|
+
|
|
3806
|
+
/** Extensible variant map - To allow module augmentation */
|
|
3807
|
+
interface TabsVariantMap {
|
|
3808
|
+
underline: unknown;
|
|
3809
|
+
segmented: unknown;
|
|
3810
|
+
soft: unknown;
|
|
3811
|
+
}
|
|
3812
|
+
/** Extensible size map - To allow module augmentation */
|
|
3813
|
+
interface TabsSizeMap {
|
|
3814
|
+
sm: unknown;
|
|
3815
|
+
md: unknown;
|
|
3816
|
+
lg: unknown;
|
|
3817
|
+
}
|
|
3818
|
+
type TabsOrientation = "horizontal" | "vertical";
|
|
3819
|
+
interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
3820
|
+
/**
|
|
3821
|
+
* Selected tab. Leave it out to let the component hold the state.
|
|
3822
|
+
* */
|
|
3823
|
+
value?: string;
|
|
3824
|
+
/**
|
|
3825
|
+
* Which tab starts selected when the component holds the state.(Default: the first
|
|
3826
|
+
* tab that is not disabled)
|
|
3827
|
+
* */
|
|
3828
|
+
defaultValue?: string;
|
|
3829
|
+
/**
|
|
3830
|
+
* Called with the value of the tab that was picked.
|
|
3831
|
+
* */
|
|
3832
|
+
onChange?: (value: string) => void;
|
|
3833
|
+
/**
|
|
3834
|
+
* How the selected tab is marked.(Default: 'underline')
|
|
3835
|
+
* */
|
|
3836
|
+
variant?: keyof TabsVariantMap;
|
|
3837
|
+
/**
|
|
3838
|
+
* Tab padding and text size.(Default: 'md')
|
|
3839
|
+
* */
|
|
3840
|
+
size?: keyof TabsSizeMap;
|
|
3841
|
+
/**
|
|
3842
|
+
* Lay the tabs out in a row or a column. A column swaps the arrow keys to up and
|
|
3843
|
+
* down.(Default: 'horizontal')
|
|
3844
|
+
* */
|
|
3845
|
+
orientation?: TabsOrientation;
|
|
3846
|
+
/**
|
|
3847
|
+
* Share the available width between the tabs instead of letting them hug their
|
|
3848
|
+
* labels.(Default: false)
|
|
3849
|
+
* */
|
|
3850
|
+
fullWidth?: boolean;
|
|
3851
|
+
/**
|
|
3852
|
+
* Render as navigation rather than as tabs.
|
|
3853
|
+
*
|
|
3854
|
+
* Tabs swap content on the same page; navigation goes somewhere else. They look the
|
|
3855
|
+
* same but are not the same thing to a screen reader, so this switches the markup:
|
|
3856
|
+
* a `nav` landmark instead of a tablist, `aria-current` instead of `aria-selected`,
|
|
3857
|
+
* and the arrow keys left alone so Tab moves through the links.(Default: 'div')
|
|
3858
|
+
* */
|
|
3859
|
+
as?: "div" | "nav";
|
|
3860
|
+
/**
|
|
3861
|
+
* Keep every panel mounted, so a panel holding form state survives being hidden.
|
|
3862
|
+
* Off by default, which keeps the DOM small.(Default: false)
|
|
3863
|
+
* */
|
|
3864
|
+
keepMounted?: boolean;
|
|
3865
|
+
/**
|
|
3866
|
+
* A `TabList`, the `TabPanel`s, and whatever layout you want around them.
|
|
3867
|
+
* */
|
|
3868
|
+
children?: ReactNode;
|
|
3869
|
+
}
|
|
3870
|
+
interface TabListProps extends HTMLAttributes<HTMLDivElement> {
|
|
3871
|
+
/**
|
|
3872
|
+
* `Tab` elements.
|
|
3873
|
+
* */
|
|
3874
|
+
children?: ReactNode;
|
|
3875
|
+
}
|
|
3876
|
+
interface TabProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
3877
|
+
/**
|
|
3878
|
+
* Identifies the tab. Matched against the `value` on `Tabs`, and against the
|
|
3879
|
+
* `TabPanel` it reveals.
|
|
3880
|
+
* */
|
|
3881
|
+
value: string;
|
|
3882
|
+
/**
|
|
3883
|
+
* Take the tab out of the keyboard order and stop it being selected.
|
|
3884
|
+
* */
|
|
3885
|
+
disabled?: boolean;
|
|
3886
|
+
/**
|
|
3887
|
+
* Use the child element as the tab instead of rendering a button, so navigation tabs
|
|
3888
|
+
* can be real links. The child receives the id, tab index and aria wiring.
|
|
3889
|
+
*
|
|
3890
|
+
* @example
|
|
3891
|
+
* ```tsx
|
|
3892
|
+
* <Tab value="/settings/profile" asChild>
|
|
3893
|
+
* <Link href="/settings/profile">Profile</Link>
|
|
3894
|
+
* </Tab>
|
|
3895
|
+
* ```
|
|
3896
|
+
* */
|
|
3897
|
+
asChild?: boolean;
|
|
3898
|
+
/**
|
|
3899
|
+
* What the tab shows. Anything: text, an icon beside text, a badge.
|
|
3900
|
+
* */
|
|
3901
|
+
children?: ReactNode;
|
|
3902
|
+
}
|
|
3903
|
+
interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
3904
|
+
/**
|
|
3905
|
+
* Matched against the `Tab` that reveals this panel.
|
|
3906
|
+
* */
|
|
3907
|
+
value: string;
|
|
3908
|
+
/**
|
|
3909
|
+
* Keep this panel mounted while another tab is selected, overriding `keepMounted`
|
|
3910
|
+
* on `Tabs`. Worth it for a panel holding a half filled form.
|
|
3911
|
+
* */
|
|
3912
|
+
keepMounted?: boolean;
|
|
3913
|
+
/**
|
|
3914
|
+
* The panel contents.
|
|
3915
|
+
* */
|
|
3916
|
+
children?: ReactNode;
|
|
3917
|
+
}
|
|
3918
|
+
interface TabsContextProps {
|
|
3919
|
+
selectedValue: string | undefined;
|
|
3920
|
+
select: (value: string) => void;
|
|
3921
|
+
keepMounted: boolean;
|
|
3922
|
+
isNav: boolean;
|
|
3923
|
+
orientation: TabsOrientation;
|
|
3924
|
+
}
|
|
3925
|
+
|
|
3926
|
+
/**
|
|
3927
|
+
* Holds which tab is selected, and the look shared by the tabs and their panels.
|
|
3928
|
+
*
|
|
3929
|
+
* @example
|
|
3930
|
+
* ```tsx
|
|
3931
|
+
* <Tabs defaultValue="profile">
|
|
3932
|
+
* <TabList>
|
|
3933
|
+
* <Tab value="profile">Profile</Tab>
|
|
3934
|
+
* <Tab value="billing">Billing</Tab>
|
|
3935
|
+
* </TabList>
|
|
3936
|
+
*
|
|
3937
|
+
* <TabPanel value="profile"><ProfileForm /></TabPanel>
|
|
3938
|
+
* <TabPanel value="billing"><BillingForm /></TabPanel>
|
|
3939
|
+
* </Tabs>
|
|
3940
|
+
* ```
|
|
3941
|
+
*
|
|
3942
|
+
* @example
|
|
3943
|
+
* As navigation, with the router holding the state and no panels:
|
|
3944
|
+
*
|
|
3945
|
+
* ```tsx
|
|
3946
|
+
* <Tabs as="nav" value={pathname}>
|
|
3947
|
+
* <TabList>
|
|
3948
|
+
* <Tab value="/settings/profile" asChild>
|
|
3949
|
+
* <Link href="/settings/profile">Profile</Link>
|
|
3950
|
+
* </Tab>
|
|
3951
|
+
* </TabList>
|
|
3952
|
+
* </Tabs>
|
|
3953
|
+
* ```
|
|
3954
|
+
*/
|
|
3955
|
+
declare const Tabs: {
|
|
3956
|
+
({ value, defaultValue, onChange, variant, size, orientation, fullWidth, as, keepMounted, className, children, ...rest }: TabsProps): react_jsx_runtime.JSX.Element;
|
|
3957
|
+
displayName: string;
|
|
3958
|
+
};
|
|
3959
|
+
|
|
3960
|
+
/**
|
|
3961
|
+
* The strip the tabs sit in. Owns the keyboard navigation and keeps the selected tab in
|
|
3962
|
+
* view when there are more tabs than room.
|
|
3963
|
+
*
|
|
3964
|
+
* Put it wherever the layout wants it — a sticky header, say — and the panels can live
|
|
3965
|
+
* somewhere else entirely.
|
|
3966
|
+
*/
|
|
3967
|
+
declare const TabList: {
|
|
3968
|
+
({ className, children, ...rest }: TabListProps): react_jsx_runtime.JSX.Element;
|
|
3969
|
+
displayName: string;
|
|
3970
|
+
};
|
|
3971
|
+
|
|
3972
|
+
/**
|
|
3973
|
+
* One tab. Whatever you put inside is what the tab shows.
|
|
3974
|
+
*
|
|
3975
|
+
* @example
|
|
3976
|
+
* ```tsx
|
|
3977
|
+
* <Tab value="profile">Profile</Tab>
|
|
3978
|
+
* <Tab value="alerts"><BellIcon /> Alerts <Badge color="error">7</Badge></Tab>
|
|
3979
|
+
* ```
|
|
3980
|
+
*
|
|
3981
|
+
* @example
|
|
3982
|
+
* A real link, for navigation tabs:
|
|
3983
|
+
*
|
|
3984
|
+
* ```tsx
|
|
3985
|
+
* <Tab value="/settings/profile" asChild>
|
|
3986
|
+
* <Link href="/settings/profile">Profile</Link>
|
|
3987
|
+
* </Tab>
|
|
3988
|
+
* ```
|
|
3989
|
+
*/
|
|
3990
|
+
declare const Tab: {
|
|
3991
|
+
({ value, disabled, asChild, className, children, ...rest }: TabProps): react_jsx_runtime.JSX.Element;
|
|
3992
|
+
displayName: string;
|
|
3993
|
+
};
|
|
3994
|
+
|
|
3995
|
+
/**
|
|
3996
|
+
* The panel a tab reveals, matched to it by `value`.
|
|
3997
|
+
*
|
|
3998
|
+
* Hidden panels unmount by default, so a form inside one loses its state. Pass
|
|
3999
|
+
* `keepMounted` here, or on `Tabs` for all of them, to hide rather than unmount.
|
|
4000
|
+
*
|
|
4001
|
+
* @example
|
|
4002
|
+
* ```tsx
|
|
4003
|
+
* <TabPanel value="profile">
|
|
4004
|
+
* <ProfileForm />
|
|
4005
|
+
* </TabPanel>
|
|
4006
|
+
* ```
|
|
4007
|
+
*/
|
|
4008
|
+
declare const TabPanel: {
|
|
4009
|
+
({ value, keepMounted, className, children, ...rest }: TabPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
4010
|
+
displayName: string;
|
|
4011
|
+
};
|
|
4012
|
+
|
|
4013
|
+
declare const useTabs: () => TabsContextProps;
|
|
4014
|
+
|
|
4015
|
+
/** Extensible variant map - To allow module augmentation */
|
|
4016
|
+
interface AccordionVariantMap {
|
|
4017
|
+
separated: unknown;
|
|
4018
|
+
contained: unknown;
|
|
4019
|
+
plain: unknown;
|
|
4020
|
+
}
|
|
4021
|
+
/** Extensible size map - To allow module augmentation */
|
|
4022
|
+
interface AccordionSizeMap {
|
|
4023
|
+
sm: unknown;
|
|
4024
|
+
md: unknown;
|
|
4025
|
+
lg: unknown;
|
|
4026
|
+
}
|
|
4027
|
+
type AccordionValue = string | string[];
|
|
4028
|
+
interface AccordionProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
4029
|
+
/**
|
|
4030
|
+
* Which items are open. A string on its own, or an array when `multiple` is set.
|
|
4031
|
+
* Leave it out to let the component hold the state.
|
|
4032
|
+
* */
|
|
4033
|
+
value?: AccordionValue;
|
|
4034
|
+
/**
|
|
4035
|
+
* Which items start open when the component holds the state.
|
|
4036
|
+
* */
|
|
4037
|
+
defaultValue?: AccordionValue;
|
|
4038
|
+
/**
|
|
4039
|
+
* Called with what is open now: a string, or an array when `multiple` is set. The
|
|
4040
|
+
* string is empty when the last open item closes.
|
|
4041
|
+
* */
|
|
4042
|
+
onChange?: (value: AccordionValue) => void;
|
|
4043
|
+
/**
|
|
4044
|
+
* Let several items be open at once. One at a time by default, which is what a FAQ
|
|
4045
|
+
* usually wants.(Default: false)
|
|
4046
|
+
* */
|
|
4047
|
+
multiple?: boolean;
|
|
4048
|
+
/**
|
|
4049
|
+
* Whether the open item can be closed, leaving nothing open. Turn it off to keep one
|
|
4050
|
+
* item open at all times.(Default: true)
|
|
4051
|
+
* */
|
|
4052
|
+
collapsible?: boolean;
|
|
4053
|
+
/**
|
|
4054
|
+
* How the items are framed.(Default: 'plain')
|
|
4055
|
+
* */
|
|
4056
|
+
variant?: keyof AccordionVariantMap;
|
|
4057
|
+
/**
|
|
4058
|
+
* Header padding and text size.(Default: 'md')
|
|
4059
|
+
* */
|
|
4060
|
+
size?: keyof AccordionSizeMap;
|
|
4061
|
+
/**
|
|
4062
|
+
* Keep closed panels in the DOM, hidden rather than unmounted.
|
|
4063
|
+
*
|
|
4064
|
+
* On by default, because it is what makes the open and close animate, and it keeps a
|
|
4065
|
+
* half filled form alive while its panel is shut. Turn it off when the panels are
|
|
4066
|
+
* expensive to render, and accept that closing then happens without the
|
|
4067
|
+
* animation.(Default: true)
|
|
4068
|
+
* */
|
|
4069
|
+
keepMounted?: boolean;
|
|
4070
|
+
/**
|
|
4071
|
+
* `AccordionItem` elements.
|
|
4072
|
+
* */
|
|
4073
|
+
children?: ReactNode;
|
|
4074
|
+
}
|
|
4075
|
+
interface AccordionItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
4076
|
+
/**
|
|
4077
|
+
* Identifies the item. This is what `value` and `onChange` report.
|
|
4078
|
+
* */
|
|
4079
|
+
value: string;
|
|
4080
|
+
/**
|
|
4081
|
+
* Stop the item being opened or closed, and take its header out of the keyboard
|
|
4082
|
+
* order.
|
|
4083
|
+
* */
|
|
4084
|
+
disabled?: boolean;
|
|
4085
|
+
/**
|
|
4086
|
+
* An `AccordionHeader` and an `AccordionPanel`.
|
|
4087
|
+
* */
|
|
4088
|
+
children?: ReactNode;
|
|
4089
|
+
}
|
|
4090
|
+
interface AccordionHeaderProps extends HTMLAttributes<HTMLButtonElement> {
|
|
4091
|
+
/**
|
|
4092
|
+
* Hide the chevron that turns as the item opens.(Default: false)
|
|
4093
|
+
* */
|
|
4094
|
+
hideIcon?: boolean;
|
|
4095
|
+
/**
|
|
4096
|
+
* Replace the chevron with something of your own.
|
|
4097
|
+
* */
|
|
4098
|
+
icon?: ReactNode;
|
|
4099
|
+
/**
|
|
4100
|
+
* What the header shows.
|
|
4101
|
+
* */
|
|
4102
|
+
children?: ReactNode;
|
|
4103
|
+
}
|
|
4104
|
+
interface AccordionPanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
4105
|
+
/**
|
|
4106
|
+
* Keep this panel in the DOM while it is closed, overriding `keepMounted` on
|
|
4107
|
+
* `Accordion`.
|
|
4108
|
+
* */
|
|
4109
|
+
keepMounted?: boolean;
|
|
4110
|
+
/**
|
|
4111
|
+
* The panel contents.
|
|
4112
|
+
* */
|
|
4113
|
+
children?: ReactNode;
|
|
4114
|
+
}
|
|
4115
|
+
interface AccordionContextProps {
|
|
4116
|
+
openValues: string[];
|
|
4117
|
+
toggle: (value: string) => void;
|
|
4118
|
+
keepMounted: boolean;
|
|
4119
|
+
}
|
|
4120
|
+
interface AccordionItemContextProps {
|
|
4121
|
+
value: string;
|
|
4122
|
+
disabled: boolean;
|
|
4123
|
+
open: boolean;
|
|
4124
|
+
}
|
|
4125
|
+
|
|
4126
|
+
/**
|
|
4127
|
+
* A stack of items that open one at a time, or several at once.
|
|
4128
|
+
*
|
|
4129
|
+
* @example
|
|
4130
|
+
* ```tsx
|
|
4131
|
+
* <Accordion defaultValue="shipping">
|
|
4132
|
+
* <AccordionItem value="shipping">
|
|
4133
|
+
* <AccordionHeader>Shipping</AccordionHeader>
|
|
4134
|
+
* <AccordionPanel>Ships in 2 to 3 working days.</AccordionPanel>
|
|
4135
|
+
* </AccordionItem>
|
|
4136
|
+
* </Accordion>
|
|
4137
|
+
* ```
|
|
4138
|
+
*/
|
|
4139
|
+
declare const Accordion: {
|
|
4140
|
+
({ value, defaultValue, onChange, multiple, collapsible, variant, size, keepMounted, className, children, ...rest }: AccordionProps): react_jsx_runtime.JSX.Element;
|
|
4141
|
+
displayName: string;
|
|
4142
|
+
};
|
|
4143
|
+
|
|
4144
|
+
/**
|
|
4145
|
+
* One item: a header and the panel it opens.
|
|
4146
|
+
*/
|
|
4147
|
+
declare const AccordionItem: {
|
|
4148
|
+
({ value, disabled, className, children, ...rest }: AccordionItemProps): react_jsx_runtime.JSX.Element;
|
|
4149
|
+
displayName: string;
|
|
4150
|
+
};
|
|
4151
|
+
|
|
4152
|
+
/**
|
|
4153
|
+
* The button that opens and closes its item. Whatever you put inside is what it shows.
|
|
4154
|
+
*
|
|
4155
|
+
* @example
|
|
4156
|
+
* ```tsx
|
|
4157
|
+
* <AccordionHeader>
|
|
4158
|
+
* <TruckIcon /> Shipping <Badge color="info">free</Badge>
|
|
4159
|
+
* </AccordionHeader>
|
|
4160
|
+
* ```
|
|
4161
|
+
*/
|
|
4162
|
+
declare const AccordionHeader: {
|
|
4163
|
+
({ hideIcon, icon, className, children, onClick, ...rest }: AccordionHeaderProps): react_jsx_runtime.JSX.Element;
|
|
4164
|
+
displayName: string;
|
|
4165
|
+
};
|
|
4166
|
+
|
|
4167
|
+
/**
|
|
4168
|
+
* What an item reveals.
|
|
4169
|
+
*
|
|
4170
|
+
* The open and close is animated with a CSS grid row rather than a height, so it runs to
|
|
4171
|
+
* the content's real height without measuring anything. That needs the panel to stay in
|
|
4172
|
+
* the DOM, which is why `keepMounted` is on by default.
|
|
4173
|
+
*/
|
|
4174
|
+
declare const AccordionPanel: {
|
|
4175
|
+
({ keepMounted, className, children, ...rest }: AccordionPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
4176
|
+
displayName: string;
|
|
4177
|
+
};
|
|
4178
|
+
|
|
4179
|
+
declare const useAccordion: () => AccordionContextProps;
|
|
4180
|
+
declare const useAccordionItem: () => AccordionItemContextProps;
|
|
4181
|
+
|
|
4182
|
+
/** Extensible color map - To allow module augmentation */
|
|
4183
|
+
interface AlertColorMap {
|
|
4184
|
+
error: unknown;
|
|
4185
|
+
warning: unknown;
|
|
4186
|
+
info: unknown;
|
|
4187
|
+
success: unknown;
|
|
4188
|
+
default: unknown;
|
|
4189
|
+
}
|
|
4190
|
+
interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
4191
|
+
/**
|
|
4192
|
+
* What the alert means. Drives the accent colour.(Default: 'default')
|
|
4193
|
+
*
|
|
4194
|
+
* Named `color` to match `Button` and `Badge`, where `variant` is the visual
|
|
4195
|
+
* treatment rather than the meaning.
|
|
4196
|
+
* */
|
|
4197
|
+
color?: keyof AlertColorMap;
|
|
4198
|
+
/**
|
|
4199
|
+
* Determines if the alert should be condensed.(Default: false)
|
|
4200
|
+
* */
|
|
4201
|
+
condensed?: boolean;
|
|
4202
|
+
/**
|
|
4203
|
+
* Main message to display in the alert.
|
|
4204
|
+
*/
|
|
4205
|
+
title: ReactNode | FC;
|
|
4206
|
+
/**
|
|
4207
|
+
* Extra description to display in the alert.
|
|
4208
|
+
*/
|
|
4209
|
+
description?: ReactNode | FC;
|
|
4210
|
+
/**
|
|
4211
|
+
* Callback function to handle the remove event.
|
|
4212
|
+
*/
|
|
4213
|
+
onRemove?: () => void;
|
|
4214
|
+
/**
|
|
4215
|
+
* Custom icon to display in the alert.
|
|
4216
|
+
* If provided, iconClassName will be ignored.
|
|
4217
|
+
*/
|
|
4218
|
+
icon?: ReactNode | FC;
|
|
4219
|
+
/**
|
|
4220
|
+
* Custom class name for the icon.
|
|
4221
|
+
* Only used if icon is not provided.
|
|
4222
|
+
*/
|
|
4223
|
+
iconClassName?: string;
|
|
4224
|
+
}
|
|
4225
|
+
|
|
4226
|
+
/**
|
|
4227
|
+
* An alert component for displaying important messages with different severity levels.
|
|
4228
|
+
*
|
|
4229
|
+
* Supports multiple colours (error, success, warning, info), optional descriptions,
|
|
4230
|
+
* custom icons, and dismissal functionality. The `condensed` prop reduces vertical padding
|
|
4231
|
+
* for a more compact appearance.
|
|
4232
|
+
*
|
|
4233
|
+
* @example
|
|
4234
|
+
* ```tsx
|
|
4235
|
+
* // Basic alert
|
|
4236
|
+
* <Alert title="This is an alert message" />
|
|
4237
|
+
*
|
|
4238
|
+
* // Different colours
|
|
4239
|
+
* <Alert color="success" title="Success!" />
|
|
4240
|
+
* <Alert color="warning" title="Warning!" />
|
|
4241
|
+
* <Alert color="info" title="Information" />
|
|
4242
|
+
*
|
|
4243
|
+
* // Condensed style
|
|
4244
|
+
* <Alert color="success" condensed title="This is a success message" />
|
|
4245
|
+
*
|
|
4246
|
+
* // With description and remove button
|
|
4247
|
+
* <Alert
|
|
4248
|
+
* color="warning"
|
|
4249
|
+
* title="Warning!"
|
|
4250
|
+
* description="This is a detailed warning message with more context."
|
|
4251
|
+
* onRemove={() => console.log('Alert dismissed')}
|
|
4252
|
+
* />
|
|
4253
|
+
*
|
|
4254
|
+
* // With custom icon
|
|
4255
|
+
* <Alert
|
|
4256
|
+
* color="info"
|
|
4257
|
+
* title="Custom Icon"
|
|
4258
|
+
* icon={<CustomIcon />}
|
|
4259
|
+
* />
|
|
4260
|
+
* ```
|
|
4261
|
+
*/
|
|
4262
|
+
declare const Alert: FC<AlertProps>;
|
|
4263
|
+
|
|
4264
|
+
/** Extensible size map - To allow module augmentation */
|
|
4265
|
+
interface AvatarSizeMap {
|
|
4266
|
+
xs: unknown;
|
|
4267
|
+
sm: unknown;
|
|
4268
|
+
md: unknown;
|
|
4269
|
+
lg: unknown;
|
|
4270
|
+
xl: unknown;
|
|
4271
|
+
}
|
|
4272
|
+
/** Extensible shape map - To allow module augmentation */
|
|
4273
|
+
interface AvatarShapeMap {
|
|
4274
|
+
circle: unknown;
|
|
4275
|
+
rounded: unknown;
|
|
4276
|
+
square: unknown;
|
|
4277
|
+
}
|
|
4278
|
+
/** Extensible color map - To allow module augmentation */
|
|
4279
|
+
interface AvatarColorMap {
|
|
4280
|
+
default: unknown;
|
|
4281
|
+
primary: unknown;
|
|
4282
|
+
success: unknown;
|
|
4283
|
+
error: unknown;
|
|
4284
|
+
warning: unknown;
|
|
4285
|
+
info: unknown;
|
|
4286
|
+
}
|
|
4287
|
+
interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
|
|
4288
|
+
/**
|
|
4289
|
+
* Image to show. When it is missing or fails to load, the fallback is shown instead.
|
|
4290
|
+
* */
|
|
4291
|
+
src?: string;
|
|
4292
|
+
/**
|
|
4293
|
+
* Alternative text for the image. Falls back to `name`.
|
|
4294
|
+
* */
|
|
4295
|
+
alt?: string;
|
|
4296
|
+
/**
|
|
4297
|
+
* Who this is. Its initials are drawn when there is no image, and it labels the avatar
|
|
4298
|
+
* for a screen reader.
|
|
4299
|
+
* */
|
|
4300
|
+
name?: string;
|
|
4301
|
+
/**
|
|
4302
|
+
* What to draw instead of the initials when there is no image.
|
|
4303
|
+
* */
|
|
4304
|
+
fallback?: ReactNode | FC;
|
|
4305
|
+
/**
|
|
4306
|
+
* Avatar size. Taken from the surrounding `AvatarGroup` when it is not set
|
|
4307
|
+
* here.(Default: 'md')
|
|
4308
|
+
* */
|
|
4309
|
+
size?: keyof AvatarSizeMap;
|
|
4310
|
+
/**
|
|
4311
|
+
* Corner treatment. Taken from the surrounding `AvatarGroup` when it is not set
|
|
4312
|
+
* here.(Default: 'circle')
|
|
4313
|
+
* */
|
|
4314
|
+
shape?: keyof AvatarShapeMap;
|
|
4315
|
+
/**
|
|
4316
|
+
* Accent behind the fallback.(Default: 'default')
|
|
4317
|
+
* */
|
|
4318
|
+
color?: keyof AvatarColorMap;
|
|
4319
|
+
}
|
|
4320
|
+
interface AvatarGroupOverflow {
|
|
4321
|
+
/**
|
|
4322
|
+
* The avatars past `max`, as the props they were given, in the order they were given.
|
|
4323
|
+
* Read whatever you need off them — `name`, `src`, your own extras — and render it
|
|
4324
|
+
* however you like. `avatars.length` is the number behind the count.
|
|
4325
|
+
* */
|
|
4326
|
+
avatars: AvatarProps[];
|
|
4327
|
+
}
|
|
4328
|
+
interface AvatarGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
4329
|
+
/**
|
|
4330
|
+
* How many avatars to show before the rest are counted. Leave it out to show them all.
|
|
4331
|
+
* */
|
|
4332
|
+
max?: number;
|
|
4333
|
+
/**
|
|
4334
|
+
* Size for every avatar in the group, and for the overflow count.(Default: 'md')
|
|
4335
|
+
* */
|
|
4336
|
+
size?: keyof AvatarSizeMap;
|
|
4337
|
+
/**
|
|
4338
|
+
* Corner treatment for every avatar in the group.(Default: 'circle')
|
|
4339
|
+
* */
|
|
4340
|
+
shape?: keyof AvatarShapeMap;
|
|
4341
|
+
/**
|
|
4342
|
+
* Lift each avatar on hover, naming it in an overlay, and open the overflow list from
|
|
4343
|
+
* the count. Only avatars with a `name` are named.(Default: true)
|
|
4344
|
+
* */
|
|
4345
|
+
interactive?: boolean;
|
|
4346
|
+
/**
|
|
4347
|
+
* What fills the overlay behind the `+2` count, which opens on hover. Leave it out for
|
|
4348
|
+
* the list of names. The overlay itself is not yours to place — only what is inside it.
|
|
4349
|
+
* */
|
|
4350
|
+
renderOverflow?: (overflow: AvatarGroupOverflow) => ReactNode;
|
|
4351
|
+
/**
|
|
4352
|
+
* The avatars.
|
|
4353
|
+
* */
|
|
4354
|
+
children?: ReactNode;
|
|
4355
|
+
}
|
|
4356
|
+
|
|
4357
|
+
/**
|
|
4358
|
+
* A picture of someone, falling back to their initials.
|
|
4359
|
+
*
|
|
4360
|
+
* @example
|
|
4361
|
+
* ```tsx
|
|
4362
|
+
* <Avatar name="Ada Lovelace" src={user.image} />
|
|
4363
|
+
* <Avatar name="Ada Lovelace" size="lg" />
|
|
4364
|
+
* <Avatar shape="rounded" fallback={<BotIcon />} />
|
|
4365
|
+
* ```
|
|
4366
|
+
*/
|
|
4367
|
+
declare const Avatar: react.ForwardRefExoticComponent<AvatarProps & react.RefAttributes<HTMLSpanElement>>;
|
|
4368
|
+
|
|
4369
|
+
/**
|
|
4370
|
+
* Overlapping avatars, with the rest counted once there are more than `max`.
|
|
4371
|
+
*
|
|
4372
|
+
* `size` and `shape` set here apply to every avatar inside, so the overlap lines up
|
|
4373
|
+
* without repeating them. Each avatar sits on top of the one after it, so the children are
|
|
4374
|
+
* handed over reversed and the styles lay them out right to left.
|
|
4375
|
+
*
|
|
4376
|
+
* @example
|
|
4377
|
+
* ```tsx
|
|
4378
|
+
* <AvatarGroup max={3}>
|
|
4379
|
+
* <Avatar name="Ada Lovelace" />
|
|
4380
|
+
* <Avatar name="Grace Hopper" />
|
|
4381
|
+
* <Avatar name="Alan Turing" />
|
|
4382
|
+
* <Avatar name="Katherine Johnson" />
|
|
4383
|
+
* </AvatarGroup>
|
|
4384
|
+
* ```
|
|
4385
|
+
*
|
|
4386
|
+
* @example
|
|
4387
|
+
* Your own contents behind the count:
|
|
4388
|
+
*
|
|
4389
|
+
* ```tsx
|
|
4390
|
+
* <AvatarGroup
|
|
4391
|
+
* max={3}
|
|
4392
|
+
* renderOverflow={({ avatars }) => (
|
|
4393
|
+
* <ul>
|
|
4394
|
+
* {avatars.map((avatar) => (
|
|
4395
|
+
* <li key={avatar.name}>{avatar.name}</li>
|
|
4396
|
+
* ))}
|
|
4397
|
+
* </ul>
|
|
4398
|
+
* )}>
|
|
4399
|
+
* …
|
|
4400
|
+
* </AvatarGroup>
|
|
4401
|
+
* ```
|
|
4402
|
+
*/
|
|
4403
|
+
declare const AvatarGroup: {
|
|
4404
|
+
({ max, size, shape, interactive, renderOverflow, className, children, ...rest }: AvatarGroupProps): react_jsx_runtime.JSX.Element;
|
|
4405
|
+
displayName: string;
|
|
4406
|
+
};
|
|
4407
|
+
|
|
4408
|
+
/** Extensible variant map - To allow module augmentation */
|
|
4409
|
+
interface BadgeVariantMap {
|
|
4410
|
+
filled: unknown;
|
|
4411
|
+
soft: unknown;
|
|
4412
|
+
outlined: unknown;
|
|
4413
|
+
}
|
|
4414
|
+
/** Extensible color map - To allow module augmentation */
|
|
4415
|
+
interface BadgeColorMap {
|
|
4416
|
+
default: unknown;
|
|
4417
|
+
primary: unknown;
|
|
4418
|
+
success: unknown;
|
|
4419
|
+
error: unknown;
|
|
4420
|
+
warning: unknown;
|
|
4421
|
+
info: unknown;
|
|
4422
|
+
}
|
|
4423
|
+
/** Extensible size map - To allow module augmentation */
|
|
4424
|
+
interface BadgeSizeMap {
|
|
4425
|
+
sm: unknown;
|
|
4426
|
+
md: unknown;
|
|
4427
|
+
lg: unknown;
|
|
4428
|
+
}
|
|
4429
|
+
/** Extensible shape map - To allow module augmentation */
|
|
4430
|
+
interface BadgeShapeMap {
|
|
4431
|
+
rounded: unknown;
|
|
4432
|
+
pill: unknown;
|
|
4433
|
+
square: unknown;
|
|
4434
|
+
}
|
|
4435
|
+
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
4436
|
+
/**
|
|
4437
|
+
* How the badge is filled.(Default: 'soft')
|
|
4438
|
+
* */
|
|
4439
|
+
variant?: keyof BadgeVariantMap;
|
|
4440
|
+
/**
|
|
4441
|
+
* What the badge means. Drives the accent colour.(Default: 'default')
|
|
4442
|
+
* */
|
|
4443
|
+
color?: keyof BadgeColorMap;
|
|
4444
|
+
/**
|
|
4445
|
+
* Badge size.(Default: 'md')
|
|
4446
|
+
* */
|
|
4447
|
+
size?: keyof BadgeSizeMap;
|
|
4448
|
+
/**
|
|
4449
|
+
* Corner treatment.(Default: 'rounded')
|
|
4450
|
+
* */
|
|
4451
|
+
shape?: keyof BadgeShapeMap;
|
|
4452
|
+
/**
|
|
4453
|
+
* Show a leading status dot. It inherits the badge colour and scales with `size`.
|
|
4454
|
+
* Ignored when `icon` is set.(Default: false)
|
|
4455
|
+
* */
|
|
4456
|
+
dot?: boolean;
|
|
4457
|
+
/**
|
|
4458
|
+
* Custom leading visual, rendered as given. Style it where you define it.
|
|
4459
|
+
* Takes precedence over `dot`.
|
|
4460
|
+
* */
|
|
4461
|
+
icon?: ReactNode | FC;
|
|
4462
|
+
}
|
|
4463
|
+
|
|
4464
|
+
/**
|
|
4465
|
+
* A small inline label for status, counts and categories.
|
|
4466
|
+
*
|
|
4467
|
+
* Two independent axes: `variant` is how it is filled, `color` is what it means. So a
|
|
4468
|
+
* success badge can be solid, tinted or outlined without changing what it says.
|
|
4469
|
+
*
|
|
4470
|
+
* @example
|
|
4471
|
+
* ```tsx
|
|
4472
|
+
* <Badge>Draft</Badge>
|
|
4473
|
+
* <Badge color="success">Active</Badge>
|
|
4474
|
+
* <Badge variant="filled" color="error">Failed</Badge>
|
|
4475
|
+
* <Badge variant="outlined" color="info" size="sm">Beta</Badge>
|
|
4476
|
+
*
|
|
4477
|
+
* // Status dot, custom icon, shapes
|
|
4478
|
+
* <Badge color="success" dot>Live</Badge>
|
|
4479
|
+
* <Badge color="primary" icon={<StarIcon />}>Featured</Badge>
|
|
4480
|
+
* <Badge><Avatar size="xs" />Alice</Badge>
|
|
4481
|
+
* <Badge shape="pill" color="primary">New</Badge>
|
|
4482
|
+
* <Badge shape="square">v2.0</Badge>
|
|
4483
|
+
* ```
|
|
4484
|
+
*/
|
|
4485
|
+
declare const Badge: react.ForwardRefExoticComponent<BadgeProps & react.RefAttributes<HTMLSpanElement>>;
|
|
2858
4486
|
|
|
2859
|
-
|
|
2860
|
-
|
|
4487
|
+
/** Extensible shape map - To allow module augmentation */
|
|
4488
|
+
interface SkeletonShapeMap {
|
|
4489
|
+
text: unknown;
|
|
4490
|
+
rounded: unknown;
|
|
4491
|
+
circle: unknown;
|
|
2861
4492
|
}
|
|
2862
|
-
|
|
2863
|
-
|
|
4493
|
+
/** Extensible animation map - To allow module augmentation */
|
|
4494
|
+
interface SkeletonAnimationMap {
|
|
4495
|
+
pulse: unknown;
|
|
4496
|
+
wave: unknown;
|
|
4497
|
+
none: unknown;
|
|
2864
4498
|
}
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
4499
|
+
interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {
|
|
4500
|
+
/**
|
|
4501
|
+
* The outline of the placeholder.(Default: 'text')
|
|
4502
|
+
* */
|
|
4503
|
+
shape?: keyof SkeletonShapeMap;
|
|
4504
|
+
/**
|
|
4505
|
+
* How it animates while it waits. Dropped under `prefers-reduced-motion`.(Default: 'pulse')
|
|
4506
|
+
* */
|
|
4507
|
+
animation?: keyof SkeletonAnimationMap;
|
|
4508
|
+
/**
|
|
4509
|
+
* How many stacked lines to draw, for a paragraph placeholder. The last line is drawn
|
|
4510
|
+
* short so the block reads as text. Only applies to the `text` shape.(Default: 1)
|
|
4511
|
+
* */
|
|
4512
|
+
lines?: number;
|
|
4513
|
+
/**
|
|
4514
|
+
* While true the placeholder is drawn. Turn it off and `children` render in its
|
|
4515
|
+
* place.(Default: true)
|
|
4516
|
+
* */
|
|
4517
|
+
loading?: boolean;
|
|
4518
|
+
/**
|
|
4519
|
+
* What replaces the placeholder once `loading` is false. Never rendered while loading,
|
|
4520
|
+
* so it is safe to read data that has not arrived yet.
|
|
4521
|
+
* */
|
|
4522
|
+
children?: ReactNode;
|
|
2870
4523
|
}
|
|
2871
4524
|
|
|
2872
4525
|
/**
|
|
2873
|
-
* A
|
|
4526
|
+
* A placeholder that holds the space content will take while it loads.
|
|
2874
4527
|
*
|
|
2875
|
-
*
|
|
2876
|
-
*
|
|
4528
|
+
* Size it with `className` the way you would size the real thing, so the page does not
|
|
4529
|
+
* move when the content arrives.
|
|
2877
4530
|
*
|
|
2878
4531
|
* @example
|
|
2879
4532
|
* ```tsx
|
|
2880
|
-
*
|
|
2881
|
-
* <
|
|
2882
|
-
*
|
|
2883
|
-
*
|
|
2884
|
-
*
|
|
2885
|
-
* </RHFSelect>
|
|
2886
|
-
*
|
|
2887
|
-
* // Multiple selection
|
|
2888
|
-
* <RHFSelect name="skills" multiple>
|
|
2889
|
-
* <SelectOption value="js" label="JavaScript" />
|
|
2890
|
-
* <SelectOption value="ts" label="TypeScript" />
|
|
2891
|
-
* <SelectOption value="react" label="React" />
|
|
2892
|
-
* </RHFSelect>
|
|
4533
|
+
* <Skeleton />
|
|
4534
|
+
* <Skeleton lines={3} />
|
|
4535
|
+
* <Skeleton shape="circle" className="size-10" />
|
|
4536
|
+
* <Skeleton shape="rounded" className="h-32 w-full" />
|
|
4537
|
+
* ```
|
|
2893
4538
|
*
|
|
2894
|
-
*
|
|
2895
|
-
*
|
|
2896
|
-
* {['low', 'medium', 'high'].map((priority) => (
|
|
2897
|
-
* <SelectOption
|
|
2898
|
-
* key={priority}
|
|
2899
|
-
* value={priority}
|
|
2900
|
-
* label={priority.charAt(0).toUpperCase() + priority.slice(1)}
|
|
2901
|
-
* className={({ selected }) =>
|
|
2902
|
-
* selected ? "text-blue-600 font-bold" : "text-gray-700"
|
|
2903
|
-
* }
|
|
2904
|
-
* />
|
|
2905
|
-
* ))}
|
|
2906
|
-
* </RHFSelect>
|
|
4539
|
+
* @example
|
|
4540
|
+
* Wrapping the real thing, so there is no ternary at the call site:
|
|
2907
4541
|
*
|
|
2908
|
-
*
|
|
2909
|
-
* <
|
|
2910
|
-
*
|
|
2911
|
-
*
|
|
2912
|
-
* console.log('Selected:', value);
|
|
2913
|
-
* fetchSubcategories(value);
|
|
2914
|
-
* }}
|
|
2915
|
-
* >
|
|
2916
|
-
* <SelectOption value="1" label="Category 1" />
|
|
2917
|
-
* <SelectOption value="2" label="Category 2" />
|
|
2918
|
-
* </RHFSelect>
|
|
4542
|
+
* ```tsx
|
|
4543
|
+
* <Skeleton loading={isLoading} shape="circle" className="size-10">
|
|
4544
|
+
* <Avatar src={user.image} />
|
|
4545
|
+
* </Skeleton>
|
|
2919
4546
|
* ```
|
|
2920
4547
|
*/
|
|
2921
|
-
declare const
|
|
4548
|
+
declare const Skeleton: react.ForwardRefExoticComponent<SkeletonProps & react.RefAttributes<HTMLDivElement>>;
|
|
2922
4549
|
|
|
2923
|
-
|
|
4550
|
+
/** Extensible size map - To allow module augmentation */
|
|
4551
|
+
interface ProgressSizeMap {
|
|
4552
|
+
sm: unknown;
|
|
4553
|
+
md: unknown;
|
|
4554
|
+
lg: unknown;
|
|
4555
|
+
}
|
|
4556
|
+
/** Extensible color map - To allow module augmentation */
|
|
4557
|
+
interface ProgressColorMap {
|
|
4558
|
+
default: unknown;
|
|
4559
|
+
primary: unknown;
|
|
4560
|
+
success: unknown;
|
|
4561
|
+
error: unknown;
|
|
4562
|
+
warning: unknown;
|
|
4563
|
+
info: unknown;
|
|
4564
|
+
}
|
|
4565
|
+
interface ProgressLabel {
|
|
4566
|
+
/** How far along, 0 to 100, rounded to whole numbers. */
|
|
4567
|
+
percent: number;
|
|
4568
|
+
/** The value as given, clamped into range. */
|
|
4569
|
+
value: number;
|
|
4570
|
+
/** What `value` is measured against. */
|
|
4571
|
+
max: number;
|
|
4572
|
+
}
|
|
4573
|
+
interface ProgressProps extends HTMLAttributes<HTMLDivElement> {
|
|
2924
4574
|
/**
|
|
2925
|
-
*
|
|
4575
|
+
* How far along. Leave it out when you do not know, and the bar runs on its own until
|
|
4576
|
+
* you do.
|
|
2926
4577
|
* */
|
|
2927
|
-
|
|
4578
|
+
value?: number;
|
|
2928
4579
|
/**
|
|
2929
|
-
*
|
|
4580
|
+
* What `value` is measured against, so `value` reads as a percentage unless you say
|
|
4581
|
+
* otherwise.(Default: 100)
|
|
2930
4582
|
* */
|
|
2931
|
-
|
|
4583
|
+
max?: number;
|
|
2932
4584
|
/**
|
|
2933
|
-
*
|
|
4585
|
+
* What the bar means. Drives the accent colour.(Default: 'primary')
|
|
2934
4586
|
* */
|
|
2935
|
-
|
|
4587
|
+
color?: keyof ProgressColorMap;
|
|
2936
4588
|
/**
|
|
2937
|
-
*
|
|
2938
|
-
* ie. the element that triggers the tooltip to appear
|
|
2939
|
-
* @example
|
|
2940
|
-
*
|
|
2941
|
-
* ```js
|
|
2942
|
-
* <Tooltip content="hello world">
|
|
2943
|
-
* <Button>Hover me</Button> // <-- This is the tooltip trigger
|
|
2944
|
-
* </Tooltip>
|
|
2945
|
-
* ```
|
|
4589
|
+
* Bar thickness.(Default: 'md')
|
|
2946
4590
|
* */
|
|
2947
|
-
|
|
4591
|
+
size?: keyof ProgressSizeMap;
|
|
2948
4592
|
/**
|
|
2949
|
-
*
|
|
4593
|
+
* Text above the bar. A function is called with how far along it is, and only when there
|
|
4594
|
+
* is a value to report; a plain node shows either way.
|
|
2950
4595
|
* */
|
|
2951
|
-
|
|
4596
|
+
label?: ReactNode | ((progress: ProgressLabel) => ReactNode);
|
|
4597
|
+
}
|
|
4598
|
+
|
|
4599
|
+
/**
|
|
4600
|
+
* How far along something is.
|
|
4601
|
+
*
|
|
4602
|
+
* @example
|
|
4603
|
+
* ```tsx
|
|
4604
|
+
* <Progress value={40} />
|
|
4605
|
+
* <Progress value={3} max={7} />
|
|
4606
|
+
* <Progress />
|
|
4607
|
+
* <Progress value={100} color="success" size="lg" />
|
|
4608
|
+
* <Progress value={40} label={({ percent }) => `${percent}%`} />
|
|
4609
|
+
* ```
|
|
4610
|
+
*/
|
|
4611
|
+
declare const Progress: react.ForwardRefExoticComponent<ProgressProps & react.RefAttributes<HTMLDivElement>>;
|
|
4612
|
+
|
|
4613
|
+
/** Extensible size map - To allow module augmentation */
|
|
4614
|
+
interface BreadcrumbSizeMap {
|
|
4615
|
+
sm: unknown;
|
|
4616
|
+
md: unknown;
|
|
4617
|
+
lg: unknown;
|
|
4618
|
+
}
|
|
4619
|
+
interface BreadcrumbProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
4620
|
+
/** The crumbs, in order. */
|
|
4621
|
+
children?: ReactNode;
|
|
2952
4622
|
/**
|
|
2953
|
-
*
|
|
2954
|
-
* Use this to avoid invalid button nesting errors when using a button as the trigger.
|
|
4623
|
+
* What goes between the crumbs. A chevron when it is left out.
|
|
2955
4624
|
* */
|
|
2956
|
-
|
|
4625
|
+
separator?: ReactNode;
|
|
2957
4626
|
/**
|
|
2958
|
-
*
|
|
4627
|
+
* How many crumbs to show before the middle is folded away behind an ellipsis, which
|
|
4628
|
+
* opens them as a list. The first and the last are always kept. Leave it out to show
|
|
4629
|
+
* them all.
|
|
2959
4630
|
* */
|
|
2960
|
-
|
|
4631
|
+
maxItems?: number;
|
|
2961
4632
|
/**
|
|
2962
|
-
*
|
|
4633
|
+
* How many to keep at the end when the middle is folded away.(Default: 1)
|
|
2963
4634
|
* */
|
|
2964
|
-
|
|
4635
|
+
itemsAfterCollapse?: number;
|
|
2965
4636
|
/**
|
|
2966
|
-
*
|
|
4637
|
+
* How many to keep at the start when the middle is folded away.(Default: 1)
|
|
2967
4638
|
* */
|
|
2968
|
-
|
|
4639
|
+
itemsBeforeCollapse?: number;
|
|
4640
|
+
/** What the ellipsis is called, for a screen reader.(Default: 'Show the rest') */
|
|
4641
|
+
expandLabel?: string;
|
|
4642
|
+
/** Where the list of folded crumbs opens.(Default: 'bottom-start') */
|
|
4643
|
+
menuPlacement?: Placement;
|
|
4644
|
+
/** Extra class for that list. */
|
|
4645
|
+
menuClassName?: string;
|
|
4646
|
+
/** What the whole trail is called.(Default: 'Breadcrumb') */
|
|
4647
|
+
"aria-label"?: string;
|
|
4648
|
+
size?: keyof BreadcrumbSizeMap;
|
|
4649
|
+
className?: string;
|
|
4650
|
+
}
|
|
4651
|
+
interface BreadcrumbItemProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "children"> {
|
|
4652
|
+
children?: ReactNode;
|
|
4653
|
+
/**
|
|
4654
|
+
* Where it goes, as a plain anchor. That reloads the page, so for client side routing
|
|
4655
|
+
* reach for `asChild` with your own link, or give the crumb an `onClick`.
|
|
4656
|
+
* */
|
|
4657
|
+
href?: string;
|
|
4658
|
+
/**
|
|
4659
|
+
* Whether this is the page you are on. The last crumb takes this for itself, unless
|
|
4660
|
+
* another one claims it — so setting it here moves it rather than adding a second.
|
|
4661
|
+
* */
|
|
4662
|
+
current?: boolean;
|
|
4663
|
+
/**
|
|
4664
|
+
* Hand the crumb to your own element, a router link most often, rather than rendering an
|
|
4665
|
+
* anchor. It keeps its own class name, with the crumb's added.
|
|
4666
|
+
*
|
|
4667
|
+
* This is the one to use with a router: an `href` is a plain anchor and reloads.
|
|
4668
|
+
* */
|
|
4669
|
+
asChild?: boolean;
|
|
2969
4670
|
}
|
|
2970
4671
|
|
|
2971
|
-
|
|
4672
|
+
/**
|
|
4673
|
+
* The trail of pages above the one you are on.
|
|
4674
|
+
*
|
|
4675
|
+
* @example
|
|
4676
|
+
* ```tsx
|
|
4677
|
+
* <Breadcrumb>
|
|
4678
|
+
* <BreadcrumbItem href="/">Home</BreadcrumbItem>
|
|
4679
|
+
* <BreadcrumbItem href="/settings">Settings</BreadcrumbItem>
|
|
4680
|
+
* <BreadcrumbItem>Profile</BreadcrumbItem>
|
|
4681
|
+
* </Breadcrumb>
|
|
4682
|
+
* ```
|
|
4683
|
+
*
|
|
4684
|
+
* @example
|
|
4685
|
+
* A deep trail, with the middle folded away until it is asked for:
|
|
4686
|
+
*
|
|
4687
|
+
* ```tsx
|
|
4688
|
+
* <Breadcrumb maxItems={3}>…</Breadcrumb>
|
|
4689
|
+
* ```
|
|
4690
|
+
*/
|
|
4691
|
+
declare const Breadcrumb: {
|
|
4692
|
+
({ children, separator, maxItems, itemsBeforeCollapse, itemsAfterCollapse, expandLabel, menuPlacement, size, className, menuClassName, "aria-label": ariaLabel, ...rest }: BreadcrumbProps): react_jsx_runtime.JSX.Element;
|
|
4693
|
+
displayName: string;
|
|
4694
|
+
};
|
|
2972
4695
|
|
|
2973
|
-
/**
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
4696
|
+
/**
|
|
4697
|
+
* One crumb.
|
|
4698
|
+
*
|
|
4699
|
+
* The last one is the page you are on, so it is drawn as text rather than a link and
|
|
4700
|
+
* carries `aria-current`. Set `current` when the last crumb is not where you are.
|
|
4701
|
+
*
|
|
4702
|
+
* `href` renders a plain anchor, which reloads the page. For client side routing hand the
|
|
4703
|
+
* crumb your own link with `asChild`, or give it an `onClick` and it becomes a button.
|
|
4704
|
+
*
|
|
4705
|
+
* @example
|
|
4706
|
+
* ```tsx
|
|
4707
|
+
* <BreadcrumbItem href="/settings">Settings</BreadcrumbItem>
|
|
4708
|
+
* <BreadcrumbItem>Profile</BreadcrumbItem>
|
|
4709
|
+
*
|
|
4710
|
+
* <BreadcrumbItem asChild>
|
|
4711
|
+
* <Link href="/settings">Settings</Link>
|
|
4712
|
+
* </BreadcrumbItem>
|
|
4713
|
+
*
|
|
4714
|
+
* <BreadcrumbItem onClick={() => router.push("/settings")}>Settings</BreadcrumbItem>
|
|
4715
|
+
* ```
|
|
4716
|
+
*/
|
|
4717
|
+
declare const BreadcrumbItem: {
|
|
4718
|
+
({ children, href, current, asChild, className, onClick, ...rest }: BreadcrumbItemProps): react_jsx_runtime.JSX.Element;
|
|
4719
|
+
displayName: string;
|
|
4720
|
+
};
|
|
4721
|
+
|
|
4722
|
+
/** Extensible size map - To allow module augmentation */
|
|
4723
|
+
interface StepperSizeMap {
|
|
4724
|
+
sm: unknown;
|
|
4725
|
+
md: unknown;
|
|
4726
|
+
lg: unknown;
|
|
2980
4727
|
}
|
|
2981
|
-
|
|
4728
|
+
/** Extensible orientation map - To allow module augmentation */
|
|
4729
|
+
interface StepperOrientationMap {
|
|
4730
|
+
horizontal: unknown;
|
|
4731
|
+
vertical: unknown;
|
|
4732
|
+
}
|
|
4733
|
+
/**
|
|
4734
|
+
* Where a step stands. Worked out from where it sits unless the step says otherwise.
|
|
4735
|
+
*/
|
|
4736
|
+
type StepStatus = "complete" | "current" | "upcoming" | "error";
|
|
4737
|
+
interface StepperProps extends Omit<HTMLAttributes<HTMLElement>, "onChange"> {
|
|
4738
|
+
/** Which step you are on, by its `value`. */
|
|
4739
|
+
value: string;
|
|
2982
4740
|
/**
|
|
2983
|
-
*
|
|
4741
|
+
* Called when a step is picked. Leaving it out makes the stepper something to read
|
|
4742
|
+
* rather than something to use.
|
|
2984
4743
|
* */
|
|
2985
|
-
|
|
4744
|
+
onChange?: (value: string) => void;
|
|
4745
|
+
/** The steps, in order. */
|
|
4746
|
+
children?: ReactNode;
|
|
2986
4747
|
/**
|
|
2987
|
-
*
|
|
4748
|
+
* Whether the steps have to be taken in order. While true only the ones already done can
|
|
4749
|
+
* be gone back to; turn it off when any step is reachable.(Default: true)
|
|
2988
4750
|
* */
|
|
2989
|
-
|
|
2990
|
-
/**
|
|
2991
|
-
|
|
2992
|
-
*/
|
|
2993
|
-
title: ReactNode | FC;
|
|
2994
|
-
/**
|
|
2995
|
-
* Extra description to display in the alert.
|
|
2996
|
-
*/
|
|
2997
|
-
description?: ReactNode | FC;
|
|
4751
|
+
linear?: boolean;
|
|
4752
|
+
/** Which way the steps run.(Default: 'horizontal') */
|
|
4753
|
+
orientation?: keyof StepperOrientationMap;
|
|
2998
4754
|
/**
|
|
2999
|
-
*
|
|
3000
|
-
|
|
3001
|
-
|
|
4755
|
+
* What goes between the steps. A line that fills as you go, unless you give something
|
|
4756
|
+
* else — an arrow, a dot, whatever suits.
|
|
4757
|
+
* */
|
|
4758
|
+
separator?: ReactNode;
|
|
4759
|
+
size?: keyof StepperSizeMap;
|
|
4760
|
+
className?: string;
|
|
4761
|
+
/** What the whole thing is called.(Default: 'Progress') */
|
|
4762
|
+
"aria-label"?: string;
|
|
4763
|
+
}
|
|
4764
|
+
/** Everything a step knows about itself, for drawing one yourself. */
|
|
4765
|
+
interface StepRenderArgs {
|
|
4766
|
+
value: string;
|
|
4767
|
+
/** Which number it is, counting from one. */
|
|
4768
|
+
index: number;
|
|
4769
|
+
status: StepStatus;
|
|
4770
|
+
/** Whether picking it would go anywhere. */
|
|
4771
|
+
reachable: boolean;
|
|
4772
|
+
disabled: boolean;
|
|
4773
|
+
/** Go to this step. Does nothing when it cannot be reached. */
|
|
4774
|
+
select: () => void;
|
|
4775
|
+
/** What was passed as the step's name and second line. */
|
|
4776
|
+
children: ReactNode;
|
|
4777
|
+
description: ReactNode;
|
|
4778
|
+
}
|
|
4779
|
+
interface StepProps extends Omit<HTMLAttributes<HTMLButtonElement>, "children"> {
|
|
4780
|
+
/** What `value` and `onChange` deal in. */
|
|
4781
|
+
value: string;
|
|
4782
|
+
/** The step's name. */
|
|
4783
|
+
children?: ReactNode;
|
|
4784
|
+
/** A second line under the name. */
|
|
4785
|
+
description?: ReactNode;
|
|
3002
4786
|
/**
|
|
3003
|
-
*
|
|
3004
|
-
*
|
|
3005
|
-
*/
|
|
3006
|
-
|
|
4787
|
+
* Where this step stands. Worked out from where it sits against the current one unless
|
|
4788
|
+
* it is given, which is how a step already passed can still show an error.
|
|
4789
|
+
* */
|
|
4790
|
+
status?: StepStatus;
|
|
4791
|
+
/** What goes in the marker. The number, or a tick once it is done. */
|
|
4792
|
+
icon?: ReactNode;
|
|
4793
|
+
/** Cannot be picked, whatever else is true. */
|
|
4794
|
+
disabled?: boolean;
|
|
3007
4795
|
/**
|
|
3008
|
-
*
|
|
3009
|
-
*
|
|
3010
|
-
|
|
3011
|
-
|
|
4796
|
+
* Draw the step yourself. Everything it knows is handed over and nothing of its own is
|
|
4797
|
+
* rendered — no marker, no classes, no styles to work around.
|
|
4798
|
+
*
|
|
4799
|
+
* The list item and the joint to the next step stay, so it is still a list and still
|
|
4800
|
+
* joined up. Reach for this when the design is not a marker beside a label; the props
|
|
4801
|
+
* above are quicker when it is.
|
|
4802
|
+
*
|
|
4803
|
+
* @example
|
|
4804
|
+
* ```tsx
|
|
4805
|
+
* <Step
|
|
4806
|
+
* value="dev"
|
|
4807
|
+
* render={({ index, status, select }) => (
|
|
4808
|
+
* <button onClick={select} data-current={status === "current"}>
|
|
4809
|
+
* <span className="chip">{index}</span> Dev
|
|
4810
|
+
* </button>
|
|
4811
|
+
* )}
|
|
4812
|
+
* />
|
|
4813
|
+
* ```
|
|
4814
|
+
* */
|
|
4815
|
+
render?: (step: StepRenderArgs) => ReactNode;
|
|
3012
4816
|
}
|
|
3013
4817
|
|
|
3014
4818
|
/**
|
|
3015
|
-
*
|
|
4819
|
+
* How far along a set of steps you are.
|
|
3016
4820
|
*
|
|
3017
|
-
*
|
|
3018
|
-
*
|
|
3019
|
-
*
|
|
4821
|
+
* It shows progress and takes you back through it; what each step holds is yours to render.
|
|
4822
|
+
* A wizard is usually one form with fields shown and hidden, rather than separate panels —
|
|
4823
|
+
* `Tabs` is the component for those.
|
|
3020
4824
|
*
|
|
3021
4825
|
* @example
|
|
3022
4826
|
* ```tsx
|
|
3023
|
-
*
|
|
3024
|
-
*
|
|
3025
|
-
*
|
|
3026
|
-
*
|
|
3027
|
-
*
|
|
3028
|
-
*
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
4827
|
+
* <Stepper value={step} onChange={setStep}>
|
|
4828
|
+
* <Step value="account">Account</Step>
|
|
4829
|
+
* <Step value="payment" description="Card or bank">Payment</Step>
|
|
4830
|
+
* <Step value="done">Confirm</Step>
|
|
4831
|
+
* </Stepper>
|
|
4832
|
+
* ```
|
|
4833
|
+
*/
|
|
4834
|
+
declare const Stepper: {
|
|
4835
|
+
({ value, onChange, children, linear, orientation, separator, size, className, "aria-label": ariaLabel, ...rest }: StepperProps): react_jsx_runtime.JSX.Element;
|
|
4836
|
+
displayName: string;
|
|
4837
|
+
};
|
|
4838
|
+
|
|
4839
|
+
/**
|
|
4840
|
+
* One step.
|
|
3033
4841
|
*
|
|
3034
|
-
*
|
|
3035
|
-
*
|
|
3036
|
-
*
|
|
3037
|
-
* title="Warning!"
|
|
3038
|
-
* description="This is a detailed warning message with more context."
|
|
3039
|
-
* onRemove={() => console.log('Alert dismissed')}
|
|
3040
|
-
* />
|
|
4842
|
+
* Where it stands comes from where it sits against the current one, so a straight run of
|
|
4843
|
+
* steps needs nothing said. `status` overrides it, which is how a step already passed can
|
|
4844
|
+
* show an error rather than a tick.
|
|
3041
4845
|
*
|
|
3042
|
-
*
|
|
3043
|
-
*
|
|
3044
|
-
*
|
|
3045
|
-
*
|
|
3046
|
-
*
|
|
3047
|
-
* />
|
|
4846
|
+
* @example
|
|
4847
|
+
* ```tsx
|
|
4848
|
+
* <Step value="account">Account</Step>
|
|
4849
|
+
* <Step value="payment" description="Card or bank">Payment</Step>
|
|
4850
|
+
* <Step value="review" status="error">Review</Step>
|
|
3048
4851
|
* ```
|
|
3049
4852
|
*/
|
|
3050
|
-
declare const
|
|
4853
|
+
declare const Step: {
|
|
4854
|
+
({ value, children, description, status, icon, disabled, render, className, onClick, ...rest }: StepProps): react_jsx_runtime.JSX.Element;
|
|
4855
|
+
displayName: string;
|
|
4856
|
+
};
|
|
3051
4857
|
|
|
3052
4858
|
interface PaginationProps {
|
|
3053
4859
|
/**
|
|
@@ -3106,12 +4912,138 @@ interface PaginationProps {
|
|
|
3106
4912
|
*/
|
|
3107
4913
|
declare const Pagination: FC<PaginationProps>;
|
|
3108
4914
|
|
|
4915
|
+
interface PopoverProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
4916
|
+
/**
|
|
4917
|
+
* Whether the popover is showing. Leave it out to let the component hold the state.
|
|
4918
|
+
* */
|
|
4919
|
+
open?: boolean;
|
|
4920
|
+
/**
|
|
4921
|
+
* Whether it starts open when the component holds the state.(Default: false)
|
|
4922
|
+
* */
|
|
4923
|
+
defaultOpen?: boolean;
|
|
4924
|
+
/**
|
|
4925
|
+
* Called whenever the popover opens or closes.
|
|
4926
|
+
* */
|
|
4927
|
+
onOpenChange?: (open: boolean) => void;
|
|
4928
|
+
/**
|
|
4929
|
+
* Where the content sits against the trigger. It flips when there is no
|
|
4930
|
+
* room.(Default: 'bottom-start')
|
|
4931
|
+
* */
|
|
4932
|
+
placement?: Placement;
|
|
4933
|
+
/**
|
|
4934
|
+
* The gap between the trigger and the nearest part of the popover, in pixels. With
|
|
4935
|
+
* `arrow` on that is the arrow's tip rather than the panel edge, so the gap looks the
|
|
4936
|
+
* same either way.(Default: 6)
|
|
4937
|
+
* */
|
|
4938
|
+
offset?: number;
|
|
4939
|
+
/**
|
|
4940
|
+
* Positioning strategy, for the rare case where absolute does not work.
|
|
4941
|
+
* */
|
|
4942
|
+
floatingStrategy?: Strategy;
|
|
4943
|
+
/**
|
|
4944
|
+
* Close on Escape.(Default: true)
|
|
4945
|
+
* */
|
|
4946
|
+
dismissOnEscape?: boolean;
|
|
4947
|
+
/**
|
|
4948
|
+
* Close when something outside is clicked.(Default: true)
|
|
4949
|
+
* */
|
|
4950
|
+
dismissOnOutsideClick?: boolean;
|
|
4951
|
+
/**
|
|
4952
|
+
* Show a small arrow pointing at the trigger.(Default: false)
|
|
4953
|
+
* */
|
|
4954
|
+
arrow?: boolean;
|
|
4955
|
+
/**
|
|
4956
|
+
* Stop the popover opening at all.
|
|
4957
|
+
* */
|
|
4958
|
+
disabled?: boolean;
|
|
4959
|
+
/**
|
|
4960
|
+
* A `PopoverTrigger` and a `PopoverContent`.
|
|
4961
|
+
* */
|
|
4962
|
+
children?: ReactNode;
|
|
4963
|
+
}
|
|
4964
|
+
interface PopoverTriggerProps {
|
|
4965
|
+
/**
|
|
4966
|
+
* The element that opens the popover. It is used as the trigger itself rather than
|
|
4967
|
+
* wrapped, so it keeps its own tag, styles and handlers.
|
|
4968
|
+
* */
|
|
4969
|
+
children: ReactNode;
|
|
4970
|
+
}
|
|
4971
|
+
interface PopoverContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
4972
|
+
/**
|
|
4973
|
+
* What the popover shows.
|
|
4974
|
+
* */
|
|
4975
|
+
children?: ReactNode;
|
|
4976
|
+
}
|
|
4977
|
+
interface PopoverContextProps {
|
|
4978
|
+
open: boolean;
|
|
4979
|
+
setOpen: (open: boolean) => void;
|
|
4980
|
+
close: () => void;
|
|
4981
|
+
toggle: () => void;
|
|
4982
|
+
disabled: boolean;
|
|
4983
|
+
arrow: boolean;
|
|
4984
|
+
dismissOnEscape: boolean;
|
|
4985
|
+
floating: any;
|
|
4986
|
+
arrowRef: React.RefObject<SVGSVGElement | null>;
|
|
4987
|
+
/** Set by `PopoverTrigger`, so focus can be handed back when the popover closes. */
|
|
4988
|
+
setTriggerNode: (node: HTMLElement | null) => void;
|
|
4989
|
+
}
|
|
4990
|
+
|
|
4991
|
+
declare const Popover: {
|
|
4992
|
+
({ open: controlledOpen, defaultOpen, onOpenChange, placement, offset, floatingStrategy, dismissOnEscape, dismissOnOutsideClick, arrow, disabled, className, children, ...rest }: PopoverProps): react_jsx_runtime.JSX.Element;
|
|
4993
|
+
displayName: string;
|
|
4994
|
+
};
|
|
4995
|
+
|
|
4996
|
+
/**
|
|
4997
|
+
* Whatever opens the popover. The child is used as the trigger itself rather than
|
|
4998
|
+
* wrapped, so it keeps its own tag, styling and handlers.
|
|
4999
|
+
*
|
|
5000
|
+
* @example
|
|
5001
|
+
* ```tsx
|
|
5002
|
+
* <PopoverTrigger>
|
|
5003
|
+
* <Button>Filters</Button>
|
|
5004
|
+
* </PopoverTrigger>
|
|
5005
|
+
* ```
|
|
5006
|
+
*/
|
|
5007
|
+
declare const PopoverTrigger: {
|
|
5008
|
+
({ children }: PopoverTriggerProps): react_jsx_runtime.JSX.Element;
|
|
5009
|
+
displayName: string;
|
|
5010
|
+
};
|
|
5011
|
+
|
|
5012
|
+
/**
|
|
5013
|
+
* The panel itself. Anything can live in here — a form, a list, a chart.
|
|
5014
|
+
*
|
|
5015
|
+
* Focus moves in when it opens and returns to the trigger when it closes, so it can be
|
|
5016
|
+
* driven from the keyboard.
|
|
5017
|
+
*/
|
|
5018
|
+
declare const PopoverContent: {
|
|
5019
|
+
({ className, children, ...rest }: PopoverContentProps): react_jsx_runtime.JSX.Element | null;
|
|
5020
|
+
displayName: string;
|
|
5021
|
+
};
|
|
5022
|
+
|
|
5023
|
+
/**
|
|
5024
|
+
* Read the popover's state from anything inside it — a Cancel button that needs to close
|
|
5025
|
+
* it, say.
|
|
5026
|
+
*
|
|
5027
|
+
* @example
|
|
5028
|
+
* ```tsx
|
|
5029
|
+
* const { close } = usePopover();
|
|
5030
|
+
*
|
|
5031
|
+
* <Button onClick={close}>Cancel</Button>
|
|
5032
|
+
* ```
|
|
5033
|
+
*/
|
|
5034
|
+
declare const usePopover: () => PopoverContextProps;
|
|
5035
|
+
|
|
3109
5036
|
interface DialogContentProps extends DialogOptions {
|
|
3110
5037
|
/**
|
|
3111
5038
|
* Function to close the dialog.
|
|
3112
5039
|
* In case you want to close the dialog programmatically.
|
|
3113
5040
|
* */
|
|
3114
5041
|
dismiss: () => void;
|
|
5042
|
+
/**
|
|
5043
|
+
* Whether this dialog is the topmost entry in the overlay stack.
|
|
5044
|
+
* Injected automatically by `GeckoUIProvider`; consumer code does not need to set this.
|
|
5045
|
+
*/
|
|
5046
|
+
isTop?: boolean;
|
|
3115
5047
|
}
|
|
3116
5048
|
interface ActionsArgs extends DialogContentProps {
|
|
3117
5049
|
/**
|
|
@@ -3141,7 +5073,7 @@ interface DialogOptions {
|
|
|
3141
5073
|
* Dismiss the dialog on pressing the `Escape` key.
|
|
3142
5074
|
* Default is `true`.
|
|
3143
5075
|
* */
|
|
3144
|
-
|
|
5076
|
+
dismissOnEscape?: boolean;
|
|
3145
5077
|
/**
|
|
3146
5078
|
* Dismiss the dialog on clicking outside the dialog.
|
|
3147
5079
|
* Default is `true`.
|
|
@@ -3150,117 +5082,67 @@ interface DialogOptions {
|
|
|
3150
5082
|
/** Data attributes to be added to the dialog */
|
|
3151
5083
|
[key: `data-${string}`]: string;
|
|
3152
5084
|
}
|
|
5085
|
+
interface DialogProps {
|
|
5086
|
+
/**
|
|
5087
|
+
* Open/Close the dialog
|
|
5088
|
+
* */
|
|
5089
|
+
open: boolean;
|
|
5090
|
+
/**
|
|
5091
|
+
* Callback fired when the dialog asks to be closed (Esc key or backdrop click).
|
|
5092
|
+
* */
|
|
5093
|
+
onClose?: () => void;
|
|
5094
|
+
/**
|
|
5095
|
+
* Content to be displayed inside the dialog.
|
|
5096
|
+
* */
|
|
5097
|
+
children?: ReactNode;
|
|
5098
|
+
/**
|
|
5099
|
+
* Additional class name for the dialog
|
|
5100
|
+
* */
|
|
5101
|
+
className?: string;
|
|
5102
|
+
/**
|
|
5103
|
+
* Dismiss the dialog on pressing the `Escape` key.
|
|
5104
|
+
* Default is `true`.
|
|
5105
|
+
* */
|
|
5106
|
+
dismissOnEscape?: boolean;
|
|
5107
|
+
/**
|
|
5108
|
+
* Dismiss the dialog on clicking the backdrop.
|
|
5109
|
+
* Clicks inside the dialog never dismiss it, including content rendered in a portal
|
|
5110
|
+
* such as a `Select` or `Menu` popup.
|
|
5111
|
+
* Default is `true`.
|
|
5112
|
+
* */
|
|
5113
|
+
dismissOnOutsideClick?: boolean;
|
|
5114
|
+
/** Data attributes to be added to the dialog */
|
|
5115
|
+
[key: `data-${string}`]: string;
|
|
5116
|
+
}
|
|
3153
5117
|
|
|
3154
5118
|
/**
|
|
3155
|
-
* Dialog
|
|
3156
|
-
* It serves as the foundational layer for more complex dialog patterns like ConfirmDialog.
|
|
3157
|
-
*
|
|
3158
|
-
* The component automatically handles focus management, escape key dismissal, and click-outside
|
|
3159
|
-
* behavior. Content can be provided as a React component or render function that receives
|
|
3160
|
-
* a dismiss callback for programmatic control.
|
|
5119
|
+
* Dialog renders content in a centered modal overlay.
|
|
3161
5120
|
*
|
|
3162
|
-
*
|
|
3163
|
-
*
|
|
3164
|
-
*
|
|
3165
|
-
* ```tsx
|
|
3166
|
-
* const openImageViewer = (imageUrl: string) => {
|
|
3167
|
-
* Dialog.show({
|
|
3168
|
-
* content: ({ dismiss }) => (
|
|
3169
|
-
* <div className="relative">
|
|
3170
|
-
* <img src={imageUrl} alt="Preview" className="max-w-4xl" />
|
|
3171
|
-
* <button
|
|
3172
|
-
* onClick={dismiss}
|
|
3173
|
-
* className="absolute top-4 right-4"
|
|
3174
|
-
* >
|
|
3175
|
-
* ✕
|
|
3176
|
-
* </button>
|
|
3177
|
-
* </div>
|
|
3178
|
-
* ),
|
|
3179
|
-
* className: "bg-transparent shadow-none",
|
|
3180
|
-
* dismissOnEsc: true,
|
|
3181
|
-
* dismissOnOutsideClick: true
|
|
3182
|
-
* });
|
|
3183
|
-
* };
|
|
3184
|
-
* ```
|
|
3185
|
-
*
|
|
3186
|
-
* @example
|
|
3187
|
-
* Form modal with data submission:
|
|
3188
|
-
*
|
|
3189
|
-
* ```tsx
|
|
3190
|
-
* const showUserForm = (userId?: string) => {
|
|
3191
|
-
* Dialog.show({
|
|
3192
|
-
* content: ({ dismiss }) => {
|
|
3193
|
-
* const [formData, setFormData] = useState({});
|
|
3194
|
-
*
|
|
3195
|
-
* const handleSubmit = async () => {
|
|
3196
|
-
* await saveUser(userId, formData);
|
|
3197
|
-
* dismiss();
|
|
3198
|
-
* showSuccessToast("User saved");
|
|
3199
|
-
* };
|
|
3200
|
-
*
|
|
3201
|
-
* return (
|
|
3202
|
-
* <UserForm
|
|
3203
|
-
* data={formData}
|
|
3204
|
-
* onChange={setFormData}
|
|
3205
|
-
* onSubmit={handleSubmit}
|
|
3206
|
-
* onCancel={dismiss}
|
|
3207
|
-
* />
|
|
3208
|
-
* );
|
|
3209
|
-
* },
|
|
3210
|
-
* className: "max-w-2xl p-6",
|
|
3211
|
-
* dismissOnEsc: false,
|
|
3212
|
-
* dismissOnOutsideClick: false
|
|
3213
|
-
* });
|
|
3214
|
-
* };
|
|
3215
|
-
* ```
|
|
5121
|
+
* Use it declaratively with `open` / `onClose` when the dialog belongs to a component's
|
|
5122
|
+
* state, or imperatively with `Dialog.show()` when it is a one-off triggered from anywhere.
|
|
5123
|
+
* The imperative form requires `<GeckoUIProvider>` to wrap your app.
|
|
3216
5124
|
*
|
|
3217
|
-
*
|
|
3218
|
-
*
|
|
3219
|
-
*
|
|
3220
|
-
* ```tsx
|
|
3221
|
-
* Dialog.show({
|
|
3222
|
-
* content: () => (
|
|
3223
|
-
* <VideoPlayer
|
|
3224
|
-
* src="/tutorial.mp4"
|
|
3225
|
-
* autoPlay
|
|
3226
|
-
* onEnded={() => {
|
|
3227
|
-
* trackAnalytics("video_completed");
|
|
3228
|
-
* Dialog.dismiss();
|
|
3229
|
-
* }}
|
|
3230
|
-
* />
|
|
3231
|
-
* ),
|
|
3232
|
-
* className: "w-screen h-screen max-w-none",
|
|
3233
|
-
* dismissOnEsc: true,
|
|
3234
|
-
* "data-video-modal": "true"
|
|
3235
|
-
* });
|
|
3236
|
-
* ```
|
|
5125
|
+
* Clicking the backdrop or pressing Esc dismisses the dialog. Clicks inside the dialog never
|
|
5126
|
+
* dismiss it, including popups rendered in a portal such as `Select` or `Menu`.
|
|
3237
5127
|
*
|
|
3238
5128
|
* @example
|
|
3239
|
-
*
|
|
5129
|
+
* Declarative:
|
|
3240
5130
|
*
|
|
3241
5131
|
* ```tsx
|
|
3242
|
-
*
|
|
3243
|
-
* Dialog.show({
|
|
3244
|
-
* content: () => <LoadingSpinner text="Processing payment..." />,
|
|
3245
|
-
* className: "w-64",
|
|
3246
|
-
* dismissOnEsc: false,
|
|
3247
|
-
* dismissOnOutsideClick: false
|
|
3248
|
-
* });
|
|
5132
|
+
* const [open, setOpen] = useState(false);
|
|
3249
5133
|
*
|
|
3250
|
-
*
|
|
3251
|
-
*
|
|
3252
|
-
*
|
|
5134
|
+
* <Button onClick={() => setOpen(true)}>Open</Button>
|
|
5135
|
+
* <Dialog open={open} onClose={() => setOpen(false)}>
|
|
5136
|
+
* <h3>Hello</h3>
|
|
5137
|
+
* <Button onClick={() => setOpen(false)}>Close</Button>
|
|
5138
|
+
* </Dialog>
|
|
3253
5139
|
* ```
|
|
3254
|
-
*
|
|
3255
|
-
* @note
|
|
3256
|
-
* For dialogs requiring user confirmation with standardized action buttons,
|
|
3257
|
-
* consider using the `ConfirmDialog` component instead, which provides a
|
|
3258
|
-
* more opinionated interface for confirmation workflows.
|
|
3259
5140
|
*/
|
|
3260
|
-
declare
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
5141
|
+
declare function Dialog({ open, onClose, className, dismissOnEscape, dismissOnOutsideClick, children, ...rest }: DialogProps): react_jsx_runtime.JSX.Element;
|
|
5142
|
+
declare namespace Dialog {
|
|
5143
|
+
var show: (options: DialogOptions) => string;
|
|
5144
|
+
var dismiss: (id?: string) => void;
|
|
5145
|
+
}
|
|
3264
5146
|
|
|
3265
5147
|
interface ConfirmDialogContentProps extends ConfirmDialogOptions {
|
|
3266
5148
|
/**
|
|
@@ -3268,6 +5150,11 @@ interface ConfirmDialogContentProps extends ConfirmDialogOptions {
|
|
|
3268
5150
|
* In case you want to close the dialog programmatically.
|
|
3269
5151
|
* */
|
|
3270
5152
|
dismiss: () => void;
|
|
5153
|
+
/**
|
|
5154
|
+
* Whether this dialog is the topmost entry in the overlay stack.
|
|
5155
|
+
* Injected automatically by `GeckoUIProvider`; consumer code does not need to set this.
|
|
5156
|
+
* */
|
|
5157
|
+
isTop?: boolean;
|
|
3271
5158
|
}
|
|
3272
5159
|
interface ConfirmDialogActionsArgs extends ConfirmDialogContentProps {
|
|
3273
5160
|
/**
|
|
@@ -3410,15 +5297,200 @@ interface ConfirmDialogOptions extends Omit<DialogOptions, "content" | "classNam
|
|
|
3410
5297
|
* ```
|
|
3411
5298
|
*/
|
|
3412
5299
|
declare const ConfirmDialog: {
|
|
3413
|
-
show: (options: ConfirmDialogOptions) =>
|
|
3414
|
-
dismiss: () => void;
|
|
5300
|
+
show: (options: ConfirmDialogOptions) => string;
|
|
5301
|
+
dismiss: (id?: string) => void;
|
|
3415
5302
|
};
|
|
3416
5303
|
|
|
3417
|
-
|
|
3418
|
-
|
|
5304
|
+
type ToastPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
5305
|
+
type ToastVariant = "default" | "success" | "error" | "warning" | "info" | "loading";
|
|
5306
|
+
interface ToastAction {
|
|
5307
|
+
label: string;
|
|
5308
|
+
onClick: () => void;
|
|
5309
|
+
}
|
|
5310
|
+
interface ToastOptions {
|
|
5311
|
+
/** Supporting line under the message */
|
|
5312
|
+
description?: ReactNode;
|
|
5313
|
+
/** Milliseconds before the toast closes itself. `Infinity` keeps it open. */
|
|
5314
|
+
duration?: number;
|
|
5315
|
+
/** Overrides the Toaster position for this toast */
|
|
5316
|
+
position?: ToastPosition;
|
|
5317
|
+
/** Primary action button */
|
|
5318
|
+
action?: ToastAction;
|
|
5319
|
+
/** Secondary action button */
|
|
5320
|
+
cancel?: ToastAction;
|
|
5321
|
+
/** Reuse an id to replace an existing toast instead of stacking a new one */
|
|
5322
|
+
id?: string;
|
|
5323
|
+
/** Replaces the variant icon. `null` removes it. */
|
|
5324
|
+
icon?: ReactNode | null;
|
|
5325
|
+
/** Show the dismiss button */
|
|
5326
|
+
closeButton?: boolean;
|
|
5327
|
+
/**
|
|
5328
|
+
* Whether the toast can be swiped away. Set it to false for one that has to be answered
|
|
5329
|
+
* rather than waved off.(Default: true)
|
|
5330
|
+
* */
|
|
5331
|
+
dismissible?: boolean;
|
|
5332
|
+
/** Called whenever the toast leaves, including on auto close */
|
|
5333
|
+
onDismiss?: () => void;
|
|
5334
|
+
/** Called only when the duration elapses */
|
|
5335
|
+
onAutoClose?: () => void;
|
|
5336
|
+
className?: string;
|
|
5337
|
+
style?: CSSProperties;
|
|
5338
|
+
}
|
|
5339
|
+
interface ToastRecord {
|
|
5340
|
+
id: string;
|
|
5341
|
+
variant: ToastVariant;
|
|
5342
|
+
message: ReactNode;
|
|
5343
|
+
options: ToastOptions;
|
|
5344
|
+
/** Set when the toast was created by `toast.custom` */
|
|
5345
|
+
custom?: boolean;
|
|
5346
|
+
/** Bumped when a toast is replaced in place, so its timer restarts */
|
|
5347
|
+
generation: number;
|
|
5348
|
+
}
|
|
5349
|
+
interface ToastPromiseMessages<T> {
|
|
5350
|
+
loading: ReactNode;
|
|
5351
|
+
success: ReactNode | ((value: T) => ReactNode);
|
|
5352
|
+
error: ReactNode | ((error: unknown) => ReactNode);
|
|
5353
|
+
}
|
|
5354
|
+
interface ToasterOptions {
|
|
5355
|
+
/** Where toasts appear unless a toast overrides it. Default `bottom-right`. */
|
|
5356
|
+
position?: ToastPosition;
|
|
5357
|
+
/** Default duration in ms. Default `4000`. */
|
|
5358
|
+
duration?: number;
|
|
5359
|
+
/**
|
|
5360
|
+
* Show the dismiss button on every toast. Default `false`.
|
|
5361
|
+
*
|
|
5362
|
+
* Worth turning on for a toast that neither closes itself nor can be swiped: swiping is
|
|
5363
|
+
* pointer only, so that combination leaves a keyboard user no way to be rid of it.
|
|
5364
|
+
* */
|
|
5365
|
+
closeButton?: boolean;
|
|
5366
|
+
/** Whether toasts can be swiped away. Default `true`. */
|
|
5367
|
+
dismissible?: boolean;
|
|
5368
|
+
/** How many toasts are rendered per position at once. Default `3`. */
|
|
5369
|
+
visibleToasts?: number;
|
|
5370
|
+
/** Pixels between stacked toasts. Default `14`. */
|
|
5371
|
+
gap?: number;
|
|
5372
|
+
/** Pixels between the stack and the viewport edge. Default `24`. */
|
|
5373
|
+
offset?: number;
|
|
5374
|
+
/** Class applied to the stack element for each position */
|
|
5375
|
+
className?: string;
|
|
5376
|
+
/** Class applied to every toast */
|
|
5377
|
+
toastClassName?: string;
|
|
5378
|
+
/** Style applied to every toast */
|
|
5379
|
+
toastStyle?: CSSProperties;
|
|
5380
|
+
/** Class applied to the variant icon */
|
|
5381
|
+
iconClassName?: string;
|
|
5382
|
+
/** Class applied to the message line */
|
|
5383
|
+
messageClassName?: string;
|
|
5384
|
+
/** Class applied to the description line */
|
|
5385
|
+
descriptionClassName?: string;
|
|
5386
|
+
/** Class applied to the action button */
|
|
5387
|
+
actionClassName?: string;
|
|
5388
|
+
/** Class applied to the cancel button */
|
|
5389
|
+
cancelClassName?: string;
|
|
5390
|
+
/** Class applied to the dismiss button */
|
|
5391
|
+
closeClassName?: string;
|
|
5392
|
+
}
|
|
5393
|
+
|
|
5394
|
+
/**
|
|
5395
|
+
* Show a toast. Returns the id, which you can pass to `toast.dismiss(id)` or reuse
|
|
5396
|
+
* as `options.id` to replace the toast in place.
|
|
5397
|
+
*
|
|
5398
|
+
* Requires `<GeckoUIProvider>` to be mounted.
|
|
5399
|
+
*
|
|
5400
|
+
* @example
|
|
5401
|
+
* ```tsx
|
|
5402
|
+
* toast("Saved");
|
|
5403
|
+
* toast.success("Account created", { description: "Check your inbox." });
|
|
5404
|
+
* toast.error("Upload failed", { action: { label: "Retry", onClick: retry } });
|
|
5405
|
+
*
|
|
5406
|
+
* const id = toast.loading("Uploading…");
|
|
5407
|
+
* toast.success("Uploaded", { id }); // replaces the loading toast
|
|
5408
|
+
* ```
|
|
5409
|
+
*/
|
|
5410
|
+
declare function toast(message: ReactNode, options?: ToastOptions): string;
|
|
5411
|
+
declare namespace toast {
|
|
5412
|
+
var success: (message: ReactNode, options?: ToastOptions) => string;
|
|
5413
|
+
var error: (message: ReactNode, options?: ToastOptions) => string;
|
|
5414
|
+
var warning: (message: ReactNode, options?: ToastOptions) => string;
|
|
5415
|
+
var info: (message: ReactNode, options?: ToastOptions) => string;
|
|
5416
|
+
var loading: (message: ReactNode, options?: ToastOptions) => string;
|
|
5417
|
+
var custom: (content: ReactNode, options?: ToastOptions) => string;
|
|
5418
|
+
var promise: <T>(promise: Promise<T>, messages: ToastPromiseMessages<T>, options?: ToastOptions) => Promise<T>;
|
|
5419
|
+
var dismiss: (id?: string) => void;
|
|
5420
|
+
}
|
|
5421
|
+
|
|
5422
|
+
/**
|
|
5423
|
+
* Renders the toast stacks. `GeckoUIProvider` mounts this for you.
|
|
5424
|
+
*/
|
|
5425
|
+
declare function Toaster({ position, duration, closeButton, dismissible, visibleToasts, gap, offset, className, ...rest }: ToasterOptions): react.ReactPortal | null;
|
|
5426
|
+
|
|
5427
|
+
/**
|
|
5428
|
+
* Props for `GeckoUIProvider`, the required wrapper component that owns the overlay
|
|
5429
|
+
* stack and renders the toast stacks. Place it below your own context providers
|
|
5430
|
+
* so that `Dialog.show()` / `Drawer.show()` content can read app-level React context.
|
|
5431
|
+
*/
|
|
5432
|
+
interface GeckoUIProviderProps {
|
|
5433
|
+
/**
|
|
5434
|
+
* The app's component tree.
|
|
5435
|
+
*
|
|
5436
|
+
* Place `GeckoUIProvider` below your own context providers so overlays opened via
|
|
5437
|
+
* `Dialog.show()` / `Drawer.show()` can read those contexts.
|
|
5438
|
+
*
|
|
5439
|
+
* @example
|
|
5440
|
+
* ```tsx
|
|
5441
|
+
* <AuthProvider>
|
|
5442
|
+
* <GeckoUIProvider>
|
|
5443
|
+
* <App />
|
|
5444
|
+
* </GeckoUIProvider>
|
|
5445
|
+
* </AuthProvider>
|
|
5446
|
+
* ```
|
|
5447
|
+
*/
|
|
5448
|
+
children: ReactNode;
|
|
5449
|
+
/**
|
|
5450
|
+
* Defaults for every toast, and where the stacks sit.
|
|
5451
|
+
*
|
|
5452
|
+
* @example
|
|
5453
|
+
* ```tsx
|
|
5454
|
+
* <GeckoUIProvider toastOptions={{ duration: 3000 }}>
|
|
5455
|
+
* <App />
|
|
5456
|
+
* </GeckoUIProvider>
|
|
5457
|
+
* ```
|
|
5458
|
+
*/
|
|
5459
|
+
toastOptions?: ToasterOptions;
|
|
3419
5460
|
}
|
|
3420
5461
|
|
|
3421
|
-
|
|
5462
|
+
/**
|
|
5463
|
+
* GeckoUIProvider must wrap your application tree (below your own context providers).
|
|
5464
|
+
*
|
|
5465
|
+
* It owns the overlay stack for `Dialog.show()` / `Drawer.show()` and renders each
|
|
5466
|
+
* open overlay via `ReactDOM.createPortal` so that React context flows into overlay
|
|
5467
|
+
* content. It also renders the toast stacks.
|
|
5468
|
+
*
|
|
5469
|
+
* Mount one provider. If you nest another one deeper — to give overlays access to a subtree's
|
|
5470
|
+
* context — the innermost provider owns the overlay stack and the `<Toaster>`, and the outer
|
|
5471
|
+
* ones render nothing but their children.
|
|
5472
|
+
*
|
|
5473
|
+
* @example
|
|
5474
|
+
* ```tsx
|
|
5475
|
+
* // app/layout.tsx
|
|
5476
|
+
* import { GeckoUIProvider } from "@geckoui/geckoui";
|
|
5477
|
+
*
|
|
5478
|
+
* export default function RootLayout({ children }) {
|
|
5479
|
+
* return (
|
|
5480
|
+
* <html>
|
|
5481
|
+
* <body>
|
|
5482
|
+
* <AuthProvider>
|
|
5483
|
+
* <GeckoUIProvider>
|
|
5484
|
+
* {children}
|
|
5485
|
+
* </GeckoUIProvider>
|
|
5486
|
+
* </AuthProvider>
|
|
5487
|
+
* </body>
|
|
5488
|
+
* </html>
|
|
5489
|
+
* );
|
|
5490
|
+
* }
|
|
5491
|
+
* ```
|
|
5492
|
+
*/
|
|
5493
|
+
declare function GeckoUIProvider({ children, toastOptions }: GeckoUIProviderProps): react_jsx_runtime.JSX.Element;
|
|
3422
5494
|
|
|
3423
5495
|
/** Extensible placement map - To allow module augmentation */
|
|
3424
5496
|
interface DrawerPlacementMap {
|
|
@@ -3435,7 +5507,7 @@ interface DrawerProps {
|
|
|
3435
5507
|
/**
|
|
3436
5508
|
* Allow clicking outside of drawer to close
|
|
3437
5509
|
* If true, you can click through backdrop to close the drawer
|
|
3438
|
-
* If you pass `
|
|
5510
|
+
* If you pass `onClose` prop, you can use it to close the drawer
|
|
3439
5511
|
* Use it with caution, it may cause bad UX in some cases
|
|
3440
5512
|
* Eg. let's say you have an `a` tag that points to another page,
|
|
3441
5513
|
* if you click on that element, it will close the drawer and navigate to the new page
|
|
@@ -3445,13 +5517,14 @@ interface DrawerProps {
|
|
|
3445
5517
|
* */
|
|
3446
5518
|
allowClickOutside?: boolean;
|
|
3447
5519
|
/**
|
|
3448
|
-
* Callback fired when
|
|
5520
|
+
* Callback fired when the drawer asks to be closed (Esc key, backdrop click, or a
|
|
5521
|
+
* click outside when `allowClickOutside` is set).
|
|
3449
5522
|
* */
|
|
3450
|
-
|
|
5523
|
+
onClose?: () => void;
|
|
3451
5524
|
/**
|
|
3452
5525
|
* Backdrop show/hide If true,
|
|
3453
5526
|
* This is just a visual effect just setting opacity to 0
|
|
3454
|
-
* So, you can still click the backdrop to close the drawer if you pass `
|
|
5527
|
+
* So, you can still click the backdrop to close the drawer if you pass `onClose` prop to close the drawer
|
|
3455
5528
|
* */
|
|
3456
5529
|
hideBackdrop?: boolean;
|
|
3457
5530
|
/**
|
|
@@ -3477,6 +5550,11 @@ interface DrawerProps {
|
|
|
3477
5550
|
* Default is true
|
|
3478
5551
|
* */
|
|
3479
5552
|
dismissOnEscape?: boolean;
|
|
5553
|
+
/**
|
|
5554
|
+
* Inline styles for the drawer root.
|
|
5555
|
+
* `GeckoUIProvider` uses it to stack drawers opened with `Drawer.show()`.
|
|
5556
|
+
* */
|
|
5557
|
+
style?: CSSProperties;
|
|
3480
5558
|
}
|
|
3481
5559
|
|
|
3482
5560
|
/**
|
|
@@ -3488,18 +5566,26 @@ interface DrawerProps {
|
|
|
3488
5566
|
* optional backdrop overlay, and flexible dismissal behaviors including ESC key and click-outside handling.
|
|
3489
5567
|
*
|
|
3490
5568
|
* @example
|
|
5569
|
+
* Controlled usage:
|
|
5570
|
+
*
|
|
5571
|
+
* ```tsx
|
|
5572
|
+
* const [open, setOpen] = useState(false);
|
|
5573
|
+
*
|
|
5574
|
+
* <Button onClick={() => setOpen(true)}>Open</Button>
|
|
5575
|
+
* <Drawer open={open} onClose={() => setOpen(false)} placement="right" allowClickOutside>
|
|
5576
|
+
* <div className="p-6">Content here</div>
|
|
5577
|
+
* </Drawer>
|
|
5578
|
+
* ```
|
|
5579
|
+
*
|
|
5580
|
+
* @example
|
|
3491
5581
|
* Mobile navigation menu:
|
|
3492
5582
|
*
|
|
3493
5583
|
* ```tsx
|
|
3494
5584
|
* const [menuOpen, setMenuOpen] = useState(false);
|
|
3495
5585
|
*
|
|
3496
|
-
* <button onClick={() => setMenuOpen(true)}>
|
|
3497
|
-
* <MenuIcon />
|
|
3498
|
-
* </button>
|
|
3499
|
-
*
|
|
3500
5586
|
* <Drawer
|
|
3501
5587
|
* open={menuOpen}
|
|
3502
|
-
*
|
|
5588
|
+
* onClose={() => setMenuOpen(false)}
|
|
3503
5589
|
* placement="left"
|
|
3504
5590
|
* allowClickOutside
|
|
3505
5591
|
* dismissOnEscape
|
|
@@ -3510,92 +5596,11 @@ interface DrawerProps {
|
|
|
3510
5596
|
* </nav>
|
|
3511
5597
|
* </Drawer>
|
|
3512
5598
|
* ```
|
|
3513
|
-
*
|
|
3514
|
-
* @example
|
|
3515
|
-
* Filter panel with backdrop:
|
|
3516
|
-
*
|
|
3517
|
-
* ```tsx
|
|
3518
|
-
* const [filtersOpen, setFiltersOpen] = useState(false);
|
|
3519
|
-
*
|
|
3520
|
-
* <Drawer
|
|
3521
|
-
* open={filtersOpen}
|
|
3522
|
-
* handleClose={() => setFiltersOpen(false)}
|
|
3523
|
-
* placement="right"
|
|
3524
|
-
* allowClickOutside={true}
|
|
3525
|
-
* backdropClassName="bg-black/60"
|
|
3526
|
-
* className="w-96 p-6"
|
|
3527
|
-
* >
|
|
3528
|
-
* <FilterPanel
|
|
3529
|
-
* onApply={(filters) => {
|
|
3530
|
-
* applyFilters(filters);
|
|
3531
|
-
* setFiltersOpen(false);
|
|
3532
|
-
* }}
|
|
3533
|
-
* />
|
|
3534
|
-
* </Drawer>
|
|
3535
|
-
* ```
|
|
3536
|
-
*
|
|
3537
|
-
* @example
|
|
3538
|
-
* Notification center from top:
|
|
3539
|
-
*
|
|
3540
|
-
* ```tsx
|
|
3541
|
-
* <Drawer
|
|
3542
|
-
* open={showNotifications}
|
|
3543
|
-
* handleClose={() => setShowNotifications(false)}
|
|
3544
|
-
* placement="top"
|
|
3545
|
-
* hideBackdrop={false}
|
|
3546
|
-
* allowClickOutside
|
|
3547
|
-
* className="h-96 border-b shadow-lg"
|
|
3548
|
-
* >
|
|
3549
|
-
* <NotificationList
|
|
3550
|
-
* notifications={notifications}
|
|
3551
|
-
* onMarkAllRead={handleMarkAllRead}
|
|
3552
|
-
* />
|
|
3553
|
-
* </Drawer>
|
|
3554
|
-
* ```
|
|
3555
|
-
*
|
|
3556
|
-
* @example
|
|
3557
|
-
* Bottom sheet for mobile actions:
|
|
3558
|
-
*
|
|
3559
|
-
* ```tsx
|
|
3560
|
-
* <Drawer
|
|
3561
|
-
* open={isBottomSheetOpen}
|
|
3562
|
-
* handleClose={() => setBottomSheetOpen(false)}
|
|
3563
|
-
* placement="bottom"
|
|
3564
|
-
* allowClickOutside
|
|
3565
|
-
* dismissOnEscape={false}
|
|
3566
|
-
* backdropClassName="bg-black/40"
|
|
3567
|
-
* className="h-64 rounded-t-2xl"
|
|
3568
|
-
* >
|
|
3569
|
-
* <ActionSheet
|
|
3570
|
-
* actions={mobileActions}
|
|
3571
|
-
* onSelect={handleActionSelect}
|
|
3572
|
-
* />
|
|
3573
|
-
* </Drawer>
|
|
3574
|
-
* ```
|
|
3575
|
-
*
|
|
3576
|
-
* @example
|
|
3577
|
-
* Settings panel without backdrop:
|
|
3578
|
-
*
|
|
3579
|
-
* ```tsx
|
|
3580
|
-
* <Drawer
|
|
3581
|
-
* open={settingsVisible}
|
|
3582
|
-
* handleClose={() => setSettingsVisible(false)}
|
|
3583
|
-
* placement="right"
|
|
3584
|
-
* hideBackdrop
|
|
3585
|
-
* allowClickOutside={false}
|
|
3586
|
-
* className="w-[600px] border-l"
|
|
3587
|
-
* >
|
|
3588
|
-
* <SettingsPanel
|
|
3589
|
-
* sections={settingsSections}
|
|
3590
|
-
* onSave={saveSettings}
|
|
3591
|
-
* />
|
|
3592
|
-
* </Drawer>
|
|
3593
|
-
* ```
|
|
3594
5599
|
*/
|
|
3595
|
-
declare function Drawer({ open, allowClickOutside,
|
|
5600
|
+
declare function Drawer({ open, allowClickOutside, onClose, hideBackdrop, placement, backdropClassName, className, children, dismissOnEscape, style }: DrawerProps): react_jsx_runtime.JSX.Element;
|
|
3596
5601
|
declare namespace Drawer {
|
|
3597
|
-
var show: (node: ReactNode, options?: Omit<DrawerProps, "open" | "children">) =>
|
|
3598
|
-
var dismiss: () => void;
|
|
5602
|
+
var show: (node: ReactNode, options?: Omit<DrawerProps, "open" | "children">) => string;
|
|
5603
|
+
var dismiss: (id?: string) => void;
|
|
3599
5604
|
}
|
|
3600
5605
|
|
|
3601
5606
|
interface MenuProps extends PropsWithChildren {
|
|
@@ -3764,17 +5769,87 @@ declare function isTwoFileEqualByFileContent(file1: File, file2: File): Promise<
|
|
|
3764
5769
|
* */
|
|
3765
5770
|
declare const hasDisplayName: (displayName: string) => (e: ReactNode) => boolean;
|
|
3766
5771
|
|
|
5772
|
+
interface FormatNumericInputOptions {
|
|
5773
|
+
/**
|
|
5774
|
+
* Drop leading zeros and normalise the whole part.
|
|
5775
|
+
* Turn it off for values like room numbers where "007" is meaningful.
|
|
5776
|
+
* */
|
|
5777
|
+
strict?: boolean;
|
|
5778
|
+
/** Reject a leading minus sign */
|
|
5779
|
+
positiveOnly?: boolean;
|
|
5780
|
+
/** Digits kept after the decimal point. `0` removes the decimal point entirely. */
|
|
5781
|
+
maxFractionDigits?: number;
|
|
5782
|
+
/** Digits kept before the decimal point */
|
|
5783
|
+
maxWholeDigitPlaces?: number;
|
|
5784
|
+
}
|
|
5785
|
+
/**
|
|
5786
|
+
* Sanitises a partially typed number without converting it to a `number`.
|
|
5787
|
+
*
|
|
5788
|
+
* Keeping the value a string is what lets someone type "2." on the way to "2.5":
|
|
5789
|
+
* a round trip through `parseFloat` would collapse it to "2" and eat the decimal
|
|
5790
|
+
* point as they type.
|
|
5791
|
+
*
|
|
5792
|
+
* @example
|
|
5793
|
+
* ```ts
|
|
5794
|
+
* formatNumericInput("2."); // "2."
|
|
5795
|
+
* formatNumericInput("007"); // "7"
|
|
5796
|
+
* formatNumericInput("007", { strict: false }); // "007"
|
|
5797
|
+
* formatNumericInput("1.239", { maxFractionDigits: 2 }); // "1.23"
|
|
5798
|
+
* ```
|
|
5799
|
+
* */
|
|
5800
|
+
declare const formatNumericInput: (rawValue: string, { strict, positiveOnly, maxFractionDigits, maxWholeDigitPlaces }?: FormatNumericInputOptions) => string;
|
|
5801
|
+
|
|
3767
5802
|
declare const getDataAttributes: (props: Record<string, any>) => Record<string, string>;
|
|
3768
5803
|
|
|
5804
|
+
/**
|
|
5805
|
+
* Split props into the `data-*` attributes and everything else.
|
|
5806
|
+
*
|
|
5807
|
+
* Components whose root element is not the one receiving `...rest` use this to keep
|
|
5808
|
+
* `data-*` on the root, next to the state attributes the styles already key off,
|
|
5809
|
+
* rather than leaking them onto an inner element.
|
|
5810
|
+
*/
|
|
5811
|
+
declare const splitDataAttributes: <T extends Record<string, any>>(props: T) => {
|
|
5812
|
+
dataAttributes: Record<string, unknown>;
|
|
5813
|
+
rest: Omit<T, `data-${string}`>;
|
|
5814
|
+
};
|
|
5815
|
+
|
|
3769
5816
|
declare function isAsyncFn(fn: unknown): boolean;
|
|
3770
5817
|
|
|
5818
|
+
/**
|
|
5819
|
+
* Warn about a mistake only a developer can fix. Silent in production builds.
|
|
5820
|
+
*
|
|
5821
|
+
* tsup is told not to replace `process.env.NODE_ENV` while building this library, or the
|
|
5822
|
+
* value would be fixed at publish time — see the `define` in tsup.config.ts.
|
|
5823
|
+
*/
|
|
5824
|
+
declare function devWarn(message: string): void;
|
|
5825
|
+
|
|
5826
|
+
/**
|
|
5827
|
+
* The single element to merge `asChild`-style props into, or `null` when there isn't one.
|
|
5828
|
+
*
|
|
5829
|
+
* `Children.only` would be the obvious choice, but it throws, and a library component
|
|
5830
|
+
* cannot take the whole page down over its children. Under RSC a child can also reach a
|
|
5831
|
+
* client component as an unresolved lazy chunk rather than an element, so callers need a
|
|
5832
|
+
* path that falls back to their own wrapper instead of crashing.
|
|
5833
|
+
*/
|
|
5834
|
+
declare const asChildElement: (children: ReactNode) => ReactElement | null;
|
|
5835
|
+
|
|
3771
5836
|
declare class BaseFilePickerHandler {
|
|
3772
5837
|
accept: string;
|
|
3773
5838
|
removeDuplicates: boolean;
|
|
5839
|
+
multiple: boolean;
|
|
5840
|
+
preview: boolean;
|
|
5841
|
+
/** How many more files may be taken on this run, not the field's own `max`. */
|
|
5842
|
+
room?: number;
|
|
3774
5843
|
oldFiles: FilePickerFile[];
|
|
5844
|
+
/** Everything turned away on this run, and why, for the caller to report. */
|
|
5845
|
+
rejected: FileRejection[];
|
|
3775
5846
|
constructor(accept?: string, removeDuplicates?: boolean, opts?: {
|
|
3776
5847
|
oldFiles?: FilePickerFile[];
|
|
5848
|
+
multiple?: boolean;
|
|
5849
|
+
preview?: boolean;
|
|
5850
|
+
room?: number;
|
|
3777
5851
|
});
|
|
5852
|
+
private turnAway;
|
|
3778
5853
|
onDrop(_: DataTransferItemList | undefined): Promise<FilePickerFile[]>;
|
|
3779
5854
|
open(options?: OpenFilePickerOptions): Promise<FilePickerFile[]>;
|
|
3780
5855
|
protected addFileIfValid(file: FilePickerFile, data?: FilePickerFile[]): Promise<FilePickerFile[]>;
|
|
@@ -3786,4 +5861,4 @@ declare class FileOnlyPickerHandler extends BaseFilePickerHandler {
|
|
|
3786
5861
|
|
|
3787
5862
|
declare const FilePicker: typeof FileOnlyPickerHandler;
|
|
3788
5863
|
|
|
3789
|
-
export { type ActionsArgs, Alert, type AlertProps, type
|
|
5864
|
+
export { Accordion, type AccordionContextProps, AccordionHeader, type AccordionHeaderProps, AccordionItem, type AccordionItemContextProps, type AccordionItemProps, AccordionPanel, type AccordionPanelProps, type AccordionProps, type AccordionSizeMap, type AccordionValue, type AccordionVariantMap, type ActionsArgs, Alert, type AlertColorMap, type AlertProps, Avatar, type AvatarColorMap, AvatarGroup, type AvatarGroupOverflow, type AvatarGroupProps, type AvatarProps, type AvatarShapeMap, type AvatarSizeMap, Badge, type BadgeColorMap, type BadgeProps, type BadgeShapeMap, type BadgeSizeMap, type BadgeVariantMap, type BaseSelectProps, Breadcrumb, BreadcrumbItem, type BreadcrumbItemProps, type BreadcrumbProps, type BreadcrumbSizeMap, Button, type ButtonColorMap, type ButtonProps, type ButtonSizeMap, type ButtonVariantMap, _default as Calendar, type CalendarActiveProps, type CalendarOverload, type CalendarProps, type CalendarRangeModeProps, type CalendarRef, type CalendarSingleModeProps, CalendarType, Checkbox, type CheckboxProps, type ColorFormat, ColorInput, type ColorInputProps, type ColorInputRenderState, ColorPicker, type ColorPickerProps, type ColorPickerRenderState, ConfirmDialog, type ConfirmDialogActionsArgs, type ConfirmDialogContentProps, type ConfirmDialogOptions, CounterInput, type CounterInputProps, type CounterInputSizeMap, type CustomSelectOptionArgs, type CustomSelectOptionBaseArgs, type DataAttributeProps, type DateFormat$1 as DateFormat, DateInput, type DateInputProps, type DateRange, DateRangeInput, type DateRangeInputProps, type DayCellRenderProps, Dialog, type DialogContentProps, type DialogOptions, type DialogProps, Drawer, type DrawerPlacementMap, type DrawerProps, FileInput, type FileInputProps, FilePicker, type FilePickerFile, type FileRejection, type FileRejectionReason, type FileSize, type FocusedOption, type FormatNumericInputOptions, GeckoUIProvider, type GeckoUIProviderProps, type Hsva, Input, InputError, type InputErrorProps, type InputProps, Label, type LabelProps, LoadingButton, type LoadingButtonProps, Menu, type MenuContextProps, MenuItem, type MenuItemProps, type MenuProps, MenuTrigger, type MenuTriggerProps, type MenuTriggerRenderProps, type MultiFileRenderState, type MultiSelectProps, type MultiSelectTriggerProps, type MultiSelectTriggerRenderProps, OTPInput, type OTPInputProps, type OpenFilePickerFn, type OpenFilePickerOptions, Pagination, type PaginationProps, type PickedFile, Popover, PopoverContent, type PopoverContentProps, type PopoverContextProps, type PopoverProps, PopoverTrigger, type PopoverTriggerProps, type PreviewFile, Progress, type ProgressColorMap, type ProgressLabel, type ProgressProps, type ProgressSizeMap, type RHFBaseProps, RHFCheckbox, type RHFCheckboxProps, RHFColorInput, type RHFColorInputProps, RHFController, RHFCounterInput, type RHFCounterInputProps, RHFCurrencyInput, type RHFCurrencyInputProps, RHFDateInput, type RHFDateInputProps, RHFDateRangeInput, type RHFDateRangeInputProps, RHFError, type RHFErrorProps, type RHFErrorRenderProps, RHFFileInput, type RHFFileInputProps, RHFInput, RHFInputGroup, type RHFInputGroupProps, type RHFInputProps, RHFNumberInput, type RHFNumberInputProps, RHFOTPInput, type RHFOTPInputProps, RHFRadio, type RHFRadioProps, RHFRangeSlider, type RHFRangeSliderProps, RHFRating, type RHFRatingProps, type RHFRenderArgs, RHFSelect, type RHFSelectOverload, type RHFSelectProps, RHFSlider, type RHFSliderProps, RHFSwitch, type RHFSwitchProps, RHFTagInput, type RHFTagInputProps, RHFTextarea, type RHFTextareaProps, RHFTimeInput, type RHFTimeInputProps, Radio, type RadioProps, RangeSlider, type RangeSliderProps, Rating, type RatingColorMap, type RatingProps, type RatingSizeMap, type Rgba, Select, SelectConsumer, type SelectConsumerProps, type SelectContextProps, SelectDropdownSearch, SelectEmpty, type SelectEmptyProps, SelectOption, type SelectOptionConfig, type SelectOptionElement, type SelectOptionProps, type SelectOverload, type SelectProps, SelectTrigger, type SelectTriggerBaseRenderProps, type SelectTriggerOverload, type SelectTriggerProps, type SelectionMode, type SingleFileRenderState, type SingleSelectProps, type SingleSelectTriggerProps, type SingleSelectTriggerRenderProps, Skeleton, type SkeletonAnimationMap, type SkeletonProps, type SkeletonShapeMap, Slider, type SliderColorMap, type SliderLabel, type SliderMark, type SliderProps, type SliderSizeMap, type SliderThumb, Spinner, Step, type StepProps, type StepRenderArgs, type StepStatus, Stepper, type StepperOrientationMap, type StepperProps, type StepperSizeMap, Switch, type SwitchProps, type SwitchSizeMap, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsContextProps, type TabsOrientation, type TabsProps, type TabsSizeMap, type TabsVariantMap, TagInput, TagInputOption, type TagInputOptionProps, type TagInputProps, type TagInputTag, Textarea, type TextareaProps, type TimeFormat, TimeInput, type TimeInputProps, type TimeParts, type ToastAction, type ToastOptions, type ToastPosition, type ToastPromiseMessages, type ToastRecord, type ToastVariant, Toaster, type ToasterOptions, Tooltip, type TooltipProps, type UseFilePickerOptions, type UseFilePickerReturn, asChildElement, devWarn, fileToUInt8Array, formatColor, formatNumericInput, getDataAttributes, hasDisplayName, isAsyncFn, isTwoFileEqualByFileContent, parseColor, splitDataAttributes, toThousandsSeparatorFormat, toast, useAccordion, useAccordionItem, useClickOutside, useEscListener, useFilePicker, useMenu, usePopover, usePreventDefault, useScrollLock, useSelect, useTabs, useTagInput };
|