@m4l/components 9.49.0 → 9.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/CheckableList/CheckableList.d.ts.map +1 -1
- package/components/CheckableList/CheckableList.js +159 -143
- package/components/CheckableList/CheckableList.styles.d.ts.map +1 -1
- package/components/CheckableList/CheckableList.styles.js +59 -33
- package/components/CheckableList/constants.d.ts +6 -1
- package/components/CheckableList/constants.d.ts.map +1 -1
- package/components/CheckableList/constants.js +7 -6
- package/components/CheckableList/hooks/useCheckableListRender.d.ts +2 -3
- package/components/CheckableList/hooks/useCheckableListRender.d.ts.map +1 -1
- package/components/CheckableList/hooks/useCheckableListRender.js +86 -91
- package/components/CheckableList/hooks/useCheckableListVirtualization.d.ts +14 -2
- package/components/CheckableList/hooks/useCheckableListVirtualization.d.ts.map +1 -1
- package/components/CheckableList/hooks/useCheckableListVirtualization.js +41 -28
- package/components/CheckableList/slots/slots.d.ts +2 -0
- package/components/CheckableList/slots/slots.d.ts.map +1 -1
- package/components/CheckableList/slots/slots.js +1 -1
- package/components/CheckableList/slots/styled.d.ts +8 -2
- package/components/CheckableList/slots/styled.d.ts.map +1 -1
- package/components/CheckableList/slots/styled.js +80 -73
- package/components/CheckableList/types.d.ts +38 -3
- package/components/CheckableList/types.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckableList.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/CheckableList/CheckableList.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAEnB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"CheckableList.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/CheckableList/CheckableList.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAEnB,MAAM,SAAS,CAAC;AAgCjB;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,qDAiStD,CAAC"}
|
|
@@ -1,137 +1,138 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import
|
|
4
|
-
import { CHECKABLE_LIST_CLASSES as
|
|
5
|
-
import { useModuleDictionary as
|
|
1
|
+
import { jsx as e, jsxs as T } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useRef as _ } from "react";
|
|
3
|
+
import v from "clsx";
|
|
4
|
+
import { CHECKABLE_LIST_CLASSES as d } from "./constants.js";
|
|
5
|
+
import { useModuleDictionary as ge } from "@m4l/core";
|
|
6
6
|
import { DICCTIONARY as c } from "./dictionary.js";
|
|
7
|
-
import { useSizeContainer as
|
|
8
|
-
import { useStateRef as
|
|
9
|
-
import { Icon as
|
|
10
|
-
import { useCheckableListState as
|
|
11
|
-
import { useCheckableListItems as
|
|
12
|
-
import { useCheckableListSelection as
|
|
13
|
-
import { useCheckableListHandlers as
|
|
14
|
-
import { useCheckableListVirtualization as
|
|
15
|
-
import { useCheckableListRender as
|
|
16
|
-
import { RootStyled as A, LoadingContainerStyled as
|
|
17
|
-
import { Skeleton as
|
|
18
|
-
import { ImageText as
|
|
19
|
-
const
|
|
7
|
+
import { useSizeContainer as Se } from "../../hooks/useSizeContainer/index.js";
|
|
8
|
+
import { useStateRef as fe } from "../../hooks/useStateRef/index.js";
|
|
9
|
+
import { Icon as be } from "@m4l/base";
|
|
10
|
+
import { useCheckableListState as Ce } from "./hooks/useCheckableListState.js";
|
|
11
|
+
import { useCheckableListItems as ye } from "./hooks/useCheckableListItems.js";
|
|
12
|
+
import { useCheckableListSelection as Ie } from "./hooks/useCheckableListSelection.js";
|
|
13
|
+
import { useCheckableListHandlers as xe } from "./hooks/useCheckableListHandlers.js";
|
|
14
|
+
import { useCheckableListVirtualization as Le } from "./hooks/useCheckableListVirtualization.js";
|
|
15
|
+
import { useCheckableListRender as ke } from "./hooks/useCheckableListRender.js";
|
|
16
|
+
import { RootStyled as A, LoadingContainerStyled as we, SearchContainerStyled as ze, SearchInputStyled as He, SelectAllContainerStyled as Re, SelectAllCheckboxStyled as Ge, ChipCountTypografyStyled as Te, ListContainerStyled as _e, VirtualizedListStyled as ve, VirtualContainerStyled as Ae, VirtualRowStyled as Ee, EmptyMessageWrapperStyled as Ne } from "./slots/styled.js";
|
|
17
|
+
import { Skeleton as Ve } from "../extended/mui/Skeleton/Skeleton.js";
|
|
18
|
+
import { ImageText as Be } from "../ImageText/ImageText.js";
|
|
19
|
+
const rt = (E) => {
|
|
20
20
|
const {
|
|
21
|
-
value:
|
|
22
|
-
onChange:
|
|
23
|
-
items:
|
|
24
|
-
groups:
|
|
25
|
-
multiple:
|
|
26
|
-
selectAll:
|
|
27
|
-
groupable:
|
|
21
|
+
value: l = [],
|
|
22
|
+
onChange: N,
|
|
23
|
+
items: V = [],
|
|
24
|
+
groups: m,
|
|
25
|
+
multiple: u = !0,
|
|
26
|
+
selectAll: B = !1,
|
|
27
|
+
groupable: j = !0,
|
|
28
28
|
expandAllGroups: D = !0,
|
|
29
|
-
searchable:
|
|
30
|
-
filterFn:
|
|
31
|
-
size:
|
|
29
|
+
searchable: F = !1,
|
|
30
|
+
filterFn: M,
|
|
31
|
+
size: a = "medium",
|
|
32
32
|
variant: g = "standard",
|
|
33
|
-
width:
|
|
33
|
+
width: O = "100%",
|
|
34
34
|
checkboxSize: S = "medium",
|
|
35
|
-
showCheckboxOnGroup:
|
|
36
|
-
indeterminateBehavior:
|
|
35
|
+
showCheckboxOnGroup: P = !0,
|
|
36
|
+
indeterminateBehavior: Q = "indicate-some",
|
|
37
37
|
className: f,
|
|
38
38
|
"data-testid": b,
|
|
39
39
|
ariaLabel: C,
|
|
40
|
-
ariaLabelledBy:
|
|
41
|
-
renderItem:
|
|
42
|
-
renderGroup:
|
|
43
|
-
loading:
|
|
44
|
-
disabled:
|
|
45
|
-
itemRowHeight:
|
|
46
|
-
groupRowHeight:
|
|
47
|
-
} =
|
|
40
|
+
ariaLabelledBy: y,
|
|
41
|
+
renderItem: W,
|
|
42
|
+
renderGroup: K,
|
|
43
|
+
loading: U = !1,
|
|
44
|
+
disabled: i = !1,
|
|
45
|
+
itemRowHeight: Y,
|
|
46
|
+
groupRowHeight: q
|
|
47
|
+
} = E, I = _(null), [J, X] = fe(null), o = Se(J, {
|
|
48
48
|
// excludePadding: true,
|
|
49
|
-
}), { getLabel:
|
|
50
|
-
|
|
49
|
+
}), { getLabel: n } = ge(), s = _(o?.containerHeight ?? 0);
|
|
50
|
+
s.current !== o?.containerHeight && o?.containerHeight !== 0 && (s.current = o?.containerHeight ?? 0);
|
|
51
51
|
const {
|
|
52
|
-
searchQuery:
|
|
53
|
-
setSearchQuery:
|
|
52
|
+
searchQuery: x,
|
|
53
|
+
setSearchQuery: Z,
|
|
54
54
|
expandedGroups: L,
|
|
55
|
-
itemHeights:
|
|
56
|
-
handleGroupExpandToggle:
|
|
57
|
-
} =
|
|
58
|
-
groups:
|
|
55
|
+
itemHeights: $,
|
|
56
|
+
handleGroupExpandToggle: ee
|
|
57
|
+
} = Ce({
|
|
58
|
+
groups: m,
|
|
59
59
|
expandAllGroups: D
|
|
60
60
|
}), {
|
|
61
|
-
isGrouped:
|
|
61
|
+
isGrouped: h,
|
|
62
62
|
normalizedItems: k,
|
|
63
|
-
filteredItems:
|
|
64
|
-
filteredGroups:
|
|
65
|
-
virtualizedItems:
|
|
66
|
-
} =
|
|
67
|
-
items:
|
|
68
|
-
groups:
|
|
69
|
-
searchQuery:
|
|
70
|
-
filterFn:
|
|
63
|
+
filteredItems: te,
|
|
64
|
+
filteredGroups: re,
|
|
65
|
+
virtualizedItems: w
|
|
66
|
+
} = ye({
|
|
67
|
+
items: V,
|
|
68
|
+
groups: m,
|
|
69
|
+
searchQuery: x,
|
|
70
|
+
filterFn: M,
|
|
71
71
|
expandedGroups: L
|
|
72
72
|
}), {
|
|
73
|
-
getGroupItems:
|
|
74
|
-
isItemSelected:
|
|
75
|
-
isGroupFullySelected:
|
|
76
|
-
isGroupPartiallySelected:
|
|
73
|
+
getGroupItems: z,
|
|
74
|
+
isItemSelected: H,
|
|
75
|
+
isGroupFullySelected: R,
|
|
76
|
+
isGroupPartiallySelected: le,
|
|
77
77
|
areAllItemsSelected: p,
|
|
78
|
-
areSomeItemsSelected:
|
|
79
|
-
} =
|
|
80
|
-
value:
|
|
78
|
+
areSomeItemsSelected: ae
|
|
79
|
+
} = Ie({
|
|
80
|
+
value: l,
|
|
81
81
|
normalizedItems: k,
|
|
82
|
-
groups:
|
|
83
|
-
isGrouped:
|
|
84
|
-
}), { handleItemToggle:
|
|
85
|
-
value:
|
|
86
|
-
onChange:
|
|
87
|
-
multiple:
|
|
88
|
-
disabled:
|
|
82
|
+
groups: m,
|
|
83
|
+
isGrouped: h
|
|
84
|
+
}), { handleItemToggle: ie, handleGroupToggle: oe, handleSelectAllToggle: ne } = xe({
|
|
85
|
+
value: l,
|
|
86
|
+
onChange: N,
|
|
87
|
+
multiple: u,
|
|
88
|
+
disabled: i,
|
|
89
89
|
normalizedItems: k,
|
|
90
|
-
getGroupItems:
|
|
91
|
-
isGroupFullySelected:
|
|
92
|
-
isItemSelected:
|
|
90
|
+
getGroupItems: z,
|
|
91
|
+
isGroupFullySelected: R,
|
|
92
|
+
isItemSelected: H,
|
|
93
93
|
areAllItemsSelected: p
|
|
94
|
-
}), { getItemSize:
|
|
95
|
-
virtualizedItems:
|
|
96
|
-
itemHeights:
|
|
97
|
-
defaultItemRowHeight:
|
|
98
|
-
defaultGroupRowHeight:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
94
|
+
}), { getItemSize: se, virtualizer: de, virtualItems: ce, totalSize: me } = Le({
|
|
95
|
+
virtualizedItems: w,
|
|
96
|
+
itemHeights: $,
|
|
97
|
+
defaultItemRowHeight: Y,
|
|
98
|
+
defaultGroupRowHeight: q,
|
|
99
|
+
scrollElementRef: I
|
|
100
|
+
}), { renderVirtualizedItem: ue, urlIconSearch: he, urlIconNoResults: pe } = ke({
|
|
101
|
+
isItemSelected: H,
|
|
102
|
+
disabled: i,
|
|
103
|
+
size: a,
|
|
103
104
|
variant: g,
|
|
104
105
|
checkboxSize: S,
|
|
105
|
-
handleItemToggle:
|
|
106
|
-
renderItem:
|
|
106
|
+
handleItemToggle: ie,
|
|
107
|
+
renderItem: W,
|
|
107
108
|
expandedGroups: L,
|
|
108
|
-
isGroupFullySelected:
|
|
109
|
-
isGroupPartiallySelected:
|
|
110
|
-
getGroupItems:
|
|
111
|
-
indeterminateBehavior:
|
|
112
|
-
renderGroup:
|
|
113
|
-
groupable:
|
|
114
|
-
showCheckboxOnGroup:
|
|
115
|
-
handleGroupExpandToggle:
|
|
116
|
-
handleGroupToggle:
|
|
109
|
+
isGroupFullySelected: R,
|
|
110
|
+
isGroupPartiallySelected: le,
|
|
111
|
+
getGroupItems: z,
|
|
112
|
+
indeterminateBehavior: Q,
|
|
113
|
+
renderGroup: K,
|
|
114
|
+
groupable: j,
|
|
115
|
+
showCheckboxOnGroup: P,
|
|
116
|
+
handleGroupExpandToggle: ee,
|
|
117
|
+
handleGroupToggle: oe
|
|
117
118
|
}), t = {
|
|
118
|
-
size:
|
|
119
|
+
size: a,
|
|
119
120
|
variant: g,
|
|
120
|
-
disabled:
|
|
121
|
-
grouped:
|
|
122
|
-
hasSelected:
|
|
121
|
+
disabled: i,
|
|
122
|
+
grouped: h,
|
|
123
|
+
hasSelected: l.length > 0
|
|
123
124
|
};
|
|
124
|
-
if (
|
|
125
|
+
if (U)
|
|
125
126
|
return /* @__PURE__ */ e(
|
|
126
127
|
A,
|
|
127
128
|
{
|
|
128
129
|
ownerState: t,
|
|
129
|
-
className:
|
|
130
|
+
className: v(f, d.root),
|
|
130
131
|
"data-testid": b,
|
|
131
132
|
"aria-label": C || "checkable list",
|
|
132
|
-
"aria-labelledby":
|
|
133
|
-
children: /* @__PURE__ */ e(
|
|
134
|
-
|
|
133
|
+
"aria-labelledby": y,
|
|
134
|
+
children: /* @__PURE__ */ e(we, { ownerState: t, children: /* @__PURE__ */ e(
|
|
135
|
+
Ve,
|
|
135
136
|
{
|
|
136
137
|
variant: "rectangular",
|
|
137
138
|
width: "100%",
|
|
@@ -143,82 +144,97 @@ const Xe = (T) => {
|
|
|
143
144
|
) })
|
|
144
145
|
}
|
|
145
146
|
);
|
|
146
|
-
const G =
|
|
147
|
-
return /* @__PURE__ */
|
|
147
|
+
const G = h ? re.length > 0 : te.length > 0;
|
|
148
|
+
return /* @__PURE__ */ T(
|
|
148
149
|
A,
|
|
149
150
|
{
|
|
150
151
|
ownerState: t,
|
|
151
|
-
className:
|
|
152
|
+
className: v(f, d.root),
|
|
152
153
|
"data-testid": b,
|
|
153
154
|
role: "group",
|
|
154
155
|
"aria-label": C || "checkable list",
|
|
155
|
-
"aria-labelledby":
|
|
156
|
+
"aria-labelledby": y,
|
|
156
157
|
children: [
|
|
157
|
-
|
|
158
|
-
|
|
158
|
+
F && /* @__PURE__ */ e(ze, { ownerState: t, role: "search", children: /* @__PURE__ */ e(
|
|
159
|
+
He,
|
|
159
160
|
{
|
|
160
161
|
role: "searchbox",
|
|
161
162
|
"aria-label": "search",
|
|
162
163
|
ownerState: t,
|
|
163
|
-
value:
|
|
164
|
-
onChange: (
|
|
165
|
-
placeholder:
|
|
166
|
-
size:
|
|
167
|
-
className:
|
|
164
|
+
value: x,
|
|
165
|
+
onChange: (r) => Z(r.target.value),
|
|
166
|
+
placeholder: n(c.label_search_placeholder),
|
|
167
|
+
size: a,
|
|
168
|
+
className: d.searchInput,
|
|
168
169
|
variant: "contained",
|
|
169
170
|
InputProps: {
|
|
170
|
-
startAdornment: /* @__PURE__ */ e(
|
|
171
|
+
startAdornment: /* @__PURE__ */ e(be, { src: he })
|
|
171
172
|
}
|
|
172
173
|
}
|
|
173
174
|
) }),
|
|
174
|
-
|
|
175
|
+
B && G && u && /* @__PURE__ */ T(Re, { ownerState: t, role: "group", "aria-label": "Seleccionar todo", children: [
|
|
175
176
|
/* @__PURE__ */ e(
|
|
176
|
-
|
|
177
|
+
Ge,
|
|
177
178
|
{
|
|
178
179
|
checked: p,
|
|
179
|
-
indeterminate:
|
|
180
|
-
disabled:
|
|
180
|
+
indeterminate: ae && !p,
|
|
181
|
+
disabled: i,
|
|
181
182
|
size: S,
|
|
182
|
-
onChange:
|
|
183
|
-
inlineText:
|
|
183
|
+
onChange: ne,
|
|
184
|
+
inlineText: n(c.label_select_all)
|
|
184
185
|
}
|
|
185
186
|
),
|
|
186
187
|
/* @__PURE__ */ e(
|
|
187
|
-
|
|
188
|
+
Te,
|
|
188
189
|
{
|
|
189
190
|
ownerState: t,
|
|
190
191
|
variant: "bodyStandard",
|
|
191
|
-
size:
|
|
192
|
+
size: a,
|
|
192
193
|
color: "text.disabled",
|
|
193
|
-
children:
|
|
194
|
+
children: l.length
|
|
194
195
|
}
|
|
195
196
|
)
|
|
196
197
|
] }),
|
|
197
198
|
/* @__PURE__ */ e(
|
|
198
|
-
|
|
199
|
+
_e,
|
|
199
200
|
{
|
|
200
|
-
ref:
|
|
201
|
+
ref: X,
|
|
201
202
|
ownerState: { ...t },
|
|
202
|
-
"aria-multiselectable":
|
|
203
|
-
children: G ?
|
|
204
|
-
|
|
203
|
+
"aria-multiselectable": u ? "true" : "false",
|
|
204
|
+
children: G ? s.current > 0 ? /* @__PURE__ */ e(
|
|
205
|
+
ve,
|
|
205
206
|
{
|
|
206
|
-
ref:
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
207
|
+
ref: I,
|
|
208
|
+
ownerState: {
|
|
209
|
+
...t,
|
|
210
|
+
listHeight: s.current,
|
|
211
|
+
listWidth: O
|
|
212
|
+
},
|
|
213
|
+
className: d.virtualizedList,
|
|
214
|
+
children: /* @__PURE__ */ e(Ae, { ownerState: { ...t, totalSize: me }, children: ce.map((r) => /* @__PURE__ */ e(
|
|
215
|
+
Ee,
|
|
216
|
+
{
|
|
217
|
+
ref: de.measureElement,
|
|
218
|
+
"data-index": r.index,
|
|
219
|
+
ownerState: {
|
|
220
|
+
...t,
|
|
221
|
+
offsetTop: r.start,
|
|
222
|
+
minRowHeight: se(r.index)
|
|
223
|
+
},
|
|
224
|
+
children: ue({
|
|
225
|
+
index: r.index,
|
|
226
|
+
virtualizedItems: w
|
|
227
|
+
})
|
|
228
|
+
},
|
|
229
|
+
r.key
|
|
230
|
+
)) })
|
|
215
231
|
}
|
|
216
|
-
) : null : /* @__PURE__ */ e(
|
|
217
|
-
|
|
232
|
+
) : null : /* @__PURE__ */ e(Ne, { ownerState: t, role: "status", "aria-live": "polite", children: /* @__PURE__ */ e(
|
|
233
|
+
Be,
|
|
218
234
|
{
|
|
219
|
-
title:
|
|
220
|
-
message:
|
|
221
|
-
imageUrl:
|
|
235
|
+
title: n(c.label_no_results),
|
|
236
|
+
message: n(c.label_no_results_description),
|
|
237
|
+
imageUrl: pe
|
|
222
238
|
}
|
|
223
239
|
) })
|
|
224
240
|
}
|
|
@@ -228,5 +244,5 @@ const Xe = (T) => {
|
|
|
228
244
|
);
|
|
229
245
|
};
|
|
230
246
|
export {
|
|
231
|
-
|
|
247
|
+
rt as CheckableList
|
|
232
248
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckableList.styles.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/CheckableList/CheckableList.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAI9C,eAAO,MAAM,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"CheckableList.styles.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/CheckableList/CheckableList.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAI9C,eAAO,MAAM,mBAAmB,EAAE,mBA8RjC,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { getContrastTextColor as
|
|
1
|
+
import { getContrastTextColor as t } from "@m4l/graphics";
|
|
2
2
|
import { getSizeStyles as s } from "../../utils/getSizeStyles/getSizeStyles.js";
|
|
3
3
|
const n = {
|
|
4
4
|
/**
|
|
5
5
|
* Root: Estilos del contenedor principal del componente.
|
|
6
6
|
*/
|
|
7
|
-
root: ({ theme: e, ownerState:
|
|
7
|
+
root: ({ theme: e, ownerState: i }) => ({
|
|
8
8
|
width: "100%",
|
|
9
9
|
// height: '100%',
|
|
10
10
|
flexGrow: 1,
|
|
@@ -12,7 +12,7 @@ const n = {
|
|
|
12
12
|
display: "flex",
|
|
13
13
|
flexDirection: "column",
|
|
14
14
|
gap: e.vars.size.baseSpacings.sp2,
|
|
15
|
-
...
|
|
15
|
+
...i?.disabled && {
|
|
16
16
|
opacity: 0.6,
|
|
17
17
|
pointerEvents: "none"
|
|
18
18
|
}
|
|
@@ -27,11 +27,11 @@ const n = {
|
|
|
27
27
|
/**
|
|
28
28
|
* searchInput: Estilos del input de búsqueda.
|
|
29
29
|
*/
|
|
30
|
-
searchInput: ({ theme: e, ownerState:
|
|
30
|
+
searchInput: ({ theme: e, ownerState: i }) => ({
|
|
31
31
|
width: "100%",
|
|
32
|
-
...s(e,
|
|
33
|
-
height:
|
|
34
|
-
minHeight:
|
|
32
|
+
...s(e, i?.size || "medium", "container", (a) => ({
|
|
33
|
+
height: a,
|
|
34
|
+
minHeight: a
|
|
35
35
|
}))
|
|
36
36
|
}),
|
|
37
37
|
/**
|
|
@@ -55,7 +55,7 @@ const n = {
|
|
|
55
55
|
/**
|
|
56
56
|
* listContainer: Estilos del contenedor de la lista.
|
|
57
57
|
*/
|
|
58
|
-
listContainer: ({ theme: e, ownerState:
|
|
58
|
+
listContainer: ({ theme: e, ownerState: i }) => ({
|
|
59
59
|
flex: 1,
|
|
60
60
|
overflow: "hidden",
|
|
61
61
|
display: "flex",
|
|
@@ -64,25 +64,51 @@ const n = {
|
|
|
64
64
|
// border: `1px solid ${theme.vars.palette.border.secondary}`,
|
|
65
65
|
// borderRadius: theme.vars.size.borderRadius.r2,
|
|
66
66
|
backgroundColor: e.vars.palette.background.default,
|
|
67
|
-
...
|
|
68
|
-
maxHeight: typeof
|
|
67
|
+
...i?.maxHeight && {
|
|
68
|
+
maxHeight: typeof i.maxHeight == "number" ? `${i.maxHeight}px` : i.maxHeight
|
|
69
69
|
}
|
|
70
70
|
}),
|
|
71
71
|
/**
|
|
72
72
|
* virtualizedList: Estilos de la lista virtualizada.
|
|
73
|
+
* Es el elemento scrolleable que TanStack Virtual observa (`getScrollElement`).
|
|
74
|
+
* El alto lo aporta `useSizeContainer` a través de `ownerState.listHeight`, igual que antes se
|
|
75
|
+
* pasaba como prop `height` a react-window.
|
|
73
76
|
*/
|
|
74
|
-
virtualizedList: () => ({
|
|
77
|
+
virtualizedList: ({ ownerState: e }) => ({
|
|
78
|
+
width: typeof e?.listWidth == "number" ? `${e.listWidth}px` : e?.listWidth ?? "100%",
|
|
79
|
+
height: e?.listHeight ? `${e.listHeight}px` : "100%",
|
|
80
|
+
overflow: "auto"
|
|
81
|
+
}),
|
|
82
|
+
/**
|
|
83
|
+
* virtualContainer: Contenedor que reserva la altura total del contenido virtualizado.
|
|
84
|
+
* Define el área scrolleable; su alto es la suma de todas las filas (`getTotalSize`).
|
|
85
|
+
*/
|
|
86
|
+
virtualContainer: ({ ownerState: e }) => ({
|
|
87
|
+
width: "100%",
|
|
88
|
+
position: "relative",
|
|
89
|
+
height: `${e?.totalSize ?? 0}px`
|
|
90
|
+
}),
|
|
91
|
+
/**
|
|
92
|
+
* virtualRow: Wrapper de cada fila virtualizada, posicionada por TanStack Virtual.
|
|
93
|
+
* `minHeight` usa la altura estimada por `getItemSize`, de modo que las filas conservan su
|
|
94
|
+
* altura habitual pero pueden crecer cuando el contenido real lo requiere.
|
|
95
|
+
*/
|
|
96
|
+
virtualRow: ({ ownerState: e }) => ({
|
|
97
|
+
position: "absolute",
|
|
98
|
+
top: 0,
|
|
99
|
+
left: 0,
|
|
75
100
|
width: "100%",
|
|
76
|
-
|
|
101
|
+
minHeight: `${e?.minRowHeight ?? 0}px`,
|
|
102
|
+
transform: `translateY(${e?.offsetTop ?? 0}px)`
|
|
77
103
|
}),
|
|
78
104
|
/**
|
|
79
105
|
* itemWrapper: Estilos del contenedor de cada item.
|
|
80
106
|
*/
|
|
81
|
-
itemWrapper: ({ theme: e, ownerState:
|
|
107
|
+
itemWrapper: ({ theme: e, ownerState: i }) => ({
|
|
82
108
|
display: "flex",
|
|
83
109
|
alignItems: "center",
|
|
84
110
|
height: "100%",
|
|
85
|
-
backgroundColor:
|
|
111
|
+
backgroundColor: i?.selected ? e.vars.palette.primary.opacity : "transparent",
|
|
86
112
|
// borderBottom: `1px solid ${theme.vars.palette.border.secondary}`,
|
|
87
113
|
gap: e.vars.size.baseSpacings["sp2-5"],
|
|
88
114
|
padding: e.vars.size.baseSpacings["sp1-5"],
|
|
@@ -97,11 +123,11 @@ const n = {
|
|
|
97
123
|
/**
|
|
98
124
|
* itemCheckbox: Estilos del checkbox del item.
|
|
99
125
|
*/
|
|
100
|
-
itemCheckbox: ({ theme: e, ownerState:
|
|
126
|
+
itemCheckbox: ({ theme: e, ownerState: i }) => ({
|
|
101
127
|
flexShrink: 0,
|
|
102
|
-
...s(e,
|
|
103
|
-
width:
|
|
104
|
-
height:
|
|
128
|
+
...s(e, i?.size || "medium", "action", (a) => ({
|
|
129
|
+
width: a,
|
|
130
|
+
height: a
|
|
105
131
|
}))
|
|
106
132
|
}),
|
|
107
133
|
/**
|
|
@@ -129,18 +155,18 @@ const n = {
|
|
|
129
155
|
alignItems: "center",
|
|
130
156
|
justifyContent: "center",
|
|
131
157
|
flexShrink: 0,
|
|
132
|
-
...s(e, "medium", "action", (
|
|
133
|
-
width:
|
|
134
|
-
height:
|
|
158
|
+
...s(e, "medium", "action", (i) => ({
|
|
159
|
+
width: i,
|
|
160
|
+
height: i
|
|
135
161
|
}))
|
|
136
162
|
}),
|
|
137
163
|
/**
|
|
138
164
|
* groupWrapper: Estilos del contenedor del grupo.
|
|
139
165
|
*/
|
|
140
|
-
groupWrapper: ({ theme: e, ownerState:
|
|
166
|
+
groupWrapper: ({ theme: e, ownerState: i }) => ({
|
|
141
167
|
display: "flex",
|
|
142
168
|
flexDirection: "column",
|
|
143
|
-
backgroundColor:
|
|
169
|
+
backgroundColor: i?.selected ? e.vars.palette.primary.opacity : "transparent",
|
|
144
170
|
borderBottom: `1px solid ${e.vars.palette.border.secondary}`,
|
|
145
171
|
"&:last-child": {
|
|
146
172
|
borderBottom: "none"
|
|
@@ -183,13 +209,13 @@ const n = {
|
|
|
183
209
|
/**
|
|
184
210
|
* chipCount: Estilos del contador del grupo.
|
|
185
211
|
*/
|
|
186
|
-
chipCount: ({ theme: e, ownerState:
|
|
212
|
+
chipCount: ({ theme: e, ownerState: i }) => ({
|
|
187
213
|
"&&& ": {
|
|
188
214
|
borderRadius: e.vars.size.borderRadius["r1-5"],
|
|
189
215
|
paddingLeft: e.vars.size.baseSpacings.sp1,
|
|
190
216
|
paddingRight: e.vars.size.baseSpacings.sp1,
|
|
191
|
-
backgroundColor:
|
|
192
|
-
color:
|
|
217
|
+
backgroundColor: i?.color ?? e.vars.palette.background.surface,
|
|
218
|
+
color: i?.color ? t(i?.color) : e.vars.palette.text.secondary
|
|
193
219
|
}
|
|
194
220
|
}),
|
|
195
221
|
/**
|
|
@@ -200,19 +226,19 @@ const n = {
|
|
|
200
226
|
alignItems: "center",
|
|
201
227
|
justifyContent: "center",
|
|
202
228
|
flexShrink: 0,
|
|
203
|
-
...s(e, "medium", "action", (
|
|
204
|
-
width:
|
|
205
|
-
height:
|
|
229
|
+
...s(e, "medium", "action", (i) => ({
|
|
230
|
+
width: i,
|
|
231
|
+
height: i
|
|
206
232
|
}))
|
|
207
233
|
}),
|
|
208
234
|
/**
|
|
209
235
|
* groupToggleButton: Estilos del botón para expandir/colapsar grupo.
|
|
210
236
|
*/
|
|
211
|
-
groupToggleButton: ({ theme: e, ownerState:
|
|
237
|
+
groupToggleButton: ({ theme: e, ownerState: i }) => ({
|
|
212
238
|
flexShrink: 0,
|
|
213
|
-
...s(e,
|
|
214
|
-
width:
|
|
215
|
-
height:
|
|
239
|
+
...s(e, i?.size || "medium", "action", (a) => ({
|
|
240
|
+
width: a,
|
|
241
|
+
height: a
|
|
216
242
|
}))
|
|
217
243
|
}),
|
|
218
244
|
/**
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export declare const CHECKABLE_LIST_KEY_COMPONENT = "M4LCheckableList";
|
|
2
|
-
export declare const CHECKABLE_LIST_CLASSES: Record<"root" | "searchContainer" | "searchInput" | "selectAllContainer" | "selectAllCheckbox" | "listContainer" | "virtualizedList" | "itemWrapper" | "itemCheckbox" | "itemContentWrapper" | "itemLabel" | "itemDescription" | "itemIcon" | "groupWrapper" | "groupHeader" | "groupCheckbox" | "groupLabelCountWrapper" | "groupLabel" | "chipCount" | "groupIcon" | "groupToggleButton" | "groupItems" | "emptyMessageWrapper" | "loadingContainer", string>;
|
|
2
|
+
export declare const CHECKABLE_LIST_CLASSES: Record<"root" | "searchContainer" | "searchInput" | "selectAllContainer" | "selectAllCheckbox" | "listContainer" | "virtualizedList" | "virtualContainer" | "virtualRow" | "itemWrapper" | "itemCheckbox" | "itemContentWrapper" | "itemLabel" | "itemDescription" | "itemIcon" | "groupWrapper" | "groupHeader" | "groupCheckbox" | "groupLabelCountWrapper" | "groupLabel" | "chipCount" | "groupIcon" | "groupToggleButton" | "groupItems" | "emptyMessageWrapper" | "loadingContainer", string>;
|
|
3
3
|
export declare const CHECKABLE_LIST_DEFAULT_ITEM_ROW_HEIGHT = 36;
|
|
4
4
|
export declare const CHECKABLE_LIST_DEFAULT_ITEM_ROW_HEIGHT_WITH_DESCRIPTION = 46;
|
|
5
5
|
export declare const CHECKABLE_LIST_DEFAULT_GROUP_ROW_HEIGHT = 36;
|
|
6
|
+
/**
|
|
7
|
+
* Cantidad de filas que TanStack Virtual monta fuera del viewport, arriba y abajo.
|
|
8
|
+
* Evita ver huecos en blanco durante el scroll rápido.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CHECKABLE_LIST_VIRTUALIZER_OVERSCAN = 5;
|
|
6
11
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/CheckableList/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAE/D,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/CheckableList/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAE/D,eAAO,MAAM,sBAAsB,qeAGlC,CAAC;AAEF,eAAO,MAAM,sCAAsC,KAAK,CAAC;AACzD,eAAO,MAAM,uDAAuD,KAAK,CAAC;AAC1E,eAAO,MAAM,uCAAuC,KAAK,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,mCAAmC,IAAI,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { getComponentClasses as E } from "../../utils/getComponentSlotRoot.js";
|
|
2
2
|
import { CheckableListSlots as _ } from "./slots/slots.js";
|
|
3
|
-
const C = "M4LCheckableList",
|
|
3
|
+
const C = "M4LCheckableList", I = E(
|
|
4
4
|
C,
|
|
5
5
|
_
|
|
6
|
-
),
|
|
6
|
+
), o = 36, t = 46, H = 36, s = 5;
|
|
7
7
|
export {
|
|
8
|
-
|
|
8
|
+
I as CHECKABLE_LIST_CLASSES,
|
|
9
9
|
H as CHECKABLE_LIST_DEFAULT_GROUP_ROW_HEIGHT,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
C as CHECKABLE_LIST_KEY_COMPONENT
|
|
10
|
+
o as CHECKABLE_LIST_DEFAULT_ITEM_ROW_HEIGHT,
|
|
11
|
+
t as CHECKABLE_LIST_DEFAULT_ITEM_ROW_HEIGHT_WITH_DESCRIPTION,
|
|
12
|
+
C as CHECKABLE_LIST_KEY_COMPONENT,
|
|
13
|
+
s as CHECKABLE_LIST_VIRTUALIZER_OVERSCAN
|
|
13
14
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { MouseEvent, ChangeEvent } from 'react';
|
|
2
|
-
import { ListChildComponentProps } from 'react-window';
|
|
3
2
|
import { Sizes } from '@m4l/styles';
|
|
4
|
-
import { CheckableListItem, CheckableListGroup, CheckableListRenderItemParams } from '../types';
|
|
3
|
+
import { CheckableListItem, CheckableListGroup, CheckableListRenderItemParams, RenderVirtualizedItemParams } from '../types';
|
|
5
4
|
export interface CheckableListRenderGroupParams {
|
|
6
5
|
group: CheckableListGroup;
|
|
7
6
|
items: CheckableListItem[];
|
|
@@ -41,7 +40,7 @@ interface UseCheckableListRenderProps {
|
|
|
41
40
|
interface UseCheckableListRenderReturn {
|
|
42
41
|
renderItemContent: (item: CheckableListItem, index: number) => React.ReactNode;
|
|
43
42
|
renderGroupContent: (group: CheckableListGroup, index: number) => React.ReactNode;
|
|
44
|
-
renderVirtualizedItem: (
|
|
43
|
+
renderVirtualizedItem: (params: RenderVirtualizedItemParams) => React.ReactNode;
|
|
45
44
|
urlIconSearch: string;
|
|
46
45
|
urlIconNoResults: string;
|
|
47
46
|
}
|