@servicetitan/anvil2 3.0.6 → 3.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/Combobox.js +1 -2
- package/dist/Combobox.js.map +1 -1
- package/dist/{DataTable-0kOuVgSB.js → DataTable-E8z0H8c7.js} +140 -13
- package/dist/{DataTable-0kOuVgSB.js.map → DataTable-E8z0H8c7.js.map} +1 -1
- package/dist/DataTable.css +47 -5
- package/dist/{DateFieldRange-Be_I9GTp.js → DateFieldRange-BN_uIvHI.js} +24 -12
- package/dist/DateFieldRange-BN_uIvHI.js.map +1 -0
- package/dist/DateFieldRange.js +1 -1
- package/dist/{DateFieldSingle-CsrsY9i8.js → DateFieldSingle-h3YkdwPo.js} +2 -2
- package/dist/{DateFieldSingle-CsrsY9i8.js.map → DateFieldSingle-h3YkdwPo.js.map} +1 -1
- package/dist/DateFieldSingle.js +1 -1
- package/dist/{Dialog-CD-SDfPT.js → Dialog-CvYSMvfD.js} +2 -2
- package/dist/{Dialog-CD-SDfPT.js.map → Dialog-CvYSMvfD.js.map} +1 -1
- package/dist/Dialog.js +1 -1
- package/dist/FilterBar-B4ZAs73g.js +412 -0
- package/dist/FilterBar-B4ZAs73g.js.map +1 -0
- package/dist/FilterBar.js +1 -1
- package/dist/{ListView-CcRRh1ap.js → ListView-DO5psxd4.js} +5 -5
- package/dist/{ListView-CcRRh1ap.js.map → ListView-DO5psxd4.js.map} +1 -1
- package/dist/ListView.js +1 -1
- package/dist/{ListView.module-CKUQP3kf.js → ListView.module-DfqtCL3Q.js} +3 -3
- package/dist/ListView.module-DfqtCL3Q.js.map +1 -0
- package/dist/MultiSelectField.js +1 -1
- package/dist/{MultiSelectFieldSync-BMVROOjy.js → MultiSelectFieldSync-CXX2F0ru.js} +59 -29
- package/dist/MultiSelectFieldSync-CXX2F0ru.js.map +1 -0
- package/dist/MultiSelectFieldSync.css +72 -69
- package/dist/MultiSelectMenu.js +1 -1
- package/dist/{MultiSelectMenuSync-BNPp_2Bm.js → MultiSelectMenuSync-EKtvlL62.js} +218 -47
- package/dist/MultiSelectMenuSync-EKtvlL62.js.map +1 -0
- package/dist/{Page-SBy27-Wv.js → Page-C2_Hm27h.js} +2 -2
- package/dist/{Page-SBy27-Wv.js.map → Page-C2_Hm27h.js.map} +1 -1
- package/dist/Page.js +1 -1
- package/dist/{Pagination-Cm8-K6VH.js → Pagination-Bmd4JORe.js} +2 -2
- package/dist/{Pagination-Cm8-K6VH.js.map → Pagination-Bmd4JORe.js.map} +1 -1
- package/dist/Pagination.js +1 -1
- package/dist/SavedFiltersButton-2qba2Cgu.js +650 -0
- package/dist/SavedFiltersButton-2qba2Cgu.js.map +1 -0
- package/dist/SavedFiltersButton.css +8 -0
- package/dist/SavedFiltersButton.d.ts +1 -0
- package/dist/SavedFiltersButton.js +2 -0
- package/dist/SavedFiltersButton.js.map +1 -0
- package/dist/{SearchField-3tUPU8hH.js → SearchField-BMHJCVFu.js} +2 -2
- package/dist/{SearchField-3tUPU8hH.js.map → SearchField-BMHJCVFu.js.map} +1 -1
- package/dist/{SearchField-BcQZ5e0x.js → SearchField-fXc_vWEr.js} +2 -2
- package/dist/{SearchField-BcQZ5e0x.js.map → SearchField-fXc_vWEr.js.map} +1 -1
- package/dist/SearchField.js +1 -1
- package/dist/SelectField.js +1 -1
- package/dist/{SelectFieldSync-BeDYbJ2M.js → SelectFieldSync-DykGkR_w.js} +3 -3
- package/dist/{SelectFieldSync-BeDYbJ2M.js.map → SelectFieldSync-DykGkR_w.js.map} +1 -1
- package/dist/SelectMenu.js +1 -1
- package/dist/{SelectMenuSync-C-PFemsQ.js → SelectMenuSync-DTQ8Ofoz.js} +21 -9
- package/dist/SelectMenuSync-DTQ8Ofoz.js.map +1 -0
- package/dist/{SelectOptions-Tr11Ckqw.js → SelectOptions-DVSOJwRy.js} +2 -2
- package/dist/{SelectOptions-Tr11Ckqw.js.map → SelectOptions-DVSOJwRy.js.map} +1 -1
- package/dist/{SelectTrigger-DTz7V-Xx.js → SelectTrigger-CHk0KO-P.js} +2 -2
- package/dist/{SelectTrigger-DTz7V-Xx.js.map → SelectTrigger-CHk0KO-P.js.map} +1 -1
- package/dist/SelectTrigger.js +1 -1
- package/dist/{SelectTriggerBase-Ds6I7Qbr.js → SelectTriggerBase-B2S5SOZr.js} +134 -38
- package/dist/SelectTriggerBase-B2S5SOZr.js.map +1 -0
- package/dist/Table.js +1 -1
- package/dist/{Toolbar-BUd9eNkq.js → Toolbar-DaUKbbsL.js} +3 -3
- package/dist/{Toolbar-BUd9eNkq.js.map → Toolbar-DaUKbbsL.js.map} +1 -1
- package/dist/Toolbar.js +2 -2
- package/dist/{ToolbarButtonToggle-C06cqJ6F.js → ToolbarButtonToggle-BPu81Wuv.js} +4 -3
- package/dist/ToolbarButtonToggle-BPu81Wuv.js.map +1 -0
- package/dist/beta.js +10 -9
- package/dist/beta.js.map +1 -1
- package/dist/filter-state-Bx3aYS1r.js +1627 -0
- package/dist/filter-state-Bx3aYS1r.js.map +1 -0
- package/dist/{FilterBar.css → filter-state.css} +19 -33
- package/dist/index.js +9 -10
- package/dist/index.js.map +1 -1
- package/dist/src/beta/components/FilterBar/FilterBar.d.ts +12 -10
- package/dist/src/beta/components/FilterBar/FilterDateList.d.ts +15 -5
- package/dist/src/beta/components/FilterBar/FilterDateRange.d.ts +34 -29
- package/dist/src/beta/components/FilterBar/FilterDateSingle.d.ts +31 -22
- package/dist/src/beta/components/FilterBar/FilterDrawer.d.ts +1 -1
- package/dist/src/beta/components/FilterBar/FilterItemWrapper.d.ts +4 -12
- package/dist/src/beta/components/FilterBar/FilterNumericRange.d.ts +29 -0
- package/dist/src/beta/components/FilterBar/FilterPopoverButton.d.ts +86 -0
- package/dist/src/beta/components/FilterBar/FilterToggleButton.d.ts +2 -2
- package/dist/src/beta/components/FilterBar/FilterTriggerButton.d.ts +50 -0
- package/dist/src/beta/components/FilterBar/index.d.ts +1 -1
- package/dist/src/beta/components/FilterBar/internal/FilterGroupContext.d.ts +5 -9
- package/dist/src/beta/components/FilterBar/internal/adapters/asyncMultiSelect.d.ts +6 -0
- package/dist/src/beta/components/FilterBar/internal/adapters/asyncSelect.d.ts +6 -0
- package/dist/src/beta/components/FilterBar/internal/adapters/boolean.d.ts +3 -0
- package/dist/src/beta/components/FilterBar/internal/adapters/custom.d.ts +3 -0
- package/dist/src/beta/components/FilterBar/internal/adapters/date.d.ts +5 -0
- package/dist/src/beta/components/FilterBar/internal/adapters/dateList.d.ts +5 -0
- package/dist/src/beta/components/FilterBar/internal/adapters/dateRange.d.ts +8 -0
- package/dist/src/beta/components/FilterBar/internal/adapters/index.d.ts +15 -0
- package/dist/src/beta/components/FilterBar/internal/adapters/multiSelect.d.ts +6 -0
- package/dist/src/beta/components/FilterBar/internal/adapters/numericRange.d.ts +3 -0
- package/dist/src/beta/components/FilterBar/internal/adapters/singleSelect.d.ts +6 -0
- package/dist/src/beta/components/FilterBar/internal/adapters/types.d.ts +78 -0
- package/dist/src/beta/components/FilterBar/internal/types.d.ts +166 -61
- package/dist/src/beta/components/FilterBar/internal/utils/dateListLibraryOptions.d.ts +2 -2
- package/dist/src/beta/components/FilterBar/internal/utils/filter-state.d.ts +2 -40
- package/dist/src/beta/components/FilterBar/internal/utils/test.d.ts +13 -28
- package/dist/src/beta/components/FilterBar/internal/utils/value-compare.d.ts +14 -0
- package/dist/src/beta/components/MultiSelectField/internal/MultiSelectFieldComboboxMode.d.ts +1 -1
- package/dist/src/beta/components/MultiSelectField/internal/MultiSelectFieldSelectMode.d.ts +1 -1
- package/dist/src/beta/components/MultiSelectField/internal/types.d.ts +4 -2
- package/dist/src/beta/components/MultiSelectField/internal/useComboMultiple.d.ts +7 -5
- package/dist/src/beta/components/MultiSelectField/internal/useSelectModeMultiple.d.ts +5 -2
- package/dist/src/beta/components/MultiSelectField/types.d.ts +21 -36
- package/dist/src/beta/components/MultiSelectMenu/MultiSelectMenu.d.ts +1 -0
- package/dist/src/beta/components/MultiSelectMenu/types.d.ts +52 -12
- package/dist/src/beta/components/SavedFiltersButton/SavedFiltersButton.d.ts +40 -0
- package/dist/src/beta/components/SavedFiltersButton/index.d.ts +2 -0
- package/dist/src/beta/components/SavedFiltersButton/internal/AddSavedFilterDrawer.d.ts +27 -0
- package/dist/src/beta/components/SavedFiltersButton/internal/EditSavedFiltersDrawer.d.ts +38 -0
- package/dist/src/beta/components/SavedFiltersButton/types.d.ts +147 -0
- package/dist/src/beta/components/SelectField/types.d.ts +7 -11
- package/dist/src/beta/components/SelectMenu/internal/useMenuInteraction.d.ts +8 -1
- package/dist/src/beta/components/SelectMenu/types.d.ts +21 -1
- package/dist/src/beta/components/Table/DataTable/internal/DataTablePagination.d.ts +6 -0
- package/dist/src/beta/components/Table/DataTable/types.d.ts +43 -10
- package/dist/src/beta/components/Toolbar/internal/ToolbarContext.d.ts +3 -2
- package/dist/src/beta/components/index.d.ts +1 -0
- package/dist/src/internal/components/MenuFooter/MenuFooter.d.ts +43 -0
- package/dist/src/internal/components/OptionCheckbox.d.ts +6 -0
- package/dist/src/internal/components/OptionContentArea.d.ts +8 -0
- package/dist/src/internal/components/OptionRow.d.ts +10 -0
- package/dist/src/internal/components/OptionsPopover/OptionsPopover.d.ts +4 -4
- package/dist/src/internal/hooks/index.d.ts +2 -0
- package/dist/src/internal/hooks/useBulkActionRunner.d.ts +41 -0
- package/dist/src/internal/hooks/useConfirmationDraft.d.ts +21 -0
- package/dist/src/internal/types/bulkActionTypes.d.ts +39 -0
- package/dist/src/internal/types/confirmationTypes.d.ts +19 -0
- package/dist/src/internal/types/optionContent.d.ts +19 -0
- package/dist/src/internal/types/selectFieldInternalTypes.d.ts +2 -0
- package/dist/{syncFilterUtils-COxBIkt6.js → syncFilterUtils-BEKek64h.js} +163 -124
- package/dist/syncFilterUtils-BEKek64h.js.map +1 -0
- package/dist/syncFilterUtils.css +96 -59
- package/dist/{Combobox-Cp7M4-4r.js → useInfiniteCombobox-CknXmqlQ.js} +185 -10
- package/dist/useInfiniteCombobox-CknXmqlQ.js.map +1 -0
- package/dist/{useMenuInteraction-C4RU5Fdq.js → useMenuInteraction-CpAOHSJu.js} +118 -5
- package/dist/useMenuInteraction-CpAOHSJu.js.map +1 -0
- package/dist/useMenuInteraction.css +28 -0
- package/dist/{useToggleSelection-B5PnTuT2.js → useToggleSelection-B-Z80gy2.js} +53 -4
- package/dist/useToggleSelection-B-Z80gy2.js.map +1 -0
- package/package.json +3 -3
- package/dist/Combobox-Cp7M4-4r.js.map +0 -1
- package/dist/DateFieldRange-Be_I9GTp.js.map +0 -1
- package/dist/FilterBar-yysyZ-t1.js +0 -1797
- package/dist/FilterBar-yysyZ-t1.js.map +0 -1
- package/dist/ListView.module-CKUQP3kf.js.map +0 -1
- package/dist/MultiSelectFieldSync-BMVROOjy.js.map +0 -1
- package/dist/MultiSelectMenuSync-BNPp_2Bm.js.map +0 -1
- package/dist/SelectMenuSync-C-PFemsQ.js.map +0 -1
- package/dist/SelectTriggerBase-Ds6I7Qbr.js.map +0 -1
- package/dist/ToolbarButtonToggle-C06cqJ6F.js.map +0 -1
- package/dist/src/beta/components/FilterBar/FilterButton.d.ts +0 -33
- package/dist/src/beta/components/FilterBar/FilterSelect.d.ts +0 -29
- package/dist/syncFilterUtils-COxBIkt6.js.map +0 -1
- package/dist/useInfiniteCombobox-WcRgC9p6.js +0 -179
- package/dist/useInfiniteCombobox-WcRgC9p6.js.map +0 -1
- package/dist/useMenuInteraction-C4RU5Fdq.js.map +0 -1
- package/dist/useToggleSelection-B5PnTuT2.js.map +0 -1
- /package/dist/{Combobox.css → useInfiniteCombobox.css} +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { AriaAttributes, CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { AiMarkWithTooltipOrPopoverProps,
|
|
3
|
-
import { SelectFieldGroupByValue, SelectFieldOption } from '../SelectField/types';
|
|
2
|
+
import { AiMarkWithTooltipOrPopoverProps, LayoutUtilProps, Size } from '../../../types';
|
|
3
|
+
import { SelectFieldGroupByValue, SelectFieldOption, SelectFieldOptionContent } from '../SelectField/types';
|
|
4
4
|
import { ChipProps } from '../../../components/Chip';
|
|
5
5
|
import { AddNewItemProps } from '../../../internal/types/addNewItemTypes';
|
|
6
|
+
import { BulkActionConfig } from '../../../internal/types/bulkActionTypes';
|
|
6
7
|
/**
|
|
7
8
|
* Partial chip props that can be returned from the `getChipProps` callback.
|
|
8
9
|
* Supports `icon` or `avatar` (mutually exclusive) and all other chip props as optional overrides.
|
|
@@ -34,6 +35,11 @@ export type MultiSelectFieldHandle = {
|
|
|
34
35
|
invalidate: () => void;
|
|
35
36
|
};
|
|
36
37
|
export type MultiSelectFieldGroupByValue = SelectFieldGroupByValue;
|
|
38
|
+
/**
|
|
39
|
+
* Rich content configuration for a MultiSelectField option row.
|
|
40
|
+
* Controls the avatar, icon, description, and chip display within an option.
|
|
41
|
+
*/
|
|
42
|
+
export type MultiSelectFieldOptionContent = SelectFieldOptionContent;
|
|
37
43
|
export type MultiSelectFieldOption = SelectFieldOption;
|
|
38
44
|
export type MultiSelectFieldGroupedOption = MultiSelectFieldOption & {
|
|
39
45
|
group: MultiSelectFieldGroupByValue;
|
|
@@ -210,27 +216,18 @@ type MultiSelectFieldCommonProps = {
|
|
|
210
216
|
* Configuration for the "Select All" option at the top of the list.
|
|
211
217
|
* When provided, a "Select All" option will be shown while the search input is empty.
|
|
212
218
|
*
|
|
219
|
+
* Pass exactly one of `onClick` (fire-and-forget; the consumer commits via
|
|
220
|
+
* `onSelectedOptionsChange`) or `compute` (returns the next selection; the
|
|
221
|
+
* field commits the result for you, with sync or async support).
|
|
222
|
+
*
|
|
223
|
+
* While a `compute` promise is pending, the bulk row shows a loading state,
|
|
224
|
+
* all option rows are disabled, and stale resolutions are silently discarded.
|
|
225
|
+
*
|
|
213
226
|
* Select All and Select Filtered are mutually exclusive:
|
|
214
227
|
* - Select All is shown when the search input is empty.
|
|
215
228
|
* - Select Filtered (if provided) is shown when a search term is active.
|
|
216
229
|
*/
|
|
217
|
-
selectAll?:
|
|
218
|
-
/**
|
|
219
|
-
* The label to display for the "Select All" option.
|
|
220
|
-
* @default "Select All"
|
|
221
|
-
*/
|
|
222
|
-
label?: string;
|
|
223
|
-
/**
|
|
224
|
-
* Callback when the "Select All" option is clicked.
|
|
225
|
-
* The parent component is responsible for handling the select/deselect all logic.
|
|
226
|
-
*/
|
|
227
|
-
onClick: () => void;
|
|
228
|
-
/**
|
|
229
|
-
* Check state for the "Select All" option.
|
|
230
|
-
* @default false
|
|
231
|
-
*/
|
|
232
|
-
checkState: boolean | CheckState;
|
|
233
|
-
};
|
|
230
|
+
selectAll?: BulkActionConfig;
|
|
234
231
|
/**
|
|
235
232
|
* Function that receives the current search value and returns configuration for
|
|
236
233
|
* the "Select Filtered" option at the top of the list.
|
|
@@ -238,28 +235,16 @@ type MultiSelectFieldCommonProps = {
|
|
|
238
235
|
* When provided and a search term is active, a "Select Filtered" option will be shown
|
|
239
236
|
* instead of "Select All". This allows selecting all options matching the current filter.
|
|
240
237
|
*
|
|
238
|
+
* See `selectAll` for the `onClick` / `compute` choice.
|
|
239
|
+
*
|
|
241
240
|
* Select All and Select Filtered are mutually exclusive:
|
|
242
241
|
* - Select All (if provided) is shown when the search input is empty.
|
|
243
242
|
* - Select Filtered is shown when a search term is active.
|
|
244
243
|
*
|
|
245
244
|
* @param searchValue - The current search input value
|
|
246
|
-
* @returns
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
* selectFiltered={(searchValue) => ({
|
|
250
|
-
* label: `Select items matching "${searchValue}"`,
|
|
251
|
-
* onClick: () => handleSelectFiltered(searchValue),
|
|
252
|
-
* checkState: allFilteredSelected ? "checked" : "unchecked",
|
|
253
|
-
* })}
|
|
254
|
-
*/
|
|
255
|
-
selectFiltered?: (searchValue: string) => {
|
|
256
|
-
/** The label to display. @default `Select items matching "${searchValue}"` */
|
|
257
|
-
label?: string;
|
|
258
|
-
/** Callback when clicked. */
|
|
259
|
-
onClick: () => void;
|
|
260
|
-
/** Check state for the option. */
|
|
261
|
-
checkState: boolean | CheckState;
|
|
262
|
-
};
|
|
245
|
+
* @returns BulkActionConfig describing the row
|
|
246
|
+
*/
|
|
247
|
+
selectFiltered?: (searchValue: string) => BulkActionConfig;
|
|
263
248
|
/**
|
|
264
249
|
* When true, restricts the field to a single row height.
|
|
265
250
|
* Overflow chips will be collapsed into a "+N" indicator.
|
|
@@ -18,6 +18,7 @@ import { MultiSelectMenuHandle, MultiSelectMenuProps } from './types';
|
|
|
18
18
|
* - Controlled selection state
|
|
19
19
|
* - Configurable popover width
|
|
20
20
|
* - Optional "Add new item" affordance below the option list with consumer-owned dialog
|
|
21
|
+
* - Optional confirmation mode that buffers selection until Apply is clicked
|
|
21
22
|
*
|
|
22
23
|
* @example
|
|
23
24
|
* <MultiSelectMenu
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { KeyboardEvent, ReactElement, RefObject } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { SelectFieldGroupByValue, SelectFieldOption } from '../SelectField/types';
|
|
2
|
+
import { SelectFieldGroupByValue, SelectFieldOption, SelectFieldOptionContent } from '../SelectField/types';
|
|
4
3
|
import { MultiSelectFieldCacheOptions, MultiSelectFieldEagerLoader, MultiSelectFieldGroupLazyLoader, MultiSelectFieldOffsetLazyLoader, MultiSelectFieldPageLazyLoader, MultiSelectFieldPinnedOptions, MultiSelectFieldSearchProps } from '../MultiSelectField/types';
|
|
5
4
|
import { AddNewItemProps } from '../../../internal/types/addNewItemTypes';
|
|
5
|
+
import { ConfirmationProp } from '../../../internal/types/confirmationTypes';
|
|
6
|
+
import { BulkActionConfig } from '../../../internal/types/bulkActionTypes';
|
|
7
|
+
/**
|
|
8
|
+
* Configuration for the "Select All" / "Select Filtered" rows.
|
|
9
|
+
*/
|
|
10
|
+
export type MultiSelectMenuBulkActionConfig = BulkActionConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Rich content configuration for a MultiSelectMenu option row.
|
|
13
|
+
* Controls the avatar, icon, description, and chip display within an option.
|
|
14
|
+
*/
|
|
15
|
+
export type MultiSelectMenuOptionContent = SelectFieldOptionContent;
|
|
6
16
|
export type MultiSelectMenuOption = SelectFieldOption;
|
|
7
17
|
export type MultiSelectMenuGroupByValue = SelectFieldGroupByValue;
|
|
8
18
|
/**
|
|
@@ -121,28 +131,58 @@ type MultiSelectMenuCommonProps = {
|
|
|
121
131
|
/**
|
|
122
132
|
* Configuration for the "Select All" option at the top of the list.
|
|
123
133
|
* Shown when the search input is empty.
|
|
134
|
+
*
|
|
135
|
+
* Pass exactly one of `onClick` (fire-and-forget; the consumer commits via
|
|
136
|
+
* `onSelectedOptionsChange`) or `compute` (returns the next selection;
|
|
137
|
+
* integrates with confirmation drafts and supports async resolution).
|
|
138
|
+
*
|
|
139
|
+
* `compute` is required when you want the action to participate in the
|
|
140
|
+
* confirmation draft. While a `compute` promise is pending, the menu shows
|
|
141
|
+
* a loading state, disables all options, and disables Apply.
|
|
124
142
|
*/
|
|
125
|
-
selectAll?:
|
|
126
|
-
label?: string;
|
|
127
|
-
onClick: () => void;
|
|
128
|
-
checkState: boolean | CheckState;
|
|
129
|
-
};
|
|
143
|
+
selectAll?: MultiSelectMenuBulkActionConfig;
|
|
130
144
|
/**
|
|
131
145
|
* Function that receives the current search value and returns configuration for
|
|
132
146
|
* the "Select Filtered" option at the top of the list.
|
|
133
147
|
* Shown when a search term is active (instead of Select All).
|
|
148
|
+
*
|
|
149
|
+
* See `selectAll` for the `onClick` / `compute` choice.
|
|
134
150
|
*/
|
|
135
|
-
selectFiltered?: (searchValue: string) =>
|
|
136
|
-
label?: string;
|
|
137
|
-
onClick: () => void;
|
|
138
|
-
checkState: boolean | CheckState;
|
|
139
|
-
};
|
|
151
|
+
selectFiltered?: (searchValue: string) => MultiSelectMenuBulkActionConfig;
|
|
140
152
|
/**
|
|
141
153
|
* Width of the popover. Only applies when `displayMenuAs="popover"` (or when the adaptive mode resolves to popover). Has no effect in dialog mode.
|
|
142
154
|
* Accepts a CSS width value or "reference" to match the trigger element's width.
|
|
143
155
|
* @default 320
|
|
144
156
|
*/
|
|
145
157
|
popoverWidth?: "reference" | number | string;
|
|
158
|
+
/**
|
|
159
|
+
* When set, the menu becomes a buffered selection: clicks update a draft
|
|
160
|
+
* value inside the open menu, and `onSelectedOptionsChange` only fires when
|
|
161
|
+
* the user clicks Apply. Dismissing the menu (Escape, click outside,
|
|
162
|
+
* toggling the trigger) discards the draft. Pass `true` for the default
|
|
163
|
+
* "Apply" / "Cancel" labels, or an object to customize.
|
|
164
|
+
*
|
|
165
|
+
* Note: a `selectAll` / `selectFiltered` row configured with `onClick`
|
|
166
|
+
* bypasses the draft and applies immediately. Use the `compute` variant
|
|
167
|
+
* to integrate the bulk action with the draft.
|
|
168
|
+
* @default undefined (off — selections apply immediately)
|
|
169
|
+
*/
|
|
170
|
+
confirmation?: ConfirmationProp;
|
|
171
|
+
/**
|
|
172
|
+
* Configures a "Clear" button in the menu footer. Presence of this prop
|
|
173
|
+
* enables the button; omit to suppress.
|
|
174
|
+
*
|
|
175
|
+
* - `onClick` — called when the user clicks Clear.
|
|
176
|
+
* - `label` — button label (default "Clear").
|
|
177
|
+
* - `disabled` — whether the button is inert. Filter adapters typically
|
|
178
|
+
* tie this to `!isActive(filter)` so the button is dim when nothing is
|
|
179
|
+
* selected.
|
|
180
|
+
*/
|
|
181
|
+
clear?: {
|
|
182
|
+
onClick: () => void;
|
|
183
|
+
label?: string;
|
|
184
|
+
disabled?: boolean;
|
|
185
|
+
};
|
|
146
186
|
} & MultiSelectMenuSearchProps & AddNewItemProps;
|
|
147
187
|
type MultiSelectMenuGroupingProps = {
|
|
148
188
|
/**
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SavedFiltersButtonProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* `SavedFiltersButton` is an opt-in companion to FilterBar that lets users
|
|
4
|
+
* apply, save, edit, and delete preset filter selections. It is fully
|
|
5
|
+
* stateless: the consumer owns the `savedFilters` array and writes its own
|
|
6
|
+
* persistence (server, localStorage, etc.) by reacting to the callbacks the
|
|
7
|
+
* component fires.
|
|
8
|
+
*
|
|
9
|
+
* Visually it's a single Button trigger that opens a popover listing the
|
|
10
|
+
* presets, with two footer actions:
|
|
11
|
+
*
|
|
12
|
+
* - **Save Current Filter** opens a drawer that snapshots `currentFilters`
|
|
13
|
+
* into a new preset.
|
|
14
|
+
* - **Edit Saved Filters** opens a drawer listing every preset with edit
|
|
15
|
+
* affordances; clicking edit on a row drills into a per-preset form
|
|
16
|
+
* reusing the FilterBar adapter `renderDrawer` machinery.
|
|
17
|
+
*
|
|
18
|
+
* Apply, save, update, and delete are all delivered as consumer callbacks
|
|
19
|
+
* (`onApplySavedFilter`, `onSaveCurrentFilter`, `onUpdateSavedFilter`,
|
|
20
|
+
* `onDeleteSavedFilter`). Promise-returning callbacks are supported with
|
|
21
|
+
* loading state on the relevant submit button and success/error alerts on
|
|
22
|
+
* the parent drawer.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* <SavedFiltersButton
|
|
26
|
+
* savedFilters={presets}
|
|
27
|
+
* currentFilters={filters}
|
|
28
|
+
* onApplySavedFilter={(preset) => setFilters(preset.filters)}
|
|
29
|
+
* onSaveCurrentFilter={async ({ name, filters }) => {
|
|
30
|
+
* await api.savePreset({ name, filters });
|
|
31
|
+
* refetchPresets();
|
|
32
|
+
* }}
|
|
33
|
+
* onUpdateSavedFilter={async (id, update) => api.updatePreset(id, update)}
|
|
34
|
+
* onDeleteSavedFilter={async (id) => api.deletePreset(id)}
|
|
35
|
+
* />
|
|
36
|
+
*/
|
|
37
|
+
export declare const SavedFiltersButton: {
|
|
38
|
+
(props: SavedFiltersButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
displayName: string;
|
|
40
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Filter } from '../../FilterBar/internal/types';
|
|
2
|
+
type AddSavedFilterDrawerProps = {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
/** Snapshot of filters captured when the drawer opened. */
|
|
6
|
+
filtersSnapshot: Filter[];
|
|
7
|
+
onSave: (payload: {
|
|
8
|
+
name: string;
|
|
9
|
+
filters: Filter[];
|
|
10
|
+
}) => void | Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Consumer-supplied name validator. Returning a string blocks Add and is
|
|
13
|
+
* surfaced as the field's error message; `undefined` allows submit.
|
|
14
|
+
*/
|
|
15
|
+
validateName?: (name: string) => string | undefined;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Drawer rendered when the user clicks "Save Current Filter" in the
|
|
19
|
+
* SavedFiltersButton popover. Captures a name and emits `onSave` with the
|
|
20
|
+
* filters snapshot. Supports async `onSave`; while pending the Add button
|
|
21
|
+
* shows a loading spinner and the form is disabled.
|
|
22
|
+
*
|
|
23
|
+
* If `onSave` rejects, the drawer stays open with the current input so the
|
|
24
|
+
* user can retry or cancel. On success the drawer closes.
|
|
25
|
+
*/
|
|
26
|
+
export declare const AddSavedFilterDrawer: ({ open, onClose, filtersSnapshot, onSave, validateName, }: AddSavedFilterDrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SavedFilter, SavedFiltersAlertText } from '../types';
|
|
2
|
+
type EditSavedFiltersDrawerProps = {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
savedFilters: SavedFilter[];
|
|
6
|
+
/** Drilldown's "Update Filter" action. May return a promise. */
|
|
7
|
+
onUpdate?: (id: string, update: {
|
|
8
|
+
name: string;
|
|
9
|
+
filters: SavedFilter["filters"];
|
|
10
|
+
}) => void | Promise<void>;
|
|
11
|
+
/** Drilldown's "Delete Filter" action. May return a promise. */
|
|
12
|
+
onDelete?: (id: string) => void | Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Optional drag-to-reorder callback. When provided, the list view renders
|
|
15
|
+
* each row as a `DndSort.Card` with a drag handle and emits the new
|
|
16
|
+
* `orderedIds` after a drop. When omitted, the list renders as a static
|
|
17
|
+
* stack with no handles.
|
|
18
|
+
*/
|
|
19
|
+
onReorder?: (orderedIds: string[]) => void | Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Optional validator for the name field in the drilldown. The `currentId`
|
|
22
|
+
* is set to the preset being edited so the consumer can permit the row's
|
|
23
|
+
* own name in uniqueness checks.
|
|
24
|
+
*/
|
|
25
|
+
validateName?: (name: string, currentId?: string) => string | undefined;
|
|
26
|
+
/** Optional override for the auto-managed alert text. */
|
|
27
|
+
alertText?: SavedFiltersAlertText;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Drawer that lets the user manage existing saved filters. Composed of two
|
|
31
|
+
* views — a list of presets (the Drawer host) and a per-preset edit screen
|
|
32
|
+
* (a `DrillDown` child) that reuses the FilterBar adapter `renderDrawer`
|
|
33
|
+
* machinery to render edit fields. Navigation between the two is driven by
|
|
34
|
+
* `useDrillDown`, which also wires the back-button affordance built into
|
|
35
|
+
* `DrillDown.Header`.
|
|
36
|
+
*/
|
|
37
|
+
export declare const EditSavedFiltersDrawer: ({ open, onClose, savedFilters, onUpdate, onDelete, onReorder, validateName, alertText, }: EditSavedFiltersDrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Filter } from '../FilterBar/internal/types';
|
|
3
|
+
/**
|
|
4
|
+
* A consumer-owned preset of filter values. The component never mutates these
|
|
5
|
+
* — it only emits callbacks describing the user's intent (apply, save, update,
|
|
6
|
+
* delete). The consumer holds the source-of-truth list and re-renders
|
|
7
|
+
* `SavedFiltersButton` with the updated array.
|
|
8
|
+
*
|
|
9
|
+
* `filters` is a snapshot of the bar's full filter schema with the preset's
|
|
10
|
+
* values baked in, in the same shape as `FilterBar`'s `filters` prop. That
|
|
11
|
+
* uniformity lets the edit drilldown reuse the FilterBar adapter
|
|
12
|
+
* `renderDrawer` machinery without bespoke per-filter-type rendering.
|
|
13
|
+
*/
|
|
14
|
+
export type SavedFilter = {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
filters: Filter[];
|
|
18
|
+
/**
|
|
19
|
+
* When true, this preset cannot be edited from the Edit drawer — its row
|
|
20
|
+
* renders without an Edit affordance and the drilldown is unreachable.
|
|
21
|
+
* Useful for marking system / seeded presets as immutable while still
|
|
22
|
+
* letting users edit their own.
|
|
23
|
+
*/
|
|
24
|
+
disableEdit?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* When true, the "Delete Filter" button is omitted from the drilldown
|
|
27
|
+
* footer for this preset. Independent of `disableEdit` — a preset can be
|
|
28
|
+
* editable but not deletable, or vice versa.
|
|
29
|
+
*/
|
|
30
|
+
disableDelete?: boolean;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Text overrides for the auto-managed success / error Alerts that appear on
|
|
34
|
+
* the "Edit Saved Filters" drawer after a save, update, delete, or reorder
|
|
35
|
+
* settles.
|
|
36
|
+
*
|
|
37
|
+
* All entries are optional; unset values fall back to generic defaults.
|
|
38
|
+
*/
|
|
39
|
+
export type SavedFiltersAlertText = {
|
|
40
|
+
saveSuccess?: string;
|
|
41
|
+
saveError?: string;
|
|
42
|
+
updateSuccess?: string;
|
|
43
|
+
updateError?: string;
|
|
44
|
+
deleteSuccess?: string;
|
|
45
|
+
deleteError?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Surfaced on the list view when `onReorderSavedFilters` rejects. No
|
|
48
|
+
* matching `reorderSuccess` — successful reorders don't show an alert,
|
|
49
|
+
* because the new order is its own visible confirmation.
|
|
50
|
+
*/
|
|
51
|
+
reorderError?: string;
|
|
52
|
+
};
|
|
53
|
+
export type SavedFiltersButtonProps = {
|
|
54
|
+
/** The presets to list. Consumer owns the storage. */
|
|
55
|
+
savedFilters: SavedFilter[];
|
|
56
|
+
/**
|
|
57
|
+
* The filters currently committed in the FilterBar (or any analogous
|
|
58
|
+
* filter source). Used as the snapshot payload when the user clicks
|
|
59
|
+
* "Save Current Filter."
|
|
60
|
+
*/
|
|
61
|
+
currentFilters: Filter[];
|
|
62
|
+
/**
|
|
63
|
+
* Called when the user picks a preset from the list. The consumer is
|
|
64
|
+
* responsible for pushing `saved.filters` into their FilterBar (or
|
|
65
|
+
* equivalent) state. The popover closes immediately after click.
|
|
66
|
+
*/
|
|
67
|
+
onApplySavedFilter: (saved: SavedFilter) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Called when the user submits the "Save Current Filter" drawer. The
|
|
70
|
+
* payload `filters` is the snapshot of `currentFilters` at the moment the
|
|
71
|
+
* drawer opened. May return a promise; while pending, the Add button
|
|
72
|
+
* shows a loading state. Rejecting surfaces an error alert; resolving
|
|
73
|
+
* surfaces a success alert and closes the drawer.
|
|
74
|
+
*/
|
|
75
|
+
onSaveCurrentFilter: (payload: {
|
|
76
|
+
name: string;
|
|
77
|
+
filters: Filter[];
|
|
78
|
+
}) => void | Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Called when the user submits the drilldown's "Update Filter" action.
|
|
81
|
+
* Same async / alert semantics as `onSaveCurrentFilter`.
|
|
82
|
+
*/
|
|
83
|
+
onUpdateSavedFilter: (id: string, update: {
|
|
84
|
+
name: string;
|
|
85
|
+
filters: Filter[];
|
|
86
|
+
}) => void | Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Called when the user clicks "Delete Filter" in the drilldown. Same
|
|
89
|
+
* async / alert semantics as `onSaveCurrentFilter`.
|
|
90
|
+
*/
|
|
91
|
+
onDeleteSavedFilter: (id: string) => void | Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Optional validation for the name field in the save / edit flows. Return
|
|
94
|
+
* an error string to block submit (Add / Update is disabled); return
|
|
95
|
+
* `undefined` when valid. The optional `currentId` is set during an edit
|
|
96
|
+
* flow so the consumer can permit the row's own name in uniqueness
|
|
97
|
+
* checks.
|
|
98
|
+
*/
|
|
99
|
+
validateName?: (name: string, currentId?: string) => string | undefined;
|
|
100
|
+
/** Optional override for the auto-managed alert text. */
|
|
101
|
+
alertText?: SavedFiltersAlertText;
|
|
102
|
+
/**
|
|
103
|
+
* Optional id of the preset that is currently applied. When set, the
|
|
104
|
+
* matching row in the popover renders with a check affordance. The
|
|
105
|
+
* component does no comparison itself — the consumer is responsible for
|
|
106
|
+
* tracking which preset (if any) reflects the current filter state, and
|
|
107
|
+
* for clearing the id when the filters drift (e.g. the user edited a
|
|
108
|
+
* filter directly).
|
|
109
|
+
*
|
|
110
|
+
* Defaults to `undefined`, in which case no row is marked active.
|
|
111
|
+
*/
|
|
112
|
+
activeSavedFilterId?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Optional trigger label override.
|
|
115
|
+
* @default "Saved Filters"
|
|
116
|
+
*/
|
|
117
|
+
label?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Optional override for the popover's empty-state content, shown when
|
|
120
|
+
* `savedFilters` is empty. Defaults to "No saved filters yet."
|
|
121
|
+
*
|
|
122
|
+
* - Pass a `string` to keep the default subdued/small `Text` styling — only
|
|
123
|
+
* the wording changes.
|
|
124
|
+
* - Pass any other `ReactNode` (a CTA, an illustration, a styled block) to
|
|
125
|
+
* take full control of the empty-state content.
|
|
126
|
+
*
|
|
127
|
+
* Separately, when `savedFilters` is empty the "Edit Saved Filters" footer
|
|
128
|
+
* button is disabled, so this empty-state is the only thing the user sees
|
|
129
|
+
* in the popover.
|
|
130
|
+
*/
|
|
131
|
+
emptyState?: ReactNode;
|
|
132
|
+
/**
|
|
133
|
+
* Called when the user drags a preset to a new position in the "Edit Saved
|
|
134
|
+
* Filters" drawer. The payload is the full list of preset ids in their new
|
|
135
|
+
* order; the consumer is responsible for re-sorting their `savedFilters`
|
|
136
|
+
* array to match.
|
|
137
|
+
*
|
|
138
|
+
* Providing this callback opts the Edit drawer into drag-to-reorder UI —
|
|
139
|
+
* each row picks up a drag handle and keyboard-accessible drop affordance.
|
|
140
|
+
* Omitting it renders the list as a static stack with no handles.
|
|
141
|
+
*
|
|
142
|
+
* May return a promise. A rejection surfaces as a danger alert on the
|
|
143
|
+
* list view using `alertText.reorderError` (or the thrown Error's message
|
|
144
|
+
* when present).
|
|
145
|
+
*/
|
|
146
|
+
onReorderSavedFilters?: (orderedIds: string[]) => void | Promise<void>;
|
|
147
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AriaAttributes, CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { AiMarkWithTooltipOrPopoverProps, LayoutUtilProps, Size } from '../../../types';
|
|
3
|
-
import {
|
|
3
|
+
import { OptionContent } from '../../../internal/types/optionContent';
|
|
4
4
|
import { AddNewItemProps } from '../../../internal/types/addNewItemTypes';
|
|
5
5
|
/**
|
|
6
6
|
* Configuration options for the SelectField cache.
|
|
@@ -21,6 +21,11 @@ export type SelectFieldHandle = {
|
|
|
21
21
|
invalidate: () => void;
|
|
22
22
|
};
|
|
23
23
|
export type SelectFieldGroupByValue = string | number;
|
|
24
|
+
/**
|
|
25
|
+
* Rich content configuration for a SelectField option row.
|
|
26
|
+
* Controls the avatar, icon, description, and chip display within an option.
|
|
27
|
+
*/
|
|
28
|
+
export type SelectFieldOptionContent = OptionContent;
|
|
24
29
|
export type SelectFieldOption = {
|
|
25
30
|
id: string | number;
|
|
26
31
|
label: string;
|
|
@@ -28,16 +33,7 @@ export type SelectFieldOption = {
|
|
|
28
33
|
group?: SelectFieldGroupByValue;
|
|
29
34
|
disabled?: boolean;
|
|
30
35
|
extra?: Record<string, unknown>;
|
|
31
|
-
content?:
|
|
32
|
-
title?: string;
|
|
33
|
-
description?: string;
|
|
34
|
-
chips?: Pick<ChipProps, "label" | "color" | "textWrap">[];
|
|
35
|
-
avatar?: Pick<AvatarProps, "name" | "status" | "color" | "image">;
|
|
36
|
-
icon?: Pick<IconProps, "svg" | "color"> & {
|
|
37
|
-
/** Accessible label for the icon. When omitted, the icon is treated as decorative. */
|
|
38
|
-
label?: string;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
36
|
+
content?: SelectFieldOptionContent;
|
|
41
37
|
};
|
|
42
38
|
export type SelectFieldGroupedOption = SelectFieldOption & {
|
|
43
39
|
group: SelectFieldGroupByValue;
|
|
@@ -12,6 +12,13 @@ export type UseMenuInteractionConfig = {
|
|
|
12
12
|
id: string;
|
|
13
13
|
triggerRef: RefObject<HTMLButtonElement>;
|
|
14
14
|
label: string;
|
|
15
|
+
/**
|
|
16
|
+
* Controlled open state. The consumer owns `[isOpen, setIsOpen]` so other
|
|
17
|
+
* hooks in the same render (e.g. `useConfirmationDraft`) can read the same
|
|
18
|
+
* value without a one-render lag.
|
|
19
|
+
*/
|
|
20
|
+
isOpen: boolean;
|
|
21
|
+
setIsOpen: (open: boolean) => void;
|
|
15
22
|
onImplicitClose?: () => void;
|
|
16
23
|
onExplicitClose?: () => void;
|
|
17
24
|
};
|
|
@@ -56,7 +63,7 @@ type ItemReturnProps = {
|
|
|
56
63
|
};
|
|
57
64
|
export type GetMenuPropsFn = (opts?: MenuPropsArg) => MenuReturnProps;
|
|
58
65
|
export type GetItemPropsFn = (opts: ItemPropsArg) => ItemReturnProps;
|
|
59
|
-
export declare const useMenuInteraction: ({ items, sectionsMeta: _sectionsMeta, onItemActivate, selectedItemIds, displayAs: _displayAs, closeOnActivate, disabled, id, triggerRef, label, onImplicitClose, onExplicitClose, }: UseMenuInteractionConfig) => {
|
|
66
|
+
export declare const useMenuInteraction: ({ items, sectionsMeta: _sectionsMeta, onItemActivate, selectedItemIds, displayAs: _displayAs, closeOnActivate, disabled, id, triggerRef, label, isOpen, setIsOpen, onImplicitClose, onExplicitClose, }: UseMenuInteractionConfig) => {
|
|
60
67
|
isOpen: boolean;
|
|
61
68
|
openMenu: () => void;
|
|
62
69
|
closeMenu: (options?: {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { KeyboardEvent, ReactElement, RefObject } from 'react';
|
|
2
|
-
import { SelectFieldCacheOptions, SelectFieldEagerLoader, SelectFieldGroupByValue, SelectFieldGroupLazyLoader, SelectFieldGroupedOption, SelectFieldOffsetLazyLoader, SelectFieldOption, SelectFieldPageLazyLoader, SelectFieldPinnedOptions, SelectFieldSearchProps } from '../SelectField/types';
|
|
2
|
+
import { SelectFieldCacheOptions, SelectFieldEagerLoader, SelectFieldGroupByValue, SelectFieldGroupLazyLoader, SelectFieldGroupedOption, SelectFieldOffsetLazyLoader, SelectFieldOption, SelectFieldOptionContent, SelectFieldPageLazyLoader, SelectFieldPinnedOptions, SelectFieldSearchProps } from '../SelectField/types';
|
|
3
3
|
import { AddNewItemProps } from '../../../internal/types/addNewItemTypes';
|
|
4
|
+
/**
|
|
5
|
+
* Rich content configuration for a SelectMenu option row.
|
|
6
|
+
* Controls the avatar, icon, description, and chip display within an option.
|
|
7
|
+
*/
|
|
8
|
+
export type SelectMenuOptionContent = SelectFieldOptionContent;
|
|
4
9
|
export type SelectMenuOption = SelectFieldOption;
|
|
5
10
|
export type SelectMenuGroupByValue = SelectFieldGroupByValue;
|
|
6
11
|
export type SelectMenuGroupedOption = SelectFieldGroupedOption;
|
|
@@ -125,6 +130,21 @@ type SelectMenuCommonProps = {
|
|
|
125
130
|
* @default 320
|
|
126
131
|
*/
|
|
127
132
|
popoverWidth?: "reference" | number | string;
|
|
133
|
+
/**
|
|
134
|
+
* Configures a "Clear" button in the menu footer. Presence of this prop
|
|
135
|
+
* enables the button; omit to suppress.
|
|
136
|
+
*
|
|
137
|
+
* - `onClick` — called when the user clicks Clear.
|
|
138
|
+
* - `label` — button label (default "Clear").
|
|
139
|
+
* - `disabled` — whether the button is inert. Filter adapters typically
|
|
140
|
+
* tie this to `!isActive(filter)` so the button is dim when nothing is
|
|
141
|
+
* selected.
|
|
142
|
+
*/
|
|
143
|
+
clear?: {
|
|
144
|
+
onClick: () => void;
|
|
145
|
+
label?: string;
|
|
146
|
+
disabled?: boolean;
|
|
147
|
+
};
|
|
128
148
|
} & SelectMenuSearchProps & AddNewItemProps;
|
|
129
149
|
type SelectMenuGroupingProps = {
|
|
130
150
|
/**
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { PaginationProps } from '../../../../..';
|
|
2
|
+
type DataTableCursorPaginationProps = Pick<PaginationProps, "page" | "itemsPerPage" | "onPageChange" | "onItemsPerPageChange" | "itemsPerPageOptions"> & {
|
|
3
|
+
hasNextPage?: boolean;
|
|
4
|
+
hasPrevPage?: boolean;
|
|
5
|
+
};
|
|
2
6
|
export type DataTablePaginationProps = Pick<PaginationProps, "page" | "itemsPerPage" | "totalItemCount" | "showCount" | "onPageChange" | "onItemsPerPageChange" | "itemsPerPageOptions">;
|
|
3
7
|
export declare const DataTablePagination: ({ showCount, ...props }: DataTablePaginationProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const DataTableCursorPagination: ({ page, itemsPerPage, itemsPerPageOptions, hasNextPage, hasPrevPage, onPageChange, onItemsPerPageChange, }: DataTableCursorPaginationProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -53,9 +53,12 @@ export type DataTableCacheOptions = {
|
|
|
53
53
|
maxSize?: number;
|
|
54
54
|
};
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
56
|
+
* Pagination behavior for DataTable.
|
|
57
|
+
* "offset" uses numbered pages with a known total row count.
|
|
58
|
+
* "cursor" uses previous/next availability for unknown-total pagination.
|
|
57
59
|
*/
|
|
58
|
-
export type
|
|
60
|
+
export type DataTablePaginationMode = "offset" | "cursor";
|
|
61
|
+
type DataTablePaginationBaseConfig<T> = {
|
|
59
62
|
/**
|
|
60
63
|
* Number of rows displayed per page
|
|
61
64
|
* @default 25
|
|
@@ -96,28 +99,57 @@ export type DataTablePaginationConfig<T> = {
|
|
|
96
99
|
* Callback when page changes. Receives the new page index (0-based)
|
|
97
100
|
*/
|
|
98
101
|
onPageChange?: (pageIndex: number) => void;
|
|
102
|
+
/**
|
|
103
|
+
* Key that triggers data refetch when changed.
|
|
104
|
+
* Useful for forcing refetch when external filters change.
|
|
105
|
+
* When changed, the page index automatically resets to 0.
|
|
106
|
+
*/
|
|
107
|
+
refreshKey?: string | number;
|
|
108
|
+
/**
|
|
109
|
+
* Configuration for caching loadPageData results.
|
|
110
|
+
* Caching is enabled by default. Set `{ enabled: false }` to disable.
|
|
111
|
+
*/
|
|
112
|
+
cache?: DataTableCacheOptions;
|
|
113
|
+
};
|
|
114
|
+
export type DataTableOffsetPaginationConfig<T> = DataTablePaginationBaseConfig<T> & {
|
|
115
|
+
/**
|
|
116
|
+
* Offset pagination mode.
|
|
117
|
+
* @default "offset"
|
|
118
|
+
*/
|
|
119
|
+
mode?: "offset";
|
|
99
120
|
/**
|
|
100
121
|
* Whether to display the item count information in pagination
|
|
101
122
|
* @default true
|
|
102
123
|
*/
|
|
103
124
|
showCount?: boolean;
|
|
104
125
|
/**
|
|
105
|
-
* Total number of rows across all pages. Falls back to data.length if not provided.
|
|
126
|
+
* Total number of rows across all pages in offset mode. Falls back to data.length if not provided.
|
|
106
127
|
* Useful for server-side pagination scenarios where totalRowCount may differ from data array length.
|
|
107
128
|
*/
|
|
108
129
|
totalRowCount?: number;
|
|
130
|
+
hasNextPage?: never;
|
|
131
|
+
hasPrevPage?: never;
|
|
132
|
+
};
|
|
133
|
+
export type DataTableCursorPaginationConfig<T> = DataTablePaginationBaseConfig<T> & {
|
|
109
134
|
/**
|
|
110
|
-
*
|
|
111
|
-
* Useful for forcing refetch when external filters change.
|
|
112
|
-
* When changed, the page index automatically resets to 0.
|
|
135
|
+
* Cursor pagination mode for datasets where the total row count is unknown.
|
|
113
136
|
*/
|
|
114
|
-
|
|
137
|
+
mode: "cursor";
|
|
115
138
|
/**
|
|
116
|
-
*
|
|
117
|
-
* Caching is enabled by default. Set `{ enabled: false }` to disable.
|
|
139
|
+
* Whether another page is available.
|
|
118
140
|
*/
|
|
119
|
-
|
|
141
|
+
hasNextPage: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Whether a previous page is available.
|
|
144
|
+
*/
|
|
145
|
+
hasPrevPage: boolean;
|
|
146
|
+
showCount?: never;
|
|
147
|
+
totalRowCount?: never;
|
|
120
148
|
};
|
|
149
|
+
/**
|
|
150
|
+
* Configuration for pagination in DataTable
|
|
151
|
+
*/
|
|
152
|
+
export type DataTablePaginationConfig<T> = DataTableOffsetPaginationConfig<T> | DataTableCursorPaginationConfig<T>;
|
|
121
153
|
/**
|
|
122
154
|
* Ref handle for DataTable component
|
|
123
155
|
* @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).
|
|
@@ -135,3 +167,4 @@ export type DataTableRef = {
|
|
|
135
167
|
*/
|
|
136
168
|
clearCache: () => void;
|
|
137
169
|
};
|
|
170
|
+
export {};
|
|
@@ -25,9 +25,10 @@ export type ToolbarContextProps = {
|
|
|
25
25
|
*/
|
|
26
26
|
orderedIds?: string[];
|
|
27
27
|
/**
|
|
28
|
-
* Overflow behavior type
|
|
28
|
+
* Overflow behavior type. Defaults to wrap behavior when omitted.
|
|
29
|
+
* @default "wrap"
|
|
29
30
|
*/
|
|
30
|
-
overflow
|
|
31
|
+
overflow?: ToolbarOverflowTypes;
|
|
31
32
|
/**
|
|
32
33
|
* Size of toolbar child components
|
|
33
34
|
*/
|