@servicetitan/anvil2 1.48.0 → 1.48.1

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 (81) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/{Calendar-Bv7N3SoB.js → Calendar-8bP4LsQV.js} +2 -2
  3. package/dist/{Calendar-Bv7N3SoB.js.map → Calendar-8bP4LsQV.js.map} +1 -1
  4. package/dist/{Calendar-BWETPlKE.js → Calendar-NDOcurOz.js} +2 -2
  5. package/dist/{Calendar-BWETPlKE.js.map → Calendar-NDOcurOz.js.map} +1 -1
  6. package/dist/Calendar.js +2 -2
  7. package/dist/{DataTable-BHI2ONJ-.js → DataTable-xUON92DR.js} +293 -123
  8. package/dist/DataTable-xUON92DR.js.map +1 -0
  9. package/dist/DataTable.css +86 -83
  10. package/dist/{DateField-HeK2wOzu.js → DateField-Cm0FIG3Y.js} +4 -4
  11. package/dist/{DateField-HeK2wOzu.js.map → DateField-Cm0FIG3Y.js.map} +1 -1
  12. package/dist/DateField.js +1 -1
  13. package/dist/{DateFieldRange-GNPGcfcD.js → DateFieldRange-CGGqW_cg.js} +4 -4
  14. package/dist/{DateFieldRange-GNPGcfcD.js.map → DateFieldRange-CGGqW_cg.js.map} +1 -1
  15. package/dist/DateFieldRange.js +1 -1
  16. package/dist/{DateFieldSingle-CvKdVIqR.js → DateFieldSingle-BYWuJ3IL.js} +4 -4
  17. package/dist/{DateFieldSingle-CvKdVIqR.js.map → DateFieldSingle-BYWuJ3IL.js.map} +1 -1
  18. package/dist/DateFieldSingle.js +1 -1
  19. package/dist/{DateFieldYearless-B801SnxH.js → DateFieldYearless-BXRgNWzy.js} +2 -2
  20. package/dist/{DateFieldYearless-B801SnxH.js.map → DateFieldYearless-BXRgNWzy.js.map} +1 -1
  21. package/dist/DateFieldYearless.js +1 -1
  22. package/dist/{DaysOfTheWeek-BJErLzD2.js → DaysOfTheWeek-BIi9dyJP.js} +4 -3
  23. package/dist/DaysOfTheWeek-BIi9dyJP.js.map +1 -0
  24. package/dist/DaysOfTheWeek.js +1 -1
  25. package/dist/{InputMask-BOkWmhsv.js → InputMask-B6oJlChY.js} +2 -2
  26. package/dist/{InputMask-BOkWmhsv.js.map → InputMask-B6oJlChY.js.map} +1 -1
  27. package/dist/InputMask.js +1 -1
  28. package/dist/{ListView-kfwvU4Z-.js → ListView-fBFSagWO.js} +4 -2
  29. package/dist/ListView-fBFSagWO.js.map +1 -0
  30. package/dist/ListView.js +1 -1
  31. package/dist/{NumberField-CjvsSokL.js → NumberField-CNskrtsN.js} +4 -3
  32. package/dist/{NumberField-CjvsSokL.js.map → NumberField-CNskrtsN.js.map} +1 -1
  33. package/dist/NumberField.js +1 -1
  34. package/dist/{Pagination-p734If5z.js → Pagination-CQjNN1yN.js} +3 -2
  35. package/dist/{Pagination-p734If5z.js.map → Pagination-CQjNN1yN.js.map} +1 -1
  36. package/dist/Pagination.js +1 -1
  37. package/dist/{Radio-CLaDEpuU.js → Radio-CTYs8JpI.js} +2 -2
  38. package/dist/{Radio-CLaDEpuU.js.map → Radio-CTYs8JpI.js.map} +1 -1
  39. package/dist/Radio.js +2 -2
  40. package/dist/{RadioGroup-DMJqrF4q.js → RadioGroup-BVGnsTuG.js} +2 -2
  41. package/dist/RadioGroup-BVGnsTuG.js.map +1 -0
  42. package/dist/{SelectCard-BORQF-zC.js → SelectCard-Dw7zW0UN.js} +2 -2
  43. package/dist/{SelectCard-BORQF-zC.js.map → SelectCard-Dw7zW0UN.js.map} +1 -1
  44. package/dist/SelectCard.js +1 -1
  45. package/dist/Table.js +1 -1
  46. package/dist/{TextField-3szrbqNi.js → TextField-CUrYEZR4.js} +2 -2
  47. package/dist/{TextField-3szrbqNi.js.map → TextField-CUrYEZR4.js.map} +1 -1
  48. package/dist/{TextField-DmddoTnj.js → TextField-DPTJjF8V.js} +4 -3
  49. package/dist/TextField-DPTJjF8V.js.map +1 -0
  50. package/dist/TextField.js +1 -1
  51. package/dist/{Textarea-CJG9i528.js → Textarea-f0jAKcvn.js} +4 -3
  52. package/dist/{Textarea-CJG9i528.js.map → Textarea-f0jAKcvn.js.map} +1 -1
  53. package/dist/Textarea.js +1 -1
  54. package/dist/{TimeField-BfxAImzQ.js → TimeField-CGSwrpl0.js} +2 -2
  55. package/dist/{TimeField-BfxAImzQ.js.map → TimeField-CGSwrpl0.js.map} +1 -1
  56. package/dist/TimeField.js +1 -1
  57. package/dist/{Toolbar-hhk9ZQ9l.js → Toolbar-CcJa_YpH.js} +6 -6
  58. package/dist/{Toolbar-hhk9ZQ9l.js.map → Toolbar-CcJa_YpH.js.map} +1 -1
  59. package/dist/Toolbar.js +1 -1
  60. package/dist/anvil-fonts.css +30 -0
  61. package/dist/beta/components/Table/DataTable/DataTable.d.ts +22 -1
  62. package/dist/beta/components/Table/DataTable/DataTable.test-data.d.ts +1 -0
  63. package/dist/beta/components/Table/DataTable/internal/DataTableContext.d.ts +1 -2
  64. package/dist/beta/components/Table/DataTable/internal/DataTablePagination.d.ts +3 -0
  65. package/dist/beta/components/Table/DataTable/internal/useDataTableContext.d.ts +4 -0
  66. package/dist/beta/components/Table/DataTable/stories/DataTable.story-data.d.ts +1 -0
  67. package/dist/beta/components/Table/DataTable/types.d.ts +43 -0
  68. package/dist/beta/components/Table/createColumnHelper.d.ts +1 -2
  69. package/dist/beta/components/Table/index.d.ts +1 -0
  70. package/dist/beta.js +4 -4
  71. package/dist/index.js +18 -17
  72. package/dist/index.js.map +1 -1
  73. package/dist/index2.css +0 -30
  74. package/dist/{utils-ComsNTho.js → utils-CyPyKUVh.js} +2 -2
  75. package/dist/{utils-ComsNTho.js.map → utils-CyPyKUVh.js.map} +1 -1
  76. package/package.json +3 -3
  77. package/dist/DataTable-BHI2ONJ-.js.map +0 -1
  78. package/dist/DaysOfTheWeek-BJErLzD2.js.map +0 -1
  79. package/dist/ListView-kfwvU4Z-.js.map +0 -1
  80. package/dist/RadioGroup-DMJqrF4q.js.map +0 -1
  81. package/dist/TextField-DmddoTnj.js.map +0 -1
@@ -2,6 +2,7 @@ import { ComponentPropsWithoutRef } from 'react';
2
2
  import { LayoutUtilProps } from '../../../../types';
3
3
  import { ColumnDef, CustomTableFooterCellProps, TableRow } from '../types';
4
4
  import { TableContainerProps } from '../base/TableContainer';
5
+ import { DataTablePaginationConfig } from './types';
5
6
  /**
6
7
  * Represents a sorted column configuration for DataTable
7
8
  */
@@ -24,7 +25,7 @@ export type DataTableProps<T> = LayoutUtilProps & ComponentPropsWithoutRef<"div"
24
25
  /**
25
26
  * The data for the table. Must be an array of objects with an `id` property.
26
27
  */
27
- data: TableRow<T>[];
28
+ data: TableRow<T>[] | Promise<TableRow<T>[]>;
28
29
  /**
29
30
  * The columns for the table, created with the `createColumnHelper` factory function.
30
31
  */
@@ -71,6 +72,12 @@ export type DataTableProps<T> = LayoutUtilProps & ComponentPropsWithoutRef<"div"
71
72
  * Called when the column sorting state changes. Passes the sorted column.
72
73
  */
73
74
  onSort?: (sortedColumn: SortedColumn | undefined) => void;
75
+ /**
76
+ * Pagination configuration. When provided, enables pagination and filters data to show only the current page.
77
+ * When `true`, the default pagination configuration is used.
78
+ * When `false` or `undefined`, no pagination is applied and all data is shown.
79
+ */
80
+ pagination?: boolean | DataTablePaginationConfig<T>;
74
81
  /**
75
82
  * The selected row ids.
76
83
  */
@@ -94,6 +101,7 @@ export type DataTableProps<T> = LayoutUtilProps & ComponentPropsWithoutRef<"div"
94
101
  * - Row sub-component
95
102
  * - Row sub-rows
96
103
  * - Default and Strong backgrounds
104
+ * - Pagination support with configurable items per page
97
105
  *
98
106
  * @param props - The props for the DataTable component
99
107
  * @param props.data - The data for the table. Must be an array of objects with an `id` property.
@@ -108,9 +116,22 @@ export type DataTableProps<T> = LayoutUtilProps & ComponentPropsWithoutRef<"div"
108
116
  * @param props.onSelectRow - Called when the row selection state changes. Passes the selected row ids.
109
117
  * @param props.onSort - Called when the column sorting state changes. Passes the sorted column.
110
118
  * @param props.onExpandRow - Called when the row expansion state changes. Passes the expanded row ids.
119
+ * @param props.pagination - Pagination configuration. When provided, enables pagination and filters data to show only the current page. When undefined, all data is shown and no pagination controls are rendered.
111
120
  * @param props.selectedRowIds - The selected row ids.
112
121
  * @param props.sortedColumn - The sorted column.
113
122
  * @param props.style - The style of the table container.
114
123
  * @param props.rest - The rest of the props for the DataTable component, spread to the div surrounding the table.
124
+ *
125
+ * @example
126
+ * <DataTable
127
+ * data={tableData}
128
+ * columns={columns}
129
+ * pagination={{
130
+ * itemsPerPage: 25,
131
+ * defaultPageIndex: 0,
132
+ * onPageChange: (pageIndex) => console.log('Page changed to:', pageIndex),
133
+ * showCount: true,
134
+ * }}
135
+ * />
115
136
  */
116
137
  export declare function DataTable<T>(props: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -7,6 +7,7 @@ export type TableStoryData = {
7
7
  status?: Status[];
8
8
  };
9
9
  export declare const data: TableRow<TableStoryData>[];
10
+ export declare const longData: TableRow<TableStoryData>[];
10
11
  export declare const dataWithEmptyCells: TableRow<TableStoryData>[];
11
12
  export declare const dataWithSubRow: TableRow<TableStoryData>[];
12
13
  export declare const dataWithSubComponent: TableRow<TableStoryData>[];
@@ -3,7 +3,7 @@ import { RegisterCellProps } from '../../internal/focus-management/useFocusManag
3
3
  /**
4
4
  * The context type for the table
5
5
  */
6
- interface DataTableContextType {
6
+ export interface DataTableContextType {
7
7
  hoveredColumnId: string | null;
8
8
  setHoveredColumnId: (columnId: string | null) => void;
9
9
  isOffGridInteractionOccurring: boolean;
@@ -23,4 +23,3 @@ interface DataTableContextType {
23
23
  * The context for the table context provider
24
24
  */
25
25
  export declare const DataTableContext: import('react').Context<DataTableContextType | undefined>;
26
- export {};
@@ -0,0 +1,3 @@
1
+ import { PaginationProps } from '../../../../..';
2
+ export type DataTablePaginationProps = Pick<PaginationProps, "page" | "itemsPerPage" | "totalItemCount" | "showCount" | "onPageChange">;
3
+ export declare const DataTablePagination: ({ showCount, ...props }: DataTablePaginationProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Hook to access the internal data table context
3
+ */
4
+ export declare function useDataTableContext(): import('./DataTableContext').DataTableContextType;
@@ -15,6 +15,7 @@ export declare const expandedRowData: TableRow<TableStoryData>[];
15
15
  export declare const subComponentsData: TableRow<TableStoryData>[];
16
16
  export declare const primaryColumns: import('../..').ColumnDef<TableStoryData>[];
17
17
  export declare const groupedColumns: import('../..').ColumnDef<TableStoryData>[];
18
+ export declare const columnsWithoutFooter: import('../..').ColumnDef<TableStoryData>[];
18
19
  export type Category = "electronics" | "clothing" | "home" | "garden" | "other";
19
20
  export type EditableTableStoryData = {
20
21
  id: string;
@@ -0,0 +1,43 @@
1
+ import { TableRow } from '../types';
2
+ /**
3
+ * Configuration for pagination in DataTable
4
+ */
5
+ export type DataTablePaginationConfig<T> = {
6
+ /**
7
+ * Number of rows displayed per page
8
+ * @default 25
9
+ */
10
+ rowsPerPage?: number;
11
+ /**
12
+ * Current page index (0-based)
13
+ */
14
+ currentPageIndex?: number;
15
+ /**
16
+ * Function to get the data for the current page. When used, the data displayed will be
17
+ * fully controlled by the implementor. This is useful for server-side pagination scenarios where
18
+ * the total number of rows may differ from the data array length.
19
+ */
20
+ loadPageData?: ({ pageIndex, pageSize, }: {
21
+ pageIndex: number;
22
+ pageSize: number;
23
+ }) => TableRow<T>[] | Promise<TableRow<T>[]>;
24
+ /**
25
+ * Default page index for uncontrolled mode (0-based)
26
+ * @default 0
27
+ */
28
+ defaultPageIndex?: number;
29
+ /**
30
+ * Callback when page changes. Receives the new page index (0-based)
31
+ */
32
+ onPageChange?: (pageIndex: number) => void;
33
+ /**
34
+ * Whether to display the item count information in pagination
35
+ * @default true
36
+ */
37
+ showCount?: boolean;
38
+ /**
39
+ * Total number of rows across all pages. Falls back to data.length if not provided.
40
+ * Useful for server-side pagination scenarios where totalRowCount may differ from data array length.
41
+ */
42
+ totalRowCount?: number;
43
+ };
@@ -4,7 +4,7 @@ import { ColumnDef } from './types';
4
4
  * Utility type that allows a value to be either the original type or,
5
5
  * if it's an array, one of the elements in the array
6
6
  */
7
- type ValueOrElement<V> = V extends (infer U)[] ? V | U : V;
7
+ export type ValueOrElement<V> = V extends (infer U)[] ? V | U : V;
8
8
  /**
9
9
  * Factory function to create column helper function for defining Table columns
10
10
  *
@@ -22,4 +22,3 @@ export declare function createColumnHelper<T>(): <K extends keyof T>(id: K | {
22
22
  label: string;
23
23
  }[];
24
24
  }) => ColumnDef<T>;
25
- export {};
@@ -1,3 +1,4 @@
1
+ export * from './createColumnHelper';
1
2
  export * from './formatters';
2
3
  export * from './DataTable';
3
4
  export * from './types';
package/dist/beta.js CHANGED
@@ -1,5 +1,5 @@
1
- export { D as DataTable, c as chipsFormatter, a as currencyFormatter, p as percentFormatter } from './DataTable-BHI2ONJ-.js';
2
- export { T as Toolbar, a as ToolbarButton, c as ToolbarButtonLink, b as ToolbarButtonToggle, e as ToolbarControlGroup, g as ToolbarElement, f as ToolbarSearchField, d as ToolbarSelect } from './Toolbar-hhk9ZQ9l.js';
3
- export { u as useCalendarBetaProps } from './Calendar-BWETPlKE.js';
4
- export { C as Calendar } from './Calendar-Bv7N3SoB.js';
1
+ export { D as DataTable, a as chipsFormatter, c as createColumnHelper, b as currencyFormatter, p as percentFormatter } from './DataTable-xUON92DR.js';
2
+ export { T as Toolbar, a as ToolbarButton, c as ToolbarButtonLink, b as ToolbarButtonToggle, e as ToolbarControlGroup, g as ToolbarElement, f as ToolbarSearchField, d as ToolbarSelect } from './Toolbar-CcJa_YpH.js';
3
+ export { u as useCalendarBetaProps } from './Calendar-NDOcurOz.js';
4
+ export { C as Calendar } from './Calendar-8bP4LsQV.js';
5
5
  //# sourceMappingURL=beta.js.map
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
- import './index2.css';export { DndSort, DndSortCard, DndSortZone } from './DndSort.js';
1
+ import './anvil-fonts.css';import './index2.css';/* empty css */
2
+ export { DndSort, DndSortCard, DndSortZone } from './DndSort.js';
2
3
  export { A as Alert } from './Alert-Cz_w_cw0.js';
3
4
  export { A as Announcement } from './Announcement-C1xSJkl0.js';
4
5
  export { A as Avatar } from './Avatar-VQrimv28.js';
@@ -9,18 +10,18 @@ import { B as Button } from './Button-DzcOa6iJ.js';
9
10
  export { B as ButtonCompound } from './ButtonCompound-Dvr3Fres.js';
10
11
  import { B as ButtonLink } from './ButtonLink-DGIRpyK6.js';
11
12
  import { B as ButtonToggle } from './ButtonToggle-Dv6VAm4W.js';
12
- export { a as Calendar, g as CalendarMonth, f as CalendarMonthButton, e as CalendarNext, b as CalendarNow, d as CalendarPrev, c as CalendarYearButton } from './Calendar-BWETPlKE.js';
13
+ export { a as Calendar, g as CalendarMonth, f as CalendarMonthButton, e as CalendarNext, b as CalendarNow, d as CalendarPrev, c as CalendarYearButton } from './Calendar-NDOcurOz.js';
13
14
  export { C as Card } from './Card-Cyoz-LaD.js';
14
15
  export { C as Checkbox } from './Checkbox-BJnt8TFk.js';
15
16
  export { C as CheckboxGroup } from './Checkbox-Bsa1FgoI.js';
16
17
  export { C as Chip } from './Chip-BGa1Inb8.js';
17
18
  export { C as Combobox, c as ComboboxContent, a as ComboboxElement, i as ComboboxEmpty, e as ComboboxItem, f as ComboboxItemAddNew, d as ComboboxList, g as ComboboxSearchField, b as ComboboxSelect, h as ComboboxSelectTrigger } from './Combobox-BfqKpX1v.js';
18
19
  export { u as useInfiniteCombobox } from './useInfiniteCombobox-WcRgC9p6.js';
19
- export { D as DateField } from './DateField-HeK2wOzu.js';
20
- export { D as DateFieldRange } from './DateFieldRange-GNPGcfcD.js';
21
- export { D as DateFieldSingle } from './DateFieldSingle-CvKdVIqR.js';
22
- export { D as DateFieldYearless } from './DateFieldYearless-B801SnxH.js';
23
- export { D as DaysOfTheWeek } from './DaysOfTheWeek-BJErLzD2.js';
20
+ export { D as DateField } from './DateField-Cm0FIG3Y.js';
21
+ export { D as DateFieldRange } from './DateFieldRange-CGGqW_cg.js';
22
+ export { D as DateFieldSingle } from './DateFieldSingle-BYWuJ3IL.js';
23
+ export { D as DateFieldYearless } from './DateFieldYearless-BXRgNWzy.js';
24
+ export { D as DaysOfTheWeek } from './DaysOfTheWeek-BIi9dyJP.js';
24
25
  export { D as Details, b as DetailsContent, a as DetailsSummary } from './Details-Bg7QzlOm.js';
25
26
  export { D as Dialog, a as DialogCancelButton, b as DialogContent, c as DialogFooter, d as DialogHeader } from './Dialog-fJClGTI6.js';
26
27
  export { D as Divider } from './Divider-DYZFKug1.js';
@@ -32,26 +33,26 @@ export { F as FieldMessage } from './FieldMessage-BbARBii0.js';
32
33
  import { F as Flex } from './Flex-GLF5XRJg.js';
33
34
  export { G as Grid } from './Grid-BpAt2zA7.js';
34
35
  import { I as Icon } from './Icon-TcJbUdTz.js';
35
- export { I as InputMask } from './InputMask-BOkWmhsv.js';
36
+ export { I as InputMask } from './InputMask-B6oJlChY.js';
36
37
  export { L as Layout, a as LayoutElement, b as LayoutItem } from './Layout-CUUb2PVr.js';
37
38
  export { L as Link, u as useLinkStyles } from './Link-Br_AJ7Af.js';
38
39
  export { L as LinkButton } from './LinkButton-CwiVzaro.js';
39
40
  import { L as Listbox } from './Listbox-gtZ2Ao_I.js';
40
41
  export { a as ListboxOption, b as ListboxOptionGroup } from './Listbox-gtZ2Ao_I.js';
41
- export { L as ListView, a as ListViewOption, b as ListViewOptionCell } from './ListView-kfwvU4Z-.js';
42
+ export { L as ListView, a as ListViewOption, b as ListViewOptionCell } from './ListView-fBFSagWO.js';
42
43
  export { M as Menu, a as MenuItem } from './Menu-CBbUK_sX.js';
43
- export { N as NumberField } from './NumberField-CjvsSokL.js';
44
+ export { N as NumberField } from './NumberField-CNskrtsN.js';
44
45
  export { Overflow, OverflowText } from './Overflow.js';
45
46
  export { P as Page } from './Page-4VdFrCjy.js';
46
- export { P as Pagination } from './Pagination-p734If5z.js';
47
+ export { P as Pagination } from './Pagination-CQjNN1yN.js';
47
48
  import { P as Popover } from './Popover--c9PXAVi.js';
48
49
  export { a as PopoverButton, b as PopoverClose, c as PopoverContent, d as PopoverTrigger } from './Popover--c9PXAVi.js';
49
50
  export { P as ProgressBar } from './ProgressBar-CXMuhBQV.js';
50
- export { R as Radio } from './Radio-CLaDEpuU.js';
51
- export { R as RadioGroup } from './RadioGroup-DMJqrF4q.js';
51
+ export { R as Radio } from './Radio-CTYs8JpI.js';
52
+ export { R as RadioGroup } from './RadioGroup-BVGnsTuG.js';
52
53
  export { S as SearchField } from './SearchField-DLqva3o3.js';
53
54
  export { S as SegmentedControl, a as SegmentedControlSegment } from './SegmentedControl-1OzOQmCp.js';
54
- export { S as SelectCard, a as SelectCardElement, b as SelectCardGroup } from './SelectCard-BORQF-zC.js';
55
+ export { S as SelectCard, a as SelectCardElement, b as SelectCardGroup } from './SelectCard-Dw7zW0UN.js';
55
56
  export { S as SelectTrigger } from './SelectTrigger-BQNqyG3M.js';
56
57
  export { S as SideNav, b as SideNavCollapsible, c as SideNavGroup, a as SideNavLink } from './SideNav-COiPAIph.js';
57
58
  export { Skeleton, SkeletonCircle, SkeletonPill, SkeletonRectangle, SkeletonText } from './Skeleton.js';
@@ -61,9 +62,9 @@ export { S as Stepper, a as StepperFinalPanel, b as StepperList, c as StepperNex
61
62
  export { S as Switch } from './Switch-mhyHJeex.js';
62
63
  export { T as Tab, a as TabButton, b as TabList, c as TabPanel } from './Tab-BISlFW_i.js';
63
64
  export { T as Text } from './Text-CDzLZl1O.js';
64
- export { T as Textarea } from './Textarea-CJG9i528.js';
65
- export { T as TextField } from './TextField-3szrbqNi.js';
66
- export { T as TimeField } from './TimeField-BfxAImzQ.js';
65
+ export { T as Textarea } from './Textarea-f0jAKcvn.js';
66
+ export { T as TextField } from './TextField-CUrYEZR4.js';
67
+ export { T as TimeField } from './TimeField-CGSwrpl0.js';
67
68
  export { T as Toaster } from './Toaster-C6iB4h0P.js';
68
69
  export { t as toast } from './Toaster-D72xHdfH.js';
69
70
  import { jsx, jsxs } from 'react/jsx-runtime';