@eintrek/erp-theme 1.4.5 → 1.4.7

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,6 @@
1
1
  import { Select as SelectPrimitive } from "radix-ui";
2
2
  import * as React from "react";
3
- declare function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
3
+ declare function Select({ onValueChange, onOpenChange, open, defaultOpen, ...props }: React.ComponentProps<typeof SelectPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
4
  declare function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
5
5
  declare function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>): import("react/jsx-runtime").JSX.Element;
6
6
  declare function SelectTrigger({ className, size, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
package/dist/index.esm.js CHANGED
@@ -15986,8 +15986,49 @@ function ScrollBar({ className, orientation = "vertical", ...props }) {
15986
15986
  "h-2.5 flex-col border-t border-t-transparent", className), ...props, children: jsx(ScrollAreaPrimitive.ScrollAreaThumb, { "data-slot": "scroll-area-thumb", className: "bg-border relative flex-1 rounded-full" }) }));
15987
15987
  }
15988
15988
 
15989
- function Select({ ...props }) {
15990
- return jsx(SelectPrimitive.Root, { "data-slot": "select", ...props });
15989
+ function Select({ onValueChange, onOpenChange, open, defaultOpen, ...props }) {
15990
+ // Tracked in a ref, not state: this only needs to be readable inside the
15991
+ // callback below, and putting it in state would re-render on every open.
15992
+ const isOpenRef = React.useRef(defaultOpen ?? false);
15993
+ if (open !== undefined)
15994
+ isOpenRef.current = open;
15995
+ return (jsx(SelectPrimitive.Root, { "data-slot": "select", ...props, open: open, defaultOpen: defaultOpen, onOpenChange: next => {
15996
+ isOpenRef.current = next;
15997
+ onOpenChange?.(next);
15998
+ }, onValueChange: value => {
15999
+ // Drop ONLY the empty value Radix echoes back on its own.
16000
+ //
16001
+ // Radix keeps a hidden native <select> so the control works inside
16002
+ // real forms. Whenever the controlled value changes it assigns that
16003
+ // value to the native node and dispatches a synthetic change event,
16004
+ // which comes straight back out through onValueChange:
16005
+ //
16006
+ // setValue.call(select, selectValue);
16007
+ // select.dispatchEvent(new Event("change", { bubbles: true }));
16008
+ // ...
16009
+ // onChange: (event) => onValueChange(event.target.value)
16010
+ //
16011
+ // The native <option> list is registered by SelectItem, and the items
16012
+ // live inside SelectContent — portalled, and only mounted while the
16013
+ // menu is open. On a closed select the option for the incoming value
16014
+ // usually does not exist yet, the DOM refuses the assignment,
16015
+ // `select.value` collapses to "", and that empty string reaches the
16016
+ // consumer. In a form this lands exactly when saved data arrives: the
16017
+ // field is set to its stored value, Radix echoes "", and the handler
16018
+ // writes that back — enum fields then snap to their fallback and zod
16019
+ // rejects the submit with "received ''".
16020
+ //
16021
+ // The open check is what keeps a real "none" option working. Radix
16022
+ // does NOT forbid <SelectItem value="">, and picking one is a
16023
+ // legitimate way to clear a selection. A user pick always arrives
16024
+ // while the menu is still open — SelectItem's handleSelect calls
16025
+ // onValueChange(value) BEFORE onOpenChange(false) — whereas the echo
16026
+ // above fires from an effect with the menu closed. So only the closed
16027
+ // case is suppressed.
16028
+ if (value === "" && !isOpenRef.current)
16029
+ return;
16030
+ onValueChange?.(value);
16031
+ } }));
15991
16032
  }
15992
16033
  function SelectGroup({ ...props }) {
15993
16034
  return jsx(SelectPrimitive.Group, { "data-slot": "select-group", ...props });
@@ -25252,7 +25293,7 @@ function DataTablePagination({ table, pageSizeOptions = [10, 20, 30, 40, 50], cl
25252
25293
  }
25253
25294
  return pages;
25254
25295
  };
25255
- return (jsx("div", { className: cn$1("data-table-pagination flex w-full flex-col-reverse items-center justify-between overflow-auto sm:flex-row bg-sidebar mt-4 rounded-2xl p-4 shadow-sm", className), ...props, children: jsx("div", { className: "flex flex-col-reverse items-center gap-4 sm:flex-row sm:gap-6 lg:gap-8", children: jsx(Pagination, { children: jsxs(PaginationContent, { children: [jsx(PaginationItem, { children: jsx(PaginationPrevious, { onClick: () => table.previousPage(), disabled: !canPreviousPage, className: !canPreviousPage ? "pointer-events-none opacity-50" : "" }) }), getPageNumbers().map((page, index) => (jsx(PaginationItem, { children: page === "..." ? (jsx(PaginationEllipsis, {})) : (jsx(PaginationLink, { onClick: () => table.setPageIndex(page - 1), isActive: currentPage === page, className: "cursor-pointer h-8 w-8", children: page })) }, index))), jsx(PaginationItem, { children: jsx(PaginationNext, { onClick: () => table.nextPage(), disabled: !canNextPage, className: !canNextPage ? "pointer-events-none opacity-50" : "" }) })] }) }) }) }));
25296
+ return (jsx("div", { className: cn$1("data-table-pagination flex w-full flex-col-reverse items-center justify-between overflow-auto sm:flex-row bg-sidebar rounded-2xl p-4 shadow-sm", className), ...props, children: jsx("div", { className: "flex flex-col-reverse items-center gap-4 sm:flex-row sm:gap-6 lg:gap-8", children: jsx(Pagination, { children: jsxs(PaginationContent, { children: [jsx(PaginationItem, { children: jsx(PaginationPrevious, { onClick: () => table.previousPage(), disabled: !canPreviousPage, className: !canPreviousPage ? "pointer-events-none opacity-50" : "" }) }), getPageNumbers().map((page, index) => (jsx(PaginationItem, { children: page === "..." ? (jsx(PaginationEllipsis, {})) : (jsx(PaginationLink, { onClick: () => table.setPageIndex(page - 1), isActive: currentPage === page, className: "cursor-pointer h-8 w-8", children: page })) }, index))), jsx(PaginationItem, { children: jsx(PaginationNext, { onClick: () => table.nextPage(), disabled: !canNextPage, className: !canNextPage ? "pointer-events-none opacity-50" : "" }) })] }) }) }) }));
25256
25297
  }
25257
25298
 
25258
25299
  function DataTable({ table, actionBar, children, className, isLoading = false, isFetching = false, getRowClassName, ...props }) {
@@ -25334,7 +25375,7 @@ function DataTable({ table, actionBar, children, className, isLoading = false, i
25334
25375
  : undefined,
25335
25376
  boxShadow: getCellBoxShadow(cell.column.columnDef.meta?.sticky, cell.column.columnDef.meta?.showLeftDivider),
25336
25377
  }, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
25337
- }) }, row.id)))) : (jsx(TableRow, { children: jsx(TableCell, { colSpan: table.getAllColumns().length, className: "h-24 text-center", children: "No results." }) })) })] }) }), jsxs("div", { className: "flex items-center justify-between", children: [jsx("div", { className: "text-muted-foreground hidden flex-1 text-sm lg:flex" }), jsx("div", { children: !isLoading && jsx(DataTablePagination, { table: table }) })] }), actionBar &&
25378
+ }) }, row.id)))) : (jsx(TableRow, { children: jsx(TableCell, { colSpan: table.getAllColumns().length, className: "h-24 text-center", children: "\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25" }) })) })] }) }), jsxs("div", { className: "flex items-center justify-between", children: [jsx("div", { className: "text-muted-foreground hidden flex-1 text-sm lg:flex" }), jsx("div", { children: !isLoading && jsx(DataTablePagination, { table: table }) })] }), actionBar &&
25338
25379
  table.getFilteredSelectedRowModel().rows.length > 0 &&
25339
25380
  actionBar] }));
25340
25381
  }
@@ -25679,7 +25720,7 @@ function DataTableFacetedFilter({ column, title, options, multiple, }) {
25679
25720
  }
25680
25721
  return title ?? "";
25681
25722
  }, [selectedValues, options, title]);
25682
- return (jsxs(Popover, { open: open, onOpenChange: setOpen, children: [jsx(PopoverTrigger, { asChild: true, children: jsxs("div", { className: "relative", children: [jsx(Input, { readOnly: true, placeholder: placeholderText, className: "pr-8 cursor-pointer" }), jsx(ChevronDown, { className: "absolute right-2 top-1/2 h-4 w-4 -translate-y-1/2 pointer-events-none" })] }) }), jsx(PopoverContent, { className: "w-[12.5rem] p-0", align: "start", children: jsxs(Command, { children: [jsx(CommandInput, { className: "!border-0 !outline-none text-foreground inline", placeholder: title }), jsxs(CommandList, { className: "max-h-full", children: [jsx(CommandEmpty, { children: "No results found." }), jsx(CommandGroup, { className: "max-h-[18.75rem] overflow-y-auto overflow-x-hidden", children: options.map(option => {
25723
+ return (jsxs(Popover, { open: open, onOpenChange: setOpen, children: [jsx(PopoverTrigger, { asChild: true, children: jsxs("div", { className: "relative", children: [jsx(Input, { readOnly: true, placeholder: placeholderText, className: "pr-8 cursor-pointer" }), jsx(ChevronDown, { className: "absolute right-2 top-1/2 h-4 w-4 -translate-y-1/2 pointer-events-none" })] }) }), jsx(PopoverContent, { className: "w-[12.5rem] p-0", align: "start", children: jsxs(Command, { children: [jsx(CommandInput, { className: "!border-0 !outline-none text-foreground inline", placeholder: title }), jsxs(CommandList, { className: "max-h-full", children: [jsx(CommandEmpty, { children: "\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E17\u0E35\u0E48\u0E04\u0E49\u0E19\u0E2B\u0E32" }), jsx(CommandGroup, { className: "max-h-[18.75rem] overflow-y-auto overflow-x-hidden", children: options.map(option => {
25683
25724
  const isSelected = selectedValues.has(option.value);
25684
25725
  return (jsxs(CommandItem, { onSelect: () => onItemSelect(option, isSelected), className: "flex items-center", children: [jsx("div", { className: cn$1("flex size-4 items-center justify-center rounded-sm border border-primary", isSelected
25685
25726
  ? "bg-primary"