lecom-ui 5.4.32 → 5.4.34
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/dist/components/Combobox/Combobox.js +178 -42
- package/dist/components/CustomTagInput/CustomTagInput.js +27 -18
- 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 +4 -1
- package/dist/components/Input/Input.js +2 -2
- package/dist/components/Layout/Layout.js +3 -0
- package/dist/components/MultiSelect/MultiSelect.js +282 -165
- package/dist/components/Pagination/Pagination.js +20 -5
- package/dist/components/ScrollArea/ScrollArea.js +1 -1
- package/dist/components/TagInput/TagInput.js +44 -17
- package/dist/i18n/locales/en_us.js +4 -2
- package/dist/i18n/locales/es_es.js +4 -2
- package/dist/i18n/locales/pt_br.js +4 -2
- package/dist/index.d.ts +21 -11
- package/dist/style.min.css +1 -1
- package/package.json +1 -1
|
@@ -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 } from 'lucide-react';
|
|
4
|
+
import { ChevronUpIcon, ChevronDownIcon, Check, Plus } 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" }, option.value === value && /* @__PURE__ */ React.createElement(
|
|
118
|
+
/* @__PURE__ */ React.createElement(Typography, { className: "w-4 h-4 flex items-center justify-center shrink-0" }, option.value === value && /* @__PURE__ */ React.createElement(
|
|
119
119
|
Check,
|
|
120
120
|
{
|
|
121
121
|
className: cn(textColor, isSelected ? "text-primary-600" : ""),
|
|
@@ -123,18 +123,64 @@ const ComboboxItemContent = ({
|
|
|
123
123
|
strokeWidth: isSelected ? 2.5 : 2
|
|
124
124
|
}
|
|
125
125
|
)),
|
|
126
|
-
option.prefix && /* @__PURE__ */ React.createElement(
|
|
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
|
+
),
|
|
127
136
|
/* @__PURE__ */ React.createElement(
|
|
128
137
|
Typography,
|
|
129
138
|
{
|
|
130
139
|
variant: fontVariant,
|
|
131
|
-
className: cn(
|
|
140
|
+
className: cn(
|
|
141
|
+
textColor,
|
|
142
|
+
"whitespace-normal flex items-center justify-center break-words"
|
|
143
|
+
)
|
|
132
144
|
},
|
|
133
145
|
option.label
|
|
134
146
|
)
|
|
135
147
|
);
|
|
136
148
|
};
|
|
137
149
|
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";
|
|
138
184
|
const ComboboxOptionsList = React.memo(
|
|
139
185
|
({ items, value, onChange, onClose, itemsClassName, size }) => /* @__PURE__ */ React.createElement(React.Fragment, null, items.map(
|
|
140
186
|
(item, idx) => isComboboxGroup(item) ? /* @__PURE__ */ React.createElement(
|
|
@@ -171,6 +217,83 @@ const ComboboxOptionsList = React.memo(
|
|
|
171
217
|
))
|
|
172
218
|
);
|
|
173
219
|
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
|
+
};
|
|
174
297
|
const comboboxTriggerVariants = cva(
|
|
175
298
|
"w-full px-4 text-left shadow-sm flex items-center justify-between transition",
|
|
176
299
|
{
|
|
@@ -241,14 +364,24 @@ const ComboboxTriggerButton = React.forwardRef(
|
|
|
241
364
|
disabled: disabled ?? false,
|
|
242
365
|
...props
|
|
243
366
|
},
|
|
244
|
-
/* @__PURE__ */ React.createElement(
|
|
245
|
-
|
|
367
|
+
/* @__PURE__ */ React.createElement(
|
|
368
|
+
"div",
|
|
246
369
|
{
|
|
247
|
-
className: cn(
|
|
248
|
-
|
|
370
|
+
className: cn(
|
|
371
|
+
"flex items-center gap-2 truncate min-w-[calc(100%-2.25rem)]",
|
|
372
|
+
selectedPrefix && "min-w-[calc(100%-4.75rem)]"
|
|
373
|
+
)
|
|
249
374
|
},
|
|
250
|
-
|
|
251
|
-
|
|
375
|
+
selectedPrefix && /* @__PURE__ */ React.createElement(Typography, { className: "flex items-center shrink-0" }, selectedPrefix),
|
|
376
|
+
/* @__PURE__ */ React.createElement(
|
|
377
|
+
Typography,
|
|
378
|
+
{
|
|
379
|
+
className: cn("truncate", colorClass),
|
|
380
|
+
variant: fontVariant
|
|
381
|
+
},
|
|
382
|
+
selectedLabel
|
|
383
|
+
)
|
|
384
|
+
),
|
|
252
385
|
/* @__PURE__ */ React.createElement("div", { className: "w-5" }, /* @__PURE__ */ React.createElement(
|
|
253
386
|
ChevronIcon,
|
|
254
387
|
{
|
|
@@ -274,43 +407,42 @@ function Combobox({
|
|
|
274
407
|
itemsClassName,
|
|
275
408
|
rounded = "default",
|
|
276
409
|
showSearch = true,
|
|
277
|
-
size = "medium"
|
|
410
|
+
size = "medium",
|
|
411
|
+
allowCreate = false,
|
|
412
|
+
onCreateOption
|
|
278
413
|
}) {
|
|
279
414
|
const { t } = useTranslation();
|
|
280
415
|
const [open, setOpen] = React.useState(false);
|
|
281
416
|
const [search, setSearch] = React.useState("");
|
|
282
417
|
const commandListRef = React.useRef(null);
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
418
|
+
const lastOpenOptionsRef = React.useRef(options);
|
|
419
|
+
React.useEffect(() => {
|
|
420
|
+
if (open) {
|
|
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
|
|
290
434
|
);
|
|
291
|
-
const selectedLabel = selectedOption?.label || placeholder || t("multiSelect.placeholder");
|
|
292
|
-
const selectedPrefix = selectedOption?.prefix;
|
|
293
435
|
const handleClose = React.useCallback(() => {
|
|
294
436
|
setOpen(false);
|
|
295
437
|
}, []);
|
|
296
|
-
React.
|
|
297
|
-
|
|
298
|
-
if (
|
|
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) {
|
|
438
|
+
const handleOpenChange = React.useCallback((nextOpen) => {
|
|
439
|
+
setOpen(nextOpen);
|
|
440
|
+
if (nextOpen) {
|
|
310
441
|
setSearch("");
|
|
311
442
|
}
|
|
312
|
-
}, [
|
|
313
|
-
|
|
443
|
+
}, []);
|
|
444
|
+
useComboboxScrollToSelected(open, value, commandListRef);
|
|
445
|
+
return /* @__PURE__ */ React.createElement(Popover, { open, onOpenChange: handleOpenChange }, /* @__PURE__ */ React.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
314
446
|
ComboboxTriggerButton,
|
|
315
447
|
{
|
|
316
448
|
open,
|
|
@@ -354,15 +486,19 @@ function Combobox({
|
|
|
354
486
|
contentClassName
|
|
355
487
|
)
|
|
356
488
|
},
|
|
357
|
-
/* @__PURE__ */ React.createElement(CommandList, { className: "overflow-visible" }, /* @__PURE__ */ React.createElement(
|
|
358
|
-
|
|
489
|
+
/* @__PURE__ */ React.createElement(CommandList, { className: "overflow-visible" }, /* @__PURE__ */ React.createElement(
|
|
490
|
+
ComboboxContent,
|
|
359
491
|
{
|
|
360
|
-
|
|
492
|
+
showCreateOption,
|
|
493
|
+
search,
|
|
494
|
+
onCreateOption,
|
|
495
|
+
onClose: handleClose,
|
|
496
|
+
size,
|
|
497
|
+
notFoundContent,
|
|
498
|
+
filteredOptions,
|
|
361
499
|
value,
|
|
362
500
|
onChange,
|
|
363
|
-
|
|
364
|
-
itemsClassName,
|
|
365
|
-
size
|
|
501
|
+
itemsClassName
|
|
366
502
|
}
|
|
367
503
|
))
|
|
368
504
|
))
|
|
@@ -18,11 +18,13 @@ const CustomTagItemComponent = React.memo(function CustomTagItemComponent2({
|
|
|
18
18
|
onDragEnd,
|
|
19
19
|
isDragging,
|
|
20
20
|
onMouseDown,
|
|
21
|
-
isAllSelected = false
|
|
21
|
+
isAllSelected = false,
|
|
22
|
+
defaultColor
|
|
22
23
|
}) {
|
|
23
24
|
const [isEditing, setIsEditing] = React.useState(false);
|
|
24
25
|
const [editValue, setEditValue] = React.useState(item.label);
|
|
25
26
|
const inputRef = React.useRef(null);
|
|
27
|
+
const tagColor = item.color || defaultColor;
|
|
26
28
|
React.useEffect(() => {
|
|
27
29
|
if (isEditing && inputRef.current) {
|
|
28
30
|
inputRef.current.focus();
|
|
@@ -80,7 +82,7 @@ const CustomTagItemComponent = React.memo(function CustomTagItemComponent2({
|
|
|
80
82
|
[index, onDragOver]
|
|
81
83
|
);
|
|
82
84
|
if (isEditing) {
|
|
83
|
-
return /* @__PURE__ */ React.createElement(Tag, { "data-tag": "true", color:
|
|
85
|
+
return /* @__PURE__ */ React.createElement(Tag, { "data-tag": "true", color: tagColor, className: "px-2 py-0 max-w-[15.625rem]" }, /* @__PURE__ */ React.createElement(
|
|
84
86
|
"input",
|
|
85
87
|
{
|
|
86
88
|
ref: inputRef,
|
|
@@ -89,7 +91,7 @@ const CustomTagItemComponent = React.memo(function CustomTagItemComponent2({
|
|
|
89
91
|
onChange: (e) => setEditValue(e.target.value),
|
|
90
92
|
onKeyDown: handleKeyDown,
|
|
91
93
|
onBlur: handleBlur,
|
|
92
|
-
className: "bg-transparent border-none outline-none
|
|
94
|
+
className: "bg-transparent border-none outline-none [color:inherit] body-small-400 min-w-[60px] w-full",
|
|
93
95
|
onClick: (e) => e.stopPropagation(),
|
|
94
96
|
style: { width: `${Math.min(Math.max(editValue.length * 8, 60), 250)}px` }
|
|
95
97
|
}
|
|
@@ -99,7 +101,7 @@ const CustomTagItemComponent = React.memo(function CustomTagItemComponent2({
|
|
|
99
101
|
Tag,
|
|
100
102
|
{
|
|
101
103
|
"data-tag": "true",
|
|
102
|
-
color:
|
|
104
|
+
color: tagColor,
|
|
103
105
|
className: cn(
|
|
104
106
|
"cursor-pointer group max-w-[15.625rem]",
|
|
105
107
|
isDragging && "opacity-30 scale-95 transition-all",
|
|
@@ -117,7 +119,7 @@ const CustomTagItemComponent = React.memo(function CustomTagItemComponent2({
|
|
|
117
119
|
GripVertical,
|
|
118
120
|
{
|
|
119
121
|
className: cn(
|
|
120
|
-
"w-4 h-4 opacity-100 transition-all cursor-grab flex-shrink-0 stroke-
|
|
122
|
+
"w-4 h-4 opacity-100 transition-all cursor-grab flex-shrink-0 stroke-current fill-none hover:opacity-80 hover:scale-110",
|
|
121
123
|
isAllSelected && "!stroke-grey-400"
|
|
122
124
|
),
|
|
123
125
|
onMouseDown: (e) => e.stopPropagation(),
|
|
@@ -128,8 +130,7 @@ const CustomTagItemComponent = React.memo(function CustomTagItemComponent2({
|
|
|
128
130
|
Typography,
|
|
129
131
|
{
|
|
130
132
|
variant: "body-small-400",
|
|
131
|
-
className: "truncate flex-1 min-w-0",
|
|
132
|
-
textColor: "text-blue-700",
|
|
133
|
+
className: "truncate flex-1 min-w-0 [color:inherit]",
|
|
133
134
|
onClick: handleClick
|
|
134
135
|
},
|
|
135
136
|
item.label
|
|
@@ -138,7 +139,7 @@ const CustomTagItemComponent = React.memo(function CustomTagItemComponent2({
|
|
|
138
139
|
X,
|
|
139
140
|
{
|
|
140
141
|
className: cn(
|
|
141
|
-
"w-4 h-4 cursor-pointer flex-shrink-0 stroke-
|
|
142
|
+
"w-4 h-4 cursor-pointer flex-shrink-0 stroke-current stroke-2 outline-none hover:opacity-80 hover:scale-110 transition-all",
|
|
142
143
|
isAllSelected && "!stroke-grey-400"
|
|
143
144
|
),
|
|
144
145
|
onClick: handleRemove,
|
|
@@ -167,7 +168,8 @@ const TagItemWrapper = React.memo(function TagItemWrapper2({
|
|
|
167
168
|
onInlineCancel,
|
|
168
169
|
onSpacerClick,
|
|
169
170
|
onMouseDown,
|
|
170
|
-
isAllSelected = false
|
|
171
|
+
isAllSelected = false,
|
|
172
|
+
defaultColor
|
|
171
173
|
}) {
|
|
172
174
|
const showInlineInput = insertAtIndex === index;
|
|
173
175
|
const showDragIndicator = dragOverIndex === index && draggedIndex !== null && draggedIndex !== index;
|
|
@@ -177,7 +179,8 @@ const TagItemWrapper = React.memo(function TagItemWrapper2({
|
|
|
177
179
|
{
|
|
178
180
|
onAdd: onInlineAdd,
|
|
179
181
|
onCancel: onInlineCancel,
|
|
180
|
-
placeholder: inlinePlaceholder
|
|
182
|
+
placeholder: inlinePlaceholder,
|
|
183
|
+
color: defaultColor
|
|
181
184
|
}
|
|
182
185
|
), /* @__PURE__ */ React.createElement("div", { className: "flex items-start gap-0.5 relative" }, /* @__PURE__ */ React.createElement(
|
|
183
186
|
CustomTagItemComponent,
|
|
@@ -194,7 +197,8 @@ const TagItemWrapper = React.memo(function TagItemWrapper2({
|
|
|
194
197
|
onDragEnd,
|
|
195
198
|
isDragging: draggedIndex === index,
|
|
196
199
|
onMouseDown,
|
|
197
|
-
isAllSelected
|
|
200
|
+
isAllSelected,
|
|
201
|
+
defaultColor
|
|
198
202
|
}
|
|
199
203
|
), showDragIndicator && /* @__PURE__ */ React.createElement("div", { className: "w-1 h-6 bg-blue-500 rounded-full animate-pulse self-center" }), showSpacer && /* @__PURE__ */ React.createElement(
|
|
200
204
|
"div",
|
|
@@ -208,7 +212,7 @@ const TagItemWrapper = React.memo(function TagItemWrapper2({
|
|
|
208
212
|
}
|
|
209
213
|
)));
|
|
210
214
|
});
|
|
211
|
-
const InlineInput = React.memo(function InlineInput2({ onAdd, onCancel, placeholder }) {
|
|
215
|
+
const InlineInput = React.memo(function InlineInput2({ onAdd, onCancel, placeholder, color }) {
|
|
212
216
|
const [value, setValue] = React.useState("");
|
|
213
217
|
const inputRef = React.useRef(null);
|
|
214
218
|
React.useEffect(() => {
|
|
@@ -237,7 +241,7 @@ const InlineInput = React.memo(function InlineInput2({ onAdd, onCancel, placehol
|
|
|
237
241
|
onCancel();
|
|
238
242
|
}
|
|
239
243
|
}, [value, onAdd, onCancel]);
|
|
240
|
-
return /* @__PURE__ */ React.createElement(Tag, { "data-tag": "true", color
|
|
244
|
+
return /* @__PURE__ */ React.createElement(Tag, { "data-tag": "true", color, className: "px-2 py-0 max-w-[15.625rem]", "data-inline-input": "true" }, /* @__PURE__ */ React.createElement(
|
|
241
245
|
"input",
|
|
242
246
|
{
|
|
243
247
|
ref: inputRef,
|
|
@@ -247,7 +251,7 @@ const InlineInput = React.memo(function InlineInput2({ onAdd, onCancel, placehol
|
|
|
247
251
|
onKeyDown: handleKeyDown,
|
|
248
252
|
onBlur: handleBlur,
|
|
249
253
|
placeholder,
|
|
250
|
-
className: "bg-transparent border-none outline-none
|
|
254
|
+
className: "bg-transparent border-none outline-none [color:inherit] body-small-400 min-w-[3.75rem] w-full px-1",
|
|
251
255
|
onClick: (e) => e.stopPropagation(),
|
|
252
256
|
style: { width: `${Math.min(Math.max(value.length * 8, 60), 250)}px` }
|
|
253
257
|
}
|
|
@@ -680,7 +684,8 @@ function CustomTagInputRenderer({
|
|
|
680
684
|
setInputValue,
|
|
681
685
|
handleMouseDown,
|
|
682
686
|
isAllSelected,
|
|
683
|
-
setIsAllSelected
|
|
687
|
+
setIsAllSelected,
|
|
688
|
+
defaultColor
|
|
684
689
|
}) {
|
|
685
690
|
const showFinalInlineInput = insertAtIndex === value.length;
|
|
686
691
|
const inputPlaceholder = value.length === 0 ? placeholder : "";
|
|
@@ -706,14 +711,16 @@ function CustomTagInputRenderer({
|
|
|
706
711
|
onInlineCancel: handleInlineCancel,
|
|
707
712
|
onSpacerClick: handleSpacerClick,
|
|
708
713
|
onMouseDown: handleMouseDown,
|
|
709
|
-
isAllSelected
|
|
714
|
+
isAllSelected,
|
|
715
|
+
defaultColor
|
|
710
716
|
}
|
|
711
717
|
)), showFinalInlineInput && /* @__PURE__ */ React.createElement(
|
|
712
718
|
InlineInput,
|
|
713
719
|
{
|
|
714
720
|
onAdd: handleInlineAdd,
|
|
715
721
|
onCancel: handleInlineCancel,
|
|
716
|
-
placeholder: inlinePlaceholder
|
|
722
|
+
placeholder: inlinePlaceholder,
|
|
723
|
+
color: defaultColor
|
|
717
724
|
}
|
|
718
725
|
), !readOnly && /* @__PURE__ */ React.createElement(
|
|
719
726
|
"span",
|
|
@@ -749,6 +756,7 @@ function CustomTagInput(props) {
|
|
|
749
756
|
allowDuplicates = false,
|
|
750
757
|
enableReorder = true,
|
|
751
758
|
onTagEdit,
|
|
759
|
+
color = "blue",
|
|
752
760
|
...restProps
|
|
753
761
|
} = props;
|
|
754
762
|
const [inputValue, setInputValue] = React.useState("");
|
|
@@ -849,7 +857,8 @@ function CustomTagInput(props) {
|
|
|
849
857
|
setInputValue,
|
|
850
858
|
handleMouseDown,
|
|
851
859
|
isAllSelected,
|
|
852
|
-
setIsAllSelected
|
|
860
|
+
setIsAllSelected,
|
|
861
|
+
defaultColor: color
|
|
853
862
|
}
|
|
854
863
|
)
|
|
855
864
|
)
|
|
@@ -107,7 +107,7 @@ function DataTable({
|
|
|
107
107
|
});
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
}, [isLoading]);
|
|
110
|
+
}, [isLoading, sorting]);
|
|
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" }), /* @__PURE__ */ React.createElement(ScrollBar, { orientation: "vertical" }))
|
|
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.title
|
|
125
|
+
title: externalColumn.showHeaderTooltip ? externalColumn.title : void 0
|
|
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,6 +9,7 @@ const SearchInput = ({
|
|
|
9
9
|
customStyles,
|
|
10
10
|
placeholder,
|
|
11
11
|
isActiveButton,
|
|
12
|
+
value,
|
|
12
13
|
onChangeValue,
|
|
13
14
|
onClickButton
|
|
14
15
|
}) => {
|
|
@@ -44,9 +45,11 @@ const SearchInput = ({
|
|
|
44
45
|
{
|
|
45
46
|
id: "header-search-input-lecom-ui",
|
|
46
47
|
placeholder,
|
|
48
|
+
size: "small",
|
|
47
49
|
radius: "full",
|
|
50
|
+
value,
|
|
48
51
|
prefixInset: /* @__PURE__ */ React.createElement(Search, { size: 20, color: mappedCustomStyles.color }),
|
|
49
|
-
className: "body-small-400 border-none",
|
|
52
|
+
className: "body-small-400 border-none h-8",
|
|
50
53
|
containerClassName: "grow",
|
|
51
54
|
onMouseOver: handleOver,
|
|
52
55
|
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
|
|
6
|
+
`flex 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-4 py-1 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,6 +15,9 @@ 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
|
+
}
|
|
18
21
|
const { items, info, collapsible = "icon" } = sideBar;
|
|
19
22
|
const sidebarState = getCookie("sidebar:state") === "true";
|
|
20
23
|
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(
|