@bynder/compact-view 5.1.4 → 5.2.1

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 (278) hide show
  1. package/ActiveFilter.js +0 -1
  2. package/ActiveFilters.js +0 -1
  3. package/AddMedia.js +21 -22
  4. package/Advanced.js +0 -1
  5. package/App.d.ts +3 -1
  6. package/App.js +61 -53
  7. package/AssetCard.js +60 -52
  8. package/AssetCardMetaproperties.js +0 -1
  9. package/AssetFilter.js +80 -101
  10. package/AssetFilterContext.js +0 -1
  11. package/AssetItem.js +0 -1
  12. package/AssetList.js +44 -44
  13. package/AssetTypeItem.js +0 -1
  14. package/AssetsView.js +0 -1
  15. package/Autocomplete_new.js +132 -0
  16. package/ButtonAction.js +0 -1
  17. package/CardSkeleton.js +0 -1
  18. package/Checkbox.styles.js +0 -1
  19. package/Chip.js +0 -1
  20. package/CollectionCard.js +0 -1
  21. package/CollectionItem.js +0 -1
  22. package/CollectionList.js +0 -1
  23. package/CollectionView.js +0 -1
  24. package/CollectionsView.js +0 -1
  25. package/ConfigContext.js +0 -1
  26. package/ConnectButton.js +0 -1
  27. package/Container.js +0 -1
  28. package/ContextAction.js +28 -21
  29. package/Dat.js +0 -1
  30. package/DatDropdownItem.js +0 -1
  31. package/DesignSystemContext.js +0 -1
  32. package/DirectionSelect.js +0 -1
  33. package/DocumentIcon.js +0 -1
  34. package/DomainInput.js +0 -1
  35. package/DragSelect.js +66 -61
  36. package/Dropdown.js +0 -1
  37. package/DropdownContent.js +54 -39
  38. package/DropdownListItem.js +0 -1
  39. package/ErrorIcon.js +0 -1
  40. package/ErrorMessage.js +0 -1
  41. package/FieldSelect.js +0 -1
  42. package/FileSelector.js +128 -117
  43. package/Header.js +0 -1
  44. package/HorizontalScroll.js +0 -1
  45. package/InfiniteScroll.js +0 -1
  46. package/LeftArrow.js +0 -1
  47. package/LoginComponent.js +0 -1
  48. package/LoginContext.js +0 -1
  49. package/MetapropertyFilterContent.js +0 -1
  50. package/MetapropertyOption.js +0 -1
  51. package/Modal.js +0 -1
  52. package/NoResults.js +0 -1
  53. package/Oops.js +0 -1
  54. package/Option_new.js +49 -0
  55. package/RefreshingSpinner.js +0 -1
  56. package/ReportModal.js +0 -1
  57. package/RightArrow.js +0 -1
  58. package/RootElementContext.js +0 -1
  59. package/SearchInput.js +26 -22
  60. package/SelectedItemContainer.js +0 -1
  61. package/SelectedItems.js +0 -1
  62. package/SelectionContext.js +0 -1
  63. package/SelectionFooter.js +0 -1
  64. package/ShadowRoot.js +0 -1
  65. package/ShadowRootInternal.js +0 -1
  66. package/Shield.js +0 -1
  67. package/Skeleton.js +0 -1
  68. package/SmartFilterContent.js +0 -1
  69. package/SmartFilterSelect_new.js +85 -0
  70. package/Smartfilters_new.js +196 -0
  71. package/Spinner.js +0 -1
  72. package/StatefulAssetList.js +0 -1
  73. package/StoreInitializer.js +29 -0
  74. package/Styles.css.js +0 -1
  75. package/SwitchNLS.js +0 -1
  76. package/TagItem.js +0 -1
  77. package/Tags.js +0 -1
  78. package/Theming.js +0 -1
  79. package/Toolbar.js +0 -1
  80. package/Tooltip.js +0 -1
  81. package/ViewSwitch.js +0 -1
  82. package/api/getFilterOptions.d.ts +9 -0
  83. package/api/getFilters.d.ts +1 -1
  84. package/api/getFilters_new.d.ts +7 -0
  85. package/api/index.d.ts +1 -1
  86. package/api/types/getFilters_new.d.ts +64 -0
  87. package/app-config/ConfigContext.d.ts +1 -1
  88. package/app-config/appConfig.type.d.ts +2 -0
  89. package/asset.type.js +0 -1
  90. package/asyncDebounce.js +0 -1
  91. package/auth.js +0 -1
  92. package/{autocomplete2.js → autocomplete.js} +0 -1
  93. package/base64Converter.js +0 -1
  94. package/chunk.js +0 -1
  95. package/class.js +0 -1
  96. package/combineFilters.js +0 -1
  97. package/combineMetaproperties.js +0 -1
  98. package/constants.js +0 -1
  99. package/createSelectors.js +0 -1
  100. package/crypto.js +0 -1
  101. package/filter/filters/smartfilters/Metaproperties/Autocomplete_new.d.ts +15 -0
  102. package/filter/filters/smartfilters/Metaproperties/Option_new.d.ts +13 -0
  103. package/filter/filters/smartfilters/Metaproperties/SmartFilterSelect_new.d.ts +13 -0
  104. package/filter/filters/smartfilters/Smartfilters_new.d.ts +7 -0
  105. package/filterAssets.js +14 -13
  106. package/getAsset.js +0 -1
  107. package/getAssetCounts.js +0 -1
  108. package/getAssets.js +0 -1
  109. package/getCollections.js +4 -4
  110. package/getFilterOptions.js +56 -0
  111. package/getFilters.js +33 -33
  112. package/getFilters_new.js +72 -0
  113. package/getLimitedUseThumbnails.js +25 -0
  114. package/getSimilarityAssets.js +0 -1
  115. package/handlers.js +3 -8
  116. package/helpers.js +0 -1
  117. package/index.js +0 -1
  118. package/index2.js +0 -1
  119. package/index3.js +44 -25
  120. package/index4.js +0 -1
  121. package/logger.js +0 -1
  122. package/loginwindow.js +0 -1
  123. package/normalizeResponse.js +0 -1
  124. package/oauth2.js +0 -1
  125. package/package.json +1 -1
  126. package/result.type.js +0 -1
  127. package/store/StoreInitializer.d.ts +8 -0
  128. package/text.js +0 -1
  129. package/trimMetapropertyValue.js +0 -1
  130. package/url.js +0 -1
  131. package/useAccountDomain.js +0 -1
  132. package/useAuthInformation.js +0 -1
  133. package/useClickOutside.js +0 -1
  134. package/useDatStore.js +0 -1
  135. package/useDimensions.js +0 -1
  136. package/useOrderingStore.js +0 -1
  137. package/useRouterStore.js +0 -1
  138. package/useSearchStore.js +0 -1
  139. package/useSimilaritySearchStore.js +0 -1
  140. package/utils/getLimitedUseThumbnails.d.ts +2 -0
  141. package/utils.js +0 -1
  142. package/utils2.js +0 -1
  143. package/views/asset/asset-card/AssetCard.d.ts +4 -2
  144. package/views/asset/asset-card/ContextAction.d.ts +3 -1
  145. package/ActiveFilter.js.map +0 -1
  146. package/ActiveFilters.js.map +0 -1
  147. package/AddMedia.js.map +0 -1
  148. package/Advanced.js.map +0 -1
  149. package/App.js.map +0 -1
  150. package/AssetCard.js.map +0 -1
  151. package/AssetCardMetaproperties.js.map +0 -1
  152. package/AssetFilter.js.map +0 -1
  153. package/AssetFilterContext.js.map +0 -1
  154. package/AssetItem.js.map +0 -1
  155. package/AssetList.js.map +0 -1
  156. package/AssetTypeItem.js.map +0 -1
  157. package/AssetsView.js.map +0 -1
  158. package/Autocomplete.js +0 -148
  159. package/Autocomplete.js.map +0 -1
  160. package/ButtonAction.js.map +0 -1
  161. package/CardSkeleton.js.map +0 -1
  162. package/Checkbox.styles.js.map +0 -1
  163. package/Chip.js.map +0 -1
  164. package/CollectionCard.js.map +0 -1
  165. package/CollectionItem.js.map +0 -1
  166. package/CollectionList.js.map +0 -1
  167. package/CollectionView.js.map +0 -1
  168. package/CollectionsView.js.map +0 -1
  169. package/ConfigContext.js.map +0 -1
  170. package/ConnectButton.js.map +0 -1
  171. package/Container.js.map +0 -1
  172. package/ContextAction.js.map +0 -1
  173. package/Dat.js.map +0 -1
  174. package/DatDropdownItem.js.map +0 -1
  175. package/DesignSystemContext.js.map +0 -1
  176. package/DirectionSelect.js.map +0 -1
  177. package/DocumentIcon.js.map +0 -1
  178. package/DomainInput.js.map +0 -1
  179. package/DragSelect.js.map +0 -1
  180. package/Dropdown.js.map +0 -1
  181. package/DropdownContent.js.map +0 -1
  182. package/DropdownListItem.js.map +0 -1
  183. package/ErrorIcon.js.map +0 -1
  184. package/ErrorMessage.js.map +0 -1
  185. package/FieldSelect.js.map +0 -1
  186. package/FileSelector.js.map +0 -1
  187. package/Header.js.map +0 -1
  188. package/HorizontalScroll.js.map +0 -1
  189. package/InfiniteScroll.js.map +0 -1
  190. package/LeftArrow.js.map +0 -1
  191. package/LoginComponent.js.map +0 -1
  192. package/LoginContext.js.map +0 -1
  193. package/MetapropertyFilterContent.js.map +0 -1
  194. package/MetapropertyOption.js.map +0 -1
  195. package/Modal.js.map +0 -1
  196. package/NoResults.js.map +0 -1
  197. package/Oops.js.map +0 -1
  198. package/Option.js +0 -50
  199. package/Option.js.map +0 -1
  200. package/RefreshingSpinner.js.map +0 -1
  201. package/ReportModal.js.map +0 -1
  202. package/RightArrow.js.map +0 -1
  203. package/RootElementContext.js.map +0 -1
  204. package/SearchInput.js.map +0 -1
  205. package/SelectedItemContainer.js.map +0 -1
  206. package/SelectedItems.js.map +0 -1
  207. package/SelectionContext.js.map +0 -1
  208. package/SelectionFooter.js.map +0 -1
  209. package/ShadowRoot.js.map +0 -1
  210. package/ShadowRootInternal.js.map +0 -1
  211. package/Shield.js.map +0 -1
  212. package/Skeleton.js.map +0 -1
  213. package/SmartFilterContent.js.map +0 -1
  214. package/SmartFilterSelect.js +0 -91
  215. package/SmartFilterSelect.js.map +0 -1
  216. package/Smartfilters.js +0 -186
  217. package/Smartfilters.js.map +0 -1
  218. package/Spinner.js.map +0 -1
  219. package/StatefulAssetList.js.map +0 -1
  220. package/Styles.css.js.map +0 -1
  221. package/SwitchNLS.js.map +0 -1
  222. package/TagItem.js.map +0 -1
  223. package/Tags.js.map +0 -1
  224. package/Theming.js.map +0 -1
  225. package/Toolbar.js.map +0 -1
  226. package/Tooltip.js.map +0 -1
  227. package/ViewSwitch.js.map +0 -1
  228. package/asset.type.js.map +0 -1
  229. package/asyncDebounce.js.map +0 -1
  230. package/auth.js.map +0 -1
  231. package/autocomplete2.js.map +0 -1
  232. package/base64Converter.js.map +0 -1
  233. package/chunk.js.map +0 -1
  234. package/class.js.map +0 -1
  235. package/combineFilters.js.map +0 -1
  236. package/combineMetaproperties.js.map +0 -1
  237. package/constants.js.map +0 -1
  238. package/createSelectors.js.map +0 -1
  239. package/crypto.js.map +0 -1
  240. package/filterAssets.js.map +0 -1
  241. package/filterEmptyMetaproperties.js +0 -11
  242. package/filterEmptyMetaproperties.js.map +0 -1
  243. package/getAsset.js.map +0 -1
  244. package/getAssetCounts.js.map +0 -1
  245. package/getAssets.js.map +0 -1
  246. package/getCollections.js.map +0 -1
  247. package/getFilters.js.map +0 -1
  248. package/getInitialFilters.js +0 -51
  249. package/getInitialFilters.js.map +0 -1
  250. package/getMetapropertiesOptions.js +0 -31
  251. package/getMetapropertiesOptions.js.map +0 -1
  252. package/getSimilarityAssets.js.map +0 -1
  253. package/handlers.js.map +0 -1
  254. package/helpers.js.map +0 -1
  255. package/index.js.map +0 -1
  256. package/index2.js.map +0 -1
  257. package/index3.js.map +0 -1
  258. package/index4.js.map +0 -1
  259. package/logger.js.map +0 -1
  260. package/loginwindow.js.map +0 -1
  261. package/normalizeResponse.js.map +0 -1
  262. package/oauth2.js.map +0 -1
  263. package/result.type.js.map +0 -1
  264. package/router/RouterContext.d.ts +0 -19
  265. package/text.js.map +0 -1
  266. package/trimMetapropertyValue.js.map +0 -1
  267. package/url.js.map +0 -1
  268. package/useAccountDomain.js.map +0 -1
  269. package/useAuthInformation.js.map +0 -1
  270. package/useClickOutside.js.map +0 -1
  271. package/useDatStore.js.map +0 -1
  272. package/useDimensions.js.map +0 -1
  273. package/useOrderingStore.js.map +0 -1
  274. package/useRouterStore.js.map +0 -1
  275. package/useSearchStore.js.map +0 -1
  276. package/useSimilaritySearchStore.js.map +0 -1
  277. package/utils.js.map +0 -1
  278. package/utils2.js.map +0 -1
package/ContextAction.js CHANGED
@@ -1,42 +1,49 @@
1
- import { jsx as n, jsxs as u } from "react/jsx-runtime";
2
- import { IconOpenInNew as l, IconCrop as a, IconMore as C } from "@bynder/icons";
3
- import { Card as i, Dropdown as o } from "@bynder/design-system";
4
- import { useConfig as p } from "./ConfigContext.js";
5
- import { __ as w } from "./index2.js";
6
- function g({ transformBaseUrl: s, portalUrl: r, onOpenDAT: c }) {
7
- const { hideExternalAccess: e, selectionMode: d } = p(), t = d === "SingleSelectFile" && s;
8
- return !t && e ? null : !t && !e ? /* @__PURE__ */ n(
1
+ import { jsx as n, jsxs as C } from "react/jsx-runtime";
2
+ import { IconOpenInNew as s, IconCrop as a, IconMore as p } from "@bynder/icons";
3
+ import { Card as i, Dropdown as e } from "@bynder/design-system";
4
+ import { useConfig as w } from "./ConfigContext.js";
5
+ import { __ as h } from "./index2.js";
6
+ function _({ dragState: r, transformBaseUrl: d, portalUrl: l, onOpenDAT: c }) {
7
+ const { hideExternalAccess: o, selectionMode: m } = w(), t = m === "SingleSelectFile" && d;
8
+ return !t && o ? null : !t && !o && r !== "select" ? /* @__PURE__ */ n(
9
9
  i.ContextActionButton,
10
10
  {
11
- "aria-label": w("Open in new tab"),
11
+ "aria-label": h("Open in new tab"),
12
12
  onClick: () => {
13
- window.open(r, "_blank");
13
+ window.open(l, "_blank");
14
14
  },
15
- children: /* @__PURE__ */ n(l, {})
15
+ children: /* @__PURE__ */ n(s, {})
16
16
  }
17
- ) : t && e ? /* @__PURE__ */ n(i.ContextActionButton, { "aria-label": "New transformation", onClick: c, children: /* @__PURE__ */ n(a, {}) }) : /* @__PURE__ */ u(
18
- o,
17
+ ) : t && o ? /* @__PURE__ */ n(i.ContextActionButton, { "aria-label": "New transformation", onClick: c, children: /* @__PURE__ */ n(a, {}) }) : /* @__PURE__ */ C(
18
+ e,
19
19
  {
20
- trigger: ({ isOpen: m, ...f }) => /* @__PURE__ */ n(i.ContextActionButton, { "aria-label": "Menu", isPressed: m, ...f, children: /* @__PURE__ */ n(C, {}) }),
20
+ trigger: ({ isOpen: u, ...f }) => r !== "select" ? /* @__PURE__ */ n(
21
+ i.ContextActionButton,
22
+ {
23
+ "aria-label": "Menu",
24
+ isPressed: u,
25
+ ...f,
26
+ children: /* @__PURE__ */ n(p, {})
27
+ }
28
+ ) : null,
21
29
  isClosedOnScroll: !0,
22
30
  children: [
23
31
  /* @__PURE__ */ n(
24
- o.Item,
32
+ e.Item,
25
33
  {
26
- icon: /* @__PURE__ */ n(l, {}),
34
+ icon: /* @__PURE__ */ n(s, {}),
27
35
  onClick: () => {
28
- window.open(r, "_blank");
36
+ window.open(l, "_blank");
29
37
  },
30
38
  children: "Open asset"
31
39
  }
32
40
  ),
33
- /* @__PURE__ */ n(o.Divider, {}),
34
- /* @__PURE__ */ n(o.Item, { icon: /* @__PURE__ */ n(a, {}), onClick: c, children: "New transformation" })
41
+ /* @__PURE__ */ n(e.Divider, {}),
42
+ /* @__PURE__ */ n(e.Item, { icon: /* @__PURE__ */ n(a, {}), onClick: c, children: "New transformation" })
35
43
  ]
36
44
  }
37
45
  );
38
46
  }
39
47
  export {
40
- g as ContextAction
48
+ _ as ContextAction
41
49
  };
42
- //# sourceMappingURL=ContextAction.js.map
package/Dat.js CHANGED
@@ -87,4 +87,3 @@ const U = y.div`
87
87
  export {
88
88
  L as Dat
89
89
  };
90
- //# sourceMappingURL=Dat.js.map
@@ -44,4 +44,3 @@ const I = b(s.Item)`
44
44
  export {
45
45
  L as DatDropdownItem
46
46
  };
47
- //# sourceMappingURL=DatDropdownItem.js.map
@@ -9,4 +9,3 @@ function a(r) {
9
9
  export {
10
10
  a as DesignSystemProvider
11
11
  };
12
- //# sourceMappingURL=DesignSystemContext.js.map
@@ -40,4 +40,3 @@ const S = n(m)`
40
40
  export {
41
41
  b as DirectionSelect
42
42
  };
43
- //# sourceMappingURL=DirectionSelect.js.map
package/DocumentIcon.js CHANGED
@@ -66,4 +66,3 @@ function r() {
66
66
  export {
67
67
  r as DocumentIcon
68
68
  };
69
- //# sourceMappingURL=DocumentIcon.js.map
package/DomainInput.js CHANGED
@@ -36,4 +36,3 @@ const g = t.div`
36
36
  export {
37
37
  C as DomainInput
38
38
  };
39
- //# sourceMappingURL=DomainInput.js.map
package/DragSelect.js CHANGED
@@ -1,12 +1,13 @@
1
- import { jsx as j } from "react/jsx-runtime";
2
- import z, { useState as T, useRef as S, useEffect as f, useCallback as x } from "react";
3
- import { createPortal as G } from "react-dom";
4
- import { useDebounce as W } from "use-debounce";
1
+ import { jsx as Y } from "react/jsx-runtime";
2
+ import j, { useState as T, useRef as I, useEffect as f, useCallback as w } from "react";
3
+ import { createPortal as z } from "react-dom";
4
+ import { useDebounce as q } from "use-debounce";
5
+ import { token as G } from "@bynder/design-system";
5
6
  import { useRootElement as H } from "./RootElementContext.js";
6
7
  const L = {
7
8
  x: null,
8
9
  y: null
9
- }, K = 0, J = "data-drag-select-id", O = "drag-select-container", V = 10, $ = 50, Q = 10, de = ({
10
+ }, K = 0, J = "data-drag-select-id", x = "drag-select-container", W = 10, V = 50, Q = 10, fe = ({
10
11
  dragContainer: n,
11
12
  selectionBoxCustomAttr: e,
12
13
  onSelect: m,
@@ -14,100 +15,105 @@ const L = {
14
15
  onDragStart: h,
15
16
  onDragEnd: u
16
17
  }) => {
17
- const [E, R] = T(L), [d, D] = T(L), [C] = W(d, V, {
18
+ const [E, R] = T(L), [d, D] = T(L), [C] = q(d, W, {
18
19
  leading: !0,
19
- maxWait: V
20
- }), [M, X] = T(), o = H(), w = z.useMemo(
21
- () => Z(
20
+ maxWait: W
21
+ }), [M, $] = T(), o = H(), O = j.useMemo(
22
+ () => ee(
22
23
  E,
23
24
  C,
24
25
  o.querySelector(".cv-root")
25
26
  ),
26
27
  [E, C, o]
27
- ), [N] = W(
28
- w,
29
- $,
28
+ ), [N] = q(
29
+ O,
30
+ V,
30
31
  {
31
32
  leading: !1,
32
- maxWait: $
33
+ maxWait: V
33
34
  }
34
- ), [v, Y] = T([]), y = se(v), c = S(E), g = S(d), i = S(
35
+ ), [v, F] = T([]), y = se(v), c = I(E), g = I(d), i = I(
35
36
  c.current.x !== null && c.current.y !== null && g.current.x !== null && g.current.y !== null
36
- ), B = S({
37
+ ), B = I({
37
38
  shiftKey: !1,
38
39
  metaKey: !1
39
40
  });
40
41
  f(() => (document.addEventListener("keydown", p, !1), document.addEventListener("keyup", p, !1), () => {
41
42
  document.removeEventListener("keydown", p, !1), document.removeEventListener("keyup", p, !1);
42
43
  }), []);
43
- const p = ({ shiftKey: t, metaKey: r }) => {
44
- const s = t || r ? "inverse" : "select";
45
- B.current = { shiftKey: t, metaKey: r }, i.current && s !== M && X(s);
44
+ const p = ({ shiftKey: t, metaKey: s }) => {
45
+ const r = t || s ? "inverse" : "select";
46
+ B.current = { shiftKey: t, metaKey: s }, i.current && r !== M && $(r);
46
47
  };
47
48
  f(() => {
48
49
  let t;
49
50
  return typeof h == "function" && i.current ? (p(B.current), h(M ?? "select")) : typeof u == "function" && !i.current && (t = setTimeout(() => u(M ?? "select"), Q)), () => clearTimeout(t);
50
51
  }, [i.current, M]);
51
52
  const A = (t) => {
52
- c.current = t, R(t), k();
53
- }, U = (t) => {
54
- g.current = t, D(t), k();
55
- }, k = () => {
53
+ c.current = t, R(t), b();
54
+ }, k = (t) => {
55
+ g.current = t, D(t), b();
56
+ }, b = () => {
56
57
  i.current = c.current.x !== null && c.current.y !== null && g.current.x !== null && g.current.y !== null;
57
- }, I = x(({ clientY: t, clientX: r }) => {
58
- const s = c.current.x !== null, a = Math.abs(c.current.x ?? 0 - r) >= 1 || Math.abs(c.current.y ?? 0 - t) >= 1;
59
- !s || !a || U({
60
- x: r,
58
+ }, S = w(({ clientY: t, clientX: s }) => {
59
+ const r = c.current.x !== null, a = Math.abs(c.current.x ?? 0 - s) >= 1 || Math.abs(c.current.y ?? 0 - t) >= 1;
60
+ !r || !a || k({
61
+ x: s,
61
62
  y: t
62
63
  });
63
- }, []), _ = x(() => {
64
- o.removeEventListener("mousemove", I), o.removeEventListener("mouseup", _), A(L), U(L);
65
- }, [I, o]), P = x(
66
- ({ clientY: t, clientX: r, button: s }) => {
67
- s === K && (o.addEventListener("mousemove", I), o.addEventListener("mouseup", _), A({
68
- x: r,
64
+ }, []), _ = w(() => {
65
+ o.removeEventListener("mousemove", S), o.removeEventListener("mouseup", _), A(L), k(L);
66
+ }, [S, o]), P = w(
67
+ ({ clientY: t, clientX: s, button: r }) => {
68
+ r === K && (o.addEventListener("mousemove", S), o.addEventListener("mouseup", _), A({
69
+ x: s,
69
70
  y: t
70
71
  }));
71
72
  },
72
- [I, _, o]
73
+ [S, _, o]
73
74
  // eslint-disable-line react-hooks/exhaustive-deps
74
75
  );
75
76
  f(() => {
76
77
  const t = o.querySelector(n);
77
- return t && (ne(o), t.addEventListener("mousedown", P)), () => {
78
- t && (t.removeEventListener("mousedown", P), oe(o));
78
+ return t && (oe(o), t.addEventListener("mousedown", P)), () => {
79
+ t && (t.removeEventListener("mousedown", P), re(o));
79
80
  };
80
- }, [n, P, I, _, o]), f(() => {
81
- const t = o.querySelectorAll(`[${J}]`), r = Array.from(t).reduce((s, a) => {
82
- const b = te(a);
83
- return a instanceof HTMLElement && ee(b, N) && a.dataset.dragSelectId && s.push(a.dataset.dragSelectId), s;
81
+ }, [n, P, S, _, o]), f(() => {
82
+ const t = o.querySelectorAll(`[${J}]`), s = Array.from(t).reduce((r, a) => {
83
+ const X = ne(a);
84
+ return a instanceof HTMLElement && te(X, N) && a.dataset.dragSelectId && r.push(a.dataset.dragSelectId), r;
84
85
  }, []);
85
- Y(r);
86
+ F(s);
86
87
  }, [N, o]), f(() => {
87
88
  if (!y || y === v || !i.current)
88
89
  return;
89
- const t = v.filter((s) => !y.includes(s)), r = y.filter(
90
- (s) => !v.includes(s)
90
+ const t = v.filter((r) => !y.includes(r)), s = y.filter(
91
+ (r) => !v.includes(r)
91
92
  );
92
- t.length && m(t), r.length && l(r);
93
+ t.length && m(t), s.length && l(s);
93
94
  }, [v, y, m, l, i]);
94
- const q = o.querySelector(`#${O}`);
95
- return !i.current || !q ? null : G(
96
- /* @__PURE__ */ j(
95
+ const U = o.querySelector(`#${x}`);
96
+ return !i.current || !U ? null : z(
97
+ /* @__PURE__ */ Y(
97
98
  "div",
98
99
  {
99
100
  ...e,
100
- style: e.style ? {
101
- ...F,
101
+ style: {
102
+ ...Z,
102
103
  ...e.style,
103
- ...w
104
- } : { ...F, ...w },
104
+ ...O,
105
+ borderColor: G.brandPrimary500,
106
+ borderStyle: "solid",
107
+ borderWidth: 2,
108
+ // This is brandColour300 in rgba with 0.2 opacity
109
+ background: "rgba(148, 189, 255, 0.2)"
110
+ },
105
111
  "data-testid": "drag-selection"
106
112
  }
107
113
  ),
108
- q
114
+ U
109
115
  );
110
- }, F = { position: "absolute", zIndex: 100 }, Z = (n, e, m) => {
116
+ }, Z = { position: "absolute", zIndex: 100 }, ee = (n, e, m) => {
111
117
  if (!n.x || !n.y || !e.x || !e.y || !m)
112
118
  return { left: 0, top: 0, height: 0, width: 0 };
113
119
  const l = m.getBoundingClientRect(), h = Math.max(e.x, 0);
@@ -117,7 +123,7 @@ const L = {
117
123
  let d = Math.abs(h - n.x);
118
124
  const D = l.width + l.left - u - 4;
119
125
  return d = Math.min(d, D), { left: u, top: E, height: R, width: d };
120
- }, ee = (n, e) => n.left <= e.left + e.width && n.left + n.width >= e.left && n.top <= e.top + e.height && n.top + n.height >= e.top, te = (n) => {
126
+ }, te = (n, e) => n.left <= e.left + e.width && n.left + n.width >= e.left && n.top <= e.top + e.height && n.top + n.height >= e.top, ne = (n) => {
121
127
  const e = n.getBoundingClientRect();
122
128
  return {
123
129
  left: e.left,
@@ -125,20 +131,19 @@ const L = {
125
131
  height: e.height,
126
132
  width: e.width
127
133
  };
128
- }, ne = (n) => {
129
- const e = document.createElement("div");
130
- e.id = O, n.appendChild(e);
131
134
  }, oe = (n) => {
132
- const e = n.querySelector(`#${O}`);
135
+ const e = document.createElement("div");
136
+ e.id = x, n.appendChild(e);
137
+ }, re = (n) => {
138
+ const e = n.querySelector(`#${x}`);
133
139
  e && e.remove();
134
140
  }, se = (n) => {
135
- const e = S();
141
+ const e = I();
136
142
  return f(() => {
137
143
  e.current = n;
138
144
  }), e.current;
139
145
  };
140
146
  export {
141
- de as DragSelect,
142
- Z as getSelectionBoxRect
147
+ fe as DragSelect,
148
+ ee as getSelectionBoxRect
143
149
  };
144
- //# sourceMappingURL=DragSelect.js.map
package/Dropdown.js CHANGED
@@ -69,4 +69,3 @@ const I = r.div`
69
69
  export {
70
70
  N as Dropdown
71
71
  };
72
- //# sourceMappingURL=Dropdown.js.map
@@ -1,59 +1,74 @@
1
- import { jsx as b } from "react/jsx-runtime";
2
- import { useRef as W, useState as y, useLayoutEffect as R } from "react";
3
- import { createPortal as D } from "react-dom";
4
- import { styled as H } from "styled-components";
5
- import { token as k } from "@bynder/design-system";
6
- import { useClickOutside as O } from "./useClickOutside.js";
7
- import { useRootElement as P } from "./RootElementContext.js";
8
- import { concatClasses as S } from "./class.js";
9
- function U(t) {
10
- const n = W(null), [, d] = y(0);
11
- O([t.target, n], t.onClickOutside);
12
- const i = !!document.querySelector("#compactViewContainer");
13
- R(() => {
14
- d(
1
+ import { jsx as L } from "react/jsx-runtime";
2
+ import { useRef as O, useState as l, useLayoutEffect as g } from "react";
3
+ import { createPortal as P } from "react-dom";
4
+ import { styled as S } from "styled-components";
5
+ import { token as m } from "@bynder/design-system";
6
+ import { useClickOutside as z } from "./useClickOutside.js";
7
+ import { useRootElement as V } from "./RootElementContext.js";
8
+ import { concatClasses as j } from "./class.js";
9
+ function Q(t) {
10
+ const e = O(null), [, h] = l(0);
11
+ z([t.target, e], t.onClickOutside);
12
+ const d = !!document.querySelector("#compactViewContainer");
13
+ g(() => {
14
+ h(
15
15
  t.target.current !== null ? t.target.current.getBoundingClientRect().x : 0
16
16
  );
17
17
  }, [t.target]);
18
- const c = P();
19
- if (c === null || t.target.current === null)
18
+ const [x, w] = l(600);
19
+ g(() => {
20
+ const n = () => {
21
+ if (!t.target.current) return;
22
+ const a = t.target.current.getBoundingClientRect(), E = window.innerHeight - (a.top + a.height), $ = a.top, u = 600, k = Math.max(E, $);
23
+ let r = Math.min(
24
+ u,
25
+ k,
26
+ window.innerHeight
27
+ );
28
+ r < u && (r = Math.max(0, r)), w(r);
29
+ };
30
+ return n(), window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
31
+ }, [t.target, t.direction]);
32
+ const s = V();
33
+ if (s === null || t.target.current === null)
20
34
  return null;
21
- const a = () => t.isMetapropertyDropdown ? i ? "39%" : o < 1120 ? u : 1120 : 300, s = () => {
22
- const v = n.current && r + n.current.clientWidth > o ? void 0 : r;
23
- return i ? "initial" : v;
24
- }, e = t.target.current.getBoundingClientRect(), r = e.x, o = window.innerWidth - 32, u = o - 16, l = 280, m = a(), g = 600, f = s(), x = n.current && r + n.current.clientWidth > o ? 24 : void 0, h = t.direction === "Down" ? e.top + e.height : void 0, w = t.direction === "Up" ? window.innerHeight - e.top : void 0, C = {
25
- left: f,
26
- right: x,
27
- top: h,
28
- bottom: w,
29
- minWidth: l,
30
- maxWidth: m,
31
- maxHeight: g
32
- }, p = S("cv-root cv-dropdown");
33
- return D(
34
- /* @__PURE__ */ b(
35
- B,
35
+ const f = () => t.isMetapropertyDropdown ? d ? "39%" : i < 1120 ? C : 1120 : 300, v = () => {
36
+ const n = e.current && c + e.current.clientWidth > i ? void 0 : c;
37
+ return d ? "initial" : n;
38
+ }, o = t.target.current.getBoundingClientRect(), c = o.x, i = window.innerWidth - 32, C = i - 16, H = 280, p = f(), b = "auto", M = v(), W = e.current && c + e.current.clientWidth > i ? 24 : void 0, R = t.direction === "Down" ? o.top + o.height : void 0, y = t.direction === "Up" ? window.innerHeight - o.top : void 0, B = {
39
+ left: M,
40
+ right: W,
41
+ top: R,
42
+ bottom: y,
43
+ minWidth: H,
44
+ maxWidth: p,
45
+ // Subtract spacing7 for bottom padding if not at max height to account for bottom padding.
46
+ maxHeight: `calc(${x}px - ${m.spacing7})`,
47
+ overflow: b
48
+ }, D = j("cv-root cv-dropdown");
49
+ return P(
50
+ /* @__PURE__ */ L(
51
+ q,
36
52
  {
37
53
  role: "menu",
38
54
  id: t.id,
39
- className: p,
40
- ref: n,
41
- style: C,
55
+ className: D,
56
+ ref: e,
57
+ style: B,
42
58
  isPaddingContent: t.isPaddingContent,
43
59
  children: t.children
44
60
  }
45
61
  ),
46
- c
62
+ s
47
63
  );
48
64
  }
49
- const B = H.div`
50
- padding: ${({ isPaddingContent: t }) => t ? `${k.spacing3} 0` : "0"};
65
+ const q = S.div`
66
+ padding: ${({ isPaddingContent: t }) => t ? `${m.spacing3} 0` : "0"};
51
67
  user-select: none;
52
68
  border-radius: 6px;
53
69
  border: 1px solid rgba(3, 16, 38, 0.17);
54
70
  box-shadow: 0px 0px 1px 0px rgba(3, 16, 38, 0.1), 0px 8px 12px -2px rgba(3, 16, 38, 0.1);
55
71
  `;
56
72
  export {
57
- U as DropdownContent
73
+ Q as DropdownContent
58
74
  };
59
- //# sourceMappingURL=DropdownContent.js.map
@@ -49,4 +49,3 @@ const c = r.button`
49
49
  export {
50
50
  m as DropdownListItem
51
51
  };
52
- //# sourceMappingURL=DropdownListItem.js.map
package/ErrorIcon.js CHANGED
@@ -45,4 +45,3 @@ function e() {
45
45
  export {
46
46
  e as ErrorIcon
47
47
  };
48
- //# sourceMappingURL=ErrorIcon.js.map
package/ErrorMessage.js CHANGED
@@ -37,4 +37,3 @@ const l = i.h1`
37
37
  export {
38
38
  u as ErrorMessage
39
39
  };
40
- //# sourceMappingURL=ErrorMessage.js.map
package/FieldSelect.js CHANGED
@@ -71,4 +71,3 @@ const S = t.ul`
71
71
  export {
72
72
  R as FieldSelect
73
73
  };
74
- //# sourceMappingURL=FieldSelect.js.map