@trackunit/react-table-base-components 1.10.17 → 1.10.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -9,8 +9,74 @@ import { Temporal } from '@js-temporal/polyfill';
9
9
  import { DateTimeFormat } from '@trackunit/shared-utils';
10
10
 
11
11
  /**
12
- * The ButtonCell is used to display interactive data in table columns.
12
+ * The `<ButtonCell>` component renders an interactive button within a table cell.
13
+ * Uses a ghost-neutral variant by default for subtle inline actions.
14
+ * Commonly used for quick actions on individual rows without opening a menu.
13
15
  *
16
+ * ### When to use
17
+ * - Provide a single quick action directly in a table cell
18
+ * - When the action is contextual and specific to that row's data
19
+ * - For inline edit, view details, or quick status change actions
20
+ *
21
+ * ### When not to use
22
+ * - For multiple actions per row - use `RowActions` instead
23
+ * - For primary page-level actions - use regular `Button` component
24
+ * - For navigation links - use `LinkCell` or `IdentityCell` with link prop
25
+ *
26
+ * @example Basic usage
27
+ * ```tsx
28
+ * import { ButtonCell } from "@trackunit/react-table-base-components";
29
+ * import { createColumnHelper } from "@tanstack/react-table";
30
+ *
31
+ * const columnHelper = createColumnHelper<Asset>();
32
+ *
33
+ * const columns = [
34
+ * columnHelper.display({
35
+ * id: "action",
36
+ * header: "Action",
37
+ * cell: ({ row }) => (
38
+ * <ButtonCell onClick={() => handleView(row.original.id)}>
39
+ * View Details
40
+ * </ButtonCell>
41
+ * ),
42
+ * }),
43
+ * ];
44
+ * ```
45
+ * @example With icon
46
+ * ```tsx
47
+ * import { ButtonCell } from "@trackunit/react-table-base-components";
48
+ *
49
+ * // Edit action with icon
50
+ * <ButtonCell
51
+ * iconName="PencilSquare"
52
+ * onClick={() => handleEdit(assetId)}
53
+ * >
54
+ * Edit
55
+ * </ButtonCell>
56
+ *
57
+ * // Download action
58
+ * <ButtonCell
59
+ * iconName="ArrowDownTray"
60
+ * iconColor="primary"
61
+ * onClick={() => handleDownload(reportId)}
62
+ * >
63
+ * Download
64
+ * </ButtonCell>
65
+ * ```
66
+ * @example Different button states
67
+ * ```tsx
68
+ * import { ButtonCell } from "@trackunit/react-table-base-components";
69
+ *
70
+ * // Disabled state
71
+ * <ButtonCell disabled onClick={() => {}}>
72
+ * Unavailable
73
+ * </ButtonCell>
74
+ *
75
+ * // Loading state
76
+ * <ButtonCell loading onClick={() => {}}>
77
+ * Processing
78
+ * </ButtonCell>
79
+ * ```
14
80
  * @param {ButtonCellProps} props - The props for the ButtonCell component
15
81
  * @returns {ReactElement} ButtonCell component
16
82
  */
@@ -36,8 +102,58 @@ const cvaDateTime$1 = cvaMerge(["slashed-zero", "text-sm", "text-ellipsis"]);
36
102
  const cvaDateTimeSince$1 = cvaMerge(["slashed-zero", "text-neutral-500", "text-xs", "text-ellipsis"]);
37
103
 
38
104
  /**
39
- * DateTimeCell is used for render a date and or time in a table cell.
105
+ * The `<DateTimeCell>` component renders a formatted date/time in a table cell.
106
+ * It displays the formatted date with an optional "time since" indicator
107
+ * (e.g., "2 hours ago") on a second line for quick context.
108
+ *
109
+ * ### When to use
110
+ * - Display timestamps, created/updated dates in tables
111
+ * - When users need to quickly understand how recent an event was
112
+ * - For date columns that benefit from relative time context
113
+ *
114
+ * ### When not to use
115
+ * - For date-only display without time - use `PlainDateCell` instead
116
+ * - For duration values - use `NumberCell` with appropriate units
117
+ * - For editable date inputs - use form components instead
118
+ *
119
+ * @example Basic usage
120
+ * ```tsx
121
+ * import { DateTimeCell } from "@trackunit/react-table-base-components";
122
+ * import { createColumnHelper } from "@tanstack/react-table";
123
+ *
124
+ * const columnHelper = createColumnHelper<Event>();
125
+ *
126
+ * const columns = [
127
+ * columnHelper.accessor("createdAt", {
128
+ * header: "Created",
129
+ * cell: ({ getValue }) => <DateTimeCell date={getValue()} />,
130
+ * }),
131
+ * ];
132
+ * ```
133
+ * @example With timezone and format options
134
+ * ```tsx
135
+ * import { DateTimeCell } from "@trackunit/react-table-base-components";
136
+ *
137
+ * // Default format with time since
138
+ * <DateTimeCell date={new Date("2024-01-15T14:30:00Z")} />
139
+ * // Output: "Jan 15, 2024, 2:30 PM" + "3 days ago"
140
+ *
141
+ * // Without time since indicator
142
+ * <DateTimeCell date={new Date()} withTimeSince={false} />
40
143
  *
144
+ * // With specific timezone
145
+ * <DateTimeCell
146
+ * date={new Date()}
147
+ * timeZone="America/New_York"
148
+ * locale="en-US"
149
+ * />
150
+ *
151
+ * // Custom format
152
+ * <DateTimeCell
153
+ * date={new Date()}
154
+ * format="dateTime"
155
+ * />
156
+ * ```
41
157
  * @param {DateTimeCellProps} props - The props for the DateTimeCell component
42
158
  * @returns {ReactElement} DateTimeCell component
43
159
  */
@@ -85,13 +201,76 @@ const cvaIdentityCell = cvaMerge(["grid", "items-center", "text-sm", "gap-2"], {
85
201
  });
86
202
 
87
203
  /**
88
- * The IdentityCell is used for render an identity in a table cell.
204
+ * The `<IdentityCell>` component renders an identity or entity in a table cell,
205
+ * typically showing a title with optional thumbnail and supporting details.
206
+ * Commonly used for displaying assets, users, or other entities with rich metadata.
89
207
  *
90
208
  * When displaying asset information, always use the `type` field
91
209
  * (e.g., "excavator", "boom lift") instead of `assetType` (e.g., "machine", "attachment").
92
210
  *
93
- * @param {IdentityCellProps} props - The props for the LinkCell component
94
- * @returns {ReactElement} LinkCell component
211
+ * ### When to use
212
+ * - Display entities with name + additional identifying details (model, serial number, etc.)
213
+ * - When a thumbnail/avatar helps users identify the item
214
+ * - For the primary identifying column in asset, user, or entity tables
215
+ *
216
+ * ### When not to use
217
+ * - For simple text values - use `TextCell` instead
218
+ * - For numeric data - use `NumberCell` instead
219
+ * - For standalone links without identity context - use `LinkCell` instead
220
+ *
221
+ * @example Basic usage with asset data
222
+ * ```tsx
223
+ * import { IdentityCell } from "@trackunit/react-table-base-components";
224
+ * import { createColumnHelper } from "@tanstack/react-table";
225
+ *
226
+ * const columnHelper = createColumnHelper<Asset>();
227
+ *
228
+ * const columns = [
229
+ * columnHelper.accessor("name", {
230
+ * header: "Asset",
231
+ * cell: ({ row }) => (
232
+ * <IdentityCell
233
+ * title={row.original.name}
234
+ * details={[row.original.type, row.original.serialNumber]}
235
+ * />
236
+ * ),
237
+ * }),
238
+ * ];
239
+ * ```
240
+ * @example With thumbnail and link
241
+ * ```tsx
242
+ * import { IdentityCell } from "@trackunit/react-table-base-components";
243
+ * import { AssetImage } from "@trackunit/react-components";
244
+ * import { useIrisRouting } from "@trackunit/react-core-contexts-and-hooks";
245
+ *
246
+ * const { createHref, goto } = useIrisRouting();
247
+ *
248
+ * <IdentityCell
249
+ * title="Excavator CAT 320"
250
+ * details={["Caterpillar", "SN: ABC123456"]}
251
+ * thumbnail={<AssetImage assetId={assetId} size="small" />}
252
+ * link={{
253
+ * href: () => createHref({ page: "asset", assetId }),
254
+ * goto: () => goto({ page: "asset", assetId }),
255
+ * title: "View asset details",
256
+ * }}
257
+ * />
258
+ * ```
259
+ * @example Simple identity without extras
260
+ * ```tsx
261
+ * import { IdentityCell } from "@trackunit/react-table-base-components";
262
+ *
263
+ * // Just title
264
+ * <IdentityCell title="John Smith" />
265
+ *
266
+ * // Title with details array
267
+ * <IdentityCell
268
+ * title="Boom Lift JLG 600S"
269
+ * details={["JLG Industries", "Serial: XYZ789"]}
270
+ * />
271
+ * ```
272
+ * @param {IdentityCellProps} props - The props for the IdentityCell component
273
+ * @returns {ReactElement} IdentityCell component
95
274
  */
96
275
  const IdentityCell = ({ link, className, "data-testid": dataTestId, title, details = [], thumbnail, }) => {
97
276
  const [href, setHref] = useState(undefined);
@@ -137,8 +316,61 @@ const IndicatorCell = ({ withBackground = false, weight = "normal", ...rest }) =
137
316
  const cvaLinkCell = cvaMerge(["text-sm"]);
138
317
 
139
318
  /**
140
- * The LinkCell is used for render a list of tags in a table cell
319
+ * The `<LinkCell>` component renders a clickable link in a table cell.
320
+ * Supports URLs, phone numbers (tel:), and email addresses (mailto:).
321
+ * Clicking the link opens it without triggering the table row click handler.
322
+ *
323
+ * ### When to use
324
+ * - Display clickable URLs, emails, or phone numbers in table columns
325
+ * - When users need to contact someone or visit an external link from table data
326
+ * - For contact information columns (email, phone)
327
+ *
328
+ * ### When not to use
329
+ * - For internal navigation - use `IdentityCell` with link prop instead
330
+ * - For action buttons - use `ButtonCell` or `RowActions` instead
331
+ * - For non-interactive text - use `TextCell` instead
332
+ *
333
+ * @example Basic usage with different link types
334
+ * ```tsx
335
+ * import { LinkCell } from "@trackunit/react-table-base-components";
336
+ * import { createColumnHelper } from "@tanstack/react-table";
337
+ *
338
+ * const columnHelper = createColumnHelper<Contact>();
141
339
  *
340
+ * const columns = [
341
+ * columnHelper.accessor("email", {
342
+ * header: "Email",
343
+ * cell: ({ getValue }) => (
344
+ * <LinkCell type="EMAIL" link={getValue()} />
345
+ * ),
346
+ * }),
347
+ * columnHelper.accessor("phone", {
348
+ * header: "Phone",
349
+ * cell: ({ getValue }) => (
350
+ * <LinkCell type="PHONE" link={getValue()} />
351
+ * ),
352
+ * }),
353
+ * columnHelper.accessor("website", {
354
+ * header: "Website",
355
+ * cell: ({ getValue }) => (
356
+ * <LinkCell type="LINK" link={getValue()} />
357
+ * ),
358
+ * }),
359
+ * ];
360
+ * ```
361
+ * @example Link type examples
362
+ * ```tsx
363
+ * import { LinkCell } from "@trackunit/react-table-base-components";
364
+ *
365
+ * // Email - opens mail client
366
+ * <LinkCell type="EMAIL" link="contact@example.com" />
367
+ *
368
+ * // Phone - opens phone dialer
369
+ * <LinkCell type="PHONE" link="+1-555-123-4567" />
370
+ *
371
+ * // URL - opens in browser
372
+ * <LinkCell type="LINK" link="https://example.com" />
373
+ * ```
142
374
  * @param {LinkCellProps} props - The props for the LinkCell component
143
375
  * @returns {ReactElement} LinkCell component
144
376
  */
@@ -246,8 +478,49 @@ const NoticeCell = ({ ...rest }) => {
246
478
  const cvaNumberCell = cvaMerge(["flex", "gap-1", "slashed-zero", "text-sm", "text-ellipsis"]);
247
479
 
248
480
  /**
249
- * The `<NumberCell>` component is used for displaying numbers with units in a table cell.
481
+ * The `<NumberCell>` component is used for displaying numbers with optional units in a table cell.
482
+ * Numbers are right-aligned by default for easy scanning and comparison in data tables.
483
+ *
484
+ * ### When to use
485
+ * - Display numeric values like quantities, measurements, or counts
486
+ * - When values need to be accompanied by units (km, hours, %, etc.)
487
+ * - For right-aligned numeric columns in data tables
488
+ *
489
+ * ### When not to use
490
+ * - For non-numeric text content - use `TextCell` instead
491
+ * - For dates and times - use `DateTimeCell` instead
492
+ * - For formatted currency - consider specialized formatting
493
+ *
494
+ * @example Basic usage
495
+ * ```tsx
496
+ * import { NumberCell } from "@trackunit/react-table-base-components";
497
+ * import { createColumnHelper } from "@tanstack/react-table";
498
+ *
499
+ * const columnHelper = createColumnHelper<Asset>();
500
+ *
501
+ * const columns = [
502
+ * columnHelper.accessor("engineHours", {
503
+ * header: "Engine Hours",
504
+ * cell: ({ getValue }) => <NumberCell value={getValue()} unit="h" />,
505
+ * }),
506
+ * ];
507
+ * ```
508
+ * @example Different unit types
509
+ * ```tsx
510
+ * import { NumberCell } from "@trackunit/react-table-base-components";
250
511
  *
512
+ * // Distance
513
+ * <NumberCell value={1250} unit="km" />
514
+ *
515
+ * // Percentage
516
+ * <NumberCell value={85} unit="%" />
517
+ *
518
+ * // Temperature
519
+ * <NumberCell value={23.5} unit="°C" />
520
+ *
521
+ * // Without unit
522
+ * <NumberCell value={42} />
523
+ * ```
251
524
  * @param {NumberCellProps} props - The props for the NumberCell component.
252
525
  * @returns {ReactElement} A React JSX element representing the NumberCell component.
253
526
  */
@@ -333,15 +606,114 @@ const cvaResizeHandel = cvaMerge([
333
606
  });
334
607
 
335
608
  /**
336
- * RowActions component displays actions as individual buttons or a dropdown menu
337
- * based on the number of actions provided.
609
+ * The `<RowActions>` component displays contextual actions for a table row.
610
+ * Automatically adapts its rendering based on the number of actions:
611
+ * - Single action: renders as a standalone button
612
+ * - Multiple actions: renders selected actions as icon buttons + overflow menu
613
+ *
614
+ * Actions can be marked as `isSelected` to display them as quick-access icon buttons
615
+ * outside the dropdown menu. Danger actions are automatically separated with a divider.
616
+ *
617
+ * ### When to use
618
+ * - Provide row-level actions like Edit, Delete, Download, etc.
619
+ * - When rows need multiple contextual actions
620
+ * - For consistent action patterns across data tables
621
+ *
622
+ * ### When not to use
623
+ * - For bulk actions on selected rows - use `ActionSheet` instead
624
+ * - For a single simple action - consider `ButtonCell` for simpler UI
625
+ * - For navigation - use `IdentityCell` with link prop
626
+ *
627
+ * @example Basic usage with multiple actions
628
+ * ```tsx
629
+ * import { RowActions } from "@trackunit/react-table-base-components";
630
+ * import { createColumnHelper } from "@tanstack/react-table";
338
631
  *
339
- * - If there is a single action, it displays a standalone button.
340
- * - If there are multiple actions, they are grouped into a dropdown menu.
632
+ * const columnHelper = createColumnHelper<Asset>();
341
633
  *
634
+ * const columns = [
635
+ * columnHelper.display({
636
+ * id: "actions",
637
+ * header: "",
638
+ * cell: ({ row }) => (
639
+ * <RowActions
640
+ * actions={[
641
+ * {
642
+ * label: "Edit",
643
+ * iconName: "PencilSquare",
644
+ * onClick: () => handleEdit(row.original.id),
645
+ * },
646
+ * {
647
+ * label: "Download",
648
+ * iconName: "ArrowDownTray",
649
+ * onClick: () => handleDownload(row.original.id),
650
+ * },
651
+ * {
652
+ * label: "Delete",
653
+ * iconName: "Trash",
654
+ * variant: "danger",
655
+ * onClick: () => handleDelete(row.original.id),
656
+ * },
657
+ * ]}
658
+ * />
659
+ * ),
660
+ * }),
661
+ * ];
662
+ * ```
663
+ * @example With selected (pinned) actions
664
+ * ```tsx
665
+ * import { RowActions } from "@trackunit/react-table-base-components";
666
+ *
667
+ * <RowActions
668
+ * actions={[
669
+ * {
670
+ * label: "Edit",
671
+ * iconName: "PencilSquare",
672
+ * isSelected: true, // Shows as icon button outside menu
673
+ * onClick: () => handleEdit(id),
674
+ * },
675
+ * {
676
+ * label: "Duplicate",
677
+ * iconName: "DocumentDuplicate",
678
+ * onClick: () => handleDuplicate(id),
679
+ * },
680
+ * {
681
+ * label: "Delete",
682
+ * iconName: "Trash",
683
+ * variant: "danger",
684
+ * onClick: () => handleDelete(id),
685
+ * },
686
+ * ]}
687
+ * />
688
+ * ```
689
+ * @example With loading and disabled states
690
+ * ```tsx
691
+ * import { RowActions } from "@trackunit/react-table-base-components";
692
+ *
693
+ * <RowActions
694
+ * actions={[
695
+ * {
696
+ * label: "Processing...",
697
+ * iconName: "ArrowPath",
698
+ * loading: true,
699
+ * onClick: () => {},
700
+ * },
701
+ * {
702
+ * label: "Unavailable",
703
+ * iconName: "NoSymbol",
704
+ * disabled: true,
705
+ * onClick: () => {},
706
+ * },
707
+ * {
708
+ * label: "Hidden Action",
709
+ * isVisible: false, // Will not be rendered
710
+ * onClick: () => {},
711
+ * },
712
+ * ]}
713
+ * />
714
+ * ```
342
715
  * @param {RowActionsProps} props - The properties for the component.
343
- * @param {Action[]} props.actions - A list of actions to display, including their labels, icons, and handlers.
344
- * @returns {Element} A React component rendering the actions.
716
+ * @returns {ReactElement} A React component rendering the row actions.
345
717
  */
346
718
  const RowActions = ({ actions }) => {
347
719
  const selectedActions = actions.filter(action => action.isSelected);
@@ -444,8 +816,49 @@ const cvaTableRoot = cvaMerge(["border-spacing-0", "min-w-full", "border-collaps
444
816
  const cvaTagsCell = cvaMerge(["flex", "gap-2"]);
445
817
 
446
818
  /**
447
- * The TagsCell is used for render a list of tags in a table cell
819
+ * The `<TagsCell>` component renders a list of tags in a table cell.
820
+ * Useful for displaying categories, labels, or status indicators in a compact format.
821
+ *
822
+ * ### When to use
823
+ * - Display multiple tags, categories, or labels for an entity
824
+ * - Show groupings, classifications, or metadata as visual tags
825
+ * - When items have multiple attributes that should be shown together
826
+ *
827
+ * ### When not to use
828
+ * - For a single status indicator - use `Tag` component directly or `IndicatorCell`
829
+ * - For text content - use `TextCell` instead
830
+ * - For interactive chip selection - use form components instead
831
+ *
832
+ * @example Basic usage with string array
833
+ * ```tsx
834
+ * import { TagsCell } from "@trackunit/react-table-base-components";
835
+ * import { createColumnHelper } from "@tanstack/react-table";
836
+ *
837
+ * const columnHelper = createColumnHelper<Asset>();
838
+ *
839
+ * const columns = [
840
+ * columnHelper.accessor("tags", {
841
+ * header: "Tags",
842
+ * cell: ({ getValue }) => <TagsCell tags={getValue()} />,
843
+ * }),
844
+ * ];
845
+ * ```
846
+ * @example With custom tag props
847
+ * ```tsx
848
+ * import { TagsCell } from "@trackunit/react-table-base-components";
448
849
  *
850
+ * // Simple string tags
851
+ * <TagsCell tags={["Active", "Premium", "Verified"]} />
852
+ *
853
+ * // Tags with custom styling using TagProps
854
+ * <TagsCell
855
+ * tags={[
856
+ * { children: "Active", color: "success" },
857
+ * { children: "Warning", color: "warning" },
858
+ * { children: "Inactive", color: "neutral" },
859
+ * ]}
860
+ * />
861
+ * ```
449
862
  * @param {TagsCellProps} props - The props for the TagsCell component
450
863
  * @returns {ReactElement} TagsCell component
451
864
  */
@@ -502,8 +915,44 @@ const cvaTextCellTooltip = cvaMerge(["grid"]);
502
915
 
503
916
  /**
504
917
  * The `<TextCell>` component is used for displaying text in a table cell.
505
- * The text is not editable and will be truncated if the cell is too narrow.
918
+ * The text is not editable and will be truncated with an ellipsis if the cell is too narrow.
919
+ * When truncated, a tooltip automatically appears on hover showing the full content.
920
+ *
921
+ * ### When to use
922
+ * - Display simple text values in table columns (names, descriptions, statuses)
923
+ * - When text content might be longer than the column width
924
+ * - For read-only text display in data grids
925
+ *
926
+ * ### When not to use
927
+ * - For numeric values - use `NumberCell` instead
928
+ * - For dates and times - use `DateTimeCell` instead
929
+ * - For clickable links - use `LinkCell` or `ButtonCell` instead
930
+ * - For multi-line content - consider `IdentityCell` with details
931
+ *
932
+ * @example Basic usage
933
+ * ```tsx
934
+ * import { TextCell } from "@trackunit/react-table-base-components";
935
+ * import { createColumnHelper } from "@tanstack/react-table";
936
+ *
937
+ * const columnHelper = createColumnHelper<Asset>();
938
+ *
939
+ * const columns = [
940
+ * columnHelper.accessor("name", {
941
+ * header: "Name",
942
+ * cell: ({ getValue }) => <TextCell content={getValue()} />,
943
+ * }),
944
+ * ];
945
+ * ```
946
+ * @example With custom content
947
+ * ```tsx
948
+ * import { TextCell } from "@trackunit/react-table-base-components";
949
+ *
950
+ * // Text content - will show tooltip if truncated
951
+ * <TextCell content="This is a long description that might get truncated" />
506
952
  *
953
+ * // ReactElement content
954
+ * <TextCell content={<span className="font-bold">Bold text</span>} />
955
+ * ```
507
956
  * @param {TextCellProps} props - The props for the TextCell component
508
957
  * @returns {ReactElement} TextCell component
509
958
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-table-base-components",
3
- "version": "1.10.17",
3
+ "version": "1.10.19",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -8,12 +8,12 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "react": "19.0.0",
11
- "@trackunit/react-components": "1.14.17",
12
- "@trackunit/ui-icons": "1.10.14",
13
- "@trackunit/react-form-components": "1.11.17",
14
- "@trackunit/css-class-variance-utilities": "1.10.14",
15
- "@trackunit/date-and-time-utils": "1.10.14",
16
- "@trackunit/shared-utils": "1.12.14",
11
+ "@trackunit/react-components": "1.14.19",
12
+ "@trackunit/ui-icons": "1.10.16",
13
+ "@trackunit/react-form-components": "1.11.19",
14
+ "@trackunit/css-class-variance-utilities": "1.10.16",
15
+ "@trackunit/date-and-time-utils": "1.10.16",
16
+ "@trackunit/shared-utils": "1.12.16",
17
17
  "tailwind-merge": "^2.0.0",
18
18
  "@js-temporal/polyfill": "^0.5.1"
19
19
  },
@@ -2,13 +2,90 @@ import { ButtonCommonProps, IconColors } from "@trackunit/react-components";
2
2
  import { IconName } from "@trackunit/ui-icons";
3
3
  import { ReactNode } from "react";
4
4
  export interface ButtonCellProps extends ButtonCommonProps {
5
+ /**
6
+ * The content to display inside the button, typically the action text.
7
+ */
5
8
  children: ReactNode;
9
+ /**
10
+ * Optional icon name to display before the button text.
11
+ */
6
12
  iconName?: IconName;
13
+ /**
14
+ * Color of the icon when iconName is provided.
15
+ *
16
+ * @default "primary"
17
+ */
7
18
  iconColor?: IconColors;
8
19
  }
9
20
  /**
10
- * The ButtonCell is used to display interactive data in table columns.
21
+ * The `<ButtonCell>` component renders an interactive button within a table cell.
22
+ * Uses a ghost-neutral variant by default for subtle inline actions.
23
+ * Commonly used for quick actions on individual rows without opening a menu.
11
24
  *
25
+ * ### When to use
26
+ * - Provide a single quick action directly in a table cell
27
+ * - When the action is contextual and specific to that row's data
28
+ * - For inline edit, view details, or quick status change actions
29
+ *
30
+ * ### When not to use
31
+ * - For multiple actions per row - use `RowActions` instead
32
+ * - For primary page-level actions - use regular `Button` component
33
+ * - For navigation links - use `LinkCell` or `IdentityCell` with link prop
34
+ *
35
+ * @example Basic usage
36
+ * ```tsx
37
+ * import { ButtonCell } from "@trackunit/react-table-base-components";
38
+ * import { createColumnHelper } from "@tanstack/react-table";
39
+ *
40
+ * const columnHelper = createColumnHelper<Asset>();
41
+ *
42
+ * const columns = [
43
+ * columnHelper.display({
44
+ * id: "action",
45
+ * header: "Action",
46
+ * cell: ({ row }) => (
47
+ * <ButtonCell onClick={() => handleView(row.original.id)}>
48
+ * View Details
49
+ * </ButtonCell>
50
+ * ),
51
+ * }),
52
+ * ];
53
+ * ```
54
+ * @example With icon
55
+ * ```tsx
56
+ * import { ButtonCell } from "@trackunit/react-table-base-components";
57
+ *
58
+ * // Edit action with icon
59
+ * <ButtonCell
60
+ * iconName="PencilSquare"
61
+ * onClick={() => handleEdit(assetId)}
62
+ * >
63
+ * Edit
64
+ * </ButtonCell>
65
+ *
66
+ * // Download action
67
+ * <ButtonCell
68
+ * iconName="ArrowDownTray"
69
+ * iconColor="primary"
70
+ * onClick={() => handleDownload(reportId)}
71
+ * >
72
+ * Download
73
+ * </ButtonCell>
74
+ * ```
75
+ * @example Different button states
76
+ * ```tsx
77
+ * import { ButtonCell } from "@trackunit/react-table-base-components";
78
+ *
79
+ * // Disabled state
80
+ * <ButtonCell disabled onClick={() => {}}>
81
+ * Unavailable
82
+ * </ButtonCell>
83
+ *
84
+ * // Loading state
85
+ * <ButtonCell loading onClick={() => {}}>
86
+ * Processing
87
+ * </ButtonCell>
88
+ * ```
12
89
  * @param {ButtonCellProps} props - The props for the ButtonCell component
13
90
  * @returns {ReactElement} ButtonCell component
14
91
  */