@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,461 +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 domUtils = require('@seed-design/dom-utils');
13
- var React = require('react');
14
- var DataTable12s = require('./DataTable-12s-Gpv6I4J8.cjs');
15
- var reactImage = require('@seed-design/react-image');
16
- var avatar = require('@seed-design/css/recipes/avatar');
17
- require('@seed-design/css/recipes/avatar-stack');
18
- var badge = require('@seed-design/css/recipes/badge');
19
- var columnLayout12s = require('./column-layout-12s-k2fZYeKl.cjs');
20
- var editors12s = require('./editors-12s-C0RxmTcI.cjs');
21
- var DataTable12sZml1x9Kr12s = require('./DataTable-12s-Zml1x9Kr-12s-B-mwMBhn.cjs');
22
-
23
- const { withProvider, withContext } = DataTable12s.createSlotRecipeContext(avatar.avatar);
24
- const AvatarRoot = withProvider(reactImage.Image.Root, "root");
25
- const AvatarImage = withContext(reactImage.Image.Content, "image");
26
- const AvatarFallback = withContext(reactImage.Image.Fallback, "fallback");
27
- withContext(DataTable12s.Primitive.div, "badge");
28
-
29
- const Badge = /*#__PURE__*/ React.forwardRef(({ className, children, ...props }, ref)=>{
30
- const [variantProps, restProps] = badge.badge.splitVariantProps(props);
31
- const { root, label } = badge.badge(variantProps);
32
- return /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.Primitive.span, {
33
- className: DataTable12s.clsx(root, className),
34
- ...restProps,
35
- ref: ref,
36
- children: /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.Primitive.span, {
37
- className: label,
38
- children: children
39
- })
40
- });
41
- });
42
- Badge.displayName = "Badge";
43
-
44
- // Attio cell-type renderers, built from seed's own components -- not exported from
45
- // the package's public surface (kept alongside DataTable.tsx as an implementation
46
- // detail, the way Select keeps `InternalIcon` under `components/private`). Each
47
- // renderer takes the raw column value and the table's resolved recipe classNames,
48
- // and returns `null` for an empty value: Attio's own empty cell is genuinely blank,
49
- // no placeholder character, for any type (crisp's datatable.tsx, #412).
50
- // seed's `CheckboxIndicator` renders exactly what its `checked` prop is -- it does not
51
- // supply a checkmark on its own. `checked={null}` (this file's own pre-fix state)
52
- // therefore rendered an empty box even once the value WAS true; every read-only/
53
- // editable checkbox cell in this component needs a real icon here, the same one the
54
- // row-selection checkbox already uses (`DataTable.tsx`'s `SELECTION_ICON_SIZE`, 12px).
55
- const CHECKBOX_CELL_CHECKED_ICON = /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.IconCheckmarkLine_default, {
56
- size: 12
57
- });
58
- // The 6 tones Badge ships (`@seed-design/css/recipes/badge`) -- not Attio's own
59
- // wider palette (crisp's tag/status cells hash across a measured 7- or 12-colour
60
- // set it defines itself), because this component builds cell chrome ONLY from
61
- // seed's already-shipped primitives rather than adding a parallel palette. Same
62
- // stable-hash approach as crisp's own `toneFor` (multiply-and-add over char codes),
63
- // just over seed's tone list instead of crisp's.
64
- const BADGE_TONES = [
65
- "neutral",
66
- "brand",
67
- "informative",
68
- "positive",
69
- "warning",
70
- "critical"
71
- ];
72
- function toneFor(value) {
73
- let hash = 0;
74
- for(let index = 0; index < value.length; index++){
75
- hash = hash * 31 + value.charCodeAt(index) >>> 0;
76
- }
77
- return BADGE_TONES[hash % BADGE_TONES.length];
78
- }
79
- function initialsFor(name) {
80
- const parts = name.trim().split(/\s+/);
81
- return ((parts[0]?.[0] ?? "") + (parts[1]?.[0] ?? "")).toUpperCase() || "?";
82
- }
83
- function formatNumberCell(value, locale) {
84
- return typeof value === "number" ? value.toLocaleString(locale) : null;
85
- }
86
- function formatCurrencyCell(value, symbol, locale) {
87
- return typeof value === "number" ? `${symbol}${value.toLocaleString(locale)}` : null;
88
- }
89
- function toDate(value) {
90
- const date = value instanceof Date ? value : typeof value === "string" ? new Date(value) : null;
91
- return date && !Number.isNaN(date.getTime()) ? date : null;
92
- }
93
- /** `<input type="date">`'s own value shape (`yyyy-mm-dd`) -- editors.tsx's plain
94
- * `cellType: "date"` inline editor reads/writes exactly this string, native to the
95
- * browser's own date input, so no separate parse/format step is needed on commit. */ function toDateInputValue(value) {
96
- const date = toDate(value);
97
- if (!date) return "";
98
- const pad = (n)=>String(n).padStart(2, "0");
99
- return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
100
- }
101
- /** `<input type="datetime-local">`'s own value shape (`yyyy-mm-ddThh:mm`) -- same
102
- * reasoning as `toDateInputValue` above, one input type over. */ function toDateTimeInputValue(value) {
103
- const date = toDate(value);
104
- if (!date) return "";
105
- const pad = (n)=>String(n).padStart(2, "0");
106
- return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;
107
- }
108
- function formatDateCell(value, locale) {
109
- const date = toDate(value);
110
- if (!date) return null;
111
- return new Intl.DateTimeFormat(locale, {
112
- month: "short",
113
- day: "numeric",
114
- year: "numeric"
115
- }).format(date);
116
- }
117
- function formatDateTimeCell(value, locale) {
118
- const date = toDate(value);
119
- if (!date) return null;
120
- return new Intl.DateTimeFormat(locale, {
121
- month: "short",
122
- day: "numeric",
123
- year: "numeric",
124
- hour: "numeric",
125
- minute: "2-digit"
126
- }).format(date);
127
- }
128
- function EntityCell({ value, className, nameClassName }) {
129
- const entity = typeof value === "object" && value !== null ? value : {
130
- name: String(value ?? "")
131
- };
132
- if (!entity.name) return null;
133
- return /*#__PURE__*/ jsxRuntime.jsxs("span", {
134
- className: className,
135
- children: [
136
- /*#__PURE__*/ jsxRuntime.jsxs(AvatarRoot, {
137
- size: "20",
138
- children: [
139
- entity.avatar && /*#__PURE__*/ jsxRuntime.jsx(AvatarImage, {
140
- src: entity.avatar,
141
- alt: ""
142
- }),
143
- /*#__PURE__*/ jsxRuntime.jsx(AvatarFallback, {
144
- children: initialsFor(entity.name)
145
- })
146
- ]
147
- }),
148
- /*#__PURE__*/ jsxRuntime.jsx("span", {
149
- className: nameClassName,
150
- children: entity.name
151
- })
152
- ]
153
- });
154
- }
155
- function TagsCell({ value, className }) {
156
- const tags = Array.isArray(value) ? value : [];
157
- if (!tags.length) return null;
158
- return /*#__PURE__*/ jsxRuntime.jsx("span", {
159
- className: className,
160
- children: tags.map((tag)=>/*#__PURE__*/ jsxRuntime.jsx(Badge, {
161
- tone: toneFor(tag),
162
- variant: "weak",
163
- size: "medium",
164
- children: tag
165
- }, tag))
166
- });
167
- }
168
- function StatusCell({ value }) {
169
- const status = value == null ? "" : String(value);
170
- if (!status) return null;
171
- return /*#__PURE__*/ jsxRuntime.jsx(Badge, {
172
- tone: toneFor(status),
173
- variant: "weak",
174
- size: "medium",
175
- children: status
176
- });
177
- }
178
- function LinkCell({ column, value, className }) {
179
- const text = value == null ? "" : String(value);
180
- if (!text) return null;
181
- const isUrl = column.type === "url";
182
- const href = isUrl ? /^https?:\/\//.test(text) ? text : `https://${text}` : `mailto:${text}`;
183
- return /*#__PURE__*/ jsxRuntime.jsx("a", {
184
- className: className,
185
- href: href,
186
- target: isUrl ? "_blank" : undefined,
187
- rel: isUrl ? "noreferrer" : undefined,
188
- // A link cell points somewhere other than "select this row" -- its own
189
- // navigation must not also fire a row click handler.
190
- onClick: (event)=>event.stopPropagation(),
191
- children: text
192
- });
193
- }
194
- // Attio's own measured 5-point star path (crisp's `RATING_STAR_D`, traced from the
195
- // live widget's SVG) -- reused verbatim rather than a generic star glyph, so a
196
- // rating cell's silhouette matches Attio exactly instead of approximating it. Exported
197
- // so editors.tsx's interactive `RatingEditor` (an `editable` rating column, clicking a
198
- // star commits) draws the identical silhouette rather than a second, slightly
199
- // different one.
200
- const RATING_STAR_D = "M7.32203 2.81085C7.65793 1.97438 8.84207 1.97438 9.17797 2.81085L10.0851 5.06967C10.2281 5.42587 10.5624 5.66876 10.9454 5.69473L13.3739 5.8594C14.2733 5.92038 14.6392 7.04656 13.9475 7.62451L12.0795 9.18521C11.7849 9.43132 11.6572 9.82433 11.7509 10.1966L12.3447 12.5572C12.5647 13.4313 11.6067 14.1273 10.8433 13.6481L8.78171 12.3538C8.45661 12.1497 8.04339 12.1497 7.71829 12.3538L5.65675 13.6481C4.89333 14.1273 3.93534 13.4313 4.15526 12.5572L4.74911 10.1966C4.84276 9.82433 4.71507 9.43132 4.4205 9.18521L2.55254 7.62451C1.86081 7.04656 2.22673 5.92038 3.12606 5.8594L5.55463 5.69473C5.9376 5.66876 6.27191 5.42587 6.41495 5.06967L7.32203 2.81085Z";
201
- // Filled = the same measured Attio brand blue the selected-row tint uses
202
- // (`data-table.ts`'s `ATTIO_BRAND_BLUE`); empty = crisp's own measured
203
- // `rgba(0,0,0,0.1)`. Literal, not a recipe token -- see that file's comment on why.
204
- const RATING_FILLED = "#0298d9";
205
- const RATING_EMPTY = "rgba(0, 0, 0, 0.1)";
206
- function RatingCell({ value, maxRating = 5 }) {
207
- const rating = typeof value === "number" ? value : Number(value);
208
- if (!rating || Number.isNaN(rating)) return null;
209
- return /*#__PURE__*/ jsxRuntime.jsx("span", {
210
- style: {
211
- display: "inline-flex",
212
- alignItems: "center",
213
- gap: 2
214
- },
215
- children: Array.from({
216
- length: maxRating
217
- }, (_, index)=>// biome-ignore lint/suspicious/noArrayIndexKey: a fixed-length star row has no other identity
218
- /*#__PURE__*/ jsxRuntime.jsx("svg", {
219
- width: 16,
220
- height: 16,
221
- viewBox: "0 0 16 16",
222
- fill: "none",
223
- role: "presentation",
224
- "aria-hidden": "true",
225
- children: /*#__PURE__*/ jsxRuntime.jsx("path", {
226
- d: RATING_STAR_D,
227
- fill: index < rating ? RATING_FILLED : RATING_EMPTY
228
- })
229
- }, index))
230
- });
231
- }
232
- /** `type: "checkbox"`'s READ-ONLY display -- a disabled seed `Checkbox` reflecting
233
- * the raw boolean, so a non-`editable` checkbox column still reads as a checkbox
234
- * (crisp's own measured shape, distinct from `switch`/`rating`'s toggle/star), not a
235
- * bare "true"/"false" string. The `editable` case (a live, clickable checkbox) is
236
- * `editors.tsx`'s `CheckboxEditor` -- this renderer never handles a click. */ function CheckboxCell({ value }) {
237
- const checked = value === true || value === "true";
238
- return /*#__PURE__*/ jsxRuntime.jsxs(DataTable12s.CheckboxRoot, {
239
- checked: checked,
240
- disabled: true,
241
- tabIndex: -1,
242
- children: [
243
- /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.CheckboxControl, {
244
- children: /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.CheckboxIndicator, {
245
- checked: CHECKBOX_CELL_CHECKED_ICON
246
- })
247
- }),
248
- /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.CheckboxHiddenInput, {
249
- "aria-label": "Value"
250
- })
251
- ]
252
- });
253
- }
254
-
255
- /** `editable` + one of these shapes needs no double-click gate and no separate rest
256
- * display -- interacting with the widget itself IS the commit gesture (crisp's own
257
- * #453/#760/#761: `switch`/`rating`/`checkbox` never had a meaningfully different
258
- * "rest" state to show). Every other `editable` column opens on double-click. */ function isAlwaysLiveEditable(column) {
259
- if (!column.editable) return false;
260
- return column.editor === "switch" || column.type === "rating" || column.type === "checkbox";
261
- }
262
- function ColumnBodyCells({ columns, row, classNames, locale, selectable, stickyFirst, stickyLast }) {
263
- const effective = columnLayout12s.useEffectiveColumns(columns);
264
- const { startEdit } = DataTable12sZml1x9Kr12s.useDataTableContext();
265
- return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
266
- children: effective.map(({ column }, index)=>{
267
- const isFirst = index === 0;
268
- const isLast = index === effective.length - 1;
269
- const sticky = columnLayout12s.stickyProps({
270
- selectable,
271
- stickyFirst,
272
- stickyLast,
273
- isSelectionCell: false,
274
- isFirst,
275
- isLast
276
- });
277
- // A gated `editable` column (everything except the always-live widgets)
278
- // opens on double-click -- Attio's own measured gesture (crisp's #411),
279
- // matched here rather than a single click, which stays "select this cell"
280
- // in crisp's own spreadsheet model and would otherwise be indistinguishable
281
- // from this table's plain row click.
282
- const gated = column.editable && !isAlwaysLiveEditable(column);
283
- return /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.DataTableCell, {
284
- "data-numeric": domUtils.dataAttr(column.type === "number" || column.type === "currency"),
285
- "data-editable": domUtils.dataAttr(!!column.editable),
286
- "data-sticky": sticky["data-sticky"],
287
- "data-sticky-edge": sticky["data-sticky-edge"],
288
- "data-sticky-edge-end": sticky["data-sticky-edge-end"],
289
- style: sticky.style,
290
- onDoubleClick: gated ? ()=>startEdit(row.id, column.key) : undefined,
291
- children: /*#__PURE__*/ jsxRuntime.jsx(CellContent, {
292
- column: column,
293
- row: row,
294
- rowId: row.id,
295
- classNames: classNames,
296
- locale: locale
297
- })
298
- }, column.key);
299
- })
300
- });
301
- }
302
- /**
303
- * Dispatches to whichever of cells.tsx's static renderers or editors.tsx's live
304
- * editors applies to THIS column/row right now -- always-live first (no rest state to
305
- * fall back to), then a gated editor while the cell is mid-edit, else the plain
306
- * display (a custom `render` wins there, same as before `editable` existed; it never
307
- * overrides an actual editing/always-live state, matching crisp's own split between
308
- * `renderTyped`'s rest-state branch and the editing branches above it).
309
- */ function CellContent({ column, row, rowId, classNames, locale }) {
310
- const { isEditing, isPending, getEditError, commitEdit, cancelEdit } = DataTable12sZml1x9Kr12s.useDataTableContext();
311
- const rawValue = DataTable12s.getColumnValue(column, row);
312
- const pending = isPending(rowId, column.key);
313
- const error = column.editable ? getEditError(rowId, column.key) : null;
314
- const commit = (value)=>commitEdit(rowId, column.key, value);
315
- const cancel = ()=>cancelEdit();
316
- let node;
317
- if (column.editable && column.editor === "switch") {
318
- node = /*#__PURE__*/ jsxRuntime.jsx(editors12s.SwitchEditor, {
319
- column: column,
320
- value: editors12s.resolveEditValue(column, row, rawValue),
321
- pending: pending,
322
- onCommit: commit
323
- });
324
- } else if (column.editable && column.type === "rating") {
325
- node = /*#__PURE__*/ jsxRuntime.jsx(editors12s.RatingEditor, {
326
- column: column,
327
- value: editors12s.resolveEditValue(column, row, rawValue),
328
- pending: pending,
329
- onCommit: commit
330
- });
331
- } else if (column.editable && column.type === "checkbox") {
332
- node = /*#__PURE__*/ jsxRuntime.jsx(editors12s.CheckboxEditor, {
333
- column: column,
334
- value: editors12s.resolveEditValue(column, row, rawValue),
335
- pending: pending,
336
- onCommit: commit
337
- });
338
- } else if (column.editable && isEditing(rowId, column.key)) {
339
- if (column.editor === "select") {
340
- node = /*#__PURE__*/ jsxRuntime.jsx(editors12s.SelectEditor, {
341
- column: column,
342
- value: editors12s.resolveEditValue(column, row, rawValue),
343
- pending: pending,
344
- onCommit: commit,
345
- onCancel: cancel
346
- });
347
- } else if (column.editor === "reference" || column.editor === "actor") {
348
- node = /*#__PURE__*/ jsxRuntime.jsx(editors12s.ReferenceEditor, {
349
- column: column,
350
- value: editors12s.resolveEditValue(column, row, rawValue),
351
- pending: pending,
352
- onCommit: commit,
353
- onCancel: cancel
354
- });
355
- } else if (column.cellType === "date" || column.cellType === "datetime") {
356
- node = /*#__PURE__*/ jsxRuntime.jsx(editors12s.DateEditor, {
357
- column: column,
358
- value: rawValue,
359
- pending: pending,
360
- onCommit: commit,
361
- onCancel: cancel
362
- });
363
- } else {
364
- node = /*#__PURE__*/ jsxRuntime.jsx(editors12s.TextEditor, {
365
- column: column,
366
- value: rawValue,
367
- pending: pending,
368
- onCommit: commit,
369
- onCancel: cancel
370
- });
371
- }
372
- } else {
373
- node = /*#__PURE__*/ jsxRuntime.jsx(DisplayCellContent, {
374
- column: column,
375
- row: row,
376
- value: rawValue,
377
- classNames: classNames,
378
- locale: locale
379
- });
380
- }
381
- return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
382
- children: [
383
- node,
384
- error && /*#__PURE__*/ jsxRuntime.jsx(editors12s.EditError, {
385
- message: error
386
- })
387
- ]
388
- });
389
- }
390
- // The plain (non-editing) Attio cell-type renderer -- unchanged from before this
391
- // table grew inline editing, just renamed (it used to be the whole of `CellContent`)
392
- // since that name now belongs to the dispatcher above.
393
- function DisplayCellContent({ column, row, value, classNames, locale }) {
394
- if (column.render) return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
395
- children: column.render(row)
396
- });
397
- switch(column.type){
398
- case "entity":
399
- return /*#__PURE__*/ jsxRuntime.jsx(EntityCell, {
400
- value: value,
401
- className: classNames.entity,
402
- nameClassName: classNames.entityName
403
- });
404
- case "url":
405
- case "email":
406
- return /*#__PURE__*/ jsxRuntime.jsx(LinkCell, {
407
- column: column,
408
- value: value,
409
- className: classNames.link
410
- });
411
- case "tags":
412
- return /*#__PURE__*/ jsxRuntime.jsx(TagsCell, {
413
- value: value,
414
- className: classNames.tagList
415
- });
416
- case "status":
417
- return /*#__PURE__*/ jsxRuntime.jsx(StatusCell, {
418
- value: value
419
- });
420
- case "number":
421
- return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
422
- children: formatNumberCell(value, locale)
423
- });
424
- case "currency":
425
- return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
426
- children: formatCurrencyCell(value, column.symbol ?? "$", locale)
427
- });
428
- case "date":
429
- return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
430
- children: formatDateCell(value, locale)
431
- });
432
- case "datetime":
433
- return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
434
- children: formatDateTimeCell(value, locale)
435
- });
436
- case "rating":
437
- return /*#__PURE__*/ jsxRuntime.jsx(RatingCell, {
438
- value: value,
439
- maxRating: column.maxRating
440
- });
441
- case "checkbox":
442
- return /*#__PURE__*/ jsxRuntime.jsx(CheckboxCell, {
443
- value: value
444
- });
445
- default:
446
- return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
447
- children: value == null ? null : String(value)
448
- });
449
- }
450
- }
451
-
452
- exports.AvatarFallback = AvatarFallback;
453
- exports.AvatarImage = AvatarImage;
454
- exports.AvatarRoot = AvatarRoot;
455
- exports.CHECKBOX_CELL_CHECKED_ICON = CHECKBOX_CELL_CHECKED_ICON;
456
- exports.ColumnBodyCells = ColumnBodyCells;
457
- exports.RATING_EMPTY = RATING_EMPTY;
458
- exports.RATING_FILLED = RATING_FILLED;
459
- exports.RATING_STAR_D = RATING_STAR_D;
460
- exports.toDateInputValue = toDateInputValue;
461
- exports.toDateTimeInputValue = toDateTimeInputValue;