@runlume/admin-ui 0.1.0 → 0.2.1

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 (286) hide show
  1. package/README.en.md +6 -13
  2. package/README.md +5 -11
  3. package/dist-package/_virtual/_rolldown/runtime.cjs +1 -0
  4. package/dist-package/admin-ui.cjs +1 -0
  5. package/dist-package/admin-ui.d.ts +41 -1
  6. package/dist-package/admin-ui.d.ts.map +1 -1
  7. package/dist-package/admin-ui.js +79 -0
  8. package/dist-package/components/calendar.cjs +1 -0
  9. package/dist-package/components/calendar.d.ts +13 -0
  10. package/dist-package/components/calendar.d.ts.map +1 -0
  11. package/dist-package/components/calendar.js +91 -0
  12. package/dist-package/components/cascader.cjs +1 -0
  13. package/dist-package/components/cascader.d.ts +19 -0
  14. package/dist-package/components/cascader.d.ts.map +1 -0
  15. package/dist-package/components/cascader.js +85 -0
  16. package/dist-package/components/charts.cjs +1 -0
  17. package/dist-package/components/charts.d.ts +80 -0
  18. package/dist-package/components/charts.d.ts.map +1 -0
  19. package/dist-package/components/charts.js +374 -0
  20. package/dist-package/components/code-block.cjs +1 -0
  21. package/dist-package/components/code-block.d.ts +7 -0
  22. package/dist-package/components/code-block.d.ts.map +1 -0
  23. package/dist-package/components/code-block.js +47 -0
  24. package/dist-package/components/column-chart.cjs +1 -0
  25. package/dist-package/components/column-chart.d.ts +18 -0
  26. package/dist-package/components/column-chart.d.ts.map +1 -0
  27. package/dist-package/components/column-chart.js +89 -0
  28. package/dist-package/components/combobox.cjs +1 -0
  29. package/dist-package/components/combobox.d.ts +24 -0
  30. package/dist-package/components/combobox.d.ts.map +1 -0
  31. package/dist-package/components/combobox.js +111 -0
  32. package/dist-package/components/confirm-dialog.cjs +1 -0
  33. package/dist-package/components/confirm-dialog.d.ts +17 -0
  34. package/dist-package/components/confirm-dialog.d.ts.map +1 -0
  35. package/dist-package/components/confirm-dialog.js +44 -0
  36. package/dist-package/components/count-to.cjs +1 -0
  37. package/dist-package/components/count-to.d.ts +13 -0
  38. package/dist-package/components/count-to.d.ts.map +1 -0
  39. package/dist-package/components/count-to.js +36 -0
  40. package/dist-package/components/cursor-pagination.cjs +1 -0
  41. package/dist-package/components/cursor-pagination.d.ts +11 -0
  42. package/dist-package/components/cursor-pagination.d.ts.map +1 -0
  43. package/dist-package/components/cursor-pagination.js +39 -0
  44. package/dist-package/components/data-table.cjs +1 -0
  45. package/dist-package/components/data-table.d.ts +69 -0
  46. package/dist-package/components/data-table.d.ts.map +1 -0
  47. package/dist-package/components/data-table.js +377 -0
  48. package/dist-package/components/descriptions.cjs +1 -0
  49. package/dist-package/components/descriptions.d.ts +16 -0
  50. package/dist-package/components/descriptions.d.ts.map +1 -0
  51. package/dist-package/components/descriptions.js +28 -0
  52. package/dist-package/components/editable-table.cjs +1 -0
  53. package/dist-package/components/editable-table.d.ts +27 -0
  54. package/dist-package/components/editable-table.d.ts.map +1 -0
  55. package/dist-package/components/editable-table.js +212 -0
  56. package/dist-package/components/filter-presets.cjs +1 -0
  57. package/dist-package/components/filter-presets.d.ts +11 -0
  58. package/dist-package/components/filter-presets.d.ts.map +1 -0
  59. package/dist-package/components/filter-presets.js +17 -0
  60. package/dist-package/components/fixed-bar.cjs +1 -0
  61. package/dist-package/components/fixed-bar.d.ts +11 -0
  62. package/dist-package/components/fixed-bar.d.ts.map +1 -0
  63. package/dist-package/components/fixed-bar.js +18 -0
  64. package/dist-package/components/image-preview.cjs +1 -0
  65. package/dist-package/components/image-preview.d.ts +14 -0
  66. package/dist-package/components/image-preview.d.ts.map +1 -0
  67. package/dist-package/components/image-preview.js +166 -0
  68. package/dist-package/components/layout-container.cjs +1 -0
  69. package/dist-package/components/layout-container.d.ts +17 -0
  70. package/dist-package/components/layout-container.d.ts.map +1 -0
  71. package/dist-package/components/layout-container.js +85 -0
  72. package/dist-package/components/mention.cjs +1 -0
  73. package/dist-package/components/mention.d.ts +20 -0
  74. package/dist-package/components/mention.d.ts.map +1 -0
  75. package/dist-package/components/mention.js +126 -0
  76. package/dist-package/components/multi-select.cjs +1 -0
  77. package/dist-package/components/multi-select.d.ts +17 -0
  78. package/dist-package/components/multi-select.d.ts.map +1 -0
  79. package/dist-package/components/multi-select.js +126 -0
  80. package/dist-package/components/multi-step-loader.cjs +1 -0
  81. package/dist-package/components/multi-step-loader.d.ts +18 -0
  82. package/dist-package/components/multi-step-loader.d.ts.map +1 -0
  83. package/dist-package/components/multi-step-loader.js +38 -0
  84. package/dist-package/components/page-button.cjs +1 -0
  85. package/dist-package/components/page-button.d.ts +6 -0
  86. package/dist-package/components/page-button.d.ts.map +1 -0
  87. package/dist-package/components/page-button.js +24 -0
  88. package/dist-package/components/page-pager.cjs +1 -0
  89. package/dist-package/components/page-pager.d.ts +11 -0
  90. package/dist-package/components/page-pager.d.ts.map +1 -0
  91. package/dist-package/components/page-pager.js +51 -0
  92. package/dist-package/components/page.cjs +1 -0
  93. package/dist-package/components/page.d.ts +34 -0
  94. package/dist-package/components/page.d.ts.map +1 -0
  95. package/dist-package/components/page.js +208 -0
  96. package/dist-package/components/pagination-bar.cjs +1 -0
  97. package/dist-package/components/pagination-bar.d.ts +8 -0
  98. package/dist-package/components/pagination-bar.d.ts.map +1 -0
  99. package/dist-package/components/pagination-bar.js +23 -0
  100. package/dist-package/components/password-strength.cjs +1 -0
  101. package/dist-package/components/password-strength.d.ts +11 -0
  102. package/dist-package/components/password-strength.d.ts.map +1 -0
  103. package/dist-package/components/password-strength.js +70 -0
  104. package/dist-package/components/rate.cjs +1 -0
  105. package/dist-package/components/rate.d.ts +13 -0
  106. package/dist-package/components/rate.d.ts.map +1 -0
  107. package/dist-package/components/rate.js +56 -0
  108. package/dist-package/components/resizable-panel.cjs +1 -0
  109. package/dist-package/components/resizable-panel.d.ts +15 -0
  110. package/dist-package/components/resizable-panel.d.ts.map +1 -0
  111. package/dist-package/components/resizable-panel.js +56 -0
  112. package/dist-package/components/search-filters.cjs +1 -0
  113. package/dist-package/components/search-filters.d.ts +31 -0
  114. package/dist-package/components/search-filters.d.ts.map +1 -0
  115. package/dist-package/components/search-filters.js +110 -0
  116. package/dist-package/components/sortable-list.cjs +1 -0
  117. package/dist-package/components/sortable-list.d.ts +14 -0
  118. package/dist-package/components/sortable-list.d.ts.map +1 -0
  119. package/dist-package/components/sortable-list.js +48 -0
  120. package/dist-package/components/sparkline.cjs +1 -0
  121. package/dist-package/components/sparkline.d.ts +11 -0
  122. package/dist-package/components/sparkline.d.ts.map +1 -0
  123. package/dist-package/components/sparkline.js +50 -0
  124. package/dist-package/components/status-badge.cjs +1 -0
  125. package/dist-package/components/status-badge.d.ts +4 -0
  126. package/dist-package/components/status-badge.d.ts.map +1 -0
  127. package/dist-package/components/status-badge.js +28 -0
  128. package/dist-package/components/steps.cjs +1 -0
  129. package/dist-package/components/steps.d.ts +15 -0
  130. package/dist-package/components/steps.d.ts.map +1 -0
  131. package/dist-package/components/steps.js +41 -0
  132. package/dist-package/components/storage-box.cjs +1 -0
  133. package/dist-package/components/storage-box.d.ts +19 -0
  134. package/dist-package/components/storage-box.d.ts.map +1 -0
  135. package/dist-package/components/storage-box.js +153 -0
  136. package/dist-package/components/table-cell-overflow.cjs +1 -0
  137. package/dist-package/components/table-cell-overflow.d.ts +5 -0
  138. package/dist-package/components/table-cell-overflow.d.ts.map +1 -0
  139. package/dist-package/components/table-cell-overflow.js +31 -0
  140. package/dist-package/components/table-toolbar.cjs +1 -0
  141. package/dist-package/components/table-toolbar.d.ts +5 -0
  142. package/dist-package/components/table-toolbar.d.ts.map +1 -0
  143. package/dist-package/components/table-toolbar.js +11 -0
  144. package/dist-package/components/timeline.cjs +1 -0
  145. package/dist-package/components/timeline.d.ts +14 -0
  146. package/dist-package/components/timeline.d.ts.map +1 -0
  147. package/dist-package/components/timeline.js +40 -0
  148. package/dist-package/components/transfer.cjs +1 -0
  149. package/dist-package/components/transfer.d.ts +18 -0
  150. package/dist-package/components/transfer.d.ts.map +1 -0
  151. package/dist-package/components/transfer.js +98 -0
  152. package/dist-package/components/tree-table.cjs +1 -0
  153. package/dist-package/components/tree-table.d.ts +23 -0
  154. package/dist-package/components/tree-table.d.ts.map +1 -0
  155. package/dist-package/components/tree-table.js +53 -0
  156. package/dist-package/components/tree.cjs +1 -0
  157. package/dist-package/components/tree.d.ts +36 -0
  158. package/dist-package/components/tree.d.ts.map +1 -0
  159. package/dist-package/components/tree.js +204 -0
  160. package/dist-package/components/trend.cjs +1 -0
  161. package/dist-package/components/trend.d.ts +19 -0
  162. package/dist-package/components/trend.d.ts.map +1 -0
  163. package/dist-package/components/trend.js +18 -0
  164. package/dist-package/components/ui/alert-dialog.cjs +1 -0
  165. package/dist-package/components/ui/alert-dialog.js +57 -0
  166. package/dist-package/components/ui/alert.cjs +1 -0
  167. package/dist-package/components/ui/alert.js +63 -0
  168. package/dist-package/components/ui/avatar.cjs +1 -0
  169. package/dist-package/components/ui/avatar.js +27 -0
  170. package/dist-package/components/ui/badge.cjs +1 -0
  171. package/dist-package/components/ui/badge.js +40 -0
  172. package/dist-package/components/ui/breadcrumb.cjs +1 -0
  173. package/dist-package/components/ui/breadcrumb.js +70 -0
  174. package/dist-package/components/ui/button.cjs +1 -0
  175. package/dist-package/components/ui/button.js +58 -0
  176. package/dist-package/components/ui/card.cjs +1 -0
  177. package/dist-package/components/ui/card.js +55 -0
  178. package/dist-package/components/ui/checkbox.cjs +1 -0
  179. package/dist-package/components/ui/checkbox.js +19 -0
  180. package/dist-package/components/ui/collapsible.cjs +1 -0
  181. package/dist-package/components/ui/collapsible.js +32 -0
  182. package/dist-package/components/ui/context-menu.cjs +1 -0
  183. package/dist-package/components/ui/context-menu.js +46 -0
  184. package/dist-package/components/ui/date-input.cjs +1 -0
  185. package/dist-package/components/ui/date-input.js +183 -0
  186. package/dist-package/components/ui/date-range-input.cjs +1 -0
  187. package/dist-package/components/ui/date-range-input.js +209 -0
  188. package/dist-package/components/ui/date-time-input.cjs +1 -0
  189. package/dist-package/components/ui/date-time-input.js +23 -0
  190. package/dist-package/components/ui/dialog.cjs +1 -0
  191. package/dist-package/components/ui/dialog.js +189 -0
  192. package/dist-package/components/ui/dropdown-menu.cjs +1 -0
  193. package/dist-package/components/ui/dropdown-menu.js +124 -0
  194. package/dist-package/components/ui/file-upload.cjs +1 -0
  195. package/dist-package/components/ui/file-upload.js +160 -0
  196. package/dist-package/components/ui/hover-card.cjs +1 -0
  197. package/dist-package/components/ui/hover-card.js +28 -0
  198. package/dist-package/components/ui/input-otp.cjs +1 -0
  199. package/dist-package/components/ui/input-otp.js +33 -0
  200. package/dist-package/components/ui/input.cjs +1 -0
  201. package/dist-package/components/ui/input.js +65 -0
  202. package/dist-package/components/ui/kbd.cjs +1 -0
  203. package/dist-package/components/ui/kbd.js +20 -0
  204. package/dist-package/components/ui/label.cjs +1 -0
  205. package/dist-package/components/ui/label.js +14 -0
  206. package/dist-package/components/ui/native-select.cjs +1 -0
  207. package/dist-package/components/ui/native-select.js +125 -0
  208. package/dist-package/components/ui/number-field.cjs +1 -0
  209. package/dist-package/components/ui/number-field.js +50 -0
  210. package/dist-package/components/ui/progress.cjs +1 -0
  211. package/dist-package/components/ui/progress.js +28 -0
  212. package/dist-package/components/ui/radio-group.cjs +1 -0
  213. package/dist-package/components/ui/radio-group.js +27 -0
  214. package/dist-package/components/ui/scroll-area.cjs +1 -0
  215. package/dist-package/components/ui/scroll-area.js +25 -0
  216. package/dist-package/components/ui/select.cjs +1 -0
  217. package/dist-package/components/ui/select.js +23 -0
  218. package/dist-package/components/ui/separator.cjs +1 -0
  219. package/dist-package/components/ui/separator.js +17 -0
  220. package/dist-package/components/ui/sheet.cjs +1 -0
  221. package/dist-package/components/ui/sheet.js +86 -0
  222. package/dist-package/components/ui/sidebar.cjs +1 -0
  223. package/dist-package/components/ui/sidebar.js +350 -0
  224. package/dist-package/components/ui/skeleton.cjs +1 -0
  225. package/dist-package/components/ui/skeleton.js +12 -0
  226. package/dist-package/components/ui/slider.cjs +1 -0
  227. package/dist-package/components/ui/slider.js +36 -0
  228. package/dist-package/components/ui/switch.cjs +1 -0
  229. package/dist-package/components/ui/switch.js +14 -0
  230. package/dist-package/components/ui/table.cjs +1 -0
  231. package/dist-package/components/ui/table.js +66 -0
  232. package/dist-package/components/ui/tabs.cjs +1 -0
  233. package/dist-package/components/ui/tabs.js +47 -0
  234. package/dist-package/components/ui/tag-variants.cjs +1 -0
  235. package/dist-package/components/ui/tag-variants.js +15 -0
  236. package/dist-package/components/ui/tag.cjs +1 -0
  237. package/dist-package/components/ui/tag.js +31 -0
  238. package/dist-package/components/ui/textarea.cjs +1 -0
  239. package/dist-package/components/ui/textarea.js +13 -0
  240. package/dist-package/components/ui/time-input.cjs +1 -0
  241. package/dist-package/components/ui/time-input.js +89 -0
  242. package/dist-package/components/ui/tooltip.cjs +1 -0
  243. package/dist-package/components/ui/tooltip.js +35 -0
  244. package/dist-package/hooks/use-mobile.cjs +1 -0
  245. package/dist-package/hooks/use-mobile.js +11 -0
  246. package/dist-package/lib/dialog-focus.cjs +1 -0
  247. package/dist-package/lib/dialog-focus.js +10 -0
  248. package/dist-package/lib/metrics.cjs +1 -0
  249. package/dist-package/lib/metrics.d.ts +18 -0
  250. package/dist-package/lib/metrics.d.ts.map +1 -0
  251. package/dist-package/lib/metrics.js +22 -0
  252. package/dist-package/lib/pager.cjs +1 -0
  253. package/dist-package/lib/pager.d.ts +8 -0
  254. package/dist-package/lib/pager.d.ts.map +1 -0
  255. package/dist-package/lib/pager.js +18 -0
  256. package/dist-package/lib/password.cjs +1 -0
  257. package/dist-package/lib/password.d.ts +14 -0
  258. package/dist-package/lib/password.d.ts.map +1 -0
  259. package/dist-package/lib/password.js +34 -0
  260. package/dist-package/lib/presets.cjs +1 -0
  261. package/dist-package/lib/presets.d.ts +25 -0
  262. package/dist-package/lib/presets.d.ts.map +1 -0
  263. package/dist-package/lib/presets.js +48 -0
  264. package/dist-package/lib/range.cjs +1 -0
  265. package/dist-package/lib/range.js +57 -0
  266. package/dist-package/lib/storage-key.cjs +1 -0
  267. package/dist-package/lib/storage-key.d.ts +2 -0
  268. package/dist-package/lib/storage-key.d.ts.map +1 -0
  269. package/dist-package/lib/storage-key.js +6 -0
  270. package/dist-package/lib/table-prefs.cjs +1 -0
  271. package/dist-package/lib/table-prefs.d.ts +17 -0
  272. package/dist-package/lib/table-prefs.d.ts.map +1 -0
  273. package/dist-package/lib/table-prefs.js +64 -0
  274. package/dist-package/lib/tree.cjs +1 -0
  275. package/dist-package/lib/tree.d.ts +37 -0
  276. package/dist-package/lib/tree.d.ts.map +1 -0
  277. package/dist-package/lib/tree.js +57 -0
  278. package/dist-package/lib/use-ui-translation.cjs +1 -0
  279. package/dist-package/lib/use-ui-translation.d.ts +15 -0
  280. package/dist-package/lib/use-ui-translation.d.ts.map +1 -0
  281. package/dist-package/lib/use-ui-translation.js +65 -0
  282. package/dist-package/lib/utils.cjs +1 -0
  283. package/dist-package/lib/utils.js +8 -0
  284. package/dist-package/styles.css +1 -1
  285. package/package.json +25 -15
  286. package/dist-package/index.js +0 -12212
@@ -0,0 +1,110 @@
1
+ import { cn as e } from "../lib/utils.js";
2
+ import { Button as t } from "./ui/button.js";
3
+ import { useUiTranslation as n } from "../lib/use-ui-translation.js";
4
+ import { FilterPresets as r } from "./filter-presets.js";
5
+ import { Children as i, Fragment as a, cloneElement as o, isValidElement as s, useId as c, useLayoutEffect as l, useRef as u, useState as d } from "react";
6
+ import { ChevronDown as f, ChevronUp as p } from "lucide-react";
7
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
8
+ import { flushSync as _ } from "react-dom";
9
+ //#region src/components/search-filters.tsx
10
+ function v(e) {
11
+ return i.toArray(e).flatMap((e) => s(e) && e.type === a ? v(e.props.children) : [e]);
12
+ }
13
+ function y({ presets: i, labelPosition: a = "left", columns: y = 3, collapsedCount: S = y, style: C, description: w, descriptionPosition: T = "bottom", togglePosition: E = "inline", collapsible: D = !0, defaultExpanded: O = !1, className: k, children: A, onInvalidCapture: j, ...M }) {
14
+ let { t: N } = n(), [P, F] = d(O), I = c(), L = u(null);
15
+ l(() => {
16
+ let e = L.current;
17
+ if (!e || a !== "left") return;
18
+ let t = () => {
19
+ let t = getComputedStyle(e).display === "contents" ? e.parentElement : e, n = getComputedStyle(t).gridTemplateColumns.split(" ").length, r = Array.from(e.querySelectorAll(":scope > .search-filter-field")), i = Array.from({ length: n }, () => 0);
20
+ r.forEach((e, t) => {
21
+ let r = e.querySelector(":scope > label, :scope > .search-filter-label");
22
+ i[t % n] = Math.max(i[t % n] ?? 0, r?.getBoundingClientRect().width ?? 0);
23
+ }), r.forEach((e, t) => e.style.setProperty("--search-label-width", `${i[t % n]}px`));
24
+ };
25
+ t();
26
+ let n = new ResizeObserver(t);
27
+ return n.observe(e), e.parentElement && n.observe(e.parentElement), e.querySelectorAll(":scope > .search-filter-field > label, :scope > .search-filter-field > .search-filter-label").forEach((e) => n.observe(e)), () => n.disconnect();
28
+ }, [
29
+ A,
30
+ y,
31
+ a,
32
+ P
33
+ ]);
34
+ let R = v(A), z = R.filter((e) => s(e) && e.type === b), B = D && z.length > S, V = !B || P, H = B ? /* @__PURE__ */ g(t, {
35
+ type: "button",
36
+ variant: "ghost",
37
+ size: "sm",
38
+ "aria-expanded": B && V,
39
+ "aria-controls": I,
40
+ onClick: () => F((e) => !e),
41
+ children: [N(B && V ? "searchCollapse" : "searchExpand"), h(B && V ? p : f, { "aria-hidden": "true" })]
42
+ }) : null, U = w ? /* @__PURE__ */ h("p", {
43
+ className: "text-xs leading-5 text-muted-foreground",
44
+ children: w
45
+ }) : null, W = /* @__PURE__ */ g(m, { children: [T === "inline" && U, E === "inline" && H] }), G = T === "inline" && !!U || E === "inline" && !!H, K = T === "bottom" && !!U || E === "bottom" && !!H, q = 0, J = R.some((e) => s(e) && e.type === x);
46
+ return /* @__PURE__ */ g("form", {
47
+ role: "search",
48
+ ...M,
49
+ onInvalidCapture: (e) => {
50
+ V || _(() => F(!0)), j?.(e);
51
+ },
52
+ style: {
53
+ ...C,
54
+ "--search-columns": y
55
+ },
56
+ "data-columns": y,
57
+ "data-label-position": a,
58
+ "data-expanded": V,
59
+ "data-inline-actions": !B || !V,
60
+ className: e("search-filters w-full rounded-xl border bg-card p-4", k),
61
+ children: [/* @__PURE__ */ h("div", {
62
+ ref: L,
63
+ id: I,
64
+ className: "search-filter-fields",
65
+ children: R.map((e) => s(e) && e.type === b ? o(e, { hidden: e.props.hidden || !V && q++ >= S }) : s(e) && e.type === x ? null : e)
66
+ }), (J || G || K) && /* @__PURE__ */ g("div", {
67
+ className: "search-filter-footer",
68
+ children: [T === "bottom" && U, /* @__PURE__ */ g("div", {
69
+ className: "search-filter-footer-actions",
70
+ children: [
71
+ R.map((e) => s(e) && e.type === x ? o(e, { children: /* @__PURE__ */ g(m, { children: [e.props.children, W] }) }) : null),
72
+ !J && G && /* @__PURE__ */ h(x, { children: W }),
73
+ i && /* @__PURE__ */ h(r, {
74
+ storageId: i.storageId,
75
+ value: i.value,
76
+ onApply: i.onApply,
77
+ summary: i.summary
78
+ }),
79
+ E === "bottom" && H
80
+ ]
81
+ })]
82
+ })]
83
+ });
84
+ }
85
+ function b(t) {
86
+ if (t.as === "label") {
87
+ let { as: n, className: r, children: a, ...o } = t;
88
+ return /* @__PURE__ */ h("label", {
89
+ ...o,
90
+ className: e("search-filter-field", r),
91
+ children: i.map(a, (e) => typeof e == "string" || typeof e == "number" ? /* @__PURE__ */ h("span", {
92
+ className: "search-filter-label",
93
+ children: e
94
+ }) : e)
95
+ });
96
+ }
97
+ let { as: n, className: r, ...a } = t;
98
+ return /* @__PURE__ */ h("div", {
99
+ ...a,
100
+ className: e("search-filter-field", r)
101
+ });
102
+ }
103
+ function x({ className: t, ...n }) {
104
+ return /* @__PURE__ */ h("div", {
105
+ ...n,
106
+ className: e("search-filter-actions", t)
107
+ });
108
+ }
109
+ //#endregion
110
+ export { x as SearchActions, b as SearchField, y as SearchFilters };
@@ -0,0 +1 @@
1
+ const e=require("../lib/utils.cjs");let t=require("react"),n=require("lucide-react"),r=require("react/jsx-runtime");function i({items:i,onReorder:a,renderItem:o,label:s=`可排序列表`,className:c}){let[l,u]=(0,t.useState)();function d(e,t){if(t<0||t>=i.length||e===t)return;let n=[...i],[r]=n.splice(e,1);r&&!r.disabled&&(n.splice(t,0,r),a(n))}return(0,r.jsx)(`ul`,{className:e.cn(`space-y-2`,c),"aria-label":s,children:i.map((e,t)=>(0,r.jsxs)(`li`,{draggable:!e.disabled,"data-dragging":l===e.id||void 0,className:`flex min-h-12 items-center gap-3 rounded-lg border bg-card px-3 py-2 data-dragging:opacity-50`,onDragStart:t=>{u(e.id),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,e.id)},onDragEnd:()=>u(void 0),onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),d(i.findIndex(t=>t.id===e.dataTransfer.getData(`text/plain`)),t),u(void 0)},children:[(0,r.jsx)(`button`,{type:`button`,disabled:e.disabled,"aria-label":`拖动第 ${t+1} 项;方向键调整顺序`,className:`cursor-grab rounded p-1 text-muted-foreground hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed`,onKeyDown:e=>{(e.key===`ArrowUp`||e.key===`ArrowDown`)&&(e.preventDefault(),d(t,t+(e.key===`ArrowDown`?1:-1)))},children:(0,r.jsx)(n.GripVertical,{"aria-hidden":`true`,className:`size-4`})}),(0,r.jsx)(`div`,{className:`min-w-0 flex-1`,children:o(e,t)})]},e.id))})}exports.SortableList=i;
@@ -0,0 +1,14 @@
1
+ import { type ReactNode } from 'react';
2
+ export type SortableItem = {
3
+ id: string;
4
+ disabled?: boolean;
5
+ };
6
+ export type SortableListProps<T extends SortableItem> = {
7
+ items: T[];
8
+ onReorder: (items: T[]) => void;
9
+ renderItem: (item: T, index: number) => ReactNode;
10
+ label?: string;
11
+ className?: string;
12
+ };
13
+ export declare function SortableList<T extends SortableItem>({ items, onReorder, renderItem, label, className, }: SortableListProps<T>): import("react").JSX.Element;
14
+ //# sourceMappingURL=sortable-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sortable-list.d.ts","sourceRoot":"","sources":["../../src/components/sortable-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAIhD,MAAM,MAAM,YAAY,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAC7D,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,YAAY,IAAI;IACtD,KAAK,EAAE,CAAC,EAAE,CAAA;IACV,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,IAAI,CAAA;IAC/B,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,CAAA;IACjD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,YAAY,EAAE,EACnD,KAAK,EACL,SAAS,EACT,UAAU,EACV,KAAe,EACf,SAAS,GACV,EAAE,iBAAiB,CAAC,CAAC,CAAC,+BAuDtB"}
@@ -0,0 +1,48 @@
1
+ import { cn as e } from "../lib/utils.js";
2
+ import { useState as t } from "react";
3
+ import { GripVertical as n } from "lucide-react";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ //#region src/components/sortable-list.tsx
6
+ function a({ items: a, onReorder: o, renderItem: s, label: c = "可排序列表", className: l }) {
7
+ let [u, d] = t();
8
+ function f(e, t) {
9
+ if (t < 0 || t >= a.length || e === t) return;
10
+ let n = [...a], [r] = n.splice(e, 1);
11
+ r && !r.disabled && (n.splice(t, 0, r), o(n));
12
+ }
13
+ return /* @__PURE__ */ r("ul", {
14
+ className: e("space-y-2", l),
15
+ "aria-label": c,
16
+ children: a.map((e, t) => /* @__PURE__ */ i("li", {
17
+ draggable: !e.disabled,
18
+ "data-dragging": u === e.id || void 0,
19
+ className: "flex min-h-12 items-center gap-3 rounded-lg border bg-card px-3 py-2 data-dragging:opacity-50",
20
+ onDragStart: (t) => {
21
+ d(e.id), t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData("text/plain", e.id);
22
+ },
23
+ onDragEnd: () => d(void 0),
24
+ onDragOver: (e) => e.preventDefault(),
25
+ onDrop: (e) => {
26
+ e.preventDefault(), f(a.findIndex((t) => t.id === e.dataTransfer.getData("text/plain")), t), d(void 0);
27
+ },
28
+ children: [/* @__PURE__ */ r("button", {
29
+ type: "button",
30
+ disabled: e.disabled,
31
+ "aria-label": `拖动第 ${t + 1} 项;方向键调整顺序`,
32
+ className: "cursor-grab rounded p-1 text-muted-foreground hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed",
33
+ onKeyDown: (e) => {
34
+ (e.key === "ArrowUp" || e.key === "ArrowDown") && (e.preventDefault(), f(t, t + (e.key === "ArrowDown" ? 1 : -1)));
35
+ },
36
+ children: /* @__PURE__ */ r(n, {
37
+ "aria-hidden": "true",
38
+ className: "size-4"
39
+ })
40
+ }), /* @__PURE__ */ r("div", {
41
+ className: "min-w-0 flex-1",
42
+ children: s(e, t)
43
+ })]
44
+ }, e.id))
45
+ });
46
+ }
47
+ //#endregion
48
+ export { a as SortableList };
@@ -0,0 +1 @@
1
+ const e=require("../lib/utils.cjs"),t=require("../lib/metrics.cjs");let n=require("react"),r=require("react/jsx-runtime");function i({values:i,width:a=96,height:o=28,smooth:s=!0,label:c,className:l}){let u=`sparkline-${(0,n.useId)()}`,d=t.sparklinePoints(i,a,o),f=t.sparklinePath(d,s),p=d.length?`${f} L${d.at(-1).x} ${o} L${d[0].x} ${o} Z`:``;return(0,r.jsxs)(`svg`,{role:`img`,"aria-label":c,viewBox:`0 0 ${a} ${o}`,className:e.cn(`overflow-visible`,l),style:{width:a,height:o},children:[(0,r.jsx)(`defs`,{children:(0,r.jsxs)(`linearGradient`,{id:u,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,r.jsx)(`stop`,{offset:`0%`,stopColor:`var(--primary)`,stopOpacity:`0.28`}),(0,r.jsx)(`stop`,{offset:`100%`,stopColor:`var(--primary)`,stopOpacity:`0`})]})}),p&&(0,r.jsx)(`path`,{d:p,fill:`url(#${u})`}),(0,r.jsx)(`path`,{d:f,fill:`none`,stroke:`var(--primary)`,strokeWidth:1.6,strokeLinecap:`round`,strokeLinejoin:`round`})]})}exports.Sparkline=i;
@@ -0,0 +1,11 @@
1
+ /** 迷你趋势线;数值序列自绘 SVG,不引图表库。 */
2
+ export declare function Sparkline({ values, width, height, smooth, label, className, }: {
3
+ values: number[];
4
+ width?: number;
5
+ height?: number;
6
+ smooth?: boolean;
7
+ /** 图形的访问名称,通常写成"近 7 天趋势"。 */
8
+ label: string;
9
+ className?: string;
10
+ }): import("react").JSX.Element;
11
+ //# sourceMappingURL=sparkline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sparkline.d.ts","sourceRoot":"","sources":["../../src/components/sparkline.tsx"],"names":[],"mappings":"AAIA,8BAA8B;AAC9B,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,KAAU,EACV,MAAW,EACX,MAAa,EACb,KAAK,EACL,SAAS,GACV,EAAE;IACD,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BAgCA"}
@@ -0,0 +1,50 @@
1
+ import { cn as e } from "../lib/utils.js";
2
+ import { sparklinePath as t, sparklinePoints as n } from "../lib/metrics.js";
3
+ import { useId as r } from "react";
4
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ //#region src/components/sparkline.tsx
6
+ function o({ values: o, width: s = 96, height: c = 28, smooth: l = !0, label: u, className: d }) {
7
+ let f = `sparkline-${r()}`, p = n(o, s, c), m = t(p, l), h = p.length ? `${m} L${p.at(-1).x} ${c} L${p[0].x} ${c} Z` : "";
8
+ return /* @__PURE__ */ a("svg", {
9
+ role: "img",
10
+ "aria-label": u,
11
+ viewBox: `0 0 ${s} ${c}`,
12
+ className: e("overflow-visible", d),
13
+ style: {
14
+ width: s,
15
+ height: c
16
+ },
17
+ children: [
18
+ /* @__PURE__ */ i("defs", { children: /* @__PURE__ */ a("linearGradient", {
19
+ id: f,
20
+ x1: "0",
21
+ y1: "0",
22
+ x2: "0",
23
+ y2: "1",
24
+ children: [/* @__PURE__ */ i("stop", {
25
+ offset: "0%",
26
+ stopColor: "var(--primary)",
27
+ stopOpacity: "0.28"
28
+ }), /* @__PURE__ */ i("stop", {
29
+ offset: "100%",
30
+ stopColor: "var(--primary)",
31
+ stopOpacity: "0"
32
+ })]
33
+ }) }),
34
+ h && /* @__PURE__ */ i("path", {
35
+ d: h,
36
+ fill: `url(#${f})`
37
+ }),
38
+ /* @__PURE__ */ i("path", {
39
+ d: m,
40
+ fill: "none",
41
+ stroke: "var(--primary)",
42
+ strokeWidth: 1.6,
43
+ strokeLinecap: "round",
44
+ strokeLinejoin: "round"
45
+ })
46
+ ]
47
+ });
48
+ }
49
+ //#endregion
50
+ export { o as Sparkline };
@@ -0,0 +1 @@
1
+ const e=require("../lib/utils.cjs"),t=require("../lib/use-ui-translation.cjs"),n=require("./ui/badge.cjs");let r=require("react/jsx-runtime");var i={ACTIVE:`bg-success-soft text-success`,PENDING:`bg-warning-soft text-warning`,PROCESSING:`bg-info-soft text-info`,FAILED:`bg-danger-soft text-danger`,DISABLED:`bg-disabled-soft text-disabled`,INACTIVE:`bg-inactive-soft text-inactive`,SUSPENDED:`bg-suspended-soft text-suspended`,UNKNOWN:`bg-unknown-soft text-unknown`};function a({status:a}){let{t:o}=t.useUiTranslation(),s=Object.hasOwn(i,a);return(0,r.jsxs)(n.Badge,{variant:`outline`,className:e.cn(`gap-1.5 border-transparent px-2 py-0.5 font-medium`,s?i[a]:i.UNKNOWN),children:[(0,r.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-current`}),o(s?a:`UNKNOWN`)]})}exports.StatusBadge=a;
@@ -0,0 +1,4 @@
1
+ export declare function StatusBadge({ status }: {
2
+ status: string;
3
+ }): import("react").JSX.Element;
4
+ //# sourceMappingURL=status-badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-badge.d.ts","sourceRoot":"","sources":["../../src/components/status-badge.tsx"],"names":[],"mappings":"AAaA,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,+BAezD"}
@@ -0,0 +1,28 @@
1
+ import { cn as e } from "../lib/utils.js";
2
+ import { useUiTranslation as t } from "../lib/use-ui-translation.js";
3
+ import { Badge as n } from "./ui/badge.js";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ //#region src/components/status-badge.tsx
6
+ var a = {
7
+ ACTIVE: "bg-success-soft text-success",
8
+ PENDING: "bg-warning-soft text-warning",
9
+ PROCESSING: "bg-info-soft text-info",
10
+ FAILED: "bg-danger-soft text-danger",
11
+ DISABLED: "bg-disabled-soft text-disabled",
12
+ INACTIVE: "bg-inactive-soft text-inactive",
13
+ SUSPENDED: "bg-suspended-soft text-suspended",
14
+ UNKNOWN: "bg-unknown-soft text-unknown"
15
+ };
16
+ function o({ status: o }) {
17
+ let { t: s } = t(), c = Object.hasOwn(a, o);
18
+ return /* @__PURE__ */ i(n, {
19
+ variant: "outline",
20
+ className: e("gap-1.5 border-transparent px-2 py-0.5 font-medium", c ? a[o] : a.UNKNOWN),
21
+ children: [/* @__PURE__ */ r("span", {
22
+ "aria-hidden": "true",
23
+ className: "size-1.5 rounded-full bg-current"
24
+ }), s(c ? o : "UNKNOWN")]
25
+ });
26
+ }
27
+ //#endregion
28
+ export { o as StatusBadge };
@@ -0,0 +1 @@
1
+ const e=require("../lib/utils.cjs");let t=require("lucide-react"),n=require("react/jsx-runtime");function r({items:r,current:i,status:a=`process`,className:o}){let s=e=>e<i?`finish`:e===i?a:`waiting`;return(0,n.jsx)(`ol`,{"data-slot":`steps`,className:e.cn(`flex flex-col gap-4 sm:flex-row sm:items-start`,o),children:r.map((i,a)=>{let o=s(a);return(0,n.jsxs)(`li`,{className:`flex min-w-0 flex-1 items-start gap-3`,children:[(0,n.jsx)(`span`,{"aria-hidden":`true`,"data-state":o,className:e.cn(`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full border text-xs font-medium`,o===`finish`&&`border-primary bg-primary text-primary-foreground`,o===`process`&&`border-primary text-primary`,o===`error`&&`border-danger bg-danger-soft text-danger`,o===`waiting`&&`border-input text-muted-foreground`),children:o===`finish`?(0,n.jsx)(t.Check,{className:`size-3.5`}):a+1}),(0,n.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,n.jsx)(`span`,{className:e.cn(`block text-sm font-medium`,o===`waiting`&&`text-muted-foreground`,o===`error`&&`text-danger`),children:i.label}),i.description&&(0,n.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted-foreground`,children:i.description})]}),a<r.length-1&&(0,n.jsx)(`span`,{"aria-hidden":`true`,className:e.cn(`mt-3.5 hidden h-px flex-1 shrink sm:block`,o===`finish`?`bg-primary/40`:`bg-border`)})]},i.value)})})}exports.Steps=r;
@@ -0,0 +1,15 @@
1
+ export type StepItem = {
2
+ value: string;
3
+ label: string;
4
+ description?: string;
5
+ };
6
+ export type StepStatus = 'waiting' | 'process' | 'finish' | 'error';
7
+ /** 步骤条:横向展示流程进度,用当前步骤推导状态。 */
8
+ export declare function Steps({ items, current, status, className, }: {
9
+ items: StepItem[];
10
+ /** 当前步骤下标,从 0 开始。 */
11
+ current: number;
12
+ status?: Extract<StepStatus, 'process' | 'error'>;
13
+ className?: string;
14
+ }): import("react").JSX.Element;
15
+ //# sourceMappingURL=steps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../src/components/steps.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,QAAQ,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAC7E,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;AAEnE,8BAA8B;AAC9B,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,OAAO,EACP,MAAkB,EAClB,SAAS,GACV,EAAE;IACD,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,CAAA;IACjD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BAuDA"}
@@ -0,0 +1,41 @@
1
+ import { cn as e } from "../lib/utils.js";
2
+ import { Check as t } from "lucide-react";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ //#region src/components/steps.tsx
5
+ function i({ items: i, current: a, status: o = "process", className: s }) {
6
+ let c = (e) => e < a ? "finish" : e === a ? o : "waiting";
7
+ return /* @__PURE__ */ n("ol", {
8
+ "data-slot": "steps",
9
+ className: e("flex flex-col gap-4 sm:flex-row sm:items-start", s),
10
+ children: i.map((a, o) => {
11
+ let s = c(o);
12
+ return /* @__PURE__ */ r("li", {
13
+ className: "flex min-w-0 flex-1 items-start gap-3",
14
+ children: [
15
+ /* @__PURE__ */ n("span", {
16
+ "aria-hidden": "true",
17
+ "data-state": s,
18
+ className: e("mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full border text-xs font-medium", s === "finish" && "border-primary bg-primary text-primary-foreground", s === "process" && "border-primary text-primary", s === "error" && "border-danger bg-danger-soft text-danger", s === "waiting" && "border-input text-muted-foreground"),
19
+ children: s === "finish" ? /* @__PURE__ */ n(t, { className: "size-3.5" }) : o + 1
20
+ }),
21
+ /* @__PURE__ */ r("span", {
22
+ className: "min-w-0 flex-1",
23
+ children: [/* @__PURE__ */ n("span", {
24
+ className: e("block text-sm font-medium", s === "waiting" && "text-muted-foreground", s === "error" && "text-danger"),
25
+ children: a.label
26
+ }), a.description && /* @__PURE__ */ n("span", {
27
+ className: "mt-0.5 block text-xs text-muted-foreground",
28
+ children: a.description
29
+ })]
30
+ }),
31
+ o < i.length - 1 && /* @__PURE__ */ n("span", {
32
+ "aria-hidden": "true",
33
+ className: e("mt-3.5 hidden h-px flex-1 shrink sm:block", s === "finish" ? "bg-primary/40" : "bg-border")
34
+ })
35
+ ]
36
+ }, a.value);
37
+ })
38
+ });
39
+ }
40
+ //#endregion
41
+ export { i as Steps };
@@ -0,0 +1 @@
1
+ const e=require("../lib/utils.cjs"),t=require("./ui/button.cjs"),n=require("../lib/use-ui-translation.cjs"),r=require("./ui/input.cjs"),i=require("./ui/label.cjs"),a=require("../lib/presets.cjs");let o=require("react"),s=require("radix-ui"),c=require("lucide-react"),l=require("react/jsx-runtime"),u=require("sonner");function d({storageId:d,snapshot:f,onRestore:p,title:m,placeholder:h,summary:g,emptyHint:_,className:v}){let{t:y}=n.useUiTranslation(),b=`storage-box.${d}`,[x,S]=(0,o.useState)(()=>a.readPresets(b)),[C,w]=(0,o.useState)(``),[T,E]=(0,o.useState)(),[D,O]=(0,o.useState)(``),[k,A]=(0,o.useState)(!1);function j(e){S(e),a.writePresets(b,e)}function M(){let e=C.trim();if(!e)return;let t=a.presetNameTaken(x,e);j(a.upsertPreset(x,{name:e,value:f,savedAt:new Date().toISOString()})),w(``),u.toast.success(y(t?`storageBox.overwritten`:`storageBox.saved`,{name:e}))}let N=C.trim(),P=a.presetNameTaken(x,N);return(0,l.jsxs)(s.Popover.Root,{open:k,onOpenChange:A,children:[(0,l.jsx)(s.Popover.Trigger,{asChild:!0,children:(0,l.jsxs)(t.Button,{variant:`outline`,className:v,children:[(0,l.jsx)(c.Bookmark,{"aria-hidden":`true`}),m??y(`storageBox.title`)]})}),(0,l.jsx)(s.Popover.Portal,{children:(0,l.jsxs)(s.Popover.Content,{align:`end`,sideOffset:6,className:`z-50 w-80 rounded-xl border bg-popover p-3 text-sm shadow-lg outline-none`,children:[(0,l.jsx)(`p`,{className:`font-medium`,children:m??y(`storageBox.title`)}),(0,l.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:y(`storageBox.hint`)}),(0,l.jsxs)(`div`,{className:`mt-3 flex items-end gap-2`,children:[(0,l.jsxs)(`div`,{className:`grid flex-1 gap-1.5`,children:[(0,l.jsx)(i.Label,{htmlFor:`storage-box-name-${d}`,className:`text-xs`,children:y(`storageBox.name`)}),(0,l.jsx)(r.Input,{id:`storage-box-name-${d}`,className:`h-8`,value:C,placeholder:h??y(`storageBox.namePlaceholder`),onChange:e=>w(e.target.value)})]}),(0,l.jsxs)(t.Button,{size:`sm`,variant:P?`outline`:`default`,disabled:!N,onClick:M,children:[(0,l.jsx)(c.Save,{"aria-hidden":`true`}),y(P?`storageBox.overwrite`:`storageBox.save`)]})]}),P&&(0,l.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-warning`,children:y(`storageBox.nameTaken`,{name:N})}),(0,l.jsxs)(`ul`,{className:`mt-3 max-h-64 space-y-1 overflow-y-auto`,children:[x.map(n=>(0,l.jsx)(`li`,{className:`rounded-lg border p-2`,children:T===n.name?(0,l.jsxs)(`div`,{className:`space-y-1`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(r.Input,{className:`h-8`,"aria-label":y(`storageBox.rename`),value:D,onChange:e=>O(e.target.value)}),(0,l.jsx)(t.Button,{size:`sm`,disabled:!D.trim()||a.presetNameTaken(x,D,n.name),onClick:()=>{j(a.renamePreset(x,n.name,D.trim())),E(void 0)},children:y(`confirm`)})]}),a.presetNameTaken(x,D,n.name)&&(0,l.jsx)(`p`,{role:`alert`,className:`text-xs text-warning`,children:y(`storageBox.nameTaken`,{name:D.trim()})})]}):(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,onClick:()=>{p(n.value),u.toast.success(y(`storageBox.applied`,{name:n.name}))},children:[(0,l.jsx)(`span`,{className:`block truncate font-medium`,children:n.name}),(0,l.jsx)(`span`,{className:e.cn(`mt-0.5 block truncate text-xs text-muted-foreground`),children:g?.(n.value)??n.savedAt?.slice(0,16)??``})]}),(0,l.jsx)(t.Button,{variant:`ghost`,size:`icon-xs`,"aria-label":`${y(`storageBox.rename`)} ${n.name}`,onClick:()=>{E(n.name),O(n.name)},children:(0,l.jsx)(c.PencilLine,{"aria-hidden":`true`})}),(0,l.jsx)(t.Button,{variant:`ghost`,size:`icon-xs`,"aria-label":`${y(`storageBox.remove`)} ${n.name}`,onClick:()=>{j(x.filter(e=>e.name!==n.name)),u.toast.success(y(`storageBox.removed`,{name:n.name}))},children:(0,l.jsx)(c.Trash2,{"aria-hidden":`true`})})]})},n.name)),!x.length&&(0,l.jsx)(`li`,{className:`rounded-lg border border-dashed px-3 py-6 text-center text-xs text-muted-foreground`,children:_??y(`storageBox.empty`)})]})]})})]})}exports.StorageBox=d;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * 储物箱:把当前页面状态(筛选条件、表格列配置等)命名保存到浏览器,
3
+ * 之后一键恢复;支持覆盖、重命名、删除与自定义标题。
4
+ */
5
+ export declare function StorageBox<T>({ storageId, snapshot, onRestore, title, placeholder, summary, emptyHint, className, }: {
6
+ /** 存储键后缀,通常用页面名,例如 `customers`。 */
7
+ storageId: string;
8
+ /** 当前要暂存的状态快照。 */
9
+ snapshot: T;
10
+ onRestore: (value: T) => void;
11
+ /** 弹出层标题,默认「储物箱」。 */
12
+ title?: string;
13
+ placeholder?: string;
14
+ /** 列表里展示的快照摘要,帮助区分不同条目。 */
15
+ summary?: (value: T) => string;
16
+ emptyHint?: string;
17
+ className?: string;
18
+ }): import("react").JSX.Element;
19
+ //# sourceMappingURL=storage-box.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-box.d.ts","sourceRoot":"","sources":["../../src/components/storage-box.tsx"],"names":[],"mappings":"AAkBA;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,EAC5B,SAAS,EACT,QAAQ,EACR,SAAS,EACT,KAAK,EACL,WAAW,EACX,OAAO,EACP,SAAS,EACT,SAAS,GACV,EAAE;IACD,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,kBAAkB;IAClB,QAAQ,EAAE,CAAC,CAAA;IACX,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;IAC7B,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAA;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BA+JA"}
@@ -0,0 +1,153 @@
1
+ import { cn as e } from "../lib/utils.js";
2
+ import { Button as t } from "./ui/button.js";
3
+ import { useUiTranslation as n } from "../lib/use-ui-translation.js";
4
+ import { Input as r } from "./ui/input.js";
5
+ import { Label as i } from "./ui/label.js";
6
+ import { presetNameTaken as a, readPresets as o, renamePreset as s, upsertPreset as c, writePresets as l } from "../lib/presets.js";
7
+ import { useState as u } from "react";
8
+ import { Popover as d } from "radix-ui";
9
+ import { Bookmark as f, PencilLine as p, Save as m, Trash2 as h } from "lucide-react";
10
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
11
+ import { toast as v } from "sonner";
12
+ //#region src/components/storage-box.tsx
13
+ function y({ storageId: y, snapshot: b, onRestore: x, title: S, placeholder: C, summary: w, emptyHint: T, className: E }) {
14
+ let { t: D } = n(), O = `storage-box.${y}`, [k, A] = u(() => o(O)), [j, M] = u(""), [N, P] = u(), [F, I] = u(""), [L, R] = u(!1);
15
+ function z(e) {
16
+ A(e), l(O, e);
17
+ }
18
+ function B() {
19
+ let e = j.trim();
20
+ if (!e) return;
21
+ let t = a(k, e);
22
+ z(c(k, {
23
+ name: e,
24
+ value: b,
25
+ savedAt: (/* @__PURE__ */ new Date()).toISOString()
26
+ })), M(""), v.success(D(t ? "storageBox.overwritten" : "storageBox.saved", { name: e }));
27
+ }
28
+ let V = j.trim(), H = a(k, V);
29
+ return /* @__PURE__ */ _(d.Root, {
30
+ open: L,
31
+ onOpenChange: R,
32
+ children: [/* @__PURE__ */ g(d.Trigger, {
33
+ asChild: !0,
34
+ children: /* @__PURE__ */ _(t, {
35
+ variant: "outline",
36
+ className: E,
37
+ children: [/* @__PURE__ */ g(f, { "aria-hidden": "true" }), S ?? D("storageBox.title")]
38
+ })
39
+ }), /* @__PURE__ */ g(d.Portal, { children: /* @__PURE__ */ _(d.Content, {
40
+ align: "end",
41
+ sideOffset: 6,
42
+ className: "z-50 w-80 rounded-xl border bg-popover p-3 text-sm shadow-lg outline-none",
43
+ children: [
44
+ /* @__PURE__ */ g("p", {
45
+ className: "font-medium",
46
+ children: S ?? D("storageBox.title")
47
+ }),
48
+ /* @__PURE__ */ g("p", {
49
+ className: "mt-1 text-xs text-muted-foreground",
50
+ children: D("storageBox.hint")
51
+ }),
52
+ /* @__PURE__ */ _("div", {
53
+ className: "mt-3 flex items-end gap-2",
54
+ children: [/* @__PURE__ */ _("div", {
55
+ className: "grid flex-1 gap-1.5",
56
+ children: [/* @__PURE__ */ g(i, {
57
+ htmlFor: `storage-box-name-${y}`,
58
+ className: "text-xs",
59
+ children: D("storageBox.name")
60
+ }), /* @__PURE__ */ g(r, {
61
+ id: `storage-box-name-${y}`,
62
+ className: "h-8",
63
+ value: j,
64
+ placeholder: C ?? D("storageBox.namePlaceholder"),
65
+ onChange: (e) => M(e.target.value)
66
+ })]
67
+ }), /* @__PURE__ */ _(t, {
68
+ size: "sm",
69
+ variant: H ? "outline" : "default",
70
+ disabled: !V,
71
+ onClick: B,
72
+ children: [/* @__PURE__ */ g(m, { "aria-hidden": "true" }), D(H ? "storageBox.overwrite" : "storageBox.save")]
73
+ })]
74
+ }),
75
+ H && /* @__PURE__ */ g("p", {
76
+ role: "alert",
77
+ className: "mt-2 text-xs text-warning",
78
+ children: D("storageBox.nameTaken", { name: V })
79
+ }),
80
+ /* @__PURE__ */ _("ul", {
81
+ className: "mt-3 max-h-64 space-y-1 overflow-y-auto",
82
+ children: [k.map((n) => /* @__PURE__ */ g("li", {
83
+ className: "rounded-lg border p-2",
84
+ children: N === n.name ? /* @__PURE__ */ _("div", {
85
+ className: "space-y-1",
86
+ children: [/* @__PURE__ */ _("div", {
87
+ className: "flex items-center gap-2",
88
+ children: [/* @__PURE__ */ g(r, {
89
+ className: "h-8",
90
+ "aria-label": D("storageBox.rename"),
91
+ value: F,
92
+ onChange: (e) => I(e.target.value)
93
+ }), /* @__PURE__ */ g(t, {
94
+ size: "sm",
95
+ disabled: !F.trim() || a(k, F, n.name),
96
+ onClick: () => {
97
+ z(s(k, n.name, F.trim())), P(void 0);
98
+ },
99
+ children: D("confirm")
100
+ })]
101
+ }), a(k, F, n.name) && /* @__PURE__ */ g("p", {
102
+ role: "alert",
103
+ className: "text-xs text-warning",
104
+ children: D("storageBox.nameTaken", { name: F.trim() })
105
+ })]
106
+ }) : /* @__PURE__ */ _("div", {
107
+ className: "flex items-center gap-2",
108
+ children: [
109
+ /* @__PURE__ */ _("button", {
110
+ type: "button",
111
+ className: "min-w-0 flex-1 text-left",
112
+ onClick: () => {
113
+ x(n.value), v.success(D("storageBox.applied", { name: n.name }));
114
+ },
115
+ children: [/* @__PURE__ */ g("span", {
116
+ className: "block truncate font-medium",
117
+ children: n.name
118
+ }), /* @__PURE__ */ g("span", {
119
+ className: e("mt-0.5 block truncate text-xs text-muted-foreground"),
120
+ children: w?.(n.value) ?? n.savedAt?.slice(0, 16) ?? ""
121
+ })]
122
+ }),
123
+ /* @__PURE__ */ g(t, {
124
+ variant: "ghost",
125
+ size: "icon-xs",
126
+ "aria-label": `${D("storageBox.rename")} ${n.name}`,
127
+ onClick: () => {
128
+ P(n.name), I(n.name);
129
+ },
130
+ children: /* @__PURE__ */ g(p, { "aria-hidden": "true" })
131
+ }),
132
+ /* @__PURE__ */ g(t, {
133
+ variant: "ghost",
134
+ size: "icon-xs",
135
+ "aria-label": `${D("storageBox.remove")} ${n.name}`,
136
+ onClick: () => {
137
+ z(k.filter((e) => e.name !== n.name)), v.success(D("storageBox.removed", { name: n.name }));
138
+ },
139
+ children: /* @__PURE__ */ g(h, { "aria-hidden": "true" })
140
+ })
141
+ ]
142
+ })
143
+ }, n.name)), !k.length && /* @__PURE__ */ g("li", {
144
+ className: "rounded-lg border border-dashed px-3 py-6 text-center text-xs text-muted-foreground",
145
+ children: T ?? D("storageBox.empty")
146
+ })]
147
+ })
148
+ ]
149
+ }) })]
150
+ });
151
+ }
152
+ //#endregion
153
+ export { y as StorageBox };
@@ -0,0 +1 @@
1
+ const e=require("./ui/tooltip.cjs");let t=require("react"),n=require("react/jsx-runtime");function r({children:r}){let i=(0,t.useRef)(null),[a,o]=(0,t.useState)(``);return(0,t.useLayoutEffect)(()=>{let e=i.current;if(!e)return;let t=()=>{let t=[e,...e.querySelectorAll(`*`)].some(e=>e.clientWidth>0&&e.scrollWidth>e.clientWidth+1);o(t?e.innerText:``)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[r]),(0,n.jsxs)(e.Tooltip,{children:[(0,n.jsx)(e.TooltipTrigger,{asChild:!0,children:(0,n.jsx)(`div`,{ref:i,tabIndex:a?0:void 0,className:`table-cell-overflow`,children:r})}),a&&(0,n.jsx)(e.TooltipContent,{className:`max-w-[min(32rem,calc(100vw-2rem))] whitespace-pre-wrap break-words`,children:a})]})}exports.TableCellOverflow=r;
@@ -0,0 +1,5 @@
1
+ import { type ReactNode } from 'react';
2
+ export declare function TableCellOverflow({ children }: {
3
+ children: ReactNode;
4
+ }): import("react").JSX.Element;
5
+ //# sourceMappingURL=table-cell-overflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-cell-overflow.d.ts","sourceRoot":"","sources":["../../src/components/table-cell-overflow.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAGzE,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BA+BtE"}
@@ -0,0 +1,31 @@
1
+ import { Tooltip as e, TooltipContent as t, TooltipTrigger as n } from "./ui/tooltip.js";
2
+ import { useLayoutEffect as r, useRef as i, useState as a } from "react";
3
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
4
+ //#region src/components/table-cell-overflow.tsx
5
+ function c({ children: c }) {
6
+ let l = i(null), [u, d] = a("");
7
+ return r(() => {
8
+ let e = l.current;
9
+ if (!e) return;
10
+ let t = () => {
11
+ let t = [e, ...e.querySelectorAll("*")].some((e) => e.clientWidth > 0 && e.scrollWidth > e.clientWidth + 1);
12
+ d(t ? e.innerText : "");
13
+ };
14
+ t();
15
+ let n = new ResizeObserver(t);
16
+ return n.observe(e), () => n.disconnect();
17
+ }, [c]), /* @__PURE__ */ s(e, { children: [/* @__PURE__ */ o(n, {
18
+ asChild: !0,
19
+ children: /* @__PURE__ */ o("div", {
20
+ ref: l,
21
+ tabIndex: u ? 0 : void 0,
22
+ className: "table-cell-overflow",
23
+ children: c
24
+ })
25
+ }), u && /* @__PURE__ */ o(t, {
26
+ className: "max-w-[min(32rem,calc(100vw-2rem))] whitespace-pre-wrap break-words",
27
+ children: u
28
+ })] });
29
+ }
30
+ //#endregion
31
+ export { c as TableCellOverflow };
@@ -0,0 +1 @@
1
+ let e=require("react/jsx-runtime");function t({children:t}){return(0,e.jsx)(`div`,{"data-slot":`table-toolbar`,className:`mb-3! flex min-h-9 flex-wrap items-center justify-start gap-2 [&_button]:h-9`,children:t})}exports.TableToolbar=t;
@@ -0,0 +1,5 @@
1
+ import type { ReactNode } from 'react';
2
+ export declare function TableToolbar({ children }: {
3
+ children: ReactNode;
4
+ }): import("react").JSX.Element;
5
+ //# sourceMappingURL=table-toolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-toolbar.d.ts","sourceRoot":"","sources":["../../src/components/table-toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BASjE"}
@@ -0,0 +1,11 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ //#region src/components/table-toolbar.tsx
3
+ function t({ children: t }) {
4
+ return /* @__PURE__ */ e("div", {
5
+ "data-slot": "table-toolbar",
6
+ className: "mb-3! flex min-h-9 flex-wrap items-center justify-start gap-2 [&_button]:h-9",
7
+ children: t
8
+ });
9
+ }
10
+ //#endregion
11
+ export { t as TableToolbar };
@@ -0,0 +1 @@
1
+ const e=require("../lib/utils.cjs");let t=require("react/jsx-runtime");var n={default:`bg-primary`,success:`bg-success`,warning:`bg-warning`,danger:`bg-danger`};function r({items:r,className:i}){return(0,t.jsx)(`ol`,{"data-slot":`timeline`,className:e.cn(`relative space-y-5`,i),children:r.map((i,a)=>(0,t.jsxs)(`li`,{className:`relative flex gap-3 pb-1 pl-1`,children:[(0,t.jsxs)(`span`,{"aria-hidden":`true`,className:`relative flex w-3 shrink-0 justify-center`,children:[a<r.length-1&&(0,t.jsx)(`span`,{className:`absolute top-3 h-[calc(100%+8px)] w-px bg-border`}),(0,t.jsx)(`span`,{className:e.cn(`mt-1.5 size-2 rounded-full`,n[i.tone??`default`])})]}),(0,t.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,t.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-2`,children:[(0,t.jsx)(`p`,{className:`text-sm font-medium`,children:i.title}),i.time&&(0,t.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i.time})]}),i.description&&(0,t.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:i.description})]})]},i.key))})}exports.Timeline=r;