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
@@ -0,0 +1,94 @@
1
+ import type { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
2
+ /**
3
+ * Explicit stand-ins for the Radix prop shapes we re-expose.
4
+ *
5
+ * The runtime bundle inlines Radix (see vite.config.ts — only React is
6
+ * external), so consumers never install `@radix-ui/*`. If a public type were
7
+ * derived from a Radix type (`ComponentPropsWithoutRef<typeof Radix.Root>`),
8
+ * the emitted `.d.ts` would `import '@radix-ui/…'` and every prop on that
9
+ * component would silently resolve to `unknown` for anyone who doesn't happen
10
+ * to have Radix installed. Declaring the props here keeps `dist/index.d.ts`
11
+ * self-contained.
12
+ *
13
+ * Keep these in sync with the Radix version pinned in devDependencies.
14
+ */
15
+ /** Render into the child element instead of the primitive's own DOM node. */
16
+ export interface AsChildProps {
17
+ /** Merge props onto the single child element rather than rendering a wrapper. */
18
+ asChild?: boolean;
19
+ }
20
+ /** Reading direction, accepted by most Radix roots. */
21
+ export type Direction = 'ltr' | 'rtl';
22
+ /** Side a floating panel prefers relative to its trigger. */
23
+ export type PopperSide = 'top' | 'right' | 'bottom' | 'left';
24
+ /** Alignment of a floating panel along its trigger's edge. */
25
+ export type PopperAlign = 'start' | 'center' | 'end';
26
+ /** A button-like trigger that can defer rendering to its child. */
27
+ export type TriggerProps = ButtonHTMLAttributes<HTMLButtonElement> & AsChildProps;
28
+ /** Positioning and dismissal props shared by popper-based content panels. */
29
+ export interface PopperContentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'dir'>, AsChildProps {
30
+ /** Preferred side relative to the trigger. */
31
+ side?: PopperSide;
32
+ /** Distance in px from the trigger. */
33
+ sideOffset?: number;
34
+ /** Alignment along the trigger's edge. */
35
+ align?: PopperAlign;
36
+ /** Offset in px along the alignment axis. */
37
+ alignOffset?: number;
38
+ /** Flip to the opposite side when there isn't room. Default: true. */
39
+ avoidCollisions?: boolean;
40
+ /** Padding kept between the panel and the viewport edge. */
41
+ collisionPadding?: number | Partial<Record<PopperSide, number>>;
42
+ /** Element(s) treated as the collision boundary. */
43
+ collisionBoundary?: Element | null | Array<Element | null>;
44
+ /** How to behave when the trigger is fully hidden. */
45
+ hideWhenDetached?: boolean;
46
+ /** Keep mounted so animation libraries can control presence. */
47
+ forceMount?: true;
48
+ /** Fires on Escape. Call `preventDefault()` to keep the panel open. */
49
+ onEscapeKeyDown?: (event: KeyboardEvent) => void;
50
+ /** Fires on pointer down outside the panel. */
51
+ onPointerDownOutside?: (event: Event) => void;
52
+ /** Fires on focus or pointer interaction outside the panel. */
53
+ onInteractOutside?: (event: Event) => void;
54
+ /** Fires when focus moves outside the panel. */
55
+ onFocusOutside?: (event: Event) => void;
56
+ /** Fires when auto-focus would move into the panel on open. */
57
+ onOpenAutoFocus?: (event: Event) => void;
58
+ /** Fires when auto-focus would return to the trigger on close. */
59
+ onCloseAutoFocus?: (event: Event) => void;
60
+ }
61
+ /** Open/close state shared by dialog-, popover- and menu-style roots. */
62
+ export interface OpenStateProps {
63
+ /** Controlled open state. */
64
+ open?: boolean;
65
+ /** Uncontrolled initial open state. */
66
+ defaultOpen?: boolean;
67
+ /** Fires when the open state changes. */
68
+ onOpenChange?: (open: boolean) => void;
69
+ /** Whether the surface blocks interaction with the rest of the page. */
70
+ modal?: boolean;
71
+ /** Reading direction. */
72
+ dir?: Direction;
73
+ children?: ReactNode;
74
+ }
75
+ /** Single-value form control state (Select, RadioGroup, Tabs…). */
76
+ export interface ValueStateProps {
77
+ /** Controlled value. */
78
+ value?: string;
79
+ /** Uncontrolled initial value. */
80
+ defaultValue?: string;
81
+ /** Fires when the value changes. */
82
+ onValueChange?: (value: string) => void;
83
+ }
84
+ /** Form-participation props shared by the input-like primitives. */
85
+ export interface FormControlProps {
86
+ /** Name submitted with the enclosing form. */
87
+ name?: string;
88
+ /** Marks the control required for form validation. */
89
+ required?: boolean;
90
+ /** Disables interaction. */
91
+ disabled?: boolean;
92
+ /** Associates the control with a form by id. */
93
+ form?: string;
94
+ }
@@ -0,0 +1,22 @@
1
+ import type { CSSProperties, ReactElement } from 'react';
2
+ import type { SxProp } from '../components/Layout/sx';
3
+ export interface WithSxResult {
4
+ /** Merged class names (base classes + generated responsive-sx class). */
5
+ className: string;
6
+ /** Inline style (scalar sx + any explicit style; explicit style wins). */
7
+ style: CSSProperties | undefined;
8
+ /** Scoped <style> element for responsive sx, or null. Render inside the root. */
9
+ styleTag: ReactElement | null;
10
+ }
11
+ /**
12
+ * Resolve an `sx` prop for a component that isn't built on `Box`.
13
+ *
14
+ * Standardizes the same behavior `Box` has: scalar sx → inline style; responsive
15
+ * sx → a content-hashed class + a scoped `<style>` (SSR-safe). Pass the base
16
+ * class names last; the generated sx class is appended so it wins the cascade.
17
+ *
18
+ * @example
19
+ * const { className, style, styleTag } = withSx(sx, style, 'card', color);
20
+ * return <div className={className} style={style}>{styleTag}{children}</div>;
21
+ */
22
+ export declare function withSx(sx: SxProp | undefined, style: CSSProperties | undefined, ...classNames: (string | false | null | undefined)[]): WithSxResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canny-ui-react",
3
- "version": "5.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "React component wrappers for Canny-UI — Button, Input, Select, MultiSelect, Field, Layout primitives, and more. Built on Radix, motion, cmdk.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -20,7 +20,7 @@
20
20
  "peerDependencies": {
21
21
  "react": ">=18.0.0",
22
22
  "react-dom": ">=18.0.0",
23
- "canny-ui": "^5.0.0"
23
+ "canny-ui": "^6.1.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@radix-ui/react-accordion": "^1.2.12",
@@ -52,7 +52,7 @@
52
52
  "typescript": "^5.7.2",
53
53
  "vite": "^6.0.3",
54
54
  "vitest": "^2.1.8",
55
- "canny-ui": "5.0.0"
55
+ "canny-ui": "6.1.0"
56
56
  },
57
57
  "keywords": [
58
58
  "react",
@@ -80,9 +80,10 @@
80
80
  "registry": "https://registry.npmjs.org/"
81
81
  },
82
82
  "scripts": {
83
- "build": "vite build && tsc --emitDeclarationOnly",
83
+ "build": "vite build && tsc --emitDeclarationOnly && node scripts/check-dts-self-contained.mjs",
84
84
  "test": "vitest run",
85
85
  "test:watch": "vitest",
86
- "dev": "vite build --watch"
86
+ "dev": "vite build --watch",
87
+ "check:dts": "node scripts/check-dts-self-contained.mjs"
87
88
  }
88
89
  }