@dimaan/ui 0.0.21 → 0.0.23

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 CHANGED
@@ -299,7 +299,9 @@ function DashboardContent({ className, children, ...props }) {
299
299
  "main",
300
300
  {
301
301
  className: cn(
302
- "flex min-h-[calc(100vh-var(--header-height))] flex-1 flex-col gap-6 p-4 sm:p-6 lg:p-8",
302
+ // `min-w-0` keeps wide children (Table, code blocks) scrolling within
303
+ // this column instead of widening the page past 100%.
304
+ "flex min-h-[calc(100vh-var(--header-height))] min-w-0 flex-1 flex-col gap-6 p-4 sm:p-6 lg:p-8",
303
305
  className
304
306
  ),
305
307
  ...props,
@@ -365,7 +367,10 @@ function DashboardMain({ className, children, ...props }) {
365
367
  "div",
366
368
  {
367
369
  className: cn(
368
- "flex min-h-screen flex-1 flex-col transition-[margin] duration-200 ease-out",
370
+ // `min-w-0` lets this flex column shrink below its content's intrinsic
371
+ // width so wide children (e.g. a Table) scroll internally instead of
372
+ // stretching the whole layout past 100%.
373
+ "flex min-h-screen min-w-0 flex-1 flex-col transition-[margin] duration-200 ease-out",
369
374
  // On desktop, push the main column past the fixed sidebar using logical margin.
370
375
  collapsed ? "lg:ms-[var(--sidebar-width-collapsed)]" : "lg:ms-[var(--sidebar-width)]",
371
376
  className
@@ -1375,15 +1380,20 @@ var detailPageBaseClass = "flex w-full flex-col gap-6";
1375
1380
  var detailPageBodyClass = "flex flex-col gap-6";
1376
1381
  var detailPageSkeletonRowClass = "h-5 w-full animate-pulse rounded-md bg-muted";
1377
1382
  var detailPageEmptyClass = "rounded-md border border-border bg-card";
1378
- var DEFAULT_LABELS = {
1383
+ var DEFAULT_LABELS_LTR = {
1384
+ back: "Back",
1379
1385
  notFoundTitle: "Not found",
1380
1386
  notFoundDescription: "The record you\u2019re looking for does not exist or has been removed."
1381
1387
  };
1388
+ var DEFAULT_LABELS_RTL = {
1389
+ back: "\u0631\u062C\u0648\u0639",
1390
+ notFoundTitle: "\u063A\u064A\u0631 \u0645\u0648\u062C\u0648\u062F",
1391
+ 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."
1392
+ };
1382
1393
  var DEFAULT_SKELETON_ROW_COUNT = 6;
1383
1394
  function DetailPage({
1384
1395
  title,
1385
1396
  description,
1386
- back,
1387
1397
  actions,
1388
1398
  bordered = true,
1389
1399
  isLoading = false,
@@ -1395,7 +1405,10 @@ function DetailPage({
1395
1405
  className,
1396
1406
  bodyClassName
1397
1407
  }) {
1398
- const labels = { ...DEFAULT_LABELS, ...labelsProp };
1408
+ const navigate = reactRouterDom.useNavigate();
1409
+ const dir = useDirection();
1410
+ const defaults = dir === "rtl" ? DEFAULT_LABELS_RTL : DEFAULT_LABELS_LTR;
1411
+ const labels = { ...defaults, ...labelsProp };
1399
1412
  return /* @__PURE__ */ jsxRuntime.jsxs(
1400
1413
  "div",
1401
1414
  {
@@ -1409,7 +1422,7 @@ function DetailPage({
1409
1422
  {
1410
1423
  title,
1411
1424
  description,
1412
- back,
1425
+ back: { label: labels.back, onClick: () => navigate(-1) },
1413
1426
  actions,
1414
1427
  bordered
1415
1428
  }
@@ -1717,19 +1730,231 @@ function mergeRefs(...refs) {
1717
1730
  };
1718
1731
  }
1719
1732
 
1733
+ // src/components/file-upload/fileUploadVariants.ts
1734
+ var fileUploadBaseClass = "flex w-full min-w-0 flex-col gap-2";
1735
+ var fileUploadDropzoneClass = "flex cursor-pointer flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed border-input bg-muted/40 px-6 py-8 text-center transition-colors hover:border-ring peer-focus-visible:border-ring peer-focus-visible:ring-2 peer-focus-visible:ring-ring/40 data-[drag-active=true]:border-ring data-[drag-active=true]:bg-accent data-[invalid=true]:border-destructive data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50 data-[disabled=true]:hover:border-input";
1736
+ var fileUploadIconClass = "size-8 text-muted-foreground";
1737
+ var fileUploadPromptClass = "text-sm text-foreground";
1738
+ var fileUploadHintClass = "text-xs text-muted-foreground";
1739
+ var fileUploadFileRowClass = "flex items-center justify-between gap-2 rounded-md border border-border bg-card px-3 py-2";
1740
+ var fileUploadFileNameClass = "truncate text-sm font-medium text-foreground";
1741
+ var fileUploadFileSizeClass = "text-xs text-muted-foreground";
1742
+ var fileUploadRemoveClass = "inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 disabled:pointer-events-none disabled:opacity-50";
1743
+ var DEFAULT_MAX_SIZE_MB = 5;
1744
+ var DEFAULT_LABELS_LTR2 = {
1745
+ prompt: "Drag & drop a file or click to browse",
1746
+ remove: "Remove"
1747
+ };
1748
+ var DEFAULT_LABELS_RTL2 = {
1749
+ prompt: "\u0627\u0633\u062D\u0628 \u0648\u0623\u0641\u0644\u062A \u0645\u0644\u0641\u064B\u0627 \u0623\u0648 \u0627\u0636\u063A\u0637 \u0644\u0644\u0627\u062E\u062A\u064A\u0627\u0631",
1750
+ remove: "\u0625\u0632\u0627\u0644\u0629"
1751
+ };
1752
+ function normalizeFiles(value) {
1753
+ if (Array.isArray(value)) return value.filter((f) => f instanceof File);
1754
+ return value instanceof File ? [value] : [];
1755
+ }
1756
+ function fileKey(file) {
1757
+ return `${file.name}:${file.size}:${file.lastModified}`;
1758
+ }
1759
+ function formatBytes(bytes) {
1760
+ if (bytes < 1024) return `${bytes} B`;
1761
+ const kb = bytes / 1024;
1762
+ if (kb < 1024) return `${kb.toFixed(1)} KB`;
1763
+ return `${(kb / 1024).toFixed(1)} MB`;
1764
+ }
1765
+ function matchesAccept(file, accept) {
1766
+ if (!accept) return true;
1767
+ const tokens = accept.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean);
1768
+ if (tokens.length === 0 || tokens.includes("*") || tokens.includes("*/*")) return true;
1769
+ const name = file.name.toLowerCase();
1770
+ const type = file.type.toLowerCase();
1771
+ return tokens.some((token) => {
1772
+ if (token.startsWith(".")) return name.endsWith(token);
1773
+ if (token.endsWith("/*")) return type.startsWith(token.slice(0, -1));
1774
+ return type === token;
1775
+ });
1776
+ }
1777
+ var FileUploadImpl = react.forwardRef(
1778
+ function FileUpload(props, ref) {
1779
+ const {
1780
+ multiple = false,
1781
+ accept,
1782
+ maxSize = DEFAULT_MAX_SIZE_MB,
1783
+ disabled = false,
1784
+ required,
1785
+ name,
1786
+ id,
1787
+ onError,
1788
+ onBlur,
1789
+ labels: labelsProp,
1790
+ className,
1791
+ value,
1792
+ defaultValue,
1793
+ onValueChange,
1794
+ onChange,
1795
+ "aria-invalid": ariaInvalid,
1796
+ "aria-describedby": ariaDescribedBy,
1797
+ "aria-label": ariaLabel
1798
+ } = props;
1799
+ const dir = useDirection();
1800
+ const generatedId = react.useId();
1801
+ const inputId = id ?? generatedId;
1802
+ const [dragActive, setDragActive] = react.useState(false);
1803
+ const baseLabels = dir === "rtl" ? DEFAULT_LABELS_RTL2 : DEFAULT_LABELS_LTR2;
1804
+ const prompt = labelsProp?.prompt ?? baseLabels.prompt;
1805
+ const removeLabel = labelsProp?.remove ?? baseLabels.remove;
1806
+ const hint = labelsProp?.hint ?? (dir === "rtl" ? `\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 ${maxSize} \u0645\u064A\u062C\u0627\u0628\u0627\u064A\u062A` : `Max ${maxSize} MB`);
1807
+ const isControlled = value !== void 0;
1808
+ const [internal, setInternal] = react.useState(() => normalizeFiles(defaultValue));
1809
+ const files = isControlled ? normalizeFiles(value) : internal;
1810
+ const invalid = ariaInvalid === true || ariaInvalid === "true";
1811
+ const emit = (next) => {
1812
+ if (!isControlled) setInternal(next);
1813
+ onValueChange?.(multiple ? next : next[0] ?? null);
1814
+ onChange?.(multiple ? next : next[0] ?? null);
1815
+ };
1816
+ const tooLargeMessage = (file) => dir === "rtl" ? `${file.name} \u0623\u0643\u0628\u0631 \u0645\u0646 ${maxSize} \u0645\u064A\u062C\u0627\u0628\u0627\u064A\u062A` : `${file.name} is larger than ${maxSize} MB`;
1817
+ const wrongTypeMessage = (file) => dir === "rtl" ? `${file.name} \u0644\u064A\u0633 \u0646\u0648\u0639 \u0645\u0644\u0641 \u0645\u0642\u0628\u0648\u0644` : `${file.name} is not an accepted file type`;
1818
+ const addFiles = (incoming) => {
1819
+ if (disabled) return;
1820
+ const accepted = [];
1821
+ for (const file of Array.from(incoming)) {
1822
+ if (!matchesAccept(file, accept)) {
1823
+ onError?.({ code: "file-type-rejected", message: wrongTypeMessage(file), file });
1824
+ continue;
1825
+ }
1826
+ if (maxSize && file.size > maxSize * 1024 * 1024) {
1827
+ onError?.({ code: "file-too-large", message: tooLargeMessage(file), file });
1828
+ continue;
1829
+ }
1830
+ accepted.push(file);
1831
+ }
1832
+ if (accepted.length === 0) return;
1833
+ if (!multiple) {
1834
+ const [first] = accepted;
1835
+ if (first) emit([first]);
1836
+ return;
1837
+ }
1838
+ const byKey = new Map(files.map((f) => [fileKey(f), f]));
1839
+ for (const f of accepted) byKey.set(fileKey(f), f);
1840
+ emit([...byKey.values()]);
1841
+ };
1842
+ const handleInputChange = (event) => {
1843
+ if (event.target.files) addFiles(event.target.files);
1844
+ event.target.value = "";
1845
+ };
1846
+ const handleDrag = (event) => {
1847
+ event.preventDefault();
1848
+ event.stopPropagation();
1849
+ if (disabled) return;
1850
+ if (event.type === "dragenter" || event.type === "dragover") setDragActive(true);
1851
+ else if (event.type === "dragleave") setDragActive(false);
1852
+ };
1853
+ const handleDrop = (event) => {
1854
+ event.preventDefault();
1855
+ event.stopPropagation();
1856
+ setDragActive(false);
1857
+ if (!disabled && event.dataTransfer.files) addFiles(event.dataTransfer.files);
1858
+ };
1859
+ const remove = (file) => emit(files.filter((f) => fileKey(f) !== fileKey(file)));
1860
+ const showDropzone = multiple || files.length === 0;
1861
+ return (
1862
+ // biome-ignore lint/a11y/noStaticElementInteractions: drag-and-drop is a wrapper affordance; keyboard/click access is the inner <label> + focusable <input>.
1863
+ /* @__PURE__ */ jsxRuntime.jsxs(
1864
+ "div",
1865
+ {
1866
+ ref,
1867
+ "data-slot": "file-upload",
1868
+ className: cn(fileUploadBaseClass, className),
1869
+ onDragEnter: handleDrag,
1870
+ onDragOver: handleDrag,
1871
+ onDragLeave: handleDrag,
1872
+ onDrop: handleDrop,
1873
+ children: [
1874
+ /* @__PURE__ */ jsxRuntime.jsx(
1875
+ "input",
1876
+ {
1877
+ id: inputId,
1878
+ type: "file",
1879
+ accept,
1880
+ multiple,
1881
+ name,
1882
+ required,
1883
+ disabled,
1884
+ onChange: handleInputChange,
1885
+ onBlur,
1886
+ "aria-invalid": ariaInvalid,
1887
+ "aria-describedby": ariaDescribedBy,
1888
+ "aria-label": ariaLabel,
1889
+ className: "peer sr-only"
1890
+ }
1891
+ ),
1892
+ showDropzone ? /* @__PURE__ */ jsxRuntime.jsxs(
1893
+ "label",
1894
+ {
1895
+ htmlFor: inputId,
1896
+ "data-slot": "file-upload-dropzone",
1897
+ "data-drag-active": dragActive ? "true" : void 0,
1898
+ "data-invalid": invalid ? "true" : void 0,
1899
+ "data-disabled": disabled ? "true" : void 0,
1900
+ className: fileUploadDropzoneClass,
1901
+ children: [
1902
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { "aria-hidden": "true", className: fileUploadIconClass }),
1903
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: fileUploadPromptClass, children: prompt }),
1904
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: fileUploadHintClass, children: hint })
1905
+ ]
1906
+ }
1907
+ ) : null,
1908
+ files.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "flex flex-col gap-2", children: files.map((file) => /* @__PURE__ */ jsxRuntime.jsxs(
1909
+ "li",
1910
+ {
1911
+ "data-slot": "file-upload-file",
1912
+ className: fileUploadFileRowClass,
1913
+ children: [
1914
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
1915
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.File, { "aria-hidden": "true", className: "size-5 shrink-0 text-muted-foreground" }),
1916
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
1917
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: fileUploadFileNameClass, children: file.name }),
1918
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: fileUploadFileSizeClass, children: formatBytes(file.size) })
1919
+ ] })
1920
+ ] }),
1921
+ /* @__PURE__ */ jsxRuntime.jsx(
1922
+ "button",
1923
+ {
1924
+ type: "button",
1925
+ disabled,
1926
+ "aria-label": `${removeLabel}: ${file.name}`,
1927
+ "data-slot": "file-upload-remove",
1928
+ className: fileUploadRemoveClass,
1929
+ onClick: () => remove(file),
1930
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { "aria-hidden": "true", className: "size-4" })
1931
+ }
1932
+ )
1933
+ ]
1934
+ },
1935
+ fileKey(file)
1936
+ )) }) : null
1937
+ ]
1938
+ }
1939
+ )
1940
+ );
1941
+ }
1942
+ );
1943
+ var FileUpload2 = FileUploadImpl;
1944
+
1720
1945
  // src/components/form-page/formPageVariants.ts
1721
1946
  var formPageBaseClass = "flex w-full flex-col gap-6";
1722
1947
  var formPageBodyClass = "flex-1";
1723
1948
  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";
1724
1949
  var formPageSkeletonRowClass = "h-10 w-full animate-pulse rounded-md bg-muted";
1725
1950
  var DEFAULT_SKELETON_ROW_COUNT2 = 6;
1726
- var DEFAULT_LABELS_LTR = {
1951
+ var DEFAULT_LABELS_LTR3 = {
1727
1952
  back: "Back",
1728
1953
  cancel: "Cancel",
1729
1954
  save: "Save",
1730
1955
  saving: "Saving\u2026"
1731
1956
  };
1732
- var DEFAULT_LABELS_RTL = {
1957
+ var DEFAULT_LABELS_RTL3 = {
1733
1958
  back: "\u0631\u062C\u0648\u0639",
1734
1959
  cancel: "\u0625\u0644\u063A\u0627\u0621",
1735
1960
  save: "\u062D\u0641\u0638",
@@ -1756,7 +1981,7 @@ function FormPage({
1756
1981
  const dir = useDirection();
1757
1982
  const formContext = reactHookForm.useFormContext();
1758
1983
  const submitting = isSubmitting ?? formContext?.formState?.isSubmitting ?? false;
1759
- const defaults = dir === "rtl" ? DEFAULT_LABELS_RTL : DEFAULT_LABELS_LTR;
1984
+ const defaults = dir === "rtl" ? DEFAULT_LABELS_RTL3 : DEFAULT_LABELS_LTR3;
1760
1985
  const labels = { ...defaults, ...labelsProp };
1761
1986
  const goBack = () => navigate(-1);
1762
1987
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "form-page", className: cn(formPageBaseClass, className), children: [
@@ -1924,132 +2149,6 @@ function LanguageSwitcher({
1924
2149
  }
1925
2150
  );
1926
2151
  }
1927
-
1928
- // src/components/select/selectVariants.ts
1929
- var selectVariantClass = {
1930
- default: "border border-input bg-background hover:border-ring",
1931
- filled: "border border-transparent bg-muted hover:bg-muted/80",
1932
- ghost: "border border-transparent bg-transparent hover:bg-accent"
1933
- };
1934
- var selectSizeClass = {
1935
- sm: "h-8 rounded-md ps-2.5 pe-8 text-sm",
1936
- md: "h-9 rounded-md ps-3 pe-9 text-sm",
1937
- lg: "h-11 rounded-md ps-4 pe-10 text-base"
1938
- };
1939
- 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";
1940
- 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";
1941
- var selectViewportClass = "p-1";
1942
- 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";
1943
- 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";
1944
- var selectGroupLabelClass = "px-2 py-1.5 text-xs font-semibold text-muted-foreground";
1945
- var selectSeparatorClass = "-mx-1 my-1 h-px bg-border";
1946
- function isGroupedOptions(options) {
1947
- const first = options[0];
1948
- return first !== void 0 && "options" in first;
1949
- }
1950
- var Select = react.forwardRef(function Select2({
1951
- variant = "default",
1952
- selectSize = "md",
1953
- options,
1954
- placeholder,
1955
- value,
1956
- defaultValue,
1957
- onValueChange,
1958
- onChange,
1959
- onBlur,
1960
- name,
1961
- disabled,
1962
- required,
1963
- id,
1964
- className,
1965
- "aria-invalid": ariaInvalid,
1966
- "aria-describedby": ariaDescribedBy,
1967
- "aria-label": ariaLabel,
1968
- children
1969
- }, ref) {
1970
- const generatedId = react.useId();
1971
- const triggerId = id ?? generatedId;
1972
- const handleValueChange = react.useCallback(
1973
- (next) => {
1974
- onValueChange?.(next);
1975
- if (onChange) {
1976
- const synthetic = {
1977
- target: { value: next, name },
1978
- currentTarget: { value: next, name },
1979
- type: "change"
1980
- };
1981
- onChange(synthetic);
1982
- }
1983
- },
1984
- [onValueChange, onChange, name]
1985
- );
1986
- return /* @__PURE__ */ jsxRuntime.jsxs(
1987
- RadixSelect__namespace.Root,
1988
- {
1989
- value,
1990
- defaultValue,
1991
- onValueChange: handleValueChange,
1992
- disabled,
1993
- required,
1994
- name,
1995
- children: [
1996
- /* @__PURE__ */ jsxRuntime.jsxs(
1997
- RadixSelect__namespace.Trigger,
1998
- {
1999
- ref,
2000
- id: triggerId,
2001
- "aria-label": ariaLabel,
2002
- "aria-invalid": ariaInvalid,
2003
- "aria-describedby": ariaDescribedBy,
2004
- onBlur,
2005
- "data-slot": "select-trigger",
2006
- className: cn(
2007
- selectBaseClass,
2008
- selectVariantClass[variant],
2009
- selectSizeClass[selectSize],
2010
- className
2011
- ),
2012
- children: [
2013
- /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Value, { placeholder }),
2014
- /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "pointer-events-none absolute end-3 top-1/2 size-4 shrink-0 -translate-y-1/2 text-muted-foreground" }) })
2015
- ]
2016
- }
2017
- ),
2018
- /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
2019
- RadixSelect__namespace.Content,
2020
- {
2021
- position: "popper",
2022
- sideOffset: 4,
2023
- "data-slot": "select-content",
2024
- className: selectContentClass,
2025
- children: [
2026
- /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.ScrollUpButton, { className: "flex h-6 cursor-default items-center justify-center bg-popover text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { className: "size-4" }) }),
2027
- /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Viewport, { className: selectViewportClass, children: children ?? (options ? renderOptions(options) : null) }),
2028
- /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.ScrollDownButton, { className: "flex h-6 cursor-default items-center justify-center bg-popover text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "size-4" }) })
2029
- ]
2030
- }
2031
- ) })
2032
- ]
2033
- }
2034
- );
2035
- });
2036
- function renderOptions(options) {
2037
- if (isGroupedOptions(options)) {
2038
- const lastIndex = options.length - 1;
2039
- return options.map((group, idx) => /* @__PURE__ */ jsxRuntime.jsxs(RadixSelect__namespace.Group, { children: [
2040
- /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Label, { className: selectGroupLabelClass, children: group.label }),
2041
- group.options.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value)),
2042
- idx < lastIndex && /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Separator, { className: selectSeparatorClass })
2043
- ] }, group.label));
2044
- }
2045
- return options.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value));
2046
- }
2047
- var SelectItem = react.forwardRef(function SelectItem2({ className, children, ...props }, ref) {
2048
- return /* @__PURE__ */ jsxRuntime.jsxs(RadixSelect__namespace.Item, { ref, className: cn(selectItemClass, className), ...props, children: [
2049
- /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.ItemIndicator, { className: selectItemIndicatorClass, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, {}) }),
2050
- /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.ItemText, { children })
2051
- ] });
2052
- });
2053
2152
  var EN_LABELS = {
2054
2153
  rowsPerPage: "Rows per page",
2055
2154
  pageRangeOf: "of",
@@ -2173,17 +2272,17 @@ var tableSizeClass = {
2173
2272
  sm: {
2174
2273
  row: "",
2175
2274
  cell: "px-3 py-1.5 text-xs",
2176
- head: "px-3 py-2 text-xs font-medium"
2275
+ head: "whitespace-nowrap px-3 py-2 text-xs font-medium"
2177
2276
  },
2178
2277
  md: {
2179
2278
  row: "",
2180
2279
  cell: "px-4 py-2.5 text-sm",
2181
- head: "px-4 py-2.5 text-xs font-medium uppercase tracking-wide"
2280
+ head: "whitespace-nowrap px-4 py-2.5 text-xs font-medium uppercase tracking-wide"
2182
2281
  },
2183
2282
  lg: {
2184
2283
  row: "",
2185
2284
  cell: "px-5 py-3.5 text-sm",
2186
- head: "px-5 py-3 text-sm font-medium"
2285
+ head: "whitespace-nowrap px-5 py-3 text-sm font-medium"
2187
2286
  }
2188
2287
  };
2189
2288
  var tableBaseClass = "w-full caption-bottom border-collapse";
@@ -2300,7 +2399,7 @@ function Table(props) {
2300
2399
  const sizeClasses = tableSizeClass[size];
2301
2400
  const showToolbar = enableRowSelection && bulkActions !== void 0 && selected.size > 0;
2302
2401
  const skeletonCount = loadingRowCount ?? pageSize;
2303
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex w-full flex-col gap-3", className), children: [
2402
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex w-full min-w-0 flex-col gap-3", className), children: [
2304
2403
  showToolbar && /* @__PURE__ */ jsxRuntime.jsx(
2305
2404
  Toolbar,
2306
2405
  {
@@ -2333,7 +2432,9 @@ function Table(props) {
2333
2432
  "thead",
2334
2433
  {
2335
2434
  className: cn(
2336
- "bg-muted/40 text-muted-foreground",
2435
+ // Opaque (not bg-muted/40) so a sticky header fully hides the rows
2436
+ // scrolling underneath it.
2437
+ "bg-muted text-muted-foreground",
2337
2438
  maxHeight !== void 0 && "sticky top-0 z-10"
2338
2439
  ),
2339
2440
  children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
@@ -2501,20 +2602,446 @@ function SortIndicator({ active, direction }) {
2501
2602
  if (!active) return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, { "aria-hidden": "true", className });
2502
2603
  return direction === "asc" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { "aria-hidden": "true", className }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { "aria-hidden": "true", className });
2503
2604
  }
2504
- var DEFAULT_LABELS2 = {
2505
- searchPlaceholder: "Search\u2026",
2506
- searchAriaLabel: "Search",
2605
+
2606
+ // src/components/select/selectVariants.ts
2607
+ var selectVariantClass = {
2608
+ default: "border border-input bg-background hover:border-ring",
2609
+ filled: "border border-transparent bg-muted hover:bg-muted/80",
2610
+ ghost: "border border-transparent bg-transparent hover:bg-accent"
2611
+ };
2612
+ var selectSizeClass = {
2613
+ sm: "h-8 rounded-md ps-2.5 pe-8 text-sm",
2614
+ md: "h-9 rounded-md ps-3 pe-9 text-sm",
2615
+ lg: "h-11 rounded-md ps-4 pe-10 text-base"
2616
+ };
2617
+ 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";
2618
+ 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";
2619
+ var selectViewportClass = "p-1";
2620
+ 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";
2621
+ 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";
2622
+ var selectGroupLabelClass = "px-2 py-1.5 text-xs font-semibold text-muted-foreground";
2623
+ var selectSeparatorClass = "-mx-1 my-1 h-px bg-border";
2624
+
2625
+ // src/components/multi-select/multiSelectVariants.ts
2626
+ var multiSelectTriggerSizeClass = {
2627
+ sm: "min-h-8 rounded-md ps-2.5 pe-8 py-1 text-sm",
2628
+ md: "min-h-9 rounded-md ps-3 pe-9 py-1 text-sm",
2629
+ lg: "min-h-11 rounded-md ps-4 pe-10 py-1.5 text-base"
2630
+ };
2631
+ var multiSelectValueRowClass = "flex min-w-0 flex-1 flex-wrap items-center gap-1";
2632
+ var multiSelectChipClass = "max-w-full gap-1 pe-1";
2633
+ 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";
2634
+ 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";
2635
+ var multiSelectSearchRowClass = "border-b border-border p-1";
2636
+ var multiSelectListClass = "max-h-60 overflow-y-auto overflow-x-hidden p-1";
2637
+ 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";
2638
+ var multiSelectEmptyClass = "px-2 py-6 text-center text-sm text-muted-foreground";
2639
+ var DEFAULT_LABELS_LTR4 = {
2640
+ search: "Search\u2026",
2641
+ empty: "No results"
2642
+ };
2643
+ var DEFAULT_LABELS_RTL4 = {
2644
+ search: "\u0628\u062D\u062B\u2026",
2645
+ empty: "\u0644\u0627 \u0646\u062A\u0627\u0626\u062C"
2646
+ };
2647
+ function toArray(value) {
2648
+ return Array.isArray(value) ? value : [];
2649
+ }
2650
+ var MultiSelect = react.forwardRef(function MultiSelect2({
2651
+ variant = "default",
2652
+ selectSize = "md",
2653
+ options,
2654
+ placeholder,
2655
+ value,
2656
+ defaultValue,
2657
+ onValueChange,
2658
+ onChange,
2659
+ onBlur,
2660
+ searchable = true,
2661
+ maxTagCount,
2662
+ labels: labelsProp,
2663
+ name,
2664
+ disabled = false,
2665
+ required,
2666
+ id,
2667
+ className,
2668
+ contentClassName,
2669
+ "aria-invalid": ariaInvalid,
2670
+ "aria-describedby": ariaDescribedBy,
2671
+ "aria-label": ariaLabel
2672
+ }, ref) {
2673
+ const dir = useDirection();
2674
+ const labels = { ...dir === "rtl" ? DEFAULT_LABELS_RTL4 : DEFAULT_LABELS_LTR4, ...labelsProp };
2675
+ const generatedId = react.useId();
2676
+ const triggerId = id ?? generatedId;
2677
+ const isControlled = value !== void 0;
2678
+ const [internal, setInternal] = react.useState(() => toArray(defaultValue));
2679
+ const selected = isControlled ? toArray(value) : internal;
2680
+ const [open, setOpen] = react.useState(false);
2681
+ const [query, setQuery] = react.useState("");
2682
+ const labelByValue = react.useMemo(() => new Map(options.map((o) => [o.value, o.label])), [options]);
2683
+ const filtered = react.useMemo(() => {
2684
+ const q = query.trim().toLowerCase();
2685
+ if (!searchable || q === "") return options;
2686
+ return options.filter((o) => o.label.toLowerCase().includes(q));
2687
+ }, [options, query, searchable]);
2688
+ const emit = (next) => {
2689
+ if (!isControlled) setInternal(next);
2690
+ onValueChange?.(next);
2691
+ onChange?.(next);
2692
+ };
2693
+ const toggle = (optionValue) => {
2694
+ emit(
2695
+ selected.includes(optionValue) ? selected.filter((v) => v !== optionValue) : [...selected, optionValue]
2696
+ );
2697
+ };
2698
+ const remove = (optionValue) => emit(selected.filter((v) => v !== optionValue));
2699
+ const openOnKeys = (event) => {
2700
+ if (disabled) return;
2701
+ if (event.key === "Enter" || event.key === " " || event.key === "ArrowDown") {
2702
+ event.preventDefault();
2703
+ setOpen(true);
2704
+ }
2705
+ };
2706
+ const shownValues = maxTagCount !== void 0 ? selected.slice(0, maxTagCount) : selected;
2707
+ const overflowCount = selected.length - shownValues.length;
2708
+ return /* @__PURE__ */ jsxRuntime.jsxs(RadixPopover__namespace.Root, { open, onOpenChange: setOpen, children: [
2709
+ /* @__PURE__ */ jsxRuntime.jsx(RadixPopover__namespace.Anchor, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
2710
+ "div",
2711
+ {
2712
+ ref,
2713
+ id: triggerId,
2714
+ role: "button",
2715
+ tabIndex: disabled ? -1 : 0,
2716
+ "aria-haspopup": "listbox",
2717
+ "aria-expanded": open,
2718
+ "aria-disabled": disabled || void 0,
2719
+ "aria-label": ariaLabel,
2720
+ "aria-invalid": ariaInvalid,
2721
+ "aria-describedby": ariaDescribedBy,
2722
+ "data-slot": "multi-select-trigger",
2723
+ "data-state": open ? "open" : "closed",
2724
+ "data-placeholder": selected.length === 0 ? "" : void 0,
2725
+ onClick: () => !disabled && setOpen(true),
2726
+ onKeyDown: openOnKeys,
2727
+ onBlur,
2728
+ className: cn(
2729
+ selectBaseClass,
2730
+ selectVariantClass[variant],
2731
+ multiSelectTriggerSizeClass[selectSize],
2732
+ className
2733
+ ),
2734
+ children: [
2735
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: multiSelectValueRowClass, children: selected.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-muted-foreground", children: placeholder }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2736
+ shownValues.map((v) => /* @__PURE__ */ jsxRuntime.jsxs(Badge, { variant: "default", size: "sm", className: multiSelectChipClass, children: [
2737
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: labelByValue.get(v) ?? v }),
2738
+ /* @__PURE__ */ jsxRuntime.jsx(
2739
+ "button",
2740
+ {
2741
+ type: "button",
2742
+ tabIndex: -1,
2743
+ "aria-label": `Remove ${labelByValue.get(v) ?? v}`,
2744
+ "data-slot": "multi-select-chip-remove",
2745
+ className: multiSelectChipRemoveClass,
2746
+ onClick: (event) => {
2747
+ event.stopPropagation();
2748
+ if (!disabled) remove(v);
2749
+ },
2750
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { "aria-hidden": "true", className: "size-3" })
2751
+ }
2752
+ )
2753
+ ] }, v)),
2754
+ overflowCount > 0 ? /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "default", size: "sm", children: `+${overflowCount}` }) : null
2755
+ ] }) }),
2756
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "pointer-events-none absolute end-3 top-1/2 size-4 shrink-0 -translate-y-1/2 text-muted-foreground" }),
2757
+ name ? /* @__PURE__ */ jsxRuntime.jsx(
2758
+ "input",
2759
+ {
2760
+ type: "hidden",
2761
+ name,
2762
+ value: selected.join(","),
2763
+ required,
2764
+ readOnly: true
2765
+ }
2766
+ ) : null
2767
+ ]
2768
+ }
2769
+ ) }),
2770
+ /* @__PURE__ */ jsxRuntime.jsx(RadixPopover__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
2771
+ RadixPopover__namespace.Content,
2772
+ {
2773
+ align: "start",
2774
+ sideOffset: 4,
2775
+ "data-slot": "multi-select-content",
2776
+ className: cn(multiSelectContentClass, contentClassName),
2777
+ onOpenAutoFocus: (event) => {
2778
+ if (!searchable) event.preventDefault();
2779
+ },
2780
+ children: [
2781
+ searchable ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: multiSelectSearchRowClass, children: /* @__PURE__ */ jsxRuntime.jsx(
2782
+ Input,
2783
+ {
2784
+ type: "search",
2785
+ inputSize: "sm",
2786
+ value: query,
2787
+ onChange: (e) => setQuery(e.target.value),
2788
+ placeholder: labels.search,
2789
+ "aria-label": labels.search,
2790
+ leadingIcon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "size-4" })
2791
+ }
2792
+ ) }) : null,
2793
+ filtered.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: multiSelectEmptyClass, children: labels.empty }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: multiSelectListClass, children: filtered.map((option) => {
2794
+ const isSelected = selected.includes(option.value);
2795
+ const optionId = `${triggerId}-opt-${option.value}`;
2796
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2797
+ "label",
2798
+ {
2799
+ htmlFor: optionId,
2800
+ "data-slot": "multi-select-option",
2801
+ "data-selected": isSelected ? "true" : void 0,
2802
+ className: multiSelectOptionClass,
2803
+ children: [
2804
+ /* @__PURE__ */ jsxRuntime.jsx(
2805
+ Checkbox,
2806
+ {
2807
+ id: optionId,
2808
+ size: "sm",
2809
+ checked: isSelected,
2810
+ disabled: option.disabled,
2811
+ onCheckedChange: () => toggle(option.value)
2812
+ }
2813
+ ),
2814
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: option.label })
2815
+ ]
2816
+ },
2817
+ option.value
2818
+ );
2819
+ }) })
2820
+ ]
2821
+ }
2822
+ ) })
2823
+ ] });
2824
+ });
2825
+ function isGroupedOptions(options) {
2826
+ const first = options[0];
2827
+ return first !== void 0 && "options" in first;
2828
+ }
2829
+ var Select = react.forwardRef(function Select2({
2830
+ variant = "default",
2831
+ selectSize = "md",
2832
+ options,
2833
+ placeholder,
2834
+ value,
2835
+ defaultValue,
2836
+ onValueChange,
2837
+ onChange,
2838
+ onBlur,
2839
+ name,
2840
+ disabled,
2841
+ required,
2842
+ id,
2843
+ className,
2844
+ "aria-invalid": ariaInvalid,
2845
+ "aria-describedby": ariaDescribedBy,
2846
+ "aria-label": ariaLabel,
2847
+ children
2848
+ }, ref) {
2849
+ const generatedId = react.useId();
2850
+ const triggerId = id ?? generatedId;
2851
+ const handleValueChange = react.useCallback(
2852
+ (next) => {
2853
+ onValueChange?.(next);
2854
+ if (onChange) {
2855
+ const synthetic = {
2856
+ target: { value: next, name },
2857
+ currentTarget: { value: next, name },
2858
+ type: "change"
2859
+ };
2860
+ onChange(synthetic);
2861
+ }
2862
+ },
2863
+ [onValueChange, onChange, name]
2864
+ );
2865
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2866
+ RadixSelect__namespace.Root,
2867
+ {
2868
+ value,
2869
+ defaultValue,
2870
+ onValueChange: handleValueChange,
2871
+ disabled,
2872
+ required,
2873
+ name,
2874
+ children: [
2875
+ /* @__PURE__ */ jsxRuntime.jsxs(
2876
+ RadixSelect__namespace.Trigger,
2877
+ {
2878
+ ref,
2879
+ id: triggerId,
2880
+ "aria-label": ariaLabel,
2881
+ "aria-invalid": ariaInvalid,
2882
+ "aria-describedby": ariaDescribedBy,
2883
+ onBlur,
2884
+ "data-slot": "select-trigger",
2885
+ className: cn(
2886
+ selectBaseClass,
2887
+ selectVariantClass[variant],
2888
+ selectSizeClass[selectSize],
2889
+ className
2890
+ ),
2891
+ children: [
2892
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Value, { placeholder }),
2893
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "pointer-events-none absolute end-3 top-1/2 size-4 shrink-0 -translate-y-1/2 text-muted-foreground" }) })
2894
+ ]
2895
+ }
2896
+ ),
2897
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
2898
+ RadixSelect__namespace.Content,
2899
+ {
2900
+ position: "popper",
2901
+ sideOffset: 4,
2902
+ "data-slot": "select-content",
2903
+ className: selectContentClass,
2904
+ children: [
2905
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.ScrollUpButton, { className: "flex h-6 cursor-default items-center justify-center bg-popover text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { className: "size-4" }) }),
2906
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Viewport, { className: selectViewportClass, children: children ?? (options ? renderOptions(options) : null) }),
2907
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.ScrollDownButton, { className: "flex h-6 cursor-default items-center justify-center bg-popover text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "size-4" }) })
2908
+ ]
2909
+ }
2910
+ ) })
2911
+ ]
2912
+ }
2913
+ );
2914
+ });
2915
+ function renderOptions(options) {
2916
+ if (isGroupedOptions(options)) {
2917
+ const lastIndex = options.length - 1;
2918
+ return options.map((group, idx) => /* @__PURE__ */ jsxRuntime.jsxs(RadixSelect__namespace.Group, { children: [
2919
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Label, { className: selectGroupLabelClass, children: group.label }),
2920
+ group.options.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value)),
2921
+ idx < lastIndex && /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Separator, { className: selectSeparatorClass })
2922
+ ] }, group.label));
2923
+ }
2924
+ return options.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value));
2925
+ }
2926
+ var SelectItem = react.forwardRef(function SelectItem2({ className, children, ...props }, ref) {
2927
+ return /* @__PURE__ */ jsxRuntime.jsxs(RadixSelect__namespace.Item, { ref, className: cn(selectItemClass, className), ...props, children: [
2928
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.ItemIndicator, { className: selectItemIndicatorClass, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, {}) }),
2929
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.ItemText, { children })
2930
+ ] });
2931
+ });
2932
+
2933
+ // src/components/list-page/listPageFilters.ts
2934
+ var FILTER_SPAN_CLASS = {
2935
+ narrow: "",
2936
+ default: "",
2937
+ wide: "sm:col-span-2"
2938
+ };
2939
+ function filterDefaultValue(filter) {
2940
+ return filter.type === "select" ? filter.options[0]?.value ?? "" : "";
2941
+ }
2942
+ function hasActiveFilters(filters, values) {
2943
+ for (const filter of filters ?? []) {
2944
+ const current = values?.[filter.key];
2945
+ if (current === void 0) continue;
2946
+ const value = filter.type === "text" ? current.trim() : current;
2947
+ if (value !== filterDefaultValue(filter)) return true;
2948
+ }
2949
+ return false;
2950
+ }
2951
+ function ListPageFilterBar({
2952
+ filters,
2953
+ values,
2954
+ onChange,
2955
+ disabled = false,
2956
+ labels
2957
+ }) {
2958
+ const active = hasActiveFilters(filters, values);
2959
+ const reset = () => {
2960
+ for (const filter of filters ?? []) {
2961
+ onChange?.(filter.key, filterDefaultValue(filter));
2962
+ }
2963
+ };
2964
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "list-page-filter-bar", className: "space-y-3", children: [
2965
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3", children: filters?.map((filter) => /* @__PURE__ */ jsxRuntime.jsx(
2966
+ FilterControl,
2967
+ {
2968
+ filter,
2969
+ value: values?.[filter.key],
2970
+ onChange,
2971
+ disabled
2972
+ },
2973
+ filter.key
2974
+ )) }),
2975
+ active && !disabled ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", size: "sm", onClick: reset, children: [
2976
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, { className: "size-4" }),
2977
+ labels.reset
2978
+ ] }) }) : null
2979
+ ] });
2980
+ }
2981
+ function FilterControl({ filter, value, onChange, disabled }) {
2982
+ const spanClass = FILTER_SPAN_CLASS[filter.width ?? "default"];
2983
+ const ariaLabel = typeof filter.label === "string" ? filter.label : filter.key;
2984
+ switch (filter.type) {
2985
+ case "select":
2986
+ return /* @__PURE__ */ jsxRuntime.jsx(
2987
+ Select,
2988
+ {
2989
+ "aria-label": ariaLabel,
2990
+ value: value ?? filterDefaultValue(filter),
2991
+ onValueChange: (v) => onChange?.(filter.key, v),
2992
+ options: filter.options,
2993
+ className: spanClass,
2994
+ disabled
2995
+ }
2996
+ );
2997
+ case "text":
2998
+ return /* @__PURE__ */ jsxRuntime.jsx(
2999
+ Input,
3000
+ {
3001
+ type: "search",
3002
+ "aria-label": ariaLabel,
3003
+ placeholder: filter.placeholder,
3004
+ value: value ?? "",
3005
+ onChange: (e) => onChange?.(filter.key, e.target.value),
3006
+ leadingIcon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "size-4" }),
3007
+ wrapperClassName: spanClass,
3008
+ disabled
3009
+ }
3010
+ );
3011
+ case "date":
3012
+ return /* @__PURE__ */ jsxRuntime.jsx(
3013
+ DatePicker,
3014
+ {
3015
+ "aria-label": ariaLabel,
3016
+ placeholder: filter.placeholder,
3017
+ value: value ?? "",
3018
+ onValueChange: (v) => onChange?.(filter.key, v),
3019
+ className: spanClass,
3020
+ disabled
3021
+ }
3022
+ );
3023
+ case "multiselect":
3024
+ return /* @__PURE__ */ jsxRuntime.jsx(
3025
+ MultiSelect,
3026
+ {
3027
+ "aria-label": ariaLabel,
3028
+ placeholder: filter.placeholder,
3029
+ options: filter.options,
3030
+ value: value ? value.split(",").filter(Boolean) : [],
3031
+ onValueChange: (values) => onChange?.(filter.key, values.join(",")),
3032
+ className: spanClass,
3033
+ disabled
3034
+ }
3035
+ );
3036
+ }
3037
+ }
3038
+ var DEFAULT_LABELS = {
2507
3039
  reset: "Reset filters",
2508
3040
  emptyTitle: "No results",
2509
3041
  emptyDescription: "Try clearing the search or adjusting the filters.",
2510
3042
  noDataTitle: "No data yet",
2511
3043
  noDataDescription: "Nothing has been added here so far."
2512
3044
  };
2513
- var FILTER_WIDTH_CLASS = {
2514
- narrow: "w-32",
2515
- default: "w-44",
2516
- wide: "w-56"
2517
- };
2518
3045
  function ListPage({
2519
3046
  title,
2520
3047
  description,
@@ -2525,8 +3052,6 @@ function ListPage({
2525
3052
  getRowId,
2526
3053
  isLoading = false,
2527
3054
  loadingRowCount,
2528
- searchValue,
2529
- onSearchChange,
2530
3055
  filters,
2531
3056
  filterValues,
2532
3057
  onFilterChange,
@@ -2541,59 +3066,30 @@ function ListPage({
2541
3066
  labels: labelsProp,
2542
3067
  className
2543
3068
  }) {
2544
- const labels = { ...DEFAULT_LABELS2, ...labelsProp };
2545
- const showSearch = onSearchChange !== void 0;
2546
- const showFilterBar = showSearch || Boolean(filters?.length);
2547
- const hasActiveQuery = react.useMemo(() => {
2548
- if ((searchValue ?? "").trim() !== "") return true;
2549
- for (const f of filters ?? []) {
2550
- const current = filterValues?.[f.key];
2551
- const def = f.options[0]?.value ?? "";
2552
- if (current !== void 0 && current !== def) return true;
2553
- }
2554
- return false;
2555
- }, [searchValue, filters, filterValues]);
3069
+ const labels = { ...DEFAULT_LABELS, ...labelsProp };
3070
+ const showFilterBar = Boolean(filters?.length);
3071
+ const hasActiveQuery = react.useMemo(
3072
+ () => hasActiveFilters(filters, filterValues),
3073
+ [filters, filterValues]
3074
+ );
2556
3075
  const reset = () => {
2557
- onSearchChange?.("");
2558
3076
  for (const f of filters ?? []) {
2559
- const def = f.options[0]?.value ?? "";
2560
- onFilterChange?.(f.key, def);
3077
+ onFilterChange?.(f.key, filterDefaultValue(f));
2561
3078
  }
2562
3079
  };
2563
3080
  const tableMode = isLoading ? "loading" : data.length === 0 && !hasActiveQuery ? "no-data" : data.length === 0 && hasActiveQuery ? "no-results" : "rows";
2564
3081
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "list-page", className: cn("space-y-6", className), children: [
2565
3082
  /* @__PURE__ */ jsxRuntime.jsx(PageHeader, { title, description, bordered, actions }),
2566
- showFilterBar ? /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "list-page-filter-bar", className: "flex flex-wrap items-center gap-3", children: [
2567
- showSearch ? /* @__PURE__ */ jsxRuntime.jsx(
2568
- Input,
2569
- {
2570
- type: "search",
2571
- placeholder: labels.searchPlaceholder,
2572
- "aria-label": labels.searchAriaLabel || labels.searchPlaceholder,
2573
- value: searchValue ?? "",
2574
- onChange: (e) => onSearchChange?.(e.target.value),
2575
- leadingIcon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, {}),
2576
- wrapperClassName: "sm:max-w-xs",
2577
- disabled: isLoading
2578
- }
2579
- ) : null,
2580
- filters?.map((f) => /* @__PURE__ */ jsxRuntime.jsx(
2581
- Select,
2582
- {
2583
- "aria-label": typeof f.label === "string" ? f.label : f.key,
2584
- value: filterValues?.[f.key] ?? f.options[0]?.value ?? "",
2585
- onValueChange: (v) => onFilterChange?.(f.key, v),
2586
- options: f.options,
2587
- className: FILTER_WIDTH_CLASS[f.width ?? "default"],
2588
- disabled: isLoading
2589
- },
2590
- f.key
2591
- )),
2592
- hasActiveQuery && !isLoading ? /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", onClick: reset, children: [
2593
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, {}),
2594
- labels.reset
2595
- ] }) : null
2596
- ] }) : null,
3083
+ showFilterBar ? /* @__PURE__ */ jsxRuntime.jsx(
3084
+ ListPageFilterBar,
3085
+ {
3086
+ filters,
3087
+ values: filterValues,
3088
+ onChange: onFilterChange,
3089
+ disabled: isLoading,
3090
+ labels: { reset: labels.reset }
3091
+ }
3092
+ ) : null,
2597
3093
  tableMode === "loading" || tableMode === "rows" ? /* @__PURE__ */ jsxRuntime.jsx(
2598
3094
  Table,
2599
3095
  {
@@ -3061,6 +3557,7 @@ exports.DropdownMenuShortcut = DropdownMenuShortcut;
3061
3557
  exports.DropdownMenuTrigger = DropdownMenuTrigger;
3062
3558
  exports.EmptyState = EmptyState;
3063
3559
  exports.Field = Field;
3560
+ exports.FileUpload = FileUpload2;
3064
3561
  exports.FormPage = FormPage;
3065
3562
  exports.HeaderActions = HeaderActions;
3066
3563
  exports.HeaderCollapseTrigger = HeaderCollapseTrigger;
@@ -3070,6 +3567,7 @@ exports.HeaderTitle = HeaderTitle;
3070
3567
  exports.Input = Input;
3071
3568
  exports.LanguageSwitcher = LanguageSwitcher;
3072
3569
  exports.ListPage = ListPage;
3570
+ exports.MultiSelect = MultiSelect;
3073
3571
  exports.PageHeader = PageHeader;
3074
3572
  exports.RadioGroup = RadioGroup;
3075
3573
  exports.RadioGroupItem = RadioGroupItem;
@@ -3142,6 +3640,15 @@ exports.emptyStateDescriptionSizeClass = emptyStateDescriptionSizeClass;
3142
3640
  exports.emptyStateIconWrapperBaseClass = emptyStateIconWrapperBaseClass;
3143
3641
  exports.emptyStateIconWrapperSizeClass = emptyStateIconWrapperSizeClass;
3144
3642
  exports.emptyStateTitleSizeClass = emptyStateTitleSizeClass;
3643
+ exports.fileUploadBaseClass = fileUploadBaseClass;
3644
+ exports.fileUploadDropzoneClass = fileUploadDropzoneClass;
3645
+ exports.fileUploadFileNameClass = fileUploadFileNameClass;
3646
+ exports.fileUploadFileRowClass = fileUploadFileRowClass;
3647
+ exports.fileUploadFileSizeClass = fileUploadFileSizeClass;
3648
+ exports.fileUploadHintClass = fileUploadHintClass;
3649
+ exports.fileUploadIconClass = fileUploadIconClass;
3650
+ exports.fileUploadPromptClass = fileUploadPromptClass;
3651
+ exports.fileUploadRemoveClass = fileUploadRemoveClass;
3145
3652
  exports.formPageActionsBarClass = formPageActionsBarClass;
3146
3653
  exports.formPageBaseClass = formPageBaseClass;
3147
3654
  exports.formPageBodyClass = formPageBodyClass;
@@ -3149,6 +3656,15 @@ exports.formPageSkeletonRowClass = formPageSkeletonRowClass;
3149
3656
  exports.inputBaseClass = inputBaseClass;
3150
3657
  exports.inputSizeClass = inputSizeClass;
3151
3658
  exports.inputVariantClass = inputVariantClass;
3659
+ exports.multiSelectChipClass = multiSelectChipClass;
3660
+ exports.multiSelectChipRemoveClass = multiSelectChipRemoveClass;
3661
+ exports.multiSelectContentClass = multiSelectContentClass;
3662
+ exports.multiSelectEmptyClass = multiSelectEmptyClass;
3663
+ exports.multiSelectListClass = multiSelectListClass;
3664
+ exports.multiSelectOptionClass = multiSelectOptionClass;
3665
+ exports.multiSelectSearchRowClass = multiSelectSearchRowClass;
3666
+ exports.multiSelectTriggerSizeClass = multiSelectTriggerSizeClass;
3667
+ exports.multiSelectValueRowClass = multiSelectValueRowClass;
3152
3668
  exports.pageHeaderActionsClass = pageHeaderActionsClass;
3153
3669
  exports.pageHeaderBackClass = pageHeaderBackClass;
3154
3670
  exports.pageHeaderBackIconClass = pageHeaderBackIconClass;