lecom-ui 5.4.32 → 5.4.33

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.
@@ -5,7 +5,7 @@ import { Tag } from '../Tag/Tag.js';
5
5
  import { textareaVariants } from '../Textarea/Textarea.js';
6
6
  import { Typography } from '../Typography/Typography.js';
7
7
 
8
- function TagItem({ item, onRemove, readOnly }) {
8
+ function TagItem({ item, onRemove, readOnly, defaultColor }) {
9
9
  const handleRemove = React.useCallback(
10
10
  (e) => {
11
11
  e.stopPropagation();
@@ -13,18 +13,35 @@ function TagItem({ item, onRemove, readOnly }) {
13
13
  },
14
14
  [item.value, onRemove]
15
15
  );
16
- return /* @__PURE__ */ React.createElement(Tag, { "data-tag": "true", color: "blue", className: "max-w-[15.625rem] h-6 !px-2 !py-0.5" }, /* @__PURE__ */ React.createElement(Typography, { variant: "body-small-400", className: "text-blue-600 truncate p-0" }, item.label), !readOnly && /* @__PURE__ */ React.createElement(
17
- X,
16
+ const tagColor = item.color || defaultColor;
17
+ return /* @__PURE__ */ React.createElement(
18
+ Tag,
18
19
  {
19
- className: "w-4 h-4 cursor-pointer flex-shrink-0",
20
- onClick: handleRemove,
21
- "aria-label": `Remover ${item.label}`,
22
- tabIndex: 0
23
- }
24
- ));
20
+ "data-tag": "true",
21
+ color: tagColor,
22
+ className: "max-w-[15.625rem] h-6 !px-2 !py-0.5"
23
+ },
24
+ /* @__PURE__ */ React.createElement(
25
+ Typography,
26
+ {
27
+ variant: "body-small-400",
28
+ className: "truncate p-0 [color:inherit]"
29
+ },
30
+ item.label
31
+ ),
32
+ !readOnly && /* @__PURE__ */ React.createElement(
33
+ X,
34
+ {
35
+ className: "w-4 h-4 cursor-pointer flex-shrink-0",
36
+ onClick: handleRemove,
37
+ "aria-label": `Remover ${item.label}`,
38
+ tabIndex: 0
39
+ }
40
+ )
41
+ );
25
42
  }
26
- function HiddenCountTag({ count }) {
27
- return /* @__PURE__ */ React.createElement(Tag, { color: "blue", "data-tag": "true" }, /* @__PURE__ */ React.createElement(Typography, { variant: "body-small-400", className: "text-blue-600" }, "+", count));
43
+ function HiddenCountTag({ count, color }) {
44
+ return /* @__PURE__ */ React.createElement(Tag, { color, "data-tag": "true" }, /* @__PURE__ */ React.createElement(Typography, { variant: "body-small-400", className: "[color:inherit]" }, "+", count));
28
45
  }
29
46
  function calculateEstimatedWidths(value) {
30
47
  const AVG_CHAR_WIDTH = 8;
@@ -69,7 +86,8 @@ function useDynamicMaxCount(ref, value, maxDisplayCount) {
69
86
  const [maxLines, setMaxLines] = React.useState(null);
70
87
  const hasCalculatedMaxLines = React.useRef(false);
71
88
  React.useEffect(() => {
72
- if (hasCalculatedMaxLines.current || !ref.current || value.length === 0) return;
89
+ if (hasCalculatedMaxLines.current || !ref.current || value.length === 0)
90
+ return;
73
91
  const calculateMaxLines = () => {
74
92
  if (!ref.current) {
75
93
  setTimeout(calculateMaxLines, 10);
@@ -83,7 +101,10 @@ function useDynamicMaxCount(ref, value, maxDisplayCount) {
83
101
  const TAG_HEIGHT = 24;
84
102
  const CONTAINER_PADDING_VERTICAL = 4;
85
103
  const availableHeight = containerHeight - CONTAINER_PADDING_VERTICAL * 2;
86
- const calculatedMaxLines = Math.max(1, Math.floor(availableHeight / TAG_HEIGHT));
104
+ const calculatedMaxLines = Math.max(
105
+ 1,
106
+ Math.floor(availableHeight / TAG_HEIGHT)
107
+ );
87
108
  setMaxLines(calculatedMaxLines);
88
109
  hasCalculatedMaxLines.current = true;
89
110
  };
@@ -126,7 +147,11 @@ function useDynamicMaxCount(ref, value, maxDisplayCount) {
126
147
  setDynamicMaxCount(value.length);
127
148
  return;
128
149
  }
129
- const count = simulateTagLayout(estimatedWidths, availableWidth, maxLines);
150
+ const count = simulateTagLayout(
151
+ estimatedWidths,
152
+ availableWidth,
153
+ maxLines
154
+ );
130
155
  setDynamicMaxCount(count);
131
156
  };
132
157
  const rafId = requestAnimationFrame(() => {
@@ -156,6 +181,7 @@ function TagInput(props) {
156
181
  className = "",
157
182
  variant = "default",
158
183
  radius = "default",
184
+ color = "blue",
159
185
  ...restProps
160
186
  } = props;
161
187
  const ref = React.useRef(null);
@@ -192,17 +218,18 @@ function TagInput(props) {
192
218
  style: containerStyles,
193
219
  ...restProps
194
220
  },
195
- value.length === 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "body-small-400", className: "text-grey-400" }, placeholder),
221
+ value.length === 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "body-small-400", className: "text-grey-500" }, placeholder),
196
222
  displayTags.map((item) => /* @__PURE__ */ React.createElement(
197
223
  TagItem,
198
224
  {
199
225
  key: item.value,
200
226
  item,
201
227
  onRemove: handleRemove,
202
- readOnly
228
+ readOnly,
229
+ defaultColor: color
203
230
  }
204
231
  )),
205
- actualHiddenCount > 0 && /* @__PURE__ */ React.createElement(HiddenCountTag, { count: actualHiddenCount })
232
+ actualHiddenCount > 0 && /* @__PURE__ */ React.createElement(HiddenCountTag, { count: actualHiddenCount, color })
206
233
  );
207
234
  }
208
235
 
@@ -9,7 +9,8 @@ const language = {
9
9
  },
10
10
  pagination: {
11
11
  show: "Show:",
12
- selectedProcess: "selected process"
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.",
@@ -20,7 +21,8 @@ const language = {
20
21
  search: "Type to search",
21
22
  empty: "No results found",
22
23
  selectAll: "Select all",
23
- placeholder: "Select"
24
+ placeholder: "Select",
25
+ create: "Create"
24
26
  }
25
27
  }
26
28
  };
@@ -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.",
@@ -20,7 +21,8 @@ const language = {
20
21
  search: "Tipo a buscar",
21
22
  empty: "No se han encontrado resultados",
22
23
  selectAll: "Seleccionar todo",
23
- placeholder: "Seleccionar"
24
+ placeholder: "Seleccionar",
25
+ create: "Crear"
24
26
  }
25
27
  }
26
28
  };
@@ -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.",
@@ -20,7 +21,8 @@ const language = {
20
21
  search: "Digite para pesquisar",
21
22
  empty: "Nenhum resultado encontrado",
22
23
  selectAll: "Selecionar tudo",
23
- placeholder: "Selecione"
24
+ placeholder: "Selecione",
25
+ create: "Criar"
24
26
  }
25
27
  }
26
28
  };
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
 
@@ -384,6 +385,7 @@ interface Column<TData, TValue> {
384
385
  headerClassName?: string;
385
386
  headerStyle?: React.CSSProperties;
386
387
  cellClassName?: string;
388
+ showHeaderTooltip?: boolean;
387
389
  customHeaderRender?: ({ table, column, }: ColumnSort<TData, TValue>) => React.ReactNode;
388
390
  render?: (({ value, row }: ColumnRender<TData, TValue>) => React.ReactNode) | React.ReactNode;
389
391
  onSort?: ({ table, column }: ColumnSort<TData, TValue>) => 'asc' | 'desc' | null | void;
@@ -726,6 +728,7 @@ interface SearchInputProps {
726
728
  customStyles: CustomStyles$2;
727
729
  placeholder?: string;
728
730
  isActiveButton?: boolean;
731
+ value?: string;
729
732
  onChangeValue?: (value: string) => void;
730
733
  onClickButton?: () => void;
731
734
  }
@@ -783,9 +786,9 @@ interface HeaderProps extends React$1.HTMLAttributes<HTMLElement>, VariantProps<
783
786
  }
784
787
 
785
788
  declare const inputVariants: (props?: ({
786
- variant?: "default" | "filled" | "borderless" | null | undefined;
787
- size?: "default" | "small" | "large" | null | undefined;
788
- radius?: "default" | "small" | "large" | "full" | null | undefined;
789
+ variant?: "filled" | "default" | "borderless" | null | undefined;
790
+ size?: "small" | "large" | "default" | null | undefined;
791
+ radius?: "small" | "large" | "default" | "full" | null | undefined;
789
792
  } & class_variance_authority_types.ClassProp) | undefined) => string;
790
793
  interface InputProps extends Omit<React$1.InputHTMLAttributes<HTMLInputElement>, 'size' | 'sufix' | 'prefix'>, VariantProps<typeof inputVariants> {
791
794
  sufix?: React$1.ReactNode;
@@ -819,7 +822,7 @@ interface SideBarProps {
819
822
  }
820
823
  interface LayoutProps extends React$1.HTMLAttributes<HTMLDivElement> {
821
824
  header: HeaderProps;
822
- sideBar: SideBarProps;
825
+ sideBar?: SideBarProps;
823
826
  }
824
827
  declare const Layout: {
825
828
  ({ children, header, sideBar }: LayoutProps): React$1.JSX.Element;
@@ -860,6 +863,7 @@ interface MultiSelectProps extends React$1.ButtonHTMLAttributes<HTMLButtonElemen
860
863
  };
861
864
  classNameContent?: string;
862
865
  size?: MultiSelectSize;
866
+ readOnly?: boolean;
863
867
  }
864
868
  interface MultiSelectTreeOption {
865
869
  label: string;
@@ -990,7 +994,7 @@ declare const RadioGroup: React$1.ForwardRefExoticComponent<Omit<RadioGroupPrimi
990
994
  declare const RadioGroupItem: React$1.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
991
995
 
992
996
  declare const ResizablePanelGroup: ({ className, ...props }: React$1.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => React$1.JSX.Element;
993
- declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLDivElement | HTMLElement | HTMLButtonElement | HTMLOListElement | HTMLLIElement | HTMLAnchorElement | HTMLSpanElement | HTMLHeadingElement | HTMLParagraphElement | HTMLLabelElement | HTMLUListElement | HTMLInputElement | HTMLObjectElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLCanvasElement | HTMLTableCaptionElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLImageElement | HTMLLegendElement | HTMLLinkElement | HTMLMapElement | HTMLMenuElement | HTMLMetaElement | HTMLMeterElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLPictureElement | HTMLPreElement | HTMLProgressElement | HTMLScriptElement | HTMLSelectElement | HTMLSlotElement | HTMLSourceElement | HTMLStyleElement | HTMLTableElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTemplateElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTitleElement | HTMLTableRowElement | HTMLTrackElement | HTMLVideoElement>, "id" | "onResize"> & {
997
+ declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLButtonElement | HTMLElement | HTMLDivElement | HTMLHeadingElement | HTMLParagraphElement | HTMLSpanElement | HTMLOListElement | HTMLLIElement | HTMLAnchorElement | HTMLUListElement | HTMLLabelElement | HTMLInputElement | HTMLObjectElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLCanvasElement | HTMLTableCaptionElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLImageElement | HTMLLegendElement | HTMLLinkElement | HTMLMapElement | HTMLMenuElement | HTMLMetaElement | HTMLMeterElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLPictureElement | HTMLPreElement | HTMLProgressElement | HTMLScriptElement | HTMLSelectElement | HTMLSlotElement | HTMLSourceElement | HTMLStyleElement | HTMLTableElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTemplateElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTitleElement | HTMLTableRowElement | HTMLTrackElement | HTMLVideoElement>, "id" | "onResize"> & {
994
998
  className?: string;
995
999
  collapsedSize?: number | undefined;
996
1000
  collapsible?: boolean | undefined;
@@ -1156,9 +1160,9 @@ declare const TabsTrigger: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.
1156
1160
  declare const TabsContent: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
1157
1161
 
1158
1162
  declare const textareaVariants: (props?: ({
1159
- variant?: "default" | "filled" | "borderless" | null | undefined;
1160
- size?: "default" | "small" | "large" | null | undefined;
1161
- radius?: "default" | "small" | "large" | "full" | null | undefined;
1163
+ variant?: "filled" | "default" | "borderless" | null | undefined;
1164
+ size?: "small" | "large" | "default" | null | undefined;
1165
+ radius?: "small" | "large" | "default" | "full" | null | undefined;
1162
1166
  resize?: "default" | "both" | "horizontal" | "vertical" | "vertical-limited" | null | undefined;
1163
1167
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1164
1168
  interface TextareaProps extends React$1.ComponentProps<'textarea'>, VariantProps<typeof textareaVariants> {
@@ -1228,14 +1232,17 @@ type ComboboxProps = {
1228
1232
  rounded?: ComboboxRounded;
1229
1233
  showSearch?: boolean;
1230
1234
  size?: ComboboxSize;
1235
+ allowCreate?: boolean;
1236
+ onCreateOption?: (inputValue: string) => void;
1231
1237
  };
1232
- declare function Combobox({ options, value, onChange, placeholder, disabled, notFoundContent, status, searchTerm, triggerClassName, contentClassName, itemsClassName, rounded, showSearch, size, }: ComboboxProps): React$1.JSX.Element;
1238
+ declare function Combobox({ options, value, onChange, placeholder, disabled, notFoundContent, status, searchTerm, triggerClassName, contentClassName, itemsClassName, rounded, showSearch, size, allowCreate, onCreateOption, }: ComboboxProps): React$1.JSX.Element;
1233
1239
 
1234
1240
  interface TagItem {
1235
1241
  label: string;
1236
1242
  value: string;
1243
+ color?: TagProps['color'];
1237
1244
  }
1238
- interface TagInputProps extends React$1.HTMLAttributes<HTMLDivElement> {
1245
+ interface TagInputProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'color'> {
1239
1246
  value: TagItem[];
1240
1247
  onRemove: (value: string) => void;
1241
1248
  placeholder?: string;
@@ -1245,6 +1252,7 @@ interface TagInputProps extends React$1.HTMLAttributes<HTMLDivElement> {
1245
1252
  variant?: 'default' | 'filled' | 'borderless';
1246
1253
  radius?: 'default' | 'full';
1247
1254
  maxDisplayCount?: number;
1255
+ color?: TagProps['color'];
1248
1256
  }
1249
1257
  declare function TagInput(props: TagInputProps): React$1.JSX.Element;
1250
1258
 
@@ -1298,7 +1306,7 @@ declare const SheetClose: React$1.ForwardRefExoticComponent<DialogPrimitive.Dial
1298
1306
  declare const SheetPortal: React$1.FC<DialogPrimitive.DialogPortalProps>;
1299
1307
  declare const SheetOverlay: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
1300
1308
  declare const sheetVariants: (props?: ({
1301
- side?: "left" | "right" | "top" | "bottom" | null | undefined;
1309
+ side?: "top" | "right" | "bottom" | "left" | null | undefined;
1302
1310
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1303
1311
  interface SheetContentProps extends React$1.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, VariantProps<typeof sheetVariants> {
1304
1312
  }
@@ -1317,8 +1325,9 @@ declare const SheetDescription: React$1.ForwardRefExoticComponent<Omit<DialogPri
1317
1325
  interface CustomTagItem {
1318
1326
  id: string;
1319
1327
  label: string;
1328
+ color?: TagProps['color'];
1320
1329
  }
1321
- interface CustomTagInputProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'onChange'> {
1330
+ interface CustomTagInputProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'onChange' | 'color'> {
1322
1331
  value: CustomTagItem[];
1323
1332
  onChange: (items: CustomTagItem[]) => void;
1324
1333
  placeholder?: string;
@@ -1332,6 +1341,7 @@ interface CustomTagInputProps extends Omit<React$1.HTMLAttributes<HTMLDivElement
1332
1341
  onTagEdit?: (item: CustomTagItem) => void;
1333
1342
  allowDuplicates?: boolean;
1334
1343
  enableReorder?: boolean;
1344
+ color?: TagProps['color'];
1335
1345
  }
1336
1346
  declare function CustomTagInput(props: CustomTagInputProps): React$1.JSX.Element;
1337
1347
 
@@ -1342,7 +1352,7 @@ interface DateInputProps extends Omit<React$1.InputHTMLAttributes<HTMLInputEleme
1342
1352
  declare const DateInput: React$1.ForwardRefExoticComponent<DateInputProps & React$1.RefAttributes<HTMLInputElement>>;
1343
1353
 
1344
1354
  declare const badgeVariants: (props?: ({
1345
- variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
1355
+ variant?: "destructive" | "default" | "outline" | "secondary" | null | undefined;
1346
1356
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1347
1357
  interface BadgeProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
1348
1358
  }