@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.
- package/dist/components/ui/select.d.ts +1 -1
- package/dist/index.esm.js +46 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +46 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16031,8 +16031,49 @@ 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
|
-
|
|
16034
|
+
function Select({ onValueChange, onOpenChange, open, defaultOpen, ...props }) {
|
|
16035
|
+
// Tracked in a ref, not state: this only needs to be readable inside the
|
|
16036
|
+
// callback below, and putting it in state would re-render on every open.
|
|
16037
|
+
const isOpenRef = React__namespace.useRef(defaultOpen ?? false);
|
|
16038
|
+
if (open !== undefined)
|
|
16039
|
+
isOpenRef.current = open;
|
|
16040
|
+
return (require$$1.jsx(SelectPrimitive__namespace.Root, { "data-slot": "select", ...props, open: open, defaultOpen: defaultOpen, onOpenChange: next => {
|
|
16041
|
+
isOpenRef.current = next;
|
|
16042
|
+
onOpenChange?.(next);
|
|
16043
|
+
}, onValueChange: value => {
|
|
16044
|
+
// Drop ONLY the empty value Radix echoes back on its own.
|
|
16045
|
+
//
|
|
16046
|
+
// Radix keeps a hidden native <select> so the control works inside
|
|
16047
|
+
// real forms. Whenever the controlled value changes it assigns that
|
|
16048
|
+
// value to the native node and dispatches a synthetic change event,
|
|
16049
|
+
// which comes straight back out through onValueChange:
|
|
16050
|
+
//
|
|
16051
|
+
// setValue.call(select, selectValue);
|
|
16052
|
+
// select.dispatchEvent(new Event("change", { bubbles: true }));
|
|
16053
|
+
// ...
|
|
16054
|
+
// onChange: (event) => onValueChange(event.target.value)
|
|
16055
|
+
//
|
|
16056
|
+
// The native <option> list is registered by SelectItem, and the items
|
|
16057
|
+
// live inside SelectContent — portalled, and only mounted while the
|
|
16058
|
+
// menu is open. On a closed select the option for the incoming value
|
|
16059
|
+
// usually does not exist yet, the DOM refuses the assignment,
|
|
16060
|
+
// `select.value` collapses to "", and that empty string reaches the
|
|
16061
|
+
// consumer. In a form this lands exactly when saved data arrives: the
|
|
16062
|
+
// field is set to its stored value, Radix echoes "", and the handler
|
|
16063
|
+
// writes that back — enum fields then snap to their fallback and zod
|
|
16064
|
+
// rejects the submit with "received ''".
|
|
16065
|
+
//
|
|
16066
|
+
// The open check is what keeps a real "none" option working. Radix
|
|
16067
|
+
// does NOT forbid <SelectItem value="">, and picking one is a
|
|
16068
|
+
// legitimate way to clear a selection. A user pick always arrives
|
|
16069
|
+
// while the menu is still open — SelectItem's handleSelect calls
|
|
16070
|
+
// onValueChange(value) BEFORE onOpenChange(false) — whereas the echo
|
|
16071
|
+
// above fires from an effect with the menu closed. So only the closed
|
|
16072
|
+
// case is suppressed.
|
|
16073
|
+
if (value === "" && !isOpenRef.current)
|
|
16074
|
+
return;
|
|
16075
|
+
onValueChange?.(value);
|
|
16076
|
+
} }));
|
|
16036
16077
|
}
|
|
16037
16078
|
function SelectGroup({ ...props }) {
|
|
16038
16079
|
return require$$1.jsx(SelectPrimitive__namespace.Group, { "data-slot": "select-group", ...props });
|
|
@@ -25297,7 +25338,7 @@ function DataTablePagination({ table, pageSizeOptions = [10, 20, 30, 40, 50], cl
|
|
|
25297
25338
|
}
|
|
25298
25339
|
return pages;
|
|
25299
25340
|
};
|
|
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
|
|
25341
|
+
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
25342
|
}
|
|
25302
25343
|
|
|
25303
25344
|
function DataTable({ table, actionBar, children, className, isLoading = false, isFetching = false, getRowClassName, ...props }) {
|
|
@@ -25379,7 +25420,7 @@ function DataTable({ table, actionBar, children, className, isLoading = false, i
|
|
|
25379
25420
|
: undefined,
|
|
25380
25421
|
boxShadow: getCellBoxShadow(cell.column.columnDef.meta?.sticky, cell.column.columnDef.meta?.showLeftDivider),
|
|
25381
25422
|
}, 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: "
|
|
25423
|
+
}) }, 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
25424
|
table.getFilteredSelectedRowModel().rows.length > 0 &&
|
|
25384
25425
|
actionBar] }));
|
|
25385
25426
|
}
|
|
@@ -25724,7 +25765,7 @@ function DataTableFacetedFilter({ column, title, options, multiple, }) {
|
|
|
25724
25765
|
}
|
|
25725
25766
|
return title ?? "";
|
|
25726
25767
|
}, [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: "
|
|
25768
|
+
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
25769
|
const isSelected = selectedValues.has(option.value);
|
|
25729
25770
|
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
25771
|
? "bg-primary"
|