@commercelayer/app-elements 7.15.1 → 7.17.0
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/dist/{CodeEditorComponent-rMQXVk1G.js → CodeEditorComponent-CCPIIE7I.js} +2 -2
- package/dist/{InputDateComponent-CF9aTmc1.js → InputDateComponent-DVDHFKZ3.js} +2 -2
- package/dist/{RuleEngineComponent-8X7tfn88.js → RuleEngineComponent-DkwpT4pk.js} +90 -80
- package/dist/{en-B-7ylwWx.js → en-BE_K3P12.js} +6 -3
- package/dist/{fetchCoreResourcesSuggestions-oblxhsk6.js → fetchCoreResourcesSuggestions-rR0lV7qP.js} +1 -1
- package/dist/{it-BXPKgQsm.js → it-B7w1qsox.js} +6 -3
- package/dist/locales/en.d.ts +4 -1
- package/dist/{main-DAyuCXwB.js → main-Dex3Vb3n.js} +10439 -9737
- package/dist/main.js +1 -1
- package/dist/{parseISO-FyBqaqSI.js → parseISO-XPb8b6wN.js} +1 -1
- package/dist/ui/composite/SearchBar.d.ts +15 -0
- package/dist/ui/forms/InputSelect/AsyncPaginateComponent.d.ts +15 -0
- package/dist/ui/forms/InputSelect/CreatableComponent.d.ts +2 -2
- package/dist/ui/forms/InputSelect/GenericAsyncComponent.d.ts +3 -3
- package/dist/ui/forms/InputSelect/HookedInputSelect.d.ts +9 -2
- package/dist/ui/forms/InputSelect/InputSelect.d.ts +47 -5
- package/dist/ui/forms/InputSelect/SelectComponent.d.ts +2 -2
- package/dist/ui/forms/InputSelect/index.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Condition/hooks.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/InputResourceSelector.d.ts +1 -1
- package/dist/ui/resources/useResourceFilters/FiltersBar.d.ts +7 -1
- package/dist/ui/resources/useResourceFilters/FiltersSearchBar.d.ts +2 -2
- package/dist/ui/resources/useResourceFilters/useResourceFilters.test.d.ts +1 -0
- package/dist/ui/resources/useResourceFilters/useResourceSelectOptions.d.ts +17 -2
- package/dist/ui/resources/useResourceList/useMetricsCursorTrail.d.ts +37 -0
- package/dist/ui/resources/useResourceList/usePageInUrl.d.ts +33 -0
- package/package.json +2 -1
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { an as s, ao as t, ap as o, aq as r, ar as c, as as n, at as u, af as d, au as i, av as l, aw as p, ax as g, ay as b, al as m, az as S, aA as k, aB as I, a1 as T, ae as R, a9 as D, aC as y, aD as C, aE as h, aF as A, aG as P, aH as f, aI as H, aJ as v, aK as F, aL as L, aM as B, aN as O, aO as E, aP as N, aQ as M, aR as G, aS as w, aT as V, aU as x, aV as W, aW as J, aX as U, aY as j, aZ as q, a_ as z, a$ as Y, b0 as K, ah as Q, b1 as X, a0 as Z, ab as _, b2 as $, b3 as aa, b4 as ea, b5 as sa, aj as ta, ai as oa, b6 as ra, b7 as ca, b8 as na, b9 as ua, ba as da, a7 as ia, bb as la, bc as pa, bd as ga, be as ba, bf as ma, bg as Sa, bh as ka, bi as Ia, bj as Ta, bk as Ra, bl as Da, bm as ya, bn as Ca, bo as ha, bp as Aa, bq as Pa, br as fa, bs as Ha, bt as va, bu as Fa, bv as La, bw as Ba, bx as Oa, by as Ea, bz as Na, bA as Ma, bB as Ga, bC as wa, bD as Va, bE as xa, bF as Wa, bG as Ja, bH as Ua, bI as ja, bJ as qa, bK as za, bL as Ya, bM as Ka, bN as Qa, bO as Xa, bP as Za, bQ as _a, bR as $a, bS as ae, ag as ee, bT as se, bU as te, bV as oe, bW as re, bX as ce, bY as ne, bZ as ue, b_ as de, b$ as ie, c0 as le, c1 as pe, a8 as ge, c2 as be, c3 as me, c4 as Se, c5 as ke, c6 as Ie, c7 as Te, c8 as Re, c9 as De, ca as ye, cb as Ce, cc as he, cd as Ae, ce as Pe, cf as fe, cg as He, ch as ve, ci as Fe, cj as Le, ck as Be, cl as Oe, cm as Ee, cn as Ne, co as Me, cp as Ge, cq as we, cr as Ve, cs as xe, ct as We, cu as Je, cv as Ue, cw as je, cx as qe, cy as ze, cz as Ye, cA as Ke, cB as Qe, cC as Xe, cD as Ze, cE as _e, cF as $e, cG as as, cH as es, cI as ss, cJ as ts, cK as os, cL as rs, cM as cs, cN as ns, cO as us, cP as ds, cQ as is, cR as ls, cS as ps, cT as gs, cU as bs, cV as ms, cW as Ss, cX as ks, cY as Is, cZ as Ts, S as Rs, c_ as Ds, c$ as ys, d0 as Cs, ad as hs, aa as As, d1 as Ps, d2 as fs, d3 as Hs, d4 as vs, d5 as Fs, d6 as Ls, d7 as Bs, d8 as Os, d9 as Es, da as Ns, db as Ms, dc as Gs, dd as ws, de as Vs, df as xs, dg as Ws, dh as Js, di as Us, dj as js, a5 as qs, a4 as zs, dk as Ys, dl as Ks, dm as Qs, dn as Xs, dp as Zs, dq as _s, dr as $s, ds as at, dt as et, du as st, dv as tt, dw as ot, dx as rt, u as ct, dy as nt, ac as ut, dz as dt, dA as it, dB as lt } from "./main-
|
|
2
|
+
import { an as s, ao as t, ap as o, aq as r, ar as c, as as n, at as u, af as d, au as i, av as l, aw as p, ax as g, ay as b, al as m, az as S, aA as k, aB as I, a1 as T, ae as R, a9 as D, aC as y, aD as C, aE as h, aF as A, aG as P, aH as f, aI as H, aJ as v, aK as F, aL as L, aM as B, aN as O, aO as E, aP as N, aQ as M, aR as G, aS as w, aT as V, aU as x, aV as W, aW as J, aX as U, aY as j, aZ as q, a_ as z, a$ as Y, b0 as K, ah as Q, b1 as X, a0 as Z, ab as _, b2 as $, b3 as aa, b4 as ea, b5 as sa, aj as ta, ai as oa, b6 as ra, b7 as ca, b8 as na, b9 as ua, ba as da, a7 as ia, bb as la, bc as pa, bd as ga, be as ba, bf as ma, bg as Sa, bh as ka, bi as Ia, bj as Ta, bk as Ra, bl as Da, bm as ya, bn as Ca, bo as ha, bp as Aa, bq as Pa, br as fa, bs as Ha, bt as va, bu as Fa, bv as La, bw as Ba, bx as Oa, by as Ea, bz as Na, bA as Ma, bB as Ga, bC as wa, bD as Va, bE as xa, bF as Wa, bG as Ja, bH as Ua, bI as ja, bJ as qa, bK as za, bL as Ya, bM as Ka, bN as Qa, bO as Xa, bP as Za, bQ as _a, bR as $a, bS as ae, ag as ee, bT as se, bU as te, bV as oe, bW as re, bX as ce, bY as ne, bZ as ue, b_ as de, b$ as ie, c0 as le, c1 as pe, a8 as ge, c2 as be, c3 as me, c4 as Se, c5 as ke, c6 as Ie, c7 as Te, c8 as Re, c9 as De, ca as ye, cb as Ce, cc as he, cd as Ae, ce as Pe, cf as fe, cg as He, ch as ve, ci as Fe, cj as Le, ck as Be, cl as Oe, cm as Ee, cn as Ne, co as Me, cp as Ge, cq as we, cr as Ve, cs as xe, ct as We, cu as Je, cv as Ue, cw as je, cx as qe, cy as ze, cz as Ye, cA as Ke, cB as Qe, cC as Xe, cD as Ze, cE as _e, cF as $e, cG as as, cH as es, cI as ss, cJ as ts, cK as os, cL as rs, cM as cs, cN as ns, cO as us, cP as ds, cQ as is, cR as ls, cS as ps, cT as gs, cU as bs, cV as ms, cW as Ss, cX as ks, cY as Is, cZ as Ts, S as Rs, c_ as Ds, c$ as ys, d0 as Cs, ad as hs, aa as As, d1 as Ps, d2 as fs, d3 as Hs, d4 as vs, d5 as Fs, d6 as Ls, d7 as Bs, d8 as Os, d9 as Es, da as Ns, db as Ms, dc as Gs, dd as ws, de as Vs, df as xs, dg as Ws, dh as Js, di as Us, dj as js, a5 as qs, a4 as zs, dk as Ys, dl as Ks, dm as Qs, dn as Xs, dp as Zs, dq as _s, dr as $s, ds as at, dt as et, du as st, dv as tt, dw as ot, dx as rt, u as ct, dy as nt, ac as ut, dz as dt, dA as it, dB as lt } from "./main-Dex3Vb3n.js";
|
|
3
3
|
export {
|
|
4
4
|
s as A,
|
|
5
5
|
t as ActionButtons,
|
|
@@ -34,6 +34,21 @@ export interface SearchBarProps extends Pick<SkeletonTemplateProps, "isLoading"
|
|
|
34
34
|
* Variant of the search bar
|
|
35
35
|
*/
|
|
36
36
|
variant?: "outline";
|
|
37
|
+
/**
|
|
38
|
+
* Number of characters the user has to type before a search is triggered.
|
|
39
|
+
*
|
|
40
|
+
* Leading and trailing `*` are not counted: where they act as wildcards they
|
|
41
|
+
* stand in for the rest of the term rather than being part of it, so `fo*` is
|
|
42
|
+
* two characters and does not reach a threshold of three.
|
|
43
|
+
*
|
|
44
|
+
* Below the threshold the search reads as empty, so the list shows unfiltered
|
|
45
|
+
* results instead of the ones from the last term long enough to run.
|
|
46
|
+
*
|
|
47
|
+
* A single character matches most of any collection, so the request it costs
|
|
48
|
+
* buys nothing. Pass `0` to search on every keystroke anyway.
|
|
49
|
+
* @default 2
|
|
50
|
+
*/
|
|
51
|
+
minSearchLength?: number;
|
|
37
52
|
}
|
|
38
53
|
/**
|
|
39
54
|
* This component renders a search bar with a clear button with debounced `onSearch` callback.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { GroupBase, SelectInstance, StylesConfig } from 'react-select';
|
|
2
|
+
import { InputSelectBaseProps, InputSelectValue, LoadAsyncValuesPaginated } from './InputSelect';
|
|
3
|
+
export interface AsyncPaginateSelectComponentProps extends Omit<InputSelectBaseProps, "label" | "hint" | "asTextSearch" | "isCreatable"> {
|
|
4
|
+
loadAsyncValues: LoadAsyncValuesPaginated;
|
|
5
|
+
styles: StylesConfig<InputSelectValue>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The async select that loads the next page as its menu is scrolled, instead of
|
|
9
|
+
* leaving everything past the first page reachable only by typing.
|
|
10
|
+
*
|
|
11
|
+
* Options are always what the server returned — client-side filtering stays off,
|
|
12
|
+
* as filtering a list that is only partly loaded would quietly hide matches
|
|
13
|
+
* sitting on a page that has not been fetched yet.
|
|
14
|
+
*/
|
|
15
|
+
export declare const AsyncPaginateSelectComponent: import('react').ForwardRefExoticComponent<AsyncPaginateSelectComponentProps & import('react').RefAttributes<SelectInstance<InputSelectValue, boolean, GroupBase<InputSelectValue>>>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GroupBase, SelectInstance, StylesConfig } from 'react-select';
|
|
2
|
-
import {
|
|
3
|
-
export interface CreatableComponentProps extends Omit<
|
|
2
|
+
import { InputSelectBaseProps, InputSelectValue } from './InputSelect';
|
|
3
|
+
export interface CreatableComponentProps extends Omit<InputSelectBaseProps, "label" | "hint"> {
|
|
4
4
|
styles: StylesConfig<InputSelectValue>;
|
|
5
5
|
}
|
|
6
6
|
export declare const CreatableComponent: import('react').ForwardRefExoticComponent<CreatableComponentProps & import('react').RefAttributes<SelectInstance<InputSelectValue, boolean, GroupBase<InputSelectValue>>>>;
|
|
@@ -2,9 +2,9 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { GroupBase, SelectInstance, StylesConfig } from 'react-select';
|
|
3
3
|
import { default as AsyncSelect } from 'react-select/async';
|
|
4
4
|
import { default as AsyncCreatableSelect } from 'react-select/async-creatable';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { InputSelectBaseProps, InputSelectValue, LoadAsyncValues } from './InputSelect';
|
|
6
|
+
export interface GenericAsyncSelectComponentProps extends Omit<InputSelectBaseProps, "label" | "hint"> {
|
|
7
|
+
loadAsyncValues: LoadAsyncValues;
|
|
8
8
|
styles: StylesConfig<InputSelectValue>;
|
|
9
9
|
}
|
|
10
10
|
export declare const GenericAsyncSelectComponent: React.ForwardRefExoticComponent<GenericAsyncSelectComponentProps & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { InputSelectAsyncProps, InputSelectBaseProps, PossibleSelectValue } from './InputSelect';
|
|
2
|
+
interface HookedInputSelectOwnProps extends Omit<InputSelectBaseProps, "onSelect" | "defaultValue"> {
|
|
3
3
|
/**
|
|
4
4
|
* field name to match hook-form state
|
|
5
5
|
*/
|
|
@@ -27,9 +27,16 @@ export interface HookedInputSelectProps extends Omit<InputSelectProps, "onSelect
|
|
|
27
27
|
*/
|
|
28
28
|
onSelect?: (value: PossibleSelectValue) => void;
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* The async half is intersected in rather than derived with `Omit`/`Pick`, as
|
|
32
|
+
* both collapse a union — and with it the rule that `infiniteScroll` requires the
|
|
33
|
+
* paginated loader.
|
|
34
|
+
*/
|
|
35
|
+
export type HookedInputSelectProps = HookedInputSelectOwnProps & InputSelectAsyncProps;
|
|
30
36
|
/**
|
|
31
37
|
* `InputSelect` component ready to be used with the `react-hook-form` context.
|
|
32
38
|
* Value to be stored in the field can be controlled from the `pathToValue` prop.
|
|
33
39
|
* @see InputSelect
|
|
34
40
|
*/
|
|
35
41
|
export declare const HookedInputSelect: React.FC<HookedInputSelectProps>;
|
|
42
|
+
export {};
|
|
@@ -12,7 +12,7 @@ export interface InputSelectValue {
|
|
|
12
12
|
isDisabled?: boolean;
|
|
13
13
|
}
|
|
14
14
|
export type PossibleSelectValue = MultiValue<InputSelectValue> | SingleValue<InputSelectValue>;
|
|
15
|
-
export interface
|
|
15
|
+
export interface InputSelectBaseProps extends InputWrapperBaseProps {
|
|
16
16
|
/**
|
|
17
17
|
* Initial values to populate the select options. It can be a flat array of values or a grouped array.
|
|
18
18
|
*/
|
|
@@ -94,10 +94,6 @@ export interface InputSelectProps extends InputWrapperBaseProps {
|
|
|
94
94
|
* CSS class name
|
|
95
95
|
*/
|
|
96
96
|
className?: string;
|
|
97
|
-
/**
|
|
98
|
-
* Function to load async values on search
|
|
99
|
-
*/
|
|
100
|
-
loadAsyncValues?: (inputValue: string) => Promise<GroupedSelectValues | InputSelectValue[]>;
|
|
101
97
|
/**
|
|
102
98
|
* Optional text to display at the bottom of the dropdown menu
|
|
103
99
|
*/
|
|
@@ -132,6 +128,52 @@ export interface InputSelectProps extends InputWrapperBaseProps {
|
|
|
132
128
|
*/
|
|
133
129
|
menuPortalTarget?: HTMLElement | null;
|
|
134
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Loads the options matching what has been typed, all in one go.
|
|
133
|
+
*/
|
|
134
|
+
export type LoadAsyncValues = (inputValue: string) => Promise<GroupedSelectValues | InputSelectValue[]>;
|
|
135
|
+
/**
|
|
136
|
+
* Loads one page of the options matching what has been typed.
|
|
137
|
+
*
|
|
138
|
+
* `hasMore` is what stops the paging: while it is `true` the menu asks for the
|
|
139
|
+
* page after the current one as it is scrolled to the bottom.
|
|
140
|
+
*/
|
|
141
|
+
export type LoadAsyncValuesPaginated = (inputValue: string, meta: {
|
|
142
|
+
page: number;
|
|
143
|
+
}) => Promise<{
|
|
144
|
+
options: InputSelectValue[];
|
|
145
|
+
hasMore: boolean;
|
|
146
|
+
}>;
|
|
147
|
+
/**
|
|
148
|
+
* How the options are loaded, which also decides which select is mounted.
|
|
149
|
+
*
|
|
150
|
+
* The two are kept apart rather than folded into one optional flag so that
|
|
151
|
+
* turning `infiniteScroll` on makes the paginated loader mandatory — a loader
|
|
152
|
+
* that ignores the page it is handed would silently return the first page
|
|
153
|
+
* forever.
|
|
154
|
+
*/
|
|
155
|
+
export type InputSelectAsyncProps = {
|
|
156
|
+
/**
|
|
157
|
+
* Load the next page of options as the menu is scrolled, so that a list
|
|
158
|
+
* longer than one page can be browsed instead of only searched.
|
|
159
|
+
*
|
|
160
|
+
* Opt-in: without it the select keeps loading options the way it always
|
|
161
|
+
* has, one non-paginated request per search.
|
|
162
|
+
*/
|
|
163
|
+
infiniteScroll?: false;
|
|
164
|
+
/**
|
|
165
|
+
* Function to load async values on search
|
|
166
|
+
*/
|
|
167
|
+
loadAsyncValues?: LoadAsyncValues;
|
|
168
|
+
} | {
|
|
169
|
+
infiniteScroll: true;
|
|
170
|
+
/**
|
|
171
|
+
* Function to load one page of async values. Called again with the next
|
|
172
|
+
* page as the menu is scrolled to the bottom.
|
|
173
|
+
*/
|
|
174
|
+
loadAsyncValues: LoadAsyncValuesPaginated;
|
|
175
|
+
};
|
|
176
|
+
export type InputSelectProps = InputSelectBaseProps & InputSelectAsyncProps;
|
|
135
177
|
/**
|
|
136
178
|
* Advanced select component with support for async options loading and multi-select.
|
|
137
179
|
* It's a wrapper around `react-select` with a subset of props exposed.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GroupBase, SelectInstance, StylesConfig } from 'react-select';
|
|
2
|
-
import {
|
|
3
|
-
export interface SelectComponentProps extends Omit<
|
|
2
|
+
import { InputSelectBaseProps, InputSelectValue } from './InputSelect';
|
|
3
|
+
export interface SelectComponentProps extends Omit<InputSelectBaseProps, "label" | "hint"> {
|
|
4
4
|
styles: StylesConfig<InputSelectValue>;
|
|
5
5
|
}
|
|
6
6
|
export declare const SelectComponent: import('react').ForwardRefExoticComponent<SelectComponentProps & import('react').RefAttributes<SelectInstance<InputSelectValue, boolean, GroupBase<InputSelectValue>>>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { HookedInputSelect, type HookedInputSelectProps, } from './HookedInputSelect';
|
|
2
|
-
export { type GroupedSelectValues, InputSelect, type InputSelectProps, type InputSelectValue, type PossibleSelectValue, } from './InputSelect';
|
|
2
|
+
export { type GroupedSelectValues, InputSelect, type InputSelectAsyncProps, type InputSelectBaseProps, type InputSelectProps, type InputSelectValue, type LoadAsyncValues, type LoadAsyncValuesPaginated, type PossibleSelectValue, } from './InputSelect';
|
|
3
3
|
export { flatSelectValues, getDefaultValueFromFlatten, isGroupedSelectValues, isMultiValueSelected, isSingleValueSelected, } from './utils';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { atPath } from '../../CodeEditor/fetchCoreResourcesSuggestions';
|
|
2
2
|
import { SchemaConditionItem } from '../utils';
|
|
3
3
|
import { matcherDictionary } from './utils';
|
|
4
|
-
export declare function getResourceType(resourceId: string | undefined): "bundles" | "markets" | "skus" | "sku_lists" | "tags";
|
|
4
|
+
export declare function getResourceType(resourceId: string | undefined): "bundles" | "customer_groups" | "markets" | "skus" | "sku_lists" | "tags";
|
|
5
5
|
export declare function useResourcePathInfos(item: SchemaConditionItem | null): {
|
|
6
6
|
infos: (Awaited<ReturnType<typeof atPath>> & {
|
|
7
7
|
/** Information about the matcher used in the condition. */
|
|
@@ -4,7 +4,7 @@ import { PossibleSelectValue } from '../InputSelect';
|
|
|
4
4
|
import { ItemWithValue } from './utils';
|
|
5
5
|
export declare const InputResourceSelector: React.FC<{
|
|
6
6
|
value?: ItemWithValue["value"];
|
|
7
|
-
resource: Extract<ListableResourceType, "markets" | "tags" | "skus" | "sku_lists" | "bundles">;
|
|
7
|
+
resource: Extract<ListableResourceType, "markets" | "tags" | "skus" | "sku_lists" | "bundles" | "customer_groups">;
|
|
8
8
|
resourceKey: string;
|
|
9
9
|
isMulti?: boolean;
|
|
10
10
|
onSelect: (selected: PossibleSelectValue) => void;
|
|
@@ -36,6 +36,12 @@ export interface FiltersBarProps {
|
|
|
36
36
|
* @default 500
|
|
37
37
|
*/
|
|
38
38
|
searchBarDebounceMs?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Characters the user has to type before the search runs. Leading and
|
|
41
|
+
* trailing `*` do not count, so a wildcard cannot stand in for them.
|
|
42
|
+
* @default 2
|
|
43
|
+
*/
|
|
44
|
+
searchBarMinLength?: number;
|
|
39
45
|
/**
|
|
40
46
|
* Hide the search bar, keeping the filters button and the pills.
|
|
41
47
|
* @default false
|
|
@@ -57,7 +63,7 @@ interface InternalProps {
|
|
|
57
63
|
* Search bar with the filters button on the right and the applied filters
|
|
58
64
|
* rendered as removable pills below.
|
|
59
65
|
*/
|
|
60
|
-
export declare function FiltersBar({ queryString, onUpdate, defaultValues, onFilterClick, searchBarPlaceholder, searchBarDebounceMs, hideSearchBar, actions, instructions, predicateWhitelist, openDrawer, }: FiltersBarProps & InternalProps): JSX.Element;
|
|
66
|
+
export declare function FiltersBar({ queryString, onUpdate, defaultValues, onFilterClick, searchBarPlaceholder, searchBarDebounceMs, searchBarMinLength, hideSearchBar, actions, instructions, predicateWhitelist, openDrawer, }: FiltersBarProps & InternalProps): JSX.Element;
|
|
61
67
|
export declare namespace FiltersBar {
|
|
62
68
|
var displayName: string;
|
|
63
69
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
2
|
import { SearchBarProps } from '../../composite/SearchBar';
|
|
3
3
|
import { FiltersInstructions } from './types';
|
|
4
|
-
export interface FilterSearchBarProps extends Pick<SearchBarProps, "placeholder" | "debounceMs" | "variant"> {
|
|
4
|
+
export interface FilterSearchBarProps extends Pick<SearchBarProps, "placeholder" | "debounceMs" | "variant" | "minSearchLength"> {
|
|
5
5
|
/**
|
|
6
6
|
* Array of instruction items to build the filters behaviors
|
|
7
7
|
*/
|
|
@@ -31,7 +31,7 @@ export interface FilterSearchBarProps extends Pick<SearchBarProps, "placeholder"
|
|
|
31
31
|
*/
|
|
32
32
|
predicateWhitelist: string[];
|
|
33
33
|
}
|
|
34
|
-
declare function FiltersSearchBar({ instructions, placeholder, onUpdate, queryString, predicateWhitelist, debounceMs, variant, }: FilterSearchBarProps): JSX.Element;
|
|
34
|
+
declare function FiltersSearchBar({ instructions, placeholder, onUpdate, queryString, predicateWhitelist, debounceMs, variant, minSearchLength, }: FilterSearchBarProps): JSX.Element;
|
|
35
35
|
declare namespace FiltersSearchBar {
|
|
36
36
|
var displayName: string;
|
|
37
37
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -18,8 +18,23 @@ export interface ResourceSelectOptions {
|
|
|
18
18
|
recordCount?: number;
|
|
19
19
|
/** Whether the labels of the current selection have been resolved. */
|
|
20
20
|
hasResolvedSelection: boolean;
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Whether anything exists beyond `initialValues`. When it does not, the whole
|
|
23
|
+
* list is already in hand and the select needs no request of its own.
|
|
24
|
+
*/
|
|
25
|
+
hasMorePages: boolean;
|
|
26
|
+
/** Whether typing narrows the list server-side, i.e. `searchBy` is set. */
|
|
27
|
+
isSearchable: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Loads one page of options, narrowed by what has been typed when the
|
|
30
|
+
* instruction sets `searchBy`. Feeds the select's infinite scroll.
|
|
31
|
+
*/
|
|
32
|
+
loadAsyncValues: (hint: string, meta: {
|
|
33
|
+
page: number;
|
|
34
|
+
}) => Promise<{
|
|
35
|
+
options: InputSelectValue[];
|
|
36
|
+
hasMore: boolean;
|
|
37
|
+
}>;
|
|
23
38
|
}
|
|
24
39
|
/**
|
|
25
40
|
* Loads the options of a resource-backed filter select.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface MetricsCursorTrail {
|
|
2
|
+
/**
|
|
3
|
+
* The cursor that opens `page`, or `undefined` when the trail does not hold
|
|
4
|
+
* it — in which case that page cannot be opened at all.
|
|
5
|
+
*/
|
|
6
|
+
cursorFor: (page: number) => string | null | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Record, after loading `page`, the cursor that opens the page after it.
|
|
9
|
+
*/
|
|
10
|
+
record: (page: number, cursor: string | null) => void;
|
|
11
|
+
/** Forget every cursor but page 1's, which is always "no cursor". */
|
|
12
|
+
reset: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The cursor trail of a metrics-backed list, kept in `sessionStorage`.
|
|
16
|
+
*
|
|
17
|
+
* The metrics api only moves forward: the cursor that opens page N is handed
|
|
18
|
+
* back when page N-1 is fetched. Holding those cursors is what lets the pager
|
|
19
|
+
* step backwards, and persisting them is what lets a list reopen on the page it
|
|
20
|
+
* was left on, since going to a details page unmounts the list and would
|
|
21
|
+
* otherwise take the trail with it.
|
|
22
|
+
*
|
|
23
|
+
* `sessionStorage` is the right shelf for it: it is per tab, it survives a
|
|
24
|
+
* reload, and it is gone when the tab is. A trail is private to the session
|
|
25
|
+
* that walked it, and a link someone shares carries no cursor.
|
|
26
|
+
*
|
|
27
|
+
* One entry per list, so nothing accumulates. The entry records the query it
|
|
28
|
+
* was walked against, and a trail measured against a different one is dropped
|
|
29
|
+
* rather than trusted: a cursor is only meaningful for the exact filters and
|
|
30
|
+
* sort that produced it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function useMetricsCursorTrail({ enabled, type, metricsQuery, }: {
|
|
33
|
+
/** Only metrics-backed lists in `pagination` mode keep a trail. */
|
|
34
|
+
enabled: boolean;
|
|
35
|
+
type: string;
|
|
36
|
+
metricsQuery: unknown;
|
|
37
|
+
}): MetricsCursorTrail;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface UsePageInUrlReturn {
|
|
2
|
+
/**
|
|
3
|
+
* The page the url is asking for. `1` when the parameter is absent, or when
|
|
4
|
+
* its value is not a positive integer.
|
|
5
|
+
*/
|
|
6
|
+
requestedPage: number;
|
|
7
|
+
/**
|
|
8
|
+
* Write `page` to the url as a new history entry, so the browser's back
|
|
9
|
+
* button walks back through the pages the user visited.
|
|
10
|
+
*/
|
|
11
|
+
pushPage: (page: number) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Write `page` to the url in place, without a history entry. Use it to
|
|
14
|
+
* correct a page the list could not open: pushing would leave the unservable
|
|
15
|
+
* page in history, so going back would return to it and correct it again,
|
|
16
|
+
* trapping the user on the pager.
|
|
17
|
+
*/
|
|
18
|
+
replacePage: (page: number) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Keeps the current page of a paginated list in the query string.
|
|
22
|
+
*
|
|
23
|
+
* This is what makes the page survive leaving the list and coming back, either
|
|
24
|
+
* with the browser's back button or with `goBack` from `useAppLinking`, which
|
|
25
|
+
* restores the whole url including its query string.
|
|
26
|
+
*
|
|
27
|
+
* Page 1 carries no parameter: it is the default, and a bare url is the one
|
|
28
|
+
* worth sharing.
|
|
29
|
+
*
|
|
30
|
+
* The parameter is not namespaced, so two paginated lists rendered on the same
|
|
31
|
+
* route would share it. No page does that today.
|
|
32
|
+
*/
|
|
33
|
+
export declare function usePageInUrl(): UsePageInUrlReturn;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercelayer/app-elements",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.17.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"react-hook-form": "7.62.0",
|
|
60
60
|
"react-i18next": "^15.7.4",
|
|
61
61
|
"react-select": "^5.10.2",
|
|
62
|
+
"react-select-async-paginate": "^0.7.11",
|
|
62
63
|
"react-toastify": "^11.1.0",
|
|
63
64
|
"react-tooltip": "^5.30.1",
|
|
64
65
|
"stable-hash": "^0.0.6",
|