laif-ds 0.2.74 → 0.2.76

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 (155) hide show
  1. package/dist/CHANGELOG.md +446 -0
  2. package/dist/agent-docs/adoption-report.json +615 -0
  3. package/dist/agent-docs/components/Accordion.md +46 -16
  4. package/dist/agent-docs/components/Alert.md +90 -95
  5. package/dist/agent-docs/components/AlertDialog.md +132 -126
  6. package/dist/agent-docs/components/AppEditor.md +90 -90
  7. package/dist/agent-docs/components/AppRadioGroup.md +18 -18
  8. package/dist/agent-docs/components/AppSidebar.md +129 -122
  9. package/dist/agent-docs/components/AppStepper.md +81 -77
  10. package/dist/agent-docs/components/AspectRatio.md +70 -62
  11. package/dist/agent-docs/components/AudioVisualizer.md +5 -5
  12. package/dist/agent-docs/components/Avatar.md +112 -113
  13. package/dist/agent-docs/components/Badge.md +123 -118
  14. package/dist/agent-docs/components/Breadcrumb.md +8 -1
  15. package/dist/agent-docs/components/Button.md +131 -129
  16. package/dist/agent-docs/components/Card.md +172 -147
  17. package/dist/agent-docs/components/Carousel.md +148 -129
  18. package/dist/agent-docs/components/Chat.md +121 -109
  19. package/dist/agent-docs/components/ChatMessage.md +72 -61
  20. package/dist/agent-docs/components/Checkbox.md +150 -135
  21. package/dist/agent-docs/components/CircularProgress.md +53 -49
  22. package/dist/agent-docs/components/CodeHighlighter.md +4 -4
  23. package/dist/agent-docs/components/Collapsible.md +114 -95
  24. package/dist/agent-docs/components/Command.md +141 -142
  25. package/dist/agent-docs/components/Confirmer.md +182 -175
  26. package/dist/agent-docs/components/ContextMenu.md +196 -191
  27. package/dist/agent-docs/components/DataCrossTable.md +114 -94
  28. package/dist/agent-docs/components/DataTable.md +32 -24
  29. package/dist/agent-docs/components/Dialog.md +130 -125
  30. package/dist/agent-docs/components/Drawer.md +141 -127
  31. package/dist/agent-docs/components/FilePreviewer.md +138 -139
  32. package/dist/agent-docs/components/FileUploader.md +149 -129
  33. package/dist/agent-docs/components/Form.md +3 -1
  34. package/dist/agent-docs/components/FormComposer.md +163 -137
  35. package/dist/agent-docs/components/GanttChart.md +125 -122
  36. package/dist/agent-docs/components/HoverCard.md +1 -1
  37. package/dist/agent-docs/components/Icon.md +98 -99
  38. package/dist/agent-docs/components/Input.md +173 -138
  39. package/dist/agent-docs/components/InputOtp.md +6 -1
  40. package/dist/agent-docs/components/InputSelector.md +94 -97
  41. package/dist/agent-docs/components/InterruptPrompt.md +4 -4
  42. package/dist/agent-docs/components/MarkdownRenderer.md +5 -2
  43. package/dist/agent-docs/components/Menubar.md +60 -57
  44. package/dist/agent-docs/components/MessageInput.md +134 -131
  45. package/dist/agent-docs/components/MessageList.md +110 -96
  46. package/dist/agent-docs/components/MultipleSelector.md +147 -146
  47. package/dist/agent-docs/components/NavigationMenu.md +6 -2
  48. package/dist/agent-docs/components/Popover.md +112 -103
  49. package/dist/agent-docs/components/PromptSuggestions.md +5 -5
  50. package/dist/agent-docs/components/RadioGroup.md +97 -90
  51. package/dist/agent-docs/components/Resizable.md +4 -1
  52. package/dist/agent-docs/components/ResizePrompt.md +12 -13
  53. package/dist/agent-docs/components/ScrollArea.md +6 -2
  54. package/dist/agent-docs/components/SecurePdfViewer.md +10 -6
  55. package/dist/agent-docs/components/Select.md +131 -132
  56. package/dist/agent-docs/components/Sheet.md +8 -1
  57. package/dist/agent-docs/components/ShikiHighlighter.md +5 -5
  58. package/dist/agent-docs/components/Sidebar.md +94 -85
  59. package/dist/agent-docs/components/Slider.md +62 -58
  60. package/dist/agent-docs/components/Sonner.md +1 -0
  61. package/dist/agent-docs/components/Spinner.md +14 -14
  62. package/dist/agent-docs/components/Stepper.md +93 -67
  63. package/dist/agent-docs/components/Switch.md +41 -42
  64. package/dist/agent-docs/components/TableSkeleton.md +8 -8
  65. package/dist/agent-docs/components/Tabs.md +106 -86
  66. package/dist/agent-docs/components/TextArea.md +51 -52
  67. package/dist/agent-docs/components/ThemeSwitcher.md +72 -69
  68. package/dist/agent-docs/components/Toaster.md +1 -0
  69. package/dist/agent-docs/components/Tooltip.md +102 -91
  70. package/dist/agent-docs/components/Typo.md +68 -65
  71. package/dist/agent-docs/components/WeeklyCalendar.md +63 -64
  72. package/dist/agent-docs/components-list.md +1 -0
  73. package/dist/agent-docs/manifest.json +5981 -0
  74. package/dist/agent-docs/truncated-cell.md +342 -0
  75. package/dist/components/editor/editor-hooks/use-update-toolbar.js +6 -6
  76. package/dist/components/editor/plugins/actions/counter-character-plugin.js +6 -6
  77. package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +18 -18
  78. package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +10 -10
  79. package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +9 -9
  80. package/dist/components/ui/app-checkbox.js +1 -1
  81. package/dist/components/ui/app-dialog.js +70 -64
  82. package/dist/components/ui/app-editor.js +51 -51
  83. package/dist/components/ui/app-form.js +81 -81
  84. package/dist/components/ui/app-multiple-select-dropdown.js +36 -36
  85. package/dist/components/ui/app-select.js +109 -104
  86. package/dist/components/ui/app-sidebar.js +41 -41
  87. package/dist/components/ui/app-stepper.js +1 -1
  88. package/dist/components/ui/app-time-picker.js +18 -18
  89. package/dist/components/ui/app-tooltip.js +1 -1
  90. package/dist/components/ui/async-select.js +5 -5
  91. package/dist/components/ui/audio-visualizer.js +61 -58
  92. package/dist/components/ui/card.js +1 -1
  93. package/dist/components/ui/carousel.js +2 -2
  94. package/dist/components/ui/chart.js +1 -1
  95. package/dist/components/ui/chat-message.js +8 -8
  96. package/dist/components/ui/chat.js +86 -88
  97. package/dist/components/ui/command.js +2 -2
  98. package/dist/components/ui/copy-button.js +4 -4
  99. package/dist/components/ui/date-picker.js +20 -20
  100. package/dist/components/ui/file-preview/index.js +13 -13
  101. package/dist/components/ui/file-previewer.js +12 -11
  102. package/dist/components/ui/file-uploader.js +86 -78
  103. package/dist/components/ui/form.js +2 -2
  104. package/dist/components/ui/gantt/components/Chart/Bars/Bars.js +56 -56
  105. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarItem/BarItem.js +12 -12
  106. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarsItems/BarItems.js +1 -1
  107. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarsRow.js +4 -4
  108. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/RepeteadBars/RepeteadBars.js +2 -2
  109. package/dist/components/ui/gantt/components/Chart/Chart.js +23 -23
  110. package/dist/components/ui/gantt/components/Chart/Scale/Scale.js +1 -1
  111. package/dist/components/ui/gantt/components/Chart/Tree/Tree.js +34 -34
  112. package/dist/components/ui/gantt/components/Controls/Controls.js +5 -5
  113. package/dist/components/ui/gantt/components/Gantt/Gantt.js +4 -4
  114. package/dist/components/ui/gantt/hooks/useGanttCalculate.js +25 -18
  115. package/dist/components/ui/input-selector.js +1 -1
  116. package/dist/components/ui/input.js +23 -23
  117. package/dist/components/ui/kanban.js +8 -9
  118. package/dist/components/ui/markdown-renderer.js +41 -35
  119. package/dist/components/ui/message-input.js +45 -44
  120. package/dist/components/ui/multiple-selector.js +91 -82
  121. package/dist/components/ui/secure-pdf-viewer.js +19 -7
  122. package/dist/components/ui/sidebar.js +1 -1
  123. package/dist/components/ui/slider.js +1 -1
  124. package/dist/components/ui/spinner.js +4 -4
  125. package/dist/components/ui/stepper.js +157 -138
  126. package/dist/components/ui/tables/data-cross-table/data-cross-table-buttons.js +29 -29
  127. package/dist/components/ui/tables/data-cross-table/data-cross-table.js +258 -246
  128. package/dist/components/ui/tables/data-table/components/data-table-advanced-filter.js +4 -1
  129. package/dist/components/ui/tables/data-table/components/data-table-body.js +211 -367
  130. package/dist/components/ui/tables/data-table/components/data-table-filter-inputs.js +114 -112
  131. package/dist/components/ui/tables/data-table/components/data-table-filters.js +116 -96
  132. package/dist/components/ui/tables/data-table/components/data-table-header.js +211 -0
  133. package/dist/components/ui/tables/data-table/components/data-table-searchbar.js +8 -8
  134. package/dist/components/ui/tables/data-table/components/data-table-skeleton-rows.js +33 -0
  135. package/dist/components/ui/tables/data-table/data-table.js +258 -250
  136. package/dist/components/ui/tables/data-table/data-table.service.js +112 -97
  137. package/dist/components/ui/tables/data-table/data-table.utils.js +25 -15
  138. package/dist/components/ui/textarea.js +2 -2
  139. package/dist/components/ui/theme-switcher.js +1 -1
  140. package/dist/components/ui/toggle-group.js +2 -2
  141. package/dist/components/ui/truncated-cell.js +100 -0
  142. package/dist/components/ui/weekly-calendar/appointment-card.js +16 -16
  143. package/dist/components/ui/weekly-calendar/calendar-context.js +6 -6
  144. package/dist/components/ui/weekly-calendar/calendar-header.js +12 -12
  145. package/dist/components/ui/weekly-calendar/day-column.js +16 -16
  146. package/dist/components/ui/weekly-calendar/time-column.js +4 -4
  147. package/dist/components/ui/weekly-calendar/weekly-calendar.js +4 -4
  148. package/dist/hooks/use-audio-recording.js +1 -1
  149. package/dist/hooks/use-auto-scroll.js +18 -18
  150. package/dist/hooks/use-autosize-textarea.js +12 -13
  151. package/dist/index.d.ts +100 -45
  152. package/dist/index.js +362 -360
  153. package/dist/lib/utils.js +6 -6
  154. package/dist/styles.v3.css +1 -1
  155. package/package.json +14 -4
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import { jsxs as l, jsx as o } from "react/jsx-runtime";
3
- import { designTokens as r } from "../design-tokens.js";
4
- import { Calendar as L } from "./calendar.js";
5
- import { Icon as X } from "./icon.js";
6
- import { Label as ue } from "./label.js";
7
- import { Popover as fe, PopoverTrigger as he, PopoverContent as ge } from "./popover.js";
8
- import { cn as B } from "../../lib/utils.js";
9
3
  import * as f from "react";
10
- import { useCallback as G, useMemo as p, useEffect as ve } from "react";
4
+ import { useCallback as L, useMemo as p, useEffect as ue } from "react";
5
+ import { designTokens as r } from "../design-tokens.js";
6
+ import { Calendar as X } from "./calendar.js";
7
+ import { Icon as B } from "./icon.js";
8
+ import { Label as fe } from "./label.js";
9
+ import { Popover as he, PopoverTrigger as ge, PopoverContent as ve } from "./popover.js";
10
+ import { cn as G } from "../../lib/utils.js";
11
11
  import { TimePickerColumn as k } from "./app-time-picker.js";
12
12
  import { it as be } from "../../node_modules/date-fns/locale/it.js";
13
13
  import { formatDate as H } from "../../node_modules/date-fns/format.js";
@@ -53,7 +53,7 @@ function Oe(t) {
53
53
  s.getMinutes(),
54
54
  s.getSeconds()
55
55
  ), b(a), a && C(a), !n && t.onChange && t.onChange(a), !v && a && V(!1);
56
- }, ae = G(() => {
56
+ }, ae = L(() => {
57
57
  n ? (N(void 0), t.onChange && t.onChange(void 0)) : (b(void 0), t.onChange && t.onChange(void 0)), A?.();
58
58
  }, [n, t.onChange, A]), ne = s?.getHours(), oe = s?.getMinutes(), se = s?.getSeconds(), ie = p(
59
59
  () => Array.from({ length: 24 }, (e, a) => a),
@@ -70,7 +70,7 @@ function Oe(t) {
70
70
  (e, a) => a * y
71
71
  ),
72
72
  [y]
73
- ), S = G(
73
+ ), S = L(
74
74
  (e, a) => {
75
75
  const m = s ? new Date(s) : /* @__PURE__ */ new Date();
76
76
  s || m.setHours(0, 0, 0, 0), e === "hour" ? m.setHours(a) : e === "minute" ? m.setMinutes(a) : e === "second" && m.setSeconds(a), b(m), !n && t.onChange && t.onChange(m);
@@ -84,7 +84,7 @@ function Oe(t) {
84
84
  (e) => !O.some(
85
85
  (a) => Ce(a, e)
86
86
  )
87
- ), d && (c = [!0]), ve(() => {
87
+ ), d && (c = [!0]), ue(() => {
88
88
  if (n) {
89
89
  N(t.value);
90
90
  const e = t.value?.from;
@@ -99,15 +99,15 @@ function Oe(t) {
99
99
  i.from && i.to && " - ",
100
100
  i.to && H(i.to, D, { locale: u })
101
101
  ] }) : !n && s ? /* @__PURE__ */ o("span", { children: H(s, D, { locale: u }) }) : /* @__PURE__ */ o("span", { className: "text-d-muted-foreground", children: x });
102
- return /* @__PURE__ */ l("div", { className: B("flex flex-col gap-1.5", W), children: [
103
- I && /* @__PURE__ */ o(ue, { htmlFor: q, className: U, children: I }),
104
- /* @__PURE__ */ l(fe, { open: d ? !1 : _, onOpenChange: V, modal: !0, children: [
105
- /* @__PURE__ */ o(he, { asChild: !0, children: /* @__PURE__ */ l(
102
+ return /* @__PURE__ */ l("div", { className: G("flex flex-col gap-1.5", W), children: [
103
+ I && /* @__PURE__ */ o(fe, { htmlFor: q, className: U, children: I }),
104
+ /* @__PURE__ */ l(he, { open: d ? !1 : _, onOpenChange: V, modal: !0, children: [
105
+ /* @__PURE__ */ o(ge, { asChild: !0, children: /* @__PURE__ */ l(
106
106
  "div",
107
107
  {
108
108
  id: q,
109
109
  "data-testid": Z,
110
- className: B(
110
+ className: G(
111
111
  r.input.base,
112
112
  r.radius.default,
113
113
  r.text.base,
@@ -129,7 +129,7 @@ function Oe(t) {
129
129
  onClick: d ? void 0 : () => {
130
130
  },
131
131
  children: [
132
- /* @__PURE__ */ o(X, { name: "Calendar", size: h === "lg" ? "sm" : "xs" }),
132
+ /* @__PURE__ */ o(B, { name: "Calendar", size: h === "lg" ? "sm" : "xs" }),
133
133
  /* @__PURE__ */ o("div", { className: "min-w-0 flex-1", children: me() }),
134
134
  ee && E && /* @__PURE__ */ o(
135
135
  "div",
@@ -142,7 +142,7 @@ function Oe(t) {
142
142
  onMouseDown: (e) => e.preventDefault(),
143
143
  "aria-label": "Clear selection",
144
144
  children: /* @__PURE__ */ o(
145
- X,
145
+ B,
146
146
  {
147
147
  name: "X",
148
148
  size: "xs",
@@ -156,13 +156,13 @@ function Oe(t) {
156
156
  ) }),
157
157
  " ",
158
158
  /* @__PURE__ */ l(
159
- ge,
159
+ ve,
160
160
  {
161
161
  className: "flex max-h-[500px] min-h-0 w-auto flex-row p-0 shadow",
162
162
  align: "start",
163
163
  children: [
164
164
  n ? /* @__PURE__ */ o(
165
- L,
165
+ X,
166
166
  {
167
167
  ...F || {},
168
168
  mode: "range",
@@ -177,7 +177,7 @@ function Oe(t) {
177
177
  maxDate: j
178
178
  }
179
179
  ) : /* @__PURE__ */ o(
180
- L,
180
+ X,
181
181
  {
182
182
  ...F || {},
183
183
  mode: "single",
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { jsx as r, jsxs as m, Fragment as T } from "react/jsx-runtime";
3
- import { getNameOrUrl as z, getExt as F, getMimeFromFile as $, imageExts as K, isFile as D, getFileMetadata as B, getFormatIcon as W, formatMetadata as q } from "../../../lib/file-preview.js";
4
3
  import { cva as v } from "../../../node_modules/class-variance-authority/dist/index.js";
5
- import { motion as G } from "framer-motion";
6
- import f, { useEffect as U, Fragment as X } from "react";
4
+ import { motion as K } from "framer-motion";
5
+ import f, { useEffect as $, Fragment as B } from "react";
6
+ import { getNameOrUrl as z, getExt as F, getMimeFromFile as U, imageExts as W, isFile as D, getFileMetadata as q, getFormatIcon as G, formatMetadata as X } from "../../../lib/file-preview.js";
7
7
  import { Button as H } from "../button.js";
8
8
  import { DropdownMenu as J, DropdownMenuTrigger as Q, DropdownMenuContent as Y, DropdownMenuSeparator as Z, DropdownMenuItem as ee } from "../dropdown-menu.js";
9
9
  import { Icon as P } from "../icon.js";
@@ -115,7 +115,7 @@ const re = {
115
115
  sizeLabel: e,
116
116
  formatLabel: a
117
117
  }) => {
118
- const { size: o } = N(), t = q(e, a);
118
+ const { size: o } = N(), t = X(e, a);
119
119
  return t ? /* @__PURE__ */ r(
120
120
  "div",
121
121
  {
@@ -153,7 +153,7 @@ const re = {
153
153
  ext: a,
154
154
  mimeType: o
155
155
  }) => {
156
- const { size: t } = N(), { iconName: n, colorClass: s } = W(a ?? "", o);
156
+ const { size: t } = N(), { iconName: n, colorClass: s } = G(a ?? "", o);
157
157
  return /* @__PURE__ */ r(
158
158
  "div",
159
159
  {
@@ -241,7 +241,7 @@ const re = {
241
241
  align: "end",
242
242
  onClick: (i) => i.stopPropagation(),
243
243
  onPointerDown: (i) => i.stopPropagation(),
244
- children: u.filter((i) => i.cond).map((i, d, y) => /* @__PURE__ */ m(X, { children: [
244
+ children: u.filter((i) => i.cond).map((i, d, y) => /* @__PURE__ */ m(B, { children: [
245
245
  i.danger && y.length > 1 && /* @__PURE__ */ r(Z, {}),
246
246
  /* @__PURE__ */ m(
247
247
  ee,
@@ -279,8 +279,8 @@ const re = {
279
279
  );
280
280
  }, Pe = f.forwardRef(
281
281
  (e, a) => {
282
- const o = z(e.file), t = F(o), n = $(e.file), s = t === "csv" || n === "text/csv";
283
- return n && n.startsWith("image/") || t && K.has(t) ? /* @__PURE__ */ r(fe, { ...e, ref: a }) : !s && (t === "txt" || t === "md" || n && n.startsWith("text/")) ? /* @__PURE__ */ r(ue, { ...e, ref: a }) : /* @__PURE__ */ r(me, { ...e, ref: a });
282
+ const o = z(e.file), t = F(o), n = U(e.file), s = t === "csv" || n === "text/csv";
283
+ return n && n.startsWith("image/") || t && W.has(t) ? /* @__PURE__ */ r(fe, { ...e, ref: a }) : !s && (t === "txt" || t === "md" || n && n.startsWith("text/")) ? /* @__PURE__ */ r(ue, { ...e, ref: a }) : /* @__PURE__ */ r(me, { ...e, ref: a });
284
284
  }
285
285
  ), L = f.forwardRef(
286
286
  ({
@@ -300,7 +300,7 @@ const re = {
300
300
  const [d, y] = f.useState(
301
301
  () => D(e) ? "" : e.url
302
302
  );
303
- U(() => {
303
+ $(() => {
304
304
  if (D(e)) {
305
305
  const l = URL.createObjectURL(e);
306
306
  return y(l), () => {
@@ -309,7 +309,7 @@ const re = {
309
309
  } else
310
310
  y(e.url);
311
311
  }, [e]);
312
- const S = B(e), R = z(e), M = !s && !!g, p = a && (!!t || M), E = async (l) => {
312
+ const S = q(e), R = z(e), M = !s && !!g, p = a && (!!t || M), E = async (l) => {
313
313
  if (M) {
314
314
  try {
315
315
  await g(l);
@@ -332,7 +332,7 @@ const re = {
332
332
  p && (l.stopPropagation(), (l.key === "Enter" || l.key === " ") && (l.preventDefault(), E(l)));
333
333
  };
334
334
  return /* @__PURE__ */ r(
335
- G.div,
335
+ K.div,
336
336
  {
337
337
  ref: i,
338
338
  role: p ? "button" : "group",
@@ -396,7 +396,7 @@ const re = {
396
396
  ] }) });
397
397
  }), ue = f.forwardRef(({ file: e, showThumbnail: a = !0, ...o }, t) => {
398
398
  const [n, s] = f.useState(null), c = z(e), h = o.size ?? "default";
399
- U(() => {
399
+ $(() => {
400
400
  if (D(e)) {
401
401
  const g = new FileReader();
402
402
  return g.onload = (u) => {
@@ -437,7 +437,7 @@ const re = {
437
437
  ] })
438
438
  ] }) });
439
439
  }), me = f.forwardRef((e, a) => {
440
- const o = z(e.file), t = F(o), n = $(e.file);
440
+ const o = z(e.file), t = F(o), n = U(e.file);
441
441
  return /* @__PURE__ */ r(L, { ...e, ref: a, children: (s, c) => /* @__PURE__ */ m(T, { children: [
442
442
  /* @__PURE__ */ r(k, { ext: t, mimeType: n }),
443
443
  /* @__PURE__ */ m("div", { className: "mr-1 flex min-w-0 flex-1 flex-col gap-0.5", children: [
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import { jsxs as f, jsx as r } from "react/jsx-runtime";
3
+ import { useMemo as c } from "react";
3
4
  import { createAsk as w } from "../../node_modules/use-ask/dist/index.js";
4
5
  import { Dialog as x, DialogContent as g, DialogHeader as N, DialogTitle as y } from "./dialog.js";
5
6
  import { Icon as P } from "./icon.js";
6
7
  import { SecurePdfViewer as b } from "./secure-pdf-viewer.js";
7
8
  import { guessKind as A, isHttpUrl as D, getOfficeEmbedUrl as O } from "../../lib/file-preview.js";
8
9
  import { cn as F } from "../../lib/utils.js";
9
- import { useMemo as c } from "react";
10
10
  const [p, T] = w({});
11
11
  function h(e) {
12
12
  return typeof e == "string" ? { url: e } : e || {};
@@ -18,20 +18,20 @@ function B(e) {
18
18
  return p.safeAsk(h(e));
19
19
  }
20
20
  const E = () => {
21
- const [{ payload: e }, { asking: i, ok: n }] = T(), l = e?.url, a = e?.readOnly, o = e?.page, t = c(() => e?.filename ? e?.filename : (e?.url || "").split(/[?#]/)[0].split("/").pop() || "" || "document", [e?.filename, e?.url]), m = c(() => {
21
+ const [{ payload: e }, { asking: i, ok: n }] = T(), l = e?.url, a = e?.readOnly, t = e?.page, o = c(() => e?.filename ? e?.filename : (e?.url || "").split(/[?#]/)[0].split("/").pop() || "" || "document", [e?.filename, e?.url]), m = c(() => {
22
22
  if (!e?.url) return null;
23
23
  const s = new URL(e?.url), u = s.searchParams.get("response-content-type") || s.searchParams.get("content-type"), d = e?.mimeType || u || "";
24
24
  return A({
25
25
  mimeType: d,
26
- filename: t,
26
+ filename: o,
27
27
  url: e?.url
28
28
  });
29
- }, [e?.mimeType, t, e?.url]), v = c(
29
+ }, [e?.mimeType, o, e?.url]), v = c(
30
30
  () => /* @__PURE__ */ f("span", { className: "flex items-center gap-2", children: [
31
31
  /* @__PURE__ */ r(P, { name: "File", className: "h-4 w-4" }),
32
- e?.title || t
32
+ e?.title || o
33
33
  ] }),
34
- [e?.title, t]
34
+ [e?.title, o]
35
35
  );
36
36
  return /* @__PURE__ */ r(x, { open: i, onOpenChange: (s) => !s && n(), children: /* @__PURE__ */ f(g, { size: "xl", className: "sm:max-w-4xl", children: [
37
37
  /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(y, { children: v }) }),
@@ -42,7 +42,7 @@ const E = () => {
42
42
  src: l,
43
43
  officeUrl: l,
44
44
  readOnly: a,
45
- page: o
45
+ page: t
46
46
  }
47
47
  ) : null })
48
48
  ] }) });
@@ -65,7 +65,7 @@ const E = () => {
65
65
  className: "max-h-[78vh] w-auto max-w-full object-contain"
66
66
  }
67
67
  ) });
68
- case "pdf":
68
+ case "pdf": {
69
69
  if (l && i)
70
70
  return /* @__PURE__ */ r(
71
71
  b,
@@ -75,15 +75,16 @@ const E = () => {
75
75
  className: "w-full"
76
76
  }
77
77
  );
78
- let o = i;
79
- return a > 0 && (o += "#page=" + a), /* @__PURE__ */ r(
78
+ let t = i;
79
+ return a > 0 && (t += "#page=" + a), /* @__PURE__ */ r(
80
80
  "iframe",
81
81
  {
82
- src: o,
82
+ src: t,
83
83
  title: "PDF Preview",
84
84
  className: "h-[78vh] w-full rounded"
85
85
  }
86
86
  );
87
+ }
87
88
  case "audio":
88
89
  return /* @__PURE__ */ r("div", { className: "grid place-items-center", children: /* @__PURE__ */ r("audio", { controls: !0, className: "w-full max-w-2xl", children: /* @__PURE__ */ r("source", { src: i }) }) });
89
90
  case "video":
@@ -22,132 +22,140 @@ const U = {
22
22
  gif: ".gif",
23
23
  image: "image/*",
24
24
  video: "video/*",
25
- audio: "audio/*"
25
+ audio: "audio/*",
26
+ // Keep both extensions and MIME aliases because archive file types are
27
+ // reported inconsistently across browsers and operating systems.
28
+ zip: ".zip,application/zip,application/x-zip-compressed,multipart/x-zip",
29
+ rar: ".rar,application/vnd.rar,application/x-rar-compressed",
30
+ "7z": ".7z,application/x-7z-compressed",
31
+ tar: ".tar,application/x-tar",
32
+ gz: ".gz,application/gzip,application/x-gzip",
33
+ tgz: ".tgz,.tar.gz,application/gzip,application/x-compressed-tar"
26
34
  }, R = (g) => Math.ceil(g / (1024 * 1024)), ee = ({
27
35
  extensions: g = ["pdf", "image", "video", "audio"],
28
- multiple: f = !1,
29
- onUpload: b,
30
- description: y = "Trascina un file o clicca per selezionare",
31
- formatDescription: w = "Formato accettato: PDF, Immagini, Video, Audio",
32
- selectedLabel: N = "File selezionati",
33
- maxTotalSize: d,
34
- removeAllLabel: j = "rimuovi tutto",
36
+ multiple: p = !1,
37
+ onUpload: z,
38
+ description: I = "Trascina un file o clicca per selezionare",
39
+ formatDescription: b = "Formato accettato: PDF, Immagini, Video, Audio",
40
+ selectedLabel: y = "File selezionati",
41
+ maxTotalSize: c,
42
+ removeAllLabel: N = "rimuovi tutto",
35
43
  maxFiles: x,
36
- id: i,
37
- "data-testid": z
44
+ id: s,
45
+ "data-testid": j
38
46
  }) => {
39
- const u = g.map((e) => U[e]).join(","), [s, p] = l.useState([]), [D, I] = l.useState(""), a = (e) => {
40
- const o = Array.from(e).filter(
41
- (n) => u.split(",").some((t) => (t = t.trim(), n.type.startsWith(t.replace("/*", "")) || n.name.toLowerCase().endsWith(t.replace("*", ""))))
47
+ const f = g.map((e) => U[e]).join(","), [a, u] = l.useState([]), [w, D] = l.useState(""), o = (e) => {
48
+ const n = Array.from(e).filter(
49
+ (i) => f.split(",").some((t) => (t = t.trim(), i.type.startsWith(t.replace("/*", "")) || i.name.toLowerCase().endsWith(t.replace("*", ""))))
42
50
  );
43
- let c = [];
51
+ let d = [];
44
52
  const m = [];
45
- if (f) {
46
- let n = o;
53
+ if (p) {
54
+ let i = n;
47
55
  if (typeof x == "number") {
48
- const t = Math.max(x - s.length, 0);
49
- t < o.length && (n = o.slice(0, t), m.push(`Max ${x} file`));
56
+ const t = Math.max(x - a.length, 0);
57
+ t < n.length && (i = n.slice(0, t), m.push(`Max ${x} file`));
50
58
  }
51
- if (typeof d == "number") {
52
- const t = d;
53
- let F = s.reduce((h, A) => h + (A.size || 0), 0);
59
+ if (typeof c == "number") {
60
+ const t = c;
61
+ let F = a.reduce((h, A) => h + (A.size || 0), 0);
54
62
  const M = [];
55
63
  let $ = !1;
56
- for (const h of n)
64
+ for (const h of i)
57
65
  F + (h.size || 0) <= t ? (M.push(h), F += h.size || 0) : $ || (m.push(`Max ${R(t)} MB`), $ = !0);
58
- n = M;
66
+ i = M;
59
67
  }
60
- c = [...s, ...n];
68
+ d = [...a, ...i];
61
69
  } else {
62
- const n = o[0] ? [o[0]] : [];
63
- if (typeof d == "number" && n[0]) {
64
- const t = d;
65
- (n[0].size || 0) > t ? (m.push(`Max ${R(t)} MB`), c = s) : c = n;
70
+ const i = n[0] ? [n[0]] : [];
71
+ if (typeof c == "number" && i[0]) {
72
+ const t = c;
73
+ (i[0].size || 0) > t ? (m.push(`Max ${R(t)} MB`), d = a) : d = i;
66
74
  } else
67
- c = n;
75
+ d = i;
68
76
  }
69
- p(c), I(m.join(" • ")), b?.(c);
77
+ u(d), D(m.join(" • ")), z?.(d);
70
78
  }, E = (e) => {
71
- e.target.files && a(e.target.files), e.target.value = "";
79
+ e.target.files && o(e.target.files), e.target.value = "";
72
80
  }, L = (e) => {
73
- e.preventDefault(), a(e.dataTransfer.files);
81
+ e.preventDefault(), o(e.dataTransfer.files);
74
82
  }, C = (e) => {
75
- const o = s.filter((c, m) => m !== e);
76
- p(o), I(""), b?.(o);
83
+ const n = a.filter((d, m) => m !== e);
84
+ u(n), D(""), z?.(n);
77
85
  };
78
86
  return /* @__PURE__ */ v("div", { className: "mx-auto w-full space-y-4", children: [
79
- (f || s.length === 0) && /* @__PURE__ */ r(
87
+ (p || a.length === 0) && /* @__PURE__ */ r(
80
88
  V,
81
89
  {
82
- accept: u,
83
- multiple: f,
90
+ accept: f,
91
+ multiple: p,
84
92
  onDrop: L,
85
93
  onChange: E,
86
- description: y,
87
- formatDescription: w,
88
- errorCaption: D,
89
- id: i,
90
- "data-testid": z
94
+ description: I,
95
+ formatDescription: b,
96
+ errorCaption: w,
97
+ id: s,
98
+ "data-testid": j
91
99
  }
92
100
  ),
93
- s.length > 0 && /* @__PURE__ */ r(B, { children: /* @__PURE__ */ v(P, { size: "sm", className: "shadow-none", children: [
101
+ a.length > 0 && /* @__PURE__ */ r(B, { children: /* @__PURE__ */ v(P, { size: "sm", className: "shadow-none", children: [
94
102
  /* @__PURE__ */ v(_, { className: "flex justify-between", children: [
95
- /* @__PURE__ */ r(W, { children: N }),
103
+ /* @__PURE__ */ r(W, { children: y }),
96
104
  /* @__PURE__ */ r(
97
105
  S,
98
106
  {
99
107
  size: "sm",
100
108
  variant: "ghost",
101
109
  className: "text-xs",
102
- onClick: () => p([]),
103
- children: j
110
+ onClick: () => u([]),
111
+ children: N
104
112
  }
105
113
  )
106
114
  ] }),
107
- /* @__PURE__ */ r(H, { children: f ? /* @__PURE__ */ r("div", { className: "flex flex-nowrap gap-2 overflow-x-auto py-2", children: s.map((e, o) => /* @__PURE__ */ r(
115
+ /* @__PURE__ */ r(H, { children: p ? /* @__PURE__ */ r("div", { className: "flex flex-nowrap gap-2 overflow-x-auto py-2", children: a.map((e, n) => /* @__PURE__ */ r(
108
116
  k,
109
117
  {
110
118
  file: e,
111
- onRemove: () => C(o)
119
+ onRemove: () => C(n)
112
120
  },
113
- e.name + o
114
- )) }) : /* @__PURE__ */ r(k, { file: s[0], onRemove: () => C(0) }) })
121
+ e.name + n
122
+ )) }) : /* @__PURE__ */ r(k, { file: a[0], onRemove: () => C(0) }) })
115
123
  ] }) })
116
124
  ] });
117
125
  }, V = ({
118
126
  accept: g,
119
- multiple: f,
120
- onDrop: b,
121
- onChange: y,
122
- description: w,
123
- formatDescription: N,
124
- errorCaption: d,
125
- id: j,
127
+ multiple: p,
128
+ onDrop: z,
129
+ onChange: I,
130
+ description: b,
131
+ formatDescription: y,
132
+ errorCaption: c,
133
+ id: N,
126
134
  "data-testid": x
127
135
  }) => {
128
- const i = l.useRef(null), [z, u] = l.useState(!1), s = l.useId(), p = l.useId(), D = l.useId(), I = l.useId();
136
+ const s = l.useRef(null), [j, f] = l.useState(!1), a = l.useId(), u = l.useId(), w = l.useId(), D = l.useId();
129
137
  return /* @__PURE__ */ v(
130
138
  "div",
131
139
  {
132
- id: j,
140
+ id: N,
133
141
  "data-testid": x,
134
142
  role: "button",
135
143
  tabIndex: 0,
136
- "aria-label": w || "Seleziona file",
137
- "aria-describedby": `${s} ${p}${d ? ` ${D}` : ""}`,
138
- onKeyDown: (a) => {
139
- (a.key === "Enter" || a.key === " ") && (a.preventDefault(), i.current && (i.current.value = "", i.current.click()));
144
+ "aria-label": b || "Seleziona file",
145
+ "aria-describedby": `${a} ${u}${c ? ` ${w}` : ""}`,
146
+ onKeyDown: (o) => {
147
+ (o.key === "Enter" || o.key === " ") && (o.preventDefault(), s.current && (s.current.value = "", s.current.click()));
140
148
  },
141
149
  onClick: () => {
142
- i.current && (i.current.value = "", i.current.click());
150
+ s.current && (s.current.value = "", s.current.click());
143
151
  },
144
- onDragEnter: () => u(!0),
145
- onDragOver: (a) => a.preventDefault(),
146
- onDragLeave: () => u(!1),
147
- onDrop: (a) => {
148
- u(!1), b(a);
152
+ onDragEnter: () => f(!0),
153
+ onDragOver: (o) => o.preventDefault(),
154
+ onDragLeave: () => f(!1),
155
+ onDrop: (o) => {
156
+ f(!1), z(o);
149
157
  },
150
- className: `border-d-border flex w-full cursor-pointer flex-col items-center gap-3 rounded-lg border-2 border-dashed px-4 py-8 ${z ? "bg-muted/40" : ""}`,
158
+ className: `border-d-border flex w-full cursor-pointer flex-col items-center gap-3 rounded-lg border-2 border-dashed px-4 py-8 ${j ? "bg-muted/40" : ""}`,
151
159
  children: [
152
160
  /* @__PURE__ */ r(
153
161
  K,
@@ -157,27 +165,27 @@ const U = {
157
165
  }
158
166
  ),
159
167
  /* @__PURE__ */ v("div", { className: "max-w-xs text-center", children: [
160
- /* @__PURE__ */ r("p", { id: s, className: "text-d-muted-foreground text-sm font-medium", children: w }),
168
+ /* @__PURE__ */ r("p", { id: a, className: "text-d-muted-foreground text-sm font-medium", children: b }),
161
169
  /* @__PURE__ */ r(
162
170
  "p",
163
171
  {
164
- id: p,
172
+ id: u,
165
173
  className: "text-d-muted-foreground text-muted-foreground mt-1 text-xs",
166
- children: N
174
+ children: y
167
175
  }
168
176
  ),
169
- d ? /* @__PURE__ */ r("p", { id: D, className: "mt-2 text-xs font-medium text-red-600", children: d }) : null
177
+ c ? /* @__PURE__ */ r("p", { id: w, className: "mt-2 text-xs font-medium text-red-600", children: c }) : null
170
178
  ] }),
171
179
  /* @__PURE__ */ r(
172
180
  O,
173
181
  {
174
- ref: i,
175
- id: I,
182
+ ref: s,
183
+ id: D,
176
184
  type: "file",
177
185
  className: "hidden",
178
186
  accept: g,
179
- multiple: f,
180
- onChange: y
187
+ multiple: p,
188
+ onChange: I
181
189
  }
182
190
  )
183
191
  ]
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { jsx as n } from "react/jsx-runtime";
3
- import * as s from "react";
4
3
  import { Root as f } from "../../node_modules/@radix-ui/react-slot/dist/index.js";
4
+ import * as s from "react";
5
5
  import { FormProvider as u, Controller as F, useFormContext as x, useFormState as I } from "../../node_modules/react-hook-form/dist/index.esm.js";
6
- import { cn as a } from "../../lib/utils.js";
7
6
  import { Label as g } from "./label.js";
7
+ import { cn as a } from "../../lib/utils.js";
8
8
  const S = u, c = s.createContext(
9
9
  {}
10
10
  ), $ = ({