lecom-ui 4.8.0 → 4.8.2
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { cn } from '../../lib/utils.js';
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { Spin } from '../Spin/Spin.js';
|
|
4
5
|
import { CustomButton } from './CustomButton.js';
|
|
5
6
|
|
|
6
7
|
const buttonVariants = cva(
|
|
@@ -129,6 +130,7 @@ const Button = React.forwardRef(
|
|
|
129
130
|
customStyles,
|
|
130
131
|
isActive,
|
|
131
132
|
children,
|
|
133
|
+
isLoading,
|
|
132
134
|
...props
|
|
133
135
|
}, ref) => {
|
|
134
136
|
if (customStyles) {
|
|
@@ -143,7 +145,8 @@ const Button = React.forwardRef(
|
|
|
143
145
|
ref,
|
|
144
146
|
...props
|
|
145
147
|
},
|
|
146
|
-
children
|
|
148
|
+
children,
|
|
149
|
+
isLoading && /* @__PURE__ */ React.createElement(Spin, null)
|
|
147
150
|
);
|
|
148
151
|
}
|
|
149
152
|
const Comp = "button";
|
|
@@ -157,7 +160,8 @@ const Button = React.forwardRef(
|
|
|
157
160
|
ref,
|
|
158
161
|
...props
|
|
159
162
|
},
|
|
160
|
-
children
|
|
163
|
+
children,
|
|
164
|
+
isLoading && /* @__PURE__ */ React.createElement(Spin, null)
|
|
161
165
|
);
|
|
162
166
|
}
|
|
163
167
|
);
|
|
@@ -16,12 +16,13 @@ function DataTable({
|
|
|
16
16
|
vhDiff,
|
|
17
17
|
className,
|
|
18
18
|
noScroll,
|
|
19
|
+
size = "middle",
|
|
19
20
|
onIsSelected
|
|
20
21
|
}) {
|
|
21
22
|
const [sorting, setSorting] = React.useState([]);
|
|
22
23
|
const table = useReactTable({
|
|
23
24
|
data,
|
|
24
|
-
columns: buildColumns({ columns }),
|
|
25
|
+
columns: buildColumns({ columns, size }),
|
|
25
26
|
getCoreRowModel: getCoreRowModel(),
|
|
26
27
|
onSortingChange: setSorting,
|
|
27
28
|
getSortedRowModel: getSortedRowModel(),
|
|
@@ -99,7 +100,8 @@ function DataTable({
|
|
|
99
100
|
columns,
|
|
100
101
|
noResults,
|
|
101
102
|
onIsSelected,
|
|
102
|
-
isLoading
|
|
103
|
+
isLoading,
|
|
104
|
+
size
|
|
103
105
|
}
|
|
104
106
|
);
|
|
105
107
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
@@ -32,7 +32,8 @@ function buildCellSelect({
|
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
function buildColumns({
|
|
35
|
-
columns
|
|
35
|
+
columns,
|
|
36
|
+
size = "middle"
|
|
36
37
|
}) {
|
|
37
38
|
const mappedColumns = columns.map((externalColumn) => ({
|
|
38
39
|
accessorKey: externalColumn.key,
|
|
@@ -62,9 +63,10 @@ function buildColumns({
|
|
|
62
63
|
typeof externalColumn.title === "string" ? /* @__PURE__ */ React.createElement(
|
|
63
64
|
Typography,
|
|
64
65
|
{
|
|
65
|
-
variant: "body-large-500",
|
|
66
|
+
variant: size === "small" ? "body-medium-500" : "body-large-500",
|
|
66
67
|
textColor: "text-grey-950",
|
|
67
|
-
className: "truncate"
|
|
68
|
+
className: "truncate",
|
|
69
|
+
title: externalColumn.title
|
|
68
70
|
},
|
|
69
71
|
externalColumn.title
|
|
70
72
|
) : title,
|
|
@@ -94,7 +96,15 @@ function buildColumns({
|
|
|
94
96
|
}
|
|
95
97
|
return externalColumn.render;
|
|
96
98
|
}
|
|
97
|
-
return /* @__PURE__ */ React.createElement(
|
|
99
|
+
return /* @__PURE__ */ React.createElement(
|
|
100
|
+
Typography,
|
|
101
|
+
{
|
|
102
|
+
variant: size === "small" ? "body-medium-400" : "body-large-400",
|
|
103
|
+
textColor: "text-grey-800",
|
|
104
|
+
title: row.getValue(externalColumn.key)
|
|
105
|
+
},
|
|
106
|
+
row.getValue(externalColumn.key)
|
|
107
|
+
);
|
|
98
108
|
},
|
|
99
109
|
meta: {
|
|
100
110
|
width: externalColumn.width,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { cn } from '../../lib/utils.js';
|
|
2
3
|
import { flexRender } from '@tanstack/react-table';
|
|
3
4
|
import { Skeleton } from '../Skeleton/Skeleton.js';
|
|
4
5
|
|
|
@@ -7,6 +8,7 @@ function Table({
|
|
|
7
8
|
isLoading,
|
|
8
9
|
columns,
|
|
9
10
|
noResults,
|
|
11
|
+
size = "middle",
|
|
10
12
|
onIsSelected
|
|
11
13
|
}) {
|
|
12
14
|
const styleColumn = (meta, elem) => {
|
|
@@ -38,7 +40,10 @@ function Table({
|
|
|
38
40
|
"th",
|
|
39
41
|
{
|
|
40
42
|
key: header.id,
|
|
41
|
-
className:
|
|
43
|
+
className: cn(
|
|
44
|
+
"h-12 px-4 [&:has([role=checkbox])]:pr-0 shadow-[0_-1.5px_0px_0px_#c9c9c9_inset] text-left",
|
|
45
|
+
size === "small" && "h-10"
|
|
46
|
+
),
|
|
42
47
|
"data-header": header.id,
|
|
43
48
|
"data-fixed": getFixed(header.column.columnDef.meta),
|
|
44
49
|
style: styleColumn(header.column.columnDef.meta, "th")
|
package/dist/index.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ interface CustomStyles$1 {
|
|
|
58
58
|
interface ButtonProps extends Omit<React$1.ButtonHTMLAttributes<HTMLButtonElement>, 'color'>, VariantProps<typeof buttonVariants> {
|
|
59
59
|
customStyles?: CustomStyles$1;
|
|
60
60
|
isActive?: boolean;
|
|
61
|
+
isLoading?: boolean;
|
|
61
62
|
}
|
|
62
63
|
declare const Button: React$1.ForwardRefExoticComponent<ButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
63
64
|
|
|
@@ -371,6 +372,7 @@ interface DataTableProps<TData, TValue> {
|
|
|
371
372
|
vhDiff?: number;
|
|
372
373
|
className?: string;
|
|
373
374
|
noScroll?: boolean;
|
|
375
|
+
size?: 'small' | 'middle';
|
|
374
376
|
onIsSelected?: (row: Row$1<TData>) => boolean;
|
|
375
377
|
}
|
|
376
378
|
interface Row<TData> {
|
|
@@ -382,6 +384,7 @@ interface Header<TData, TValue> {
|
|
|
382
384
|
}
|
|
383
385
|
interface BuildColumns<TData, TValue> {
|
|
384
386
|
columns: Column<TData, TValue>[];
|
|
387
|
+
size?: 'small' | 'middle';
|
|
385
388
|
}
|
|
386
389
|
interface BuildHeaderSelect<TData, TValue> {
|
|
387
390
|
table: Table<TData>;
|
|
@@ -400,10 +403,11 @@ interface TableProps<TData, TValue> {
|
|
|
400
403
|
isLoading?: boolean;
|
|
401
404
|
columns: Column<TData, TValue>[];
|
|
402
405
|
noResults?: React.ReactNode;
|
|
406
|
+
size?: 'small' | 'middle';
|
|
403
407
|
onIsSelected?: (row: Row$1<TData>) => boolean;
|
|
404
408
|
}
|
|
405
409
|
|
|
406
|
-
declare function DataTable<TData, TValue>({ isLoading, columns, data, noResults, pagination, vwDiff, vhDiff, className, noScroll, onIsSelected, }: DataTableProps<TData, TValue>): React$1.JSX.Element;
|
|
410
|
+
declare function DataTable<TData, TValue>({ isLoading, columns, data, noResults, pagination, vwDiff, vhDiff, className, noScroll, size, onIsSelected, }: DataTableProps<TData, TValue>): React$1.JSX.Element;
|
|
407
411
|
declare namespace DataTable {
|
|
408
412
|
var displayName: string;
|
|
409
413
|
}
|
|
@@ -559,9 +563,9 @@ interface HeaderProps extends React$1.HTMLAttributes<HTMLElement>, VariantProps<
|
|
|
559
563
|
}
|
|
560
564
|
|
|
561
565
|
declare const inputVariants: (props?: ({
|
|
562
|
-
variant?: "
|
|
563
|
-
size?: "
|
|
564
|
-
radius?: "
|
|
566
|
+
variant?: "filled" | "default" | "borderless" | null | undefined;
|
|
567
|
+
size?: "small" | "large" | "default" | null | undefined;
|
|
568
|
+
radius?: "small" | "large" | "default" | null | undefined;
|
|
565
569
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
566
570
|
interface InputProps extends Omit<React$1.InputHTMLAttributes<HTMLInputElement>, 'size' | 'sufix' | 'prefix'>, VariantProps<typeof inputVariants> {
|
|
567
571
|
sufix?: React$1.ReactNode;
|
|
@@ -722,7 +726,7 @@ declare const TooltipTrigger: React$1.ForwardRefExoticComponent<TooltipPrimitive
|
|
|
722
726
|
declare const TooltipArrow: React$1.ForwardRefExoticComponent<TooltipPrimitive.TooltipArrowProps & React$1.RefAttributes<SVGSVGElement>>;
|
|
723
727
|
declare const TooltipPortal: React$1.FC<TooltipPrimitive.TooltipPortalProps>;
|
|
724
728
|
declare const tooltipContentVariants: (props?: ({
|
|
725
|
-
color?: "
|
|
729
|
+
color?: "white" | "black" | null | undefined;
|
|
726
730
|
arrow?: boolean | null | undefined;
|
|
727
731
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
728
732
|
interface TooltipContentProps extends React$1.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>, VariantProps<typeof tooltipContentVariants> {
|