@g4rcez/components 3.0.2 → 4.0.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 (151) hide show
  1. package/dist/CaretDown.es-Cj7klWI3.js +33 -0
  2. package/dist/CaretDown.es-Cj7klWI3.js.map +1 -0
  3. package/dist/CaretRight.es-0-M8D9y8.js +33 -0
  4. package/dist/CaretRight.es-0-M8D9y8.js.map +1 -0
  5. package/dist/CheckCircle.es-C6QWLfk_.js +33 -0
  6. package/dist/CheckCircle.es-C6QWLfk_.js.map +1 -0
  7. package/dist/File.es-CA-vuPED.js +33 -0
  8. package/dist/File.es-CA-vuPED.js.map +1 -0
  9. package/dist/IconBase.es-DJ1oCtpo.js +50 -0
  10. package/dist/IconBase.es-DJ1oCtpo.js.map +1 -0
  11. package/dist/Info.es-CrZKs4q4.js +33 -0
  12. package/dist/Info.es-CrZKs4q4.js.map +1 -0
  13. package/dist/MotionConfigContext-C7MqlSdv.js.map +1 -1
  14. package/dist/Warning.es-D_eI6tLe.js +39 -0
  15. package/dist/Warning.es-D_eI6tLe.js.map +1 -0
  16. package/dist/X.es-BJ1O93El.js +39 -0
  17. package/dist/X.es-BJ1O93El.js.map +1 -0
  18. package/dist/ai/docs/Alert.md +1 -1
  19. package/dist/ai/docs/AnimatedList.md +3 -3
  20. package/dist/ai/docs/Button.md +1 -1
  21. package/dist/ai/docs/CommandPalette.md +7 -7
  22. package/dist/ai/docs/Dropdown.md +4 -4
  23. package/dist/ai/docs/Empty.md +9 -9
  24. package/dist/ai/docs/Expand.md +1 -1
  25. package/dist/ai/docs/FileUpload.md +2 -2
  26. package/dist/ai/docs/Input.md +2 -2
  27. package/dist/ai/docs/InputField.md +2 -2
  28. package/dist/ai/docs/List.md +3 -3
  29. package/dist/ai/docs/Menu.md +3 -3
  30. package/dist/ai/docs/MultiSelect.md +1 -1
  31. package/dist/ai/docs/PageCalendar.md +1 -1
  32. package/dist/ai/docs/Select.md +1 -1
  33. package/dist/ai/docs/Slot.md +1 -1
  34. package/dist/ai/docs/Stats.md +11 -11
  35. package/dist/ai/docs/Table.md +1 -1
  36. package/dist/ai/docs/Tag.md +2 -2
  37. package/dist/ai/docs/Timeline.md +5 -5
  38. package/dist/ai/docs/Toolbar.md +2 -2
  39. package/dist/ai/docs/Tooltip.md +3 -3
  40. package/dist/ai/docs/TransferList.md +2 -2
  41. package/dist/{autocomplete-Boida9R7.js → autocomplete-Cn9Z2hLq.js} +48 -48
  42. package/dist/autocomplete-Cn9Z2hLq.js.map +1 -0
  43. package/dist/{calendar-BswV66Nx.js → calendar-B5lSd0ID.js} +599 -571
  44. package/dist/calendar-B5lSd0ID.js.map +1 -0
  45. package/dist/components/display/alert.js +18 -18
  46. package/dist/components/display/alert.js.map +1 -1
  47. package/dist/components/display/calendar.js +4 -4
  48. package/dist/components/display/card.d.ts +2 -2
  49. package/dist/components/display/card.d.ts.map +1 -1
  50. package/dist/components/display/card.js +6 -6
  51. package/dist/components/display/card.js.map +1 -1
  52. package/dist/components/display/empty.d.ts +2 -2
  53. package/dist/components/display/empty.d.ts.map +1 -1
  54. package/dist/components/display/list.js +15 -15
  55. package/dist/components/display/list.js.map +1 -1
  56. package/dist/components/display/notifications.js +5 -5
  57. package/dist/components/display/tabs.js +1 -1
  58. package/dist/components/floating/command-palette.d.ts +3 -3
  59. package/dist/components/floating/command-palette.d.ts.map +1 -1
  60. package/dist/components/floating/dropdown.js +1 -1
  61. package/dist/components/floating/expand.js +1 -1
  62. package/dist/components/floating/menu.d.ts +2 -2
  63. package/dist/components/floating/menu.d.ts.map +1 -1
  64. package/dist/components/floating/menu.js +31 -31
  65. package/dist/components/floating/menu.js.map +1 -1
  66. package/dist/components/floating/modal.js +35 -35
  67. package/dist/components/floating/modal.js.map +1 -1
  68. package/dist/components/floating/tooltip.js +1 -1
  69. package/dist/components/form/autocomplete.js +5 -5
  70. package/dist/components/form/date-picker.js +3 -3
  71. package/dist/components/form/file-upload.d.ts.map +1 -1
  72. package/dist/components/form/file-upload.js +3 -3
  73. package/dist/components/form/input-field.d.ts.map +1 -1
  74. package/dist/components/form/input.js +1 -1
  75. package/dist/components/form/select.js +29 -29
  76. package/dist/components/form/select.js.map +1 -1
  77. package/dist/components/form/task-list.js.map +1 -1
  78. package/dist/components/form/transfer-list.js +15 -15
  79. package/dist/components/form/transfer-list.js.map +1 -1
  80. package/dist/components/page-calendar/calendar-header.d.ts.map +1 -1
  81. package/dist/components/page-calendar/day-view.d.ts.map +1 -1
  82. package/dist/components/page-calendar/month-view.d.ts.map +1 -1
  83. package/dist/components/page-calendar/page-calendar.utils.d.ts +6 -0
  84. package/dist/components/page-calendar/page-calendar.utils.d.ts.map +1 -1
  85. package/dist/components/page-calendar/week-view.d.ts.map +1 -1
  86. package/dist/components/table/table.js +3 -3
  87. package/dist/config/context.d.ts +2 -0
  88. package/dist/config/context.d.ts.map +1 -1
  89. package/dist/context-BFXNJVn2.js.map +1 -1
  90. package/dist/{date-picker-BxPTdZPy.js → date-picker-DwNo22lx.js} +316 -288
  91. package/dist/date-picker-DwNo22lx.js.map +1 -0
  92. package/dist/{file-upload-BB6BdGcE.js → file-upload-Brf2NkLr.js} +1103 -976
  93. package/dist/file-upload-Brf2NkLr.js.map +1 -0
  94. package/dist/{floating-ui.react-DycKASR0.js → floating-ui.react-QNHG9W4N.js} +205 -205
  95. package/dist/{floating-ui.react-DycKASR0.js.map → floating-ui.react-QNHG9W4N.js.map} +1 -1
  96. package/dist/hooks/use-components-provider.d.ts.map +1 -1
  97. package/dist/index-0YMC-_Lt.js.map +1 -1
  98. package/dist/index-BelDtX5M.js +1821 -0
  99. package/dist/index-BelDtX5M.js.map +1 -0
  100. package/dist/{index-BtlhELJ3.js → index-C-PuFUZi.js} +136 -136
  101. package/dist/index-C-PuFUZi.js.map +1 -0
  102. package/dist/index-Z-fZHxfJ.js +335 -0
  103. package/dist/index-Z-fZHxfJ.js.map +1 -0
  104. package/dist/index-t1qLJTt5.js.map +1 -1
  105. package/dist/index.css +1 -1
  106. package/dist/index.js +2583 -2463
  107. package/dist/index.js.map +1 -1
  108. package/dist/{input-CoJoHIhd.js → input-CrGrSnUt.js} +2 -2
  109. package/dist/{input-CoJoHIhd.js.map → input-CrGrSnUt.js.map} +1 -1
  110. package/dist/input-field-5vYcz5tT.js +166 -0
  111. package/dist/input-field-5vYcz5tT.js.map +1 -0
  112. package/dist/notifications-cUdVPs-B.js +2786 -0
  113. package/dist/notifications-cUdVPs-B.js.map +1 -0
  114. package/dist/proxy-BZcQiBrp.js.map +1 -1
  115. package/dist/{slot-CQW8ZzBb.js → slot-CRyweuj0.js} +5 -5
  116. package/dist/{slot-CQW8ZzBb.js.map → slot-CRyweuj0.js.map} +1 -1
  117. package/dist/{tabs-ccIA7vMo.js → tabs-S00a8qq8.js} +5 -5
  118. package/dist/{tabs-ccIA7vMo.js.map → tabs-S00a8qq8.js.map} +1 -1
  119. package/dist/use-motion-value-eGwNuWuw.js.map +1 -1
  120. package/package.json +2 -2
  121. package/dist/autocomplete-Boida9R7.js.map +0 -1
  122. package/dist/calendar-BswV66Nx.js.map +0 -1
  123. package/dist/chevron-down-BBFYYzZq.js +0 -6
  124. package/dist/chevron-down-BBFYYzZq.js.map +0 -1
  125. package/dist/chevron-right-DvXGOiS_.js +0 -6
  126. package/dist/chevron-right-DvXGOiS_.js.map +0 -1
  127. package/dist/circle-check-big-3M5lhTxx.js +0 -9
  128. package/dist/circle-check-big-3M5lhTxx.js.map +0 -1
  129. package/dist/createLucideIcon-CP-mMPfa.js +0 -76
  130. package/dist/createLucideIcon-CP-mMPfa.js.map +0 -1
  131. package/dist/date-picker-BxPTdZPy.js.map +0 -1
  132. package/dist/file-CBCP85VI.js +0 -15
  133. package/dist/file-CBCP85VI.js.map +0 -1
  134. package/dist/file-upload-BB6BdGcE.js.map +0 -1
  135. package/dist/index-BJ1ayTam.js +0 -126
  136. package/dist/index-BJ1ayTam.js.map +0 -1
  137. package/dist/index-BtlhELJ3.js.map +0 -1
  138. package/dist/index-ChfR6F8d.js +0 -1590
  139. package/dist/index-ChfR6F8d.js.map +0 -1
  140. package/dist/index-DE4shK8D.js +0 -215
  141. package/dist/index-DE4shK8D.js.map +0 -1
  142. package/dist/info-N5jWZg2A.js +0 -10
  143. package/dist/info-N5jWZg2A.js.map +0 -1
  144. package/dist/input-field-DTeIrwpK.js +0 -146
  145. package/dist/input-field-DTeIrwpK.js.map +0 -1
  146. package/dist/notifications-NPuFDsBp.js +0 -2550
  147. package/dist/notifications-NPuFDsBp.js.map +0 -1
  148. package/dist/triangle-alert-CHMhQ6yd.js +0 -16
  149. package/dist/triangle-alert-CHMhQ6yd.js.map +0 -1
  150. package/dist/x-B9bYxG31.js +0 -9
  151. package/dist/x-B9bYxG31.js.map +0 -1
@@ -1,1590 +0,0 @@
1
- import { jsx as a, jsxs as b } from "react/jsx-runtime";
2
- import O, { createContext as se, useRef as A, useState as _, useCallback as W, useContext as q, useMemo as T, forwardRef as Le, useEffect as z, useId as nt, Fragment as N, createElement as ot } from "react";
3
- import { u as Pe } from "./index-BJ1ayTam.js";
4
- import { u as De } from "./input-field-DTeIrwpK.js";
5
- import { X as st } from "./index-BtlhELJ3.js";
6
- import { I as Oe, k as at } from "./dom-Dl8XH0CK.js";
7
- import { u as ee } from "./use-stable-ref-CYh-YkID.js";
8
- import { u as F } from "./use-translations-BwLKTrZv.js";
9
- import { F as lt } from "./file-CBCP85VI.js";
10
- import { S as _e } from "./skeleton-D75GFBV6.js";
11
- import { P as J } from "./polymorph-B5n9fs_K.js";
12
- import { p as it, i as te, u as ae } from "./fns-D2eyJKd5.js";
13
- import { Dropdown as V } from "./components/floating/dropdown.js";
14
- import { Select as E } from "./components/form/select.js";
15
- import { c as C } from "./createLucideIcon-CP-mMPfa.js";
16
- import { I as ze } from "./input-CoJoHIhd.js";
17
- import { u as Ge, L as ye, m as le, A as ie } from "./proxy-BZcQiBrp.js";
18
- import { B as ct, C as je, D as ut, E as K, u as U, m as dt, F as ht, l as We, d as mt } from "./MotionConfigContext-C7MqlSdv.js";
19
- import { u as ce } from "./use-motion-value-eGwNuWuw.js";
20
- import { Button as ft } from "./components/core/button.js";
21
- const gt = [
22
- ["path", { d: "m3 16 4 4 4-4", key: "1co6wj" }],
23
- ["path", { d: "M7 20V4", key: "1yoxec" }],
24
- ["rect", { x: "15", y: "4", width: "4", height: "6", ry: "2", key: "1bwicg" }],
25
- ["path", { d: "M17 20v-6h-2", key: "1qp1so" }],
26
- ["path", { d: "M15 20h4", key: "1j968p" }]
27
- ], pt = C("arrow-down-0-1", gt);
28
- const yt = [
29
- ["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
30
- ["path", { d: "M7 4v16", key: "1glfcx" }],
31
- ["rect", { x: "15", y: "4", width: "4", height: "6", ry: "2", key: "1bwicg" }],
32
- ["path", { d: "M17 20v-6h-2", key: "1qp1so" }],
33
- ["path", { d: "M15 20h4", key: "1j968p" }]
34
- ], bt = C("arrow-up-0-1", yt);
35
- const vt = [
36
- ["path", { d: "m21 16-4 4-4-4", key: "f6ql7i" }],
37
- ["path", { d: "M17 20V4", key: "1ejh1v" }],
38
- ["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
39
- ["path", { d: "M7 4v16", key: "1glfcx" }]
40
- ], qe = C("arrow-up-down", vt);
41
- const wt = [
42
- ["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
43
- ["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
44
- ["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
45
- ["circle", { cx: "15", cy: "12", r: "1", key: "1tmaij" }],
46
- ["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
47
- ["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
48
- ], St = C("grip-vertical", wt);
49
- const xt = [
50
- ["path", { d: "M2 5h20", key: "1fs1ex" }],
51
- ["path", { d: "M6 12h12", key: "8npq4p" }],
52
- ["path", { d: "M9 19h6", key: "456am0" }]
53
- ], Nt = C("list-filter", xt);
54
- const Ct = [
55
- ["path", { d: "M5 12h14", key: "1ays0h" }],
56
- ["path", { d: "M12 5v14", key: "s699le" }]
57
- ], ue = C("plus", Ct);
58
- const kt = [
59
- ["path", { d: "m8 11 2 2 4-4", key: "1sed1v" }],
60
- ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
61
- ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
62
- ], At = C("search-check", kt);
63
- const Ft = [
64
- ["path", { d: "m13.5 8.5-5 5", key: "1cs55j" }],
65
- ["path", { d: "m8.5 8.5 5 5", key: "a8mexj" }],
66
- ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
67
- ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
68
- ], It = C("search-x", Ft);
69
- const Tt = [
70
- ["path", { d: "M10 11v6", key: "nco0om" }],
71
- ["path", { d: "M14 11v6", key: "outv1u" }],
72
- ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
73
- ["path", { d: "M3 6h18", key: "d0wm0j" }],
74
- ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
75
- ], H = C("trash-2", Tt);
76
- const $t = [
77
- ["rect", { width: "8", height: "6", x: "5", y: "4", rx: "1", key: "nzclkv" }],
78
- ["rect", { width: "8", height: "6", x: "11", y: "14", rx: "1", key: "4tytwb" }]
79
- ], Et = C("ungroup", $t);
80
- function Mt(...e) {
81
- const t = !Array.isArray(e[0]), r = t ? 0 : -1, n = e[0 + r], o = e[1 + r], s = e[2 + r], i = e[3 + r], c = ct(o, s, i);
82
- return t ? c(n) : c;
83
- }
84
- const Rt = (e) => !e.isLayoutDirty && e.willUpdate(!1);
85
- function be() {
86
- const e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new WeakMap(), r = () => e.forEach(Rt);
87
- return {
88
- add: (n) => {
89
- e.add(n), t.set(n, n.addEventListener("willUpdate", r));
90
- },
91
- remove: (n) => {
92
- e.delete(n);
93
- const o = t.get(n);
94
- o && (o(), t.delete(n)), r();
95
- },
96
- dirty: r
97
- };
98
- }
99
- const Lt = se(null);
100
- function Pt() {
101
- const e = A(!1);
102
- return Ge(() => (e.current = !0, () => {
103
- e.current = !1;
104
- }), []), e;
105
- }
106
- function Dt() {
107
- const e = Pt(), [t, r] = _(0), n = W(() => {
108
- e.current && r(t + 1);
109
- }, [t]);
110
- return [W(() => je.postRender(n), [n]), t];
111
- }
112
- const Be = (e) => e === !0, Ot = (e) => Be(e === !0) || e === "id", _t = ({ children: e, id: t, inherit: r = !0 }) => {
113
- const n = q(ye), o = q(Lt), [s, i] = Dt(), c = A(null), l = n.id || o;
114
- c.current === null && (Ot(r) && l && (t = t ? l + "-" + t : l), c.current = {
115
- id: t,
116
- group: Be(r) && n.group || be()
117
- });
118
- const u = T(() => ({ ...c.current, forceRender: s }), [i]);
119
- return a(ye.Provider, { value: u, children: e });
120
- };
121
- function Ve(e, t) {
122
- const r = ce(t()), n = () => r.set(t());
123
- return n(), Ge(() => {
124
- const o = () => je.preRender(n, !1, !0), s = e.map((i) => i.on("change", o));
125
- return () => {
126
- s.forEach((i) => i()), ut(n);
127
- };
128
- }), r;
129
- }
130
- function zt(e) {
131
- K.current = [], e();
132
- const t = Ve(K.current, e);
133
- return K.current = void 0, t;
134
- }
135
- function Gt(e, t, r, n) {
136
- if (typeof e == "function")
137
- return zt(e);
138
- const s = typeof t == "function" ? t : Mt(t, r, n), i = Array.isArray(e) ? ve(e, s) : ve([e], ([l]) => s(l)), c = Array.isArray(e) ? void 0 : e.accelerate;
139
- return c && !c.isTransformed && typeof t != "function" && Array.isArray(r) && n?.clamp !== !1 && (i.accelerate = {
140
- ...c,
141
- times: t,
142
- keyframes: r,
143
- isTransformed: !0
144
- }), i;
145
- }
146
- function ve(e, t) {
147
- const r = U(() => []);
148
- return Ve(e, () => {
149
- r.length = 0;
150
- const n = e.length;
151
- for (let o = 0; o < n; o++)
152
- r[o] = e[o].get();
153
- return t(r);
154
- });
155
- }
156
- class jt {
157
- constructor() {
158
- this.componentControls = /* @__PURE__ */ new Set();
159
- }
160
- /**
161
- * Subscribe a component's internal `VisualElementDragControls` to the user-facing API.
162
- *
163
- * @internal
164
- */
165
- subscribe(t) {
166
- return this.componentControls.add(t), () => this.componentControls.delete(t);
167
- }
168
- /**
169
- * Start a drag gesture on every `motion` component that has this set of drag controls
170
- * passed into it via the `dragControls` prop.
171
- *
172
- * ```jsx
173
- * dragControls.start(e, {
174
- * snapToCursor: true
175
- * })
176
- * ```
177
- *
178
- * @param event - PointerEvent
179
- * @param options - Options
180
- *
181
- * @public
182
- */
183
- start(t, r) {
184
- this.componentControls.forEach((n) => {
185
- n.start(t.nativeEvent || t, r);
186
- });
187
- }
188
- /**
189
- * Cancels a drag gesture.
190
- *
191
- * ```jsx
192
- * dragControls.cancel()
193
- * ```
194
- *
195
- * @public
196
- */
197
- cancel() {
198
- this.componentControls.forEach((t) => {
199
- t.cancel();
200
- });
201
- }
202
- /**
203
- * Stops a drag gesture.
204
- *
205
- * ```jsx
206
- * dragControls.stop()
207
- * ```
208
- *
209
- * @public
210
- */
211
- stop() {
212
- this.componentControls.forEach((t) => {
213
- t.stop();
214
- });
215
- }
216
- }
217
- const Wt = () => new jt();
218
- function qt() {
219
- return U(Wt);
220
- }
221
- const Ue = se(null);
222
- function Bt(e, t, r, n) {
223
- if (!n)
224
- return e;
225
- const o = e.findIndex((h) => h.value === t);
226
- if (o === -1)
227
- return e;
228
- const s = n > 0 ? 1 : -1, i = e[o + s];
229
- if (!i)
230
- return e;
231
- const c = e[o], l = i.layout, u = dt(l.min, l.max, 0.5);
232
- return s === 1 && c.layout.max + r > u || s === -1 && c.layout.min + r < u ? ht(e, o, o + s) : e;
233
- }
234
- function Vt({ children: e, as: t = "ul", axis: r = "y", onReorder: n, values: o, ...s }, i) {
235
- const c = U(() => le[t]), l = [], u = A(!1), h = A(null);
236
- We(!!o, "Reorder.Group must be provided a values prop", "reorder-values");
237
- const f = {
238
- axis: r,
239
- groupRef: h,
240
- registerItem: (S, g) => {
241
- const d = l.findIndex((m) => S === m.value);
242
- d !== -1 ? l[d].layout = g[r] : l.push({ value: S, layout: g[r] }), l.sort(Ht);
243
- },
244
- updateOrder: (S, g, d) => {
245
- if (u.current)
246
- return;
247
- const m = Bt(l, S, g, d);
248
- l !== m && (u.current = !0, n(m.map(Ut).filter((y) => o.indexOf(y) !== -1)));
249
- }
250
- };
251
- z(() => {
252
- u.current = !1;
253
- });
254
- const p = (S) => {
255
- h.current = S, typeof i == "function" ? i(S) : i && (i.current = S);
256
- }, w = {
257
- overflowAnchor: "none",
258
- ...s.style
259
- };
260
- return a(c, { ...s, style: w, ref: p, ignoreStrict: !0, children: a(Ue.Provider, { value: f, children: e }) });
261
- }
262
- const He = /* @__PURE__ */ Le(Vt);
263
- function Ut(e) {
264
- return e.value;
265
- }
266
- function Ht(e, t) {
267
- return e.layout.min - t.layout.min;
268
- }
269
- const G = 50, we = 25, Xt = /* @__PURE__ */ new Set(["auto", "scroll"]), L = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap();
270
- let R = null;
271
- function Jt() {
272
- if (R) {
273
- const e = re(R, "y");
274
- e && (P.delete(e), L.delete(e));
275
- const t = re(R, "x");
276
- t && t !== e && (P.delete(t), L.delete(t)), R = null;
277
- }
278
- }
279
- function Kt(e, t) {
280
- const r = getComputedStyle(e), n = t === "x" ? r.overflowX : r.overflowY, o = e === document.body || e === document.documentElement;
281
- return Xt.has(n) || o;
282
- }
283
- function re(e, t) {
284
- let r = e?.parentElement;
285
- for (; r; ) {
286
- if (Kt(r, t))
287
- return r;
288
- r = r.parentElement;
289
- }
290
- return null;
291
- }
292
- function Yt(e, t, r) {
293
- const n = t.getBoundingClientRect(), o = r === "x" ? Math.max(0, n.left) : Math.max(0, n.top), s = r === "x" ? Math.min(window.innerWidth, n.right) : Math.min(window.innerHeight, n.bottom), i = e - o, c = s - e;
294
- if (i < G) {
295
- const l = 1 - i / G;
296
- return { amount: -we * l * l, edge: "start" };
297
- } else if (c < G) {
298
- const l = 1 - c / G;
299
- return { amount: we * l * l, edge: "end" };
300
- }
301
- return { amount: 0, edge: null };
302
- }
303
- function Qt(e, t, r, n) {
304
- if (!e)
305
- return;
306
- R = e;
307
- const o = re(e, r);
308
- if (!o)
309
- return;
310
- const s = t - (r === "x" ? window.scrollX : window.scrollY), { amount: i, edge: c } = Yt(s, o, r);
311
- if (c === null) {
312
- P.delete(o), L.delete(o);
313
- return;
314
- }
315
- const l = P.get(o), u = o === document.body || o === document.documentElement;
316
- if (l !== c) {
317
- if (!(c === "start" && n < 0 || c === "end" && n > 0))
318
- return;
319
- P.set(o, c);
320
- const f = r === "x" ? o.scrollWidth - (u ? window.innerWidth : o.clientWidth) : o.scrollHeight - (u ? window.innerHeight : o.clientHeight);
321
- L.set(o, f);
322
- }
323
- if (i > 0) {
324
- const h = L.get(o);
325
- if ((r === "x" ? u ? window.scrollX : o.scrollLeft : u ? window.scrollY : o.scrollTop) >= h)
326
- return;
327
- }
328
- r === "x" ? u ? window.scrollBy({ left: i }) : o.scrollLeft += i : u ? window.scrollBy({ top: i }) : o.scrollTop += i;
329
- }
330
- function Se(e, t = 0) {
331
- return mt(e) ? e : ce(t);
332
- }
333
- function Zt({ children: e, style: t = {}, value: r, as: n = "li", onDrag: o, onDragEnd: s, layout: i = !0, ...c }, l) {
334
- const u = U(() => le[n]), h = q(Ue), f = {
335
- x: Se(t.x),
336
- y: Se(t.y)
337
- }, p = Gt([f.x, f.y], ([m, y]) => m || y ? 1 : "unset");
338
- We(!!h, "Reorder.Item must be a child of Reorder.Group", "reorder-item-child");
339
- const { axis: w, registerItem: S, updateOrder: g, groupRef: d } = h;
340
- return a(u, { drag: w, ...c, dragSnapToOrigin: !0, style: { ...t, x: f.x, y: f.y, zIndex: p }, layout: i, onDrag: (m, y) => {
341
- const { velocity: v, point: x } = y, k = f[w].get();
342
- g(r, k, v[w]), Qt(d.current, x[w], w, v[w]), o && o(m, y);
343
- }, onDragEnd: (m, y) => {
344
- Jt(), s && s(m, y);
345
- }, onLayoutMeasure: (m) => {
346
- S(r, m);
347
- }, ref: l, ignoreStrict: !0, children: e });
348
- }
349
- const Xe = /* @__PURE__ */ Le(Zt);
350
- var er = Object.defineProperty, xe = Object.getOwnPropertySymbols, tr = Object.prototype.hasOwnProperty, rr = Object.prototype.propertyIsEnumerable, Ne = (e, t, r) => t in e ? er(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, nr = (e, t) => {
351
- for (var r in t || (t = {}))
352
- tr.call(t, r) && Ne(e, r, t[r]);
353
- if (xe)
354
- for (var r of xe(t))
355
- rr.call(t, r) && Ne(e, r, t[r]);
356
- return e;
357
- }, de = (e, t) => {
358
- const r = e.length;
359
- for (let n = 0; n < r; n++)
360
- if (t(e[n], n, e))
361
- return !0;
362
- return !1;
363
- }, or = (e, t, r, n) => X(de, e, t, r, n), M = (e) => typeof e == "object", I = (e, t) => {
364
- if (e === t)
365
- return !0;
366
- if (e instanceof Date && t instanceof Date)
367
- return e.getTime() === t.getTime();
368
- if (!e || !t || !M(e) && !M(t))
369
- return e === t;
370
- if (e.prototype !== t.prototype)
371
- return !1;
372
- const r = Object.keys(e);
373
- return r.length !== Object.keys(t).length ? !1 : r.every((n) => I(e[n], t[n]));
374
- }, sr = (e, t) => (M(e) || Array.isArray(e)) && t ? e[t] : e, ar = (e) => (t, r) => t[e] === r[e] ? 0 : t[e] > r[e] ? 1 : -1, B = (e) => /[0-9.]+/.test(e), Ce = (e) => ["string", "number"].includes(typeof e), ke = (e) => e == null || e?.length === 0 || e === "", Ae = {
375
- eq: I,
376
- is: Object.is,
377
- "!=": (e, t) => e != t,
378
- "!==": (e, t) => e !== t,
379
- "<": (e, t) => e < t,
380
- "<=": (e, t) => e <= t,
381
- "==": (e, t) => e == t,
382
- "===": (e, t) => e === t,
383
- ">": (e, t) => e > t,
384
- ">=": (e, t) => e >= t,
385
- includes: (e, t) => `${e}`.includes(t),
386
- notIncludes: (e, t) => !`${e}`.includes(t),
387
- startsWith: (e, t) => `${e}`.startsWith(t),
388
- endsWith: (e, t) => `${e}`.endsWith(t),
389
- like: (e, t) => new RegExp(`.*${t}.*`, "gi").test(`${e}`),
390
- alphabetical: (e, t) => e.toString().localeCompare(t.toString()),
391
- empty: ke,
392
- notEmpty: (e) => !ke(e),
393
- in: (e, t) => de(t, (r) => I(e, r)),
394
- notIn: (e, t) => Je(t, (r) => !I(e, r))
395
- }, lr = (e) => {
396
- if (e in Ae)
397
- return Ae[e];
398
- throw new Error("Linq - Symbol not found");
399
- }, $ = (e, t) => {
400
- const r = [], n = e.length;
401
- for (let o = 0; o < n; o++)
402
- t(e[o], o, e) && r.push(e[o]);
403
- return r;
404
- }, X = (e, t, r, n, o) => {
405
- if (typeof r == "function")
406
- return e(t, r);
407
- const s = lr(n);
408
- return r && n && o !== void 0 ? e(t, (i) => s(i[r], o)) : e(t, (i) => s(i, o));
409
- }, ir = (e, t, r, n) => X($, e, t, r, n), Je = (e, t) => {
410
- for (let r = 0; r < e.length; r++)
411
- if (!t(e[r], r, e))
412
- return !1;
413
- return !0;
414
- }, cr = (e, t, r, n) => X(Je, e, t, r, n), Ke = (e) => {
415
- if (e === null)
416
- return null;
417
- const t = nr({}, e);
418
- return Object.keys(t).forEach((r) => t[r] = M(e[r]) ? Ke(e[r]) : e[r]), Array.isArray(e) && e.length ? (t.length = e.length) && Array.from(t) : Array.isArray(e) ? Array.from(e) : t;
419
- }, Fe = (e, t) => {
420
- if (M(t)) {
421
- for (let r = 0; r < e.length; r++) {
422
- const n = e[r];
423
- if (I(t, n))
424
- return !0;
425
- }
426
- return !1;
427
- }
428
- for (let r = 0; r < e.length; r++) {
429
- const n = e[r];
430
- if (I(t, n))
431
- return !0;
432
- }
433
- return !1;
434
- }, ur = (e, t) => {
435
- const r = new Map(e.map((n) => [n[t], n]));
436
- return Object.fromEntries(r.entries());
437
- }, dr = (e) => $(
438
- e,
439
- (t, r, n) => M(t) ? r === n.findIndex((o) => I(o, t)) : r === n.indexOf(t)
440
- ), hr = (e, t) => {
441
- const r = e.length;
442
- for (let n = 0; n < r; n++)
443
- if (t(e[n], n, e))
444
- return e[n];
445
- }, Ye = (e, t) => {
446
- const r = /* @__PURE__ */ new Map();
447
- return e.forEach((n) => {
448
- const o = t(n), s = r.get(o) || [];
449
- s.push(n), r.set(o, s);
450
- }), Object.fromEntries(r.entries());
451
- }, mr = (e, t) => Ye(e, (r) => r[t]), Ie = (e, t) => {
452
- const r = [];
453
- let n = 0;
454
- const o = e.length;
455
- for (n; n < o; n++) {
456
- const s = t(e[n], n, e);
457
- r.push(s);
458
- }
459
- return r;
460
- }, fr = (e, t) => {
461
- let r = Number.parseInt(e, 10), n = Number.parseInt(t, 10);
462
- return r > n ? [n, r] : [r, n];
463
- }, gr = (e, t, r = 1) => {
464
- const n = [];
465
- let o = e.charCodeAt(0);
466
- const s = t.charCodeAt(0);
467
- for (; o <= s; o += r)
468
- n.push(String.fromCharCode(o));
469
- return B(e) && B(t) ? n.map((i) => Number.parseInt(i)) : n;
470
- }, Y = (e, t, r = 1) => {
471
- let n = Math.abs(r);
472
- if ((e.length > 1 || t.length > 1) && B(e) && B(t)) {
473
- const o = [], [s, i] = fr(e, t);
474
- for (let c = s; c <= i; c += n)
475
- o.push(c);
476
- return o;
477
- }
478
- return gr(e, t, n);
479
- }, pr = (e, t, r = 1) => {
480
- if (t === void 0) {
481
- const [n, o, s] = e.split("..");
482
- return s === void 0 ? Y(n, o, 1) : Y(n, s, Number.parseInt(o, 10));
483
- }
484
- return Ce(e) && Ce(t) ? Y(`${e}`, `${t}`, r) : Array.from({ length: e }, (n, o) => o * Math.abs(t));
485
- }, Q = (e, t, r) => {
486
- let n = t;
487
- const o = r.length;
488
- for (let s = 0; s < o; s++) {
489
- const i = r[s];
490
- n = e(n, i, s, r);
491
- }
492
- return n;
493
- }, Te = (e) => {
494
- const t = Array.from(e.values());
495
- let r = null, n = null, o = t.length;
496
- for (r = 0; r < o / 2; r += 1) {
497
- n = o - 1 - r;
498
- let s = t[r];
499
- t[r] = t[n], t[n] = s;
500
- }
501
- return t;
502
- }, yr = (e, t) => {
503
- if (typeof t == "number")
504
- return e.slice(t);
505
- let r = e.length;
506
- for (let n = 0; n < r; n++) {
507
- const o = e[n];
508
- if (t(o, n, e))
509
- return e.slice(n);
510
- }
511
- return e.slice(0);
512
- }, br = (e, t, r, n) => X(yr, e, t, r, n), $e = (e, t) => {
513
- const r = [...e];
514
- return t === void 0 ? r.sort() : typeof t == "function" ? r.toSorted(t) : r.toSorted(ar(t));
515
- }, Qe = /* @__PURE__ */ ((e) => (e.Asc = "asc", e.Desc = "desc", e))(Qe || {}), vr = (e) => (t, r) => e.reduce((n, o) => {
516
- const s = o.type === "desc" ? -1 : 1, i = o.key, c = t[i] > r[i] ? s : t[i] < r[i] ? -s : 0;
517
- return n !== 0 ? n : c;
518
- }, 0), wr = (e, t) => e.sort(vr(t)), Sr = (e, t) => {
519
- if (t === void 0)
520
- return [...new Set(e).values()];
521
- const r = /* @__PURE__ */ new Set();
522
- return Array.isArray(t) ? [...new Set(t)] : $(e, (n) => {
523
- const o = t ? r.has(n[t]) : r.has(t);
524
- return t && (o || r.add(n[t])), !o;
525
- });
526
- }, xr = class ne {
527
- constructor(t = []) {
528
- this.array = t;
529
- }
530
- static Range(...t) {
531
- return pr(...t);
532
- }
533
- static New(t) {
534
- return new ne(t);
535
- }
536
- Where(t, r, n) {
537
- return this.array = ir(this.array, t, r, n), this;
538
- }
539
- Some(t, r, n) {
540
- return or(this.array, t, r, n);
541
- }
542
- All(t, r, n) {
543
- return cr(this.array, t, r, n);
544
- }
545
- Reverse() {
546
- return this.array = Te(this.array), this;
547
- }
548
- Add(t) {
549
- return this.array = Array.isArray(t) ? this.array.concat(t) : this.array.concat([t]), this;
550
- }
551
- Prepend(t) {
552
- return this.array = Array.isArray(t) ? t.concat(this.array) : [t].concat(this.array), this;
553
- }
554
- Select(t) {
555
- return t === void 0 ? this.array : this.array.map(t);
556
- }
557
- Take(t, r) {
558
- return r !== void 0 ? this.array = this.array.slice(t, Math.max(0, r)) : this.array = this.array.slice(t), this;
559
- }
560
- Head() {
561
- return this.array[0];
562
- }
563
- Tail() {
564
- return this.Skip(1);
565
- }
566
- Skip(t, r, n) {
567
- return this.array = br(this.array, t, r, n), this;
568
- }
569
- Distinct() {
570
- return this.array = dr(this.array), this;
571
- }
572
- First(t) {
573
- return t === void 0 ? this.array[0] : hr(this.array, t) || null;
574
- }
575
- Last(t) {
576
- const r = this.array.length;
577
- if (t === void 0)
578
- return this.array[r - 1];
579
- for (let n = r; n !== 0; n--)
580
- if (t(this.array[n], n, this.array))
581
- return this.array[n];
582
- }
583
- Sum(t) {
584
- return t === void 0 ? Q((r, n) => r + n, 0, this.array) : Q((r, n) => r + sr(n, t), 0, this.array);
585
- }
586
- Average(t) {
587
- return this.Sum(t) / this.array.length;
588
- }
589
- GroupBy(t) {
590
- return mr(this.array, t);
591
- }
592
- GroupWith(t) {
593
- return Ye(this.array, t);
594
- }
595
- Except(t) {
596
- return $(this.array, (r) => !Fe(t, r));
597
- }
598
- Intersect(t) {
599
- return $(this.array, (r) => Fe(t, r));
600
- }
601
- OrderBy(t, r) {
602
- let n;
603
- return n = t ? $e(this.array, t) : this.array.toSorted(), this.array = r === "desc" ? Te(n) : n, this;
604
- }
605
- Includes(t) {
606
- return de(this.array, (r) => I(r, t));
607
- }
608
- In(t) {
609
- const r = t.length;
610
- for (let n = 0; n < r; n++) {
611
- const o = t[n];
612
- if (this.Includes(o))
613
- return !0;
614
- }
615
- return !1;
616
- }
617
- Reduce(t, r) {
618
- return Q(t, r ?? this.array[0], this.array);
619
- }
620
- Empty() {
621
- return this.array.length === 0;
622
- }
623
- ToMap(t) {
624
- return new Map(Ie(this.array, (r) => [t, r]));
625
- }
626
- Zip(t, r) {
627
- return Ie(this.array, (n, o) => r(n, t[o]));
628
- }
629
- Count(t) {
630
- return t === void 0 ? this.array.length : $(this.array, t).length;
631
- }
632
- Get(t) {
633
- return this.array[t];
634
- }
635
- Clone() {
636
- return new ne(Ke(this.array));
637
- }
638
- ToObject(t) {
639
- return ur(this.array, t);
640
- }
641
- Sort(t) {
642
- return Array.isArray(t) ? wr(this.array, t) : $e(this.array, t);
643
- }
644
- Unique(t) {
645
- return Sr(this.array, t);
646
- }
647
- }, Ze = xr;
648
- const Nr = (e) => {
649
- const t = e.Icon ?? lt, r = F();
650
- return /* @__PURE__ */ b("div", { className: "flex w-full flex-col items-center justify-center gap-4 px-8 py-12", children: [
651
- /* @__PURE__ */ a(t, { size: 64, className: "text-disabled" }),
652
- /* @__PURE__ */ a("p", { className: "text-disabled", children: e.message ?? r.emptyDataMessage })
653
- ] });
654
- };
655
- function Cr(e, t) {
656
- if (!e || !t) return [];
657
- const r = [1];
658
- if (e === 1 && t === 1) return r;
659
- e > 4 && r.push("-");
660
- const n = 2, o = e - n, s = e + n;
661
- for (let c = o > 2 ? o : 2; c <= Math.min(t, s); c++) r.push(c);
662
- const i = t - 2;
663
- return s + 1 !== i && s + 1 < t && r.push("_"), s < t && (r.push(t - 2), r.push(t - 1), r.push(t)), Array.from(new Set(r));
664
- }
665
- const kr = (e) => {
666
- const t = nt(), r = F(), n = T(() => Cr(e.current, e.pages), [e.current, e.pages]), o = e.current < e.pages;
667
- return /* @__PURE__ */ b("footer", { className: "flex flex-wrap items-center justify-center gap-4 border-t-muted p-3 text-sm lg:flex-nowrap lg:justify-between", children: [
668
- /* @__PURE__ */ a("p", { children: /* @__PURE__ */ a(
669
- r.tablePaginationFooter,
670
- {
671
- ...e,
672
- sizes: e.sizes,
673
- select: e.onChangeSize && Array.isArray(e.sizes) ? /* @__PURE__ */ b(N, { children: [
674
- /* @__PURE__ */ a("label", { htmlFor: t, children: r.tablePaginationSelectLabel }),
675
- /* @__PURE__ */ a(
676
- "select",
677
- {
678
- id: t,
679
- value: e.size,
680
- className: "cursor-pointer bg-transparent",
681
- onChange: (s) => {
682
- e.onChangeSize?.(Number(s.target.value));
683
- },
684
- children: e.sizes.map((s) => /* @__PURE__ */ a("option", { value: s, children: s }, `pagination-opt-${s}`))
685
- }
686
- ),
687
- " "
688
- ] }) : null
689
- }
690
- ) }),
691
- /* @__PURE__ */ a("nav", { children: /* @__PURE__ */ b("ul", { className: "flex items-center gap-2", children: [
692
- e.current > 1 ? /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(J, { as: e.asLink || "button", href: "previous", className: "", children: r.tablePaginationPrevious }) }) : null,
693
- n.map((s) => s === null ? null : /* @__PURE__ */ a(N, { children: typeof s == "string" ? /* @__PURE__ */ a("li", { children: "..." }) : /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
694
- J,
695
- {
696
- href: s,
697
- as: e.asLink || "button",
698
- className: `cursor-pointer border-b-2 px-3 py-1 proportional-nums transition-colors hover:border-primary-subtle hover:text-primary-subtle ${s === e.current ? "border-primary text-primary" : "border-transparent"}`,
699
- children: s
700
- }
701
- ) }) }, `pagination-${s}`)),
702
- o ? /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(J, { as: e.asLink || "button", href: "next", className: "", children: r.tablePaginationNext }) }) : null
703
- ] }) })
704
- ] });
705
- }, Ar = (e) => {
706
- const t = A(null), r = A(null), [n, o] = _("opacity-0"), s = n === "opacity-0", i = () => o("opacity-0"), c = () => {
707
- const u = r.current, h = t.current;
708
- u === null || h === null || (h.style.left = `-${u.getBoundingClientRect().width + 4}px`);
709
- }, l = () => o("opacity-100");
710
- return z(() => {
711
- const u = r.current;
712
- if (u === null || parent === null) return;
713
- c();
714
- const h = new IntersectionObserver((f) => f.forEach(c), { root: document.documentElement });
715
- return h.observe(u), () => h.disconnect();
716
- }, []), /* @__PURE__ */ a(
717
- "div",
718
- {
719
- ref: t,
720
- onMouseEnter: l,
721
- onMouseLeave: i,
722
- "data-component": "cell-aside",
723
- inert: s ? !0 : void 0,
724
- tabIndex: s ? -1 : void 0,
725
- className: `group-table-cell-aside absolute inset-0 top-0 flex h-full w-full items-stretch transition-opacity duration-300 ease-in-out ${n}`,
726
- children: /* @__PURE__ */ a("div", { ref: r, className: "isolate block", children: e.children })
727
- }
728
- );
729
- }, Fr = (e, t, r) => {
730
- const n = r.cols, o = r.loading;
731
- return /* @__PURE__ */ a(N, { children: n.map((s, i) => {
732
- const c = `${i},${e}`, l = it(t, s.id), u = s.Element, h = s.cellProps?.className || "", f = i === 0 && r.Aside && o === !1, p = r.Aside;
733
- return /* @__PURE__ */ ot(
734
- "td",
735
- {
736
- ...s.cellProps,
737
- role: "cell",
738
- "data-matrix": c,
739
- key: `accessor-${e}-${i}`,
740
- className: `typography group-table-cell flex border-collapse flex-col whitespace-pre-wrap border border-y border-b border-table-border p-[var(--table-cell-padding)] md:table-cell md:border-b-0 md:border-r md:border-l-transparent md:last:border-r-transparent ${h}`
741
- },
742
- f ? /* @__PURE__ */ a(Ar, { children: /* @__PURE__ */ a(p, { col: s, row: t, rowIndex: e }) }) : null,
743
- /* @__PURE__ */ a("span", { className: "block text-sm font-bold leading-tight md:hidden", children: s.thead }),
744
- /* @__PURE__ */ a("span", { className: "relative", children: o ? _e : u ? /* @__PURE__ */ a(N, { children: /* @__PURE__ */ a(u, { row: t, matrix: c, col: s, rowIndex: e, value: l }) }) : /* @__PURE__ */ a(N, { children: Oe.nil(l) ? "" : l }) })
745
- );
746
- }) });
747
- };
748
- var Z = {}, Ee;
749
- function Ir() {
750
- return Ee || (Ee = 1, (function(e) {
751
- Object.defineProperty(e, Symbol.toStringTag, { value: "Module" });
752
- const t = (d, m) => {
753
- try {
754
- Object.keys(d).forEach(m);
755
- } catch (y) {
756
- window.console.log(y);
757
- }
758
- }, r = (d) => d == null, n = (d) => {
759
- const m = typeof d;
760
- return m === "string" || m === "number" || m === "boolean" || r(d);
761
- }, o = (d, m) => {
762
- const y = m.getItem(d);
763
- try {
764
- return JSON.parse(y);
765
- } catch {
766
- return y ?? null;
767
- }
768
- }, s = (d) => Object.keys(d).reduce((m, y) => ({ ...m, [y]: o(y, d) }), {}), i = (d) => d instanceof Date ? d : typeof d == "number" ? new Date(/* @__PURE__ */ new Date() * 1 + d * 864e5) : d, c = "1969-12-31T23:59:59.000Z", l = () => document.cookie === "" ? {} : document.cookie.split("; ").map((d) => d.split("=")).reduce((d, m) => (d[decodeURIComponent(m[0].trim())] = decodeURIComponent(m[1].trim()), d), {}), u = /* @__PURE__ */ new Set(), h = () => {
769
- const d = l();
770
- u.forEach((m) => m(d));
771
- }, f = [{ name: "expires", parse: (d) => `expires=${i(d.expires ?? c)}` }, { name: "maxAge", parse: (d) => d.maxAge ? `max-age=${i(d.expires ?? c)}` : "" }, { name: "path", parse: (d) => `path=${d.path ?? "/"}` }, { name: "sameSite", parse: (d) => `samesite=${d.sameSite ?? "strict"}` }, { name: "useSecure", parse: (d) => `${d.useSecure ?? !0 ? "secure" : ""}` }, { name: "domain", parse: (d) => {
772
- const m = d.domain ?? "";
773
- return m === "" ? "" : `domain=${d.multiDomain ? "." : ""}${m}`;
774
- } }, { name: "partitioned", parse: (d) => d.partitioned ? "Partitioned" : "" }], p = { json: l, listener: (d) => (u.add(d), () => u.delete(d)), clearListeners: () => u.clear(), has: (d) => document.cookie.split(";").some((m) => m.trim().startsWith(`${d}=`)), deleteAll: () => {
775
- document.cookie.split(";").forEach((d) => {
776
- document.cookie = d.replace(/^ +/, "").replace(/=.*/, `=;expires=${(/* @__PURE__ */ new Date()).toUTCString()};path=/`);
777
- }), h();
778
- }, get: (d) => {
779
- const m = p.json()[d];
780
- if (r(m)) return null;
781
- try {
782
- return JSON.parse(decodeURIComponent(m));
783
- } catch {
784
- return m;
785
- }
786
- }, delete: (d) => {
787
- document.cookie = `${encodeURIComponent(d)}=;expires=${(/* @__PURE__ */ new Date()).toUTCString()}`, h();
788
- }, set: (d, m, y = {}) => {
789
- const v = n(m) ? m : encodeURIComponent(JSON.stringify(m)), x = f.reduce((k, ge) => {
790
- const pe = ge.parse(y);
791
- return pe === "" ? k : k.concat(pe);
792
- }, [`${encodeURIComponent(d)}=${v}`]).join(";");
793
- document.cookie = x, h();
794
- } }, w = (d) => {
795
- const m = /* @__PURE__ */ new Set(), y = (v) => {
796
- d().removeItem(v);
797
- const x = s(d());
798
- m.forEach((k) => k(x));
799
- };
800
- return { delete: y, listener: (v) => (m.add(v), () => m.delete(v)), clearListeners: () => m.clear(), json: (v = !1) => v ? s(d()) : d(), has: (v) => {
801
- const x = d().getItem(v);
802
- return !r(x);
803
- }, deleteAll: () => {
804
- t(d(), y), m.forEach((v) => v(d()));
805
- }, get: (v) => o(v, d()), set: (v, x) => {
806
- d().setItem(v, JSON.stringify(x)), m.forEach((k) => k(d()));
807
- } };
808
- }, S = w(() => window.sessionStorage), g = w(() => window.localStorage);
809
- e.Cookie = p, e.LocalStorage = g, e.SessionStorage = S, e.createStorage = w;
810
- })(Z)), Z;
811
- }
812
- var Me = Ir();
813
- const he = (e) => e.headerLabel ?? e.thead ?? e.id, et = (e) => e.map((t) => ({
814
- value: t.id,
815
- label: t.thead ?? t.headerLabel ?? t.id
816
- }));
817
- var D = /* @__PURE__ */ ((e) => (e.Boolean = "boolean", e.Number = "number", e.Select = "select", e.Text = "text", e))(D || {});
818
- const me = (e) => e.type === "number" ? e.valueAsNumber : e.value, Cn = (e) => {
819
- let t = [];
820
- return e({ add: (i, c, l) => t.push({ ...l, id: i, thead: c }), remove: (i) => t = t.filter((c) => c.id !== i), getAll: () => Array.from(t), filter: (i) => t = Array.from(t.filter(i)) }), t;
821
- }, Tr = {}, $r = (e, t) => {
822
- if (!Array.isArray(t)) return e;
823
- const r = new Set(t.map((o) => o.id));
824
- if (!e.every((o) => r.has(o.id)))
825
- return e;
826
- const n = new Map(e.map((o) => [o.id, o]));
827
- return t.map((o, s) => {
828
- const i = n.get(o.id);
829
- return i === void 0 ? e[s] : i;
830
- });
831
- }, kn = (e, t, r = Tr) => {
832
- const n = te() ? null : Me.LocalStorage.get(`@components/table-${e}`) || null, [o, s] = Pe(
833
- {
834
- name: e,
835
- groups: r.groups || n?.groups || [],
836
- sorters: r.sorters || n?.sorters || [],
837
- filters: r.filters || n?.filters || [],
838
- cols: $r(t, n?.cols)
839
- },
840
- (i) => {
841
- const c = (l) => {
842
- const u = i.state(), h = { ...u, ...l };
843
- return te() || Me.LocalStorage.set(`@components/table-${u.name}`, h), h;
844
- };
845
- return c(i.state()), {
846
- set: (l) => c(l)
847
- };
848
- }
849
- );
850
- return { ...o, ...s, name: e };
851
- }, Er = (e) => {
852
- const t = ee(e), r = A(null), n = W(
853
- (o) => {
854
- t.current(o), o.forEach((s) => {
855
- const i = r.current.querySelector(`th[data-tableheader="${s.id}"]`);
856
- i && (i.style.width = "auto");
857
- });
858
- },
859
- [t]
860
- );
861
- return [r, n];
862
- }, An = () => te() ? void 0 : document.querySelector('[data-component="modal-body"]'), Mr = (e) => (t, r) => e.reduce((n, o) => {
863
- const s = o.type === "desc" ? -1 : 1, i = o.value, c = t[i] > r[i] ? s : t[i] < r[i] ? -s : 0;
864
- return n !== 0 ? n : c;
865
- }, 0), Rr = (e, t) => e.toSorted(Mr(t)), tt = (e, t, r) => ({
866
- label: t,
867
- id: ae(),
868
- type: r,
869
- value: e.id
870
- }), Lr = (e) => {
871
- const t = F(), r = {
872
- asc: {
873
- label: t.tableSortAsc,
874
- value: "asc"
875
- /* Asc */
876
- },
877
- desc: {
878
- label: t.tableSortDesc,
879
- value: "desc"
880
- /* Desc */
881
- }
882
- }, n = [r.asc, r.desc], o = () => {
883
- const l = e.cols[0];
884
- l && e.set((u) => [...u, tt(l, r.asc.label, r.asc.value)]);
885
- }, s = (l) => (u) => {
886
- const h = u.target.value;
887
- e.set((f) => f.map((p) => p.id === l ? { ...p, value: h } : p));
888
- }, i = (l) => (u) => {
889
- const h = u.target.value;
890
- e.set((f) => f.map((p) => p.id === l ? { ...p, type: h } : p));
891
- }, c = (l) => {
892
- const u = l.currentTarget.dataset.id || "";
893
- e.set((h) => h.filter((f) => f.id !== u));
894
- };
895
- return /* @__PURE__ */ a(N, { children: /* @__PURE__ */ a(
896
- V,
897
- {
898
- title: t.tableSortDropdownTitle,
899
- trigger: /* @__PURE__ */ b("span", { className: "flex items-center gap-1 proportional-nums", children: [
900
- /* @__PURE__ */ a(qe, { size: 14 }),
901
- t.tableSortOrderByLabel,
902
- " ",
903
- e.sorters.length === 0 ? "" : ` (${e.sorters.length})`
904
- ] }),
905
- children: /* @__PURE__ */ b("ul", { className: "mt-4 space-y-2", children: [
906
- e.sorters.map((l) => /* @__PURE__ */ b("li", { className: "flex flex-nowrap gap-3", children: [
907
- /* @__PURE__ */ a(
908
- E,
909
- {
910
- options: e.options,
911
- value: l.value,
912
- onChange: s(l.id),
913
- title: t.tableSortOrderInputTitle,
914
- placeholder: t.tableSortOrderInputPlaceholder
915
- }
916
- ),
917
- /* @__PURE__ */ a(
918
- E,
919
- {
920
- onChange: i(l.id),
921
- value: l.type,
922
- options: n,
923
- title: t.tableSortTypeInputTitle,
924
- placeholder: t.tableSortTypeInputPlaceholder
925
- }
926
- ),
927
- /* @__PURE__ */ a("button", { className: "mt-4", "data-id": l.id, onClick: c, children: /* @__PURE__ */ a(H, { className: "text-danger", size: 14 }) })
928
- ] }, `sorter-select-${l.id}`)),
929
- /* @__PURE__ */ a("li", { children: /* @__PURE__ */ b("button", { type: "button", onClick: o, className: "flex items-center gap-1 text-primary", children: [
930
- /* @__PURE__ */ a(ue, { size: 14 }),
931
- " ",
932
- t.tableSortAddButton
933
- ] }) })
934
- ] })
935
- }
936
- ) });
937
- }, Pr = (e) => {
938
- const t = F(), [r, n] = _(() => {
939
- const c = e.sorters.find((l) => l.value === e.col.id);
940
- return c ? c.type : "undefined";
941
- }), o = () => n(
942
- (c) => c === "undefined" ? "asc" : c === "asc" ? "desc" : "undefined"
943
- /* Undefined */
944
- );
945
- z(() => {
946
- e.setSorters((c) => {
947
- if (r === "undefined") return c.filter((h) => h.value !== e.col.id);
948
- const l = c.findIndex((h) => h.value === e.col.id), u = tt(e.col, r, r);
949
- return l === -1 ? [...c, u] : (c[l] = u, [...c]);
950
- });
951
- }, [r, e.col]);
952
- const s = `${e.col.id}-sorter-id`, i = he(e.col);
953
- return /* @__PURE__ */ b("button", { "aria-labelledby": s, className: "isolate flex items-center", onClick: o, type: "button", children: [
954
- /* @__PURE__ */ b("span", { id: s, className: "sr-only", children: [
955
- t.tableSortDropdownTitle,
956
- " ",
957
- i
958
- ] }),
959
- r === "asc" ? /* @__PURE__ */ a(bt, { size: 14 }) : null,
960
- r === "desc" ? /* @__PURE__ */ a(pt, { size: 14 }) : null,
961
- r === "undefined" ? /* @__PURE__ */ a(qe, { size: 14 }) : null
962
- ] });
963
- }, rt = se({}), Dr = rt.Provider, Or = () => q(rt), oe = (e, t, r, n = {}) => {
964
- const o = e.id, s = e.type ?? D.Text, i = t[s] ?? [], c = i.find((u) => u["data-default"])?.value ?? i[0]?.value, l = r[c];
965
- return { id: ae(), operation: l, label: he(e), name: o, type: s, value: "", ...n };
966
- }, fe = () => {
967
- const e = F(), t = T(
968
- () => ({
969
- contains: {
970
- value: "contains",
971
- label: e.tableFilterTypeContains,
972
- symbol: "includes",
973
- "data-default": "true"
974
- },
975
- is: { value: "is", label: e.tableFilterTypeIs, symbol: "is" },
976
- isNot: { value: "isNot", label: e.tableFilterTypeIsNot, symbol: "!==" },
977
- notContains: {
978
- value: "notContains",
979
- label: e.tableFilterTypeNotContains,
980
- symbol: "notIncludes"
981
- },
982
- lessThan: { value: "lessThan", label: e.tableFilterTypeLessThan, symbol: "<=" },
983
- greaterThan: { value: "greaterThan", label: e.tableFilterTypeGreaterThan, symbol: ">=" },
984
- startsWith: { value: "startsWith", label: e.tableFilterTypeStartsWith, symbol: "startsWith" },
985
- endsWith: { value: "endsWith", label: e.tableFilterTypeEndsWith, symbol: "endsWith" }
986
- }),
987
- [e]
988
- );
989
- return { options: T(
990
- () => ({
991
- [D.Text]: [
992
- t.is,
993
- t.isNot,
994
- t.contains,
995
- t.notContains,
996
- t.startsWith,
997
- t.endsWith
998
- ],
999
- [D.Boolean]: [t.is, t.isNot],
1000
- [D.Number]: [t.is, t.isNot, t.greaterThan, t.lessThan]
1001
- }),
1002
- [t]
1003
- ), operations: t };
1004
- }, _r = (e) => {
1005
- const t = F(), r = fe(), n = () => {
1006
- const l = e.cols.at(0);
1007
- e.set((u) => [...u, oe(l, r.options, r.operations)]);
1008
- }, o = (l) => {
1009
- const u = l.target.dataset.id || "", h = l.target.value;
1010
- e.set(
1011
- (f) => f.map((p) => {
1012
- if (u !== p.id) return p;
1013
- const w = e.cols.find((S) => h === S.id);
1014
- return oe(w, r.options, r.operations, { value: "" });
1015
- })
1016
- );
1017
- }, s = (l) => {
1018
- const u = l.target.dataset.id || "", h = l.target.value;
1019
- e.set(
1020
- (f) => f.map(
1021
- (p) => p.id === u ? {
1022
- ...p,
1023
- operation: r.operations[h]
1024
- } : p
1025
- )
1026
- );
1027
- }, i = (l) => {
1028
- const u = l.currentTarget.dataset.id || "";
1029
- e.set((h) => h.filter((f) => f.id !== u));
1030
- }, c = (l) => {
1031
- const u = l.target.dataset.id || "", h = me(l.target);
1032
- e.set((f) => f.map((p) => p.id === u ? { ...p, value: h } : p));
1033
- };
1034
- return /* @__PURE__ */ a(N, { children: /* @__PURE__ */ a(
1035
- V,
1036
- {
1037
- arrow: !0,
1038
- title: t.tableFilterDropdownTitle,
1039
- trigger: /* @__PURE__ */ b("span", { className: "flex items-center gap-1 proportional-nums", children: [
1040
- /* @__PURE__ */ a(Nt, { size: 14 }),
1041
- t.tableFilterLabel,
1042
- " ",
1043
- e.filters.length === 0 ? "" : ` (${e.filters.length})`
1044
- ] }),
1045
- children: /* @__PURE__ */ b("ul", { className: "mt-4 space-y-2", children: [
1046
- e.filters.map((l) => {
1047
- const u = r.options[l.type];
1048
- return /* @__PURE__ */ b("li", { className: "flex flex-nowrap gap-3", children: [
1049
- /* @__PURE__ */ a(
1050
- E,
1051
- {
1052
- options: e.options,
1053
- title: t.tableFilterColumnTitle,
1054
- placeholder: t.tableFilterColumnPlaceholder,
1055
- value: l.name,
1056
- "data-id": l.id,
1057
- onChange: o
1058
- }
1059
- ),
1060
- /* @__PURE__ */ a(
1061
- E,
1062
- {
1063
- "data-id": l.id,
1064
- onChange: s,
1065
- value: l.operation.value,
1066
- options: u,
1067
- title: t.tableFilterOperatorTitle,
1068
- placeholder: t.tableFilterOperatorPlaceholder
1069
- }
1070
- ),
1071
- /* @__PURE__ */ a(
1072
- ze,
1073
- {
1074
- optionalText: "",
1075
- "data-id": l.id,
1076
- onChange: c,
1077
- value: l.value,
1078
- type: l.type,
1079
- title: t.tableFilterValueTitle,
1080
- placeholder: t.tableFilterValuePlaceholder
1081
- }
1082
- ),
1083
- /* @__PURE__ */ a("div", { className: "mt-5 flex items-center justify-center", children: /* @__PURE__ */ a("button", { "data-id": l.id, type: "button", onClick: i, children: /* @__PURE__ */ a(H, { className: "text-danger", size: 16 }) }) })
1084
- ] }, `filter-select-${l.id}`);
1085
- }),
1086
- /* @__PURE__ */ a("li", { children: /* @__PURE__ */ b("button", { type: "button", onClick: n, className: "flex items-center gap-1 text-primary", children: [
1087
- /* @__PURE__ */ a(ue, { size: 14 }),
1088
- " ",
1089
- t.tableFilterNewFilter
1090
- ] }) })
1091
- ] })
1092
- }
1093
- ) });
1094
- }, zr = ({ filter: e, onDelete: t, set: r }) => {
1095
- const n = F(), o = fe(), s = (c) => {
1096
- const l = c.target.value, u = c.target.dataset.id || "";
1097
- r(
1098
- (h) => h.map(
1099
- (f) => f.id === u ? {
1100
- ...f,
1101
- operation: o.operations[l]
1102
- } : f
1103
- )
1104
- );
1105
- }, i = (c) => {
1106
- const l = c.target.dataset.id || "", u = me(c.target);
1107
- r((h) => h.map((f) => f.id === l ? { ...f, value: u } : f));
1108
- };
1109
- return /* @__PURE__ */ b("div", { className: "flex flex-nowrap items-center gap-4 py-2", children: [
1110
- /* @__PURE__ */ a(
1111
- E,
1112
- {
1113
- "data-id": e.id,
1114
- onChange: s,
1115
- value: e.operation.value,
1116
- options: o.options[e.type],
1117
- title: n.tableFilterColumnTitle,
1118
- placeholder: n.tableFilterColumnPlaceholder
1119
- }
1120
- ),
1121
- /* @__PURE__ */ a(
1122
- ze,
1123
- {
1124
- optionalText: " ",
1125
- "data-id": e.id,
1126
- onChange: i,
1127
- value: e.value,
1128
- type: e.type,
1129
- title: n.tableFilterValueTitle,
1130
- placeholder: n.tableFilterValueTitle
1131
- }
1132
- ),
1133
- /* @__PURE__ */ a("button", { onClick: t, "data-id": e.id, type: "button", className: "mt-4", children: /* @__PURE__ */ a(H, { className: "text-danger", size: 14 }) })
1134
- ] });
1135
- }, Gr = { top: 0, left: 0, right: 0, bottom: -1 }, jr = (e) => {
1136
- const t = De(), r = F(), n = e.filters.filter((g) => g.name === e.header.id), o = n.length > 0, s = e.header.allowSort ?? t.table.sorters ?? !0, i = e.header.allowFilter ?? t.table.filters ?? !0, c = fe(), l = o ? At : It, u = A(null), h = (g) => {
1137
- const d = g.currentTarget.dataset.id || "";
1138
- return e.setFilters((m) => m.filter((y) => y.id !== d));
1139
- }, f = W((g) => {
1140
- if (g === null) return;
1141
- u.current = g;
1142
- const d = new AbortController();
1143
- return g.addEventListener(
1144
- "pointerdown",
1145
- (m) => {
1146
- if (m.target.dataset.type === "resizer")
1147
- return m.stopPropagation(), m.stopImmediatePropagation();
1148
- },
1149
- { signal: d.signal }
1150
- ), () => d.abort();
1151
- }, []), p = e.sorters.find((g) => e.header.id === g.value), w = p?.type ? p.type === Qe.Asc ? "ascending" : "descending" : "none", S = he(e.header);
1152
- return /* @__PURE__ */ b(
1153
- Xe,
1154
- {
1155
- ...e.header.thProps,
1156
- as: "th",
1157
- ref: f,
1158
- initial: !1,
1159
- dragSnapToOrigin: !0,
1160
- dragDirectionLock: !0,
1161
- role: "columnheader",
1162
- "aria-sort": w,
1163
- value: e.header,
1164
- "aria-busy": e.loading,
1165
- "data-tableheader": e.header.id,
1166
- whileDrag: { cursor: "grabbing" },
1167
- className: `typography bg-table-header first:rounded-tl-lg last:rounded-tr-lg overflow-clip last:border-r-transparent border-table-border border-r-[1px] relative min-w-0 cursor-grab font-medium md:h-14 ${e.header.thProps?.className ?? ""}`,
1168
- children: [
1169
- /* @__PURE__ */ a(
1170
- "span",
1171
- {
1172
- className: `flex h-full items-center justify-between bg-table-header p-[var(--table-cell-padding)] ${e.isLast ? "rounded-tr-lg" : ""} ${e.index === 0 ? "rounded-tl-lg" : ""}`,
1173
- children: /* @__PURE__ */ b("span", { className: "flex items-center gap-1", children: [
1174
- e.inlineFilter && i ? /* @__PURE__ */ a(
1175
- V,
1176
- {
1177
- arrow: !0,
1178
- trigger: /* @__PURE__ */ b("span", { children: [
1179
- /* @__PURE__ */ b("span", { id: `${e.header.id}-filter-dropdown-button`, className: "sr-only", children: [
1180
- r.tableFilterDropdownTitleUnique,
1181
- " ",
1182
- S
1183
- ] }),
1184
- /* @__PURE__ */ a(l, { "aria-labelledby": `${e.header.id}-filter-dropdown-button`, size: 14 })
1185
- ] }),
1186
- title: /* @__PURE__ */ b("span", { className: "text-lg", children: [
1187
- r.tableFilterDropdownTitleUnique,
1188
- " ",
1189
- /* @__PURE__ */ a("span", { className: "font-medium", children: S })
1190
- ] }),
1191
- children: /* @__PURE__ */ b("ul", { className: "font-medium", children: [
1192
- n.length === 0 ? null : /* @__PURE__ */ a(N, { children: n.map((g) => /* @__PURE__ */ a("li", { className: "my-1", children: /* @__PURE__ */ a(zr, { onDelete: h, filter: g, set: e.setFilters }) }, `thead-filter-${g.id}`)) }),
1193
- /* @__PURE__ */ a("li", { children: /* @__PURE__ */ b(
1194
- "button",
1195
- {
1196
- type: "button",
1197
- className: "flex items-center gap-1 text-primary",
1198
- onClick: () => e.setFilters(
1199
- (g) => g.concat(oe(e.header, c.options, c.operations))
1200
- ),
1201
- children: [
1202
- /* @__PURE__ */ a(ue, { size: 14 }),
1203
- " ",
1204
- r.tableFilterNewFilter
1205
- ]
1206
- }
1207
- ) })
1208
- ] })
1209
- }
1210
- ) : null,
1211
- /* @__PURE__ */ a("span", { className: "pointer-events-auto text-balance text-base", children: e.header.thead }),
1212
- e.inlineSorter && s ? /* @__PURE__ */ a(Pr, { col: e.header, setSorters: e.setSorters, sorters: e.sorters }) : null
1213
- ] })
1214
- }
1215
- ),
1216
- e.isLast ? null : /* @__PURE__ */ a(
1217
- le.button,
1218
- {
1219
- drag: "x",
1220
- draggable: !0,
1221
- dragListener: !0,
1222
- dragMomentum: !0,
1223
- type: "button",
1224
- animate: !1,
1225
- dragElastic: 0,
1226
- dragPropagation: !0,
1227
- initial: !1,
1228
- dragSnapToOrigin: !0,
1229
- dragDirectionLock: !0,
1230
- "data-type": "resizer",
1231
- title: e.header.id,
1232
- dragConstraints: Gr,
1233
- className: "absolute -right-[0.5px] top-0 z-calendar block h-full w-[1px] cursor-col-resize bg-transparent hover:w-1.5 hover:bg-primary active:w-1.5 active:bg-primary",
1234
- onClick: (g) => {
1235
- g.currentTarget.focus();
1236
- },
1237
- onKeyDown: (g) => {
1238
- if (g.key === "ArrowLeft" || g.key === "ArrowRight") {
1239
- if (u.current === null) return;
1240
- u.current.setAttribute("data-resized", "true");
1241
- const d = u.current.getBoundingClientRect().width, y = (g.shiftKey ? 50 : 10) * (g.key === "ArrowLeft" ? -1 : 1);
1242
- u.current.style.width = `${Math.abs(d + y)}px`;
1243
- }
1244
- },
1245
- onDoubleClick: () => {
1246
- u.current !== null && (u.current.style.width = "auto");
1247
- },
1248
- onDrag: (g, d) => {
1249
- if (u.current === null) return;
1250
- u.current.setAttribute("data-resized", "true");
1251
- const m = u.current.getBoundingClientRect().width, y = d.delta.x;
1252
- u.current.style.width = `${Math.abs(m + y)}px`;
1253
- }
1254
- }
1255
- )
1256
- ]
1257
- }
1258
- );
1259
- }, Wr = (e) => {
1260
- const [t, r] = Er(e.setCols);
1261
- return /* @__PURE__ */ a(He, { layout: !0, as: "tr", axis: "x", drag: "x", ref: t, layoutRoot: !0, role: "row", layoutScroll: !0, onReorder: r, values: e.headers, children: /* @__PURE__ */ a(ie, { children: e.headers.map((n, o) => /* @__PURE__ */ a(
1262
- jr,
1263
- {
1264
- index: o,
1265
- header: n,
1266
- filters: e.filters,
1267
- loading: e.loading,
1268
- sorters: e.sorters,
1269
- setFilters: e.setFilters,
1270
- setSorters: e.setSorters,
1271
- inlineFilter: e.inlineFilter,
1272
- inlineSorter: e.inlineSorter,
1273
- isLast: o === e.headers.length - 1
1274
- },
1275
- `header-child-item-${n.id}`
1276
- )) }) });
1277
- }, qr = O.forwardRef(
1278
- ({
1279
- context: e,
1280
- className: t = "",
1281
- ...r
1282
- }, n) => /* @__PURE__ */ a("tbody", { ...r, role: "rowgroup", className: `divide-y divide-table-border ${t}`, ref: n, children: /* @__PURE__ */ a(ie, { children: r.children }) })
1283
- ), Br = O.forwardRef(({ context: e, className: t = "", ...r }, n) => /* @__PURE__ */ a(
1284
- "table",
1285
- {
1286
- ...r,
1287
- role: "table",
1288
- ref: n,
1289
- style: { ...r.style, "--table-cell-padding": "0.75rem" },
1290
- className: `table w-full table-fixed border-separate border-spacing-0 text-left ${t ?? ""}`
1291
- }
1292
- )), Vr = O.forwardRef(({ context: e, ...t }, r) => {
1293
- const n = Or(), o = {
1294
- ...t?.style,
1295
- top: Oe.number(n.sticky) ? `${n.sticky}px` : void 0
1296
- };
1297
- return /* @__PURE__ */ a("thead", { ...t, ref: r, style: o, role: "rowgroup", className: "group:sticky top-0 hidden bg-transparent md:table-header-group" });
1298
- }), Ur = O.forwardRef(({ context: e, item: t, ...r }, n) => {
1299
- const o = e?.getRowProps?.(t), s = { ...r, ...o };
1300
- return /* @__PURE__ */ a(
1301
- "tr",
1302
- {
1303
- ...s,
1304
- role: "row",
1305
- ref: n,
1306
- className: `group-table-row flex h-fit flex-col flex-wrap justify-center gap-1 pb-4 md:table-row ${[r?.className, o?.className].filter(Boolean).join(" ")}`
1307
- }
1308
- );
1309
- }), Hr = O.forwardRef((e, t) => e.context.loadingMore ? /* @__PURE__ */ a("tfoot", { ...e, ref: t, className: "bg-card-background", children: /* @__PURE__ */ a("tr", { role: "row", className: "bg-card-background", children: /* @__PURE__ */ a("td", { colSpan: 999, className: "h-14 bg-card-background px-2", children: /* @__PURE__ */ a("span", { className: "block h-2 w-full animate-pulse rounded bg-foreground opacity-60" }) }) }) }) : null), Xr = {
1310
- TableRow: Ur,
1311
- TableFoot: Hr,
1312
- TableHead: Vr,
1313
- Table: Br,
1314
- TableBody: qr
1315
- }, Jr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], Kr = (e) => /* @__PURE__ */ a("div", { className: "flex h-48 w-full items-center justify-center px-2", children: e.loading ? _e : /* @__PURE__ */ a(Nr, {}) }), Yr = () => /* @__PURE__ */ a(N, {}), Qr = [], Re = ({
1316
- cols: e,
1317
- filters: t,
1318
- setCols: r,
1319
- sorters: n,
1320
- setFilters: o,
1321
- setSorters: s,
1322
- onScrollEnd: i,
1323
- getScrollRef: c,
1324
- pagination: l = null,
1325
- useControl: u = !1,
1326
- ...h
1327
- }) => {
1328
- const f = A(null), [, p] = _(!1), w = ee(i), S = ee(h.loadingMore), g = T(() => {
1329
- if (h.loading) return Jr;
1330
- if (u) return h.rows;
1331
- const y = new Ze(h.rows);
1332
- return t.length > 0 && t.forEach(
1333
- (v) => v.value === "" || Number.isNaN(v.value) ? void 0 : y.Where(v.name, v.operation.symbol, v.value)
1334
- ), n.length === 0 ? y.Select() : Rr(y.Select(), n);
1335
- }, [h.loading, h.rows, u, t, n]);
1336
- z(() => {
1337
- if (f.current === null) return () => {
1338
- };
1339
- const y = f.current, v = new IntersectionObserver((x) => x[x.length - 1].isIntersecting && S.current ? (w.current?.(), void p(!0)) : p(!1));
1340
- return v.observe(y), () => v.disconnect();
1341
- }, [S, w]);
1342
- const d = g.length === 0, m = {
1343
- cols: e,
1344
- Aside: h.Aside,
1345
- loading: h.loading,
1346
- getRowProps: h.getRowProps,
1347
- loadingMore: h.loadingMore
1348
- };
1349
- return /* @__PURE__ */ b("div", { className: "group bg-table-background relative flex w-full flex-col whitespace-nowrap rounded-lg", children: [
1350
- /* @__PURE__ */ a(
1351
- st,
1352
- {
1353
- components: Xr,
1354
- context: m,
1355
- totalCount: g.length,
1356
- itemContent: d ? Yr : Fr,
1357
- data: d ? Qr : g,
1358
- useWindowScroll: !c,
1359
- customScrollParent: c ? c() : void 0,
1360
- fixedHeaderContent: () => /* @__PURE__ */ a(
1361
- Wr,
1362
- {
1363
- headers: e,
1364
- filters: t,
1365
- setCols: r,
1366
- sorters: n,
1367
- setFilters: o,
1368
- setSorters: s,
1369
- loading: !!h.loading,
1370
- inlineFilter: h.inlineFilter,
1371
- inlineSorter: h.inlineSorter
1372
- }
1373
- )
1374
- }
1375
- ),
1376
- d ? /* @__PURE__ */ a(Kr, { loading: h.loading }) : null,
1377
- /* @__PURE__ */ a("div", { "aria-hidden": "true", ref: f, className: "h-0.5 w-full" }),
1378
- l !== null ? /* @__PURE__ */ a(kr, { ...l }) : null
1379
- ] });
1380
- }, Zr = ({ item: e, onPointerDown: t }) => {
1381
- const r = ce(0);
1382
- return /* @__PURE__ */ b(
1383
- Xe,
1384
- {
1385
- onPointerDown: t,
1386
- id: e.groupId,
1387
- className: "flex flex-row items-center gap-2",
1388
- value: e,
1389
- style: { y: r },
1390
- children: [
1391
- /* @__PURE__ */ a("button", { type: "button", className: "cursor-grab", children: /* @__PURE__ */ a(St, { size: 14 }) }),
1392
- /* @__PURE__ */ a("span", { children: e.groupName })
1393
- ]
1394
- },
1395
- e.groupId
1396
- );
1397
- }, en = (e) => {
1398
- const t = F(), r = et(e.cols), n = qt(), [o, s] = _(e.groups[0]?.thead || ""), i = (l) => {
1399
- const u = l.target, h = u.value, f = u.options.selectedIndex, p = u.options.item(f)?.label || "";
1400
- s(p);
1401
- const w = new Ze(e.rows).GroupBy(h), S = e.cols.find((g) => g.id === h);
1402
- e.setGroups(
1403
- at(w).map((g, d) => {
1404
- const m = w[g];
1405
- return { ...S, groupId: ae(), groupKey: h, index: d, rows: m, groupName: g };
1406
- })
1407
- );
1408
- }, c = () => e.setGroups([]);
1409
- return /* @__PURE__ */ a(N, { children: /* @__PURE__ */ b(
1410
- V,
1411
- {
1412
- arrow: !1,
1413
- title: t.tableGroupLabel,
1414
- trigger: /* @__PURE__ */ b("span", { className: "flex items-center gap-1 proportional-nums", children: [
1415
- /* @__PURE__ */ a(Et, { size: 14 }),
1416
- t.tableGroupLabelWithCount,
1417
- e.groups.length > 0 ? ` - ${o}(${e.groups.length})` : ""
1418
- ] }),
1419
- children: [
1420
- /* @__PURE__ */ b("div", { className: "flex flex-nowrap items-center", children: [
1421
- /* @__PURE__ */ a(E, { value: o, title: "Tipo de agrupamento", onChange: i, options: r, placeholder: "Agrupar por..." }),
1422
- /* @__PURE__ */ a(ft, { className: "mt-4", onClick: c, theme: "raw", "data-id": o, children: /* @__PURE__ */ a(H, { size: 16, className: "text-danger" }) })
1423
- ] }),
1424
- e.groups.length > 0 ? /* @__PURE__ */ b("section", { className: "my-4", children: [
1425
- /* @__PURE__ */ a("header", { children: /* @__PURE__ */ a("h2", { className: "text-xl font-medium", children: "Order groups" }) }),
1426
- /* @__PURE__ */ a(_t, { children: /* @__PURE__ */ a(
1427
- He,
1428
- {
1429
- axis: "y",
1430
- className: "relative space-y-2",
1431
- drag: !0,
1432
- dragControls: n,
1433
- dragListener: !1,
1434
- layoutScroll: !0,
1435
- onReorder: e.setGroups,
1436
- values: e.groups,
1437
- children: e.groups.map((l) => /* @__PURE__ */ a(
1438
- Zr,
1439
- {
1440
- item: l,
1441
- onPointerDown: (u) => {
1442
- n.start(u), e.setGroups([...e.groups]);
1443
- }
1444
- },
1445
- l.groupId
1446
- ))
1447
- }
1448
- ) })
1449
- ] }) : null
1450
- ]
1451
- }
1452
- ) });
1453
- }, tn = (e) => /* @__PURE__ */ a("header", { className: "mb-1 min-w-full", children: /* @__PURE__ */ b("div", { className: "flex min-w-full flex-wrap items-center justify-between gap-x-4 gap-y-1", children: [
1454
- /* @__PURE__ */ b("div", { className: "items-centeend flex w-fit gap-4 whitespace-nowrap py-2", children: [
1455
- /* @__PURE__ */ a("span", { children: /* @__PURE__ */ a(_r, { cols: e.cols, options: e.options, filters: e.filters, set: e.setFilters }) }),
1456
- /* @__PURE__ */ a("span", { children: /* @__PURE__ */ a(Lr, { options: e.options, cols: e.cols, sorters: e.sorters, set: e.setSorters }) }),
1457
- /* @__PURE__ */ a("span", { children: /* @__PURE__ */ a(en, { rows: e.rows, groups: e.groups, setGroups: e.setGroups, options: e.options, cols: e.cols }) })
1458
- ] }),
1459
- /* @__PURE__ */ a("ul", { className: "flex w-full flex-1 flex-grow flex-row flex-wrap items-center gap-4 md:justify-end", children: e.filters.map((t) => /* @__PURE__ */ b("li", { className: "flex items-center gap-1 rounded-xl border border-card-border px-4 py-0.5", children: [
1460
- /* @__PURE__ */ b("span", { children: [
1461
- /* @__PURE__ */ a("span", { className: "mr-2 inline-block aspect-square size-3 rounded-full bg-primary", "aria-hidden": "true" }),
1462
- t.label,
1463
- " ",
1464
- t.operation.label.toLowerCase(),
1465
- ":"
1466
- ] }),
1467
- /* @__PURE__ */ b("div", { className: "relative w-min min-w-[1ch]", children: [
1468
- /* @__PURE__ */ a("span", { "aria-hidden": "true", className: "invisible whitespace-pre p-0", children: t.value || " " }),
1469
- /* @__PURE__ */ a(
1470
- "input",
1471
- {
1472
- type: t.type,
1473
- value: t.value,
1474
- className: "absolute left-0 top-0 m-0 inline-block w-full bg-transparent p-0 placeholder-primary/70 outline-none [appearance:textfield] after:empty:text-primary/70 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
1475
- onChange: (r) => {
1476
- const n = me(r.target);
1477
- e.setFilters((o) => o.map((s) => t.id === s.id ? { ...s, value: n } : s));
1478
- }
1479
- }
1480
- )
1481
- ] })
1482
- ] }, `filter-table-${t.id}`)) })
1483
- ] }) }), rn = (e, t) => typeof t == "function" ? t(e) : t, j = (e, t, r) => e === t ? void 0 : r?.(t), Fn = (e) => {
1484
- const t = De(), r = T(
1485
- () => ({
1486
- sticky: e.sticky === void 0 ? t.table.sticky ?? void 0 : e.sticky ?? void 0
1487
- }),
1488
- [e.sticky, t.table.sticky]
1489
- ), n = e.operations ?? t.table.operations ?? !0, o = T(() => et(e.cols), [e.cols]), [s, i] = Pe(
1490
- {
1491
- cols: e.cols,
1492
- sorters: e.sorters ?? [],
1493
- groups: e.groups ?? [],
1494
- filters: e.filters ?? []
1495
- },
1496
- (c) => {
1497
- const l = (u) => (h) => {
1498
- const f = c.state();
1499
- return { ...f, [u]: rn(f[u], h) };
1500
- };
1501
- return {
1502
- cols: l("cols"),
1503
- sorters: l("sorters"),
1504
- groups: l("groups"),
1505
- filters: l("filters")
1506
- };
1507
- },
1508
- {
1509
- postMiddleware: [
1510
- (c, l) => (e.set?.(c), j(l?.filters ?? [], c.filters ?? [], e.setFilters), j(l?.sorters ?? [], c.sorters ?? [], e.setSorters), j(l?.groups ?? [], c.groups ?? [], e.setGroups), j(l?.cols ?? [], c.cols ?? [], e.setCols), c)
1511
- ]
1512
- }
1513
- );
1514
- return z(() => {
1515
- i.cols(e.cols);
1516
- }, [e.cols]), /* @__PURE__ */ a(Dr, { value: r, children: /* @__PURE__ */ b(ie, { propagate: !0, initial: !1, children: [
1517
- n ? /* @__PURE__ */ a(
1518
- tn,
1519
- {
1520
- cols: s.cols,
1521
- rows: e.rows,
1522
- options: o,
1523
- groups: s.groups,
1524
- filters: s.filters,
1525
- setCols: i.cols,
1526
- sorters: s.sorters,
1527
- setGroups: i.groups,
1528
- setFilters: i.filters,
1529
- setSorters: i.sorters,
1530
- pagination: e.pagination ?? null,
1531
- inlineFilter: e.inlineFilter ?? !0,
1532
- inlineSorter: e.inlineSorter ?? !0
1533
- }
1534
- ) : null,
1535
- s.groups.length === 0 ? /* @__PURE__ */ a(
1536
- Re,
1537
- {
1538
- ...e,
1539
- index: 0,
1540
- cols: s.cols,
1541
- options: o,
1542
- groups: s.groups,
1543
- filters: s.filters,
1544
- optionCols: o,
1545
- setCols: i.cols,
1546
- sorters: s.sorters,
1547
- setGroups: i.groups,
1548
- setFilters: i.filters,
1549
- setSorters: i.sorters,
1550
- onScrollEnd: e.onScrollEnd,
1551
- pagination: e.pagination ?? null,
1552
- inlineFilter: e.inlineFilter ?? !0,
1553
- inlineSorter: e.inlineSorter ?? !0
1554
- }
1555
- ) : /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-4", children: s.groups.map((c, l) => /* @__PURE__ */ a("div", { className: "min-w-full", children: /* @__PURE__ */ a(
1556
- Re,
1557
- {
1558
- ...e,
1559
- group: c,
1560
- index: l,
1561
- cols: s.cols,
1562
- pagination: null,
1563
- rows: c.rows,
1564
- options: o,
1565
- groups: s.groups,
1566
- filters: s.filters,
1567
- optionCols: o,
1568
- setCols: i.cols,
1569
- sorters: s.sorters,
1570
- setGroups: i.groups,
1571
- setFilters: i.filters,
1572
- setSorters: i.sorters,
1573
- onScrollEnd: e.onScrollEnd,
1574
- inlineFilter: e.inlineFilter ?? !0,
1575
- inlineSorter: e.inlineSorter ?? !0
1576
- }
1577
- ) }, `group-${c.groupId}`)) })
1578
- ] }) });
1579
- };
1580
- export {
1581
- D as C,
1582
- Nr as E,
1583
- Fn as T,
1584
- et as a,
1585
- Cn as c,
1586
- Me as d,
1587
- An as g,
1588
- kn as u
1589
- };
1590
- //# sourceMappingURL=index-ChfR6F8d.js.map