@foi/design-system 0.0.12 → 0.0.14

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 (87) hide show
  1. package/README.md +141 -1
  2. package/dist/{RadioGroup-CdW6yS38.js → RadioGroup-DCJBoZc-.js} +18 -17
  3. package/dist/{RadioGroup-CdW6yS38.js.map → RadioGroup-DCJBoZc-.js.map} +1 -1
  4. package/dist/{RadioGroup.context-BdRgENJJ.js → RadioGroup.context-QNk2hW_4.js} +4 -4
  5. package/dist/RadioGroup.context-QNk2hW_4.js.map +1 -0
  6. package/dist/{Switch-C7wjcrjU.js → Switch-JF9P9VJf.js} +438 -421
  7. package/dist/Switch-JF9P9VJf.js.map +1 -0
  8. package/dist/{ThemeProvider-JlN3U_r2.js → ThemeProvider-Q2Hjezbt.js} +2 -2
  9. package/dist/{ThemeProvider-JlN3U_r2.js.map → ThemeProvider-Q2Hjezbt.js.map} +1 -1
  10. package/dist/atoms.mjs +2 -2
  11. package/dist/components/atoms/Button/Button.interface.d.ts +1 -1
  12. package/dist/components/atoms/Checkbox/Checkbox.d.ts +4 -1
  13. package/dist/components/atoms/DatePicker/DatePickerMenu/DatePickerMenu.d.ts +0 -2
  14. package/dist/components/atoms/IconButton/IconButton.interface.d.ts +1 -1
  15. package/dist/components/atoms/Input/Input.d.ts +6 -7
  16. package/dist/components/atoms/Input/Input.interface.d.ts +62 -13
  17. package/dist/components/atoms/Pagination/Pagination.d.ts +12 -0
  18. package/dist/components/atoms/Pagination/Pagination.emotion.d.ts +2 -0
  19. package/dist/components/atoms/Pagination/Pagination.interface.d.ts +32 -0
  20. package/dist/components/atoms/Pagination/PaginationMenu/PaginationMenu.d.ts +9 -0
  21. package/dist/components/atoms/Pagination/PaginationMenu/PaginationMenu.emotion.d.ts +2 -0
  22. package/dist/components/atoms/Pagination/PaginationMenu/PaginationMenu.interface.d.ts +23 -0
  23. package/dist/components/atoms/Pagination/PaginationMenu/index.d.ts +4 -0
  24. package/dist/components/atoms/Pagination/index.d.ts +4 -0
  25. package/dist/components/atoms/Radio/Radio.d.ts +4 -0
  26. package/dist/components/atoms/Radio/RadioGroup.context.d.ts +2 -0
  27. package/dist/components/atoms/Select/SelectMenu/SelectMenu.d.ts +1 -2
  28. package/dist/components/atoms/Skeleton/Skeleton.d.ts +10 -0
  29. package/dist/components/atoms/Skeleton/Skeleton.emotion.d.ts +2 -0
  30. package/dist/components/atoms/Skeleton/Skeleton.interface.d.ts +14 -0
  31. package/dist/components/atoms/Skeleton/index.d.ts +2 -0
  32. package/dist/components/molecules/Modal/Modal.d.ts +14 -0
  33. package/dist/components/molecules/Modal/Modal.emotion.d.ts +2 -0
  34. package/dist/components/molecules/Modal/Modal.interface.d.ts +42 -0
  35. package/dist/components/molecules/Modal/index.d.ts +5 -0
  36. package/dist/components/organisms/DataGrid/DataGrid.d.ts +19 -0
  37. package/dist/components/organisms/DataGrid/DataGrid.emotion.d.ts +2 -0
  38. package/dist/components/organisms/DataGrid/DataGrid.interface.d.ts +124 -0
  39. package/dist/components/organisms/DataGrid/DataGridMenu/DataGridMenu.d.ts +14 -0
  40. package/dist/components/organisms/DataGrid/DataGridMenu/DataGridMenu.emotion.d.ts +2 -0
  41. package/dist/components/organisms/DataGrid/DataGridMenu/DataGridMenu.interface.d.ts +54 -0
  42. package/dist/components/organisms/DataGrid/DataGridMenu/components/DataGridMenuMultiSelect.d.ts +12 -0
  43. package/dist/components/organisms/DataGrid/DataGridMenu/components/DataGridMenuSearch.d.ts +8 -0
  44. package/dist/components/organisms/DataGrid/DataGridMenu/index.d.ts +3 -0
  45. package/dist/components/organisms/DataGrid/DataGridSkeleton/DataGridSkeleton.d.ts +7 -0
  46. package/dist/components/organisms/DataGrid/DataGridSkeleton/index.d.ts +1 -0
  47. package/dist/components/organisms/DataGrid/index.d.ts +4 -0
  48. package/dist/{emotion-react-jsx-runtime.browser.esm-ClrpcFMG.js → emotion-react-jsx-runtime.browser.esm-C4rLUMui.js} +9 -8
  49. package/dist/emotion-react-jsx-runtime.browser.esm-C4rLUMui.js.map +1 -0
  50. package/dist/hocs/ThemeProvider/components/DataGrid.d.ts +20 -0
  51. package/dist/hocs/ThemeProvider/components/DataGridMenu.d.ts +18 -0
  52. package/dist/hocs/ThemeProvider/components/Modal.d.ts +16 -0
  53. package/dist/hocs/ThemeProvider/components/Pagination.d.ts +13 -0
  54. package/dist/hocs/ThemeProvider/components/PaginationMenu.d.ts +24 -0
  55. package/dist/hocs/ThemeProvider/components/index.d.ts +5 -1
  56. package/dist/hocs/ThemeProvider/interfaces/Components.interface.d.ts +6 -1
  57. package/dist/hocs.mjs +1 -1
  58. package/dist/hooks/useOnClickOutside.d.ts +2 -3
  59. package/dist/hooks.mjs +1 -1
  60. package/dist/index.d.ts +6 -0
  61. package/dist/index.mjs +922 -6
  62. package/dist/index.mjs.map +1 -0
  63. package/dist/molecules.mjs +1 -1
  64. package/dist/theme/dark/colors.d.ts +1 -0
  65. package/dist/theme/dark/components/Button.d.ts +37 -0
  66. package/dist/theme/dark/components/DataGrid.d.ts +26 -0
  67. package/dist/theme/dark/components/DataGridMenu.d.ts +20 -0
  68. package/dist/theme/dark/components/Modal.d.ts +20 -0
  69. package/dist/theme/dark/components/Pagination.d.ts +12 -0
  70. package/dist/theme/dark/components/PaginationMenu.d.ts +32 -0
  71. package/dist/theme/dark/components/index.d.ts +132 -0
  72. package/dist/theme/dark/index.d.ts +132 -0
  73. package/dist/theme/index.d.ts +132 -0
  74. package/dist/{theme-D18AZjTt.js → theme-Cxg9jdmX.js} +126 -29
  75. package/dist/theme-Cxg9jdmX.js.map +1 -0
  76. package/dist/theme.mjs +1 -1
  77. package/dist/useStateCallback-B4O93zzK.js +32 -0
  78. package/dist/useStateCallback-B4O93zzK.js.map +1 -0
  79. package/dist/utilities.mjs +4 -5
  80. package/dist/utilities.mjs.map +1 -1
  81. package/package.json +1 -1
  82. package/dist/RadioGroup.context-BdRgENJJ.js.map +0 -1
  83. package/dist/Switch-C7wjcrjU.js.map +0 -1
  84. package/dist/emotion-react-jsx-runtime.browser.esm-ClrpcFMG.js.map +0 -1
  85. package/dist/theme-D18AZjTt.js.map +0 -1
  86. package/dist/useStateCallback-D9fqdxiO.js +0 -26
  87. package/dist/useStateCallback-D9fqdxiO.js.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,6 +1,922 @@
1
- import { n as e } from "./theme-D18AZjTt.js";
2
- import { a as t, n } from "./RadioGroup.context-BdRgENJJ.js";
3
- import { a as r, c as i, i as a, n as o, o as s, r as c, s as l, t as u } from "./Switch-C7wjcrjU.js";
4
- import { n as d, r as f, t as p } from "./RadioGroup-CdW6yS38.js";
5
- import { t as m } from "./ThemeProvider-JlN3U_r2.js";
6
- export { i as Button, n as Checkbox, f as CheckboxGroup, d as CheckboxTree, s as DatePicker, t as Icon, l as IconButton, r as Input, a as Radio, p as RadioGroup, c as Select, o as Slider, u as Switch, m as ThemeProvider, e as darkTheme };
1
+ import { i as e, n as t, r as n, t as r } from "./emotion-react-jsx-runtime.browser.esm-C4rLUMui.js";
2
+ import { n as i, r as a } from "./theme-Cxg9jdmX.js";
3
+ import { a as o, n as s, o as c } from "./RadioGroup.context-QNk2hW_4.js";
4
+ import { a as l, c as u, i as d, n as f, o as p, r as m, s as h, t as g } from "./Switch-JF9P9VJf.js";
5
+ import { n as _, r as v, t as y } from "./RadioGroup-DCJBoZc-.js";
6
+ import { t as b } from "./ThemeProvider-Q2Hjezbt.js";
7
+ import { useCallback as x, useEffect as S, useLayoutEffect as C, useMemo as w, useRef as T, useState as E } from "react";
8
+ import { css as D, keyframes as O } from "@emotion/react";
9
+ import k from "react-dom";
10
+ //#region src/components/atoms/Skeleton/Skeleton.emotion.ts
11
+ var ee = D`
12
+ &.--SKELETON {
13
+ display: block;
14
+ background: linear-gradient(
15
+ 90deg,
16
+ rgba(255, 255, 255, 0.05) 0%,
17
+ rgba(255, 255, 255, 0.13) 50%,
18
+ rgba(255, 255, 255, 0.05) 100%
19
+ );
20
+ background-size: 200% 100%;
21
+ animation: ${O`
22
+ 0% { background-position: 200% center; }
23
+ 100% { background-position: -200% center; }
24
+ `} 1.4s ease infinite;
25
+
26
+ &.--SKELETON--circular {
27
+ border-radius: 50%;
28
+ }
29
+
30
+ &.--SKELETON--rectangular {
31
+ border-radius: 4px;
32
+ }
33
+ }
34
+ `, A = ({ variant: e = "rectangular", width: n, height: r, className: i }) => /* @__PURE__ */ t("span", {
35
+ className: [
36
+ "--SKELETON",
37
+ `--SKELETON--${e}`,
38
+ i || ""
39
+ ].filter(Boolean).join(" "),
40
+ css: ee,
41
+ style: {
42
+ width: n,
43
+ height: r
44
+ },
45
+ "aria-hidden": "true"
46
+ }), te = (e) => D`
47
+ &.--DATAGRID {
48
+ width: 100%;
49
+ box-sizing: border-box;
50
+
51
+ ${a(e, "background-color", "--DATAGRID-ROOT-BACKGROUND-COLOR")};
52
+ ${a(e, "border-color", "--DATAGRID-ROOT-BORDER-COLOR")};
53
+ ${a(e, "border-width", "--DATAGRID-ROOT-BORDER-WIDTH")};
54
+ ${a(e, "border-radius", "--DATAGRID-ROOT-BORDER-RADIUS")};
55
+ ${a(e, "border-style", "--DATAGRID-ROOT-BORDER-STYLE")};
56
+
57
+ .--DATAGRID-tableContainer {
58
+ width: 100%;
59
+ overflow-x: auto;
60
+ }
61
+
62
+ .--DATAGRID-bodyContainer {
63
+ &::-webkit-scrollbar {
64
+ width: 12px;
65
+ height: 4px;
66
+ }
67
+
68
+ &::-webkit-scrollbar-thumb {
69
+ background-color: rgba(0, 0, 0, 0.5);
70
+ border-radius: 9999px;
71
+ border: 3px solid transparent;
72
+ background-clip: padding-box;
73
+ }
74
+ }
75
+
76
+ .--DATAGRID-table {
77
+ width: 100%;
78
+ border-collapse: collapse;
79
+
80
+ .--DATAGRID-thead {
81
+ .--DATAGRID-thScrollbarSpacer {
82
+ border: none;
83
+ background: transparent;
84
+ }
85
+
86
+ .--DATAGRID-headerRow {
87
+ height: 48px;
88
+
89
+ .--DATAGRID-th {
90
+ ${a(e, "background-color", "--DATAGRID-ROOT-BACKGROUND-COLOR")};
91
+
92
+ padding: 8px 16px;
93
+ text-align: left;
94
+ white-space: nowrap;
95
+
96
+ ${a(e, "border-bottom-color", "--DATAGRID-ROOT-BORDER-COLOR")};
97
+ ${a(e, "border-bottom-width", "--DATAGRID-ROOT-BORDER-WIDTH")};
98
+ ${a(e, "border-bottom-style", "--DATAGRID-ROOT-BORDER-STYLE")};
99
+
100
+ &.--DATAGRID-thOptions {
101
+ width: 80px;
102
+ text-align: right;
103
+ }
104
+
105
+ .--DATAGRID-thInner {
106
+ display: flex;
107
+ align-items: center;
108
+ gap: 6px;
109
+
110
+ .--DATAGRID-thActions {
111
+ display: flex;
112
+ align-items: center;
113
+ gap: 8px;
114
+ margin-left: auto;
115
+ }
116
+
117
+ .--DATAGRID-filterActive {
118
+ ${a(e, "color", "--DATAGRID-EVENTS-ENABLED-ICON-COLOR")};
119
+ }
120
+
121
+ .--DATAGRID-thLabel {
122
+ ${a(e, "color", "--DATAGRID-EVENTS-ENABLED-COLOR-SECONDARY")};
123
+
124
+ font-family: ${e["--FONTFAMILY-PRIMARY"]};
125
+ font-size: 0.875rem;
126
+ font-weight: 500;
127
+ letter-spacing: 0.01em;
128
+ line-height: 1;
129
+ white-space: nowrap;
130
+ }
131
+
132
+ .--DATAGRID-filterContainer {
133
+ display: flex;
134
+ align-items: center;
135
+ gap: 4px;
136
+
137
+ .--DATAGRID-filterLabel {
138
+ ${a(e, "color", "--DATAGRID-EVENTS-ENABLED-COLOR-SECONDARY")};
139
+
140
+ font-family: ${e["--FONTFAMILY-PRIMARY"]};
141
+ font-size: 0.75rem;
142
+ font-weight: 500;
143
+ cursor: pointer;
144
+ }
145
+ }
146
+ }
147
+ }
148
+ }
149
+ }
150
+
151
+ .--DATAGRID-tbody {
152
+ .--DATAGRID-row {
153
+ height: 48px;
154
+ transition: background-color 150ms;
155
+
156
+ ${a(e, "border-bottom-color", "--DATAGRID-ROOT-BORDER-COLOR")};
157
+ ${a(e, "border-bottom-width", "--DATAGRID-ROOT-BORDER-WIDTH")};
158
+ ${a(e, "border-bottom-style", "--DATAGRID-ROOT-BORDER-STYLE")};
159
+
160
+ &:hover {
161
+ ${a(e, "background-color", "--DATAGRID-EVENTS-HOVER-BACKGROUND-COLOR")};
162
+ }
163
+
164
+ &:last-child {
165
+ border-bottom: none;
166
+ }
167
+ }
168
+
169
+ .--DATAGRID-td {
170
+ ${a(e, "color", "--DATAGRID-EVENTS-ENABLED-COLOR-PRIMARY")};
171
+
172
+ padding: 8px 16px;
173
+ vertical-align: middle;
174
+
175
+ font-family: ${e["--FONTFAMILY-PRIMARY"]};
176
+ font-size: 0.875rem;
177
+ font-weight: 500;
178
+ letter-spacing: 0.01em;
179
+ line-height: 1;
180
+ }
181
+
182
+ .--DATAGRID-emptyCell {
183
+ text-align: center;
184
+ vertical-align: middle;
185
+
186
+ ${a(e, "color", "--DATAGRID-EVENTS-ENABLED-COLOR-SECONDARY")};
187
+
188
+ font-family: ${e["--FONTFAMILY-PRIMARY"]};
189
+ font-size: 0.875rem;
190
+ font-weight: 400;
191
+ }
192
+
193
+ .--DATAGRID-loadingMore {
194
+ text-align: center;
195
+ padding: 12px 16px;
196
+ height: 48px;
197
+ vertical-align: middle;
198
+
199
+ ${a(e, "color", "--DATAGRID-EVENTS-ENABLED-COLOR-SECONDARY")};
200
+
201
+ font-family: ${e["--FONTFAMILY-PRIMARY"]};
202
+ font-size: 0.875rem;
203
+ }
204
+ }
205
+ }
206
+
207
+ .--DATAGRID-tdOptions {
208
+ text-align: right;
209
+ display: flex;
210
+ gap: 8px;
211
+ justify-content: flex-end;
212
+ align-items: center;
213
+ padding: 12px 16px !important;
214
+ }
215
+ }
216
+ `, j = (e, t) => `
217
+ // BACKGROUNDS
218
+ ${a(e, "background-color", `--DATAGRIDMENU-${t}-BACKGROUND-COLOR`)}
219
+
220
+ // BORDERS
221
+ ${a(e, "border-color", `--DATAGRIDMENU-${t}-BORDER-COLOR`)}
222
+ ${a(e, "border-width", `--DATAGRIDMENU-${t}-BORDER-WIDTH`)}
223
+ ${a(e, "border-style", `--DATAGRIDMENU-${t}-BORDER-STYLE`)}
224
+ ${a(e, "border-radius", `--DATAGRIDMENU-${t}-BORDER-RADIUS`)}
225
+ `, M = (e) => D`
226
+ &.--DATAGRIDMENU {
227
+ position: fixed;
228
+ z-index: 200;
229
+ padding: 16px;
230
+ width: calc(240px - 32px);
231
+ display: flex;
232
+ flex-direction: column;
233
+ gap: 12px;
234
+ box-shadow:
235
+ rgba(0, 0, 0, 0.2) 0px 5px 5px -3px,
236
+ rgba(0, 0, 0, 0.14) 0px 8px 10px 1px,
237
+ rgba(0, 0, 0, 0.12) 0px 3px 14px 2px;
238
+
239
+ ${j(e, "ROOT")}
240
+
241
+ .--DATAGRIDMENU-header {
242
+ display: flex;
243
+ align-items: center;
244
+ justify-content: space-between;
245
+
246
+ .--DATAGRIDMENU-headerTitle {
247
+ ${a(e, "color", "--DATAGRIDMENU-EVENTS-ENABLED-COLOR-PRIMARY")};
248
+ font-family: ${e["--FONTFAMILY-PRIMARY"]};
249
+ font-size: 0.875rem;
250
+ font-weight: 600;
251
+ }
252
+ }
253
+
254
+ .--DATAGRIDMENU-content {
255
+ display: flex;
256
+ flex-direction: column;
257
+ gap: 8px;
258
+ }
259
+
260
+ // ─── Options list ─────────────────────────────────────────────────────────
261
+
262
+ .--DATAGRIDMENU-optionsList {
263
+ max-height: 180px;
264
+ overflow-y: auto;
265
+ // padding + negative margin let the Checkbox ::before shadow render without being clipped
266
+ padding: 4px 8px;
267
+ margin: 0 -8px;
268
+ display: flex;
269
+ flex-direction: column;
270
+ gap: 12px;
271
+
272
+ &::-webkit-scrollbar {
273
+ width: 12px;
274
+ height: 4px;
275
+ }
276
+ &::-webkit-scrollbar-thumb {
277
+ background-color: rgba(0, 0, 0, 0.5);
278
+ border-radius: 9999px;
279
+ border: 3px solid transparent;
280
+ background-clip: padding-box;
281
+ }
282
+ }
283
+
284
+ .--DATAGRIDMENU-optionRow {
285
+ display: flex;
286
+ align-items: center;
287
+ gap: 8px;
288
+ }
289
+
290
+ .--DATAGRIDMENU-optionDot {
291
+ width: 6px;
292
+ height: 24px;
293
+ border-radius: 2px;
294
+ flex-shrink: 0;
295
+ }
296
+
297
+ .--DATAGRIDMENU-actions {
298
+ display: flex;
299
+ gap: 8px;
300
+ justify-content: flex-end;
301
+ }
302
+ }
303
+ `, N = "--DATAGRIDMENU", P = ({ columnKey: e, pendingSearch: n, onSearchChange: r, searchLabel: i = "Search" }) => /* @__PURE__ */ t("div", {
304
+ className: `${N}-searchInput`,
305
+ children: /* @__PURE__ */ t(l, {
306
+ name: `search-${e}`,
307
+ label: i,
308
+ value: n,
309
+ onValueChange: r,
310
+ showErrorText: !1,
311
+ width: "full",
312
+ autoFocus: !0,
313
+ "data-testid": `${N}-searchInput-${e}`,
314
+ startAdornment: /* @__PURE__ */ t(o, {
315
+ name: "search",
316
+ style: { color: "white" }
317
+ })
318
+ })
319
+ }), F = "--DATAGRIDMENU", I = ({ filterType: e, columnKey: i, options: a, pendingMulti: o, onMultiChange: c, multiSearch: u, onMultiSearchChange: d }) => {
320
+ let f = e === "multiselect-search", p = a.filter((e) => !u || e.label.toLowerCase().includes(u.toLowerCase()));
321
+ return /* @__PURE__ */ n(r, { children: [f && /* @__PURE__ */ t("div", {
322
+ className: `${F}-searchInput`,
323
+ children: /* @__PURE__ */ t(l, {
324
+ name: `multiSearch-${i}`,
325
+ label: "Search options",
326
+ value: u,
327
+ onValueChange: d,
328
+ showErrorText: !1,
329
+ width: "full",
330
+ autoFocus: !0,
331
+ "data-testid": `${F}-multiSearch-${i}`
332
+ })
333
+ }), /* @__PURE__ */ t("div", {
334
+ className: `${F}-optionsList`,
335
+ "data-testid": `${F}-optionsList-${i}`,
336
+ children: p.map((e) => /* @__PURE__ */ n("div", {
337
+ className: `${F}-optionRow`,
338
+ children: [e.color && /* @__PURE__ */ t("span", {
339
+ className: `${F}-optionDot`,
340
+ style: { backgroundColor: e.color },
341
+ "aria-hidden": "true"
342
+ }), /* @__PURE__ */ t(s, {
343
+ checked: o.includes(e.value),
344
+ onChecked: (t) => c(t ? [...o, e.value] : o.filter((t) => t !== e.value)),
345
+ label: e.label,
346
+ showErrorText: !1,
347
+ "data-testid": `${F}-option-${i}-${e.value}`
348
+ })]
349
+ }, e.value))
350
+ })] });
351
+ }, L = "--DATAGRIDMENU", R = ({ filterType: e, options: r, columnKey: i, filterTitle: a, searchLabel: s, cancelLabel: c = "Cancel", applyLabel: l = "Apply", pendingSearch: d, onSearchChange: f, pendingMulti: p, onMultiChange: m, multiSearch: g, onMultiSearchChange: _, onCancel: v, onApply: y, onClear: b, anchorEl: x, style: S }) => {
352
+ let w = T(null);
353
+ return C(() => {
354
+ if (!x) return;
355
+ let e = () => {
356
+ if (!w.current) return;
357
+ let e = x.getBoundingClientRect(), t = w.current.offsetWidth, n = e.left + e.width / 2 - t / 2;
358
+ w.current.style.top = `${e.bottom + 8}px`, w.current.style.left = `${Math.max(8, Math.min(n, window.innerWidth - t - 8))}px`;
359
+ };
360
+ return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
361
+ window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
362
+ };
363
+ }, [x]), k.createPortal(/* @__PURE__ */ n("div", {
364
+ ref: w,
365
+ className: L,
366
+ css: M(S),
367
+ "data-popover-key": i,
368
+ "data-testid": `${L}-${i}`,
369
+ children: [
370
+ /* @__PURE__ */ n("div", {
371
+ className: `${L}-header`,
372
+ children: [/* @__PURE__ */ t("span", {
373
+ className: `${L}-headerTitle`,
374
+ children: a
375
+ }), /* @__PURE__ */ t(h, {
376
+ icon: /* @__PURE__ */ t(o, {
377
+ name: "delete_outline",
378
+ size: "sm"
379
+ }),
380
+ onClick: b,
381
+ "aria-label": "Clear filter",
382
+ "data-testid": `${L}-clearBtn-${i}`
383
+ })]
384
+ }),
385
+ /* @__PURE__ */ n("div", {
386
+ className: `${L}-content`,
387
+ children: [e === "search" && /* @__PURE__ */ t(P, {
388
+ columnKey: i,
389
+ pendingSearch: d,
390
+ onSearchChange: f,
391
+ searchLabel: s
392
+ }), (e === "multiselect" || e === "multiselect-search") && /* @__PURE__ */ t(I, {
393
+ filterType: e,
394
+ columnKey: i,
395
+ options: r ?? [],
396
+ pendingMulti: p,
397
+ onMultiChange: m,
398
+ multiSearch: g,
399
+ onMultiSearchChange: _
400
+ })]
401
+ }),
402
+ /* @__PURE__ */ n("div", {
403
+ className: `${L}-actions`,
404
+ children: [/* @__PURE__ */ t(u, {
405
+ onClick: v,
406
+ "data-testid": `${L}-cancelBtn-${i}`,
407
+ variant: "ghost",
408
+ children: c
409
+ }), /* @__PURE__ */ t(u, {
410
+ onClick: y,
411
+ "data-testid": `${L}-applyBtn-${i}`,
412
+ children: l
413
+ })]
414
+ })
415
+ ]
416
+ }), document.body);
417
+ }, ne = ({ theme: n, variant: r = "default", ...i }) => {
418
+ let { componentStyles: a } = e([c.DATAGRIDMENU], n, r.toUpperCase());
419
+ return /* @__PURE__ */ t(R, {
420
+ ...i,
421
+ style: a
422
+ });
423
+ }, z = "--DATAGRID", re = ({ columns: e, pageSize: n }) => {
424
+ let i = w(() => Array.from({ length: n }, () => e.map((e) => e.type === "options" ? null : `${Math.floor(Math.random() * 51) + 40}%`)), [n, e.length]);
425
+ return /* @__PURE__ */ t(r, { children: Array.from({ length: n }).map((n, r) => /* @__PURE__ */ t("tr", {
426
+ className: `${z}-row`,
427
+ children: e.map((e, n) => /* @__PURE__ */ t("td", {
428
+ className: [`${z}-td`, e.type === "options" ? `${z}-tdOptions` : ""].filter(Boolean).join(" "),
429
+ children: e.type === "options" ? /* @__PURE__ */ t(A, {
430
+ variant: "circular",
431
+ width: 24,
432
+ height: 24
433
+ }) : /* @__PURE__ */ t(A, {
434
+ height: 16,
435
+ width: i[r][n] ?? void 0
436
+ })
437
+ }, e.key))
438
+ }, r)) });
439
+ }, B = (e) => D`
440
+ &.--PAGINATION {
441
+ display: flex;
442
+ align-items: center;
443
+ justify-content: flex-end;
444
+ gap: 16px;
445
+ padding: 8px 16px;
446
+
447
+ .--PAGINATION-rowsControl {
448
+ position: relative;
449
+ display: flex;
450
+ align-items: center;
451
+ gap: 8px;
452
+
453
+ .--PAGINATION-rowsSize {
454
+ ${a(e, "color", "--PAGINATION-EVENTS-ENABLED-COLOR-SECONDARY")};
455
+ font-family: ${e["--FONTFAMILY-PRIMARY"]};
456
+ font-size: 0.8125rem;
457
+ user-select: none;
458
+ min-width: 20px;
459
+ text-align: center;
460
+ }
461
+ }
462
+
463
+ .--PAGINATION-controls {
464
+ display: flex;
465
+ align-items: center;
466
+ gap: 8px;
467
+
468
+ .--PAGINATION-info {
469
+ ${a(e, "color", "--PAGINATION-EVENTS-ENABLED-COLOR-SECONDARY")};
470
+ font-family: ${e["--FONTFAMILY-PRIMARY"]};
471
+ font-size: 0.8125rem;
472
+ user-select: none;
473
+ }
474
+ }
475
+ }
476
+ `, V = (e, t) => `
477
+ // BACKGROUNDS
478
+ ${a(e, "background-color", `--PAGINATIONMENU-EVENTS-${t}-BACKGROUND-COLOR`)}
479
+
480
+ // BORDERS
481
+ ${a(e, "border-color", `--PAGINATIONMENU-EVENTS-${t}-BORDER-COLOR`)}
482
+ ${a(e, "border-width", `--PAGINATIONMENU-EVENTS-${t}-BORDER-WIDTH`)}
483
+ ${a(e, "border-style", `--PAGINATIONMENU-EVENTS-${t}-BORDER-STYLE`)}
484
+ ${a(e, "border-radius", `--PAGINATIONMENU-EVENTS-${t}-BORDER-RADIUS`)}
485
+ `, H = (e, t) => `
486
+ // TYPOGRAPHY
487
+ ${a(e, "color", `--PAGINATIONMENU-EVENTS-${t}-COLOR-PRIMARY`)};
488
+ ${a(e, "caret-color", `--PAGINATIONMENU-EVENTS-${t}-COLOR-PRIMARY`)};
489
+ `, ie = (e, t) => `
490
+ // BACKGROUNDS
491
+ ${a(e, "background-color", `--PAGINATIONMENU-${t}-BACKGROUND-COLOR`)}
492
+
493
+ // BORDERS
494
+ ${a(e, "border-color", `--PAGINATIONMENU-${t}-BORDER-COLOR`)}
495
+ ${a(e, "border-width", `--PAGINATIONMENU-${t}-BORDER-WIDTH`)}
496
+ ${a(e, "border-style", `--PAGINATIONMENU-${t}-BORDER-STYLE`)}
497
+ ${a(e, "border-radius", `--PAGINATIONMENU-${t}-BORDER-RADIUS`)}
498
+ `, U = (e) => D`
499
+ &.--PAGINATIONMENU {
500
+ position: absolute;
501
+ bottom: calc(100% + ${e["--PAGINATIONMENU-ROOT-BOTTOM"] || ""});
502
+ left: 50%;
503
+ transform: translateX(-50%);
504
+ display: flex;
505
+ flex-direction: column;
506
+ overflow: hidden;
507
+ z-index: 10;
508
+ box-shadow:
509
+ rgba(0, 0, 0, 0.2) 0px 5px 5px -3px,
510
+ rgba(0, 0, 0, 0.14) 0px 8px 10px 1px,
511
+ rgba(0, 0, 0, 0.12) 0px 3px 14px 2px;
512
+
513
+ ${ie(e, "ROOT")}
514
+
515
+ .--PAGINATIONMENU-option {
516
+ all: unset;
517
+ cursor: pointer;
518
+ text-align: center;
519
+ padding: 6px 20px;
520
+ white-space: nowrap;
521
+ transition: background-color 120ms;
522
+ font-family: ${e["--FONTFAMILY-PRIMARY"]};
523
+ font-size: 0.8125rem;
524
+
525
+ // ENABLED
526
+ ${V(e, "ENABLED")}
527
+ ${H(e, "ENABLED")}
528
+
529
+ // VALUE
530
+ &.--PAGINATIONMENU-selected {
531
+ ${V(e, "VALUE")}
532
+ ${H(e, "VALUE")}
533
+ }
534
+
535
+ // HOVER
536
+ &:hover {
537
+ ${V(e, "HOVER")}
538
+ ${H(e, "HOVER")}
539
+ }
540
+
541
+ // - ACTIVE
542
+ &:active,
543
+ &.--PAGINATIONMENU-active {
544
+ ${V(e, "ACTIVE")}
545
+ ${H(e, "ACTIVE")}
546
+ }
547
+
548
+ // FOCUS
549
+ &:focus-visible {
550
+ outline-offset: 0px;
551
+ outline: 0;
552
+ ${V(e, "FOCUS")}
553
+ ${H(e, "FOCUS")}
554
+ }
555
+ }
556
+ }
557
+ `, W = "--PAGINATIONMENU", G = ({ options: e, activeOption: n, onSelect: r, focusedElement: i = -1, style: a }) => /* @__PURE__ */ t("div", {
558
+ className: W,
559
+ css: U(a),
560
+ children: e.map((e, a) => {
561
+ let o = e === n ? `${W}-selected` : "", s = i === a;
562
+ return /* @__PURE__ */ t("button", {
563
+ className: [
564
+ `${W}-option`,
565
+ o,
566
+ s ? `${W}-active` : ""
567
+ ].filter(Boolean).join(" "),
568
+ onClick: () => r(e),
569
+ children: e
570
+ }, e);
571
+ })
572
+ }), K = ({ theme: n, variant: r = "default", ...i }) => {
573
+ let { componentStyles: a } = e([c.PAGINATIONMENU], n, r.toUpperCase());
574
+ return /* @__PURE__ */ t(G, {
575
+ ...i,
576
+ style: a
577
+ });
578
+ }, q = "--PAGINATION", J = ({ page: e, total: r, pageSize: i, onPageChange: a, pageSizeOptions: s, onPageSizeChange: c, loading: l, className: u, style: d }) => {
579
+ let [f, p] = E(!1), [m, g] = E(-1), _ = Math.max(1, Math.ceil(r / i)), v = e * i + 1, y = Math.min((e + 1) * i, r), b = e === 0, x = e >= _ - 1, C = () => {
580
+ p(!1), g(-1);
581
+ };
582
+ return S(() => {
583
+ if (!f) return;
584
+ let e = (e) => {
585
+ e.target.closest(`.${q}-rowsControl`) || (p(!1), g(-1));
586
+ };
587
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
588
+ }, [f]), /* @__PURE__ */ n("div", {
589
+ className: [q, u || ""].filter(Boolean).join(" "),
590
+ css: B(d ?? {}),
591
+ children: [s && s.length > 0 && /* @__PURE__ */ n("div", {
592
+ className: `${q}-rowsControl`,
593
+ children: [
594
+ f && /* @__PURE__ */ t(K, {
595
+ options: s,
596
+ activeOption: i,
597
+ onSelect: (e) => {
598
+ c?.(e), C();
599
+ },
600
+ focusedElement: m
601
+ }),
602
+ /* @__PURE__ */ t("span", {
603
+ className: `${q}-rowsSize`,
604
+ children: i
605
+ }),
606
+ /* @__PURE__ */ t(h, {
607
+ icon: /* @__PURE__ */ t(o, {
608
+ name: "arrow_drop_up",
609
+ size: "sm"
610
+ }),
611
+ onClick: () => f ? C() : p(!0),
612
+ onKeyDown: (e) => {
613
+ if (e.key === "Tab" || e.key === "Escape") p(!1), g(-1);
614
+ else if (["ArrowDown", "ArrowUp"].includes(e.key) && f) e.preventDefault(), e.key === "ArrowDown" ? g((e) => e + 1 >= (s?.length ?? 0) ? 0 : e + 1) : g((e) => e - 1 < 0 ? (s?.length ?? 1) - 1 : e - 1);
615
+ else if (e.key === "Enter" && f && m >= 0 && s) {
616
+ e.preventDefault();
617
+ let t = s[m];
618
+ t !== void 0 && (c?.(t), p(!1), g(-1));
619
+ }
620
+ },
621
+ isFlipped: f,
622
+ "aria-label": "Rows per page",
623
+ "data-testid": `${q}-rowsBtn`
624
+ })
625
+ ]
626
+ }), /* @__PURE__ */ n("div", {
627
+ className: `${q}-controls`,
628
+ children: [
629
+ /* @__PURE__ */ n("span", {
630
+ className: `${q}-info`,
631
+ children: [
632
+ v,
633
+ "-",
634
+ y,
635
+ " of ",
636
+ r
637
+ ]
638
+ }),
639
+ /* @__PURE__ */ t(h, {
640
+ icon: /* @__PURE__ */ t(o, {
641
+ name: "first_page",
642
+ size: "sm"
643
+ }),
644
+ onClick: () => a(0),
645
+ disabled: l || b,
646
+ "aria-label": "First page",
647
+ "data-testid": `${q}-first`
648
+ }),
649
+ /* @__PURE__ */ t(h, {
650
+ icon: /* @__PURE__ */ t(o, {
651
+ name: "chevron_left",
652
+ size: "sm"
653
+ }),
654
+ onClick: () => a(e - 1),
655
+ disabled: l || b,
656
+ "aria-label": "Previous page",
657
+ "data-testid": `${q}-prev`
658
+ }),
659
+ /* @__PURE__ */ t(h, {
660
+ icon: /* @__PURE__ */ t(o, {
661
+ name: "chevron_right",
662
+ size: "sm"
663
+ }),
664
+ onClick: () => a(e + 1),
665
+ disabled: l || x,
666
+ "aria-label": "Next page",
667
+ "data-testid": `${q}-next`
668
+ }),
669
+ /* @__PURE__ */ t(h, {
670
+ icon: /* @__PURE__ */ t(o, {
671
+ name: "last_page",
672
+ size: "sm"
673
+ }),
674
+ onClick: () => a(_ - 1),
675
+ disabled: l || x,
676
+ "aria-label": "Last page",
677
+ "data-testid": `${q}-last`
678
+ })
679
+ ]
680
+ })]
681
+ });
682
+ }, Y = ({ theme: n, variant: r = "default", ...i }) => {
683
+ let { componentStyles: a } = e([c.PAGINATION], n, r.toUpperCase());
684
+ return /* @__PURE__ */ t(J, {
685
+ ...i,
686
+ style: a
687
+ });
688
+ }, X = "--DATAGRID", ae = 10, Z = ({ columns: e, onFetch: i, paginationType: a = "pagination", pageSize: s = ae, pageSizeOptions: c, emptyContent: l = /* @__PURE__ */ t("span", { children: "No se han encontrado resultados" }), loadingMoreContent: u = /* @__PURE__ */ t("span", { children: "Cargando..." }), className: d, style: f }) => {
689
+ let [p, m] = E([]), [g, _] = E(0), [v, y] = E(0), [b, w] = E(s), [D, O] = E(!0), [k, ee] = E(null), [A, j] = E({}), [M, N] = E(null), [P, F] = E(null), [I, L] = E(""), [R, z] = E([]), [B, V] = E(""), [H, ie] = E([]), [U, W] = E(0), G = T({}), K = T(null), q = T(null);
690
+ S(() => {
691
+ let e = !1;
692
+ return i({
693
+ page: v,
694
+ pageSize: b,
695
+ filters: A,
696
+ sort: k ?? void 0
697
+ }).then((t) => {
698
+ e || (m((e) => a === "scroll" && v > 0 ? [...e, ...t.data] : t.data), _(t.total), O(!1));
699
+ }), () => {
700
+ e = !0;
701
+ };
702
+ }, [
703
+ v,
704
+ b,
705
+ A,
706
+ k,
707
+ a,
708
+ i
709
+ ]), C(() => {
710
+ a !== "scroll" || !K.current || !q.current || (ie(Array.from(K.current.querySelectorAll(`th:not(.${X}-thScrollbarSpacer)`)).map((e) => e.offsetWidth)), W(q.current.offsetWidth - q.current.clientWidth));
711
+ }, [
712
+ a,
713
+ e.length,
714
+ D
715
+ ]), S(() => {
716
+ if (!M) return;
717
+ let e = (e) => {
718
+ e.target.closest(`[data-popover-key="${M}"]`) || N(null);
719
+ };
720
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
721
+ }, [M]);
722
+ let J = (e) => {
723
+ if (!e.filter) return;
724
+ if (M === e.key) {
725
+ N(null), F(null);
726
+ return;
727
+ }
728
+ let t = A[e.key];
729
+ e.filter.type === "search" ? L(typeof t == "string" ? t : "") : (z(Array.isArray(t) ? t : []), V("")), F(G.current[e.key] ?? null), N(e.key);
730
+ }, Z = (e) => {
731
+ if (!e.filter) return;
732
+ let t = e.filter.type === "search" ? I : R;
733
+ O(!0), j((n) => ({
734
+ ...n,
735
+ [e.key]: t
736
+ })), y(0), N(null);
737
+ }, Q = (e) => {
738
+ let t = A[e];
739
+ return t == null ? !1 : Array.isArray(t) ? t.length > 0 : t !== "";
740
+ }, oe = (e) => {
741
+ O(!0), ee((t) => t?.key === e ? {
742
+ key: e,
743
+ direction: t.direction === "asc" ? "desc" : "asc"
744
+ } : {
745
+ key: e,
746
+ direction: "asc"
747
+ }), y(0);
748
+ }, se = (e) => {
749
+ O(!0), y(e);
750
+ }, ce = (e) => {
751
+ O(!0), w(e), y(0);
752
+ }, le = x((e) => {
753
+ if (a !== "scroll" || D || p.length >= g) return;
754
+ let { scrollTop: t, scrollHeight: n, clientHeight: r } = e.currentTarget;
755
+ n - t - r < 48 && (O(!0), y((e) => e + 1));
756
+ }, [
757
+ a,
758
+ D,
759
+ p.length,
760
+ g
761
+ ]), ue = e.length, $ = M ? e.find((e) => e.key === M) : void 0, de = b * 48, fe = !D && p.length === 0, pe = e.map((e) => /* @__PURE__ */ t("th", {
762
+ className: [`${X}-th`, e.type === "options" ? `${X}-thOptions` : ""].join(" "),
763
+ style: e.width ? { width: e.width } : void 0,
764
+ children: /* @__PURE__ */ n("div", {
765
+ className: `${X}-thInner`,
766
+ "data-testid": `${X}-th-${e.key}`,
767
+ children: [/* @__PURE__ */ t("span", {
768
+ className: `${X}-thLabel`,
769
+ children: e.label
770
+ }), e.type !== "options" && /* @__PURE__ */ n("div", {
771
+ className: `${X}-thActions`,
772
+ children: [e.filter && /* @__PURE__ */ t("div", {
773
+ className: `${X}-filterContainer`,
774
+ "data-popover-key": e.key,
775
+ children: /* @__PURE__ */ t("span", {
776
+ ref: (t) => {
777
+ G.current[e.key] = t;
778
+ },
779
+ children: /* @__PURE__ */ t(h, {
780
+ icon: /* @__PURE__ */ t(o, {
781
+ name: Q(e.key) ? "filter_alt" : "filter_list",
782
+ size: "sm",
783
+ style: { color: Q(e.key) ? "white" : "" }
784
+ }),
785
+ onClick: () => J(e),
786
+ "data-testid": `${X}-filterBtn-${e.key}`,
787
+ "aria-label": `Filter ${e.label}`
788
+ })
789
+ })
790
+ }), e.sortable !== !1 && /* @__PURE__ */ t(h, {
791
+ icon: /* @__PURE__ */ t(o, {
792
+ name: k?.key === e.key ? k.direction === "asc" ? "arrow_upward" : "arrow_downward" : "unfold_more",
793
+ size: "sm",
794
+ style: { color: k?.key === e.key ? "white" : "" }
795
+ }),
796
+ onClick: () => oe(e.key),
797
+ "data-testid": `${X}-sortBtn-${e.key}`,
798
+ "aria-label": `Sort ${e.label}`
799
+ })]
800
+ })]
801
+ })
802
+ }, e.key)), me = D && (a !== "scroll" || p.length === 0) ? /* @__PURE__ */ t(re, {
803
+ columns: e,
804
+ pageSize: b
805
+ }) : fe ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", {
806
+ colSpan: ue,
807
+ className: `${X}-emptyCell`,
808
+ style: { height: `${de}px` },
809
+ children: l
810
+ }) }) : /* @__PURE__ */ n(r, { children: [p.map((n, r) => /* @__PURE__ */ t("tr", {
811
+ className: `${X}-row`,
812
+ "data-testid": `${X}-row-${r}`,
813
+ children: e.map((e) => {
814
+ let i = n[e.key];
815
+ return /* @__PURE__ */ t("td", {
816
+ className: [`${X}-td`, e.type === "options" ? `${X}-tdOptions` : ""].filter(Boolean).join(" "),
817
+ "data-testid": `${X}-cell-${e.key}-${r}`,
818
+ children: e.render ? e.render(i, n) : String(i ?? "")
819
+ }, e.key);
820
+ })
821
+ }, r)), a === "scroll" && D && /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", {
822
+ colSpan: ue,
823
+ className: `${X}-loadingMore`,
824
+ children: u
825
+ }) })] });
826
+ return /* @__PURE__ */ n("div", {
827
+ className: [X, d || ""].join(" "),
828
+ css: te(f),
829
+ "data-testid": X,
830
+ children: [
831
+ /* @__PURE__ */ t("div", {
832
+ className: `${X}-tableContainer`,
833
+ children: a === "scroll" ? /* @__PURE__ */ n(r, { children: [/* @__PURE__ */ n("table", {
834
+ className: `${X}-table`,
835
+ children: [/* @__PURE__ */ n("colgroup", { children: [e.map((e) => /* @__PURE__ */ t("col", { style: e.width ? { width: e.width } : void 0 }, e.key)), /* @__PURE__ */ t("col", { style: { width: U || 0 } })] }), /* @__PURE__ */ t("thead", {
836
+ ref: K,
837
+ className: `${X}-thead`,
838
+ children: /* @__PURE__ */ n("tr", {
839
+ className: `${X}-headerRow`,
840
+ children: [pe, /* @__PURE__ */ t("th", {
841
+ "aria-hidden": "true",
842
+ className: `${X}-thScrollbarSpacer`,
843
+ style: { padding: 0 }
844
+ })]
845
+ })
846
+ })]
847
+ }), /* @__PURE__ */ t("div", {
848
+ ref: q,
849
+ className: `${X}-bodyContainer`,
850
+ style: {
851
+ overflowY: "auto",
852
+ maxHeight: `${de}px`
853
+ },
854
+ onScroll: le,
855
+ children: /* @__PURE__ */ n("table", {
856
+ className: `${X}-table`,
857
+ style: {
858
+ tableLayout: "fixed",
859
+ width: "100%"
860
+ },
861
+ children: [/* @__PURE__ */ t("colgroup", { children: e.map((e, n) => /* @__PURE__ */ t("col", { style: { width: H[n] === void 0 ? e.width ?? "auto" : H[n] } }, e.key)) }), /* @__PURE__ */ t("tbody", {
862
+ className: `${X}-tbody`,
863
+ children: me
864
+ })]
865
+ })
866
+ })] }) : /* @__PURE__ */ n("table", {
867
+ className: `${X}-table`,
868
+ children: [/* @__PURE__ */ t("thead", {
869
+ className: `${X}-thead`,
870
+ children: /* @__PURE__ */ t("tr", {
871
+ className: `${X}-headerRow`,
872
+ children: pe
873
+ })
874
+ }), /* @__PURE__ */ t("tbody", {
875
+ className: `${X}-tbody`,
876
+ children: me
877
+ })]
878
+ })
879
+ }),
880
+ a === "pagination" && /* @__PURE__ */ t(Y, {
881
+ page: v,
882
+ total: g,
883
+ pageSize: b,
884
+ onPageChange: se,
885
+ pageSizeOptions: c,
886
+ onPageSizeChange: ce,
887
+ loading: D
888
+ }),
889
+ $?.filter && /* @__PURE__ */ t(ne, {
890
+ filterType: $.filter.type,
891
+ options: $.filter.options,
892
+ columnKey: $.key,
893
+ filterTitle: $.filter.title,
894
+ searchLabel: $.filter.label,
895
+ cancelLabel: $.filter.cancelLabel,
896
+ applyLabel: $.filter.applyLabel,
897
+ pendingSearch: I,
898
+ onSearchChange: L,
899
+ pendingMulti: R,
900
+ onMultiChange: z,
901
+ multiSearch: B,
902
+ onMultiSearchChange: V,
903
+ onCancel: () => N(null),
904
+ onApply: () => Z($),
905
+ onClear: () => {
906
+ $.filter?.type === "search" ? L("") : (z([]), V(""));
907
+ },
908
+ anchorEl: P
909
+ })
910
+ ]
911
+ });
912
+ }, Q = ({ theme: n, variant: r = "default", ...i }) => {
913
+ let { componentStyles: a } = e([c.DATAGRID], n, r.toUpperCase());
914
+ return /* @__PURE__ */ t(Z, {
915
+ ...i,
916
+ style: a
917
+ });
918
+ };
919
+ //#endregion
920
+ export { u as Button, s as Checkbox, v as CheckboxGroup, _ as CheckboxTree, Q as DataGrid, p as DatePicker, o as Icon, h as IconButton, l as Input, Y as Pagination, d as Radio, y as RadioGroup, m as Select, A as Skeleton, f as Slider, g as Switch, b as ThemeProvider, i as darkTheme };
921
+
922
+ //# sourceMappingURL=index.mjs.map