lecom-ui 5.4.38 → 5.4.40

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.
@@ -21,12 +21,19 @@ function DataTable({
21
21
  onIsSelected,
22
22
  expandedContent,
23
23
  initialExpanded,
24
- onExpandedChange
24
+ onExpandedChange,
25
+ sorting: controlledSorting,
26
+ onSortingChange: controlledOnSortingChange,
27
+ manualSorting = false
25
28
  }) {
26
- const [sorting, setSorting] = React.useState([]);
29
+ const [internalSorting, setInternalSorting] = React.useState(
30
+ []
31
+ );
27
32
  const [expanded, setExpanded] = React.useState(
28
33
  initialExpanded || {}
29
34
  );
35
+ const sorting = controlledSorting ?? internalSorting;
36
+ const setSorting = controlledOnSortingChange ?? setInternalSorting;
30
37
  const memorizedColumns = React.useMemo(
31
38
  () => buildColumns({
32
39
  columns,
@@ -51,10 +58,11 @@ function DataTable({
51
58
  columns: memorizedColumns,
52
59
  getCoreRowModel: getCoreRowModel(),
53
60
  onSortingChange: setSorting,
54
- getSortedRowModel: getSortedRowModel(),
61
+ ...manualSorting ? {} : { getSortedRowModel: getSortedRowModel() },
55
62
  getExpandedRowModel: getExpandedRowModel(),
56
63
  enableExpanding: !!expandedContent,
57
64
  onExpandedChange: handleExpandedChange,
65
+ manualSorting,
58
66
  state: {
59
67
  sorting,
60
68
  expanded
@@ -65,8 +73,10 @@ function DataTable({
65
73
  memorizedColumns,
66
74
  handleExpandedChange,
67
75
  sorting,
76
+ setSorting,
68
77
  expanded,
69
- expandedContent
78
+ expandedContent,
79
+ manualSorting
70
80
  ]
71
81
  );
72
82
  const table = useReactTable(tableConfig);
@@ -47,7 +47,7 @@ const Layout = ({ children, header, sideBar }) => {
47
47
  info.versionText,
48
48
  " ",
49
49
  info.version,
50
- " - ",
50
+ " ",
51
51
  info.cycle,
52
52
  " ",
53
53
  info.build
@@ -160,7 +160,6 @@ const Sidebar = React.forwardRef(
160
160
  className: cn(
161
161
  "duration-200 relative inset-y-0 z-10 hidden h-full w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex border-grey-400",
162
162
  side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] group-data-[collapsible=offcanvas]:!w-0 group-data-[collapsible=offcanvas]:group-data-[state=expanded]:!w-[--sidebar-width-icon] group-data-[collapsible=offcanvas]:group-data-[state=expanded]:left-0" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] group-data-[collapsible=offcanvas]:!w-0 group-data-[collapsible=offcanvas]:group-data-[state=expanded]:!w-[--sidebar-width-icon] group-data-[collapsible=offcanvas]:group-data-[state=expanded]:right-0",
163
- // Adjust the padding for floating and inset variants.
164
163
  variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]" : "group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",
165
164
  className
166
165
  ),
@@ -332,7 +331,6 @@ const SidebarGroupAction = React.forwardRef(({ className, asChild = false, ...pr
332
331
  "data-sidebar": "group-action",
333
332
  className: cn(
334
333
  "absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
335
- // Increases the hit area of the button on mobile.
336
334
  "after:absolute after:-inset-2 after:md:hidden",
337
335
  "group-data-[collapsible=icon]:hidden",
338
336
  className
@@ -456,7 +454,6 @@ const SidebarMenuAction = React.forwardRef(({ className, asChild = false, showOn
456
454
  "data-sidebar": "menu-action",
457
455
  className: cn(
458
456
  "absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0",
459
- // Increases the hit area of the button on mobile.
460
457
  "after:absolute after:-inset-2 after:md:hidden",
461
458
  "peer-data-[size=sm]/menu-button:top-1",
462
459
  "peer-data-[size=default]/menu-button:top-1.5",
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ export { Bar, BarChart, BarProps, CartesianGrid, Label, LabelList, LegendType, X
13
13
  import * as recharts_types_component_DefaultTooltipContent from 'recharts/types/component/DefaultTooltipContent';
14
14
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
15
15
  import { FillColor as FillColor$1, BgColor as BgColor$1 } from '@/tokens/colors';
16
- import { Table, Column as Column$1, Row as Row$1, ExpandedState } from '@tanstack/react-table';
16
+ import { Table, Column as Column$1, Row as Row$1, ExpandedState, SortingState, OnChangeFn } from '@tanstack/react-table';
17
17
  export { ColumnDef } from '@tanstack/react-table';
18
18
  import * as DialogPrimitive from '@radix-ui/react-dialog';
19
19
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
@@ -412,6 +412,9 @@ interface DataTableProps<TData, TValue> {
412
412
  expandedContent?: (row: Row$1<TData>) => React.ReactNode;
413
413
  initialExpanded?: ExpandedState;
414
414
  onExpandedChange?: (expanded: ExpandedState) => void;
415
+ sorting?: SortingState;
416
+ onSortingChange?: OnChangeFn<SortingState>;
417
+ manualSorting?: boolean;
415
418
  }
416
419
  interface Row<TData> {
417
420
  row: Row$1<TData>;
@@ -457,7 +460,7 @@ interface TableProps<TData, TValue> {
457
460
  expandedContent?: (row: Row$1<TData>) => React.ReactNode;
458
461
  }
459
462
 
460
- declare function DataTable<TData, TValue>({ isLoading, columns, data, noResults, pagination, vwDiff, vhDiff, className, noScroll, size, skeleton, onIsSelected, expandedContent, initialExpanded, onExpandedChange, }: DataTableProps<TData, TValue>): React$1.JSX.Element;
463
+ declare function DataTable<TData, TValue>({ isLoading, columns, data, noResults, pagination, vwDiff, vhDiff, className, noScroll, size, skeleton, onIsSelected, expandedContent, initialExpanded, onExpandedChange, sorting: controlledSorting, onSortingChange: controlledOnSortingChange, manualSorting, }: DataTableProps<TData, TValue>): React$1.JSX.Element;
461
464
  declare const MemoizedDataTable: typeof DataTable & {
462
465
  displayName?: string;
463
466
  };
@@ -787,9 +790,9 @@ interface HeaderProps extends React$1.HTMLAttributes<HTMLElement>, VariantProps<
787
790
  }
788
791
 
789
792
  declare const inputVariants: (props?: ({
790
- variant?: "default" | "filled" | "borderless" | null | undefined;
791
- size?: "small" | "default" | "large" | null | undefined;
792
- radius?: "small" | "default" | "large" | "full" | null | undefined;
793
+ variant?: "filled" | "default" | "borderless" | null | undefined;
794
+ size?: "small" | "large" | "default" | null | undefined;
795
+ radius?: "small" | "large" | "default" | "full" | null | undefined;
793
796
  } & class_variance_authority_types.ClassProp) | undefined) => string;
794
797
  interface InputProps extends Omit<React$1.InputHTMLAttributes<HTMLInputElement>, 'size' | 'sufix' | 'prefix'>, VariantProps<typeof inputVariants> {
795
798
  sufix?: React$1.ReactNode;
@@ -995,7 +998,7 @@ declare const RadioGroup: React$1.ForwardRefExoticComponent<Omit<RadioGroupPrimi
995
998
  declare const RadioGroupItem: React$1.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
996
999
 
997
1000
  declare const ResizablePanelGroup: ({ className, ...props }: React$1.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => React$1.JSX.Element;
998
- declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLElement | HTMLOListElement | HTMLLIElement | HTMLAnchorElement | HTMLSpanElement | HTMLDivElement | HTMLButtonElement | HTMLHeadingElement | HTMLParagraphElement | HTMLLabelElement | HTMLInputElement | HTMLUListElement | 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"> & {
1001
+ declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLButtonElement | HTMLElement | HTMLOListElement | HTMLLIElement | HTMLAnchorElement | HTMLSpanElement | HTMLDivElement | HTMLHeadingElement | HTMLParagraphElement | HTMLLabelElement | HTMLInputElement | HTMLUListElement | 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"> & {
999
1002
  className?: string;
1000
1003
  collapsedSize?: number | undefined;
1001
1004
  collapsible?: boolean | undefined;
@@ -1161,10 +1164,10 @@ declare const TabsTrigger: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.
1161
1164
  declare const TabsContent: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
1162
1165
 
1163
1166
  declare const textareaVariants: (props?: ({
1164
- variant?: "default" | "filled" | "borderless" | null | undefined;
1165
- size?: "small" | "default" | "large" | null | undefined;
1166
- radius?: "small" | "default" | "large" | "full" | null | undefined;
1167
- resize?: "both" | "horizontal" | "vertical" | "default" | "vertical-limited" | null | undefined;
1167
+ variant?: "filled" | "default" | "borderless" | null | undefined;
1168
+ size?: "small" | "large" | "default" | null | undefined;
1169
+ radius?: "small" | "large" | "default" | "full" | null | undefined;
1170
+ resize?: "default" | "both" | "horizontal" | "vertical" | "vertical-limited" | null | undefined;
1168
1171
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1169
1172
  interface TextareaProps extends React$1.ComponentProps<'textarea'>, VariantProps<typeof textareaVariants> {
1170
1173
  }
@@ -1307,7 +1310,7 @@ declare const SheetClose: React$1.ForwardRefExoticComponent<DialogPrimitive.Dial
1307
1310
  declare const SheetPortal: React$1.FC<DialogPrimitive.DialogPortalProps>;
1308
1311
  declare const SheetOverlay: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
1309
1312
  declare const sheetVariants: (props?: ({
1310
- side?: "top" | "bottom" | "left" | "right" | null | undefined;
1313
+ side?: "left" | "right" | "top" | "bottom" | null | undefined;
1311
1314
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1312
1315
  interface SheetContentProps extends React$1.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, VariantProps<typeof sheetVariants> {
1313
1316
  }
@@ -1353,7 +1356,7 @@ interface DateInputProps extends Omit<React$1.InputHTMLAttributes<HTMLInputEleme
1353
1356
  declare const DateInput: React$1.ForwardRefExoticComponent<DateInputProps & React$1.RefAttributes<HTMLInputElement>>;
1354
1357
 
1355
1358
  declare const badgeVariants: (props?: ({
1356
- variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
1359
+ variant?: "destructive" | "default" | "outline" | "secondary" | null | undefined;
1357
1360
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1358
1361
  interface BadgeProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
1359
1362
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lecom-ui",
3
- "version": "5.4.38",
3
+ "version": "5.4.40",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",