@devalok/shilp-sutra 0.8.3 → 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 -701
  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,39 +0,0 @@
1
- "use client";
2
- import { jsx as p } from "react/jsx-runtime";
3
- import { useState as d, useCallback as r } from "react";
4
- import { cn as a } from "../../lib/utils.js";
5
- function u({ state: t, className: o }) {
6
- return t.visible ? /* @__PURE__ */ p(
7
- "div",
8
- {
9
- className: a(
10
- "pointer-events-none absolute z-tooltip",
11
- "rounded-ds-md border border-border",
12
- "bg-layer-01 px-ds-03 py-ds-02",
13
- "shadow-02",
14
- "text-ds-sm text-text-primary",
15
- o
16
- ),
17
- style: { left: t.x + 12, top: t.y - 12 },
18
- children: t.content
19
- }
20
- ) : null;
21
- }
22
- u.displayName = "ChartTooltip";
23
- function f() {
24
- const [t, o] = d({
25
- visible: !1,
26
- x: 0,
27
- y: 0,
28
- content: null
29
- }), i = r((e, s, n) => {
30
- o({ visible: !0, x: e, y: s, content: n });
31
- }, []), l = r(() => {
32
- o((e) => ({ ...e, visible: !1 }));
33
- }, []);
34
- return { tooltip: t, show: i, hide: l };
35
- }
36
- export {
37
- u as ChartTooltip,
38
- f as useChartTooltip
39
- };
@@ -1,10 +0,0 @@
1
- "use client";
2
- const t = {
3
- top: 20,
4
- right: 20,
5
- bottom: 40,
6
- left: 50
7
- };
8
- export {
9
- t as DEFAULT_MARGIN
10
- };
@@ -1,245 +0,0 @@
1
- "use client";
2
- import { jsxs as f, jsx as r, Fragment as S } from "react/jsx-runtime";
3
- import * as oe from "react";
4
- import { stack as ne, stackOrderNone as re, stackOffsetNone as ae, area as _, curveMonotoneX as le, curveLinear as ce, line as z } from "d3-shape";
5
- import { scaleLinear as B, scalePoint as se } from "d3-scale";
6
- import { cn as ie } from "../lib/utils.js";
7
- import { ChartContainer as me } from "./chart-container.js";
8
- import { Axis as I } from "./_internal/axes.js";
9
- import { GridLines as O } from "./_internal/grid-lines.js";
10
- import { Legend as ue } from "./_internal/legend.js";
11
- import { useChartTooltip as pe, ChartTooltip as fe } from "./_internal/tooltip.js";
12
- import { resolveColor as de } from "./_internal/colors.js";
13
- import { useReducedMotion as he } from "./_internal/animation.js";
14
- function ye({
15
- data: m,
16
- xKey: h,
17
- series: c,
18
- curved: V = !1,
19
- stacked: G = !1,
20
- fillOpacity: b = 0.3,
21
- gradient: k = !1,
22
- strokeWidth: X = 2,
23
- height: F = 300,
24
- showGrid: A = !0,
25
- showTooltip: M = !0,
26
- showLegend: Y = !1,
27
- animate: ge = !0,
28
- xLabel: Z,
29
- yLabel: q,
30
- className: E
31
- }) {
32
- const { tooltip: J, show: Q, hide: U } = pe();
33
- he();
34
- const y = c.map((d, u) => de(d.color, u)), C = oe.useId();
35
- return /* @__PURE__ */ f("div", { className: ie("relative", E), children: [
36
- /* @__PURE__ */ r(me, { height: F, children: ({ width: d, height: u, margin: ke }) => {
37
- const L = m.map((e) => e[h]), W = L.every((e) => typeof e == "number");
38
- let $, v, x;
39
- if (W) {
40
- const e = L, t = Math.min(...e), a = Math.max(...e), s = B().domain([t, a]).range([0, d]);
41
- $ = s, v = (i) => s(Number(i[h])), x = (i) => s(Number(m[i][h]));
42
- } else {
43
- const e = L.map(String), t = se().domain(e).range([0, d]).padding(0.5);
44
- $ = t, v = (a) => t(String(a[h])) ?? 0, x = (a) => t(String(m[a][h])) ?? 0;
45
- }
46
- let D;
47
- G ? D = Math.max(
48
- ...m.map(
49
- (e) => c.reduce((t, a) => t + (Number(e[a.key]) || 0), 0)
50
- )
51
- ) : D = Math.max(
52
- ...m.flatMap(
53
- (e) => c.map((t) => Number(e[t.key]) || 0)
54
- )
55
- );
56
- const g = B().domain([0, D * 1.1]).range([u, 0]).nice(), N = V ? le : ce, j = () => m.map((e, t) => {
57
- const a = v(e), s = d / Math.max(m.length - 1, 1);
58
- return /* @__PURE__ */ r(
59
- "rect",
60
- {
61
- x: a - s / 2,
62
- y: 0,
63
- width: s,
64
- height: u,
65
- fill: "transparent",
66
- onMouseMove: (i) => {
67
- var o;
68
- const p = (o = i.currentTarget.closest("div")) == null ? void 0 : o.getBoundingClientRect();
69
- Q(
70
- i.clientX - ((p == null ? void 0 : p.left) ?? 0),
71
- i.clientY - ((p == null ? void 0 : p.top) ?? 0),
72
- /* @__PURE__ */ f("div", { children: [
73
- /* @__PURE__ */ r("div", { className: "font-medium", children: String(e[h]) }),
74
- c.map((l, n) => /* @__PURE__ */ f(
75
- "div",
76
- {
77
- className: "flex items-center gap-ds-02",
78
- children: [
79
- /* @__PURE__ */ r(
80
- "span",
81
- {
82
- className: "inline-block h-2 w-2 rounded-ds-full",
83
- style: { backgroundColor: y[n] }
84
- }
85
- ),
86
- /* @__PURE__ */ f("span", { className: "text-text-secondary", children: [
87
- l.label,
88
- ":"
89
- ] }),
90
- " ",
91
- Number(e[l.key]).toLocaleString()
92
- ]
93
- },
94
- l.key
95
- ))
96
- ] })
97
- );
98
- },
99
- onMouseLeave: U
100
- },
101
- `hover-${t}`
102
- );
103
- }), P = () => k ? /* @__PURE__ */ r("defs", { children: c.map((e, t) => /* @__PURE__ */ f(
104
- "linearGradient",
105
- {
106
- id: `${C}-gradient-${t}`,
107
- x1: "0",
108
- y1: "0",
109
- x2: "0",
110
- y2: "1",
111
- children: [
112
- /* @__PURE__ */ r(
113
- "stop",
114
- {
115
- offset: "0%",
116
- stopColor: y[t],
117
- stopOpacity: b
118
- }
119
- ),
120
- /* @__PURE__ */ r(
121
- "stop",
122
- {
123
- offset: "100%",
124
- stopColor: y[t],
125
- stopOpacity: 0.05
126
- }
127
- )
128
- ]
129
- },
130
- `grad-${t}`
131
- )) }) : null, R = () => /* @__PURE__ */ f(S, { children: [
132
- /* @__PURE__ */ r(
133
- I,
134
- {
135
- scale: $,
136
- orientation: "bottom",
137
- transform: `translate(0,${u})`,
138
- label: Z
139
- }
140
- ),
141
- /* @__PURE__ */ r(I, { scale: g, orientation: "left", label: q })
142
- ] });
143
- if (G) {
144
- const e = c.map((o) => o.key), t = ne().keys(e).order(re).offset(ae), a = m.map((o) => {
145
- const l = { [h]: String(o[h]) };
146
- for (const n of c)
147
- l[n.key] = Number(o[n.key]) || 0;
148
- return l;
149
- }), s = t(a), i = _().curve(N).x((o, l) => x(l)).y0((o) => g(o[0])).y1((o) => g(o[1])), p = z().curve(N).x((o, l) => x(l)).y((o) => g(o[1]));
150
- return /* @__PURE__ */ f(S, { children: [
151
- P(),
152
- A && /* @__PURE__ */ r(
153
- O,
154
- {
155
- width: d,
156
- height: u,
157
- yScale: g,
158
- horizontal: !0
159
- }
160
- ),
161
- [...s].reverse().map((o, l) => {
162
- const n = s.length - 1 - l, T = o, K = i(T) ?? "", ee = p(T) ?? "", te = k ? `url(#${C}-gradient-${n})` : y[n];
163
- return /* @__PURE__ */ f("g", { children: [
164
- /* @__PURE__ */ r(
165
- "path",
166
- {
167
- d: K,
168
- fill: te,
169
- opacity: k ? 1 : b
170
- }
171
- ),
172
- /* @__PURE__ */ r(
173
- "path",
174
- {
175
- d: ee,
176
- fill: "none",
177
- stroke: y[n],
178
- strokeWidth: X,
179
- strokeLinejoin: "round",
180
- strokeLinecap: "round"
181
- }
182
- )
183
- ] }, c[n].key);
184
- }),
185
- M && j(),
186
- R()
187
- ] });
188
- }
189
- const w = _().curve(N).defined((e) => e != null), H = z().curve(N).defined((e) => e != null);
190
- return /* @__PURE__ */ f(S, { children: [
191
- P(),
192
- A && /* @__PURE__ */ r(
193
- O,
194
- {
195
- width: d,
196
- height: u,
197
- yScale: g,
198
- horizontal: !0
199
- }
200
- ),
201
- [...c].reverse().map((e, t) => {
202
- const a = c.length - 1 - t, s = w.x((n) => v(n)).y0(u).y1((n) => g(Number(n[e.key]) || 0)), i = H.x((n) => v(n)).y((n) => g(Number(n[e.key]) || 0)), p = s(m) ?? "", o = i(m) ?? "", l = k ? `url(#${C}-gradient-${a})` : y[a];
203
- return /* @__PURE__ */ f("g", { children: [
204
- /* @__PURE__ */ r(
205
- "path",
206
- {
207
- d: p,
208
- fill: l,
209
- opacity: k ? 1 : b
210
- }
211
- ),
212
- /* @__PURE__ */ r(
213
- "path",
214
- {
215
- d: o,
216
- fill: "none",
217
- stroke: y[a],
218
- strokeWidth: X,
219
- strokeLinejoin: "round",
220
- strokeLinecap: "round"
221
- }
222
- )
223
- ] }, e.key);
224
- }),
225
- M && j(),
226
- R()
227
- ] });
228
- } }),
229
- M && /* @__PURE__ */ r(fe, { state: J }),
230
- Y && c.length > 1 && /* @__PURE__ */ r(
231
- ue,
232
- {
233
- items: c.map((d, u) => ({
234
- label: d.label,
235
- color: y[u]
236
- })),
237
- className: "mt-ds-04"
238
- }
239
- )
240
- ] });
241
- }
242
- ye.displayName = "AreaChart";
243
- export {
244
- ye as AreaChart
245
- };
@@ -1,153 +0,0 @@
1
- "use client";
2
- import { jsxs as v, jsx as r, Fragment as T } from "react/jsx-runtime";
3
- import { scaleBand as I, scaleLinear as H } from "d3-scale";
4
- import { cn as k } from "../lib/utils.js";
5
- import { ChartContainer as L } from "./chart-container.js";
6
- import { Axis as x } from "./_internal/axes.js";
7
- import { GridLines as tt } from "./_internal/grid-lines.js";
8
- import { Legend as at } from "./_internal/legend.js";
9
- import { useChartTooltip as rt, ChartTooltip as ot } from "./_internal/tooltip.js";
10
- import { resolveColor as X } from "./_internal/colors.js";
11
- import { useReducedMotion as nt } from "./_internal/animation.js";
12
- function it({
13
- data: g,
14
- xKey: V,
15
- yKey: C,
16
- orientation: Y = "vertical",
17
- stacked: s = !1,
18
- grouped: N = !1,
19
- color: n,
20
- height: _ = 300,
21
- showGrid: q = !0,
22
- showTooltip: z = !0,
23
- showLegend: D = !1,
24
- animate: et = !0,
25
- barRadius: E = 4,
26
- xLabel: F,
27
- yLabel: G,
28
- seriesLabels: f,
29
- className: J
30
- }) {
31
- const { tooltip: P, show: Q, hide: U } = rt();
32
- nt();
33
- const i = Y === "vertical", c = Array.isArray(C) ? C : [C], h = c.length > 1, S = h ? c.map(
34
- (p, a) => X(
35
- Array.isArray(n) ? n[a] : typeof n == "string" ? n : void 0,
36
- a
37
- )
38
- ) : [
39
- X(
40
- typeof n == "string" ? n : Array.isArray(n) ? n[0] : void 0,
41
- 0
42
- )
43
- ];
44
- return /* @__PURE__ */ v("div", { className: k("relative", J), children: [
45
- /* @__PURE__ */ r(L, { height: _, children: ({ width: p, height: a, margin: lt }) => {
46
- const Z = g.map((e) => String(e[V]));
47
- let A;
48
- s ? A = Math.max(
49
- ...g.map(
50
- (e) => c.reduce((l, o) => l + (Number(e[o]) || 0), 0)
51
- )
52
- ) : A = Math.max(
53
- ...g.flatMap((e) => c.map((l) => Number(e[l]) || 0))
54
- );
55
- const u = I().domain(Z).range(i ? [0, p] : [0, a]).padding(0.2), t = H().domain([0, A * 1.1]).range(i ? [a, 0] : [0, p]).nice(), O = u.bandwidth(), y = h && N ? O / c.length : O;
56
- return /* @__PURE__ */ v(T, { children: [
57
- q && /* @__PURE__ */ r(
58
- tt,
59
- {
60
- width: p,
61
- height: a,
62
- yScale: i ? t : void 0,
63
- xScale: i ? void 0 : t,
64
- horizontal: i,
65
- vertical: !i
66
- }
67
- ),
68
- g.map((e) => {
69
- const l = String(e[V]);
70
- let o = 0;
71
- return c.map((B, M) => {
72
- const m = Number(e[B]) || 0, K = S[M] || S[0];
73
- let $, b, j, w;
74
- return i ? ($ = (u(l) ?? 0) + (N && h ? M * y : 0), b = t(s ? o + m : m), j = y, w = s ? t(o) - t(o + m) : a - t(m)) : ($ = s ? t(o) : 0, b = (u(l) ?? 0) + (N && h ? M * y : 0), j = s ? t(o + m) - t(o) : t(m), w = y), s && (o += m), /* @__PURE__ */ r(
75
- "rect",
76
- {
77
- x: $,
78
- y: b,
79
- width: Math.max(0, j),
80
- height: Math.max(0, w),
81
- rx: E,
82
- fill: K,
83
- className: "transition-opacity hover:opacity-[0.8]",
84
- onMouseMove: (R) => {
85
- var W;
86
- if (z) {
87
- const d = (W = R.currentTarget.closest("div")) == null ? void 0 : W.getBoundingClientRect();
88
- Q(
89
- R.clientX - ((d == null ? void 0 : d.left) ?? 0),
90
- R.clientY - ((d == null ? void 0 : d.top) ?? 0),
91
- /* @__PURE__ */ v("div", { children: [
92
- /* @__PURE__ */ r("div", { className: "font-medium", children: l }),
93
- h && /* @__PURE__ */ r("div", { className: "text-text-secondary", children: (f == null ? void 0 : f[M]) ?? B }),
94
- /* @__PURE__ */ r("div", { children: m.toLocaleString() })
95
- ] })
96
- );
97
- }
98
- },
99
- onMouseLeave: U
100
- },
101
- `${l}-${B}`
102
- );
103
- });
104
- }),
105
- i ? /* @__PURE__ */ v(T, { children: [
106
- /* @__PURE__ */ r(
107
- x,
108
- {
109
- scale: u,
110
- orientation: "bottom",
111
- transform: `translate(0,${a})`,
112
- label: F
113
- }
114
- ),
115
- /* @__PURE__ */ r(x, { scale: t, orientation: "left", label: G })
116
- ] }) : /* @__PURE__ */ v(T, { children: [
117
- /* @__PURE__ */ r(
118
- x,
119
- {
120
- scale: t,
121
- orientation: "bottom",
122
- transform: `translate(0,${a})`,
123
- label: F
124
- }
125
- ),
126
- /* @__PURE__ */ r(
127
- x,
128
- {
129
- scale: u,
130
- orientation: "left",
131
- label: G
132
- }
133
- )
134
- ] })
135
- ] });
136
- } }),
137
- z && /* @__PURE__ */ r(ot, { state: P }),
138
- D && h && /* @__PURE__ */ r(
139
- at,
140
- {
141
- items: c.map((p, a) => ({
142
- label: (f == null ? void 0 : f[a]) ?? p,
143
- color: S[a]
144
- })),
145
- className: "mt-ds-04"
146
- }
147
- )
148
- ] });
149
- }
150
- it.displayName = "BarChart";
151
- export {
152
- it as BarChart
153
- };
@@ -1,27 +0,0 @@
1
- "use client";
2
- import { jsx as n } from "react/jsx-runtime";
3
- import { useRef as u, useState as p, useEffect as g } from "react";
4
- import { cn as v } from "../lib/utils.js";
5
- import { DEFAULT_MARGIN as b } from "./_internal/types.js";
6
- function w({
7
- height: i = 300,
8
- margin: s,
9
- className: c,
10
- children: m
11
- }) {
12
- const e = u(null), [r, f] = p(0), t = { ...b, ...s };
13
- g(() => {
14
- if (!e.current) return;
15
- const o = new ResizeObserver((d) => {
16
- const a = d[0];
17
- a && f(a.contentRect.width);
18
- });
19
- return o.observe(e.current), () => o.disconnect();
20
- }, []);
21
- const l = Math.max(0, r - t.left - t.right), h = Math.max(0, i - t.top - t.bottom);
22
- return /* @__PURE__ */ n("div", { ref: e, className: v("relative w-full", c), children: r > 0 && /* @__PURE__ */ n("svg", { width: r, height: i, role: "img", "aria-label": "Chart", children: /* @__PURE__ */ n("g", { transform: `translate(${t.left},${t.top})`, children: m({ width: l, height: h, margin: t }) }) }) });
23
- }
24
- w.displayName = "ChartContainer";
25
- export {
26
- w as ChartContainer
27
- };
@@ -1,72 +0,0 @@
1
- "use client";
2
- import { jsx as e, jsxs as w } from "react/jsx-runtime";
3
- import { arc as f } from "d3-shape";
4
- import { cn as B } from "../lib/utils.js";
5
- import { resolveColor as V } from "./_internal/colors.js";
6
- import { useReducedMotion as z, getTransitionDuration as D } from "./_internal/animation.js";
7
- const d = (c) => c * Math.PI / 180;
8
- function E({
9
- value: c,
10
- max: o = 100,
11
- min: r = 0,
12
- label: a,
13
- valueLabel: n,
14
- color: x,
15
- trackColor: p = "var(--color-border-subtle)",
16
- height: g = 200,
17
- startAngle: i = -120,
18
- endAngle: m = 120,
19
- thickness: s = 16,
20
- animate: v = !0,
21
- className: y
22
- }) {
23
- const R = z(), h = D(R, v ? 600 : 0), G = V(x, 0), u = g, t = u / 2, l = Math.min(Math.max(c, r), o), M = o === r ? 0 : (l - r) / (o - r), C = i + (m - i) * M, N = typeof n == "function" ? n(l) : typeof n == "string" ? n : String(l), A = f().innerRadius(t - s).outerRadius(t).startAngle(d(i)).endAngle(d(m)).cornerRadius(s / 2), P = f().innerRadius(t - s).outerRadius(t).startAngle(d(i)).endAngle(d(C)).cornerRadius(s / 2), $ = A(null) ?? "", j = P(null) ?? "";
24
- return /* @__PURE__ */ e(
25
- "div",
26
- {
27
- className: B("inline-flex flex-col items-center", y),
28
- role: "meter",
29
- "aria-valuenow": l,
30
- "aria-valuemin": r,
31
- "aria-valuemax": o,
32
- "aria-label": a ?? "Gauge chart",
33
- children: /* @__PURE__ */ e("svg", { width: u, height: u, role: "img", "aria-hidden": "true", children: /* @__PURE__ */ w("g", { transform: `translate(${t},${t})`, children: [
34
- /* @__PURE__ */ e("path", { d: $, fill: p }),
35
- /* @__PURE__ */ e(
36
- "path",
37
- {
38
- d: j,
39
- fill: G,
40
- style: h > 0 ? { transition: `d ${h}ms ease-out` } : void 0
41
- }
42
- ),
43
- /* @__PURE__ */ e(
44
- "text",
45
- {
46
- x: 0,
47
- y: a ? -4 : 0,
48
- textAnchor: "middle",
49
- dominantBaseline: "central",
50
- className: "fill-text-primary text-ds-2xl font-semibold",
51
- children: N
52
- }
53
- ),
54
- a && /* @__PURE__ */ e(
55
- "text",
56
- {
57
- x: 0,
58
- y: 20,
59
- textAnchor: "middle",
60
- dominantBaseline: "central",
61
- className: "fill-text-secondary text-ds-xs",
62
- children: a
63
- }
64
- )
65
- ] }) })
66
- }
67
- );
68
- }
69
- E.displayName = "GaugeChart";
70
- export {
71
- E as GaugeChart
72
- };