lecom-ui 4.8.1 → 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.
@@ -130,7 +130,7 @@ const Button = React.forwardRef(
130
130
  customStyles,
131
131
  isActive,
132
132
  children,
133
- isLoaging,
133
+ isLoading,
134
134
  ...props
135
135
  }, ref) => {
136
136
  if (customStyles) {
@@ -146,7 +146,7 @@ const Button = React.forwardRef(
146
146
  ...props
147
147
  },
148
148
  children,
149
- isLoaging && /* @__PURE__ */ React.createElement(Spin, null)
149
+ isLoading && /* @__PURE__ */ React.createElement(Spin, null)
150
150
  );
151
151
  }
152
152
  const Comp = "button";
@@ -161,7 +161,7 @@ const Button = React.forwardRef(
161
161
  ...props
162
162
  },
163
163
  children,
164
- isLoaging && /* @__PURE__ */ React.createElement(Spin, null)
164
+ isLoading && /* @__PURE__ */ React.createElement(Spin, null)
165
165
  );
166
166
  }
167
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,7 +63,7 @@ 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
68
  className: "truncate",
68
69
  title: externalColumn.title
@@ -98,7 +99,7 @@ function buildColumns({
98
99
  return /* @__PURE__ */ React.createElement(
99
100
  Typography,
100
101
  {
101
- variant: "body-large-400",
102
+ variant: size === "small" ? "body-medium-400" : "body-large-400",
102
103
  textColor: "text-grey-800",
103
104
  title: row.getValue(externalColumn.key)
104
105
  },
@@ -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: "h-12 px-4 [&:has([role=checkbox])]:pr-0 shadow-[0_-1.5px_0px_0px_#c9c9c9_inset] text-left",
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,7 +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
- isLoaging?: boolean;
61
+ isLoading?: boolean;
62
62
  }
63
63
  declare const Button: React$1.ForwardRefExoticComponent<ButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
64
64
 
@@ -372,6 +372,7 @@ interface DataTableProps<TData, TValue> {
372
372
  vhDiff?: number;
373
373
  className?: string;
374
374
  noScroll?: boolean;
375
+ size?: 'small' | 'middle';
375
376
  onIsSelected?: (row: Row$1<TData>) => boolean;
376
377
  }
377
378
  interface Row<TData> {
@@ -383,6 +384,7 @@ interface Header<TData, TValue> {
383
384
  }
384
385
  interface BuildColumns<TData, TValue> {
385
386
  columns: Column<TData, TValue>[];
387
+ size?: 'small' | 'middle';
386
388
  }
387
389
  interface BuildHeaderSelect<TData, TValue> {
388
390
  table: Table<TData>;
@@ -401,10 +403,11 @@ interface TableProps<TData, TValue> {
401
403
  isLoading?: boolean;
402
404
  columns: Column<TData, TValue>[];
403
405
  noResults?: React.ReactNode;
406
+ size?: 'small' | 'middle';
404
407
  onIsSelected?: (row: Row$1<TData>) => boolean;
405
408
  }
406
409
 
407
- 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;
408
411
  declare namespace DataTable {
409
412
  var displayName: string;
410
413
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lecom-ui",
3
- "version": "4.8.1",
3
+ "version": "4.8.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",