@bynder/compact-view 5.2.3 → 5.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/AccessToken2.js +1 -1
  2. package/ActiveFilters.js +49 -50
  3. package/AddMedia.js +19 -18
  4. package/Advanced.js +13 -13
  5. package/App.js +60 -59
  6. package/Arrow.js +1 -1
  7. package/AssetFilter.js +38 -38
  8. package/AssetItem.js +10 -17
  9. package/AssetList.js +5 -5
  10. package/AssetTypeItem.js +21 -21
  11. package/AssetsView.js +13 -13
  12. package/Axios2.js +82 -76
  13. package/AxiosError.js +36 -35
  14. package/ButtonAction.js +1 -1
  15. package/CanceledError.js +15 -8
  16. package/Card.js +1 -1
  17. package/Chip.js +1 -1
  18. package/CollectionCard.js +22 -22
  19. package/CollectionItem.js +9 -9
  20. package/CollectionList.js +5 -5
  21. package/CollectionView.js +11 -11
  22. package/ColorPicker.js +1 -1
  23. package/ColorPickerSolid.js +3 -3
  24. package/ColorPickerWithOpacity.js +3 -3
  25. package/Component.js +158 -0
  26. package/Component2.js +4 -0
  27. package/ConfigContext.js +7 -8
  28. package/Container.js +1 -1
  29. package/ContextAction.js +1 -1
  30. package/ControlGroup.js +6 -6
  31. package/Dat.js +33 -32
  32. package/DatDropdownItem.js +1 -1
  33. package/DesignSystemProvider.js +7 -7
  34. package/DirectionSelect.js +11 -10
  35. package/DomainInput.js +19 -11
  36. package/Draggable.js +337 -0
  37. package/Draggable2.js +4 -0
  38. package/DraggableCore.js +312 -0
  39. package/DraggableCore2.js +4 -0
  40. package/Dropdown.js +37 -37
  41. package/Dropdown2.js +1 -1
  42. package/DropdownListItem.js +1 -1
  43. package/FieldSelect.js +19 -17
  44. package/FileSelector.js +38 -37
  45. package/FontPicker.js +1 -1
  46. package/Form.js +1 -1
  47. package/Header.js +5 -4
  48. package/HttpStatusCode.js +7 -1
  49. package/InfiniteScroll.js +1 -1
  50. package/InlineBanner.js +1 -1
  51. package/Input.js +1 -1
  52. package/InterceptorManager.js +2 -1
  53. package/Item.js +8 -8
  54. package/Item4.js +2 -2
  55. package/LeftArrow.js +1 -1
  56. package/ListItem2.js +1 -1
  57. package/ModalBase.js +15 -15
  58. package/NoResults.js +1 -1
  59. package/Option_new.js +36 -29
  60. package/ReactPropTypesSecret.js +10 -0
  61. package/RightArrow.js +1 -1
  62. package/SearchInput.js +1 -1
  63. package/SearchInput2.js +1 -1
  64. package/SelectionFooter.js +41 -31
  65. package/Shield.js +2 -2
  66. package/Smartfilters_new.js +107 -98
  67. package/StatefulAssetList.js +50 -50
  68. package/StoreInitializer.js +32 -16
  69. package/SwitchNLS.js +1 -1
  70. package/TagItem.js +15 -15
  71. package/Tags.js +1 -1
  72. package/Toolbar.js +23 -20
  73. package/Tooltip2.js +1 -1
  74. package/ViewSwitch.js +17 -15
  75. package/_commonjsHelpers.js +28 -3
  76. package/adapters.js +54 -42
  77. package/api/filterAssets.d.ts +1 -1
  78. package/api/getAssets.d.ts +1 -1
  79. package/api/getFilters.d.ts +1 -1
  80. package/api/rest/index.d.ts +1 -1
  81. package/api/rest/types.d.ts +1 -1
  82. package/api2.js +1 -1
  83. package/asset.type.js +1 -1
  84. package/autocomplete.js +1 -1
  85. package/axios.js +1 -1
  86. package/bodyScrollLock.esm.js +68 -0
  87. package/buildURL.js +13 -15
  88. package/checkGlobals.js +1 -1
  89. package/cjs.js +7 -0
  90. package/cjs2.js +15 -0
  91. package/cjs3.js +4 -0
  92. package/clsx.m.js +6 -0
  93. package/clsx.m2.js +15 -0
  94. package/combineMetaproperties.js +3 -1
  95. package/composeSignals.js +1 -1
  96. package/cookieStore.js +1 -1
  97. package/cookies.js +13 -11
  98. package/currentScopes.js +1 -1
  99. package/data.js +1 -1
  100. package/devUtils.js +1 -1
  101. package/dispatchRequest.js +5 -5
  102. package/domFns.js +151 -0
  103. package/domFns2.js +4 -0
  104. package/factoryWithThrowingShims.js +52 -0
  105. package/fetch2.js +156 -128
  106. package/filter/AssetFilterContext.d.ts +3 -3
  107. package/filterAssets.js +1 -1
  108. package/getAsset.js +1 -1
  109. package/getAssetCounts.js +1 -1
  110. package/getAssets.js +1 -1
  111. package/getCollections.js +1 -1
  112. package/getFilterOptions.js +1 -1
  113. package/getFilters.js +1 -1
  114. package/getFilters_new.js +1 -1
  115. package/getPrefix.js +35 -0
  116. package/getPrefix2.js +4 -0
  117. package/getSimilarityAssets.js +1 -1
  118. package/goober.modern.js +75 -0
  119. package/handlers.js +1 -1
  120. package/iconBase.js +56 -0
  121. package/iconContext.js +12 -0
  122. package/iconsManifest.js +222 -0
  123. package/index-esm.js +1 -4
  124. package/index.browser.js +1 -1
  125. package/index.m.js +9 -0
  126. package/index.m2.js +17 -0
  127. package/index10.js +18 -2
  128. package/index11.js +181 -15
  129. package/index112.js +1 -1
  130. package/index12.js +313 -36
  131. package/index13.js +5 -2430
  132. package/index14.js +3 -557
  133. package/index15.js +15 -55
  134. package/index16.js +3 -2
  135. package/index17.js +3 -87
  136. package/index18.js +36 -60
  137. package/index19.js +3 -7
  138. package/index20.js +2429 -12
  139. package/index21.js +557 -10
  140. package/index22.js +1 -1
  141. package/index23.js +119 -6
  142. package/index24.js +39 -7
  143. package/index25.js +2 -5
  144. package/index26.js +86 -9
  145. package/index27.js +55 -8
  146. package/index28.js +6 -636
  147. package/index29.js +8692 -74
  148. package/index3.js +1684 -5
  149. package/index30.js +2 -5
  150. package/index31.js +4 -20
  151. package/index310.js +2 -0
  152. package/index32.js +11 -2
  153. package/index33.js +5083 -4
  154. package/index34.js +2 -18
  155. package/index35.js +59 -5
  156. package/index36.js +2 -2
  157. package/index37.js +13 -11
  158. package/index38.js +46 -10
  159. package/index39.js +6 -12
  160. package/index4.js +5 -1684
  161. package/index40.js +8 -11
  162. package/index41.js +26 -18
  163. package/index42.js +2 -64
  164. package/index43.js +63 -5
  165. package/index44.js +9 -55
  166. package/index45.js +7 -67
  167. package/index46.js +8 -31
  168. package/index47.js +5 -11
  169. package/index48.js +10 -121
  170. package/index49.js +9 -86
  171. package/index5.js +215 -23
  172. package/index50.js +636 -7
  173. package/index51.js +74 -11
  174. package/index52.js +4 -13
  175. package/index53.js +19 -13
  176. package/index54.js +4 -6
  177. package/index55.js +18 -7
  178. package/index56.js +5 -14
  179. package/index57.js +10 -28
  180. package/index58.js +10 -15
  181. package/index59.js +15 -0
  182. package/index6.js +250 -299
  183. package/index60.js +13 -0
  184. package/index61.js +21 -0
  185. package/index62.js +8 -0
  186. package/index63.js +57 -0
  187. package/index64.js +4 -0
  188. package/index65.js +69 -0
  189. package/index66.js +33 -0
  190. package/index67.js +13 -0
  191. package/index68.js +123 -0
  192. package/index69.js +88 -0
  193. package/index7.js +22 -5047
  194. package/index70.js +10 -0
  195. package/index71.js +13 -0
  196. package/index72.js +13 -225
  197. package/index73.js +16 -0
  198. package/index74.js +9 -0
  199. package/index75.js +228 -0
  200. package/index76.js +9 -0
  201. package/index77.js +17 -0
  202. package/index78.js +31 -0
  203. package/index79.js +18 -0
  204. package/index8.js +5044 -47
  205. package/index9.js +50 -15
  206. package/isAbsoluteURL.js +1 -1
  207. package/isURLSameOrigin.js +1 -1
  208. package/localization.js +15 -15
  209. package/log.js +14 -0
  210. package/log2.js +4 -0
  211. package/matchRequestUrl.js +1 -1
  212. package/mergeConfig.js +37 -32
  213. package/notify.js +2 -2
  214. package/package.json +1 -1
  215. package/positionFns.js +101 -0
  216. package/positionFns2.js +4 -0
  217. package/react-laag.esm.js +957 -0
  218. package/react.js +8 -8
  219. package/react2.js +9 -9
  220. package/resolveConfig.js +23 -23
  221. package/select/add-media/AddMedia.d.ts +3 -1
  222. package/select/current-selection/SelectedItems.d.ts +1 -1
  223. package/shims.js +29 -0
  224. package/shims2.js +4 -0
  225. package/store/StoreInitializer.d.ts +5 -1
  226. package/store/useAssetFilterStore.d.ts +55 -0
  227. package/store/useSelectionStore.d.ts +47 -0
  228. package/styled-components.browser.esm.js +2 -2
  229. package/throttle.js +1 -1
  230. package/toURLEncodedForm.js +11 -10
  231. package/tokenExpirationHelper.js +1 -1
  232. package/transformData.js +1 -1
  233. package/transitional.js +4 -3
  234. package/useAssetFilterStore.js +152 -0
  235. package/useDatStore.js +1 -1
  236. package/useEffectEvent.js +7 -7
  237. package/useFonts.js +2 -2
  238. package/useOrderingStore.js +1 -1
  239. package/useRouterStore.js +1 -1
  240. package/useSearchStore.js +1 -1
  241. package/useSelectionStore.js +131 -0
  242. package/useSimilaritySearchStore.js +1 -1
  243. package/useTranslate.js +1 -1
  244. package/utils/combineMetaproperties.d.ts +2 -0
  245. package/utils6.js +160 -118
  246. package/utils7.js +7 -68
  247. package/utils8.js +68 -7
  248. package/xhr.js +47 -46
  249. package/AssetFilterContext.js +0 -161
  250. package/SelectionContext.js +0 -143
  251. package/select/SelectionContext.d.ts +0 -30
  252. /package/{Middleware.js → Middleware2.js} +0 -0
  253. /package/{middleware2.js → middleware.js} +0 -0
package/Option_new.js CHANGED
@@ -1,48 +1,55 @@
1
- import { jsx as r, jsxs as e } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as i } from "react/jsx-runtime";
2
2
  import s from "./styled-components.browser.esm.js";
3
- import { TruncatedText as m } from "./TruncatedText.js";
4
- import { token as n } from "./token.js";
5
- import { IconCheckCircle as a } from "./index4.js";
6
- import { ListItem as g, StyledCheckboxWrapper as h, Content as f } from "./Checkbox.styles.js";
3
+ import { TruncatedText as l } from "./TruncatedText.js";
4
+ import { token as r } from "./token.js";
5
+ import { IconCheckCircle as n } from "./index3.js";
6
+ import { ListItem as h, StyledCheckboxWrapper as g, Content as k } from "./Checkbox.styles.js";
7
7
  const w = ({
8
- option: o,
9
- onClick: c,
10
- metapropertyName: d,
11
- isSelected: i,
12
- metapropertyMultifilter: l,
13
- showCount: t = !0,
14
- count: p
15
- }) => /* @__PURE__ */ r(g, { children: /* @__PURE__ */ r(h, { $isChecked: i, children: /* @__PURE__ */ e(
16
- f,
8
+ option: e,
9
+ onClick: p,
10
+ metapropertyName: c,
11
+ isSelected: o,
12
+ metapropertyMultifilter: d,
13
+ showCount: a = !0,
14
+ count: m
15
+ }) => /* @__PURE__ */ t(h, { children: /* @__PURE__ */ t(g, { $isChecked: o, children: /* @__PURE__ */ i(
16
+ k,
17
17
  {
18
- $isChecked: i,
18
+ $isChecked: o,
19
19
  onClick: () => {
20
- c(d, o, l);
20
+ p(c, e, d);
21
21
  },
22
22
  "data-testid": "metaproperty-option",
23
23
  children: [
24
- /* @__PURE__ */ r(m, { children: o.label }),
25
- i && !t ? /* @__PURE__ */ r(a, {}) : null,
26
- t && /* @__PURE__ */ e(C, { className: "fade-in-down", children: [
27
- i ? /* @__PURE__ */ r(a, {}) : null,
28
- " ",
29
- p
30
- ] })
24
+ /* @__PURE__ */ t(l, { children: e.label }),
25
+ o && !a ? /* @__PURE__ */ t(n, { "data-testid": "metaproperty-option-checkmark" }) : null,
26
+ a && /* @__PURE__ */ i(
27
+ f,
28
+ {
29
+ className: "fade-in-down",
30
+ "data-testid": "metaproperty-option-count",
31
+ children: [
32
+ o ? /* @__PURE__ */ t(n, { "data-testid": "metaproperty-option-checkmark" }) : null,
33
+ " ",
34
+ m
35
+ ]
36
+ }
37
+ )
31
38
  ]
32
39
  }
33
- ) }) }), C = s.span`
40
+ ) }) }), f = s.span`
34
41
  display: flex;
35
42
  align-items: center;
36
- padding: 0 ${n.spacing3};
43
+ padding: 0 ${r.spacing3};
37
44
  color: rgba(0, 34, 51, 0.8);
38
45
  background-color: #f7f8f9;
39
46
  border: 1px solid rgba(0, 34, 51, 0.1);
40
- border-radius: ${n.spacing5};
47
+ border-radius: ${r.spacing5};
41
48
 
42
49
  svg {
43
- max-width: ${n.spacing5};
44
- max-height: ${n.spacing5};
45
- margin-right: ${n.spacing2};
50
+ max-width: ${r.spacing5};
51
+ max-height: ${r.spacing5};
52
+ margin-right: ${r.spacing2};
46
53
  }
47
54
  `;
48
55
  export {
@@ -0,0 +1,10 @@
1
+ var e, r;
2
+ function _() {
3
+ if (r) return e;
4
+ r = 1;
5
+ var t = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
6
+ return e = t, e;
7
+ }
8
+ export {
9
+ _ as __require
10
+ };
package/RightArrow.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
2
  import o from "./styled-components.browser.esm.js";
3
- import { IconArrowRight as r } from "./index4.js";
3
+ import { IconArrowRight as r } from "./index3.js";
4
4
  import { Button as a } from "./Button.js";
5
5
  function d(i) {
6
6
  return /* @__PURE__ */ t(f, { children: /* @__PURE__ */ t(
package/SearchInput.js CHANGED
@@ -2,7 +2,7 @@ import { jsxs as B, jsx as o } from "react/jsx-runtime";
2
2
  import { useState as a, useEffect as p } from "react";
3
3
  import g from "./styled-components.browser.esm.js";
4
4
  import { useDebouncedCallback as m } from "./index.module2.js";
5
- import { IconSearch as F, IconImage as H } from "./index4.js";
5
+ import { IconSearch as F, IconImage as H } from "./index3.js";
6
6
  import { Input as $ } from "./Input.js";
7
7
  import { Spinner as j } from "./Spinner.js";
8
8
  import { __ as f } from "./index2.js";
package/SearchInput2.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as o, jsxs as u } from "react/jsx-runtime";
2
2
  import { useRef as f, useEffect as p } from "react";
3
3
  import t from "./styled-components.browser.esm.js";
4
- import { IconSearch as h } from "./index4.js";
4
+ import { IconSearch as h } from "./index3.js";
5
5
  import { Input as l } from "./Input.js";
6
6
  import { token as n } from "./token.js";
7
7
  import { useDropdownContext as a } from "./context3.js";
@@ -1,64 +1,74 @@
1
- import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
- import p from "./styled-components.browser.esm.js";
3
- import { Button as r } from "./Button.js";
4
- import { token as n } from "./token.js";
5
- import { IconSteps as b } from "./index4.js";
1
+ import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
+ import m from "./styled-components.browser.esm.js";
3
+ import { Button as a } from "./Button.js";
4
+ import { token as r } from "./token.js";
5
+ import { IconSteps as y } from "./index3.js";
6
6
  import { Dropdown as v } from "./Dropdown.js";
7
7
  import { __ as o } from "./index2.js";
8
- import { useSelection as w } from "./SelectionContext.js";
9
- import { AddMedia as C } from "./AddMedia.js";
10
- import { SelectedItems as A } from "./SelectedItems.js";
11
- import { useConfig as I } from "./ConfigContext.js";
12
- import { useRouterSelectors as k } from "./useRouterStore.js";
13
- import { Tooltip as M } from "./Tooltip.js";
14
- import { useSimilaritySearchStore as _ } from "./useSimilaritySearchStore.js";
15
- import { useSimilarityAssets as $ } from "./getSimilarityAssets.js";
8
+ import { AddMedia as w } from "./AddMedia.js";
9
+ import { SelectedItems as C } from "./SelectedItems.js";
10
+ import { useConfig as A } from "./ConfigContext.js";
11
+ import { useRouterSelectors as I } from "./useRouterStore.js";
12
+ import { Tooltip as k } from "./Tooltip.js";
13
+ import { useSimilaritySearchStore as M } from "./useSimilaritySearchStore.js";
14
+ import { useSimilarityAssets as _ } from "./getSimilarityAssets.js";
15
+ import { useSelectionStore as $ } from "./useSelectionStore.js";
16
16
  function L() {
17
- const { selection: i, clear: a, selectAll: d } = w(), { selectionMode: l, selectAllOption: f } = I(), g = k.use.page(), { setIsSelected: S, isEnabled: u } = _(), { search: h, resetData: x } = $(), s = i.length >= 1 ? i.filter(
17
+ const { selection: i, clear: n, selectAll: p } = $(), { selectionMode: l, selectAllOption: u } = A(), f = I.use.page(), { setIsSelected: S, isEnabled: g } = M(), { search: h, resetData: x } = _(), s = i.length >= 1 ? i.filter(
18
18
  (t) => t.type === "asset" && t.value.__typename === "Image"
19
- ).map((t) => t.value.databaseId ? t.value.databaseId : t.value.id) : [], y = () => {
20
- x(), S(!0), h(s), a();
19
+ ).map((t) => t.value.databaseId ? t.value.databaseId : t.value.id) : [], b = () => {
20
+ x(), S(!0), h(s), n();
21
21
  }, c = i.length;
22
- return c === 0 ? null : /* @__PURE__ */ m(j, { "data-testid": "selection-footer", children: [
23
- /* @__PURE__ */ m(D, { children: [
22
+ return c === 0 ? null : /* @__PURE__ */ d(j, { "data-testid": "selection-footer", children: [
23
+ /* @__PURE__ */ d(D, { children: [
24
24
  /* @__PURE__ */ e(
25
25
  v,
26
26
  {
27
27
  buttonKind: "secondary",
28
28
  direction: "Up",
29
29
  title: o("View {} selected").replace("{}", c.toString()),
30
- children: () => /* @__PURE__ */ e(A, { selection: i })
30
+ "data-testid": "view-selected-dropdown",
31
+ children: () => /* @__PURE__ */ e(C, { selection: i })
31
32
  }
32
33
  ),
33
- l === "MultiSelect" && f && g.page === "assets" && /* @__PURE__ */ e(r, { variant: "secondary", onClick: d, children: o("Select all") }),
34
- /* @__PURE__ */ e(r, { variant: "clean", onClick: a, children: o("Clear selection") })
34
+ l === "MultiSelect" && u && f.page === "assets" && /* @__PURE__ */ e(a, { variant: "secondary", onClick: p, "data-testid": "select-all-button", children: o("Select all") }),
35
+ /* @__PURE__ */ e(
36
+ a,
37
+ {
38
+ variant: "clean",
39
+ onClick: n,
40
+ "data-testid": "clear-selection-button",
41
+ children: o("Clear selection")
42
+ }
43
+ )
35
44
  ] }),
36
- l === "MultiSelect" && u && s.length > 0 && /* @__PURE__ */ e(M, { text: o("Show similar"), margin: "right", marginAmount: "spacing3", children: /* @__PURE__ */ e(
37
- r,
45
+ l === "MultiSelect" && g && s.length > 0 && /* @__PURE__ */ e(k, { text: o("Show similar"), margin: "right", marginAmount: "spacing3", children: /* @__PURE__ */ e(
46
+ a,
38
47
  {
39
48
  variant: "clean",
40
- icon: /* @__PURE__ */ e(b, {}),
49
+ icon: /* @__PURE__ */ e(y, {}),
41
50
  "aria-label": o("Show similar"),
42
- onClick: y
51
+ onClick: b,
52
+ "data-testid": "show-similar-button"
43
53
  }
44
54
  ) }),
45
- /* @__PURE__ */ e(C, { selection: i })
55
+ /* @__PURE__ */ e(w, { selection: i })
46
56
  ] });
47
57
  }
48
- const j = p.div`
58
+ const j = m.div`
49
59
  display: flex;
50
60
  flex-shrink: 0;
51
61
  z-index: 10;
52
- height: ${n.layoutSpacing5};
53
- padding: ${n.spacing6};
62
+ height: ${r.layoutSpacing5};
63
+ padding: ${r.spacing6};
54
64
  align-items: center;
55
65
  box-shadow: 0 -1px 0 0 rgba(0, 34, 51, 0.1), 0 -1px 6px 0 rgba(0, 34, 51, 0.1);
56
66
  animation: var(--fade-in-down);
57
- `, D = p.span`
67
+ `, D = m.span`
58
68
  display: flex;
59
69
  flex-grow: 1;
60
70
  align-items: center;
61
- gap: ${n.spacing2};
71
+ gap: ${r.spacing2};
62
72
  `;
63
73
  export {
64
74
  L as SelectionFooter
package/Shield.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
2
  import e from "react";
3
3
  import { Oops as o } from "./Oops.js";
4
- class l extends e.Component {
4
+ class p extends e.Component {
5
5
  constructor(r) {
6
6
  super(r), this.state = { error: null };
7
7
  }
@@ -20,5 +20,5 @@ class l extends e.Component {
20
20
  }
21
21
  }
22
22
  export {
23
- l as Shield
23
+ p as Shield
24
24
  };
@@ -1,48 +1,53 @@
1
- import { jsx as n, Fragment as T, jsxs as C } from "react/jsx-runtime";
2
- import { useState as u, useRef as m, useEffect as q } from "react";
3
- import f from "./styled-components.browser.esm.js";
4
- import { Box as G } from "./Box.js";
5
- import { Button as J } from "./Button.js";
6
- import { Flex as K } from "./Flex.js";
7
- import { token as w } from "./token.js";
8
- import { IconArrowLeft as Q, IconArrowRight as Y } from "./index4.js";
9
- import { useConfig as Z } from "./ConfigContext.js";
10
- import { useAssetFilter as tt } from "./AssetFilterContext.js";
11
- import { Dropdown as et } from "./Dropdown.js";
12
- import { Autocomplete as rt } from "./Autocomplete_new.js";
13
- import { SmartFilterSelect as ot } from "./SmartFilterSelect_new.js";
14
- import { getAutocompleteOptions as nt } from "./autocomplete.js";
15
- import { useAuth as it } from "./LoginContext.js";
16
- import { debounceAsync as st } from "./asyncDebounce.js";
17
- const Ct = ({ filterData: l }) => {
18
- const i = tt(), b = it(), { language: y } = Z(), k = lt(l), [L, D] = u({}), [X, A] = u(), [I, M] = u({}), [g, d] = u(0), [c, P] = u(0), [O, F] = u(!1), a = m(null), x = m(!1), p = m(null), h = m(null), S = m({});
19
- q(() => {
20
- a.current && P(a.current.scrollWidth - a.current.clientWidth), i.isDropdownActive || (D({}), A({}));
21
- }, [l, a, i]);
22
- const R = g === 0, U = c > 5 && g !== c;
23
- function z() {
24
- d((e) => {
1
+ import { jsx as i, Fragment as J, jsxs as k } from "react/jsx-runtime";
2
+ import { useState as d, useRef as f, useEffect as K } from "react";
3
+ import g from "./styled-components.browser.esm.js";
4
+ import { Box as Q } from "./Box.js";
5
+ import { Button as Y } from "./Button.js";
6
+ import { Flex as Z } from "./Flex.js";
7
+ import { token as S } from "./token.js";
8
+ import { IconArrowLeft as tt, IconArrowRight as et } from "./index3.js";
9
+ import { useConfig as rt } from "./ConfigContext.js";
10
+ import { Dropdown as ot } from "./Dropdown.js";
11
+ import { Autocomplete as nt } from "./Autocomplete_new.js";
12
+ import { SmartFilterSelect as it } from "./SmartFilterSelect_new.js";
13
+ import { getAutocompleteOptions as st } from "./autocomplete.js";
14
+ import { useAuth as lt } from "./LoginContext.js";
15
+ import { debounceAsync as at } from "./asyncDebounce.js";
16
+ import { useAssetFilterStore as ct } from "./useAssetFilterStore.js";
17
+ const Lt = ({ filterData: l }) => {
18
+ const {
19
+ selectSmartfilterOption: y,
20
+ selectedSmartfilterOptions: a,
21
+ existingFilters: n,
22
+ isDropdownActive: D
23
+ } = ct(), X = lt(), { language: A } = rt(), I = pt(l, n), [P, M] = d({}), [R, O] = d(), [U, v] = d({}), [h, m] = d(0), [c, W] = d(0), [C, F] = d(!1), p = f(null), x = f(!1), u = f(null), b = f(null), w = f({});
24
+ K(() => {
25
+ p.current && W(p.current.scrollWidth - p.current.clientWidth), D || (M({}), O({}));
26
+ }, [l, p, D]);
27
+ const z = h === 0, E = c > 5 && h !== c;
28
+ function N() {
29
+ m((e) => {
25
30
  const t = Math.max(e - 250, 0);
26
31
  return t >= 100 ? t : 0;
27
32
  });
28
33
  }
29
- function E() {
30
- d((e) => {
34
+ function _() {
35
+ m((e) => {
31
36
  const t = Math.min(e + 250, c);
32
37
  return t <= c - 100 ? t : c;
33
38
  });
34
39
  }
35
- const N = async (e, t, o) => {
40
+ const j = async (e, t, o) => {
36
41
  let s;
37
- M((r) => ({
42
+ v((r) => ({
38
43
  ...r,
39
44
  [t]: !0
40
- })), e.length >= 2 && (s = await nt({
45
+ })), e.length >= 2 && (s = await st({
41
46
  metapropertyId: t,
42
- auth: b,
47
+ auth: X,
43
48
  searchTerm: e,
44
49
  page: o
45
- })), A((r) => ({
50
+ })), O((r) => ({
46
51
  ...r,
47
52
  [t]: s ? {
48
53
  ...s,
@@ -51,20 +56,20 @@ const Ct = ({ filterData: l }) => {
51
56
  ...s.metapropertyOptions
52
57
  ] : s.metapropertyOptions
53
58
  } : null
54
- })), M((r) => ({
59
+ })), v((r) => ({
55
60
  ...r,
56
61
  [t]: !1
57
62
  }));
58
- }, W = (e) => (S.current[e] || (S.current[e] = st(N, 500)), S.current[e]), v = (e, t, o) => {
59
- i.selectSmartfilterOption(e, t, o);
60
- }, _ = (e, t, o) => {
61
- D((r) => ({
63
+ }, B = (e) => (w.current[e] || (w.current[e] = at(j, 500)), w.current[e]), $ = (e, t, o) => {
64
+ y(e, t, o);
65
+ }, H = (e, t, o) => {
66
+ M((r) => ({
62
67
  ...r,
63
68
  [e]: t
64
- })), W(e)(t, e, o);
65
- }, j = (e) => {
66
- p.current = e.clientX, x.current = !1, F(!0);
67
- }, B = (e) => {
69
+ })), B(e)(t, e, o);
70
+ }, V = (e) => {
71
+ u.current = e.clientX, x.current = !1, F(!0);
72
+ }, T = (e) => {
68
73
  if (x.current) {
69
74
  e.preventDefault();
70
75
  const t = (o) => {
@@ -75,86 +80,86 @@ const Ct = ({ filterData: l }) => {
75
80
  once: !0
76
81
  });
77
82
  }
78
- p.current = null, h.current = null, F(!1);
79
- }, H = (e) => {
80
- if (!O || !a.current || !p.current) return;
81
- e.preventDefault(), h.current === null && (h.current = g), p.current && Math.abs(e.clientX - p.current) > 5 && (x.current = !0);
82
- const t = (e.clientX - p.current) * -1 + h.current;
83
- return t <= 16 ? d(0) : t + 16 < c ? d(t) : d(c);
83
+ u.current = null, b.current = null, F(!1);
84
+ }, q = (e) => {
85
+ if (!C || !p.current || !u.current) return;
86
+ e.preventDefault(), b.current === null && (b.current = h), u.current && Math.abs(e.clientX - u.current) > 5 && (x.current = !0);
87
+ const t = (e.clientX - u.current) * -1 + b.current;
88
+ return t <= 16 ? m(0) : t + 16 < c ? m(t) : m(c);
84
89
  };
85
- return /* @__PURE__ */ n(T, { children: k.map((e) => {
90
+ return /* @__PURE__ */ i(J, { children: I.map((e) => {
86
91
  const t = e.smartfilter, o = e.metapropertyFilters;
87
- return /* @__PURE__ */ n(
88
- et,
92
+ return /* @__PURE__ */ i(
93
+ ot,
89
94
  {
90
- title: t.labels[y] || t.labels.en_US,
91
- alt: t.labels[y] || t.labels.en_US,
95
+ title: t.labels[A] || t.labels.en_US,
96
+ alt: t.labels[A] || t.labels.en_US,
92
97
  isSmall: !0,
93
98
  fadeIn: !0,
94
99
  isMetapropertyDropdown: !0,
95
- children: () => /* @__PURE__ */ C(
96
- ct,
100
+ children: () => /* @__PURE__ */ k(
101
+ ut,
97
102
  {
98
- ref: a,
99
- onMouseDown: j,
100
- onMouseUp: B,
101
- onMouseMove: H,
103
+ ref: p,
104
+ onMouseDown: V,
105
+ onMouseUp: T,
106
+ onMouseMove: q,
102
107
  children: [
103
- /* @__PURE__ */ n(
104
- at,
108
+ /* @__PURE__ */ i(
109
+ dt,
105
110
  {
106
- $scroll: g,
111
+ $scroll: h,
107
112
  "data-testid": "metaproperty-dropdown-content",
108
- $isDragging: O,
113
+ $isDragging: C,
109
114
  children: o.map((s) => {
110
115
  const r = s.metaproperty;
111
- if (!i.existingFilters?.[r.name] || r.type !== "autocomplete" && (r.type !== "smart-single" && r.type !== "select" || r.options.length === 0))
116
+ if (!n?.[r.name] || r.type !== "autocomplete" && (r.type !== "smart-single" && r.type !== "select" || r.options.length === 0))
112
117
  return null;
113
- const V = r.type === "autocomplete" ? /* @__PURE__ */ n(
114
- rt,
118
+ const G = r.type === "autocomplete" ? /* @__PURE__ */ i(
119
+ nt,
115
120
  {
116
121
  metaproperty: r,
117
- value: L[r.id] || "",
118
- onChange: _,
119
- onOptionSelect: v,
120
- autocompleteOptions: X || {},
121
- isLoading: I[r.id] || !1,
122
- selectedOptions: i.selectedSmartfilterOptions || {}
122
+ value: P[r.id] || "",
123
+ onChange: H,
124
+ onOptionSelect: $,
125
+ autocompleteOptions: R || {},
126
+ isLoading: U[r.id] || !1,
127
+ selectedOptions: a || {}
123
128
  }
124
- ) : /* @__PURE__ */ n(
125
- ot,
129
+ ) : /* @__PURE__ */ i(
130
+ it,
126
131
  {
127
132
  metaproperty: r,
128
133
  smartfilterId: t.id,
129
- onOptionSelect: v,
130
- selectedOptions: i.selectedSmartfilterOptions || {},
131
- filteredMetaproperty: i.existingFilters?.[r.name],
134
+ onOptionSelect: $,
135
+ selectedOptions: a || {},
136
+ filteredMetaproperty: n?.[r.name],
132
137
  metapropertyCursor: s.metadata.nextCursorMark
133
138
  }
134
139
  );
135
- return /* @__PURE__ */ n(pt, { children: V }, r.id);
140
+ return /* @__PURE__ */ i(mt, { children: G }, r.id);
136
141
  })
137
142
  }
138
143
  ),
139
- /* @__PURE__ */ C(ut, { direction: "row", justifyContent: "flex-end", children: [
140
- /* @__PURE__ */ n(
141
- $,
144
+ /* @__PURE__ */ k(ft, { direction: "row", justifyContent: "flex-end", children: [
145
+ /* @__PURE__ */ i(
146
+ L,
142
147
  {
143
148
  title: "Previous",
144
- icon: /* @__PURE__ */ n(Q, {}),
145
- onClick: z,
149
+ icon: /* @__PURE__ */ i(tt, {}),
150
+ onClick: N,
146
151
  "data-testid": "left-arrow",
147
- isDisabled: R
152
+ isDisabled: z
148
153
  }
149
154
  ),
150
- /* @__PURE__ */ n(
151
- $,
155
+ /* @__PURE__ */ i(
156
+ L,
152
157
  {
153
158
  title: "Next",
154
- icon: /* @__PURE__ */ n(Y, {}),
155
- onClick: E,
159
+ icon: /* @__PURE__ */ i(et, {}),
160
+ onClick: _,
156
161
  "data-testid": "right-arrow",
157
- isDisabled: !U
162
+ isDisabled: !E
158
163
  }
159
164
  )
160
165
  ] })
@@ -166,34 +171,38 @@ const Ct = ({ filterData: l }) => {
166
171
  );
167
172
  }) });
168
173
  };
169
- function lt(l) {
170
- return [...l.filters].sort((i, b) => i.smartfilter.zindex - b.smartfilter.zindex);
174
+ function pt(l, y) {
175
+ return [...l.filters].filter(
176
+ (a) => a.metapropertyFilters.some(
177
+ (n) => a.smartfilter.metaproperties.includes(n.metaproperty.id) && y?.[n.metaproperty.name] && (n.metaproperty.options.length > 0 || n.metaproperty.type === "autocomplete")
178
+ )
179
+ ).sort((a, n) => a.smartfilter.zindex - n.smartfilter.zindex);
171
180
  }
172
- const ct = f.div`
181
+ const ut = g.div`
173
182
  display: flex;
174
183
  flex-direction: column;
175
184
  overflow: hidden;
176
- `, at = f.div`
185
+ `, dt = g.div`
177
186
  display: flex;
178
187
  flex-direction: row;
179
188
  transform: translateX(-${(l) => l.$scroll}px);
180
189
  transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.15);
181
190
  width: fit-content;
182
191
  cursor: ${(l) => l.$isDragging ? "grabbing" : "default"};
183
- `, pt = f(G)`
192
+ `, mt = g(Q)`
184
193
  border-right: 1px solid rgba(3, 16, 38, 0.1);
185
194
  max-width: 300px;
186
- `, ut = f(K)`
187
- padding: ${w.spacing3};
195
+ `, ft = g(Z)`
196
+ padding: ${S.spacing3};
188
197
  border-top: 1px solid rgba(3, 16, 38, 0.1);
189
- gap: ${w.spacing3};
190
- `, $ = f(J)`
191
- padding: ${w.spacing3};
198
+ gap: ${S.spacing3};
199
+ `, L = g(Y)`
200
+ padding: ${S.spacing3};
192
201
  border-radius: 6px;
193
202
  border: 1px solid rgba(3, 16, 38, 0.1);
194
203
  background: rgba(3, 16, 38, 0.03);
195
204
  cursor: pointer;
196
205
  `;
197
206
  export {
198
- Ct as Smartfilter
207
+ Lt as Smartfilter
199
208
  };