@commercelayer/app-elements 7.15.1 → 7.16.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/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-DAyuCXwB.js";
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-CvmWwRKp.js";
3
3
  export {
4
4
  s as A,
5
5
  t as ActionButtons,
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { t as D, c as T, m as p, a as N } from "./main-DAyuCXwB.js";
2
+ import { t as D, c as T, m as p, a as N } from "./main-CvmWwRKp.js";
3
3
  function W(t, e) {
4
4
  const n = () => T(e?.in, NaN), a = I(t);
5
5
  let s;
@@ -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.
@@ -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,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.15.1",
3
+ "version": "7.16.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "files": [