@crisp-ui-kit/crisp 0.49.0 → 0.51.0

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 (104) hide show
  1. package/dist/cjs/components/composewindow/composewindow.js +144 -0
  2. package/dist/cjs/components/composewindow/composewindow.recipe.js +45 -0
  3. package/dist/cjs/components/composewindow/index.js +8 -0
  4. package/dist/cjs/components/datatable/datatable.js +224 -43
  5. package/dist/cjs/components/datatable/datatable.recipe.js +38 -4
  6. package/dist/cjs/components/datatable/index.js +6 -0
  7. package/dist/cjs/components/datepickerfield/datepickerfield.js +25 -15
  8. package/dist/cjs/components/datepickerfield/datepickerfield.recipe.js +25 -8
  9. package/dist/cjs/components/dialog/dialog.recipe.js +9 -1
  10. package/dist/cjs/components/menu/menu.js +4 -2
  11. package/dist/cjs/components/multiselect/multiselect.recipe.js +14 -8
  12. package/dist/cjs/components/select/select.js +2 -1
  13. package/dist/cjs/components/table/table.recipe.js +12 -3
  14. package/dist/cjs/components/tabletoolbar/tabletoolbar.chrome.js +2 -1
  15. package/dist/cjs/components/tabletoolbar/tabletoolbar.js +39 -8
  16. package/dist/cjs/core/cell-date.js +11 -0
  17. package/dist/cjs/core/index.js +2 -1
  18. package/dist/cjs/index.js +1 -0
  19. package/dist/cjs/product/recordpage/recordpage.js +88 -10
  20. package/dist/cjs/product/recordpage/recordpage.recipe.js +30 -0
  21. package/dist/cjs/product/recordpanel/recordpanel.js +54 -4
  22. package/dist/cjs/product/recordpanel/recordpanel.recipe.js +29 -0
  23. package/dist/cjs/product/recordstable/editable-field.js +110 -0
  24. package/dist/cjs/product/recordstable/index.js +4 -1
  25. package/dist/cjs/product/recordstable/recordstable.js +67 -11
  26. package/dist/cjs/product/recordstable/recordstable.recipe.js +9 -1
  27. package/dist/cjs/product/settingsshell/settingsshell.recipe.js +13 -4
  28. package/dist/cjs/product/sidebar/sidebar.js +15 -3
  29. package/dist/cjs/product/sidebar/sidebar.recipe.js +21 -2
  30. package/dist/composewindow.css +24 -0
  31. package/dist/composewindow.d.ts +7 -0
  32. package/dist/composewindow.layered.css +26 -0
  33. package/dist/datatable.css +34 -15
  34. package/dist/datatable.layered.css +34 -15
  35. package/dist/datepickerfield.css +9 -4
  36. package/dist/datepickerfield.layered.css +9 -4
  37. package/dist/dialog.css +2 -1
  38. package/dist/dialog.layered.css +2 -1
  39. package/dist/esm/components/composewindow/composewindow.js +107 -0
  40. package/dist/esm/components/composewindow/composewindow.recipe.js +42 -0
  41. package/dist/esm/components/composewindow/index.js +2 -0
  42. package/dist/esm/components/datatable/datatable.js +226 -45
  43. package/dist/esm/components/datatable/datatable.recipe.js +38 -4
  44. package/dist/esm/components/datatable/index.js +6 -0
  45. package/dist/esm/components/datepickerfield/datepickerfield.js +26 -16
  46. package/dist/esm/components/datepickerfield/datepickerfield.recipe.js +25 -8
  47. package/dist/esm/components/dialog/dialog.recipe.js +9 -1
  48. package/dist/esm/components/menu/menu.js +4 -2
  49. package/dist/esm/components/multiselect/multiselect.recipe.js +14 -8
  50. package/dist/esm/components/select/select.js +2 -1
  51. package/dist/esm/components/table/table.recipe.js +12 -3
  52. package/dist/esm/components/tabletoolbar/tabletoolbar.chrome.js +2 -1
  53. package/dist/esm/components/tabletoolbar/tabletoolbar.js +38 -8
  54. package/dist/esm/core/cell-date.js +10 -0
  55. package/dist/esm/core/index.js +1 -1
  56. package/dist/esm/index.js +1 -0
  57. package/dist/esm/product/recordpage/recordpage.js +89 -11
  58. package/dist/esm/product/recordpage/recordpage.recipe.js +30 -0
  59. package/dist/esm/product/recordpanel/recordpanel.js +55 -5
  60. package/dist/esm/product/recordpanel/recordpanel.recipe.js +29 -0
  61. package/dist/esm/product/recordstable/editable-field.js +73 -0
  62. package/dist/esm/product/recordstable/index.js +1 -0
  63. package/dist/esm/product/recordstable/recordstable.js +69 -13
  64. package/dist/esm/product/recordstable/recordstable.recipe.js +9 -1
  65. package/dist/esm/product/settingsshell/settingsshell.recipe.js +13 -4
  66. package/dist/esm/product/sidebar/sidebar.js +15 -3
  67. package/dist/esm/product/sidebar/sidebar.recipe.js +21 -2
  68. package/dist/multiselect.css +8 -8
  69. package/dist/multiselect.layered.css +8 -8
  70. package/dist/recordpage.css +25 -13
  71. package/dist/recordpage.layered.css +25 -13
  72. package/dist/recordpanel.css +22 -5
  73. package/dist/recordpanel.layered.css +22 -5
  74. package/dist/recordstable.css +10 -2
  75. package/dist/recordstable.layered.css +10 -2
  76. package/dist/settingsshell.css +2 -2
  77. package/dist/settingsshell.layered.css +2 -2
  78. package/dist/sidebar.css +7 -2
  79. package/dist/sidebar.layered.css +7 -2
  80. package/dist/styles.css +150 -55
  81. package/dist/styles.layered.css +150 -55
  82. package/dist/table.css +4 -2
  83. package/dist/table.layered.css +4 -2
  84. package/dist/tabletoolbar.css +2 -1
  85. package/dist/tabletoolbar.layered.css +2 -1
  86. package/dist/types/components/composewindow/composewindow.d.ts +80 -0
  87. package/dist/types/components/composewindow/composewindow.recipe.d.ts +3 -0
  88. package/dist/types/components/composewindow/index.d.ts +2 -0
  89. package/dist/types/components/datatable/datatable.d.ts +58 -4
  90. package/dist/types/components/datatable/index.d.ts +1 -1
  91. package/dist/types/components/datepickerfield/datepickerfield.d.ts +18 -4
  92. package/dist/types/components/menu/menu.d.ts +10 -1
  93. package/dist/types/components/select/select.d.ts +6 -1
  94. package/dist/types/components/tabletoolbar/tabletoolbar.d.ts +62 -5
  95. package/dist/types/core/cell-date.d.ts +17 -0
  96. package/dist/types/core/index.d.ts +1 -1
  97. package/dist/types/index.d.ts +1 -0
  98. package/dist/types/product/recordpage/recordpage.d.ts +59 -1
  99. package/dist/types/product/recordpanel/recordpanel.d.ts +11 -1
  100. package/dist/types/product/recordstable/editable-field.d.ts +45 -0
  101. package/dist/types/product/recordstable/index.d.ts +1 -0
  102. package/dist/types/product/recordstable/recordstable.d.ts +29 -0
  103. package/dist/types/product/sidebar/sidebar.d.ts +60 -4
  104. package/package.json +6 -1
@@ -7,7 +7,7 @@ import { contract as c, elevation as e } from "../../tokens/index.js";
7
7
  const config = defineRecipe({
8
8
  name: "datatable",
9
9
  base: `display: flex; flex-direction: column; gap: ${c.space["2.5"]}; font-family: ${c.font.sans};
10
- & .crisp-datatable-toolbar { display: flex; align-items: center; gap: ${c.space["2"]}; }
10
+ & .crisp-datatable-toolbar { display: flex; align-items: center; gap: ${c.space["2"]}; min-height: 49px; border-top: 1px solid ${c.borderSubtle}; }
11
11
  & .crisp-datatable-search { position: relative; flex: 1; max-width: 280px; display: inline-flex; align-items: center; }
12
12
  & .crisp-datatable-search svg { position: absolute; inset-inline-start: ${c.space["2"]}; color: ${c.fgMuted}; pointer-events: none; }
13
13
  & .crisp-datatable-search input { width: 100%; height: 32px; padding: 0 ${c.space["2"]} 0 ${c.space["6"]}; border: none; border-radius: ${c.radius.md}; background: ${c.bgSurface}; box-shadow: ${e.field}; font-family: inherit; font-size: ${c.text.lg}; color: ${c.fgPrimary}; outline: none; transition: box-shadow .15s; }
@@ -48,10 +48,16 @@ const config = defineRecipe({
48
48
  & .crisp-datatable-th-rename:focus { box-shadow: inset 0 0 0 1px ${c.bgBrandSolid}; }
49
49
  & .crisp-datatable-th-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
50
50
  & .crisp-datatable-sort { display: flex; align-items: center; gap: ${c.space["1.5"]}; width: 100%; min-width: 0; height: 100%; margin: 0; padding: 0 ${c.space["2"]}; border: none; background: none; font: inherit; letter-spacing: inherit; color: inherit; text-align: start; cursor: pointer; }
51
- & th[data-align="right"] .crisp-datatable-sort { justify-content: flex-end; padding-inline-end: 0; }
52
- & th[data-align="right"] .crisp-datatable-th-inner { justify-content: flex-end; }
51
+ /* A right-aligned column's header keeps its field-icon + label packed at
52
+ the START, matching its own values only in that the VALUES right-align
53
+ -- Attio's own right-aligned header (measured live: "Twitter follower
54
+ count") keeps the icon+label left and only the trailing column-menu
55
+ icon sits pinned to the right edge, independent of the label's width
56
+ (#406, reversing #393's own justify-content: flex-end here). The
57
+ chevron's own margin-inline-start: auto below already pins IT to the
58
+ end of a flex-start row with no override needed -- that's what pins
59
+ the trailing icon on Attio too. */
53
60
  & .crisp-datatable-chevron { margin-inline-start: auto; flex-shrink: 0; color: ${c.fgMuted}; opacity: 0; transition: opacity .12s; }
54
- & th[data-align="right"] .crisp-datatable-chevron { margin-inline-start: 0; order: -1; }
55
61
  & .crisp-datatable-sort:hover .crisp-datatable-chevron { opacity: 0.6; }
56
62
  & .crisp-datatable-sort[data-sorted] .crisp-datatable-chevron { opacity: 1; color: ${c.fgPrimary}; }
57
63
  /* sticky first column(s) + horizontal scroll shadow — RecordsTable's feel */
@@ -74,6 +80,34 @@ const config = defineRecipe({
74
80
  & .crisp-datatable-editable:hover { background: color-mix(in srgb, ${c.fgPrimary} 4%, ${c.bgSurface}); cursor: text; }
75
81
  & .crisp-datatable-edit { width: 100%; height: 28px; margin: 0; padding: 0 ${c.space["1.5"]}; border: none; border-radius: ${c.radius.sm}; background: ${c.bgSurface}; box-shadow: inset 0 0 0 1px ${c.bgBrandSolid}; font-family: inherit; font-size: ${c.text.lg}; color: ${c.fgPrimary}; outline: none; vertical-align: middle; }
76
82
  & .crisp-datatable-edit:focus { box-shadow: inset 0 0 0 1px ${c.bgBrandSolid}; }
83
+ /* An async onEdit's in-flight state (#385) -- the field/picker dims and
84
+ stops accepting input rather than disappearing, so the just-typed or
85
+ just-chosen value stays visible while its commit is pending. Same
86
+ treatment Input already gives its own disabled state. */
87
+ & .crisp-datatable-edit:disabled { opacity: 0.5; cursor: not-allowed; }
88
+ & .crisp-datatable-edit-pending { flex-shrink: 0; margin-inline-start: ${c.space["1"]}; color: ${c.fgMuted}; vertical-align: middle; }
89
+ /* The rejection's message, beside the cell's own content -- a sibling in
90
+ the TableCell, never nested inside a column's own render output, so a
91
+ hover-only wrapper (a Tooltip, say) around a custom render can't hide
92
+ it. Block-level: the row grows to fit it rather than floating over
93
+ the row below, so it can never end up clipped by the scroll
94
+ container's overflow the way a position:fixed escape would need
95
+ guarding against. */
96
+ & .crisp-datatable-edit-error { display: block; padding: ${c.space["0.5"]} 0 0; font-size: ${c.text.sm}; color: ${c.bgDanger}; }
97
+ /* editor: "select"/"switch" -- always live, no separate edit mode, so
98
+ the cell IS the picker: same chromeless-fill treatment as
99
+ RecordsTable's own --picker cells (measured there already; DataTable
100
+ shares RecordsTable's grid, Golden Rule 0). */
101
+ & .crisp-datatable-td--picker { padding: 0; }
102
+ & .crisp-datatable-edit-picker { display: flex; align-items: center; gap: ${c.space["1"]}; height: ${c.size.tableRow}; padding: 0 ${c.space["2"]}; }
103
+ & .crisp-datatable-edit-picker .crisp-select-trigger { flex: 1; min-width: 0; height: 100%; min-height: 0; border-radius: 0; box-shadow: none; padding: 0; }
104
+ & .crisp-datatable-td--picker .crisp-datatable-edit-error { padding-inline-start: ${c.space["2"]}; }
105
+ /* reference picker: a leading 16px avatar per option, plus a trailing
106
+ "Create X" row when the consumer supplies one (#449) -- same measured
107
+ values as RecordsTable's own .crisp-recordstable-refoption*. */
108
+ & .crisp-datatable-refoption { display: flex; align-items: center; gap: ${c.space["2"]}; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
109
+ & .crisp-datatable-refoption-avatar { flex-shrink: 0; }
110
+ & .crisp-datatable-refoption--create { color: ${c.fgMuted}; }
77
111
  & .crisp-datatable-empty { padding: ${c.space["8"]} ${c.space["3"]}; text-align: center; color: ${c.fgMuted}; font-size: ${c.text.lg}; }
78
112
  /* fixed layout so column widths (and resize) are exact — like RecordsTable */
79
113
  & table { table-layout: fixed; }
@@ -1,2 +1,8 @@
1
1
  export { DataTable, } from "./datatable.js";
2
+ // `EntityValue` (identical shape, `{ name: string; avatar?: string }`) is
3
+ // deliberately NOT re-exported here: `product/recordstable`'s own barrel
4
+ // already exports a type of that name at the package root, and re-exporting
5
+ // this module's copy too makes `EntityValue` an ambiguous export (TS2308) --
6
+ // verified by trying it. A DataTable consumer needing the type imports it
7
+ // from there; it's the same shape either table would want.
2
8
  export { datatableRecipe } from "./datatable.recipe.js";
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { CalendarDays } from "lucide-react";
2
+ import { CalendarDays, X } from "lucide-react";
3
3
  import * as React from "react";
4
4
  import { DatePicker, } from "../datepicker/index.js";
5
5
  import { Popover } from "../popover/index.js";
@@ -21,7 +21,7 @@ const fromDate = (d) => ({
21
21
  * popover. This is what `DatePicker` used to be; `DatePicker` is now
22
22
  * seed-design's bare calendar, and this composes it.
23
23
  */
24
- export function DatePickerField({ value, defaultValue, onValueChange, onChange, placeholder = "Set date…", variant = "default", format = defaultFormat, presets, calendarProps, "aria-label": ariaLabel, className, ...rest }) {
24
+ export function DatePickerField({ value, defaultValue, onValueChange, onChange, placeholder = "Set date…", variant = "default", format = defaultFormat, clearable = true, clearLabel = "Clear date", presets, calendarProps, "aria-label": ariaLabel, className, ...rest }) {
25
25
  const [internal, setInternal] = React.useState(defaultValue ?? null);
26
26
  const selected = value ?? internal;
27
27
  const [open, setOpen] = React.useState(false);
@@ -33,19 +33,29 @@ export function DatePickerField({ value, defaultValue, onValueChange, onChange,
33
33
  onChange?.(d);
34
34
  setOpen(false);
35
35
  };
36
- return (_jsx("div", { className: datepickerfieldRecipe({ className }), ...rest, children: _jsx(Popover, { open: open, onOpenChange: setOpen, "aria-label": ariaLabel, trigger: _jsxs("button", { type: "button", className: "crisp-datepickerfield-trigger", "data-ghost": variant === "ghost" ? "" : undefined, "data-placeholder": selected ? undefined : "", "aria-label": ariaLabel, children: [_jsx(CalendarDays, { size: 15, strokeWidth: 1.75, "aria-hidden": "true" }), selected ? format(selected) : placeholder] }), children: _jsxs("div", { className: "crisp-datepickerfield-panel", children: [_jsx(DatePicker
37
- // DatePickerProps is a union over selectionMode, and TypeScript
38
- // cannot narrow it through a spread: it tries every branch and
39
- // reports the range one as missing props. The field is always
40
- // single-select, so the shape is pinned here rather than inferred.
41
- , { ...{
42
- ...calendarProps,
43
- selectionMode: "single",
44
- value: selected ? fromDate(selected) : undefined,
45
- onValueChange: (next) => {
46
- if (next)
47
- pick(toDate(next));
48
- },
49
- } }), presets && presets.length > 0 && (_jsx("div", { className: "crisp-datepickerfield-presets", children: presets.map((p, i) => (_jsx("button", { type: "button", className: "crisp-datepickerfield-preset", onClick: () => pick(p.date()), children: p.label }, typeof p.label === "string" ? p.label : i))) }))] }) }) }));
36
+ const clear = () => {
37
+ if (value === undefined)
38
+ setInternal(null);
39
+ onValueChange?.(null);
40
+ onChange?.(null);
41
+ };
42
+ return (_jsx("div", { className: datepickerfieldRecipe({ className }), ...rest, children: _jsxs("div", { className: "crisp-datepickerfield-box", "data-ghost": variant === "ghost" ? "" : undefined, "data-placeholder": selected ? undefined : "", children: [_jsx(Popover, { open: open, onOpenChange: setOpen, "aria-label": ariaLabel, trigger: _jsxs("button", { type: "button", className: "crisp-datepickerfield-trigger", "aria-label": ariaLabel, children: [_jsx(CalendarDays, { size: 15, strokeWidth: 1.75, "aria-hidden": "true" }), selected ? format(selected) : placeholder] }), children: _jsxs("div", { className: "crisp-datepickerfield-panel", children: [_jsx(DatePicker
43
+ // DatePickerProps is a union over selectionMode, and TypeScript
44
+ // cannot narrow it through a spread: it tries every branch and
45
+ // reports the range one as missing props. The field is always
46
+ // single-select, so the shape is pinned here rather than inferred.
47
+ , { ...{
48
+ ...calendarProps,
49
+ selectionMode: "single",
50
+ value: selected ? fromDate(selected) : undefined,
51
+ onValueChange: (next) => {
52
+ if (next)
53
+ pick(toDate(next));
54
+ },
55
+ } }), presets && presets.length > 0 && (_jsx("div", { className: "crisp-datepickerfield-presets", children: presets.map((p, i) => (_jsx("button", { type: "button", className: "crisp-datepickerfield-preset", onClick: () => pick(p.date()), children: p.label }, typeof p.label === "string" ? p.label : i))) }))] }) }), clearable && selected && (_jsx("button", { type: "button", className: "crisp-datepickerfield-clear", "aria-label": clearLabel, onClick: (e) => {
56
+ // not the trigger button's own click -- Popover would open
57
+ e.stopPropagation();
58
+ clear();
59
+ }, children: _jsx(X, { size: 13, strokeWidth: 1.75, "aria-hidden": "true" }) }))] }) }));
50
60
  }
51
61
  DatePickerField.displayName = "DatePickerField";
@@ -9,18 +9,35 @@ const config = defineRecipe({
9
9
  base: `
10
10
  display: inline-flex; font-family: ${c.font.sans};
11
11
 
12
- & .crisp-datepickerfield-trigger {
13
- display: inline-flex; align-items: center; gap: ${c.space["2"]};
14
- box-sizing: border-box; height: 32px; padding: 0 ${c.space["2.5"]}; margin: 0;
15
- border: none; border-radius: ${c.radius.md}; background: transparent;
12
+ & .crisp-datepickerfield-box {
13
+ display: inline-flex; align-items: center;
14
+ box-sizing: border-box; height: 32px; margin: 0;
15
+ border-radius: ${c.radius.md}; background: transparent;
16
16
  box-shadow: inset 0 0 0 1px color-mix(in srgb, ${c.fgPrimary} 7%, transparent);
17
17
  color: ${c.fgPrimary}; font-family: inherit; font-size: ${c.text.lg};
18
- white-space: nowrap; cursor: pointer;
19
18
  }
20
- & .crisp-datepickerfield-trigger[data-ghost] { background: transparent; box-shadow: none; }
21
- & .crisp-datepickerfield-trigger[data-ghost]:hover { background: color-mix(in srgb, ${c.fgPrimary} 4%, transparent); }
22
- & .crisp-datepickerfield-trigger[data-placeholder] { color: ${c.fgMuted}; }
19
+ & .crisp-datepickerfield-box[data-ghost] { background: transparent; box-shadow: none; }
20
+ & .crisp-datepickerfield-box[data-ghost]:hover { background: color-mix(in srgb, ${c.fgPrimary} 4%, transparent); }
21
+ & .crisp-datepickerfield-trigger {
22
+ display: inline-flex; align-items: center; gap: ${c.space["2"]};
23
+ height: 100%; padding: 0 ${c.space["2.5"]}; margin: 0;
24
+ border: none; background: none; color: inherit; font-family: inherit;
25
+ font-size: inherit; white-space: nowrap; cursor: pointer;
26
+ }
27
+ & .crisp-datepickerfield-box[data-placeholder] .crisp-datepickerfield-trigger { color: ${c.fgMuted}; }
23
28
  & .crisp-datepickerfield-trigger svg { flex-shrink: 0; color: ${c.fgMuted}; }
29
+ /* Reuses TableToolbar's measured filter-chip remove button
30
+ (tabletoolbar.chrome.ts's .crisp-tabletoolbar-fchip-x) -- the same
31
+ small inline "clear this value" affordance, not a freshly-measured
32
+ one: no live Attio composition for a DatePickerField-equivalent
33
+ clear was reachable this round (#394). */
34
+ & .crisp-datepickerfield-clear {
35
+ display: inline-flex; align-items: center; justify-content: center;
36
+ width: 20px; height: 20px; margin-inline-end: ${c.space["1"]}; padding: 0;
37
+ border: none; border-radius: ${c.radius.sm}; background: none;
38
+ color: ${c.fgMuted}; font-family: inherit; cursor: pointer;
39
+ }
40
+ & .crisp-datepickerfield-clear:hover { background: color-mix(in srgb, ${c.fgPrimary} 10%, transparent); color: ${c.fgPrimary}; }
24
41
 
25
42
  & .crisp-datepickerfield-panel { padding: ${c.space["2"]}; width: 300px; }
26
43
  & .crisp-datepickerfield-presets { display: flex; flex-wrap: wrap; gap: ${c.space["1"]}; margin-top: ${c.space["2"]}; }
@@ -5,6 +5,13 @@ import { contract as c, elevation as e } from "../../tokens/index.js";
5
5
  // per theme — light uses a blue-tinted 3-layer shadow, dark drops to a plain
6
6
  // 2-layer black shadow) with a bordered header (title + close), a scrollable
7
7
  // body, and a bordered footer for the primary action.
8
+ //
9
+ // #414: the footer's submit-key caps (⌘/Enter) used to be one span drawing a
10
+ // visible pill (18px, 22%-white background). Attio's own are two separate
11
+ // TRANSPARENT 16x16 glyphs, 4px apart. Their 3px/10px/4px measured values sit
12
+ // between crisp's token steps (space has no 3px, radius starts at 6px, text
13
+ // starts at 11px) — raw px per Golden Rule 3's "genuinely intrinsic size"
14
+ // exception, same as a chip's odd 7px corner.
8
15
  const config = defineRecipe({
9
16
  name: "dialog",
10
17
  base: `display: contents; font-family: ${c.font.sans};
@@ -23,7 +30,8 @@ const config = defineRecipe({
23
30
  & .crisp-dialog-field-label { font-size: ${c.text.sm}; font-weight: ${c.weight.medium}; color: color-mix(in srgb, ${c.fgPrimary} 50%, transparent); }
24
31
  & .crisp-dialog-more { display: inline-flex; align-items: center; gap: ${c.space["2"]}; margin-inline-end: auto; border: none; background: none; padding: 0; font-family: inherit; font-size: ${c.text.md}; color: ${c.fgMuted}; cursor: pointer; }
25
32
  & .crisp-dialog-submit { display: inline-flex; align-items: center; gap: ${c.space["2"]}; height: 28px; padding: 0 ${c.space["1"]} 0 ${c.space["2.5"]}; border: none; border-radius: ${c.radius.md}; background: ${c.bgBrandSolid}; color: ${c.fgOnBrand}; font-family: inherit; font-size: ${c.text.md}; font-weight: ${c.weight.medium}; cursor: pointer; }
26
- & .crisp-dialog-submit-key { display: inline-flex; align-items: center; justify-content: center; height: 18px; padding: 0 ${c.space["1"]}; border-radius: ${c.radius.sm}; background: rgba(255,255,255,0.22); font-size: ${c.text.xs}; }`,
33
+ & .crisp-dialog-submit-key { display: inline-flex; align-items: center; gap: ${c.space["1"]}; }
34
+ & .crisp-dialog-submit-key kbd { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; padding: 0 3px; border-radius: 4px; background: transparent; color: ${c.fgOnBrand}; font-family: inherit; font-style: normal; font-size: 10px; }`,
27
35
  variants: {},
28
36
  defaultVariants: {},
29
37
  compoundVariants: [],
@@ -12,7 +12,7 @@ const MenuContext = React.createContext(null);
12
12
  * typeahead, Enter/Space select, Esc closes and returns focus to the trigger);
13
13
  * closes on outside click. Flips up / right-aligns when space is tight.
14
14
  */
15
- export function Menu({ trigger, children, align = "start", open: openProp, defaultOpen, onOpenChange, className, "aria-label": ariaLabel, }) {
15
+ export function Menu({ trigger, children, align = "start", open: openProp, defaultOpen, onOpenChange, className, contentClassName, "aria-label": ariaLabel, }) {
16
16
  // The surface and the button that opens it were two unconnected nodes: the
17
17
  // menu/dialog had no id, so nothing could point at it, and no accessible
18
18
  // name, so a screen reader announced a bare "menu"/"dialog". Labelling the
@@ -123,7 +123,9 @@ export function Menu({ trigger, children, align = "start", open: openProp, defau
123
123
  setOpen(!open);
124
124
  },
125
125
  });
126
- return (_jsxs("div", { ref: rootRef, className: menuRecipe({ className }), children: [triggerEl, open && (_jsx(FloatingPortal, { sourceRef: rootRef, children: _jsx("div", { ref: contentRef, className: "crisp-menu-content", role: "menu", id: surfaceId, "aria-label": ariaLabel, "aria-labelledby": ariaLabel ? undefined : triggerId, "data-align": align, "data-up": up ? "" : undefined, style: pos, onKeyDown: onContentKeyDown, children: _jsx(MenuContext.Provider, { value: { close }, children: children }) }) }))] }));
126
+ return (_jsxs("div", { ref: rootRef, className: menuRecipe({ className }), children: [triggerEl, open && (_jsx(FloatingPortal, { sourceRef: rootRef, children: _jsx("div", { ref: contentRef, className: contentClassName
127
+ ? `crisp-menu-content ${contentClassName}`
128
+ : "crisp-menu-content", role: "menu", id: surfaceId, "aria-label": ariaLabel, "aria-labelledby": ariaLabel ? undefined : triggerId, "data-align": align, "data-up": up ? "" : undefined, style: pos, onKeyDown: onContentKeyDown, children: _jsx(MenuContext.Provider, { value: { close }, children: children }) }) }))] }));
127
129
  }
128
130
  Menu.displayName = "Menu";
129
131
  export function MenuItem({ children, icon, shortcut, danger, disabled, onSelect, closeOnSelect = true, }) {
@@ -19,6 +19,12 @@ import { contract as c, elevation as e } from "../../tokens/index.js";
19
19
  // intact WITHIN the portaled subtree, only the link back to the
20
20
  // trigger-holding root broke). A flat recordstable-tag selector also works
21
21
  // unchanged wherever it's rendered, portaled or not, so it needs no split.
22
+ // This is a third, hand-pasted copy of `recordTagCss`
23
+ // (product/recordstable/recordstable.tag.ts) rather than a splice of it:
24
+ // that helper is written `& .crisp-recordstable-tag { ... }` for nesting
25
+ // under a recipe's `base`, which doesn't compile to anything inside a flat
26
+ // `globalCss` block. Keep the two in sync by hand (#380 added the measured
27
+ // `box-shadow: inset 0 0 0 1px <tone ring colour>` here to match).
22
28
  const config = defineRecipe({
23
29
  name: "multiselect",
24
30
  base: `
@@ -74,14 +80,14 @@ const config = defineRecipe({
74
80
  .crisp-multiselect-option[aria-selected="true"] .crisp-multiselect-check { background: ${c.bgBrandSolid}; box-shadow: none; color: #fff; }
75
81
  .crisp-multiselect-empty { padding: ${c.space["3"]} ${c.space["2"]}; text-align: center; font-size: ${c.text.md}; color: ${c.fgMuted}; }
76
82
 
77
- .crisp-recordstable-tag { display: inline-flex; align-items: center; height: ${c.size.chip}; padding: 0 ${c.space["1"]}; border-radius: ${c.radius.chip}; font-size: ${c.text.lg}; line-height: 20px; font-weight: ${c.weight.medium}; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: color-mix(in srgb, ${c.fgPrimary} 6%, transparent); color: color-mix(in srgb, ${c.fgPrimary} 82%, transparent); }
78
- .crisp-recordstable-tag[data-tone="brand"] { background: color-mix(in srgb, ${c.bgBrandSolid} 14%, transparent); color: color-mix(in srgb, ${c.bgBrandSolid} 82%, ${c.fgPrimary}); }
79
- .crisp-recordstable-tag[data-tone="success"] { background: color-mix(in srgb, ${c.bgSuccess} 16%, transparent); color: color-mix(in srgb, ${c.bgSuccess} 78%, ${c.fgPrimary}); }
80
- .crisp-recordstable-tag[data-tone="warning"] { background: color-mix(in srgb, ${c.bgWarning} 18%, transparent); color: color-mix(in srgb, ${c.bgWarning} 82%, ${c.fgPrimary}); }
81
- .crisp-recordstable-tag[data-tone="danger"] { background: color-mix(in srgb, ${c.bgDanger} 15%, transparent); color: color-mix(in srgb, ${c.bgDanger} 80%, ${c.fgPrimary}); }
82
- .crisp-recordstable-tag[data-tone="purple"] { background: color-mix(in srgb, ${c.bgPurple} 16%, transparent); color: color-mix(in srgb, ${c.bgPurple} 80%, ${c.fgPrimary}); }
83
- .crisp-recordstable-tag[data-tone="cyan"] { background: color-mix(in srgb, ${c.bgCyan} 18%, transparent); color: color-mix(in srgb, ${c.bgCyan} 82%, ${c.fgPrimary}); }
84
- .crisp-recordstable-tag[data-tone="orange"] { background: color-mix(in srgb, ${c.bgOrange} 16%, transparent); color: color-mix(in srgb, ${c.bgOrange} 82%, ${c.fgPrimary}); }
83
+ .crisp-recordstable-tag { display: inline-flex; align-items: center; height: ${c.size.chip}; padding: 0 ${c.space["1"]}; border-radius: ${c.radius.chip}; font-size: ${c.text.lg}; line-height: 20px; font-weight: ${c.weight.medium}; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: color-mix(in srgb, ${c.fgPrimary} 6%, transparent); color: color-mix(in srgb, ${c.fgPrimary} 82%, transparent); box-shadow: inset 0 0 0 1px ${c.borderSubtle}; }
84
+ .crisp-recordstable-tag[data-tone="brand"] { background: color-mix(in srgb, ${c.bgBrandSolid} 14%, transparent); color: color-mix(in srgb, ${c.bgBrandSolid} 82%, ${c.fgPrimary}); box-shadow: inset 0 0 0 1px color-mix(in srgb, ${c.bgBrandSolid} 30%, transparent); }
85
+ .crisp-recordstable-tag[data-tone="success"] { background: color-mix(in srgb, ${c.bgSuccess} 16%, transparent); color: color-mix(in srgb, ${c.bgSuccess} 78%, ${c.fgPrimary}); box-shadow: inset 0 0 0 1px color-mix(in srgb, ${c.bgSuccess} 30%, transparent); }
86
+ .crisp-recordstable-tag[data-tone="warning"] { background: color-mix(in srgb, ${c.bgWarning} 18%, transparent); color: color-mix(in srgb, ${c.bgWarning} 82%, ${c.fgPrimary}); box-shadow: inset 0 0 0 1px color-mix(in srgb, ${c.bgWarning} 30%, transparent); }
87
+ .crisp-recordstable-tag[data-tone="danger"] { background: color-mix(in srgb, ${c.bgDanger} 15%, transparent); color: color-mix(in srgb, ${c.bgDanger} 80%, ${c.fgPrimary}); box-shadow: inset 0 0 0 1px color-mix(in srgb, ${c.bgDanger} 30%, transparent); }
88
+ .crisp-recordstable-tag[data-tone="purple"] { background: color-mix(in srgb, ${c.bgPurple} 16%, transparent); color: color-mix(in srgb, ${c.bgPurple} 80%, ${c.fgPrimary}); box-shadow: inset 0 0 0 1px color-mix(in srgb, ${c.bgPurple} 30%, transparent); }
89
+ .crisp-recordstable-tag[data-tone="cyan"] { background: color-mix(in srgb, ${c.bgCyan} 18%, transparent); color: color-mix(in srgb, ${c.bgCyan} 82%, ${c.fgPrimary}); box-shadow: inset 0 0 0 1px color-mix(in srgb, ${c.bgCyan} 30%, transparent); }
90
+ .crisp-recordstable-tag[data-tone="orange"] { background: color-mix(in srgb, ${c.bgOrange} 16%, transparent); color: color-mix(in srgb, ${c.bgOrange} 82%, ${c.fgPrimary}); box-shadow: inset 0 0 0 1px color-mix(in srgb, ${c.bgOrange} 30%, transparent); }
85
91
  `,
86
92
  variants: {
87
93
  // Same ring Select's `invalid` draws — see that recipe's comment.
@@ -16,7 +16,7 @@ function optionText(o) {
16
16
  * "No results" empty state). Full keyboard model — ↑/↓ move, Enter/Space pick,
17
17
  * Esc close, Home/End jump, opens upward when tight. Controlled or uncontrolled.
18
18
  */
19
- export function Select({ options, value, defaultValue, onValueChange, name, required, placeholder = "Select…", variant = "default", width = "full", searchable, searchPlaceholder = "Search…", emptyLabel = "No results", disabled, invalid, className, "aria-label": ariaLabel, id, ...rest }) {
19
+ export function Select({ options, value, defaultValue, onValueChange, name, required, placeholder = "Select…", variant = "default", width = "full", searchable, searchPlaceholder = "Search…", onSearchChange, emptyLabel = "No results", disabled, invalid, className, "aria-label": ariaLabel, id, ...rest }) {
20
20
  // Virtual focus: DOM focus stays on the trigger (or the search field), and the
21
21
  // active option is named by `aria-activedescendant`. That is the only thing a
22
22
  // screen reader has to go on -- `data-highlighted` is invisible to it -- so the
@@ -165,6 +165,7 @@ export function Select({ options, value, defaultValue, onValueChange, name, requ
165
165
  onChange: () => { } })), _jsxs("button", { ref: triggerRef, type: "button", id: id, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": open, "aria-controls": open ? listboxId : undefined, "aria-activedescendant": searchable ? undefined : activeId, "aria-label": ariaLabel, "aria-invalid": invalid === true || undefined, disabled: disabled, "data-open": open ? "" : undefined, className: "crisp-select-trigger", onClick: () => (open ? setOpen(false) : openMenu()), onKeyDown: onTriggerKeyDown, children: [_jsx("span", { className: "crisp-select-value", children: selectedOption ? (_jsxs(_Fragment, { children: [selectedOption.color && (_jsx("span", { className: "crisp-select-option-dot", style: { background: selectedOption.color } })), selectedOption.label] })) : (_jsx("span", { className: "crisp-select-placeholder", children: placeholder })) }), _jsx(ChevronDown, { className: "crisp-select-chevron", size: 16, strokeWidth: 1.75 })] }), open && (_jsx(FloatingPortal, { sourceRef: rootRef, children: _jsxs("div", { ref: listboxRef, id: listboxId, className: "crisp-select-listbox", role: "listbox", "aria-label": ariaLabel, "data-up": up ? "" : undefined, style: pos, children: [searchable && (_jsxs("div", { className: "crisp-select-search", children: [_jsx(Search, { size: 15, strokeWidth: 1.75 }), _jsx("input", { ref: searchRef, type: "text", placeholder: searchPlaceholder, "aria-label": searchPlaceholder, "aria-controls": listboxId, "aria-activedescendant": activeId, value: query, onChange: (e) => {
166
166
  setQuery(e.target.value);
167
167
  setHighlight(0);
168
+ onSearchChange?.(e.target.value);
168
169
  }, onKeyDown: onNavKeys })] })), filtered.length === 0 ? (_jsx("div", { className: "crisp-select-empty", children: emptyLabel })) : (filtered.map((opt, i) => {
169
170
  const isSel = opt.value === selected;
170
171
  // #343: a header renders once per run of same-`group`
@@ -11,11 +11,11 @@ const config = defineRecipe({
11
11
  & .crisp-table-scroll { overflow-x: auto; }
12
12
  & table { width: 100%; border-collapse: separate; border-spacing: 0; font-family: ${c.font.sans}; font-size: ${c.text.lg}; color: ${c.fgPrimary}; }
13
13
  & th, & td { position: relative; height: ${c.size.tableRow}; padding: 0 ${c.space["2"]}; border-bottom: 1px solid ${c.borderSubtle}; border-inline-end: 1px solid ${c.borderSubtle}; text-align: start; vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
14
- & th { height: ${c.size.tableHeader}; background: ${c.bgSurface}; font-size: ${c.text.lg}; font-weight: ${c.weight.medium}; letter-spacing: -0.14px; color: color-mix(in srgb, ${c.fgPrimary} 63%, transparent); user-select: none; }
14
+ & th { height: ${c.size.tableHeader}; background: ${c.bgSurface}; border-top: 1px solid ${c.borderSubtle}; font-size: ${c.text.lg}; font-weight: ${c.weight.medium}; letter-spacing: -0.14px; color: color-mix(in srgb, ${c.fgPrimary} 63%, transparent); user-select: none; }
15
15
  & td { color: ${c.fgPrimary}; background: ${c.bgSurface}; }
16
16
  & th:last-child, & td:last-child { border-inline-end: none; }
17
17
  & tbody tr:last-child td { border-bottom: none; }
18
- & tfoot td { border-top: 1px solid ${c.borderSubtle}; border-bottom: none; font-weight: ${c.weight.medium}; color: ${c.fgMuted}; }
18
+ & tfoot td { border-top: 1px solid ${c.borderSubtle}; border-bottom: 1px solid ${c.borderSubtle}; font-weight: ${c.weight.medium}; color: ${c.fgMuted}; }
19
19
  & caption { padding: ${c.space["2"]} ${c.space["2"]}; text-align: start; font-size: ${c.text.sm}; color: ${c.fgMuted}; caption-side: bottom; }
20
20
  & td[data-align="right"], & th[data-align="right"] { text-align: end; }
21
21
  & td[data-align="center"], & th[data-align="center"] { text-align: center; }`,
@@ -28,8 +28,17 @@ const config = defineRecipe({
28
28
  // card (default): the bordered rounded surface, unchanged for existing
29
29
  // consumers. bleed: drops the outer border/radius/inset so the grid runs
30
30
  // edge-to-edge, like RecordsTable's real full-page records grid.
31
+ //
32
+ // #439: th/tfoot td now carry their own top/bottom border (below) so a
33
+ // bleed table's header and calc footer close the same way Attio's own
34
+ // do. card's own 4-side border already draws that top/bottom edge, so
35
+ // strip the cells' copies there -- same reasoning as `:last-child`
36
+ // dropping the inline-end border and `tbody tr:last-child` dropping the
37
+ // bottom one: the container's edge wins, cells never double it.
31
38
  surface: {
32
- card: `border: 1px solid ${c.borderSubtle}; border-radius: ${c.radius.xl}; overflow: hidden;`,
39
+ card: `border: 1px solid ${c.borderSubtle}; border-radius: ${c.radius.xl}; overflow: hidden;
40
+ & th { border-top: none; }
41
+ & tfoot td { border-bottom: none; }`,
33
42
  bleed: `border: none; border-radius: 0;`,
34
43
  },
35
44
  },
@@ -15,11 +15,12 @@ import { contract as c, elevation as e } from "../../tokens/index.js";
15
15
  // split preserves that cascade exactly, which is what lets the generated CSS
16
16
  // stay byte-for-byte identical to what shipped before the extraction.
17
17
  export const toolbarChromeHead = (p) => ` & .${CLASS_PREFIX}${p}-toolbar { display: flex; align-items: center; gap: ${c.space["1.5"]}; padding: 0 ${c.space["3"]} ${c.space["2"]}; }
18
+ & .${CLASS_PREFIX}${p}-toolbar[data-inline] { padding-bottom: 0; }
18
19
  & .${CLASS_PREFIX}${p}-search { display: flex; align-items: center; gap: ${c.space["1.5"]}; height: ${c.size.row}; padding: 0 ${c.space["2.5"]}; border: none; border-radius: ${c.radius.md}; background: ${c.bgSurface}; box-shadow: inset 0 0 0 1px ${c.borderSubtle}; color: ${c.fgMuted}; }
19
20
  & .${CLASS_PREFIX}${p}-search svg { flex-shrink: 0; }
20
21
  & .${CLASS_PREFIX}${p}-search input { border: none; outline: none; background: transparent; font-family: inherit; font-size: ${c.text.md}; color: ${c.fgPrimary}; width: 180px; }
21
22
  & .${CLASS_PREFIX}${p}-search input::placeholder { color: ${c.fgMuted}; }
22
- & .${CLASS_PREFIX}${p}-tool { display: inline-flex; align-items: center; gap: ${c.space["1"]}; height: ${c.size.row}; margin: 0; padding: 0 ${c.space["2"]}; border: none; border-radius: ${c.radius.md}; background: transparent; box-shadow: inset 0 0 0 1px ${c.borderDefault}; color: ${c.fgPrimary}; font-family: inherit; font-size: ${c.text.md}; font-weight: ${c.weight.medium}; cursor: pointer; transition: background-color .12s; }
23
+ & .${CLASS_PREFIX}${p}-tool { display: inline-flex; align-items: center; gap: ${c.space["1"]}; height: ${c.size.row}; margin: 0; padding: 0 ${c.space["2"]}; border: none; border-radius: ${c.radius.md}; background: transparent; box-shadow: inset 0 0 0 1px ${c.borderDefault}; color: ${c.fgPrimary}; font-family: inherit; font-size: ${c.text.md}; font-weight: ${c.weight.medium}; white-space: nowrap; cursor: pointer; transition: background-color .12s; }
23
24
  & .${CLASS_PREFIX}${p}-tool:hover { background: ${c.bgRaised}; }
24
25
  & .${CLASS_PREFIX}${p}-tool svg { flex-shrink: 0; color: ${c.fgMuted}; }
25
26
  & .${CLASS_PREFIX}${p}-tool--active { background: ${c.bgRaised}; }
@@ -110,8 +110,19 @@ export function applySorts(rows, sorts, get = (row, key) => row[key]) {
110
110
  * `RecordsTable` renders this same measured chrome internally; this is the
111
111
  * composable version, to put above `DataTable` or any table of your own. Pair
112
112
  * it with `applyFilters` / `applySorts` to turn its state into rows.
113
+ *
114
+ * Sort and Filter read the same `columns` list by default, but can be given
115
+ * their own (`sortColumns`/`filterColumns`) when a consumer's two menus
116
+ * genuinely offer different fields — Attio's own Tasks page does exactly
117
+ * this (Sort: Due date/Assignee/Creation date; Filter: Assignee/Record/
118
+ * Created by), which one shared list can't reproduce.
113
119
  */
114
- export function TableToolbar({ columns, sorts: sortsProp, defaultSorts, onSortsChange, filters: filtersProp, defaultFilters, onFiltersChange, count, children, helpHref, className, sortLabel = "Sort", reorderSortLabel = "Reorder sort", noSortsLabel = "No sorts applied to this view.", addSortLabel = "Add sort", learnSortingLabel = "Learn about sorting", selectConditionLabel = "Select condition", sortFieldLabel = "Sort field", sortDirectionLabel = "Sort direction", removeSortLabel = "Remove sort", filterFieldLabel = "Filter by field", filterFieldPlaceholder = "Filter by…", filterValuePlaceholder = "Value…", ascendingLabel = "Ascending", descendingLabel = "Descending", sortTriggerLabel, filterTriggerLabel, ...rest }) {
120
+ export function TableToolbar({ columns, sortColumns: sortColumnsProp, filterColumns: filterColumnsProp, sorts: sortsProp, defaultSorts, onSortsChange, filters: filtersProp, defaultFilters, onFiltersChange, count, children, helpHref, className, sortLabel = "Sort", reorderSortLabel = "Reorder sort", noSortsLabel = "No sorts applied to this view.", addSortLabel = "Add sort", learnSortingLabel = "Learn about sorting", selectConditionLabel = "Select condition", sortFieldLabel = "Sort field", sortDirectionLabel = "Sort direction", removeSortLabel = "Remove sort", filterFieldLabel = "Filter by field", filterFieldPlaceholder = "Filter by…", filterValuePlaceholder = "Value…", ascendingLabel = "Ascending", descendingLabel = "Descending", sortTriggerLabel, filterTriggerLabel, inline, ...rest }) {
121
+ // Each side falls back to the shared `columns` independently — a caller
122
+ // that only overrides one (Filter's own Record/Created by, say) still
123
+ // gets `columns` on the other, unchanged from before either prop existed.
124
+ const sortColumns = sortColumnsProp ?? columns ?? [];
125
+ const filterColumns = filterColumnsProp ?? columns ?? [];
115
126
  const [sortsState, setSortsState] = React.useState(defaultSorts ?? []);
116
127
  const [filtersState, setFiltersState] = React.useState(defaultFilters ?? []);
117
128
  const sorts = sortsProp ?? sortsState;
@@ -158,7 +169,7 @@ export function TableToolbar({ columns, sorts: sortsProp, defaultSorts, onSortsC
158
169
  }, [openMenu]);
159
170
  const addSort = () => {
160
171
  const used = new Set(sorts.map((s) => s.key));
161
- const col = columns.find((c) => !used.has(c.key));
172
+ const col = sortColumns.find((c) => !used.has(c.key));
162
173
  if (col)
163
174
  putSorts([...sorts, { key: col.key, dir: "asc" }]);
164
175
  };
@@ -197,18 +208,18 @@ export function TableToolbar({ columns, sorts: sortsProp, defaultSorts, onSortsC
197
208
  // The default phrase only works in English word order, so a caller can
198
209
  // replace the whole thing rather than fill a template.
199
210
  const sortedLabel = sortTriggerLabel
200
- ? sortTriggerLabel(sorts, columns)
211
+ ? sortTriggerLabel(sorts, sortColumns)
201
212
  : sorts.length
202
- ? `Sorted by ${columns.find((c) => c.key === sorts[0].key)?.label}${sorts.length > 1 ? ` +${sorts.length - 1}` : ""}`
213
+ ? `Sorted by ${sortColumns.find((c) => c.key === sorts[0].key)?.label}${sorts.length > 1 ? ` +${sorts.length - 1}` : ""}`
203
214
  : "Sort";
204
- return (_jsx("div", { className: tabletoolbarRecipe({ className }), ...rest, children: _jsxs("div", { className: "crisp-tabletoolbar-toolbar", children: [_jsxs("span", { className: "crisp-tabletoolbar-toolgroup", children: [_jsxs("button", { type: "button", className: `crisp-tabletoolbar-tool${sorts.length ? " crisp-tabletoolbar-tool--active" : ""}`, onClick: () => setOpenMenu(openMenu === "sort" ? null : "sort"), "aria-haspopup": "dialog", "aria-expanded": openMenu === "sort", "data-menu-trigger": true, children: [_jsx(ArrowUpDown, { size: 14, strokeWidth: 1.75, "aria-hidden": "true" }), sortedLabel] }), openMenu === "sort" && (_jsxs("div", { ref: sortListRef, className: "crisp-tabletoolbar-menu crisp-tabletoolbar-sortpop", role: "dialog", "aria-label": sortLabel, children: [sorts.length === 0 ? (_jsx("div", { className: "crisp-tabletoolbar-sort-empty", children: noSortsLabel })) : (sorts.map((s, i) => (_jsxs("div", { className: "crisp-tabletoolbar-sort-row", onDragOver: (e) => {
215
+ return (_jsx("div", { className: tabletoolbarRecipe({ className }), ...rest, children: _jsxs("div", { className: "crisp-tabletoolbar-toolbar", "data-inline": inline ? "" : undefined, children: [_jsxs("span", { className: "crisp-tabletoolbar-toolgroup", children: [_jsxs("button", { type: "button", className: `crisp-tabletoolbar-tool${sorts.length ? " crisp-tabletoolbar-tool--active" : ""}`, onClick: () => setOpenMenu(openMenu === "sort" ? null : "sort"), "aria-haspopup": "dialog", "aria-expanded": openMenu === "sort", "data-menu-trigger": true, children: [_jsx(ArrowUpDown, { size: 14, strokeWidth: 1.75, "aria-hidden": "true" }), sortedLabel] }), openMenu === "sort" && (_jsxs("div", { ref: sortListRef, className: "crisp-tabletoolbar-menu crisp-tabletoolbar-sortpop", role: "dialog", "aria-label": sortLabel, children: [sorts.length === 0 ? (_jsx("div", { className: "crisp-tabletoolbar-sort-empty", children: noSortsLabel })) : (sorts.map((s, i) => (_jsxs("div", { className: "crisp-tabletoolbar-sort-row", onDragOver: (e) => {
205
216
  if (dragSort !== null)
206
217
  e.preventDefault();
207
218
  }, onDrop: () => {
208
219
  if (dragSort !== null)
209
220
  moveSort(dragSort, i);
210
221
  setDragSort(null);
211
- }, children: [_jsx("button", { type: "button", className: "crisp-tabletoolbar-sort-grip", "aria-label": reorderSortLabel, draggable: true, onDragStart: () => setDragSort(i), onDragEnd: () => setDragSort(null), children: _jsx(GripVertical, { size: 15, strokeWidth: 1.75 }) }), _jsx(Select, { className: "crisp-tabletoolbar-sort-field", searchable: true, value: s.key, onValueChange: (k) => setSortField(i, k), options: columns.map((c) => ({
222
+ }, children: [_jsx("button", { type: "button", className: "crisp-tabletoolbar-sort-grip", "aria-label": reorderSortLabel, draggable: true, onDragStart: () => setDragSort(i), onDragEnd: () => setDragSort(null), children: _jsx(GripVertical, { size: 15, strokeWidth: 1.75 }) }), _jsx(Select, { className: "crisp-tabletoolbar-sort-field", searchable: true, value: s.key, onValueChange: (k) => setSortField(i, k), options: sortColumns.map((c) => ({
212
223
  value: c.key,
213
224
  label: c.icon ? (_jsxs("span", { className: "crisp-tabletoolbar-sort-optlabel", children: [_jsx(c.icon, { size: 15, strokeWidth: 1.75 }), c.label] })) : (c.label),
214
225
  keywords: c.label,
@@ -229,12 +240,12 @@ export function TableToolbar({ columns, sorts: sortsProp, defaultSorts, onSortsC
229
240
  ? `Filter · ${activeFilters}`
230
241
  : "Filter"] }), openMenu === "filter" && (_jsxs("div", { className: "crisp-tabletoolbar-menu", role: "dialog", "aria-label": filterFieldLabel, children: [_jsx("input", { className: "crisp-tabletoolbar-menu-input", placeholder: filterFieldPlaceholder, "aria-label": filterFieldLabel,
231
242
  // biome-ignore lint/a11y/noAutofocus: focus the picker on open
232
- autoFocus: true, value: filterQuery, onChange: (e) => setFilterQuery(e.target.value) }), columns
243
+ autoFocus: true, value: filterQuery, onChange: (e) => setFilterQuery(e.target.value) }), filterColumns
233
244
  .filter((col) => col.label
234
245
  .toLowerCase()
235
246
  .includes(filterQuery.trim().toLowerCase()))
236
247
  .map((col) => (_jsxs("button", { type: "button", className: "crisp-tabletoolbar-menu-item", onClick: () => addFilter(col.key), children: [col.icon ? (_jsx(col.icon, { size: 15, strokeWidth: 1.75 })) : (_jsx("span", { style: { width: 15 } })), col.label] }, col.key)))] }))] }), filters.map((cond) => {
237
- const col = columns.find((c) => c.key === cond.key);
248
+ const col = filterColumns.find((c) => c.key === cond.key);
238
249
  const open = openMenu === `fcond:${cond.id}`;
239
250
  const hasValue = (!opNeedsValue(cond.op) || cond.value.trim()) &&
240
251
  (!opNeedsValues(cond.op) || (cond.values?.length ?? 0) > 0);
@@ -263,3 +274,22 @@ export function TableToolbar({ columns, sorts: sortsProp, defaultSorts, onSortsC
263
274
  })] }))] }))] }, cond.id));
264
275
  }), _jsx("span", { className: "crisp-tabletoolbar-spacer" }), count != null && (_jsx("span", { className: "crisp-tabletoolbar-count", children: count })), children] }) }));
265
276
  }
277
+ /**
278
+ * The Sort/Filter chip's own chrome (`.crisp-tabletoolbar-tool`), standalone
279
+ * (#399) — for a control drawn like Sort/Filter that isn't Sort or Filter (a
280
+ * screen's own quick filter, e.g.). `.crisp-tabletoolbar-tool` alone renders
281
+ * unstyled: the rule lives nested under `TableToolbar`'s own root class, the
282
+ * same way every other rule in its shared chrome does, so it only paints on
283
+ * a descendant of an actual `TableToolbar`. This wraps one in, `display:
284
+ * contents` so it contributes no box of its own — the same technique
285
+ * `TableToolbar`'s own root already uses to disappear from layout.
286
+ */
287
+ export const ToolbarTool = React.forwardRef(({ active, ghost, className, ...rest }, ref) => (_jsx("span", { className: tabletoolbarRecipe(), children: _jsx("button", { ref: ref, type: "button", className: [
288
+ "crisp-tabletoolbar-tool",
289
+ active && "crisp-tabletoolbar-tool--active",
290
+ ghost && "crisp-tabletoolbar-tool--ghost",
291
+ className,
292
+ ]
293
+ .filter(Boolean)
294
+ .join(" "), ...rest }) })));
295
+ ToolbarTool.displayName = "ToolbarTool";
@@ -31,3 +31,13 @@ export function formatCellDate(d) {
31
31
  const pad = (n) => String(n).padStart(2, "0");
32
32
  return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
33
33
  }
34
+ export function cellDatePrecision(raw) {
35
+ const m = DATE_ONLY.exec(raw);
36
+ if (!m)
37
+ return "day";
38
+ if (!m[2])
39
+ return "year";
40
+ if (!m[3])
41
+ return "month";
42
+ return "day";
43
+ }
@@ -1,4 +1,4 @@
1
- export { formatCellDate, parseCellDate } from "./cell-date.js";
1
+ export { cellDatePrecision, formatCellDate, parseCellDate, } from "./cell-date.js";
2
2
  export { cx } from "./cx.js";
3
3
  export { defineRecipe } from "./define.js";
4
4
  export { withDescribedBy } from "./dialog-description.js";
package/dist/esm/index.js CHANGED
@@ -15,6 +15,7 @@ export * from "./components/card/index.js";
15
15
  export * from "./components/checkbox/index.js";
16
16
  export * from "./components/chip/index.js";
17
17
  export * from "./components/columncalc/index.js";
18
+ export * from "./components/composewindow/index.js";
18
19
  export * from "./components/contextmenu/index.js";
19
20
  export * from "./components/datatable/index.js";
20
21
  export * from "./components/datepicker/index.js";