lecom-ui 5.4.28 → 5.4.30
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.
|
@@ -145,7 +145,8 @@ const PaginationPerPage = ({
|
|
|
145
145
|
className,
|
|
146
146
|
onChangePerPage,
|
|
147
147
|
perPage,
|
|
148
|
-
totalRowsSelected = 0
|
|
148
|
+
totalRowsSelected = 0,
|
|
149
|
+
maxSelection
|
|
149
150
|
}) => {
|
|
150
151
|
const { t } = useTranslation();
|
|
151
152
|
const perPageOptions = [
|
|
@@ -165,6 +166,12 @@ const PaginationPerPage = ({
|
|
|
165
166
|
if (!onChangePerPage) {
|
|
166
167
|
return null;
|
|
167
168
|
}
|
|
169
|
+
const getSelectedText = () => {
|
|
170
|
+
if (maxSelection === 1 && totalRowsSelected === 1) {
|
|
171
|
+
return `${totalRowsSelected} ${t("pagination.selectedItemSingular")}`;
|
|
172
|
+
}
|
|
173
|
+
return `${totalRowsSelected} ${t("pagination.selectedProcess")}`;
|
|
174
|
+
};
|
|
168
175
|
return /* @__PURE__ */ React.createElement("div", { className: cn("flex items-center gap-4", className) }, /* @__PURE__ */ React.createElement(DropdownMenu, null, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(Button, { size: "small", color: "grey", variant: "outlined" }, /* @__PURE__ */ React.createElement("span", { className: "max-md:hidden" }, t("pagination.show")), " ", perPage, /* @__PURE__ */ React.createElement(ChevronDown, { size: 20 }))), /* @__PURE__ */ React.createElement(DropdownMenuContent, { side: "top", align: "center" }, perPageOptions.map((option) => /* @__PURE__ */ React.createElement(
|
|
169
176
|
DropdownMenuItem,
|
|
170
177
|
{
|
|
@@ -174,7 +181,7 @@ const PaginationPerPage = ({
|
|
|
174
181
|
}
|
|
175
182
|
},
|
|
176
183
|
option.value.toString()
|
|
177
|
-
)))), totalRowsSelected > 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "heading-xxsmall-600", textColor: "text-grey-800" },
|
|
184
|
+
)))), totalRowsSelected > 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "heading-xxsmall-600", textColor: "text-grey-800" }, getSelectedText()));
|
|
178
185
|
};
|
|
179
186
|
PaginationPerPage.displayName = "PaginationPerPage";
|
|
180
187
|
const Pagination = ({
|
|
@@ -185,7 +192,8 @@ const Pagination = ({
|
|
|
185
192
|
onChangePerPage,
|
|
186
193
|
className,
|
|
187
194
|
activeColor,
|
|
188
|
-
showPerPageSelector = true
|
|
195
|
+
showPerPageSelector = true,
|
|
196
|
+
maxSelection
|
|
189
197
|
}) => {
|
|
190
198
|
const { t } = useTranslation();
|
|
191
199
|
const mapPaginationItem = (item) => {
|
|
@@ -215,6 +223,12 @@ const Pagination = ({
|
|
|
215
223
|
};
|
|
216
224
|
return React.createElement(mappedComponents[item.type], componentProps);
|
|
217
225
|
};
|
|
226
|
+
const getSelectedText = () => {
|
|
227
|
+
if (maxSelection === 1 && totalRowsSelected === 1) {
|
|
228
|
+
return `${totalRowsSelected} ${t("pagination.selectedItemSingular")}`;
|
|
229
|
+
}
|
|
230
|
+
return `${totalRowsSelected} ${t("pagination.selectedProcess")}`;
|
|
231
|
+
};
|
|
218
232
|
return /* @__PURE__ */ React.createElement(
|
|
219
233
|
"div",
|
|
220
234
|
{
|
|
@@ -225,10 +239,11 @@ const Pagination = ({
|
|
|
225
239
|
{
|
|
226
240
|
onChangePerPage,
|
|
227
241
|
perPage,
|
|
228
|
-
totalRowsSelected
|
|
242
|
+
totalRowsSelected,
|
|
243
|
+
maxSelection
|
|
229
244
|
}
|
|
230
245
|
),
|
|
231
|
-
!showPerPageSelector && totalRowsSelected > 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "heading-xxsmall-600", textColor: "text-grey-800" },
|
|
246
|
+
!showPerPageSelector && totalRowsSelected > 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "heading-xxsmall-600", textColor: "text-grey-800" }, getSelectedText()),
|
|
232
247
|
/* @__PURE__ */ React.createElement("nav", { role: "navigation", "aria-label": "pagination" }, /* @__PURE__ */ React.createElement(PaginationContent, null, itemsPage.map((item) => /* @__PURE__ */ React.createElement(PaginationItem, { key: item.id }, mapPaginationItem(item)))))
|
|
233
248
|
);
|
|
234
249
|
};
|
|
@@ -13,15 +13,31 @@ function TagItem({ item, onRemove, readOnly }) {
|
|
|
13
13
|
},
|
|
14
14
|
[item.value, onRemove]
|
|
15
15
|
);
|
|
16
|
-
return /* @__PURE__ */ React.createElement(
|
|
17
|
-
|
|
16
|
+
return /* @__PURE__ */ React.createElement(
|
|
17
|
+
Tag,
|
|
18
18
|
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
"data-tag": "true",
|
|
20
|
+
color: "blue",
|
|
21
|
+
className: "max-w-[15.625rem] h-6 !px-2 !py-0.5"
|
|
22
|
+
},
|
|
23
|
+
/* @__PURE__ */ React.createElement(
|
|
24
|
+
Typography,
|
|
25
|
+
{
|
|
26
|
+
variant: "body-small-400",
|
|
27
|
+
className: "text-blue-600 truncate p-0"
|
|
28
|
+
},
|
|
29
|
+
item.label
|
|
30
|
+
),
|
|
31
|
+
!readOnly && /* @__PURE__ */ React.createElement(
|
|
32
|
+
X,
|
|
33
|
+
{
|
|
34
|
+
className: "w-4 h-4 cursor-pointer flex-shrink-0",
|
|
35
|
+
onClick: handleRemove,
|
|
36
|
+
"aria-label": `Remover ${item.label}`,
|
|
37
|
+
tabIndex: 0
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
);
|
|
25
41
|
}
|
|
26
42
|
function HiddenCountTag({ count }) {
|
|
27
43
|
return /* @__PURE__ */ React.createElement(Tag, { color: "blue", "data-tag": "true" }, /* @__PURE__ */ React.createElement(Typography, { variant: "body-small-400", className: "text-blue-600" }, "+", count));
|
|
@@ -69,7 +85,8 @@ function useDynamicMaxCount(ref, value, maxDisplayCount) {
|
|
|
69
85
|
const [maxLines, setMaxLines] = React.useState(null);
|
|
70
86
|
const hasCalculatedMaxLines = React.useRef(false);
|
|
71
87
|
React.useEffect(() => {
|
|
72
|
-
if (hasCalculatedMaxLines.current || !ref.current || value.length === 0)
|
|
88
|
+
if (hasCalculatedMaxLines.current || !ref.current || value.length === 0)
|
|
89
|
+
return;
|
|
73
90
|
const calculateMaxLines = () => {
|
|
74
91
|
if (!ref.current) {
|
|
75
92
|
setTimeout(calculateMaxLines, 10);
|
|
@@ -83,7 +100,10 @@ function useDynamicMaxCount(ref, value, maxDisplayCount) {
|
|
|
83
100
|
const TAG_HEIGHT = 24;
|
|
84
101
|
const CONTAINER_PADDING_VERTICAL = 4;
|
|
85
102
|
const availableHeight = containerHeight - CONTAINER_PADDING_VERTICAL * 2;
|
|
86
|
-
const calculatedMaxLines = Math.max(
|
|
103
|
+
const calculatedMaxLines = Math.max(
|
|
104
|
+
1,
|
|
105
|
+
Math.floor(availableHeight / TAG_HEIGHT)
|
|
106
|
+
);
|
|
87
107
|
setMaxLines(calculatedMaxLines);
|
|
88
108
|
hasCalculatedMaxLines.current = true;
|
|
89
109
|
};
|
|
@@ -126,7 +146,11 @@ function useDynamicMaxCount(ref, value, maxDisplayCount) {
|
|
|
126
146
|
setDynamicMaxCount(value.length);
|
|
127
147
|
return;
|
|
128
148
|
}
|
|
129
|
-
const count = simulateTagLayout(
|
|
149
|
+
const count = simulateTagLayout(
|
|
150
|
+
estimatedWidths,
|
|
151
|
+
availableWidth,
|
|
152
|
+
maxLines
|
|
153
|
+
);
|
|
130
154
|
setDynamicMaxCount(count);
|
|
131
155
|
};
|
|
132
156
|
const rafId = requestAnimationFrame(() => {
|
|
@@ -192,7 +216,7 @@ function TagInput(props) {
|
|
|
192
216
|
style: containerStyles,
|
|
193
217
|
...restProps
|
|
194
218
|
},
|
|
195
|
-
value.length === 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "body-small-400", className: "text-grey-
|
|
219
|
+
value.length === 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "body-small-400", className: "text-grey-500" }, placeholder),
|
|
196
220
|
displayTags.map((item) => /* @__PURE__ */ React.createElement(
|
|
197
221
|
TagItem,
|
|
198
222
|
{
|
|
@@ -9,7 +9,8 @@ const language = {
|
|
|
9
9
|
},
|
|
10
10
|
pagination: {
|
|
11
11
|
show: "Show:",
|
|
12
|
-
selectedProcess: "Item(s) selected"
|
|
12
|
+
selectedProcess: "Item(s) selected",
|
|
13
|
+
selectedItemSingular: "item selected"
|
|
13
14
|
},
|
|
14
15
|
upload: {
|
|
15
16
|
label: "Drag and drop the file here or click to select it.",
|
|
@@ -9,7 +9,8 @@ const language = {
|
|
|
9
9
|
},
|
|
10
10
|
pagination: {
|
|
11
11
|
show: "Mostrar:",
|
|
12
|
-
selectedProcess: "Item(s) seleccionado(s)"
|
|
12
|
+
selectedProcess: "Item(s) seleccionado(s)",
|
|
13
|
+
selectedItemSingular: "item seleccionado"
|
|
13
14
|
},
|
|
14
15
|
upload: {
|
|
15
16
|
label: "Arrastre y suelte el archivo aqu\xED o haga clic para seleccionarlo.",
|
|
@@ -9,7 +9,8 @@ const language = {
|
|
|
9
9
|
},
|
|
10
10
|
pagination: {
|
|
11
11
|
show: "Mostrar:",
|
|
12
|
-
selectedProcess: "Item(s) selecionado(s)"
|
|
12
|
+
selectedProcess: "Item(s) selecionado(s)",
|
|
13
|
+
selectedItemSingular: "item selecionado"
|
|
13
14
|
},
|
|
14
15
|
upload: {
|
|
15
16
|
label: "Arraste e solte o arquivo aqui ou clique para selecion\xE1-lo.",
|
package/dist/index.d.ts
CHANGED
|
@@ -306,6 +306,7 @@ interface PaginationProps {
|
|
|
306
306
|
className?: string;
|
|
307
307
|
activeColor?: BgColor$1;
|
|
308
308
|
showPerPageSelector?: boolean;
|
|
309
|
+
maxSelection?: number;
|
|
309
310
|
}
|
|
310
311
|
declare const PaginationContent: React$1.ForwardRefExoticComponent<Omit<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref"> & React$1.RefAttributes<HTMLUListElement>>;
|
|
311
312
|
declare const PaginationItem: React$1.ForwardRefExoticComponent<Omit<React$1.DetailedHTMLProps<React$1.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React$1.RefAttributes<HTMLLIElement>>;
|
|
@@ -334,7 +335,7 @@ declare const PaginationIndex: {
|
|
|
334
335
|
displayName: string;
|
|
335
336
|
};
|
|
336
337
|
declare const Pagination: {
|
|
337
|
-
({ currentPage, itemsPage, perPage, totalRowsSelected, onChangePerPage, className, activeColor, showPerPageSelector, }: PaginationProps): React$1.JSX.Element;
|
|
338
|
+
({ currentPage, itemsPage, perPage, totalRowsSelected, onChangePerPage, className, activeColor, showPerPageSelector, maxSelection, }: PaginationProps): React$1.JSX.Element;
|
|
338
339
|
displayName: string;
|
|
339
340
|
};
|
|
340
341
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lecom-ui",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.30",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"hex-color-opacity": "^0.4.2",
|
|
51
51
|
"i18next": "^24.2.2",
|
|
52
52
|
"lucide-react": "^0.488.0",
|
|
53
|
-
"next": "
|
|
53
|
+
"next": "15.5.9",
|
|
54
54
|
"react": ">=18.0.0",
|
|
55
55
|
"react-colorful": "^5.6.1",
|
|
56
56
|
"react-day-picker": "^9.8.0",
|