@crispy-seed/data-table 0.1.1 → 0.1.3

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 (49) hide show
  1. package/dist/index.cjs +4570 -2
  2. package/dist/index.js +4554 -1
  3. package/package.json +1 -1
  4. package/dist/DataTable-12s-D02v6Qj5.js +0 -1523
  5. package/dist/DataTable-12s-Gpv6I4J8.cjs +0 -1574
  6. package/dist/DataTable-12s-Zml1x9Kr-12s-B-mwMBhn.cjs +0 -161
  7. package/dist/DataTable-12s-Zml1x9Kr-12s-BR-yHfob.js +0 -153
  8. package/dist/Menu-12s-A4lEc__n.cjs +0 -103
  9. package/dist/Menu-12s-v9vnaq8F.js +0 -77
  10. package/dist/Select-12s-CE3SMzFp.js +0 -218
  11. package/dist/Select-12s-CNQC9z8t.cjs +0 -249
  12. package/dist/body-cells-12s-2sTwdliH.cjs +0 -461
  13. package/dist/body-cells-12s-Ba2uF4T-.js +0 -452
  14. package/dist/column-calc-12s-C1-I2KdV.js +0 -129
  15. package/dist/column-calc-12s-CJ26VuDJ.cjs +0 -149
  16. package/dist/column-layout-12s-BhQmNTJG.js +0 -99
  17. package/dist/column-layout-12s-k2fZYeKl.cjs +0 -120
  18. package/dist/column-menu-12s-6Yvu4SZ0.js +0 -406
  19. package/dist/column-menu-12s-BnknuXGh.cjs +0 -426
  20. package/dist/editors-12s-C0RxmTcI.cjs +0 -554
  21. package/dist/editors-12s-COixUnI2.js +0 -524
  22. package/dist/resize-12s-CajyNXFB.js +0 -58
  23. package/dist/resize-12s-ChLpxb4i.cjs +0 -58
  24. package/dist/states-12s-BB0PT_bq.cjs +0 -125
  25. package/dist/states-12s-m5mBR90e.js +0 -122
  26. package/dist/toolbar-12s-B1xiS-Zu.js +0 -68
  27. package/dist/toolbar-12s-DzLbghpK.cjs +0 -70
  28. package/dist/useDataTable-12s-BHiDUubw-12s-CBeCwTe7.js +0 -61
  29. package/dist/useDataTable-12s-BHiDUubw-12s-Dgvt7XDk.cjs +0 -61
  30. package/dist/useDataTableColumnCalc-12s-DTQQTtEJ-12s-CvD14JYo.cjs +0 -207
  31. package/dist/useDataTableColumnCalc-12s-DTQQTtEJ-12s-DsEse3uq.js +0 -183
  32. package/dist/useDataTableColumns-12s-Cn2ZAzFL-12s-CD6goR59.js +0 -289
  33. package/dist/useDataTableColumns-12s-Cn2ZAzFL-12s-CUk_CpYT.cjs +0 -292
  34. package/dist/useDataTableEdit-12s-9Wb_UCrN-12s-BoOHq3GB.js +0 -98
  35. package/dist/useDataTableEdit-12s-9Wb_UCrN-12s-De6YHBba.cjs +0 -98
  36. package/dist/useDataTableFilter-12s-ZzbmWMin-12s-CWyBeFna.js +0 -74
  37. package/dist/useDataTableFilter-12s-ZzbmWMin-12s-lpjzZY3_.cjs +0 -74
  38. package/dist/useDataTableInfiniteScroll-12s-8ZG31URd-12s-BexjP6iO.js +0 -104
  39. package/dist/useDataTableInfiniteScroll-12s-8ZG31URd-12s-Bt8gojr9.cjs +0 -104
  40. package/dist/useDataTableRow-12s-CPYaDa1p-12s-4qkGoz-j.js +0 -30
  41. package/dist/useDataTableRow-12s-CPYaDa1p-12s-DG64uYjn.cjs +0 -30
  42. package/dist/useDataTableScroll-12s-BKDCr0en-12s-C7f2vHeG.js +0 -61
  43. package/dist/useDataTableScroll-12s-BKDCr0en-12s-CUvUYMtt.cjs +0 -61
  44. package/dist/useDataTableSearch-12s-Ck3iWcpX-12s-B-65V6gH.js +0 -37
  45. package/dist/useDataTableSearch-12s-Ck3iWcpX-12s-DhVfN2Hq.cjs +0 -37
  46. package/dist/useDataTableSelection-12s-BIDtiRQq-12s-IS__VAnU.cjs +0 -71
  47. package/dist/useDataTableSelection-12s-BIDtiRQq-12s-O6M_BhrH.js +0 -71
  48. package/dist/useDataTableSort-12s-DvJYtmeS-12s-C5VGnsq4.cjs +0 -78
  49. package/dist/useDataTableSort-12s-DvJYtmeS-12s-DABSNt6U.js +0 -78
@@ -1,426 +0,0 @@
1
- 'use client';
2
- function __insertCSS(code) {
3
- if (!code || typeof document == 'undefined') return
4
- let head = document.head || document.getElementsByTagName('head')[0]
5
- let style = document.createElement('style')
6
- style.type = 'text/css'
7
- head.appendChild(style)
8
- ;style.styleSheet ? (style.styleSheet.cssText = code) : style.appendChild(document.createTextNode(code))
9
- }
10
-
11
- var jsxRuntime = require('react/jsx-runtime');
12
- var React = require('react');
13
- var DataTable12s = require('./DataTable-12s-Gpv6I4J8.cjs');
14
- var domUtils = require('@seed-design/dom-utils');
15
- var Menu12s = require('./Menu-12s-A4lEc__n.cjs');
16
- var segmentedControl = require('@seed-design/css/recipes/segmented-control');
17
- var reactSegmentedControl = require('@seed-design/react-segmented-control');
18
- var columnLayout12s = require('./column-layout-12s-k2fZYeKl.cjs');
19
- var resize12s = require('./resize-12s-ChLpxb4i.cjs');
20
- var DataTable12sZml1x9Kr12s = require('./DataTable-12s-Zml1x9Kr-12s-B-mwMBhn.cjs');
21
-
22
- function _interopNamespace(e) {
23
- if (e && e.__esModule) return e;
24
- var n = Object.create(null);
25
- if (e) {
26
- Object.keys(e).forEach(function (k) {
27
- if (k !== 'default') {
28
- var d = Object.getOwnPropertyDescriptor(e, k);
29
- Object.defineProperty(n, k, d.get ? d : {
30
- enumerable: true,
31
- get: function () { return e[k]; }
32
- });
33
- }
34
- });
35
- }
36
- n.default = e;
37
- return n;
38
- }
39
-
40
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
41
-
42
- const { withProvider, withContext } = DataTable12s.createSlotRecipeContext(segmentedControl.segmentedControl);
43
- const SegmentedControlRoot = withProvider(reactSegmentedControl.SegmentedControl.Root, "root");
44
- const SegmentedControlIndicator = withContext(DataTable12s.Primitive.div, "indicator");
45
- const SegmentedControlItem = withContext(reactSegmentedControl.SegmentedControl.Item, "item");
46
- const SegmentedControlItemHiddenInput = reactSegmentedControl.SegmentedControl.ItemHiddenInput;
47
-
48
- // Same fix as cells.tsx's `CheckboxCell`/editors.tsx's `CheckboxEditor` -- seed's
49
- // `CheckboxIndicator` needs a real icon for its `checked` prop (it renders exactly
50
- // what's passed there, nothing automatically); `checked={null}` here used to render an
51
- // empty box even once a value was actually checked. 12px, matching the row-selection
52
- // checkbox's own already-correct icon size (`DataTable.tsx`'s `SELECTION_ICON_SIZE`).
53
- const FILTER_CHECKED_ICON = /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.IconCheckmarkLine_default, {
54
- size: 12
55
- });
56
- // Fix (bug report): karrot icons default to a 24px intrinsic `width`/`height`
57
- // SVG ATTRIBUTE (not CSS) -- inside a fixed 16px `headerCellIcon` box (a flex
58
- // item), flexbox only auto-shrinks the MAIN axis (width) to fit, leaving the
59
- // CROSS axis (height) at its full 24px intrinsic size, so the glyph rendered
60
- // visibly oversized/non-square and spilled out of its slot (measured live:
61
- // 16×24, not 16×16). Passing `size` sets both attributes directly, sidestepping
62
- // the mismatch entirely rather than fighting it with more CSS. Matches crisp's
63
- // own measured `.crisp-datatable-chevron` size (14px).
64
- const SORT_ICON_SIZE = 14;
65
- const DEFAULT_SORT_ICON = {
66
- idle: /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.IconChevronDownLine_default, {
67
- size: SORT_ICON_SIZE
68
- }),
69
- asc: /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.IconChevronUpLine_default, {
70
- size: SORT_ICON_SIZE
71
- }),
72
- desc: /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.IconChevronDownLine_default, {
73
- size: SORT_ICON_SIZE
74
- })
75
- };
76
- /**
77
- * Rendered for EVERY sortable column, sorted or not -- unlike a naive "only show the
78
- * active column's arrow", Attio reveals a neutral chevron on ANY sortable header on
79
- * hover (`data-chevron`'s own CSS in `data-table.ts` owns the opacity: 0 at rest, 0.6
80
- * on header hover, 1 + full foreground once sorted). Conditionally rendering only the
81
- * sorted state, the way this component used to, has nothing for that hover state to
82
- * reveal.
83
- */ function SortIndicator({ columnKey, icon }) {
84
- const { sort } = DataTable12sZml1x9Kr12s.useDataTableContext();
85
- const isSorted = sort?.key === columnKey;
86
- const resolved = isSorted ? sort?.dir === "asc" ? icon?.asc ?? DEFAULT_SORT_ICON.asc : icon?.desc ?? DEFAULT_SORT_ICON.desc : icon?.idle ?? DEFAULT_SORT_ICON.idle;
87
- return /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.DataTableHeaderCellIcon, {
88
- "aria-hidden": true,
89
- "data-chevron": "",
90
- draggable: false,
91
- children: resolved
92
- });
93
- }
94
- /** Attio's own condition word: "Is"/"Is not" alone with zero or one value checked,
95
- * "Is any of"/"Is not any of" once a second value joins the set -- the underlying
96
- * predicate never changes (`useDataTableFilter.ts`'s own comment: membership in a
97
- * set of one IS "is X"), only the word describing it does. */ function filterConditionLabel(mode, hasMultipleValues) {
98
- if (mode === "isnot") return hasMultipleValues ? "Is not any of" : "Is not";
99
- return hasMultipleValues ? "Is any of" : "Is";
100
- }
101
- /**
102
- * A column's "is / is not / is any of" checkbox filter picker (DATATABLE-ATTIO-
103
- * SPEC.md's Feature contract), Attio's own chrome: a two-way condition control above a
104
- * checkbox value list, both built from seed's own documented components -- `Menu` for
105
- * the popover shell (`MenuRoot`/`Trigger`/`Positioner`/`Content`, unchanged), seed's
106
- * `SegmentedControl` (docs/content/react/components/segmented-control.mdx) for the
107
- * is/is-not toggle in place of the two hand-styled buttons (hardcoded hex, no seed
108
- * token) this used to be, and plain `<label>` + `CheckboxRoot` rows for the value
109
- * list -- NOT `MenuItem` there either: `MenuItem`'s own `getItemProps` (`useMenu.ts`)
110
- * closes the menu unconditionally after every click, which is correct for a normal
111
- * command menu but would close this ENTIRE popover after a single condition pick or a
112
- * single checked value -- exactly wrong for a control meant to stay open while the
113
- * condition changes and several boxes get checked. `SegmentedControl` has no such
114
- * auto-close (it's a plain controlled radio group, not a menu), which is exactly why
115
- * it -- not `MenuItem` -- is the documented component that fits here.
116
- */ function FilterMenu({ column }) {
117
- const { filters, toggleFilterValue, setFilterMode } = DataTable12sZml1x9Kr12s.useDataTableContext();
118
- const values = column.filterValues ?? [];
119
- const current = filters[column.key];
120
- const mode = current?.mode ?? "is";
121
- const checkedValues = current?.values ?? [];
122
- const hasMultipleValues = checkedValues.length > 1;
123
- const columnLabel = typeof column.header === "string" ? column.header : column.key;
124
- // A filter trigger lives INSIDE a (possibly sortable) header cell, whose own
125
- // onClick/onKeyDown toggle sort -- stop the event here so opening the filter
126
- // picker never also reorders the rows out from under it.
127
- const stopPropagation = (event)=>event.stopPropagation();
128
- return /*#__PURE__*/ jsxRuntime.jsxs(Menu12s.MenuRoot, {
129
- children: [
130
- /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.DataTableHeaderCellIcon, {
131
- asChild: true,
132
- onClick: stopPropagation,
133
- onKeyDown: stopPropagation,
134
- draggable: false,
135
- children: /*#__PURE__*/ jsxRuntime.jsx(Menu12s.MenuTrigger, {
136
- "aria-label": `Filter ${columnLabel}`,
137
- "data-active": domUtils.dataAttr(checkedValues.length > 0),
138
- children: /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.IconSlider2HorizontalLine_default, {
139
- size: 16
140
- })
141
- })
142
- }),
143
- /*#__PURE__*/ jsxRuntime.jsx(Menu12s.MenuPositioner, {
144
- children: /*#__PURE__*/ jsxRuntime.jsx(Menu12s.MenuContent, {
145
- style: {
146
- minWidth: 180
147
- },
148
- children: /*#__PURE__*/ jsxRuntime.jsxs(Menu12s.MenuScrollArea, {
149
- children: [
150
- /*#__PURE__*/ jsxRuntime.jsx("div", {
151
- style: {
152
- padding: "0 8px"
153
- },
154
- children: /*#__PURE__*/ jsxRuntime.jsxs(SegmentedControlRoot, {
155
- "aria-label": `${columnLabel} filter condition`,
156
- value: mode,
157
- onValueChange: (next)=>setFilterMode(column.key, next),
158
- style: {
159
- width: "100%"
160
- },
161
- children: [
162
- /*#__PURE__*/ jsxRuntime.jsxs(SegmentedControlItem, {
163
- value: "is",
164
- children: [
165
- /*#__PURE__*/ jsxRuntime.jsx(SegmentedControlItemHiddenInput, {}),
166
- filterConditionLabel("is", hasMultipleValues)
167
- ]
168
- }),
169
- /*#__PURE__*/ jsxRuntime.jsxs(SegmentedControlItem, {
170
- value: "isnot",
171
- children: [
172
- /*#__PURE__*/ jsxRuntime.jsx(SegmentedControlItemHiddenInput, {}),
173
- filterConditionLabel("isnot", hasMultipleValues)
174
- ]
175
- }),
176
- /*#__PURE__*/ jsxRuntime.jsx(SegmentedControlIndicator, {})
177
- ]
178
- })
179
- }),
180
- values.map((value)=>// `CheckboxRoot` is ALREADY a `<label>` (`Checkbox.tsx`'s own
181
- // `Primitive.label`) wrapping the hidden input + `CheckboxLabel` text --
182
- // wrapping it in a SECOND `<label>` here used to nest one label inside
183
- // another, which is invalid HTML and made a click on the row's own text
184
- // reach the checkbox's native activation twice (once via each label),
185
- // toggling it on then immediately back off. `CheckboxRoot` takes the
186
- // row's own layout via `style` directly instead.
187
- /*#__PURE__*/ jsxRuntime.jsxs(DataTable12s.CheckboxRoot, {
188
- checked: checkedValues.includes(value),
189
- onCheckedChange: ()=>toggleFilterValue(column.key, value),
190
- style: {
191
- display: "flex",
192
- alignItems: "center",
193
- gap: 8,
194
- padding: "4px 8px",
195
- cursor: "pointer"
196
- },
197
- children: [
198
- /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.CheckboxControl, {
199
- children: /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.CheckboxIndicator, {
200
- checked: FILTER_CHECKED_ICON
201
- })
202
- }),
203
- /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.CheckboxLabel, {
204
- children: value
205
- }),
206
- /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.CheckboxHiddenInput, {
207
- "aria-label": value
208
- })
209
- ]
210
- }, value))
211
- ]
212
- })
213
- })
214
- })
215
- ]
216
- });
217
- }
218
- /** Every header cell, in the effective (ordered, visible) order -- a standalone
219
- * component (not inlined in `DataTableInner`'s render) so it alone re-renders when
220
- * `visibleColumnOrder`/labels/widths change, without also re-deriving `sortedData`'s
221
- * render above it. */ function ColumnHeaderCells({ columns, columnMenu, reorderable, resizable, sortIcon, selectable, stickyFirst, stickyLast }) {
222
- const { draggingColumnKey, beginColumnDrag, dragOverColumn, endColumnDrag } = DataTable12sZml1x9Kr12s.useDataTableContext();
223
- const effective = columnLayout12s.useEffectiveColumns(columns);
224
- const [renamingKey, setRenamingKey] = React__namespace.useState(null);
225
- return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
226
- children: effective.map(({ column, label, width }, index)=>{
227
- const isFirst = index === 0;
228
- const isLast = index === effective.length - 1;
229
- const sticky = columnLayout12s.stickyProps({
230
- selectable,
231
- stickyFirst,
232
- stickyLast,
233
- isSelectionCell: false,
234
- isFirst,
235
- isLast
236
- });
237
- return /*#__PURE__*/ jsxRuntime.jsxs(DataTable12s.DataTableHeaderCell, {
238
- columnKey: column.key,
239
- sortable: column.sortable,
240
- "data-column-key": column.key,
241
- draggable: reorderable && renamingKey !== column.key,
242
- onDragStart: (event)=>{
243
- event.dataTransfer.effectAllowed = "move";
244
- beginColumnDrag(column.key);
245
- },
246
- onDragOver: (event)=>{
247
- event.preventDefault();
248
- if (draggingColumnKey && draggingColumnKey !== column.key) dragOverColumn(column.key);
249
- },
250
- onDrop: (event)=>event.preventDefault(),
251
- onDragEnd: endColumnDrag,
252
- "data-dragging": domUtils.dataAttr(draggingColumnKey === column.key),
253
- style: sticky.style,
254
- "data-sticky": sticky["data-sticky"],
255
- "data-sticky-edge": sticky["data-sticky-edge"],
256
- "data-sticky-edge-end": sticky["data-sticky-edge-end"],
257
- children: [
258
- /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.DataTableHeaderCellInner, {
259
- children: renamingKey === column.key ? /*#__PURE__*/ jsxRuntime.jsx(ColumnRenameInput, {
260
- column: column,
261
- initialLabel: typeof label === "string" ? label : column.key,
262
- onDone: ()=>setRenamingKey(null)
263
- }) : /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
264
- children: [
265
- /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.DataTableHeaderCellLabel, {
266
- children: label
267
- }),
268
- column.filterValues && column.filterValues.length > 0 && /*#__PURE__*/ jsxRuntime.jsx(FilterMenu, {
269
- column: column
270
- }),
271
- column.sortable && /*#__PURE__*/ jsxRuntime.jsx(SortIndicator, {
272
- columnKey: column.key,
273
- icon: sortIcon
274
- }),
275
- columnMenu && /*#__PURE__*/ jsxRuntime.jsx(ColumnMenu, {
276
- column: column,
277
- onRename: ()=>setRenamingKey(column.key)
278
- })
279
- ]
280
- })
281
- }),
282
- resizable && column.resizable !== false && /*#__PURE__*/ jsxRuntime.jsx(resize12s.ColumnResizeHandle, {
283
- columnKey: column.key,
284
- width: width
285
- })
286
- ]
287
- }, column.key);
288
- })
289
- });
290
- }
291
- function ColumnRenameInput({ column, initialLabel, onDone }) {
292
- const { renameColumn } = DataTable12sZml1x9Kr12s.useDataTableContext();
293
- const [value, setValue] = React__namespace.useState(initialLabel);
294
- // Opening this input is ITSELF the result of clicking a `MenuItem` -- the menu's own
295
- // close (which happens on that same click) restores focus to its trigger a beat
296
- // later, and that focus move fires as a `blur` on this input the instant it mounts
297
- // with `autoFocus`. Committing on THAT blur would silently re-close the editor
298
- // before anyone saw it (found writing this file's own rename test, which failed
299
- // with the header reverting to its plain label with no visible input in between).
300
- // `ready` flips true one frame after mount, so only a blur after that -- an actual
301
- // click/tab away -- commits.
302
- const readyRef = React__namespace.useRef(false);
303
- const inputRef = React__namespace.useRef(null);
304
- React__namespace.useEffect(()=>{
305
- // The menu's close restores focus to its trigger one frame after this input
306
- // mounts, stealing focus from `autoFocus`. Re-grab it in the SAME frame (after
307
- // the restore) and select the text, so the user can type/replace immediately.
308
- const frame = requestAnimationFrame(()=>{
309
- readyRef.current = true;
310
- inputRef.current?.focus();
311
- inputRef.current?.select();
312
- });
313
- return ()=>cancelAnimationFrame(frame);
314
- }, []);
315
- const commit = ()=>{
316
- if (value.trim()) renameColumn(column.key, value.trim());
317
- onDone();
318
- };
319
- return(// A bare, minimal input -- NOT seed's `TextField` (its labeled root measures
320
- // ~52px tall, per DATATABLE-ATTIO-SPEC.md's own note; this has to fit a 40px
321
- // header cell with no label/description chrome of its own). Seed has no lighter
322
- // input primitive at this level, so this follows crisp's own measured
323
- // `.crisp-datatable-th-rename` (`datatable.recipe.ts`) instead: full-width,
324
- // header-row height, a small inset, no border (an inset brand-solid box-shadow
325
- // stands in for a focus ring), the header's own font weight/size inherited
326
- // rather than a new size introduced for one input.
327
- /*#__PURE__*/ jsxRuntime.jsx("input", {
328
- ref: inputRef,
329
- // biome-ignore lint/a11y/noAutofocus: opening this input IS the user's own click a moment earlier (crisp's `.crisp-datatable-th-rename` does the same), not an unannounced page-load autofocus.
330
- autoFocus: true,
331
- "aria-label": `Rename ${initialLabel}`,
332
- value: value,
333
- onClick: (event)=>event.stopPropagation(),
334
- onChange: (event)=>setValue(event.target.value),
335
- onBlur: ()=>{
336
- if (readyRef.current) commit();
337
- },
338
- onKeyDown: (event)=>{
339
- event.stopPropagation();
340
- if (event.key === "Enter") commit();
341
- if (event.key === "Escape") onDone();
342
- },
343
- // Bare inline input: no border/ring/background/radius -- it reads as the
344
- // header label made editable in place, not a boxed field.
345
- style: {
346
- width: "100%",
347
- minWidth: 0,
348
- height: "100%",
349
- margin: 0,
350
- padding: 0,
351
- border: "none",
352
- borderRadius: 0,
353
- background: "transparent",
354
- boxShadow: "none",
355
- font: "inherit",
356
- fontWeight: "var(--seed-font-weight-medium)",
357
- color: "var(--seed-color-fg-neutral)",
358
- outline: "none"
359
- }
360
- }));
361
- }
362
- /** The per-column header menu (rename / hide / move left / move right) -- seed
363
- * `Menu`, opened from the same `headerCellIcon` slot the filter trigger and sort
364
- * chevron already share. Hover/focus-reveal (`data-column-menu`'s own CSS in
365
- * `data-table.ts`) -- crisp's own header shows the trigger only on hover, not
366
- * permanently, so this one carries its own marker attribute distinct from that
367
- * slot's OTHER occupants (the sort chevron, the filter trigger), which stay visible
368
- * under their own separate rules regardless of hover. */ function ColumnMenu({ column, onRename }) {
369
- const { moveColumn, hideColumn } = DataTable12sZml1x9Kr12s.useDataTableContext();
370
- const columnLabel = typeof column.header === "string" ? column.header : column.key;
371
- const stopPropagation = (event)=>event.stopPropagation();
372
- return /*#__PURE__*/ jsxRuntime.jsxs(Menu12s.MenuRoot, {
373
- children: [
374
- /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.DataTableHeaderCellIcon, {
375
- asChild: true,
376
- "data-column-menu": "",
377
- onClick: stopPropagation,
378
- onKeyDown: stopPropagation,
379
- draggable: false,
380
- children: /*#__PURE__*/ jsxRuntime.jsx(Menu12s.MenuTrigger, {
381
- "aria-label": `${columnLabel} column menu`,
382
- children: /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.IconDot3HorizontalLine_default, {
383
- size: 16
384
- })
385
- })
386
- }),
387
- /*#__PURE__*/ jsxRuntime.jsx(Menu12s.MenuPositioner, {
388
- children: /*#__PURE__*/ jsxRuntime.jsx(Menu12s.MenuContent, {
389
- style: {
390
- minWidth: 160
391
- },
392
- children: /*#__PURE__*/ jsxRuntime.jsxs(Menu12s.MenuScrollArea, {
393
- children: [
394
- /*#__PURE__*/ jsxRuntime.jsx(Menu12s.MenuItem, {
395
- onClick: onRename,
396
- children: /*#__PURE__*/ jsxRuntime.jsx(Menu12s.MenuItemLabel, {
397
- children: "Rename"
398
- })
399
- }),
400
- /*#__PURE__*/ jsxRuntime.jsx(Menu12s.MenuItem, {
401
- onClick: ()=>moveColumn(column.key, "left"),
402
- children: /*#__PURE__*/ jsxRuntime.jsx(Menu12s.MenuItemLabel, {
403
- children: "Move left"
404
- })
405
- }),
406
- /*#__PURE__*/ jsxRuntime.jsx(Menu12s.MenuItem, {
407
- onClick: ()=>moveColumn(column.key, "right"),
408
- children: /*#__PURE__*/ jsxRuntime.jsx(Menu12s.MenuItemLabel, {
409
- children: "Move right"
410
- })
411
- }),
412
- /*#__PURE__*/ jsxRuntime.jsx(Menu12s.MenuItem, {
413
- onClick: ()=>hideColumn(column.key),
414
- children: /*#__PURE__*/ jsxRuntime.jsx(Menu12s.MenuItemLabel, {
415
- children: "Hide column"
416
- })
417
- })
418
- ]
419
- })
420
- })
421
- })
422
- ]
423
- });
424
- }
425
-
426
- exports.ColumnHeaderCells = ColumnHeaderCells;