@scalably/ui 0.1.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/README.md +326 -0
- package/dist/index.d.cts +1667 -0
- package/dist/index.d.ts +1667 -0
- package/dist/index.esm.js +3 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +2 -0
- package/package.json +116 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1667 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
+
import { ClassValue } from 'clsx';
|
|
7
|
+
import * as date_fns from 'date-fns';
|
|
8
|
+
export { addMonths, endOfMonth, isSameDay, startOfMonth } from 'date-fns';
|
|
9
|
+
|
|
10
|
+
interface BackToTopProps {
|
|
11
|
+
/** Offset in px before button appears */
|
|
12
|
+
showAfter?: number;
|
|
13
|
+
/** Positioning class overrides */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Container class (wrapper) */
|
|
16
|
+
containerClassName?: string;
|
|
17
|
+
/** Accessible label */
|
|
18
|
+
ariaLabel?: string;
|
|
19
|
+
/** Custom icon to display */
|
|
20
|
+
icon?: React.ReactNode;
|
|
21
|
+
/** Custom render function for the icon */
|
|
22
|
+
renderIcon?: (visible: boolean) => React.ReactNode;
|
|
23
|
+
/** Custom render function for the entire button */
|
|
24
|
+
renderButton?: (props: {
|
|
25
|
+
onClick: () => void;
|
|
26
|
+
visible: boolean;
|
|
27
|
+
className: string;
|
|
28
|
+
ariaLabel: string;
|
|
29
|
+
}) => React.ReactNode;
|
|
30
|
+
/** Scroll behavior: 'smooth' (default) or 'auto' */
|
|
31
|
+
scrollBehavior?: ScrollBehavior;
|
|
32
|
+
/** Full scroll options for advanced control */
|
|
33
|
+
scrollOptions?: ScrollToOptions;
|
|
34
|
+
/** Custom click handler (overrides default scroll behavior) */
|
|
35
|
+
onClick?: () => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* BackToTop - A floating action button that appears after scrolling and scrolls to the top.
|
|
39
|
+
*
|
|
40
|
+
* Features:
|
|
41
|
+
* - Auto-hide/show based on scroll position
|
|
42
|
+
* - Smooth scroll animation
|
|
43
|
+
* - Fully customizable icon and button rendering
|
|
44
|
+
* - Keyboard and screen-reader accessible
|
|
45
|
+
* - Responsive sizing
|
|
46
|
+
*
|
|
47
|
+
* Customization:
|
|
48
|
+
* - `icon`: Replace the default icon
|
|
49
|
+
* - `renderIcon`: Full control over icon rendering
|
|
50
|
+
* - `renderButton`: Complete button customization
|
|
51
|
+
* - `scrollBehavior`/`scrollOptions`: Control scroll behavior
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```tsx
|
|
55
|
+
* // Basic usage
|
|
56
|
+
* <BackToTop showAfter={300} />
|
|
57
|
+
*
|
|
58
|
+
* // Custom icon
|
|
59
|
+
* <BackToTop icon={<ChevronUpIcon />} />
|
|
60
|
+
*
|
|
61
|
+
* // Custom icon render
|
|
62
|
+
* <BackToTop
|
|
63
|
+
* renderIcon={(visible) => (
|
|
64
|
+
* <div className={visible ? "animate-bounce" : ""}>
|
|
65
|
+
* <ArrowUpIcon />
|
|
66
|
+
* </div>
|
|
67
|
+
* )}
|
|
68
|
+
* />
|
|
69
|
+
*
|
|
70
|
+
* // Fully custom button
|
|
71
|
+
* <BackToTop
|
|
72
|
+
* renderButton={({ onClick, visible, ariaLabel }) => (
|
|
73
|
+
* <button
|
|
74
|
+
* onClick={onClick}
|
|
75
|
+
* aria-label={ariaLabel}
|
|
76
|
+
* className={`custom-back-to-top ${visible ? 'show' : 'hide'}`}
|
|
77
|
+
* >
|
|
78
|
+
* ↑ Top
|
|
79
|
+
* </button>
|
|
80
|
+
* )}
|
|
81
|
+
* />
|
|
82
|
+
*
|
|
83
|
+
* // Custom scroll behavior
|
|
84
|
+
* <BackToTop
|
|
85
|
+
* scrollBehavior="auto"
|
|
86
|
+
* onClick={() => window.scrollTo({ top: 0, behavior: 'instant' })}
|
|
87
|
+
* />
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
declare const BackToTop: react.ForwardRefExoticComponent<BackToTopProps & react.RefAttributes<HTMLButtonElement>>;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Accessible status badge with semantic color variants.
|
|
94
|
+
*
|
|
95
|
+
* Aligns with design system color semantics:
|
|
96
|
+
* - `success`: Active/Complete/Done/Confirmed/Verified
|
|
97
|
+
* - `warning`: In progress/Waiting for confirmation
|
|
98
|
+
* - `error`: Needs attention/Important/Alert/Danger
|
|
99
|
+
* - `inactive`: Closed/Passed/Not active/Too late
|
|
100
|
+
* - `info`: Informational status
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```tsx
|
|
104
|
+
* <StatusBadge status="success">Active</StatusBadge>
|
|
105
|
+
* <StatusBadge status="warning" variant="outline">Pending</StatusBadge>
|
|
106
|
+
* <StatusBadge status="inactive">Closed</StatusBadge>
|
|
107
|
+
* <StatusBadge status="error" icon={<AlertIcon />}>Urgent</StatusBadge>
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
declare const statusBadgeVariants: (props?: ({
|
|
111
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
112
|
+
status?: "error" | "success" | "warning" | "info" | "inactive" | null | undefined;
|
|
113
|
+
variant?: "solid" | "soft" | "outline" | null | undefined;
|
|
114
|
+
fullWidth?: boolean | null | undefined;
|
|
115
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
116
|
+
type StatusBadgeStatus = NonNullable<VariantProps<typeof statusBadgeVariants>["status"]>;
|
|
117
|
+
type StatusBadgeVariant = NonNullable<VariantProps<typeof statusBadgeVariants>["variant"]>;
|
|
118
|
+
type StatusBadgeSize = NonNullable<VariantProps<typeof statusBadgeVariants>["size"]>;
|
|
119
|
+
interface StatusBadgeProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "children">, VariantProps<typeof statusBadgeVariants> {
|
|
120
|
+
/**
|
|
121
|
+
* Badge size using design system typography.
|
|
122
|
+
* - `sm`: 12px medium (label-12-medium) - default
|
|
123
|
+
* - `md`: 14px medium (body-14-medium)
|
|
124
|
+
* - `lg`: 16px medium (body-16-medium)
|
|
125
|
+
* @default "sm"
|
|
126
|
+
*/
|
|
127
|
+
size?: "sm" | "md" | "lg";
|
|
128
|
+
/**
|
|
129
|
+
* Optional leading icon.
|
|
130
|
+
*/
|
|
131
|
+
icon?: ReactNode;
|
|
132
|
+
/**
|
|
133
|
+
* Badge content (text or elements).
|
|
134
|
+
*/
|
|
135
|
+
children?: ReactNode;
|
|
136
|
+
/**
|
|
137
|
+
* Accessible label for icon-only badges.
|
|
138
|
+
* Falls back to the status label if no children provided.
|
|
139
|
+
*/
|
|
140
|
+
"aria-label"?: string;
|
|
141
|
+
}
|
|
142
|
+
declare const StatusBadge: react.ForwardRefExoticComponent<StatusBadgeProps & react.RefAttributes<HTMLSpanElement>>;
|
|
143
|
+
|
|
144
|
+
declare const buttonVariants: (props?: ({
|
|
145
|
+
variant?: "default" | "link" | "text" | "outline" | "destructive" | "secondary" | null | undefined;
|
|
146
|
+
size?: "icon" | "md" | "lg" | null | undefined;
|
|
147
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
148
|
+
type ButtonVariant = VariantProps<typeof buttonVariants>["variant"];
|
|
149
|
+
type ButtonSize = VariantProps<typeof buttonVariants>["size"];
|
|
150
|
+
type ButtonBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "size">;
|
|
151
|
+
interface ButtonProps extends ButtonBaseProps, VariantProps<typeof buttonVariants> {
|
|
152
|
+
loading?: boolean;
|
|
153
|
+
disabled?: boolean;
|
|
154
|
+
leftIcon?: React.ReactNode;
|
|
155
|
+
rightIcon?: React.ReactNode;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Button - A versatile button component with multiple variants, sizes, and states.
|
|
159
|
+
*
|
|
160
|
+
* Features:
|
|
161
|
+
* - Multiple variants: default, destructive, outline, secondary, text, link
|
|
162
|
+
* - Responsive sizes: md, lg, icon (mobile-first, scales up on larger screens)
|
|
163
|
+
* - Loading state with built-in spinner
|
|
164
|
+
* - Left and right icon slots
|
|
165
|
+
* - Full keyboard navigation and accessibility
|
|
166
|
+
* - Smooth transitions and interactive states
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```tsx
|
|
170
|
+
* // Basic usage
|
|
171
|
+
* <Button onClick={handleClick}>
|
|
172
|
+
* Click me
|
|
173
|
+
* </Button>
|
|
174
|
+
*
|
|
175
|
+
* // With variant and size
|
|
176
|
+
* <Button variant="outline" size="lg">
|
|
177
|
+
* Large Outline Button
|
|
178
|
+
* </Button>
|
|
179
|
+
*
|
|
180
|
+
* // Loading state
|
|
181
|
+
* <Button loading disabled>
|
|
182
|
+
* Saving...
|
|
183
|
+
* </Button>
|
|
184
|
+
*
|
|
185
|
+
* // With icons
|
|
186
|
+
* <Button leftIcon={<SaveIcon />} rightIcon={<ArrowIcon />}>
|
|
187
|
+
* Save and Continue
|
|
188
|
+
* </Button>
|
|
189
|
+
*
|
|
190
|
+
* // Icon-only button
|
|
191
|
+
* <Button variant="text" size="icon" aria-label="Close">
|
|
192
|
+
* <CloseIcon />
|
|
193
|
+
* </Button>
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
197
|
+
|
|
198
|
+
type MultipleSelectionButtonBaseProps = Omit<React.HTMLAttributes<HTMLDivElement>, "selectedCount" | "actions" | "defaultActive" | "active" | "onActiveChange" | "iconButtonAriaLabel">;
|
|
199
|
+
interface MultipleSelectionButtonProps extends MultipleSelectionButtonBaseProps {
|
|
200
|
+
selectedCount?: number;
|
|
201
|
+
actions?: React.ReactNode | React.ReactNode[];
|
|
202
|
+
defaultActive?: boolean;
|
|
203
|
+
active?: boolean;
|
|
204
|
+
onActiveChange?: (active: boolean) => void;
|
|
205
|
+
iconButtonAriaLabel?: string;
|
|
206
|
+
selectedLabel?: React.ReactNode | ((count: number) => React.ReactNode);
|
|
207
|
+
/** Custom toggle icon (when inactive) */
|
|
208
|
+
toggleIcon?: React.ReactNode;
|
|
209
|
+
/** Custom close icon (when active) */
|
|
210
|
+
closeIcon?: React.ReactNode;
|
|
211
|
+
/** Custom render function for count badge */
|
|
212
|
+
renderCount?: (count: number) => React.ReactNode;
|
|
213
|
+
/** Maximum count to display before showing "99+" */
|
|
214
|
+
maxDisplayCount?: number;
|
|
215
|
+
/** Custom render function for the entire component when inactive */
|
|
216
|
+
renderInactive?: (props: {
|
|
217
|
+
onClick: () => void;
|
|
218
|
+
ariaLabel: string;
|
|
219
|
+
}) => React.ReactNode;
|
|
220
|
+
/** Custom render function for the entire component when active */
|
|
221
|
+
renderActive?: (props: {
|
|
222
|
+
onClose: () => void;
|
|
223
|
+
selectedCount: number;
|
|
224
|
+
selectedLabel: React.ReactNode;
|
|
225
|
+
actions?: React.ReactNode | React.ReactNode[];
|
|
226
|
+
}) => React.ReactNode;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* MultipleSelectionButton - A compact controller for multi-select mode with action toolbar.
|
|
230
|
+
*
|
|
231
|
+
* Features:
|
|
232
|
+
* - Toggle between inactive (icon button) and active (toolbar) states
|
|
233
|
+
* - Selection counter with customizable max display
|
|
234
|
+
* - Action slots for bulk operations
|
|
235
|
+
* - Controlled and uncontrolled modes
|
|
236
|
+
* - Fully customizable icons and rendering
|
|
237
|
+
*
|
|
238
|
+
* Customization:
|
|
239
|
+
* - `toggleIcon`/`closeIcon`: Replace default icons
|
|
240
|
+
* - `renderCount`: Custom count badge rendering
|
|
241
|
+
* - `renderInactive`/`renderActive`: Complete state customization
|
|
242
|
+
* - `maxDisplayCount`: Control when to show "99+"
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```tsx
|
|
246
|
+
* // Basic usage
|
|
247
|
+
* <MultipleSelectionButton
|
|
248
|
+
* active={isSelecting}
|
|
249
|
+
* onActiveChange={setIsSelecting}
|
|
250
|
+
* selectedCount={selected.length}
|
|
251
|
+
* actions={[
|
|
252
|
+
* <Button onClick={handleDelete}>Delete</Button>,
|
|
253
|
+
* <Button onClick={handleExport}>Export</Button>
|
|
254
|
+
* ]}
|
|
255
|
+
* />
|
|
256
|
+
*
|
|
257
|
+
* // Custom icons
|
|
258
|
+
* <MultipleSelectionButton
|
|
259
|
+
* active={isSelecting}
|
|
260
|
+
* onActiveChange={setIsSelecting}
|
|
261
|
+
* selectedCount={selected.length}
|
|
262
|
+
* toggleIcon={<CheckSquareIcon />}
|
|
263
|
+
* closeIcon={<XIcon />}
|
|
264
|
+
* />
|
|
265
|
+
*
|
|
266
|
+
* // Custom count rendering
|
|
267
|
+
* <MultipleSelectionButton
|
|
268
|
+
* active={isSelecting}
|
|
269
|
+
* selectedCount={selected.length}
|
|
270
|
+
* renderCount={(count) => (
|
|
271
|
+
* <div className="badge">{count} items</div>
|
|
272
|
+
* )}
|
|
273
|
+
* />
|
|
274
|
+
*
|
|
275
|
+
* // Fully custom rendering
|
|
276
|
+
* <MultipleSelectionButton
|
|
277
|
+
* active={isSelecting}
|
|
278
|
+
* onActiveChange={setIsSelecting}
|
|
279
|
+
* selectedCount={selected.length}
|
|
280
|
+
* renderActive={({ onClose, selectedCount }) => (
|
|
281
|
+
* <div className="custom-toolbar">
|
|
282
|
+
* <button onClick={onClose}>✕</button>
|
|
283
|
+
* <span>{selectedCount} selected</span>
|
|
284
|
+
* </div>
|
|
285
|
+
* )}
|
|
286
|
+
* />
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
declare const MultipleSelectionButton: react.ForwardRefExoticComponent<MultipleSelectionButtonProps & react.RefAttributes<HTMLDivElement>>;
|
|
290
|
+
|
|
291
|
+
type BaseInputProps$1 = Omit<React.InputHTMLAttributes<HTMLInputElement>, "size">;
|
|
292
|
+
interface CheckboxProps extends BaseInputProps$1 {
|
|
293
|
+
/** Marks the field as invalid (error state). Applies error color styling. */
|
|
294
|
+
invalid?: boolean;
|
|
295
|
+
/** Sets the checkbox to an indeterminate state. */
|
|
296
|
+
indeterminate?: boolean;
|
|
297
|
+
/** Optional visible label. Use `children` if you need custom label layout. */
|
|
298
|
+
label?: React.ReactNode;
|
|
299
|
+
/** Optional description text shown under the label for a11y. */
|
|
300
|
+
description?: React.ReactNode;
|
|
301
|
+
/** Id of the description element for aria-describedby; auto-wired if `description` provided. */
|
|
302
|
+
descriptionId?: string;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Checkbox - An accessible checkbox component with custom SVG UI and advanced states.
|
|
306
|
+
*
|
|
307
|
+
* Features:
|
|
308
|
+
* - Native checkbox behavior with custom visual design
|
|
309
|
+
* - Indeterminate state support
|
|
310
|
+
* - Error/invalid state styling
|
|
311
|
+
* - Optional label and description
|
|
312
|
+
* - Full keyboard navigation and accessibility
|
|
313
|
+
* - ARIA attributes for screen readers
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* ```tsx
|
|
317
|
+
* // Basic usage
|
|
318
|
+
* <Checkbox
|
|
319
|
+
* checked={agreed}
|
|
320
|
+
* onChange={(e) => setAgreed(e.target.checked)}
|
|
321
|
+
* label="I agree to the terms"
|
|
322
|
+
* />
|
|
323
|
+
*
|
|
324
|
+
* // With description
|
|
325
|
+
* <Checkbox
|
|
326
|
+
* checked={notifications}
|
|
327
|
+
* onChange={(e) => setNotifications(e.target.checked)}
|
|
328
|
+
* label="Enable notifications"
|
|
329
|
+
* description="Receive email updates about your account"
|
|
330
|
+
* />
|
|
331
|
+
*
|
|
332
|
+
* // With indeterminate state (e.g., "select all")
|
|
333
|
+
* <Checkbox
|
|
334
|
+
* checked={allSelected}
|
|
335
|
+
* indeterminate={someSelected}
|
|
336
|
+
* onChange={handleSelectAll}
|
|
337
|
+
* label="Select all items"
|
|
338
|
+
* />
|
|
339
|
+
*
|
|
340
|
+
* // With error state
|
|
341
|
+
* <Checkbox
|
|
342
|
+
* checked={agreed}
|
|
343
|
+
* onChange={(e) => setAgreed(e.target.checked)}
|
|
344
|
+
* label="I agree to the terms"
|
|
345
|
+
* invalid={!agreed && submitted}
|
|
346
|
+
* />
|
|
347
|
+
* ```
|
|
348
|
+
*/
|
|
349
|
+
declare const Checkbox: react.ForwardRefExoticComponent<CheckboxProps & react.RefAttributes<HTMLInputElement>>;
|
|
350
|
+
|
|
351
|
+
type Orientation = "horizontal" | "vertical";
|
|
352
|
+
|
|
353
|
+
interface CheckboxGroupOption<T extends string = string> {
|
|
354
|
+
value: T;
|
|
355
|
+
label: React.ReactNode;
|
|
356
|
+
description?: React.ReactNode;
|
|
357
|
+
disabled?: boolean;
|
|
358
|
+
invalid?: boolean;
|
|
359
|
+
id?: string;
|
|
360
|
+
}
|
|
361
|
+
type BaseFieldSetProps$1 = Omit<React.HTMLAttributes<HTMLFieldSetElement>, "onChange">;
|
|
362
|
+
interface CheckboxGroupProps<T extends string = string> extends BaseFieldSetProps$1 {
|
|
363
|
+
/** Accessible legend/title for the group */
|
|
364
|
+
legend: React.ReactNode;
|
|
365
|
+
/** Shared name assigned to all checkboxes in this group */
|
|
366
|
+
name: string;
|
|
367
|
+
/** Layout direction */
|
|
368
|
+
orientation?: Orientation;
|
|
369
|
+
/** Checkbox options list */
|
|
370
|
+
options: CheckboxGroupOption<T>[];
|
|
371
|
+
/** Controlled values array */
|
|
372
|
+
value?: T[];
|
|
373
|
+
/** Uncontrolled default values array */
|
|
374
|
+
defaultValue?: T[];
|
|
375
|
+
/** Change handler (receives array of selected values) */
|
|
376
|
+
onChange?: (selected: T[]) => void;
|
|
377
|
+
/** Marks group invalid; individual option invalids override per item */
|
|
378
|
+
invalid?: boolean;
|
|
379
|
+
/** Description for the group for SR users */
|
|
380
|
+
description?: React.ReactNode;
|
|
381
|
+
/** ID for description element, auto if omitted */
|
|
382
|
+
descriptionId?: string;
|
|
383
|
+
/** Show "Select All" checkbox */
|
|
384
|
+
showSelectAll?: boolean;
|
|
385
|
+
/** Label for the "Select All" checkbox */
|
|
386
|
+
selectAllLabel?: React.ReactNode;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* - Fieldset wrapper managing a group of checkboxes with optional Select All,description, and orientation.
|
|
390
|
+
*/
|
|
391
|
+
declare const CheckboxGroup: react.ForwardRefExoticComponent<CheckboxGroupProps<string> & react.RefAttributes<HTMLFieldSetElement>>;
|
|
392
|
+
|
|
393
|
+
declare const inputVariants: (props?: ({
|
|
394
|
+
variant?: "error" | "default" | null | undefined;
|
|
395
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
396
|
+
type InputVariants = VariantProps<typeof inputVariants>;
|
|
397
|
+
type InputVariant = InputVariants["variant"];
|
|
398
|
+
type InputBaseProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "required">;
|
|
399
|
+
interface InputProps extends InputBaseProps {
|
|
400
|
+
variant?: InputVariant;
|
|
401
|
+
label?: string;
|
|
402
|
+
error?: string;
|
|
403
|
+
helperText?: string;
|
|
404
|
+
contentSize?: number;
|
|
405
|
+
leftDivider?: boolean;
|
|
406
|
+
rightDivider?: boolean;
|
|
407
|
+
containerClassName?: string;
|
|
408
|
+
required?: boolean;
|
|
409
|
+
disabled?: boolean;
|
|
410
|
+
leftIcon?: React.ReactNode;
|
|
411
|
+
onLeftIconClick?: () => void;
|
|
412
|
+
leftIconAriaLabel?: string;
|
|
413
|
+
rightIcon?: React.ReactNode;
|
|
414
|
+
onRightIconClick?: () => void;
|
|
415
|
+
rightIconAriaLabel?: string;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Input - A text input component with validation, icons, and accessibility features.
|
|
419
|
+
*
|
|
420
|
+
* Features:
|
|
421
|
+
* - Validation states with error styling
|
|
422
|
+
* - Label, helper text, and error message support
|
|
423
|
+
* - Left and right icon slots (static or clickable)
|
|
424
|
+
* - Optional dividers between icons and input
|
|
425
|
+
* - Responsive sizing (mobile-first design)
|
|
426
|
+
* - Full keyboard navigation and accessibility
|
|
427
|
+
* - Support for all native input types
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* ```tsx
|
|
431
|
+
* // Basic usage
|
|
432
|
+
* <Input
|
|
433
|
+
* label="Email"
|
|
434
|
+
* placeholder="Enter your email"
|
|
435
|
+
* value={email}
|
|
436
|
+
* onChange={(e) => setEmail(e.target.value)}
|
|
437
|
+
* />
|
|
438
|
+
*
|
|
439
|
+
* // With validation
|
|
440
|
+
* <Input
|
|
441
|
+
* label="Password"
|
|
442
|
+
* type="password"
|
|
443
|
+
* required
|
|
444
|
+
* error="Password must be at least 8 characters"
|
|
445
|
+
* helperText="Use a strong password"
|
|
446
|
+
* />
|
|
447
|
+
*
|
|
448
|
+
* // With icons
|
|
449
|
+
* <Input
|
|
450
|
+
* leftIcon={<SearchIcon />}
|
|
451
|
+
* placeholder="Search..."
|
|
452
|
+
* />
|
|
453
|
+
*
|
|
454
|
+
* // With clickable icons
|
|
455
|
+
* <Input
|
|
456
|
+
* type="password"
|
|
457
|
+
* rightIcon={<EyeIcon />}
|
|
458
|
+
* onRightIconClick={togglePasswordVisibility}
|
|
459
|
+
* rightIconAriaLabel="Toggle password visibility"
|
|
460
|
+
* />
|
|
461
|
+
*
|
|
462
|
+
* // With dividers
|
|
463
|
+
* <Input
|
|
464
|
+
* leftIcon={<DollarIcon />}
|
|
465
|
+
* leftDivider
|
|
466
|
+
* placeholder="0.00"
|
|
467
|
+
* />
|
|
468
|
+
* ```
|
|
469
|
+
*/
|
|
470
|
+
declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
|
|
471
|
+
|
|
472
|
+
type QuantityInputBaseProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "type" | "value" | "defaultValue">;
|
|
473
|
+
interface QuantityInputProps extends QuantityInputBaseProps {
|
|
474
|
+
value?: number;
|
|
475
|
+
defaultValue?: number;
|
|
476
|
+
onChange?: (value: number) => void;
|
|
477
|
+
min?: number;
|
|
478
|
+
max?: number;
|
|
479
|
+
step?: number;
|
|
480
|
+
label?: string;
|
|
481
|
+
helperText?: string;
|
|
482
|
+
error?: string;
|
|
483
|
+
containerClassName?: string;
|
|
484
|
+
inputClassName?: string;
|
|
485
|
+
/** Disable manual typing; only allow +/- */
|
|
486
|
+
readOnlyInput?: boolean;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* - Controlled/uncontrolled via useControllableState
|
|
490
|
+
* - Clamps to [min, max]
|
|
491
|
+
* - Disables +/- when at bounds
|
|
492
|
+
* - Auto-clamps manual input on blur or invalid typing
|
|
493
|
+
*/
|
|
494
|
+
declare const QuantityInput: react.ForwardRefExoticComponent<QuantityInputProps & react.RefAttributes<HTMLInputElement>>;
|
|
495
|
+
|
|
496
|
+
declare const searchInputVariants: (props?: ({
|
|
497
|
+
variant?: "full" | "compact" | null | undefined;
|
|
498
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
499
|
+
type SearchInputVariant = VariantProps<typeof searchInputVariants>["variant"];
|
|
500
|
+
type SearchInputBaseProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "type">;
|
|
501
|
+
interface SearchInputProps extends SearchInputBaseProps {
|
|
502
|
+
variant?: SearchInputVariant;
|
|
503
|
+
placeholder?: string;
|
|
504
|
+
onSearch?: (value: string) => void;
|
|
505
|
+
clearable?: boolean;
|
|
506
|
+
containerClassName?: string;
|
|
507
|
+
disabled?: boolean;
|
|
508
|
+
defaultValue?: string;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* - Search field with compact and full variants, animated expansion, keyboard
|
|
512
|
+
* handling, and optional clear button.
|
|
513
|
+
*/
|
|
514
|
+
declare const SearchInput: react.ForwardRefExoticComponent<SearchInputProps & react.RefAttributes<HTMLInputElement>>;
|
|
515
|
+
|
|
516
|
+
type DatePickerMode = "single" | "range";
|
|
517
|
+
interface BaseProps$1 {
|
|
518
|
+
label?: string;
|
|
519
|
+
mode?: DatePickerMode;
|
|
520
|
+
defaultMonth?: Date;
|
|
521
|
+
minDate?: Date;
|
|
522
|
+
maxDate?: Date;
|
|
523
|
+
isDateDisabled?: (date: Date) => boolean;
|
|
524
|
+
isDateMarked?: (date: Date) => boolean;
|
|
525
|
+
showTime?: boolean;
|
|
526
|
+
minuteStep?: number;
|
|
527
|
+
onCancel?: () => void;
|
|
528
|
+
onApply?: (value: Date | {
|
|
529
|
+
from: Date | null;
|
|
530
|
+
to: Date | null;
|
|
531
|
+
}) => void;
|
|
532
|
+
className?: string;
|
|
533
|
+
locale?: string | string[];
|
|
534
|
+
labels?: {
|
|
535
|
+
from?: string;
|
|
536
|
+
to?: string;
|
|
537
|
+
today?: string;
|
|
538
|
+
cancel?: string;
|
|
539
|
+
apply?: string;
|
|
540
|
+
hours?: string;
|
|
541
|
+
minutes?: string;
|
|
542
|
+
};
|
|
543
|
+
weekdayLabels?: string[];
|
|
544
|
+
monthLabels?: string[];
|
|
545
|
+
formatHeaderDate?: (date: Date) => string;
|
|
546
|
+
}
|
|
547
|
+
interface SingleProps$1 extends BaseProps$1 {
|
|
548
|
+
mode?: "single";
|
|
549
|
+
value?: Date | null;
|
|
550
|
+
onChange?: (value: Date | null) => void;
|
|
551
|
+
}
|
|
552
|
+
interface RangeValue {
|
|
553
|
+
from: Date | null;
|
|
554
|
+
to: Date | null;
|
|
555
|
+
}
|
|
556
|
+
interface RangeProps$1 extends BaseProps$1 {
|
|
557
|
+
mode: "range";
|
|
558
|
+
value?: RangeValue;
|
|
559
|
+
onChange?: (value: RangeValue) => void;
|
|
560
|
+
}
|
|
561
|
+
type DatePickerProps = SingleProps$1 | RangeProps$1;
|
|
562
|
+
/**
|
|
563
|
+
* DatePicker - A comprehensive date and time picker with single and range selection modes.
|
|
564
|
+
*
|
|
565
|
+
* Features:
|
|
566
|
+
* - Single date or date range selection
|
|
567
|
+
* - Optional time picker with customizable minute steps
|
|
568
|
+
* - Responsive design (side-by-side on desktop, step-by-step on mobile)
|
|
569
|
+
* - Full internationalization support
|
|
570
|
+
* - Min/max date constraints
|
|
571
|
+
* - Custom date validation and marking
|
|
572
|
+
* - Keyboard navigation and accessibility
|
|
573
|
+
* - Customizable labels and formatting
|
|
574
|
+
*
|
|
575
|
+
* @example
|
|
576
|
+
* ```tsx
|
|
577
|
+
* // Single date selection
|
|
578
|
+
* <DatePicker
|
|
579
|
+
* mode="single"
|
|
580
|
+
* value={selectedDate}
|
|
581
|
+
* onChange={setSelectedDate}
|
|
582
|
+
* showTime
|
|
583
|
+
* minuteStep={15}
|
|
584
|
+
* onApply={(date) => console.log('Applied:', date)}
|
|
585
|
+
* />
|
|
586
|
+
*
|
|
587
|
+
* // Date range selection
|
|
588
|
+
* <DatePicker
|
|
589
|
+
* mode="range"
|
|
590
|
+
* value={{ from: startDate, to: endDate }}
|
|
591
|
+
* onChange={setDateRange}
|
|
592
|
+
* minDate={new Date()}
|
|
593
|
+
* maxDate={addMonths(new Date(), 6)}
|
|
594
|
+
* onApply={(range) => console.log('Applied:', range)}
|
|
595
|
+
* />
|
|
596
|
+
*
|
|
597
|
+
* // With localization
|
|
598
|
+
* <DatePicker
|
|
599
|
+
* mode="single"
|
|
600
|
+
* value={date}
|
|
601
|
+
* onChange={setDate}
|
|
602
|
+
* locale="es"
|
|
603
|
+
* labels={{
|
|
604
|
+
* today: 'Hoy',
|
|
605
|
+
* cancel: 'Cancelar',
|
|
606
|
+
* apply: 'Aplicar'
|
|
607
|
+
* }}
|
|
608
|
+
* />
|
|
609
|
+
*
|
|
610
|
+
* // With custom validation
|
|
611
|
+
* <DatePicker
|
|
612
|
+
* mode="single"
|
|
613
|
+
* value={date}
|
|
614
|
+
* onChange={setDate}
|
|
615
|
+
* isDateDisabled={(d) => d.getDay() === 0 || d.getDay() === 6}
|
|
616
|
+
* isDateMarked={(d) => isHoliday(d)}
|
|
617
|
+
* />
|
|
618
|
+
* ```
|
|
619
|
+
*/
|
|
620
|
+
declare const DatePicker: react.ForwardRefExoticComponent<DatePickerProps & react.RefAttributes<HTMLDivElement>>;
|
|
621
|
+
|
|
622
|
+
type DateInputMode = "single" | "range";
|
|
623
|
+
type BaseProps = {
|
|
624
|
+
label?: string;
|
|
625
|
+
helperText?: string;
|
|
626
|
+
error?: string;
|
|
627
|
+
required?: boolean;
|
|
628
|
+
disabled?: boolean;
|
|
629
|
+
className?: string;
|
|
630
|
+
containerClassName?: string;
|
|
631
|
+
placeholder?: string;
|
|
632
|
+
autoWidth?: boolean;
|
|
633
|
+
format?: (value: Date | {
|
|
634
|
+
from: Date | null;
|
|
635
|
+
to: Date | null;
|
|
636
|
+
} | null) => string;
|
|
637
|
+
parse?: (text: string) => Date | null;
|
|
638
|
+
onOpenChange?: (open: boolean) => void;
|
|
639
|
+
closeOnSelect?: boolean;
|
|
640
|
+
} & Pick<DatePickerProps, "minDate" | "maxDate" | "isDateDisabled" | "isDateMarked" | "showTime" | "minuteStep" | "locale" | "labels" | "weekdayLabels" | "monthLabels" | "formatHeaderDate">;
|
|
641
|
+
type SingleValue = Date | null;
|
|
642
|
+
interface SingleProps extends Omit<InputProps, "value" | "onChange" | "type" | "defaultValue">, BaseProps {
|
|
643
|
+
mode?: "single";
|
|
644
|
+
value?: SingleValue;
|
|
645
|
+
defaultValue?: SingleValue;
|
|
646
|
+
onChange?: (value: SingleValue) => void;
|
|
647
|
+
}
|
|
648
|
+
interface RangeProps extends Omit<InputProps, "value" | "onChange" | "type" | "defaultValue">, BaseProps {
|
|
649
|
+
mode: "range";
|
|
650
|
+
value?: RangeValue;
|
|
651
|
+
defaultValue?: RangeValue;
|
|
652
|
+
onChange?: (value: RangeValue) => void;
|
|
653
|
+
}
|
|
654
|
+
type DateInputProps = SingleProps | RangeProps;
|
|
655
|
+
/**
|
|
656
|
+
* - Text input that opens an accessible date (and optional time) picker. Supports
|
|
657
|
+
* single and range modes, localization, and formatted display values.
|
|
658
|
+
*/
|
|
659
|
+
declare const DateInput: react.ForwardRefExoticComponent<DateInputProps & react.RefAttributes<HTMLInputElement>>;
|
|
660
|
+
|
|
661
|
+
declare const dividerVariants: (props?: ({
|
|
662
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
663
|
+
inset?: "end" | "none" | "both" | "start" | null | undefined;
|
|
664
|
+
thickness?: "sm" | "px" | null | undefined;
|
|
665
|
+
stretch?: "none" | "full" | null | undefined;
|
|
666
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
667
|
+
type DividerVariant = VariantProps<typeof dividerVariants>;
|
|
668
|
+
type DividerProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof dividerVariants> & {
|
|
669
|
+
colorClassName?: string;
|
|
670
|
+
};
|
|
671
|
+
/**
|
|
672
|
+
* - Themed horizontal or vertical separator with orientation, inset, thickness,
|
|
673
|
+
* and stretch variants. Uses role="separator" for a11y.
|
|
674
|
+
*/
|
|
675
|
+
declare const Divider: react.ForwardRefExoticComponent<react.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
676
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
677
|
+
inset?: "end" | "none" | "both" | "start" | null | undefined;
|
|
678
|
+
thickness?: "sm" | "px" | null | undefined;
|
|
679
|
+
stretch?: "none" | "full" | null | undefined;
|
|
680
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string> & {
|
|
681
|
+
colorClassName?: string;
|
|
682
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
683
|
+
|
|
684
|
+
declare const fileUploadVariants: (props?: ({
|
|
685
|
+
variant?: "error" | "default" | "disabled" | "dragOver" | null | undefined;
|
|
686
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
687
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
688
|
+
type FileUploadVariant = VariantProps<typeof fileUploadVariants>["variant"];
|
|
689
|
+
type FileUploadSize = VariantProps<typeof fileUploadVariants>["size"];
|
|
690
|
+
type FileUploadIconType = "file" | "image" | "video";
|
|
691
|
+
interface FileUploadError {
|
|
692
|
+
type: "fileType" | "fileSize" | "fileCount" | "network" | "unknown";
|
|
693
|
+
message: string;
|
|
694
|
+
file?: File;
|
|
695
|
+
}
|
|
696
|
+
interface FileUploadFile {
|
|
697
|
+
id: string;
|
|
698
|
+
file: File;
|
|
699
|
+
preview?: string;
|
|
700
|
+
status: "pending" | "uploading" | "success" | "error";
|
|
701
|
+
error?: FileUploadError;
|
|
702
|
+
progress?: number;
|
|
703
|
+
}
|
|
704
|
+
type FileUploadSubtitleContext = {
|
|
705
|
+
acceptedFileTypes: string[];
|
|
706
|
+
maxFileSize: number;
|
|
707
|
+
multiple: boolean;
|
|
708
|
+
maxFiles: number;
|
|
709
|
+
};
|
|
710
|
+
interface FileUploadMessages {
|
|
711
|
+
titleIdle?: React.ReactNode;
|
|
712
|
+
titleDragOver?: React.ReactNode;
|
|
713
|
+
subtitle?: React.ReactNode;
|
|
714
|
+
}
|
|
715
|
+
interface FileUploadProps {
|
|
716
|
+
files?: FileUploadFile[];
|
|
717
|
+
onFilesChange?: (files: FileUploadFile[]) => void;
|
|
718
|
+
onUploadSuccess?: (files: File[]) => void;
|
|
719
|
+
onUploadError?: (error: FileUploadError) => void;
|
|
720
|
+
onFileRemove?: (fileId: string) => void;
|
|
721
|
+
acceptedFileTypes?: string[];
|
|
722
|
+
maxFileSize?: number;
|
|
723
|
+
maxFiles?: number;
|
|
724
|
+
multiple?: boolean;
|
|
725
|
+
disabled?: boolean;
|
|
726
|
+
label?: string;
|
|
727
|
+
error?: string;
|
|
728
|
+
/** Optional helper text displayed under the dropzone when no error */
|
|
729
|
+
helperText?: string;
|
|
730
|
+
variant?: FileUploadVariant;
|
|
731
|
+
size?: FileUploadSize;
|
|
732
|
+
className?: string;
|
|
733
|
+
iconType?: FileUploadIconType;
|
|
734
|
+
uploadIcon?: React.ReactNode;
|
|
735
|
+
successIcon?: React.ReactNode;
|
|
736
|
+
errorIcon?: React.ReactNode;
|
|
737
|
+
id?: string;
|
|
738
|
+
required?: boolean;
|
|
739
|
+
"aria-label"?: string;
|
|
740
|
+
"aria-describedby"?: string;
|
|
741
|
+
messages?: FileUploadMessages;
|
|
742
|
+
/**
|
|
743
|
+
* Fully control the subtitle line using a render function.
|
|
744
|
+
* If provided, this takes precedence over messages.subtitle.
|
|
745
|
+
*/
|
|
746
|
+
renderSubtitle?: (ctx: FileUploadSubtitleContext) => React.ReactNode;
|
|
747
|
+
/**
|
|
748
|
+
* Optional callback for custom file validation.
|
|
749
|
+
* Return a FileUploadError to reject the file, or null/undefined to accept it.
|
|
750
|
+
* This runs after internal type/size validation.
|
|
751
|
+
*/
|
|
752
|
+
onValidateFile?: (file: File) => FileUploadError | null | undefined;
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* File upload component with drag-and-drop, validation, previews, and accessibility support.
|
|
756
|
+
* Supports multiple files, file type validation, size limits, and comprehensive error handling.
|
|
757
|
+
*/
|
|
758
|
+
/**
|
|
759
|
+
* Note on uploading state:
|
|
760
|
+
* - The component does not perform uploads; the parent owns upload lifecycle.
|
|
761
|
+
* - To show progress or uploading state, manage `files` as a controlled prop and
|
|
762
|
+
* update each item's `status` ("uploading" | "success" | "error") and `progress`.
|
|
763
|
+
*/
|
|
764
|
+
declare const FileUpload: react.ForwardRefExoticComponent<FileUploadProps & react.RefAttributes<HTMLDivElement>>;
|
|
765
|
+
|
|
766
|
+
type FormBaseProps = Omit<React.FormHTMLAttributes<HTMLFormElement>, "onSubmit">;
|
|
767
|
+
interface FormProps extends FormBaseProps {
|
|
768
|
+
onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void;
|
|
769
|
+
noValidate?: boolean;
|
|
770
|
+
children: React.ReactNode;
|
|
771
|
+
className?: string;
|
|
772
|
+
"aria-describedby"?: string;
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* - Accessible form primitives: form wrapper with invalid focus management,
|
|
776
|
+
* error summary region, and grouping field container.
|
|
777
|
+
*/
|
|
778
|
+
declare const Form: react.ForwardRefExoticComponent<FormProps & react.RefAttributes<HTMLFormElement>>;
|
|
779
|
+
interface FormErrorItem {
|
|
780
|
+
id: string;
|
|
781
|
+
message: string;
|
|
782
|
+
}
|
|
783
|
+
interface FormErrorSummaryProps {
|
|
784
|
+
errors: FormErrorItem[];
|
|
785
|
+
className?: string;
|
|
786
|
+
title?: string;
|
|
787
|
+
id?: string;
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Renders a concise error summary with links to corresponding fields.
|
|
791
|
+
* Uses role="alert" and aria-live to announce updates to screen readers.
|
|
792
|
+
*/
|
|
793
|
+
declare const FormErrorSummary: react.ForwardRefExoticComponent<FormErrorSummaryProps & react.RefAttributes<HTMLDivElement>>;
|
|
794
|
+
interface FormFieldProps {
|
|
795
|
+
children: React.ReactNode;
|
|
796
|
+
className?: string;
|
|
797
|
+
asFieldset?: boolean;
|
|
798
|
+
legend?: string;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Lightweight grouping container for related controls.
|
|
802
|
+
* Optionally renders a fieldset/legend for semantic grouping.
|
|
803
|
+
*/
|
|
804
|
+
declare const FormField: react.ForwardRefExoticComponent<FormFieldProps & react.RefAttributes<HTMLDivElement | HTMLFieldSetElement>>;
|
|
805
|
+
|
|
806
|
+
type PaginationBaseProps = Omit<React.HTMLAttributes<HTMLElement>, "onChange">;
|
|
807
|
+
interface PaginationProps extends PaginationBaseProps {
|
|
808
|
+
total?: number;
|
|
809
|
+
pageSize?: number;
|
|
810
|
+
page?: number;
|
|
811
|
+
defaultPage?: number;
|
|
812
|
+
onPageChange?: (page: number) => void;
|
|
813
|
+
siblingCount?: 0 | 1 | 2;
|
|
814
|
+
showInfo?: boolean;
|
|
815
|
+
showFirstLast?: boolean;
|
|
816
|
+
hasNextPage?: boolean;
|
|
817
|
+
hasPrevPage?: boolean;
|
|
818
|
+
renderInfo?: (from: number, to: number, total: number) => React.ReactNode;
|
|
819
|
+
className?: string;
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* Pagination - An accessible pagination component with flexible configuration.
|
|
823
|
+
*
|
|
824
|
+
* Features:
|
|
825
|
+
* - Page number buttons with ellipsis for large datasets
|
|
826
|
+
* - Previous/Next navigation
|
|
827
|
+
* - Optional First/Last page buttons
|
|
828
|
+
* - Page info display (e.g., "1-10 of 100")
|
|
829
|
+
* - Controlled or uncontrolled modes
|
|
830
|
+
* - Responsive design
|
|
831
|
+
* - Configurable sibling page count
|
|
832
|
+
* - Custom info renderer
|
|
833
|
+
* - Full keyboard navigation and ARIA support
|
|
834
|
+
*
|
|
835
|
+
* @example
|
|
836
|
+
* ```tsx
|
|
837
|
+
* // Basic usage
|
|
838
|
+
* <Pagination
|
|
839
|
+
* total={100}
|
|
840
|
+
* pageSize={10}
|
|
841
|
+
* page={currentPage}
|
|
842
|
+
* onPageChange={setCurrentPage}
|
|
843
|
+
* />
|
|
844
|
+
*
|
|
845
|
+
* // With first/last buttons
|
|
846
|
+
* <Pagination
|
|
847
|
+
* total={500}
|
|
848
|
+
* pageSize={20}
|
|
849
|
+
* page={page}
|
|
850
|
+
* onPageChange={setPage}
|
|
851
|
+
* showFirstLast
|
|
852
|
+
* siblingCount={2}
|
|
853
|
+
* />
|
|
854
|
+
*
|
|
855
|
+
* // Without page info
|
|
856
|
+
* <Pagination
|
|
857
|
+
* total={200}
|
|
858
|
+
* pageSize={25}
|
|
859
|
+
* page={page}
|
|
860
|
+
* onPageChange={setPage}
|
|
861
|
+
* showInfo={false}
|
|
862
|
+
* />
|
|
863
|
+
*
|
|
864
|
+
* // Custom info renderer
|
|
865
|
+
* <Pagination
|
|
866
|
+
* total={150}
|
|
867
|
+
* pageSize={15}
|
|
868
|
+
* page={page}
|
|
869
|
+
* onPageChange={setPage}
|
|
870
|
+
* renderInfo={(from, to, total) => (
|
|
871
|
+
* <span>Showing {from}-{to} of {total} items</span>
|
|
872
|
+
* )}
|
|
873
|
+
* />
|
|
874
|
+
*
|
|
875
|
+
* // For infinite scroll/cursor pagination
|
|
876
|
+
* <Pagination
|
|
877
|
+
* page={page}
|
|
878
|
+
* onPageChange={setPage}
|
|
879
|
+
* hasNextPage={hasMore}
|
|
880
|
+
* hasPrevPage={page > 1}
|
|
881
|
+
* showInfo={false}
|
|
882
|
+
* />
|
|
883
|
+
* ```
|
|
884
|
+
*/
|
|
885
|
+
declare const Pagination: react.ForwardRefExoticComponent<PaginationProps & react.RefAttributes<HTMLElement>>;
|
|
886
|
+
|
|
887
|
+
type BaseInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "size">;
|
|
888
|
+
interface RadioProps extends BaseInputProps {
|
|
889
|
+
/** Marks the field as invalid (error state). Applies error color styling. */
|
|
890
|
+
invalid?: boolean;
|
|
891
|
+
/** Optional visible label. Use `children` if you need custom label layout. */
|
|
892
|
+
label?: React.ReactNode;
|
|
893
|
+
/** Optional description text shown under the label for a11y. */
|
|
894
|
+
description?: React.ReactNode;
|
|
895
|
+
/** Id of the description element for aria-describedby; auto-wired if `description` provided. */
|
|
896
|
+
descriptionId?: string;
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* Radio - An accessible radio button component with custom SVG UI.
|
|
900
|
+
*
|
|
901
|
+
* Features:
|
|
902
|
+
* - Native radio button behavior with custom visual design
|
|
903
|
+
* - Error/invalid state styling
|
|
904
|
+
* - Optional label and description
|
|
905
|
+
* - Full keyboard navigation within radio groups
|
|
906
|
+
* - ARIA attributes for screen readers
|
|
907
|
+
* - Works with RadioGroup for managing groups
|
|
908
|
+
*
|
|
909
|
+
* @example
|
|
910
|
+
* ```tsx
|
|
911
|
+
* // Basic usage (standalone)
|
|
912
|
+
* <Radio
|
|
913
|
+
* name="size"
|
|
914
|
+
* value="medium"
|
|
915
|
+
* checked={size === 'medium'}
|
|
916
|
+
* onChange={(e) => setSize(e.target.value)}
|
|
917
|
+
* label="Medium"
|
|
918
|
+
* />
|
|
919
|
+
*
|
|
920
|
+
* // With description
|
|
921
|
+
* <Radio
|
|
922
|
+
* name="plan"
|
|
923
|
+
* value="pro"
|
|
924
|
+
* checked={plan === 'pro'}
|
|
925
|
+
* onChange={(e) => setPlan(e.target.value)}
|
|
926
|
+
* label="Pro Plan"
|
|
927
|
+
* description="$29/month - Advanced features included"
|
|
928
|
+
* />
|
|
929
|
+
*
|
|
930
|
+
* // With error state
|
|
931
|
+
* <Radio
|
|
932
|
+
* name="payment"
|
|
933
|
+
* value="card"
|
|
934
|
+
* checked={payment === 'card'}
|
|
935
|
+
* onChange={(e) => setPayment(e.target.value)}
|
|
936
|
+
* label="Credit Card"
|
|
937
|
+
* invalid={!payment && submitted}
|
|
938
|
+
* />
|
|
939
|
+
*
|
|
940
|
+
* // Use RadioGroup for managing multiple radios
|
|
941
|
+
* <RadioGroup value={size} onChange={setSize}>
|
|
942
|
+
* <Radio value="small" label="Small" />
|
|
943
|
+
* <Radio value="medium" label="Medium" />
|
|
944
|
+
* <Radio value="large" label="Large" />
|
|
945
|
+
* </RadioGroup>
|
|
946
|
+
* ```
|
|
947
|
+
*/
|
|
948
|
+
declare const Radio: react.ForwardRefExoticComponent<RadioProps & react.RefAttributes<HTMLInputElement>>;
|
|
949
|
+
|
|
950
|
+
interface RadioGroupOption<T extends string = string> {
|
|
951
|
+
value: T;
|
|
952
|
+
label: React.ReactNode;
|
|
953
|
+
description?: React.ReactNode;
|
|
954
|
+
disabled?: boolean;
|
|
955
|
+
invalid?: boolean;
|
|
956
|
+
id?: string;
|
|
957
|
+
}
|
|
958
|
+
type BaseFieldSetProps = Omit<React.HTMLAttributes<HTMLFieldSetElement>, "onChange">;
|
|
959
|
+
interface RadioGroupProps<T extends string = string> extends BaseFieldSetProps {
|
|
960
|
+
/** Accessible legend/title for the group */
|
|
961
|
+
legend: React.ReactNode;
|
|
962
|
+
/** Shared name assigned to all radios in this group */
|
|
963
|
+
name: string;
|
|
964
|
+
/** Layout direction */
|
|
965
|
+
orientation?: Orientation;
|
|
966
|
+
/** Radio options list */
|
|
967
|
+
options: RadioGroupOption<T>[];
|
|
968
|
+
/** Controlled value */
|
|
969
|
+
value?: T;
|
|
970
|
+
/** Uncontrolled default value */
|
|
971
|
+
defaultValue?: T;
|
|
972
|
+
/** Change handler (receives next value) */
|
|
973
|
+
onChange?: (next: T) => void;
|
|
974
|
+
/** Marks group invalid; individual option invalids override per item */
|
|
975
|
+
invalid?: boolean;
|
|
976
|
+
/** Description for the group for SR users */
|
|
977
|
+
description?: React.ReactNode;
|
|
978
|
+
/** ID for description element, auto if omitted */
|
|
979
|
+
descriptionId?: string;
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* - Fieldset wrapper managing a group of radios with description and orientation.
|
|
983
|
+
* - Supports controlled and uncontrolled selection.
|
|
984
|
+
*/
|
|
985
|
+
declare const RadioGroup: react.ForwardRefExoticComponent<RadioGroupProps<string> & react.RefAttributes<HTMLFieldSetElement>>;
|
|
986
|
+
|
|
987
|
+
declare const selectVariants: (props?: ({
|
|
988
|
+
variant?: "error" | "default" | null | undefined;
|
|
989
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
990
|
+
type SelectVariant = VariantProps<typeof selectVariants>["variant"];
|
|
991
|
+
interface SelectOption {
|
|
992
|
+
value: string;
|
|
993
|
+
label: string;
|
|
994
|
+
disabled?: boolean;
|
|
995
|
+
}
|
|
996
|
+
type SelectBaseProps = Omit<React.SelectHTMLAttributes<HTMLSelectElement>, "size" | "required" | "multiple" | "onChange">;
|
|
997
|
+
interface SelectProps extends SelectBaseProps {
|
|
998
|
+
variant?: SelectVariant;
|
|
999
|
+
label?: string;
|
|
1000
|
+
error?: string;
|
|
1001
|
+
helperText?: string;
|
|
1002
|
+
required?: boolean;
|
|
1003
|
+
disabled?: boolean;
|
|
1004
|
+
placeholder?: string;
|
|
1005
|
+
options: SelectOption[];
|
|
1006
|
+
value?: string | string[];
|
|
1007
|
+
multiple?: boolean;
|
|
1008
|
+
native?: boolean;
|
|
1009
|
+
onChange?: (value: string | string[]) => void;
|
|
1010
|
+
containerClassName?: string;
|
|
1011
|
+
renderOption?: (option: SelectOption) => React.ReactNode;
|
|
1012
|
+
searchable?: boolean;
|
|
1013
|
+
onSearch?: (searchTerm: string) => void;
|
|
1014
|
+
clearable?: boolean;
|
|
1015
|
+
maxHeight?: number;
|
|
1016
|
+
renderValue?: (props: {
|
|
1017
|
+
selectedValue: string | string[];
|
|
1018
|
+
selectedOption: SelectOption | null;
|
|
1019
|
+
options: SelectOption[];
|
|
1020
|
+
multiple: boolean;
|
|
1021
|
+
placeholder?: string;
|
|
1022
|
+
}) => React.ReactNode;
|
|
1023
|
+
renderDropdown?: (props: {
|
|
1024
|
+
isOpen: boolean;
|
|
1025
|
+
selectId: string;
|
|
1026
|
+
searchable: boolean;
|
|
1027
|
+
searchTerm: string;
|
|
1028
|
+
searchInputRef: React.RefObject<HTMLInputElement>;
|
|
1029
|
+
onSearchChange: (searchTerm: string) => void;
|
|
1030
|
+
filteredOptions: SelectOption[];
|
|
1031
|
+
selectedValue: string | string[];
|
|
1032
|
+
multiple: boolean;
|
|
1033
|
+
optionRefs: React.MutableRefObject<Array<HTMLButtonElement | null>>;
|
|
1034
|
+
onOptionChange: (value: string) => void;
|
|
1035
|
+
onKeyDown: (e: React.KeyboardEvent) => void;
|
|
1036
|
+
renderOption?: (option: SelectOption) => React.ReactNode;
|
|
1037
|
+
maxHeight: number;
|
|
1038
|
+
}) => React.ReactNode;
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* Select - A versatile form select component with native and custom dropdown modes.
|
|
1042
|
+
*
|
|
1043
|
+
* Features:
|
|
1044
|
+
* - Native HTML select or custom dropdown UI
|
|
1045
|
+
* - Single and multi-select support
|
|
1046
|
+
* - Searchable options (client-side or API-driven)
|
|
1047
|
+
* - Clearable selections
|
|
1048
|
+
* - Custom option rendering
|
|
1049
|
+
* - Validation states (error, helper text)
|
|
1050
|
+
* - Full keyboard navigation and accessibility
|
|
1051
|
+
*
|
|
1052
|
+
* Customization:
|
|
1053
|
+
* - `renderValue`: Override the display of the selected value(s) in the button
|
|
1054
|
+
* - `renderDropdown`: Override the entire dropdown menu rendering
|
|
1055
|
+
* - `renderOption`: Customize individual option rendering
|
|
1056
|
+
*
|
|
1057
|
+
* @example
|
|
1058
|
+
* ```tsx
|
|
1059
|
+
* // Basic usage
|
|
1060
|
+
* <Select
|
|
1061
|
+
* options={[{ value: "1", label: "Option 1" }]}
|
|
1062
|
+
* value={value}
|
|
1063
|
+
* onChange={setValue}
|
|
1064
|
+
* />
|
|
1065
|
+
*
|
|
1066
|
+
* // Custom value display
|
|
1067
|
+
* <Select
|
|
1068
|
+
* options={options}
|
|
1069
|
+
* value={value}
|
|
1070
|
+
* onChange={setValue}
|
|
1071
|
+
* renderValue={({ selectedOption }) => (
|
|
1072
|
+
* <span className="sui-font-bold">{selectedOption?.label}</span>
|
|
1073
|
+
* )}
|
|
1074
|
+
* />
|
|
1075
|
+
*
|
|
1076
|
+
* // Custom dropdown
|
|
1077
|
+
* <Select
|
|
1078
|
+
* options={options}
|
|
1079
|
+
* value={value}
|
|
1080
|
+
* onChange={setValue}
|
|
1081
|
+
* renderDropdown={({ isOpen, filteredOptions, onOptionChange }) => (
|
|
1082
|
+
* // Your custom dropdown JSX
|
|
1083
|
+
* )}
|
|
1084
|
+
* />
|
|
1085
|
+
* ```
|
|
1086
|
+
*/
|
|
1087
|
+
declare const Select: react.ForwardRefExoticComponent<SelectProps & react.RefAttributes<HTMLButtonElement | HTMLSelectElement>>;
|
|
1088
|
+
|
|
1089
|
+
type TabsProps = {
|
|
1090
|
+
className?: string;
|
|
1091
|
+
value?: string;
|
|
1092
|
+
defaultValue?: string;
|
|
1093
|
+
onValueChange?: (v: string) => void;
|
|
1094
|
+
children: React.ReactNode;
|
|
1095
|
+
};
|
|
1096
|
+
/**
|
|
1097
|
+
* Tabs - An accessible tabs system with animated indicator and keyboard navigation.
|
|
1098
|
+
*
|
|
1099
|
+
* Features:
|
|
1100
|
+
* - Compound component pattern (Tabs, TabsList, TabsTrigger, TabsContent)
|
|
1101
|
+
* - Animated indicator following active tab
|
|
1102
|
+
* - Roving tabindex for keyboard navigation (Arrow keys)
|
|
1103
|
+
* - Controlled or uncontrolled modes
|
|
1104
|
+
* - Responsive and mobile-friendly
|
|
1105
|
+
* - Full ARIA support for screen readers
|
|
1106
|
+
* - Dense mode for compact UIs
|
|
1107
|
+
*
|
|
1108
|
+
* Components:
|
|
1109
|
+
* - `Tabs`: Root container with state management
|
|
1110
|
+
* - `TabsList`: Container for tab triggers with animated indicator
|
|
1111
|
+
* - `TabsTrigger`: Individual tab button
|
|
1112
|
+
* - `TabsContent`: Content panel for each tab
|
|
1113
|
+
*
|
|
1114
|
+
* @example
|
|
1115
|
+
* ```tsx
|
|
1116
|
+
* // Basic usage
|
|
1117
|
+
* <Tabs defaultValue="tab1">
|
|
1118
|
+
* <TabsList>
|
|
1119
|
+
* <TabsTrigger value="tab1">Overview</TabsTrigger>
|
|
1120
|
+
* <TabsTrigger value="tab2">Details</TabsTrigger>
|
|
1121
|
+
* <TabsTrigger value="tab3">Settings</TabsTrigger>
|
|
1122
|
+
* </TabsList>
|
|
1123
|
+
* <TabsContent value="tab1">
|
|
1124
|
+
* <h2>Overview Content</h2>
|
|
1125
|
+
* </TabsContent>
|
|
1126
|
+
* <TabsContent value="tab2">
|
|
1127
|
+
* <h2>Details Content</h2>
|
|
1128
|
+
* </TabsContent>
|
|
1129
|
+
* <TabsContent value="tab3">
|
|
1130
|
+
* <h2>Settings Content</h2>
|
|
1131
|
+
* </TabsContent>
|
|
1132
|
+
* </Tabs>
|
|
1133
|
+
*
|
|
1134
|
+
* // Controlled mode
|
|
1135
|
+
* <Tabs value={activeTab} onValueChange={setActiveTab}>
|
|
1136
|
+
* <TabsList>
|
|
1137
|
+
* <TabsTrigger value="profile">Profile</TabsTrigger>
|
|
1138
|
+
* <TabsTrigger value="billing">Billing</TabsTrigger>
|
|
1139
|
+
* </TabsList>
|
|
1140
|
+
* <TabsContent value="profile">Profile form...</TabsContent>
|
|
1141
|
+
* <TabsContent value="billing">Billing info...</TabsContent>
|
|
1142
|
+
* </Tabs>
|
|
1143
|
+
*
|
|
1144
|
+
* // Dense mode (compact UI)
|
|
1145
|
+
* <Tabs defaultValue="tab1">
|
|
1146
|
+
* <TabsList dense>
|
|
1147
|
+
* <TabsTrigger value="tab1">Tab 1</TabsTrigger>
|
|
1148
|
+
* <TabsTrigger value="tab2">Tab 2</TabsTrigger>
|
|
1149
|
+
* </TabsList>
|
|
1150
|
+
* <TabsContent value="tab1">Content 1</TabsContent>
|
|
1151
|
+
* <TabsContent value="tab2">Content 2</TabsContent>
|
|
1152
|
+
* </Tabs>
|
|
1153
|
+
* ```
|
|
1154
|
+
*/
|
|
1155
|
+
declare const Tabs: {
|
|
1156
|
+
({ className, value, defaultValue, onValueChange, children, }: TabsProps): react_jsx_runtime.JSX.Element;
|
|
1157
|
+
displayName: string;
|
|
1158
|
+
};
|
|
1159
|
+
type TabsListProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
1160
|
+
/** When true, reduce horizontal padding for compact UIs */
|
|
1161
|
+
dense?: boolean;
|
|
1162
|
+
};
|
|
1163
|
+
declare const TabsList: {
|
|
1164
|
+
({ className, dense, ...props }: TabsListProps): react_jsx_runtime.JSX.Element;
|
|
1165
|
+
displayName: string;
|
|
1166
|
+
};
|
|
1167
|
+
type TabsTriggerProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onChange"> & {
|
|
1168
|
+
value: string;
|
|
1169
|
+
/** Optional icon displayed to the left of the label */
|
|
1170
|
+
icon?: React.ReactNode;
|
|
1171
|
+
};
|
|
1172
|
+
declare const TabsTrigger: react.ForwardRefExoticComponent<Omit<react.ButtonHTMLAttributes<HTMLButtonElement>, "onChange"> & {
|
|
1173
|
+
value: string;
|
|
1174
|
+
/** Optional icon displayed to the left of the label */
|
|
1175
|
+
icon?: React.ReactNode;
|
|
1176
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
1177
|
+
type TabsContentProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
1178
|
+
value: string;
|
|
1179
|
+
/** Keep content mounted when inactive (hidden). Useful to preserve state. */
|
|
1180
|
+
forceMount?: boolean;
|
|
1181
|
+
};
|
|
1182
|
+
declare const TabsContent: {
|
|
1183
|
+
({ className, value, children, forceMount, ...props }: TabsContentProps): react_jsx_runtime.JSX.Element | null;
|
|
1184
|
+
displayName: string;
|
|
1185
|
+
};
|
|
1186
|
+
|
|
1187
|
+
interface TimePickerProps {
|
|
1188
|
+
value: Date | null;
|
|
1189
|
+
onChange: (d: Date) => void;
|
|
1190
|
+
minuteStep?: number;
|
|
1191
|
+
hoursLabel?: string;
|
|
1192
|
+
minutesLabel?: string;
|
|
1193
|
+
className?: string;
|
|
1194
|
+
placeholder?: string;
|
|
1195
|
+
/** Custom format function for displaying time */
|
|
1196
|
+
formatTime?: (date: Date) => string;
|
|
1197
|
+
/** Custom render function for the trigger button */
|
|
1198
|
+
renderTrigger?: (props: {
|
|
1199
|
+
value: Date | null;
|
|
1200
|
+
formattedTime: string;
|
|
1201
|
+
onClick: () => void;
|
|
1202
|
+
open: boolean;
|
|
1203
|
+
disabled: boolean;
|
|
1204
|
+
}) => React.ReactNode;
|
|
1205
|
+
/** Custom render function for hour options */
|
|
1206
|
+
renderHourOption?: (hour: number, isSelected: boolean) => React.ReactNode;
|
|
1207
|
+
/** Custom render function for minute options */
|
|
1208
|
+
renderMinuteOption?: (minute: number, isSelected: boolean) => React.ReactNode;
|
|
1209
|
+
/** Custom render function for the entire spinner */
|
|
1210
|
+
renderSpinner?: (props: {
|
|
1211
|
+
value: Date;
|
|
1212
|
+
onChange: (d: Date) => void;
|
|
1213
|
+
minuteStep: number;
|
|
1214
|
+
hoursLabel: string;
|
|
1215
|
+
minutesLabel: string;
|
|
1216
|
+
}) => React.ReactNode;
|
|
1217
|
+
}
|
|
1218
|
+
/**
|
|
1219
|
+
* TimePicker - A time selection component with hour/minute spinners.
|
|
1220
|
+
*
|
|
1221
|
+
* Features:
|
|
1222
|
+
* - Hour and minute selection with customizable step
|
|
1223
|
+
* - Dropdown with scrollable spinners
|
|
1224
|
+
* - Keyboard navigation (Escape to close)
|
|
1225
|
+
* - Click-outside to close
|
|
1226
|
+
* - Fully customizable trigger, options, and spinner
|
|
1227
|
+
* - Auto-scroll to selected time
|
|
1228
|
+
*
|
|
1229
|
+
* Customization:
|
|
1230
|
+
* - `formatTime`: Custom time formatting
|
|
1231
|
+
* - `renderTrigger`: Complete trigger customization
|
|
1232
|
+
* - `renderHourOption`/`renderMinuteOption`: Custom option rendering
|
|
1233
|
+
* - `renderSpinner`: Complete spinner customization
|
|
1234
|
+
*
|
|
1235
|
+
* @example
|
|
1236
|
+
* ```tsx
|
|
1237
|
+
* // Basic usage
|
|
1238
|
+
* <TimePicker
|
|
1239
|
+
* value={time}
|
|
1240
|
+
* onChange={setTime}
|
|
1241
|
+
* minuteStep={15}
|
|
1242
|
+
* />
|
|
1243
|
+
*
|
|
1244
|
+
* // Custom format
|
|
1245
|
+
* <TimePicker
|
|
1246
|
+
* value={time}
|
|
1247
|
+
* onChange={setTime}
|
|
1248
|
+
* formatTime={(date) => date.toLocaleTimeString('en-US', {
|
|
1249
|
+
* hour: '2-digit',
|
|
1250
|
+
* minute: '2-digit',
|
|
1251
|
+
* hour12: true
|
|
1252
|
+
* })}
|
|
1253
|
+
* />
|
|
1254
|
+
*
|
|
1255
|
+
* // Custom trigger
|
|
1256
|
+
* <TimePicker
|
|
1257
|
+
* value={time}
|
|
1258
|
+
* onChange={setTime}
|
|
1259
|
+
* renderTrigger={({ formattedTime, onClick, open }) => (
|
|
1260
|
+
* <button onClick={onClick} className="custom-trigger">
|
|
1261
|
+
* 🕐 {formattedTime || 'Pick time'}
|
|
1262
|
+
* </button>
|
|
1263
|
+
* )}
|
|
1264
|
+
* />
|
|
1265
|
+
*
|
|
1266
|
+
* // Custom option rendering
|
|
1267
|
+
* <TimePicker
|
|
1268
|
+
* value={time}
|
|
1269
|
+
* onChange={setTime}
|
|
1270
|
+
* renderHourOption={(hour, isSelected) => (
|
|
1271
|
+
* <span className={isSelected ? 'selected' : ''}>
|
|
1272
|
+
* {hour === 0 ? '12 AM' : hour < 12 ? `${hour} AM` : hour === 12 ? '12 PM' : `${hour - 12} PM`}
|
|
1273
|
+
* </span>
|
|
1274
|
+
* )}
|
|
1275
|
+
* />
|
|
1276
|
+
* ```
|
|
1277
|
+
*/
|
|
1278
|
+
declare const TimePicker: react.ForwardRefExoticComponent<TimePickerProps & react.RefAttributes<HTMLDivElement>>;
|
|
1279
|
+
|
|
1280
|
+
type ToastStatus = "success" | "info" | "warn" | "error";
|
|
1281
|
+
interface ToastAction {
|
|
1282
|
+
label: string;
|
|
1283
|
+
onClick: () => void;
|
|
1284
|
+
variant?: React.ComponentProps<typeof Button>["variant"];
|
|
1285
|
+
}
|
|
1286
|
+
interface ToastProps {
|
|
1287
|
+
status: ToastStatus;
|
|
1288
|
+
title: string;
|
|
1289
|
+
message?: string;
|
|
1290
|
+
className?: string;
|
|
1291
|
+
actions?: ToastAction[];
|
|
1292
|
+
onClose?: () => void;
|
|
1293
|
+
autoCloseMs?: number;
|
|
1294
|
+
showProgress?: boolean;
|
|
1295
|
+
/** Custom icon for this toast (overrides status icon) */
|
|
1296
|
+
customIcon?: React.ReactNode;
|
|
1297
|
+
/** Custom render function for the icon */
|
|
1298
|
+
renderIcon?: (status: ToastStatus) => React.ReactNode;
|
|
1299
|
+
/** Custom render function for the close button */
|
|
1300
|
+
renderCloseButton?: (props: {
|
|
1301
|
+
onClick: () => void;
|
|
1302
|
+
}) => React.ReactNode;
|
|
1303
|
+
/** Custom render function for the progress bar */
|
|
1304
|
+
renderProgress?: (progress: number, status: ToastStatus) => React.ReactNode;
|
|
1305
|
+
/** Hide the close button */
|
|
1306
|
+
hideCloseButton?: boolean;
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* Toast - A status notification component with auto-dismiss and action buttons.
|
|
1310
|
+
*
|
|
1311
|
+
* Features:
|
|
1312
|
+
* - Multiple status types: success, info, warn, error
|
|
1313
|
+
* - Auto-dismiss with configurable timeout
|
|
1314
|
+
* - Visual progress bar showing remaining time
|
|
1315
|
+
* - Pauses on hover/focus for better UX
|
|
1316
|
+
* - Optional action buttons
|
|
1317
|
+
* - Manual close button
|
|
1318
|
+
* - ARIA live region for screen reader announcements
|
|
1319
|
+
* - Smooth animations
|
|
1320
|
+
* - Fully customizable icons, close button, and progress bar
|
|
1321
|
+
*
|
|
1322
|
+
* Customization:
|
|
1323
|
+
* - `customIcon`: Replace the default status icon
|
|
1324
|
+
* - `renderIcon`: Full control over icon rendering
|
|
1325
|
+
* - `renderCloseButton`: Custom close button
|
|
1326
|
+
* - `renderProgress`: Custom progress bar
|
|
1327
|
+
* - `hideCloseButton`: Hide the close button
|
|
1328
|
+
*
|
|
1329
|
+
* @example
|
|
1330
|
+
* ```tsx
|
|
1331
|
+
* // Basic success toast
|
|
1332
|
+
* <Toast
|
|
1333
|
+
* status="success"
|
|
1334
|
+
* title="Success"
|
|
1335
|
+
* message="Your changes have been saved"
|
|
1336
|
+
* onClose={() => console.log('Toast closed')}
|
|
1337
|
+
* />
|
|
1338
|
+
*
|
|
1339
|
+
* // Custom icon
|
|
1340
|
+
* <Toast
|
|
1341
|
+
* status="info"
|
|
1342
|
+
* title="New Feature"
|
|
1343
|
+
* customIcon={<SparklesIcon />}
|
|
1344
|
+
* onClose={handleClose}
|
|
1345
|
+
* />
|
|
1346
|
+
*
|
|
1347
|
+
* // Custom close button
|
|
1348
|
+
* <Toast
|
|
1349
|
+
* status="warn"
|
|
1350
|
+
* title="Warning"
|
|
1351
|
+
* renderCloseButton={({ onClick }) => (
|
|
1352
|
+
* <button onClick={onClick} className="custom-close">×</button>
|
|
1353
|
+
* )}
|
|
1354
|
+
* />
|
|
1355
|
+
*
|
|
1356
|
+
* // Custom progress bar
|
|
1357
|
+
* <Toast
|
|
1358
|
+
* status="success"
|
|
1359
|
+
* title="Uploading..."
|
|
1360
|
+
* renderProgress={(progress, status) => (
|
|
1361
|
+
* <div className="custom-progress">
|
|
1362
|
+
* {Math.round(progress)}%
|
|
1363
|
+
* </div>
|
|
1364
|
+
* )}
|
|
1365
|
+
* />
|
|
1366
|
+
*
|
|
1367
|
+
* // Error toast with action
|
|
1368
|
+
* <Toast
|
|
1369
|
+
* status="error"
|
|
1370
|
+
* title="Upload Failed"
|
|
1371
|
+
* message="Unable to upload file. Please try again."
|
|
1372
|
+
* actions={[
|
|
1373
|
+
* { label: 'Retry', onClick: handleRetry, variant: 'default' },
|
|
1374
|
+
* { label: 'Dismiss', onClick: handleClose, variant: 'text' }
|
|
1375
|
+
* ]}
|
|
1376
|
+
* onClose={handleClose}
|
|
1377
|
+
* />
|
|
1378
|
+
* ```
|
|
1379
|
+
*/
|
|
1380
|
+
declare const Toast: React.FC<ToastProps>;
|
|
1381
|
+
|
|
1382
|
+
type ToastPosition = "top-left" | "top-right" | "top-center" | "bottom-left" | "bottom-right" | "bottom-center";
|
|
1383
|
+
interface ToastContainerProps {
|
|
1384
|
+
position?: ToastPosition;
|
|
1385
|
+
className?: string;
|
|
1386
|
+
children?: React.ReactNode;
|
|
1387
|
+
width?: number | string;
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* - Fixed-position portal region to stack toasts at screen edges.
|
|
1391
|
+
* - Click-through outer wrapper with pointer-enabled children.
|
|
1392
|
+
*/
|
|
1393
|
+
declare const ToastContainer: React.FC<ToastContainerProps>;
|
|
1394
|
+
|
|
1395
|
+
type TooltipSide = "top" | "bottom" | "left" | "right" | "auto";
|
|
1396
|
+
type TooltipAlign = "center" | "start" | "end";
|
|
1397
|
+
type TooltipProps = {
|
|
1398
|
+
children?: React.ReactElement;
|
|
1399
|
+
content: React.ReactNode;
|
|
1400
|
+
className?: string;
|
|
1401
|
+
containerClassName?: string;
|
|
1402
|
+
side?: TooltipSide;
|
|
1403
|
+
align?: TooltipAlign;
|
|
1404
|
+
open?: boolean;
|
|
1405
|
+
defaultOpen?: boolean;
|
|
1406
|
+
disabled?: boolean;
|
|
1407
|
+
delayMs?: number;
|
|
1408
|
+
id?: string;
|
|
1409
|
+
withBackdrop?: boolean;
|
|
1410
|
+
portal?: boolean;
|
|
1411
|
+
/** Show or hide the arrow */
|
|
1412
|
+
showArrow?: boolean;
|
|
1413
|
+
/** Custom arrow element */
|
|
1414
|
+
renderArrow?: () => React.ReactNode;
|
|
1415
|
+
/** Custom class for the arrow */
|
|
1416
|
+
arrowClassName?: string;
|
|
1417
|
+
};
|
|
1418
|
+
/**
|
|
1419
|
+
* Tooltip - A lightweight, accessible tooltip with smart positioning.
|
|
1420
|
+
*
|
|
1421
|
+
* Features:
|
|
1422
|
+
* - Smart positioning using Floating UI (auto-adjusts to viewport)
|
|
1423
|
+
* - Multiple placement options (top, bottom, left, right, auto)
|
|
1424
|
+
* - Alignment control (center, start, end)
|
|
1425
|
+
* - Controlled or uncontrolled modes
|
|
1426
|
+
* - Configurable delay before showing
|
|
1427
|
+
* - Optional backdrop overlay
|
|
1428
|
+
* - Portal rendering for z-index management
|
|
1429
|
+
* - Customizable arrow indicator
|
|
1430
|
+
* - ARIA compliant (aria-describedby)
|
|
1431
|
+
* - Mouse and keyboard support
|
|
1432
|
+
*
|
|
1433
|
+
* Customization:
|
|
1434
|
+
* - `showArrow`: Show or hide the arrow
|
|
1435
|
+
* - `renderArrow`: Custom arrow rendering
|
|
1436
|
+
* - `arrowClassName`: Custom arrow styling
|
|
1437
|
+
*
|
|
1438
|
+
* @example
|
|
1439
|
+
* ```tsx
|
|
1440
|
+
* // Basic usage
|
|
1441
|
+
* <Tooltip content="This is a helpful tooltip">
|
|
1442
|
+
* <Button>Hover me</Button>
|
|
1443
|
+
* </Tooltip>
|
|
1444
|
+
*
|
|
1445
|
+
* // With custom positioning
|
|
1446
|
+
* <Tooltip
|
|
1447
|
+
* content="Positioned on the right side"
|
|
1448
|
+
* side="right"
|
|
1449
|
+
* align="start"
|
|
1450
|
+
* >
|
|
1451
|
+
* <span>Hover for info</span>
|
|
1452
|
+
* </Tooltip>
|
|
1453
|
+
*
|
|
1454
|
+
* // Without arrow
|
|
1455
|
+
* <Tooltip
|
|
1456
|
+
* content="No arrow tooltip"
|
|
1457
|
+
* showArrow={false}
|
|
1458
|
+
* >
|
|
1459
|
+
* <Button>Hover me</Button>
|
|
1460
|
+
* </Tooltip>
|
|
1461
|
+
*
|
|
1462
|
+
* // Custom arrow styling
|
|
1463
|
+
* <Tooltip
|
|
1464
|
+
* content="Custom arrow"
|
|
1465
|
+
* arrowClassName="sui-bg-blue-500"
|
|
1466
|
+
* >
|
|
1467
|
+
* <Button>Hover me</Button>
|
|
1468
|
+
* </Tooltip>
|
|
1469
|
+
*
|
|
1470
|
+
* // Custom arrow render
|
|
1471
|
+
* <Tooltip
|
|
1472
|
+
* content="Custom arrow element"
|
|
1473
|
+
* renderArrow={() => (
|
|
1474
|
+
* <div className="custom-arrow">▼</div>
|
|
1475
|
+
* )}
|
|
1476
|
+
* >
|
|
1477
|
+
* <Button>Hover me</Button>
|
|
1478
|
+
* </Tooltip>
|
|
1479
|
+
*
|
|
1480
|
+
* // With backdrop and portal
|
|
1481
|
+
* <Tooltip
|
|
1482
|
+
* content="Important information"
|
|
1483
|
+
* withBackdrop
|
|
1484
|
+
* portal
|
|
1485
|
+
* delayMs={300}
|
|
1486
|
+
* >
|
|
1487
|
+
* <Button variant="outline">Show info</Button>
|
|
1488
|
+
* </Tooltip>
|
|
1489
|
+
* ```
|
|
1490
|
+
*/
|
|
1491
|
+
declare const Tooltip: React.FC<TooltipProps>;
|
|
1492
|
+
|
|
1493
|
+
type ViewMode = "grid" | "list";
|
|
1494
|
+
interface ViewToggleProps {
|
|
1495
|
+
value: ViewMode;
|
|
1496
|
+
onChange?: (value: ViewMode) => void;
|
|
1497
|
+
className?: string;
|
|
1498
|
+
"aria-label"?: string;
|
|
1499
|
+
/** Custom grid icon */
|
|
1500
|
+
gridIcon?: React.ReactNode;
|
|
1501
|
+
/** Custom list icon */
|
|
1502
|
+
listIcon?: React.ReactNode;
|
|
1503
|
+
/** Accessible label for grid option */
|
|
1504
|
+
gridLabel?: string;
|
|
1505
|
+
/** Accessible label for list option */
|
|
1506
|
+
listLabel?: string;
|
|
1507
|
+
/** Custom render function for individual options */
|
|
1508
|
+
renderOption?: (mode: ViewMode, props: {
|
|
1509
|
+
isActive: boolean;
|
|
1510
|
+
onClick: () => void;
|
|
1511
|
+
onKeyDown: (e: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
1512
|
+
ref: React.RefObject<HTMLDivElement>;
|
|
1513
|
+
ariaLabel: string;
|
|
1514
|
+
}) => React.ReactNode;
|
|
1515
|
+
}
|
|
1516
|
+
/**
|
|
1517
|
+
* ViewToggle - A compact switch for toggling between grid and list views.
|
|
1518
|
+
*
|
|
1519
|
+
* Features:
|
|
1520
|
+
* - Two-option toggle (grid/list)
|
|
1521
|
+
* - Keyboard navigation (Arrow keys)
|
|
1522
|
+
* - Fully accessible radio group
|
|
1523
|
+
* - Animated selection indicator
|
|
1524
|
+
* - Customizable icons and rendering
|
|
1525
|
+
*
|
|
1526
|
+
* Customization:
|
|
1527
|
+
* - `gridIcon`/`listIcon`: Replace default icons
|
|
1528
|
+
* - `gridLabel`/`listLabel`: Custom ARIA labels
|
|
1529
|
+
* - `renderOption`: Complete option customization
|
|
1530
|
+
*
|
|
1531
|
+
* @example
|
|
1532
|
+
* ```tsx
|
|
1533
|
+
* // Basic usage
|
|
1534
|
+
* <ViewToggle value={view} onChange={setView} />
|
|
1535
|
+
*
|
|
1536
|
+
* // Custom icons
|
|
1537
|
+
* <ViewToggle
|
|
1538
|
+
* value={view}
|
|
1539
|
+
* onChange={setView}
|
|
1540
|
+
* gridIcon={<CustomGridIcon />}
|
|
1541
|
+
* listIcon={<CustomListIcon />}
|
|
1542
|
+
* />
|
|
1543
|
+
*
|
|
1544
|
+
* // Custom labels
|
|
1545
|
+
* <ViewToggle
|
|
1546
|
+
* value={view}
|
|
1547
|
+
* onChange={setView}
|
|
1548
|
+
* gridLabel="Card view"
|
|
1549
|
+
* listLabel="Table view"
|
|
1550
|
+
* />
|
|
1551
|
+
*
|
|
1552
|
+
* // Fully custom rendering
|
|
1553
|
+
* <ViewToggle
|
|
1554
|
+
* value={view}
|
|
1555
|
+
* onChange={setView}
|
|
1556
|
+
* renderOption={(mode, { isActive, onClick, ariaLabel }) => (
|
|
1557
|
+
* <button
|
|
1558
|
+
* onClick={onClick}
|
|
1559
|
+
* aria-label={ariaLabel}
|
|
1560
|
+
* className={isActive ? 'active' : ''}
|
|
1561
|
+
* >
|
|
1562
|
+
* {mode === 'grid' ? '⊞' : '☰'} {mode}
|
|
1563
|
+
* </button>
|
|
1564
|
+
* )}
|
|
1565
|
+
* />
|
|
1566
|
+
* ```
|
|
1567
|
+
*/
|
|
1568
|
+
declare const ViewToggle: React.FC<ViewToggleProps>;
|
|
1569
|
+
|
|
1570
|
+
interface ScalablyUIProviderProps {
|
|
1571
|
+
children: React.ReactNode;
|
|
1572
|
+
className?: string;
|
|
1573
|
+
/**
|
|
1574
|
+
* When true, merges the scope class onto the single child instead of adding an extra wrapper div.
|
|
1575
|
+
*/
|
|
1576
|
+
asChild?: boolean;
|
|
1577
|
+
}
|
|
1578
|
+
/**
|
|
1579
|
+
* ScalablyUIProvider
|
|
1580
|
+
*
|
|
1581
|
+
* Adds the required `sui-scope` wrapper so prefixed Tailwind styles apply.
|
|
1582
|
+
*
|
|
1583
|
+
* Usage:
|
|
1584
|
+
* <ScalablyUIProvider>
|
|
1585
|
+
* <App />
|
|
1586
|
+
* </ScalablyUIProvider>
|
|
1587
|
+
*
|
|
1588
|
+
* Or to avoid an extra DOM node:
|
|
1589
|
+
* <ScalablyUIProvider asChild>
|
|
1590
|
+
* <main />
|
|
1591
|
+
* </ScalablyUIProvider>
|
|
1592
|
+
*/
|
|
1593
|
+
declare const ScalablyUIProvider: React.FC<ScalablyUIProviderProps>;
|
|
1594
|
+
|
|
1595
|
+
/**
|
|
1596
|
+
* Utility function to merge Tailwind CSS classes intelligently
|
|
1597
|
+
* Combines clsx for conditional classes and tailwind-merge for conflict resolution
|
|
1598
|
+
*
|
|
1599
|
+
* @param inputs - Class values to merge
|
|
1600
|
+
* @returns Merged class string
|
|
1601
|
+
*
|
|
1602
|
+
* @example
|
|
1603
|
+
* ```tsx
|
|
1604
|
+
* cn('sui-p-4', isActive && 'sui-bg-blue-500', 'sui-text-white')
|
|
1605
|
+
* // Returns: 'sui-p-4 sui-bg-blue-500 sui-text-white'
|
|
1606
|
+
* ```
|
|
1607
|
+
*/
|
|
1608
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
1609
|
+
/**
|
|
1610
|
+
* Creates a scoped class name with the UI prefix
|
|
1611
|
+
* Ensures all classes are properly prefixed for isolation
|
|
1612
|
+
*
|
|
1613
|
+
* @param className - The class name to scope
|
|
1614
|
+
* @returns Scoped class name
|
|
1615
|
+
*
|
|
1616
|
+
* @example
|
|
1617
|
+
* ```tsx
|
|
1618
|
+
* scopeClass('p-4 bg-blue-500') // Returns: 'ui-p-4 ui-bg-blue-500'
|
|
1619
|
+
* ```
|
|
1620
|
+
*/
|
|
1621
|
+
declare function scopeClass(className: string): string;
|
|
1622
|
+
/**
|
|
1623
|
+
* Debounce utility for performance optimization
|
|
1624
|
+
*
|
|
1625
|
+
* @param func - Function to debounce
|
|
1626
|
+
* @param wait - Wait time in milliseconds
|
|
1627
|
+
* @returns Debounced function
|
|
1628
|
+
*/
|
|
1629
|
+
declare function debounce<T extends (...args: unknown[]) => unknown>(func: T, wait: number): (...args: Parameters<T>) => void;
|
|
1630
|
+
/**
|
|
1631
|
+
* Throttle utility for performance optimization
|
|
1632
|
+
*
|
|
1633
|
+
* @param func - Function to throttle
|
|
1634
|
+
* @param limit - Time limit in milliseconds
|
|
1635
|
+
* @returns Throttled function
|
|
1636
|
+
*/
|
|
1637
|
+
declare function throttle<T extends (...args: unknown[]) => unknown>(func: T, limit: number): (...args: Parameters<T>) => void;
|
|
1638
|
+
|
|
1639
|
+
declare const clampDate: (d: Date, min?: Date, max?: Date) => Date;
|
|
1640
|
+
declare const toDateKey: (d: Date) => string;
|
|
1641
|
+
declare const daysGrid: (viewMonth: Date, localeCode?: string) => date_fns.EachDayOfIntervalResult<{
|
|
1642
|
+
start: Date;
|
|
1643
|
+
end: Date;
|
|
1644
|
+
}, undefined>;
|
|
1645
|
+
type DateLikeRange = {
|
|
1646
|
+
from: Date | null;
|
|
1647
|
+
to: Date | null;
|
|
1648
|
+
};
|
|
1649
|
+
declare const formatDateLocalized: (value: Date | DateLikeRange | null, opts?: {
|
|
1650
|
+
locale?: string | string[];
|
|
1651
|
+
includeTime?: boolean;
|
|
1652
|
+
}) => string;
|
|
1653
|
+
declare const monthsForLocale: (localeCode?: string) => string[];
|
|
1654
|
+
declare const weekdaysForLocale: (localeCode?: string) => string[];
|
|
1655
|
+
|
|
1656
|
+
type FieldErrorLike = {
|
|
1657
|
+
message?: string;
|
|
1658
|
+
} | undefined | null;
|
|
1659
|
+
declare const fieldErrorToProps: (error: FieldErrorLike) => {
|
|
1660
|
+
error?: string;
|
|
1661
|
+
};
|
|
1662
|
+
declare const zodErrorsToSummary: (errors: Record<string, FieldErrorLike>) => {
|
|
1663
|
+
id: string;
|
|
1664
|
+
message: string;
|
|
1665
|
+
}[];
|
|
1666
|
+
|
|
1667
|
+
export { BackToTop, type BackToTopProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Checkbox, CheckboxGroup, type CheckboxGroupOption, type CheckboxGroupProps, type CheckboxProps, DateInput, type DateInputMode, type DateInputProps, DatePicker, type DatePickerMode, type DatePickerProps, Divider, type DividerProps, type DividerVariant, type FieldErrorLike, FileUpload, type FileUploadError, type FileUploadFile, type FileUploadIconType, type FileUploadProps, type FileUploadSize, type FileUploadVariant, Form, type FormErrorItem, FormErrorSummary, type FormErrorSummaryProps, FormField, type FormFieldProps, type FormProps, Input, type InputProps, type InputVariant, MultipleSelectionButton, type MultipleSelectionButtonProps, Pagination, type PaginationProps, QuantityInput, type QuantityInputProps, Radio, RadioGroup, type RadioGroupOption, type RadioGroupProps, type RadioProps, type RangeValue, ScalablyUIProvider, type ScalablyUIProviderProps, SearchInput, type SearchInputProps, type SearchInputVariant, Select, type SelectOption, type SelectProps, type SelectVariant, StatusBadge, type StatusBadgeProps, type StatusBadgeSize, type StatusBadgeStatus, type StatusBadgeVariant, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsListProps, type TabsProps, TabsTrigger, type TabsTriggerProps, TimePicker, type TimePickerProps, Toast, type ToastAction, ToastContainer, type ToastContainerProps, type ToastPosition, type ToastProps, type ToastStatus, Tooltip, type TooltipAlign, type TooltipProps, type TooltipSide, type ViewMode, ViewToggle, type ViewToggleProps, clampDate, cn, daysGrid, debounce, fieldErrorToProps, formatDateLocalized, monthsForLocale, scopeClass, throttle, toDateKey, weekdaysForLocale, zodErrorsToSummary };
|