@servicetitan/anvil2 1.46.9 → 1.46.10

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 (170) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/{AnvilProvider-C_qRQnE6.js → AnvilProvider-DkHInQRh.js} +2 -2
  3. package/dist/{AnvilProvider-C_qRQnE6.js.map → AnvilProvider-DkHInQRh.js.map} +1 -1
  4. package/dist/AnvilProvider.js +1 -1
  5. package/dist/{Calendar-BopUjnAk.js → Calendar-DaVJ96Hp.js} +14 -3
  6. package/dist/{Calendar-BopUjnAk.js.map → Calendar-DaVJ96Hp.js.map} +1 -1
  7. package/dist/Calendar.js +2 -2
  8. package/dist/Calendar.js.map +1 -1
  9. package/dist/{Checkbox-DAODkzN3.js → Checkbox-B5VTqylq.js} +2 -2
  10. package/dist/{Checkbox-DAODkzN3.js.map → Checkbox-B5VTqylq.js.map} +1 -1
  11. package/dist/{Checkbox-C5PX8wur.js → Checkbox-Dv01A09v.js} +2 -2
  12. package/dist/{Checkbox-C5PX8wur.js.map → Checkbox-Dv01A09v.js.map} +1 -1
  13. package/dist/Checkbox.js +2 -2
  14. package/dist/{Combobox-D4Q9NeVP.js → Combobox-C9-VQHxv.js} +4 -4
  15. package/dist/{Combobox-D4Q9NeVP.js.map → Combobox-C9-VQHxv.js.map} +1 -1
  16. package/dist/Combobox.js +1 -1
  17. package/dist/DataTable-B17y3l8v.js +5640 -0
  18. package/dist/DataTable-B17y3l8v.js.map +1 -0
  19. package/dist/DataTable.css +648 -0
  20. package/dist/{DateField-B1AdxJKt.js → DateField-CKI7Zk4E.js} +5 -5
  21. package/dist/{DateField-B1AdxJKt.js.map → DateField-CKI7Zk4E.js.map} +1 -1
  22. package/dist/DateField.js +1 -1
  23. package/dist/{DateFieldRange-DiNR5bJ6.js → DateFieldRange-DIycPI0Y.js} +5 -5
  24. package/dist/{DateFieldRange-DiNR5bJ6.js.map → DateFieldRange-DIycPI0Y.js.map} +1 -1
  25. package/dist/DateFieldRange.js +1 -1
  26. package/dist/{DateFieldSingle-CTYbquGi.js → DateFieldSingle-BdkVUPvB.js} +5 -5
  27. package/dist/{DateFieldSingle-CTYbquGi.js.map → DateFieldSingle-BdkVUPvB.js.map} +1 -1
  28. package/dist/DateFieldSingle.js +1 -1
  29. package/dist/{DateFieldYearless-HrylwnwX.js → DateFieldYearless-DvbW4vgm.js} +2 -2
  30. package/dist/{DateFieldYearless-HrylwnwX.js.map → DateFieldYearless-DvbW4vgm.js.map} +1 -1
  31. package/dist/DateFieldYearless.js +1 -1
  32. package/dist/{DaysOfTheWeek-CvWu1j6-.js → DaysOfTheWeek-BcyYG7dD.js} +3 -3
  33. package/dist/{DaysOfTheWeek-CvWu1j6-.js.map → DaysOfTheWeek-BcyYG7dD.js.map} +1 -1
  34. package/dist/DaysOfTheWeek.js +1 -1
  35. package/dist/{Dialog-D3aUlrNr.js → Dialog-BLFx4TRs.js} +2 -2
  36. package/dist/{Dialog-D3aUlrNr.js.map → Dialog-BLFx4TRs.js.map} +1 -1
  37. package/dist/Dialog.js +1 -1
  38. package/dist/{Drawer-yG7C8Owv.js → Drawer-DPM-jPb7.js} +2 -2
  39. package/dist/{Drawer-yG7C8Owv.js.map → Drawer-DPM-jPb7.js.map} +1 -1
  40. package/dist/Drawer.js +1 -1
  41. package/dist/{FieldLabel-Bgl3iu13.js → FieldLabel-C6XZKglC.js} +2 -2
  42. package/dist/{FieldLabel-Bgl3iu13.js.map → FieldLabel-C6XZKglC.js.map} +1 -1
  43. package/dist/FieldLabel.js +1 -1
  44. package/dist/{InputMask-BHupXP8N.js → InputMask-DkNgXdFO.js} +2 -2
  45. package/dist/{InputMask-BHupXP8N.js.map → InputMask-DkNgXdFO.js.map} +1 -1
  46. package/dist/InputMask.js +1 -1
  47. package/dist/{ListView-Dsj5MiUx.js → ListView-DYKwVASE.js} +2 -2
  48. package/dist/{ListView-Dsj5MiUx.js.map → ListView-DYKwVASE.js.map} +1 -1
  49. package/dist/ListView.js +1 -1
  50. package/dist/{Menu-CETp4nrV.js → Menu-D22YbM7y.js} +2 -2
  51. package/dist/{Menu-CETp4nrV.js.map → Menu-D22YbM7y.js.map} +1 -1
  52. package/dist/Menu.js +1 -1
  53. package/dist/{NumberField-lvPAltDB.js → NumberField-B1hQ8jRn.js} +2 -2
  54. package/dist/{NumberField-lvPAltDB.js.map → NumberField-B1hQ8jRn.js.map} +1 -1
  55. package/dist/NumberField.js +1 -1
  56. package/dist/{Page-DAkneNVH.js → Page-DwBcDxi2.js} +5 -5
  57. package/dist/{Page-DAkneNVH.js.map → Page-DwBcDxi2.js.map} +1 -1
  58. package/dist/Page.js +1 -1
  59. package/dist/{Pagination-DiLZ3lxt.js → Pagination-B7uvkLb3.js} +2 -2
  60. package/dist/{Pagination-DiLZ3lxt.js.map → Pagination-B7uvkLb3.js.map} +1 -1
  61. package/dist/Pagination.js +1 -1
  62. package/dist/{Popover-Du2PBdp1.js → Popover-BuhxFt5z.js} +2 -2
  63. package/dist/{Popover-Du2PBdp1.js.map → Popover-BuhxFt5z.js.map} +1 -1
  64. package/dist/Popover.js +1 -1
  65. package/dist/{ProgressBar-BwM_e5cP.js → ProgressBar-Bq8indkz.js} +2 -2
  66. package/dist/{ProgressBar-BwM_e5cP.js.map → ProgressBar-Bq8indkz.js.map} +1 -1
  67. package/dist/ProgressBar.js +1 -1
  68. package/dist/{Radio-C5riI-do.js → Radio-57ck6GTm.js} +2 -2
  69. package/dist/{Radio-C5riI-do.js.map → Radio-57ck6GTm.js.map} +1 -1
  70. package/dist/Radio.js +2 -2
  71. package/dist/{RadioGroup-B7O06pVu.js → RadioGroup-CcRLdoAl.js} +2 -2
  72. package/dist/{RadioGroup-B7O06pVu.js.map → RadioGroup-CcRLdoAl.js.map} +1 -1
  73. package/dist/{SelectCard-Ca07K1FW.js → SelectCard-dEhb5KAL.js} +3 -3
  74. package/dist/{SelectCard-Ca07K1FW.js.map → SelectCard-dEhb5KAL.js.map} +1 -1
  75. package/dist/SelectCard.js +1 -1
  76. package/dist/{SelectTrigger-CaXX1SHG.js → SelectTrigger-A96aYNm-.js} +2 -2
  77. package/dist/{SelectTrigger-CaXX1SHG.js.map → SelectTrigger-A96aYNm-.js.map} +1 -1
  78. package/dist/SelectTrigger.js +1 -1
  79. package/dist/{SelectTriggerBase-C7TLCna1.js → SelectTriggerBase-I4Qo37zM.js} +2 -2
  80. package/dist/{SelectTriggerBase-C7TLCna1.js.map → SelectTriggerBase-I4Qo37zM.js.map} +1 -1
  81. package/dist/Table.d.ts +2 -0
  82. package/dist/Table.js +2 -0
  83. package/dist/Table.js.map +1 -0
  84. package/dist/{TextField-Duo_mY8Y.js → TextField-CP5kL2j7.js} +2 -2
  85. package/dist/{TextField-Duo_mY8Y.js.map → TextField-CP5kL2j7.js.map} +1 -1
  86. package/dist/{TextField-CGfnQPiO.js → TextField-DLIaLKT1.js} +2 -2
  87. package/dist/{TextField-CGfnQPiO.js.map → TextField-DLIaLKT1.js.map} +1 -1
  88. package/dist/TextField.js +1 -1
  89. package/dist/{Textarea-B2-6m291.js → Textarea-Kb-RF4rR.js} +2 -2
  90. package/dist/{Textarea-B2-6m291.js.map → Textarea-Kb-RF4rR.js.map} +1 -1
  91. package/dist/Textarea.js +1 -1
  92. package/dist/{ThemeProvider-Be3Pvtpz.js → ThemeProvider-7X1D1GxO.js} +4 -4
  93. package/dist/{ThemeProvider-Be3Pvtpz.js.map → ThemeProvider-7X1D1GxO.js.map} +1 -1
  94. package/dist/ThemeProvider.css +96 -90
  95. package/dist/ThemeProvider.js +1 -1
  96. package/dist/{TimeField-DohKibUE.js → TimeField-6OSTzIYV.js} +3 -3
  97. package/dist/{TimeField-DohKibUE.js.map → TimeField-6OSTzIYV.js.map} +1 -1
  98. package/dist/TimeField.js +1 -1
  99. package/dist/Toast.js +2 -2
  100. package/dist/{Toaster-CH5FTmGv.js → Toaster-BVM24YZG.js} +2 -2
  101. package/dist/{Toaster-CH5FTmGv.js.map → Toaster-BVM24YZG.js.map} +1 -1
  102. package/dist/{Toaster-BKyvW8J8.js → Toaster-Du0zf4b-.js} +2 -2
  103. package/dist/{Toaster-BKyvW8J8.js.map → Toaster-Du0zf4b-.js.map} +1 -1
  104. package/dist/{Toolbar-DbH5zdna.js → Toolbar-BGaVd-fy.js} +11 -11
  105. package/dist/{Toolbar-DbH5zdna.js.map → Toolbar-BGaVd-fy.js.map} +1 -1
  106. package/dist/Toolbar.js +1 -1
  107. package/dist/{Tooltip-DhtVlhah.js → Tooltip-Dp9gWa2P.js} +3 -3
  108. package/dist/{Tooltip-DhtVlhah.js.map → Tooltip-Dp9gWa2P.js.map} +1 -1
  109. package/dist/Tooltip.js +1 -1
  110. package/dist/beta/components/Calendar/Calendar.d.ts +4 -0
  111. package/dist/beta/components/Table/DataTable/DataTable.d.ts +116 -0
  112. package/dist/beta/components/Table/DataTable/DataTable.test-data.d.ts +15 -0
  113. package/dist/beta/components/Table/DataTable/index.d.ts +1 -0
  114. package/dist/beta/components/Table/DataTable/internal/DataTableBody.d.ts +16 -0
  115. package/dist/beta/components/Table/DataTable/internal/DataTableContainer.d.ts +7 -0
  116. package/dist/beta/components/Table/DataTable/internal/DataTableContext.d.ts +26 -0
  117. package/dist/beta/components/Table/DataTable/internal/DataTableContextProvider.d.ts +28 -0
  118. package/dist/beta/components/Table/DataTable/internal/DataTableFooter.d.ts +48 -0
  119. package/dist/beta/components/Table/DataTable/internal/DataTableHeader.d.ts +17 -0
  120. package/dist/beta/components/Table/DataTable/internal/cells/DataTableBodyCell.d.ts +40 -0
  121. package/dist/beta/components/Table/DataTable/internal/cells/DataTableFooterCell.d.ts +18 -0
  122. package/dist/beta/components/Table/DataTable/internal/cells/DataTableHeaderCell.d.ts +21 -0
  123. package/dist/beta/components/Table/DataTable/internal/editable-cells/DataTableEditableCellEditIcon.d.ts +5 -0
  124. package/dist/beta/components/Table/DataTable/internal/editable-cells/DataTableEditableMultiselectCell.d.ts +26 -0
  125. package/dist/beta/components/Table/DataTable/internal/editable-cells/DataTableEditableSelectCell.d.ts +26 -0
  126. package/dist/beta/components/Table/DataTable/internal/editable-cells/DataTableEditableTextCell.d.ts +17 -0
  127. package/dist/beta/components/Table/DataTable/internal/editable-cells/types.d.ts +50 -0
  128. package/dist/beta/components/Table/DataTable/internal/editable-cells/useEditCell.d.ts +11 -0
  129. package/dist/beta/components/Table/DataTable/stories/DataTable.story-data.d.ts +27 -0
  130. package/dist/beta/components/Table/base/TableBase.d.ts +43 -0
  131. package/dist/beta/components/Table/base/TableBody.d.ts +25 -0
  132. package/dist/beta/components/Table/base/TableContainer.d.ts +28 -0
  133. package/dist/beta/components/Table/base/TableFooter.d.ts +25 -0
  134. package/dist/beta/components/Table/base/TableHeader.d.ts +25 -0
  135. package/dist/beta/components/Table/base/cells/TableBodyCell.d.ts +27 -0
  136. package/dist/beta/components/Table/base/cells/TableEmptyCellContent.d.ts +4 -0
  137. package/dist/beta/components/Table/base/cells/TableFooterCell.d.ts +30 -0
  138. package/dist/beta/components/Table/base/cells/TableHeaderCell.d.ts +40 -0
  139. package/dist/beta/components/Table/base/cells/types.d.ts +10 -0
  140. package/dist/beta/components/Table/createColumnHelper.d.ts +25 -0
  141. package/dist/beta/components/Table/formatters/chipsFormatter.d.ts +21 -0
  142. package/dist/beta/components/Table/formatters/currencyFormatter.d.ts +22 -0
  143. package/dist/beta/components/Table/formatters/index.d.ts +3 -0
  144. package/dist/beta/components/Table/formatters/percentFormatter.d.ts +22 -0
  145. package/dist/beta/components/Table/index.d.ts +3 -0
  146. package/dist/beta/components/Table/internal/ResizeHandle.d.ts +14 -0
  147. package/dist/beta/components/Table/internal/TruncateChips.d.ts +30 -0
  148. package/dist/beta/components/Table/internal/focus-management/types.d.ts +34 -0
  149. package/dist/beta/components/Table/internal/focus-management/useColumnOrder.d.ts +10 -0
  150. package/dist/beta/components/Table/internal/focus-management/useFocusManagement.d.ts +27 -0
  151. package/dist/beta/components/Table/internal/focus-management/useHandleKeyDown.d.ts +36 -0
  152. package/dist/beta/components/Table/internal/focus-management/useScrollIntoView.d.ts +9 -0
  153. package/dist/beta/components/Table/internal/getColSpanWidth.d.ts +7 -0
  154. package/dist/beta/components/Table/internal/getCommonPinningClasses.d.ts +5 -0
  155. package/dist/beta/components/Table/internal/getCommonPinningStyles.d.ts +6 -0
  156. package/dist/beta/components/Table/internal/getTanStackColumnDef.d.ts +24 -0
  157. package/dist/beta/components/Table/types.d.ts +97 -0
  158. package/dist/beta/components/index.d.ts +1 -0
  159. package/dist/beta.js +3 -2
  160. package/dist/beta.js.map +1 -1
  161. package/dist/index.js +34 -34
  162. package/dist/token/core/raw.js +78 -73
  163. package/dist/token/core/semantic-variables.scss +92 -86
  164. package/dist/token/core/semantic.js +80 -59
  165. package/dist/token/core/semantic.scss +46 -43
  166. package/dist/token.js +126 -102
  167. package/dist/token.js.map +1 -1
  168. package/dist/{utils-CskVBG_X.js → utils-CEgTTa9_.js} +2 -2
  169. package/dist/{utils-CskVBG_X.js.map → utils-CEgTTa9_.js.map} +1 -1
  170. package/package.json +3 -2
@@ -0,0 +1,40 @@
1
+ import { DataTableBodyCellProps as BaseDataTableBodyCellProps } from '../../../base/cells/TableBodyCell';
2
+ import { ColumnDef } from '../../../types';
3
+ /**
4
+ * Props for the DataTableBodyCell component
5
+ * @extends Omit<BaseDataTableBodyCellProps, "onChange">
6
+ */
7
+ export type DataTableBodyCellProps<T> = Omit<BaseDataTableBodyCellProps, "onChange"> & {
8
+ /**
9
+ * The cell position of the cell
10
+ */
11
+ cellPosition: {
12
+ rowIndex: number;
13
+ columnIndex: number;
14
+ };
15
+ /**
16
+ * The column id of the cell
17
+ */
18
+ columnId: string;
19
+ /**
20
+ * The edit mode of the cell
21
+ */
22
+ editMode?: ColumnDef<T>["editMode"];
23
+ /**
24
+ * The edit value of the cell
25
+ */
26
+ editValue?: T[keyof T];
27
+ /**
28
+ * Called when the cell value is saved (on blur or enter/F2 key pressed)
29
+ */
30
+ onChange?: ColumnDef<T>["onChange"];
31
+ /**
32
+ * The options of the cell
33
+ */
34
+ options?: ColumnDef<T>["options"];
35
+ /**
36
+ * The row id of the cell
37
+ */
38
+ rowId: string;
39
+ };
40
+ export declare const DataTableBodyCell: <T>(props: DataTableBodyCellProps<T>) => JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { DataTableFooterCellProps as BaseDataTableFooterCellProps } from '../../../base/cells/TableFooterCell';
2
+ /**
3
+ * Props for the DataTableFooterCell component
4
+ * @extends BaseDataTableFooterCellProps
5
+ */
6
+ export type DataTableFooterCellProps = BaseDataTableFooterCellProps & {
7
+ cellPosition: {
8
+ rowIndex: number;
9
+ columnIndex: number;
10
+ };
11
+ };
12
+ /**
13
+ * Data table footer cell with focus management
14
+ * @param props - The props for the DataTableFooterCell component
15
+ * @param props.cellPosition - The cell position of the cell
16
+ * @param props.children - The children of the DataTableFooterCell component
17
+ */
18
+ export declare function DataTableFooterCell(props: DataTableFooterCellProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { HeaderContext } from '@tanstack/react-table';
2
+ import { DataTableHeaderCellProps as BaseDataTableHeaderCellProps } from '../../../base/cells/TableHeaderCell';
3
+ /**
4
+ * Props for the DataTableHeaderCell component
5
+ * @extends BaseDataTableHeaderCellProps
6
+ */
7
+ export type DataTableHeaderCellProps<T> = BaseDataTableHeaderCellProps & {
8
+ cellPosition: {
9
+ rowIndex: number;
10
+ columnIndex: number;
11
+ };
12
+ header: HeaderContext<T, unknown>;
13
+ };
14
+ /**
15
+ * Data table header cell with focus management
16
+ * @param props - The props for the DataTableHeaderCell component
17
+ * @param props.cellPosition - The cell position of the cell
18
+ * @param props.children - The children of the DataTableHeaderCell component
19
+ * @param props.header - The header of the DataTableHeaderCell component
20
+ */
21
+ export declare function DataTableHeaderCell<T>(props: DataTableHeaderCellProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Edit icon for editable cells in data tables
3
+ * @returns The edit icon
4
+ */
5
+ export declare const DataTableEditableCellEditIcon: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { DataTableEditableCellProps } from './types';
2
+ /**
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
17
+ * @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
25
+ */
26
+ export declare const DataTableEditableMultiselectCell: ({ cellProps, children, rowId, onChange, cellPosition, value, options, }: DataTableEditableMultiselectCellProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,26 @@
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
+ }[];
14
+ };
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;
@@ -0,0 +1,17 @@
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;
@@ -0,0 +1,50 @@
1
+ import { Ref } from 'react';
2
+ import { TableBodyCellProps } from '../../../base/cells/TableBodyCell';
3
+ import { CellPosition } from '../../../internal/focus-management/types';
4
+ /**
5
+ * Props for the useEditCell hook
6
+ * @extends Pick<UseEditCellProps<T>, "onChange" | "cellPosition" | "rowId">
7
+ */
8
+ export type UseEditCellProps<T> = {
9
+ /**
10
+ * The initial value of the cell
11
+ */
12
+ initialValue: T;
13
+ /**
14
+ * Called when the cell value is saved (on blur or enter/F2 key pressed)
15
+ */
16
+ onChange: (value: T, rowId: string) => void;
17
+ /**
18
+ * The cell position of the cell
19
+ */
20
+ cellPosition: CellPosition;
21
+ /**
22
+ * The row id of the cell
23
+ */
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
+ children: React.ReactNode;
49
+ value: T;
50
+ };
@@ -0,0 +1,11 @@
1
+ import { UseEditCellProps, UseEditCellReturn } from './types';
2
+ /**
3
+ * Hook for common logic for editable cells in data tables
4
+ * @param props - The props for the useEditCell hook
5
+ * @param props.initialValue - The initial value of the cell
6
+ * @param props.onChange - Called when the cell value is saved (on blur or enter/F2 key pressed)
7
+ * @param props.cellPosition - The cell position of the cell
8
+ * @param props.rowId - The row id of the cell
9
+ * @returns Object containing the editing state and functions for editing the cell
10
+ */
11
+ export declare const useEditCell: <T>({ initialValue, onChange, cellPosition, rowId, }: UseEditCellProps<T>) => UseEditCellReturn<T>;
@@ -0,0 +1,27 @@
1
+ import { TableRow } from '../../types';
2
+ type Status = "pending" | "shipped" | "processing" | "completed" | "cancelled";
3
+ export type TableStoryData = {
4
+ id: string;
5
+ customer_name: string;
6
+ amount: number;
7
+ items: number;
8
+ status?: Status[];
9
+ order_date: string;
10
+ payment_type: "credit_card" | "cash" | "bank_transfer" | "check" | "paypal";
11
+ note?: string;
12
+ };
13
+ export declare const data: TableRow<TableStoryData>[];
14
+ export declare const expandedRowData: TableRow<TableStoryData>[];
15
+ export declare const subComponentsData: TableRow<TableStoryData>[];
16
+ export declare const primaryColumns: import('../..').ColumnDef<TableStoryData>[];
17
+ export declare const groupedColumns: import('../..').ColumnDef<TableStoryData>[];
18
+ export type Category = "electronics" | "clothing" | "home" | "garden" | "other";
19
+ export type EditableTableStoryData = {
20
+ id: string;
21
+ status?: Status[];
22
+ payment_type: "credit_card" | "cash" | "bank_transfer" | "check" | "paypal";
23
+ categories: Category[];
24
+ };
25
+ export declare const categories: string[];
26
+ export declare const editableData: TableRow<EditableTableStoryData>[];
27
+ export {};
@@ -0,0 +1,43 @@
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ /**
3
+ * Props for the SimpleTableBase component
4
+ * @extends ComponentPropsWithoutRef<"table">
5
+ */
6
+ export type SimpleTableBaseProps = ComponentPropsWithoutRef<"table">;
7
+ /**
8
+ * Props for the DataTableBase component
9
+ * @extends Omit<ComponentPropsWithoutRef<"div">, "aria-colcount" | "aria-rowcount">
10
+ */
11
+ export type DataTableBaseProps = Omit<ComponentPropsWithoutRef<"div">, "aria-colcount" | "aria-rowcount"> & {
12
+ /**
13
+ * The number of columns in the table
14
+ */
15
+ colCount: number;
16
+ /**
17
+ * The number of rows in the table
18
+ */
19
+ rowCount: number;
20
+ /**
21
+ * Whether the table has expandable rows
22
+ */
23
+ hasSubRows?: boolean;
24
+ };
25
+ /**
26
+ * Props for the TableBase component
27
+ * @extends SimpleTableBaseProps
28
+ * @extends DataTableBaseProps
29
+ */
30
+ export type TableBaseProps = ({
31
+ type: "simple";
32
+ } & SimpleTableBaseProps) | ({
33
+ type: "data-table";
34
+ } & DataTableBaseProps);
35
+ /**
36
+ * Styled table component for simple presentational or complex data tables
37
+ * @param props - The props for the TableBase component
38
+ * @param props.type - The type of the TableBase component
39
+ * @param props.children - The children of the TableBase component
40
+ * @param props.className - The class name of the TableBase component
41
+ * @param props.ref - The ref of the TableBase component
42
+ */
43
+ export declare const TableBase: ({ type, ...rest }: TableBaseProps) => import("react/jsx-runtime").JSX.Element | undefined;
@@ -0,0 +1,25 @@
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ /**
3
+ * Props for the TableBody component
4
+ * @extends ComponentPropsWithoutRef<"tbody">
5
+ * @extends ComponentPropsWithoutRef<"div">
6
+ */
7
+ export type TableBodyProps = ({
8
+ /**
9
+ * The type of table being rendered
10
+ */
11
+ type: "simple";
12
+ } & ComponentPropsWithoutRef<"tbody">) | ({
13
+ /**
14
+ * The type of table being rendered
15
+ */
16
+ type: "data-table";
17
+ } & ComponentPropsWithoutRef<"div">);
18
+ /**
19
+ * Table body component for simple presentational or complex data tables
20
+ * @param props - The props for the TableBody component
21
+ * @param props.type - The type of table being rendered
22
+ * @param props.children - The children of the TableBody component
23
+ * @param props.ref - The ref of the TableBody component
24
+ */
25
+ export declare function TableBody({ type, children, ...rest }: TableBodyProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,28 @@
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ import { LayoutUtilProps } from '../../../../types';
3
+ /**
4
+ * Props for the TableContainer component
5
+ * @extends LayoutUtilProps
6
+ * @extends ComponentPropsWithoutRef<"div">
7
+ */
8
+ export type TableContainerProps = LayoutUtilProps & ComponentPropsWithoutRef<"div"> & {
9
+ /**
10
+ * The background color of the table container
11
+ */
12
+ background?: "default" | "strong";
13
+ };
14
+ /**
15
+ * Styled container for tables that includes a scroll container and a background color
16
+ * @param props - The props for the TableContainer component
17
+ * @param props.children - The children of the TableContainer component
18
+ * @param props.className - The class name of the TableContainer component
19
+ * @param props.style - The style of the TableContainer component
20
+ * @param props.background - The background color of the table container
21
+ * @param props.ref - The ref of the TableContainer component
22
+ */
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>>;
@@ -0,0 +1,25 @@
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ /**
3
+ * Props for the TableFooter component
4
+ * @extends ComponentPropsWithoutRef<"tfoot">
5
+ * @extends ComponentPropsWithoutRef<"div">
6
+ */
7
+ export type TableFooterProps = ({
8
+ /**
9
+ * The type of table being rendered
10
+ */
11
+ type: "simple";
12
+ } & ComponentPropsWithoutRef<"tfoot">) | ({
13
+ /**
14
+ * The type of table being rendered
15
+ */
16
+ type: "data-table";
17
+ } & ComponentPropsWithoutRef<"div">);
18
+ /**
19
+ * Table footer component for simple presentational or complex data tables
20
+ * @param props - The props for the TableFooter component
21
+ * @param props.type - The type of table being rendered
22
+ * @param props.children - The children of the TableFooter component
23
+ * @param props.ref - The ref of the TableFooter component
24
+ */
25
+ export declare function TableFooter({ type, children, ...rest }: TableFooterProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ /**
3
+ * Props for the TableHeader component
4
+ * @extends ComponentPropsWithoutRef<"thead">
5
+ * @extends ComponentPropsWithoutRef<"div">
6
+ */
7
+ export type TableHeaderProps = ({
8
+ /**
9
+ * The type of table being rendered
10
+ */
11
+ type: "simple";
12
+ } & ComponentPropsWithoutRef<"thead">) | ({
13
+ /**
14
+ * The type of table being rendered
15
+ */
16
+ type: "data-table";
17
+ } & ComponentPropsWithoutRef<"div">);
18
+ /**
19
+ * Table header component for simple presentational or complex data tables
20
+ * @param props - The props for the TableHeader component
21
+ * @param props.type - The type of table being rendered
22
+ * @param props.children - The children of the TableHeader component
23
+ * @param props.ref - The ref of the TableHeader component
24
+ */
25
+ export declare function TableHeader({ type, children, ...rest }: TableHeaderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ import { CommonTableCellProps } from './types';
3
+ export type SimpleTableBodyCellProps = ComponentPropsWithoutRef<"td"> & CommonTableCellProps;
4
+ export type DataTableBodyCellProps = ComponentPropsWithoutRef<"div"> & CommonTableCellProps;
5
+ /**
6
+ * The props for the TableBodyCell component
7
+ */
8
+ export type TableBodyCellProps = ({
9
+ /**
10
+ * The type of table being rendered
11
+ */
12
+ type: "simple";
13
+ } & SimpleTableBodyCellProps) | ({
14
+ /**
15
+ * The type of table being rendered
16
+ */
17
+ type: "data-table";
18
+ } & DataTableBodyCellProps);
19
+ /**
20
+ * The styled table body cell component
21
+ * @param props - The props for the TableBodyCell component
22
+ * @param props.type - The type of table being rendered
23
+ * @param props.children - The children to render in the cell
24
+ * @param props.className - The class name of the TableBodyCell component
25
+ * @param props.rest - The rest of the props
26
+ */
27
+ export declare const TableBodyCell: import('react').ForwardRefExoticComponent<TableBodyCellProps & import('react').RefAttributes<HTMLDivElement | HTMLTableCellElement>>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * The empty cell content for table cells
3
+ */
4
+ export declare const TableEmptyCellContent: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ export type SimpleTableFooterCellProps = ComponentPropsWithoutRef<"td"> & {
3
+ colSpan?: number;
4
+ };
5
+ export type DataTableFooterCellProps = ComponentPropsWithoutRef<"div"> & {
6
+ colSpan?: number;
7
+ };
8
+ /**
9
+ * The props for the TableFooterCell component
10
+ */
11
+ export type TableFooterCellProps = ({
12
+ /**
13
+ * The type of table being rendered
14
+ */
15
+ type: "simple";
16
+ } & SimpleTableFooterCellProps) | ({
17
+ /**
18
+ * The type of table being rendered
19
+ */
20
+ type: "data-table";
21
+ } & DataTableFooterCellProps);
22
+ /**
23
+ * The styled table footer cell component
24
+ * @param props - The props for the TableFooterCell component
25
+ * @param props.type - The type of table being rendered
26
+ * @param props.children - The children to render in the cell
27
+ * @param props.className - The class name of the TableFooterCell component
28
+ * @param props.rest - The rest of the props
29
+ */
30
+ export declare const TableFooterCell: import('react').ForwardRefExoticComponent<TableFooterCellProps & import('react').RefAttributes<HTMLDivElement | HTMLTableCellElement>>;
@@ -0,0 +1,40 @@
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ import { CommonTableCellProps } from './types';
3
+ /**
4
+ * The common props for the TableHeaderCell component
5
+ */
6
+ export type CommonTableHeaderCellProps = CommonTableCellProps & {
7
+ /**
8
+ * Whether the cell is a group cell (for grouped columns)
9
+ */
10
+ isGroup?: boolean;
11
+ /**
12
+ * Whether the header cell can be used to activate column sorting
13
+ */
14
+ isSortable?: boolean;
15
+ };
16
+ export type SimpleTableHeaderCellProps = CommonTableHeaderCellProps & ComponentPropsWithoutRef<"th">;
17
+ export type DataTableHeaderCellProps = CommonTableHeaderCellProps & ComponentPropsWithoutRef<"div">;
18
+ /**
19
+ * The props for the TableHeaderCell component
20
+ */
21
+ export type TableHeaderCellProps = ({
22
+ /**
23
+ * The type of table being rendered
24
+ */
25
+ type: "simple";
26
+ } & SimpleTableHeaderCellProps) | ({
27
+ /**
28
+ * The type of table being rendered
29
+ */
30
+ type: "data-table";
31
+ } & DataTableHeaderCellProps);
32
+ /**
33
+ * The styled table header cell component
34
+ * @param props - The props for the TableHeaderCell component
35
+ * @param props.type - The type of table being rendered
36
+ * @param props.children - The children to render in the cell
37
+ * @param props.className - The class name of the TableHeaderCell component
38
+ * @param props.rest - The rest of the props
39
+ */
40
+ export declare const TableHeaderCell: import('react').ForwardRefExoticComponent<TableHeaderCellProps & import('react').RefAttributes<HTMLDivElement | HTMLTableCellElement>>;
@@ -0,0 +1,10 @@
1
+ export type CommonTableCellProps = {
2
+ /**
3
+ * Whether the cell is an expand cell (for expandable rows)
4
+ */
5
+ isExpandCell?: boolean;
6
+ /**
7
+ * Whether the cell is a select cell (for selectable rows)
8
+ */
9
+ isSelectCell?: boolean;
10
+ };
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from 'react';
2
+ import { ColumnDef } from './types';
3
+ /**
4
+ * Utility type that allows a value to be either the original type or,
5
+ * if it's an array, one of the elements in the array
6
+ */
7
+ type ValueOrElement<V> = V extends (infer U)[] ? V | U : V;
8
+ /**
9
+ * Factory function to create column helper function for defining Table columns
10
+ *
11
+ * @param T - The type of the data
12
+ * @returns A function that creates a column definition
13
+ */
14
+ export declare function createColumnHelper<T>(): <K extends keyof T>(id: K | {
15
+ group: string;
16
+ }, column: Omit<ColumnDef<T>, "id" | "onChange" | "options" | "renderCell" | "sortable"> & {
17
+ renderCell?: (value: T[K], rowDepth: number) => ReactNode;
18
+ sortable?: boolean | ((valueA: T[K], valueB: T[K]) => number);
19
+ onChange?: (value: T[K], rowId: string) => void;
20
+ options?: {
21
+ value: ValueOrElement<T[K]>;
22
+ label: string;
23
+ }[];
24
+ }) => ColumnDef<T>;
25
+ export {};
@@ -0,0 +1,21 @@
1
+ import { ChipProps } from '../../../../components/Chip';
2
+ /**
3
+ * The accepted value type for the chips formatter function
4
+ */
5
+ export type ChipsValueType = string | string[] | ChipProps | ChipProps[];
6
+ /**
7
+ * Props for the chips formatter function
8
+ */
9
+ export type ChipsFormatterOptions = {
10
+ /**
11
+ * Whether to truncate the chips instead of wrapping
12
+ */
13
+ truncateChips?: boolean;
14
+ };
15
+ /**
16
+ * Helper function for formatting table cells with chips
17
+ * @param value - The value to format
18
+ * @param options - The options for the chips formatter
19
+ * @returns The formatted chips
20
+ */
21
+ export declare const chipsFormatter: (value?: ChipsValueType, { truncateChips }?: ChipsFormatterOptions) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Props for the currency formatter function
3
+ */
4
+ export type CurrencyFormatterOptions = {
5
+ /**
6
+ * The locale to use for the currency formatter
7
+ * @default "en-US"
8
+ */
9
+ locale?: Intl.LocalesArgument;
10
+ /**
11
+ * The currency to use for the currency formatter
12
+ * @default "USD"
13
+ */
14
+ currency?: string;
15
+ };
16
+ /**
17
+ * Helper function for formatting table cells with currency, including i18n support
18
+ * @param value - The value to format
19
+ * @param options - The options for the currency formatter
20
+ * @returns The formatted currency
21
+ */
22
+ export declare const currencyFormatter: (value?: number, { locale, currency }?: CurrencyFormatterOptions) => string | null;
@@ -0,0 +1,3 @@
1
+ export * from './chipsFormatter';
2
+ export * from './currencyFormatter';
3
+ export * from './percentFormatter';
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Options type for the percent formatter function
3
+ */
4
+ export type PercentFormatterOptions = {
5
+ /**
6
+ * The number of decimals to display
7
+ * @default 2
8
+ */
9
+ decimals?: number;
10
+ /**
11
+ * The locale to use for the percent formatter
12
+ * @default "en-US"
13
+ */
14
+ locale?: Intl.LocalesArgument;
15
+ };
16
+ /**
17
+ * Helper function for formatting table cells with percentages, including i18n support
18
+ * @param value - The value to format
19
+ * @param options - The options for the percent formatter
20
+ * @returns The formatted percentage
21
+ */
22
+ export declare const percentFormatter: (value?: number, { decimals, locale }?: PercentFormatterOptions) => string | null;
@@ -0,0 +1,3 @@
1
+ export * from './formatters';
2
+ export * from './DataTable';
3
+ export * from './types';
@@ -0,0 +1,14 @@
1
+ import { Header } from '@tanstack/react-table';
2
+ /**
3
+ * Props for the ResizeHandle component
4
+ * @extends Header<T, unknown>
5
+ */
6
+ export type ResizeHandleProps<T> = {
7
+ header: Header<T, unknown>;
8
+ };
9
+ /**
10
+ * Resize handle component resizing table columns
11
+ * @param props - The props for the ResizeHandle component
12
+ * @param props.header - The header of the ResizeHandle component
13
+ */
14
+ export declare function ResizeHandle<T>({ header }: ResizeHandleProps<T>): import("react/jsx-runtime").JSX.Element;