@fayz-ai/ui 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/chunk-75EFDLST.js +274 -0
  2. package/dist/chunk-75EFDLST.js.map +1 -0
  3. package/dist/{chunk-YB5ZJKNG.cjs → chunk-7PTRAWHO.cjs} +263 -225
  4. package/dist/chunk-7PTRAWHO.cjs.map +1 -0
  5. package/dist/{chunk-CZ6X6PZT.js → chunk-COC5DDFG.js} +313 -44
  6. package/dist/chunk-COC5DDFG.js.map +1 -0
  7. package/dist/{chunk-MYZT2OG7.js → chunk-FY7OZNKU.js} +24 -68
  8. package/dist/chunk-FY7OZNKU.js.map +1 -0
  9. package/dist/chunk-H6OULCHF.cjs +81 -0
  10. package/dist/chunk-H6OULCHF.cjs.map +1 -0
  11. package/dist/{chunk-GE6XUREM.cjs → chunk-HG5RH3B3.cjs} +339 -68
  12. package/dist/chunk-HG5RH3B3.cjs.map +1 -0
  13. package/dist/{chunk-7TBDPNLY.cjs → chunk-NWPMNPGR.cjs} +76 -47
  14. package/dist/chunk-NWPMNPGR.cjs.map +1 -0
  15. package/dist/{chunk-D6SXPF4F.cjs → chunk-ODY3GZ3Y.cjs} +41 -87
  16. package/dist/chunk-ODY3GZ3Y.cjs.map +1 -0
  17. package/dist/{chunk-22J2RTMN.js → chunk-OTUH4K4B.js} +196 -150
  18. package/dist/chunk-OTUH4K4B.js.map +1 -0
  19. package/dist/chunk-OW73RZOU.cjs +313 -0
  20. package/dist/chunk-OW73RZOU.cjs.map +1 -0
  21. package/dist/{chunk-GFH5HOCO.js → chunk-W5O2X277.js} +42 -14
  22. package/dist/chunk-W5O2X277.js.map +1 -0
  23. package/dist/chunk-YRVE4FOD.js +57 -0
  24. package/dist/chunk-YRVE4FOD.js.map +1 -0
  25. package/dist/dashboard/DashboardCanvas.d.ts +5 -1
  26. package/dist/dashboard/DashboardCanvas.d.ts.map +1 -1
  27. package/dist/dashboard/GoldCard.d.ts +19 -0
  28. package/dist/dashboard/GoldCard.d.ts.map +1 -0
  29. package/dist/dashboard/KpiCard.d.ts.map +1 -1
  30. package/dist/dashboard/index.cjs +30 -26
  31. package/dist/dashboard/index.d.ts +1 -0
  32. package/dist/dashboard/index.d.ts.map +1 -1
  33. package/dist/dashboard/index.js +3 -3
  34. package/dist/index.cjs +198 -174
  35. package/dist/index.d.ts +3 -3
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +7 -7
  38. package/dist/layout/AppShell.d.ts +27 -6
  39. package/dist/layout/AppShell.d.ts.map +1 -1
  40. package/dist/layout/ContentSplit.d.ts +32 -0
  41. package/dist/layout/ContentSplit.d.ts.map +1 -0
  42. package/dist/layout/Sidebar.d.ts.map +1 -1
  43. package/dist/layout/Topbar.d.ts.map +1 -1
  44. package/dist/layout/index.cjs +31 -23
  45. package/dist/layout/index.d.ts +2 -1
  46. package/dist/layout/index.d.ts.map +1 -1
  47. package/dist/layout/index.js +3 -3
  48. package/dist/primitives/index.cjs +126 -114
  49. package/dist/primitives/index.d.ts +2 -0
  50. package/dist/primitives/index.d.ts.map +1 -1
  51. package/dist/primitives/index.js +4 -4
  52. package/dist/primitives/markdown-editor.d.ts +23 -0
  53. package/dist/primitives/markdown-editor.d.ts.map +1 -0
  54. package/dist/primitives/markdown.d.ts +9 -0
  55. package/dist/primitives/markdown.d.ts.map +1 -0
  56. package/package.json +3 -3
  57. package/src/dashboard/DashboardCanvas.tsx +13 -2
  58. package/src/dashboard/GoldCard.tsx +38 -0
  59. package/src/dashboard/KpiCard.tsx +4 -2
  60. package/src/dashboard/index.ts +1 -0
  61. package/src/index.ts +15 -0
  62. package/src/layout/AppShell.tsx +240 -20
  63. package/src/layout/ContentSplit.tsx +153 -0
  64. package/src/layout/ModulePage.tsx +2 -2
  65. package/src/layout/Sidebar.tsx +71 -20
  66. package/src/layout/Topbar.tsx +47 -17
  67. package/src/layout/index.ts +15 -1
  68. package/src/primitives/dropdown.tsx +4 -4
  69. package/src/primitives/index.ts +2 -0
  70. package/src/primitives/markdown-editor.tsx +75 -0
  71. package/src/primitives/markdown.tsx +169 -0
  72. package/src/primitives/select.tsx +1 -1
  73. package/dist/chunk-22J2RTMN.js.map +0 -1
  74. package/dist/chunk-7TBDPNLY.cjs.map +0 -1
  75. package/dist/chunk-CZ6X6PZT.js.map +0 -1
  76. package/dist/chunk-D6SXPF4F.cjs.map +0 -1
  77. package/dist/chunk-DNYVEOAX.js +0 -11
  78. package/dist/chunk-DNYVEOAX.js.map +0 -1
  79. package/dist/chunk-E526FHZ4.js +0 -169
  80. package/dist/chunk-E526FHZ4.js.map +0 -1
  81. package/dist/chunk-GE6XUREM.cjs.map +0 -1
  82. package/dist/chunk-GFH5HOCO.js.map +0 -1
  83. package/dist/chunk-MYZT2OG7.js.map +0 -1
  84. package/dist/chunk-VVVZO2LE.cjs +0 -13
  85. package/dist/chunk-VVVZO2LE.cjs.map +0 -1
  86. package/dist/chunk-W4XXXJRW.cjs +0 -196
  87. package/dist/chunk-W4XXXJRW.cjs.map +0 -1
  88. package/dist/chunk-YB5ZJKNG.cjs.map +0 -1
@@ -1,7 +1,7 @@
1
- import { useSaveBarVisible, useCrossModuleBack, useBackHandler } from './chunk-E526FHZ4.js';
2
- import { Button, DataTable } from './chunk-MYZT2OG7.js';
3
- import { cn } from './chunk-DNYVEOAX.js';
4
- import * as React11 from 'react';
1
+ import { useSaveBarVisible, useCrossModuleBack, useBackHandler } from './chunk-75EFDLST.js';
2
+ import { DataTable, SegmentedControl } from './chunk-FY7OZNKU.js';
3
+ import { cn, Button } from './chunk-YRVE4FOD.js';
4
+ import * as React10 from 'react';
5
5
  import { useState, useRef, useEffect, useMemo, useCallback } from 'react';
6
6
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
7
7
  import { cva } from 'class-variance-authority';
@@ -17,9 +17,9 @@ import { createPortal } from 'react-dom';
17
17
  import { useTranslation, getCurrentLocale } from '@fayz-ai/core';
18
18
  import * as PopoverPrimitive from '@radix-ui/react-popover';
19
19
 
20
- var Input = React11.forwardRef(
20
+ var Input = React10.forwardRef(
21
21
  ({ className, type, error, description, id, ...props }, ref) => {
22
- const inputId = id ?? React11.useId();
22
+ const inputId = id ?? React10.useId();
23
23
  const descriptionId = description ? `${inputId}-description` : void 0;
24
24
  const errorId = error ? `${inputId}-error` : void 0;
25
25
  return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
@@ -107,7 +107,7 @@ var Modal = DialogPrimitive.Root;
107
107
  var ModalTrigger = DialogPrimitive.Trigger;
108
108
  var ModalClose = DialogPrimitive.Close;
109
109
  var ModalPortal = DialogPrimitive.Portal;
110
- var ModalOverlay = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
110
+ var ModalOverlay = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
111
111
  DialogPrimitive.Overlay,
112
112
  {
113
113
  ref,
@@ -120,7 +120,7 @@ var ModalOverlay = React11.forwardRef(({ className, ...props }, ref) => /* @__PU
120
120
  }
121
121
  ));
122
122
  ModalOverlay.displayName = "ModalOverlay";
123
- var ModalContent = React11.forwardRef(({ className, children, size = "lg", hideClose, noPadding, onPointerDownOutside, onInteractOutside, onCloseAutoFocus, ...props }, ref) => /* @__PURE__ */ jsx(ModalPortal, { children: /* @__PURE__ */ jsx(ModalOverlay, { children: /* @__PURE__ */ jsxs(
123
+ var ModalContent = React10.forwardRef(({ className, children, size = "lg", hideClose, noPadding, onPointerDownOutside, onInteractOutside, onCloseAutoFocus, ...props }, ref) => /* @__PURE__ */ jsx(ModalPortal, { children: /* @__PURE__ */ jsx(ModalOverlay, { children: /* @__PURE__ */ jsxs(
124
124
  DialogPrimitive.Content,
125
125
  {
126
126
  ref,
@@ -172,9 +172,9 @@ function ModalBody({ className, ...props }) {
172
172
  function ModalFooter({ className, ...props }) {
173
173
  return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 shrink-0", className), ...props });
174
174
  }
175
- var ModalTitle = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Title, { ref, className: cn("text-lg font-semibold leading-none tracking-tight", className), ...props }));
175
+ var ModalTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Title, { ref, className: cn("text-lg font-semibold leading-none tracking-tight", className), ...props }));
176
176
  ModalTitle.displayName = "ModalTitle";
177
- var ModalDescription = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
177
+ var ModalDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
178
178
  ModalDescription.displayName = "ModalDescription";
179
179
  var COLOR_CLASSES = {
180
180
  primary: "border-primary bg-primary text-primary-foreground",
@@ -182,7 +182,7 @@ var COLOR_CLASSES = {
182
182
  warning: "border-warning bg-warning text-white",
183
183
  destructive: "border-destructive bg-destructive text-destructive-foreground"
184
184
  };
185
- var Checkbox = React11.forwardRef(
185
+ var Checkbox = React10.forwardRef(
186
186
  ({ checked = false, onChange, disabled, className, color = "primary", id, ...props }, ref) => {
187
187
  return /* @__PURE__ */ jsx(
188
188
  "button",
@@ -208,114 +208,10 @@ var Checkbox = React11.forwardRef(
208
208
  }
209
209
  );
210
210
  Checkbox.displayName = "Checkbox";
211
- var STYLE_ID = "saas-sheet-styles";
212
- if (typeof document !== "undefined" && !document.getElementById(STYLE_ID)) {
213
- const style = document.createElement("style");
214
- style.id = STYLE_ID;
215
- style.textContent = `
216
- @keyframes saas-sheet-fade-in { from { opacity: 0 } to { opacity: 1 } }
217
- @keyframes saas-sheet-fade-out { from { opacity: 1 } to { opacity: 0 } }
218
- @keyframes saas-sheet-slide-in { from { transform: translateX(100%) } to { transform: translateX(0) } }
219
- @keyframes saas-sheet-slide-out { from { transform: translateX(0) } to { transform: translateX(100%) } }
220
- .saas-sheet-overlay[data-state="open"] { animation: saas-sheet-fade-in 200ms ease-out }
221
- .saas-sheet-overlay[data-state="closed"] { animation: saas-sheet-fade-out 150ms ease-in }
222
- .saas-sheet-content[data-state="open"] { animation: saas-sheet-slide-in 280ms cubic-bezier(0.16, 1, 0.3, 1) }
223
- .saas-sheet-content[data-state="closed"] { animation: saas-sheet-slide-out 200ms ease-in }
224
- `;
225
- document.head.appendChild(style);
226
- }
227
- var Sheet = DialogPrimitive.Root;
228
- var SheetTrigger = DialogPrimitive.Trigger;
229
- var SheetClose = DialogPrimitive.Close;
230
- var SheetPortal = DialogPrimitive.Portal;
231
- var SheetOverlay = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
232
- DialogPrimitive.Overlay,
233
- {
234
- ref,
235
- className: cn(
236
- "saas-sheet-overlay fixed inset-0 z-50 bg-black/40 backdrop-blur-[2px]",
237
- className
238
- ),
239
- ...props
240
- }
241
- ));
242
- SheetOverlay.displayName = "SheetOverlay";
243
- var SheetContent = React11.forwardRef(({ className, children, width, hideClose, overlay = "blur", ...props }, ref) => /* @__PURE__ */ jsxs(SheetPortal, { children: [
244
- /* @__PURE__ */ jsx(SheetOverlay, { className: overlay === "none" ? "bg-transparent backdrop-blur-0" : overlay === "dim" ? "backdrop-blur-0" : void 0 }),
245
- /* @__PURE__ */ jsxs(
246
- DialogPrimitive.Content,
247
- {
248
- ref,
249
- className: cn(
250
- "fayz-glass-surface saas-sheet-content fixed inset-y-0 right-0 z-50 flex flex-col border-l bg-card shadow-2xl outline-none",
251
- "w-full",
252
- width ?? "max-w-md",
253
- className
254
- ),
255
- ...props,
256
- children: [
257
- children,
258
- !hideClose && /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 z-10 flex h-7 w-7 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring", children: [
259
- /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
260
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
261
- ] })
262
- ]
263
- }
264
- )
265
- ] }));
266
- SheetContent.displayName = "SheetContent";
267
- function SheetHeader({ className, ...props }) {
268
- return /* @__PURE__ */ jsx(
269
- "div",
270
- {
271
- className: cn("flex flex-col gap-1 px-5 py-4 border-b shrink-0", className),
272
- ...props
273
- }
274
- );
275
- }
276
- SheetHeader.displayName = "SheetHeader";
277
- function SheetFooter({ className, ...props }) {
278
- return /* @__PURE__ */ jsx(
279
- "div",
280
- {
281
- className: cn("flex items-center gap-2 px-5 py-3 border-t shrink-0", className),
282
- ...props
283
- }
284
- );
285
- }
286
- SheetFooter.displayName = "SheetFooter";
287
- var SheetTitle = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
288
- DialogPrimitive.Title,
289
- {
290
- ref,
291
- className: cn("text-sm font-semibold leading-none tracking-tight", className),
292
- ...props
293
- }
294
- ));
295
- SheetTitle.displayName = "SheetTitle";
296
- var SheetDescription = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
297
- DialogPrimitive.Description,
298
- {
299
- ref,
300
- className: cn("text-xs text-muted-foreground", className),
301
- ...props
302
- }
303
- ));
304
- SheetDescription.displayName = "SheetDescription";
305
- function SheetBody({ className, ...props }) {
306
- return /* @__PURE__ */ jsx(
307
- "div",
308
- {
309
- className: cn("flex-1 overflow-y-auto px-5 py-5", className),
310
- ...props
311
- }
312
- );
313
- }
314
- SheetBody.displayName = "SheetBody";
315
211
  var Select = SelectPrimitive.Root;
316
212
  var SelectGroup = SelectPrimitive.Group;
317
213
  var SelectValue = SelectPrimitive.Value;
318
- var SelectTrigger = React11.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
214
+ var SelectTrigger = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
319
215
  SelectPrimitive.Trigger,
320
216
  {
321
217
  ref,
@@ -331,7 +227,7 @@ var SelectTrigger = React11.forwardRef(({ className, children, ...props }, ref)
331
227
  }
332
228
  ));
333
229
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
334
- var SelectScrollUpButton = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
230
+ var SelectScrollUpButton = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
335
231
  SelectPrimitive.ScrollUpButton,
336
232
  {
337
233
  ref,
@@ -344,7 +240,7 @@ var SelectScrollUpButton = React11.forwardRef(({ className, ...props }, ref) =>
344
240
  }
345
241
  ));
346
242
  SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
347
- var SelectScrollDownButton = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
243
+ var SelectScrollDownButton = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
348
244
  SelectPrimitive.ScrollDownButton,
349
245
  {
350
246
  ref,
@@ -357,7 +253,7 @@ var SelectScrollDownButton = React11.forwardRef(({ className, ...props }, ref) =
357
253
  }
358
254
  ));
359
255
  SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
360
- var SelectContent = React11.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
256
+ var SelectContent = React10.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
361
257
  SelectPrimitive.Content,
362
258
  {
363
259
  ref,
@@ -385,7 +281,7 @@ var SelectContent = React11.forwardRef(({ className, children, position = "poppe
385
281
  }
386
282
  ) }));
387
283
  SelectContent.displayName = SelectPrimitive.Content.displayName;
388
- var SelectLabel = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
284
+ var SelectLabel = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
389
285
  SelectPrimitive.Label,
390
286
  {
391
287
  ref,
@@ -394,12 +290,12 @@ var SelectLabel = React11.forwardRef(({ className, ...props }, ref) => /* @__PUR
394
290
  }
395
291
  ));
396
292
  SelectLabel.displayName = SelectPrimitive.Label.displayName;
397
- var SelectItem = React11.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
293
+ var SelectItem = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
398
294
  SelectPrimitive.Item,
399
295
  {
400
296
  ref,
401
297
  className: cn(
402
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[highlighted]:bg-muted focus:bg-muted data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
298
+ "relative flex w-full cursor-default select-none items-center rounded-button py-1.5 pl-8 pr-2 text-sm outline-none data-[highlighted]:bg-muted focus:bg-muted data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
403
299
  className
404
300
  ),
405
301
  ...props,
@@ -410,7 +306,7 @@ var SelectItem = React11.forwardRef(({ className, children, ...props }, ref) =>
410
306
  }
411
307
  ));
412
308
  SelectItem.displayName = SelectPrimitive.Item.displayName;
413
- var SelectSeparator = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
309
+ var SelectSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
414
310
  SelectPrimitive.Separator,
415
311
  {
416
312
  ref,
@@ -448,7 +344,7 @@ function ToastProvider({
448
344
  );
449
345
  }
450
346
  var Tabs = TabsPrimitive.Root;
451
- var TabsList = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
347
+ var TabsList = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
452
348
  TabsPrimitive.List,
453
349
  {
454
350
  ref,
@@ -460,7 +356,7 @@ var TabsList = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__
460
356
  }
461
357
  ));
462
358
  TabsList.displayName = TabsPrimitive.List.displayName;
463
- var TabsTrigger = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
359
+ var TabsTrigger = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
464
360
  TabsPrimitive.Trigger,
465
361
  {
466
362
  ref,
@@ -472,7 +368,7 @@ var TabsTrigger = React11.forwardRef(({ className, ...props }, ref) => /* @__PUR
472
368
  }
473
369
  ));
474
370
  TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
475
- var TabsContent = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
371
+ var TabsContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
476
372
  TabsPrimitive.Content,
477
373
  {
478
374
  ref,
@@ -484,7 +380,7 @@ var TabsContent = React11.forwardRef(({ className, ...props }, ref) => /* @__PUR
484
380
  }
485
381
  ));
486
382
  TabsContent.displayName = TabsPrimitive.Content.displayName;
487
- var Separator2 = React11.forwardRef(
383
+ var Separator2 = React10.forwardRef(
488
384
  ({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(
489
385
  SeparatorPrimitive.Root,
490
386
  {
@@ -526,7 +422,7 @@ function Breadcrumb({ parent, current, onBack }) {
526
422
  var TooltipProvider = TooltipPrimitive.Provider;
527
423
  var Tooltip = TooltipPrimitive.Root;
528
424
  var TooltipTrigger = TooltipPrimitive.Trigger;
529
- var TooltipContent = React11.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(
425
+ var TooltipContent = React10.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(
530
426
  TooltipPrimitive.Content,
531
427
  {
532
428
  ref,
@@ -1008,16 +904,16 @@ function SearchSelect({
1008
904
  className,
1009
905
  disabled
1010
906
  }) {
1011
- const [open, setOpen] = React11.useState(false);
1012
- const [query, setQuery] = React11.useState("");
1013
- const [results, setResults] = React11.useState([]);
1014
- const [loading, setLoading] = React11.useState(false);
1015
- const [creating, setCreating] = React11.useState(false);
1016
- const [selectedLabel, setSelectedLabel] = React11.useState(displayValue ?? "");
1017
- const containerRef = React11.useRef(null);
1018
- const inputRef = React11.useRef(null);
1019
- const timerRef = React11.useRef();
1020
- React11.useEffect(() => {
907
+ const [open, setOpen] = React10.useState(false);
908
+ const [query, setQuery] = React10.useState("");
909
+ const [results, setResults] = React10.useState([]);
910
+ const [loading, setLoading] = React10.useState(false);
911
+ const [creating, setCreating] = React10.useState(false);
912
+ const [selectedLabel, setSelectedLabel] = React10.useState(displayValue ?? "");
913
+ const containerRef = React10.useRef(null);
914
+ const inputRef = React10.useRef(null);
915
+ const timerRef = React10.useRef();
916
+ React10.useEffect(() => {
1021
917
  function handler(e) {
1022
918
  if (containerRef.current && !containerRef.current.contains(e.target)) {
1023
919
  setOpen(false);
@@ -1026,10 +922,10 @@ function SearchSelect({
1026
922
  document.addEventListener("mousedown", handler);
1027
923
  return () => document.removeEventListener("mousedown", handler);
1028
924
  }, []);
1029
- React11.useEffect(() => {
925
+ React10.useEffect(() => {
1030
926
  if (displayValue !== void 0) setSelectedLabel(displayValue);
1031
927
  }, [displayValue]);
1032
- React11.useEffect(() => {
928
+ React10.useEffect(() => {
1033
929
  if (open && loadOnOpen && query.length === 0 && results.length === 0 && !loading) {
1034
930
  setLoading(true);
1035
931
  Promise.resolve(onSearch("")).then(setResults).catch(() => setResults([])).finally(() => setLoading(false));
@@ -1086,7 +982,7 @@ function SearchSelect({
1086
982
  setQuery("");
1087
983
  setTimeout(() => inputRef.current?.focus(), 0);
1088
984
  }
1089
- const groups = React11.useMemo(() => {
985
+ const groups = React10.useMemo(() => {
1090
986
  const map = /* @__PURE__ */ new Map();
1091
987
  for (const opt of results) {
1092
988
  const group = opt.group ?? "";
@@ -1167,7 +1063,7 @@ function SearchSelect({
1167
1063
  }
1168
1064
  )
1169
1065
  ] }) : /* @__PURE__ */ jsxs("div", { className: "max-h-64 overflow-auto py-1", children: [
1170
- [...groups.entries()].map(([group, options]) => /* @__PURE__ */ jsxs(React11.Fragment, { children: [
1066
+ [...groups.entries()].map(([group, options]) => /* @__PURE__ */ jsxs(React10.Fragment, { children: [
1171
1067
  group && /* @__PURE__ */ jsx("div", { className: "sticky top-0 bg-muted/50 px-3 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground", children: group }),
1172
1068
  options.map((opt) => /* @__PURE__ */ jsx(
1173
1069
  "button",
@@ -1218,9 +1114,9 @@ function CurrencyInput({
1218
1114
  className,
1219
1115
  disabled
1220
1116
  }) {
1221
- const inputRef = React11.useRef(null);
1222
- const [focused, setFocused] = React11.useState(false);
1223
- const format = React11.useCallback((v) => {
1117
+ const inputRef = React10.useRef(null);
1118
+ const [focused, setFocused] = React10.useState(false);
1119
+ const format = React10.useCallback((v) => {
1224
1120
  return new Intl.NumberFormat(locale, {
1225
1121
  minimumFractionDigits: 2,
1226
1122
  maximumFractionDigits: 2
@@ -1329,7 +1225,7 @@ function ConfirmDialog({
1329
1225
  }) {
1330
1226
  const config = VARIANT_CONFIG[variant];
1331
1227
  const Icon2 = config.icon;
1332
- React11.useEffect(() => {
1228
+ React10.useEffect(() => {
1333
1229
  if (!open) return;
1334
1230
  function handleKey(e) {
1335
1231
  if (e.key === "Escape") onCancel();
@@ -1376,7 +1272,7 @@ function ConfirmDialog({
1376
1272
  }
1377
1273
  var Popover = PopoverPrimitive.Root;
1378
1274
  var PopoverTrigger = PopoverPrimitive.Trigger;
1379
- var PopoverContent = React11.forwardRef(({ className, align = "start", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
1275
+ var PopoverContent = React10.forwardRef(({ className, align = "start", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
1380
1276
  PopoverPrimitive.Content,
1381
1277
  {
1382
1278
  ref,
@@ -1391,7 +1287,157 @@ var PopoverContent = React11.forwardRef(({ className, align = "start", sideOffse
1391
1287
  }
1392
1288
  ) }));
1393
1289
  PopoverContent.displayName = PopoverPrimitive.Content.displayName;
1290
+ var INLINE_TOKEN = /(\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`)/g;
1291
+ function renderInline(text, keyPrefix) {
1292
+ return text.split(INLINE_TOKEN).map((part, i) => {
1293
+ const key = `${keyPrefix}-${i}`;
1294
+ if (part.startsWith("**") && part.endsWith("**") && part.length > 4) {
1295
+ return /* @__PURE__ */ jsx("strong", { children: part.slice(2, -2) }, key);
1296
+ }
1297
+ if (part.startsWith("*") && part.endsWith("*") && part.length > 2) {
1298
+ return /* @__PURE__ */ jsx("em", { children: part.slice(1, -1) }, key);
1299
+ }
1300
+ if (part.startsWith("`") && part.endsWith("`") && part.length > 2) {
1301
+ return /* @__PURE__ */ jsx("code", { className: "rounded bg-muted px-1 py-0.5 font-mono text-[0.85em]", children: part.slice(1, -1) }, key);
1302
+ }
1303
+ return part === "" ? null : /* @__PURE__ */ jsx(React10.Fragment, { children: part }, key);
1304
+ });
1305
+ }
1306
+ function parseBlocks(source) {
1307
+ const lines = source.replace(/\r\n/g, "\n").split("\n");
1308
+ const blocks = [];
1309
+ let i = 0;
1310
+ while (i < lines.length) {
1311
+ const line = lines[i];
1312
+ const trimmed = line.trim();
1313
+ if (trimmed === "") {
1314
+ i++;
1315
+ continue;
1316
+ }
1317
+ const heading = /^(#{1,3})\s+(.*)$/.exec(trimmed);
1318
+ if (heading) {
1319
+ blocks.push({ type: "heading", level: heading[1].length, text: heading[2] });
1320
+ i++;
1321
+ continue;
1322
+ }
1323
+ if (/^(-{3,}|\*{3,})$/.test(trimmed)) {
1324
+ blocks.push({ type: "hr" });
1325
+ i++;
1326
+ continue;
1327
+ }
1328
+ if (trimmed.startsWith(">")) {
1329
+ const quote = [];
1330
+ while (i < lines.length && lines[i].trim().startsWith(">")) {
1331
+ quote.push(lines[i].trim().replace(/^>\s?/, ""));
1332
+ i++;
1333
+ }
1334
+ blocks.push({ type: "blockquote", lines: quote });
1335
+ continue;
1336
+ }
1337
+ if (/^[-*]\s+/.test(trimmed)) {
1338
+ const items = [];
1339
+ while (i < lines.length && /^[-*]\s+/.test(lines[i].trim())) {
1340
+ items.push(lines[i].trim().replace(/^[-*]\s+/, ""));
1341
+ i++;
1342
+ }
1343
+ blocks.push({ type: "ul", items });
1344
+ continue;
1345
+ }
1346
+ if (/^\d+[.)]\s+/.test(trimmed)) {
1347
+ const items = [];
1348
+ while (i < lines.length && /^\d+[.)]\s+/.test(lines[i].trim())) {
1349
+ items.push(lines[i].trim().replace(/^\d+[.)]\s+/, ""));
1350
+ i++;
1351
+ }
1352
+ blocks.push({ type: "ol", items });
1353
+ continue;
1354
+ }
1355
+ const para = [];
1356
+ while (i < lines.length && lines[i].trim() !== "" && !/^(#{1,3}\s|>|[-*]\s|\d+[.)]\s|-{3,}$|\*{3,}$)/.test(lines[i].trim())) {
1357
+ para.push(lines[i].trim());
1358
+ i++;
1359
+ }
1360
+ blocks.push({ type: "p", lines: para });
1361
+ }
1362
+ return blocks;
1363
+ }
1364
+ var HEADING_CLASS = {
1365
+ 1: "text-xl font-semibold tracking-tight",
1366
+ 2: "text-base font-semibold tracking-tight",
1367
+ 3: "text-sm font-semibold"
1368
+ };
1369
+ function renderMarkdown(source) {
1370
+ const blocks = parseBlocks(source);
1371
+ return blocks.map((block, bi) => {
1372
+ const key = `md-${bi}`;
1373
+ switch (block.type) {
1374
+ case "heading": {
1375
+ const Tag = `h${block.level}`;
1376
+ return /* @__PURE__ */ jsx(Tag, { className: HEADING_CLASS[block.level], children: renderInline(block.text, key) }, key);
1377
+ }
1378
+ case "hr":
1379
+ return /* @__PURE__ */ jsx("hr", { className: "border-border" }, key);
1380
+ case "blockquote":
1381
+ return /* @__PURE__ */ jsx("blockquote", { className: "border-l-2 border-border pl-3 text-muted-foreground", children: block.lines.map((l, li) => /* @__PURE__ */ jsx("p", { children: renderInline(l, `${key}-${li}`) }, `${key}-${li}`)) }, key);
1382
+ case "ul":
1383
+ return /* @__PURE__ */ jsx("ul", { className: "list-disc space-y-1 pl-5", children: block.items.map((item, li) => /* @__PURE__ */ jsx("li", { children: renderInline(item, `${key}-${li}`) }, `${key}-${li}`)) }, key);
1384
+ case "ol":
1385
+ return /* @__PURE__ */ jsx("ol", { className: "list-decimal space-y-1 pl-5", children: block.items.map((item, li) => /* @__PURE__ */ jsx("li", { children: renderInline(item, `${key}-${li}`) }, `${key}-${li}`)) }, key);
1386
+ case "p":
1387
+ return /* @__PURE__ */ jsx("p", { children: block.lines.map((l, li) => /* @__PURE__ */ jsxs(React10.Fragment, { children: [
1388
+ li > 0 && /* @__PURE__ */ jsx("br", {}),
1389
+ renderInline(l, `${key}-${li}`)
1390
+ ] }, `${key}-${li}`)) }, key);
1391
+ }
1392
+ });
1393
+ }
1394
+ function Markdown({ source, className }) {
1395
+ return /* @__PURE__ */ jsx("div", { className: cn("space-y-3 text-sm leading-relaxed text-foreground", className), children: renderMarkdown(source) });
1396
+ }
1397
+ function MarkdownEditor({
1398
+ value,
1399
+ onChange,
1400
+ placeholder,
1401
+ minRows = 16,
1402
+ defaultMode = "preview",
1403
+ editLabel = "Edit",
1404
+ previewLabel = "Preview",
1405
+ renderPreview,
1406
+ className
1407
+ }) {
1408
+ const [mode, setMode] = React10.useState(
1409
+ defaultMode === "preview" && value.trim() === "" ? "edit" : defaultMode
1410
+ );
1411
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-2", className), children: [
1412
+ /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(
1413
+ SegmentedControl,
1414
+ {
1415
+ "aria-label": "Markdown mode",
1416
+ options: [
1417
+ { value: "edit", label: editLabel },
1418
+ { value: "preview", label: previewLabel }
1419
+ ],
1420
+ value: mode,
1421
+ onChange: (m) => setMode(m)
1422
+ }
1423
+ ) }),
1424
+ mode === "edit" ? /* @__PURE__ */ jsx(
1425
+ "textarea",
1426
+ {
1427
+ value,
1428
+ onChange: (e) => onChange(e.target.value),
1429
+ placeholder,
1430
+ rows: Math.max(minRows, value.split("\n").length + 1),
1431
+ className: cn(
1432
+ "w-full resize-y rounded-md border border-border bg-card p-3",
1433
+ "font-mono text-[13px] leading-relaxed text-foreground",
1434
+ "placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"
1435
+ )
1436
+ }
1437
+ ) : renderPreview ? renderPreview(value) : /* @__PURE__ */ jsx("div", { className: "rounded-md border border-border bg-card p-4", children: /* @__PURE__ */ jsx(Markdown, { source: value }) })
1438
+ ] });
1439
+ }
1394
1440
 
1395
- export { Badge, Breadcrumb, Checkbox, ConfirmDialog, CurrencyInput, DatePicker, Input, ListView, Modal, ModalBody, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger, Popover, PopoverContent, PopoverTrigger, SearchSelect, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator2 as Separator, Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, TableSkeleton, Tabs, TabsContent, TabsList, TabsTrigger, TimePicker, ToastProvider, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants };
1396
- //# sourceMappingURL=chunk-22J2RTMN.js.map
1397
- //# sourceMappingURL=chunk-22J2RTMN.js.map
1441
+ export { Badge, Breadcrumb, Checkbox, ConfirmDialog, CurrencyInput, DatePicker, Input, ListView, Markdown, MarkdownEditor, Modal, ModalBody, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger, Popover, PopoverContent, PopoverTrigger, SearchSelect, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator2 as Separator, Skeleton, TableSkeleton, Tabs, TabsContent, TabsList, TabsTrigger, TimePicker, ToastProvider, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, renderMarkdown };
1442
+ //# sourceMappingURL=chunk-OTUH4K4B.js.map
1443
+ //# sourceMappingURL=chunk-OTUH4K4B.js.map