@box/metadata-taxonomy-picker 2.20.6 → 3.1.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.
@@ -32,7 +32,7 @@ var fe = [];
32
32
  function pe(e) {
33
33
  if (e != null) return (typeof e == "function" ? e() : e) ?? void 0;
34
34
  }
35
- var g = /* @__PURE__ */ a(function({ itemsService: a, eventService: g, levels: _ = fe, mode: me, multiSelect: v, value: y, onValueChange: b, placeholder: he, disabled: x = !1, label: S, containerClassName: ge, portalElement: _e }, ve) {
35
+ var g = /*#__PURE__*/ a(function({ itemsService: a, eventService: g, levels: _ = fe, mode: me, multiSelect: v, value: y, onValueChange: b, placeholder: he, disabled: x = !1, label: S, containerClassName: ge, portalElement: _e }, ve) {
36
36
  let { formatMessage: C } = ue(), w = te(), T = `${w}-listbox`, E = l(null), ye = oe(E, ve), D = l(null), O = l(null), k = l(0), A = l(!1), be = pe(_e), j = me === m.SingleLevel, { state: M, isOpen: N, handleOpenChange: P, handleInputValueChange: F, actions: I } = t(a, _, g), { items: L, levelStack: R } = M, { drillDown: z, navigateBack: B, loadMore: xe, setSearchScopeOverride: V } = I, H = M.searchInputValue !== "", U = c(() => de(M.availableLevels), [M.availableLevels]);
37
37
  ee(() => {
38
38
  V(j && U !== null ? {
@@ -37,7 +37,7 @@ import '../styles/taxonomy-ancestor-breadcrumb.css';var f = {
37
37
  ancestor: t,
38
38
  bold: i === n,
39
39
  onMount: r
40
- })] }, t.id)) }), v = /* @__PURE__ */ t(function({ ancestors: e }) {
40
+ })] }, t.id)) }), v = /*#__PURE__*/ t(function({ ancestors: e }) {
41
41
  let t = i(null), v = i(null), y = i(/* @__PURE__ */ new Map()), [b, x] = a(!1), [S, C] = a(!1), w = e.length - 1, T = e.length >= 3 && b, E = b || S, D = n((e, t) => {
42
42
  t ? y.current.set(e.id, {
43
43
  node: t,
@@ -14,7 +14,7 @@ import '../styles/taxonomy-items-list.css';var y = {
14
14
  scrollContainer: "_scrollContainer_lky3p_1",
15
15
  virtualContent: "_virtualContent_lky3p_11",
16
16
  virtualRow: "_virtualRow_lky3p_23"
17
- }, b = /* @__PURE__ */ s(function({ children: e, selectedValue: t, onValueChange: n }) {
17
+ }, b = /*#__PURE__*/ s(function({ children: e, selectedValue: t, onValueChange: n }) {
18
18
  let r = f(null), i = c((e) => {
19
19
  r.current = e.key;
20
20
  }, []), a = c((e) => {
@@ -28,7 +28,7 @@ import '../styles/taxonomy-items-list.css';var y = {
28
28
  value: t,
29
29
  children: e
30
30
  });
31
- }), x = (e) => e.getBoundingClientRect().height, S = "__load-more-skeleton__", C = /* @__PURE__ */ o(function({ items: o, multiSelect: s, selectedValue: p, estimatedRowHeight: C = 36, hasVariableRowHeight: w = !1, isSearchMode: T = !1, isFetching: E, error: D, loadMoreError: O = null, listboxId: k, onFocusExit: A, onRetry: j, hasMore: M = !1, isFetchingMore: N = !1, onLoadMore: P }, F) {
31
+ }), x = (e) => e.getBoundingClientRect().height, S = "__load-more-skeleton__", C = /*#__PURE__*/ o(function({ items: o, multiSelect: s, selectedValue: p, estimatedRowHeight: C = 36, hasVariableRowHeight: w = !1, isSearchMode: T = !1, isFetching: E, error: D, loadMoreError: O = null, listboxId: k, onFocusExit: A, onRetry: j, hasMore: M = !1, isFetchingMore: N = !1, onLoadMore: P }, F) {
32
32
  let I = f(null);
33
33
  u(F, () => ({
34
34
  getScrollTop: () => I.current?.scrollTop ?? 0,
@@ -15,7 +15,7 @@ import '../styles/taxonomy-menu-item.css';var g = {
15
15
  selectionControl: "_selectionControl_1a4ve_31",
16
16
  content: "_content_1a4ve_41",
17
17
  drillDown: "_drillDown_1a4ve_48"
18
- }, _ = /* @__PURE__ */ r(function({ id: r, displayName: _, isSearchMode: v = !1, selectable: y, multiSelect: b, isSelected: x, showDrillDown: S, ancestors: C, onSelect: w, onDrillDown: T, onFocusExit: E }) {
18
+ }, _ = /*#__PURE__*/ r(function({ id: r, displayName: _, isSearchMode: v = !1, selectable: y, multiSelect: b, isSelected: x, showDrillDown: S, ancestors: C, onSelect: w, onDrillDown: T, onFocusExit: E }) {
19
19
  let { formatMessage: D } = d(), O = C != null && C.length > 0 && v, k = a(null), A = a(null), j = a(null), { handleSelectionControlFocus: M, handleRowKeyDown: N, handleRowKeyDownCapture: P, handleSelectionControlKeyDown: F, handleDrillDownKeyDown: I } = n({
20
20
  id: r,
21
21
  multiSelect: b,
@@ -1,7 +1,7 @@
1
1
  import { t as e } from "../../chunks/metadata-taxonomy-picker-shell.js";
2
2
  import { forwardRef as t } from "react";
3
3
  import { jsx as n } from "react/jsx-runtime";
4
- var r = /* @__PURE__ */ t(function(t, r) {
4
+ var r = /*#__PURE__*/ t(function(t, r) {
5
5
  return /* @__PURE__ */ n(e, {
6
6
  ...t,
7
7
  ref: r
@@ -24,114 +24,114 @@ var t = /* @__PURE__ */ function(e) {
24
24
  availableLevels: [],
25
25
  lastFailedOp: null
26
26
  };
27
- function i(i, a) {
28
- switch (a.type) {
29
- case n.FetchStart: return {
30
- ...i,
27
+ function i(t, n) {
28
+ switch (n.type) {
29
+ case "FETCH_START": return {
30
+ ...t,
31
31
  isFetching: !0,
32
32
  initialLoadError: null,
33
33
  loadMoreError: null,
34
34
  lastFailedOp: null
35
35
  };
36
- case n.FetchSuccess: return a.forParentId === i.currentParentId ? {
37
- ...i,
36
+ case "FETCH_SUCCESS": return n.forParentId === t.currentParentId ? {
37
+ ...t,
38
38
  isFetching: !1,
39
- items: a.entries,
40
- itemsNextMarker: a.nextMarker,
39
+ items: n.entries,
40
+ itemsNextMarker: n.nextMarker,
41
41
  initialLoadError: null
42
- } : i;
43
- case n.FetchError: return a.forParentId === i.currentParentId ? {
44
- ...i,
42
+ } : t;
43
+ case "FETCH_ERROR": return n.forParentId === t.currentParentId ? {
44
+ ...t,
45
45
  isFetching: !1,
46
- initialLoadError: a.error,
47
- lastFailedOp: t.Browse
48
- } : i;
49
- case n.DrillDown: return e(i, a.targetParentId, a.levelStack);
50
- case n.NavigateBack: return {
51
- ...e(i, a.targetParentId, a.levelStack),
52
- items: a.cached.items,
53
- itemsNextMarker: a.cached.nextMarker,
46
+ initialLoadError: n.error,
47
+ lastFailedOp: "browse"
48
+ } : t;
49
+ case "DRILL_DOWN": return e(t, n.targetParentId, n.levelStack);
50
+ case "NAVIGATE_BACK": return {
51
+ ...e(t, n.targetParentId, n.levelStack),
52
+ items: n.cached.items,
53
+ itemsNextMarker: n.cached.nextMarker,
54
54
  isFetching: !1
55
55
  };
56
- case n.NavigateBackRefetch: return e(i, a.targetParentId, a.levelStack);
57
- case n.Reset: return r;
58
- case n.LoadMoreStart: return {
59
- ...i,
56
+ case "NAVIGATE_BACK_REFETCH": return e(t, n.targetParentId, n.levelStack);
57
+ case "RESET": return r;
58
+ case "LOAD_MORE_START": return {
59
+ ...t,
60
60
  isFetchingMore: !0,
61
61
  loadMoreError: null,
62
- lastFailedOp: i.lastFailedOp === t.BrowseMore ? null : i.lastFailedOp
62
+ lastFailedOp: t.lastFailedOp === "browse-more" ? null : t.lastFailedOp
63
63
  };
64
- case n.LoadMoreSuccess: return {
65
- ...i,
64
+ case "LOAD_MORE_SUCCESS": return {
65
+ ...t,
66
66
  isFetchingMore: !1,
67
- items: [...i.items, ...a.entries],
68
- itemsNextMarker: a.nextMarker,
67
+ items: [...t.items, ...n.entries],
68
+ itemsNextMarker: n.nextMarker,
69
69
  loadMoreError: null,
70
- lastFailedOp: i.lastFailedOp === t.BrowseMore ? null : i.lastFailedOp
70
+ lastFailedOp: t.lastFailedOp === "browse-more" ? null : t.lastFailedOp
71
71
  };
72
- case n.LoadMoreError: return {
73
- ...i,
72
+ case "LOAD_MORE_ERROR": return {
73
+ ...t,
74
74
  isFetchingMore: !1,
75
- loadMoreError: a.error,
76
- lastFailedOp: t.BrowseMore
75
+ loadMoreError: n.error,
76
+ lastFailedOp: "browse-more"
77
77
  };
78
- case n.SearchLoadMoreStart: return {
79
- ...i,
78
+ case "SEARCH_LOAD_MORE_START": return {
79
+ ...t,
80
80
  isFetchingSearchMore: !0,
81
81
  searchLoadMoreError: null,
82
- lastFailedOp: i.lastFailedOp === t.SearchMore ? null : i.lastFailedOp
82
+ lastFailedOp: t.lastFailedOp === "search-more" ? null : t.lastFailedOp
83
83
  };
84
- case n.SearchLoadMoreSuccess: return a.forQuery === i.searchQuery ? {
85
- ...i,
84
+ case "SEARCH_LOAD_MORE_SUCCESS": return n.forQuery === t.searchQuery ? {
85
+ ...t,
86
86
  isFetchingSearchMore: !1,
87
- searchResults: [...i.searchResults, ...a.entries],
88
- searchNextMarker: a.nextMarker,
87
+ searchResults: [...t.searchResults, ...n.entries],
88
+ searchNextMarker: n.nextMarker,
89
89
  searchLoadMoreError: null,
90
- lastFailedOp: i.lastFailedOp === t.SearchMore ? null : i.lastFailedOp
91
- } : i;
92
- case n.SearchLoadMoreError: return a.forQuery === i.searchQuery ? {
93
- ...i,
90
+ lastFailedOp: t.lastFailedOp === "search-more" ? null : t.lastFailedOp
91
+ } : t;
92
+ case "SEARCH_LOAD_MORE_ERROR": return n.forQuery === t.searchQuery ? {
93
+ ...t,
94
94
  isFetchingSearchMore: !1,
95
- searchLoadMoreError: a.error,
96
- lastFailedOp: t.SearchMore
97
- } : i;
98
- case n.SearchInputChange: {
99
- let e = a.value !== "" && i.searchInputValue === "" && i.levelStack.length > 0 && a.availableLevels.length > 1 ? a.availableLevels[i.levelStack.length]?.level ?? i.levelStack.length + 1 : i.levelFilter;
95
+ searchLoadMoreError: n.error,
96
+ lastFailedOp: "search-more"
97
+ } : t;
98
+ case "SEARCH_INPUT_CHANGE": {
99
+ let e = n.value !== "" && t.searchInputValue === "" && t.levelStack.length > 0 && n.availableLevels.length > 1 ? n.availableLevels[t.levelStack.length]?.level ?? t.levelStack.length + 1 : t.levelFilter;
100
100
  return {
101
- ...i,
102
- searchInputValue: a.value,
103
- levelFilter: a.value === "" ? null : e,
104
- availableLevels: [...a.availableLevels],
105
- isFetchingSearch: a.value !== "",
101
+ ...t,
102
+ searchInputValue: n.value,
103
+ levelFilter: n.value === "" ? null : e,
104
+ availableLevels: [...n.availableLevels],
105
+ isFetchingSearch: n.value !== "",
106
106
  isFetchingSearchMore: !1,
107
107
  searchLoadMoreError: null,
108
- lastFailedOp: i.lastFailedOp === t.SearchMore ? null : i.lastFailedOp
108
+ lastFailedOp: t.lastFailedOp === "search-more" ? null : t.lastFailedOp
109
109
  };
110
110
  }
111
- case n.SearchFetchStart: return {
112
- ...i,
111
+ case "SEARCH_FETCH_START": return {
112
+ ...t,
113
113
  isFetchingSearch: !0,
114
114
  isFetchingSearchMore: !1,
115
115
  searchError: null,
116
116
  searchLoadMoreError: null,
117
117
  searchNextMarker: void 0,
118
- searchQuery: a.query,
119
- lastFailedOp: i.lastFailedOp === t.Search || i.lastFailedOp === t.SearchMore ? null : i.lastFailedOp
118
+ searchQuery: n.query,
119
+ lastFailedOp: t.lastFailedOp === "search" || t.lastFailedOp === "search-more" ? null : t.lastFailedOp
120
120
  };
121
- case n.SearchFetchSuccess: return a.forQuery === i.searchQuery ? {
122
- ...i,
121
+ case "SEARCH_FETCH_SUCCESS": return n.forQuery === t.searchQuery ? {
122
+ ...t,
123
123
  isFetchingSearch: !1,
124
- searchResults: a.results,
125
- searchNextMarker: a.nextMarker
126
- } : i;
127
- case n.SearchFetchError: return {
128
- ...i,
124
+ searchResults: n.results,
125
+ searchNextMarker: n.nextMarker
126
+ } : t;
127
+ case "SEARCH_FETCH_ERROR": return {
128
+ ...t,
129
129
  isFetchingSearch: !1,
130
- searchError: a.error,
131
- lastFailedOp: t.Search
130
+ searchError: n.error,
131
+ lastFailedOp: "search"
132
132
  };
133
- case n.SearchClear: return {
134
- ...i,
133
+ case "SEARCH_CLEAR": return {
134
+ ...t,
135
135
  searchInputValue: "",
136
136
  searchQuery: "",
137
137
  searchResults: [],
@@ -140,13 +140,13 @@ function i(i, a) {
140
140
  isFetchingSearchMore: !1,
141
141
  searchError: null,
142
142
  searchLoadMoreError: null,
143
- lastFailedOp: i.lastFailedOp === t.Search || i.lastFailedOp === t.SearchMore ? null : i.lastFailedOp
143
+ lastFailedOp: t.lastFailedOp === "search" || t.lastFailedOp === "search-more" ? null : t.lastFailedOp
144
144
  };
145
- case n.SetLevelFilter: return {
146
- ...i,
147
- levelFilter: a.level
145
+ case "SET_LEVEL_FILTER": return {
146
+ ...t,
147
+ levelFilter: n.level
148
148
  };
149
- default: return i;
149
+ default: return t;
150
150
  }
151
151
  }
152
152
  export { t as FailedOp, n as PickerActionType, r as initialState, i as pickerReducer };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@box/metadata-taxonomy-picker",
3
- "version": "2.20.6",
3
+ "version": "3.1.1",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@ariakit/react": "^0.4.21",
7
- "@box/blueprint-web": "^15.10.0",
8
- "@box/blueprint-web-assets": "^4.131.1",
7
+ "@box/blueprint-web": "^16.1.1",
8
+ "@box/blueprint-web-assets": "^5.1.1",
9
9
  "@tanstack/react-virtual": "^3.10.8",
10
10
  "react": "^18.0.0",
11
11
  "react-dom": "^18.0.0",
@@ -13,10 +13,10 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@ariakit/react": "^0.4.21",
16
- "@box/blueprint-web": "^15.10.0",
17
- "@box/blueprint-web-assets": "^4.131.1",
18
- "@box/eslint-plugin-blueprint": "1.2.7",
19
- "@box/storybook-utils": "0.21.13",
16
+ "@box/blueprint-web": "^16.1.1",
17
+ "@box/blueprint-web-assets": "^5.1.1",
18
+ "@box/eslint-plugin-blueprint": "2.1.1",
19
+ "@box/storybook-utils": "1.1.1",
20
20
  "@tanstack/react-virtual": "^3.10.8",
21
21
  "react-intl": "^6.4.2"
22
22
  },