@devalok/shilp-sutra 0.8.4 → 0.9.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 (217) hide show
  1. package/dist/_chunks/avatar.js +50 -0
  2. package/dist/_chunks/button.js +95 -0
  3. package/dist/_chunks/card.js +40 -0
  4. package/dist/_chunks/checkbox.js +14 -0
  5. package/dist/_chunks/form.js +27 -0
  6. package/dist/_chunks/primitives.js +6965 -0
  7. package/dist/_chunks/sidebar.js +592 -0
  8. package/dist/_chunks/spinner.js +34 -0
  9. package/dist/_chunks/tiptap.js +15254 -0
  10. package/dist/_chunks/tooltip.js +13 -0
  11. package/dist/_chunks/tree-view.js +304 -0
  12. package/dist/_chunks/use-calendar.js +990 -0
  13. package/dist/_chunks/utils.js +15 -0
  14. package/dist/_chunks/vendor.js +5823 -0
  15. package/dist/composed/avatar-group.js +20 -20
  16. package/dist/composed/command-palette.js +1 -1
  17. package/dist/composed/confirm-dialog.js +5 -5
  18. package/dist/composed/content-card.d.ts +1 -1
  19. package/dist/composed/content-card.js +6 -6
  20. package/dist/composed/date-picker/index.js +13 -0
  21. package/dist/composed/empty-state.js +10 -10
  22. package/dist/composed/error-boundary.js +2 -2
  23. package/dist/composed/global-loading.js +4 -4
  24. package/dist/composed/index.js +45 -53
  25. package/dist/composed/loading-skeleton.js +2 -2
  26. package/dist/composed/member-picker.js +5 -5
  27. package/dist/composed/page-header.js +4 -4
  28. package/dist/composed/page-skeletons.js +1 -1
  29. package/dist/composed/priority-indicator.js +6 -6
  30. package/dist/composed/rich-text-editor.js +422 -209
  31. package/dist/composed/schedule-view.js +1 -1
  32. package/dist/composed/simple-tooltip.js +6 -6
  33. package/dist/composed/status-badge.d.ts +1 -1
  34. package/dist/composed/status-badge.js +2 -2
  35. package/dist/shell/bottom-navbar.js +1 -1
  36. package/dist/shell/notification-center.js +2 -2
  37. package/dist/shell/notification-preferences.js +32 -33
  38. package/dist/shell/sidebar.js +24 -24
  39. package/dist/shell/top-bar.js +22 -22
  40. package/dist/ui/accordion.js +17 -17
  41. package/dist/ui/alert-dialog.js +29 -29
  42. package/dist/ui/alert.d.ts +2 -2
  43. package/dist/ui/alert.js +65 -44
  44. package/dist/ui/aspect-ratio.js +1 -1
  45. package/dist/ui/autocomplete.js +11 -11
  46. package/dist/ui/avatar.d.ts +1 -1
  47. package/dist/ui/avatar.js +67 -25
  48. package/dist/ui/badge.d.ts +2 -2
  49. package/dist/ui/badge.js +115 -91
  50. package/dist/ui/banner.d.ts +1 -1
  51. package/dist/ui/banner.js +5 -5
  52. package/dist/ui/breadcrumb.js +14 -14
  53. package/dist/ui/button-group.js +30 -15
  54. package/dist/ui/button.d.ts +2 -2
  55. package/dist/ui/button.js +114 -71
  56. package/dist/ui/card.js +66 -22
  57. package/dist/ui/charts/index.js +1221 -18
  58. package/dist/ui/checkbox.js +25 -5
  59. package/dist/ui/chip.d.ts +4 -4
  60. package/dist/ui/chip.js +2 -2
  61. package/dist/ui/code.js +1 -1
  62. package/dist/ui/collapsible.js +5 -5
  63. package/dist/ui/color-input.js +11 -11
  64. package/dist/ui/combobox.js +12 -12
  65. package/dist/ui/container.js +4 -4
  66. package/dist/ui/context-menu.js +37 -37
  67. package/dist/ui/data-table-toolbar.js +18 -18
  68. package/dist/ui/data-table.js +2 -2
  69. package/dist/ui/dialog.js +33 -33
  70. package/dist/ui/dropdown-menu.js +60 -60
  71. package/dist/ui/file-upload.js +1 -1
  72. package/dist/ui/form.js +36 -15
  73. package/dist/ui/hover-card.js +7 -7
  74. package/dist/ui/icon-button.js +9 -9
  75. package/dist/ui/index.js +523 -325
  76. package/dist/ui/input-otp.d.ts +2 -2
  77. package/dist/ui/input-otp.js +14 -14
  78. package/dist/ui/input.js +56 -28
  79. package/dist/ui/label.js +18 -4
  80. package/dist/ui/lib/utils.js +4 -5
  81. package/dist/ui/link.js +9 -9
  82. package/dist/ui/menubar.js +81 -81
  83. package/dist/ui/navigation-menu.js +42 -42
  84. package/dist/ui/number-input.js +13 -13
  85. package/dist/ui/pagination.js +5 -5
  86. package/dist/ui/popover.js +9 -9
  87. package/dist/ui/progress.d.ts +1 -1
  88. package/dist/ui/progress.js +15 -15
  89. package/dist/ui/radio.js +10 -10
  90. package/dist/ui/search-input.js +5 -5
  91. package/dist/ui/segmented-control.js +91 -83
  92. package/dist/ui/select.js +52 -52
  93. package/dist/ui/separator.js +20 -5
  94. package/dist/ui/sheet.js +28 -28
  95. package/dist/ui/sidebar.js +36 -560
  96. package/dist/ui/skeleton.d.ts +1 -1
  97. package/dist/ui/skeleton.js +9 -9
  98. package/dist/ui/slider.js +11 -11
  99. package/dist/ui/spinner.js +37 -2
  100. package/dist/ui/stack.js +1 -1
  101. package/dist/ui/stat-card.js +1 -1
  102. package/dist/ui/stepper.js +15 -15
  103. package/dist/ui/switch.js +22 -3
  104. package/dist/ui/table.js +1 -1
  105. package/dist/ui/tabs.js +59 -32
  106. package/dist/ui/text.js +2 -2
  107. package/dist/ui/textarea.js +7 -7
  108. package/dist/ui/toast.d.ts +1 -1
  109. package/dist/ui/toast.js +28 -28
  110. package/dist/ui/toggle-group.js +11 -11
  111. package/dist/ui/toggle.js +9 -9
  112. package/dist/ui/tooltip.js +17 -6
  113. package/dist/ui/transitions.js +68 -58
  114. package/dist/ui/tree-view/index.js +7 -0
  115. package/dist/ui/visually-hidden.js +3 -3
  116. package/llms-full.txt +1 -1
  117. package/llms.txt +7 -0
  118. package/package.json +656 -706
  119. package/dist/_virtual/client.js +0 -5
  120. package/dist/_virtual/index.js +0 -5
  121. package/dist/_virtual/react-dom-client.development.js +0 -5
  122. package/dist/_virtual/react-dom-client.production.js +0 -5
  123. package/dist/_virtual/scheduler.development.js +0 -5
  124. package/dist/_virtual/scheduler.production.js +0 -5
  125. package/dist/composed/date-picker/calendar-grid.js +0 -194
  126. package/dist/composed/date-picker/date-picker.js +0 -124
  127. package/dist/composed/date-picker/date-range-picker.js +0 -167
  128. package/dist/composed/date-picker/date-time-picker.js +0 -193
  129. package/dist/composed/date-picker/month-picker.js +0 -53
  130. package/dist/composed/date-picker/presets.js +0 -84
  131. package/dist/composed/date-picker/time-picker.js +0 -181
  132. package/dist/composed/date-picker/use-calendar.js +0 -17
  133. package/dist/composed/date-picker/year-picker.js +0 -45
  134. package/dist/composed/extensions/emoji-suggestion.js +0 -119
  135. package/dist/composed/extensions/file-attachment.js +0 -55
  136. package/dist/composed/extensions/mention-suggestion.js +0 -79
  137. package/dist/node_modules/.pnpm/@emoji-mart_data@1.2.1/node_modules/@emoji-mart/data/sets/15/native.json.js +0 -40141
  138. package/dist/node_modules/.pnpm/@emoji-mart_react@1.1.1_emoji-mart@5.6.0_react@19.2.4/node_modules/@emoji-mart/react/dist/module.js +0 -17
  139. package/dist/node_modules/.pnpm/emoji-mart@5.6.0/node_modules/emoji-mart/dist/module.js +0 -2958
  140. package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/cjs/react-dom-client.development.js +0 -17062
  141. package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/cjs/react-dom-client.production.js +0 -9790
  142. package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/client.js +0 -20
  143. package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler.development.js +0 -237
  144. package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler.production.js +0 -234
  145. package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/index.js +0 -11
  146. package/dist/primitives/_internal/number.js +0 -6
  147. package/dist/primitives/_internal/primitive.js +0 -9
  148. package/dist/primitives/_internal/react-arrow.js +0 -13
  149. package/dist/primitives/_internal/react-collection.js +0 -48
  150. package/dist/primitives/_internal/react-compose-refs.js +0 -29
  151. package/dist/primitives/_internal/react-context.js +0 -76
  152. package/dist/primitives/_internal/react-direction.js +0 -10
  153. package/dist/primitives/_internal/react-dismissable-layer.js +0 -103
  154. package/dist/primitives/_internal/react-focus-guards.js +0 -17
  155. package/dist/primitives/_internal/react-focus-scope.js +0 -137
  156. package/dist/primitives/_internal/react-id.js +0 -14
  157. package/dist/primitives/_internal/react-popper.js +0 -137
  158. package/dist/primitives/_internal/react-portal.js +0 -16
  159. package/dist/primitives/_internal/react-presence.js +0 -71
  160. package/dist/primitives/_internal/react-primitive.js +0 -36
  161. package/dist/primitives/_internal/react-use-callback-ref.js +0 -13
  162. package/dist/primitives/_internal/react-use-controllable-state.js +0 -44
  163. package/dist/primitives/_internal/react-use-escape-keydown.js +0 -14
  164. package/dist/primitives/_internal/react-use-is-hydrated.js +0 -15
  165. package/dist/primitives/_internal/react-use-layout-effect.js +0 -6
  166. package/dist/primitives/_internal/react-use-previous.js +0 -8
  167. package/dist/primitives/_internal/react-use-size.js +0 -27
  168. package/dist/primitives/react-accordion.js +0 -239
  169. package/dist/primitives/react-alert-dialog.js +0 -127
  170. package/dist/primitives/react-aspect-ratio.js +0 -43
  171. package/dist/primitives/react-avatar.js +0 -75
  172. package/dist/primitives/react-checkbox.js +0 -251
  173. package/dist/primitives/react-collapsible.js +0 -120
  174. package/dist/primitives/react-context-menu.js +0 -240
  175. package/dist/primitives/react-dialog.js +0 -262
  176. package/dist/primitives/react-dropdown-menu.js +0 -227
  177. package/dist/primitives/react-hover-card.js +0 -187
  178. package/dist/primitives/react-label.js +0 -20
  179. package/dist/primitives/react-menu.js +0 -652
  180. package/dist/primitives/react-menubar.js +0 -355
  181. package/dist/primitives/react-navigation-menu.js +0 -607
  182. package/dist/primitives/react-popover.js +0 -243
  183. package/dist/primitives/react-progress.js +0 -84
  184. package/dist/primitives/react-radio-group.js +0 -238
  185. package/dist/primitives/react-roving-focus.js +0 -183
  186. package/dist/primitives/react-select.js +0 -862
  187. package/dist/primitives/react-separator.js +0 -24
  188. package/dist/primitives/react-slider.js +0 -437
  189. package/dist/primitives/react-slot.js +0 -70
  190. package/dist/primitives/react-switch.js +0 -132
  191. package/dist/primitives/react-tabs.js +0 -163
  192. package/dist/primitives/react-toast.js +0 -446
  193. package/dist/primitives/react-toggle-group.js +0 -137
  194. package/dist/primitives/react-toggle.js +0 -33
  195. package/dist/primitives/react-tooltip.js +0 -338
  196. package/dist/primitives/react-visually-hidden.js +0 -32
  197. package/dist/ui/charts/_internal/animation.js +0 -18
  198. package/dist/ui/charts/_internal/axes.js +0 -42
  199. package/dist/ui/charts/_internal/colors.js +0 -21
  200. package/dist/ui/charts/_internal/grid-lines.js +0 -43
  201. package/dist/ui/charts/_internal/legend.js +0 -29
  202. package/dist/ui/charts/_internal/tooltip.js +0 -39
  203. package/dist/ui/charts/_internal/types.js +0 -10
  204. package/dist/ui/charts/area-chart.js +0 -245
  205. package/dist/ui/charts/bar-chart.js +0 -153
  206. package/dist/ui/charts/chart-container.js +0 -27
  207. package/dist/ui/charts/gauge-chart.js +0 -72
  208. package/dist/ui/charts/line-chart.js +0 -163
  209. package/dist/ui/charts/pie-chart.js +0 -132
  210. package/dist/ui/charts/radar-chart.js +0 -223
  211. package/dist/ui/charts/sparkline.js +0 -124
  212. package/dist/ui/lib/motion.js +0 -32
  213. package/dist/ui/lib/use-reduced-motion.js +0 -15
  214. package/dist/ui/lib/use-ripple.js +0 -14
  215. package/dist/ui/tree-view/tree-item.js +0 -139
  216. package/dist/ui/tree-view/tree-view.js +0 -140
  217. package/dist/ui/tree-view/use-tree.js +0 -38
@@ -1,163 +0,0 @@
1
- "use client";
2
- import { jsxs as p, jsx as n, Fragment as q } from "react/jsx-runtime";
3
- import { line as E, curveMonotoneX as J, curveLinear as O } from "d3-shape";
4
- import { scaleLinear as N, scalePoint as Q } from "d3-scale";
5
- import { cn as U } from "../lib/utils.js";
6
- import { ChartContainer as Z } from "./chart-container.js";
7
- import { Axis as M } from "./_internal/axes.js";
8
- import { GridLines as _ } from "./_internal/grid-lines.js";
9
- import { Legend as w } from "./_internal/legend.js";
10
- import { useChartTooltip as I, ChartTooltip as H } from "./_internal/tooltip.js";
11
- import { resolveColor as K } from "./_internal/colors.js";
12
- import { useReducedMotion as ee } from "./_internal/animation.js";
13
- function te({
14
- data: c,
15
- xKey: d,
16
- series: s,
17
- curved: k = !1,
18
- showDots: L = !1,
19
- dotSize: C = 4,
20
- strokeWidth: S = 2,
21
- height: X = 300,
22
- showGrid: G = !0,
23
- showTooltip: b = !0,
24
- showLegend: $ = !1,
25
- animate: oe = !0,
26
- xLabel: j,
27
- yLabel: T,
28
- className: V
29
- }) {
30
- const { tooltip: A, show: R, hide: z } = I();
31
- ee();
32
- const f = s.map((r, a) => K(r.color, a));
33
- return /* @__PURE__ */ p("div", { className: U("relative", V), children: [
34
- /* @__PURE__ */ n(Z, { height: X, children: ({ width: r, height: a, margin: ne }) => {
35
- const x = c.map((e) => e[d]), B = x.every((e) => typeof e == "number");
36
- let y, u;
37
- if (B) {
38
- const e = x, o = Math.min(...e), m = Math.max(...e), i = N().domain([o, m]).range([0, r]);
39
- y = i, u = (t) => i(Number(t[d]));
40
- } else {
41
- const e = x.map(String), o = Q().domain(e).range([0, r]).padding(0.5);
42
- y = o, u = (m) => o(String(m[d])) ?? 0;
43
- }
44
- const D = c.flatMap(
45
- (e) => s.map((o) => Number(e[o.key]) || 0)
46
- ), F = Math.max(...D), g = N().domain([0, F * 1.1]).range([a, 0]).nice(), P = k ? J : O, W = E().curve(P).defined((e) => e != null);
47
- return /* @__PURE__ */ p(q, { children: [
48
- G && /* @__PURE__ */ n(
49
- _,
50
- {
51
- width: r,
52
- height: a,
53
- yScale: g,
54
- horizontal: !0
55
- }
56
- ),
57
- s.map((e, o) => {
58
- const i = W.x((t) => u(t)).y((t) => g(Number(t[e.key]) || 0))(c) ?? "";
59
- return /* @__PURE__ */ p("g", { children: [
60
- /* @__PURE__ */ n(
61
- "path",
62
- {
63
- d: i,
64
- fill: "none",
65
- stroke: f[o],
66
- strokeWidth: S,
67
- strokeLinejoin: "round",
68
- strokeLinecap: "round"
69
- }
70
- ),
71
- L && c.map((t, l) => {
72
- const v = u(t), h = g(Number(t[e.key]) || 0);
73
- return /* @__PURE__ */ n(
74
- "circle",
75
- {
76
- cx: v,
77
- cy: h,
78
- r: C,
79
- fill: f[o],
80
- className: "transition-opacity hover:opacity-[0.8]"
81
- },
82
- `${e.key}-dot-${l}`
83
- );
84
- })
85
- ] }, e.key);
86
- }),
87
- b && c.map((e, o) => {
88
- const m = u(e), i = r / Math.max(c.length - 1, 1);
89
- return /* @__PURE__ */ n(
90
- "rect",
91
- {
92
- x: m - i / 2,
93
- y: 0,
94
- width: i,
95
- height: a,
96
- fill: "transparent",
97
- onMouseMove: (t) => {
98
- var v;
99
- const l = (v = t.currentTarget.closest("div")) == null ? void 0 : v.getBoundingClientRect();
100
- R(
101
- t.clientX - ((l == null ? void 0 : l.left) ?? 0),
102
- t.clientY - ((l == null ? void 0 : l.top) ?? 0),
103
- /* @__PURE__ */ p("div", { children: [
104
- /* @__PURE__ */ n("div", { className: "font-medium", children: String(e[d]) }),
105
- s.map((h, Y) => /* @__PURE__ */ p(
106
- "div",
107
- {
108
- className: "flex items-center gap-ds-02",
109
- children: [
110
- /* @__PURE__ */ n(
111
- "span",
112
- {
113
- className: "inline-block h-2 w-2 rounded-ds-full",
114
- style: { backgroundColor: f[Y] }
115
- }
116
- ),
117
- /* @__PURE__ */ p("span", { className: "text-text-secondary", children: [
118
- h.label,
119
- ":"
120
- ] }),
121
- " ",
122
- Number(e[h.key]).toLocaleString()
123
- ]
124
- },
125
- h.key
126
- ))
127
- ] })
128
- );
129
- },
130
- onMouseLeave: z
131
- },
132
- `hover-${o}`
133
- );
134
- }),
135
- /* @__PURE__ */ n(
136
- M,
137
- {
138
- scale: y,
139
- orientation: "bottom",
140
- transform: `translate(0,${a})`,
141
- label: j
142
- }
143
- ),
144
- /* @__PURE__ */ n(M, { scale: g, orientation: "left", label: T })
145
- ] });
146
- } }),
147
- b && /* @__PURE__ */ n(H, { state: A }),
148
- $ && s.length > 1 && /* @__PURE__ */ n(
149
- w,
150
- {
151
- items: s.map((r, a) => ({
152
- label: r.label,
153
- color: f[a]
154
- })),
155
- className: "mt-ds-04"
156
- }
157
- )
158
- ] });
159
- }
160
- te.displayName = "LineChart";
161
- export {
162
- te as LineChart
163
- };
@@ -1,132 +0,0 @@
1
- "use client";
2
- import { jsxs as i, Fragment as k, jsx as r } from "react/jsx-runtime";
3
- import { useRef as q, useState as w, useEffect as D } from "react";
4
- import { pie as J, arc as j } from "d3-shape";
5
- import { cn as K } from "../lib/utils.js";
6
- import { Legend as Q } from "./_internal/legend.js";
7
- import { useChartTooltip as U, ChartTooltip as V } from "./_internal/tooltip.js";
8
- import { resolveColor as Z } from "./_internal/colors.js";
9
- import { useReducedMotion as _ } from "./_internal/animation.js";
10
- function ee({
11
- data: c,
12
- variant: v = "pie",
13
- innerRadius: L = 0.6,
14
- padAngle: z = 0,
15
- cornerRadius: A = 0,
16
- height: u = 300,
17
- showTooltip: x = !0,
18
- showLegend: F = !1,
19
- showLabels: P = !1,
20
- animate: te = !0,
21
- className: B,
22
- centerLabel: R
23
- }) {
24
- const d = q(null), [l, E] = w(0), [H, b] = w(null), { tooltip: I, show: O, hide: S } = U();
25
- _(), D(() => {
26
- if (!d.current) return;
27
- const e = new ResizeObserver((t) => {
28
- const o = t[0];
29
- o && E(o.contentRect.width);
30
- });
31
- return e.observe(d.current), () => e.disconnect();
32
- }, []);
33
- const m = (l > 0 ? Math.min(l, u) : u) / 2, n = v === "donut" ? m * L : 0, y = c.map((e, t) => Z(e.color, t)), s = c.reduce((e, t) => e + t.value, 0), g = J().value((e) => e.value).padAngle(z).sort(null)(c), M = j().innerRadius(n).outerRadius(m - 2).cornerRadius(A), $ = n + (m - 2 - n) * 0.7, T = j().innerRadius($).outerRadius($);
34
- return /* @__PURE__ */ i("div", { ref: d, className: K("relative w-full", B), children: [
35
- l > 0 && /* @__PURE__ */ i(k, { children: [
36
- /* @__PURE__ */ r(
37
- "svg",
38
- {
39
- width: l,
40
- height: u,
41
- role: "img",
42
- "aria-label": "Pie chart",
43
- children: /* @__PURE__ */ i("g", { transform: `translate(${l / 2},${u / 2})`, children: [
44
- g.map((e, t) => {
45
- const o = M(e);
46
- if (!o) return null;
47
- const [f, p] = M.centroid(e), C = Math.atan2(p, f), W = Math.cos(C) * 4, X = Math.sin(C) * 4, Y = H === t;
48
- return /* @__PURE__ */ r(
49
- "path",
50
- {
51
- d: o,
52
- fill: y[t],
53
- className: "cursor-pointer transition-transform",
54
- style: {
55
- transform: Y ? `translate(${W}px, ${X}px)` : void 0
56
- },
57
- onMouseEnter: () => b(t),
58
- onMouseMove: (h) => {
59
- var N;
60
- if (x) {
61
- const a = (N = h.currentTarget.closest("div")) == null ? void 0 : N.getBoundingClientRect(), G = s > 0 ? (e.data.value / s * 100).toFixed(1) : "0";
62
- O(
63
- h.clientX - ((a == null ? void 0 : a.left) ?? 0),
64
- h.clientY - ((a == null ? void 0 : a.top) ?? 0),
65
- /* @__PURE__ */ i("div", { children: [
66
- /* @__PURE__ */ r("div", { className: "font-medium", children: e.data.label }),
67
- /* @__PURE__ */ i("div", { children: [
68
- e.data.value.toLocaleString(),
69
- " (",
70
- G,
71
- "%)"
72
- ] })
73
- ] })
74
- );
75
- }
76
- },
77
- onMouseLeave: () => {
78
- b(null), S();
79
- }
80
- },
81
- `slice-${e.data.label}-${t}`
82
- );
83
- }),
84
- P && g.map((e, t) => {
85
- const [o, f] = T.centroid(e), p = s > 0 ? (e.data.value / s * 100).toFixed(0) : "0";
86
- return s > 0 && e.data.value / s < 0.03 ? null : /* @__PURE__ */ i(
87
- "text",
88
- {
89
- x: o,
90
- y: f,
91
- textAnchor: "middle",
92
- dominantBaseline: "central",
93
- className: "pointer-events-none fill-text-on-color text-ds-xs font-medium",
94
- children: [
95
- p,
96
- "%"
97
- ]
98
- },
99
- `label-${e.data.label}-${t}`
100
- );
101
- }),
102
- v === "donut" && R && n > 0 && /* @__PURE__ */ r(
103
- "foreignObject",
104
- {
105
- x: -n * 0.7,
106
- y: -n * 0.7,
107
- width: n * 1.4,
108
- height: n * 1.4,
109
- children: /* @__PURE__ */ r("div", { className: "flex h-full w-full items-center justify-center text-center text-text-primary", children: R })
110
- }
111
- )
112
- ] })
113
- }
114
- ),
115
- x && /* @__PURE__ */ r(V, { state: I })
116
- ] }),
117
- F && /* @__PURE__ */ r(
118
- Q,
119
- {
120
- items: c.map((e, t) => ({
121
- label: e.label,
122
- color: y[t]
123
- })),
124
- className: "mt-ds-04"
125
- }
126
- )
127
- ] });
128
- }
129
- ee.displayName = "PieChart";
130
- export {
131
- ee as PieChart
132
- };
@@ -1,223 +0,0 @@
1
- "use client";
2
- import { jsxs as i, Fragment as B, jsx as s } from "react/jsx-runtime";
3
- import { useRef as T, useState as X, useEffect as Y } from "react";
4
- import { lineRadial as D, curveLinearClosed as E } from "d3-shape";
5
- import { cn as F } from "../lib/utils.js";
6
- import { Legend as O } from "./_internal/legend.js";
7
- import { useChartTooltip as q, ChartTooltip as G } from "./_internal/tooltip.js";
8
- import { resolveColor as H } from "./_internal/colors.js";
9
- import { useReducedMotion as J } from "./_internal/animation.js";
10
- function K({
11
- data: g,
12
- axes: d,
13
- series: u,
14
- maxValue: R,
15
- levels: h = 5,
16
- fillOpacity: $ = 0.25,
17
- showDots: C = !1,
18
- height: M = 300,
19
- showTooltip: k = !0,
20
- showLegend: P = !1,
21
- animate: Q = !0,
22
- className: L
23
- }) {
24
- const v = T(null), [p, S] = X(0), { tooltip: W, show: _, hide: w } = q();
25
- J(), Y(() => {
26
- if (!v.current) return;
27
- const e = new ResizeObserver((t) => {
28
- const r = t[0];
29
- r && S(r.contentRect.width);
30
- });
31
- return e.observe(v.current), () => e.disconnect();
32
- }, []);
33
- const c = (p > 0 ? Math.min(p, M) : M) / 2 - 40, f = u.map((e, t) => H(e.color, t)), x = R ?? Math.max(
34
- ...g.flatMap((e) => u.map((t) => Number(e[t.key]) || 0)),
35
- 1
36
- ), m = 2 * Math.PI / d.length, I = D().radius((e) => c * e / x).angle((e, t) => t * m).curve(E), j = (e) => d.map((t, r) => {
37
- var n;
38
- return Number((n = g[r]) == null ? void 0 : n[e]) || 0;
39
- }), A = (e, t) => {
40
- const r = m * e - Math.PI / 2, n = c * t / x;
41
- return {
42
- x: n * Math.cos(r),
43
- y: n * Math.sin(r)
44
- };
45
- };
46
- return /* @__PURE__ */ i("div", { ref: v, className: F("relative w-full", L), children: [
47
- p > 0 && /* @__PURE__ */ i(B, { children: [
48
- /* @__PURE__ */ s(
49
- "svg",
50
- {
51
- width: p,
52
- height: M,
53
- role: "img",
54
- "aria-label": "Radar chart",
55
- children: /* @__PURE__ */ i("g", { transform: `translate(${p / 2},${M / 2})`, children: [
56
- Array.from({ length: h }, (e, t) => {
57
- const r = c / h * (t + 1), n = d.map((l, o) => {
58
- const a = m * o - Math.PI / 2;
59
- return `${r * Math.cos(a)},${r * Math.sin(a)}`;
60
- }).join(" ");
61
- return /* @__PURE__ */ s(
62
- "polygon",
63
- {
64
- points: n,
65
- fill: "none",
66
- stroke: "var(--color-border-subtle)",
67
- strokeDasharray: "3,3",
68
- strokeWidth: 1
69
- },
70
- `grid-${t}`
71
- );
72
- }),
73
- d.map((e, t) => {
74
- const r = m * t - Math.PI / 2, n = c * Math.cos(r), l = c * Math.sin(r);
75
- return /* @__PURE__ */ s(
76
- "line",
77
- {
78
- x1: 0,
79
- y1: 0,
80
- x2: n,
81
- y2: l,
82
- stroke: "var(--color-border-subtle)",
83
- strokeWidth: 1
84
- },
85
- `axis-${t}`
86
- );
87
- }),
88
- d.map((e, t) => {
89
- const r = m * t - Math.PI / 2, n = c + 18, l = n * Math.cos(r), o = n * Math.sin(r);
90
- let a = "middle";
91
- return Math.abs(Math.cos(r)) > 0.1 && (a = Math.cos(r) > 0 ? "start" : "end"), /* @__PURE__ */ s(
92
- "text",
93
- {
94
- x: l,
95
- y: o,
96
- textAnchor: a,
97
- dominantBaseline: "central",
98
- className: "fill-text-secondary text-ds-xs",
99
- children: e
100
- },
101
- `label-${t}`
102
- );
103
- }),
104
- Array.from({ length: h }, (e, t) => {
105
- const r = Math.round(x / h * (t + 1)), n = c / h * (t + 1), l = -Math.PI / 2, o = n * Math.cos(l) + 4, a = n * Math.sin(l);
106
- return /* @__PURE__ */ s(
107
- "text",
108
- {
109
- x: o,
110
- y: a,
111
- textAnchor: "start",
112
- dominantBaseline: "auto",
113
- className: "fill-text-tertiary text-ds-xs",
114
- children: r
115
- },
116
- `level-label-${t}`
117
- );
118
- }),
119
- u.map((e, t) => {
120
- const r = j(e.key), n = I(r);
121
- return n ? /* @__PURE__ */ i("g", { children: [
122
- /* @__PURE__ */ s(
123
- "path",
124
- {
125
- d: n,
126
- fill: f[t],
127
- fillOpacity: $,
128
- stroke: f[t],
129
- strokeWidth: 2,
130
- strokeLinejoin: "round"
131
- }
132
- ),
133
- C && r.map((l, o) => {
134
- const { x: a, y } = A(o, l);
135
- return /* @__PURE__ */ s(
136
- "circle",
137
- {
138
- cx: a,
139
- cy: y,
140
- r: 4,
141
- fill: f[t],
142
- stroke: "var(--color-layer-01)",
143
- strokeWidth: 2,
144
- className: "transition-opacity"
145
- },
146
- `dot-${e.key}-${o}`
147
- );
148
- })
149
- ] }, e.key) : null;
150
- }),
151
- k && d.map((e, t) => {
152
- const r = m * t - Math.PI / 2, n = c * Math.cos(r), l = c * Math.sin(r);
153
- return /* @__PURE__ */ s(
154
- "circle",
155
- {
156
- cx: n,
157
- cy: l,
158
- r: 16,
159
- fill: "transparent",
160
- className: "cursor-pointer",
161
- onMouseMove: (o) => {
162
- var y;
163
- const a = (y = o.currentTarget.closest("div")) == null ? void 0 : y.getBoundingClientRect();
164
- _(
165
- o.clientX - ((a == null ? void 0 : a.left) ?? 0),
166
- o.clientY - ((a == null ? void 0 : a.top) ?? 0),
167
- /* @__PURE__ */ i("div", { children: [
168
- /* @__PURE__ */ s("div", { className: "font-medium", children: e }),
169
- u.map((b, V) => {
170
- var N;
171
- const z = Number((N = g[t]) == null ? void 0 : N[b.key]) || 0;
172
- return /* @__PURE__ */ i(
173
- "div",
174
- {
175
- className: "flex items-center gap-ds-02",
176
- children: [
177
- /* @__PURE__ */ s(
178
- "span",
179
- {
180
- className: "inline-block h-2 w-2 rounded-ds-full",
181
- style: { backgroundColor: f[V] }
182
- }
183
- ),
184
- /* @__PURE__ */ i("span", { className: "text-text-secondary", children: [
185
- b.label,
186
- ":"
187
- ] }),
188
- " ",
189
- z.toLocaleString()
190
- ]
191
- },
192
- b.key
193
- );
194
- })
195
- ] })
196
- );
197
- },
198
- onMouseLeave: w
199
- },
200
- `hover-${t}`
201
- );
202
- })
203
- ] })
204
- }
205
- ),
206
- k && /* @__PURE__ */ s(G, { state: W })
207
- ] }),
208
- P && /* @__PURE__ */ s(
209
- O,
210
- {
211
- items: u.map((e, t) => ({
212
- label: e.label,
213
- color: f[t]
214
- })),
215
- className: "mt-ds-04"
216
- }
217
- )
218
- ] });
219
- }
220
- K.displayName = "RadarChart";
221
- export {
222
- K as RadarChart
223
- };
@@ -1,124 +0,0 @@
1
- "use client";
2
- import { jsx as o, jsxs as d } from "react/jsx-runtime";
3
- import { area as q, curveMonotoneX as G, line as D } from "d3-shape";
4
- import { scaleLinear as X } from "d3-scale";
5
- import { cn as S } from "../lib/utils.js";
6
- import { resolveColor as z } from "./_internal/colors.js";
7
- function A({
8
- data: n,
9
- variant: f = "line",
10
- width: p = 120,
11
- height: g = 32,
12
- color: Y,
13
- showLastDot: j = !1,
14
- strokeWidth: a = 1.5,
15
- className: x
16
- }) {
17
- const i = z(Y, 0);
18
- if (!n.length) return null;
19
- const e = f === "bar" ? 1 : a, L = p - e * 2, b = g - e * 2, t = X().domain([0, Math.max(n.length - 1, 1)]).range([e, e + L]), u = Math.min(...n), y = Math.max(...n), _ = u === y ? [u - 1, y + 1] : [u, y], c = X().domain(_).range([e + b, e]);
20
- if (f === "bar") {
21
- const r = Math.max(
22
- 1,
23
- (L - 1 * (n.length - 1)) / n.length
24
- ), k = e + b;
25
- return /* @__PURE__ */ o(
26
- "svg",
27
- {
28
- width: p,
29
- height: g,
30
- role: "img",
31
- "aria-label": "Sparkline bar chart",
32
- className: S("inline-block align-middle", x),
33
- children: n.map((M, h) => {
34
- const v = e + h * (r + 1), l = c(M), m = Math.max(1, k - l);
35
- return /* @__PURE__ */ o(
36
- "rect",
37
- {
38
- x: v,
39
- y: l,
40
- width: r,
41
- height: m,
42
- rx: Math.min(1, r / 2),
43
- fill: i
44
- },
45
- h
46
- );
47
- })
48
- }
49
- );
50
- }
51
- if (f === "area") {
52
- const s = q().curve(G).x((l, m) => t(m)).y0(e + b).y1((l) => c(l)), r = D().curve(G).x((l, m) => t(m)).y((l) => c(l)), k = s(n) ?? "", M = r(n) ?? "", h = t(n.length - 1), v = c(n[n.length - 1]);
53
- return /* @__PURE__ */ d(
54
- "svg",
55
- {
56
- width: p,
57
- height: g,
58
- role: "img",
59
- "aria-label": "Sparkline area chart",
60
- className: S("inline-block align-middle", x),
61
- children: [
62
- /* @__PURE__ */ o("path", { d: k, fill: i, opacity: 0.2 }),
63
- /* @__PURE__ */ o(
64
- "path",
65
- {
66
- d: M,
67
- fill: "none",
68
- stroke: i,
69
- strokeWidth: a,
70
- strokeLinejoin: "round",
71
- strokeLinecap: "round"
72
- }
73
- ),
74
- j && /* @__PURE__ */ o(
75
- "circle",
76
- {
77
- cx: h,
78
- cy: v,
79
- r: a + 1,
80
- fill: i
81
- }
82
- )
83
- ]
84
- }
85
- );
86
- }
87
- const C = D().curve(G).x((s, r) => t(r)).y((s) => c(s))(n) ?? "", H = t(n.length - 1), N = c(n[n.length - 1]);
88
- return /* @__PURE__ */ d(
89
- "svg",
90
- {
91
- width: p,
92
- height: g,
93
- role: "img",
94
- "aria-label": "Sparkline chart",
95
- className: S("inline-block align-middle", x),
96
- children: [
97
- /* @__PURE__ */ o(
98
- "path",
99
- {
100
- d: C,
101
- fill: "none",
102
- stroke: i,
103
- strokeWidth: a,
104
- strokeLinejoin: "round",
105
- strokeLinecap: "round"
106
- }
107
- ),
108
- j && /* @__PURE__ */ o(
109
- "circle",
110
- {
111
- cx: H,
112
- cy: N,
113
- r: a + 1,
114
- fill: i
115
- }
116
- )
117
- ]
118
- }
119
- );
120
- }
121
- A.displayName = "Sparkline";
122
- export {
123
- A as Sparkline
124
- };
@@ -1,32 +0,0 @@
1
- const t = {
2
- productive: {
3
- standard: "cubic-bezier(0.2, 0, 0.38, 0.9)",
4
- entrance: "cubic-bezier(0, 0, 0.38, 0.9)",
5
- exit: "cubic-bezier(0.2, 0, 1, 0.9)"
6
- },
7
- expressive: {
8
- standard: "cubic-bezier(0.4, 0.14, 0.3, 1)",
9
- entrance: "cubic-bezier(0, 0, 0.3, 1)",
10
- exit: "cubic-bezier(0.4, 0.14, 1, 1)"
11
- }
12
- }, r = {
13
- instant: "0ms",
14
- "fast-01": "70ms",
15
- "fast-02": "110ms",
16
- "moderate-01": "150ms",
17
- "moderate-02": "240ms",
18
- "slow-01": "400ms",
19
- "slow-02": "700ms"
20
- };
21
- function s(e, i) {
22
- return t[i][e];
23
- }
24
- function n(e) {
25
- return r[e];
26
- }
27
- export {
28
- n as duration,
29
- r as durations,
30
- t as easings,
31
- s as motion
32
- };
@@ -1,15 +0,0 @@
1
- "use client";
2
- import { useState as r, useEffect as c } from "react";
3
- function u() {
4
- const [d, t] = r(!1);
5
- return c(() => {
6
- if (typeof window > "u" || typeof window.matchMedia != "function") return;
7
- const e = window.matchMedia("(prefers-reduced-motion: reduce)");
8
- t(e.matches);
9
- const n = (o) => t(o.matches);
10
- return e.addEventListener("change", n), () => e.removeEventListener("change", n);
11
- }, []), d;
12
- }
13
- export {
14
- u as useReducedMotion
15
- };