@senvenli/react 0.3.3 → 0.3.4

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.
Files changed (93) hide show
  1. package/dist/action/fab.d.ts +7 -0
  2. package/dist/action/fab.js +22 -3
  3. package/dist/action/fab.js.map +1 -1
  4. package/dist/collection/data-table.d.ts +1 -1
  5. package/dist/collection/data-table.js +2 -2
  6. package/dist/collection/data-table.js.map +1 -1
  7. package/dist/collection/table.d.ts +7 -2
  8. package/dist/collection/table.js +17 -7
  9. package/dist/collection/table.js.map +1 -1
  10. package/dist/i18n.d.ts +8 -0
  11. package/dist/i18n.js +18 -1
  12. package/dist/i18n.js.map +1 -1
  13. package/dist/navigation/index.d.ts +2 -2
  14. package/dist/navigation/index.js +1 -1
  15. package/dist/navigation/index.js.map +1 -1
  16. package/dist/navigation/sidebar.d.ts +18 -0
  17. package/dist/navigation/sidebar.js +26 -2
  18. package/dist/navigation/sidebar.js.map +1 -1
  19. package/dist/overlay/floating.js +4 -1
  20. package/dist/overlay/floating.js.map +1 -1
  21. package/dist/overlay/index.d.ts +2 -0
  22. package/dist/overlay/index.js +2 -1
  23. package/dist/overlay/index.js.map +1 -1
  24. package/dist/overlay/tour.d.ts +88 -0
  25. package/dist/overlay/tour.js +302 -0
  26. package/dist/overlay/tour.js.map +1 -0
  27. package/package.json +2 -2
  28. package/dist/action/files.d.ts +0 -70
  29. package/dist/action/files.js +0 -156
  30. package/dist/action/files.js.map +0 -1
  31. package/dist/action/theme-toggle.d.ts +0 -43
  32. package/dist/action/theme-toggle.js +0 -259
  33. package/dist/action/theme-toggle.js.map +0 -1
  34. package/dist/display/image-crop.d.ts +0 -106
  35. package/dist/display/image-crop.js +0 -117
  36. package/dist/display/image-crop.js.map +0 -1
  37. package/dist/display/image-cropper.d.ts +0 -68
  38. package/dist/display/image-cropper.js +0 -284
  39. package/dist/display/image-cropper.js.map +0 -1
  40. package/dist/display/lozenge.d.ts +0 -30
  41. package/dist/display/lozenge.js +0 -55
  42. package/dist/display/lozenge.js.map +0 -1
  43. package/dist/display/scroll-area.d.ts +0 -29
  44. package/dist/display/scroll-area.js +0 -95
  45. package/dist/display/scroll-area.js.map +0 -1
  46. package/dist/feedback/cooldown.d.ts +0 -17
  47. package/dist/feedback/cooldown.js +0 -59
  48. package/dist/feedback/cooldown.js.map +0 -1
  49. package/dist/feedback/status-dot.d.ts +0 -23
  50. package/dist/feedback/status-dot.js +0 -37
  51. package/dist/feedback/status-dot.js.map +0 -1
  52. package/dist/form/input-otp.d.ts +0 -35
  53. package/dist/form/input-otp.js +0 -83
  54. package/dist/form/input-otp.js.map +0 -1
  55. package/dist/layout/auth-form-layout.d.ts +0 -71
  56. package/dist/layout/auth-form-layout.js +0 -61
  57. package/dist/layout/auth-form-layout.js.map +0 -1
  58. package/dist/layout/auth-layout.d.ts +0 -59
  59. package/dist/layout/auth-layout.js +0 -26
  60. package/dist/layout/auth-layout.js.map +0 -1
  61. package/dist/layout/pressable.d.ts +0 -40
  62. package/dist/layout/pressable.js +0 -65
  63. package/dist/layout/pressable.js.map +0 -1
  64. package/dist/layout/reset-sent-card.d.ts +0 -39
  65. package/dist/layout/reset-sent-card.js +0 -22
  66. package/dist/layout/reset-sent-card.js.map +0 -1
  67. package/dist/navigation/dock.d.ts +0 -27
  68. package/dist/navigation/dock.js +0 -47
  69. package/dist/navigation/dock.js.map +0 -1
  70. package/dist/navigation/footer.d.ts +0 -43
  71. package/dist/navigation/footer.js +0 -43
  72. package/dist/navigation/footer.js.map +0 -1
  73. package/dist/navigation/language-names.d.ts +0 -19
  74. package/dist/navigation/language-names.js +0 -79
  75. package/dist/navigation/language-names.js.map +0 -1
  76. package/dist/navigation/language-switcher.d.ts +0 -55
  77. package/dist/navigation/language-switcher.js +0 -53
  78. package/dist/navigation/language-switcher.js.map +0 -1
  79. package/dist/navigation/panel-header.d.ts +0 -37
  80. package/dist/navigation/panel-header.js +0 -50
  81. package/dist/navigation/panel-header.js.map +0 -1
  82. package/dist/navigation/toolbar.d.ts +0 -37
  83. package/dist/navigation/toolbar.js +0 -334
  84. package/dist/navigation/toolbar.js.map +0 -1
  85. package/dist/overlay/command-palette.d.ts +0 -53
  86. package/dist/overlay/command-palette.js +0 -130
  87. package/dist/overlay/command-palette.js.map +0 -1
  88. package/dist/overlay/overlay.d.ts +0 -299
  89. package/dist/overlay/overlay.js +0 -558
  90. package/dist/overlay/overlay.js.map +0 -1
  91. package/dist/selection/radio-card.d.ts +0 -31
  92. package/dist/selection/radio-card.js +0 -29
  93. package/dist/selection/radio-card.js.map +0 -1
@@ -20,6 +20,13 @@ export type FabProps = {
20
20
  collapseOnScroll?: boolean;
21
21
  /** Icon-only at every width, as Button's `iconOnly`: a round button; `label` stays its accessible name. */
22
22
  iconOnly?: boolean;
23
+ /**
24
+ * A fill other than the brand's, for a Fab that carries another identity (a messaging app's contact button):
25
+ * `#rgb`, `#rrggbb` or `oklch(…)`. The label and icon are the soft ink or paper, whichever reads better on it
26
+ * (as Mantine's `autoContrast`), so the pair keeps the most contrast the color allows; hover and press darken it
27
+ * slightly. A color the engine cannot read is ignored and the brand fill stays.
28
+ */
29
+ color?: string;
23
30
  };
24
31
  /**
25
32
  * Keeps one task reachable over scrolling content: a contact link on a
@@ -6,9 +6,25 @@ import { IconGlyph } from "../display/icon.js";
6
6
  import { cn } from "../utils.js";
7
7
  import { newTabLabel } from "../i18n.js";
8
8
  import { LAYER } from "../layers.js";
9
- /** The brand fill: the one tone a Fab has. */
9
+ import { contrastRatio } from "../color/contrast.js";
10
+ /** The brand fill: a Fab's default. */
10
11
  const FILL = "bg-ds-background-brand-bold text-ds-text-on-brand data-[hovered]:bg-ds-background-brand-bold-hovered " +
11
12
  "data-[pressed]:bg-ds-background-brand-bold-pressed data-[focus-visible]:inset-ring-ds-text-on-brand";
13
+ const INK = "#0c0c0b";
14
+ const PAPER = "#fcfcfb";
15
+ /** A custom fill and the label color that reads best on it; null when the color does not parse. */
16
+ function customFill(color) {
17
+ if (!color)
18
+ return null;
19
+ const onPaper = contrastRatio(color, PAPER);
20
+ const onInk = contrastRatio(color, INK);
21
+ // contrastRatio answers 1 for a color it cannot read.
22
+ if (onPaper === 1 && onInk === 1)
23
+ return null;
24
+ return { background: color, color: onPaper >= onInk ? PAPER : INK };
25
+ }
26
+ /** The custom fill's states: a slight darkening, and the focus border in the label's color. */
27
+ const CUSTOM_STATES = "data-[hovered]:brightness-95 data-[pressed]:brightness-90 data-[focus-visible]:inset-ring-current";
12
28
  const PHONE = "(max-width: 767px)";
13
29
  function useCollapsed(enabled) {
14
30
  const [collapsed, setCollapsed] = React.useState(false);
@@ -33,23 +49,26 @@ function useCollapsed(enabled) {
33
49
  * public site, "new order" in an admin app on phones. One per screen,
34
50
  * never over a dialog, sheet or a sticky summary bar (the app decides).
35
51
  */
36
- export const Fab = React.forwardRef(function Fab({ children: label, iconBefore: icon, onPress, href, target = "_blank", placement = "fixed", collapseOnScroll = true, iconOnly = false }, ref) {
52
+ export const Fab = React.forwardRef(function Fab({ children: label, iconBefore: icon, onPress, href, target = "_blank", placement = "fixed", collapseOnScroll = true, iconOnly = false, color }, ref) {
37
53
  const { locale } = useLocale();
38
54
  const opensNewTab = Boolean(href) && target === "_blank";
39
55
  const external = opensNewTab ? ` ${newTabLabel(locale)}` : "";
40
56
  const scrolledAway = useCollapsed(!iconOnly && collapseOnScroll && placement === "fixed");
41
57
  const collapsed = iconOnly || scrolledAway;
58
+ const custom = customFill(color);
42
59
  const className = cn("inline-flex h-12 shrink-0 items-center justify-center gap-ds-100 rounded-ds-full shadow-ds-overlay text-body-strong", "cursor-pointer select-none outline-hidden transition-[background-color,filter,padding] duration-(--ds-duration-fast) ease-ds-standard", "data-[focus-visible]:inset-ring-2", collapsed ? "w-12 px-0" : "px-ds-250",
43
60
  // Over page content and a floating banner, under toasts and overlays (src/ds/layers.ts); it lifts by the
44
61
  // floating banner's height while one is shown, so the banner never covers it.
45
62
  placement === "fixed" &&
46
- "fixed end-ds-300 bottom-[max(calc(var(--ds-space-300)+env(safe-area-inset-bottom,0px)),calc(var(--ds-floating-banner-offset,0px)+var(--ds-space-150)))]", placement === "fixed" && LAYER.fab, FILL);
63
+ "fixed end-ds-300 bottom-[max(calc(var(--ds-space-300)+env(safe-area-inset-bottom,0px)),calc(var(--ds-floating-banner-offset,0px)+var(--ds-space-150)))]", placement === "fixed" && LAYER.fab, custom ? CUSTOM_STATES : FILL);
47
64
  const content = (_jsxs(_Fragment, { children: [_jsx(IconGlyph, { name: icon, size: "large", "data-slot": "fab-icon" }), !collapsed && _jsx("span", { "data-slot": "fab-label", children: label })] }));
48
65
  const common = {
49
66
  "data-slot": "fab",
50
67
  "data-collapsed": collapsed || undefined,
51
68
  // Icon-only keeps its label as the accessible name; a new tab adds Link's words after the visible label.
52
69
  "aria-label": collapsed || external ? `${label}${external}` : undefined,
70
+ "data-color": custom ? "" : undefined,
71
+ style: custom ?? undefined,
53
72
  className,
54
73
  };
55
74
  return href ? (_jsx(AriaLink, { ...common, ref: ref, href: href, target: target, rel: opensNewTab ? "noopener noreferrer" : undefined, onPress: onPress, children: content })) : (_jsx(AriaButton, { ...common, ref: ref, type: "button", onPress: onPress, children: content }));
@@ -1 +1 @@
1
- {"version":3,"file":"fab.js","sourceRoot":"","sources":["../../src/action/fab.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,IAAI,IAAI,QAAQ,EAAE,SAAS,EAAmB,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,SAAS,EAAiB,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGlC,8CAA8C;AAC9C,MAAM,IAAI,GACR,uGAAuG;I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EACxC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,EACpD,OAAO,EAAE,OAAO,YAEf,OAAO,GACC,CACZ,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,OAAK,MAAM,EAAE,GAAG,EAAE,GAAmC,EAAE,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,OAAO,YAC7F,OAAO,GACG,CACd,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Button as AriaButton, Link as AriaLink, useLocale, type PressEvent } from \"react-aria-components\";\nimport { IconGlyph, type IconName } from \"../display/icon\";\n\nimport { cn } from \"../utils\";\nimport { newTabLabel } from \"../i18n\";\nimport { LAYER } from \"../layers\";\n\n\n/** The brand fill: the one tone a Fab has. */\nconst FILL =\n \"bg-ds-background-brand-bold text-ds-text-on-brand data-[hovered]:bg-ds-background-brand-bold-hovered \" +\n \"data-[pressed]:bg-ds-background-brand-bold-pressed data-[focus-visible]:inset-ring-ds-text-on-brand\";\n\nexport type FabProps = {\n /** The task, as a verb (\"Contact us\", \"New order\"), as Button's label; also the name when icon-only. */\n children: string;\n /** Lucide icon name before the label (\"message-circle\", \"calendar-plus\"), as Button's `iconBefore`. */\n iconBefore: IconName;\n onPress?: (event: PressEvent) => void;\n /** A link (a chat or contact URL) instead of an action; it opens in a new tab unless `target` says otherwise. */\n href?: string;\n /**\n * Where `href` opens. `_blank` (default) follows Link's external convention: `noopener noreferrer` and the\n * new-tab words for screen readers. `_self` keeps an in-app link in the page, through the host router.\n */\n target?: React.HTMLAttributeAnchorTarget;\n /** `fixed` (default): bottom-end above the safe area. `inline`: in the flow (previews, docs). */\n placement?: \"fixed\" | \"inline\";\n /** Collapse to icon-only on phones after the first scroll (default true). */\n collapseOnScroll?: boolean;\n /** Icon-only at every width, as Button's `iconOnly`: a round button; `label` stays its accessible name. */\n iconOnly?: boolean;\n};\n\nconst PHONE = \"(max-width: 767px)\";\n\nfunction useCollapsed(enabled: boolean) {\n const [collapsed, setCollapsed] = React.useState(false);\n React.useEffect(() => {\n if (!enabled || typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") return;\n const media = window.matchMedia(PHONE);\n // Back at the top of the page there is room again, so the label returns.\n const update = () => setCollapsed(media.matches && window.scrollY > 0);\n update();\n window.addEventListener(\"scroll\", update, { passive: true });\n media.addEventListener?.(\"change\", update);\n return () => {\n window.removeEventListener(\"scroll\", update);\n media.removeEventListener?.(\"change\", update);\n };\n }, [enabled]);\n return collapsed;\n}\n\n/**\n * Keeps one task reachable over scrolling content: a contact link on a\n * public site, \"new order\" in an admin app on phones. One per screen,\n * never over a dialog, sheet or a sticky summary bar (the app decides).\n */\nexport const Fab = React.forwardRef<HTMLButtonElement | HTMLAnchorElement, FabProps>(function Fab(\n { children: label, iconBefore: icon, onPress, href, target = \"_blank\", placement = \"fixed\", collapseOnScroll = true, iconOnly = false },\n ref,\n) {\n const { locale } = useLocale();\n const opensNewTab = Boolean(href) && target === \"_blank\";\n const external = opensNewTab ? ` ${newTabLabel(locale)}` : \"\";\n const scrolledAway = useCollapsed(!iconOnly && collapseOnScroll && placement === \"fixed\");\n const collapsed = iconOnly || scrolledAway;\n const className = cn(\n \"inline-flex h-12 shrink-0 items-center justify-center gap-ds-100 rounded-ds-full shadow-ds-overlay text-body-strong\",\n \"cursor-pointer select-none outline-hidden transition-[background-color,filter,padding] duration-(--ds-duration-fast) ease-ds-standard\",\n \"data-[focus-visible]:inset-ring-2\",\n collapsed ? \"w-12 px-0\" : \"px-ds-250\",\n // Over page content and a floating banner, under toasts and overlays (src/ds/layers.ts); it lifts by the\n // floating banner's height while one is shown, so the banner never covers it.\n placement === \"fixed\" &&\n \"fixed end-ds-300 bottom-[max(calc(var(--ds-space-300)+env(safe-area-inset-bottom,0px)),calc(var(--ds-floating-banner-offset,0px)+var(--ds-space-150)))]\",\n placement === \"fixed\" && LAYER.fab,\n FILL,\n );\n const content = (\n <>\n <IconGlyph name={icon} size=\"large\" data-slot=\"fab-icon\" />\n {!collapsed && <span data-slot=\"fab-label\">{label}</span>}\n </>\n );\n const common = {\n \"data-slot\": \"fab\",\n \"data-collapsed\": collapsed || undefined,\n // Icon-only keeps its label as the accessible name; a new tab adds Link's words after the visible label.\n \"aria-label\": collapsed || external ? `${label}${external}` : undefined,\n className,\n };\n return href ? (\n <AriaLink\n {...common}\n ref={ref as React.Ref<HTMLAnchorElement>}\n href={href}\n target={target}\n rel={opensNewTab ? \"noopener noreferrer\" : undefined}\n onPress={onPress}\n >\n {content}\n </AriaLink>\n ) : (\n <AriaButton {...common} ref={ref as React.Ref<HTMLButtonElement>} type=\"button\" onPress={onPress}>\n {content}\n </AriaButton>\n );\n});\n"]}
1
+ {"version":3,"file":"fab.js","sourceRoot":"","sources":["../../src/action/fab.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,IAAI,IAAI,QAAQ,EAAE,SAAS,EAAmB,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,SAAS,EAAiB,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,uCAAuC;AACvC,MAAM,IAAI,GACR,uGAAuG;IACvG,qGAAqG,CAAC;AA8BxG,MAAM,GAAG,GAAG,SAAS,CAAC;AACtB,MAAM,KAAK,GAAG,SAAS,CAAC;AAExB,mGAAmG;AACnG,SAAS,UAAU,CAAC,KAAyB;IAC3C,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;I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C9B,CAAC;IACF,MAAM,OAAO,GAAG,CACd,8BACE,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,OAAO,eAAW,UAAU,GAAG,EAC1D,CAAC,SAAS,IAAI,4BAAgB,WAAW,YAAE,KAAK,GAAQ,IACxD,CACJ,CAAC;IACF,MAAM,MAAM,GAAG;QACb,WAAW,EAAE,KAAK;QAClB,gBAAgB,EAAE,SAAS,IAAI,SAAS;QACxC,yGAAyG;QACzG,YAAY,EAAE,SAAS,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS;QACvE,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;QACrC,KAAK,EAAE,MAAM,IAAI,SAAS;QAC1B,SAAS;KACV,CAAC;IACF,OAAO,IAAI,CAAC,CAAC,CAAC,CACZ,KAAC,QAAQ,OACH,MAAM,EACV,GAAG,EAAE,GAAmC,EACxC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,EACpD,OAAO,EAAE,OAAO,YAEf,OAAO,GACC,CACZ,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,OAAK,MAAM,EAAE,GAAG,EAAE,GAAmC,EAAE,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,OAAO,YAC7F,OAAO,GACG,CACd,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Button as AriaButton, Link as AriaLink, useLocale, type PressEvent } from \"react-aria-components\";\nimport { IconGlyph, type IconName } from \"../display/icon\";\n\nimport { cn } from \"../utils\";\nimport { newTabLabel } from \"../i18n\";\nimport { LAYER } from \"../layers\";\nimport { contrastRatio } from \"../color/contrast\";\n\n\n/** The brand fill: a Fab's default. */\nconst FILL =\n \"bg-ds-background-brand-bold text-ds-text-on-brand data-[hovered]:bg-ds-background-brand-bold-hovered \" +\n \"data-[pressed]:bg-ds-background-brand-bold-pressed data-[focus-visible]:inset-ring-ds-text-on-brand\";\n\nexport type FabProps = {\n /** The task, as a verb (\"Contact us\", \"New order\"), as Button's label; also the name when icon-only. */\n children: string;\n /** Lucide icon name before the label (\"message-circle\", \"calendar-plus\"), as Button's `iconBefore`. */\n iconBefore: IconName;\n onPress?: (event: PressEvent) => void;\n /** A link (a chat or contact URL) instead of an action; it opens in a new tab unless `target` says otherwise. */\n href?: string;\n /**\n * Where `href` opens. `_blank` (default) follows Link's external convention: `noopener noreferrer` and the\n * new-tab words for screen readers. `_self` keeps an in-app link in the page, through the host router.\n */\n target?: React.HTMLAttributeAnchorTarget;\n /** `fixed` (default): bottom-end above the safe area. `inline`: in the flow (previews, docs). */\n placement?: \"fixed\" | \"inline\";\n /** Collapse to icon-only on phones after the first scroll (default true). */\n collapseOnScroll?: boolean;\n /** Icon-only at every width, as Button's `iconOnly`: a round button; `label` stays its accessible name. */\n iconOnly?: boolean;\n /**\n * A fill other than the brand's, for a Fab that carries another identity (a messaging app's contact button):\n * `#rgb`, `#rrggbb` or `oklch(…)`. The label and icon are the soft ink or paper, whichever reads better on it\n * (as Mantine's `autoContrast`), so the pair keeps the most contrast the color allows; hover and press darken it\n * slightly. A color the engine cannot read is ignored and the brand fill stays.\n */\n color?: string;\n};\n\nconst INK = \"#0c0c0b\";\nconst PAPER = \"#fcfcfb\";\n\n/** A custom fill and the label color that reads best on it; null when the color does not parse. */\nfunction customFill(color: string | undefined): { background: string; color: string } | null {\n if (!color) return null;\n const onPaper = contrastRatio(color, PAPER);\n const onInk = contrastRatio(color, INK);\n // contrastRatio answers 1 for a color it cannot read.\n if (onPaper === 1 && onInk === 1) return null;\n return { background: color, color: onPaper >= onInk ? PAPER : INK };\n}\n\n/** The custom fill's states: a slight darkening, and the focus border in the label's color. */\nconst CUSTOM_STATES =\n \"data-[hovered]:brightness-95 data-[pressed]:brightness-90 data-[focus-visible]:inset-ring-current\";\n\nconst PHONE = \"(max-width: 767px)\";\n\nfunction useCollapsed(enabled: boolean) {\n const [collapsed, setCollapsed] = React.useState(false);\n React.useEffect(() => {\n if (!enabled || typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") return;\n const media = window.matchMedia(PHONE);\n // Back at the top of the page there is room again, so the label returns.\n const update = () => setCollapsed(media.matches && window.scrollY > 0);\n update();\n window.addEventListener(\"scroll\", update, { passive: true });\n media.addEventListener?.(\"change\", update);\n return () => {\n window.removeEventListener(\"scroll\", update);\n media.removeEventListener?.(\"change\", update);\n };\n }, [enabled]);\n return collapsed;\n}\n\n/**\n * Keeps one task reachable over scrolling content: a contact link on a\n * public site, \"new order\" in an admin app on phones. One per screen,\n * never over a dialog, sheet or a sticky summary bar (the app decides).\n */\nexport const Fab = React.forwardRef<HTMLButtonElement | HTMLAnchorElement, FabProps>(function Fab(\n { children: label, iconBefore: icon, onPress, href, target = \"_blank\", placement = \"fixed\", collapseOnScroll = true, iconOnly = false, color },\n ref,\n) {\n const { locale } = useLocale();\n const opensNewTab = Boolean(href) && target === \"_blank\";\n const external = opensNewTab ? ` ${newTabLabel(locale)}` : \"\";\n const scrolledAway = useCollapsed(!iconOnly && collapseOnScroll && placement === \"fixed\");\n const collapsed = iconOnly || scrolledAway;\n const custom = customFill(color);\n const className = cn(\n \"inline-flex h-12 shrink-0 items-center justify-center gap-ds-100 rounded-ds-full shadow-ds-overlay text-body-strong\",\n \"cursor-pointer select-none outline-hidden transition-[background-color,filter,padding] duration-(--ds-duration-fast) ease-ds-standard\",\n \"data-[focus-visible]:inset-ring-2\",\n collapsed ? \"w-12 px-0\" : \"px-ds-250\",\n // Over page content and a floating banner, under toasts and overlays (src/ds/layers.ts); it lifts by the\n // floating banner's height while one is shown, so the banner never covers it.\n placement === \"fixed\" &&\n \"fixed end-ds-300 bottom-[max(calc(var(--ds-space-300)+env(safe-area-inset-bottom,0px)),calc(var(--ds-floating-banner-offset,0px)+var(--ds-space-150)))]\",\n placement === \"fixed\" && LAYER.fab,\n custom ? CUSTOM_STATES : FILL,\n );\n const content = (\n <>\n <IconGlyph name={icon} size=\"large\" data-slot=\"fab-icon\" />\n {!collapsed && <span data-slot=\"fab-label\">{label}</span>}\n </>\n );\n const common = {\n \"data-slot\": \"fab\",\n \"data-collapsed\": collapsed || undefined,\n // Icon-only keeps its label as the accessible name; a new tab adds Link's words after the visible label.\n \"aria-label\": collapsed || external ? `${label}${external}` : undefined,\n \"data-color\": custom ? \"\" : undefined,\n style: custom ?? undefined,\n className,\n };\n return href ? (\n <AriaLink\n {...common}\n ref={ref as React.Ref<HTMLAnchorElement>}\n href={href}\n target={target}\n rel={opensNewTab ? \"noopener noreferrer\" : undefined}\n onPress={onPress}\n >\n {content}\n </AriaLink>\n ) : (\n <AriaButton {...common} ref={ref as React.Ref<HTMLButtonElement>} type=\"button\" onPress={onPress}>\n {content}\n </AriaButton>\n );\n});\n"]}
@@ -78,7 +78,7 @@ type DataTableBase<T> = {
78
78
  defaultView?: Partial<DataTableView>;
79
79
  /** Called with the whole next view on every change (a new sort, search, filter or page). */
80
80
  onViewChange?: (view: DataTableView) => void;
81
- /** `compact` (36px rows) by default: DataTable is the dense working list of a back office. */
81
+ /** `comfortable` (default, rows of at least 48px) or `compact` (36px rows) for a dense screen that needs every row in view. */
82
82
  density?: Density;
83
83
  };
84
84
  export type DataTableProps<T> = DataTableBase<T> & ({
@@ -31,7 +31,7 @@ const defaultRowKey = (row) => row.id;
31
31
  * bulk action settles.
32
32
  */
33
33
  export function DataTable(props) {
34
- const { "aria-label": label, columns, rowKey = defaultRowKey, filters = NO_FILTERS, bulkActions = [], defaultSort, onRowAction, pageSize = 20, formatRange, emptyState, density = "compact", } = props;
34
+ const { "aria-label": label, columns, rowKey = defaultRowKey, filters = NO_FILTERS, bulkActions = [], defaultSort, onRowAction, pageSize = 20, formatRange, emptyState, density = "comfortable", } = props;
35
35
  const { locale } = useLocale();
36
36
  // The view: the app's (`view`), or the table's own.
37
37
  const [own, setOwn] = React.useState(() => ({ page: 1, sort: defaultSort, search: "", filters: {}, ...props.defaultView }));
@@ -183,6 +183,6 @@ export function DataTable(props) {
183
183
  }), _jsx(ToolbarSpacer, {}), hideable.length > 0 && (_jsx(Menu, { "aria-label": tableColumnsLabel(locale), selectionMode: "multiple", selectedKeys: hideable.filter((column) => visibility[column.key] !== false).map((column) => column.key), onSelectionChange: (keys) => {
184
184
  const shown = keys === "all" ? new Set(hideable.map((column) => column.key)) : new Set([...keys].map(String));
185
185
  setVisibility(Object.fromEntries(hideable.map((column) => [column.key, shown.has(column.key)])));
186
- }, items: hideable.map((column) => ({ id: column.key, label: column.header })), trigger: _jsx(Button, { size: "small", variant: "subtle", iconBefore: "columns-3", children: tableColumnsLabel(locale) }) }))] })), status === "error" ? (_jsx("div", { "data-slot": "data-table-error", className: "rounded-ds-large bg-ds-surface-raised py-ds-400 shadow-ds-raised", children: _jsx(EmptyState, { size: "small", tone: "danger", icon: "cloud-off", announce: true, title: tableLoadFailedLabel(locale), description: tableLoadFailedHintLabel(locale), primaryAction: _jsx(Button, { size: "small", iconBefore: "rotate-cw", onPress: () => setReload((n) => n + 1), children: retryLabel(locale) }) }) })) : showSkeleton ? (_jsxs("div", { "data-slot": "data-table-loading", "aria-hidden": true, className: "flex flex-col overflow-hidden rounded-ds-large bg-ds-surface-raised shadow-ds-raised", children: [_jsx("div", { className: "h-9 border-b border-ds-border bg-ds-surface-sunken" }), Array.from({ length: Math.min(pageSize, 8) }, (_, index) => (_jsxs("div", { className: cn("flex items-center gap-ds-300 border-b border-ds-border px-ds-200 last:border-b-0", density === "compact" ? "h-ds-row-compact" : "h-ds-row"), children: [_jsx(Skeleton, { width: "18%", height: 12 }), _jsx(Skeleton, { width: "30%", height: 12 }), _jsx(Skeleton, { width: "16%", height: 12 })] }, index)))] })) : (_jsx(TableView, { component: "DataTable", "aria-label": label, columns: shownColumns, rows: pageRows, rowKey: rowKey, selectionMode: bulkActions.length ? "multiple" : "none", selectedKeys: [...selected].filter((key) => visibleKeys.has(key)), onSelectionChange: onSelectionChange, sortDescriptor: view.sort, onSortChange: (sort) => setView({ sort }), density: density, onRowAction: onRowAction, emptyState: empty(), virtual: virtual ? { height: props.height ?? 480 } : undefined })), !virtual && status !== "error" && total > 0 && (_jsx(Pagination, { page: view.page, pageSize: pageSize, total: total, onPageChange: (page) => setView({ page }), formatRange: formatRange }))] }));
186
+ }, items: hideable.map((column) => ({ id: column.key, label: column.header })), trigger: _jsx(Button, { size: "small", variant: "subtle", iconBefore: "columns-3", children: tableColumnsLabel(locale) }) }))] })), status === "error" ? (_jsx("div", { "data-slot": "data-table-error", className: "rounded-ds-large bg-ds-surface-raised py-ds-400 shadow-ds-raised", children: _jsx(EmptyState, { size: "small", tone: "danger", icon: "cloud-off", announce: true, title: tableLoadFailedLabel(locale), description: tableLoadFailedHintLabel(locale), primaryAction: _jsx(Button, { size: "small", iconBefore: "rotate-cw", onPress: () => setReload((n) => n + 1), children: retryLabel(locale) }) }) })) : showSkeleton ? (_jsxs("div", { "data-slot": "data-table-loading", "aria-hidden": true, className: "flex flex-col overflow-hidden rounded-ds-large bg-ds-surface-raised shadow-ds-raised", children: [_jsx("div", { className: cn("border-b border-ds-border bg-ds-surface-sunken", density === "compact" ? "h-9" : "h-10") }), Array.from({ length: Math.min(pageSize, 8) }, (_, index) => (_jsxs("div", { className: cn("flex items-center gap-ds-300 border-b border-ds-border px-ds-200 last:border-b-0", density === "compact" ? "h-ds-row-compact" : "h-ds-row"), children: [_jsx(Skeleton, { width: "18%", height: 12 }), _jsx(Skeleton, { width: "30%", height: 12 }), _jsx(Skeleton, { width: "16%", height: 12 })] }, index)))] })) : (_jsx(TableView, { component: "DataTable", "aria-label": label, columns: shownColumns, rows: pageRows, rowKey: rowKey, selectionMode: bulkActions.length ? "multiple" : "none", selectedKeys: [...selected].filter((key) => visibleKeys.has(key)), onSelectionChange: onSelectionChange, sortDescriptor: view.sort, onSortChange: (sort) => setView({ sort }), density: density, onRowAction: onRowAction, emptyState: empty(), virtual: virtual ? { height: props.height ?? 480 } : undefined })), !virtual && status !== "error" && total > 0 && (_jsx(Pagination, { page: view.page, pageSize: pageSize, total: total, onPageChange: (page) => setView({ page }), formatRange: formatRange }))] }));
187
187
  }
188
188
  //# sourceMappingURL=data-table.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-table.js","sourceRoot":"","sources":["../../src/collection/data-table.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAiD,MAAM,uBAAuB,CAAC;AAEjG,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EACL,UAAU,EACV,UAAU,EACV,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAoB,MAAM,SAAS,CAAC;AAsGrE,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,4EAA4E;AAC5E,SAAS,SAAS,CAAI,GAAM,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WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EACjE,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,IAAI,CAAC,IAAI,EACzB,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EACzC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,KAAK,EAAE,EACnB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAG,KAA6B,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,GACvF,CACH,EAEA,CAAC,OAAO,IAAI,MAAM,KAAK,OAAO,IAAI,KAAK,GAAG,CAAC,IAAI,CAC9C,KAAC,UAAU,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,WAAW,GAAI,CACvI,IACO,CACX,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport type { Density } from \"../density\";\nimport * as React from \"react\";\nimport { useLocale, type Key, type Selection, type SortDescriptor } from \"react-aria-components\";\n\nimport { cn } from \"../utils\";\nimport { Button } from \"../action/button\";\nimport { EmptyState } from \"../feedback/empty-state\";\nimport { Skeleton } from \"../feedback/skeleton\";\nimport { SearchField } from \"../form/search-field\";\nimport {\n intlLocale,\n retryLabel,\n tableClearFiltersLabel,\n tableColumnsLabel,\n tableEmptyLabel,\n tableLoadFailedHintLabel,\n tableLoadFailedLabel,\n tableNoResultsLabel,\n tableSearchLabel,\n tableSelectedLabel,\n tableToolsLabel,\n} from \"../i18n\";\nimport { Pagination } from \"../navigation/pagination\";\nimport { BulkBar, Toolbar, ToolbarSpacer } from \"../layout/toolbar\";\nimport { Menu } from \"../overlay/floating\";\nimport { matchesQuery } from \"../selection/match\";\nimport type { DataTableView } from \"./data-table-url\";\nimport { TableView, uniqueRowKeys, type TableColumn } from \"./table\";\n\nexport type DataTableColumn<T> = TableColumn<T> & {\n /** Offered in the column picker (\"Columns\"); the row header column never hides. */\n isHideable?: boolean;\n /** The value sorted and searched in a client list; the row's value under `key` by default. */\n value?: (row: T) => string | number | null | undefined;\n};\n\nexport type DataTableFilter = {\n /** Also the URL param name. */\n key: string;\n /** \"Durum\". */\n label: string;\n options: readonly { id: string; label: string }[];\n /** A client list's value(s) for this filter; the row's value under `key` by default (a nested or derived field). */\n value?: (row: never) => string | readonly string[] | null | undefined;\n};\n\nexport type DataTableQuery = DataTableView & { pageSize: number };\n\nexport type DataTableResult<T> = { rows: readonly T[]; total: number };\n\nexport type DataTableBulkAction = {\n id: string;\n /** A verb (\"Send reminder\"). */\n label: string;\n /**\n * Runs on the selected keys (across pages, filtered-out rows included). When it resolves the selection\n * clears and the list reloads; when it rejects both stay, so tell the user why from here (a toast).\n */\n onAction: (keys: Key[]) => unknown;\n};\n\ntype DataTableBase<T> = {\n /** Names the table (\"Orders\"). */\n \"aria-label\": string;\n columns: readonly DataTableColumn<T>[];\n /**\n * The row's stable id; `row.id` by default. Selection is kept by it across pages. Ids must be unique within\n * the list; build one from the fields that are when the data has none (`${row.date}:${row.channel}`). A\n * repeated id on a page still renders every row: the later ones are keyed `a#2`, `a#3`, … in row order, and\n * selection, bulk actions and `onRowAction` receive those suffixed keys; a development warning names the\n * repeated ids. A suffixed key follows the row's position, not the row: after a sort, filter\n * or page change a selection made through it can move to another copy, and an id repeated on two pages is\n * one key, so selecting it on one page selects it on both.\n */\n rowKey?: (row: T) => Key;\n filters?: readonly DataTableFilter[];\n bulkActions?: readonly DataTableBulkAction[];\n defaultSort?: SortDescriptor;\n /** Column key → shown; columns left out are shown. Pass with `onColumnVisibilityChange` to own it. */\n columnVisibility?: Readonly<Record<string, boolean>>;\n onColumnVisibilityChange?: (visibility: Record<string, boolean>) => void;\n /** Opens the record (row press while nothing is selected). */\n onRowAction?: (key: Key) => void;\n /** 20 by default. */\n pageSize?: number;\n /** The range sentence: (41, 60, 1204) → \"41–60 of 1,204\". */\n formatRange?: (from: number, to: number, total: number) => string;\n /**\n * What an empty list shows (with no search or filter active): an `EmptyState size=\"small\"` with the action that\n * fills it. \"No records yet\" by default.\n */\n emptyState?: React.ReactNode;\n /**\n * The view (page, sort, search, filters), controlled. Keep it in the URL with `useDataTableUrl`, or anywhere else;\n * left out, the table keeps it itself.\n */\n view?: DataTableView;\n /** The first view when uncontrolled: page 1, the default sort, no search and no filters by default. */\n defaultView?: Partial<DataTableView>;\n /** Called with the whole next view on every change (a new sort, search, filter or page). */\n onViewChange?: (view: DataTableView) => void;\n /** `compact` (36px rows) by default: DataTable is the dense working list of a back office. */\n density?: Density;\n};\n\nexport type DataTableProps<T> = DataTableBase<T> &\n (\n | {\n /**\n * A server list: fetches one page for the view; aborted when the view changes again. It is read when\n * the view changes, not when the function does: for a list that depends on something else (a parent\n * tab), give the DataTable a `key` from it so it starts afresh.\n */\n query: (view: DataTableQuery, signal: AbortSignal) => Promise<DataTableResult<T>>;\n rows?: never;\n virtualizeAbove?: never;\n height?: never;\n }\n | {\n /** A client list: searched, filtered and sorted here; paged, or virtualized when long. */\n rows: readonly T[];\n query?: never;\n /** Client lists longer than this render only the rows in view instead of pages. 200 by default. */\n virtualizeAbove?: number;\n /** The virtualized list's height in px. 480 by default. */\n height?: number;\n }\n );\n\nconst SEARCH_DEBOUNCE = 300;\n\n/** The row's value for a column, as a client list sorts and searches it. */\nfunction cellValue<T>(row: T, column: DataTableColumn<T>) {\n return column.value ? column.value(row) : ((row as Record<string, unknown>)[column.key] as string | number | null | undefined);\n}\n\n/** One empty list for every render, so memos keyed on `filters` hold for tables without filters. */\nconst NO_FILTERS: readonly DataTableFilter[] = [];\n\n/** One function for every render, so memos keyed on `rowKey` hold. */\nconst defaultRowKey = (row: object): Key => (row as { id: Key }).id;\n\n/**\n * The record list of a back office or admin screen: Toolbar (search, filters, column picker), a compact Table\n * with sortable headers and selection, the bulk bar while rows are selected, Pagination, and loading,\n * empty and error states in the table's frame. Page, sort, filters and search are the `view`, kept by the\n * table or by the app; `useDataTableUrl` keeps it in the URL, so a reload or a shared link shows the same view. Server lists page;\n * client lists over 200 rows render only the rows in view. Selection survives paging and clears after a\n * bulk action settles.\n */\nexport function DataTable<T extends object>(props: DataTableProps<T>) {\n const {\n \"aria-label\": label,\n columns,\n rowKey = defaultRowKey as (row: T) => Key,\n filters = NO_FILTERS,\n bulkActions = [],\n defaultSort,\n onRowAction,\n pageSize = 20,\n formatRange,\n emptyState,\n density = \"compact\",\n } = props;\n const { locale } = useLocale();\n // The view: the app's (`view`), or the table's own.\n const [own, setOwn] = React.useState<DataTableView>(() => ({ page: 1, sort: defaultSort, search: \"\", filters: {}, ...props.defaultView }));\n const view = props.view ?? own;\n const viewRef = React.useRef(view);\n viewRef.current = view;\n const setView = (patch: Partial<DataTableView>) => {\n // Anything but a page change starts again at page 1.\n const next = { ...viewRef.current, ...patch, page: patch.page ?? 1 };\n viewRef.current = next;\n if (props.view === undefined) setOwn(next);\n props.onViewChange?.(next);\n };\n // The search box answers each keystroke; the view (the fetch, and the URL with useDataTableUrl) follows once typing\n // pauses. A view changed from outside (Back and Forward, a host router) brings the box along.\n const [searchInput, setSearchInput] = React.useState(view.search);\n const searchTimer = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n React.useEffect(() => () => clearTimeout(searchTimer.current), []);\n const shownSearch = React.useRef(view.search);\n React.useEffect(() => {\n if (view.search === shownSearch.current) return;\n shownSearch.current = view.search;\n clearTimeout(searchTimer.current);\n setSearchInput(view.search);\n }, [view.search]);\n const onSearch = (search: string) => {\n setSearchInput(search);\n clearTimeout(searchTimer.current);\n searchTimer.current = setTimeout(() => {\n shownSearch.current = search;\n setView({ search });\n }, SEARCH_DEBOUNCE);\n };\n\n // Columns the picker hides.\n const [ownVisibility, setOwnVisibility] = React.useState<Record<string, boolean>>({});\n const visibility = props.columnVisibility ?? ownVisibility;\n const rowHeaderKey = (columns.find((column) => column.isRowHeader) ?? columns[0])?.key;\n const shownColumns = columns.filter((column) => column.key === rowHeaderKey || visibility[column.key] !== false);\n const hideable = columns.filter((column) => column.isHideable && column.key !== rowHeaderKey);\n const setVisibility = (next: Record<string, boolean>) => {\n if (props.columnVisibility === undefined) setOwnVisibility(next);\n props.onColumnVisibilityChange?.(next);\n };\n\n // Server data.\n const [reload, setReload] = React.useState(0);\n // `forView` is the view a result answered: a stale result (the moment after Back restores another view)\n // never decides anything about the new one.\n const [server, setServer] = React.useState<{ status: \"loading\" | \"ready\" | \"error\"; result?: DataTableResult<T>; forView?: string }>({ status: \"loading\" });\n const viewKey = JSON.stringify(view);\n const queryRef = React.useRef(props.query);\n queryRef.current = props.query;\n const isServer = props.query !== undefined;\n React.useEffect(() => {\n if (!isServer) return;\n const controller = new AbortController();\n setServer((previous) => ({ status: \"loading\", result: previous.result }));\n Promise.resolve(queryRef.current!({ ...view, pageSize }, controller.signal)).then(\n (result) => !controller.signal.aborted && setServer({ status: \"ready\", result, forView: viewKey }),\n () => !controller.signal.aborted && setServer((previous) => ({ status: \"error\", result: previous.result })),\n );\n return () => controller.abort();\n // `view` is read through `viewKey`.\n }, [isServer, viewKey, pageSize, reload]);\n\n // Client data: searched, filtered and sorted here.\n const collator = React.useMemo(() => new Intl.Collator(intlLocale(locale), { numeric: true, sensitivity: \"base\" }), [locale]);\n const clientRows = React.useMemo(() => {\n if (isServer) return [];\n let rows = [...(props.rows ?? [])];\n if (view.search.trim()) rows = rows.filter((row) => matchesQuery(view.search, ...columns.map((column) => String(cellValue(row, column) ?? \"\"))));\n for (const [key, values] of Object.entries(view.filters)) {\n if (!values.length) continue;\n const accessor = filters.find((filter) => filter.key === key)?.value as ((row: T) => string | readonly string[] | null | undefined) | undefined;\n rows = rows.filter((row) => {\n const own = accessor ? accessor(row) : ((row as Record<string, unknown>)[key] as string | null | undefined);\n const list = Array.isArray(own) ? own : [own];\n return list.some((item) => item != null && values.includes(String(item)));\n });\n }\n const sortColumn = view.sort && columns.find((column) => column.key === String(view.sort!.column));\n if (sortColumn) {\n const sign = view.sort!.direction === \"descending\" ? -1 : 1;\n rows.sort((a, b) => {\n const left = cellValue(a, sortColumn);\n const right = cellValue(b, sortColumn);\n if (typeof left === \"number\" && typeof right === \"number\") return (left - right) * sign;\n return collator.compare(String(left ?? \"\"), String(right ?? \"\")) * sign;\n });\n }\n return rows;\n // `view` is read through `viewKey`.\n }, [isServer, props.rows, viewKey, columns, filters, collator]);\n const virtual = !isServer && clientRows.length > (props.virtualizeAbove ?? 200);\n const total = isServer ? (server.result?.total ?? 0) : clientRows.length;\n // A page past the end (a shared `?page=99`, the last page emptied by a bulk delete) moves to the last page.\n const lastPage = Math.max(1, Math.ceil(total / pageSize));\n const known = !isServer || (server.status === \"ready\" && server.forView === viewKey);\n React.useEffect(() => {\n if (known && !virtual && view.page > lastPage) setView({ page: lastPage });\n });\n const pageRows = React.useMemo(\n () => (isServer ? (server.result?.rows ?? []) : virtual ? clientRows : clientRows.slice((view.page - 1) * pageSize, view.page * pageSize)),\n [isServer, server.result, virtual, clientRows, view.page, pageSize],\n );\n\n // Selection across pages: kept by key, whatever page shows.\n const [selected, setSelected] = React.useState<ReadonlySet<Key>>(new Set());\n // The keys the table gives the rows on this page: a repeated id is suffixed there, so it is here too.\n // Every render, as TableView computes its keys: a row whose id changed in place must not\n // keep a stale key here, or its selection would be filtered out.\n const visibleKeys = new Set(uniqueRowKeys(pageRows.map(rowKey)).keys);\n const onSelectionChange = (keys: Selection) => {\n const next = new Set([...selected].filter((key) => !visibleKeys.has(key)));\n for (const key of keys === \"all\" ? visibleKeys : keys) if (visibleKeys.has(key)) next.add(key);\n setSelected(next);\n };\n const [pendingAction, setPendingAction] = React.useState<string | null>(null);\n const runBulk = async (action: DataTableBulkAction) => {\n setPendingAction(action.id);\n try {\n await action.onAction([...selected]);\n // Done: the selection goes and the list shows the result.\n setSelected(new Set());\n setReload((n) => n + 1);\n } catch {\n // Failed: the selection and the bar stay so the action can be tried again; the app says what went\n // wrong (its `onAction` toasts the reason), the table never swallows it into an unhandled rejection.\n } finally {\n setPendingAction(null);\n }\n };\n\n const isFiltered = Boolean(view.search.trim()) || Object.values(view.filters).some((values) => values.length > 0);\n const clearFilters = () => {\n clearTimeout(searchTimer.current);\n setSearchInput(\"\");\n setView({ search: \"\", filters: {} });\n };\n const status = isServer ? server.status : \"ready\";\n const showSkeleton = status === \"loading\" && !(server.result && server.result.rows.length);\n\n const empty = () =>\n isFiltered ? (\n <EmptyState\n size=\"small\"\n icon=\"search-x\"\n title={tableNoResultsLabel(locale)}\n primaryAction={<Button size=\"small\" onPress={clearFilters}>{tableClearFiltersLabel(locale)}</Button>}\n />\n ) : (\n emptyState ?? <EmptyState size=\"small\" icon=\"inbox\" title={tableEmptyLabel(locale)} />\n );\n\n return (\n <section data-slot=\"data-table\" aria-busy={status === \"loading\" || undefined} className=\"flex min-w-0 flex-col gap-ds-150\">\n {selected.size > 0 && bulkActions.length > 0 ? (\n <BulkBar\n aria-label={tableSelectedLabel(locale)}\n selectedCount={selected.size}\n onClear={() => setSelected(new Set())}\n actions={bulkActions.map((action) => (\n <Button key={action.id} size=\"small\" isPending={pendingAction === action.id} isDisabled={pendingAction !== null} onPress={() => void runBulk(action)}>\n {action.label}\n </Button>\n ))}\n />\n ) : (\n <Toolbar aria-label={tableToolsLabel(locale)}>\n <div data-slot=\"data-table-search\" className=\"w-56 max-w-full\">\n <SearchField\n aria-label={tableSearchLabel(locale)}\n placeholder={tableSearchLabel(locale)}\n size=\"small\"\n value={searchInput}\n onChange={onSearch}\n />\n </div>\n {filters.map((filter) => {\n const values = view.filters[filter.key] ?? [];\n return (\n <Menu\n key={filter.key}\n aria-label={filter.label}\n placement=\"bottom start\"\n selectionMode=\"multiple\"\n selectedKeys={values}\n onSelectionChange={(keys) => setView({ filters: { ...view.filters, [filter.key]: keys === \"all\" ? filter.options.map((option) => option.id) : [...keys].map(String) } })}\n items={filter.options.map((option) => ({ id: option.id, label: option.label }))}\n trigger={\n <Button size=\"small\" variant={values.length ? \"default\" : \"subtle\"} iconBefore=\"filter\">\n {values.length ? `${filter.label} · ${values.length}` : filter.label}\n </Button>\n }\n />\n );\n })}\n <ToolbarSpacer />\n {hideable.length > 0 && (\n <Menu\n aria-label={tableColumnsLabel(locale)}\n selectionMode=\"multiple\"\n selectedKeys={hideable.filter((column) => visibility[column.key] !== false).map((column) => column.key)}\n onSelectionChange={(keys) => {\n const shown = keys === \"all\" ? new Set(hideable.map((column) => column.key)) : new Set([...keys].map(String));\n setVisibility(Object.fromEntries(hideable.map((column) => [column.key, shown.has(column.key)])));\n }}\n items={hideable.map((column) => ({ id: column.key, label: column.header }))}\n trigger={\n <Button size=\"small\" variant=\"subtle\" iconBefore=\"columns-3\">\n {tableColumnsLabel(locale)}\n </Button>\n }\n />\n )}\n </Toolbar>\n )}\n\n {status === \"error\" ? (\n <div data-slot=\"data-table-error\" className=\"rounded-ds-large bg-ds-surface-raised py-ds-400 shadow-ds-raised\">\n <EmptyState\n size=\"small\"\n tone=\"danger\"\n icon=\"cloud-off\"\n announce\n title={tableLoadFailedLabel(locale)}\n description={tableLoadFailedHintLabel(locale)}\n primaryAction={\n <Button size=\"small\" iconBefore=\"rotate-cw\" onPress={() => setReload((n) => n + 1)}>\n {retryLabel(locale)}\n </Button>\n }\n />\n </div>\n ) : showSkeleton ? (\n <div data-slot=\"data-table-loading\" aria-hidden className=\"flex flex-col overflow-hidden rounded-ds-large bg-ds-surface-raised shadow-ds-raised\">\n <div className=\"h-9 border-b border-ds-border bg-ds-surface-sunken\" />\n {Array.from({ length: Math.min(pageSize, 8) }, (_, index) => (\n <div key={index} className={cn(\"flex items-center gap-ds-300 border-b border-ds-border px-ds-200 last:border-b-0\", density === \"compact\" ? \"h-ds-row-compact\" : \"h-ds-row\")}>\n <Skeleton width=\"18%\" height={12} />\n <Skeleton width=\"30%\" height={12} />\n <Skeleton width=\"16%\" height={12} />\n </div>\n ))}\n </div>\n ) : (\n <TableView\n component=\"DataTable\"\n aria-label={label}\n columns={shownColumns}\n rows={pageRows}\n rowKey={rowKey}\n selectionMode={bulkActions.length ? \"multiple\" : \"none\"}\n selectedKeys={[...selected].filter((key) => visibleKeys.has(key))}\n onSelectionChange={onSelectionChange}\n sortDescriptor={view.sort}\n onSortChange={(sort) => setView({ sort })}\n density={density}\n onRowAction={onRowAction}\n emptyState={empty()}\n virtual={virtual ? { height: (props as { height?: number }).height ?? 480 } : undefined}\n />\n )}\n\n {!virtual && status !== \"error\" && total > 0 && (\n <Pagination page={view.page} pageSize={pageSize} total={total} onPageChange={(page) => setView({ page })} formatRange={formatRange} />\n )}\n </section>\n );\n}\n"]}
1
+ {"version":3,"file":"data-table.js","sourceRoot":"","sources":["../../src/collection/data-table.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAiD,MAAM,uBAAuB,CAAC;AAEjG,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EACL,UAAU,EACV,UAAU,EACV,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC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AIT,CACP,CAAC,IACE,CACP,CAAC,CAAC,CAAC,CACF,KAAC,SAAS,IACR,SAAS,EAAC,WAAW,gBACT,KAAK,EACjB,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,EACvD,YAAY,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EACjE,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,IAAI,CAAC,IAAI,EACzB,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EACzC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,KAAK,EAAE,EACnB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAG,KAA6B,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,GACvF,CACH,EAEA,CAAC,OAAO,IAAI,MAAM,KAAK,OAAO,IAAI,KAAK,GAAG,CAAC,IAAI,CAC9C,KAAC,UAAU,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,WAAW,GAAI,CACvI,IACO,CACX,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport type { Density } from \"../density\";\nimport * as React from \"react\";\nimport { useLocale, type Key, type Selection, type SortDescriptor } from \"react-aria-components\";\n\nimport { cn } from \"../utils\";\nimport { Button } from \"../action/button\";\nimport { EmptyState } from \"../feedback/empty-state\";\nimport { Skeleton } from \"../feedback/skeleton\";\nimport { SearchField } from \"../form/search-field\";\nimport {\n intlLocale,\n retryLabel,\n tableClearFiltersLabel,\n tableColumnsLabel,\n tableEmptyLabel,\n tableLoadFailedHintLabel,\n tableLoadFailedLabel,\n tableNoResultsLabel,\n tableSearchLabel,\n tableSelectedLabel,\n tableToolsLabel,\n} from \"../i18n\";\nimport { Pagination } from \"../navigation/pagination\";\nimport { BulkBar, Toolbar, ToolbarSpacer } from \"../layout/toolbar\";\nimport { Menu } from \"../overlay/floating\";\nimport { matchesQuery } from \"../selection/match\";\nimport type { DataTableView } from \"./data-table-url\";\nimport { TableView, uniqueRowKeys, type TableColumn } from \"./table\";\n\nexport type DataTableColumn<T> = TableColumn<T> & {\n /** Offered in the column picker (\"Columns\"); the row header column never hides. */\n isHideable?: boolean;\n /** The value sorted and searched in a client list; the row's value under `key` by default. */\n value?: (row: T) => string | number | null | undefined;\n};\n\nexport type DataTableFilter = {\n /** Also the URL param name. */\n key: string;\n /** \"Durum\". */\n label: string;\n options: readonly { id: string; label: string }[];\n /** A client list's value(s) for this filter; the row's value under `key` by default (a nested or derived field). */\n value?: (row: never) => string | readonly string[] | null | undefined;\n};\n\nexport type DataTableQuery = DataTableView & { pageSize: number };\n\nexport type DataTableResult<T> = { rows: readonly T[]; total: number };\n\nexport type DataTableBulkAction = {\n id: string;\n /** A verb (\"Send reminder\"). */\n label: string;\n /**\n * Runs on the selected keys (across pages, filtered-out rows included). When it resolves the selection\n * clears and the list reloads; when it rejects both stay, so tell the user why from here (a toast).\n */\n onAction: (keys: Key[]) => unknown;\n};\n\ntype DataTableBase<T> = {\n /** Names the table (\"Orders\"). */\n \"aria-label\": string;\n columns: readonly DataTableColumn<T>[];\n /**\n * The row's stable id; `row.id` by default. Selection is kept by it across pages. Ids must be unique within\n * the list; build one from the fields that are when the data has none (`${row.date}:${row.channel}`). A\n * repeated id on a page still renders every row: the later ones are keyed `a#2`, `a#3`, … in row order, and\n * selection, bulk actions and `onRowAction` receive those suffixed keys; a development warning names the\n * repeated ids. A suffixed key follows the row's position, not the row: after a sort, filter\n * or page change a selection made through it can move to another copy, and an id repeated on two pages is\n * one key, so selecting it on one page selects it on both.\n */\n rowKey?: (row: T) => Key;\n filters?: readonly DataTableFilter[];\n bulkActions?: readonly DataTableBulkAction[];\n defaultSort?: SortDescriptor;\n /** Column key → shown; columns left out are shown. Pass with `onColumnVisibilityChange` to own it. */\n columnVisibility?: Readonly<Record<string, boolean>>;\n onColumnVisibilityChange?: (visibility: Record<string, boolean>) => void;\n /** Opens the record (row press while nothing is selected). */\n onRowAction?: (key: Key) => void;\n /** 20 by default. */\n pageSize?: number;\n /** The range sentence: (41, 60, 1204) → \"41–60 of 1,204\". */\n formatRange?: (from: number, to: number, total: number) => string;\n /**\n * What an empty list shows (with no search or filter active): an `EmptyState size=\"small\"` with the action that\n * fills it. \"No records yet\" by default.\n */\n emptyState?: React.ReactNode;\n /**\n * The view (page, sort, search, filters), controlled. Keep it in the URL with `useDataTableUrl`, or anywhere else;\n * left out, the table keeps it itself.\n */\n view?: DataTableView;\n /** The first view when uncontrolled: page 1, the default sort, no search and no filters by default. */\n defaultView?: Partial<DataTableView>;\n /** Called with the whole next view on every change (a new sort, search, filter or page). */\n onViewChange?: (view: DataTableView) => void;\n /** `comfortable` (default, rows of at least 48px) or `compact` (36px rows) for a dense screen that needs every row in view. */\n density?: Density;\n};\n\nexport type DataTableProps<T> = DataTableBase<T> &\n (\n | {\n /**\n * A server list: fetches one page for the view; aborted when the view changes again. It is read when\n * the view changes, not when the function does: for a list that depends on something else (a parent\n * tab), give the DataTable a `key` from it so it starts afresh.\n */\n query: (view: DataTableQuery, signal: AbortSignal) => Promise<DataTableResult<T>>;\n rows?: never;\n virtualizeAbove?: never;\n height?: never;\n }\n | {\n /** A client list: searched, filtered and sorted here; paged, or virtualized when long. */\n rows: readonly T[];\n query?: never;\n /** Client lists longer than this render only the rows in view instead of pages. 200 by default. */\n virtualizeAbove?: number;\n /** The virtualized list's height in px. 480 by default. */\n height?: number;\n }\n );\n\nconst SEARCH_DEBOUNCE = 300;\n\n/** The row's value for a column, as a client list sorts and searches it. */\nfunction cellValue<T>(row: T, column: DataTableColumn<T>) {\n return column.value ? column.value(row) : ((row as Record<string, unknown>)[column.key] as string | number | null | undefined);\n}\n\n/** One empty list for every render, so memos keyed on `filters` hold for tables without filters. */\nconst NO_FILTERS: readonly DataTableFilter[] = [];\n\n/** One function for every render, so memos keyed on `rowKey` hold. */\nconst defaultRowKey = (row: object): Key => (row as { id: Key }).id;\n\n/**\n * The record list of a back office or admin screen: Toolbar (search, filters, column picker), a compact Table\n * with sortable headers and selection, the bulk bar while rows are selected, Pagination, and loading,\n * empty and error states in the table's frame. Page, sort, filters and search are the `view`, kept by the\n * table or by the app; `useDataTableUrl` keeps it in the URL, so a reload or a shared link shows the same view. Server lists page;\n * client lists over 200 rows render only the rows in view. Selection survives paging and clears after a\n * bulk action settles.\n */\nexport function DataTable<T extends object>(props: DataTableProps<T>) {\n const {\n \"aria-label\": label,\n columns,\n rowKey = defaultRowKey as (row: T) => Key,\n filters = NO_FILTERS,\n bulkActions = [],\n defaultSort,\n onRowAction,\n pageSize = 20,\n formatRange,\n emptyState,\n density = \"comfortable\",\n } = props;\n const { locale } = useLocale();\n // The view: the app's (`view`), or the table's own.\n const [own, setOwn] = React.useState<DataTableView>(() => ({ page: 1, sort: defaultSort, search: \"\", filters: {}, ...props.defaultView }));\n const view = props.view ?? own;\n const viewRef = React.useRef(view);\n viewRef.current = view;\n const setView = (patch: Partial<DataTableView>) => {\n // Anything but a page change starts again at page 1.\n const next = { ...viewRef.current, ...patch, page: patch.page ?? 1 };\n viewRef.current = next;\n if (props.view === undefined) setOwn(next);\n props.onViewChange?.(next);\n };\n // The search box answers each keystroke; the view (the fetch, and the URL with useDataTableUrl) follows once typing\n // pauses. A view changed from outside (Back and Forward, a host router) brings the box along.\n const [searchInput, setSearchInput] = React.useState(view.search);\n const searchTimer = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n React.useEffect(() => () => clearTimeout(searchTimer.current), []);\n const shownSearch = React.useRef(view.search);\n React.useEffect(() => {\n if (view.search === shownSearch.current) return;\n shownSearch.current = view.search;\n clearTimeout(searchTimer.current);\n setSearchInput(view.search);\n }, [view.search]);\n const onSearch = (search: string) => {\n setSearchInput(search);\n clearTimeout(searchTimer.current);\n searchTimer.current = setTimeout(() => {\n shownSearch.current = search;\n setView({ search });\n }, SEARCH_DEBOUNCE);\n };\n\n // Columns the picker hides.\n const [ownVisibility, setOwnVisibility] = React.useState<Record<string, boolean>>({});\n const visibility = props.columnVisibility ?? ownVisibility;\n const rowHeaderKey = (columns.find((column) => column.isRowHeader) ?? columns[0])?.key;\n const shownColumns = columns.filter((column) => column.key === rowHeaderKey || visibility[column.key] !== false);\n const hideable = columns.filter((column) => column.isHideable && column.key !== rowHeaderKey);\n const setVisibility = (next: Record<string, boolean>) => {\n if (props.columnVisibility === undefined) setOwnVisibility(next);\n props.onColumnVisibilityChange?.(next);\n };\n\n // Server data.\n const [reload, setReload] = React.useState(0);\n // `forView` is the view a result answered: a stale result (the moment after Back restores another view)\n // never decides anything about the new one.\n const [server, setServer] = React.useState<{ status: \"loading\" | \"ready\" | \"error\"; result?: DataTableResult<T>; forView?: string }>({ status: \"loading\" });\n const viewKey = JSON.stringify(view);\n const queryRef = React.useRef(props.query);\n queryRef.current = props.query;\n const isServer = props.query !== undefined;\n React.useEffect(() => {\n if (!isServer) return;\n const controller = new AbortController();\n setServer((previous) => ({ status: \"loading\", result: previous.result }));\n Promise.resolve(queryRef.current!({ ...view, pageSize }, controller.signal)).then(\n (result) => !controller.signal.aborted && setServer({ status: \"ready\", result, forView: viewKey }),\n () => !controller.signal.aborted && setServer((previous) => ({ status: \"error\", result: previous.result })),\n );\n return () => controller.abort();\n // `view` is read through `viewKey`.\n }, [isServer, viewKey, pageSize, reload]);\n\n // Client data: searched, filtered and sorted here.\n const collator = React.useMemo(() => new Intl.Collator(intlLocale(locale), { numeric: true, sensitivity: \"base\" }), [locale]);\n const clientRows = React.useMemo(() => {\n if (isServer) return [];\n let rows = [...(props.rows ?? [])];\n if (view.search.trim()) rows = rows.filter((row) => matchesQuery(view.search, ...columns.map((column) => String(cellValue(row, column) ?? \"\"))));\n for (const [key, values] of Object.entries(view.filters)) {\n if (!values.length) continue;\n const accessor = filters.find((filter) => filter.key === key)?.value as ((row: T) => string | readonly string[] | null | undefined) | undefined;\n rows = rows.filter((row) => {\n const own = accessor ? accessor(row) : ((row as Record<string, unknown>)[key] as string | null | undefined);\n const list = Array.isArray(own) ? own : [own];\n return list.some((item) => item != null && values.includes(String(item)));\n });\n }\n const sortColumn = view.sort && columns.find((column) => column.key === String(view.sort!.column));\n if (sortColumn) {\n const sign = view.sort!.direction === \"descending\" ? -1 : 1;\n rows.sort((a, b) => {\n const left = cellValue(a, sortColumn);\n const right = cellValue(b, sortColumn);\n if (typeof left === \"number\" && typeof right === \"number\") return (left - right) * sign;\n return collator.compare(String(left ?? \"\"), String(right ?? \"\")) * sign;\n });\n }\n return rows;\n // `view` is read through `viewKey`.\n }, [isServer, props.rows, viewKey, columns, filters, collator]);\n const virtual = !isServer && clientRows.length > (props.virtualizeAbove ?? 200);\n const total = isServer ? (server.result?.total ?? 0) : clientRows.length;\n // A page past the end (a shared `?page=99`, the last page emptied by a bulk delete) moves to the last page.\n const lastPage = Math.max(1, Math.ceil(total / pageSize));\n const known = !isServer || (server.status === \"ready\" && server.forView === viewKey);\n React.useEffect(() => {\n if (known && !virtual && view.page > lastPage) setView({ page: lastPage });\n });\n const pageRows = React.useMemo(\n () => (isServer ? (server.result?.rows ?? []) : virtual ? clientRows : clientRows.slice((view.page - 1) * pageSize, view.page * pageSize)),\n [isServer, server.result, virtual, clientRows, view.page, pageSize],\n );\n\n // Selection across pages: kept by key, whatever page shows.\n const [selected, setSelected] = React.useState<ReadonlySet<Key>>(new Set());\n // The keys the table gives the rows on this page: a repeated id is suffixed there, so it is here too.\n // Every render, as TableView computes its keys: a row whose id changed in place must not\n // keep a stale key here, or its selection would be filtered out.\n const visibleKeys = new Set(uniqueRowKeys(pageRows.map(rowKey)).keys);\n const onSelectionChange = (keys: Selection) => {\n const next = new Set([...selected].filter((key) => !visibleKeys.has(key)));\n for (const key of keys === \"all\" ? visibleKeys : keys) if (visibleKeys.has(key)) next.add(key);\n setSelected(next);\n };\n const [pendingAction, setPendingAction] = React.useState<string | null>(null);\n const runBulk = async (action: DataTableBulkAction) => {\n setPendingAction(action.id);\n try {\n await action.onAction([...selected]);\n // Done: the selection goes and the list shows the result.\n setSelected(new Set());\n setReload((n) => n + 1);\n } catch {\n // Failed: the selection and the bar stay so the action can be tried again; the app says what went\n // wrong (its `onAction` toasts the reason), the table never swallows it into an unhandled rejection.\n } finally {\n setPendingAction(null);\n }\n };\n\n const isFiltered = Boolean(view.search.trim()) || Object.values(view.filters).some((values) => values.length > 0);\n const clearFilters = () => {\n clearTimeout(searchTimer.current);\n setSearchInput(\"\");\n setView({ search: \"\", filters: {} });\n };\n const status = isServer ? server.status : \"ready\";\n const showSkeleton = status === \"loading\" && !(server.result && server.result.rows.length);\n\n const empty = () =>\n isFiltered ? (\n <EmptyState\n size=\"small\"\n icon=\"search-x\"\n title={tableNoResultsLabel(locale)}\n primaryAction={<Button size=\"small\" onPress={clearFilters}>{tableClearFiltersLabel(locale)}</Button>}\n />\n ) : (\n emptyState ?? <EmptyState size=\"small\" icon=\"inbox\" title={tableEmptyLabel(locale)} />\n );\n\n return (\n <section data-slot=\"data-table\" aria-busy={status === \"loading\" || undefined} className=\"flex min-w-0 flex-col gap-ds-150\">\n {selected.size > 0 && bulkActions.length > 0 ? (\n <BulkBar\n aria-label={tableSelectedLabel(locale)}\n selectedCount={selected.size}\n onClear={() => setSelected(new Set())}\n actions={bulkActions.map((action) => (\n <Button key={action.id} size=\"small\" isPending={pendingAction === action.id} isDisabled={pendingAction !== null} onPress={() => void runBulk(action)}>\n {action.label}\n </Button>\n ))}\n />\n ) : (\n <Toolbar aria-label={tableToolsLabel(locale)}>\n <div data-slot=\"data-table-search\" className=\"w-56 max-w-full\">\n <SearchField\n aria-label={tableSearchLabel(locale)}\n placeholder={tableSearchLabel(locale)}\n size=\"small\"\n value={searchInput}\n onChange={onSearch}\n />\n </div>\n {filters.map((filter) => {\n const values = view.filters[filter.key] ?? [];\n return (\n <Menu\n key={filter.key}\n aria-label={filter.label}\n placement=\"bottom start\"\n selectionMode=\"multiple\"\n selectedKeys={values}\n onSelectionChange={(keys) => setView({ filters: { ...view.filters, [filter.key]: keys === \"all\" ? filter.options.map((option) => option.id) : [...keys].map(String) } })}\n items={filter.options.map((option) => ({ id: option.id, label: option.label }))}\n trigger={\n <Button size=\"small\" variant={values.length ? \"default\" : \"subtle\"} iconBefore=\"filter\">\n {values.length ? `${filter.label} · ${values.length}` : filter.label}\n </Button>\n }\n />\n );\n })}\n <ToolbarSpacer />\n {hideable.length > 0 && (\n <Menu\n aria-label={tableColumnsLabel(locale)}\n selectionMode=\"multiple\"\n selectedKeys={hideable.filter((column) => visibility[column.key] !== false).map((column) => column.key)}\n onSelectionChange={(keys) => {\n const shown = keys === \"all\" ? new Set(hideable.map((column) => column.key)) : new Set([...keys].map(String));\n setVisibility(Object.fromEntries(hideable.map((column) => [column.key, shown.has(column.key)])));\n }}\n items={hideable.map((column) => ({ id: column.key, label: column.header }))}\n trigger={\n <Button size=\"small\" variant=\"subtle\" iconBefore=\"columns-3\">\n {tableColumnsLabel(locale)}\n </Button>\n }\n />\n )}\n </Toolbar>\n )}\n\n {status === \"error\" ? (\n <div data-slot=\"data-table-error\" className=\"rounded-ds-large bg-ds-surface-raised py-ds-400 shadow-ds-raised\">\n <EmptyState\n size=\"small\"\n tone=\"danger\"\n icon=\"cloud-off\"\n announce\n title={tableLoadFailedLabel(locale)}\n description={tableLoadFailedHintLabel(locale)}\n primaryAction={\n <Button size=\"small\" iconBefore=\"rotate-cw\" onPress={() => setReload((n) => n + 1)}>\n {retryLabel(locale)}\n </Button>\n }\n />\n </div>\n ) : showSkeleton ? (\n <div data-slot=\"data-table-loading\" aria-hidden className=\"flex flex-col overflow-hidden rounded-ds-large bg-ds-surface-raised shadow-ds-raised\">\n <div className={cn(\"border-b border-ds-border bg-ds-surface-sunken\", density === \"compact\" ? \"h-9\" : \"h-10\")} />\n {Array.from({ length: Math.min(pageSize, 8) }, (_, index) => (\n <div key={index} className={cn(\"flex items-center gap-ds-300 border-b border-ds-border px-ds-200 last:border-b-0\", density === \"compact\" ? \"h-ds-row-compact\" : \"h-ds-row\")}>\n <Skeleton width=\"18%\" height={12} />\n <Skeleton width=\"30%\" height={12} />\n <Skeleton width=\"16%\" height={12} />\n </div>\n ))}\n </div>\n ) : (\n <TableView\n component=\"DataTable\"\n aria-label={label}\n columns={shownColumns}\n rows={pageRows}\n rowKey={rowKey}\n selectionMode={bulkActions.length ? \"multiple\" : \"none\"}\n selectedKeys={[...selected].filter((key) => visibleKeys.has(key))}\n onSelectionChange={onSelectionChange}\n sortDescriptor={view.sort}\n onSortChange={(sort) => setView({ sort })}\n density={density}\n onRowAction={onRowAction}\n emptyState={empty()}\n virtual={virtual ? { height: (props as { height?: number }).height ?? 480 } : undefined}\n />\n )}\n\n {!virtual && status !== \"error\" && total > 0 && (\n <Pagination page={view.page} pageSize={pageSize} total={total} onPageChange={(page) => setView({ page })} formatRange={formatRange} />\n )}\n </section>\n );\n}\n"]}
@@ -14,6 +14,11 @@ export type TableColumn<T> = {
14
14
  render?: (row: T) => React.ReactNode;
15
15
  /** Long text: clamp to two lines with an ellipsis, the full text on hover and keyboard focus. */
16
16
  wrap?: boolean;
17
+ /**
18
+ * A second line under the value, smaller and in the subtle tone: a person's email under the name, a site's domain under
19
+ * its name, a date under a code. Both lines stay on one line each (truncated with a `width`).
20
+ */
21
+ description?: (row: T) => React.ReactNode;
17
22
  /** The row header: the value that names the row (an order number); the first column by default. */
18
23
  isRowHeader?: boolean;
19
24
  /**
@@ -45,7 +50,7 @@ export type TableProps<T> = {
45
50
  onSelectionChange?: (keys: Selection) => void;
46
51
  sortDescriptor?: SortDescriptor;
47
52
  onSortChange?: (descriptor: SortDescriptor) => void;
48
- /** `compact` (36px rows) for dense working screens; `default` (48px) for public and content pages. */
53
+ /** `comfortable` (default: rows of at least 48px, 12px above and below a value, 24px at the edges) or `compact` (36px rows) for dense working screens. */
49
54
  density?: Density;
50
55
  /** Shown when there are no rows: an `EmptyState`, or one sentence on why it is empty and the action that fills it. */
51
56
  emptyState?: React.ReactNode;
@@ -69,7 +74,7 @@ export declare function uniqueRowKeys(keys: readonly Key[]): {
69
74
  };
70
75
  /**
71
76
  * Records the user scans, compares, sorts and acts on: orders, customers, invoices. On
72
- * `ds-surface-raised` with a raised shadow; a sunken header row; 48px rows (36px compact) divided by
77
+ * `ds-surface-raised` with a raised shadow; a sunken header row; rows of at least 48px (36px compact) divided by
73
78
  * `ds-border`; selection by checkbox with a 2px marker on the leading edge; the row opens the record.
74
79
  * Status is a Badge, money right-aligned and formatted by the locale ("$1,248.00"). Under 640px use a List.
75
80
  *
@@ -109,7 +109,7 @@ function useRepeatedKeyWarning(component, label, repeated) {
109
109
  }
110
110
  /**
111
111
  * Records the user scans, compares, sorts and acts on: orders, customers, invoices. On
112
- * `ds-surface-raised` with a raised shadow; a sunken header row; 48px rows (36px compact) divided by
112
+ * `ds-surface-raised` with a raised shadow; a sunken header row; rows of at least 48px (36px compact) divided by
113
113
  * `ds-border`; selection by checkbox with a 2px marker on the leading edge; the row opens the record.
114
114
  * Status is a Badge, money right-aligned and formatted by the locale ("$1,248.00"). Under 640px use a List.
115
115
  *
@@ -154,6 +154,14 @@ export function TableView({ "aria-label": label, columns: allColumns, rows, rowK
154
154
  };
155
155
  const rowHeader = Math.max(0, columns.findIndex((column) => column.isRowHeader));
156
156
  const height = density === "compact" ? "h-ds-row-compact" : "h-ds-row";
157
+ // Room around the content. The row height is a minimum: a cell's padding keeps a two-line cell (a name over
158
+ // an email) off the dividers, so it grows the row instead of touching them. Virtualized rows have a fixed
159
+ // height the layout needs, so they keep the height alone.
160
+ const pad = virtual ? "" : density === "compact" ? "py-ds-100" : "py-ds-150";
161
+ // The table's outer edge gets more room than the gaps between columns (24px against 16px), so the first
162
+ // and last values do not sit against the card's corner.
163
+ const edge = density === "compact" ? "" : "first:ps-ds-300 last:pe-ds-300";
164
+ const headerHeight = density === "compact" ? "h-9" : "h-10";
157
165
  // Virtualized, cells are boxes the layout places; they centre their content themselves. Each row sits alone
158
166
  // in its own wrapper (so "last row" matches every row) and the header row has no box of its own: the
159
167
  // header cells carry the sunken fill and the scroll shadow, and every row keeps its divider.
@@ -165,19 +173,21 @@ export function TableView({ "aria-label": label, columns: allColumns, rows, rowK
165
173
  // (one Set) and come back unchanged.
166
174
  const { keys, repeated } = uniqueRowKeys(rows.map(rowKey));
167
175
  useRepeatedKeyWarning(component, label, repeated);
168
- const table = (_jsxs(AriaTable, { "aria-label": label, selectionMode: selectionMode, selectionBehavior: "toggle", selectedKeys: selectedKeys, defaultSelectedKeys: defaultSelectedKeys, onSelectionChange: onSelectionChange, sortDescriptor: sortDescriptor, onSortChange: onSortChange, onRowAction: onRowAction, onScroll: virtual ? (event) => setScrolled(event.currentTarget.scrollTop > 0) : undefined, style: virtual ? { height: virtual.height, overflow: "auto" } : undefined, className: cn("w-full border-separate border-spacing-0 text-body text-ds-text outline-hidden", virtual && "block overscroll-contain"), children: [_jsxs(AriaTableHeader, { "data-slot": "table-header", className: cn("sticky top-0 z-[3] bg-ds-surface-sunken transition-shadow duration-(--ds-duration-fast) motion-reduce:transition-none", "in-data-[scrolled]:shadow-ds-overflow"), children: [selectable && (_jsx(AriaColumn, { "data-slot": "table-selection-column", className: cn("w-10 border-b border-ds-border ps-ds-200 text-start", cellBox, headerCell), children: multiple ? _jsx(SelectionCheckbox, {}) : _jsx("span", { className: "sr-only", children: selectionLabel(locale) }) })), columns.map((column, index) => (_jsx(AriaColumn, { id: column.key, isRowHeader: index === rowHeader, allowsSorting: column.isSortable, "data-slot": "table-column", "data-align": column.align ?? "start", "data-hide-below": hideBelow(column), style: column.width ? { width: column.width } : undefined, className: cn("h-9 whitespace-nowrap border-b border-ds-border px-ds-200 align-middle text-body-small font-medium text-ds-text-subtle outline-hidden", "data-[focus-visible]:inset-ring-2 data-[focus-visible]:inset-ring-ds-border-focused", column.align === "end" ? "text-end" : "text-start", column.isSortable && "cursor-pointer data-[hovered]:text-ds-text", cellBox, headerCell, virtual && column.align === "end" && "justify-end", hiddenClass(column)), children: ({ allowsSorting, sortDirection }) => (_jsxs("span", { className: cn("inline-flex items-center gap-ds-050", column.align === "end" && "flex-row-reverse"), children: [column.header, allowsSorting && (_jsx("span", { "data-slot": "table-sort-icon", "data-direction": sortDirection ?? "none", className: cn("inline-flex", sortDirection ? "text-ds-text" : "text-ds-text-subtlest"), children: _jsx(IconGlyph, { name: sortDirection ? SORT_ICON[sortDirection] : "chevrons-up-down", size: "small" }) }))] })) }, column.key)))] }), _jsx(AriaTableBody, { "data-slot": "table-body", items: rows.map((row, index) => ({ key: keys[index], row })), renderEmptyState: emptyState != null && emptyState !== false
176
+ const table = (_jsxs(AriaTable, { "aria-label": label, selectionMode: selectionMode, selectionBehavior: "toggle", selectedKeys: selectedKeys, defaultSelectedKeys: defaultSelectedKeys, onSelectionChange: onSelectionChange, sortDescriptor: sortDescriptor, onSortChange: onSortChange, onRowAction: onRowAction, onScroll: virtual ? (event) => setScrolled(event.currentTarget.scrollTop > 0) : undefined, style: virtual ? { height: virtual.height, overflow: "auto" } : undefined, className: cn("w-full border-separate border-spacing-0 text-body text-ds-text outline-hidden", virtual && "block overscroll-contain"), children: [_jsxs(AriaTableHeader, { "data-slot": "table-header", className: cn("sticky top-0 z-[3] bg-ds-surface-sunken transition-shadow duration-(--ds-duration-fast) motion-reduce:transition-none", "in-data-[scrolled]:shadow-ds-overflow"), children: [selectable && (_jsx(AriaColumn, { "data-slot": "table-selection-column", className: cn("w-10 border-b border-ds-border ps-ds-200 text-start", edge, cellBox, headerCell), children: multiple ? _jsx(SelectionCheckbox, {}) : _jsx("span", { className: "sr-only", children: selectionLabel(locale) }) })), columns.map((column, index) => (_jsx(AriaColumn, { id: column.key, isRowHeader: index === rowHeader, allowsSorting: column.isSortable, "data-slot": "table-column", "data-align": column.align ?? "start", "data-hide-below": hideBelow(column), style: column.width ? { width: column.width } : undefined, className: cn(headerHeight, "whitespace-nowrap border-b border-ds-border px-ds-200 align-middle text-body-small font-medium text-ds-text-subtle outline-hidden", edge, "data-[focus-visible]:inset-ring-2 data-[focus-visible]:inset-ring-ds-border-focused", column.align === "end" ? "text-end" : "text-start", column.isSortable && "cursor-pointer data-[hovered]:text-ds-text", cellBox, headerCell, virtual && column.align === "end" && "justify-end", hiddenClass(column)), children: ({ allowsSorting, sortDirection }) => (_jsxs("span", { className: cn("inline-flex items-center gap-ds-050", column.align === "end" && "flex-row-reverse"), children: [column.header, allowsSorting && (_jsx("span", { "data-slot": "table-sort-icon", "data-direction": sortDirection ?? "none", className: cn("inline-flex", sortDirection ? "text-ds-text" : "text-ds-text-subtlest"), children: _jsx(IconGlyph, { name: sortDirection ? SORT_ICON[sortDirection] : "chevrons-up-down", size: "small" }) }))] })) }, column.key)))] }), _jsx(AriaTableBody, { "data-slot": "table-body", items: rows.map((row, index) => ({ key: keys[index], row })), renderEmptyState: emptyState != null && emptyState !== false
169
177
  ? () => (_jsx("div", { "data-slot": "table-empty", className: "px-ds-300 py-ds-500 text-center text-body text-ds-text-subtle", children: emptyState }))
170
- : undefined, children: (item) => (_jsxs(AriaRow, { id: item.key, "data-slot": "table-row", className: cn("group/row outline-hidden", (onRowAction || selectable) && "cursor-pointer", "data-[hovered]:bg-ds-surface-hovered data-[selected]:bg-ds-background-selected", "data-[focus-visible]:inset-ring-2 data-[focus-visible]:inset-ring-ds-border-focused"), children: [selectable && (_jsxs(AriaCell, { "data-slot": "table-cell", className: cn(height, "relative border-b border-ds-border ps-ds-200 align-middle", lastRow, cellBox), children: [_jsx(SelectedMarker, {}), _jsx(SelectionCheckbox, {})] })), columns.map((column, index) => {
178
+ : undefined, children: (item) => (_jsxs(AriaRow, { id: item.key, "data-slot": "table-row", className: cn("group/row outline-hidden", (onRowAction || selectable) && "cursor-pointer", "data-[hovered]:bg-ds-surface-hovered data-[selected]:bg-ds-background-selected", "data-[focus-visible]:inset-ring-2 data-[focus-visible]:inset-ring-ds-border-focused"), children: [selectable && (_jsxs(AriaCell, { "data-slot": "table-cell", className: cn(height, pad, "relative border-b border-ds-border ps-ds-200 align-middle", edge, lastRow, cellBox), children: [_jsx(SelectedMarker, {}), _jsx(SelectionCheckbox, {})] })), columns.map((column, index) => {
171
179
  const raw = column.render ? column.render(item.row) : item.row[column.key];
172
180
  // Text and numbers are isolated, so a phone or a price keeps its order in RTL ("+1 555 0100").
173
181
  const value = typeof raw === "string" || typeof raw === "number" ? _jsx("bdi", { children: raw }) : raw;
174
- return (_jsxs(AriaCell, { "data-slot": "table-cell", "data-align": column.align ?? "start", "data-hide-below": hideBelow(column), className: cn(height, "group/cell relative border-b border-ds-border px-ds-200 align-middle outline-hidden", lastRow, "data-[focus-visible]:inset-ring-2 data-[focus-visible]:inset-ring-ds-border-focused",
182
+ return (_jsxs(AriaCell, { "data-slot": "table-cell", "data-align": column.align ?? "start", "data-hide-below": hideBelow(column), className: cn(height, pad, "group/cell relative border-b border-ds-border px-ds-200 align-middle outline-hidden", edge, lastRow, "data-[focus-visible]:inset-ring-2 data-[focus-visible]:inset-ring-ds-border-focused",
175
183
  // One line per cell, as shadcn's tables: on a phone the table scrolls sideways instead of breaking
176
184
  // "SO-1081" or a name over two lines. `wrap` columns clamp to two lines; `width` columns truncate.
177
- column.align === "end" ? "whitespace-nowrap text-end tabular-nums" : cn("text-start", !column.wrap && !column.width && "whitespace-nowrap"), cellBox, virtual && column.align === "end" && "justify-end", hiddenClass(column)), children: [!selectable && index === 0 && _jsx(SelectedMarker, {}), column.wrap ? (_jsxs(_Fragment, { children: [_jsx("span", { "data-slot": "table-cell-wrap", title: typeof raw === "string" ? raw : undefined, className: "line-clamp-2 py-ds-050", children: value }), _jsx("span", { "aria-hidden": true, inert: true, "data-slot": "table-cell-full", className: "absolute inset-x-0 top-0 z-[2] hidden min-h-full rounded-ds-medium bg-ds-surface-overlay px-ds-200 py-ds-150 text-ds-text shadow-ds-overlay group-hover/cell:block group-data-[focus-visible]/cell:block group-data-[focus-visible]/row:block", children: value })] })) : value] }, column.key));
185
+ column.align === "end" ? "whitespace-nowrap text-end tabular-nums" : cn("text-start", !column.wrap && !column.width && "whitespace-nowrap"), cellBox, virtual && column.align === "end" && "justify-end", hiddenClass(column)), children: [!selectable && index === 0 && _jsx(SelectedMarker, {}), column.wrap ? (_jsxs(_Fragment, { children: [_jsx("span", { "data-slot": "table-cell-wrap", title: typeof raw === "string" ? raw : undefined, className: "line-clamp-2 py-ds-050", children: value }), _jsx("span", { "aria-hidden": true, inert: true, "data-slot": "table-cell-full", className: "absolute inset-x-0 top-0 z-[2] hidden min-h-full rounded-ds-medium bg-ds-surface-overlay px-ds-200 py-ds-150 text-ds-text shadow-ds-overlay group-hover/cell:block group-data-[focus-visible]/cell:block group-data-[focus-visible]/row:block", children: value })] })) : column.description ? (_jsxs("span", { "data-slot": "table-cell-stack", className: "flex min-w-0 flex-col", children: [_jsx("span", { className: "truncate", children: value }), _jsx("span", { "data-slot": "table-cell-description", className: "truncate text-body-small text-ds-text-subtle", children: column.description(item.row) })] })) : value] }, column.key));
178
186
  })] })) })] }));
179
- const rowHeight = density === "compact" ? 36 : 48;
180
- return (_jsx("div", { "data-slot": "table", "data-density": density, "data-scrolled": scrolled || undefined, "data-virtual": virtual ? "" : undefined, onScroll: maxHeight && !virtual ? (event) => setScrolled(event.currentTarget.scrollTop > 0) : undefined, style: maxHeight && !virtual ? { maxHeight } : undefined, className: cn(virtual ? "overflow-hidden" : "overflow-auto", "rounded-ds-large bg-ds-surface-raised shadow-ds-raised", maxHeight && "overscroll-contain"), children: virtual ? (_jsx(Virtualizer, { layout: TableLayout, layoutOptions: { rowHeight, headingHeight: 36 }, children: table })) : (table) }));
187
+ // A virtualized row has a fixed height: with a two-line column it is tall enough for both lines and the padding.
188
+ const stacked = columns.some((column) => column.description);
189
+ const rowHeight = density === "compact" ? (stacked ? 52 : 36) : stacked ? 60 : 48;
190
+ return (_jsx("div", { "data-slot": "table", "data-density": density, "data-scrolled": scrolled || undefined, "data-virtual": virtual ? "" : undefined, onScroll: maxHeight && !virtual ? (event) => setScrolled(event.currentTarget.scrollTop > 0) : undefined, style: maxHeight && !virtual ? { maxHeight } : undefined, className: cn(virtual ? "overflow-hidden" : "overflow-auto", "rounded-ds-large bg-ds-surface-raised shadow-ds-raised", maxHeight && "overscroll-contain"), children: virtual ? (_jsx(Virtualizer, { layout: TableLayout, layoutOptions: { rowHeight, headingHeight: density === "compact" ? 36 : 40 }, children: table })) : (table) }));
181
191
  }
182
192
  /** The 2px `ds-border-selected` marker on the row's leading edge, shown while the row is selected. */
183
193
  function SelectedMarker() {