@dimaan/ui 0.0.21 → 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 -192
- 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 -194
- 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';
|
|
@@ -1347,15 +1347,20 @@ var detailPageBaseClass = "flex w-full flex-col gap-6";
|
|
|
1347
1347
|
var detailPageBodyClass = "flex flex-col gap-6";
|
|
1348
1348
|
var detailPageSkeletonRowClass = "h-5 w-full animate-pulse rounded-md bg-muted";
|
|
1349
1349
|
var detailPageEmptyClass = "rounded-md border border-border bg-card";
|
|
1350
|
-
var
|
|
1350
|
+
var DEFAULT_LABELS_LTR = {
|
|
1351
|
+
back: "Back",
|
|
1351
1352
|
notFoundTitle: "Not found",
|
|
1352
1353
|
notFoundDescription: "The record you\u2019re looking for does not exist or has been removed."
|
|
1353
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
|
+
};
|
|
1354
1360
|
var DEFAULT_SKELETON_ROW_COUNT = 6;
|
|
1355
1361
|
function DetailPage({
|
|
1356
1362
|
title,
|
|
1357
1363
|
description,
|
|
1358
|
-
back,
|
|
1359
1364
|
actions,
|
|
1360
1365
|
bordered = true,
|
|
1361
1366
|
isLoading = false,
|
|
@@ -1367,7 +1372,10 @@ function DetailPage({
|
|
|
1367
1372
|
className,
|
|
1368
1373
|
bodyClassName
|
|
1369
1374
|
}) {
|
|
1370
|
-
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 };
|
|
1371
1379
|
return /* @__PURE__ */ jsxs(
|
|
1372
1380
|
"div",
|
|
1373
1381
|
{
|
|
@@ -1381,7 +1389,7 @@ function DetailPage({
|
|
|
1381
1389
|
{
|
|
1382
1390
|
title,
|
|
1383
1391
|
description,
|
|
1384
|
-
back,
|
|
1392
|
+
back: { label: labels.back, onClick: () => navigate(-1) },
|
|
1385
1393
|
actions,
|
|
1386
1394
|
bordered
|
|
1387
1395
|
}
|
|
@@ -1695,13 +1703,13 @@ var formPageBodyClass = "flex-1";
|
|
|
1695
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";
|
|
1696
1704
|
var formPageSkeletonRowClass = "h-10 w-full animate-pulse rounded-md bg-muted";
|
|
1697
1705
|
var DEFAULT_SKELETON_ROW_COUNT2 = 6;
|
|
1698
|
-
var
|
|
1706
|
+
var DEFAULT_LABELS_LTR2 = {
|
|
1699
1707
|
back: "Back",
|
|
1700
1708
|
cancel: "Cancel",
|
|
1701
1709
|
save: "Save",
|
|
1702
1710
|
saving: "Saving\u2026"
|
|
1703
1711
|
};
|
|
1704
|
-
var
|
|
1712
|
+
var DEFAULT_LABELS_RTL2 = {
|
|
1705
1713
|
back: "\u0631\u062C\u0648\u0639",
|
|
1706
1714
|
cancel: "\u0625\u0644\u063A\u0627\u0621",
|
|
1707
1715
|
save: "\u062D\u0641\u0638",
|
|
@@ -1728,7 +1736,7 @@ function FormPage({
|
|
|
1728
1736
|
const dir = useDirection();
|
|
1729
1737
|
const formContext = useFormContext();
|
|
1730
1738
|
const submitting = isSubmitting ?? formContext?.formState?.isSubmitting ?? false;
|
|
1731
|
-
const defaults = dir === "rtl" ?
|
|
1739
|
+
const defaults = dir === "rtl" ? DEFAULT_LABELS_RTL2 : DEFAULT_LABELS_LTR2;
|
|
1732
1740
|
const labels = { ...defaults, ...labelsProp };
|
|
1733
1741
|
const goBack = () => navigate(-1);
|
|
1734
1742
|
return /* @__PURE__ */ jsxs("div", { "data-slot": "form-page", className: cn(formPageBaseClass, className), children: [
|
|
@@ -1896,132 +1904,6 @@ function LanguageSwitcher({
|
|
|
1896
1904
|
}
|
|
1897
1905
|
);
|
|
1898
1906
|
}
|
|
1899
|
-
|
|
1900
|
-
// src/components/select/selectVariants.ts
|
|
1901
|
-
var selectVariantClass = {
|
|
1902
|
-
default: "border border-input bg-background hover:border-ring",
|
|
1903
|
-
filled: "border border-transparent bg-muted hover:bg-muted/80",
|
|
1904
|
-
ghost: "border border-transparent bg-transparent hover:bg-accent"
|
|
1905
|
-
};
|
|
1906
|
-
var selectSizeClass = {
|
|
1907
|
-
sm: "h-8 rounded-md ps-2.5 pe-8 text-sm",
|
|
1908
|
-
md: "h-9 rounded-md ps-3 pe-9 text-sm",
|
|
1909
|
-
lg: "h-11 rounded-md ps-4 pe-10 text-base"
|
|
1910
|
-
};
|
|
1911
|
-
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";
|
|
1912
|
-
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";
|
|
1913
|
-
var selectViewportClass = "p-1";
|
|
1914
|
-
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";
|
|
1915
|
-
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";
|
|
1916
|
-
var selectGroupLabelClass = "px-2 py-1.5 text-xs font-semibold text-muted-foreground";
|
|
1917
|
-
var selectSeparatorClass = "-mx-1 my-1 h-px bg-border";
|
|
1918
|
-
function isGroupedOptions(options) {
|
|
1919
|
-
const first = options[0];
|
|
1920
|
-
return first !== void 0 && "options" in first;
|
|
1921
|
-
}
|
|
1922
|
-
var Select = forwardRef(function Select2({
|
|
1923
|
-
variant = "default",
|
|
1924
|
-
selectSize = "md",
|
|
1925
|
-
options,
|
|
1926
|
-
placeholder,
|
|
1927
|
-
value,
|
|
1928
|
-
defaultValue,
|
|
1929
|
-
onValueChange,
|
|
1930
|
-
onChange,
|
|
1931
|
-
onBlur,
|
|
1932
|
-
name,
|
|
1933
|
-
disabled,
|
|
1934
|
-
required,
|
|
1935
|
-
id,
|
|
1936
|
-
className,
|
|
1937
|
-
"aria-invalid": ariaInvalid,
|
|
1938
|
-
"aria-describedby": ariaDescribedBy,
|
|
1939
|
-
"aria-label": ariaLabel,
|
|
1940
|
-
children
|
|
1941
|
-
}, ref) {
|
|
1942
|
-
const generatedId = useId();
|
|
1943
|
-
const triggerId = id ?? generatedId;
|
|
1944
|
-
const handleValueChange = useCallback(
|
|
1945
|
-
(next) => {
|
|
1946
|
-
onValueChange?.(next);
|
|
1947
|
-
if (onChange) {
|
|
1948
|
-
const synthetic = {
|
|
1949
|
-
target: { value: next, name },
|
|
1950
|
-
currentTarget: { value: next, name },
|
|
1951
|
-
type: "change"
|
|
1952
|
-
};
|
|
1953
|
-
onChange(synthetic);
|
|
1954
|
-
}
|
|
1955
|
-
},
|
|
1956
|
-
[onValueChange, onChange, name]
|
|
1957
|
-
);
|
|
1958
|
-
return /* @__PURE__ */ jsxs(
|
|
1959
|
-
RadixSelect.Root,
|
|
1960
|
-
{
|
|
1961
|
-
value,
|
|
1962
|
-
defaultValue,
|
|
1963
|
-
onValueChange: handleValueChange,
|
|
1964
|
-
disabled,
|
|
1965
|
-
required,
|
|
1966
|
-
name,
|
|
1967
|
-
children: [
|
|
1968
|
-
/* @__PURE__ */ jsxs(
|
|
1969
|
-
RadixSelect.Trigger,
|
|
1970
|
-
{
|
|
1971
|
-
ref,
|
|
1972
|
-
id: triggerId,
|
|
1973
|
-
"aria-label": ariaLabel,
|
|
1974
|
-
"aria-invalid": ariaInvalid,
|
|
1975
|
-
"aria-describedby": ariaDescribedBy,
|
|
1976
|
-
onBlur,
|
|
1977
|
-
"data-slot": "select-trigger",
|
|
1978
|
-
className: cn(
|
|
1979
|
-
selectBaseClass,
|
|
1980
|
-
selectVariantClass[variant],
|
|
1981
|
-
selectSizeClass[selectSize],
|
|
1982
|
-
className
|
|
1983
|
-
),
|
|
1984
|
-
children: [
|
|
1985
|
-
/* @__PURE__ */ jsx(RadixSelect.Value, { placeholder }),
|
|
1986
|
-
/* @__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" }) })
|
|
1987
|
-
]
|
|
1988
|
-
}
|
|
1989
|
-
),
|
|
1990
|
-
/* @__PURE__ */ jsx(RadixSelect.Portal, { children: /* @__PURE__ */ jsxs(
|
|
1991
|
-
RadixSelect.Content,
|
|
1992
|
-
{
|
|
1993
|
-
position: "popper",
|
|
1994
|
-
sideOffset: 4,
|
|
1995
|
-
"data-slot": "select-content",
|
|
1996
|
-
className: selectContentClass,
|
|
1997
|
-
children: [
|
|
1998
|
-
/* @__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" }) }),
|
|
1999
|
-
/* @__PURE__ */ jsx(RadixSelect.Viewport, { className: selectViewportClass, children: children ?? (options ? renderOptions(options) : null) }),
|
|
2000
|
-
/* @__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" }) })
|
|
2001
|
-
]
|
|
2002
|
-
}
|
|
2003
|
-
) })
|
|
2004
|
-
]
|
|
2005
|
-
}
|
|
2006
|
-
);
|
|
2007
|
-
});
|
|
2008
|
-
function renderOptions(options) {
|
|
2009
|
-
if (isGroupedOptions(options)) {
|
|
2010
|
-
const lastIndex = options.length - 1;
|
|
2011
|
-
return options.map((group, idx) => /* @__PURE__ */ jsxs(RadixSelect.Group, { children: [
|
|
2012
|
-
/* @__PURE__ */ jsx(RadixSelect.Label, { className: selectGroupLabelClass, children: group.label }),
|
|
2013
|
-
group.options.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value)),
|
|
2014
|
-
idx < lastIndex && /* @__PURE__ */ jsx(RadixSelect.Separator, { className: selectSeparatorClass })
|
|
2015
|
-
] }, group.label));
|
|
2016
|
-
}
|
|
2017
|
-
return options.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value));
|
|
2018
|
-
}
|
|
2019
|
-
var SelectItem = forwardRef(function SelectItem2({ className, children, ...props }, ref) {
|
|
2020
|
-
return /* @__PURE__ */ jsxs(RadixSelect.Item, { ref, className: cn(selectItemClass, className), ...props, children: [
|
|
2021
|
-
/* @__PURE__ */ jsx(RadixSelect.ItemIndicator, { className: selectItemIndicatorClass, children: /* @__PURE__ */ jsx(Check, {}) }),
|
|
2022
|
-
/* @__PURE__ */ jsx(RadixSelect.ItemText, { children })
|
|
2023
|
-
] });
|
|
2024
|
-
});
|
|
2025
1907
|
var EN_LABELS = {
|
|
2026
1908
|
rowsPerPage: "Rows per page",
|
|
2027
1909
|
pageRangeOf: "of",
|
|
@@ -2145,17 +2027,17 @@ var tableSizeClass = {
|
|
|
2145
2027
|
sm: {
|
|
2146
2028
|
row: "",
|
|
2147
2029
|
cell: "px-3 py-1.5 text-xs",
|
|
2148
|
-
head: "px-3 py-2 text-xs font-medium"
|
|
2030
|
+
head: "whitespace-nowrap px-3 py-2 text-xs font-medium"
|
|
2149
2031
|
},
|
|
2150
2032
|
md: {
|
|
2151
2033
|
row: "",
|
|
2152
2034
|
cell: "px-4 py-2.5 text-sm",
|
|
2153
|
-
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"
|
|
2154
2036
|
},
|
|
2155
2037
|
lg: {
|
|
2156
2038
|
row: "",
|
|
2157
2039
|
cell: "px-5 py-3.5 text-sm",
|
|
2158
|
-
head: "px-5 py-3 text-sm font-medium"
|
|
2040
|
+
head: "whitespace-nowrap px-5 py-3 text-sm font-medium"
|
|
2159
2041
|
}
|
|
2160
2042
|
};
|
|
2161
2043
|
var tableBaseClass = "w-full caption-bottom border-collapse";
|
|
@@ -2473,20 +2355,446 @@ function SortIndicator({ active, direction }) {
|
|
|
2473
2355
|
if (!active) return /* @__PURE__ */ jsx(ChevronsUpDown, { "aria-hidden": "true", className });
|
|
2474
2356
|
return direction === "asc" ? /* @__PURE__ */ jsx(ChevronUp, { "aria-hidden": "true", className }) : /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": "true", className });
|
|
2475
2357
|
}
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
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 = {
|
|
2479
2792
|
reset: "Reset filters",
|
|
2480
2793
|
emptyTitle: "No results",
|
|
2481
2794
|
emptyDescription: "Try clearing the search or adjusting the filters.",
|
|
2482
2795
|
noDataTitle: "No data yet",
|
|
2483
2796
|
noDataDescription: "Nothing has been added here so far."
|
|
2484
2797
|
};
|
|
2485
|
-
var FILTER_WIDTH_CLASS = {
|
|
2486
|
-
narrow: "w-32",
|
|
2487
|
-
default: "w-44",
|
|
2488
|
-
wide: "w-56"
|
|
2489
|
-
};
|
|
2490
2798
|
function ListPage({
|
|
2491
2799
|
title,
|
|
2492
2800
|
description,
|
|
@@ -2497,8 +2805,6 @@ function ListPage({
|
|
|
2497
2805
|
getRowId,
|
|
2498
2806
|
isLoading = false,
|
|
2499
2807
|
loadingRowCount,
|
|
2500
|
-
searchValue,
|
|
2501
|
-
onSearchChange,
|
|
2502
2808
|
filters,
|
|
2503
2809
|
filterValues,
|
|
2504
2810
|
onFilterChange,
|
|
@@ -2513,59 +2819,30 @@ function ListPage({
|
|
|
2513
2819
|
labels: labelsProp,
|
|
2514
2820
|
className
|
|
2515
2821
|
}) {
|
|
2516
|
-
const labels = { ...
|
|
2517
|
-
const
|
|
2518
|
-
const
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
const current = filterValues?.[f.key];
|
|
2523
|
-
const def = f.options[0]?.value ?? "";
|
|
2524
|
-
if (current !== void 0 && current !== def) return true;
|
|
2525
|
-
}
|
|
2526
|
-
return false;
|
|
2527
|
-
}, [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
|
+
);
|
|
2528
2828
|
const reset = () => {
|
|
2529
|
-
onSearchChange?.("");
|
|
2530
2829
|
for (const f of filters ?? []) {
|
|
2531
|
-
|
|
2532
|
-
onFilterChange?.(f.key, def);
|
|
2830
|
+
onFilterChange?.(f.key, filterDefaultValue(f));
|
|
2533
2831
|
}
|
|
2534
2832
|
};
|
|
2535
2833
|
const tableMode = isLoading ? "loading" : data.length === 0 && !hasActiveQuery ? "no-data" : data.length === 0 && hasActiveQuery ? "no-results" : "rows";
|
|
2536
2834
|
return /* @__PURE__ */ jsxs("div", { "data-slot": "list-page", className: cn("space-y-6", className), children: [
|
|
2537
2835
|
/* @__PURE__ */ jsx(PageHeader, { title, description, bordered, actions }),
|
|
2538
|
-
showFilterBar ? /* @__PURE__ */
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
wrapperClassName: "sm:max-w-xs",
|
|
2549
|
-
disabled: isLoading
|
|
2550
|
-
}
|
|
2551
|
-
) : null,
|
|
2552
|
-
filters?.map((f) => /* @__PURE__ */ jsx(
|
|
2553
|
-
Select,
|
|
2554
|
-
{
|
|
2555
|
-
"aria-label": typeof f.label === "string" ? f.label : f.key,
|
|
2556
|
-
value: filterValues?.[f.key] ?? f.options[0]?.value ?? "",
|
|
2557
|
-
onValueChange: (v) => onFilterChange?.(f.key, v),
|
|
2558
|
-
options: f.options,
|
|
2559
|
-
className: FILTER_WIDTH_CLASS[f.width ?? "default"],
|
|
2560
|
-
disabled: isLoading
|
|
2561
|
-
},
|
|
2562
|
-
f.key
|
|
2563
|
-
)),
|
|
2564
|
-
hasActiveQuery && !isLoading ? /* @__PURE__ */ jsxs(Button, { variant: "ghost", onClick: reset, children: [
|
|
2565
|
-
/* @__PURE__ */ jsx(RefreshCw, {}),
|
|
2566
|
-
labels.reset
|
|
2567
|
-
] }) : null
|
|
2568
|
-
] }) : 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,
|
|
2569
2846
|
tableMode === "loading" || tableMode === "rows" ? /* @__PURE__ */ jsx(
|
|
2570
2847
|
Table,
|
|
2571
2848
|
{
|
|
@@ -2985,6 +3262,6 @@ function Tooltip({
|
|
|
2985
3262
|
);
|
|
2986
3263
|
}
|
|
2987
3264
|
|
|
2988
|
-
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 };
|
|
2989
3266
|
//# sourceMappingURL=index.js.map
|
|
2990
3267
|
//# sourceMappingURL=index.js.map
|