@box/metadata-taxonomy-picker 2.18.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/LICENSE +379 -0
- package/README.md +57 -0
- package/dist/chunks/empty-state.js +22 -0
- package/dist/chunks/error-state.js +41 -0
- package/dist/chunks/load-more-error-row.js +53 -0
- package/dist/chunks/load-more-loading-row.js +17 -0
- package/dist/chunks/loading-state.js +17 -0
- package/dist/chunks/metadata-taxonomy-picker-shell.js +278 -0
- package/dist/chunks/taxonomy-ancestor-breadcrumb.js +115 -0
- package/dist/chunks/taxonomy-items-list.js +114 -0
- package/dist/chunks/taxonomy-level-filter.js +47 -0
- package/dist/chunks/taxonomy-menu-item.js +99 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/lib/components/metadata-taxonomy-picker-shell/index.js +2 -0
- package/dist/esm/lib/components/metadata-taxonomy-picker-shell/messages.js +24 -0
- package/dist/esm/lib/components/metadata-taxonomy-picker-shell/metadata-taxonomy-picker-shell.js +2 -0
- package/dist/esm/lib/components/taxonomy-ancestor-breadcrumb/index.js +2 -0
- package/dist/esm/lib/components/taxonomy-ancestor-breadcrumb/taxonomy-ancestor-breadcrumb.js +2 -0
- package/dist/esm/lib/components/taxonomy-items-list/empty-state/empty-state.js +2 -0
- package/dist/esm/lib/components/taxonomy-items-list/empty-state/index.js +2 -0
- package/dist/esm/lib/components/taxonomy-items-list/error-state/error-state.js +2 -0
- package/dist/esm/lib/components/taxonomy-items-list/error-state/index.js +2 -0
- package/dist/esm/lib/components/taxonomy-items-list/index.js +6 -0
- package/dist/esm/lib/components/taxonomy-items-list/load-more-feedback/index.js +3 -0
- package/dist/esm/lib/components/taxonomy-items-list/load-more-feedback/load-more-error-row.js +2 -0
- package/dist/esm/lib/components/taxonomy-items-list/load-more-feedback/load-more-loading-row.js +2 -0
- package/dist/esm/lib/components/taxonomy-items-list/load-more-feedback/messages.js +20 -0
- package/dist/esm/lib/components/taxonomy-items-list/loading-state/index.js +2 -0
- package/dist/esm/lib/components/taxonomy-items-list/loading-state/loading-state.js +2 -0
- package/dist/esm/lib/components/taxonomy-items-list/messages.js +36 -0
- package/dist/esm/lib/components/taxonomy-items-list/taxonomy-items-list.js +2 -0
- package/dist/esm/lib/components/taxonomy-level-filter/index.js +2 -0
- package/dist/esm/lib/components/taxonomy-level-filter/messages.js +6 -0
- package/dist/esm/lib/components/taxonomy-level-filter/taxonomy-level-filter.js +2 -0
- package/dist/esm/lib/components/taxonomy-menu-item/index.js +2 -0
- package/dist/esm/lib/components/taxonomy-menu-item/messages.js +6 -0
- package/dist/esm/lib/components/taxonomy-menu-item/taxonomy-menu-item.js +2 -0
- package/dist/esm/lib/components/taxonomy-menu-item/use-taxonomy-menu-item-keyboard.js +100 -0
- package/dist/esm/lib/constants.js +2 -0
- package/dist/esm/lib/hooks/messages.js +16 -0
- package/dist/esm/lib/hooks/use-taxonomy-picker-controller.js +261 -0
- package/dist/esm/lib/metadata-taxonomy-picker.js +10 -0
- package/dist/esm/lib/state/reducer.js +147 -0
- package/dist/esm/lib/state/transitions.js +22 -0
- package/dist/i18n/bn-IN.js +24 -0
- package/dist/i18n/bn-IN.properties +44 -0
- package/dist/i18n/da-DK.js +24 -0
- package/dist/i18n/da-DK.properties +44 -0
- package/dist/i18n/de-DE.js +24 -0
- package/dist/i18n/de-DE.properties +44 -0
- package/dist/i18n/en-AU.js +24 -0
- package/dist/i18n/en-AU.properties +44 -0
- package/dist/i18n/en-CA.js +24 -0
- package/dist/i18n/en-CA.properties +44 -0
- package/dist/i18n/en-GB.js +24 -0
- package/dist/i18n/en-GB.properties +44 -0
- package/dist/i18n/en-US.js +24 -0
- package/dist/i18n/en-US.properties +44 -0
- package/dist/i18n/en-x-pseudo.js +24 -0
- package/dist/i18n/en-x-pseudo.properties +44 -0
- package/dist/i18n/es-419.js +24 -0
- package/dist/i18n/es-419.properties +44 -0
- package/dist/i18n/es-ES.js +24 -0
- package/dist/i18n/es-ES.properties +44 -0
- package/dist/i18n/fi-FI.js +24 -0
- package/dist/i18n/fi-FI.properties +44 -0
- package/dist/i18n/fr-CA.js +24 -0
- package/dist/i18n/fr-CA.properties +44 -0
- package/dist/i18n/fr-FR.js +24 -0
- package/dist/i18n/fr-FR.properties +44 -0
- package/dist/i18n/hi-IN.js +24 -0
- package/dist/i18n/hi-IN.properties +44 -0
- package/dist/i18n/it-IT.js +24 -0
- package/dist/i18n/it-IT.properties +44 -0
- package/dist/i18n/ja-JP.js +24 -0
- package/dist/i18n/ja-JP.properties +44 -0
- package/dist/i18n/json/src/lib/components/metadata-taxonomy-picker-shell/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/taxonomy-items-list/load-more-feedback/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/taxonomy-items-list/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/taxonomy-level-filter/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/taxonomy-menu-item/messages.json +1 -0
- package/dist/i18n/json/src/lib/hooks/messages.json +1 -0
- package/dist/i18n/ko-KR.js +24 -0
- package/dist/i18n/ko-KR.properties +44 -0
- package/dist/i18n/nb-NO.js +24 -0
- package/dist/i18n/nb-NO.properties +44 -0
- package/dist/i18n/nl-NL.js +24 -0
- package/dist/i18n/nl-NL.properties +44 -0
- package/dist/i18n/pl-PL.js +24 -0
- package/dist/i18n/pl-PL.properties +44 -0
- package/dist/i18n/pt-BR.js +24 -0
- package/dist/i18n/pt-BR.properties +44 -0
- package/dist/i18n/ru-RU.js +24 -0
- package/dist/i18n/ru-RU.properties +44 -0
- package/dist/i18n/sv-SE.js +24 -0
- package/dist/i18n/sv-SE.properties +44 -0
- package/dist/i18n/tr-TR.js +24 -0
- package/dist/i18n/tr-TR.properties +44 -0
- package/dist/i18n/zh-CN.js +24 -0
- package/dist/i18n/zh-CN.properties +44 -0
- package/dist/i18n/zh-TW.js +24 -0
- package/dist/i18n/zh-TW.properties +44 -0
- package/dist/styles/empty-state.css +1 -0
- package/dist/styles/error-state.css +1 -0
- package/dist/styles/load-more-error-row.css +1 -0
- package/dist/styles/load-more-loading-row.css +1 -0
- package/dist/styles/loading-state.css +1 -0
- package/dist/styles/metadata-taxonomy-picker-shell.css +1 -0
- package/dist/styles/taxonomy-ancestor-breadcrumb.css +1 -0
- package/dist/styles/taxonomy-items-list.css +1 -0
- package/dist/styles/taxonomy-level-filter.css +1 -0
- package/dist/styles/taxonomy-menu-item.css +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/lib/components/metadata-taxonomy-picker-shell/index.d.ts +1 -0
- package/dist/types/lib/components/metadata-taxonomy-picker-shell/messages.d.ts +27 -0
- package/dist/types/lib/components/metadata-taxonomy-picker-shell/metadata-taxonomy-picker-shell.d.ts +2 -0
- package/dist/types/lib/components/taxonomy-ancestor-breadcrumb/index.d.ts +1 -0
- package/dist/types/lib/components/taxonomy-ancestor-breadcrumb/taxonomy-ancestor-breadcrumb.d.ts +16 -0
- package/dist/types/lib/components/taxonomy-items-list/empty-state/empty-state.d.ts +10 -0
- package/dist/types/lib/components/taxonomy-items-list/empty-state/index.d.ts +1 -0
- package/dist/types/lib/components/taxonomy-items-list/error-state/error-state.d.ts +9 -0
- package/dist/types/lib/components/taxonomy-items-list/error-state/index.d.ts +1 -0
- package/dist/types/lib/components/taxonomy-items-list/index.d.ts +5 -0
- package/dist/types/lib/components/taxonomy-items-list/load-more-feedback/index.d.ts +2 -0
- package/dist/types/lib/components/taxonomy-items-list/load-more-feedback/load-more-error-row.d.ts +10 -0
- package/dist/types/lib/components/taxonomy-items-list/load-more-feedback/load-more-loading-row.d.ts +7 -0
- package/dist/types/lib/components/taxonomy-items-list/load-more-feedback/messages.d.ts +22 -0
- package/dist/types/lib/components/taxonomy-items-list/loading-state/index.d.ts +1 -0
- package/dist/types/lib/components/taxonomy-items-list/loading-state/loading-state.d.ts +6 -0
- package/dist/types/lib/components/taxonomy-items-list/messages.d.ts +42 -0
- package/dist/types/lib/components/taxonomy-items-list/taxonomy-items-list.d.ts +82 -0
- package/dist/types/lib/components/taxonomy-level-filter/index.d.ts +1 -0
- package/dist/types/lib/components/taxonomy-level-filter/messages.d.ts +7 -0
- package/dist/types/lib/components/taxonomy-level-filter/taxonomy-level-filter.d.ts +11 -0
- package/dist/types/lib/components/taxonomy-menu-item/index.d.ts +1 -0
- package/dist/types/lib/components/taxonomy-menu-item/messages.d.ts +7 -0
- package/dist/types/lib/components/taxonomy-menu-item/taxonomy-menu-item.d.ts +20 -0
- package/dist/types/lib/components/taxonomy-menu-item/use-taxonomy-menu-item-keyboard.d.ts +47 -0
- package/dist/types/lib/constants.d.ts +49 -0
- package/dist/types/lib/hooks/messages.d.ts +17 -0
- package/dist/types/lib/hooks/use-taxonomy-picker-controller.d.ts +22 -0
- package/dist/types/lib/metadata-taxonomy-picker.d.ts +8 -0
- package/dist/types/lib/state/reducer.d.ts +180 -0
- package/dist/types/lib/state/transitions.d.ts +4 -0
- package/dist/types/lib/stories/metadata-taxonomy-picker.stories.d.ts +136 -0
- package/dist/types/lib/stories/shared/build-taxonomy-items.d.ts +10 -0
- package/dist/types/lib/stories/shared/create-mock-items-service.d.ts +35 -0
- package/dist/types/lib/stories/shared/generate-deep-nodes.d.ts +39 -0
- package/dist/types/lib/stories/shared/generate-hierarchical-nodes.d.ts +3 -0
- package/dist/types/lib/stories/shared/generate-nodes.d.ts +2 -0
- package/dist/types/lib/stories/shared/generate-search-results.d.ts +10 -0
- package/dist/types/lib/stories/shared/story-container.d.ts +5 -0
- package/dist/types/lib/stories/shared/taxonomy-items-list-fixtures.d.ts +7 -0
- package/dist/types/lib/stories/taxonomy-ancestor-breadcrumb.stories.d.ts +28 -0
- package/dist/types/lib/stories/taxonomy-items-list.stories.d.ts +77 -0
- package/dist/types/lib/stories/taxonomy-menu-item.stories.d.ts +67 -0
- package/dist/types/lib/stories/tests/breadcrumb-navigation.interaction-tests.stories.d.ts +78 -0
- package/dist/types/lib/stories/tests/error-handling.interaction-tests.stories.d.ts +50 -0
- package/dist/types/lib/stories/tests/interaction-tests.stories.d.ts +47 -0
- package/dist/types/lib/stories/tests/level-filter-interaction-tests.stories.d.ts +99 -0
- package/dist/types/lib/stories/tests/level-transitions.interaction-tests.stories.d.ts +60 -0
- package/dist/types/lib/stories/tests/pagination.interaction-tests.stories.d.ts +90 -0
- package/dist/types/lib/stories/tests/portal-and-ref.interaction-tests.stories.d.ts +39 -0
- package/dist/types/lib/stories/tests/search-interaction-tests.stories.d.ts +124 -0
- package/dist/types/lib/stories/tests/shell-selection.interaction-tests.stories.d.ts +56 -0
- package/dist/types/lib/stories/tests/single-level-mode.interaction-tests.stories.d.ts +50 -0
- package/dist/types/lib/stories/tests/taxonomy-menu-item.interaction-tests.stories.d.ts +70 -0
- package/dist/types/lib/stories/tests/visual-regression-tests.stories.d.ts +38 -0
- package/dist/types/lib/types.d.ts +105 -0
- package/package.json +51 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { BREADCRUMB_ROOT_ID as e } from "../esm/lib/constants.js";
|
|
2
|
+
import { useTaxonomyPickerController as t } from "../esm/lib/hooks/use-taxonomy-picker-controller.js";
|
|
3
|
+
import { t as n } from "./taxonomy-items-list.js";
|
|
4
|
+
import { t as r } from "./taxonomy-level-filter.js";
|
|
5
|
+
import { messages as i } from "../esm/lib/components/metadata-taxonomy-picker-shell/messages.js";
|
|
6
|
+
import { forwardRef as a, useCallback as o, useEffect as ee, useId as te, useLayoutEffect as s, useMemo as c, useRef as l, useState as ne } from "react";
|
|
7
|
+
import { Breadcrumb as re, ChipsGroup as ie, IconButton as ae, InputChip as u, Popover as d, useForkRef as oe } from "@box/blueprint-web";
|
|
8
|
+
import { Search as se, XMark as ce } from "@box/blueprint-web-assets/icons/Fill";
|
|
9
|
+
import le from "clsx";
|
|
10
|
+
import { useIntl as ue } from "react-intl";
|
|
11
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
12
|
+
import '../styles/metadata-taxonomy-picker-shell.css';var m = /* @__PURE__ */ function(e) {
|
|
13
|
+
return e.SingleLevel = "single-level", e.MultiLevel = "multi-level", e;
|
|
14
|
+
}({}), h = {
|
|
15
|
+
container: "_container_1uu1w_1",
|
|
16
|
+
label: "_label_1uu1w_8",
|
|
17
|
+
trigger: "_trigger_1uu1w_16",
|
|
18
|
+
searchInput: "_searchInput_1uu1w_34",
|
|
19
|
+
chips: "_chips_1uu1w_47",
|
|
20
|
+
searchIcon: "_searchIcon_1uu1w_73",
|
|
21
|
+
emptyState: "_emptyState_1uu1w_81",
|
|
22
|
+
popover: "_popover_1uu1w_87",
|
|
23
|
+
clearButton: "_clearButton_1uu1w_92",
|
|
24
|
+
breadcrumbContainer: "_breadcrumbContainer_1uu1w_96"
|
|
25
|
+
};
|
|
26
|
+
function de(e) {
|
|
27
|
+
let t = null;
|
|
28
|
+
for (let n of e) n.selectable !== !1 && (t === null || n.level > t) && (t = n.level);
|
|
29
|
+
return t;
|
|
30
|
+
}
|
|
31
|
+
var fe = [];
|
|
32
|
+
function pe(e) {
|
|
33
|
+
if (e != null) return typeof e == "function" ? e() : e;
|
|
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) {
|
|
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
|
+
ee(() => {
|
|
38
|
+
V(j && U !== null ? {
|
|
39
|
+
parentId: null,
|
|
40
|
+
levelFilter: U
|
|
41
|
+
} : void 0);
|
|
42
|
+
}, [
|
|
43
|
+
j,
|
|
44
|
+
U,
|
|
45
|
+
V
|
|
46
|
+
]);
|
|
47
|
+
let [Se, W] = ne(""), G = l(!1), Ce = o(() => {
|
|
48
|
+
G.current = !0;
|
|
49
|
+
}, []), we = o((e) => {
|
|
50
|
+
G.current = !1, F(e.target.value);
|
|
51
|
+
}, [F]);
|
|
52
|
+
s(() => {
|
|
53
|
+
G.current ? M.searchInputValue === "" && (G.current = !1, W("")) : W(M.searchInputValue);
|
|
54
|
+
}, [M.searchInputValue]), s(() => {
|
|
55
|
+
let e;
|
|
56
|
+
return !H && A.current && (e = requestAnimationFrame(() => {
|
|
57
|
+
O.current?.scrollTo(k.current);
|
|
58
|
+
})), A.current = H, () => {
|
|
59
|
+
e !== void 0 && cancelAnimationFrame(e);
|
|
60
|
+
};
|
|
61
|
+
}, [H]);
|
|
62
|
+
let K = c(() => new Set(y.map((e) => e.id)), [y]), Te = c(() => !v && y.length === 1 ? y[0].id : "", [v, y]), q = o((e, t = !0) => {
|
|
63
|
+
let n = L.find((t) => t.id === e);
|
|
64
|
+
if (!n || !n.selectable) return;
|
|
65
|
+
let r = {
|
|
66
|
+
id: n.id,
|
|
67
|
+
displayName: n.displayName,
|
|
68
|
+
level: n.level,
|
|
69
|
+
ancestors: n.ancestors
|
|
70
|
+
};
|
|
71
|
+
v ? b(K.has(e) ? y.filter((t) => t.id !== e) : [...y, r]) : (b([r]), t && P(!1));
|
|
72
|
+
}, [
|
|
73
|
+
L,
|
|
74
|
+
v,
|
|
75
|
+
K,
|
|
76
|
+
y,
|
|
77
|
+
b,
|
|
78
|
+
P
|
|
79
|
+
]), J = o((e, t = !0) => {
|
|
80
|
+
let n = M.searchResults.find((t) => t.id === e);
|
|
81
|
+
if (!n || !n.selectable) return;
|
|
82
|
+
let r = {
|
|
83
|
+
id: n.id,
|
|
84
|
+
displayName: n.displayName,
|
|
85
|
+
level: n.level,
|
|
86
|
+
ancestors: n.ancestors
|
|
87
|
+
};
|
|
88
|
+
v ? b(K.has(e) ? y.filter((t) => t.id !== e) : [...y, r]) : (b([r]), t !== !1 && P(!1));
|
|
89
|
+
}, [
|
|
90
|
+
M.searchResults,
|
|
91
|
+
v,
|
|
92
|
+
K,
|
|
93
|
+
y,
|
|
94
|
+
b,
|
|
95
|
+
P
|
|
96
|
+
]), Y = o((e) => {
|
|
97
|
+
let t = M.searchResults.find((t) => t.id === e);
|
|
98
|
+
t && I.drillDown({
|
|
99
|
+
id: t.id,
|
|
100
|
+
displayName: t.displayName,
|
|
101
|
+
ancestors: t.ancestors
|
|
102
|
+
});
|
|
103
|
+
}, [M.searchResults, I]), X = o((e) => {
|
|
104
|
+
let t = M.items.find((t) => t.id === e);
|
|
105
|
+
t && z({
|
|
106
|
+
id: t.id,
|
|
107
|
+
displayName: t.displayName
|
|
108
|
+
});
|
|
109
|
+
}, [M.items, z]), Z = o((e) => !(!e.hasChildren || j && U !== null && e.level >= U), [j, U]), Ee = c(() => L.map((e) => ({
|
|
110
|
+
id: e.id,
|
|
111
|
+
displayName: e.displayName,
|
|
112
|
+
selectable: e.selectable,
|
|
113
|
+
multiSelect: v,
|
|
114
|
+
isSelected: K.has(e.id),
|
|
115
|
+
showDrillDown: Z(e),
|
|
116
|
+
ancestors: e.ancestors,
|
|
117
|
+
onSelect: q,
|
|
118
|
+
onDrillDown: X
|
|
119
|
+
})), [
|
|
120
|
+
L,
|
|
121
|
+
v,
|
|
122
|
+
K,
|
|
123
|
+
Z,
|
|
124
|
+
q,
|
|
125
|
+
X
|
|
126
|
+
]), Q = c(() => R.length === 0 ? [] : [{
|
|
127
|
+
id: e,
|
|
128
|
+
name: C(i.breadcrumbRootLabel)
|
|
129
|
+
}, ...R.map((e) => ({
|
|
130
|
+
id: e.id,
|
|
131
|
+
name: e.displayName
|
|
132
|
+
}))], [R, C]), De = o((e) => {
|
|
133
|
+
B(e === "__breadcrumb_root__" ? null : e);
|
|
134
|
+
}, [B]), Oe = !j && H && M.availableLevels.length > 1, ke = c(() => M.searchResults.map((e) => ({
|
|
135
|
+
id: e.id,
|
|
136
|
+
displayName: e.displayName,
|
|
137
|
+
selectable: e.selectable,
|
|
138
|
+
multiSelect: v,
|
|
139
|
+
isSelected: K.has(e.id),
|
|
140
|
+
showDrillDown: Z(e),
|
|
141
|
+
ancestors: e.ancestors,
|
|
142
|
+
onSelect: J,
|
|
143
|
+
onDrillDown: Y
|
|
144
|
+
})), [
|
|
145
|
+
M.searchResults,
|
|
146
|
+
v,
|
|
147
|
+
K,
|
|
148
|
+
Z,
|
|
149
|
+
J,
|
|
150
|
+
Y
|
|
151
|
+
]), Ae = o((e) => {
|
|
152
|
+
e.target === e.currentTarget && E.current?.focus();
|
|
153
|
+
}, [E]), $ = y.length > 0, je = he ?? C(i.placeholder), Me = (e) => {
|
|
154
|
+
!x && e.target === e.currentTarget && (e.preventDefault(), E.current?.focus());
|
|
155
|
+
}, Ne = () => {
|
|
156
|
+
!x && !N && P(!0);
|
|
157
|
+
}, Pe = o(() => {
|
|
158
|
+
x || (b([]), F(""));
|
|
159
|
+
}, [
|
|
160
|
+
x,
|
|
161
|
+
b,
|
|
162
|
+
F
|
|
163
|
+
]), Fe = (e) => {
|
|
164
|
+
!H && e.target.value && (k.current = O.current?.getScrollTop() ?? 0), W(e.target.value), G.current || F(e.target.value);
|
|
165
|
+
}, Ie = (e) => {
|
|
166
|
+
x || b(y.filter((t) => t.id !== e.id));
|
|
167
|
+
};
|
|
168
|
+
return /* @__PURE__ */ p(d.Root, {
|
|
169
|
+
modal: !1,
|
|
170
|
+
onOpenChange: P,
|
|
171
|
+
open: N,
|
|
172
|
+
children: [/* @__PURE__ */ f(d.Anchor, { children: /* @__PURE__ */ p("div", {
|
|
173
|
+
className: le(h.container, ge),
|
|
174
|
+
children: [S && /* @__PURE__ */ f("label", {
|
|
175
|
+
className: h.label,
|
|
176
|
+
htmlFor: w,
|
|
177
|
+
children: S
|
|
178
|
+
}), /* @__PURE__ */ p("div", {
|
|
179
|
+
className: h.trigger,
|
|
180
|
+
"data-disabled": x,
|
|
181
|
+
onMouseDown: Me,
|
|
182
|
+
ref: D,
|
|
183
|
+
children: [
|
|
184
|
+
v && $ && /* @__PURE__ */ f(ie, {
|
|
185
|
+
onClick: Ae,
|
|
186
|
+
children: y.map((e) => /* @__PURE__ */ f(u, {
|
|
187
|
+
label: e.displayName,
|
|
188
|
+
onDelete: () => Ie(e),
|
|
189
|
+
tabIndex: x ? -1 : void 0
|
|
190
|
+
}, e.id))
|
|
191
|
+
}),
|
|
192
|
+
!v && $ && /* @__PURE__ */ f(u, {
|
|
193
|
+
label: y[0].displayName,
|
|
194
|
+
tabIndex: x ? -1 : void 0
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ f("input", {
|
|
197
|
+
"aria-controls": T,
|
|
198
|
+
"aria-expanded": N,
|
|
199
|
+
"aria-haspopup": "listbox",
|
|
200
|
+
className: h.searchInput,
|
|
201
|
+
disabled: x,
|
|
202
|
+
id: w,
|
|
203
|
+
onChange: Fe,
|
|
204
|
+
onCompositionStart: Ce,
|
|
205
|
+
onCompositionEnd: we,
|
|
206
|
+
onFocus: Ne,
|
|
207
|
+
placeholder: $ ? void 0 : je,
|
|
208
|
+
ref: ye,
|
|
209
|
+
role: "combobox",
|
|
210
|
+
type: "text",
|
|
211
|
+
value: Se
|
|
212
|
+
}),
|
|
213
|
+
!v && $ && /* @__PURE__ */ f(ae, {
|
|
214
|
+
"aria-label": C(i.clearAriaLabel),
|
|
215
|
+
className: h.clearButton,
|
|
216
|
+
icon: ce,
|
|
217
|
+
size: "x-small",
|
|
218
|
+
tabIndex: x ? -1 : void 0,
|
|
219
|
+
onClick: Pe
|
|
220
|
+
}),
|
|
221
|
+
/* @__PURE__ */ f(se, {
|
|
222
|
+
"aria-hidden": "true",
|
|
223
|
+
className: h.searchIcon,
|
|
224
|
+
role: "presentation"
|
|
225
|
+
})
|
|
226
|
+
]
|
|
227
|
+
})]
|
|
228
|
+
}) }), /* @__PURE__ */ p(d.ContentContainer, {
|
|
229
|
+
align: "start",
|
|
230
|
+
className: h.popover,
|
|
231
|
+
container: be,
|
|
232
|
+
onInteractOutside: (e) => {
|
|
233
|
+
D.current?.contains(e.target) && e.preventDefault();
|
|
234
|
+
},
|
|
235
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
236
|
+
children: [
|
|
237
|
+
Q.length > 0 && !H && /* @__PURE__ */ f("div", {
|
|
238
|
+
className: h.breadcrumbContainer,
|
|
239
|
+
children: /* @__PURE__ */ f(re, {
|
|
240
|
+
breadcrumbAriaLabel: C(i.breadcrumbAriaLabel),
|
|
241
|
+
crumbs: Q,
|
|
242
|
+
onPageLinkClick: De,
|
|
243
|
+
rootIconVariant: "taxonomy",
|
|
244
|
+
isInteractive: !x,
|
|
245
|
+
isResponsiveEnabled: !1,
|
|
246
|
+
size: "small",
|
|
247
|
+
truncatedLinksIconAriaLabel: C(i.breadcrumbTruncatedLinksLabel),
|
|
248
|
+
truncationMethod: "folder-tree"
|
|
249
|
+
})
|
|
250
|
+
}),
|
|
251
|
+
Oe && /* @__PURE__ */ f(r, {
|
|
252
|
+
availableLevels: _,
|
|
253
|
+
levelFilter: M.levelFilter,
|
|
254
|
+
onLevelFilterChange: I.setLevelFilter
|
|
255
|
+
}),
|
|
256
|
+
/* @__PURE__ */ f(n, {
|
|
257
|
+
error: H ? M.searchError : M.initialLoadError,
|
|
258
|
+
estimatedRowHeight: H ? 44 : void 0,
|
|
259
|
+
hasMore: H ? M.searchNextMarker !== void 0 : M.itemsNextMarker !== void 0,
|
|
260
|
+
hasVariableRowHeight: H,
|
|
261
|
+
isFetching: H ? M.isFetchingSearch : M.isFetching,
|
|
262
|
+
isFetchingMore: H ? M.isFetchingSearchMore : M.isFetchingMore,
|
|
263
|
+
isSearchMode: H,
|
|
264
|
+
items: H ? ke : Ee,
|
|
265
|
+
listboxId: T,
|
|
266
|
+
loadMoreError: H ? M.searchLoadMoreError : M.loadMoreError,
|
|
267
|
+
multiSelect: v,
|
|
268
|
+
onFocusExit: () => E.current?.focus(),
|
|
269
|
+
onLoadMore: H ? I.searchLoadMore : xe,
|
|
270
|
+
onRetry: I.retry,
|
|
271
|
+
ref: O,
|
|
272
|
+
selectedValue: Te
|
|
273
|
+
})
|
|
274
|
+
]
|
|
275
|
+
})]
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
export { m as n, g as t };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import "../esm/lib/constants.js";
|
|
2
|
+
import { Fragment as e, memo as t, useCallback as n, useLayoutEffect as r, useRef as i, useState as a } from "react";
|
|
3
|
+
import { Text as o, Tooltip as s } from "@box/blueprint-web";
|
|
4
|
+
import { Ellipsis as c } from "@box/blueprint-web-assets/icons/Fill";
|
|
5
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
6
|
+
import '../styles/taxonomy-ancestor-breadcrumb.css';var f = {
|
|
7
|
+
root: "_root_12bt1_2",
|
|
8
|
+
segment: "_segment_12bt1_15",
|
|
9
|
+
trail: "_trail_12bt1_30",
|
|
10
|
+
ellipsisIcon: "_ellipsisIcon_12bt1_39",
|
|
11
|
+
probe: "_probe_12bt1_48"
|
|
12
|
+
}, p = (e) => {
|
|
13
|
+
let t = window.getComputedStyle(e), n = parseFloat(t.lineHeight);
|
|
14
|
+
return Number.isFinite(n) && n > 0 ? n : (parseFloat(t.fontSize) || 16) * 1.2;
|
|
15
|
+
}, m = (e, t, n) => {
|
|
16
|
+
if (e.textContent = t, e.scrollWidth - e.clientWidth <= n) return !1;
|
|
17
|
+
let r = e.clientWidth, i = 0, a = t.length, o = "";
|
|
18
|
+
for (; i <= a;) {
|
|
19
|
+
let s = Math.floor((i + a) / 2), c = t.slice(0, s).trimEnd() + "…";
|
|
20
|
+
e.textContent = c, e.scrollWidth <= r + n ? (o = c, i = s + 1) : a = s - 1;
|
|
21
|
+
}
|
|
22
|
+
return e.textContent = o || "…", !0;
|
|
23
|
+
}, h = ({ ancestor: e, bold: t, onMount: n }) => /* @__PURE__ */ u(o, {
|
|
24
|
+
as: "span",
|
|
25
|
+
className: f.segment,
|
|
26
|
+
color: "textOnLightSecondary",
|
|
27
|
+
ref: n ? ((t) => n(e, t)) : void 0,
|
|
28
|
+
variant: t ? "captionBold" : "caption",
|
|
29
|
+
children: e.displayName
|
|
30
|
+
}), g = () => /* @__PURE__ */ u(o, {
|
|
31
|
+
"aria-hidden": "true",
|
|
32
|
+
as: "span",
|
|
33
|
+
color: "textOnLightSecondary",
|
|
34
|
+
variant: "caption",
|
|
35
|
+
children: " / "
|
|
36
|
+
}), _ = ({ items: t, lastIndex: n, onSegmentMount: r }) => /* @__PURE__ */ u(l, { children: t.map((t, i) => /* @__PURE__ */ d(e, { children: [i > 0 && /* @__PURE__ */ u(g, {}), /* @__PURE__ */ u(h, {
|
|
37
|
+
ancestor: t,
|
|
38
|
+
bold: i === n,
|
|
39
|
+
onMount: r
|
|
40
|
+
})] }, t.id)) }), v = /* @__PURE__ */ t(function({ ancestors: e }) {
|
|
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
|
+
t ? y.current.set(e.id, {
|
|
43
|
+
node: t,
|
|
44
|
+
fullText: e.displayName
|
|
45
|
+
}) : y.current.delete(e.id);
|
|
46
|
+
}, []);
|
|
47
|
+
r(() => {
|
|
48
|
+
let e = t.current, n = v.current;
|
|
49
|
+
if (!e || !n) return;
|
|
50
|
+
let r = p(n) * 2 + 2, i = () => {
|
|
51
|
+
let e = n.scrollHeight > r;
|
|
52
|
+
x((t) => t === e ? t : e);
|
|
53
|
+
let t = !1;
|
|
54
|
+
y.current.forEach(({ node: e, fullText: n }) => {
|
|
55
|
+
m(e, n, 2) && (t = !0);
|
|
56
|
+
}), C((e) => e === t ? e : t);
|
|
57
|
+
};
|
|
58
|
+
i();
|
|
59
|
+
let a = new ResizeObserver(i);
|
|
60
|
+
return a.observe(e), a.observe(n), () => {
|
|
61
|
+
a.disconnect();
|
|
62
|
+
};
|
|
63
|
+
}, [e, E]);
|
|
64
|
+
let O = e.map((e) => e.displayName).join(" / "), k = /* @__PURE__ */ d(o, {
|
|
65
|
+
as: "span",
|
|
66
|
+
className: f.root,
|
|
67
|
+
"data-testid": "taxonomy-ancestor-breadcrumb",
|
|
68
|
+
ref: t,
|
|
69
|
+
role: E ? "group" : void 0,
|
|
70
|
+
tabIndex: E ? 0 : void 0,
|
|
71
|
+
children: [/* @__PURE__ */ u(o, {
|
|
72
|
+
as: "span",
|
|
73
|
+
className: f.trail,
|
|
74
|
+
color: "textOnLightSecondary",
|
|
75
|
+
variant: "caption",
|
|
76
|
+
children: T ? /* @__PURE__ */ d(l, { children: [
|
|
77
|
+
/* @__PURE__ */ u(h, {
|
|
78
|
+
ancestor: e[0],
|
|
79
|
+
onMount: D
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ u(g, {}),
|
|
82
|
+
/* @__PURE__ */ u(c, {
|
|
83
|
+
"aria-hidden": !0,
|
|
84
|
+
className: f.ellipsisIcon,
|
|
85
|
+
color: "currentColor"
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ u(g, {}),
|
|
88
|
+
/* @__PURE__ */ u(h, {
|
|
89
|
+
ancestor: e[w],
|
|
90
|
+
bold: !0,
|
|
91
|
+
onMount: D
|
|
92
|
+
})
|
|
93
|
+
] }) : /* @__PURE__ */ u(_, {
|
|
94
|
+
items: e,
|
|
95
|
+
lastIndex: w,
|
|
96
|
+
onSegmentMount: D
|
|
97
|
+
})
|
|
98
|
+
}), /* @__PURE__ */ u(o, {
|
|
99
|
+
"aria-hidden": "true",
|
|
100
|
+
as: "span",
|
|
101
|
+
className: f.probe,
|
|
102
|
+
ref: v,
|
|
103
|
+
variant: "caption",
|
|
104
|
+
children: /* @__PURE__ */ u(_, {
|
|
105
|
+
items: e,
|
|
106
|
+
lastIndex: w
|
|
107
|
+
})
|
|
108
|
+
})]
|
|
109
|
+
});
|
|
110
|
+
return E ? /* @__PURE__ */ u(s, {
|
|
111
|
+
content: O,
|
|
112
|
+
children: k
|
|
113
|
+
}) : k;
|
|
114
|
+
});
|
|
115
|
+
export { v as t };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import "../esm/lib/constants.js";
|
|
2
|
+
import { t as e } from "./empty-state.js";
|
|
3
|
+
import { t } from "./error-state.js";
|
|
4
|
+
import { t as n } from "./loading-state.js";
|
|
5
|
+
import { t as r } from "./taxonomy-menu-item.js";
|
|
6
|
+
import { t as i } from "./load-more-error-row.js";
|
|
7
|
+
import { t as a } from "./load-more-loading-row.js";
|
|
8
|
+
import { forwardRef as o, memo as s, useCallback as c, useEffect as l, useImperativeHandle as u, useLayoutEffect as d, useRef as f } from "react";
|
|
9
|
+
import { Radio as p } from "@box/blueprint-web";
|
|
10
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
11
|
+
import { Composite as g, CompositeProvider as _ } from "@ariakit/react";
|
|
12
|
+
import { useVirtualizer as v } from "@tanstack/react-virtual";
|
|
13
|
+
import '../styles/taxonomy-items-list.css';var y = {
|
|
14
|
+
scrollContainer: "_scrollContainer_lky3p_1",
|
|
15
|
+
virtualContent: "_virtualContent_lky3p_11",
|
|
16
|
+
virtualRow: "_virtualRow_lky3p_23"
|
|
17
|
+
}, b = /* @__PURE__ */ s(function({ children: e, selectedValue: t, onValueChange: n }) {
|
|
18
|
+
let r = f(null), i = c((e) => {
|
|
19
|
+
r.current = e.key;
|
|
20
|
+
}, []), a = c((e) => {
|
|
21
|
+
let t = r.current === "ArrowUp" || r.current === "ArrowDown";
|
|
22
|
+
r.current = null, n(e, !t);
|
|
23
|
+
}, [n]);
|
|
24
|
+
return /* @__PURE__ */ m(p.Group, {
|
|
25
|
+
name: "taxonomy-picker",
|
|
26
|
+
onKeyDown: i,
|
|
27
|
+
onValueChange: a,
|
|
28
|
+
value: t,
|
|
29
|
+
children: e
|
|
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) {
|
|
32
|
+
let I = f(null);
|
|
33
|
+
u(F, () => ({
|
|
34
|
+
getScrollTop: () => I.current?.scrollTop ?? 0,
|
|
35
|
+
scrollTo: (e) => {
|
|
36
|
+
I.current && (I.current.scrollTop = e);
|
|
37
|
+
}
|
|
38
|
+
}), []);
|
|
39
|
+
let L = N, R = o.length + +!!L, z = c((e) => e >= o.length ? 112 : C, [C, o.length]), B = c((e) => e >= o.length ? S : o[e].id, [o]), V = c((e, t) => {
|
|
40
|
+
let n = o.find((t) => t.id === e);
|
|
41
|
+
n?.selectable && n.onSelect(e, t);
|
|
42
|
+
}, [o]), H = v({
|
|
43
|
+
count: R,
|
|
44
|
+
getScrollElement: () => I.current,
|
|
45
|
+
estimateSize: z,
|
|
46
|
+
gap: 1,
|
|
47
|
+
overscan: 20,
|
|
48
|
+
getItemKey: B,
|
|
49
|
+
measureElement: x
|
|
50
|
+
}), U = f(o.length), W = f(null);
|
|
51
|
+
o.length !== U.current && (o.length > U.current && I.current && (W.current = I.current.scrollTop), U.current = o.length), d(() => {
|
|
52
|
+
let e = W.current;
|
|
53
|
+
if (W.current = null, e === null) return;
|
|
54
|
+
let t = I.current;
|
|
55
|
+
t && t.scrollTop !== e && (t.scrollTop = e);
|
|
56
|
+
});
|
|
57
|
+
let G = f(P);
|
|
58
|
+
G.current = P;
|
|
59
|
+
let K = f(!1);
|
|
60
|
+
K.current = M && !N && O === null && !!P;
|
|
61
|
+
let q = E && o.length === 0, J = !E && D !== null, Y = !E && D === null && o.length === 0;
|
|
62
|
+
if (l(() => {
|
|
63
|
+
let e = I.current;
|
|
64
|
+
if (!e) return;
|
|
65
|
+
let t = 0, n = () => {
|
|
66
|
+
K.current && e.scrollHeight - e.scrollTop - e.clientHeight <= 200 && G.current?.();
|
|
67
|
+
}, r = () => {
|
|
68
|
+
cancelAnimationFrame(t), t = requestAnimationFrame(n);
|
|
69
|
+
};
|
|
70
|
+
return e.addEventListener("scroll", r, { passive: !0 }), t = requestAnimationFrame(n), () => {
|
|
71
|
+
e.removeEventListener("scroll", r), cancelAnimationFrame(t);
|
|
72
|
+
};
|
|
73
|
+
}, [o.length]), q) return /* @__PURE__ */ m(n, {});
|
|
74
|
+
if (J) return /* @__PURE__ */ m(t, { onRetry: j });
|
|
75
|
+
if (Y) return /* @__PURE__ */ m(e, { isSearchMode: T });
|
|
76
|
+
let X = /* @__PURE__ */ m(_, { children: /* @__PURE__ */ m(g, { children: /* @__PURE__ */ m("div", {
|
|
77
|
+
className: y.virtualContent,
|
|
78
|
+
style: { height: H.getTotalSize() },
|
|
79
|
+
children: H.getVirtualItems().map((e) => {
|
|
80
|
+
if (e.index >= o.length) return /* @__PURE__ */ m("div", {
|
|
81
|
+
ref: H.measureElement,
|
|
82
|
+
className: y.virtualRow,
|
|
83
|
+
"data-index": e.index,
|
|
84
|
+
style: { transform: `translateY(${e.start}px)` },
|
|
85
|
+
children: /* @__PURE__ */ m(a, {})
|
|
86
|
+
}, e.key);
|
|
87
|
+
let t = o[e.index];
|
|
88
|
+
return /* @__PURE__ */ m("div", {
|
|
89
|
+
ref: w ? H.measureElement : void 0,
|
|
90
|
+
className: y.virtualRow,
|
|
91
|
+
"data-index": e.index,
|
|
92
|
+
style: { transform: `translateY(${e.start}px)` },
|
|
93
|
+
children: /* @__PURE__ */ m(r, {
|
|
94
|
+
...t,
|
|
95
|
+
onFocusExit: e.index === 0 ? A : void 0,
|
|
96
|
+
isSearchMode: T
|
|
97
|
+
})
|
|
98
|
+
}, e.key);
|
|
99
|
+
})
|
|
100
|
+
}) }) });
|
|
101
|
+
return /* @__PURE__ */ h("div", {
|
|
102
|
+
ref: I,
|
|
103
|
+
"aria-multiselectable": s || void 0,
|
|
104
|
+
className: y.scrollContainer,
|
|
105
|
+
id: k,
|
|
106
|
+
role: "listbox",
|
|
107
|
+
children: [s ? X : /* @__PURE__ */ m(b, {
|
|
108
|
+
onValueChange: V,
|
|
109
|
+
selectedValue: p,
|
|
110
|
+
children: X
|
|
111
|
+
}), O !== null && !N && /* @__PURE__ */ m(i, { onRetry: j })]
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
export { C as t };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { messages as e } from "../esm/lib/components/taxonomy-level-filter/messages.js";
|
|
2
|
+
import { DropdownMenu as t, TextButton as n } from "@box/blueprint-web";
|
|
3
|
+
import { useIntl as r } from "react-intl";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
import { Checkmark as o, ChevronDown as s } from "@box/blueprint-web-assets/icons/Medium";
|
|
6
|
+
import '../styles/taxonomy-level-filter.css';var c = {
|
|
7
|
+
container: "_container_mbgfz_2",
|
|
8
|
+
popoverContent: "_popoverContent_mbgfz_10",
|
|
9
|
+
itemStartElement: "_itemStartElement_mbgfz_16",
|
|
10
|
+
levelFilterButton: "_levelFilterButton_mbgfz_26"
|
|
11
|
+
};
|
|
12
|
+
function l({ availableLevels: l, levelFilter: u, onLevelFilterChange: d }) {
|
|
13
|
+
let { formatMessage: f } = r(), p = f(e.allOption), m = u === null ? p : l.find((e) => e.level === u)?.displayName ?? p;
|
|
14
|
+
return /* @__PURE__ */ i("div", {
|
|
15
|
+
className: c.container,
|
|
16
|
+
children: /* @__PURE__ */ a(t.Root, {
|
|
17
|
+
modal: !1,
|
|
18
|
+
children: [/* @__PURE__ */ i(t.Trigger, { children: /* @__PURE__ */ i(n, {
|
|
19
|
+
className: c.levelFilterButton,
|
|
20
|
+
icon: s,
|
|
21
|
+
variant: "bodyDefault",
|
|
22
|
+
children: m
|
|
23
|
+
}) }), /* @__PURE__ */ a(t.Content, {
|
|
24
|
+
className: c.popoverContent,
|
|
25
|
+
align: "start",
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ a(t.Item, {
|
|
28
|
+
onClick: () => d(null),
|
|
29
|
+
children: [/* @__PURE__ */ i(t.Item.StartElement, {
|
|
30
|
+
className: c.itemStartElement,
|
|
31
|
+
icon: u === null ? o : void 0
|
|
32
|
+
}), /* @__PURE__ */ i(t.Item.MainContent, { label: p })]
|
|
33
|
+
}),
|
|
34
|
+
/* @__PURE__ */ i(t.Separator, {}),
|
|
35
|
+
l.map((e) => /* @__PURE__ */ a(t.Item, {
|
|
36
|
+
onClick: () => d(e.level),
|
|
37
|
+
children: [/* @__PURE__ */ i(t.Item.StartElement, {
|
|
38
|
+
className: c.itemStartElement,
|
|
39
|
+
icon: u === e.level ? o : void 0
|
|
40
|
+
}), /* @__PURE__ */ i(t.Item.MainContent, { label: e.displayName })]
|
|
41
|
+
}, e.level))
|
|
42
|
+
]
|
|
43
|
+
})]
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export { l as t };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { t as e } from "./taxonomy-ancestor-breadcrumb.js";
|
|
2
|
+
import { messages as t } from "../esm/lib/components/taxonomy-menu-item/messages.js";
|
|
3
|
+
import { useTaxonomyMenuItemKeyboard as n } from "../esm/lib/components/taxonomy-menu-item/use-taxonomy-menu-item-keyboard.js";
|
|
4
|
+
import { memo as r, useCallback as i, useRef as a } from "react";
|
|
5
|
+
import { Checkbox as o, EllipsizableText as s, IconButton as c, Radio as l } from "@box/blueprint-web";
|
|
6
|
+
import u from "clsx";
|
|
7
|
+
import { useIntl as d } from "react-intl";
|
|
8
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
9
|
+
import { CompositeItem as m } from "@ariakit/react";
|
|
10
|
+
import { ChevronRight as h } from "@box/blueprint-web-assets/icons/Medium";
|
|
11
|
+
import '../styles/taxonomy-menu-item.css';var g = {
|
|
12
|
+
row: "_row_1y44c_2",
|
|
13
|
+
rowWithAncestors: "_rowWithAncestors_1y44c_19",
|
|
14
|
+
nonSelectable: "_nonSelectable_1y44c_24",
|
|
15
|
+
selectionControl: "_selectionControl_1y44c_31",
|
|
16
|
+
content: "_content_1y44c_41",
|
|
17
|
+
drillDown: "_drillDown_1y44c_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 }) {
|
|
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
|
+
id: r,
|
|
21
|
+
multiSelect: b,
|
|
22
|
+
onSelect: w,
|
|
23
|
+
onFocusExit: E,
|
|
24
|
+
rowRef: k,
|
|
25
|
+
selectionControlRef: A,
|
|
26
|
+
drillDownRef: j
|
|
27
|
+
}), L = i(() => {
|
|
28
|
+
y ? w(r) : S && T?.(r);
|
|
29
|
+
}, [
|
|
30
|
+
y,
|
|
31
|
+
S,
|
|
32
|
+
w,
|
|
33
|
+
T,
|
|
34
|
+
r
|
|
35
|
+
]), R = i((e) => {
|
|
36
|
+
e.stopPropagation(), T?.(r);
|
|
37
|
+
}, [T, r]);
|
|
38
|
+
return /* @__PURE__ */ p(m, {
|
|
39
|
+
ref: k,
|
|
40
|
+
render: /* @__PURE__ */ f("div", {
|
|
41
|
+
role: "option",
|
|
42
|
+
"aria-selected": x
|
|
43
|
+
}),
|
|
44
|
+
className: u(g.row, {
|
|
45
|
+
[g.rowWithAncestors]: O,
|
|
46
|
+
[g.nonSelectable]: !y
|
|
47
|
+
}),
|
|
48
|
+
"data-testid": `taxonomy-menu-item-${r}`,
|
|
49
|
+
onClick: L,
|
|
50
|
+
onKeyDown: N,
|
|
51
|
+
onKeyDownCapture: P,
|
|
52
|
+
children: [
|
|
53
|
+
y && b && /* @__PURE__ */ f(o.Item, {
|
|
54
|
+
ref: A,
|
|
55
|
+
"aria-label": _,
|
|
56
|
+
checked: x,
|
|
57
|
+
className: g.selectionControl,
|
|
58
|
+
label: "",
|
|
59
|
+
tabIndex: -1,
|
|
60
|
+
onClick: (e) => e.stopPropagation(),
|
|
61
|
+
onCheckedChange: () => w(r),
|
|
62
|
+
onKeyDown: F,
|
|
63
|
+
value: r
|
|
64
|
+
}),
|
|
65
|
+
y && !b && /* @__PURE__ */ f(l.Item, {
|
|
66
|
+
ref: A,
|
|
67
|
+
"aria-label": _,
|
|
68
|
+
className: g.selectionControl,
|
|
69
|
+
label: "",
|
|
70
|
+
tabIndex: -1,
|
|
71
|
+
onClick: (e) => e.stopPropagation(),
|
|
72
|
+
onFocus: M,
|
|
73
|
+
onKeyDown: F,
|
|
74
|
+
value: r
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ p("div", {
|
|
77
|
+
className: g.content,
|
|
78
|
+
children: [/* @__PURE__ */ f(s, {
|
|
79
|
+
as: "span",
|
|
80
|
+
lineClamp: 1,
|
|
81
|
+
variant: O ? "bodyDefaultBold" : "bodyDefault",
|
|
82
|
+
children: _
|
|
83
|
+
}), O && /* @__PURE__ */ f(e, { ancestors: C })]
|
|
84
|
+
}),
|
|
85
|
+
S && /* @__PURE__ */ f(c, {
|
|
86
|
+
ref: j,
|
|
87
|
+
"aria-label": D(t.drillDownAriaLabel, { name: _ }),
|
|
88
|
+
className: g.drillDown,
|
|
89
|
+
"data-testid": `taxonomy-menu-item-drill-down-${r}`,
|
|
90
|
+
icon: h,
|
|
91
|
+
tabIndex: -1,
|
|
92
|
+
onClick: R,
|
|
93
|
+
onKeyDown: I,
|
|
94
|
+
size: "x-small"
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
export { _ as t };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineMessages as e } from "react-intl";
|
|
2
|
+
var t = e({
|
|
3
|
+
placeholder: {
|
|
4
|
+
id: "groupSharedFeatures.metadataTaxonomyPicker.shell.placeholder",
|
|
5
|
+
defaultMessage: "Select an Option"
|
|
6
|
+
},
|
|
7
|
+
breadcrumbAriaLabel: {
|
|
8
|
+
id: "groupSharedFeatures.metadataTaxonomyPicker.shell.breadcrumbAriaLabel",
|
|
9
|
+
defaultMessage: "Taxonomy navigation"
|
|
10
|
+
},
|
|
11
|
+
breadcrumbRootLabel: {
|
|
12
|
+
id: "groupSharedFeatures.metadataTaxonomyPicker.shell.breadcrumbRootLabel",
|
|
13
|
+
defaultMessage: "All"
|
|
14
|
+
},
|
|
15
|
+
breadcrumbTruncatedLinksLabel: {
|
|
16
|
+
id: "groupSharedFeatures.metadataTaxonomyPicker.shell.breadcrumbTruncatedLinksLabel",
|
|
17
|
+
defaultMessage: "Show hidden parent levels"
|
|
18
|
+
},
|
|
19
|
+
clearAriaLabel: {
|
|
20
|
+
id: "groupSharedFeatures.metadataTaxonomyPicker.shell.clearAriaLabel",
|
|
21
|
+
defaultMessage: "Clear selection"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
export { t as messages };
|