@servicetitan/anvil2 2.0.0 → 2.0.2

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 (139) hide show
  1. package/CHANGELOG.md +120 -68
  2. package/dist/Calendar-BFWJ7Rlq.js +2635 -0
  3. package/dist/Calendar-BFWJ7Rlq.js.map +1 -0
  4. package/dist/{Calendar-D4abBZAq.js → Calendar-BO9QiBJG.js} +2 -2
  5. package/dist/{Calendar-D4abBZAq.js.map → Calendar-BO9QiBJG.js.map} +1 -1
  6. package/dist/Calendar.js +2 -2
  7. package/dist/{Combobox-CeADQxTl.js → Combobox-OUK7p5gp.js} +34 -24
  8. package/dist/Combobox-OUK7p5gp.js.map +1 -0
  9. package/dist/Combobox.js +1 -1
  10. package/dist/{DataTable-CVtDYMKC.js → DataTable-BPJeSvOx.js} +1956 -1324
  11. package/dist/DataTable-BPJeSvOx.js.map +1 -0
  12. package/dist/DataTable.css +82 -80
  13. package/dist/{DateFieldRange-BfdBwpwc.js → DateFieldRange-CanMYRgZ.js} +6 -5
  14. package/dist/{DateFieldRange-BfdBwpwc.js.map → DateFieldRange-CanMYRgZ.js.map} +1 -1
  15. package/dist/DateFieldRange.js +1 -1
  16. package/dist/{DateFieldSingle-CVxnfM5x.js → DateFieldSingle-CShe2aHZ.js} +6 -5
  17. package/dist/{DateFieldSingle-CVxnfM5x.js.map → DateFieldSingle-CShe2aHZ.js.map} +1 -1
  18. package/dist/DateFieldSingle.js +1 -1
  19. package/dist/{DateFieldYearless-CgOOwwTc.js → DateFieldYearless-MBQ233Xa.js} +2 -2
  20. package/dist/{DateFieldYearless-CgOOwwTc.js.map → DateFieldYearless-MBQ233Xa.js.map} +1 -1
  21. package/dist/DateFieldYearless.js +1 -1
  22. package/dist/{DateFieldYearlessRange-D8dQk2WI.js → DateFieldYearlessRange-BBtaFzsE.js} +2 -2
  23. package/dist/{DateFieldYearlessRange-D8dQk2WI.js.map → DateFieldYearlessRange-BBtaFzsE.js.map} +1 -1
  24. package/dist/DateFieldYearlessRange.js +1 -1
  25. package/dist/{ListView-CBmaHOY-.js → ListView-CRDUPrbQ.js} +11 -9
  26. package/dist/ListView-CRDUPrbQ.js.map +1 -0
  27. package/dist/ListView.js +1 -1
  28. package/dist/{Menu-d3w2bIdB.js → Menu-Dh0q__vE.js} +7 -5
  29. package/dist/Menu-Dh0q__vE.js.map +1 -0
  30. package/dist/Menu.js +1 -1
  31. package/dist/{NumberField-r0fRpYa0.js → NumberField-Dmm1YQNn.js} +221 -7
  32. package/dist/NumberField-Dmm1YQNn.js.map +1 -0
  33. package/dist/NumberField.js +1 -1
  34. package/dist/{Page-DR5k0MAR.js → Page-C5nExhiH.js} +117 -13
  35. package/dist/Page-C5nExhiH.js.map +1 -0
  36. package/dist/Page.js +1 -1
  37. package/dist/{Pagination-XPZ5UeBs.js → Pagination-CimQTC7M.js} +3 -3
  38. package/dist/{Pagination-XPZ5UeBs.js.map → Pagination-CimQTC7M.js.map} +1 -1
  39. package/dist/Pagination.css +2 -1
  40. package/dist/Pagination.js +1 -1
  41. package/dist/{Popover-U2Eu7v1Q.js → Popover-CJLSDpgR.js} +9 -8
  42. package/dist/Popover-CJLSDpgR.js.map +1 -0
  43. package/dist/Popover.js +1 -1
  44. package/dist/Table.js +1 -1
  45. package/dist/{TimeField-BX9PovdE.js → TimeField-BeaCSkdZ.js} +3 -3
  46. package/dist/{TimeField-BX9PovdE.js.map → TimeField-BeaCSkdZ.js.map} +1 -1
  47. package/dist/TimeField.js +1 -1
  48. package/dist/{Toolbar-BWqguBF1.js → Toolbar-Cjo7eAhI.js} +8 -8
  49. package/dist/{Toolbar-BWqguBF1.js.map → Toolbar-Cjo7eAhI.js.map} +1 -1
  50. package/dist/Toolbar.js +1 -1
  51. package/dist/{YearlessDateInputWithPicker-uG9QMemw.js → YearlessDateInputWithPicker-BVRZlf9Y.js} +3 -3
  52. package/dist/{YearlessDateInputWithPicker-uG9QMemw.js.map → YearlessDateInputWithPicker-BVRZlf9Y.js.map} +1 -1
  53. package/dist/beta/components/Table/DataTable/DataTable.d.ts +8 -10
  54. package/dist/beta/components/Table/DataTable/DataTable.test-data.d.ts +2 -0
  55. package/dist/beta/components/Table/DataTable/internal/DataTableBody.d.ts +6 -1
  56. package/dist/beta/components/Table/DataTable/internal/DataTableBodyRow.d.ts +9 -0
  57. package/dist/beta/components/Table/DataTable/internal/DataTablePagination.d.ts +1 -1
  58. package/dist/beta/components/Table/DataTable/internal/cells/CellError.d.ts +10 -0
  59. package/dist/beta/components/Table/DataTable/internal/cells/CellFocusContext.d.ts +16 -0
  60. package/dist/beta/components/Table/DataTable/internal/cells/DataTableBodyCell.d.ts +19 -37
  61. package/dist/beta/components/Table/DataTable/internal/cells/DataTableBodyImmutableCell.d.ts +32 -0
  62. package/dist/beta/components/Table/DataTable/internal/cells/DataTableBodyMutableCell.d.ts +33 -0
  63. package/dist/beta/components/Table/DataTable/internal/cells/DataTableFooterCell.d.ts +2 -0
  64. package/dist/beta/components/Table/DataTable/internal/cells/DataTableHeaderCell.d.ts +1 -0
  65. package/dist/beta/components/Table/DataTable/internal/constants.d.ts +13 -0
  66. package/dist/beta/components/Table/DataTable/internal/context/focus/DTFocusContext.d.ts +57 -0
  67. package/dist/beta/components/Table/DataTable/internal/context/focus/DTFocusProvider.d.ts +9 -0
  68. package/dist/beta/components/Table/DataTable/internal/context/focus/useDTFocusDispatchContext.d.ts +11 -0
  69. package/dist/beta/components/Table/DataTable/internal/context/focus/useDTFocusStateContext.d.ts +1 -0
  70. package/dist/beta/components/Table/DataTable/internal/context/hover/DTHoverContext.d.ts +31 -0
  71. package/dist/beta/components/Table/DataTable/internal/context/hover/DTHoverProvider.d.ts +3 -0
  72. package/dist/beta/components/Table/DataTable/internal/context/hover/useDTHoverDispatchContext.d.ts +1 -0
  73. package/dist/beta/components/Table/DataTable/internal/context/hover/useDTHoverStateContext.d.ts +4 -0
  74. package/dist/beta/components/Table/DataTable/internal/editable-cells/DataTableEditableMultiselectCell.d.ts +19 -23
  75. package/dist/beta/components/Table/DataTable/internal/editable-cells/DataTableEditableSelectCell.d.ts +6 -25
  76. package/dist/beta/components/Table/DataTable/internal/editable-cells/DataTableEditableTextCell.d.ts +7 -17
  77. package/dist/beta/components/Table/DataTable/internal/editable-cells/types.d.ts +29 -37
  78. package/dist/beta/components/Table/DataTable/internal/util/cellPositionHelpers.d.ts +6 -0
  79. package/dist/beta/components/Table/DataTable/internal/util/cellTypeHelpers.d.ts +42 -0
  80. package/dist/beta/components/Table/{internal → DataTable/internal/util}/getTanStackColumnDef.d.ts +14 -6
  81. package/dist/beta/components/Table/DataTable/stories/DataTable.story-data.d.ts +4 -2
  82. package/dist/beta/components/Table/DataTable/types.d.ts +21 -0
  83. package/dist/beta/components/Table/base/TableContainer.d.ts +3 -14
  84. package/dist/beta/components/Table/createColumnHelper.d.ts +119 -13
  85. package/dist/beta/components/Table/formatters/booleanFormatter.d.ts +22 -0
  86. package/dist/beta/components/Table/formatters/currencyFormatter.d.ts +2 -2
  87. package/dist/beta/components/Table/formatters/dateFormatter.d.ts +34 -0
  88. package/dist/beta/components/Table/formatters/dateTimeFormatter.d.ts +66 -0
  89. package/dist/beta/components/Table/formatters/index.d.ts +7 -0
  90. package/dist/beta/components/Table/formatters/numberFormatter.d.ts +42 -0
  91. package/dist/beta/components/Table/formatters/percentFormatter.d.ts +1 -1
  92. package/dist/beta/components/Table/formatters/presets.d.ts +16 -0
  93. package/dist/beta/components/Table/formatters/timeFormatter.d.ts +28 -0
  94. package/dist/beta/components/Table/formatters/yearlessDateFormatter.d.ts +32 -0
  95. package/dist/beta/components/Table/internal/ResizeHandle.d.ts +2 -1
  96. package/dist/beta/components/Table/internal/getCommonPinningStyles.d.ts +1 -0
  97. package/dist/beta/components/Table/internal/scrollCellIntoView.d.ts +13 -0
  98. package/dist/beta/components/Table/internal/types.d.ts +13 -0
  99. package/dist/beta/components/Table/types.d.ts +52 -8
  100. package/dist/beta.js +4 -4
  101. package/dist/components/DateFieldRange/internal/MaskedDateRangeInput.d.ts +1 -1
  102. package/dist/components/DateFieldSingle/internal/MaskedDateInput.d.ts +1 -1
  103. package/dist/components/Page/Page.d.ts +9 -2
  104. package/dist/components/Page/PageHeader.d.ts +13 -4
  105. package/dist/components/Popover/internal/PopoverContext.d.ts +0 -1
  106. package/dist/components/Popover/internal/usePopoverContext.d.ts +0 -1
  107. package/dist/components/SearchField/SearchField.d.ts +1 -1
  108. package/dist/edit-DQOiktcu.js +6 -0
  109. package/dist/edit-DQOiktcu.js.map +1 -0
  110. package/dist/{index.esm-C2ZhC_8d.js → index.esm-BMOZFPwN.js} +2 -2
  111. package/dist/{index.esm-C2ZhC_8d.js.map → index.esm-BMOZFPwN.js.map} +1 -1
  112. package/dist/index.js +13 -13
  113. package/dist/internal/hooks/useNumberField/internal/createNumberMaskOptions.d.ts +10 -0
  114. package/dist/internal/hooks/useNumberField/internal/createTrailingDecimalHandlers.d.ts +13 -0
  115. package/dist/internal/hooks/useNumberField/internal/createTrailingZerosHandlers.d.ts +16 -0
  116. package/dist/internal/hooks/useNumberField/internal/numberMaskUtils.d.ts +9 -0
  117. package/dist/{Calendar-BEwWBsCE.js → luxon-wpz4A-OQ.js} +3 -2635
  118. package/dist/luxon-wpz4A-OQ.js.map +1 -0
  119. package/dist/{utils-CcMJa47q.js → utils-Cj6v6CZ-.js} +2 -2
  120. package/dist/{utils-CcMJa47q.js.map → utils-Cj6v6CZ-.js.map} +1 -1
  121. package/package.json +1 -1
  122. package/dist/Calendar-BEwWBsCE.js.map +0 -1
  123. package/dist/Combobox-CeADQxTl.js.map +0 -1
  124. package/dist/DataTable-CVtDYMKC.js.map +0 -1
  125. package/dist/ListView-CBmaHOY-.js.map +0 -1
  126. package/dist/Menu-d3w2bIdB.js.map +0 -1
  127. package/dist/NumberField-r0fRpYa0.js.map +0 -1
  128. package/dist/Page-DR5k0MAR.js.map +0 -1
  129. package/dist/Popover-U2Eu7v1Q.js.map +0 -1
  130. package/dist/beta/components/Table/DataTable/internal/DataTableContainer.d.ts +0 -7
  131. package/dist/beta/components/Table/DataTable/internal/DataTableContext.d.ts +0 -25
  132. package/dist/beta/components/Table/DataTable/internal/DataTableContextProvider.d.ts +0 -28
  133. package/dist/beta/components/Table/DataTable/internal/editable-cells/useEditCell.d.ts +0 -11
  134. package/dist/beta/components/Table/DataTable/internal/useDataTableContext.d.ts +0 -4
  135. package/dist/beta/components/Table/internal/focus-management/types.d.ts +0 -34
  136. package/dist/beta/components/Table/internal/focus-management/useFocusManagement.d.ts +0 -27
  137. package/dist/beta/components/Table/internal/focus-management/useHandleKeyDown.d.ts +0 -36
  138. package/dist/beta/components/Table/internal/focus-management/useScrollIntoView.d.ts +0 -9
  139. /package/dist/beta/components/Table/{internal/focus-management → DataTable/internal}/useColumnOrder.d.ts +0 -0
@@ -0,0 +1,33 @@
1
+ import { DataTableBodyCellProps as BaseDataTableBodyCellProps } from '../../../base/cells/TableBodyCell';
2
+ import { Cell } from '@tanstack/react-table';
3
+ import { CellPosition } from '../../../internal/types';
4
+ /**
5
+ * Props for the DataTableBodyMutableCell component
6
+ */
7
+ export type DataTableBodyMutableCellProps<T> = Omit<BaseDataTableBodyCellProps, "onChange"> & {
8
+ /**
9
+ * The position of the cell in the table
10
+ */
11
+ cellPosition: CellPosition;
12
+ /**
13
+ * The TanStack table cell instance
14
+ */
15
+ cell: Cell<T, unknown>;
16
+ /**
17
+ * Whether the cell is currently hovered
18
+ */
19
+ isHovered: boolean;
20
+ };
21
+ /**
22
+ * Renders a mutable (editable) body cell in a DataTable. This component handles keyboard navigation
23
+ * and delegates to the appropriate editable cell component (text, select, or multiselect) based on
24
+ * the column's editMode configuration.
25
+ *
26
+ * @param props - The props for the DataTableBodyMutableCell component
27
+ * @param props.cell - The TanStack table cell instance
28
+ * @param props.cellPosition - The position of the cell in the table
29
+ * @param props.children - The content to render in the cell
30
+ * @param props.isHovered - Whether the cell is currently hovered
31
+ * @returns The rendered editable cell component or null if no editMode is configured
32
+ */
33
+ export declare function DataTableBodyMutableCell<T>(props: DataTableBodyMutableCellProps<T>): import("react/jsx-runtime").JSX.Element | null;
@@ -14,5 +14,7 @@ export type DataTableFooterCellProps = BaseDataTableFooterCellProps & {
14
14
  * @param props - The props for the DataTableFooterCell component
15
15
  * @param props.cellPosition - The cell position of the cell
16
16
  * @param props.children - The children of the DataTableFooterCell component
17
+ * @param props.className - The class name of the DataTableFooterCell component
18
+ * @param props.tabIndex - The tab index of the cell
17
19
  */
18
20
  export declare function DataTableFooterCell(props: DataTableFooterCellProps): import("react/jsx-runtime").JSX.Element;
@@ -18,6 +18,7 @@ export type DataTableHeaderCellProps<T> = BaseDataTableHeaderCellProps & {
18
18
  * @param props.cellPosition - The cell position of the cell
19
19
  * @param props.children - The children of the DataTableHeaderCell component
20
20
  * @param props.header - The header of the DataTableHeaderCell component
21
+ * @param props.isFocused - Whether the cell is focused
21
22
  */
22
23
  declare function DataTableHeaderCellInner<T>(props: DataTableHeaderCellProps<T>, forwardedRef: Ref<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
23
24
  /**
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Internal column ID for the primary row action column.
3
+ * This column typically contains expand buttons, but may also contain
4
+ * checkboxes for nested rows when selection is enabled.
5
+ */
6
+ export declare const INTERNAL_ROW_ACTION_PRIMARY_COLUMN_ID = "a2-table-internal-row-action-primary";
7
+ /**
8
+ * Internal column ID for the secondary row action column.
9
+ * This column contains checkboxes for row selection when enabled.
10
+ * For nested rows, this column renders nothing (selection is handled
11
+ * in the primary action column instead).
12
+ */
13
+ export declare const INTERNAL_ROW_ACTION_SECONDARY_COLUMN_ID = "a2-table-internal-row-action-secondary";
@@ -0,0 +1,57 @@
1
+ import { CellPosition } from '../../../../internal/types';
2
+ export type DTFocusState = {
3
+ /**
4
+ * The currently focused cell or null if no cell is focused
5
+ */
6
+ focusedCell: CellPosition | null;
7
+ /**
8
+ * The last focused cell when the table was blurred or { rowIndex: 0, columnIndex: 0 } if never focused
9
+ */
10
+ focusRestorePoint: CellPosition;
11
+ /**
12
+ * Whether the focus has been disrupted by a sub component
13
+ */
14
+ hasFocusBeenDisrupted: boolean;
15
+ };
16
+ export type DTFocusStateContextValue = {
17
+ getFocusedCell: () => CellPosition | null;
18
+ };
19
+ export type DTFocusCellAction = {
20
+ type: "FOCUS_CELL";
21
+ payload: {
22
+ cellPosition: CellPosition;
23
+ };
24
+ };
25
+ export type DTFocusTableAction = {
26
+ type: "FOCUS_TABLE";
27
+ };
28
+ export type DTFocusMoveAction = {
29
+ type: "MOVE_FOCUS";
30
+ payload: {
31
+ direction: "up" | "down" | "left" | "right";
32
+ };
33
+ };
34
+ export type DTFocusJumpAction = {
35
+ type: "JUMP_FOCUS";
36
+ payload: {
37
+ direction: "up" | "down" | "left" | "right";
38
+ };
39
+ };
40
+ export type DTFocusCellManuallyAction = {
41
+ type: "FOCUS_CELL_MANUALLY";
42
+ payload: {
43
+ cellPosition: CellPosition;
44
+ };
45
+ };
46
+ export type DTBlurAction = {
47
+ type: "BLUR";
48
+ };
49
+ export type DTFocusSubComponentAction = {
50
+ type: "FOCUS_SUB_COMPONENT";
51
+ };
52
+ export type DTFocusSubComponentBlurAction = {
53
+ type: "BLUR_SUB_COMPONENT";
54
+ };
55
+ export type DTFocusAction = DTFocusCellAction | DTFocusTableAction | DTFocusMoveAction | DTFocusJumpAction | DTBlurAction | DTFocusSubComponentAction | DTFocusSubComponentBlurAction | DTFocusCellManuallyAction;
56
+ export declare const DTFocusStateContext: import('react').Context<DTFocusStateContextValue>;
57
+ export declare const DTFocusDispatchContext: import('react').Context<import('react').Dispatch<DTFocusAction>>;
@@ -0,0 +1,9 @@
1
+ export interface DTFocusProviderProps {
2
+ children: React.ReactNode;
3
+ rowCount: number;
4
+ columnCount: number;
5
+ tableRef: React.RefObject<HTMLDivElement>;
6
+ leftPinnedWidth: number;
7
+ rightPinnedWidth: number;
8
+ }
9
+ export declare function DTFocusProvider({ children, rowCount, columnCount, tableRef, leftPinnedWidth, rightPinnedWidth, }: DTFocusProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { CellPosition } from '../../../../internal/types';
2
+ export declare function useDTFocusDispatchContext(): {
3
+ focusTableGenerally: () => void;
4
+ moveFocusToCell: (cellPosition: CellPosition) => void;
5
+ moveFocus: (direction: "up" | "down" | "left" | "right") => void;
6
+ jumpFocus: (direction: "up" | "down" | "left" | "right") => void;
7
+ blur: () => void;
8
+ focusSubComponent: () => void;
9
+ blurSubComponent: () => void;
10
+ dispatch: import('react').Dispatch<import('./DTFocusContext').DTFocusAction>;
11
+ };
@@ -0,0 +1 @@
1
+ export declare function useDTFocusStateContext(): import('./DTFocusContext').DTFocusStateContextValue;
@@ -0,0 +1,31 @@
1
+ export type DTHoverState = {
2
+ hoveredColumnId: string | null;
3
+ resizingColumnId: string | null;
4
+ };
5
+ export type DTHoverStartAction = {
6
+ type: "HOVER_START";
7
+ payload: {
8
+ columnId: string;
9
+ };
10
+ };
11
+ export type DTHoverEndAction = {
12
+ type: "HOVER_END";
13
+ payload: {
14
+ columnId: string;
15
+ };
16
+ };
17
+ export type DTResizeStartAction = {
18
+ type: "RESIZE_START";
19
+ payload: {
20
+ columnId: string;
21
+ };
22
+ };
23
+ export type DTResizeEndAction = {
24
+ type: "RESIZE_END";
25
+ payload: {
26
+ columnId: string;
27
+ };
28
+ };
29
+ export type DTHoverAction = DTHoverStartAction | DTHoverEndAction | DTResizeStartAction | DTResizeEndAction;
30
+ export declare const DTHoverStateContext: import('react').Context<DTHoverState>;
31
+ export declare const DTHoverDispatchContext: import('react').Context<import('react').Dispatch<DTHoverAction>>;
@@ -0,0 +1,3 @@
1
+ export declare function DTHoverProvider({ children }: {
2
+ children: React.ReactNode;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function useDTHoverDispatchContext(): import('react').Dispatch<import('./DTHoverContext').DTHoverAction>;
@@ -0,0 +1,4 @@
1
+ export declare function useDTHoverStateContext(): {
2
+ getIsHovered: (columnId: string) => boolean;
3
+ hoveredColumnId: string | null;
4
+ };
@@ -1,26 +1,22 @@
1
- import { DataTableEditableCellProps } from './types';
1
+ import { EditableCellImperativeHandle, BaseEditableCellProps } from './types';
2
+ export type DataTableEditableMultiselectCellProps<T> = BaseEditableCellProps<T>;
2
3
  /**
3
- * Props for the DataTableEditableMultiselectCell component
4
- * @extends DataTableEditableCellProps<string[]>
5
- */
6
- export type DataTableEditableMultiselectCellProps = DataTableEditableCellProps<string[]> & {
7
- /**
8
- * The options available for selection
9
- */
10
- options: {
11
- value: string;
12
- label: string;
13
- }[];
14
- };
15
- /**
16
- * Editable multiselect cell for data tables
4
+ * Renders an editable multiselect cell in a DataTable. This component provides a popover with a
5
+ * searchable list that appears when the cell is activated, allowing users to select multiple values
6
+ * from a list of options. Supports keyboard navigation, search filtering, and commit/cancel operations.
7
+ *
17
8
  * @param props - The props for the DataTableEditableMultiselectCell component
18
- * @param props.cellProps - The props for the DataTableEditableMultiselectCell component
19
- * @param props.children - The children of the DataTableEditableMultiselectCell component
20
- * @param props.rowId - The row id of the DataTableEditableMultiselectCell component
21
- * @param props.onChange - Called when the cell value is saved (on blur or enter/F2 key pressed)
22
- * @param props.cellPosition - The cell position of the DataTableEditableMultiselectCell component
23
- * @param props.value - The value of the DataTableEditableMultiselectCell component
24
- * @param props.options - The options available for selection
9
+ * @param props.cell - The TanStack table cell instance
10
+ * @param props.cellProps - Props for styling and event handling of the cell container
11
+ * @param props.cellPosition - The position of the cell in the table
12
+ * @param props.children - The content to display when not editing
13
+ * @param props.isHovered - Whether the cell is currently hovered
14
+ * @param ref - Ref to the imperative handle for programmatic control
15
+ * @returns The rendered editable multiselect cell component
25
16
  */
26
- export declare const DataTableEditableMultiselectCell: ({ cellProps, children, rowId, onChange, cellPosition, value, options, }: DataTableEditableMultiselectCellProps) => import("react/jsx-runtime").JSX.Element;
17
+ export declare function DataTableEditableMultiselectCellInner<T>(props: DataTableEditableMultiselectCellProps<T>, ref: React.Ref<EditableCellImperativeHandle>): import("react/jsx-runtime").JSX.Element;
18
+ export declare const DataTableEditableMultiselectCell: (<T>(props: DataTableEditableMultiselectCellProps<T> & {
19
+ ref?: React.Ref<EditableCellImperativeHandle>;
20
+ }) => React.ReactElement) & {
21
+ displayName: string;
22
+ };
@@ -1,26 +1,7 @@
1
- import { DataTableEditableCellProps } from './types';
2
- /**
3
- * Props for the DataTableEditableSelectCell component
4
- * @extends DataTableEditableCellProps<string>
5
- */
6
- export type DataTableEditableSelectCellProps = DataTableEditableCellProps<string> & {
7
- /**
8
- * The options available for selection
9
- */
10
- options: {
11
- value: string;
12
- label: string;
13
- }[];
1
+ import { EditableCellImperativeHandle, BaseEditableCellProps } from './types';
2
+ export type DataTableEditableSelectCellProps<T> = BaseEditableCellProps<T>;
3
+ export declare const DataTableEditableSelectCell: (<T>(props: DataTableEditableSelectCellProps<T> & {
4
+ ref?: React.Ref<EditableCellImperativeHandle>;
5
+ }) => React.ReactElement) & {
6
+ displayName: string;
14
7
  };
15
- /**
16
- * Editable select cell for data tables
17
- * @param props - The props for the DataTableEditableSelectCell component
18
- * @param props.cellProps - The props for the DataTableEditableSelectCell component
19
- * @param props.children - The children of the DataTableEditableSelectCell component
20
- * @param props.rowId - The row id of the DataTableEditableSelectCell component
21
- * @param props.onChange - Called when the cell value is saved (on blur or enter/F2 key pressed)
22
- * @param props.cellPosition - The cell position of the DataTableEditableSelectCell component
23
- * @param props.value - The value of the DataTableEditableSelectCell component
24
- * @param props.options - The options available for selection
25
- */
26
- export declare const DataTableEditableSelectCell: ({ cellProps, children, rowId, onChange, cellPosition, value, options, }: DataTableEditableSelectCellProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,17 +1,7 @@
1
- import { DataTableEditableCellProps } from './types';
2
- /**
3
- * Props for the DataTableEditableTextCell component
4
- * @extends DataTableEditableCellProps<string>
5
- */
6
- export type DataTableEditableTextCellProps = DataTableEditableCellProps<string>;
7
- /**
8
- * Editable text cell for data tables
9
- * @param props - The props for the DataTableEditableTextCell component
10
- * @param props.cellProps - The props for the DataTableEditableTextCell component
11
- * @param props.children - The children of the DataTableEditableTextCell component
12
- * @param props.rowId - The row id of the DataTableEditableTextCell component
13
- * @param props.onChange - Called when the cell value is saved (on blur or enter/F2 key pressed)
14
- * @param props.cellPosition - The cell position of the DataTableEditableTextCell component
15
- * @param props.value - The value of the DataTableEditableTextCell component
16
- */
17
- export declare const DataTableEditableTextCell: ({ cellProps, children, rowId, onChange, cellPosition, value, }: DataTableEditableTextCellProps) => import("react/jsx-runtime").JSX.Element;
1
+ import { EditableCellImperativeHandle, BaseEditableCellProps } from './types';
2
+ export type DataTableEditableTextCellProps<T> = BaseEditableCellProps<T>;
3
+ export declare const DataTableEditableTextCell: (<T>(props: DataTableEditableTextCellProps<T> & {
4
+ ref?: React.Ref<EditableCellImperativeHandle>;
5
+ }) => React.ReactElement) & {
6
+ displayName: string;
7
+ };
@@ -1,50 +1,42 @@
1
- import { Ref } from 'react';
2
- import { TableBodyCellProps } from '../../../base/cells/TableBodyCell';
3
- import { CellPosition } from '../../../internal/focus-management/types';
1
+ import { DataTableBodyCellProps } from '../../../base/cells/TableBodyCell';
2
+ import { CellPosition } from '../../../internal/types';
3
+ import { Cell } from '@tanstack/react-table';
4
4
  /**
5
- * Props for the useEditCell hook
6
- * @extends Pick<UseEditCellProps<T>, "onChange" | "cellPosition" | "rowId">
5
+ * Imperative handle for editable cell components, allowing programmatic control
6
+ * of editing state and focus management
7
7
  */
8
- export type UseEditCellProps<T> = {
8
+ export type EditableCellImperativeHandle = {
9
+ invoke: () => void;
10
+ focus: () => void;
11
+ };
12
+ /**
13
+ * Props passed to editable cells for styling and event handling
14
+ * This is a subset of DataTableBodyCellProps containing only the properties
15
+ * that are actually used by editable cell components
16
+ */
17
+ export type EditableCellCellProps = Pick<DataTableBodyCellProps, "className" | "onKeyDown" | "style">;
18
+ /**
19
+ * Base props shared by all editable cell components
20
+ */
21
+ export type BaseEditableCellProps<T> = {
9
22
  /**
10
- * The initial value of the cell
23
+ * The TanStack table cell instance
11
24
  */
12
- initialValue: T;
25
+ cell: Cell<T, unknown>;
13
26
  /**
14
- * Called when the cell value is saved (on blur or enter/F2 key pressed)
27
+ * Props for styling and event handling of the cell container
15
28
  */
16
- onChange: (value: T, rowId: string) => void;
29
+ cellProps: EditableCellCellProps;
17
30
  /**
18
- * The cell position of the cell
31
+ * The position of the cell in the table
19
32
  */
20
33
  cellPosition: CellPosition;
21
34
  /**
22
- * The row id of the cell
35
+ * The children to render in the cell
23
36
  */
24
- rowId: string;
25
- };
26
- /**
27
- * Return type for the useEditCell hook
28
- * @extends Pick<UseEditCellProps<T>, "onChange" | "cellPosition" | "rowId">
29
- */
30
- export type UseEditCellReturn<T> = {
31
- isEditing: boolean;
32
- editValue: T;
33
- updateEditValue: (editValue: T) => void;
34
- saveValue: () => void;
35
- cancelEdit: () => void;
36
- onClick: () => void;
37
- onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
38
- onBlur: () => void;
39
- };
40
- /**
41
- * Common props for the editable cells in data tables
42
- * @extends Pick<UseEditCellProps<T>, "onChange" | "cellPosition" | "rowId">
43
- */
44
- export type DataTableEditableCellProps<T> = Pick<UseEditCellProps<T>, "onChange" | "cellPosition" | "rowId"> & {
45
- cellProps: TableBodyCellProps & {
46
- ref: Ref<HTMLDivElement>;
47
- };
48
37
  children: React.ReactNode;
49
- value: T;
38
+ /**
39
+ * Whether the cell is currently hovered
40
+ */
41
+ isHovered: boolean;
50
42
  };
@@ -0,0 +1,6 @@
1
+ import { CellPosition } from '../../../internal/types';
2
+ export declare function formatCellPositionString(cellPosition: CellPosition): string;
3
+ /**
4
+ * Checks if two cell positions are equal.
5
+ */
6
+ export declare function areCellPositionsEqual(pos1: CellPosition | null | undefined, pos2: CellPosition | null | undefined): boolean;
@@ -0,0 +1,42 @@
1
+ import { Cell } from '@tanstack/react-table';
2
+ /**
3
+ * Extracts the column ID from a cell, with proper type narrowing.
4
+ * Uses the stored ColumnDef from meta if available, otherwise falls back to column.id.
5
+ *
6
+ * @param cell - The TanStack table cell instance
7
+ * @returns The column ID as a keyof T
8
+ */
9
+ export declare function getColumnId<T>(cell: Cell<T, unknown>): keyof T;
10
+ /**
11
+ * Gets the cell value with proper type narrowing based on column ID.
12
+ * Uses the column ID to narrow the return type from `unknown` to `T[K]`.
13
+ *
14
+ * @param cell - The TanStack table cell instance
15
+ * @param _columnId - The column ID to use for type narrowing (unused at runtime, only for TypeScript)
16
+ * @returns The cell value, typed as T[K]
17
+ */
18
+ export declare function getCellValue<T, K extends keyof T>(cell: Cell<T, unknown>, _columnId: K): T[K];
19
+ /**
20
+ * Gets the onChange callback with proper typing based on column ID.
21
+ * Returns a callback that accepts T[K] instead of the union type T[keyof T].
22
+ *
23
+ * @param cell - The TanStack table cell instance
24
+ * @param _columnId - The column ID to use for type narrowing (unused at runtime, only for TypeScript)
25
+ * @returns The onChange callback, typed to accept T[K], or undefined if not configured
26
+ */
27
+ export declare function getCellOnChange<T, K extends keyof T>(cell: Cell<T, unknown>, _columnId: K): ((value: T[K], rowId: string) => void) | undefined;
28
+ /**
29
+ * Logs a warning when a cell value type doesn't match the expected type for its editMode.
30
+ *
31
+ * @param params - The warning parameters
32
+ * @param params.columnId - The column ID for the warning message
33
+ * @param params.editMode - The editMode of the column
34
+ * @param params.expectedType - The expected type description
35
+ * @param params.receivedType - The actual type received
36
+ */
37
+ export declare function logWarningForInvalidCellValueType({ columnId, editMode, expectedType, receivedType, }: {
38
+ columnId: string;
39
+ editMode: string;
40
+ expectedType: string;
41
+ receivedType: string;
42
+ }): void;
@@ -1,24 +1,32 @@
1
1
  import { ColumnDef as TanstackColumnDef } from '@tanstack/react-table';
2
- import { ColumnDef } from '../types';
2
+ import { ColumnDef } from '../../../types';
3
3
  declare module "@tanstack/react-table" {
4
4
  interface ColumnMeta<TData, TValue> {
5
5
  editMode?: ColumnDef<TData>["editMode"];
6
6
  onChange?: ColumnDef<TData>["onChange"];
7
7
  options?: ColumnDef<TData>["options"];
8
+ /**
9
+ * The original column definition, stored for type narrowing and runtime access
10
+ */
11
+ columnDef?: ColumnDef<TData>;
8
12
  }
9
13
  }
10
14
  /**
11
15
  * Props for the getTanStackColumnDef function
12
- * @extends ColumnDef<T>
13
16
  */
14
17
  export type TanStackColumnDefProps<T> = {
18
+ /**
19
+ * The column definition to convert to a TanStack column definition
20
+ */
15
21
  columnDef: ColumnDef<T>;
16
22
  };
17
23
  /**
18
- * Build the column definition for TanStack useReactTable
19
- * This allows for customized column definitions that maintain type safety
24
+ * Build the column definition for TanStack useReactTable.
25
+ * This converts our ColumnDef<T> to TanStack's column definition format,
26
+ * preserving the original column definition in meta for type narrowing.
27
+ *
20
28
  * @param props - The props for the getTanStackColumnDef function
21
- * @param props.columnDef - The column definition for the TanStack useReactTable
22
- * @returns The column definition for the TanStack useReactTable
29
+ * @param props.columnDef - The column definition to convert
30
+ * @returns The column definition for TanStack useReactTable
23
31
  */
24
32
  export declare function getTanStackColumnDef<T>({ columnDef, }: TanStackColumnDefProps<T>): TanstackColumnDef<T, any>;
@@ -12,6 +12,7 @@ export type TableStoryData = {
12
12
  };
13
13
  export declare const data: TableRow<TableStoryData>[];
14
14
  export declare const expandedRowData: TableRow<TableStoryData>[];
15
+ export declare const deepExpandedRowData: TableRow<TableStoryData>[];
15
16
  export declare const subComponentsData: TableRow<TableStoryData>[];
16
17
  export declare const primaryColumns: import('../..').ColumnDef<TableStoryData>[];
17
18
  export declare const groupedColumns: import('../..').ColumnDef<TableStoryData>[];
@@ -19,8 +20,9 @@ export declare const columnsWithMaxWidth: import('../..').ColumnDef<TableStoryDa
19
20
  export declare const columnsWithoutFooter: import('../..').ColumnDef<TableStoryData>[];
20
21
  export type Category = "electronics" | "clothing" | "home" | "garden" | "other";
21
22
  export type EditableTableStoryData = {
22
- id: string;
23
- status?: Status[];
23
+ id?: string;
24
+ note?: string;
25
+ status?: Status;
24
26
  payment_type: "credit_card" | "cash" | "bank_transfer" | "check" | "paypal";
25
27
  categories: Category[];
26
28
  };
@@ -8,6 +8,15 @@ export type DataTablePaginationConfig<T> = {
8
8
  * @default 25
9
9
  */
10
10
  rowsPerPage?: number;
11
+ /**
12
+ * Available options for rows per page selection
13
+ * @default [25, 50, 100]
14
+ */
15
+ rowsPerPageOptions?: number[];
16
+ /**
17
+ * Callback when rows per page changes
18
+ */
19
+ onRowsPerPageChange?: (rowsPerPage: number) => void;
11
20
  /**
12
21
  * Current page index (0-based)
13
22
  */
@@ -47,3 +56,15 @@ export type DataTablePaginationConfig<T> = {
47
56
  */
48
57
  refreshKey?: string | number;
49
58
  };
59
+ /**
60
+ * Ref handle for DataTable component
61
+ * @property {function} refresh - Triggers a data refetch and resets the page index to 0. Useful for manually refreshing data after external changes (e.g., after a mutation).
62
+ */
63
+ export type DataTableRef = {
64
+ /**
65
+ * Triggers a data refetch and resets the page index to 0.
66
+ * Useful for manually refreshing data after external changes (e.g., after a mutation).
67
+ * When using controlled pagination, this will call `onPageChange(0)`.
68
+ */
69
+ refresh: () => void;
70
+ };
@@ -5,24 +5,13 @@ import { LayoutUtilProps } from '../../../../types';
5
5
  * @extends LayoutUtilProps
6
6
  * @extends ComponentPropsWithoutRef<"div">
7
7
  */
8
- export type TableContainerProps = LayoutUtilProps & ComponentPropsWithoutRef<"div"> & {
9
- /**
10
- * The background color of the table container
11
- */
12
- background?: "default" | "strong";
13
- };
8
+ export type TableContainerProps = LayoutUtilProps & ComponentPropsWithoutRef<"div">;
14
9
  /**
15
- * Styled container for tables that includes a scroll container and a background color
10
+ * Styled container for tables that includes a scroll container and provides consistent background and border treatment
16
11
  * @param props - The props for the TableContainer component
17
12
  * @param props.children - The children of the TableContainer component
18
13
  * @param props.className - The class name of the TableContainer component
19
14
  * @param props.style - The style of the TableContainer component
20
- * @param props.background - The background color of the table container
21
15
  * @param props.ref - The ref of the TableContainer component
22
16
  */
23
- export declare const TableContainer: import('react').ForwardRefExoticComponent<LayoutUtilProps & Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
24
- /**
25
- * The background color of the table container
26
- */
27
- background?: "default" | "strong";
28
- } & import('react').RefAttributes<HTMLDivElement>>;
17
+ export declare const TableContainer: import('react').ForwardRefExoticComponent<LayoutUtilProps & Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;