@orion-ds/react 5.0.0 → 5.1.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 (40) hide show
  1. package/README.md +48 -4
  2. package/dist/client.cjs +1 -1
  3. package/dist/client.mjs +143 -139
  4. package/dist/components/Button/Button.module.css +1 -1
  5. package/dist/components/Button/Button.module.css.cjs +1 -1
  6. package/dist/components/Button/Button.module.css.mjs +28 -28
  7. package/dist/components/Calendar/Calendar.cjs +1 -1
  8. package/dist/components/Calendar/Calendar.d.ts.map +1 -1
  9. package/dist/components/Calendar/Calendar.mjs +105 -86
  10. package/dist/components/Chart/Chart.cjs +1 -1
  11. package/dist/components/Chart/Chart.d.ts +2 -3
  12. package/dist/components/Chart/Chart.d.ts.map +1 -1
  13. package/dist/components/Chart/Chart.mjs +124 -71
  14. package/dist/components/Chat/components/ChatMarkdown.cjs +1 -1
  15. package/dist/components/Chat/components/ChatMarkdown.d.ts.map +1 -1
  16. package/dist/components/Chat/components/ChatMarkdown.mjs +32 -17
  17. package/dist/components/CodeEditor/CodeEditor.cjs +6 -6
  18. package/dist/components/CodeEditor/CodeEditor.d.ts.map +1 -1
  19. package/dist/components/CodeEditor/CodeEditor.mjs +118 -99
  20. package/dist/components/CollapsibleFolder/CollapsibleFolder.cjs +1 -1
  21. package/dist/components/CollapsibleFolder/CollapsibleFolder.d.ts.map +1 -1
  22. package/dist/components/CollapsibleFolder/CollapsibleFolder.mjs +123 -105
  23. package/dist/components/DatePicker/DatePicker.cjs +1 -1
  24. package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
  25. package/dist/components/DatePicker/DatePicker.mjs +70 -52
  26. package/dist/components/MissingDependencyError.cjs +1 -0
  27. package/dist/components/MissingDependencyError.d.ts +5 -0
  28. package/dist/components/MissingDependencyError.d.ts.map +1 -0
  29. package/dist/components/MissingDependencyError.mjs +140 -0
  30. package/dist/index.cjs +1 -1
  31. package/dist/index.mjs +143 -139
  32. package/dist/styles.css +111 -3
  33. package/dist/theme.css +110 -2
  34. package/dist/utils/index.d.ts +1 -0
  35. package/dist/utils/index.d.ts.map +1 -1
  36. package/dist/utils/optionalDeps.cjs +1 -0
  37. package/dist/utils/optionalDeps.d.ts +63 -0
  38. package/dist/utils/optionalDeps.d.ts.map +1 -0
  39. package/dist/utils/optionalDeps.mjs +55 -0
  40. package/package.json +2 -1
@@ -1,9 +1,16 @@
1
- import { jsxs as k, jsx as l } from "react/jsx-runtime";
2
- import { forwardRef as U, useRef as g, useState as K, useEffect as T } from "react";
3
- import { Prism as W } from "react-syntax-highlighter";
4
- import { oneLight as _, oneDark as I } from "react-syntax-highlighter/dist/esm/styles/prism";
5
- import i from "./CodeEditor.module.css.mjs";
6
- import { useThemeContext as G } from "../../contexts/ThemeContext.mjs";
1
+ import { jsxs as k, jsx as i } from "react/jsx-runtime";
2
+ import { forwardRef as G, useRef as m, useState as B, useEffect as C } from "react";
3
+ import { MissingDependencyError as J } from "../MissingDependencyError.mjs";
4
+ import a from "./CodeEditor.module.css.mjs";
5
+ import { useThemeContext as Q } from "../../contexts/ThemeContext.mjs";
6
+ let K, j, F, U = null;
7
+ try {
8
+ K = require("react-syntax-highlighter").Prism;
9
+ const c = require("react-syntax-highlighter/dist/esm/styles/prism");
10
+ j = c.oneDark, F = c.oneLight;
11
+ } catch (r) {
12
+ U = r instanceof Error ? r : new Error("react-syntax-highlighter not found");
13
+ }
7
14
  try {
8
15
  const r = require("refractor/all");
9
16
  r.default && r.default.registered && r.default.registered("markdown") && !r.default.languages.markdown?.["quoted-string"] && r.default.languages.insertBefore("markdown", "bold", {
@@ -15,149 +22,161 @@ try {
15
22
  });
16
23
  } catch {
17
24
  }
18
- const J = U(
25
+ const X = G(
19
26
  ({
20
27
  value: r = "",
21
- onChange: f,
22
- language: C,
28
+ onChange: c,
29
+ language: T,
23
30
  readOnly: S = !1,
24
- showLineNumbers: L = !0,
25
- placeholder: $,
26
- minRows: m = 10,
27
- className: j,
31
+ showLineNumbers: E = !0,
32
+ placeholder: L,
33
+ minRows: f = 10,
34
+ className: V,
28
35
  "aria-label": H,
29
36
  ...M
30
- }, q) => {
31
- const p = g(null), x = g(null), v = g(null), A = g(null), F = g(null), d = g(null), h = q || F, [y, V] = K(0), [c, z] = K([]);
32
- let E = "dark";
37
+ }, z) => {
38
+ if (U)
39
+ return /* @__PURE__ */ i(
40
+ J,
41
+ {
42
+ available: !1,
43
+ componentName: "CodeEditor",
44
+ depName: "react-syntax-highlighter",
45
+ installCommand: "npm install react-syntax-highlighter",
46
+ pnpmCommand: "pnpm add react-syntax-highlighter",
47
+ docsUrl: "https://docs.orion-ds.dev/components/code-editor"
48
+ }
49
+ );
50
+ const p = m(null), y = m(null), v = m(null), $ = m(null), O = m(null), h = m(null), g = z || O, [x, P] = B(0), [d, W] = B([]);
51
+ let D = "dark";
33
52
  try {
34
- E = G().theme;
53
+ D = Q().theme;
35
54
  } catch {
36
55
  }
37
- const O = E === "light" ? _ : I, R = Math.max(r.split(`
38
- `).length, m);
39
- T(() => {
40
- if (d.current && h.current) {
41
- const { start: e, end: t } = d.current;
42
- h.current.setSelectionRange(e, t), d.current = null;
56
+ const _ = D === "light" ? F : j, R = Math.max(r.split(`
57
+ `).length, f);
58
+ C(() => {
59
+ if (h.current && g.current) {
60
+ const { start: e, end: t } = h.current;
61
+ g.current.setSelectionRange(e, t), h.current = null;
43
62
  }
44
- }), T(() => {
45
- const e = v.current, t = A.current;
63
+ }), C(() => {
64
+ const e = v.current, t = $.current;
46
65
  if (!e || !t) return;
47
66
  const n = () => {
48
67
  const o = t.clientWidth;
49
68
  if (o <= 0) return;
50
69
  e.style.width = `${o}px`;
51
70
  const s = r.split(`
52
- `), u = Math.max(s.length, m), b = [];
53
- for (let N = 0; N < u; N++) {
54
- const P = s[N] ?? "";
55
- e.textContent = P || " ", b.push(e.scrollHeight);
71
+ `), u = Math.max(s.length, f), b = [];
72
+ for (let w = 0; w < u; w++) {
73
+ const I = s[w] ?? "";
74
+ e.textContent = I || " ", b.push(e.scrollHeight);
56
75
  }
57
- z(b);
76
+ W(b);
58
77
  };
59
78
  n();
60
- const a = new ResizeObserver(n);
61
- return a.observe(t), () => a.disconnect();
62
- }, [r, m]), T(() => {
79
+ const l = new ResizeObserver(n);
80
+ return l.observe(t), () => l.disconnect();
81
+ }, [r, f]), C(() => {
63
82
  const e = (n) => {
64
- const a = n.target;
65
- p.current && (p.current.scrollTop = a.scrollTop), x.current && (x.current.scrollTop = a.scrollTop, x.current.scrollLeft = a.scrollLeft);
66
- }, t = h?.current;
83
+ const l = n.target;
84
+ p.current && (p.current.scrollTop = l.scrollTop), y.current && (y.current.scrollTop = l.scrollTop, y.current.scrollLeft = l.scrollLeft);
85
+ }, t = g?.current;
67
86
  if (t)
68
87
  return t.addEventListener("scroll", e), () => {
69
88
  t.removeEventListener("scroll", e);
70
89
  };
71
- }, [h]);
72
- const w = (e) => {
90
+ }, [g]);
91
+ const N = (e) => {
73
92
  const t = e.value.substring(0, e.selectionStart);
74
- V(t.split(`
93
+ P(t.split(`
75
94
  `).length - 1);
76
- }, B = (e) => {
95
+ }, A = (e) => {
77
96
  if (e.key === "Tab") {
78
97
  e.preventDefault();
79
- const t = e.currentTarget, n = t.selectionStart, a = t.selectionEnd, o = " ";
80
- if (n === a) {
81
- const s = r.substring(0, n) + o + r.substring(a);
82
- d.current = {
98
+ const t = e.currentTarget, n = t.selectionStart, l = t.selectionEnd, o = " ";
99
+ if (n === l) {
100
+ const s = r.substring(0, n) + o + r.substring(l);
101
+ h.current = {
83
102
  start: n + o.length,
84
103
  end: n + o.length
85
- }, f?.(s);
104
+ }, c?.(s);
86
105
  } else if (e.shiftKey) {
87
106
  const s = r.lastIndexOf(`
88
107
  `, n - 1) + 1, u = r.substring(s).match(/^ {1,2}/)?.[0] ?? "";
89
108
  if (u.length > 0) {
90
109
  const b = r.substring(0, s) + r.substring(s + u.length);
91
- d.current = {
110
+ h.current = {
92
111
  start: Math.max(s, n - u.length),
93
- end: Math.max(s, a - u.length)
94
- }, f?.(b);
112
+ end: Math.max(s, l - u.length)
113
+ }, c?.(b);
95
114
  }
96
115
  } else {
97
- const s = r.substring(0, n) + o + r.substring(a);
98
- d.current = {
116
+ const s = r.substring(0, n) + o + r.substring(l);
117
+ h.current = {
99
118
  start: n + o.length,
100
119
  end: n + o.length
101
- }, f?.(s);
120
+ }, c?.(s);
102
121
  }
103
122
  }
104
- }, D = [i.wrapper, j].filter(Boolean).join(" ");
105
- return C ? /* @__PURE__ */ k(
123
+ }, q = [a.wrapper, V].filter(Boolean).join(" ");
124
+ return T ? /* @__PURE__ */ k(
106
125
  "div",
107
126
  {
108
- className: D,
127
+ className: q,
109
128
  style: {
110
- minHeight: `calc(${m} * 1.6em + 2 * var(--spacing-4))`
129
+ minHeight: `calc(${f} * 1.6em + 2 * var(--spacing-4))`
111
130
  },
112
131
  children: [
113
- /* @__PURE__ */ l(
132
+ /* @__PURE__ */ i(
114
133
  "div",
115
134
  {
116
135
  ref: v,
117
- className: i.lineMirror,
136
+ className: a.lineMirror,
118
137
  "aria-hidden": "true"
119
138
  }
120
139
  ),
121
- L && /* @__PURE__ */ l(
140
+ E && /* @__PURE__ */ i(
122
141
  "div",
123
142
  {
124
143
  ref: p,
125
- className: i.lineNumbers,
144
+ className: a.lineNumbers,
126
145
  "aria-hidden": "true",
127
- children: Array.from({ length: R }).map((e, t) => /* @__PURE__ */ l(
146
+ children: Array.from({ length: R }).map((e, t) => /* @__PURE__ */ i(
128
147
  "div",
129
148
  {
130
- className: i.lineNumber,
131
- style: c[t] !== void 0 ? { height: `${c[t]}px` } : void 0,
149
+ className: a.lineNumber,
150
+ style: d[t] !== void 0 ? { height: `${d[t]}px` } : void 0,
132
151
  children: t + 1
133
152
  },
134
153
  t
135
154
  ))
136
155
  }
137
156
  ),
138
- /* @__PURE__ */ k("div", { ref: A, className: i.editorArea, children: [
139
- /* @__PURE__ */ l(
157
+ /* @__PURE__ */ k("div", { ref: $, className: a.editorArea, children: [
158
+ /* @__PURE__ */ i(
140
159
  "div",
141
160
  {
142
- className: i.lineHighlight,
161
+ className: a.lineHighlight,
143
162
  style: {
144
- top: c.length > 0 ? `calc(var(--spacing-4) + ${c.slice(0, y).reduce((e, t) => e + t, 0)}px)` : `calc(var(--spacing-4) + ${(y * 1.6).toFixed(2)}em)`,
145
- ...c[y] !== void 0 ? { height: `${c[y]}px` } : {}
163
+ top: d.length > 0 ? `calc(var(--spacing-4) + ${d.slice(0, x).reduce((e, t) => e + t, 0)}px)` : `calc(var(--spacing-4) + ${(x * 1.6).toFixed(2)}em)`,
164
+ ...d[x] !== void 0 ? { height: `${d[x]}px` } : {}
146
165
  },
147
166
  "aria-hidden": "true"
148
167
  }
149
168
  ),
150
- /* @__PURE__ */ l(
169
+ /* @__PURE__ */ i(
151
170
  "div",
152
171
  {
153
- ref: x,
154
- className: i.highlightLayer,
172
+ ref: y,
173
+ className: a.highlightLayer,
155
174
  "aria-hidden": "true",
156
- children: /* @__PURE__ */ l(
157
- W,
175
+ children: /* @__PURE__ */ i(
176
+ K,
158
177
  {
159
- language: C,
160
- style: O,
178
+ language: T,
179
+ style: _,
161
180
  customStyle: {
162
181
  margin: 0,
163
182
  padding: 0,
@@ -184,18 +203,18 @@ const J = U(
184
203
  )
185
204
  }
186
205
  ),
187
- /* @__PURE__ */ l(
206
+ /* @__PURE__ */ i(
188
207
  "textarea",
189
208
  {
190
- ref: h,
191
- className: i.textareaOverlay,
209
+ ref: g,
210
+ className: a.textareaOverlay,
192
211
  value: r,
193
- onChange: (e) => f?.(e.target.value),
194
- onKeyDown: B,
195
- onKeyUp: (e) => w(e.currentTarget),
196
- onMouseUp: (e) => w(e.currentTarget),
197
- onClick: (e) => w(e.currentTarget),
198
- placeholder: $,
212
+ onChange: (e) => c?.(e.target.value),
213
+ onKeyDown: A,
214
+ onKeyUp: (e) => N(e.currentTarget),
215
+ onMouseUp: (e) => N(e.currentTarget),
216
+ onClick: (e) => N(e.currentTarget),
217
+ placeholder: L,
199
218
  readOnly: S,
200
219
  "aria-label": H || "Code editor",
201
220
  spellCheck: "false",
@@ -208,36 +227,36 @@ const J = U(
208
227
  ) : /* @__PURE__ */ k(
209
228
  "div",
210
229
  {
211
- className: D,
212
- style: { minHeight: `calc(${m} * 1.6em + 2 * var(--spacing-4))` },
230
+ className: q,
231
+ style: { minHeight: `calc(${f} * 1.6em + 2 * var(--spacing-4))` },
213
232
  children: [
214
- /* @__PURE__ */ l("div", { ref: v, className: i.lineMirror, "aria-hidden": "true" }),
215
- L && /* @__PURE__ */ l(
233
+ /* @__PURE__ */ i("div", { ref: v, className: a.lineMirror, "aria-hidden": "true" }),
234
+ E && /* @__PURE__ */ i(
216
235
  "div",
217
236
  {
218
237
  ref: p,
219
- className: i.lineNumbers,
238
+ className: a.lineNumbers,
220
239
  "aria-hidden": "true",
221
- children: Array.from({ length: R }).map((e, t) => /* @__PURE__ */ l(
240
+ children: Array.from({ length: R }).map((e, t) => /* @__PURE__ */ i(
222
241
  "div",
223
242
  {
224
- className: i.lineNumber,
225
- style: c[t] !== void 0 ? { height: `${c[t]}px` } : void 0,
243
+ className: a.lineNumber,
244
+ style: d[t] !== void 0 ? { height: `${d[t]}px` } : void 0,
226
245
  children: t + 1
227
246
  },
228
247
  t
229
248
  ))
230
249
  }
231
250
  ),
232
- /* @__PURE__ */ l(
251
+ /* @__PURE__ */ i(
233
252
  "textarea",
234
253
  {
235
- ref: h,
236
- className: i.textarea,
254
+ ref: g,
255
+ className: a.textarea,
237
256
  value: r,
238
- onChange: (e) => f?.(e.target.value),
239
- onKeyDown: B,
240
- placeholder: $,
257
+ onChange: (e) => c?.(e.target.value),
258
+ onKeyDown: A,
259
+ placeholder: L,
241
260
  readOnly: S,
242
261
  "aria-label": H || "Code editor",
243
262
  spellCheck: "false",
@@ -249,7 +268,7 @@ const J = U(
249
268
  );
250
269
  }
251
270
  );
252
- J.displayName = "CodeEditor";
271
+ X.displayName = "CodeEditor";
253
272
  export {
254
- J as CodeEditor
273
+ X as CodeEditor
255
274
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),le=require("@dnd-kit/core"),g=require("lucide-react"),a=require("./CollapsibleFolder.module.css.cjs"),h=require("../Collapsible/Collapsible.cjs"),ne=require("../Badge/Badge.cjs"),F=require("../Dropdown/Dropdown.cjs"),R=require("../Button/Button.cjs");function w(E){const{id:u,title:B,itemCount:x,items:r,renderItem:z,itemLabel:O="Item",itemLabelPlural:k="Items",emptyText:A="No items in this folder",sortLabel:v="Sort",defaultExpanded:$=!0,sortOptions:i,selectedSort:M,onSortChange:P,onDrop:D,onFolderEdit:b,onFolderDelete:j,onFolderInvite:N,isDropTarget:Y=!1,isDropCompleted:H=!1,onDragEnter:Z,onDragLeaveFolder:C,className:_,...G}=E,[f,J]=o.useState($),[m,d]=o.useState(null),[T,p]=o.useState(!1),I=o.useRef(null),{setNodeRef:K}=le.useDroppable({id:u}),Q=t=>{if(t.preventDefault(),t.dataTransfer.dropEffect="move",T||(p(!0),Z?.()),!f||r.length===0){d(0);return}const l=I.current;if(!l)return;const n=Array.from(l.querySelectorAll("[data-item-id]")),ae=t.clientY;let L=n.length;for(let c=0;c<n.length;c++){const S=n[c];if(!S)continue;const q=S.getBoundingClientRect();if(ae<q.top+q.height/2){L=c;break}}d(L)},U=t=>{t.currentTarget.contains(t.relatedTarget)||(p(!1),d(null),C?.())},V=t=>{t.preventDefault();const l=t.dataTransfer.getData("text/plain")||t.dataTransfer.getData("itemId");if(l&&D){const n=m??r.length;D(l,u,n)}p(!1),d(null),C?.()},W=(t,l)=>{t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",l)},X=i?.map(t=>({id:t.value,label:t.label,onClick:()=>P?.(t.value)})),y=[...b?[{id:"rename",label:"Rename",onClick:b}]:[],...N?[{id:"invite",label:"Invite participants",onClick:N}]:[],...j?[{id:"delete",label:"Delete folder",danger:!0,onClick:j}]:[]],s=Y||T,ee=[a.default.folder,s&&a.default.dropTarget,H&&a.default.dropCompleted,_].filter(Boolean).join(" "),te=x===1?O:k;return e.jsx("div",{ref:K,className:ee,"data-folder-id":u,"data-drop-active":s,onDragOver:Q,onDragLeave:U,onDrop:V,...G,children:e.jsxs(h.Collapsible,{open:f,onOpenChange:J,children:[e.jsxs("div",{className:a.default.header,children:[e.jsxs(h.Collapsible.Trigger,{className:a.default.trigger,children:[e.jsx(g.ChevronDown,{size:20,className:`${a.default.chevron} ${f?a.default.expanded:""}`}),e.jsx("h2",{className:a.default.title,children:B}),e.jsxs(ne.Badge,{variant:"secondary",className:a.default.badge,children:[x,e.jsxs("span",{className:a.default.badgeLabel,children:[" ",te]})]})]}),e.jsxs("div",{className:a.default.actions,children:[i&&i.length>0&&e.jsx("div",{className:a.default.sortDropdown,children:e.jsx(F.Dropdown,{trigger:e.jsx(R.Button,{variant:"ghost",size:"sm",iconRight:e.jsx(g.ChevronDown,{size:16}),"aria-label":`Sort by ${v}`,children:i.find(t=>t.value===M)?.label||v}),items:X,placement:"bottom-end"})}),y.length>0&&e.jsx(F.Dropdown,{trigger:e.jsx(R.Button,{variant:"ghost",size:"sm",iconOnly:!0,icon:e.jsx(g.MoreHorizontal,{size:20}),"aria-label":"Folder actions"}),items:y,placement:"bottom-end"})]})]}),e.jsx(h.Collapsible.Content,{children:e.jsx("div",{className:a.default.content,children:r.length===0?s?e.jsx("div",{className:a.default.emptyDropZone,children:e.jsx("div",{className:a.default.insertionLine,role:"presentation"})}):e.jsx("div",{className:a.default.emptyState,children:e.jsx("p",{className:a.default.emptyText,children:A})}):e.jsxs("div",{className:a.default.grid,ref:I,children:[r.map((t,l)=>e.jsxs(o.Fragment,{children:[s&&m===l&&e.jsx("div",{className:a.default.insertionLine,role:"presentation"}),e.jsx("div",{"data-item-id":t.id,draggable:t.draggable,onDragStart:n=>W(n,t.id),children:z(t,l)})]},t.id)),s&&m===r.length&&e.jsx("div",{className:a.default.insertionLine,role:"presentation"})]})})})]})})}w.displayName="CollapsibleFolder";exports.CollapsibleFolder=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),h=require("lucide-react"),re=require("../MissingDependencyError.cjs"),a=require("./CollapsibleFolder.module.css.cjs"),x=require("../Collapsible/Collapsible.cjs"),se=require("../Badge/Badge.cjs"),q=require("../Dropdown/Dropdown.cjs"),F=require("../Button/Button.cjs");let w,R=null;try{w=require("@dnd-kit/core").useDroppable}catch(r){R=r instanceof Error?r:new Error("@dnd-kit/core not found")}function B(r){if(R)return e.jsx(re.MissingDependencyError,{available:!1,componentName:"CollapsibleFolder",depName:["@dnd-kit/core","@dnd-kit/sortable","@dnd-kit/utilities"],installCommand:"npm install @dnd-kit/core @dnd-kit/sortable @dnd-kit/utilities",pnpmCommand:"pnpm add @dnd-kit/core @dnd-kit/sortable @dnd-kit/utilities",docsUrl:"https://docs.orion-ds.dev/components/collapsible-folder"});const{id:p,title:z,itemCount:b,items:s,renderItem:O,itemLabel:A="Item",itemLabelPlural:M="Items",emptyText:K="No items in this folder",sortLabel:v="Sort",defaultExpanded:$=!0,sortOptions:d,selectedSort:P,onSortChange:Y,onDrop:D,onFolderEdit:j,onFolderDelete:C,onFolderInvite:N,isDropTarget:H=!1,isDropCompleted:U=!1,onDragEnter:Z,onDragLeaveFolder:y,className:_,...G}=r,[m,J]=i.useState($),[f,c]=i.useState(null),[T,g]=i.useState(!1),k=i.useRef(null),{setNodeRef:Q}=w({id:p}),V=t=>{if(t.preventDefault(),t.dataTransfer.dropEffect="move",T||(g(!0),Z?.()),!m||s.length===0){c(0);return}const n=k.current;if(!n)return;const l=Array.from(n.querySelectorAll("[data-item-id]")),le=t.clientY;let E=l.length;for(let u=0;u<l.length;u++){const L=l[u];if(!L)continue;const S=L.getBoundingClientRect();if(le<S.top+S.height/2){E=u;break}}c(E)},W=t=>{t.currentTarget.contains(t.relatedTarget)||(g(!1),c(null),y?.())},X=t=>{t.preventDefault();const n=t.dataTransfer.getData("text/plain")||t.dataTransfer.getData("itemId");if(n&&D){const l=f??s.length;D(n,p,l)}g(!1),c(null),y?.()},ee=(t,n)=>{t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",n)},te=d?.map(t=>({id:t.value,label:t.label,onClick:()=>Y?.(t.value)})),I=[...j?[{id:"rename",label:"Rename",onClick:j}]:[],...N?[{id:"invite",label:"Invite participants",onClick:N}]:[],...C?[{id:"delete",label:"Delete folder",danger:!0,onClick:C}]:[]],o=H||T,ae=[a.default.folder,o&&a.default.dropTarget,U&&a.default.dropCompleted,_].filter(Boolean).join(" "),ne=b===1?A:M;return e.jsx("div",{ref:Q,className:ae,"data-folder-id":p,"data-drop-active":o,onDragOver:V,onDragLeave:W,onDrop:X,...G,children:e.jsxs(x.Collapsible,{open:m,onOpenChange:J,children:[e.jsxs("div",{className:a.default.header,children:[e.jsxs(x.Collapsible.Trigger,{className:a.default.trigger,children:[e.jsx(h.ChevronDown,{size:20,className:`${a.default.chevron} ${m?a.default.expanded:""}`}),e.jsx("h2",{className:a.default.title,children:z}),e.jsxs(se.Badge,{variant:"secondary",className:a.default.badge,children:[b,e.jsxs("span",{className:a.default.badgeLabel,children:[" ",ne]})]})]}),e.jsxs("div",{className:a.default.actions,children:[d&&d.length>0&&e.jsx("div",{className:a.default.sortDropdown,children:e.jsx(q.Dropdown,{trigger:e.jsx(F.Button,{variant:"ghost",size:"sm",iconRight:e.jsx(h.ChevronDown,{size:16}),"aria-label":`Sort by ${v}`,children:d.find(t=>t.value===P)?.label||v}),items:te,placement:"bottom-end"})}),I.length>0&&e.jsx(q.Dropdown,{trigger:e.jsx(F.Button,{variant:"ghost",size:"sm",iconOnly:!0,icon:e.jsx(h.MoreHorizontal,{size:20}),"aria-label":"Folder actions"}),items:I,placement:"bottom-end"})]})]}),e.jsx(x.Collapsible.Content,{children:e.jsx("div",{className:a.default.content,children:s.length===0?o?e.jsx("div",{className:a.default.emptyDropZone,children:e.jsx("div",{className:a.default.insertionLine,role:"presentation"})}):e.jsx("div",{className:a.default.emptyState,children:e.jsx("p",{className:a.default.emptyText,children:K})}):e.jsxs("div",{className:a.default.grid,ref:k,children:[s.map((t,n)=>e.jsxs(i.Fragment,{children:[o&&f===n&&e.jsx("div",{className:a.default.insertionLine,role:"presentation"}),e.jsx("div",{"data-item-id":t.id,draggable:t.draggable,onDragStart:l=>ee(l,t.id),children:O(t,n)})]},t.id)),o&&f===s.length&&e.jsx("div",{className:a.default.insertionLine,role:"presentation"})]})})})]})})}B.displayName="CollapsibleFolder";exports.CollapsibleFolder=B;
@@ -1 +1 @@
1
- {"version":3,"file":"CollapsibleFolder.d.ts","sourceRoot":"","sources":["../../../src/components/CollapsibleFolder/CollapsibleFolder.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAQxE,wBAAgB,iBAAiB,CAC/B,KAAK,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,EACjD,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,2CAuQrC;yBAzQe,iBAAiB"}
1
+ {"version":3,"file":"CollapsibleFolder.d.ts","sourceRoot":"","sources":["../../../src/components/CollapsibleFolder/CollapsibleFolder.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAoBxE,wBAAgB,iBAAiB,CAC/B,KAAK,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,EACjD,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,2CAoRrC;yBAtRe,iBAAiB"}