@inshorts/glint-ui 0.5.4 → 0.6.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 (340) hide show
  1. package/README.md +3 -1
  2. package/dist/alert.cjs +96 -0
  3. package/dist/alert.cjs.map +1 -0
  4. package/dist/alert.d.cts +29 -0
  5. package/dist/alert.d.ts +29 -0
  6. package/dist/alert.js +10 -0
  7. package/dist/alert.js.map +1 -0
  8. package/dist/autocomplete.cjs +578 -0
  9. package/dist/autocomplete.cjs.map +1 -0
  10. package/dist/autocomplete.d.cts +56 -0
  11. package/dist/autocomplete.d.ts +56 -0
  12. package/dist/autocomplete.js +11 -0
  13. package/dist/autocomplete.js.map +1 -0
  14. package/dist/badge.cjs +89 -0
  15. package/dist/badge.cjs.map +1 -0
  16. package/dist/badge.d.cts +25 -0
  17. package/dist/badge.d.ts +25 -0
  18. package/dist/badge.js +10 -0
  19. package/dist/badge.js.map +1 -0
  20. package/dist/breadcrumb.cjs +88 -0
  21. package/dist/breadcrumb.cjs.map +1 -0
  22. package/dist/breadcrumb.d.cts +14 -0
  23. package/dist/breadcrumb.d.ts +14 -0
  24. package/dist/breadcrumb.js +8 -0
  25. package/dist/breadcrumb.js.map +1 -0
  26. package/dist/button.cjs +143 -0
  27. package/dist/button.cjs.map +1 -0
  28. package/dist/button.d.cts +34 -0
  29. package/dist/button.d.ts +34 -0
  30. package/dist/button.js +9 -0
  31. package/dist/button.js.map +1 -0
  32. package/dist/card.cjs +111 -0
  33. package/dist/card.cjs.map +1 -0
  34. package/dist/card.d.cts +15 -0
  35. package/dist/card.d.ts +15 -0
  36. package/dist/card.js +18 -0
  37. package/dist/card.js.map +1 -0
  38. package/dist/checkbox.cjs +66 -0
  39. package/dist/checkbox.cjs.map +1 -0
  40. package/{src/checkbox.tsx → dist/checkbox.d.cts} +5 -22
  41. package/dist/checkbox.d.ts +25 -0
  42. package/dist/checkbox.js +10 -0
  43. package/dist/checkbox.js.map +1 -0
  44. package/dist/chunk-5MEOZHJA.js +513 -0
  45. package/dist/chunk-5MEOZHJA.js.map +1 -0
  46. package/dist/chunk-67ACNS42.js +29 -0
  47. package/dist/chunk-67ACNS42.js.map +1 -0
  48. package/dist/chunk-A6GRLKOO.js +85 -0
  49. package/dist/chunk-A6GRLKOO.js.map +1 -0
  50. package/dist/chunk-DS3QYIKL.js +90 -0
  51. package/dist/chunk-DS3QYIKL.js.map +1 -0
  52. package/dist/chunk-EWSBFU54.js +53 -0
  53. package/dist/chunk-EWSBFU54.js.map +1 -0
  54. package/dist/chunk-G4ZQUSAJ.js +38 -0
  55. package/dist/chunk-G4ZQUSAJ.js.map +1 -0
  56. package/dist/chunk-GMCUXEFI.js +67 -0
  57. package/dist/chunk-GMCUXEFI.js.map +1 -0
  58. package/dist/chunk-HBBOR43A.js +85 -0
  59. package/dist/chunk-HBBOR43A.js.map +1 -0
  60. package/dist/chunk-HCA5ODCD.js +11 -0
  61. package/dist/chunk-HCA5ODCD.js.map +1 -0
  62. package/dist/chunk-HYRJYUPI.js +26 -0
  63. package/dist/chunk-HYRJYUPI.js.map +1 -0
  64. package/dist/chunk-IRCTGJQB.js +26 -0
  65. package/dist/chunk-IRCTGJQB.js.map +1 -0
  66. package/dist/chunk-ISPICB4W.js +70 -0
  67. package/dist/chunk-ISPICB4W.js.map +1 -0
  68. package/dist/chunk-JDE5XYPT.js +30 -0
  69. package/dist/chunk-JDE5XYPT.js.map +1 -0
  70. package/dist/chunk-JSJEEKR3.js +59 -0
  71. package/dist/chunk-JSJEEKR3.js.map +1 -0
  72. package/dist/chunk-KR3BCFP7.js +85 -0
  73. package/dist/chunk-KR3BCFP7.js.map +1 -0
  74. package/dist/chunk-MLRSOTFI.js +81 -0
  75. package/dist/chunk-MLRSOTFI.js.map +1 -0
  76. package/dist/chunk-MQT5RAQV.js +202 -0
  77. package/dist/chunk-MQT5RAQV.js.map +1 -0
  78. package/dist/chunk-MUPW2TFJ.js +102 -0
  79. package/dist/chunk-MUPW2TFJ.js.map +1 -0
  80. package/dist/chunk-OUYT6SPU.js +76 -0
  81. package/dist/chunk-OUYT6SPU.js.map +1 -0
  82. package/dist/chunk-PM2VE7DJ.js +100 -0
  83. package/dist/chunk-PM2VE7DJ.js.map +1 -0
  84. package/dist/chunk-PPYR3O3L.js +44 -0
  85. package/dist/chunk-PPYR3O3L.js.map +1 -0
  86. package/dist/chunk-PUTC52SI.js +98 -0
  87. package/dist/chunk-PUTC52SI.js.map +1 -0
  88. package/dist/chunk-PWAKTEXF.js +18 -0
  89. package/dist/chunk-PWAKTEXF.js.map +1 -0
  90. package/dist/chunk-QTFWORA7.js +26 -0
  91. package/dist/chunk-QTFWORA7.js.map +1 -0
  92. package/dist/chunk-RUPL2H6V.js +49 -0
  93. package/dist/chunk-RUPL2H6V.js.map +1 -0
  94. package/dist/chunk-S7PVZAPL.js +28 -0
  95. package/dist/chunk-S7PVZAPL.js.map +1 -0
  96. package/dist/chunk-SQDV2AKJ.js +49 -0
  97. package/dist/chunk-SQDV2AKJ.js.map +1 -0
  98. package/dist/chunk-T2KXVH3O.js +297 -0
  99. package/dist/chunk-T2KXVH3O.js.map +1 -0
  100. package/dist/chunk-T4WCCHJQ.js +29 -0
  101. package/dist/chunk-T4WCCHJQ.js.map +1 -0
  102. package/dist/chunk-UC3ZIQPE.js +93 -0
  103. package/dist/chunk-UC3ZIQPE.js.map +1 -0
  104. package/dist/chunk-UE7JY7VR.js +28 -0
  105. package/dist/chunk-UE7JY7VR.js.map +1 -0
  106. package/dist/chunk-Y5WCT6XN.js +93 -0
  107. package/dist/chunk-Y5WCT6XN.js.map +1 -0
  108. package/dist/chunk-YDICVETX.js +151 -0
  109. package/dist/chunk-YDICVETX.js.map +1 -0
  110. package/dist/chunk-ZFSQVMLJ.js +126 -0
  111. package/dist/chunk-ZFSQVMLJ.js.map +1 -0
  112. package/dist/chunk-ZHATD73Y.js +46 -0
  113. package/dist/chunk-ZHATD73Y.js.map +1 -0
  114. package/dist/chunk-ZLAA4DGG.js +111 -0
  115. package/dist/chunk-ZLAA4DGG.js.map +1 -0
  116. package/dist/chunk-ZP252OJZ.js +56 -0
  117. package/dist/chunk-ZP252OJZ.js.map +1 -0
  118. package/dist/clipboard.cjs +125 -0
  119. package/dist/clipboard.cjs.map +1 -0
  120. package/dist/clipboard.d.cts +52 -0
  121. package/dist/clipboard.d.ts +52 -0
  122. package/dist/clipboard.js +23 -0
  123. package/dist/clipboard.js.map +1 -0
  124. package/dist/collapsible.cjs +94 -0
  125. package/dist/collapsible.cjs.map +1 -0
  126. package/dist/collapsible.d.cts +21 -0
  127. package/dist/collapsible.d.ts +21 -0
  128. package/dist/collapsible.js +9 -0
  129. package/dist/collapsible.js.map +1 -0
  130. package/dist/confirm-dialog.cjs +369 -0
  131. package/dist/confirm-dialog.cjs.map +1 -0
  132. package/dist/confirm-dialog.d.cts +16 -0
  133. package/dist/confirm-dialog.d.ts +16 -0
  134. package/dist/confirm-dialog.js +13 -0
  135. package/dist/confirm-dialog.js.map +1 -0
  136. package/dist/copy-button.cjs +102 -0
  137. package/dist/copy-button.cjs.map +1 -0
  138. package/dist/copy-button.d.cts +18 -0
  139. package/dist/copy-button.d.ts +18 -0
  140. package/dist/copy-button.js +10 -0
  141. package/dist/copy-button.js.map +1 -0
  142. package/dist/data-table.cjs +140 -0
  143. package/dist/data-table.cjs.map +1 -0
  144. package/dist/data-table.d.cts +81 -0
  145. package/dist/data-table.d.ts +81 -0
  146. package/dist/data-table.js +8 -0
  147. package/dist/data-table.js.map +1 -0
  148. package/dist/date-range-picker/dateRange.cjs +138 -0
  149. package/dist/date-range-picker/dateRange.cjs.map +1 -0
  150. package/dist/date-range-picker/dateRange.d.cts +57 -0
  151. package/dist/date-range-picker/dateRange.d.ts +57 -0
  152. package/dist/date-range-picker/dateRange.js +31 -0
  153. package/dist/date-range-picker/dateRange.js.map +1 -0
  154. package/dist/date-range-picker/index.cjs +375 -0
  155. package/dist/date-range-picker/index.cjs.map +1 -0
  156. package/dist/date-range-picker/index.d.cts +18 -0
  157. package/dist/date-range-picker/index.d.ts +18 -0
  158. package/dist/date-range-picker/index.js +10 -0
  159. package/dist/date-range-picker/index.js.map +1 -0
  160. package/dist/dialogLayer.cjs +121 -0
  161. package/dist/dialogLayer.cjs.map +1 -0
  162. package/dist/dialogLayer.d.cts +11 -0
  163. package/dist/dialogLayer.d.ts +11 -0
  164. package/dist/dialogLayer.js +8 -0
  165. package/dist/dialogLayer.js.map +1 -0
  166. package/dist/feature-access-gate.cjs +160 -0
  167. package/dist/feature-access-gate.cjs.map +1 -0
  168. package/dist/feature-access-gate.d.cts +14 -0
  169. package/dist/feature-access-gate.d.ts +14 -0
  170. package/dist/feature-access-gate.js +11 -0
  171. package/dist/feature-access-gate.js.map +1 -0
  172. package/dist/field.cjs +58 -0
  173. package/dist/field.cjs.map +1 -0
  174. package/dist/field.d.cts +23 -0
  175. package/dist/field.d.ts +23 -0
  176. package/dist/field.js +8 -0
  177. package/dist/field.js.map +1 -0
  178. package/dist/image-uploader.cjs +293 -0
  179. package/dist/image-uploader.cjs.map +1 -0
  180. package/dist/image-uploader.d.cts +34 -0
  181. package/dist/image-uploader.d.ts +34 -0
  182. package/dist/image-uploader.js +12 -0
  183. package/dist/image-uploader.js.map +1 -0
  184. package/dist/index.cjs +3008 -0
  185. package/dist/index.cjs.map +1 -0
  186. package/dist/index.d.cts +41 -0
  187. package/dist/index.d.ts +41 -0
  188. package/dist/index.js +232 -0
  189. package/dist/index.js.map +1 -0
  190. package/dist/input.cjs +58 -0
  191. package/dist/input.cjs.map +1 -0
  192. package/dist/input.d.cts +7 -0
  193. package/dist/input.d.ts +7 -0
  194. package/dist/input.js +10 -0
  195. package/dist/input.js.map +1 -0
  196. package/dist/label.cjs +67 -0
  197. package/dist/label.cjs.map +1 -0
  198. package/dist/label.d.cts +7 -0
  199. package/dist/label.d.ts +7 -0
  200. package/dist/label.js +9 -0
  201. package/dist/label.js.map +1 -0
  202. package/dist/modal.cjs +212 -0
  203. package/dist/modal.cjs.map +1 -0
  204. package/dist/modal.d.cts +39 -0
  205. package/dist/modal.d.ts +39 -0
  206. package/dist/modal.js +12 -0
  207. package/dist/modal.js.map +1 -0
  208. package/dist/page-header.cjs +78 -0
  209. package/dist/page-header.cjs.map +1 -0
  210. package/dist/page-header.d.cts +35 -0
  211. package/dist/page-header.d.ts +35 -0
  212. package/dist/page-header.js +8 -0
  213. package/dist/page-header.js.map +1 -0
  214. package/dist/pagination.cjs +237 -0
  215. package/dist/pagination.cjs.map +1 -0
  216. package/dist/pagination.d.cts +15 -0
  217. package/dist/pagination.d.ts +15 -0
  218. package/dist/pagination.js +11 -0
  219. package/dist/pagination.js.map +1 -0
  220. package/dist/panel-brand-mark.cjs +59 -0
  221. package/dist/panel-brand-mark.cjs.map +1 -0
  222. package/dist/panel-brand-mark.d.cts +13 -0
  223. package/dist/panel-brand-mark.d.ts +13 -0
  224. package/dist/panel-brand-mark.js +8 -0
  225. package/dist/panel-brand-mark.js.map +1 -0
  226. package/dist/panel-sign-in.cjs +256 -0
  227. package/dist/panel-sign-in.cjs.map +1 -0
  228. package/dist/panel-sign-in.d.cts +31 -0
  229. package/dist/panel-sign-in.d.ts +31 -0
  230. package/dist/panel-sign-in.js +14 -0
  231. package/dist/panel-sign-in.js.map +1 -0
  232. package/dist/segmented-control.cjs +122 -0
  233. package/dist/segmented-control.cjs.map +1 -0
  234. package/dist/segmented-control.d.cts +58 -0
  235. package/dist/segmented-control.d.ts +58 -0
  236. package/dist/segmented-control.js +9 -0
  237. package/dist/segmented-control.js.map +1 -0
  238. package/dist/select.cjs +648 -0
  239. package/dist/select.cjs.map +1 -0
  240. package/dist/select.d.cts +30 -0
  241. package/dist/select.d.ts +30 -0
  242. package/dist/select.js +12 -0
  243. package/dist/select.js.map +1 -0
  244. package/dist/separator.cjs +70 -0
  245. package/dist/separator.cjs.map +1 -0
  246. package/dist/separator.d.cts +13 -0
  247. package/dist/separator.d.ts +13 -0
  248. package/dist/separator.js +9 -0
  249. package/dist/separator.js.map +1 -0
  250. package/dist/side-drawer.cjs +321 -0
  251. package/dist/side-drawer.cjs.map +1 -0
  252. package/dist/side-drawer.d.cts +21 -0
  253. package/dist/side-drawer.d.ts +21 -0
  254. package/dist/side-drawer.js +13 -0
  255. package/dist/side-drawer.js.map +1 -0
  256. package/dist/spinner.cjs +57 -0
  257. package/dist/spinner.cjs.map +1 -0
  258. package/{src/spinner.tsx → dist/spinner.d.cts} +11 -22
  259. package/dist/spinner.d.ts +27 -0
  260. package/dist/spinner.js +8 -0
  261. package/dist/spinner.js.map +1 -0
  262. package/dist/spreadsheet-grid.cjs +238 -0
  263. package/dist/spreadsheet-grid.cjs.map +1 -0
  264. package/dist/spreadsheet-grid.d.cts +48 -0
  265. package/dist/spreadsheet-grid.d.ts +48 -0
  266. package/dist/spreadsheet-grid.js +8 -0
  267. package/dist/spreadsheet-grid.js.map +1 -0
  268. package/dist/state-panel.cjs +86 -0
  269. package/dist/state-panel.cjs.map +1 -0
  270. package/dist/state-panel.d.cts +23 -0
  271. package/dist/state-panel.d.ts +23 -0
  272. package/dist/state-panel.js +9 -0
  273. package/dist/state-panel.js.map +1 -0
  274. package/dist/switch.cjs +87 -0
  275. package/dist/switch.cjs.map +1 -0
  276. package/dist/switch.d.cts +13 -0
  277. package/dist/switch.d.ts +13 -0
  278. package/dist/switch.js +9 -0
  279. package/dist/switch.js.map +1 -0
  280. package/dist/table.cjs +139 -0
  281. package/dist/table.cjs.map +1 -0
  282. package/dist/table.d.cts +16 -0
  283. package/dist/table.d.ts +16 -0
  284. package/dist/table.js +22 -0
  285. package/dist/table.js.map +1 -0
  286. package/dist/tabs.cjs +168 -0
  287. package/dist/tabs.cjs.map +1 -0
  288. package/dist/tabs.d.cts +59 -0
  289. package/dist/tabs.d.ts +59 -0
  290. package/dist/tabs.js +11 -0
  291. package/dist/tabs.js.map +1 -0
  292. package/dist/textarea.cjs +66 -0
  293. package/dist/textarea.cjs.map +1 -0
  294. package/dist/textarea.d.cts +18 -0
  295. package/dist/textarea.d.ts +18 -0
  296. package/dist/textarea.js +10 -0
  297. package/dist/textarea.js.map +1 -0
  298. package/dist/utils.cjs +35 -0
  299. package/dist/utils.cjs.map +1 -0
  300. package/dist/utils.d.cts +5 -0
  301. package/dist/utils.d.ts +5 -0
  302. package/dist/utils.js +7 -0
  303. package/dist/utils.js.map +1 -0
  304. package/package.json +391 -14
  305. package/src/alert.tsx +0 -74
  306. package/src/autocomplete.tsx +0 -666
  307. package/src/badge.tsx +0 -60
  308. package/src/breadcrumb.tsx +0 -71
  309. package/src/button.tsx +0 -113
  310. package/src/card.tsx +0 -79
  311. package/src/clipboard.ts +0 -144
  312. package/src/collapsible.tsx +0 -63
  313. package/src/confirm-dialog.tsx +0 -84
  314. package/src/copy-button.tsx +0 -58
  315. package/src/data-table.tsx +0 -190
  316. package/src/date-range-picker/dateRange.ts +0 -142
  317. package/src/date-range-picker/index.tsx +0 -366
  318. package/src/dialogLayer.ts +0 -142
  319. package/src/feature-access-gate.tsx +0 -38
  320. package/src/field.tsx +0 -56
  321. package/src/image-uploader.tsx +0 -181
  322. package/src/index.ts +0 -37
  323. package/src/input.tsx +0 -16
  324. package/src/label.tsx +0 -23
  325. package/src/modal.tsx +0 -117
  326. package/src/page-header.tsx +0 -75
  327. package/src/pagination.tsx +0 -116
  328. package/src/panel-brand-mark.tsx +0 -32
  329. package/src/panel-sign-in.tsx +0 -134
  330. package/src/segmented-control.tsx +0 -155
  331. package/src/select.tsx +0 -105
  332. package/src/separator.tsx +0 -32
  333. package/src/side-drawer.tsx +0 -87
  334. package/src/spreadsheet-grid.tsx +0 -264
  335. package/src/state-panel.tsx +0 -46
  336. package/src/switch.tsx +0 -47
  337. package/src/table.tsx +0 -110
  338. package/src/tabs.tsx +0 -201
  339. package/src/textarea.tsx +0 -32
  340. package/src/utils.ts +0 -6
@@ -0,0 +1,369 @@
1
+ "use client";
2
+ "use strict";
3
+ "use client";
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+
32
+ // src/confirm-dialog.tsx
33
+ var confirm_dialog_exports = {};
34
+ __export(confirm_dialog_exports, {
35
+ ConfirmDialog: () => ConfirmDialog
36
+ });
37
+ module.exports = __toCommonJS(confirm_dialog_exports);
38
+ var React4 = __toESM(require("react"), 1);
39
+
40
+ // src/button.tsx
41
+ var React = __toESM(require("react"), 1);
42
+ var import_class_variance_authority = require("class-variance-authority");
43
+ var import_react_slot = require("@radix-ui/react-slot");
44
+
45
+ // src/spinner.tsx
46
+ var import_lucide_react = require("lucide-react");
47
+
48
+ // src/utils.ts
49
+ var import_clsx = require("clsx");
50
+ var import_tailwind_merge = require("tailwind-merge");
51
+ function cn(...inputs) {
52
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
53
+ }
54
+
55
+ // src/spinner.tsx
56
+ var import_jsx_runtime = require("react/jsx-runtime");
57
+ var SIZES = {
58
+ sm: "size-3.5",
59
+ md: "size-4",
60
+ lg: "size-5",
61
+ xl: "size-10 border-2"
62
+ };
63
+ function Spinner({ size = "md", className, ...props }) {
64
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
+ import_lucide_react.Loader2,
66
+ {
67
+ "aria-hidden": true,
68
+ className: cn("animate-spin", SIZES[size], className),
69
+ ...props
70
+ }
71
+ );
72
+ }
73
+
74
+ // src/button.tsx
75
+ var import_jsx_runtime2 = require("react/jsx-runtime");
76
+ var buttonVariants = (0, import_class_variance_authority.cva)(
77
+ "inline-flex h-9 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md px-3 text-sm font-medium transition duration-200 active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
78
+ {
79
+ variants: {
80
+ variant: {
81
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
82
+ secondary: "bg-muted text-foreground hover:bg-muted/80",
83
+ ghost: "hover:bg-muted",
84
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
85
+ outline: "border border-border bg-background hover:bg-muted"
86
+ },
87
+ size: {
88
+ sm: "h-8 px-2.5",
89
+ md: "h-9 px-3",
90
+ lg: "h-10 px-4",
91
+ icon: "h-9 w-9 px-0",
92
+ // Square, matching `sm`'s height — for an icon-only control sitting in
93
+ // a table row or beside `sm` buttons, where `icon` is a row taller.
94
+ "icon-sm": "h-8 w-8 px-0"
95
+ }
96
+ },
97
+ defaultVariants: {
98
+ variant: "default",
99
+ size: "md"
100
+ }
101
+ }
102
+ );
103
+ var ICON_SIZES = /* @__PURE__ */ new Set(["icon", "icon-sm"]);
104
+ var Button = React.forwardRef(
105
+ ({
106
+ className,
107
+ variant,
108
+ size,
109
+ asChild = false,
110
+ loading,
111
+ disabled,
112
+ children,
113
+ ...props
114
+ }, ref) => {
115
+ const Comp = asChild ? import_react_slot.Slot : "button";
116
+ if (asChild) {
117
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
118
+ Comp,
119
+ {
120
+ ref,
121
+ className: cn(buttonVariants({ variant, size }), className),
122
+ ...props,
123
+ children
124
+ }
125
+ );
126
+ }
127
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
128
+ "button",
129
+ {
130
+ ref,
131
+ disabled: disabled || loading,
132
+ "aria-busy": loading || void 0,
133
+ className: cn(buttonVariants({ variant, size }), className),
134
+ ...props,
135
+ children: [
136
+ loading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Spinner, { size: "sm" }) : null,
137
+ loading && size != null && ICON_SIZES.has(size) ? null : children
138
+ ]
139
+ }
140
+ );
141
+ }
142
+ );
143
+ Button.displayName = "Button";
144
+
145
+ // src/modal.tsx
146
+ var React3 = __toESM(require("react"), 1);
147
+ var import_react_dom = require("react-dom");
148
+
149
+ // src/dialogLayer.ts
150
+ var React2 = __toESM(require("react"), 1);
151
+ var layers = [];
152
+ var FOCUSABLE = [
153
+ "a[href]",
154
+ "button:not([disabled])",
155
+ "input:not([disabled])",
156
+ "select:not([disabled])",
157
+ "textarea:not([disabled])",
158
+ '[tabindex]:not([tabindex="-1"])'
159
+ ].join(",");
160
+ function isVisible(element) {
161
+ if (element.closest("[hidden]")) return false;
162
+ if (element.getAttribute("aria-hidden") === "true") return false;
163
+ return typeof element.checkVisibility === "function" ? element.checkVisibility() : true;
164
+ }
165
+ function focusableWithin(container) {
166
+ return Array.from(container.querySelectorAll(FOCUSABLE)).filter(
167
+ isVisible
168
+ );
169
+ }
170
+ function useDialogLayer({
171
+ active,
172
+ containerRef,
173
+ onEscape
174
+ }) {
175
+ const escapeRef = React2.useRef(onEscape);
176
+ React2.useEffect(() => {
177
+ escapeRef.current = onEscape;
178
+ });
179
+ React2.useEffect(() => {
180
+ if (!active) return;
181
+ const layer = /* @__PURE__ */ Symbol("dialog-layer");
182
+ layers.push(layer);
183
+ const isTopLayer = () => layers[layers.length - 1] === layer;
184
+ const previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null;
185
+ const container = containerRef.current;
186
+ if (container && !container.contains(document.activeElement)) {
187
+ const [first] = focusableWithin(container);
188
+ (container.hasAttribute("tabindex") ? container : first)?.focus();
189
+ }
190
+ function handleKeyDown(event) {
191
+ if (!isTopLayer()) return;
192
+ if (event.key === "Escape") {
193
+ escapeRef.current?.();
194
+ return;
195
+ }
196
+ if (event.key !== "Tab") return;
197
+ const panel = containerRef.current;
198
+ if (!panel) return;
199
+ const items = focusableWithin(panel);
200
+ if (items.length === 0) {
201
+ event.preventDefault();
202
+ panel.focus();
203
+ return;
204
+ }
205
+ const first = items[0];
206
+ const last = items[items.length - 1];
207
+ const active2 = document.activeElement;
208
+ const outside = !panel.contains(active2);
209
+ if (event.shiftKey && (active2 === first || outside)) {
210
+ event.preventDefault();
211
+ last.focus();
212
+ } else if (!event.shiftKey && (active2 === last || outside)) {
213
+ event.preventDefault();
214
+ first.focus();
215
+ }
216
+ }
217
+ document.addEventListener("keydown", handleKeyDown);
218
+ const previousOverflow = document.body.style.overflow;
219
+ document.body.style.overflow = "hidden";
220
+ return () => {
221
+ document.removeEventListener("keydown", handleKeyDown);
222
+ document.body.style.overflow = previousOverflow;
223
+ const index = layers.indexOf(layer);
224
+ if (index !== -1) layers.splice(index, 1);
225
+ if (previouslyFocused?.isConnected) previouslyFocused.focus();
226
+ };
227
+ }, [active, containerRef]);
228
+ }
229
+
230
+ // src/modal.tsx
231
+ var import_jsx_runtime3 = (
232
+ /*
233
+ `overflow-y-auto` on the overlay, `my-auto` on the panel — not
234
+ `items-center`. A flex item centred with `align-items` overflows equally
235
+ in both directions once it is taller than its container, and the half
236
+ above the top edge cannot be scrolled to: with the page behind it locked,
237
+ an over-tall dialog was simply unreachable at both ends. Auto margins
238
+ centre a short panel the same way and collapse to zero on a tall one,
239
+ which scrolls.
240
+ */
241
+ require("react/jsx-runtime")
242
+ );
243
+ var emptySubscribe = () => () => {
244
+ };
245
+ function useHasMounted() {
246
+ return React3.useSyncExternalStore(
247
+ emptySubscribe,
248
+ () => true,
249
+ () => false
250
+ );
251
+ }
252
+ function Modal({
253
+ isOpen,
254
+ labelledBy,
255
+ describedBy,
256
+ closeLabel,
257
+ onClose,
258
+ children,
259
+ dismissible = true,
260
+ role = "dialog",
261
+ panelClassName
262
+ }) {
263
+ const mounted = useHasMounted();
264
+ const panelRef = React3.useRef(null);
265
+ useDialogLayer({
266
+ // Gated on `mounted` too: before that the panel is not rendered, so there
267
+ // would be nothing to move focus into.
268
+ active: isOpen && mounted,
269
+ containerRef: panelRef,
270
+ onEscape: dismissible ? onClose : void 0
271
+ });
272
+ if (!mounted || !isOpen) return null;
273
+ return (0, import_react_dom.createPortal)(
274
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "fixed inset-0 z-[100] flex justify-center overflow-y-auto p-4", children: [
275
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
276
+ "button",
277
+ {
278
+ type: "button",
279
+ "aria-label": closeLabel,
280
+ tabIndex: -1,
281
+ className: "fixed inset-0 bg-overlay/50",
282
+ onClick: () => {
283
+ if (dismissible) onClose();
284
+ }
285
+ }
286
+ ),
287
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
288
+ "div",
289
+ {
290
+ ref: panelRef,
291
+ role,
292
+ "aria-modal": "true",
293
+ "aria-labelledby": labelledBy,
294
+ "aria-describedby": describedBy,
295
+ tabIndex: -1,
296
+ className: cn(
297
+ "border-border bg-background relative z-10 my-auto w-full rounded-lg border shadow-2xl outline-none",
298
+ panelClassName ?? "max-w-md p-6"
299
+ ),
300
+ children
301
+ }
302
+ )
303
+ ] }),
304
+ document.body
305
+ );
306
+ }
307
+
308
+ // src/confirm-dialog.tsx
309
+ var import_jsx_runtime4 = require("react/jsx-runtime");
310
+ function ConfirmDialog({
311
+ isOpen,
312
+ title,
313
+ description,
314
+ confirmLabel = "Delete",
315
+ cancelLabel = "Cancel",
316
+ isConfirming,
317
+ error,
318
+ onConfirm,
319
+ onClose
320
+ }) {
321
+ const titleId = React4.useId();
322
+ const descriptionId = React4.useId();
323
+ const errorId = React4.useId();
324
+ const describedBy = [
325
+ description ? descriptionId : null,
326
+ error ? errorId : null
327
+ ].filter(Boolean).join(" ");
328
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
329
+ Modal,
330
+ {
331
+ isOpen,
332
+ role: "alertdialog",
333
+ labelledBy: titleId,
334
+ describedBy: describedBy || void 0,
335
+ closeLabel: "Close dialog",
336
+ onClose,
337
+ children: [
338
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { id: titleId, className: "text-lg font-semibold", children: title }),
339
+ description ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { id: descriptionId, className: "text-muted-foreground mt-2 text-sm", children: description }) : null,
340
+ error ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
341
+ "div",
342
+ {
343
+ id: errorId,
344
+ role: "alert",
345
+ className: "border-destructive/30 bg-destructive/5 text-destructive mt-4 rounded-lg border px-3 py-2 text-sm",
346
+ children: error
347
+ }
348
+ ) : null,
349
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mt-6 flex justify-end gap-2", children: [
350
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Button, { variant: "outline", onClick: onClose, disabled: isConfirming, children: cancelLabel }),
351
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
352
+ Button,
353
+ {
354
+ variant: "destructive",
355
+ onClick: onConfirm,
356
+ loading: isConfirming,
357
+ children: confirmLabel
358
+ }
359
+ )
360
+ ] })
361
+ ]
362
+ }
363
+ );
364
+ }
365
+ // Annotate the CommonJS export names for ESM import in node:
366
+ 0 && (module.exports = {
367
+ ConfirmDialog
368
+ });
369
+ //# sourceMappingURL=confirm-dialog.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/confirm-dialog.tsx","../src/button.tsx","../src/spinner.tsx","../src/utils.ts","../src/modal.tsx","../src/dialogLayer.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { Button } from \"./button\";\nimport { Modal } from \"./modal\";\n\ninterface ConfirmDialogProps {\n isOpen: boolean;\n title: string;\n description?: React.ReactNode;\n confirmLabel?: string;\n cancelLabel?: string;\n isConfirming?: boolean;\n error?: string | null;\n onConfirm: () => void;\n onClose: () => void;\n}\n\nexport function ConfirmDialog({\n isOpen,\n title,\n description,\n confirmLabel = \"Delete\",\n cancelLabel = \"Cancel\",\n isConfirming,\n error,\n onConfirm,\n onClose,\n}: ConfirmDialogProps) {\n const titleId = React.useId();\n const descriptionId = React.useId();\n const errorId = React.useId();\n\n const describedBy = [\n description ? descriptionId : null,\n error ? errorId : null,\n ]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <Modal\n isOpen={isOpen}\n role=\"alertdialog\"\n labelledBy={titleId}\n describedBy={describedBy || undefined}\n closeLabel=\"Close dialog\"\n onClose={onClose}\n >\n <h3 id={titleId} className=\"text-lg font-semibold\">\n {title}\n </h3>\n {description ? (\n <div id={descriptionId} className=\"text-muted-foreground mt-2 text-sm\">\n {description}\n </div>\n ) : null}\n\n {error ? (\n <div\n id={errorId}\n role=\"alert\"\n className=\"border-destructive/30 bg-destructive/5 text-destructive mt-4 rounded-lg border px-3 py-2 text-sm\"\n >\n {error}\n </div>\n ) : null}\n\n <div className=\"mt-6 flex justify-end gap-2\">\n <Button variant=\"outline\" onClick={onClose} disabled={isConfirming}>\n {cancelLabel}\n </Button>\n <Button\n variant=\"destructive\"\n onClick={onConfirm}\n loading={isConfirming}\n >\n {confirmLabel}\n </Button>\n </div>\n </Modal>\n );\n}\n","import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nimport { Spinner } from \"./spinner\";\nimport { cn } from \"./utils\";\n\nconst buttonVariants = cva(\n \"inline-flex h-9 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md px-3 text-sm font-medium transition duration-200 active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n secondary: \"bg-muted text-foreground hover:bg-muted/80\",\n ghost: \"hover:bg-muted\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline: \"border border-border bg-background hover:bg-muted\",\n },\n size: {\n sm: \"h-8 px-2.5\",\n md: \"h-9 px-3\",\n lg: \"h-10 px-4\",\n icon: \"h-9 w-9 px-0\",\n // Square, matching `sm`'s height — for an icon-only control sitting in\n // a table row or beside `sm` buttons, where `icon` is a row taller.\n \"icon-sm\": \"h-8 w-8 px-0\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"md\",\n },\n },\n);\n\nexport interface ButtonProps\n extends\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n /**\n * Work is in flight: shows a spinner, disables the button, and sets\n * `aria-busy`.\n *\n * This exists because the panel had 272 disabled buttons and only 22 that\n * said anything about why — the rest went dead on click with no spinner and\n * no label change, which reads as a broken button rather than a busy one.\n * Making the feedback part of `disabled` rather than something each caller\n * remembers separately is the only way that ratio stays fixed.\n *\n * The label is kept rather than swapped. \"Saving…\" loses which button you\n * pressed, and the spinner already says it is working. An icon-only button\n * is the exception — there is no room beside the glyph, so the spinner takes\n * its place; the `aria-label` is what names the button either way.\n *\n * \"Icon-only\" means an icon `size`. A square button that grew a spinner\n * beside its glyph would not just look wrong, it would resize mid-request\n * and shove whatever sits next to it sideways.\n */\n loading?: boolean;\n}\n\n/** Sizes with no room for a spinner beside the glyph. */\nconst ICON_SIZES = new Set<string>([\"icon\", \"icon-sm\"]);\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n asChild = false,\n loading,\n disabled,\n children,\n ...props\n },\n ref,\n ) => {\n const Comp = asChild ? Slot : \"button\";\n\n // `asChild` renders someone else's element, which may not take a spinner or\n // a disabled attribute — so the busy treatment is only applied to a real\n // button, and passing both is a mistake worth not papering over.\n if (asChild) {\n return (\n <Comp\n ref={ref}\n className={cn(buttonVariants({ variant, size }), className)}\n {...props}\n >\n {children}\n </Comp>\n );\n }\n\n return (\n <button\n ref={ref}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n className={cn(buttonVariants({ variant, size }), className)}\n {...props}\n >\n {loading ? <Spinner size=\"sm\" /> : null}\n {loading && size != null && ICON_SIZES.has(size) ? null : children}\n </button>\n );\n },\n);\n\nButton.displayName = \"Button\";\n","import * as React from \"react\";\nimport { Loader2 } from \"lucide-react\";\n\nimport { cn } from \"./utils\";\n\n/**\n * The one spinner.\n *\n * There were five spellings of `animate-spin` across twelve files — `h-4 w-4`,\n * `h-5 w-5`, `size-4`, bare, and a hand-drawn ring in `ProtectedRoute` — so the\n * same \"working\" signal came out a different size depending on which panel you\n * were on.\n *\n * It is `aria-hidden` on purpose. A spinner is decoration; what a screen reader\n * needs is the surrounding control's `aria-busy` or the panel's status text,\n * and announcing \"loading\" twice is worse than once. `Button` and `StatePanel`\n * both supply that.\n */\nconst SIZES = {\n sm: \"size-3.5\",\n md: \"size-4\",\n lg: \"size-5\",\n xl: \"size-10 border-2\",\n} as const;\n\nexport interface SpinnerProps extends React.SVGProps<SVGSVGElement> {\n size?: keyof typeof SIZES;\n}\n\nexport function Spinner({ size = \"md\", className, ...props }: SpinnerProps) {\n return (\n <Loader2\n aria-hidden\n className={cn(\"animate-spin\", SIZES[size], className)}\n {...props}\n />\n );\n}\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { useDialogLayer } from \"./dialogLayer\";\nimport { cn } from \"./utils\";\n\nconst emptySubscribe = () => () => {};\n\n/**\n * Returns false during SSR and the first client render, then true once mounted.\n * `useSyncExternalStore` is the React-recommended way to read client-only state\n * without a setState-in-effect (which triggers cascading renders).\n */\nexport function useHasMounted(): boolean {\n return React.useSyncExternalStore(\n emptySubscribe,\n () => true,\n () => false,\n );\n}\n\ninterface ModalProps {\n isOpen: boolean;\n /** id of the element labelling the dialog; wired to aria-labelledby. */\n labelledBy: string;\n /**\n * Optional id(s) of elements describing the dialog (APG alertdialog body).\n * Space-separated when multiple.\n */\n describedBy?: string;\n /** Accessible label for the backdrop dismiss button. */\n closeLabel: string;\n onClose: () => void;\n children: React.ReactNode;\n /**\n * When false, Escape and backdrop clicks do not close the modal (e.g. while a\n * save is in flight). Defaults to true.\n */\n dismissible?: boolean;\n /** Use \"alertdialog\" for destructive confirmations. Defaults to \"dialog\". */\n role?: \"dialog\" | \"alertdialog\";\n /** Tailwind max-width class for the panel. Defaults to \"max-w-md\". */\n panelClassName?: string;\n}\n\n/**\n * Shared modal shell: renders a portal-backed, scroll-locked, Escape-dismissible\n * overlay with a centered panel. Callers provide the panel body (heading, form,\n * footer). Consolidates the boilerplate previously copied across every dialog.\n */\nexport function Modal({\n isOpen,\n labelledBy,\n describedBy,\n closeLabel,\n onClose,\n children,\n dismissible = true,\n role = \"dialog\",\n panelClassName,\n}: ModalProps) {\n const mounted = useHasMounted();\n const panelRef = React.useRef<HTMLDivElement>(null);\n\n useDialogLayer({\n // Gated on `mounted` too: before that the panel is not rendered, so there\n // would be nothing to move focus into.\n active: isOpen && mounted,\n containerRef: panelRef,\n onEscape: dismissible ? onClose : undefined,\n });\n\n if (!mounted || !isOpen) return null;\n\n return createPortal(\n /*\n `overflow-y-auto` on the overlay, `my-auto` on the panel — not\n `items-center`. A flex item centred with `align-items` overflows equally\n in both directions once it is taller than its container, and the half\n above the top edge cannot be scrolled to: with the page behind it locked,\n an over-tall dialog was simply unreachable at both ends. Auto margins\n centre a short panel the same way and collapse to zero on a tall one,\n which scrolls.\n */\n <div className=\"fixed inset-0 z-[100] flex justify-center overflow-y-auto p-4\">\n {/* `fixed`, not `absolute`: inside a scrolling overlay an absolute\n backdrop scrolls away with the content and leaves the rest of a tall\n dialog sitting on an undimmed page. */}\n <button\n type=\"button\"\n aria-label={closeLabel}\n tabIndex={-1}\n className=\"fixed inset-0 bg-overlay/50\"\n onClick={() => {\n if (dismissible) onClose();\n }}\n />\n <div\n ref={panelRef}\n role={role}\n aria-modal=\"true\"\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n tabIndex={-1}\n className={cn(\n \"border-border bg-background relative z-10 my-auto w-full rounded-lg border shadow-2xl outline-none\",\n panelClassName ?? \"max-w-md p-6\",\n )}\n >\n {children}\n </div>\n </div>,\n document.body,\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\n/**\n * The keyboard and focus behaviour every dialog needs, in one place.\n *\n * `Modal` and `SideDrawer` each had a copy of the scroll lock and an Escape\n * handler, and neither did anything about focus: opening a dialog left focus\n * on the button behind it, Tab walked the page underneath — through the\n * full-screen backdrop button, among other things — and closing left focus\n * wherever it had wandered. That is the whole keyboard story for thirty\n * dialogs, so it is fixed once here rather than thirty times.\n */\n\n/**\n * Open dialogs, innermost last.\n *\n * Nesting is real here — \"Create audience group\" opens on top of \"Send\n * notification\" — and without an ordering both would answer the same Escape\n * and fight over the same Tab. Only the top layer acts.\n */\nconst layers: symbol[] = [];\n\nconst FOCUSABLE = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(\",\");\n\n/**\n * Deliberately not `offsetParent` or `getClientRects`: the first is null for\n * anything `position: fixed`, which a dialog panel usually is, and the second\n * is empty for *everything* under a test renderer that does no layout — which\n * would collapse the trap to \"no focusable elements\" in every test.\n */\nfunction isVisible(element: HTMLElement): boolean {\n if (element.closest(\"[hidden]\")) return false;\n if (element.getAttribute(\"aria-hidden\") === \"true\") return false;\n return typeof element.checkVisibility === \"function\"\n ? element.checkVisibility()\n : true;\n}\n\nfunction focusableWithin(container: HTMLElement): HTMLElement[] {\n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(\n isVisible,\n );\n}\n\nexport function useDialogLayer({\n active,\n containerRef,\n onEscape,\n}: {\n active: boolean;\n /** The panel. Focus is moved into it and kept inside it. */\n containerRef: React.RefObject<HTMLElement | null>;\n /** Called on Escape, only while this is the top layer. Omit to ignore it. */\n onEscape?: () => void;\n}): void {\n // Read through a ref so a caller passing a fresh closure every render does\n // not tear the listener down and rebuild it on every keystroke.\n const escapeRef = React.useRef(onEscape);\n React.useEffect(() => {\n escapeRef.current = onEscape;\n });\n\n React.useEffect(() => {\n if (!active) return;\n\n const layer = Symbol(\"dialog-layer\");\n layers.push(layer);\n const isTopLayer = () => layers[layers.length - 1] === layer;\n\n const previouslyFocused =\n document.activeElement instanceof HTMLElement\n ? document.activeElement\n : null;\n\n const container = containerRef.current;\n // Something inside may have claimed focus already — an `autoFocus` input —\n // and that choice is better than any this could make.\n if (container && !container.contains(document.activeElement)) {\n const [first] = focusableWithin(container);\n // The panel itself, not its first control: the first control is a Delete\n // button often enough that focusing it would put a destructive action\n // one Enter away from an accidental keypress.\n (container.hasAttribute(\"tabindex\") ? container : first)?.focus();\n }\n\n function handleKeyDown(event: KeyboardEvent) {\n if (!isTopLayer()) return;\n\n if (event.key === \"Escape\") {\n escapeRef.current?.();\n return;\n }\n\n if (event.key !== \"Tab\") return;\n const panel = containerRef.current;\n if (!panel) return;\n\n const items = focusableWithin(panel);\n if (items.length === 0) {\n event.preventDefault();\n panel.focus();\n return;\n }\n\n const first = items[0]!;\n const last = items[items.length - 1]!;\n const active = document.activeElement;\n const outside = !panel.contains(active);\n\n if (event.shiftKey && (active === first || outside)) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && (active === last || outside)) {\n event.preventDefault();\n first.focus();\n }\n }\n\n document.addEventListener(\"keydown\", handleKeyDown);\n const previousOverflow = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown);\n document.body.style.overflow = previousOverflow;\n const index = layers.indexOf(layer);\n if (index !== -1) layers.splice(index, 1);\n // Back where it came from, so closing a dialog opened by keyboard does\n // not drop the caret at the top of the document.\n if (previouslyFocused?.isConnected) previouslyFocused.focus();\n };\n }, [active, containerRef]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,SAAuB;;;ACFvB,YAAuB;AACvB,sCAAuC;AACvC,wBAAqB;;;ACDrB,0BAAwB;;;ACDxB,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;AD0BI;AAbJ,IAAM,QAAQ;AAAA,EACZ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAMO,SAAS,QAAQ,EAAE,OAAO,MAAM,WAAW,GAAG,MAAM,GAAiB;AAC1E,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,MACX,WAAW,GAAG,gBAAgB,MAAM,IAAI,GAAG,SAAS;AAAA,MACnD,GAAG;AAAA;AAAA,EACN;AAEJ;;;ADkDQ,IAAAC,sBAAA;AAhFR,IAAM,qBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,WAAW;AAAA,QACX,OAAO;AAAA,QACP,aACE;AAAA,QACF,SAAS;AAAA,MACX;AAAA,MACA,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,Q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AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,SAAQ;AAAA,cACR,SAAS;AAAA,cACT,SAAS;AAAA,cAER;AAAA;AAAA,UACH;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["React","import_jsx_runtime","React","React","active","import_jsx_runtime","import_jsx_runtime"]}
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+
3
+ interface ConfirmDialogProps {
4
+ isOpen: boolean;
5
+ title: string;
6
+ description?: React.ReactNode;
7
+ confirmLabel?: string;
8
+ cancelLabel?: string;
9
+ isConfirming?: boolean;
10
+ error?: string | null;
11
+ onConfirm: () => void;
12
+ onClose: () => void;
13
+ }
14
+ declare function ConfirmDialog({ isOpen, title, description, confirmLabel, cancelLabel, isConfirming, error, onConfirm, onClose, }: ConfirmDialogProps): React.JSX.Element;
15
+
16
+ export { ConfirmDialog };
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+
3
+ interface ConfirmDialogProps {
4
+ isOpen: boolean;
5
+ title: string;
6
+ description?: React.ReactNode;
7
+ confirmLabel?: string;
8
+ cancelLabel?: string;
9
+ isConfirming?: boolean;
10
+ error?: string | null;
11
+ onConfirm: () => void;
12
+ onClose: () => void;
13
+ }
14
+ declare function ConfirmDialog({ isOpen, title, description, confirmLabel, cancelLabel, isConfirming, error, onConfirm, onClose, }: ConfirmDialogProps): React.JSX.Element;
15
+
16
+ export { ConfirmDialog };
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import {
3
+ ConfirmDialog
4
+ } from "./chunk-ISPICB4W.js";
5
+ import "./chunk-DS3QYIKL.js";
6
+ import "./chunk-HBBOR43A.js";
7
+ import "./chunk-KR3BCFP7.js";
8
+ import "./chunk-UE7JY7VR.js";
9
+ import "./chunk-HCA5ODCD.js";
10
+ export {
11
+ ConfirmDialog
12
+ };
13
+ //# sourceMappingURL=confirm-dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,102 @@
1
+ "use client";
2
+ "use strict";
3
+ "use client";
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+
32
+ // src/copy-button.tsx
33
+ var copy_button_exports = {};
34
+ __export(copy_button_exports, {
35
+ CopyButton: () => CopyButton
36
+ });
37
+ module.exports = __toCommonJS(copy_button_exports);
38
+ var import_lucide_react = require("lucide-react");
39
+ var React = __toESM(require("react"), 1);
40
+
41
+ // src/clipboard.ts
42
+ async function writeToClipboard(text) {
43
+ if (navigator.clipboard?.writeText) {
44
+ return navigator.clipboard.writeText(text);
45
+ }
46
+ const textarea = document.createElement("textarea");
47
+ textarea.value = text;
48
+ textarea.style.position = "fixed";
49
+ textarea.style.top = "-1000px";
50
+ document.body.appendChild(textarea);
51
+ textarea.select();
52
+ try {
53
+ if (!document.execCommand("copy")) {
54
+ throw new Error("Could not write to the clipboard");
55
+ }
56
+ } finally {
57
+ document.body.removeChild(textarea);
58
+ }
59
+ }
60
+
61
+ // src/utils.ts
62
+ var import_clsx = require("clsx");
63
+ var import_tailwind_merge = require("tailwind-merge");
64
+ function cn(...inputs) {
65
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
66
+ }
67
+
68
+ // src/copy-button.tsx
69
+ var import_jsx_runtime = require("react/jsx-runtime");
70
+ function CopyButton({
71
+ value,
72
+ label,
73
+ className
74
+ }) {
75
+ const [copied, setCopied] = React.useState(false);
76
+ React.useEffect(() => {
77
+ if (!copied) return;
78
+ const timer = window.setTimeout(() => setCopied(false), 1500);
79
+ return () => window.clearTimeout(timer);
80
+ }, [copied]);
81
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
82
+ "button",
83
+ {
84
+ type: "button",
85
+ "aria-label": copied ? `${label} copied` : `Copy ${label}`,
86
+ title: copied ? "Copied" : `Copy ${label}`,
87
+ className: cn(
88
+ "text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:ring-ring shrink-0 cursor-pointer rounded p-1 transition focus-visible:ring-2 focus-visible:outline-none",
89
+ className
90
+ ),
91
+ onClick: () => {
92
+ void writeToClipboard(value).then(() => setCopied(true)).catch(() => void 0);
93
+ },
94
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Check, { className: "size-3.5 text-success", "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Copy, { className: "size-3.5", "aria-hidden": true })
95
+ }
96
+ );
97
+ }
98
+ // Annotate the CommonJS export names for ESM import in node:
99
+ 0 && (module.exports = {
100
+ CopyButton
101
+ });
102
+ //# sourceMappingURL=copy-button.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/copy-button.tsx","../src/clipboard.ts","../src/utils.ts"],"sourcesContent":["\"use client\";\n\nimport { Check, Copy } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { writeToClipboard } from \"./clipboard\";\nimport { cn } from \"./utils\";\n\n/**\n * Copies one short string — an id, a title, a URL — and says so for a moment.\n *\n * The panel had this three times over, each with its own timeout and its own\n * silent-failure story. `writeToClipboard` is used rather than\n * `navigator.clipboard` directly because the latter is undefined on http\n * origins, which is exactly where this panel runs in local dev.\n */\nexport function CopyButton({\n value,\n label,\n className,\n}: {\n value: string;\n /** What is being copied, for the accessible name: \"card id\", \"title\". */\n label: string;\n className?: string;\n}) {\n const [copied, setCopied] = React.useState(false);\n\n React.useEffect(() => {\n if (!copied) return;\n const timer = window.setTimeout(() => setCopied(false), 1500);\n return () => window.clearTimeout(timer);\n }, [copied]);\n\n return (\n <button\n type=\"button\"\n aria-label={copied ? `${label} copied` : `Copy ${label}`}\n title={copied ? \"Copied\" : `Copy ${label}`}\n className={cn(\n \"text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:ring-ring shrink-0 cursor-pointer rounded p-1 transition focus-visible:ring-2 focus-visible:outline-none\",\n className,\n )}\n onClick={() => {\n // A denied clipboard permission should not throw into the row.\n void writeToClipboard(value)\n .then(() => setCopied(true))\n .catch(() => undefined);\n }}\n >\n {copied ? (\n <Check className=\"size-3.5 text-success\" aria-hidden />\n ) : (\n <Copy className=\"size-3.5\" aria-hidden />\n )}\n </button>\n );\n}\n","/**\n * Range maths and clipboard text for the card table's spreadsheet selection.\n *\n * Ported from video-shorts-panel `app/src/common/components/ExcelTable.jsx`.\n * Kept free of React and the DOM (except `writeToClipboard`) so the escaping\n * and range rules are unit-testable.\n */\n\nexport type CellRef = { r: number; c: number };\n\nexport type CellRange = { r1: number; r2: number; c1: number; c2: number };\n\n/** Tab for the clipboard (Excel/Sheets split on it), comma for a .csv file. */\nexport const TSV_DELIMITER = \"\\t\";\nexport const CSV_DELIMITER = \",\";\n\n/**\n * Anchor and focus can be dragged in any direction, so the range is whichever\n * corners they happen to be — normalize to top-left / bottom-right.\n */\nexport function normalizeRange(\n anchor: CellRef | null | undefined,\n focus: CellRef | null | undefined,\n): CellRange | null {\n if (!anchor || !focus) return null;\n return {\n r1: Math.min(anchor.r, focus.r),\n r2: Math.max(anchor.r, focus.r),\n c1: Math.min(anchor.c, focus.c),\n c2: Math.max(anchor.c, focus.c),\n };\n}\n\n/**\n * A cell needs quoting once it carries the delimiters themselves — the same\n * rule Excel uses when it parses the clipboard. Without it, a title containing\n * a tab or a newline silently becomes extra columns or rows on paste.\n */\nexport function escapeCell(raw: unknown, delimiter: string): string {\n const value = raw == null ? \"\" : String(raw);\n if (\n value.includes(delimiter) ||\n value.includes(\"\\n\") ||\n value.includes(\"\\r\") ||\n value.includes('\"')\n ) {\n return `\"${value.replace(/\"/g, '\"\"')}\"`;\n }\n return value;\n}\n\nexport type TextColumn<Row> = {\n title: string;\n value: (row: Row) => string;\n};\n\n/** Renders a range as delimited text, optionally with a header line. */\nexport function buildRangeText<Row>(\n range: CellRange | null,\n columns: TextColumn<Row>[],\n rows: Row[],\n delimiter: string,\n includeHeaders: boolean,\n): string {\n if (!range) return \"\";\n const lines: string[] = [];\n\n if (includeHeaders) {\n const header: string[] = [];\n for (let c = range.c1; c <= range.c2; c++) {\n header.push(escapeCell(columns[c]?.title, delimiter));\n }\n lines.push(header.join(delimiter));\n }\n\n for (let r = range.r1; r <= range.r2; r++) {\n const line: string[] = [];\n const row = rows[r];\n for (let c = range.c1; c <= range.c2; c++) {\n const column = columns[c];\n line.push(\n escapeCell(\n column && row !== undefined ? column.value(row) : \"\",\n delimiter,\n ),\n );\n }\n lines.push(line.join(delimiter));\n }\n\n return lines.join(\"\\n\");\n}\n\n/** The whole grid, or null when there is nothing to select. */\nexport function fullRange<Row>(\n columns: TextColumn<Row>[],\n rows: Row[],\n): CellRange | null {\n if (!rows.length || !columns.length) return null;\n return { r1: 0, r2: rows.length - 1, c1: 0, c2: columns.length - 1 };\n}\n\n/** \"3 × 2 selected\" — what the toolbar reports back to the user. */\nexport function describeRange(range: CellRange | null): string {\n if (!range) return \"No selection\";\n const rowCount = range.r2 - range.r1 + 1;\n const colCount = range.c2 - range.c1 + 1;\n if (rowCount === 1 && colCount === 1) return \"1 cell selected\";\n return `${rowCount} × ${colCount} selected`;\n}\n\nexport function countCells(range: CellRange): {\n rows: number;\n columns: number;\n} {\n return {\n rows: range.r2 - range.r1 + 1,\n columns: range.c2 - range.c1 + 1,\n };\n}\n\n/**\n * `navigator.clipboard` is unavailable on http origins and older browsers, so\n * fall back to a hidden textarea + execCommand rather than failing the copy.\n */\nexport async function writeToClipboard(text: string): Promise<void> {\n if (navigator.clipboard?.writeText) {\n return navigator.clipboard.writeText(text);\n }\n\n const textarea = document.createElement(\"textarea\");\n textarea.value = text;\n textarea.style.position = \"fixed\";\n textarea.style.top = \"-1000px\";\n document.body.appendChild(textarea);\n textarea.select();\n try {\n if (!document.execCommand(\"copy\")) {\n throw new Error(\"Could not write to the clipboard\");\n }\n } finally {\n document.body.removeChild(textarea);\n }\n}\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,0BAA4B;AAC5B,YAAuB;;;AC0HvB,eAAsB,iBAAiB,MAA6B;AAClE,MAAI,UAAU,WAAW,WAAW;AAClC,WAAO,UAAU,UAAU,UAAU,IAAI;AAAA,EAC3C;AAEA,QAAM,WAAW,SAAS,cAAc,UAAU;AAClD,WAAS,QAAQ;AACjB,WAAS,MAAM,WAAW;AAC1B,WAAS,MAAM,MAAM;AACrB,WAAS,KAAK,YAAY,QAAQ;AAClC,WAAS,OAAO;AAChB,MAAI;AACF,QAAI,CAAC,SAAS,YAAY,MAAM,GAAG;AACjC,YAAM,IAAI,MAAM,kCAAkC;AAAA,IACpD;AAAA,EACF,UAAE;AACA,aAAS,KAAK,YAAY,QAAQ;AAAA,EACpC;AACF;;;AC/IA,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;AF8CQ;AAnCD,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AACF,GAKG;AACD,QAAM,CAAC,QAAQ,SAAS,IAAU,eAAS,KAAK;AAEhD,EAAM,gBAAU,MAAM;AACpB,QAAI,CAAC,OAAQ;AACb,UAAM,QAAQ,OAAO,WAAW,MAAM,UAAU,KAAK,GAAG,IAAI;AAC5D,WAAO,MAAM,OAAO,aAAa,KAAK;AAAA,EACxC,GAAG,CAAC,MAAM,CAAC;AAEX,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,cAAY,SAAS,GAAG,KAAK,YAAY,QAAQ,KAAK;AAAA,MACtD,OAAO,SAAS,WAAW,QAAQ,KAAK;AAAA,MACxC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACA,SAAS,MAAM;AAEb,aAAK,iBAAiB,KAAK,EACxB,KAAK,MAAM,UAAU,IAAI,CAAC,EAC1B,MAAM,MAAM,MAAS;AAAA,MAC1B;AAAA,MAEC,mBACC,4CAAC,6BAAM,WAAU,yBAAwB,eAAW,MAAC,IAErD,4CAAC,4BAAK,WAAU,YAAW,eAAW,MAAC;AAAA;AAAA,EAE3C;AAEJ;","names":[]}
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+
3
+ /**
4
+ * Copies one short string — an id, a title, a URL — and says so for a moment.
5
+ *
6
+ * The panel had this three times over, each with its own timeout and its own
7
+ * silent-failure story. `writeToClipboard` is used rather than
8
+ * `navigator.clipboard` directly because the latter is undefined on http
9
+ * origins, which is exactly where this panel runs in local dev.
10
+ */
11
+ declare function CopyButton({ value, label, className, }: {
12
+ value: string;
13
+ /** What is being copied, for the accessible name: "card id", "title". */
14
+ label: string;
15
+ className?: string;
16
+ }): React.JSX.Element;
17
+
18
+ export { CopyButton };
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+
3
+ /**
4
+ * Copies one short string — an id, a title, a URL — and says so for a moment.
5
+ *
6
+ * The panel had this three times over, each with its own timeout and its own
7
+ * silent-failure story. `writeToClipboard` is used rather than
8
+ * `navigator.clipboard` directly because the latter is undefined on http
9
+ * origins, which is exactly where this panel runs in local dev.
10
+ */
11
+ declare function CopyButton({ value, label, className, }: {
12
+ value: string;
13
+ /** What is being copied, for the accessible name: "card id", "title". */
14
+ label: string;
15
+ className?: string;
16
+ }): React.JSX.Element;
17
+
18
+ export { CopyButton };
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import {
3
+ CopyButton
4
+ } from "./chunk-PPYR3O3L.js";
5
+ import "./chunk-HCA5ODCD.js";
6
+ import "./chunk-Y5WCT6XN.js";
7
+ export {
8
+ CopyButton
9
+ };
10
+ //# sourceMappingURL=copy-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}