@eintrek/erp-theme 1.4.5 → 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/components/ui/select.d.ts +1 -1
- package/dist/index.esm.js +39 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +39 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -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, ...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,42 @@ 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, ...props }) {
|
|
15990
|
+
return (jsx(SelectPrimitive.Root, { "data-slot": "select", ...props, onValueChange: value => {
|
|
15991
|
+
// Swallow the empty value Radix emits on its own.
|
|
15992
|
+
//
|
|
15993
|
+
// Radix keeps a hidden native <select> so the control participates in
|
|
15994
|
+
// real forms. Whenever the controlled value changes it assigns that
|
|
15995
|
+
// value to the native node and dispatches a synthetic change event,
|
|
15996
|
+
// which comes back out through onValueChange:
|
|
15997
|
+
//
|
|
15998
|
+
// setValue.call(select, selectValue);
|
|
15999
|
+
// select.dispatchEvent(new Event("change", { bubbles: true }));
|
|
16000
|
+
// ...
|
|
16001
|
+
// onChange: (event) => onValueChange(event.target.value)
|
|
16002
|
+
//
|
|
16003
|
+
// The native <option> list is registered by SelectItem, and the items
|
|
16004
|
+
// live inside SelectContent — which is portalled and only mounted
|
|
16005
|
+
// while the menu is open. So on a closed select the option for the
|
|
16006
|
+
// incoming value usually does not exist yet, the DOM refuses the
|
|
16007
|
+
// assignment, `select.value` collapses to "", and that empty string is
|
|
16008
|
+
// what every consumer receives.
|
|
16009
|
+
//
|
|
16010
|
+
// In practice this fires exactly when server data lands in a form:
|
|
16011
|
+
// the field is set to the saved value, Radix echoes back "", and the
|
|
16012
|
+
// handler writes it into form state. Fields normalised through an
|
|
16013
|
+
// enum/fallback then snap to their default; fields validated by zod
|
|
16014
|
+
// fail on submit with "received ''".
|
|
16015
|
+
//
|
|
16016
|
+
// A genuine selection can never be empty — that path is
|
|
16017
|
+
// `context.onValueChange(value)` from SelectItem's handleSelect, using
|
|
16018
|
+
// the item's own value — so dropping "" costs nothing. Consumers that
|
|
16019
|
+
// really want a "none" option should give it an explicit sentinel
|
|
16020
|
+
// value; Radix reserves "" for the placeholder.
|
|
16021
|
+
if (value === "")
|
|
16022
|
+
return;
|
|
16023
|
+
onValueChange?.(value);
|
|
16024
|
+
} }));
|
|
15991
16025
|
}
|
|
15992
16026
|
function SelectGroup({ ...props }) {
|
|
15993
16027
|
return jsx(SelectPrimitive.Group, { "data-slot": "select-group", ...props });
|
|
@@ -25252,7 +25286,7 @@ function DataTablePagination({ table, pageSizeOptions = [10, 20, 30, 40, 50], cl
|
|
|
25252
25286
|
}
|
|
25253
25287
|
return pages;
|
|
25254
25288
|
};
|
|
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
|
|
25289
|
+
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
25290
|
}
|
|
25257
25291
|
|
|
25258
25292
|
function DataTable({ table, actionBar, children, className, isLoading = false, isFetching = false, getRowClassName, ...props }) {
|
|
@@ -25334,7 +25368,7 @@ function DataTable({ table, actionBar, children, className, isLoading = false, i
|
|
|
25334
25368
|
: undefined,
|
|
25335
25369
|
boxShadow: getCellBoxShadow(cell.column.columnDef.meta?.sticky, cell.column.columnDef.meta?.showLeftDivider),
|
|
25336
25370
|
}, 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: "
|
|
25371
|
+
}) }, 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
25372
|
table.getFilteredSelectedRowModel().rows.length > 0 &&
|
|
25339
25373
|
actionBar] }));
|
|
25340
25374
|
}
|
|
@@ -25679,7 +25713,7 @@ function DataTableFacetedFilter({ column, title, options, multiple, }) {
|
|
|
25679
25713
|
}
|
|
25680
25714
|
return title ?? "";
|
|
25681
25715
|
}, [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: "
|
|
25716
|
+
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
25717
|
const isSelected = selectedValues.has(option.value);
|
|
25684
25718
|
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
25719
|
? "bg-primary"
|