@dimaan/ui 0.0.20 → 0.0.22
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.cjs +479 -193
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +367 -244
- package/dist/index.d.ts +367 -244
- package/dist/index.js +471 -195
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { forwardRef, Children, isValidElement, cloneElement, createContext, useR
|
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
|
-
import { Loader2, Check, Minus, Calendar, X, ChevronLeft, ChevronRight, ChevronDown, ChevronUp, ArrowLeft, Menu, FileQuestion, ChevronsUpDown,
|
|
6
|
+
import { Loader2, Check, Minus, Calendar, X, ChevronLeft, ChevronRight, ChevronDown, Search, ChevronUp, ArrowLeft, Menu, FileQuestion, ChevronsUpDown, Inbox, RefreshCw, SearchX } from 'lucide-react';
|
|
7
7
|
import { DirectionProvider } from '@radix-ui/react-direction';
|
|
8
8
|
import { Link, useLocation, useResolvedPath, useNavigate } from 'react-router-dom';
|
|
9
9
|
import * as RadixPopover from '@radix-ui/react-popover';
|
|
@@ -728,7 +728,6 @@ function SidebarNavItem({
|
|
|
728
728
|
}
|
|
729
729
|
);
|
|
730
730
|
}
|
|
731
|
-
console.log("AppShell");
|
|
732
731
|
function isGroup(entry) {
|
|
733
732
|
return "items" in entry && Array.isArray(entry.items);
|
|
734
733
|
}
|
|
@@ -1348,15 +1347,20 @@ var detailPageBaseClass = "flex w-full flex-col gap-6";
|
|
|
1348
1347
|
var detailPageBodyClass = "flex flex-col gap-6";
|
|
1349
1348
|
var detailPageSkeletonRowClass = "h-5 w-full animate-pulse rounded-md bg-muted";
|
|
1350
1349
|
var detailPageEmptyClass = "rounded-md border border-border bg-card";
|
|
1351
|
-
var
|
|
1350
|
+
var DEFAULT_LABELS_LTR = {
|
|
1351
|
+
back: "Back",
|
|
1352
1352
|
notFoundTitle: "Not found",
|
|
1353
1353
|
notFoundDescription: "The record you\u2019re looking for does not exist or has been removed."
|
|
1354
1354
|
};
|
|
1355
|
+
var DEFAULT_LABELS_RTL = {
|
|
1356
|
+
back: "\u0631\u062C\u0648\u0639",
|
|
1357
|
+
notFoundTitle: "\u063A\u064A\u0631 \u0645\u0648\u062C\u0648\u062F",
|
|
1358
|
+
notFoundDescription: "\u0627\u0644\u0633\u062C\u0644 \u0627\u0644\u0630\u064A \u062A\u0628\u062D\u062B \u0639\u0646\u0647 \u063A\u064A\u0631 \u0645\u0648\u062C\u0648\u062F \u0623\u0648 \u062A\u0645 \u062D\u0630\u0641\u0647."
|
|
1359
|
+
};
|
|
1355
1360
|
var DEFAULT_SKELETON_ROW_COUNT = 6;
|
|
1356
1361
|
function DetailPage({
|
|
1357
1362
|
title,
|
|
1358
1363
|
description,
|
|
1359
|
-
back,
|
|
1360
1364
|
actions,
|
|
1361
1365
|
bordered = true,
|
|
1362
1366
|
isLoading = false,
|
|
@@ -1368,7 +1372,10 @@ function DetailPage({
|
|
|
1368
1372
|
className,
|
|
1369
1373
|
bodyClassName
|
|
1370
1374
|
}) {
|
|
1371
|
-
const
|
|
1375
|
+
const navigate = useNavigate();
|
|
1376
|
+
const dir = useDirection();
|
|
1377
|
+
const defaults = dir === "rtl" ? DEFAULT_LABELS_RTL : DEFAULT_LABELS_LTR;
|
|
1378
|
+
const labels = { ...defaults, ...labelsProp };
|
|
1372
1379
|
return /* @__PURE__ */ jsxs(
|
|
1373
1380
|
"div",
|
|
1374
1381
|
{
|
|
@@ -1382,7 +1389,7 @@ function DetailPage({
|
|
|
1382
1389
|
{
|
|
1383
1390
|
title,
|
|
1384
1391
|
description,
|
|
1385
|
-
back,
|
|
1392
|
+
back: { label: labels.back, onClick: () => navigate(-1) },
|
|
1386
1393
|
actions,
|
|
1387
1394
|
bordered
|
|
1388
1395
|
}
|
|
@@ -1696,13 +1703,13 @@ var formPageBodyClass = "flex-1";
|
|
|
1696
1703
|
var formPageActionsBarClass = "sticky bottom-0 -mx-6 -mb-6 mt-6 flex items-center justify-end gap-2 border-t border-border bg-background/95 px-6 py-3 backdrop-blur supports-[backdrop-filter]:bg-background/80";
|
|
1697
1704
|
var formPageSkeletonRowClass = "h-10 w-full animate-pulse rounded-md bg-muted";
|
|
1698
1705
|
var DEFAULT_SKELETON_ROW_COUNT2 = 6;
|
|
1699
|
-
var
|
|
1706
|
+
var DEFAULT_LABELS_LTR2 = {
|
|
1700
1707
|
back: "Back",
|
|
1701
1708
|
cancel: "Cancel",
|
|
1702
1709
|
save: "Save",
|
|
1703
1710
|
saving: "Saving\u2026"
|
|
1704
1711
|
};
|
|
1705
|
-
var
|
|
1712
|
+
var DEFAULT_LABELS_RTL2 = {
|
|
1706
1713
|
back: "\u0631\u062C\u0648\u0639",
|
|
1707
1714
|
cancel: "\u0625\u0644\u063A\u0627\u0621",
|
|
1708
1715
|
save: "\u062D\u0641\u0638",
|
|
@@ -1729,7 +1736,7 @@ function FormPage({
|
|
|
1729
1736
|
const dir = useDirection();
|
|
1730
1737
|
const formContext = useFormContext();
|
|
1731
1738
|
const submitting = isSubmitting ?? formContext?.formState?.isSubmitting ?? false;
|
|
1732
|
-
const defaults = dir === "rtl" ?
|
|
1739
|
+
const defaults = dir === "rtl" ? DEFAULT_LABELS_RTL2 : DEFAULT_LABELS_LTR2;
|
|
1733
1740
|
const labels = { ...defaults, ...labelsProp };
|
|
1734
1741
|
const goBack = () => navigate(-1);
|
|
1735
1742
|
return /* @__PURE__ */ jsxs("div", { "data-slot": "form-page", className: cn(formPageBaseClass, className), children: [
|
|
@@ -1897,132 +1904,6 @@ function LanguageSwitcher({
|
|
|
1897
1904
|
}
|
|
1898
1905
|
);
|
|
1899
1906
|
}
|
|
1900
|
-
|
|
1901
|
-
// src/components/select/selectVariants.ts
|
|
1902
|
-
var selectVariantClass = {
|
|
1903
|
-
default: "border border-input bg-background hover:border-ring",
|
|
1904
|
-
filled: "border border-transparent bg-muted hover:bg-muted/80",
|
|
1905
|
-
ghost: "border border-transparent bg-transparent hover:bg-accent"
|
|
1906
|
-
};
|
|
1907
|
-
var selectSizeClass = {
|
|
1908
|
-
sm: "h-8 rounded-md ps-2.5 pe-8 text-sm",
|
|
1909
|
-
md: "h-9 rounded-md ps-3 pe-9 text-sm",
|
|
1910
|
-
lg: "h-11 rounded-md ps-4 pe-10 text-base"
|
|
1911
|
-
};
|
|
1912
|
-
var selectBaseClass = "group/select relative inline-flex w-full items-center text-foreground outline-none transition-[background-color,border-color,box-shadow] focus:ring-2 focus:ring-ring/40 focus:ring-offset-1 focus:ring-offset-background aria-[invalid=true]:border-destructive aria-[invalid=true]:focus:ring-destructive/40 disabled:pointer-events-none disabled:opacity-50 cursor-pointer data-[placeholder]:text-muted-foreground";
|
|
1913
|
-
var selectContentClass = "z-50 max-h-(--radix-select-content-available-height) min-w-(--radix-select-trigger-width) overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95";
|
|
1914
|
-
var selectViewportClass = "p-1";
|
|
1915
|
-
var selectItemClass = "relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 ps-8 pe-2 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
|
|
1916
|
-
var selectItemIndicatorClass = "absolute start-2 inline-flex h-3.5 w-3.5 items-center justify-center [&_svg]:h-3.5 [&_svg]:w-3.5";
|
|
1917
|
-
var selectGroupLabelClass = "px-2 py-1.5 text-xs font-semibold text-muted-foreground";
|
|
1918
|
-
var selectSeparatorClass = "-mx-1 my-1 h-px bg-border";
|
|
1919
|
-
function isGroupedOptions(options) {
|
|
1920
|
-
const first = options[0];
|
|
1921
|
-
return first !== void 0 && "options" in first;
|
|
1922
|
-
}
|
|
1923
|
-
var Select = forwardRef(function Select2({
|
|
1924
|
-
variant = "default",
|
|
1925
|
-
selectSize = "md",
|
|
1926
|
-
options,
|
|
1927
|
-
placeholder,
|
|
1928
|
-
value,
|
|
1929
|
-
defaultValue,
|
|
1930
|
-
onValueChange,
|
|
1931
|
-
onChange,
|
|
1932
|
-
onBlur,
|
|
1933
|
-
name,
|
|
1934
|
-
disabled,
|
|
1935
|
-
required,
|
|
1936
|
-
id,
|
|
1937
|
-
className,
|
|
1938
|
-
"aria-invalid": ariaInvalid,
|
|
1939
|
-
"aria-describedby": ariaDescribedBy,
|
|
1940
|
-
"aria-label": ariaLabel,
|
|
1941
|
-
children
|
|
1942
|
-
}, ref) {
|
|
1943
|
-
const generatedId = useId();
|
|
1944
|
-
const triggerId = id ?? generatedId;
|
|
1945
|
-
const handleValueChange = useCallback(
|
|
1946
|
-
(next) => {
|
|
1947
|
-
onValueChange?.(next);
|
|
1948
|
-
if (onChange) {
|
|
1949
|
-
const synthetic = {
|
|
1950
|
-
target: { value: next, name },
|
|
1951
|
-
currentTarget: { value: next, name },
|
|
1952
|
-
type: "change"
|
|
1953
|
-
};
|
|
1954
|
-
onChange(synthetic);
|
|
1955
|
-
}
|
|
1956
|
-
},
|
|
1957
|
-
[onValueChange, onChange, name]
|
|
1958
|
-
);
|
|
1959
|
-
return /* @__PURE__ */ jsxs(
|
|
1960
|
-
RadixSelect.Root,
|
|
1961
|
-
{
|
|
1962
|
-
value,
|
|
1963
|
-
defaultValue,
|
|
1964
|
-
onValueChange: handleValueChange,
|
|
1965
|
-
disabled,
|
|
1966
|
-
required,
|
|
1967
|
-
name,
|
|
1968
|
-
children: [
|
|
1969
|
-
/* @__PURE__ */ jsxs(
|
|
1970
|
-
RadixSelect.Trigger,
|
|
1971
|
-
{
|
|
1972
|
-
ref,
|
|
1973
|
-
id: triggerId,
|
|
1974
|
-
"aria-label": ariaLabel,
|
|
1975
|
-
"aria-invalid": ariaInvalid,
|
|
1976
|
-
"aria-describedby": ariaDescribedBy,
|
|
1977
|
-
onBlur,
|
|
1978
|
-
"data-slot": "select-trigger",
|
|
1979
|
-
className: cn(
|
|
1980
|
-
selectBaseClass,
|
|
1981
|
-
selectVariantClass[variant],
|
|
1982
|
-
selectSizeClass[selectSize],
|
|
1983
|
-
className
|
|
1984
|
-
),
|
|
1985
|
-
children: [
|
|
1986
|
-
/* @__PURE__ */ jsx(RadixSelect.Value, { placeholder }),
|
|
1987
|
-
/* @__PURE__ */ jsx(RadixSelect.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDown, { className: "pointer-events-none absolute end-3 top-1/2 size-4 shrink-0 -translate-y-1/2 text-muted-foreground" }) })
|
|
1988
|
-
]
|
|
1989
|
-
}
|
|
1990
|
-
),
|
|
1991
|
-
/* @__PURE__ */ jsx(RadixSelect.Portal, { children: /* @__PURE__ */ jsxs(
|
|
1992
|
-
RadixSelect.Content,
|
|
1993
|
-
{
|
|
1994
|
-
position: "popper",
|
|
1995
|
-
sideOffset: 4,
|
|
1996
|
-
"data-slot": "select-content",
|
|
1997
|
-
className: selectContentClass,
|
|
1998
|
-
children: [
|
|
1999
|
-
/* @__PURE__ */ jsx(RadixSelect.ScrollUpButton, { className: "flex h-6 cursor-default items-center justify-center bg-popover text-muted-foreground", children: /* @__PURE__ */ jsx(ChevronUp, { className: "size-4" }) }),
|
|
2000
|
-
/* @__PURE__ */ jsx(RadixSelect.Viewport, { className: selectViewportClass, children: children ?? (options ? renderOptions(options) : null) }),
|
|
2001
|
-
/* @__PURE__ */ jsx(RadixSelect.ScrollDownButton, { className: "flex h-6 cursor-default items-center justify-center bg-popover text-muted-foreground", children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-4" }) })
|
|
2002
|
-
]
|
|
2003
|
-
}
|
|
2004
|
-
) })
|
|
2005
|
-
]
|
|
2006
|
-
}
|
|
2007
|
-
);
|
|
2008
|
-
});
|
|
2009
|
-
function renderOptions(options) {
|
|
2010
|
-
if (isGroupedOptions(options)) {
|
|
2011
|
-
const lastIndex = options.length - 1;
|
|
2012
|
-
return options.map((group, idx) => /* @__PURE__ */ jsxs(RadixSelect.Group, { children: [
|
|
2013
|
-
/* @__PURE__ */ jsx(RadixSelect.Label, { className: selectGroupLabelClass, children: group.label }),
|
|
2014
|
-
group.options.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value)),
|
|
2015
|
-
idx < lastIndex && /* @__PURE__ */ jsx(RadixSelect.Separator, { className: selectSeparatorClass })
|
|
2016
|
-
] }, group.label));
|
|
2017
|
-
}
|
|
2018
|
-
return options.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value));
|
|
2019
|
-
}
|
|
2020
|
-
var SelectItem = forwardRef(function SelectItem2({ className, children, ...props }, ref) {
|
|
2021
|
-
return /* @__PURE__ */ jsxs(RadixSelect.Item, { ref, className: cn(selectItemClass, className), ...props, children: [
|
|
2022
|
-
/* @__PURE__ */ jsx(RadixSelect.ItemIndicator, { className: selectItemIndicatorClass, children: /* @__PURE__ */ jsx(Check, {}) }),
|
|
2023
|
-
/* @__PURE__ */ jsx(RadixSelect.ItemText, { children })
|
|
2024
|
-
] });
|
|
2025
|
-
});
|
|
2026
1907
|
var EN_LABELS = {
|
|
2027
1908
|
rowsPerPage: "Rows per page",
|
|
2028
1909
|
pageRangeOf: "of",
|
|
@@ -2146,17 +2027,17 @@ var tableSizeClass = {
|
|
|
2146
2027
|
sm: {
|
|
2147
2028
|
row: "",
|
|
2148
2029
|
cell: "px-3 py-1.5 text-xs",
|
|
2149
|
-
head: "px-3 py-2 text-xs font-medium"
|
|
2030
|
+
head: "whitespace-nowrap px-3 py-2 text-xs font-medium"
|
|
2150
2031
|
},
|
|
2151
2032
|
md: {
|
|
2152
2033
|
row: "",
|
|
2153
2034
|
cell: "px-4 py-2.5 text-sm",
|
|
2154
|
-
head: "px-4 py-2.5 text-xs font-medium uppercase tracking-wide"
|
|
2035
|
+
head: "whitespace-nowrap px-4 py-2.5 text-xs font-medium uppercase tracking-wide"
|
|
2155
2036
|
},
|
|
2156
2037
|
lg: {
|
|
2157
2038
|
row: "",
|
|
2158
2039
|
cell: "px-5 py-3.5 text-sm",
|
|
2159
|
-
head: "px-5 py-3 text-sm font-medium"
|
|
2040
|
+
head: "whitespace-nowrap px-5 py-3 text-sm font-medium"
|
|
2160
2041
|
}
|
|
2161
2042
|
};
|
|
2162
2043
|
var tableBaseClass = "w-full caption-bottom border-collapse";
|
|
@@ -2474,20 +2355,446 @@ function SortIndicator({ active, direction }) {
|
|
|
2474
2355
|
if (!active) return /* @__PURE__ */ jsx(ChevronsUpDown, { "aria-hidden": "true", className });
|
|
2475
2356
|
return direction === "asc" ? /* @__PURE__ */ jsx(ChevronUp, { "aria-hidden": "true", className }) : /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": "true", className });
|
|
2476
2357
|
}
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2358
|
+
|
|
2359
|
+
// src/components/select/selectVariants.ts
|
|
2360
|
+
var selectVariantClass = {
|
|
2361
|
+
default: "border border-input bg-background hover:border-ring",
|
|
2362
|
+
filled: "border border-transparent bg-muted hover:bg-muted/80",
|
|
2363
|
+
ghost: "border border-transparent bg-transparent hover:bg-accent"
|
|
2364
|
+
};
|
|
2365
|
+
var selectSizeClass = {
|
|
2366
|
+
sm: "h-8 rounded-md ps-2.5 pe-8 text-sm",
|
|
2367
|
+
md: "h-9 rounded-md ps-3 pe-9 text-sm",
|
|
2368
|
+
lg: "h-11 rounded-md ps-4 pe-10 text-base"
|
|
2369
|
+
};
|
|
2370
|
+
var selectBaseClass = "group/select relative inline-flex w-full items-center text-foreground outline-none transition-[background-color,border-color,box-shadow] focus:ring-2 focus:ring-ring/40 focus:ring-offset-1 focus:ring-offset-background aria-[invalid=true]:border-destructive aria-[invalid=true]:focus:ring-destructive/40 disabled:pointer-events-none disabled:opacity-50 cursor-pointer data-[placeholder]:text-muted-foreground";
|
|
2371
|
+
var selectContentClass = "z-50 max-h-(--radix-select-content-available-height) min-w-(--radix-select-trigger-width) overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95";
|
|
2372
|
+
var selectViewportClass = "p-1";
|
|
2373
|
+
var selectItemClass = "relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 ps-8 pe-2 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
|
|
2374
|
+
var selectItemIndicatorClass = "absolute start-2 inline-flex h-3.5 w-3.5 items-center justify-center [&_svg]:h-3.5 [&_svg]:w-3.5";
|
|
2375
|
+
var selectGroupLabelClass = "px-2 py-1.5 text-xs font-semibold text-muted-foreground";
|
|
2376
|
+
var selectSeparatorClass = "-mx-1 my-1 h-px bg-border";
|
|
2377
|
+
|
|
2378
|
+
// src/components/multi-select/multiSelectVariants.ts
|
|
2379
|
+
var multiSelectTriggerSizeClass = {
|
|
2380
|
+
sm: "min-h-8 rounded-md ps-2.5 pe-8 py-1 text-sm",
|
|
2381
|
+
md: "min-h-9 rounded-md ps-3 pe-9 py-1 text-sm",
|
|
2382
|
+
lg: "min-h-11 rounded-md ps-4 pe-10 py-1.5 text-base"
|
|
2383
|
+
};
|
|
2384
|
+
var multiSelectValueRowClass = "flex min-w-0 flex-1 flex-wrap items-center gap-1";
|
|
2385
|
+
var multiSelectChipClass = "max-w-full gap-1 pe-1";
|
|
2386
|
+
var multiSelectChipRemoveClass = "inline-flex size-3.5 shrink-0 items-center justify-center rounded-sm hover:bg-foreground/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40";
|
|
2387
|
+
var multiSelectContentClass = "z-50 w-(--radix-popover-trigger-width) overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95";
|
|
2388
|
+
var multiSelectSearchRowClass = "border-b border-border p-1";
|
|
2389
|
+
var multiSelectListClass = "max-h-60 overflow-y-auto overflow-x-hidden p-1";
|
|
2390
|
+
var multiSelectOptionClass = "flex w-full cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground has-[:focus-visible]:bg-accent has-[:disabled]:pointer-events-none has-[:disabled]:opacity-50";
|
|
2391
|
+
var multiSelectEmptyClass = "px-2 py-6 text-center text-sm text-muted-foreground";
|
|
2392
|
+
var DEFAULT_LABELS_LTR3 = {
|
|
2393
|
+
search: "Search\u2026",
|
|
2394
|
+
empty: "No results"
|
|
2395
|
+
};
|
|
2396
|
+
var DEFAULT_LABELS_RTL3 = {
|
|
2397
|
+
search: "\u0628\u062D\u062B\u2026",
|
|
2398
|
+
empty: "\u0644\u0627 \u0646\u062A\u0627\u0626\u062C"
|
|
2399
|
+
};
|
|
2400
|
+
function toArray(value) {
|
|
2401
|
+
return Array.isArray(value) ? value : [];
|
|
2402
|
+
}
|
|
2403
|
+
var MultiSelect = forwardRef(function MultiSelect2({
|
|
2404
|
+
variant = "default",
|
|
2405
|
+
selectSize = "md",
|
|
2406
|
+
options,
|
|
2407
|
+
placeholder,
|
|
2408
|
+
value,
|
|
2409
|
+
defaultValue,
|
|
2410
|
+
onValueChange,
|
|
2411
|
+
onChange,
|
|
2412
|
+
onBlur,
|
|
2413
|
+
searchable = true,
|
|
2414
|
+
maxTagCount,
|
|
2415
|
+
labels: labelsProp,
|
|
2416
|
+
name,
|
|
2417
|
+
disabled = false,
|
|
2418
|
+
required,
|
|
2419
|
+
id,
|
|
2420
|
+
className,
|
|
2421
|
+
contentClassName,
|
|
2422
|
+
"aria-invalid": ariaInvalid,
|
|
2423
|
+
"aria-describedby": ariaDescribedBy,
|
|
2424
|
+
"aria-label": ariaLabel
|
|
2425
|
+
}, ref) {
|
|
2426
|
+
const dir = useDirection();
|
|
2427
|
+
const labels = { ...dir === "rtl" ? DEFAULT_LABELS_RTL3 : DEFAULT_LABELS_LTR3, ...labelsProp };
|
|
2428
|
+
const generatedId = useId();
|
|
2429
|
+
const triggerId = id ?? generatedId;
|
|
2430
|
+
const isControlled = value !== void 0;
|
|
2431
|
+
const [internal, setInternal] = useState(() => toArray(defaultValue));
|
|
2432
|
+
const selected = isControlled ? toArray(value) : internal;
|
|
2433
|
+
const [open, setOpen] = useState(false);
|
|
2434
|
+
const [query, setQuery] = useState("");
|
|
2435
|
+
const labelByValue = useMemo(() => new Map(options.map((o) => [o.value, o.label])), [options]);
|
|
2436
|
+
const filtered = useMemo(() => {
|
|
2437
|
+
const q = query.trim().toLowerCase();
|
|
2438
|
+
if (!searchable || q === "") return options;
|
|
2439
|
+
return options.filter((o) => o.label.toLowerCase().includes(q));
|
|
2440
|
+
}, [options, query, searchable]);
|
|
2441
|
+
const emit = (next) => {
|
|
2442
|
+
if (!isControlled) setInternal(next);
|
|
2443
|
+
onValueChange?.(next);
|
|
2444
|
+
onChange?.(next);
|
|
2445
|
+
};
|
|
2446
|
+
const toggle = (optionValue) => {
|
|
2447
|
+
emit(
|
|
2448
|
+
selected.includes(optionValue) ? selected.filter((v) => v !== optionValue) : [...selected, optionValue]
|
|
2449
|
+
);
|
|
2450
|
+
};
|
|
2451
|
+
const remove = (optionValue) => emit(selected.filter((v) => v !== optionValue));
|
|
2452
|
+
const openOnKeys = (event) => {
|
|
2453
|
+
if (disabled) return;
|
|
2454
|
+
if (event.key === "Enter" || event.key === " " || event.key === "ArrowDown") {
|
|
2455
|
+
event.preventDefault();
|
|
2456
|
+
setOpen(true);
|
|
2457
|
+
}
|
|
2458
|
+
};
|
|
2459
|
+
const shownValues = maxTagCount !== void 0 ? selected.slice(0, maxTagCount) : selected;
|
|
2460
|
+
const overflowCount = selected.length - shownValues.length;
|
|
2461
|
+
return /* @__PURE__ */ jsxs(RadixPopover.Root, { open, onOpenChange: setOpen, children: [
|
|
2462
|
+
/* @__PURE__ */ jsx(RadixPopover.Anchor, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
2463
|
+
"div",
|
|
2464
|
+
{
|
|
2465
|
+
ref,
|
|
2466
|
+
id: triggerId,
|
|
2467
|
+
role: "button",
|
|
2468
|
+
tabIndex: disabled ? -1 : 0,
|
|
2469
|
+
"aria-haspopup": "listbox",
|
|
2470
|
+
"aria-expanded": open,
|
|
2471
|
+
"aria-disabled": disabled || void 0,
|
|
2472
|
+
"aria-label": ariaLabel,
|
|
2473
|
+
"aria-invalid": ariaInvalid,
|
|
2474
|
+
"aria-describedby": ariaDescribedBy,
|
|
2475
|
+
"data-slot": "multi-select-trigger",
|
|
2476
|
+
"data-state": open ? "open" : "closed",
|
|
2477
|
+
"data-placeholder": selected.length === 0 ? "" : void 0,
|
|
2478
|
+
onClick: () => !disabled && setOpen(true),
|
|
2479
|
+
onKeyDown: openOnKeys,
|
|
2480
|
+
onBlur,
|
|
2481
|
+
className: cn(
|
|
2482
|
+
selectBaseClass,
|
|
2483
|
+
selectVariantClass[variant],
|
|
2484
|
+
multiSelectTriggerSizeClass[selectSize],
|
|
2485
|
+
className
|
|
2486
|
+
),
|
|
2487
|
+
children: [
|
|
2488
|
+
/* @__PURE__ */ jsx("span", { className: multiSelectValueRowClass, children: selected.length === 0 ? /* @__PURE__ */ jsx("span", { className: "truncate text-muted-foreground", children: placeholder }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2489
|
+
shownValues.map((v) => /* @__PURE__ */ jsxs(Badge, { variant: "default", size: "sm", className: multiSelectChipClass, children: [
|
|
2490
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: labelByValue.get(v) ?? v }),
|
|
2491
|
+
/* @__PURE__ */ jsx(
|
|
2492
|
+
"button",
|
|
2493
|
+
{
|
|
2494
|
+
type: "button",
|
|
2495
|
+
tabIndex: -1,
|
|
2496
|
+
"aria-label": `Remove ${labelByValue.get(v) ?? v}`,
|
|
2497
|
+
"data-slot": "multi-select-chip-remove",
|
|
2498
|
+
className: multiSelectChipRemoveClass,
|
|
2499
|
+
onClick: (event) => {
|
|
2500
|
+
event.stopPropagation();
|
|
2501
|
+
if (!disabled) remove(v);
|
|
2502
|
+
},
|
|
2503
|
+
children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true", className: "size-3" })
|
|
2504
|
+
}
|
|
2505
|
+
)
|
|
2506
|
+
] }, v)),
|
|
2507
|
+
overflowCount > 0 ? /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: `+${overflowCount}` }) : null
|
|
2508
|
+
] }) }),
|
|
2509
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "pointer-events-none absolute end-3 top-1/2 size-4 shrink-0 -translate-y-1/2 text-muted-foreground" }),
|
|
2510
|
+
name ? /* @__PURE__ */ jsx(
|
|
2511
|
+
"input",
|
|
2512
|
+
{
|
|
2513
|
+
type: "hidden",
|
|
2514
|
+
name,
|
|
2515
|
+
value: selected.join(","),
|
|
2516
|
+
required,
|
|
2517
|
+
readOnly: true
|
|
2518
|
+
}
|
|
2519
|
+
) : null
|
|
2520
|
+
]
|
|
2521
|
+
}
|
|
2522
|
+
) }),
|
|
2523
|
+
/* @__PURE__ */ jsx(RadixPopover.Portal, { children: /* @__PURE__ */ jsxs(
|
|
2524
|
+
RadixPopover.Content,
|
|
2525
|
+
{
|
|
2526
|
+
align: "start",
|
|
2527
|
+
sideOffset: 4,
|
|
2528
|
+
"data-slot": "multi-select-content",
|
|
2529
|
+
className: cn(multiSelectContentClass, contentClassName),
|
|
2530
|
+
onOpenAutoFocus: (event) => {
|
|
2531
|
+
if (!searchable) event.preventDefault();
|
|
2532
|
+
},
|
|
2533
|
+
children: [
|
|
2534
|
+
searchable ? /* @__PURE__ */ jsx("div", { className: multiSelectSearchRowClass, children: /* @__PURE__ */ jsx(
|
|
2535
|
+
Input,
|
|
2536
|
+
{
|
|
2537
|
+
type: "search",
|
|
2538
|
+
inputSize: "sm",
|
|
2539
|
+
value: query,
|
|
2540
|
+
onChange: (e) => setQuery(e.target.value),
|
|
2541
|
+
placeholder: labels.search,
|
|
2542
|
+
"aria-label": labels.search,
|
|
2543
|
+
leadingIcon: /* @__PURE__ */ jsx(Search, { className: "size-4" })
|
|
2544
|
+
}
|
|
2545
|
+
) }) : null,
|
|
2546
|
+
filtered.length === 0 ? /* @__PURE__ */ jsx("div", { className: multiSelectEmptyClass, children: labels.empty }) : /* @__PURE__ */ jsx("div", { className: multiSelectListClass, children: filtered.map((option) => {
|
|
2547
|
+
const isSelected = selected.includes(option.value);
|
|
2548
|
+
const optionId = `${triggerId}-opt-${option.value}`;
|
|
2549
|
+
return /* @__PURE__ */ jsxs(
|
|
2550
|
+
"label",
|
|
2551
|
+
{
|
|
2552
|
+
htmlFor: optionId,
|
|
2553
|
+
"data-slot": "multi-select-option",
|
|
2554
|
+
"data-selected": isSelected ? "true" : void 0,
|
|
2555
|
+
className: multiSelectOptionClass,
|
|
2556
|
+
children: [
|
|
2557
|
+
/* @__PURE__ */ jsx(
|
|
2558
|
+
Checkbox,
|
|
2559
|
+
{
|
|
2560
|
+
id: optionId,
|
|
2561
|
+
size: "sm",
|
|
2562
|
+
checked: isSelected,
|
|
2563
|
+
disabled: option.disabled,
|
|
2564
|
+
onCheckedChange: () => toggle(option.value)
|
|
2565
|
+
}
|
|
2566
|
+
),
|
|
2567
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: option.label })
|
|
2568
|
+
]
|
|
2569
|
+
},
|
|
2570
|
+
option.value
|
|
2571
|
+
);
|
|
2572
|
+
}) })
|
|
2573
|
+
]
|
|
2574
|
+
}
|
|
2575
|
+
) })
|
|
2576
|
+
] });
|
|
2577
|
+
});
|
|
2578
|
+
function isGroupedOptions(options) {
|
|
2579
|
+
const first = options[0];
|
|
2580
|
+
return first !== void 0 && "options" in first;
|
|
2581
|
+
}
|
|
2582
|
+
var Select = forwardRef(function Select2({
|
|
2583
|
+
variant = "default",
|
|
2584
|
+
selectSize = "md",
|
|
2585
|
+
options,
|
|
2586
|
+
placeholder,
|
|
2587
|
+
value,
|
|
2588
|
+
defaultValue,
|
|
2589
|
+
onValueChange,
|
|
2590
|
+
onChange,
|
|
2591
|
+
onBlur,
|
|
2592
|
+
name,
|
|
2593
|
+
disabled,
|
|
2594
|
+
required,
|
|
2595
|
+
id,
|
|
2596
|
+
className,
|
|
2597
|
+
"aria-invalid": ariaInvalid,
|
|
2598
|
+
"aria-describedby": ariaDescribedBy,
|
|
2599
|
+
"aria-label": ariaLabel,
|
|
2600
|
+
children
|
|
2601
|
+
}, ref) {
|
|
2602
|
+
const generatedId = useId();
|
|
2603
|
+
const triggerId = id ?? generatedId;
|
|
2604
|
+
const handleValueChange = useCallback(
|
|
2605
|
+
(next) => {
|
|
2606
|
+
onValueChange?.(next);
|
|
2607
|
+
if (onChange) {
|
|
2608
|
+
const synthetic = {
|
|
2609
|
+
target: { value: next, name },
|
|
2610
|
+
currentTarget: { value: next, name },
|
|
2611
|
+
type: "change"
|
|
2612
|
+
};
|
|
2613
|
+
onChange(synthetic);
|
|
2614
|
+
}
|
|
2615
|
+
},
|
|
2616
|
+
[onValueChange, onChange, name]
|
|
2617
|
+
);
|
|
2618
|
+
return /* @__PURE__ */ jsxs(
|
|
2619
|
+
RadixSelect.Root,
|
|
2620
|
+
{
|
|
2621
|
+
value,
|
|
2622
|
+
defaultValue,
|
|
2623
|
+
onValueChange: handleValueChange,
|
|
2624
|
+
disabled,
|
|
2625
|
+
required,
|
|
2626
|
+
name,
|
|
2627
|
+
children: [
|
|
2628
|
+
/* @__PURE__ */ jsxs(
|
|
2629
|
+
RadixSelect.Trigger,
|
|
2630
|
+
{
|
|
2631
|
+
ref,
|
|
2632
|
+
id: triggerId,
|
|
2633
|
+
"aria-label": ariaLabel,
|
|
2634
|
+
"aria-invalid": ariaInvalid,
|
|
2635
|
+
"aria-describedby": ariaDescribedBy,
|
|
2636
|
+
onBlur,
|
|
2637
|
+
"data-slot": "select-trigger",
|
|
2638
|
+
className: cn(
|
|
2639
|
+
selectBaseClass,
|
|
2640
|
+
selectVariantClass[variant],
|
|
2641
|
+
selectSizeClass[selectSize],
|
|
2642
|
+
className
|
|
2643
|
+
),
|
|
2644
|
+
children: [
|
|
2645
|
+
/* @__PURE__ */ jsx(RadixSelect.Value, { placeholder }),
|
|
2646
|
+
/* @__PURE__ */ jsx(RadixSelect.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDown, { className: "pointer-events-none absolute end-3 top-1/2 size-4 shrink-0 -translate-y-1/2 text-muted-foreground" }) })
|
|
2647
|
+
]
|
|
2648
|
+
}
|
|
2649
|
+
),
|
|
2650
|
+
/* @__PURE__ */ jsx(RadixSelect.Portal, { children: /* @__PURE__ */ jsxs(
|
|
2651
|
+
RadixSelect.Content,
|
|
2652
|
+
{
|
|
2653
|
+
position: "popper",
|
|
2654
|
+
sideOffset: 4,
|
|
2655
|
+
"data-slot": "select-content",
|
|
2656
|
+
className: selectContentClass,
|
|
2657
|
+
children: [
|
|
2658
|
+
/* @__PURE__ */ jsx(RadixSelect.ScrollUpButton, { className: "flex h-6 cursor-default items-center justify-center bg-popover text-muted-foreground", children: /* @__PURE__ */ jsx(ChevronUp, { className: "size-4" }) }),
|
|
2659
|
+
/* @__PURE__ */ jsx(RadixSelect.Viewport, { className: selectViewportClass, children: children ?? (options ? renderOptions(options) : null) }),
|
|
2660
|
+
/* @__PURE__ */ jsx(RadixSelect.ScrollDownButton, { className: "flex h-6 cursor-default items-center justify-center bg-popover text-muted-foreground", children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-4" }) })
|
|
2661
|
+
]
|
|
2662
|
+
}
|
|
2663
|
+
) })
|
|
2664
|
+
]
|
|
2665
|
+
}
|
|
2666
|
+
);
|
|
2667
|
+
});
|
|
2668
|
+
function renderOptions(options) {
|
|
2669
|
+
if (isGroupedOptions(options)) {
|
|
2670
|
+
const lastIndex = options.length - 1;
|
|
2671
|
+
return options.map((group, idx) => /* @__PURE__ */ jsxs(RadixSelect.Group, { children: [
|
|
2672
|
+
/* @__PURE__ */ jsx(RadixSelect.Label, { className: selectGroupLabelClass, children: group.label }),
|
|
2673
|
+
group.options.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value)),
|
|
2674
|
+
idx < lastIndex && /* @__PURE__ */ jsx(RadixSelect.Separator, { className: selectSeparatorClass })
|
|
2675
|
+
] }, group.label));
|
|
2676
|
+
}
|
|
2677
|
+
return options.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value));
|
|
2678
|
+
}
|
|
2679
|
+
var SelectItem = forwardRef(function SelectItem2({ className, children, ...props }, ref) {
|
|
2680
|
+
return /* @__PURE__ */ jsxs(RadixSelect.Item, { ref, className: cn(selectItemClass, className), ...props, children: [
|
|
2681
|
+
/* @__PURE__ */ jsx(RadixSelect.ItemIndicator, { className: selectItemIndicatorClass, children: /* @__PURE__ */ jsx(Check, {}) }),
|
|
2682
|
+
/* @__PURE__ */ jsx(RadixSelect.ItemText, { children })
|
|
2683
|
+
] });
|
|
2684
|
+
});
|
|
2685
|
+
|
|
2686
|
+
// src/components/list-page/listPageFilters.ts
|
|
2687
|
+
var FILTER_SPAN_CLASS = {
|
|
2688
|
+
narrow: "",
|
|
2689
|
+
default: "",
|
|
2690
|
+
wide: "sm:col-span-2"
|
|
2691
|
+
};
|
|
2692
|
+
function filterDefaultValue(filter) {
|
|
2693
|
+
return filter.type === "select" ? filter.options[0]?.value ?? "" : "";
|
|
2694
|
+
}
|
|
2695
|
+
function hasActiveFilters(filters, values) {
|
|
2696
|
+
for (const filter of filters ?? []) {
|
|
2697
|
+
const current = values?.[filter.key];
|
|
2698
|
+
if (current === void 0) continue;
|
|
2699
|
+
const value = filter.type === "text" ? current.trim() : current;
|
|
2700
|
+
if (value !== filterDefaultValue(filter)) return true;
|
|
2701
|
+
}
|
|
2702
|
+
return false;
|
|
2703
|
+
}
|
|
2704
|
+
function ListPageFilterBar({
|
|
2705
|
+
filters,
|
|
2706
|
+
values,
|
|
2707
|
+
onChange,
|
|
2708
|
+
disabled = false,
|
|
2709
|
+
labels
|
|
2710
|
+
}) {
|
|
2711
|
+
const active = hasActiveFilters(filters, values);
|
|
2712
|
+
const reset = () => {
|
|
2713
|
+
for (const filter of filters ?? []) {
|
|
2714
|
+
onChange?.(filter.key, filterDefaultValue(filter));
|
|
2715
|
+
}
|
|
2716
|
+
};
|
|
2717
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "list-page-filter-bar", className: "space-y-3", children: [
|
|
2718
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3", children: filters?.map((filter) => /* @__PURE__ */ jsx(
|
|
2719
|
+
FilterControl,
|
|
2720
|
+
{
|
|
2721
|
+
filter,
|
|
2722
|
+
value: values?.[filter.key],
|
|
2723
|
+
onChange,
|
|
2724
|
+
disabled
|
|
2725
|
+
},
|
|
2726
|
+
filter.key
|
|
2727
|
+
)) }),
|
|
2728
|
+
active && !disabled ? /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: reset, children: [
|
|
2729
|
+
/* @__PURE__ */ jsx(RefreshCw, { className: "size-4" }),
|
|
2730
|
+
labels.reset
|
|
2731
|
+
] }) }) : null
|
|
2732
|
+
] });
|
|
2733
|
+
}
|
|
2734
|
+
function FilterControl({ filter, value, onChange, disabled }) {
|
|
2735
|
+
const spanClass = FILTER_SPAN_CLASS[filter.width ?? "default"];
|
|
2736
|
+
const ariaLabel = typeof filter.label === "string" ? filter.label : filter.key;
|
|
2737
|
+
switch (filter.type) {
|
|
2738
|
+
case "select":
|
|
2739
|
+
return /* @__PURE__ */ jsx(
|
|
2740
|
+
Select,
|
|
2741
|
+
{
|
|
2742
|
+
"aria-label": ariaLabel,
|
|
2743
|
+
value: value ?? filterDefaultValue(filter),
|
|
2744
|
+
onValueChange: (v) => onChange?.(filter.key, v),
|
|
2745
|
+
options: filter.options,
|
|
2746
|
+
className: spanClass,
|
|
2747
|
+
disabled
|
|
2748
|
+
}
|
|
2749
|
+
);
|
|
2750
|
+
case "text":
|
|
2751
|
+
return /* @__PURE__ */ jsx(
|
|
2752
|
+
Input,
|
|
2753
|
+
{
|
|
2754
|
+
type: "search",
|
|
2755
|
+
"aria-label": ariaLabel,
|
|
2756
|
+
placeholder: filter.placeholder,
|
|
2757
|
+
value: value ?? "",
|
|
2758
|
+
onChange: (e) => onChange?.(filter.key, e.target.value),
|
|
2759
|
+
leadingIcon: /* @__PURE__ */ jsx(Search, { className: "size-4" }),
|
|
2760
|
+
wrapperClassName: spanClass,
|
|
2761
|
+
disabled
|
|
2762
|
+
}
|
|
2763
|
+
);
|
|
2764
|
+
case "date":
|
|
2765
|
+
return /* @__PURE__ */ jsx(
|
|
2766
|
+
DatePicker,
|
|
2767
|
+
{
|
|
2768
|
+
"aria-label": ariaLabel,
|
|
2769
|
+
placeholder: filter.placeholder,
|
|
2770
|
+
value: value ?? "",
|
|
2771
|
+
onValueChange: (v) => onChange?.(filter.key, v),
|
|
2772
|
+
className: spanClass,
|
|
2773
|
+
disabled
|
|
2774
|
+
}
|
|
2775
|
+
);
|
|
2776
|
+
case "multiselect":
|
|
2777
|
+
return /* @__PURE__ */ jsx(
|
|
2778
|
+
MultiSelect,
|
|
2779
|
+
{
|
|
2780
|
+
"aria-label": ariaLabel,
|
|
2781
|
+
placeholder: filter.placeholder,
|
|
2782
|
+
options: filter.options,
|
|
2783
|
+
value: value ? value.split(",").filter(Boolean) : [],
|
|
2784
|
+
onValueChange: (values) => onChange?.(filter.key, values.join(",")),
|
|
2785
|
+
className: spanClass,
|
|
2786
|
+
disabled
|
|
2787
|
+
}
|
|
2788
|
+
);
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
var DEFAULT_LABELS = {
|
|
2480
2792
|
reset: "Reset filters",
|
|
2481
2793
|
emptyTitle: "No results",
|
|
2482
2794
|
emptyDescription: "Try clearing the search or adjusting the filters.",
|
|
2483
2795
|
noDataTitle: "No data yet",
|
|
2484
2796
|
noDataDescription: "Nothing has been added here so far."
|
|
2485
2797
|
};
|
|
2486
|
-
var FILTER_WIDTH_CLASS = {
|
|
2487
|
-
narrow: "w-32",
|
|
2488
|
-
default: "w-44",
|
|
2489
|
-
wide: "w-56"
|
|
2490
|
-
};
|
|
2491
2798
|
function ListPage({
|
|
2492
2799
|
title,
|
|
2493
2800
|
description,
|
|
@@ -2498,8 +2805,6 @@ function ListPage({
|
|
|
2498
2805
|
getRowId,
|
|
2499
2806
|
isLoading = false,
|
|
2500
2807
|
loadingRowCount,
|
|
2501
|
-
searchValue,
|
|
2502
|
-
onSearchChange,
|
|
2503
2808
|
filters,
|
|
2504
2809
|
filterValues,
|
|
2505
2810
|
onFilterChange,
|
|
@@ -2514,59 +2819,30 @@ function ListPage({
|
|
|
2514
2819
|
labels: labelsProp,
|
|
2515
2820
|
className
|
|
2516
2821
|
}) {
|
|
2517
|
-
const labels = { ...
|
|
2518
|
-
const
|
|
2519
|
-
const
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
const current = filterValues?.[f.key];
|
|
2524
|
-
const def = f.options[0]?.value ?? "";
|
|
2525
|
-
if (current !== void 0 && current !== def) return true;
|
|
2526
|
-
}
|
|
2527
|
-
return false;
|
|
2528
|
-
}, [searchValue, filters, filterValues]);
|
|
2822
|
+
const labels = { ...DEFAULT_LABELS, ...labelsProp };
|
|
2823
|
+
const showFilterBar = Boolean(filters?.length);
|
|
2824
|
+
const hasActiveQuery = useMemo(
|
|
2825
|
+
() => hasActiveFilters(filters, filterValues),
|
|
2826
|
+
[filters, filterValues]
|
|
2827
|
+
);
|
|
2529
2828
|
const reset = () => {
|
|
2530
|
-
onSearchChange?.("");
|
|
2531
2829
|
for (const f of filters ?? []) {
|
|
2532
|
-
|
|
2533
|
-
onFilterChange?.(f.key, def);
|
|
2830
|
+
onFilterChange?.(f.key, filterDefaultValue(f));
|
|
2534
2831
|
}
|
|
2535
2832
|
};
|
|
2536
2833
|
const tableMode = isLoading ? "loading" : data.length === 0 && !hasActiveQuery ? "no-data" : data.length === 0 && hasActiveQuery ? "no-results" : "rows";
|
|
2537
2834
|
return /* @__PURE__ */ jsxs("div", { "data-slot": "list-page", className: cn("space-y-6", className), children: [
|
|
2538
2835
|
/* @__PURE__ */ jsx(PageHeader, { title, description, bordered, actions }),
|
|
2539
|
-
showFilterBar ? /* @__PURE__ */
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
wrapperClassName: "sm:max-w-xs",
|
|
2550
|
-
disabled: isLoading
|
|
2551
|
-
}
|
|
2552
|
-
) : null,
|
|
2553
|
-
filters?.map((f) => /* @__PURE__ */ jsx(
|
|
2554
|
-
Select,
|
|
2555
|
-
{
|
|
2556
|
-
"aria-label": typeof f.label === "string" ? f.label : f.key,
|
|
2557
|
-
value: filterValues?.[f.key] ?? f.options[0]?.value ?? "",
|
|
2558
|
-
onValueChange: (v) => onFilterChange?.(f.key, v),
|
|
2559
|
-
options: f.options,
|
|
2560
|
-
className: FILTER_WIDTH_CLASS[f.width ?? "default"],
|
|
2561
|
-
disabled: isLoading
|
|
2562
|
-
},
|
|
2563
|
-
f.key
|
|
2564
|
-
)),
|
|
2565
|
-
hasActiveQuery && !isLoading ? /* @__PURE__ */ jsxs(Button, { variant: "ghost", onClick: reset, children: [
|
|
2566
|
-
/* @__PURE__ */ jsx(RefreshCw, {}),
|
|
2567
|
-
labels.reset
|
|
2568
|
-
] }) : null
|
|
2569
|
-
] }) : null,
|
|
2836
|
+
showFilterBar ? /* @__PURE__ */ jsx(
|
|
2837
|
+
ListPageFilterBar,
|
|
2838
|
+
{
|
|
2839
|
+
filters,
|
|
2840
|
+
values: filterValues,
|
|
2841
|
+
onChange: onFilterChange,
|
|
2842
|
+
disabled: isLoading,
|
|
2843
|
+
labels: { reset: labels.reset }
|
|
2844
|
+
}
|
|
2845
|
+
) : null,
|
|
2570
2846
|
tableMode === "loading" || tableMode === "rows" ? /* @__PURE__ */ jsx(
|
|
2571
2847
|
Table,
|
|
2572
2848
|
{
|
|
@@ -2986,6 +3262,6 @@ function Tooltip({
|
|
|
2986
3262
|
);
|
|
2987
3263
|
}
|
|
2988
3264
|
|
|
2989
|
-
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppShell, Avatar, Badge, Button, Checkbox, ConfirmDialogProvider, DashboardContent, DashboardHeader, DashboardLayout, DashboardMain, DatePicker, DetailPage, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, EmptyState, Field, FormPage, HeaderActions, HeaderCollapseTrigger, HeaderMobileTrigger, HeaderSearch, HeaderTitle, Input, LanguageSwitcher, ListPage, PageHeader, RadioGroup, RadioGroupItem, Select, Sidebar, SidebarFooter, SidebarGroup, SidebarHeader, SidebarNav, SidebarNavGroup, SidebarNavItem, Switch, Table, Textarea, Toaster, Tooltip, TooltipProvider, badgeBaseClass, badgeDotSizeClass, badgeSizeClass, badgeVariantClass, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, datePickerCalendarClass, datePickerCaptionClass, datePickerContentClass, datePickerDayBaseClass, datePickerDayWrapperClass, datePickerDisabledClass, datePickerMonthClass, datePickerMonthGridClass, datePickerMonthsClass, datePickerNavButtonClass, datePickerNavClass, datePickerOutsideClass, datePickerPlaceholderClass, datePickerSelectedClass, datePickerTodayClass, datePickerTriggerBaseClass, datePickerTriggerSizeClass, datePickerTriggerVariantClass, datePickerValueClass, datePickerWeekClass, datePickerWeekdayClass, datePickerWeekdaysClass, detailPageBaseClass, detailPageBodyClass, detailPageEmptyClass, detailPageSkeletonRowClass, dialogCloseButtonClass, dialogContentClass, dialogDescriptionClass, dialogFooterClass, dialogHeaderClass, dialogOverlayClass, dialogTitleClass, dropdownMenuContentClass, dropdownMenuItemBaseClass, dropdownMenuItemInsetClass, dropdownMenuItemVariantClass, dropdownMenuLabelClass, dropdownMenuSeparatorClass, dropdownMenuShortcutClass, emptyStateActionsSpacingClass, emptyStateBaseClass, emptyStateContainerSizeClass, emptyStateDescriptionSizeClass, emptyStateIconWrapperBaseClass, emptyStateIconWrapperSizeClass, emptyStateTitleSizeClass, formPageActionsBarClass, formPageBaseClass, formPageBodyClass, formPageSkeletonRowClass, inputBaseClass, inputSizeClass, inputVariantClass, pageHeaderActionsClass, pageHeaderBackClass, pageHeaderBackIconClass, pageHeaderBaseClass, pageHeaderBorderedClass, pageHeaderBreadcrumbsClass, pageHeaderDescriptionClass, pageHeaderTitleBlockClass, pageHeaderTitleClass, pageHeaderTitleRowClass, radioGroupBaseClass, radioGroupOrientationClass, radioIndicatorBaseClass, radioIndicatorDotClass, radioIndicatorSizeClass, radioItemBaseClass, radioItemSizeClass, radioLabelSizeClass, radioOptionRowClass, selectBaseClass, selectSizeClass, selectVariantClass, switchThumbBaseClass, switchThumbClass, switchTrackBaseClass, switchTrackClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, textareaBaseClass, textareaResizeClass, textareaSizeClass, textareaVariantClass, toastClassNames, tooltipArrowClass, tooltipContentClass, useConfirm, useDashboardLayout, useDirection };
|
|
3265
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppShell, Avatar, Badge, Button, Checkbox, ConfirmDialogProvider, DashboardContent, DashboardHeader, DashboardLayout, DashboardMain, DatePicker, DetailPage, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, EmptyState, Field, FormPage, HeaderActions, HeaderCollapseTrigger, HeaderMobileTrigger, HeaderSearch, HeaderTitle, Input, LanguageSwitcher, ListPage, MultiSelect, PageHeader, RadioGroup, RadioGroupItem, Select, Sidebar, SidebarFooter, SidebarGroup, SidebarHeader, SidebarNav, SidebarNavGroup, SidebarNavItem, Switch, Table, Textarea, Toaster, Tooltip, TooltipProvider, badgeBaseClass, badgeDotSizeClass, badgeSizeClass, badgeVariantClass, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, datePickerCalendarClass, datePickerCaptionClass, datePickerContentClass, datePickerDayBaseClass, datePickerDayWrapperClass, datePickerDisabledClass, datePickerMonthClass, datePickerMonthGridClass, datePickerMonthsClass, datePickerNavButtonClass, datePickerNavClass, datePickerOutsideClass, datePickerPlaceholderClass, datePickerSelectedClass, datePickerTodayClass, datePickerTriggerBaseClass, datePickerTriggerSizeClass, datePickerTriggerVariantClass, datePickerValueClass, datePickerWeekClass, datePickerWeekdayClass, datePickerWeekdaysClass, detailPageBaseClass, detailPageBodyClass, detailPageEmptyClass, detailPageSkeletonRowClass, dialogCloseButtonClass, dialogContentClass, dialogDescriptionClass, dialogFooterClass, dialogHeaderClass, dialogOverlayClass, dialogTitleClass, dropdownMenuContentClass, dropdownMenuItemBaseClass, dropdownMenuItemInsetClass, dropdownMenuItemVariantClass, dropdownMenuLabelClass, dropdownMenuSeparatorClass, dropdownMenuShortcutClass, emptyStateActionsSpacingClass, emptyStateBaseClass, emptyStateContainerSizeClass, emptyStateDescriptionSizeClass, emptyStateIconWrapperBaseClass, emptyStateIconWrapperSizeClass, emptyStateTitleSizeClass, formPageActionsBarClass, formPageBaseClass, formPageBodyClass, formPageSkeletonRowClass, inputBaseClass, inputSizeClass, inputVariantClass, multiSelectChipClass, multiSelectChipRemoveClass, multiSelectContentClass, multiSelectEmptyClass, multiSelectListClass, multiSelectOptionClass, multiSelectSearchRowClass, multiSelectTriggerSizeClass, multiSelectValueRowClass, pageHeaderActionsClass, pageHeaderBackClass, pageHeaderBackIconClass, pageHeaderBaseClass, pageHeaderBorderedClass, pageHeaderBreadcrumbsClass, pageHeaderDescriptionClass, pageHeaderTitleBlockClass, pageHeaderTitleClass, pageHeaderTitleRowClass, radioGroupBaseClass, radioGroupOrientationClass, radioIndicatorBaseClass, radioIndicatorDotClass, radioIndicatorSizeClass, radioItemBaseClass, radioItemSizeClass, radioLabelSizeClass, radioOptionRowClass, selectBaseClass, selectSizeClass, selectVariantClass, switchThumbBaseClass, switchThumbClass, switchTrackBaseClass, switchTrackClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, textareaBaseClass, textareaResizeClass, textareaSizeClass, textareaVariantClass, toastClassNames, tooltipArrowClass, tooltipContentClass, useConfirm, useDashboardLayout, useDirection };
|
|
2990
3266
|
//# sourceMappingURL=index.js.map
|
|
2991
3267
|
//# sourceMappingURL=index.js.map
|