@foi/design-system 0.0.12 → 0.0.13
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.
- package/README.md +141 -1
- package/dist/{RadioGroup-CdW6yS38.js → RadioGroup-DCJBoZc-.js} +18 -17
- package/dist/{RadioGroup-CdW6yS38.js.map → RadioGroup-DCJBoZc-.js.map} +1 -1
- package/dist/{RadioGroup.context-BdRgENJJ.js → RadioGroup.context-QNk2hW_4.js} +4 -4
- package/dist/RadioGroup.context-QNk2hW_4.js.map +1 -0
- package/dist/{Switch-C7wjcrjU.js → Switch-JF9P9VJf.js} +438 -421
- package/dist/Switch-JF9P9VJf.js.map +1 -0
- package/dist/{ThemeProvider-JlN3U_r2.js → ThemeProvider-Q2Hjezbt.js} +2 -2
- package/dist/{ThemeProvider-JlN3U_r2.js.map → ThemeProvider-Q2Hjezbt.js.map} +1 -1
- package/dist/atoms.mjs +2 -2
- package/dist/components/atoms/Button/Button.interface.d.ts +1 -1
- package/dist/components/atoms/Checkbox/Checkbox.d.ts +4 -1
- package/dist/components/atoms/DatePicker/DatePickerMenu/DatePickerMenu.d.ts +0 -2
- package/dist/components/atoms/IconButton/IconButton.interface.d.ts +1 -1
- package/dist/components/atoms/Input/Input.d.ts +6 -7
- package/dist/components/atoms/Input/Input.interface.d.ts +62 -13
- package/dist/components/atoms/Pagination/Pagination.d.ts +12 -0
- package/dist/components/atoms/Pagination/Pagination.emotion.d.ts +2 -0
- package/dist/components/atoms/Pagination/Pagination.interface.d.ts +32 -0
- package/dist/components/atoms/Pagination/PaginationMenu/PaginationMenu.d.ts +9 -0
- package/dist/components/atoms/Pagination/PaginationMenu/PaginationMenu.emotion.d.ts +2 -0
- package/dist/components/atoms/Pagination/PaginationMenu/PaginationMenu.interface.d.ts +23 -0
- package/dist/components/atoms/Pagination/PaginationMenu/index.d.ts +4 -0
- package/dist/components/atoms/Pagination/index.d.ts +4 -0
- package/dist/components/atoms/Radio/Radio.d.ts +4 -0
- package/dist/components/atoms/Radio/RadioGroup.context.d.ts +2 -0
- package/dist/components/atoms/Select/SelectMenu/SelectMenu.d.ts +1 -2
- package/dist/components/atoms/Skeleton/Skeleton.d.ts +10 -0
- package/dist/components/atoms/Skeleton/Skeleton.emotion.d.ts +2 -0
- package/dist/components/atoms/Skeleton/Skeleton.interface.d.ts +14 -0
- package/dist/components/atoms/Skeleton/index.d.ts +2 -0
- package/dist/components/molecules/Modal/Modal.d.ts +14 -0
- package/dist/components/molecules/Modal/Modal.emotion.d.ts +2 -0
- package/dist/components/molecules/Modal/Modal.interface.d.ts +42 -0
- package/dist/components/molecules/Modal/index.d.ts +5 -0
- package/dist/components/organisms/DataGrid/DataGrid.d.ts +19 -0
- package/dist/components/organisms/DataGrid/DataGrid.emotion.d.ts +2 -0
- package/dist/components/organisms/DataGrid/DataGrid.interface.d.ts +124 -0
- package/dist/components/organisms/DataGrid/DataGridMenu/DataGridMenu.d.ts +14 -0
- package/dist/components/organisms/DataGrid/DataGridMenu/DataGridMenu.emotion.d.ts +2 -0
- package/dist/components/organisms/DataGrid/DataGridMenu/DataGridMenu.interface.d.ts +54 -0
- package/dist/components/organisms/DataGrid/DataGridMenu/components/DataGridMenuMultiSelect.d.ts +12 -0
- package/dist/components/organisms/DataGrid/DataGridMenu/components/DataGridMenuSearch.d.ts +8 -0
- package/dist/components/organisms/DataGrid/DataGridMenu/index.d.ts +3 -0
- package/dist/components/organisms/DataGrid/DataGridSkeleton/DataGridSkeleton.d.ts +7 -0
- package/dist/components/organisms/DataGrid/DataGridSkeleton/index.d.ts +1 -0
- package/dist/components/organisms/DataGrid/index.d.ts +4 -0
- package/dist/{emotion-react-jsx-runtime.browser.esm-ClrpcFMG.js → emotion-react-jsx-runtime.browser.esm-C4rLUMui.js} +9 -8
- package/dist/emotion-react-jsx-runtime.browser.esm-C4rLUMui.js.map +1 -0
- package/dist/hocs/ThemeProvider/components/DataGrid.d.ts +20 -0
- package/dist/hocs/ThemeProvider/components/DataGridMenu.d.ts +18 -0
- package/dist/hocs/ThemeProvider/components/Modal.d.ts +16 -0
- package/dist/hocs/ThemeProvider/components/Pagination.d.ts +13 -0
- package/dist/hocs/ThemeProvider/components/PaginationMenu.d.ts +24 -0
- package/dist/hocs/ThemeProvider/components/index.d.ts +5 -1
- package/dist/hocs/ThemeProvider/interfaces/Components.interface.d.ts +6 -1
- package/dist/hocs.mjs +1 -1
- package/dist/hooks/useOnClickOutside.d.ts +2 -3
- package/dist/hooks.mjs +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +918 -6
- package/dist/index.mjs.map +1 -0
- package/dist/molecules.mjs +1 -1
- package/dist/theme/dark/colors.d.ts +1 -0
- package/dist/theme/dark/components/Button.d.ts +37 -0
- package/dist/theme/dark/components/DataGrid.d.ts +26 -0
- package/dist/theme/dark/components/DataGridMenu.d.ts +20 -0
- package/dist/theme/dark/components/Modal.d.ts +20 -0
- package/dist/theme/dark/components/Pagination.d.ts +12 -0
- package/dist/theme/dark/components/PaginationMenu.d.ts +32 -0
- package/dist/theme/dark/components/index.d.ts +132 -0
- package/dist/theme/dark/index.d.ts +132 -0
- package/dist/theme/index.d.ts +132 -0
- package/dist/{theme-D18AZjTt.js → theme-Cxg9jdmX.js} +126 -29
- package/dist/theme-Cxg9jdmX.js.map +1 -0
- package/dist/theme.mjs +1 -1
- package/dist/useStateCallback-B4O93zzK.js +32 -0
- package/dist/useStateCallback-B4O93zzK.js.map +1 -0
- package/dist/utilities.mjs +4 -5
- package/dist/utilities.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/RadioGroup.context-BdRgENJJ.js.map +0 -1
- package/dist/Switch-C7wjcrjU.js.map +0 -1
- package/dist/emotion-react-jsx-runtime.browser.esm-ClrpcFMG.js.map +0 -1
- package/dist/theme-D18AZjTt.js.map +0 -1
- package/dist/useStateCallback-D9fqdxiO.js +0 -26
- package/dist/useStateCallback-D9fqdxiO.js.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,918 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
|
|
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: 16px;
|
|
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
|
+
display: flex;
|
|
265
|
+
flex-direction: column;
|
|
266
|
+
gap: 12px;
|
|
267
|
+
|
|
268
|
+
&::-webkit-scrollbar {
|
|
269
|
+
width: 4px;
|
|
270
|
+
}
|
|
271
|
+
&::-webkit-scrollbar-track {
|
|
272
|
+
background: transparent;
|
|
273
|
+
}
|
|
274
|
+
&::-webkit-scrollbar-thumb {
|
|
275
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
276
|
+
border-radius: 2px;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.--DATAGRIDMENU-optionRow {
|
|
281
|
+
display: flex;
|
|
282
|
+
align-items: center;
|
|
283
|
+
gap: 8px;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.--DATAGRIDMENU-optionDot {
|
|
287
|
+
width: 6px;
|
|
288
|
+
height: 24px;
|
|
289
|
+
border-radius: 2px;
|
|
290
|
+
flex-shrink: 0;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.--DATAGRIDMENU-actions {
|
|
294
|
+
display: flex;
|
|
295
|
+
gap: 8px;
|
|
296
|
+
justify-content: flex-end;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
`, N = "--DATAGRIDMENU", P = ({ columnKey: e, pendingSearch: n, onSearchChange: r, searchLabel: i = "Search" }) => /* @__PURE__ */ t("div", {
|
|
300
|
+
className: `${N}-searchInput`,
|
|
301
|
+
children: /* @__PURE__ */ t(l, {
|
|
302
|
+
name: `search-${e}`,
|
|
303
|
+
label: i,
|
|
304
|
+
value: n,
|
|
305
|
+
onValueChange: r,
|
|
306
|
+
showErrorText: !1,
|
|
307
|
+
width: "full",
|
|
308
|
+
autoFocus: !0,
|
|
309
|
+
"data-testid": `${N}-searchInput-${e}`,
|
|
310
|
+
startAdornment: /* @__PURE__ */ t(o, {
|
|
311
|
+
name: "search",
|
|
312
|
+
style: { color: "white" }
|
|
313
|
+
})
|
|
314
|
+
})
|
|
315
|
+
}), F = "--DATAGRIDMENU", I = ({ filterType: e, columnKey: i, options: a, pendingMulti: o, onMultiChange: c, multiSearch: u, onMultiSearchChange: d }) => {
|
|
316
|
+
let f = e === "multiselect-search", p = a.filter((e) => !u || e.label.toLowerCase().includes(u.toLowerCase()));
|
|
317
|
+
return /* @__PURE__ */ n(r, { children: [f && /* @__PURE__ */ t("div", {
|
|
318
|
+
className: `${F}-searchInput`,
|
|
319
|
+
children: /* @__PURE__ */ t(l, {
|
|
320
|
+
name: `multiSearch-${i}`,
|
|
321
|
+
label: "Search options",
|
|
322
|
+
value: u,
|
|
323
|
+
onValueChange: d,
|
|
324
|
+
showErrorText: !1,
|
|
325
|
+
width: "full",
|
|
326
|
+
autoFocus: !0,
|
|
327
|
+
"data-testid": `${F}-multiSearch-${i}`
|
|
328
|
+
})
|
|
329
|
+
}), /* @__PURE__ */ t("div", {
|
|
330
|
+
className: `${F}-optionsList`,
|
|
331
|
+
"data-testid": `${F}-optionsList-${i}`,
|
|
332
|
+
children: p.map((e) => /* @__PURE__ */ n("div", {
|
|
333
|
+
className: `${F}-optionRow`,
|
|
334
|
+
children: [e.color && /* @__PURE__ */ t("span", {
|
|
335
|
+
className: `${F}-optionDot`,
|
|
336
|
+
style: { backgroundColor: e.color },
|
|
337
|
+
"aria-hidden": "true"
|
|
338
|
+
}), /* @__PURE__ */ t(s, {
|
|
339
|
+
checked: o.includes(e.value),
|
|
340
|
+
onChecked: (t) => c(t ? [...o, e.value] : o.filter((t) => t !== e.value)),
|
|
341
|
+
label: e.label,
|
|
342
|
+
showErrorText: !1,
|
|
343
|
+
"data-testid": `${F}-option-${i}-${e.value}`
|
|
344
|
+
})]
|
|
345
|
+
}, e.value))
|
|
346
|
+
})] });
|
|
347
|
+
}, 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 }) => {
|
|
348
|
+
let w = T(null);
|
|
349
|
+
return C(() => {
|
|
350
|
+
if (!x) return;
|
|
351
|
+
let e = () => {
|
|
352
|
+
if (!w.current) return;
|
|
353
|
+
let e = x.getBoundingClientRect(), t = w.current.offsetWidth, n = e.left + e.width / 2 - t / 2;
|
|
354
|
+
w.current.style.top = `${e.bottom + 8}px`, w.current.style.left = `${Math.max(8, Math.min(n, window.innerWidth - t - 8))}px`;
|
|
355
|
+
};
|
|
356
|
+
return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
357
|
+
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
358
|
+
};
|
|
359
|
+
}, [x]), k.createPortal(/* @__PURE__ */ n("div", {
|
|
360
|
+
ref: w,
|
|
361
|
+
className: L,
|
|
362
|
+
css: M(S),
|
|
363
|
+
"data-popover-key": i,
|
|
364
|
+
"data-testid": `${L}-${i}`,
|
|
365
|
+
children: [
|
|
366
|
+
/* @__PURE__ */ n("div", {
|
|
367
|
+
className: `${L}-header`,
|
|
368
|
+
children: [/* @__PURE__ */ t("span", {
|
|
369
|
+
className: `${L}-headerTitle`,
|
|
370
|
+
children: a
|
|
371
|
+
}), /* @__PURE__ */ t(h, {
|
|
372
|
+
icon: /* @__PURE__ */ t(o, {
|
|
373
|
+
name: "delete_outline",
|
|
374
|
+
size: "sm"
|
|
375
|
+
}),
|
|
376
|
+
onClick: b,
|
|
377
|
+
"aria-label": "Clear filter",
|
|
378
|
+
"data-testid": `${L}-clearBtn-${i}`
|
|
379
|
+
})]
|
|
380
|
+
}),
|
|
381
|
+
/* @__PURE__ */ n("div", {
|
|
382
|
+
className: `${L}-content`,
|
|
383
|
+
children: [e === "search" && /* @__PURE__ */ t(P, {
|
|
384
|
+
columnKey: i,
|
|
385
|
+
pendingSearch: d,
|
|
386
|
+
onSearchChange: f,
|
|
387
|
+
searchLabel: s
|
|
388
|
+
}), (e === "multiselect" || e === "multiselect-search") && /* @__PURE__ */ t(I, {
|
|
389
|
+
filterType: e,
|
|
390
|
+
columnKey: i,
|
|
391
|
+
options: r ?? [],
|
|
392
|
+
pendingMulti: p,
|
|
393
|
+
onMultiChange: m,
|
|
394
|
+
multiSearch: g,
|
|
395
|
+
onMultiSearchChange: _
|
|
396
|
+
})]
|
|
397
|
+
}),
|
|
398
|
+
/* @__PURE__ */ n("div", {
|
|
399
|
+
className: `${L}-actions`,
|
|
400
|
+
children: [/* @__PURE__ */ t(u, {
|
|
401
|
+
onClick: v,
|
|
402
|
+
"data-testid": `${L}-cancelBtn-${i}`,
|
|
403
|
+
variant: "ghost",
|
|
404
|
+
children: c
|
|
405
|
+
}), /* @__PURE__ */ t(u, {
|
|
406
|
+
onClick: y,
|
|
407
|
+
"data-testid": `${L}-applyBtn-${i}`,
|
|
408
|
+
children: l
|
|
409
|
+
})]
|
|
410
|
+
})
|
|
411
|
+
]
|
|
412
|
+
}), document.body);
|
|
413
|
+
}, ne = ({ theme: n, variant: r = "default", ...i }) => {
|
|
414
|
+
let { componentStyles: a } = e([c.DATAGRIDMENU], n, r.toUpperCase());
|
|
415
|
+
return /* @__PURE__ */ t(R, {
|
|
416
|
+
...i,
|
|
417
|
+
style: a
|
|
418
|
+
});
|
|
419
|
+
}, z = "--DATAGRID", re = ({ columns: e, pageSize: n }) => {
|
|
420
|
+
let i = w(() => Array.from({ length: n }, () => e.map((e) => e.type === "options" ? null : `${Math.floor(Math.random() * 51) + 40}%`)), [n, e.length]);
|
|
421
|
+
return /* @__PURE__ */ t(r, { children: Array.from({ length: n }).map((n, r) => /* @__PURE__ */ t("tr", {
|
|
422
|
+
className: `${z}-row`,
|
|
423
|
+
children: e.map((e, n) => /* @__PURE__ */ t("td", {
|
|
424
|
+
className: [`${z}-td`, e.type === "options" ? `${z}-tdOptions` : ""].filter(Boolean).join(" "),
|
|
425
|
+
children: e.type === "options" ? /* @__PURE__ */ t(A, {
|
|
426
|
+
variant: "circular",
|
|
427
|
+
width: 24,
|
|
428
|
+
height: 24
|
|
429
|
+
}) : /* @__PURE__ */ t(A, {
|
|
430
|
+
height: 16,
|
|
431
|
+
width: i[r][n] ?? void 0
|
|
432
|
+
})
|
|
433
|
+
}, e.key))
|
|
434
|
+
}, r)) });
|
|
435
|
+
}, B = (e) => D`
|
|
436
|
+
&.--PAGINATION {
|
|
437
|
+
display: flex;
|
|
438
|
+
align-items: center;
|
|
439
|
+
justify-content: flex-end;
|
|
440
|
+
gap: 16px;
|
|
441
|
+
padding: 8px 16px;
|
|
442
|
+
|
|
443
|
+
.--PAGINATION-rowsControl {
|
|
444
|
+
position: relative;
|
|
445
|
+
display: flex;
|
|
446
|
+
align-items: center;
|
|
447
|
+
gap: 8px;
|
|
448
|
+
|
|
449
|
+
.--PAGINATION-rowsSize {
|
|
450
|
+
${a(e, "color", "--PAGINATION-EVENTS-ENABLED-COLOR-SECONDARY")};
|
|
451
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
452
|
+
font-size: 0.8125rem;
|
|
453
|
+
user-select: none;
|
|
454
|
+
min-width: 20px;
|
|
455
|
+
text-align: center;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.--PAGINATION-controls {
|
|
460
|
+
display: flex;
|
|
461
|
+
align-items: center;
|
|
462
|
+
gap: 8px;
|
|
463
|
+
|
|
464
|
+
.--PAGINATION-info {
|
|
465
|
+
${a(e, "color", "--PAGINATION-EVENTS-ENABLED-COLOR-SECONDARY")};
|
|
466
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
467
|
+
font-size: 0.8125rem;
|
|
468
|
+
user-select: none;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
`, V = (e, t) => `
|
|
473
|
+
// BACKGROUNDS
|
|
474
|
+
${a(e, "background-color", `--PAGINATIONMENU-EVENTS-${t}-BACKGROUND-COLOR`)}
|
|
475
|
+
|
|
476
|
+
// BORDERS
|
|
477
|
+
${a(e, "border-color", `--PAGINATIONMENU-EVENTS-${t}-BORDER-COLOR`)}
|
|
478
|
+
${a(e, "border-width", `--PAGINATIONMENU-EVENTS-${t}-BORDER-WIDTH`)}
|
|
479
|
+
${a(e, "border-style", `--PAGINATIONMENU-EVENTS-${t}-BORDER-STYLE`)}
|
|
480
|
+
${a(e, "border-radius", `--PAGINATIONMENU-EVENTS-${t}-BORDER-RADIUS`)}
|
|
481
|
+
`, H = (e, t) => `
|
|
482
|
+
// TYPOGRAPHY
|
|
483
|
+
${a(e, "color", `--PAGINATIONMENU-EVENTS-${t}-COLOR-PRIMARY`)};
|
|
484
|
+
${a(e, "caret-color", `--PAGINATIONMENU-EVENTS-${t}-COLOR-PRIMARY`)};
|
|
485
|
+
`, ie = (e, t) => `
|
|
486
|
+
// BACKGROUNDS
|
|
487
|
+
${a(e, "background-color", `--PAGINATIONMENU-${t}-BACKGROUND-COLOR`)}
|
|
488
|
+
|
|
489
|
+
// BORDERS
|
|
490
|
+
${a(e, "border-color", `--PAGINATIONMENU-${t}-BORDER-COLOR`)}
|
|
491
|
+
${a(e, "border-width", `--PAGINATIONMENU-${t}-BORDER-WIDTH`)}
|
|
492
|
+
${a(e, "border-style", `--PAGINATIONMENU-${t}-BORDER-STYLE`)}
|
|
493
|
+
${a(e, "border-radius", `--PAGINATIONMENU-${t}-BORDER-RADIUS`)}
|
|
494
|
+
`, U = (e) => D`
|
|
495
|
+
&.--PAGINATIONMENU {
|
|
496
|
+
position: absolute;
|
|
497
|
+
bottom: calc(100% + ${e["--PAGINATIONMENU-ROOT-BOTTOM"] || ""});
|
|
498
|
+
left: 50%;
|
|
499
|
+
transform: translateX(-50%);
|
|
500
|
+
display: flex;
|
|
501
|
+
flex-direction: column;
|
|
502
|
+
overflow: hidden;
|
|
503
|
+
z-index: 10;
|
|
504
|
+
box-shadow:
|
|
505
|
+
rgba(0, 0, 0, 0.2) 0px 5px 5px -3px,
|
|
506
|
+
rgba(0, 0, 0, 0.14) 0px 8px 10px 1px,
|
|
507
|
+
rgba(0, 0, 0, 0.12) 0px 3px 14px 2px;
|
|
508
|
+
|
|
509
|
+
${ie(e, "ROOT")}
|
|
510
|
+
|
|
511
|
+
.--PAGINATIONMENU-option {
|
|
512
|
+
all: unset;
|
|
513
|
+
cursor: pointer;
|
|
514
|
+
text-align: center;
|
|
515
|
+
padding: 6px 20px;
|
|
516
|
+
white-space: nowrap;
|
|
517
|
+
transition: background-color 120ms;
|
|
518
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
519
|
+
font-size: 0.8125rem;
|
|
520
|
+
|
|
521
|
+
// ENABLED
|
|
522
|
+
${V(e, "ENABLED")}
|
|
523
|
+
${H(e, "ENABLED")}
|
|
524
|
+
|
|
525
|
+
// VALUE
|
|
526
|
+
&.--PAGINATIONMENU-selected {
|
|
527
|
+
${V(e, "VALUE")}
|
|
528
|
+
${H(e, "VALUE")}
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// HOVER
|
|
532
|
+
&:hover {
|
|
533
|
+
${V(e, "HOVER")}
|
|
534
|
+
${H(e, "HOVER")}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
// - ACTIVE
|
|
538
|
+
&:active,
|
|
539
|
+
&.--PAGINATIONMENU-active {
|
|
540
|
+
${V(e, "ACTIVE")}
|
|
541
|
+
${H(e, "ACTIVE")}
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// FOCUS
|
|
545
|
+
&:focus-visible {
|
|
546
|
+
outline-offset: 0px;
|
|
547
|
+
outline: 0;
|
|
548
|
+
${V(e, "FOCUS")}
|
|
549
|
+
${H(e, "FOCUS")}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
`, W = "--PAGINATIONMENU", G = ({ options: e, activeOption: n, onSelect: r, focusedElement: i = -1, style: a }) => /* @__PURE__ */ t("div", {
|
|
554
|
+
className: W,
|
|
555
|
+
css: U(a),
|
|
556
|
+
children: e.map((e, a) => {
|
|
557
|
+
let o = e === n ? `${W}-selected` : "", s = i === a;
|
|
558
|
+
return /* @__PURE__ */ t("button", {
|
|
559
|
+
className: [
|
|
560
|
+
`${W}-option`,
|
|
561
|
+
o,
|
|
562
|
+
s ? `${W}-active` : ""
|
|
563
|
+
].filter(Boolean).join(" "),
|
|
564
|
+
onClick: () => r(e),
|
|
565
|
+
children: e
|
|
566
|
+
}, e);
|
|
567
|
+
})
|
|
568
|
+
}), K = ({ theme: n, variant: r = "default", ...i }) => {
|
|
569
|
+
let { componentStyles: a } = e([c.PAGINATIONMENU], n, r.toUpperCase());
|
|
570
|
+
return /* @__PURE__ */ t(G, {
|
|
571
|
+
...i,
|
|
572
|
+
style: a
|
|
573
|
+
});
|
|
574
|
+
}, q = "--PAGINATION", J = ({ page: e, total: r, pageSize: i, onPageChange: a, pageSizeOptions: s, onPageSizeChange: c, loading: l, className: u, style: d }) => {
|
|
575
|
+
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 = () => {
|
|
576
|
+
p(!1), g(-1);
|
|
577
|
+
};
|
|
578
|
+
return S(() => {
|
|
579
|
+
if (!f) return;
|
|
580
|
+
let e = (e) => {
|
|
581
|
+
e.target.closest(`.${q}-rowsControl`) || (p(!1), g(-1));
|
|
582
|
+
};
|
|
583
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
584
|
+
}, [f]), /* @__PURE__ */ n("div", {
|
|
585
|
+
className: [q, u || ""].filter(Boolean).join(" "),
|
|
586
|
+
css: B(d ?? {}),
|
|
587
|
+
children: [s && s.length > 0 && /* @__PURE__ */ n("div", {
|
|
588
|
+
className: `${q}-rowsControl`,
|
|
589
|
+
children: [
|
|
590
|
+
f && /* @__PURE__ */ t(K, {
|
|
591
|
+
options: s,
|
|
592
|
+
activeOption: i,
|
|
593
|
+
onSelect: (e) => {
|
|
594
|
+
c?.(e), C();
|
|
595
|
+
},
|
|
596
|
+
focusedElement: m
|
|
597
|
+
}),
|
|
598
|
+
/* @__PURE__ */ t("span", {
|
|
599
|
+
className: `${q}-rowsSize`,
|
|
600
|
+
children: i
|
|
601
|
+
}),
|
|
602
|
+
/* @__PURE__ */ t(h, {
|
|
603
|
+
icon: /* @__PURE__ */ t(o, {
|
|
604
|
+
name: "arrow_drop_up",
|
|
605
|
+
size: "sm"
|
|
606
|
+
}),
|
|
607
|
+
onClick: () => f ? C() : p(!0),
|
|
608
|
+
onKeyDown: (e) => {
|
|
609
|
+
if (e.key === "Tab" || e.key === "Escape") p(!1), g(-1);
|
|
610
|
+
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);
|
|
611
|
+
else if (e.key === "Enter" && f && m >= 0 && s) {
|
|
612
|
+
e.preventDefault();
|
|
613
|
+
let t = s[m];
|
|
614
|
+
t !== void 0 && (c?.(t), p(!1), g(-1));
|
|
615
|
+
}
|
|
616
|
+
},
|
|
617
|
+
isFlipped: f,
|
|
618
|
+
"aria-label": "Rows per page",
|
|
619
|
+
"data-testid": `${q}-rowsBtn`
|
|
620
|
+
})
|
|
621
|
+
]
|
|
622
|
+
}), /* @__PURE__ */ n("div", {
|
|
623
|
+
className: `${q}-controls`,
|
|
624
|
+
children: [
|
|
625
|
+
/* @__PURE__ */ n("span", {
|
|
626
|
+
className: `${q}-info`,
|
|
627
|
+
children: [
|
|
628
|
+
v,
|
|
629
|
+
"-",
|
|
630
|
+
y,
|
|
631
|
+
" of ",
|
|
632
|
+
r
|
|
633
|
+
]
|
|
634
|
+
}),
|
|
635
|
+
/* @__PURE__ */ t(h, {
|
|
636
|
+
icon: /* @__PURE__ */ t(o, {
|
|
637
|
+
name: "first_page",
|
|
638
|
+
size: "sm"
|
|
639
|
+
}),
|
|
640
|
+
onClick: () => a(0),
|
|
641
|
+
disabled: l || b,
|
|
642
|
+
"aria-label": "First page",
|
|
643
|
+
"data-testid": `${q}-first`
|
|
644
|
+
}),
|
|
645
|
+
/* @__PURE__ */ t(h, {
|
|
646
|
+
icon: /* @__PURE__ */ t(o, {
|
|
647
|
+
name: "chevron_left",
|
|
648
|
+
size: "sm"
|
|
649
|
+
}),
|
|
650
|
+
onClick: () => a(e - 1),
|
|
651
|
+
disabled: l || b,
|
|
652
|
+
"aria-label": "Previous page",
|
|
653
|
+
"data-testid": `${q}-prev`
|
|
654
|
+
}),
|
|
655
|
+
/* @__PURE__ */ t(h, {
|
|
656
|
+
icon: /* @__PURE__ */ t(o, {
|
|
657
|
+
name: "chevron_right",
|
|
658
|
+
size: "sm"
|
|
659
|
+
}),
|
|
660
|
+
onClick: () => a(e + 1),
|
|
661
|
+
disabled: l || x,
|
|
662
|
+
"aria-label": "Next page",
|
|
663
|
+
"data-testid": `${q}-next`
|
|
664
|
+
}),
|
|
665
|
+
/* @__PURE__ */ t(h, {
|
|
666
|
+
icon: /* @__PURE__ */ t(o, {
|
|
667
|
+
name: "last_page",
|
|
668
|
+
size: "sm"
|
|
669
|
+
}),
|
|
670
|
+
onClick: () => a(_ - 1),
|
|
671
|
+
disabled: l || x,
|
|
672
|
+
"aria-label": "Last page",
|
|
673
|
+
"data-testid": `${q}-last`
|
|
674
|
+
})
|
|
675
|
+
]
|
|
676
|
+
})]
|
|
677
|
+
});
|
|
678
|
+
}, Y = ({ theme: n, variant: r = "default", ...i }) => {
|
|
679
|
+
let { componentStyles: a } = e([c.PAGINATION], n, r.toUpperCase());
|
|
680
|
+
return /* @__PURE__ */ t(J, {
|
|
681
|
+
...i,
|
|
682
|
+
style: a
|
|
683
|
+
});
|
|
684
|
+
}, 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 }) => {
|
|
685
|
+
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);
|
|
686
|
+
S(() => {
|
|
687
|
+
let e = !1;
|
|
688
|
+
return i({
|
|
689
|
+
page: v,
|
|
690
|
+
pageSize: b,
|
|
691
|
+
filters: A,
|
|
692
|
+
sort: k ?? void 0
|
|
693
|
+
}).then((t) => {
|
|
694
|
+
e || (m((e) => a === "scroll" && v > 0 ? [...e, ...t.data] : t.data), _(t.total), O(!1));
|
|
695
|
+
}), () => {
|
|
696
|
+
e = !0;
|
|
697
|
+
};
|
|
698
|
+
}, [
|
|
699
|
+
v,
|
|
700
|
+
b,
|
|
701
|
+
A,
|
|
702
|
+
k,
|
|
703
|
+
a,
|
|
704
|
+
i
|
|
705
|
+
]), C(() => {
|
|
706
|
+
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));
|
|
707
|
+
}, [
|
|
708
|
+
a,
|
|
709
|
+
e.length,
|
|
710
|
+
D
|
|
711
|
+
]), S(() => {
|
|
712
|
+
if (!M) return;
|
|
713
|
+
let e = (e) => {
|
|
714
|
+
e.target.closest(`[data-popover-key="${M}"]`) || N(null);
|
|
715
|
+
};
|
|
716
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
717
|
+
}, [M]);
|
|
718
|
+
let J = (e) => {
|
|
719
|
+
if (!e.filter) return;
|
|
720
|
+
if (M === e.key) {
|
|
721
|
+
N(null), F(null);
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
let t = A[e.key];
|
|
725
|
+
e.filter.type === "search" ? L(typeof t == "string" ? t : "") : (z(Array.isArray(t) ? t : []), V("")), F(G.current[e.key] ?? null), N(e.key);
|
|
726
|
+
}, Z = (e) => {
|
|
727
|
+
if (!e.filter) return;
|
|
728
|
+
let t = e.filter.type === "search" ? I : R;
|
|
729
|
+
O(!0), j((n) => ({
|
|
730
|
+
...n,
|
|
731
|
+
[e.key]: t
|
|
732
|
+
})), y(0), N(null);
|
|
733
|
+
}, Q = (e) => {
|
|
734
|
+
let t = A[e];
|
|
735
|
+
return t == null ? !1 : Array.isArray(t) ? t.length > 0 : t !== "";
|
|
736
|
+
}, oe = (e) => {
|
|
737
|
+
O(!0), ee((t) => t?.key === e ? {
|
|
738
|
+
key: e,
|
|
739
|
+
direction: t.direction === "asc" ? "desc" : "asc"
|
|
740
|
+
} : {
|
|
741
|
+
key: e,
|
|
742
|
+
direction: "asc"
|
|
743
|
+
}), y(0);
|
|
744
|
+
}, se = (e) => {
|
|
745
|
+
O(!0), y(e);
|
|
746
|
+
}, ce = (e) => {
|
|
747
|
+
O(!0), w(e), y(0);
|
|
748
|
+
}, le = x((e) => {
|
|
749
|
+
if (a !== "scroll" || D || p.length >= g) return;
|
|
750
|
+
let { scrollTop: t, scrollHeight: n, clientHeight: r } = e.currentTarget;
|
|
751
|
+
n - t - r < 48 && (O(!0), y((e) => e + 1));
|
|
752
|
+
}, [
|
|
753
|
+
a,
|
|
754
|
+
D,
|
|
755
|
+
p.length,
|
|
756
|
+
g
|
|
757
|
+
]), 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", {
|
|
758
|
+
className: [`${X}-th`, e.type === "options" ? `${X}-thOptions` : ""].join(" "),
|
|
759
|
+
style: e.width ? { width: e.width } : void 0,
|
|
760
|
+
children: /* @__PURE__ */ n("div", {
|
|
761
|
+
className: `${X}-thInner`,
|
|
762
|
+
"data-testid": `${X}-th-${e.key}`,
|
|
763
|
+
children: [/* @__PURE__ */ t("span", {
|
|
764
|
+
className: `${X}-thLabel`,
|
|
765
|
+
children: e.label
|
|
766
|
+
}), e.type !== "options" && /* @__PURE__ */ n("div", {
|
|
767
|
+
className: `${X}-thActions`,
|
|
768
|
+
children: [e.filter && /* @__PURE__ */ t("div", {
|
|
769
|
+
className: `${X}-filterContainer`,
|
|
770
|
+
"data-popover-key": e.key,
|
|
771
|
+
children: /* @__PURE__ */ t("span", {
|
|
772
|
+
ref: (t) => {
|
|
773
|
+
G.current[e.key] = t;
|
|
774
|
+
},
|
|
775
|
+
children: /* @__PURE__ */ t(h, {
|
|
776
|
+
icon: /* @__PURE__ */ t(o, {
|
|
777
|
+
name: Q(e.key) ? "filter_alt" : "filter_list",
|
|
778
|
+
size: "sm",
|
|
779
|
+
style: { color: Q(e.key) ? "white" : "" }
|
|
780
|
+
}),
|
|
781
|
+
onClick: () => J(e),
|
|
782
|
+
"data-testid": `${X}-filterBtn-${e.key}`,
|
|
783
|
+
"aria-label": `Filter ${e.label}`
|
|
784
|
+
})
|
|
785
|
+
})
|
|
786
|
+
}), e.sortable !== !1 && /* @__PURE__ */ t(h, {
|
|
787
|
+
icon: /* @__PURE__ */ t(o, {
|
|
788
|
+
name: k?.key === e.key ? k.direction === "asc" ? "arrow_upward" : "arrow_downward" : "unfold_more",
|
|
789
|
+
size: "sm",
|
|
790
|
+
style: { color: k?.key === e.key ? "white" : "" }
|
|
791
|
+
}),
|
|
792
|
+
onClick: () => oe(e.key),
|
|
793
|
+
"data-testid": `${X}-sortBtn-${e.key}`,
|
|
794
|
+
"aria-label": `Sort ${e.label}`
|
|
795
|
+
})]
|
|
796
|
+
})]
|
|
797
|
+
})
|
|
798
|
+
}, e.key)), me = D && (a !== "scroll" || p.length === 0) ? /* @__PURE__ */ t(re, {
|
|
799
|
+
columns: e,
|
|
800
|
+
pageSize: b
|
|
801
|
+
}) : fe ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", {
|
|
802
|
+
colSpan: ue,
|
|
803
|
+
className: `${X}-emptyCell`,
|
|
804
|
+
style: { height: `${de}px` },
|
|
805
|
+
children: l
|
|
806
|
+
}) }) : /* @__PURE__ */ n(r, { children: [p.map((n, r) => /* @__PURE__ */ t("tr", {
|
|
807
|
+
className: `${X}-row`,
|
|
808
|
+
"data-testid": `${X}-row-${r}`,
|
|
809
|
+
children: e.map((e) => {
|
|
810
|
+
let i = n[e.key];
|
|
811
|
+
return /* @__PURE__ */ t("td", {
|
|
812
|
+
className: [`${X}-td`, e.type === "options" ? `${X}-tdOptions` : ""].filter(Boolean).join(" "),
|
|
813
|
+
"data-testid": `${X}-cell-${e.key}-${r}`,
|
|
814
|
+
children: e.render ? e.render(i, n) : String(i ?? "")
|
|
815
|
+
}, e.key);
|
|
816
|
+
})
|
|
817
|
+
}, r)), a === "scroll" && D && /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", {
|
|
818
|
+
colSpan: ue,
|
|
819
|
+
className: `${X}-loadingMore`,
|
|
820
|
+
children: u
|
|
821
|
+
}) })] });
|
|
822
|
+
return /* @__PURE__ */ n("div", {
|
|
823
|
+
className: [X, d || ""].join(" "),
|
|
824
|
+
css: te(f),
|
|
825
|
+
"data-testid": X,
|
|
826
|
+
children: [
|
|
827
|
+
/* @__PURE__ */ t("div", {
|
|
828
|
+
className: `${X}-tableContainer`,
|
|
829
|
+
children: a === "scroll" ? /* @__PURE__ */ n(r, { children: [/* @__PURE__ */ n("table", {
|
|
830
|
+
className: `${X}-table`,
|
|
831
|
+
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", {
|
|
832
|
+
ref: K,
|
|
833
|
+
className: `${X}-thead`,
|
|
834
|
+
children: /* @__PURE__ */ n("tr", {
|
|
835
|
+
className: `${X}-headerRow`,
|
|
836
|
+
children: [pe, /* @__PURE__ */ t("th", {
|
|
837
|
+
"aria-hidden": "true",
|
|
838
|
+
className: `${X}-thScrollbarSpacer`,
|
|
839
|
+
style: { padding: 0 }
|
|
840
|
+
})]
|
|
841
|
+
})
|
|
842
|
+
})]
|
|
843
|
+
}), /* @__PURE__ */ t("div", {
|
|
844
|
+
ref: q,
|
|
845
|
+
className: `${X}-bodyContainer`,
|
|
846
|
+
style: {
|
|
847
|
+
overflowY: "auto",
|
|
848
|
+
maxHeight: `${de}px`
|
|
849
|
+
},
|
|
850
|
+
onScroll: le,
|
|
851
|
+
children: /* @__PURE__ */ n("table", {
|
|
852
|
+
className: `${X}-table`,
|
|
853
|
+
style: {
|
|
854
|
+
tableLayout: "fixed",
|
|
855
|
+
width: "100%"
|
|
856
|
+
},
|
|
857
|
+
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", {
|
|
858
|
+
className: `${X}-tbody`,
|
|
859
|
+
children: me
|
|
860
|
+
})]
|
|
861
|
+
})
|
|
862
|
+
})] }) : /* @__PURE__ */ n("table", {
|
|
863
|
+
className: `${X}-table`,
|
|
864
|
+
children: [/* @__PURE__ */ t("thead", {
|
|
865
|
+
className: `${X}-thead`,
|
|
866
|
+
children: /* @__PURE__ */ t("tr", {
|
|
867
|
+
className: `${X}-headerRow`,
|
|
868
|
+
children: pe
|
|
869
|
+
})
|
|
870
|
+
}), /* @__PURE__ */ t("tbody", {
|
|
871
|
+
className: `${X}-tbody`,
|
|
872
|
+
children: me
|
|
873
|
+
})]
|
|
874
|
+
})
|
|
875
|
+
}),
|
|
876
|
+
a === "pagination" && /* @__PURE__ */ t(Y, {
|
|
877
|
+
page: v,
|
|
878
|
+
total: g,
|
|
879
|
+
pageSize: b,
|
|
880
|
+
onPageChange: se,
|
|
881
|
+
pageSizeOptions: c,
|
|
882
|
+
onPageSizeChange: ce,
|
|
883
|
+
loading: D
|
|
884
|
+
}),
|
|
885
|
+
$?.filter && /* @__PURE__ */ t(ne, {
|
|
886
|
+
filterType: $.filter.type,
|
|
887
|
+
options: $.filter.options,
|
|
888
|
+
columnKey: $.key,
|
|
889
|
+
filterTitle: $.filter.title,
|
|
890
|
+
searchLabel: $.filter.label,
|
|
891
|
+
cancelLabel: $.filter.cancelLabel,
|
|
892
|
+
applyLabel: $.filter.applyLabel,
|
|
893
|
+
pendingSearch: I,
|
|
894
|
+
onSearchChange: L,
|
|
895
|
+
pendingMulti: R,
|
|
896
|
+
onMultiChange: z,
|
|
897
|
+
multiSearch: B,
|
|
898
|
+
onMultiSearchChange: V,
|
|
899
|
+
onCancel: () => N(null),
|
|
900
|
+
onApply: () => Z($),
|
|
901
|
+
onClear: () => {
|
|
902
|
+
$.filter?.type === "search" ? L("") : (z([]), V(""));
|
|
903
|
+
},
|
|
904
|
+
anchorEl: P
|
|
905
|
+
})
|
|
906
|
+
]
|
|
907
|
+
});
|
|
908
|
+
}, Q = ({ theme: n, variant: r = "default", ...i }) => {
|
|
909
|
+
let { componentStyles: a } = e([c.DATAGRID], n, r.toUpperCase());
|
|
910
|
+
return /* @__PURE__ */ t(Z, {
|
|
911
|
+
...i,
|
|
912
|
+
style: a
|
|
913
|
+
});
|
|
914
|
+
};
|
|
915
|
+
//#endregion
|
|
916
|
+
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 };
|
|
917
|
+
|
|
918
|
+
//# sourceMappingURL=index.mjs.map
|