lecom-ui 5.3.31 → 5.3.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.
package/README.md CHANGED
@@ -1 +1 @@
1
- lecom-ui
1
+ lecom-ui
@@ -1,5 +1,4 @@
1
1
  import * as React from 'react';
2
- import { cn } from '../../lib/utils.js';
3
2
  import { ArrowUp, ArrowDown, ArrowUpDown } from 'lucide-react';
4
3
  import { Checkbox } from '../Checkbox/Checkbox.js';
5
4
  import { Typography } from '../Typography/Typography.js';
@@ -47,14 +46,21 @@ function renderSortArrow({
47
46
  }
48
47
  };
49
48
  if (sorted === "asc") {
50
- return /* @__PURE__ */ React.createElement(ArrowUp, { size: 16, className: "ml-1 text-grey-950", onClick: handleClick });
49
+ return /* @__PURE__ */ React.createElement(
50
+ ArrowUp,
51
+ {
52
+ size: 16,
53
+ className: "ml-1 text-grey-950 hover:cursor-pointer",
54
+ onClick: handleClick
55
+ }
56
+ );
51
57
  }
52
58
  if (sorted === "desc") {
53
59
  return /* @__PURE__ */ React.createElement(
54
60
  ArrowDown,
55
61
  {
56
62
  size: 16,
57
- className: "ml-1 text-grey-950",
63
+ className: "ml-1 text-grey-950 hover:cursor-pointer",
58
64
  onClick: handleClick
59
65
  }
60
66
  );
@@ -63,7 +69,7 @@ function renderSortArrow({
63
69
  ArrowUpDown,
64
70
  {
65
71
  size: 16,
66
- className: "ml-1 text-grey-400 group-hover:text-grey-950",
72
+ className: "ml-1 text-grey-400 group-hover:text-grey-950 hover:cursor-pointer",
67
73
  onClick: handleClick
68
74
  }
69
75
  );
@@ -98,26 +104,16 @@ function buildColumns({
98
104
  }
99
105
  const hasSort = !!externalColumn.onSort || !!externalColumn.onSortClient;
100
106
  const title = typeof externalColumn.title === "function" ? externalColumn.title({ table, column }) : externalColumn.title;
101
- return /* @__PURE__ */ React.createElement(
102
- "div",
107
+ return /* @__PURE__ */ React.createElement("div", { className: "group flex items-center gap-1" }, typeof externalColumn.title === "string" ? /* @__PURE__ */ React.createElement(
108
+ Typography,
103
109
  {
104
- className: cn(
105
- "group flex items-center gap-1",
106
- hasSort && "hover:cursor-pointer"
107
- )
110
+ variant: size === "small" ? "body-medium-500" : "body-large-500",
111
+ textColor: "text-grey-950",
112
+ className: "whitespace-normal break-words max-sm:truncate",
113
+ title: externalColumn.title
108
114
  },
109
- typeof externalColumn.title === "string" ? /* @__PURE__ */ React.createElement(
110
- Typography,
111
- {
112
- variant: size === "small" ? "body-medium-500" : "body-large-500",
113
- textColor: "text-grey-950",
114
- className: "whitespace-normal break-words max-sm:truncate",
115
- title: externalColumn.title
116
- },
117
- externalColumn.title
118
- ) : title,
119
- hasSort && renderSortArrow({ column, externalColumn, table })
120
- );
115
+ externalColumn.title
116
+ ) : title, hasSort && renderSortArrow({ column, externalColumn, table }));
121
117
  },
122
118
  cell: ({ row }) => {
123
119
  if (externalColumn.enableSelect) {
@@ -27,8 +27,8 @@ function Table({
27
27
  }
28
28
  return {
29
29
  width: meta.width,
30
- maxWidth: meta.maxWidth ?? "0",
31
- minWidth: meta.minWidth ?? "0",
30
+ maxWidth: meta.maxWidth ?? void 0,
31
+ minWidth: meta.minWidth ?? void 0,
32
32
  textAlign: meta.align || "left"
33
33
  };
34
34
  }, []);
@@ -20,7 +20,6 @@ const MultiSelect = React.forwardRef(
20
20
  className,
21
21
  treeOptions,
22
22
  treeSelectionStrategy = "leaf",
23
- defaultExpandAll = false,
24
23
  selectAllLabel,
25
24
  treeSearch = true,
26
25
  treeSearchPlaceholder,
@@ -29,20 +28,6 @@ const MultiSelect = React.forwardRef(
29
28
  const { t } = useTranslation();
30
29
  const [selectedValues, setSelectedValues] = React.useState(value);
31
30
  const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);
32
- const [expandedNodes, setExpandedNodes] = React.useState(
33
- () => new Set(
34
- defaultExpandAll ? function collectAll(ids, opts) {
35
- if (!opts) return ids;
36
- for (const o of opts) {
37
- if (o.children?.length) {
38
- ids.push(o.value);
39
- collectAll(ids, o.children);
40
- }
41
- }
42
- return ids;
43
- }([], treeOptions) : []
44
- )
45
- );
46
31
  React.useEffect(() => {
47
32
  const shallowEqual = (a, b) => {
48
33
  if (a === b) return true;
@@ -130,21 +115,8 @@ const MultiSelect = React.forwardRef(
130
115
  }, [treeOptions, treeQuery, filterTree]);
131
116
  React.useEffect(() => {
132
117
  if (!treeOptions) return;
133
- if (treeQuery) {
134
- const all = /* @__PURE__ */ new Set();
135
- const collect = (list) => {
136
- for (const n of list) {
137
- if (n.children?.length) {
138
- all.add(n.value);
139
- collect(n.children);
140
- }
141
- }
142
- };
143
- collect(treeOptions);
144
- setExpandedNodes(all);
145
- }
146
118
  }, [treeQuery, treeOptions]);
147
- React.useCallback((val) => {
119
+ const findTreeLabel = React.useCallback((val) => {
148
120
  if (!treeOptions) return void 0;
149
121
  const stack = [...treeOptions];
150
122
  while (stack.length) {
@@ -154,10 +126,6 @@ const MultiSelect = React.forwardRef(
154
126
  }
155
127
  return void 0;
156
128
  }, [treeOptions]);
157
- React.useCallback(
158
- (id) => expandedNodes.has(id),
159
- [expandedNodes]
160
- );
161
129
  const collectAllValues = (node) => {
162
130
  const self = treeSelectionStrategy === "all" ? [node.value] : [];
163
131
  if (!node.children || node.children.length === 0) {
@@ -203,17 +171,34 @@ const MultiSelect = React.forwardRef(
203
171
  "flex items-center gap-2 px-2 py-1 cursor-pointer rounded-sm text-grey-800 hover:bg-grey-100 text-sm",
204
172
  (fully || isSelectedLeaf) && "bg-blue-50"
205
173
  ),
206
- style: { paddingLeft: depth * 14 + 8 },
207
- onClick: (e) => {
208
- e.stopPropagation();
209
- toggleTreeNode(n);
210
- }
174
+ style: { paddingLeft: depth * 14 + 8 }
211
175
  },
212
- /* @__PURE__ */ React.createElement("div", { className: cn(
213
- "flex h-4 w-4 items-center justify-center rounded-sm border transition-colors",
214
- fully ? "bg-blue-600 border-blue-600 text-primary-foreground" : "border-grey-400 bg-white"
215
- ) }, fully && /* @__PURE__ */ React.createElement(Check, { className: "h-3 w-3" }), partial && !fully && /* @__PURE__ */ React.createElement(Minus, { className: "h-3 w-3 text-blue-600" })),
216
- /* @__PURE__ */ React.createElement("span", { className: "text-sm flex-1 truncate" }, n.label)
176
+ /* @__PURE__ */ React.createElement(
177
+ "div",
178
+ {
179
+ className: cn(
180
+ "flex h-4 w-4 items-center justify-center rounded-sm border transition-colors",
181
+ fully ? "bg-blue-600 border-blue-600 text-primary-foreground" : "border-grey-400 bg-white"
182
+ ),
183
+ onClick: (e) => {
184
+ e.stopPropagation();
185
+ toggleTreeNode(n);
186
+ }
187
+ },
188
+ fully && /* @__PURE__ */ React.createElement(Check, { className: "h-3 w-3" }),
189
+ partial && !fully && /* @__PURE__ */ React.createElement(Minus, { className: "h-3 w-3 text-blue-600" })
190
+ ),
191
+ /* @__PURE__ */ React.createElement(
192
+ "span",
193
+ {
194
+ className: "text-sm flex-1 truncate cursor-pointer",
195
+ onClick: (e) => {
196
+ e.stopPropagation();
197
+ toggleTreeNode(n);
198
+ }
199
+ },
200
+ n.label
201
+ )
217
202
  ), hasChildren && /* @__PURE__ */ React.createElement("div", null, renderTree(n.children, depth + 1)));
218
203
  }));
219
204
  };
@@ -240,7 +225,8 @@ const MultiSelect = React.forwardRef(
240
225
  },
241
226
  selectedValues.length > 0 ? /* @__PURE__ */ React.createElement("div", { className: "flex justify-between items-center w-full" }, /* @__PURE__ */ React.createElement("div", { className: "flex flex-wrap items-center gap-1" }, selectedValues.slice(0, maxCount).map((value2) => {
242
227
  const option = options.find((o) => o.value === value2);
243
- return /* @__PURE__ */ React.createElement(Tag, { key: value2, color: "blue", className: "focus:ring-0" }, option?.label, /* @__PURE__ */ React.createElement(
228
+ const label = option?.label || findTreeLabel(value2) || value2;
229
+ return /* @__PURE__ */ React.createElement(Tag, { key: value2, color: "blue", className: "focus:ring-0" }, label, /* @__PURE__ */ React.createElement(
244
230
  X,
245
231
  {
246
232
  className: "h-4 w-4 cursor-pointer",
package/dist/index.d.ts CHANGED
@@ -743,8 +743,8 @@ interface HeaderProps extends React$1.HTMLAttributes<HTMLElement>, VariantProps<
743
743
 
744
744
  declare const inputVariants: (props?: ({
745
745
  variant?: "default" | "filled" | "borderless" | null | undefined;
746
- size?: "default" | "small" | "large" | null | undefined;
747
- radius?: "default" | "small" | "large" | "full" | null | undefined;
746
+ size?: "small" | "default" | "large" | null | undefined;
747
+ radius?: "small" | "default" | "large" | "full" | null | undefined;
748
748
  } & class_variance_authority_types.ClassProp) | undefined) => string;
749
749
  interface InputProps extends Omit<React$1.InputHTMLAttributes<HTMLInputElement>, 'size' | 'sufix' | 'prefix'>, VariantProps<typeof inputVariants> {
750
750
  sufix?: React$1.ReactNode;
@@ -800,12 +800,8 @@ interface MultiSelectProps extends React$1.ButtonHTMLAttributes<HTMLButtonElemen
800
800
  matchTriggerWidth?: boolean;
801
801
  treeOptions?: MultiSelectTreeOption[];
802
802
  treeSelectionStrategy?: 'leaf' | 'all';
803
- defaultExpandAll?: boolean;
804
- /** Custom label para "selecionar tudo" */
805
803
  selectAllLabel?: string;
806
- /** Exibe input de busca em modo árvore (default true) */
807
804
  treeSearch?: boolean;
808
- /** Placeholder da busca em modo árvore */
809
805
  treeSearchPlaceholder?: string;
810
806
  }
811
807
  interface MultiSelectTreeOption {
@@ -1074,9 +1070,9 @@ declare const TabsContent: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.
1074
1070
 
1075
1071
  declare const textareaVariants: (props?: ({
1076
1072
  variant?: "default" | "filled" | "borderless" | null | undefined;
1077
- size?: "default" | "small" | "large" | null | undefined;
1078
- radius?: "default" | "small" | "large" | "full" | null | undefined;
1079
- resize?: "default" | "both" | "horizontal" | "vertical" | "vertical-limited" | null | undefined;
1073
+ size?: "small" | "default" | "large" | null | undefined;
1074
+ radius?: "small" | "default" | "large" | "full" | null | undefined;
1075
+ resize?: "both" | "horizontal" | "vertical" | "default" | "vertical-limited" | null | undefined;
1080
1076
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1081
1077
  interface TextareaProps extends React$1.ComponentProps<'textarea'>, VariantProps<typeof textareaVariants> {
1082
1078
  }
@@ -1205,7 +1201,7 @@ declare const SheetClose: React$1.ForwardRefExoticComponent<DialogPrimitive.Dial
1205
1201
  declare const SheetPortal: React$1.FC<DialogPrimitive.DialogPortalProps>;
1206
1202
  declare const SheetOverlay: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
1207
1203
  declare const sheetVariants: (props?: ({
1208
- side?: "left" | "right" | "top" | "bottom" | null | undefined;
1204
+ side?: "top" | "bottom" | "left" | "right" | null | undefined;
1209
1205
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1210
1206
  interface SheetContentProps extends React$1.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, VariantProps<typeof sheetVariants> {
1211
1207
  }
@@ -1,78 +1,78 @@
1
- const extend = {
2
- colors: {
3
- background: 'hsl(var(--background))',
4
- foreground: 'hsl(var(--foreground))',
5
- card: {
6
- DEFAULT: 'hsl(var(--card))',
7
- foreground: 'hsl(var(--card-foreground))',
8
- },
9
- popover: {
10
- DEFAULT: 'hsl(var(--popover))',
11
- foreground: 'hsl(var(--popover-foreground))',
12
- },
13
- primary: {
14
- DEFAULT: 'hsl(var(--primary))',
15
- foreground: 'hsl(var(--primary-foreground))',
16
- },
17
- secondary: {
18
- DEFAULT: 'hsl(var(--secondary))',
19
- foreground: 'hsl(var(--secondary-foreground))',
20
- },
21
- muted: {
22
- DEFAULT: 'hsl(var(--muted))',
23
- foreground: 'hsl(var(--muted-foreground))',
24
- },
25
- accent: {
26
- DEFAULT: 'hsl(var(--accent))',
27
- foreground: 'hsl(var(--accent-foreground))',
28
- },
29
- destructive: {
30
- DEFAULT: 'hsl(var(--destructive))',
31
- foreground: 'hsl(var(--destructive-foreground))',
32
- },
33
- border: 'hsl(var(--border))',
34
- input: 'hsl(var(--input))',
35
- ring: 'hsl(var(--ring))',
36
- chart: {
37
- 1: 'hsl(var(--chart-1))',
38
- 2: 'hsl(var(--chart-2))',
39
- 3: 'hsl(var(--chart-3))',
40
- 4: 'hsl(var(--chart-4))',
41
- 5: 'hsl(var(--chart-5))',
42
- 6: 'hsl(var(--chart-6))',
43
- 7: 'hsl(var(--chart-7))',
44
- 8: 'hsl(var(--chart-8))',
45
- },
46
- sidebar: {
47
- DEFAULT: 'hsl(var(--sidebar-background))',
48
- foreground: 'hsl(var(--sidebar-foreground))',
49
- primary: 'hsl(var(--sidebar-primary))',
50
- 'primary-foreground': 'hsl(var(--sidebar-primary-foreground))',
51
- accent: 'hsl(var(--sidebar-accent))',
52
- 'accent-foreground': 'hsl(var(--sidebar-accent-foreground))',
53
- border: 'hsl(var(--sidebar-border))',
54
- ring: 'hsl(var(--sidebar-ring))',
55
- },
56
- },
57
- borderRadius: {
58
- lg: 'var(--radius)',
59
- md: 'calc(var(--radius) - 2px)',
60
- sm: 'calc(var(--radius) - 4px)',
61
- },
62
- keyframes: {
63
- 'accordion-down': {
64
- from: { height: '0' },
65
- to: { height: 'var(--radix-accordion-content-height)' },
66
- },
67
- 'accordion-up': {
68
- from: { height: 'var(--radix-accordion-content-height)' },
69
- to: { height: '0' },
70
- },
71
- },
72
- animation: {
73
- 'accordion-down': 'accordion-down 0.2s ease-out',
74
- 'accordion-up': 'accordion-up 0.2s ease-out',
75
- },
76
- };
77
-
78
- export { extend };
1
+ const extend = {
2
+ colors: {
3
+ background: 'hsl(var(--background))',
4
+ foreground: 'hsl(var(--foreground))',
5
+ card: {
6
+ DEFAULT: 'hsl(var(--card))',
7
+ foreground: 'hsl(var(--card-foreground))',
8
+ },
9
+ popover: {
10
+ DEFAULT: 'hsl(var(--popover))',
11
+ foreground: 'hsl(var(--popover-foreground))',
12
+ },
13
+ primary: {
14
+ DEFAULT: 'hsl(var(--primary))',
15
+ foreground: 'hsl(var(--primary-foreground))',
16
+ },
17
+ secondary: {
18
+ DEFAULT: 'hsl(var(--secondary))',
19
+ foreground: 'hsl(var(--secondary-foreground))',
20
+ },
21
+ muted: {
22
+ DEFAULT: 'hsl(var(--muted))',
23
+ foreground: 'hsl(var(--muted-foreground))',
24
+ },
25
+ accent: {
26
+ DEFAULT: 'hsl(var(--accent))',
27
+ foreground: 'hsl(var(--accent-foreground))',
28
+ },
29
+ destructive: {
30
+ DEFAULT: 'hsl(var(--destructive))',
31
+ foreground: 'hsl(var(--destructive-foreground))',
32
+ },
33
+ border: 'hsl(var(--border))',
34
+ input: 'hsl(var(--input))',
35
+ ring: 'hsl(var(--ring))',
36
+ chart: {
37
+ 1: 'hsl(var(--chart-1))',
38
+ 2: 'hsl(var(--chart-2))',
39
+ 3: 'hsl(var(--chart-3))',
40
+ 4: 'hsl(var(--chart-4))',
41
+ 5: 'hsl(var(--chart-5))',
42
+ 6: 'hsl(var(--chart-6))',
43
+ 7: 'hsl(var(--chart-7))',
44
+ 8: 'hsl(var(--chart-8))',
45
+ },
46
+ sidebar: {
47
+ DEFAULT: 'hsl(var(--sidebar-background))',
48
+ foreground: 'hsl(var(--sidebar-foreground))',
49
+ primary: 'hsl(var(--sidebar-primary))',
50
+ 'primary-foreground': 'hsl(var(--sidebar-primary-foreground))',
51
+ accent: 'hsl(var(--sidebar-accent))',
52
+ 'accent-foreground': 'hsl(var(--sidebar-accent-foreground))',
53
+ border: 'hsl(var(--sidebar-border))',
54
+ ring: 'hsl(var(--sidebar-ring))',
55
+ },
56
+ },
57
+ borderRadius: {
58
+ lg: 'var(--radius)',
59
+ md: 'calc(var(--radius) - 2px)',
60
+ sm: 'calc(var(--radius) - 4px)',
61
+ },
62
+ keyframes: {
63
+ 'accordion-down': {
64
+ from: { height: '0' },
65
+ to: { height: 'var(--radix-accordion-content-height)' },
66
+ },
67
+ 'accordion-up': {
68
+ from: { height: 'var(--radix-accordion-content-height)' },
69
+ to: { height: '0' },
70
+ },
71
+ },
72
+ animation: {
73
+ 'accordion-down': 'accordion-down 0.2s ease-out',
74
+ 'accordion-up': 'accordion-up 0.2s ease-out',
75
+ },
76
+ };
77
+
78
+ export { extend };