@commercelayer/app-elements 1.17.1 → 1.17.2

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.
@@ -2,7 +2,7 @@
2
2
  var ur = Object.defineProperty;
3
3
  var lr = (a, n, e) => n in a ? ur(a, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[n] = e;
4
4
  var D = (a, n, e) => (lr(a, typeof n != "symbol" ? n + "" : n, e), e);
5
- import { a as Ut, c as pr, i as Fe, p as dr, b as hr, f as fr, o as mr, d as q, j as be, I as gr, g as yr, w as wr, X as Dr } from "./main-CwwTeAUF.js";
5
+ import { a as Ut, c as pr, i as Fe, p as dr, b as hr, f as fr, o as mr, d as q, j as be, I as gr, g as yr, w as wr, X as Dr } from "./main-bvrBIWhO.js";
6
6
  import * as C from "react";
7
7
  import f, { createElement as vr, Component as br, useLayoutEffect as On, useEffect as Nn, createRef as kr, forwardRef as Mr } from "react";
8
8
  import * as _r from "react-dom";
@@ -26009,7 +26009,7 @@ function fy({
26009
26009
  }
26010
26010
  fy.displayName = "InputCurrencyRange";
26011
26011
  const p8e = nM(
26012
- async () => await import("./InputDateComponent-DdFak1F0.js").then((e) => ({
26012
+ async () => await import("./InputDateComponent-DocNjnnQ.js").then((e) => ({
26013
26013
  default: e.InputDateComponent
26014
26014
  }))
26015
26015
  ), hs = G(
@@ -34193,38 +34193,40 @@ function Uy({
34193
34193
  placeholder: t,
34194
34194
  onUpdate: n,
34195
34195
  queryString: r,
34196
- predicateWhitelist: a
34196
+ predicateWhitelist: a,
34197
+ debounceMs: s
34197
34198
  }) {
34198
- var p, v;
34199
- const { adaptUrlQueryToFormValues: s, adaptFormValuesToUrlQuery: u } = $s({
34199
+ var v, y;
34200
+ const { adaptUrlQueryToFormValues: u, adaptFormValuesToUrlQuery: d } = $s({
34200
34201
  instructions: e,
34201
34202
  predicateWhitelist: a
34202
- }), d = (p = e.find(
34203
- (y) => y.type === "textSearch" && y.render.component === "searchBar"
34204
- )) == null ? void 0 : p.sdk.predicate, c = (y) => {
34205
- if (d == null)
34203
+ }), c = (v = e.find(
34204
+ (E) => E.type === "textSearch" && E.render.component === "searchBar"
34205
+ )) == null ? void 0 : v.sdk.predicate, f = (E) => {
34206
+ if (c == null)
34206
34207
  return;
34207
- const E = s({
34208
+ const x = u({
34208
34209
  queryString: r
34209
- }), x = u({
34210
+ }), M = d({
34210
34211
  formValues: {
34211
- ...E,
34212
- [d]: ve(y == null ? void 0 : y.trim()) ? void 0 : y
34212
+ ...x,
34213
+ [c]: ve(E == null ? void 0 : E.trim()) ? void 0 : E
34213
34214
  }
34214
34215
  });
34215
- n(x);
34216
+ n(M);
34216
34217
  };
34217
- if (d == null)
34218
+ if (c == null)
34218
34219
  return /* @__PURE__ */ A.jsx("div", { children: "No textSearch filter set" });
34219
- const f = s({ queryString: r })[d], h = (v = Ks(f)[0]) == null ? void 0 : v.toString();
34220
+ const h = u({ queryString: r })[c], p = (y = Ks(h)[0]) == null ? void 0 : y.toString();
34220
34221
  return /* @__PURE__ */ A.jsx(
34221
34222
  G2,
34222
34223
  {
34223
34224
  placeholder: t,
34224
- initialValue: h,
34225
- onClear: c,
34226
- onSearch: c,
34227
- autoFocus: h !== void 0 && h.length > 0
34225
+ initialValue: p,
34226
+ onClear: f,
34227
+ onSearch: f,
34228
+ autoFocus: p !== void 0 && p.length > 0,
34229
+ debounceMs: s
34228
34230
  }
34229
34231
  );
34230
34232
  }
@@ -34266,29 +34268,31 @@ function z6e({
34266
34268
  onFilterClick: y,
34267
34269
  onUpdate: E,
34268
34270
  searchBarPlaceholder: x,
34271
+ searchBarDebounceMs: M,
34269
34272
  // we need this value as prop to avoid re-rendering the component and losing the focus on searchbar
34270
34273
  // so we can't reuse the `queryString` variable we have in the hook scope
34271
- queryString: M,
34272
- hideSearchBar: C,
34273
- hideFiltersNav: Z
34274
- }) => C === !0 && Z === !0 ? /* @__PURE__ */ A.jsx(A.Fragment, {}) : /* @__PURE__ */ A.jsxs(qe, { top: "4", bottom: "14", children: [
34275
- C === !0 ? null : /* @__PURE__ */ A.jsx(qe, { bottom: "2", children: /* @__PURE__ */ A.jsx(
34274
+ queryString: C,
34275
+ hideSearchBar: Z,
34276
+ hideFiltersNav: O
34277
+ }) => Z === !0 && O === !0 ? /* @__PURE__ */ A.jsx(A.Fragment, {}) : /* @__PURE__ */ A.jsxs(qe, { top: "4", bottom: "14", children: [
34278
+ Z === !0 ? null : /* @__PURE__ */ A.jsx(qe, { bottom: "2", children: /* @__PURE__ */ A.jsx(
34276
34279
  Uy,
34277
34280
  {
34278
34281
  placeholder: x ?? "Search...",
34282
+ debounceMs: M,
34279
34283
  instructions: d,
34280
34284
  onUpdate: E,
34281
- queryString: M,
34285
+ queryString: C,
34282
34286
  predicateWhitelist: t
34283
34287
  }
34284
34288
  ) }),
34285
- Z === !0 ? null : /* @__PURE__ */ A.jsx(
34289
+ O === !0 ? null : /* @__PURE__ */ A.jsx(
34286
34290
  f6e,
34287
34291
  {
34288
34292
  instructions: d,
34289
34293
  onFilterClick: y,
34290
34294
  onUpdate: E,
34291
- queryString: M,
34295
+ queryString: C,
34292
34296
  predicateWhitelist: t
34293
34297
  }
34294
34298
  )
package/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { a4 as s, aK as t, a5 as o, a6 as r, a7 as n, a8 as u, a9 as i, aa as l, ab as p, ac as b, ad as c, aL as d, ae as g, af as S, V as m, aM as I, aN as k, aO as T, aP as D, ag as R, Z as y, _ as h, ah as C, ai as H, aQ as P, b0 as A, b1 as f, b3 as B, b5 as F, b7 as v, bb as L, bd as N, bi as O, bl as G, bn as w, bu as V, bw as x, by as E, bA as M, bC as W, bG as J, bH as U, aj as Y, ak as q, b2 as z, b4 as K, b6 as Q, b8 as Z, ba as _, bc as $, be as j, bf as X, bg as aa, bh as ea, bj as sa, bk as ta, bm as oa, bo as ra, bv as na, bx as ua, bz as ia, bB as la, bD as pa, bE as ba, bF as ca, aR as da, aS as ga, aT as Sa, aU as ma, a0 as Ia, aV as ka, al as Ta, aW as Da, aX as Ra, am as ya, an as ha, ao as Ca, ap as Ha, aY as Pa, bK as Aa, bL as fa, bM as Ba, bN as Fa, bO as va, bP as La, bQ as Na, bR as Oa, aq as Ga, aZ as wa, ar as Va, as as xa, at as Ea, au as Ma, aw as Wa, ax as Ja, ay as Ua, az as Ya, aA as qa, aF as za, aB as Ka, a_ as Qa, aG as Za, aH as _a, aC as $a, aI as ja, aD as Xa, a$ as ae, a1 as ee, aJ as se, aE as te, B as oe, a3 as re, E as ne, F as ue, k as ie, A as le, bp as pe, b9 as be, l as ce, m as de, q as ge, C as Se, D as me, G as Ie, bT as ke, bU as Te, bq as De, s as Re, t as ye, u as he, v as Ce, bV as He, bW as Pe, bX as Ae, bY as fe, bZ as Be, H as Fe, J as ve, b_ as Le, b$ as Ne, c0 as Oe, c1 as Ge, K as we, L as Ve, c2 as xe, c3 as Ee, c4 as Me, O as We, P as Je, e as Ue, M as Ye, N as qe, h as ze, br as Ke, bs as Qe, bt as Ze, n as _e, r as $e, x as je, bI as Xe, y as as, z as es, Q as ss, W as ts, Y as os, R as rs, S as ns, T as us, U as is, bS as ls, $ as ps, a2 as bs, bJ as cs, av as ds } from "./main-CwwTeAUF.js";
2
+ import { a4 as s, aK as t, a5 as o, a6 as r, a7 as n, a8 as u, a9 as i, aa as l, ab as p, ac as b, ad as c, aL as d, ae as g, af as S, V as m, aM as I, aN as k, aO as T, aP as D, ag as R, Z as y, _ as h, ah as C, ai as H, aQ as P, b0 as A, b1 as f, b3 as B, b5 as F, b7 as v, bb as L, bd as N, bi as O, bl as G, bn as w, bu as V, bw as x, by as E, bA as M, bC as W, bG as J, bH as U, aj as Y, ak as q, b2 as z, b4 as K, b6 as Q, b8 as Z, ba as _, bc as $, be as j, bf as X, bg as aa, bh as ea, bj as sa, bk as ta, bm as oa, bo as ra, bv as na, bx as ua, bz as ia, bB as la, bD as pa, bE as ba, bF as ca, aR as da, aS as ga, aT as Sa, aU as ma, a0 as Ia, aV as ka, al as Ta, aW as Da, aX as Ra, am as ya, an as ha, ao as Ca, ap as Ha, aY as Pa, bK as Aa, bL as fa, bM as Ba, bN as Fa, bO as va, bP as La, bQ as Na, bR as Oa, aq as Ga, aZ as wa, ar as Va, as as xa, at as Ea, au as Ma, aw as Wa, ax as Ja, ay as Ua, az as Ya, aA as qa, aF as za, aB as Ka, a_ as Qa, aG as Za, aH as _a, aC as $a, aI as ja, aD as Xa, a$ as ae, a1 as ee, aJ as se, aE as te, B as oe, a3 as re, E as ne, F as ue, k as ie, A as le, bp as pe, b9 as be, l as ce, m as de, q as ge, C as Se, D as me, G as Ie, bT as ke, bU as Te, bq as De, s as Re, t as ye, u as he, v as Ce, bV as He, bW as Pe, bX as Ae, bY as fe, bZ as Be, H as Fe, J as ve, b_ as Le, b$ as Ne, c0 as Oe, c1 as Ge, K as we, L as Ve, c2 as xe, c3 as Ee, c4 as Me, O as We, P as Je, e as Ue, M as Ye, N as qe, h as ze, br as Ke, bs as Qe, bt as Ze, n as _e, r as $e, x as je, bI as Xe, y as as, z as es, Q as ss, W as ts, Y as os, R as rs, S as ns, T as us, U as is, bS as ls, $ as ps, a2 as bs, bJ as cs, av as ds } from "./main-bvrBIWhO.js";
3
3
  export {
4
4
  s as A,
5
5
  t as ActionButtons,
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
+ import { type SearchBarProps } from '../../composite/SearchBar';
2
3
  import { type FiltersInstructions } from './types';
3
- export interface FilterSearchBarProps {
4
+ export interface FilterSearchBarProps extends Pick<SearchBarProps, 'placeholder' | 'debounceMs'> {
4
5
  /**
5
6
  * Array of instruction items to build the filters behaviors
6
7
  */
@@ -16,10 +17,6 @@ export interface FilterSearchBarProps {
16
17
  * It must be "reactive", so most of the time it should come for router.
17
18
  */
18
19
  queryString: string;
19
- /**
20
- * Input placeholder
21
- */
22
- placeholder?: string;
23
20
  /**
24
21
  * By default, we strip out all filters that are not part of the `instructions` array.
25
22
  * The option `predicateWhitelist` is used to whitelist a set of predicates that you want to use as filters.
@@ -34,7 +31,7 @@ export interface FilterSearchBarProps {
34
31
  */
35
32
  predicateWhitelist: string[];
36
33
  }
37
- declare function FiltersSearchBar({ instructions, placeholder, onUpdate, queryString, predicateWhitelist }: FilterSearchBarProps): JSX.Element;
34
+ declare function FiltersSearchBar({ instructions, placeholder, onUpdate, queryString, predicateWhitelist, debounceMs }: FilterSearchBarProps): JSX.Element;
38
35
  declare namespace FiltersSearchBar {
39
36
  var displayName: string;
40
37
  }
@@ -46,6 +46,11 @@ interface UseResourceFiltersHook {
46
46
  * @default 'Search...'
47
47
  */
48
48
  searchBarPlaceholder?: string;
49
+ /**
50
+ * Milliseconds to wait before triggering the search bar callback
51
+ * @default 500
52
+ */
53
+ searchBarDebounceMs?: number;
49
54
  }) => JSX.Element;
50
55
  /**
51
56
  * Form component with filters fields based on provided instructions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercelayer/app-elements",
3
- "version": "1.17.1",
3
+ "version": "1.17.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "files": [