@eintrek/erp-theme 1.4.4 → 1.4.6

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/dist/index.js CHANGED
@@ -13432,7 +13432,7 @@ function ValidationErrors({ errors, title = "Validation Errors", compact = false
13432
13432
  if (flatErrors.length === 0) {
13433
13433
  return null;
13434
13434
  }
13435
- return (require$$1.jsxs("div", { className: cn$1("rounded-lg border border-destructive/50 bg-destructive/10", "dark:border-destructive/30 dark:bg-destructive/5", className), children: [require$$1.jsxs("div", { className: "flex items-center gap-2 border-b border-destructive/20 px-4 py-3", children: [require$$1.jsx(lucideReact.AlertCircle, { className: "h-5 w-5 text-destructive" }), require$$1.jsxs("h3", { className: "font-semibold text-sm text-destructive", children: [title, require$$1.jsx("span", { className: "ml-2 inline-flex items-center justify-center rounded-full bg-destructive/20 px-2 py-0.5 text-xs font-medium", children: flatErrors.length })] })] }), require$$1.jsx("div", { className: cn$1("p-4", !compact && "space-y-2"), children: require$$1.jsx("ul", { className: cn$1("space-y-2", compact && "space-y-1"), children: flatErrors.map((error, index) => (require$$1.jsxs("li", { className: cn$1("flex items-start gap-2 text-sm", compact ? "text-xs" : "text-sm"), children: [require$$1.jsx("span", { className: "mt-0.5 flex h-1.5 w-1.5 shrink-0 rounded-full bg-destructive" }), require$$1.jsxs("div", { className: "flex-1 min-w-0", children: [require$$1.jsxs("span", { className: "font-medium text-destructive/90", children: [labelTransformer(error.path), ":"] }), " ", require$$1.jsx("span", { className: "text-destructive/80", children: error.message })] })] }, `${error.path}-${index}`))) }) })] }));
13435
+ return (require$$1.jsxs("div", { className: cn$1("rounded-lg border border-destructive/50 bg-destructive/10", "dark:border-destructive/30 dark:bg-destructive/5", className), children: [require$$1.jsxs("div", { className: "flex items-center gap-2 border-b border-destructive/20 px-4 py-3", children: [require$$1.jsx(lucideReact.AlertCircle, { className: "h-5 w-5 text-destructive" }), require$$1.jsxs("h3", { className: "font-semibold text-sm text-destructive", children: [title, require$$1.jsx("span", { className: "ml-2 inline-flex items-center justify-center rounded-full bg-destructive/20 px-2 py-0.5 text-xs font-medium", children: flatErrors.length })] })] }), require$$1.jsx("div", { className: cn$1("p-4", !compact && "space-y-2"), children: require$$1.jsx("ul", { className: cn$1("space-y-2", compact && "space-y-1"), children: flatErrors.map((error, index) => (require$$1.jsxs("li", { className: cn$1("flex items-start gap-2 text-sm", compact ? "text-xs" : "text-sm"), children: [require$$1.jsx("span", { "aria-hidden": "true", className: "mt-2 flex h-1.5 w-1.5 shrink-0 rounded-full bg-destructive" }), require$$1.jsxs("div", { className: "flex-1 min-w-0", children: [require$$1.jsxs("span", { className: "font-medium text-destructive/90", children: [labelTransformer(error.path), ":"] }), " ", require$$1.jsx("span", { className: "text-destructive/80", children: error.message })] })] }, `${error.path}-${index}`))) }) })] }));
13436
13436
  }
13437
13437
 
13438
13438
  function PageHeader({ title, actions }) {
@@ -16031,8 +16031,42 @@ function ScrollBar({ className, orientation = "vertical", ...props }) {
16031
16031
  "h-2.5 flex-col border-t border-t-transparent", className), ...props, children: require$$1.jsx(ScrollAreaPrimitive__namespace.ScrollAreaThumb, { "data-slot": "scroll-area-thumb", className: "bg-border relative flex-1 rounded-full" }) }));
16032
16032
  }
16033
16033
 
16034
- function Select({ ...props }) {
16035
- return require$$1.jsx(SelectPrimitive__namespace.Root, { "data-slot": "select", ...props });
16034
+ function Select({ onValueChange, ...props }) {
16035
+ return (require$$1.jsx(SelectPrimitive__namespace.Root, { "data-slot": "select", ...props, onValueChange: value => {
16036
+ // Swallow the empty value Radix emits on its own.
16037
+ //
16038
+ // Radix keeps a hidden native <select> so the control participates in
16039
+ // real forms. Whenever the controlled value changes it assigns that
16040
+ // value to the native node and dispatches a synthetic change event,
16041
+ // which comes back out through onValueChange:
16042
+ //
16043
+ // setValue.call(select, selectValue);
16044
+ // select.dispatchEvent(new Event("change", { bubbles: true }));
16045
+ // ...
16046
+ // onChange: (event) => onValueChange(event.target.value)
16047
+ //
16048
+ // The native <option> list is registered by SelectItem, and the items
16049
+ // live inside SelectContent — which is portalled and only mounted
16050
+ // while the menu is open. So on a closed select the option for the
16051
+ // incoming value usually does not exist yet, the DOM refuses the
16052
+ // assignment, `select.value` collapses to "", and that empty string is
16053
+ // what every consumer receives.
16054
+ //
16055
+ // In practice this fires exactly when server data lands in a form:
16056
+ // the field is set to the saved value, Radix echoes back "", and the
16057
+ // handler writes it into form state. Fields normalised through an
16058
+ // enum/fallback then snap to their default; fields validated by zod
16059
+ // fail on submit with "received ''".
16060
+ //
16061
+ // A genuine selection can never be empty — that path is
16062
+ // `context.onValueChange(value)` from SelectItem's handleSelect, using
16063
+ // the item's own value — so dropping "" costs nothing. Consumers that
16064
+ // really want a "none" option should give it an explicit sentinel
16065
+ // value; Radix reserves "" for the placeholder.
16066
+ if (value === "")
16067
+ return;
16068
+ onValueChange?.(value);
16069
+ } }));
16036
16070
  }
16037
16071
  function SelectGroup({ ...props }) {
16038
16072
  return require$$1.jsx(SelectPrimitive__namespace.Group, { "data-slot": "select-group", ...props });
@@ -25297,7 +25331,7 @@ function DataTablePagination({ table, pageSizeOptions = [10, 20, 30, 40, 50], cl
25297
25331
  }
25298
25332
  return pages;
25299
25333
  };
25300
- return (require$$1.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: require$$1.jsx("div", { className: "flex flex-col-reverse items-center gap-4 sm:flex-row sm:gap-6 lg:gap-8", children: require$$1.jsx(Pagination, { children: require$$1.jsxs(PaginationContent, { children: [require$$1.jsx(PaginationItem, { children: require$$1.jsx(PaginationPrevious, { onClick: () => table.previousPage(), disabled: !canPreviousPage, className: !canPreviousPage ? "pointer-events-none opacity-50" : "" }) }), getPageNumbers().map((page, index) => (require$$1.jsx(PaginationItem, { children: page === "..." ? (require$$1.jsx(PaginationEllipsis, {})) : (require$$1.jsx(PaginationLink, { onClick: () => table.setPageIndex(page - 1), isActive: currentPage === page, className: "cursor-pointer h-8 w-8", children: page })) }, index))), require$$1.jsx(PaginationItem, { children: require$$1.jsx(PaginationNext, { onClick: () => table.nextPage(), disabled: !canNextPage, className: !canNextPage ? "pointer-events-none opacity-50" : "" }) })] }) }) }) }));
25334
+ return (require$$1.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: require$$1.jsx("div", { className: "flex flex-col-reverse items-center gap-4 sm:flex-row sm:gap-6 lg:gap-8", children: require$$1.jsx(Pagination, { children: require$$1.jsxs(PaginationContent, { children: [require$$1.jsx(PaginationItem, { children: require$$1.jsx(PaginationPrevious, { onClick: () => table.previousPage(), disabled: !canPreviousPage, className: !canPreviousPage ? "pointer-events-none opacity-50" : "" }) }), getPageNumbers().map((page, index) => (require$$1.jsx(PaginationItem, { children: page === "..." ? (require$$1.jsx(PaginationEllipsis, {})) : (require$$1.jsx(PaginationLink, { onClick: () => table.setPageIndex(page - 1), isActive: currentPage === page, className: "cursor-pointer h-8 w-8", children: page })) }, index))), require$$1.jsx(PaginationItem, { children: require$$1.jsx(PaginationNext, { onClick: () => table.nextPage(), disabled: !canNextPage, className: !canNextPage ? "pointer-events-none opacity-50" : "" }) })] }) }) }) }));
25301
25335
  }
25302
25336
 
25303
25337
  function DataTable({ table, actionBar, children, className, isLoading = false, isFetching = false, getRowClassName, ...props }) {
@@ -25379,7 +25413,7 @@ function DataTable({ table, actionBar, children, className, isLoading = false, i
25379
25413
  : undefined,
25380
25414
  boxShadow: getCellBoxShadow(cell.column.columnDef.meta?.sticky, cell.column.columnDef.meta?.showLeftDivider),
25381
25415
  }, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
25382
- }) }, row.id)))) : (require$$1.jsx(TableRow, { children: require$$1.jsx(TableCell, { colSpan: table.getAllColumns().length, className: "h-24 text-center", children: "No results." }) })) })] }) }), require$$1.jsxs("div", { className: "flex items-center justify-between", children: [require$$1.jsx("div", { className: "text-muted-foreground hidden flex-1 text-sm lg:flex" }), require$$1.jsx("div", { children: !isLoading && require$$1.jsx(DataTablePagination, { table: table }) })] }), actionBar &&
25416
+ }) }, row.id)))) : (require$$1.jsx(TableRow, { children: require$$1.jsx(TableCell, { colSpan: table.getAllColumns().length, className: "h-24 text-center", children: "\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25" }) })) })] }) }), require$$1.jsxs("div", { className: "flex items-center justify-between", children: [require$$1.jsx("div", { className: "text-muted-foreground hidden flex-1 text-sm lg:flex" }), require$$1.jsx("div", { children: !isLoading && require$$1.jsx(DataTablePagination, { table: table }) })] }), actionBar &&
25383
25417
  table.getFilteredSelectedRowModel().rows.length > 0 &&
25384
25418
  actionBar] }));
25385
25419
  }
@@ -25724,7 +25758,7 @@ function DataTableFacetedFilter({ column, title, options, multiple, }) {
25724
25758
  }
25725
25759
  return title ?? "";
25726
25760
  }, [selectedValues, options, title]);
25727
- return (require$$1.jsxs(Popover, { open: open, onOpenChange: setOpen, children: [require$$1.jsx(PopoverTrigger, { asChild: true, children: require$$1.jsxs("div", { className: "relative", children: [require$$1.jsx(Input, { readOnly: true, placeholder: placeholderText, className: "pr-8 cursor-pointer" }), require$$1.jsx(lucideReact.ChevronDown, { className: "absolute right-2 top-1/2 h-4 w-4 -translate-y-1/2 pointer-events-none" })] }) }), require$$1.jsx(PopoverContent, { className: "w-[12.5rem] p-0", align: "start", children: require$$1.jsxs(Command, { children: [require$$1.jsx(CommandInput, { className: "!border-0 !outline-none text-foreground inline", placeholder: title }), require$$1.jsxs(CommandList, { className: "max-h-full", children: [require$$1.jsx(CommandEmpty, { children: "No results found." }), require$$1.jsx(CommandGroup, { className: "max-h-[18.75rem] overflow-y-auto overflow-x-hidden", children: options.map(option => {
25761
+ return (require$$1.jsxs(Popover, { open: open, onOpenChange: setOpen, children: [require$$1.jsx(PopoverTrigger, { asChild: true, children: require$$1.jsxs("div", { className: "relative", children: [require$$1.jsx(Input, { readOnly: true, placeholder: placeholderText, className: "pr-8 cursor-pointer" }), require$$1.jsx(lucideReact.ChevronDown, { className: "absolute right-2 top-1/2 h-4 w-4 -translate-y-1/2 pointer-events-none" })] }) }), require$$1.jsx(PopoverContent, { className: "w-[12.5rem] p-0", align: "start", children: require$$1.jsxs(Command, { children: [require$$1.jsx(CommandInput, { className: "!border-0 !outline-none text-foreground inline", placeholder: title }), require$$1.jsxs(CommandList, { className: "max-h-full", children: [require$$1.jsx(CommandEmpty, { children: "\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E17\u0E35\u0E48\u0E04\u0E49\u0E19\u0E2B\u0E32" }), require$$1.jsx(CommandGroup, { className: "max-h-[18.75rem] overflow-y-auto overflow-x-hidden", children: options.map(option => {
25728
25762
  const isSelected = selectedValues.has(option.value);
25729
25763
  return (require$$1.jsxs(CommandItem, { onSelect: () => onItemSelect(option, isSelected), className: "flex items-center", children: [require$$1.jsx("div", { className: cn$1("flex size-4 items-center justify-center rounded-sm border border-primary", isSelected
25730
25764
  ? "bg-primary"