@dimaan/ui 0.0.9 → 0.0.11
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.cjs +732 -195
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +660 -163
- package/dist/index.d.ts +660 -163
- package/dist/index.js +681 -198
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { HTMLAttributes, ReactNode, ReactElement, ButtonHTMLAttributes, InputHTMLAttributes, ChangeEvent,
|
|
3
|
+
import { HTMLAttributes, ReactNode, ReactElement, ButtonHTMLAttributes, InputHTMLAttributes, ChangeEvent, ComponentPropsWithoutRef, FieldsetHTMLAttributes, Ref, AnchorHTMLAttributes, TextareaHTMLAttributes } from 'react';
|
|
4
|
+
import * as RadixDropdown from '@radix-ui/react-dropdown-menu';
|
|
4
5
|
import { FieldValues, FieldPath, Control } from 'react-hook-form';
|
|
6
|
+
import * as RadixRadioGroup from '@radix-ui/react-radio-group';
|
|
5
7
|
import { ClassValue } from 'clsx';
|
|
6
8
|
|
|
7
9
|
interface DashboardLayoutContextValue {
|
|
@@ -131,6 +133,43 @@ interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
131
133
|
}
|
|
132
134
|
declare function Avatar({ src, alt, fallback, size, className, ...props }: AvatarProps): react_jsx_runtime.JSX.Element;
|
|
133
135
|
|
|
136
|
+
type BadgeVariant = 'default' | 'primary' | 'success' | 'warning' | 'destructive' | 'outline';
|
|
137
|
+
type BadgeSize = 'sm' | 'md';
|
|
138
|
+
declare const badgeVariantClass: Record<BadgeVariant, string>;
|
|
139
|
+
declare const badgeSizeClass: Record<BadgeSize, string>;
|
|
140
|
+
/** The dot-indicator size for each badge size. */
|
|
141
|
+
declare const badgeDotSizeClass: Record<BadgeSize, string>;
|
|
142
|
+
declare const badgeBaseClass = "inline-flex shrink-0 items-center rounded-full border font-medium leading-none whitespace-nowrap select-none transition-colors";
|
|
143
|
+
|
|
144
|
+
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
145
|
+
variant?: BadgeVariant;
|
|
146
|
+
size?: BadgeSize;
|
|
147
|
+
/** Render a small dot before the label (useful for online/status indicators). */
|
|
148
|
+
dot?: boolean;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Inline status pill. Most common use: status column in a table (Active /
|
|
152
|
+
* Pending / Archived), category labels, or counts in nav items.
|
|
153
|
+
*
|
|
154
|
+
* @example Status pill in a table cell
|
|
155
|
+
* ```tsx
|
|
156
|
+
* <Badge variant="success">Active</Badge>
|
|
157
|
+
* <Badge variant="warning">Pending</Badge>
|
|
158
|
+
* <Badge variant="default">Archived</Badge>
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
* @example With status dot
|
|
162
|
+
* ```tsx
|
|
163
|
+
* <Badge variant="success" dot>Online</Badge>
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
166
|
+
* @example Outline (border-only, no fill)
|
|
167
|
+
* ```tsx
|
|
168
|
+
* <Badge variant="outline">Beta</Badge>
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
declare const Badge: react.ForwardRefExoticComponent<BadgeProps & react.RefAttributes<HTMLSpanElement>>;
|
|
172
|
+
|
|
134
173
|
type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive' | 'success' | 'warning' | 'link';
|
|
135
174
|
type ButtonSize = 'sm' | 'md' | 'lg' | 'icon' | 'icon-sm';
|
|
136
175
|
declare const buttonVariantClass: Record<ButtonVariant, string>;
|
|
@@ -193,6 +232,153 @@ interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'typ
|
|
|
193
232
|
}
|
|
194
233
|
declare const Checkbox: react.ForwardRefExoticComponent<CheckboxProps & react.RefAttributes<HTMLInputElement>>;
|
|
195
234
|
|
|
235
|
+
type DropdownMenuItemVariant = 'default' | 'destructive';
|
|
236
|
+
declare const dropdownMenuContentClass = "z-50 min-w-32 overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95";
|
|
237
|
+
declare const dropdownMenuItemBaseClass = "relative flex w-full cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0";
|
|
238
|
+
declare const dropdownMenuItemVariantClass: Record<DropdownMenuItemVariant, string>;
|
|
239
|
+
/** Indent items without an icon so they align with items that have one. */
|
|
240
|
+
declare const dropdownMenuItemInsetClass = "ps-8";
|
|
241
|
+
declare const dropdownMenuSeparatorClass = "-mx-1 my-1 h-px bg-border";
|
|
242
|
+
declare const dropdownMenuLabelClass = "px-2 py-1.5 text-xs font-semibold text-muted-foreground select-none";
|
|
243
|
+
declare const dropdownMenuShortcutClass = "ms-auto text-xs tracking-widest text-muted-foreground";
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Compound dropdown menu built on `@radix-ui/react-dropdown-menu`. Use for
|
|
247
|
+
* row actions (⋯ menu in tables), header overflow menus, user avatar menus.
|
|
248
|
+
*
|
|
249
|
+
* @example Row actions in a table
|
|
250
|
+
* ```tsx
|
|
251
|
+
* <DropdownMenu>
|
|
252
|
+
* <DropdownMenuTrigger asChild>
|
|
253
|
+
* <Button variant="ghost" size="icon" aria-label="More actions">
|
|
254
|
+
* <MoreHorizontal />
|
|
255
|
+
* </Button>
|
|
256
|
+
* </DropdownMenuTrigger>
|
|
257
|
+
* <DropdownMenuContent align="end">
|
|
258
|
+
* <DropdownMenuItem onSelect={() => edit(row)}>
|
|
259
|
+
* <Pencil />
|
|
260
|
+
* Edit
|
|
261
|
+
* </DropdownMenuItem>
|
|
262
|
+
* <DropdownMenuItem onSelect={() => archive(row)}>
|
|
263
|
+
* <Archive />
|
|
264
|
+
* Archive
|
|
265
|
+
* </DropdownMenuItem>
|
|
266
|
+
* <DropdownMenuSeparator />
|
|
267
|
+
* <DropdownMenuItem variant="destructive" onSelect={() => del(row)}>
|
|
268
|
+
* <Trash2 />
|
|
269
|
+
* Delete
|
|
270
|
+
* </DropdownMenuItem>
|
|
271
|
+
* </DropdownMenuContent>
|
|
272
|
+
* </DropdownMenu>
|
|
273
|
+
* ```
|
|
274
|
+
*
|
|
275
|
+
* @example With label, group, and keyboard shortcut
|
|
276
|
+
* ```tsx
|
|
277
|
+
* <DropdownMenu>
|
|
278
|
+
* <DropdownMenuTrigger asChild>
|
|
279
|
+
* <Button variant="outline">Options</Button>
|
|
280
|
+
* </DropdownMenuTrigger>
|
|
281
|
+
* <DropdownMenuContent>
|
|
282
|
+
* <DropdownMenuLabel>My account</DropdownMenuLabel>
|
|
283
|
+
* <DropdownMenuItem>
|
|
284
|
+
* Profile
|
|
285
|
+
* <DropdownMenuShortcut>⌘P</DropdownMenuShortcut>
|
|
286
|
+
* </DropdownMenuItem>
|
|
287
|
+
* <DropdownMenuItem>
|
|
288
|
+
* Settings
|
|
289
|
+
* <DropdownMenuShortcut>⌘,</DropdownMenuShortcut>
|
|
290
|
+
* </DropdownMenuItem>
|
|
291
|
+
* </DropdownMenuContent>
|
|
292
|
+
* </DropdownMenu>
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
declare const DropdownMenu: react.FC<RadixDropdown.DropdownMenuProps>;
|
|
296
|
+
declare const DropdownMenuTrigger: react.ForwardRefExoticComponent<RadixDropdown.DropdownMenuTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
297
|
+
declare const DropdownMenuGroup: react.ForwardRefExoticComponent<RadixDropdown.DropdownMenuGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
298
|
+
declare const DropdownMenuPortal: react.FC<RadixDropdown.DropdownMenuPortalProps>;
|
|
299
|
+
interface DropdownMenuContentProps extends ComponentPropsWithoutRef<typeof RadixDropdown.Content> {
|
|
300
|
+
}
|
|
301
|
+
declare const DropdownMenuContent: react.ForwardRefExoticComponent<DropdownMenuContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
302
|
+
interface DropdownMenuItemProps extends ComponentPropsWithoutRef<typeof RadixDropdown.Item> {
|
|
303
|
+
variant?: DropdownMenuItemVariant;
|
|
304
|
+
/** Indent items without a leading icon so they align with iconed siblings. */
|
|
305
|
+
inset?: boolean;
|
|
306
|
+
}
|
|
307
|
+
declare const DropdownMenuItem: react.ForwardRefExoticComponent<DropdownMenuItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
308
|
+
interface DropdownMenuSeparatorProps extends ComponentPropsWithoutRef<typeof RadixDropdown.Separator> {
|
|
309
|
+
}
|
|
310
|
+
declare const DropdownMenuSeparator: react.ForwardRefExoticComponent<DropdownMenuSeparatorProps & react.RefAttributes<HTMLDivElement>>;
|
|
311
|
+
interface DropdownMenuLabelProps extends ComponentPropsWithoutRef<typeof RadixDropdown.Label> {
|
|
312
|
+
/** Indent to align with iconed items. */
|
|
313
|
+
inset?: boolean;
|
|
314
|
+
}
|
|
315
|
+
declare const DropdownMenuLabel: react.ForwardRefExoticComponent<DropdownMenuLabelProps & react.RefAttributes<HTMLDivElement>>;
|
|
316
|
+
/**
|
|
317
|
+
* Visual hint for a keyboard shortcut, rendered at the trailing edge of an
|
|
318
|
+
* item. Pure presentation — does **not** register a keyboard handler.
|
|
319
|
+
*/
|
|
320
|
+
interface DropdownMenuShortcutProps extends HTMLAttributes<HTMLSpanElement> {
|
|
321
|
+
children: ReactNode;
|
|
322
|
+
}
|
|
323
|
+
declare const DropdownMenuShortcut: react.ForwardRefExoticComponent<DropdownMenuShortcutProps & react.RefAttributes<HTMLSpanElement>>;
|
|
324
|
+
|
|
325
|
+
type EmptyStateSize = 'sm' | 'md' | 'lg';
|
|
326
|
+
declare const emptyStateContainerSizeClass: Record<EmptyStateSize, string>;
|
|
327
|
+
declare const emptyStateIconWrapperSizeClass: Record<EmptyStateSize, string>;
|
|
328
|
+
declare const emptyStateTitleSizeClass: Record<EmptyStateSize, string>;
|
|
329
|
+
declare const emptyStateDescriptionSizeClass: Record<EmptyStateSize, string>;
|
|
330
|
+
declare const emptyStateActionsSpacingClass: Record<EmptyStateSize, string>;
|
|
331
|
+
declare const emptyStateBaseClass = "flex flex-col items-center justify-center text-center px-4";
|
|
332
|
+
declare const emptyStateIconWrapperBaseClass = "inline-flex items-center justify-center rounded-full bg-muted text-muted-foreground";
|
|
333
|
+
|
|
334
|
+
interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
335
|
+
/** Optional icon rendered in a circular muted background. Sized via `size` prop. */
|
|
336
|
+
icon?: ReactNode;
|
|
337
|
+
/** Required title — what's missing or what state we're in. */
|
|
338
|
+
title: ReactNode;
|
|
339
|
+
/** Secondary text — explain why the state is empty, suggest next action. */
|
|
340
|
+
description?: ReactNode;
|
|
341
|
+
/** Slot for primary (and optional secondary) action buttons. Rendered below description. */
|
|
342
|
+
action?: ReactNode;
|
|
343
|
+
/** Visual size — `sm` for inline empties (e.g. inside a popover), `md` (default) for table cells, `lg` for full-page empties. */
|
|
344
|
+
size?: EmptyStateSize;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Inline empty-state placeholder. Use when a list, table, or section has no
|
|
348
|
+
* data to show — either because the user hasn't created anything yet, or
|
|
349
|
+
* because filters/search returned zero results.
|
|
350
|
+
*
|
|
351
|
+
* The most common dashboard pattern: render inside a table's `tbody` colspan
|
|
352
|
+
* cell, or as a sibling to a list when the list is empty.
|
|
353
|
+
*
|
|
354
|
+
* @example No-results in a filtered table
|
|
355
|
+
* ```tsx
|
|
356
|
+
* <EmptyState
|
|
357
|
+
* icon={<SearchX />}
|
|
358
|
+
* title="No users match your filters"
|
|
359
|
+
* description="Try clearing the search or changing the status filter."
|
|
360
|
+
* action={<Button variant="outline" onClick={resetFilters}>Reset filters</Button>}
|
|
361
|
+
* />
|
|
362
|
+
* ```
|
|
363
|
+
*
|
|
364
|
+
* @example First-run empty (encourage creation)
|
|
365
|
+
* ```tsx
|
|
366
|
+
* <EmptyState
|
|
367
|
+
* size="lg"
|
|
368
|
+
* icon={<Users />}
|
|
369
|
+
* title="No users yet"
|
|
370
|
+
* description="Add your first team member to get started."
|
|
371
|
+
* action={<Button onClick={openCreate}>Add user</Button>}
|
|
372
|
+
* />
|
|
373
|
+
* ```
|
|
374
|
+
*
|
|
375
|
+
* @example Compact (inline)
|
|
376
|
+
* ```tsx
|
|
377
|
+
* <EmptyState size="sm" title="No notifications" />
|
|
378
|
+
* ```
|
|
379
|
+
*/
|
|
380
|
+
declare const EmptyState: react.ForwardRefExoticComponent<EmptyStateProps & react.RefAttributes<HTMLDivElement>>;
|
|
381
|
+
|
|
196
382
|
interface FieldRHFProps<TValues extends FieldValues = FieldValues, TName extends FieldPath<TValues> = FieldPath<TValues>> {
|
|
197
383
|
/**
|
|
198
384
|
* RHF `Control` returned from `useForm()`. Optional when `Field` is rendered
|
|
@@ -314,47 +500,45 @@ declare const inputBaseClass = "group/input relative inline-flex w-full items-ce
|
|
|
314
500
|
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
|
|
315
501
|
variant?: InputVariant;
|
|
316
502
|
inputSize?: InputSize;
|
|
317
|
-
/** Optional label rendered above the field. */
|
|
318
|
-
label?: ReactNode;
|
|
319
|
-
/** Helper text rendered under the field when not in an error state. */
|
|
320
|
-
helperText?: ReactNode;
|
|
321
|
-
/** Error message — renders in destructive style and sets aria-invalid. */
|
|
322
|
-
error?: ReactNode;
|
|
323
503
|
/** Element rendered before the input (icon, prefix text, etc.). */
|
|
324
504
|
leadingIcon?: ReactNode;
|
|
325
505
|
/** Element rendered after the input (icon, suffix text, etc.). */
|
|
326
506
|
trailingIcon?: ReactNode;
|
|
327
|
-
/** Stretch the wrapper to fill the parent's inline width. Defaults to `true`. */
|
|
328
|
-
fullWidth?: boolean;
|
|
329
507
|
/** Class applied to the outer wrapper that holds the icons + input. */
|
|
330
508
|
wrapperClassName?: string;
|
|
331
|
-
/** Class applied to the field container (`<label>` block). */
|
|
332
|
-
containerClassName?: string;
|
|
333
509
|
}
|
|
334
510
|
/**
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
511
|
+
* Bare text input — renders the wrapper + native `<input>` + optional leading /
|
|
512
|
+
* trailing icons. **No label/helperText/error props by design** (per ADR-007:
|
|
513
|
+
* Field owns all form layout). Wrap in `<Field label="…">` for label, helper,
|
|
514
|
+
* error rendering and full a11y wiring.
|
|
338
515
|
*
|
|
339
|
-
* @example
|
|
516
|
+
* @example Inside a Field (RHF + Zod)
|
|
340
517
|
* ```tsx
|
|
341
|
-
* <
|
|
518
|
+
* <Field name="email" label="Email" description="…" required>
|
|
519
|
+
* <Input type="email" />
|
|
520
|
+
* </Field>
|
|
342
521
|
* ```
|
|
343
522
|
*
|
|
344
523
|
* @example With icons
|
|
345
524
|
* ```tsx
|
|
346
|
-
* <
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
525
|
+
* <Field label="Search">
|
|
526
|
+
* <Input
|
|
527
|
+
* leadingIcon={<Search />}
|
|
528
|
+
* trailingIcon={<X onClick={clear} />}
|
|
529
|
+
* placeholder="Type to search…"
|
|
530
|
+
* />
|
|
531
|
+
* </Field>
|
|
351
532
|
* ```
|
|
352
533
|
*
|
|
353
|
-
* @example
|
|
534
|
+
* @example Bare in a filter bar (no Field)
|
|
354
535
|
* ```tsx
|
|
355
|
-
* <
|
|
356
|
-
*
|
|
357
|
-
*
|
|
536
|
+
* <Input
|
|
537
|
+
* value={search}
|
|
538
|
+
* onChange={(e) => setSearch(e.target.value)}
|
|
539
|
+
* placeholder="Search…"
|
|
540
|
+
* aria-label="Search products"
|
|
541
|
+
* />
|
|
358
542
|
* ```
|
|
359
543
|
*/
|
|
360
544
|
declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
|
|
@@ -467,6 +651,445 @@ interface SelectProps {
|
|
|
467
651
|
*/
|
|
468
652
|
declare const Select: react.ForwardRefExoticComponent<SelectProps & react.RefAttributes<HTMLButtonElement>>;
|
|
469
653
|
|
|
654
|
+
type TableSize = 'sm' | 'md' | 'lg';
|
|
655
|
+
interface TableSizeClasses {
|
|
656
|
+
/** Applied to <tr> when needed (currently empty — present for symmetry). */
|
|
657
|
+
row: string;
|
|
658
|
+
/** Applied to <td>. */
|
|
659
|
+
cell: string;
|
|
660
|
+
/** Applied to <th>. */
|
|
661
|
+
head: string;
|
|
662
|
+
}
|
|
663
|
+
declare const tableSizeClass: Record<TableSize, TableSizeClasses>;
|
|
664
|
+
declare const tableBaseClass = "w-full caption-bottom border-collapse";
|
|
665
|
+
declare const selectedRowClass = "bg-muted/40";
|
|
666
|
+
declare const sortIconClass = "inline-flex h-3 w-3 shrink-0 items-center justify-center";
|
|
667
|
+
declare const alignClass: Record<ColumnAlign, string>;
|
|
668
|
+
|
|
669
|
+
type SortDirection = 'asc' | 'desc';
|
|
670
|
+
interface SortState {
|
|
671
|
+
/** Column id being sorted, or `null` when no sort is active. */
|
|
672
|
+
columnId: string | null;
|
|
673
|
+
direction: SortDirection;
|
|
674
|
+
}
|
|
675
|
+
interface PaginationState {
|
|
676
|
+
/** 0-based page index. */
|
|
677
|
+
pageIndex: number;
|
|
678
|
+
pageSize: number;
|
|
679
|
+
}
|
|
680
|
+
/** Set of row ids (returned from `getRowId`) that are currently selected. */
|
|
681
|
+
type RowSelectionState = ReadonlySet<string>;
|
|
682
|
+
type SortableValue = string | number | bigint | boolean | Date | null | undefined;
|
|
683
|
+
type ColumnAlign = 'start' | 'center' | 'end';
|
|
684
|
+
interface Column<T> {
|
|
685
|
+
/** Stable column id. Used for sort state and React keys. */
|
|
686
|
+
id: string;
|
|
687
|
+
/** Header label, ReactNode, or a function that returns the header content. */
|
|
688
|
+
header: ReactNode | (() => ReactNode);
|
|
689
|
+
/** Field on T to read for default rendering and default sorting. */
|
|
690
|
+
accessor?: keyof T;
|
|
691
|
+
/** Custom cell renderer. If omitted, renders `String(row[accessor] ?? '')`. */
|
|
692
|
+
render?: (row: T, rowIndex: number) => ReactNode;
|
|
693
|
+
/** Enable click-to-sort UI on the header. */
|
|
694
|
+
sortable?: boolean;
|
|
695
|
+
/** Optional override for the value used to compare during sorting. */
|
|
696
|
+
sortAccessor?: (row: T) => SortableValue;
|
|
697
|
+
/** Tailwind classes applied to both <th> and <td>. */
|
|
698
|
+
className?: string;
|
|
699
|
+
/** Inline alignment hint. Defaults to 'start'. */
|
|
700
|
+
align?: ColumnAlign;
|
|
701
|
+
}
|
|
702
|
+
interface TableProps<T> {
|
|
703
|
+
/** Source rows. In server-side mode, this is just the current page. */
|
|
704
|
+
data: readonly T[];
|
|
705
|
+
/** Column definitions. */
|
|
706
|
+
columns: ReadonlyArray<Column<T>>;
|
|
707
|
+
/** Stable id for each row. Required for selection; recommended always. */
|
|
708
|
+
getRowId: (row: T, index: number) => string;
|
|
709
|
+
/**
|
|
710
|
+
* Total row count across all pages. Pass this when the parent paginates/sorts
|
|
711
|
+
* server-side — Table will skip its local sort + slice.
|
|
712
|
+
*/
|
|
713
|
+
totalCount?: number;
|
|
714
|
+
defaultSort?: SortState;
|
|
715
|
+
sort?: SortState;
|
|
716
|
+
onSortChange?: (next: SortState) => void;
|
|
717
|
+
defaultPagination?: PaginationState;
|
|
718
|
+
pagination?: PaginationState;
|
|
719
|
+
onPaginationChange?: (next: PaginationState) => void;
|
|
720
|
+
/** Page size dropdown options. Defaults to [10, 25, 50]. */
|
|
721
|
+
pageSizeOptions?: readonly number[];
|
|
722
|
+
/** Force the paginator to render even when rowCount <= pageSize. */
|
|
723
|
+
showPagination?: boolean;
|
|
724
|
+
/** Adds the selection column + header checkbox. */
|
|
725
|
+
enableRowSelection?: boolean;
|
|
726
|
+
defaultSelectedRowIds?: ReadonlySet<string>;
|
|
727
|
+
selectedRowIds?: ReadonlySet<string>;
|
|
728
|
+
onSelectedRowIdsChange?: (next: ReadonlySet<string>) => void;
|
|
729
|
+
/** Per-row guard. Disabled rows have a disabled checkbox and are excluded from "select all". */
|
|
730
|
+
isRowSelectable?: (row: T) => boolean;
|
|
731
|
+
/** Render prop receives the array of selected rows currently present in `data`. */
|
|
732
|
+
bulkActions?: (selectedRows: T[]) => ReactNode;
|
|
733
|
+
/** Override the "{n} selected" label (i18n / RTL). */
|
|
734
|
+
renderSelectionLabel?: (count: number) => ReactNode;
|
|
735
|
+
/** Label for the "Clear" button on the toolbar. */
|
|
736
|
+
clearSelectionLabel?: ReactNode;
|
|
737
|
+
loading?: boolean;
|
|
738
|
+
/** Number of skeleton rows shown while loading. Defaults to current pageSize. */
|
|
739
|
+
loadingRowCount?: number;
|
|
740
|
+
/** Empty-state slot. Defaults to a centered "No data" message. */
|
|
741
|
+
emptyState?: ReactNode;
|
|
742
|
+
size?: TableSize;
|
|
743
|
+
className?: string;
|
|
744
|
+
tableClassName?: string;
|
|
745
|
+
/**
|
|
746
|
+
* Constrain the scrollable region's height. Accepts any CSS length (e.g. `400`,
|
|
747
|
+
* `'24rem'`, `'60vh'`). When set, the body scrolls vertically and the header
|
|
748
|
+
* sticks to the top.
|
|
749
|
+
*/
|
|
750
|
+
maxHeight?: number | string;
|
|
751
|
+
/** Stripe alternating rows. Defaults to false. */
|
|
752
|
+
striped?: boolean;
|
|
753
|
+
/** Optional row click handler. */
|
|
754
|
+
onRowClick?: (row: T, rowIndex: number) => void;
|
|
755
|
+
/** Optional ref to the underlying <table> element. */
|
|
756
|
+
tableRef?: Ref<HTMLTableElement>;
|
|
757
|
+
'aria-label'?: string;
|
|
758
|
+
'aria-labelledby'?: string;
|
|
759
|
+
/** Caption rendered as <caption className="sr-only"> for assistive tech. */
|
|
760
|
+
caption?: ReactNode;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
declare function Table<T>(props: TableProps<T>): react_jsx_runtime.JSX.Element;
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* One filter dropdown definition for `<ListPage>`. ListPage manages each
|
|
767
|
+
* filter's state internally — you provide options + accessor.
|
|
768
|
+
*/
|
|
769
|
+
interface ListPageFilter<T> {
|
|
770
|
+
/** Unique key for state tracking. */
|
|
771
|
+
key: string;
|
|
772
|
+
/** Aria-label on the Select trigger. */
|
|
773
|
+
ariaLabel?: string;
|
|
774
|
+
/** Returns the row value to match against the filter selection. */
|
|
775
|
+
accessor: (row: T) => string;
|
|
776
|
+
/** Options to choose from. The first option's value is treated as "no filter / show all". */
|
|
777
|
+
options: SelectOption[];
|
|
778
|
+
/** Override the "no filter" default. Defaults to the first option's `value`. */
|
|
779
|
+
defaultValue?: string;
|
|
780
|
+
/** Width of the Select. Defaults to `'default'` (~11rem). */
|
|
781
|
+
width?: 'narrow' | 'default' | 'wide';
|
|
782
|
+
}
|
|
783
|
+
interface ListPageEmptyState {
|
|
784
|
+
icon?: ReactNode;
|
|
785
|
+
title?: ReactNode;
|
|
786
|
+
description?: ReactNode;
|
|
787
|
+
/** Override the default "Reset filters" action button. Pass `null` to hide entirely. */
|
|
788
|
+
action?: ReactNode | null;
|
|
789
|
+
}
|
|
790
|
+
interface ListPageLabels {
|
|
791
|
+
/** Default search input placeholder. */
|
|
792
|
+
searchPlaceholder?: string;
|
|
793
|
+
/** Default search aria-label (falls back to placeholder). */
|
|
794
|
+
searchAriaLabel?: string;
|
|
795
|
+
/** Default "Reset filters" button label. */
|
|
796
|
+
reset?: string;
|
|
797
|
+
/** Default empty-state title (when filters return zero). */
|
|
798
|
+
emptyTitle?: string;
|
|
799
|
+
/** Default empty-state description. */
|
|
800
|
+
emptyDescription?: string;
|
|
801
|
+
}
|
|
802
|
+
interface ListPageProps<T> {
|
|
803
|
+
title: ReactNode;
|
|
804
|
+
description?: ReactNode;
|
|
805
|
+
/** Page-header bordered separator. Defaults to `true` for list pages. */
|
|
806
|
+
bordered?: boolean;
|
|
807
|
+
/** Header action slot — primary "Add" button, etc. */
|
|
808
|
+
actions?: ReactNode;
|
|
809
|
+
data: T[];
|
|
810
|
+
columns: Column<T>[];
|
|
811
|
+
getRowId: (row: T) => string;
|
|
812
|
+
/** Keys on `T` to search. Search input only renders when this is provided. */
|
|
813
|
+
searchKeys?: Array<keyof T>;
|
|
814
|
+
filters?: ListPageFilter<T>[];
|
|
815
|
+
enableRowSelection?: boolean;
|
|
816
|
+
bulkActions?: (selected: T[]) => ReactNode;
|
|
817
|
+
emptyState?: ListPageEmptyState;
|
|
818
|
+
labels?: ListPageLabels;
|
|
819
|
+
className?: string;
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* Declarative list-page template — composes `PageHeader + search input +
|
|
823
|
+
* filter selects + Table + EmptyState` into a single configurable component.
|
|
824
|
+
*
|
|
825
|
+
* **Owns state internally** for search and filter selections — you pass raw
|
|
826
|
+
* `data` and ListPage filters it for you. For server-side data fetching or URL
|
|
827
|
+
* sync, drop down to the underlying primitives directly (see the
|
|
828
|
+
* `RecipeListPage` playground page for the manual composition pattern).
|
|
829
|
+
*
|
|
830
|
+
* @example Basic — Users list
|
|
831
|
+
* ```tsx
|
|
832
|
+
* <ListPage
|
|
833
|
+
* title="Users"
|
|
834
|
+
* description="Manage your team members."
|
|
835
|
+
* actions={<Button onClick={openCreate}>Add user</Button>}
|
|
836
|
+
* data={users}
|
|
837
|
+
* columns={USER_COLUMNS}
|
|
838
|
+
* getRowId={(u) => u.id}
|
|
839
|
+
* searchKeys={['name', 'email']}
|
|
840
|
+
* filters={[
|
|
841
|
+
* {
|
|
842
|
+
* key: 'status',
|
|
843
|
+
* ariaLabel: 'Status',
|
|
844
|
+
* accessor: (u) => u.status,
|
|
845
|
+
* options: [
|
|
846
|
+
* { value: 'all', label: 'All statuses' },
|
|
847
|
+
* { value: 'active', label: 'Active' },
|
|
848
|
+
* { value: 'invited', label: 'Invited' },
|
|
849
|
+
* ],
|
|
850
|
+
* },
|
|
851
|
+
* ]}
|
|
852
|
+
* enableRowSelection
|
|
853
|
+
* bulkActions={(rows) => <Button variant="destructive">Delete ({rows.length})</Button>}
|
|
854
|
+
* />
|
|
855
|
+
* ```
|
|
856
|
+
*
|
|
857
|
+
* @example With localized labels
|
|
858
|
+
* ```tsx
|
|
859
|
+
* <ListPage
|
|
860
|
+
* {...props}
|
|
861
|
+
* labels={{
|
|
862
|
+
* searchPlaceholder: 'ابحث…',
|
|
863
|
+
* reset: 'إعادة الفلاتر',
|
|
864
|
+
* emptyTitle: 'لا توجد نتائج',
|
|
865
|
+
* emptyDescription: 'حاول مسح البحث أو تغيير الفلاتر.',
|
|
866
|
+
* }}
|
|
867
|
+
* />
|
|
868
|
+
* ```
|
|
869
|
+
*/
|
|
870
|
+
declare function ListPage<T>({ title, description, bordered, actions, data, columns, getRowId, searchKeys, filters, enableRowSelection, bulkActions, emptyState, labels: labelsProp, className, }: ListPageProps<T>): react_jsx_runtime.JSX.Element;
|
|
871
|
+
|
|
872
|
+
type PageHeaderHeadingLevel = 'h1' | 'h2' | 'h3' | 'h4';
|
|
873
|
+
/** Props passed to the routing-library `render` slot of the back button. */
|
|
874
|
+
interface PageHeaderBackRenderProps {
|
|
875
|
+
href?: string;
|
|
876
|
+
className?: string;
|
|
877
|
+
children: ReactNode;
|
|
878
|
+
onClick?: () => void;
|
|
879
|
+
}
|
|
880
|
+
interface PageHeaderBackProps {
|
|
881
|
+
/** Visible label next to the arrow. Defaults to `"Back"`. */
|
|
882
|
+
label?: ReactNode;
|
|
883
|
+
/** Target href — renders an `<a>`. */
|
|
884
|
+
href?: string;
|
|
885
|
+
/** Click handler — renders a `<button>` (or wraps the `render` element). */
|
|
886
|
+
onClick?: () => void;
|
|
887
|
+
/** Routing-library render prop (e.g. wrap React Router `<Link>`). Wins over `href`. */
|
|
888
|
+
render?: (props: PageHeaderBackRenderProps) => ReactElement;
|
|
889
|
+
}
|
|
890
|
+
interface PageHeaderProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
891
|
+
/** Page title (required). */
|
|
892
|
+
title: ReactNode;
|
|
893
|
+
/** Optional secondary text under the title. */
|
|
894
|
+
description?: ReactNode;
|
|
895
|
+
/** Slot above the title for breadcrumbs (e.g. `<Breadcrumbs items={…} />` or your own JSX). */
|
|
896
|
+
breadcrumbs?: ReactNode;
|
|
897
|
+
/** Optional back button rendered above the title row. */
|
|
898
|
+
back?: PageHeaderBackProps;
|
|
899
|
+
/** Slot on the trailing side of the title row — buttons, dropdowns, etc. */
|
|
900
|
+
actions?: ReactNode;
|
|
901
|
+
/** Heading level for the title element. Defaults to `'h1'`. */
|
|
902
|
+
as?: PageHeaderHeadingLevel;
|
|
903
|
+
/** Add a bottom border separator. Default: `false`. */
|
|
904
|
+
bordered?: boolean;
|
|
905
|
+
}
|
|
906
|
+
/**
|
|
907
|
+
* Top-of-page header — title, optional description, breadcrumbs, back button,
|
|
908
|
+
* and actions slot. The first thing a user sees on any list / detail / form
|
|
909
|
+
* page in a dashboard.
|
|
910
|
+
*
|
|
911
|
+
* Designed to drop directly into `<DashboardContent>` (or any padded page
|
|
912
|
+
* container). Has no outer padding of its own — the surrounding layout owns
|
|
913
|
+
* spacing.
|
|
914
|
+
*
|
|
915
|
+
* @example List page header with primary action
|
|
916
|
+
* ```tsx
|
|
917
|
+
* <PageHeader
|
|
918
|
+
* title="Users"
|
|
919
|
+
* description="Manage your team members and their roles."
|
|
920
|
+
* actions={<Button onClick={openCreate}>Add user</Button>}
|
|
921
|
+
* bordered
|
|
922
|
+
* />
|
|
923
|
+
* ```
|
|
924
|
+
*
|
|
925
|
+
* @example Detail page header with back button
|
|
926
|
+
* ```tsx
|
|
927
|
+
* <PageHeader
|
|
928
|
+
* title={user.name}
|
|
929
|
+
* description={user.email}
|
|
930
|
+
* back={{
|
|
931
|
+
* label: 'Users',
|
|
932
|
+
* render: (props) => <Link to="/users" {...props} />,
|
|
933
|
+
* }}
|
|
934
|
+
* actions={
|
|
935
|
+
* <>
|
|
936
|
+
* <Button variant="outline">Edit</Button>
|
|
937
|
+
* <Button variant="destructive">Delete</Button>
|
|
938
|
+
* </>
|
|
939
|
+
* }
|
|
940
|
+
* />
|
|
941
|
+
* ```
|
|
942
|
+
*
|
|
943
|
+
* @example With breadcrumbs slot
|
|
944
|
+
* ```tsx
|
|
945
|
+
* <PageHeader
|
|
946
|
+
* breadcrumbs={
|
|
947
|
+
* <nav aria-label="Breadcrumb">
|
|
948
|
+
* <ol className="flex items-center gap-1">
|
|
949
|
+
* <li><Link to="/">Home</Link></li>
|
|
950
|
+
* <li>/</li>
|
|
951
|
+
* <li>Users</li>
|
|
952
|
+
* </ol>
|
|
953
|
+
* </nav>
|
|
954
|
+
* }
|
|
955
|
+
* title="Users"
|
|
956
|
+
* />
|
|
957
|
+
* ```
|
|
958
|
+
*/
|
|
959
|
+
declare const PageHeader: react.ForwardRefExoticComponent<PageHeaderProps & react.RefAttributes<HTMLElement>>;
|
|
960
|
+
|
|
961
|
+
declare const pageHeaderBaseClass = "flex w-full flex-col gap-3";
|
|
962
|
+
/** Adds a bottom border separator below the header. */
|
|
963
|
+
declare const pageHeaderBorderedClass = "border-b border-border pb-4";
|
|
964
|
+
declare const pageHeaderTitleRowClass = "flex flex-wrap items-start justify-between gap-3 sm:gap-4";
|
|
965
|
+
declare const pageHeaderTitleBlockClass = "min-w-0 flex-1 space-y-1";
|
|
966
|
+
declare const pageHeaderTitleClass = "text-2xl font-semibold tracking-tight text-foreground";
|
|
967
|
+
declare const pageHeaderDescriptionClass = "text-sm text-muted-foreground";
|
|
968
|
+
declare const pageHeaderActionsClass = "flex shrink-0 flex-wrap items-center gap-2";
|
|
969
|
+
declare const pageHeaderBackClass = "inline-flex items-center gap-1.5 self-start text-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-md";
|
|
970
|
+
declare const pageHeaderBackIconClass = "size-4 shrink-0 rtl:rotate-180";
|
|
971
|
+
declare const pageHeaderBreadcrumbsClass = "text-xs text-muted-foreground";
|
|
972
|
+
|
|
973
|
+
type RadioGroupSize = 'sm' | 'md' | 'lg';
|
|
974
|
+
/** Outer circle (radio button itself) — sized + bordered. */
|
|
975
|
+
declare const radioItemSizeClass: Record<RadioGroupSize, string>;
|
|
976
|
+
/** Inner indicator (the filled dot when selected). Centred via flex on the parent. */
|
|
977
|
+
declare const radioIndicatorSizeClass: Record<RadioGroupSize, string>;
|
|
978
|
+
/** Label text size that pairs naturally with each radio size. */
|
|
979
|
+
declare const radioLabelSizeClass: Record<RadioGroupSize, string>;
|
|
980
|
+
declare const radioItemBaseClass = "aspect-square shrink-0 rounded-full border border-input bg-background text-primary outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-2 focus-visible:ring-offset-background hover:border-ring disabled:cursor-not-allowed disabled:opacity-50 aria-[invalid=true]:border-destructive aria-[invalid=true]:focus-visible:ring-destructive/40 data-[state=checked]:border-primary";
|
|
981
|
+
declare const radioIndicatorBaseClass = "flex h-full w-full items-center justify-center";
|
|
982
|
+
declare const radioIndicatorDotClass = "rounded-full bg-primary";
|
|
983
|
+
/** Each option row: radio + label + optional description. */
|
|
984
|
+
declare const radioOptionRowClass = "flex cursor-pointer items-start gap-2 has-[button:disabled]:cursor-not-allowed";
|
|
985
|
+
/** The group container — vertical stack by default, horizontal row when orientation="horizontal". */
|
|
986
|
+
declare const radioGroupBaseClass = "flex gap-3";
|
|
987
|
+
declare const radioGroupOrientationClass: {
|
|
988
|
+
readonly vertical: "flex-col";
|
|
989
|
+
readonly horizontal: "flex-row flex-wrap";
|
|
990
|
+
};
|
|
991
|
+
|
|
992
|
+
interface RadioGroupOption {
|
|
993
|
+
value: string;
|
|
994
|
+
/** Visible label rendered next to the radio button. */
|
|
995
|
+
label: ReactNode;
|
|
996
|
+
/** Optional secondary text rendered below the label (e.g. plan description). */
|
|
997
|
+
description?: ReactNode;
|
|
998
|
+
disabled?: boolean;
|
|
999
|
+
}
|
|
1000
|
+
type RadioGroupOrientation = 'vertical' | 'horizontal';
|
|
1001
|
+
interface RadioGroupProps {
|
|
1002
|
+
/** Visual size of each radio + label. */
|
|
1003
|
+
radioSize?: RadioGroupSize;
|
|
1004
|
+
/** Layout direction within the group. `'vertical'` (default) stacks options; `'horizontal'` lays them out in a row. */
|
|
1005
|
+
orientation?: RadioGroupOrientation;
|
|
1006
|
+
/** Controlled selected value (Radix-style). */
|
|
1007
|
+
value?: string;
|
|
1008
|
+
/** Initial selected value for uncontrolled usage. */
|
|
1009
|
+
defaultValue?: string;
|
|
1010
|
+
/** Radix-style change handler — receives the new value directly. */
|
|
1011
|
+
onValueChange?: (value: string) => void;
|
|
1012
|
+
/** Synthetic-event handler for `react-hook-form`'s `field.onChange` and other consumers. */
|
|
1013
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
1014
|
+
/** Called when focus leaves the group. */
|
|
1015
|
+
onBlur?: () => void;
|
|
1016
|
+
/** Form name (for native form submission). */
|
|
1017
|
+
name?: string;
|
|
1018
|
+
/** Disables the entire group. */
|
|
1019
|
+
disabled?: boolean;
|
|
1020
|
+
/** Marks the group as required. */
|
|
1021
|
+
required?: boolean;
|
|
1022
|
+
/** Override id (otherwise auto-generated via useId). */
|
|
1023
|
+
id?: string;
|
|
1024
|
+
/** Declarative options. When `children` is provided it wins (escape hatch for custom content). */
|
|
1025
|
+
options?: RadioGroupOption[];
|
|
1026
|
+
/** Class on the outer group container. */
|
|
1027
|
+
className?: string;
|
|
1028
|
+
'aria-label'?: string;
|
|
1029
|
+
'aria-labelledby'?: string;
|
|
1030
|
+
'aria-describedby'?: string;
|
|
1031
|
+
'aria-invalid'?: boolean | 'true' | 'false';
|
|
1032
|
+
/** Radix children — used for advanced composition (custom RadioGroupItem layouts). */
|
|
1033
|
+
children?: ReactNode;
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Group of mutually-exclusive radio buttons built on `@radix-ui/react-radio-group`.
|
|
1037
|
+
* Use for **3–5 options** where Select would be overkill (pricing tier, privacy
|
|
1038
|
+
* level, single-choice settings). Bare component — wrap in `<Field label="…">`
|
|
1039
|
+
* for the GROUP label, helper, and error rendering.
|
|
1040
|
+
*
|
|
1041
|
+
* Each option carries its own per-radio `label` (and optional `description`).
|
|
1042
|
+
* The Field's outer label names the group; the option labels name each choice.
|
|
1043
|
+
*
|
|
1044
|
+
* @example Inside a Field (RHF + Zod)
|
|
1045
|
+
* ```tsx
|
|
1046
|
+
* <Field name="plan" label="Subscription plan" description="You can change anytime.">
|
|
1047
|
+
* <RadioGroup
|
|
1048
|
+
* options={[
|
|
1049
|
+
* { value: 'free', label: 'Free', description: 'Up to 3 projects' },
|
|
1050
|
+
* { value: 'pro', label: 'Pro', description: 'Unlimited projects' },
|
|
1051
|
+
* { value: 'enterprise', label: 'Enterprise', description: 'Custom limits' },
|
|
1052
|
+
* ]}
|
|
1053
|
+
* />
|
|
1054
|
+
* </Field>
|
|
1055
|
+
* ```
|
|
1056
|
+
*
|
|
1057
|
+
* @example Horizontal row in a settings card
|
|
1058
|
+
* ```tsx
|
|
1059
|
+
* <Field label="Visibility" orientation="horizontal">
|
|
1060
|
+
* <RadioGroup
|
|
1061
|
+
* orientation="horizontal"
|
|
1062
|
+
* value={visibility}
|
|
1063
|
+
* onValueChange={setVisibility}
|
|
1064
|
+
* options={[
|
|
1065
|
+
* { value: 'public', label: 'Public' },
|
|
1066
|
+
* { value: 'private', label: 'Private' },
|
|
1067
|
+
* ]}
|
|
1068
|
+
* />
|
|
1069
|
+
* </Field>
|
|
1070
|
+
* ```
|
|
1071
|
+
*/
|
|
1072
|
+
declare const RadioGroup: react.ForwardRefExoticComponent<RadioGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
1073
|
+
/**
|
|
1074
|
+
* `<RadioGroupItem>` — re-exported for consumers building custom option layouts
|
|
1075
|
+
* (icons, badges, etc.) via the `children` escape hatch.
|
|
1076
|
+
*
|
|
1077
|
+
* @example
|
|
1078
|
+
* ```tsx
|
|
1079
|
+
* <RadioGroup value={plan} onValueChange={setPlan}>
|
|
1080
|
+
* {plans.map((p) => (
|
|
1081
|
+
* <label key={p.value} htmlFor={p.value} className="flex items-center gap-2">
|
|
1082
|
+
* <RadioGroupItem id={p.value} value={p.value} />
|
|
1083
|
+
* <PlanCard {...p} />
|
|
1084
|
+
* </label>
|
|
1085
|
+
* ))}
|
|
1086
|
+
* </RadioGroup>
|
|
1087
|
+
* ```
|
|
1088
|
+
*/
|
|
1089
|
+
declare const RadioGroupItem: react.ForwardRefExoticComponent<Omit<RadixRadioGroup.RadioGroupItemProps & react.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
1090
|
+
radioSize?: RadioGroupSize;
|
|
1091
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
1092
|
+
|
|
470
1093
|
type SidebarProps = HTMLAttributes<HTMLElement>;
|
|
471
1094
|
declare function Sidebar({ className, children, ...props }: SidebarProps): react_jsx_runtime.JSX.Element;
|
|
472
1095
|
|
|
@@ -595,117 +1218,6 @@ interface SwitchProps {
|
|
|
595
1218
|
*/
|
|
596
1219
|
declare const Switch: react.ForwardRefExoticComponent<SwitchProps & react.RefAttributes<HTMLButtonElement>>;
|
|
597
1220
|
|
|
598
|
-
type TableSize = 'sm' | 'md' | 'lg';
|
|
599
|
-
interface TableSizeClasses {
|
|
600
|
-
/** Applied to <tr> when needed (currently empty — present for symmetry). */
|
|
601
|
-
row: string;
|
|
602
|
-
/** Applied to <td>. */
|
|
603
|
-
cell: string;
|
|
604
|
-
/** Applied to <th>. */
|
|
605
|
-
head: string;
|
|
606
|
-
}
|
|
607
|
-
declare const tableSizeClass: Record<TableSize, TableSizeClasses>;
|
|
608
|
-
declare const tableBaseClass = "w-full caption-bottom border-collapse";
|
|
609
|
-
declare const selectedRowClass = "bg-muted/40";
|
|
610
|
-
declare const sortIconClass = "inline-flex h-3 w-3 shrink-0 items-center justify-center";
|
|
611
|
-
declare const alignClass: Record<ColumnAlign, string>;
|
|
612
|
-
|
|
613
|
-
type SortDirection = 'asc' | 'desc';
|
|
614
|
-
interface SortState {
|
|
615
|
-
/** Column id being sorted, or `null` when no sort is active. */
|
|
616
|
-
columnId: string | null;
|
|
617
|
-
direction: SortDirection;
|
|
618
|
-
}
|
|
619
|
-
interface PaginationState {
|
|
620
|
-
/** 0-based page index. */
|
|
621
|
-
pageIndex: number;
|
|
622
|
-
pageSize: number;
|
|
623
|
-
}
|
|
624
|
-
/** Set of row ids (returned from `getRowId`) that are currently selected. */
|
|
625
|
-
type RowSelectionState = ReadonlySet<string>;
|
|
626
|
-
type SortableValue = string | number | bigint | boolean | Date | null | undefined;
|
|
627
|
-
type ColumnAlign = 'start' | 'center' | 'end';
|
|
628
|
-
interface Column<T> {
|
|
629
|
-
/** Stable column id. Used for sort state and React keys. */
|
|
630
|
-
id: string;
|
|
631
|
-
/** Header label, ReactNode, or a function that returns the header content. */
|
|
632
|
-
header: ReactNode | (() => ReactNode);
|
|
633
|
-
/** Field on T to read for default rendering and default sorting. */
|
|
634
|
-
accessor?: keyof T;
|
|
635
|
-
/** Custom cell renderer. If omitted, renders `String(row[accessor] ?? '')`. */
|
|
636
|
-
render?: (row: T, rowIndex: number) => ReactNode;
|
|
637
|
-
/** Enable click-to-sort UI on the header. */
|
|
638
|
-
sortable?: boolean;
|
|
639
|
-
/** Optional override for the value used to compare during sorting. */
|
|
640
|
-
sortAccessor?: (row: T) => SortableValue;
|
|
641
|
-
/** Tailwind classes applied to both <th> and <td>. */
|
|
642
|
-
className?: string;
|
|
643
|
-
/** Inline alignment hint. Defaults to 'start'. */
|
|
644
|
-
align?: ColumnAlign;
|
|
645
|
-
}
|
|
646
|
-
interface TableProps<T> {
|
|
647
|
-
/** Source rows. In server-side mode, this is just the current page. */
|
|
648
|
-
data: readonly T[];
|
|
649
|
-
/** Column definitions. */
|
|
650
|
-
columns: ReadonlyArray<Column<T>>;
|
|
651
|
-
/** Stable id for each row. Required for selection; recommended always. */
|
|
652
|
-
getRowId: (row: T, index: number) => string;
|
|
653
|
-
/**
|
|
654
|
-
* Total row count across all pages. Pass this when the parent paginates/sorts
|
|
655
|
-
* server-side — Table will skip its local sort + slice.
|
|
656
|
-
*/
|
|
657
|
-
totalCount?: number;
|
|
658
|
-
defaultSort?: SortState;
|
|
659
|
-
sort?: SortState;
|
|
660
|
-
onSortChange?: (next: SortState) => void;
|
|
661
|
-
defaultPagination?: PaginationState;
|
|
662
|
-
pagination?: PaginationState;
|
|
663
|
-
onPaginationChange?: (next: PaginationState) => void;
|
|
664
|
-
/** Page size dropdown options. Defaults to [10, 25, 50]. */
|
|
665
|
-
pageSizeOptions?: readonly number[];
|
|
666
|
-
/** Force the paginator to render even when rowCount <= pageSize. */
|
|
667
|
-
showPagination?: boolean;
|
|
668
|
-
/** Adds the selection column + header checkbox. */
|
|
669
|
-
enableRowSelection?: boolean;
|
|
670
|
-
defaultSelectedRowIds?: ReadonlySet<string>;
|
|
671
|
-
selectedRowIds?: ReadonlySet<string>;
|
|
672
|
-
onSelectedRowIdsChange?: (next: ReadonlySet<string>) => void;
|
|
673
|
-
/** Per-row guard. Disabled rows have a disabled checkbox and are excluded from "select all". */
|
|
674
|
-
isRowSelectable?: (row: T) => boolean;
|
|
675
|
-
/** Render prop receives the array of selected rows currently present in `data`. */
|
|
676
|
-
bulkActions?: (selectedRows: T[]) => ReactNode;
|
|
677
|
-
/** Override the "{n} selected" label (i18n / RTL). */
|
|
678
|
-
renderSelectionLabel?: (count: number) => ReactNode;
|
|
679
|
-
/** Label for the "Clear" button on the toolbar. */
|
|
680
|
-
clearSelectionLabel?: ReactNode;
|
|
681
|
-
loading?: boolean;
|
|
682
|
-
/** Number of skeleton rows shown while loading. Defaults to current pageSize. */
|
|
683
|
-
loadingRowCount?: number;
|
|
684
|
-
/** Empty-state slot. Defaults to a centered "No data" message. */
|
|
685
|
-
emptyState?: ReactNode;
|
|
686
|
-
size?: TableSize;
|
|
687
|
-
className?: string;
|
|
688
|
-
tableClassName?: string;
|
|
689
|
-
/**
|
|
690
|
-
* Constrain the scrollable region's height. Accepts any CSS length (e.g. `400`,
|
|
691
|
-
* `'24rem'`, `'60vh'`). When set, the body scrolls vertically and the header
|
|
692
|
-
* sticks to the top.
|
|
693
|
-
*/
|
|
694
|
-
maxHeight?: number | string;
|
|
695
|
-
/** Stripe alternating rows. Defaults to false. */
|
|
696
|
-
striped?: boolean;
|
|
697
|
-
/** Optional row click handler. */
|
|
698
|
-
onRowClick?: (row: T, rowIndex: number) => void;
|
|
699
|
-
/** Optional ref to the underlying <table> element. */
|
|
700
|
-
tableRef?: Ref<HTMLTableElement>;
|
|
701
|
-
'aria-label'?: string;
|
|
702
|
-
'aria-labelledby'?: string;
|
|
703
|
-
/** Caption rendered as <caption className="sr-only"> for assistive tech. */
|
|
704
|
-
caption?: ReactNode;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
declare function Table<T>(props: TableProps<T>): react_jsx_runtime.JSX.Element;
|
|
708
|
-
|
|
709
1221
|
type TextareaVariant = 'default' | 'filled' | 'ghost';
|
|
710
1222
|
type TextareaSize = 'sm' | 'md' | 'lg';
|
|
711
1223
|
type TextareaResize = 'none' | 'vertical' | 'horizontal' | 'both';
|
|
@@ -719,41 +1231,26 @@ interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>
|
|
|
719
1231
|
textareaSize?: TextareaSize;
|
|
720
1232
|
/** Controls the native CSS `resize` behaviour. Defaults to `'vertical'`. */
|
|
721
1233
|
resize?: TextareaResize;
|
|
722
|
-
/** Optional label rendered above the field. */
|
|
723
|
-
label?: ReactNode;
|
|
724
|
-
/** Helper text rendered under the field when not in an error state. */
|
|
725
|
-
helperText?: ReactNode;
|
|
726
|
-
/** Error message — renders in destructive style and sets aria-invalid. */
|
|
727
|
-
error?: ReactNode;
|
|
728
|
-
/** Stretch the wrapper to fill the parent's inline width. Defaults to `true`. */
|
|
729
|
-
fullWidth?: boolean;
|
|
730
1234
|
/** Class applied to the outer wrapper that frames the textarea. */
|
|
731
1235
|
wrapperClassName?: string;
|
|
732
|
-
/** Class applied to the field container (`<label>` block). */
|
|
733
|
-
containerClassName?: string;
|
|
734
1236
|
}
|
|
735
1237
|
/**
|
|
736
|
-
*
|
|
737
|
-
*
|
|
738
|
-
*
|
|
739
|
-
*
|
|
740
|
-
* ```tsx
|
|
741
|
-
* <Textarea label="Bio" helperText="Up to 280 characters." rows={4} />
|
|
742
|
-
* ```
|
|
1238
|
+
* Bare multi-line text input — renders the wrapper + native `<textarea>`. **No
|
|
1239
|
+
* label/helperText/error props by design** (per ADR-007: Field owns all form
|
|
1240
|
+
* layout). Wrap in `<Field label="…">` for label, helper, error rendering and
|
|
1241
|
+
* full a11y wiring.
|
|
743
1242
|
*
|
|
744
|
-
* @example
|
|
1243
|
+
* @example Inside a Field (RHF + Zod)
|
|
745
1244
|
* ```tsx
|
|
746
|
-
* <
|
|
747
|
-
*
|
|
748
|
-
*
|
|
749
|
-
* resize="vertical"
|
|
750
|
-
* />
|
|
1245
|
+
* <Field name="bio" label="Bio" description="Up to 280 characters.">
|
|
1246
|
+
* <Textarea rows={4} />
|
|
1247
|
+
* </Field>
|
|
751
1248
|
* ```
|
|
752
1249
|
*
|
|
753
|
-
* @example
|
|
1250
|
+
* @example Custom resize behaviour
|
|
754
1251
|
* ```tsx
|
|
755
|
-
* <Field
|
|
756
|
-
* <Textarea rows={
|
|
1252
|
+
* <Field label="Notes">
|
|
1253
|
+
* <Textarea resize="none" rows={6} />
|
|
757
1254
|
* </Field>
|
|
758
1255
|
* ```
|
|
759
1256
|
*/
|
|
@@ -764,4 +1261,4 @@ declare function useDirection(): Direction;
|
|
|
764
1261
|
|
|
765
1262
|
declare function cn(...inputs: ClassValue[]): string;
|
|
766
1263
|
|
|
767
|
-
export { AppShell, type AppShellBrand, type AppShellNavGroup, type AppShellNavItem, type AppShellProps, Avatar, type AvatarProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Checkbox, type CheckboxProps, type CheckboxSize, type Column, type ColumnAlign, DashboardContent, type DashboardContentProps, DashboardHeader, type DashboardHeaderProps, DashboardLayout, type DashboardLayoutContextValue, type DashboardLayoutProps, DashboardMain, type DashboardMainProps, type Direction, Field, type FieldOrientation, type FieldProps, type FieldRHFProps, HeaderActions, type HeaderActionsProps, HeaderCollapseTrigger, type HeaderCollapseTriggerProps, HeaderMobileTrigger, type HeaderMobileTriggerProps, HeaderSearch, type HeaderSearchProps, HeaderTitle, type HeaderTitleProps, Input, type InputProps, type InputSize, type InputVariant, type LanguageOption, LanguageSwitcher, type LanguageSwitcherProps, type PaginationState, type RowSelectionState, Select, type SelectOption, type SelectProps, type SelectSize, type SelectVariant, Sidebar, SidebarFooter, type SidebarFooterProps, SidebarGroup, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarNav, SidebarNavGroup, type SidebarNavGroupProps, SidebarNavItem, type SidebarNavItemProps, type SidebarNavItemRenderProps, type SidebarNavProps, type SidebarProps, type SortDirection, type SortState, type SortableValue, Switch, type SwitchProps, type SwitchSize, Table, type TableProps, type TableSize, type TableSizeClasses, Textarea, type TextareaProps, type TextareaResize, type TextareaSize, type TextareaVariant, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, inputBaseClass, inputSizeClass, inputVariantClass, selectBaseClass, selectSizeClass, selectVariantClass, switchThumbBaseClass, switchThumbClass, switchTrackBaseClass, switchTrackClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, textareaBaseClass, textareaResizeClass, textareaSizeClass, textareaVariantClass, useDashboardLayout, useDirection };
|
|
1264
|
+
export { AppShell, type AppShellBrand, type AppShellNavGroup, type AppShellNavItem, type AppShellProps, Avatar, type AvatarProps, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Checkbox, type CheckboxProps, type CheckboxSize, type Column, type ColumnAlign, DashboardContent, type DashboardContentProps, DashboardHeader, type DashboardHeaderProps, DashboardLayout, type DashboardLayoutContextValue, type DashboardLayoutProps, DashboardMain, type DashboardMainProps, type Direction, DropdownMenu, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuItemVariant, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuShortcut, type DropdownMenuShortcutProps, DropdownMenuTrigger, EmptyState, type EmptyStateProps, type EmptyStateSize, Field, type FieldOrientation, type FieldProps, type FieldRHFProps, HeaderActions, type HeaderActionsProps, HeaderCollapseTrigger, type HeaderCollapseTriggerProps, HeaderMobileTrigger, type HeaderMobileTriggerProps, HeaderSearch, type HeaderSearchProps, HeaderTitle, type HeaderTitleProps, Input, type InputProps, type InputSize, type InputVariant, type LanguageOption, LanguageSwitcher, type LanguageSwitcherProps, ListPage, type ListPageEmptyState, type ListPageFilter, type ListPageLabels, type ListPageProps, PageHeader, type PageHeaderBackProps, type PageHeaderBackRenderProps, type PageHeaderHeadingLevel, type PageHeaderProps, type PaginationState, RadioGroup, RadioGroupItem, type RadioGroupOption, type RadioGroupOrientation, type RadioGroupProps, type RadioGroupSize, type RowSelectionState, Select, type SelectOption, type SelectProps, type SelectSize, type SelectVariant, Sidebar, SidebarFooter, type SidebarFooterProps, SidebarGroup, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarNav, SidebarNavGroup, type SidebarNavGroupProps, SidebarNavItem, type SidebarNavItemProps, type SidebarNavItemRenderProps, type SidebarNavProps, type SidebarProps, type SortDirection, type SortState, type SortableValue, Switch, type SwitchProps, type SwitchSize, Table, type TableProps, type TableSize, type TableSizeClasses, Textarea, type TextareaProps, type TextareaResize, type TextareaSize, type TextareaVariant, badgeBaseClass, badgeDotSizeClass, badgeSizeClass, badgeVariantClass, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, dropdownMenuContentClass, dropdownMenuItemBaseClass, dropdownMenuItemInsetClass, dropdownMenuItemVariantClass, dropdownMenuLabelClass, dropdownMenuSeparatorClass, dropdownMenuShortcutClass, emptyStateActionsSpacingClass, emptyStateBaseClass, emptyStateContainerSizeClass, emptyStateDescriptionSizeClass, emptyStateIconWrapperBaseClass, emptyStateIconWrapperSizeClass, emptyStateTitleSizeClass, inputBaseClass, inputSizeClass, inputVariantClass, pageHeaderActionsClass, pageHeaderBackClass, pageHeaderBackIconClass, pageHeaderBaseClass, pageHeaderBorderedClass, pageHeaderBreadcrumbsClass, pageHeaderDescriptionClass, pageHeaderTitleBlockClass, pageHeaderTitleClass, pageHeaderTitleRowClass, radioGroupBaseClass, radioGroupOrientationClass, radioIndicatorBaseClass, radioIndicatorDotClass, radioIndicatorSizeClass, radioItemBaseClass, radioItemSizeClass, radioLabelSizeClass, radioOptionRowClass, selectBaseClass, selectSizeClass, selectVariantClass, switchThumbBaseClass, switchThumbClass, switchTrackBaseClass, switchTrackClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, textareaBaseClass, textareaResizeClass, textareaSizeClass, textareaVariantClass, useDashboardLayout, useDirection };
|