lecom-ui 5.4.31 → 5.4.32
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 +1 -1
- package/dist/components/Combobox/Combobox.js +42 -178
- package/dist/components/DataTable/DataTable.js +2 -2
- package/dist/components/DataTable/DataTable.utils.js +1 -1
- package/dist/components/DataTable/Table.js +1 -1
- package/dist/components/Header/SearchInput.js +1 -4
- package/dist/components/Input/Input.js +2 -2
- package/dist/components/Layout/Layout.js +0 -3
- package/dist/components/MultiSelect/MultiSelect.js +124 -238
- package/dist/components/Pagination/Pagination.js +5 -20
- package/dist/components/ScrollArea/ScrollArea.js +1 -1
- package/dist/components/TagInput/TagInput.js +12 -36
- package/dist/i18n/locales/en_us.js +2 -4
- package/dist/i18n/locales/es_es.js +2 -4
- package/dist/i18n/locales/pt_br.js +2 -4
- package/dist/index.d.ts +5 -11
- package/dist/plugin/extend.js +79 -79
- package/dist/plugin/fontFaces.js +172 -172
- package/dist/plugin/general.js +12 -12
- package/dist/plugin/pluginDev.cjs +5 -5
- package/dist/plugin/pluginNext.cjs +5 -5
- package/dist/plugin/pluginNextTurbo.cjs +5 -5
- package/dist/plugin/pluginVite.cjs +5 -5
- package/dist/plugin/template.js +31 -31
- package/dist/plugin/typographies.js +152 -152
- package/dist/plugin/varsTheme.js +79 -79
- package/dist/style.min.css +1 -1
- package/package.json +1 -1
- package/dist/components/Collapse/Collapse.js +0 -94
- package/dist/components/CustomIcon/Icons/CadastroFacil.js +0 -23
- package/dist/components/CustomIcon/Icons/LogoLecom.js +0 -30
- package/dist/components/CustomIcon/Icons/LogoLecomBrand.js +0 -23
- package/dist/components/CustomIcon/Icons/ModoTeste.js +0 -23
- package/dist/components/CustomIcon/Icons/Rpa.js +0 -23
- package/dist/components/CustomIcon/Icons/SairModoTeste.js +0 -31
- package/dist/components/IconHandler/IconHandler.js +0 -99
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
lecom-ui
|
|
1
|
+
lecom-ui
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
|
-
import { ChevronUpIcon, ChevronDownIcon, Check
|
|
4
|
+
import { ChevronUpIcon, ChevronDownIcon, Check } from 'lucide-react';
|
|
5
5
|
import { initializeI18n } from '../../i18n/index.js';
|
|
6
6
|
import { cn } from '../../lib/utils.js';
|
|
7
7
|
import { Button } from '../Button/Button.js';
|
|
@@ -115,7 +115,7 @@ const ComboboxItemContent = ({
|
|
|
115
115
|
),
|
|
116
116
|
"aria-current": isSelected ? "true" : void 0
|
|
117
117
|
},
|
|
118
|
-
/* @__PURE__ */ React.createElement(Typography, { className: "w-4 h-4 flex items-center justify-center
|
|
118
|
+
/* @__PURE__ */ React.createElement(Typography, { className: "w-4 h-4 flex items-center justify-center" }, option.value === value && /* @__PURE__ */ React.createElement(
|
|
119
119
|
Check,
|
|
120
120
|
{
|
|
121
121
|
className: cn(textColor, isSelected ? "text-primary-600" : ""),
|
|
@@ -123,64 +123,18 @@ const ComboboxItemContent = ({
|
|
|
123
123
|
strokeWidth: isSelected ? 2.5 : 2
|
|
124
124
|
}
|
|
125
125
|
)),
|
|
126
|
-
option.prefix && /* @__PURE__ */ React.createElement(
|
|
127
|
-
Typography,
|
|
128
|
-
{
|
|
129
|
-
className: cn(
|
|
130
|
-
"mr-0.5 flex items-center justify-center shrink-0",
|
|
131
|
-
textColor
|
|
132
|
-
)
|
|
133
|
-
},
|
|
134
|
-
option.prefix
|
|
135
|
-
),
|
|
126
|
+
option.prefix && /* @__PURE__ */ React.createElement(Typography, { className: cn("mr-0.5 flex items-center justify-center shrink-0", textColor) }, option.prefix),
|
|
136
127
|
/* @__PURE__ */ React.createElement(
|
|
137
128
|
Typography,
|
|
138
129
|
{
|
|
139
130
|
variant: fontVariant,
|
|
140
|
-
className: cn(
|
|
141
|
-
textColor,
|
|
142
|
-
"whitespace-normal flex items-center justify-center"
|
|
143
|
-
)
|
|
131
|
+
className: cn(textColor, "whitespace-normal flex items-center justify-center")
|
|
144
132
|
},
|
|
145
133
|
option.label
|
|
146
134
|
)
|
|
147
135
|
);
|
|
148
136
|
};
|
|
149
137
|
ComboboxItemContent.displayName = "ComboboxItemContent";
|
|
150
|
-
const CreateOption = ({
|
|
151
|
-
searchTerm,
|
|
152
|
-
onCreateOption,
|
|
153
|
-
onClose,
|
|
154
|
-
size = "medium"
|
|
155
|
-
}) => {
|
|
156
|
-
const { t } = useTranslation();
|
|
157
|
-
const fontVariant = getFontVariant(size);
|
|
158
|
-
const checkIconSize = CHECK_ICON_SIZES[size];
|
|
159
|
-
const handleCreate = () => {
|
|
160
|
-
onClose();
|
|
161
|
-
requestAnimationFrame(() => onCreateOption(searchTerm));
|
|
162
|
-
};
|
|
163
|
-
return /* @__PURE__ */ React.createElement(
|
|
164
|
-
CommandItem,
|
|
165
|
-
{
|
|
166
|
-
onSelect: handleCreate,
|
|
167
|
-
className: cn(
|
|
168
|
-
comboboxItemVariants({ size }),
|
|
169
|
-
"text-primary-600 hover:bg-primary-50"
|
|
170
|
-
)
|
|
171
|
-
},
|
|
172
|
-
/* @__PURE__ */ React.createElement(Typography, { className: "w-4 h-4 flex items-center justify-center shrink-0" }, /* @__PURE__ */ React.createElement(
|
|
173
|
-
Plus,
|
|
174
|
-
{
|
|
175
|
-
className: "text-primary-600",
|
|
176
|
-
size: checkIconSize,
|
|
177
|
-
strokeWidth: 2
|
|
178
|
-
}
|
|
179
|
-
)),
|
|
180
|
-
/* @__PURE__ */ React.createElement(Typography, { variant: fontVariant, className: "text-primary-600" }, t("multiSelect.create"), " ", '"', searchTerm, '"')
|
|
181
|
-
);
|
|
182
|
-
};
|
|
183
|
-
CreateOption.displayName = "CreateOption";
|
|
184
138
|
const ComboboxOptionsList = React.memo(
|
|
185
139
|
({ items, value, onChange, onClose, itemsClassName, size }) => /* @__PURE__ */ React.createElement(React.Fragment, null, items.map(
|
|
186
140
|
(item, idx) => isComboboxGroup(item) ? /* @__PURE__ */ React.createElement(
|
|
@@ -217,83 +171,6 @@ const ComboboxOptionsList = React.memo(
|
|
|
217
171
|
))
|
|
218
172
|
);
|
|
219
173
|
ComboboxOptionsList.displayName = "ComboboxOptionsList";
|
|
220
|
-
const useComboboxScrollToSelected = (open, value, commandListRef) => {
|
|
221
|
-
React.useEffect(() => {
|
|
222
|
-
if (!open) return;
|
|
223
|
-
if (!value) return;
|
|
224
|
-
requestAnimationFrame(() => {
|
|
225
|
-
const el = commandListRef.current?.querySelector(
|
|
226
|
-
`[data-combobox-value="${value}"]`
|
|
227
|
-
);
|
|
228
|
-
if (el) {
|
|
229
|
-
el.scrollIntoView({ block: "nearest" });
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
}, [open, value, commandListRef]);
|
|
233
|
-
};
|
|
234
|
-
const useComboboxState = (options, renderOptions, value, search, allowCreate, onCreateOption, placeholder, t) => {
|
|
235
|
-
const filteredOptions = React.useMemo(
|
|
236
|
-
() => !search ? renderOptions : filterComboboxOptions(renderOptions, search),
|
|
237
|
-
[renderOptions, search]
|
|
238
|
-
);
|
|
239
|
-
const selectedOption = React.useMemo(
|
|
240
|
-
() => getSelectedOption(options, value),
|
|
241
|
-
[options, value]
|
|
242
|
-
);
|
|
243
|
-
const showCreateOption = allowCreate && onCreateOption && search.trim() !== "";
|
|
244
|
-
const selectedLabel = selectedOption?.label || placeholder || t("multiSelect.placeholder");
|
|
245
|
-
const selectedPrefix = selectedOption?.prefix;
|
|
246
|
-
return {
|
|
247
|
-
filteredOptions,
|
|
248
|
-
selectedOption,
|
|
249
|
-
showCreateOption,
|
|
250
|
-
selectedLabel,
|
|
251
|
-
selectedPrefix
|
|
252
|
-
};
|
|
253
|
-
};
|
|
254
|
-
const ComboboxContent = ({
|
|
255
|
-
showCreateOption,
|
|
256
|
-
search,
|
|
257
|
-
onCreateOption,
|
|
258
|
-
onClose,
|
|
259
|
-
size,
|
|
260
|
-
notFoundContent,
|
|
261
|
-
filteredOptions,
|
|
262
|
-
value,
|
|
263
|
-
onChange,
|
|
264
|
-
itemsClassName
|
|
265
|
-
}) => {
|
|
266
|
-
const { t } = useTranslation();
|
|
267
|
-
const hasResults = filteredOptions.length > 0;
|
|
268
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, !hasResults && /* @__PURE__ */ React.createElement(CommandEmpty, null, notFoundContent || t("multiSelect.empty")), /* @__PURE__ */ React.createElement(
|
|
269
|
-
ComboboxOptionsList,
|
|
270
|
-
{
|
|
271
|
-
items: filteredOptions,
|
|
272
|
-
value,
|
|
273
|
-
onChange,
|
|
274
|
-
onClose,
|
|
275
|
-
itemsClassName,
|
|
276
|
-
size
|
|
277
|
-
}
|
|
278
|
-
), showCreateOption && onCreateOption && /* @__PURE__ */ React.createElement(
|
|
279
|
-
"div",
|
|
280
|
-
{
|
|
281
|
-
className: cn(
|
|
282
|
-
"sticky bottom-0 bg-white pt-1",
|
|
283
|
-
hasResults && "border-t border-grey-200"
|
|
284
|
-
)
|
|
285
|
-
},
|
|
286
|
-
/* @__PURE__ */ React.createElement(
|
|
287
|
-
CreateOption,
|
|
288
|
-
{
|
|
289
|
-
searchTerm: search,
|
|
290
|
-
onCreateOption,
|
|
291
|
-
onClose,
|
|
292
|
-
size
|
|
293
|
-
}
|
|
294
|
-
)
|
|
295
|
-
));
|
|
296
|
-
};
|
|
297
174
|
const comboboxTriggerVariants = cva(
|
|
298
175
|
"w-full px-4 text-left shadow-sm flex items-center justify-between transition",
|
|
299
176
|
{
|
|
@@ -364,24 +241,14 @@ const ComboboxTriggerButton = React.forwardRef(
|
|
|
364
241
|
disabled: disabled ?? false,
|
|
365
242
|
...props
|
|
366
243
|
},
|
|
367
|
-
/* @__PURE__ */ React.createElement(
|
|
368
|
-
|
|
244
|
+
/* @__PURE__ */ React.createElement("div", { className: cn("flex items-center gap-2 truncate min-w-[calc(100%-2.25rem)]", selectedPrefix && "min-w-[calc(100%-4.75rem)]") }, selectedPrefix && /* @__PURE__ */ React.createElement(Typography, { className: "flex items-center shrink-0" }, selectedPrefix), /* @__PURE__ */ React.createElement(
|
|
245
|
+
Typography,
|
|
369
246
|
{
|
|
370
|
-
className: cn(
|
|
371
|
-
|
|
372
|
-
selectedPrefix && "min-w-[calc(100%-4.75rem)]"
|
|
373
|
-
)
|
|
247
|
+
className: cn("truncate", colorClass),
|
|
248
|
+
variant: fontVariant
|
|
374
249
|
},
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
Typography,
|
|
378
|
-
{
|
|
379
|
-
className: cn("truncate", colorClass),
|
|
380
|
-
variant: fontVariant
|
|
381
|
-
},
|
|
382
|
-
selectedLabel
|
|
383
|
-
)
|
|
384
|
-
),
|
|
250
|
+
selectedLabel
|
|
251
|
+
)),
|
|
385
252
|
/* @__PURE__ */ React.createElement("div", { className: "w-5" }, /* @__PURE__ */ React.createElement(
|
|
386
253
|
ChevronIcon,
|
|
387
254
|
{
|
|
@@ -407,42 +274,43 @@ function Combobox({
|
|
|
407
274
|
itemsClassName,
|
|
408
275
|
rounded = "default",
|
|
409
276
|
showSearch = true,
|
|
410
|
-
size = "medium"
|
|
411
|
-
allowCreate = false,
|
|
412
|
-
onCreateOption
|
|
277
|
+
size = "medium"
|
|
413
278
|
}) {
|
|
414
279
|
const { t } = useTranslation();
|
|
415
280
|
const [open, setOpen] = React.useState(false);
|
|
416
281
|
const [search, setSearch] = React.useState("");
|
|
417
282
|
const commandListRef = React.useRef(null);
|
|
418
|
-
const
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
lastOpenOptionsRef.current = options;
|
|
422
|
-
}
|
|
423
|
-
}, [open, options]);
|
|
424
|
-
const renderOptions = open ? options : lastOpenOptionsRef.current;
|
|
425
|
-
const { filteredOptions, showCreateOption, selectedLabel, selectedPrefix } = useComboboxState(
|
|
426
|
-
options,
|
|
427
|
-
renderOptions,
|
|
428
|
-
value,
|
|
429
|
-
search,
|
|
430
|
-
allowCreate,
|
|
431
|
-
onCreateOption,
|
|
432
|
-
placeholder,
|
|
433
|
-
t
|
|
283
|
+
const filteredOptions = React.useMemo(
|
|
284
|
+
() => !search ? options : filterComboboxOptions(options, search),
|
|
285
|
+
[options, search]
|
|
434
286
|
);
|
|
287
|
+
const selectedOption = React.useMemo(
|
|
288
|
+
() => getSelectedOption(options, value),
|
|
289
|
+
[options, value]
|
|
290
|
+
);
|
|
291
|
+
const selectedLabel = selectedOption?.label || placeholder || t("multiSelect.placeholder");
|
|
292
|
+
const selectedPrefix = selectedOption?.prefix;
|
|
435
293
|
const handleClose = React.useCallback(() => {
|
|
436
294
|
setOpen(false);
|
|
437
295
|
}, []);
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
if (
|
|
296
|
+
React.useEffect(() => {
|
|
297
|
+
if (!open) return;
|
|
298
|
+
if (!value) return;
|
|
299
|
+
requestAnimationFrame(() => {
|
|
300
|
+
const el = commandListRef.current?.querySelector(
|
|
301
|
+
`[data-combobox-value="${value}"]`
|
|
302
|
+
);
|
|
303
|
+
if (el) {
|
|
304
|
+
el.scrollIntoView({ block: "nearest" });
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
}, [open, value]);
|
|
308
|
+
React.useEffect(() => {
|
|
309
|
+
if (!open) {
|
|
441
310
|
setSearch("");
|
|
442
311
|
}
|
|
443
|
-
}, []);
|
|
444
|
-
|
|
445
|
-
return /* @__PURE__ */ React.createElement(Popover, { open, onOpenChange: handleOpenChange }, /* @__PURE__ */ React.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
312
|
+
}, [open]);
|
|
313
|
+
return /* @__PURE__ */ React.createElement(Popover, { open, onOpenChange: setOpen }, /* @__PURE__ */ React.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
446
314
|
ComboboxTriggerButton,
|
|
447
315
|
{
|
|
448
316
|
open,
|
|
@@ -486,19 +354,15 @@ function Combobox({
|
|
|
486
354
|
contentClassName
|
|
487
355
|
)
|
|
488
356
|
},
|
|
489
|
-
/* @__PURE__ */ React.createElement(CommandList, { className: "overflow-visible" }, /* @__PURE__ */ React.createElement(
|
|
490
|
-
|
|
357
|
+
/* @__PURE__ */ React.createElement(CommandList, { className: "overflow-visible" }, /* @__PURE__ */ React.createElement(CommandEmpty, null, notFoundContent || t("multiSelect.empty")), /* @__PURE__ */ React.createElement(
|
|
358
|
+
ComboboxOptionsList,
|
|
491
359
|
{
|
|
492
|
-
|
|
493
|
-
search,
|
|
494
|
-
onCreateOption,
|
|
495
|
-
onClose: handleClose,
|
|
496
|
-
size,
|
|
497
|
-
notFoundContent,
|
|
498
|
-
filteredOptions,
|
|
360
|
+
items: filteredOptions,
|
|
499
361
|
value,
|
|
500
362
|
onChange,
|
|
501
|
-
|
|
363
|
+
onClose: handleClose,
|
|
364
|
+
itemsClassName,
|
|
365
|
+
size
|
|
502
366
|
}
|
|
503
367
|
))
|
|
504
368
|
))
|
|
@@ -107,7 +107,7 @@ function DataTable({
|
|
|
107
107
|
});
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
}, [isLoading
|
|
110
|
+
}, [isLoading]);
|
|
111
111
|
const throttle = React.useCallback(
|
|
112
112
|
(func, delay) => {
|
|
113
113
|
let timeoutId = null;
|
|
@@ -194,7 +194,7 @@ function DataTable({
|
|
|
194
194
|
style: { maxHeight: styleDataTableContainer.height }
|
|
195
195
|
},
|
|
196
196
|
renderTable()
|
|
197
|
-
), /* @__PURE__ */ React.createElement(ScrollBar, { orientation: "horizontal" })
|
|
197
|
+
), /* @__PURE__ */ React.createElement(ScrollBar, { orientation: "horizontal" }))
|
|
198
198
|
), hasPagination());
|
|
199
199
|
}
|
|
200
200
|
const MemoizedDataTable = React.memo(DataTable);
|
|
@@ -122,7 +122,7 @@ function buildColumns({
|
|
|
122
122
|
variant: size === "small" ? "body-medium-500" : "body-large-500",
|
|
123
123
|
textColor: "text-grey-950",
|
|
124
124
|
className: "whitespace-normal break-words max-sm:truncate",
|
|
125
|
-
title: externalColumn.
|
|
125
|
+
title: externalColumn.title
|
|
126
126
|
},
|
|
127
127
|
externalColumn.title
|
|
128
128
|
) : title, hasSort && renderSortArrow({ column, externalColumn, table }));
|
|
@@ -71,7 +71,7 @@ function Table({
|
|
|
71
71
|
"tr",
|
|
72
72
|
{
|
|
73
73
|
"data-state": onIsSelected?.(row) ? "selected" : "",
|
|
74
|
-
className: "[&_td]:hover
|
|
74
|
+
className: "[&_td]:hover:bg-grey-100 [&_td]:data-[state=selected]:bg-grey-100"
|
|
75
75
|
},
|
|
76
76
|
row.getVisibleCells().map((cell) => /* @__PURE__ */ React.createElement(
|
|
77
77
|
"td",
|
|
@@ -9,7 +9,6 @@ const SearchInput = ({
|
|
|
9
9
|
customStyles,
|
|
10
10
|
placeholder,
|
|
11
11
|
isActiveButton,
|
|
12
|
-
value,
|
|
13
12
|
onChangeValue,
|
|
14
13
|
onClickButton
|
|
15
14
|
}) => {
|
|
@@ -45,11 +44,9 @@ const SearchInput = ({
|
|
|
45
44
|
{
|
|
46
45
|
id: "header-search-input-lecom-ui",
|
|
47
46
|
placeholder,
|
|
48
|
-
size: "small",
|
|
49
47
|
radius: "full",
|
|
50
|
-
value,
|
|
51
48
|
prefixInset: /* @__PURE__ */ React.createElement(Search, { size: 20, color: mappedCustomStyles.color }),
|
|
52
|
-
className: "body-small-400 border-none
|
|
49
|
+
className: "body-small-400 border-none",
|
|
53
50
|
containerClassName: "grow",
|
|
54
51
|
onMouseOver: handleOver,
|
|
55
52
|
onMouseOut: handleOut,
|
|
@@ -3,7 +3,7 @@ import { cn } from '../../lib/utils.js';
|
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
const inputVariants = cva(
|
|
6
|
-
`flex w-full rounded-sm border border-grey-400 bg-background px-3 py-2
|
|
6
|
+
`flex h-8 w-full rounded-sm border border-grey-400 bg-background px-3 py-2
|
|
7
7
|
placeholder:text-grey-500 outline-none
|
|
8
8
|
hover:border-grey-500 focus:bg-background focus:border-grey-400 focus:ring-grey-600 focus:ring-opacity-15 focus:ring-4
|
|
9
9
|
disabled:cursor-not-allowed disabled:bg-grey-100 disabled:border-grey-400
|
|
@@ -16,7 +16,7 @@ const inputVariants = cva(
|
|
|
16
16
|
borderless: "border-none bg-transparent focus:bg-transparent focus:ring-0"
|
|
17
17
|
},
|
|
18
18
|
size: {
|
|
19
|
-
small: "h-8 body-small-400 px-
|
|
19
|
+
small: "h-8 body-small-400 px-3 py-0 placeholder:body-small-400",
|
|
20
20
|
default: "h-10 body-medium-400 px-3 py-2 placeholder:body-medium-400",
|
|
21
21
|
large: "h-12 body-large-400 px-3 py-2 placeholder:body-large-400"
|
|
22
22
|
},
|
|
@@ -15,9 +15,6 @@ import { Typography } from '../Typography/Typography.js';
|
|
|
15
15
|
|
|
16
16
|
initializeI18n();
|
|
17
17
|
const Layout = ({ children, header, sideBar }) => {
|
|
18
|
-
if (!sideBar) {
|
|
19
|
-
return /* @__PURE__ */ React.createElement("div", { className: "flex flex-col h-screen" }, /* @__PURE__ */ React.createElement(Header, { ...header }), /* @__PURE__ */ React.createElement("main", { className: "grow w-full" }, children));
|
|
20
|
-
}
|
|
21
18
|
const { items, info, collapsible = "icon" } = sideBar;
|
|
22
19
|
const sidebarState = getCookie("sidebar:state") === "true";
|
|
23
20
|
return /* @__PURE__ */ React.createElement(SidebarProvider, { className: "flex-col", defaultOpen: sidebarState }, /* @__PURE__ */ React.createElement(Header, { ...header }), /* @__PURE__ */ React.createElement("div", { className: "flex grow" }, /* @__PURE__ */ React.createElement(Sidebar, { collapsible, variant: "sidebar" }, /* @__PURE__ */ React.createElement(SidebarContent, null, /* @__PURE__ */ React.createElement(SidebarGroup, null, /* @__PURE__ */ React.createElement(SidebarGroupContent, null, /* @__PURE__ */ React.createElement(SidebarMenu, null, items.map((item) => /* @__PURE__ */ React.createElement(SidebarMenuItem, { key: item.title }, /* @__PURE__ */ React.createElement(
|