canny-ui-react 5.0.0 → 6.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.
Files changed (57) hide show
  1. package/dist/components/Accordion/Accordion.d.ts +45 -16
  2. package/dist/components/Alert/Alert.types.d.ts +7 -0
  3. package/dist/components/Autocomplete/Autocomplete.types.d.ts +11 -1
  4. package/dist/components/Avatar/Avatar.types.d.ts +7 -0
  5. package/dist/components/Badge/Badge.d.ts +7 -0
  6. package/dist/components/Breadcrumb/Breadcrumb.d.ts +7 -0
  7. package/dist/components/Button/Button.types.d.ts +7 -0
  8. package/dist/components/Button/ToggleButtonGroup.d.ts +39 -4
  9. package/dist/components/Card/Card.types.d.ts +7 -0
  10. package/dist/components/Charts/BarChart.d.ts +11 -1
  11. package/dist/components/Charts/LineChart.d.ts +10 -0
  12. package/dist/components/Charts/PieChart.d.ts +11 -1
  13. package/dist/components/Charts/ResponsiveContainer.d.ts +11 -2
  14. package/dist/components/Checkbox/Checkbox.d.ts +21 -3
  15. package/dist/components/Chip/Chip.d.ts +7 -0
  16. package/dist/components/ConfirmDialog/ConfirmDialog.d.ts +12 -2
  17. package/dist/components/DataTable/DataTable.d.ts +11 -1
  18. package/dist/components/DatePicker/DatePicker.types.d.ts +8 -0
  19. package/dist/components/Dialog/Dialog.d.ts +16 -4
  20. package/dist/components/Drawer/Drawer.d.ts +16 -4
  21. package/dist/components/Field/Field.d.ts +9 -1
  22. package/dist/components/FileUploader/FileUploader.d.ts +10 -1
  23. package/dist/components/FileUploader/useFileDrop.d.ts +29 -29
  24. package/dist/components/Input/Input.types.d.ts +8 -0
  25. package/dist/components/Layout/AspectRatio.d.ts +3 -0
  26. package/dist/components/Layout/Divider.d.ts +3 -0
  27. package/dist/components/Layout/Spacer.d.ts +5 -1
  28. package/dist/components/List/List.d.ts +7 -0
  29. package/dist/components/Menu/Menu.d.ts +34 -8
  30. package/dist/components/MultiSelect/MultiSelect.d.ts +12 -2
  31. package/dist/components/Navbar/Navbar.types.d.ts +7 -0
  32. package/dist/components/Pagination/Pagination.d.ts +9 -0
  33. package/dist/components/PanelGroup/PanelGroup.d.ts +7 -0
  34. package/dist/components/Popover/Popover.d.ts +17 -6
  35. package/dist/components/Progress/Progress.types.d.ts +13 -0
  36. package/dist/components/Radio/Radio.d.ts +24 -4
  37. package/dist/components/Scroll/Scroll.types.d.ts +7 -0
  38. package/dist/components/Select/Select.d.ts +27 -5
  39. package/dist/components/Sidebar/Sidebar.types.d.ts +7 -0
  40. package/dist/components/Skeleton/Skeleton.types.d.ts +7 -0
  41. package/dist/components/Slider/Slider.d.ts +7 -0
  42. package/dist/components/Stepper/Stepper.d.ts +7 -0
  43. package/dist/components/Switch/Switch.d.ts +20 -3
  44. package/dist/components/Tabs/Tabs.d.ts +19 -3
  45. package/dist/components/Text/Text.d.ts +7 -0
  46. package/dist/components/Textarea/Textarea.d.ts +7 -0
  47. package/dist/components/Timeline/Timeline.d.ts +7 -0
  48. package/dist/components/Toast/Toast.types.d.ts +8 -0
  49. package/dist/components/Tooltip/Tooltip.d.ts +33 -6
  50. package/dist/components/TreeView/TreeView.d.ts +8 -0
  51. package/dist/index.cjs +45 -45
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.js +7410 -6974
  54. package/dist/index.js.map +1 -1
  55. package/dist/utils/primitiveProps.d.ts +94 -0
  56. package/dist/utils/withSx.d.ts +22 -0
  57. package/package.json +6 -5
@@ -1,4 +1,5 @@
1
1
  import type { HTMLAttributes, ReactNode } from 'react';
2
+ import type { SxProp } from '../Layout/sx';
2
3
  export interface StepperStep {
3
4
  label: ReactNode;
4
5
  description?: ReactNode;
@@ -12,5 +13,11 @@ export interface StepperProps extends Omit<HTMLAttributes<HTMLOListElement>, 'ch
12
13
  size?: 'sm' | 'md';
13
14
  /** Fired when a previously-completed step is clicked. */
14
15
  onStepClick?: (index: number) => void;
16
+ /**
17
+ * One-off CSS, same as `Box`'s `sx`: each value may be a scalar or a
18
+ * responsive breakpoint map (`{ base, sm, md, lg, xl }`). Scalar-only sx
19
+ * merges into inline style; responsive sx injects a scoped class.
20
+ */
21
+ sx?: SxProp;
15
22
  }
16
23
  export declare const Stepper: import("react").ForwardRefExoticComponent<StepperProps & import("react").RefAttributes<HTMLOListElement>>;
@@ -1,8 +1,25 @@
1
- import type { ComponentPropsWithoutRef, ReactNode } from 'react';
2
- import * as RadixSwitch from '@radix-ui/react-switch';
3
- type SwitchRootProps = ComponentPropsWithoutRef<typeof RadixSwitch.Root>;
1
+ import type { ButtonHTMLAttributes, ReactNode } from 'react';
2
+ import type { FormControlProps } from '../../utils/primitiveProps';
3
+ import type { SxProp } from '../Layout/sx';
4
+ interface SwitchRootProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'onChange' | 'checked' | 'defaultChecked' | 'type'>, FormControlProps {
5
+ /** Controlled checked state. */
6
+ checked?: boolean;
7
+ /** Uncontrolled initial checked state. */
8
+ defaultChecked?: boolean;
9
+ /** Fires when the checked state changes. */
10
+ onCheckedChange?: (checked: boolean) => void;
11
+ /** Value submitted with the form when checked. Default: `'on'`. */
12
+ value?: string;
13
+ }
4
14
  export interface SwitchProps extends Omit<SwitchRootProps, 'children'> {
5
15
  children?: ReactNode;
16
+ /**
17
+ * One-off CSS, same as `Box`'s `sx`: each value may be a scalar or a
18
+ * responsive breakpoint map (`{ base, sm, md, lg, xl }`). Scalar-only sx
19
+ * merges into inline style; responsive sx injects a scoped class. Applied to
20
+ * the outer label wrapper, or the switch itself when there is no label.
21
+ */
22
+ sx?: SxProp;
6
23
  }
7
24
  export declare const Switch: import("react").ForwardRefExoticComponent<SwitchProps & import("react").RefAttributes<HTMLButtonElement>>;
8
25
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { ComponentPropsWithoutRef, ReactNode } from 'react';
2
- import * as RadixTabs from '@radix-ui/react-tabs';
2
+ import type { SxProp } from '../Layout/sx';
3
3
  export type TabsVariant = 'line' | 'pills' | 'segmented';
4
4
  export type TabsSize = 'sm' | 'md' | 'lg';
5
5
  /**
@@ -35,9 +35,19 @@ export interface TabsProps extends Omit<ComponentPropsWithoutRef<'div'>, 'dir'>
35
35
  variant?: TabsVariant;
36
36
  /** Size preset. Default: `md`. */
37
37
  size?: TabsSize;
38
+ /**
39
+ * One-off CSS, same as `Box`'s `sx`: each value may be a scalar or a
40
+ * responsive breakpoint map (`{ base, sm, md, lg, xl }`). Scalar-only sx
41
+ * merges into inline style; responsive sx injects a scoped class.
42
+ */
43
+ sx?: SxProp;
38
44
  }
39
45
  export declare const Tabs: import("react").ForwardRefExoticComponent<TabsProps & import("react").RefAttributes<HTMLDivElement>>;
40
- export declare const TabsList: import("react").ForwardRefExoticComponent<Omit<RadixTabs.TabsListProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
46
+ export interface TabsListProps extends ComponentPropsWithoutRef<'div'> {
47
+ /** Keep arrow-key navigation inside the list. Default: true. */
48
+ loop?: boolean;
49
+ }
50
+ export declare const TabsList: import("react").ForwardRefExoticComponent<TabsListProps & import("react").RefAttributes<HTMLDivElement>>;
41
51
  export interface TabsTriggerProps extends ComponentPropsWithoutRef<'button'> {
42
52
  /** Value identifying which panel this trigger activates. */
43
53
  value: string;
@@ -47,4 +57,10 @@ export interface TabsTriggerProps extends ComponentPropsWithoutRef<'button'> {
47
57
  badge?: ReactNode;
48
58
  }
49
59
  export declare const TabsTrigger: import("react").ForwardRefExoticComponent<TabsTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
50
- export declare const TabsContent: import("react").ForwardRefExoticComponent<Omit<RadixTabs.TabsContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
60
+ export interface TabsContentProps extends ComponentPropsWithoutRef<'div'> {
61
+ /** Value of the trigger that reveals this panel. */
62
+ value: string;
63
+ /** Keep mounted while hidden (useful for forms and animations). */
64
+ forceMount?: true;
65
+ }
66
+ export declare const TabsContent: import("react").ForwardRefExoticComponent<TabsContentProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,5 @@
1
1
  import type { ComponentPropsWithoutRef, ElementType, ForwardedRef, ReactElement } from 'react';
2
+ import type { SxProp } from '../Layout/sx';
2
3
  export type TextVariant = 'display' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'lead' | 'body' | 'small' | 'caption' | 'code' | 'kbd';
3
4
  export type TextWeight = 'regular' | 'medium' | 'semibold' | 'bold';
4
5
  export type TextAlign = 'left' | 'center' | 'right' | 'justify';
@@ -10,6 +11,12 @@ export type TextProps<E extends ElementType = ElementType> = Omit<ComponentProps
10
11
  align?: TextAlign;
11
12
  color?: TextColor;
12
13
  truncate?: boolean;
14
+ /**
15
+ * One-off CSS, same as `Box`'s `sx`: each value may be a scalar or a
16
+ * responsive breakpoint map (`{ base, sm, md, lg, xl }`). Scalar-only sx
17
+ * merges into inline style; responsive sx injects a scoped class.
18
+ */
19
+ sx?: SxProp;
13
20
  };
14
21
  /**
15
22
  * Text — typography primitive. `variant` picks the semantic element and the
@@ -1,4 +1,5 @@
1
1
  import type { TextareaHTMLAttributes } from 'react';
2
+ import type { SxProp } from '../Layout/sx';
2
3
  export type TextareaColor = 'primary' | 'danger' | 'warning' | 'success';
3
4
  export type TextareaSize = 'sm' | 'md' | 'lg';
4
5
  export interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> {
@@ -8,6 +9,12 @@ export interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaE
8
9
  autoGrow?: boolean;
9
10
  /** With autoGrow, limits how tall the textarea can get. Default 12. */
10
11
  maxRows?: number;
12
+ /**
13
+ * One-off CSS, same as `Box`'s `sx`: each value may be a scalar or a
14
+ * responsive breakpoint map (`{ base, sm, md, lg, xl }`). Scalar-only sx
15
+ * merges into inline style; responsive sx injects a scoped class.
16
+ */
17
+ sx?: SxProp;
11
18
  }
12
19
  /** Auto-growing textarea. Measures scrollHeight on every change to set height. */
13
20
  export declare const Textarea: import("react").ForwardRefExoticComponent<TextareaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -1,4 +1,5 @@
1
1
  import type { HTMLAttributes, ReactNode } from 'react';
2
+ import type { SxProp } from '../Layout/sx';
2
3
  export type TimelineDotColor = 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'neutral';
3
4
  /** Which side the content sits on relative to the central rail. */
4
5
  export type TimelinePosition = 'right' | 'left' | 'alternate';
@@ -13,6 +14,12 @@ export interface TimelineProps extends HTMLAttributes<HTMLOListElement> {
13
14
  orientation?: TimelineOrientation;
14
15
  /** Density preset. Default `'md'`. */
15
16
  size?: TimelineSize;
17
+ /**
18
+ * One-off CSS, same as `Box`'s `sx`: each value may be a scalar or a
19
+ * responsive breakpoint map (`{ base, sm, md, lg, xl }`). Scalar-only sx
20
+ * merges into inline style; responsive sx injects a scoped class.
21
+ */
22
+ sx?: SxProp;
16
23
  }
17
24
  export declare const Timeline: import("react").ForwardRefExoticComponent<TimelineProps & import("react").RefAttributes<HTMLOListElement>>;
18
25
  export type TimelineItemProps = HTMLAttributes<HTMLLIElement>;
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
+ import type { SxProp } from '../Layout/sx';
2
3
  export type ToastVariant = 'default' | 'success' | 'info' | 'warning' | 'danger' | 'loading';
3
4
  export type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
4
5
  export interface ToastOptions {
@@ -20,6 +21,12 @@ export interface ToastOptions {
20
21
  id?: string;
21
22
  /** Hide the close button. */
22
23
  dismissible?: boolean;
24
+ /**
25
+ * One-off CSS for this toast's root, same as `Box`'s `sx`: each value may be a
26
+ * scalar or a responsive breakpoint map (`{ base, sm, md, lg, xl }`).
27
+ * Scalar-only sx merges into inline style; responsive sx injects a scoped class.
28
+ */
29
+ sx?: SxProp;
23
30
  }
24
31
  export interface ToastInstance extends Required<Pick<ToastOptions, 'variant' | 'duration' | 'dismissible'>> {
25
32
  id: string;
@@ -28,6 +35,7 @@ export interface ToastInstance extends Required<Pick<ToastOptions, 'variant' | '
28
35
  action?: ReactNode;
29
36
  icon?: ReactNode | false;
30
37
  onDismiss?: () => void;
38
+ sx?: SxProp;
31
39
  /** Internal — flips to true when entering exit animation. */
32
40
  exiting?: boolean;
33
41
  }
@@ -1,5 +1,7 @@
1
- import type { ReactNode } from 'react';
2
- import * as RadixTooltip from '@radix-ui/react-tooltip';
1
+ import type { FC, ReactNode } from 'react';
2
+ import type { OpenStateProps, PopperContentProps, TriggerProps } from '../../utils/primitiveProps';
3
+ import type { CSSProperties } from 'react';
4
+ import type { SxProp } from '../Layout/sx';
3
5
  /**
4
6
  * Tooltip provider — wrap your app once. Controls the global delay so the
5
7
  * first tooltip in a group has a longer delay, then subsequent tooltips
@@ -10,7 +12,16 @@ import * as RadixTooltip from '@radix-ui/react-tooltip';
10
12
  * <App />
11
13
  * </TooltipProvider>
12
14
  */
13
- export declare const TooltipProvider: import("react").FC<RadixTooltip.TooltipProviderProps>;
15
+ export interface TooltipProviderProps {
16
+ /** Delay before the first tooltip in a group opens, in ms. Default: 700. */
17
+ delayDuration?: number;
18
+ /** Window in which subsequent tooltips open instantly, in ms. Default: 300. */
19
+ skipDelayDuration?: number;
20
+ /** Prevent the content itself from keeping the tooltip open on hover. */
21
+ disableHoverableContent?: boolean;
22
+ children?: ReactNode;
23
+ }
24
+ export declare const TooltipProvider: FC<TooltipProviderProps>;
14
25
  export interface TooltipProps {
15
26
  /** The element that triggers the tooltip on hover/focus. */
16
27
  children: ReactNode;
@@ -30,6 +41,14 @@ export interface TooltipProps {
30
41
  disabled?: boolean;
31
42
  /** Extra className on the popup. */
32
43
  contentClassName?: string;
44
+ /** Inline style on the tooltip bubble. */
45
+ contentStyle?: CSSProperties;
46
+ /**
47
+ * One-off CSS for the tooltip bubble, same as `Box`'s `sx`: each value may be
48
+ * a scalar or a responsive breakpoint map (`{ base, sm, md, lg, xl }`).
49
+ * Scalar-only sx merges into inline style; responsive sx injects a scoped class.
50
+ */
51
+ sx?: SxProp;
33
52
  }
34
53
  /**
35
54
  * Single-shot tooltip. Pass any element as `children` and it becomes the
@@ -41,6 +60,14 @@ export interface TooltipProps {
41
60
  * </Tooltip>
42
61
  */
43
62
  export declare const Tooltip: import("react").ForwardRefExoticComponent<TooltipProps & import("react").RefAttributes<HTMLDivElement>>;
44
- export declare const TooltipRoot: import("react").FC<RadixTooltip.TooltipProps>;
45
- export declare const TooltipTrigger: import("react").ForwardRefExoticComponent<RadixTooltip.TooltipTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
46
- export declare const TooltipContent: import("react").ForwardRefExoticComponent<Omit<RadixTooltip.TooltipContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
63
+ export interface TooltipRootProps extends Omit<OpenStateProps, 'modal'> {
64
+ /** Delay before opening, in ms. Overrides the provider default. */
65
+ delayDuration?: number;
66
+ /** Prevent the content itself from keeping the tooltip open on hover. */
67
+ disableHoverableContent?: boolean;
68
+ }
69
+ export declare const TooltipRoot: FC<TooltipRootProps>;
70
+ export type TooltipTriggerProps = TriggerProps;
71
+ export declare const TooltipTrigger: FC<TooltipTriggerProps>;
72
+ export type TooltipContentProps = PopperContentProps;
73
+ export declare const TooltipContent: import("react").ForwardRefExoticComponent<PopperContentProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,5 @@
1
1
  import type { HTMLAttributes, ReactNode } from 'react';
2
+ import type { SxProp } from '../Layout/sx';
2
3
  export interface TreeViewProps extends Omit<HTMLAttributes<HTMLUListElement>, 'onSelect'> {
3
4
  /** Controlled set of expanded item ids. */
4
5
  expandedIds?: string[];
@@ -16,6 +17,13 @@ export interface TreeViewProps extends Omit<HTMLAttributes<HTMLUListElement>, 'o
16
17
  onItemExpandToggle?: (id: string, expanded: boolean) => void;
17
18
  /** Auto folder/file icons for items without their own icon. Default `true`. */
18
19
  defaultIcons?: boolean;
20
+ /**
21
+ * One-off CSS, same as `Box`'s `sx`: each value may be a scalar or a
22
+ * responsive breakpoint map (`{ base, sm, md, lg, xl }`). Applied to the
23
+ * root tree container. Scalar-only sx merges into inline style; responsive
24
+ * sx injects a scoped class.
25
+ */
26
+ sx?: SxProp;
19
27
  }
20
28
  export declare const TreeView: import("react").ForwardRefExoticComponent<TreeViewProps & import("react").RefAttributes<HTMLUListElement>>;
21
29
  export interface TreeItemProps extends Omit<HTMLAttributes<HTMLLIElement>, 'id'> {