@cystackapp/ui 1.4.1 → 2.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 (201) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +77 -47
  3. package/dist/assets/background-pattern-grid.svg.js +7 -0
  4. package/dist/assets/empty-cloud.svg.js +5 -0
  5. package/dist/components/accordion/Accordion.d.ts +20 -0
  6. package/dist/components/accordion/Accordion.js +36 -0
  7. package/dist/components/accordion/AccordionTestStory.d.ts +3 -0
  8. package/dist/components/alert/Alert.d.ts +15 -0
  9. package/dist/components/alert/Alert.js +54 -0
  10. package/dist/components/avatar/Avatar.d.ts +13 -0
  11. package/dist/components/avatar/Avatar.js +64 -0
  12. package/dist/components/background-pattern/BackgroundPatternGrid.d.ts +1 -0
  13. package/dist/components/background-pattern/BackgroundPatternGrid.js +6 -0
  14. package/dist/components/badge/Badge.d.ts +1 -1
  15. package/dist/components/badge/Badge.js +3 -3
  16. package/dist/components/badge/BadgeTestStory.d.ts +1 -1
  17. package/dist/components/badge/variants/BadgeMore.d.ts +1 -1
  18. package/dist/components/badge/variants/BadgeMoreTestStory.d.ts +1 -1
  19. package/dist/components/badge/variants/BadgeTag.d.ts +1 -1
  20. package/dist/components/badge/variants/BadgeTag.js +1 -1
  21. package/dist/components/banner/Banner.d.ts +9 -0
  22. package/dist/components/banner/Banner.js +21 -0
  23. package/dist/components/breadcrumb/Breadcrumb.d.ts +13 -0
  24. package/dist/components/breadcrumb/Breadcrumb.js +36 -0
  25. package/dist/components/button/Button.d.ts +21 -0
  26. package/dist/components/button/Button.js +49 -0
  27. package/dist/components/button/ButtonLoader.d.ts +7 -0
  28. package/dist/components/button/ButtonLoader.js +44 -0
  29. package/dist/components/button/ButtonTestStory.d.ts +5 -0
  30. package/dist/components/button/button-variants.d.ts +13 -0
  31. package/dist/components/button/button-variants.js +58 -0
  32. package/dist/components/card/Card.d.ts +91 -0
  33. package/dist/components/card/Card.js +56 -0
  34. package/dist/components/card/Card.stories-ct.d.ts +1 -0
  35. package/dist/components/card/CardBody.d.ts +9 -0
  36. package/dist/components/card/CardBody.js +16 -0
  37. package/dist/components/card/CardHeader.d.ts +15 -0
  38. package/dist/components/card/CardHeader.js +79 -0
  39. package/dist/components/card/types.d.ts +1 -0
  40. package/dist/components/chart/chart-legend/ChartLegend.d.ts +38 -0
  41. package/dist/components/chart/chart-legend/ChartLegend.js +57 -0
  42. package/dist/components/chart/chart-legend/ChartLegendItem.d.ts +19 -0
  43. package/dist/components/chart/chart-legend/ChartLegendItem.js +30 -0
  44. package/dist/components/chart/chart-legend/types.d.ts +49 -0
  45. package/dist/components/chart/donut-chart/DonutChart.d.ts +55 -0
  46. package/dist/components/chart/donut-chart/DonutChart.js +110 -0
  47. package/dist/components/chart/donut-chart/DonutSegments.d.ts +25 -0
  48. package/dist/components/chart/donut-chart/DonutSegments.js +51 -0
  49. package/dist/components/chart/donut-chart/donut-tooltip.d.ts +20 -0
  50. package/dist/components/chart/donut-chart/donut-tooltip.js +37 -0
  51. package/dist/components/chart/types.d.ts +8 -0
  52. package/dist/components/checkbox/Checkbox.d.ts +6 -0
  53. package/dist/components/checkbox/Checkbox.js +72 -0
  54. package/dist/components/checkbox/CheckboxTestStory.d.ts +7 -0
  55. package/dist/components/collapsible/Collapsible.d.ts +21 -0
  56. package/dist/components/collapsible/Collapsible.js +50 -0
  57. package/dist/components/combobox/Combobox.d.ts +1 -1
  58. package/dist/components/divider/Divider.d.ts +9 -0
  59. package/dist/components/divider/Divider.js +28 -0
  60. package/dist/components/drawer/Drawer.d.ts +8 -0
  61. package/dist/components/drawer/Drawer.js +68 -0
  62. package/dist/components/dropdown/Dropdown.d.ts +45 -0
  63. package/dist/components/dropdown/Dropdown.js +133 -0
  64. package/dist/components/dropdown/DropdownMenu.d.ts +20 -0
  65. package/dist/components/dropdown/DropdownMenu.js +78 -0
  66. package/dist/components/dropdown/DropdownMenuItem.d.ts +13 -0
  67. package/dist/components/dropdown/DropdownMenuItem.js +49 -0
  68. package/dist/components/dropdown/DropdownTestStory.d.ts +5 -0
  69. package/dist/components/dropdown/dropdown-utils.d.ts +4 -0
  70. package/dist/components/dropdown/dropdown-utils.js +14 -0
  71. package/dist/components/dropdown/types.d.ts +48 -0
  72. package/dist/components/dropdown/use-dropdown-keyboard.d.ts +12 -0
  73. package/dist/components/dropdown/use-dropdown-keyboard.js +49 -0
  74. package/dist/components/empty-state/EmptyState.d.ts +26 -0
  75. package/dist/components/empty-state/EmptyState.js +36 -0
  76. package/dist/components/error-state/ErrorState.d.ts +1 -1
  77. package/dist/components/featured-icon/FeaturedIcon.d.ts +12 -0
  78. package/dist/components/featured-icon/FeaturedIcon.js +44 -0
  79. package/dist/components/form-field/FormField.d.ts +13 -0
  80. package/dist/components/form-field/FormField.js +21 -0
  81. package/dist/components/input/Input.d.ts +11 -0
  82. package/dist/components/input/Input.js +39 -0
  83. package/dist/components/keyboard-shortcut-label/KeyboardShortcutLabel.d.ts +8 -0
  84. package/dist/components/keyboard-shortcut-label/KeyboardShortcutLabel.js +18 -0
  85. package/dist/components/loading-state/Loader.d.ts +20 -0
  86. package/dist/components/loading-state/Loader.js +38 -0
  87. package/dist/components/loading-state/LoadingState.d.ts +15 -0
  88. package/dist/components/loading-state/LoadingState.js +47 -0
  89. package/dist/components/loading-state/locale/en.json.d.ts +6 -0
  90. package/dist/components/loading-state/locale/en.json.js +7 -0
  91. package/dist/components/loading-state/locale/vi.json.d.ts +6 -0
  92. package/dist/components/loading-state/locale/vi.json.js +7 -0
  93. package/dist/components/media/Media.d.ts +7 -0
  94. package/dist/components/media/Media.js +25 -0
  95. package/dist/components/modal/Modal.d.ts +9 -0
  96. package/dist/components/modal/Modal.js +68 -0
  97. package/dist/components/modal/helpers/HeaderIcon.d.ts +8 -0
  98. package/dist/components/modal/helpers/HeaderIcon.js +32 -0
  99. package/dist/components/modal/helpers/Title.d.ts +6 -0
  100. package/dist/components/modal/helpers/Title.js +9 -0
  101. package/dist/components/modal/helpers/circles-sm.svg.js +5 -0
  102. package/dist/components/modal/modal-context.d.ts +2 -0
  103. package/dist/components/modal/modal-context.js +9 -0
  104. package/dist/components/modal/use-click-outside-modal.d.ts +2 -0
  105. package/dist/components/modal/use-click-outside-modal.js +15 -0
  106. package/dist/components/notification/NotificationBanner.d.ts +9 -0
  107. package/dist/components/notification/NotificationBanner.js +97 -0
  108. package/dist/components/notification/icons.d.ts +5 -0
  109. package/dist/components/notification/icons.js +29 -0
  110. package/dist/components/notification/index.d.ts +4 -0
  111. package/dist/components/notification/index.js +26 -0
  112. package/dist/components/notification/locale/en.json.d.ts +8 -0
  113. package/dist/components/notification/locale/en.json.js +7 -0
  114. package/dist/components/notification/locale/vi.json.d.ts +8 -0
  115. package/dist/components/notification/locale/vi.json.js +7 -0
  116. package/dist/components/operating-system-icon/OperatingSystemIcon.d.ts +6 -0
  117. package/dist/components/operating-system-icon/OperatingSystemIcon.js +19 -0
  118. package/dist/components/operating-system-icon/assets/logo-android.svg.js +5 -0
  119. package/dist/components/operating-system-icon/assets/logo-apple.svg.js +5 -0
  120. package/dist/components/operating-system-icon/assets/logo-ubuntu.svg.js +5 -0
  121. package/dist/components/operating-system-icon/assets/logo-windows-10.svg.js +5 -0
  122. package/dist/components/page-title/PageTitle.d.ts +1 -1
  123. package/dist/components/popover/Popover.d.ts +1 -1
  124. package/dist/components/progress-bar/ProgressBar.d.ts +9 -0
  125. package/dist/components/progress-bar/ProgressBar.js +31 -0
  126. package/dist/components/radio/Radio.d.ts +4 -0
  127. package/dist/components/radio/Radio.js +55 -0
  128. package/dist/components/searchbox/Searchbox.d.ts +7 -0
  129. package/dist/components/searchbox/Searchbox.js +15 -0
  130. package/dist/components/select/Select.d.ts +11 -0
  131. package/dist/components/select/Select.js +44 -0
  132. package/dist/components/skeleton/Skeleton.d.ts +14 -0
  133. package/dist/components/skeleton/Skeleton.js +12 -0
  134. package/dist/components/switch/Switch.d.ts +1 -1
  135. package/dist/components/table/Table.d.ts +32 -0
  136. package/dist/components/table/Table.js +128 -0
  137. package/dist/components/table/TableActionButton.d.ts +15 -0
  138. package/dist/components/table/TableActionButton.js +50 -0
  139. package/dist/components/table/TableCell.d.ts +8 -0
  140. package/dist/components/table/TableCell.js +26 -0
  141. package/dist/components/table/TableHeader.d.ts +15 -0
  142. package/dist/components/table/TableHeader.js +36 -0
  143. package/dist/components/table/TableHeaderCell.d.ts +10 -0
  144. package/dist/components/table/TableHeaderCell.js +35 -0
  145. package/dist/components/table/TablePagination.d.ts +6 -0
  146. package/dist/components/table/TablePagination.js +69 -0
  147. package/dist/components/table/TableRow.d.ts +12 -0
  148. package/dist/components/table/TableRow.js +9 -0
  149. package/dist/components/table/expandable/ExpandableTable.d.ts +30 -0
  150. package/dist/components/table/expandable/ExpandableTable.js +156 -0
  151. package/dist/components/table/hooks/use-fit-page-height.d.ts +14 -0
  152. package/dist/components/table/hooks/use-fit-page-height.js +21 -0
  153. package/dist/components/table/hooks/use-row-selection.d.ts +27 -0
  154. package/dist/components/table/hooks/use-row-selection.js +35 -0
  155. package/dist/components/table/locale/en.json.d.ts +13 -0
  156. package/dist/components/table/locale/en.json.js +21 -0
  157. package/dist/components/table/locale/vi.json.d.ts +13 -0
  158. package/dist/components/table/locale/vi.json.js +21 -0
  159. package/dist/components/table/table-utils.d.ts +10 -0
  160. package/dist/components/table/table-utils.js +10 -0
  161. package/dist/components/table/types.d.ts +84 -0
  162. package/dist/components/tabs/Tabs.d.ts +27 -0
  163. package/dist/components/tabs/Tabs.js +75 -0
  164. package/dist/components/tabs/TabsTestStory.d.ts +4 -0
  165. package/dist/components/tags-input/TagsInput.d.ts +18 -0
  166. package/dist/components/tags-input/TagsInput.js +78 -0
  167. package/dist/components/tags-input/TagsInputTestStory.d.ts +3 -0
  168. package/dist/components/textarea/Textarea.d.ts +7 -0
  169. package/dist/components/textarea/Textarea.js +36 -0
  170. package/dist/components/toast/ToastSlice.d.ts +11 -0
  171. package/dist/components/toast/ToastSlice.js +103 -0
  172. package/dist/components/toast/icons.d.ts +8 -0
  173. package/dist/components/toast/icons.js +19 -0
  174. package/dist/components/toast/index.d.ts +4 -0
  175. package/dist/components/toast/index.js +35 -0
  176. package/dist/components/toast/types.d.ts +14 -0
  177. package/dist/components/toast/use-toast-list.d.ts +4 -0
  178. package/dist/components/toast/use-toast-list.js +27 -0
  179. package/dist/components/tooltip/Tooltip.d.ts +1 -1
  180. package/dist/filters/FilterDropdown.d.ts +9 -0
  181. package/dist/filters/FilterDropdown.js +57 -0
  182. package/dist/filters/types.d.ts +11 -0
  183. package/dist/filters/url-params.d.ts +5 -0
  184. package/dist/filters/url-params.js +20 -0
  185. package/dist/filters/use-filters.d.ts +13 -0
  186. package/dist/filters/use-filters.js +63 -0
  187. package/dist/hooks/use-countdown.d.ts +4 -0
  188. package/dist/hooks/use-countdown.js +18 -0
  189. package/dist/i18n/resources.js +23 -0
  190. package/dist/index.d.ts +66 -0
  191. package/dist/index.js +141 -38
  192. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +421 -350
  193. package/dist/test-utils/expect-visibility.d.ts +45 -0
  194. package/dist/utils/key-typeguard.d.ts +5 -0
  195. package/dist/utils/key-typeguard.js +6 -0
  196. package/dist/utils/observable.d.ts +7 -0
  197. package/dist/utils/observable.js +22 -0
  198. package/dist/utils/use-debounce.d.ts +1 -0
  199. package/dist/utils/use-debounce.js +11 -0
  200. package/package.json +30 -7
  201. package/theme.css +7 -1
@@ -0,0 +1,55 @@
1
+ import { ReactNode, SVGAttributes } from 'react';
2
+ import { DonutTooltipPayload } from './donut-tooltip';
3
+ import { ChartDataItem } from '../types';
4
+ /**
5
+ * Props for the `DonutChart` component.
6
+ *
7
+ * At minimum, provide `data`. The chart renders a built-in tooltip by default;
8
+ * pass `tooltip` to override, or `tooltip={null}` to disable.
9
+ */
10
+ interface DonutChartProps extends Omit<SVGAttributes<SVGSVGElement>, "viewBox"> {
11
+ /** Chart data slices. Zero-value items are filtered automatically. */
12
+ data: ChartDataItem[];
13
+ /**
14
+ * Custom tooltip renderer. Receives the hovered item, total value, and unit.
15
+ * - Omit to use the built-in tooltip.
16
+ * - Pass `null` to disable tooltips entirely.
17
+ */
18
+ tooltip?: ((payload: DonutTooltipPayload) => ReactNode) | null;
19
+ /** Format unit label for tooltip display. Receives the hovered item's value. */
20
+ getUnit?: (count: number) => string;
21
+ /**
22
+ * Ratio of the inner hole radius to the outer radius.
23
+ * - `0` renders a pie chart (no hole).
24
+ * - `0.56` is the default donut.
25
+ * - `1` is degenerate (invisible).
26
+ */
27
+ holeRatio?: number;
28
+ /** Color of the empty-state placeholder ring. */
29
+ emptyColor?: string;
30
+ }
31
+ /**
32
+ * SVG donut chart with built-in tooltip.
33
+ *
34
+ * Use `className` to control the rendered size, e.g. `className="w-32 h-32"`.
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * // Minimal — tooltip works out of the box
39
+ * <DonutChart data={[
40
+ * { id: "a", name: "Critical", value: 12, color: "#e11d48" },
41
+ * { id: "b", name: "High", value: 25, color: "#f97316" },
42
+ * ]} />
43
+ *
44
+ * // Custom size via className
45
+ * <DonutChart data={chartData} className="w-40 h-40" />
46
+ *
47
+ * // Pie chart (no hole)
48
+ * <DonutChart data={chartData} holeRatio={0} />
49
+ *
50
+ * // Disable tooltip
51
+ * <DonutChart data={chartData} tooltip={null} />
52
+ * ```
53
+ */
54
+ export declare const DonutChart: import('react').ForwardRefExoticComponent<DonutChartProps & import('react').RefAttributes<SVGSVGElement>>;
55
+ export {};
@@ -0,0 +1,110 @@
1
+ import { jsxs as m, Fragment as E, jsx as d } from "react/jsx-runtime";
2
+ import { forwardRef as C, useMemo as p, useState as A, useCallback as R } from "react";
3
+ import { computeSegments as w, DonutSegments as F } from "./DonutSegments.js";
4
+ import { defaultTooltipRenderer as I, renderTooltipPortal as j } from "./donut-tooltip.js";
5
+ const v = 200, N = 0.56, P = "var(--color-gray-v2-200)", n = v / 2, o = { x: n, y: n }, U = C(
6
+ ({
7
+ data: s,
8
+ tooltip: y = I,
9
+ getUnit: a,
10
+ holeRatio: T = N,
11
+ emptyColor: D = P,
12
+ className: L,
13
+ ...M
14
+ }, O) => {
15
+ const l = n * T, S = p(
16
+ () => s.filter((e) => e.value > 0),
17
+ [s]
18
+ ), r = p(
19
+ () => s.reduce((e, u) => e + u.value, 0),
20
+ [s]
21
+ ), [i, g] = A({ x: 0, y: 0, visible: !1, payload: null }), h = R(
22
+ (e, u, b) => {
23
+ g({
24
+ x: u + 8,
25
+ y: b + 8,
26
+ visible: !0,
27
+ payload: {
28
+ item: e,
29
+ totalValue: r,
30
+ unit: a ? a(e.value) : ""
31
+ }
32
+ });
33
+ },
34
+ [r, a]
35
+ ), f = R(() => {
36
+ g((e) => ({ ...e, visible: !1, payload: null }));
37
+ }, []), t = p(
38
+ () => w(
39
+ S,
40
+ r,
41
+ n,
42
+ l,
43
+ o
44
+ ),
45
+ [S, r, l]
46
+ ), _ = t.length > 1, c = t.length === 1, x = t.length === 0;
47
+ return /* @__PURE__ */ m(E, { children: [
48
+ /* @__PURE__ */ m(
49
+ "svg",
50
+ {
51
+ ref: O,
52
+ className: L,
53
+ viewBox: `0 0 ${v} ${v}`,
54
+ ...M,
55
+ children: [
56
+ _ && /* @__PURE__ */ d(
57
+ F,
58
+ {
59
+ segments: t,
60
+ outerRadius: n,
61
+ innerRadius: l,
62
+ center: o,
63
+ onSegmentEnter: h,
64
+ onSegmentLeave: f
65
+ }
66
+ ),
67
+ (c || x) && /* @__PURE__ */ m(E, { children: [
68
+ /* @__PURE__ */ d(
69
+ "circle",
70
+ {
71
+ cx: o.x,
72
+ cy: o.y,
73
+ r: n,
74
+ fill: c ? t[0].item.color : D,
75
+ opacity: x ? 0.4 : 1,
76
+ onMouseMove: c ? (e) => h(
77
+ t[0].item,
78
+ e.clientX,
79
+ e.clientY
80
+ ) : void 0,
81
+ onMouseOut: c ? f : void 0
82
+ }
83
+ ),
84
+ l > 0 && /* @__PURE__ */ d(
85
+ "circle",
86
+ {
87
+ cx: o.x,
88
+ cy: o.y,
89
+ r: l,
90
+ fill: "white"
91
+ }
92
+ )
93
+ ] })
94
+ ]
95
+ }
96
+ ),
97
+ y && j(
98
+ i.y,
99
+ i.x,
100
+ i.visible,
101
+ i.payload,
102
+ y
103
+ )
104
+ ] });
105
+ }
106
+ );
107
+ U.displayName = "DonutChart";
108
+ export {
109
+ U as DonutChart
110
+ };
@@ -0,0 +1,25 @@
1
+ import { ChartDataItem } from '../types';
2
+ export interface Point {
3
+ x: number;
4
+ y: number;
5
+ }
6
+ /** Pre-computed geometry for a single donut segment. */
7
+ export interface DonutSegment {
8
+ item: ChartDataItem;
9
+ startAngle: number;
10
+ endAngle: number;
11
+ outerStart: Point;
12
+ outerEnd: Point;
13
+ innerEnd: Point;
14
+ }
15
+ export declare function computeSegments(data: ChartDataItem[], totalValue: number, outerRadius: number, innerRadius: number, center: Point): DonutSegment[];
16
+ interface Props {
17
+ segments: DonutSegment[];
18
+ outerRadius: number;
19
+ innerRadius: number;
20
+ center: Point;
21
+ onSegmentEnter: (item: ChartDataItem, x: number, y: number) => void;
22
+ onSegmentLeave: () => void;
23
+ }
24
+ export declare const DonutSegments: ({ segments, outerRadius, innerRadius, center, onSegmentEnter, onSegmentLeave, }: Props) => import("react").JSX.Element;
25
+ export {};
@@ -0,0 +1,51 @@
1
+ import { jsx as $, Fragment as p } from "react/jsx-runtime";
2
+ function l(o, e, t) {
3
+ const r = o * Math.PI / 180;
4
+ return {
5
+ x: Math.sin(r) * e + t.x,
6
+ y: -Math.cos(r) * e + t.y
7
+ };
8
+ }
9
+ function m(o, e, t, r) {
10
+ const c = Math.abs(t - e) % 360 > 180 ? 1 : 0, u = t >= e ? 1 : 0, n = l(t, o, r);
11
+ return `A ${o} ${o} 0 ${c} ${u} ${n.x} ${n.y}`;
12
+ }
13
+ function M(o, e, t, r) {
14
+ const { outerStart: c, innerEnd: u, startAngle: n, endAngle: i } = o, a = m(e, n, i, r), s = m(t, i, n, r);
15
+ return `M ${c.x} ${c.y} ${a} L ${u.x} ${u.y} ${s}`;
16
+ }
17
+ function h(o, e, t, r, c) {
18
+ let u = 0;
19
+ return o.map((n) => {
20
+ const i = n.value / e * 360, a = u, s = a + i;
21
+ return u = s, {
22
+ item: n,
23
+ startAngle: a,
24
+ endAngle: s,
25
+ outerStart: l(a, t, c),
26
+ outerEnd: l(s, t, c),
27
+ innerEnd: l(s, r, c)
28
+ };
29
+ });
30
+ }
31
+ const x = ({
32
+ segments: o,
33
+ outerRadius: e,
34
+ innerRadius: t,
35
+ center: r,
36
+ onSegmentEnter: c,
37
+ onSegmentLeave: u
38
+ }) => /* @__PURE__ */ $(p, { children: o.map((n) => /* @__PURE__ */ $(
39
+ "path",
40
+ {
41
+ fill: n.item.color,
42
+ d: M(n, e, t, r),
43
+ onMouseMove: (i) => c(n.item, i.clientX, i.clientY),
44
+ onMouseOut: u
45
+ },
46
+ n.item.id
47
+ )) });
48
+ export {
49
+ x as DonutSegments,
50
+ h as computeSegments
51
+ };
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from 'react';
2
+ import { ChartDataItem } from '../types';
3
+ /** Payload passed to a custom tooltip renderer. */
4
+ export interface DonutTooltipPayload {
5
+ item: ChartDataItem;
6
+ totalValue: number;
7
+ /** Formatted unit label, e.g. "tickets". Empty string when `getUnit` is not provided. */
8
+ unit: string;
9
+ }
10
+ /**
11
+ * Built-in tooltip renderer.
12
+ * Shows the item name, value with unit, and percentage of total.
13
+ */
14
+ export declare const defaultTooltipRenderer: ({ item, totalValue, unit, }: DonutTooltipPayload) => ReactNode;
15
+ /**
16
+ * Render the tooltip into `document.body` via a portal.
17
+ * This is a plain function (not a component) to avoid `ReactPortal` vs `ReactNode`
18
+ * type mismatch issues between `@types/react` and `@types/react-dom`.
19
+ */
20
+ export declare function renderTooltipPortal(top: number, left: number, visible: boolean, payload: DonutTooltipPayload | null, renderer: (payload: DonutTooltipPayload) => ReactNode): ReactNode;
@@ -0,0 +1,37 @@
1
+ import { jsxs as t, jsx as d } from "react/jsx-runtime";
2
+ import { createPortal as c } from "react-dom";
3
+ const a = ({
4
+ item: e,
5
+ totalValue: r,
6
+ unit: n
7
+ }) => {
8
+ const o = r > 0 ? (e.value / r * 100).toFixed() : "0";
9
+ return /* @__PURE__ */ t(
10
+ "div",
11
+ {
12
+ style: { backgroundColor: e.color },
13
+ className: "rounded-md p-3 shadow-lg whitespace-pre text-white font-medium text-sm",
14
+ children: [
15
+ /* @__PURE__ */ d("p", { children: e.name }),
16
+ /* @__PURE__ */ t("p", { children: [
17
+ e.value,
18
+ " ",
19
+ n,
20
+ " (",
21
+ o,
22
+ "%)"
23
+ ] })
24
+ ]
25
+ }
26
+ );
27
+ };
28
+ function p(e, r, n, o, l) {
29
+ return !n || !o ? null : c(
30
+ /* @__PURE__ */ d("div", { style: { top: e, left: r }, className: "fixed z-10 pointer-events-none", children: l(o) }),
31
+ document.body
32
+ );
33
+ }
34
+ export {
35
+ a as defaultTooltipRenderer,
36
+ p as renderTooltipPortal
37
+ };
@@ -0,0 +1,8 @@
1
+ /** A single data entry shared across chart components (DonutChart, ChartLegend, etc.). */
2
+ export interface ChartDataItem {
3
+ id: string;
4
+ name: string;
5
+ value: number;
6
+ /** Resolved CSS color string (hex, rgb, etc.). */
7
+ color: string;
8
+ }
@@ -0,0 +1,6 @@
1
+ import { InputHTMLAttributes } from 'react';
2
+ interface Props extends InputHTMLAttributes<HTMLInputElement> {
3
+ indeterminate?: boolean;
4
+ }
5
+ export declare const Checkbox: import('react').ForwardRefExoticComponent<Props & import('react').RefAttributes<HTMLInputElement>>;
6
+ export {};
@@ -0,0 +1,72 @@
1
+ import { jsxs as l, jsx as s } from "react/jsx-runtime";
2
+ import { Check as d, Minus as b } from "@untitled-ui/icons-react";
3
+ import { forwardRef as u } from "react";
4
+ import { cn as t } from "../../utils/cn.js";
5
+ const c = u(
6
+ ({ checked: a, indeterminate: o, className: r, ...e }, n) => {
7
+ const i = !!o && !a;
8
+ return /* @__PURE__ */ l(
9
+ "label",
10
+ {
11
+ className: t(
12
+ "relative size-5 shrink-0 block rounded-md bg-white transition-all ease-out border overflow-hidden",
13
+ a || i ? e.disabled ? "border-gray-v2-300" : "border-brand-v2-600" : "border-gray-v2-300",
14
+ { "bg-gray-v2-50": e.disabled },
15
+ r
16
+ ),
17
+ children: [
18
+ /* @__PURE__ */ s(
19
+ "input",
20
+ {
21
+ ref: n,
22
+ ...e,
23
+ checked: a,
24
+ className: t(
25
+ "absolute top-0 left-0 z-10 size-full rounded-md appearance-none",
26
+ "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand-v2-400",
27
+ e.disabled ? "cursor-not-allowed" : "cursor-pointer"
28
+ ),
29
+ type: "checkbox"
30
+ }
31
+ ),
32
+ /* @__PURE__ */ l(
33
+ "span",
34
+ {
35
+ className: t(
36
+ "relative size-full transition-all ease-out rounded-0.5 flex justify-center items-center",
37
+ { "bg-brand-v2-600": !e.disabled },
38
+ { "scale-[40%] opacity-0 rotate-12": !(a || i) }
39
+ ),
40
+ children: [
41
+ /* @__PURE__ */ s(
42
+ d,
43
+ {
44
+ className: t(
45
+ "absolute size-[70%] transition-all ease-out",
46
+ e.disabled ? "text-gray-v2-300" : "text-white",
47
+ { "scale-0": !a }
48
+ )
49
+ }
50
+ ),
51
+ /* @__PURE__ */ s(
52
+ b,
53
+ {
54
+ className: t(
55
+ "absolute size-[70%] transition-all ease-out",
56
+ e.disabled ? "text-gray-v2-300" : "text-white",
57
+ { "scale-0": !i }
58
+ )
59
+ }
60
+ )
61
+ ]
62
+ }
63
+ )
64
+ ]
65
+ }
66
+ );
67
+ }
68
+ );
69
+ c.displayName = "Checkbox";
70
+ export {
71
+ c as Checkbox
72
+ };
@@ -0,0 +1,7 @@
1
+ export declare function CheckboxUnchecked(): import("react").JSX.Element;
2
+ export declare function CheckboxChecked(): import("react").JSX.Element;
3
+ export declare function CheckboxIndeterminate(): import("react").JSX.Element;
4
+ export declare function CheckboxCheckedAndIndeterminate(): import("react").JSX.Element;
5
+ export declare function CheckboxDisabled(): import("react").JSX.Element;
6
+ export declare function CheckboxDisabledChecked(): import("react").JSX.Element;
7
+ export declare function CheckboxWithClickCounter(): import("react").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { ReactNode } from 'react';
2
+ interface Props {
3
+ expanded: boolean;
4
+ duration?: number;
5
+ className?: string;
6
+ children?: ReactNode;
7
+ }
8
+ /**
9
+ * Pure animated collapse container. No trigger, no label — just an outer
10
+ * grid whose row template animates between `0fr` and `1fr`, with a delayed
11
+ * `visibility` transition so collapsed content is unreachable by pointer,
12
+ * focus, and assistive tech once the fade finishes.
13
+ *
14
+ * Consumers own the toggle UI (e.g. `Accordion` wraps its own `role=button`
15
+ * label around this; `Card` keeps its collapse button in `CardHeader`).
16
+ *
17
+ * @param expanded - Whether the content is shown.
18
+ * @param duration - Transition duration in milliseconds (default: 300).
19
+ */
20
+ export declare const Collapsible: ({ expanded, duration, className, children, }: Props) => import("react").JSX.Element;
21
+ export {};
@@ -0,0 +1,50 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { useState as f, useEffect as c } from "react";
3
+ import { cn as s } from "../../utils/cn.js";
4
+ const g = ({
5
+ expanded: i,
6
+ duration: n = 300,
7
+ className: e,
8
+ children: a
9
+ }) => {
10
+ const t = `${n}ms`, [l, o] = f(
11
+ i ? "visible" : "hidden"
12
+ );
13
+ return c(() => {
14
+ i && o("visible");
15
+ }, [i]), /* @__PURE__ */ r(
16
+ "div",
17
+ {
18
+ className: s(
19
+ "grid motion-safe:transition-[grid-template-rows] ease-out",
20
+ i ? "grid-rows-[1fr]" : "grid-rows-[0fr]",
21
+ e
22
+ ),
23
+ style: { transitionDuration: t },
24
+ onTransitionEnd: (m) => {
25
+ m.propertyName === "grid-template-rows" && !i && o("hidden");
26
+ },
27
+ children: /* @__PURE__ */ r(
28
+ "div",
29
+ {
30
+ className: s("min-h-0", {
31
+ "invisible opacity-0": !i
32
+ }),
33
+ style: {
34
+ overflow: l,
35
+ transitionProperty: "opacity, visibility",
36
+ transitionDuration: `${t}, 0s`,
37
+ transitionTimingFunction: "ease-out",
38
+ // Delay visibility so it hides only after the fade finishes.
39
+ // When expanding, no delay — content becomes visible immediately.
40
+ transitionDelay: i ? "0s, 0s" : `0s, ${t}`
41
+ },
42
+ children: a
43
+ }
44
+ )
45
+ }
46
+ );
47
+ };
48
+ export {
49
+ g as Collapsible
50
+ };
@@ -92,5 +92,5 @@ interface Props {
92
92
  *
93
93
  * <Combobox value={value} onChange={handleChange} error={error} />
94
94
  */
95
- export declare const Combobox: ({ id, value, onChange, onBlur, getSuggestions, delimiter, placeholder, error, disabled, getBadgeProps, getLabel, }: Props) => import("react/jsx-runtime").JSX.Element;
95
+ export declare const Combobox: ({ id, value, onChange, onBlur, getSuggestions, delimiter, placeholder, error, disabled, getBadgeProps, getLabel, }: Props) => import("react").JSX.Element;
96
96
  export {};
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ interface Props {
3
+ /** Optional content rendered in the middle of the divider. */
4
+ children?: ReactNode;
5
+ orientation?: "horizontal" | "vertical";
6
+ className?: string;
7
+ }
8
+ export declare const Divider: ({ children, orientation, className, }: Props) => import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1,28 @@
1
+ import { jsx as r, jsxs as l } from "react/jsx-runtime";
2
+ import { cn as e } from "../../utils/cn.js";
3
+ const p = ({
4
+ children: t,
5
+ orientation: s = "horizontal",
6
+ className: a
7
+ }) => s === "vertical" ? /* @__PURE__ */ r(
8
+ "span",
9
+ {
10
+ role: "separator",
11
+ "aria-orientation": "vertical",
12
+ className: e("self-stretch w-px bg-gray-v2-200", a)
13
+ }
14
+ ) : t ? /* @__PURE__ */ l(
15
+ "div",
16
+ {
17
+ role: "separator",
18
+ className: e("flex items-center gap-3 w-full", a),
19
+ children: [
20
+ /* @__PURE__ */ r("span", { className: "flex-1 h-px bg-gray-v2-200" }),
21
+ /* @__PURE__ */ r("span", { className: "text-sm font-medium text-gray-v2-600 whitespace-nowrap", children: t }),
22
+ /* @__PURE__ */ r("span", { className: "flex-1 h-px bg-gray-v2-200" })
23
+ ]
24
+ }
25
+ ) : /* @__PURE__ */ r("hr", { className: e("w-full border-0 h-px bg-gray-v2-200", a) });
26
+ export {
27
+ p as Divider
28
+ };
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ export interface DrawerProps {
3
+ isOpen: boolean;
4
+ onOpenChange: (open: boolean) => void;
5
+ children?: ReactNode;
6
+ className?: string;
7
+ }
8
+ export declare const Drawer: ({ isOpen, onOpenChange, children, className, }: DrawerProps) => import('react').ReactPortal;
@@ -0,0 +1,68 @@
1
+ import { jsx as a, jsxs as v } from "react/jsx-runtime";
2
+ import { useRef as f, useCallback as h, useEffect as x } from "react";
3
+ import { createPortal as g } from "react-dom";
4
+ import { XClose as p } from "@untitled-ui/icons-react";
5
+ import { Button as w } from "../button/Button.js";
6
+ import { cn as d } from "../../utils/cn.js";
7
+ import { useClickOutsideModal as E } from "../modal/use-click-outside-modal.js";
8
+ const k = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])', A = ({
9
+ isOpen: e,
10
+ onOpenChange: r,
11
+ children: u,
12
+ className: m
13
+ }) => {
14
+ const i = f(null), l = f(null), b = (t) => {
15
+ if (!(!e || l.current === null) && (t.key === "Escape" && r(!1), t.key === "Tab")) {
16
+ const o = Array.from(
17
+ l.current.querySelectorAll(k)
18
+ ).filter((y) => !y.closest("[inert]"));
19
+ if (o.length === 0) return;
20
+ const s = o[0], c = o[o.length - 1];
21
+ t.shiftKey ? document.activeElement === s && (t.preventDefault(), c.focus()) : document.activeElement === c && (t.preventDefault(), s.focus());
22
+ }
23
+ }, n = h(() => r(!1), [r]);
24
+ return E(n, i, [l]), x(() => (document.body.classList.toggle("overflow-hidden", e), () => document.body.classList.remove("overflow-hidden")), [e]), g(
25
+ /* @__PURE__ */ a(
26
+ "div",
27
+ {
28
+ ref: i,
29
+ className: d(
30
+ "fixed inset-0 flex items-center justify-end z-10 transition-all duration-300 bg-gray-v2-950/48",
31
+ { "invisible opacity-0": !e }
32
+ ),
33
+ onKeyDown: b,
34
+ children: /* @__PURE__ */ v(
35
+ "div",
36
+ {
37
+ ref: l,
38
+ role: "dialog",
39
+ "aria-modal": "true",
40
+ className: d(
41
+ "relative h-full w-104 bg-white flex flex-col overflow-hidden transition-all duration-300",
42
+ { "translate-x-full": !e },
43
+ m
44
+ ),
45
+ children: [
46
+ /* @__PURE__ */ a(
47
+ w,
48
+ {
49
+ variant: "tertiary",
50
+ color: "gray",
51
+ className: "absolute right-0 top-0 m-4",
52
+ onClick: n,
53
+ "aria-label": "Close",
54
+ children: /* @__PURE__ */ a(p, { className: "size-6 shrink-0 text-gray-v2-400" })
55
+ }
56
+ ),
57
+ u
58
+ ]
59
+ }
60
+ )
61
+ }
62
+ ),
63
+ document.body
64
+ );
65
+ };
66
+ export {
67
+ A as Drawer
68
+ };
@@ -0,0 +1,45 @@
1
+ import { DropdownProps } from './types';
2
+ /**
3
+ * Generic standalone dropdown for action menus, context menus, or selection lists.
4
+ *
5
+ * Supports controlled (`open`) and uncontrolled (`defaultOpen`) open state.
6
+ * When `selected` is provided, the dropdown shows checkmarks (selection mode).
7
+ * Otherwise it behaves as a plain action menu.
8
+ *
9
+ * @example
10
+ * // Action menu
11
+ * <Dropdown
12
+ * items={[
13
+ * { id: "edit", label: "Edit", icon: <Edit01 /> },
14
+ * { type: "divider" },
15
+ * { id: "delete", label: "Delete", danger: true },
16
+ * ]}
17
+ * onSelect={(item) => handleAction(item.id)}
18
+ * >
19
+ * <IconButton icon={<DotsVertical />} />
20
+ * </Dropdown>
21
+ *
22
+ * @example
23
+ * // Selection dropdown with checkmarks
24
+ * <Dropdown
25
+ * items={statusOptions}
26
+ * selected={currentStatus}
27
+ * onSelect={(item) => setStatus(item.id)}
28
+ * syncWidth
29
+ * >
30
+ * <Button>{currentStatusLabel} <ChevronDown /></Button>
31
+ * </Dropdown>
32
+ *
33
+ * @example
34
+ * // Custom item rendering
35
+ * <Dropdown
36
+ * items={[
37
+ * { id: "high", label: "High", render: () => <Badge color="error">High</Badge> },
38
+ * { id: "low", label: "Low", render: () => <Badge color="success">Low</Badge> },
39
+ * ]}
40
+ * onSelect={handleSelect}
41
+ * >
42
+ * <Button>Priority</Button>
43
+ * </Dropdown>
44
+ */
45
+ export declare const Dropdown: ({ items, onSelect, selected, open: openProp, defaultOpen, onOpenChange, placement, syncWidth, children, menuClassName, className, disabled, }: DropdownProps) => import("react").JSX.Element;