canny-ui-react 2.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/components/Accordion/Accordion.d.ts +32 -0
  2. package/dist/components/Accordion/index.d.ts +2 -0
  3. package/dist/components/Autocomplete/Autocomplete.d.ts +19 -0
  4. package/dist/components/Autocomplete/Autocomplete.types.d.ts +71 -0
  5. package/dist/components/Autocomplete/index.d.ts +2 -0
  6. package/dist/components/Badge/Badge.d.ts +21 -0
  7. package/dist/components/Badge/index.d.ts +2 -0
  8. package/dist/components/Breadcrumb/Breadcrumb.d.ts +14 -0
  9. package/dist/components/Breadcrumb/index.d.ts +2 -0
  10. package/dist/components/Charts/BarChart.d.ts +31 -0
  11. package/dist/components/Charts/LineChart.d.ts +25 -0
  12. package/dist/components/Charts/PieChart.d.ts +22 -0
  13. package/dist/components/Charts/ResponsiveContainer.d.ts +12 -0
  14. package/dist/components/Charts/chartUtils.d.ts +16 -0
  15. package/dist/components/Charts/index.d.ts +9 -0
  16. package/dist/components/Chip/Chip.d.ts +37 -0
  17. package/dist/components/Chip/index.d.ts +2 -0
  18. package/dist/components/ConfirmDialog/ConfirmDialog.d.ts +31 -0
  19. package/dist/components/ConfirmDialog/index.d.ts +4 -0
  20. package/dist/components/ConfirmDialog/useConfirm.d.ts +16 -0
  21. package/dist/components/DataTable/DataTable.d.ts +69 -0
  22. package/dist/components/DataTable/index.d.ts +2 -0
  23. package/dist/components/Dialog/Dialog.d.ts +34 -0
  24. package/dist/components/Dialog/index.d.ts +2 -0
  25. package/dist/components/Drawer/Drawer.d.ts +35 -0
  26. package/dist/components/Drawer/index.d.ts +2 -0
  27. package/dist/components/FileUploader/FileUploader.d.ts +19 -0
  28. package/dist/components/FileUploader/index.d.ts +4 -0
  29. package/dist/components/FileUploader/useFileDrop.d.ts +630 -0
  30. package/dist/components/Layout/AspectRatio.d.ts +11 -0
  31. package/dist/components/Layout/Center.d.ts +7 -0
  32. package/dist/components/Layout/Grid.d.ts +7 -1
  33. package/dist/components/Layout/Group.d.ts +10 -0
  34. package/dist/components/Layout/index.d.ts +6 -0
  35. package/dist/components/List/List.d.ts +42 -0
  36. package/dist/components/List/index.d.ts +2 -0
  37. package/dist/components/Menu/Menu.d.ts +51 -0
  38. package/dist/components/Menu/index.d.ts +2 -0
  39. package/dist/components/Pagination/Pagination.d.ts +22 -0
  40. package/dist/components/Pagination/index.d.ts +2 -0
  41. package/dist/components/PanelGroup/PanelGroup.d.ts +33 -0
  42. package/dist/components/PanelGroup/index.d.ts +2 -0
  43. package/dist/components/Popover/Popover.d.ts +24 -0
  44. package/dist/components/Popover/index.d.ts +2 -0
  45. package/dist/components/Slider/Slider.d.ts +15 -0
  46. package/dist/components/Slider/index.d.ts +2 -0
  47. package/dist/components/Stepper/Stepper.d.ts +16 -0
  48. package/dist/components/Stepper/index.d.ts +2 -0
  49. package/dist/components/Tabs/Tabs.d.ts +34 -0
  50. package/dist/components/Tabs/index.d.ts +2 -0
  51. package/dist/components/Timeline/Timeline.d.ts +55 -0
  52. package/dist/components/Timeline/index.d.ts +2 -0
  53. package/dist/components/Tooltip/Tooltip.d.ts +46 -0
  54. package/dist/components/Tooltip/index.d.ts +2 -0
  55. package/dist/components/TreeView/RichTreeView.d.ts +28 -0
  56. package/dist/components/TreeView/TreeView.d.ts +31 -0
  57. package/dist/components/TreeView/index.d.ts +4 -0
  58. package/dist/index.cjs +73 -38
  59. package/dist/index.cjs.map +1 -1
  60. package/dist/index.d.ts +22 -0
  61. package/dist/index.js +8579 -4711
  62. package/dist/index.js.map +1 -1
  63. package/package.json +20 -17
@@ -0,0 +1,32 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ import * as AccordionPrimitive from '@radix-ui/react-accordion';
3
+ type RootSingle = ComponentPropsWithoutRef<typeof AccordionPrimitive.Root> & {
4
+ type: 'single';
5
+ };
6
+ type RootMultiple = ComponentPropsWithoutRef<typeof AccordionPrimitive.Root> & {
7
+ type: 'multiple';
8
+ };
9
+ export type AccordionProps = (RootSingle | RootMultiple) & {
10
+ variant?: 'plain' | 'bordered' | 'separated';
11
+ };
12
+ export declare const Accordion: import("react").ForwardRefExoticComponent<((Omit<AccordionPrimitive.AccordionSingleProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
13
+ type: "single";
14
+ } & {
15
+ variant?: "plain" | "bordered" | "separated";
16
+ }) | (Omit<AccordionPrimitive.AccordionMultipleProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
17
+ type: "multiple";
18
+ } & {
19
+ variant?: "plain" | "bordered" | "separated";
20
+ })) & import("react").RefAttributes<HTMLDivElement>>;
21
+ export type AccordionItemProps = ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>;
22
+ export declare const AccordionItem: import("react").ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionItemProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
23
+ export interface AccordionTriggerProps extends ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger> {
24
+ /** Optional leading icon in the trigger row. */
25
+ icon?: ReactNode;
26
+ /** Hide the chevron indicator. */
27
+ hideIndicator?: boolean;
28
+ }
29
+ export declare const AccordionTrigger: import("react").ForwardRefExoticComponent<AccordionTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
30
+ export type AccordionContentProps = ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>;
31
+ export declare const AccordionContent: import("react").ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
32
+ export {};
@@ -0,0 +1,2 @@
1
+ export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from './Accordion';
2
+ export type { AccordionProps, AccordionItemProps, AccordionTriggerProps, AccordionContentProps } from './Accordion';
@@ -0,0 +1,19 @@
1
+ import type { AutocompleteProps } from './Autocomplete.types';
2
+ /**
3
+ * Searchable combobox. Single or multi-select. Built on @radix-ui/react-popover
4
+ * for positioning + cmdk for filter / keyboard nav. Replaces MUI's
5
+ * `Autocomplete` with a more compact API.
6
+ *
7
+ * @example
8
+ * <Autocomplete
9
+ * options={[
10
+ * { value: 'eng', label: 'Engineering', group: 'Departments' },
11
+ * { value: 'des', label: 'Design', group: 'Departments' },
12
+ * ]}
13
+ * placeholder="Pick a department"
14
+ * onValueChange={(v) => console.log(v)}
15
+ * />
16
+ *
17
+ * <Autocomplete multiple options={…} placeholder="Pick attendees" />
18
+ */
19
+ export declare const Autocomplete: import("react").ForwardRefExoticComponent<AutocompleteProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,71 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface AutocompleteOption {
3
+ /** Stable identifier — what gets stored in `value`. */
4
+ value: string;
5
+ /** Visible label. */
6
+ label: string;
7
+ /** Optional group heading. Options with the same `group` cluster together. */
8
+ group?: string;
9
+ /** Disable selection of this option. */
10
+ disabled?: boolean;
11
+ /** Right-aligned secondary text (e.g. department, hint). */
12
+ hint?: ReactNode;
13
+ /** Leading icon node (overrides the avatar character). */
14
+ icon?: ReactNode;
15
+ }
16
+ export type AutocompleteSize = 'sm' | 'md' | 'lg';
17
+ export type AutocompleteColor = 'primary' | 'danger' | 'warning' | 'success';
18
+ interface AutocompleteBase {
19
+ /** Flat list of options. */
20
+ options: AutocompleteOption[];
21
+ /** Trigger placeholder when nothing is selected. */
22
+ placeholder?: string;
23
+ /** Search input placeholder inside the dropdown. */
24
+ searchPlaceholder?: string;
25
+ /** Empty-state when no options match the search. */
26
+ emptyText?: ReactNode;
27
+ /** Show a loading spinner inside the dropdown. */
28
+ loading?: boolean;
29
+ /** Loading-state text. */
30
+ loadingText?: ReactNode;
31
+ /** Trigger size. */
32
+ size?: AutocompleteSize;
33
+ /** Validation color on the trigger. */
34
+ color?: AutocompleteColor;
35
+ /** Disable the entire control. */
36
+ disabled?: boolean;
37
+ /** Show a clear button when something is selected. */
38
+ clearable?: boolean;
39
+ /** Field-threading: id forwarded to the trigger. */
40
+ id?: string;
41
+ /** Field-threading: forwarded ARIA. */
42
+ 'aria-invalid'?: boolean;
43
+ /** Field-threading: forwarded ARIA. */
44
+ 'aria-describedby'?: string;
45
+ /** Accessible label when no `<Field>` wraps the control. */
46
+ 'aria-label'?: string;
47
+ /** Custom className on the trigger. */
48
+ className?: string;
49
+ }
50
+ export interface AutocompleteSingleProps extends AutocompleteBase {
51
+ multiple?: false;
52
+ /** Controlled selected value. */
53
+ value?: string | null;
54
+ /** Uncontrolled initial value. */
55
+ defaultValue?: string | null;
56
+ /** Fires on selection change. */
57
+ onValueChange?: (value: string | null) => void;
58
+ }
59
+ export interface AutocompleteMultipleProps extends AutocompleteBase {
60
+ multiple: true;
61
+ /** Controlled selected values. */
62
+ value?: string[];
63
+ /** Uncontrolled initial values. */
64
+ defaultValue?: string[];
65
+ /** Fires on selection change. */
66
+ onValueChange?: (value: string[]) => void;
67
+ /** Cap on how many can be selected. */
68
+ maxItems?: number;
69
+ }
70
+ export type AutocompleteProps = AutocompleteSingleProps | AutocompleteMultipleProps;
71
+ export {};
@@ -0,0 +1,2 @@
1
+ export { Autocomplete } from './Autocomplete';
2
+ export type { AutocompleteOption, AutocompleteProps, AutocompleteSingleProps, AutocompleteMultipleProps, AutocompleteSize, AutocompleteColor, } from './Autocomplete.types';
@@ -0,0 +1,21 @@
1
+ import type { HTMLAttributes, ReactNode } from 'react';
2
+ export type BadgeColor = 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'neutral';
3
+ export type BadgePlacement = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
4
+ export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
5
+ /** Numeric count shown in the indicator. */
6
+ count?: number;
7
+ /** Render a small dot instead of a number. */
8
+ dot?: boolean;
9
+ /** Cap displayed count; values above show `{max}+`. Default 99. */
10
+ max?: number;
11
+ /** Show the indicator even when count is 0. Default false. */
12
+ showZero?: boolean;
13
+ /** Semantic color. Default `'danger'`. */
14
+ color?: BadgeColor;
15
+ /** Corner the indicator anchors to (ignored when standalone). Default `'top-right'`. */
16
+ placement?: BadgePlacement;
17
+ /** Render the indicator inline with no anchored child. */
18
+ standalone?: boolean;
19
+ children?: ReactNode;
20
+ }
21
+ export declare const Badge: import("react").ForwardRefExoticComponent<BadgeProps & import("react").RefAttributes<HTMLSpanElement>>;
@@ -0,0 +1,2 @@
1
+ export { Badge } from './Badge';
2
+ export type { BadgeProps, BadgeColor, BadgePlacement } from './Badge';
@@ -0,0 +1,14 @@
1
+ import type { HTMLAttributes, ReactNode } from 'react';
2
+ export interface BreadcrumbItem {
3
+ label: ReactNode;
4
+ href?: string;
5
+ /** Custom render — e.g. `<Link>`. Receives the rendered label. */
6
+ render?: (label: ReactNode) => ReactNode;
7
+ }
8
+ export interface BreadcrumbProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
9
+ items: BreadcrumbItem[];
10
+ /** Separator node between items. Default: chevron. */
11
+ separator?: ReactNode;
12
+ size?: 'sm' | 'md';
13
+ }
14
+ export declare const Breadcrumb: import("react").ForwardRefExoticComponent<BreadcrumbProps & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,2 @@
1
+ export { Breadcrumb } from './Breadcrumb';
2
+ export type { BreadcrumbProps, BreadcrumbItem } from './Breadcrumb';
@@ -0,0 +1,31 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface BarSeries {
3
+ /** Key into each datum for this series' value. */
4
+ key: string;
5
+ /** Legend / tooltip label. Defaults to `key`. */
6
+ label?: string;
7
+ /** Override the series color. */
8
+ color?: string;
9
+ }
10
+ export interface BarChartProps<D extends Record<string, unknown> = Record<string, unknown>> {
11
+ data: D[];
12
+ /** Key for the category label on the x-axis. */
13
+ xKey: string;
14
+ series: BarSeries[];
15
+ height?: number;
16
+ /** Stack the series instead of grouping them side by side. */
17
+ stacked?: boolean;
18
+ grid?: boolean;
19
+ legend?: boolean;
20
+ /** Format y-axis tick values. */
21
+ yTickFormatter?: (value: number) => string;
22
+ /** Format x-axis category labels. */
23
+ xTickFormatter?: (value: string) => string;
24
+ /** Custom tooltip body for a hovered category. */
25
+ renderTooltip?: (params: {
26
+ label: string;
27
+ datum: D;
28
+ }) => ReactNode;
29
+ className?: string;
30
+ }
31
+ export declare function BarChart<D extends Record<string, unknown>>({ data, xKey, series, height, stacked, grid, legend, yTickFormatter, xTickFormatter, renderTooltip, className, }: BarChartProps<D>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { BarSeries } from './BarChart';
3
+ export interface LineChartProps<D extends Record<string, unknown> = Record<string, unknown>> {
4
+ data: D[];
5
+ xKey: string;
6
+ series: BarSeries[];
7
+ height?: number;
8
+ /** Fill the area under each line. */
9
+ area?: boolean;
10
+ /** Stack the series (area charts). */
11
+ stacked?: boolean;
12
+ /** Show point markers. */
13
+ dots?: boolean;
14
+ grid?: boolean;
15
+ legend?: boolean;
16
+ yTickFormatter?: (value: number) => string;
17
+ xTickFormatter?: (value: string) => string;
18
+ renderTooltip?: (params: {
19
+ label: string;
20
+ datum: D;
21
+ }) => ReactNode;
22
+ className?: string;
23
+ }
24
+ export declare function LineChart<D extends Record<string, unknown>>(props: LineChartProps<D>): import("react/jsx-runtime").JSX.Element;
25
+ export declare function AreaChart<D extends Record<string, unknown>>(props: LineChartProps<D>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface PieDatum {
3
+ label: string;
4
+ value: number;
5
+ color?: string;
6
+ }
7
+ export interface PieChartProps {
8
+ data: PieDatum[];
9
+ height?: number;
10
+ /** Inner radius as a fraction of the outer radius (0 = pie, 0.6 = donut). */
11
+ innerRadius?: number;
12
+ legend?: boolean;
13
+ /** Custom tooltip body for a hovered slice. */
14
+ renderTooltip?: (params: {
15
+ datum: PieDatum;
16
+ percent: number;
17
+ }) => ReactNode;
18
+ /** Center label (e.g. a total) for donut charts. */
19
+ centerLabel?: ReactNode;
20
+ className?: string;
21
+ }
22
+ export declare function PieChart({ data, height, innerRadius, legend, renderTooltip, centerLabel, className, }: PieChartProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface ResponsiveContainerProps {
3
+ /** Chart height in px. */
4
+ height?: number;
5
+ children: ReactNode;
6
+ className?: string;
7
+ }
8
+ /**
9
+ * Sizing wrapper kept for `recharts` compatibility. Canny charts already fill
10
+ * their parent's width; this passes `height` down and stretches to 100% width.
11
+ */
12
+ export declare function ResponsiveContainer({ height, children, className }: ResponsiveContainerProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import type { RefObject } from 'react';
2
+ /** Default palette — token-driven series colors, cycled by index. */
3
+ export declare const CHART_COLORS: string[];
4
+ export declare function seriesColor(index: number, explicit?: string): string;
5
+ /**
6
+ * Measures the host element's width with a ResizeObserver and returns a fluid
7
+ * width. Falls back to `fallback` when measurement is unavailable (SSR/jsdom).
8
+ */
9
+ export declare function useChartWidth(fallback?: number): [RefObject<HTMLDivElement | null>, number];
10
+ /** "Nice" max + evenly spaced ticks for a [0, max] axis. */
11
+ export declare function niceTicks(max: number, count?: number): {
12
+ max: number;
13
+ ticks: number[];
14
+ };
15
+ /** SVG path for a (possibly donut) pie slice. Angles in radians, 0 at 12 o'clock. */
16
+ export declare function arcPath(cx: number, cy: number, rOuter: number, rInner: number, startAngle: number, endAngle: number): string;
@@ -0,0 +1,9 @@
1
+ export { BarChart } from './BarChart';
2
+ export type { BarChartProps, BarSeries } from './BarChart';
3
+ export { LineChart, AreaChart } from './LineChart';
4
+ export type { LineChartProps } from './LineChart';
5
+ export { PieChart } from './PieChart';
6
+ export type { PieChartProps, PieDatum } from './PieChart';
7
+ export { ResponsiveContainer } from './ResponsiveContainer';
8
+ export type { ResponsiveContainerProps } from './ResponsiveContainer';
9
+ export { CHART_COLORS } from './chartUtils';
@@ -0,0 +1,37 @@
1
+ import type { HTMLAttributes, MouseEventHandler, ReactNode } from 'react';
2
+ export type ChipColor = 'default' | 'primary' | 'success' | 'info' | 'warning' | 'danger';
3
+ export type ChipSize = 'sm' | 'md';
4
+ export type ChipVariant = 'soft' | 'outline' | 'solid';
5
+ export interface ChipProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'onSelect'> {
6
+ /** Color/variant tone. Default: `default`. */
7
+ color?: ChipColor;
8
+ /** Visual style. Default: `soft`. */
9
+ variant?: ChipVariant;
10
+ /** Size preset. Default: `md`. */
11
+ size?: ChipSize;
12
+ /** Leading icon or avatar node. */
13
+ icon?: ReactNode;
14
+ /** Avatar node (rendered before icon if both supplied). */
15
+ avatar?: ReactNode;
16
+ /** When provided, renders an X button that calls this. */
17
+ onDelete?: MouseEventHandler<HTMLButtonElement>;
18
+ /** Accessible label for the delete button. Default: `Remove`. */
19
+ deleteLabel?: string;
20
+ /** Make the chip itself clickable (becomes role=button). */
21
+ onClick?: MouseEventHandler<HTMLSpanElement>;
22
+ /** Disabled visual + non-interactive. */
23
+ disabled?: boolean;
24
+ /** The chip's text/content. */
25
+ children: ReactNode;
26
+ }
27
+ /**
28
+ * Compact label primitive for tags, statuses, filter pills, and selected items.
29
+ * Six color tones × three variants. Optional leading icon/avatar and trailing
30
+ * delete button.
31
+ *
32
+ * @example
33
+ * <Chip color="success">Active</Chip>
34
+ * <Chip color="primary" variant="outline" onDelete={() => …}>Engineering</Chip>
35
+ * <Chip avatar={<Avatar size="xs">PS</Avatar>}>Premkumar S.</Chip>
36
+ */
37
+ export declare const Chip: import("react").ForwardRefExoticComponent<ChipProps & import("react").RefAttributes<HTMLSpanElement>>;
@@ -0,0 +1,2 @@
1
+ export { Chip } from './Chip';
2
+ export type { ChipProps, ChipColor, ChipSize, ChipVariant } from './Chip';
@@ -0,0 +1,31 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface ConfirmDialogProps {
3
+ /** Controlled open state. */
4
+ open: boolean;
5
+ /** Called with the next open state (e.g. on Esc, backdrop, or cancel). */
6
+ onOpenChange: (open: boolean) => void;
7
+ /** Dialog heading. */
8
+ title: ReactNode;
9
+ /** Body copy. Ignored when `children` is provided. */
10
+ message?: ReactNode;
11
+ /** Custom body; overrides `message`. */
12
+ children?: ReactNode;
13
+ /** Confirm button label. Default `'Confirm'`. */
14
+ confirmLabel?: string;
15
+ /** Cancel button label. Default `'Cancel'`. */
16
+ cancelLabel?: string;
17
+ /** Render the confirm button in the danger color. */
18
+ danger?: boolean;
19
+ /** Show a spinner on confirm and disable both buttons. */
20
+ loading?: boolean;
21
+ /** Fired when the confirm button is clicked. */
22
+ onConfirm: () => void;
23
+ /** Fired when the cancel button is clicked (before close). */
24
+ onCancel?: () => void;
25
+ className?: string;
26
+ }
27
+ /**
28
+ * ConfirmDialog — a small Dialog preset for destructive / confirmation prompts.
29
+ * Composes the base `Dialog` and `Button`.
30
+ */
31
+ export declare function ConfirmDialog({ open, onOpenChange, title, message, children, confirmLabel, cancelLabel, danger, loading, onConfirm, onCancel, className, }: ConfirmDialogProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export { ConfirmDialog } from './ConfirmDialog';
2
+ export type { ConfirmDialogProps } from './ConfirmDialog';
3
+ export { useConfirm } from './useConfirm';
4
+ export type { ConfirmOptions } from './useConfirm';
@@ -0,0 +1,16 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface ConfirmOptions {
3
+ title: ReactNode;
4
+ message?: ReactNode;
5
+ confirmLabel?: string;
6
+ cancelLabel?: string;
7
+ danger?: boolean;
8
+ }
9
+ /**
10
+ * Imperative confirmation. Render `confirmDialog` once in the tree, then
11
+ * `await confirm({ title, message })` to get a boolean.
12
+ */
13
+ export declare function useConfirm(): {
14
+ confirm: (options: ConfirmOptions) => Promise<boolean>;
15
+ confirmDialog: import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null;
16
+ };
@@ -0,0 +1,69 @@
1
+ import type { ReactElement, ReactNode, Ref } from 'react';
2
+ export type DataTableAlign = 'left' | 'center' | 'right';
3
+ export type RowId = string | number;
4
+ export interface DataTableColumn<R = Record<string, unknown>> {
5
+ /** Key into the row (and the sort field). Use `renderCell` for non-primitive values. */
6
+ field: string;
7
+ /** Column header text. Defaults to `field`. */
8
+ headerName?: string;
9
+ /** Fixed width in px. */
10
+ width?: number;
11
+ /** Proportional width (flex-grow). Ignored when `width` is set. */
12
+ flex?: number;
13
+ /** Cell text alignment. */
14
+ align?: DataTableAlign;
15
+ /** Header text alignment. Defaults to `align`. */
16
+ headerAlign?: DataTableAlign;
17
+ /** Allow sorting on this column. */
18
+ sortable?: boolean;
19
+ /** Allow drag-to-resize on this column. Default `true`. */
20
+ resizable?: boolean;
21
+ /** Custom cell renderer. */
22
+ renderCell?: (params: {
23
+ row: R;
24
+ value: unknown;
25
+ field: string;
26
+ }) => ReactNode;
27
+ /** Derive the cell value from the row instead of `row[field]`. */
28
+ valueGetter?: (params: {
29
+ row: R;
30
+ field: string;
31
+ }) => unknown;
32
+ }
33
+ export interface DataTableSort {
34
+ field: string;
35
+ sort: 'asc' | 'desc';
36
+ }
37
+ export interface DataTablePaginationModel {
38
+ /** Zero-based page index. */
39
+ page: number;
40
+ pageSize: number;
41
+ }
42
+ export interface DataTableProps<R = Record<string, unknown>> {
43
+ columns: DataTableColumn<R>[];
44
+ rows: R[];
45
+ /** Stable id for a row. Defaults to `row.id`. */
46
+ getRowId?: (row: R) => RowId;
47
+ /** Replace rows with skeleton placeholders. */
48
+ loading?: boolean;
49
+ /** Total server-side row count — enables the pagination footer. */
50
+ rowCount?: number;
51
+ paginationModel?: DataTablePaginationModel;
52
+ onPaginationModelChange?: (model: DataTablePaginationModel) => void;
53
+ /** Show a leading checkbox column. */
54
+ checkboxSelection?: boolean;
55
+ rowSelectionModel?: RowId[];
56
+ onRowSelectionModelChange?: (ids: RowId[]) => void;
57
+ /** Controlled sort. Header clicks emit `onSortModelChange` (server-driven). */
58
+ sortModel?: DataTableSort | null;
59
+ onSortModelChange?: (sort: DataTableSort | null) => void;
60
+ onRowClick?: (row: R) => void;
61
+ /** Empty-state content. */
62
+ noRowsLabel?: ReactNode;
63
+ /** Turn off column resizing for every column. */
64
+ disableColumnResize?: boolean;
65
+ className?: string;
66
+ }
67
+ export declare const DataTable: <R = Record<string, unknown>>(props: DataTableProps<R> & {
68
+ ref?: Ref<HTMLDivElement>;
69
+ }) => ReactElement;
@@ -0,0 +1,2 @@
1
+ export { DataTable } from './DataTable';
2
+ export type { DataTableProps, DataTableColumn, DataTableSort, DataTablePaginationModel, DataTableAlign, RowId, } from './DataTable';
@@ -0,0 +1,34 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ import * as RadixDialog from '@radix-ui/react-dialog';
3
+ export type DialogSize = 'sm' | 'md' | 'lg' | 'xl' | 'full';
4
+ export interface DialogProps extends ComponentPropsWithoutRef<typeof RadixDialog.Root> {
5
+ /** Title rendered as the visible h2. Required for accessibility. */
6
+ title: ReactNode;
7
+ /** Optional descriptive subhead under the title. */
8
+ description?: ReactNode;
9
+ /** Body content (forms, copy, lists). */
10
+ children?: ReactNode;
11
+ /** Footer node (typically a Button row). */
12
+ footer?: ReactNode;
13
+ /** Width preset. Default: `md`. */
14
+ size?: DialogSize;
15
+ /** Hide the built-in X close button. */
16
+ hideClose?: boolean;
17
+ /** Extra className on the dialog content. */
18
+ className?: string;
19
+ }
20
+ /**
21
+ * Modal dialog built on @radix-ui/react-dialog. Includes a backdrop, focus trap,
22
+ * Esc-to-close, scroll lock, and an accessible title/description out of the box.
23
+ *
24
+ * @example
25
+ * const [open, setOpen] = useState(false);
26
+ * <Dialog open={open} onOpenChange={setOpen} title="Confirm delete">
27
+ * This action can't be undone.
28
+ * </Dialog>
29
+ */
30
+ export declare const Dialog: import("react").ForwardRefExoticComponent<DialogProps & import("react").RefAttributes<HTMLDivElement>>;
31
+ /** Trigger button to open a Dialog when wired with a controlled root. */
32
+ export declare const DialogTrigger: import("react").ForwardRefExoticComponent<RadixDialog.DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
33
+ /** Close button — typically used inside the body or footer. */
34
+ export declare const DialogClose: import("react").ForwardRefExoticComponent<RadixDialog.DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,2 @@
1
+ export { Dialog, DialogTrigger, DialogClose } from './Dialog';
2
+ export type { DialogProps, DialogSize } from './Dialog';
@@ -0,0 +1,35 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ import * as RadixDialog from '@radix-ui/react-dialog';
3
+ export type DrawerSide = 'left' | 'right' | 'top' | 'bottom';
4
+ export type DrawerSize = 'sm' | 'md' | 'lg' | 'xl';
5
+ export interface DrawerProps extends ComponentPropsWithoutRef<typeof RadixDialog.Root> {
6
+ /** Visible heading for the drawer. Required for AT. */
7
+ title: ReactNode;
8
+ /** Optional subhead under the title. */
9
+ description?: ReactNode;
10
+ /** Body content. */
11
+ children?: ReactNode;
12
+ /** Footer (typically Buttons). */
13
+ footer?: ReactNode;
14
+ /** Edge the drawer slides in from. Default: `right`. */
15
+ side?: DrawerSide;
16
+ /** Width preset (for left/right) or height preset (for top/bottom). Default: `md`. */
17
+ size?: DrawerSize;
18
+ /** Hide the built-in X close button. */
19
+ hideClose?: boolean;
20
+ /** Extra className on the drawer content. */
21
+ className?: string;
22
+ }
23
+ /**
24
+ * Off-canvas drawer / sheet. Slides in from any edge. Built on
25
+ * @radix-ui/react-dialog so it gets focus trapping, Esc-to-close, scroll
26
+ * lock, and accessibility for free.
27
+ *
28
+ * @example
29
+ * <Drawer open={open} onOpenChange={setOpen} side="right" title="Settings">
30
+ * <SettingsForm />
31
+ * </Drawer>
32
+ */
33
+ export declare const Drawer: import("react").ForwardRefExoticComponent<DrawerProps & import("react").RefAttributes<HTMLDivElement>>;
34
+ export declare const DrawerTrigger: import("react").ForwardRefExoticComponent<RadixDialog.DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
35
+ export declare const DrawerClose: import("react").ForwardRefExoticComponent<RadixDialog.DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,2 @@
1
+ export { Drawer, DrawerTrigger, DrawerClose } from './Drawer';
2
+ export type { DrawerProps, DrawerSide, DrawerSize } from './Drawer';
@@ -0,0 +1,19 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { FileRejection, UseFileDropOptions } from './useFileDrop';
3
+ export interface FileUploaderProps extends Omit<UseFileDropOptions, 'onDrop' | 'onDropAccepted' | 'onDropRejected'> {
4
+ /** Fired with `(accepted, rejected)` after each drop or browse. */
5
+ onDrop?: (accepted: File[], rejected: FileRejection[]) => void;
6
+ /** Primary call-to-action line. */
7
+ label?: ReactNode;
8
+ /** Secondary hint under the label (e.g. accepted types / max size). */
9
+ hint?: ReactNode;
10
+ /** Replace the leading icon. */
11
+ icon?: ReactNode;
12
+ /** Custom body; overrides the default icon + text. */
13
+ children?: ReactNode;
14
+ /** Browse-button label. Set to `false` to hide the button. */
15
+ buttonLabel?: ReactNode | false;
16
+ size?: 'sm' | 'md';
17
+ className?: string;
18
+ }
19
+ export declare const FileUploader: import("react").ForwardRefExoticComponent<FileUploaderProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,4 @@
1
+ export { FileUploader } from './FileUploader';
2
+ export type { FileUploaderProps } from './FileUploader';
3
+ export { useFileDrop } from './useFileDrop';
4
+ export type { UseFileDropOptions, FileRejection, FileError, FileRejectionCode, AcceptProp, } from './useFileDrop';