@box/user-selector 1.74.33 → 1.74.35
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/dist/chunks/buildOptionsWithOverlay.js +21 -22
- package/dist/chunks/user-selector-headless.module.js +13 -14
- package/dist/chunks/user-selector-list-item.js +84 -0
- package/dist/chunks/user-selector.js +89 -0
- package/dist/esm/index.js +4 -9
- package/dist/esm/lib/messages.js +42 -44
- package/dist/esm/lib/shared.js +6 -8
- package/dist/esm/lib/user-selector-container.js +29 -42
- package/dist/esm/lib/user-selector-headless/components/user-avatar.js +25 -31
- package/dist/esm/lib/user-selector-headless/components/user-selector-content.js +27 -50
- package/dist/esm/lib/user-selector-headless/components/user-selector-default-empty.js +34 -42
- package/dist/esm/lib/user-selector-headless/components/user-selector-default-error.js +13 -19
- package/dist/esm/lib/user-selector-headless/components/user-selector-skeleton.js +19 -25
- package/dist/esm/lib/user-selector-headless/hooks/use-avatars.js +13 -21
- package/dist/esm/lib/user-selector-headless/hooks/use-keyboard-navigation.js +25 -27
- package/dist/esm/lib/user-selector-headless/hooks/use-select-options.js +24 -27
- package/dist/esm/lib/user-selector-headless/user-selector-context.js +6 -10
- package/dist/esm/lib/user-selector-headless/user-selector-headless.js +171 -167
- package/dist/esm/lib/user-selector-list-item.js +2 -113
- package/dist/esm/lib/user-selector.js +2 -108
- package/dist/esm/lib/utils/VariantsAggregator.js +26 -45
- package/dist/esm/lib/utils/buildOptionsWithOverlay.js +2 -4
- package/dist/esm/lib/utils/defaultRenderCustomOption.js +10 -11
- package/dist/esm/lib/utils/getInitials.js +4 -6
- package/dist/esm/lib/utils/isUserContactType.js +3 -5
- package/dist/styles/user-selector-headless.css +1 -1
- package/dist/styles/user-selector-list-item.css +1 -1
- package/dist/styles/user-selector.css +1 -1
- package/package.json +8 -8
|
@@ -1,168 +1,172 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import { jsx as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
1
|
+
import { UserSelectorContext as e } from "./user-selector-context.js";
|
|
2
|
+
import { t } from "../../../chunks/user-selector-headless.module.js";
|
|
3
|
+
import { UserSelectorContent as n } from "./components/user-selector-content.js";
|
|
4
|
+
import { useAvatars as r } from "./hooks/use-avatars.js";
|
|
5
|
+
import { useKeyboardNavigation as i } from "./hooks/use-keyboard-navigation.js";
|
|
6
|
+
import { useSelectOptions as a } from "./hooks/use-select-options.js";
|
|
7
|
+
import { forwardRef as o, useCallback as s, useEffect as c, useId as l, useImperativeHandle as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
8
|
+
import m from "clsx";
|
|
9
|
+
import { Popover as h } from "@box/blueprint-web";
|
|
10
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
11
|
+
var v = /* @__PURE__ */ o(({ fetchUsers: o, fetchAvatarUrls: v, open: y, value: b, rootElement: x, onSelectedUserChange: S, inputElementRef: C, focusOnOpen: w = !1, renderError: T, renderEmpty: E, loadingAriaLabel: D, ariaRoleDescription: O, nativeFocusEnabled: k = !0, allowEmptyQuery: A = !1, onInvite: j, popoverContentContainerProps: M }, N) => {
|
|
12
|
+
let [P, F] = p(null), { options: I, isEmpty: L, isLoading: R, error: z } = a({
|
|
13
|
+
fetcher: o,
|
|
14
|
+
value: b,
|
|
15
|
+
allowEmptyQuery: A
|
|
16
|
+
}), { avatars: B } = r({
|
|
17
|
+
fetchAvatarUrls: v,
|
|
18
|
+
options: I
|
|
19
|
+
}), V = l(), H = f(/* @__PURE__ */ new Map()), U = d(() => `listbox-${V}`, [V]), W = s((e) => `${V}-option-${e.id}`, [V]), G = s((e) => {
|
|
20
|
+
let t = H.current.get(e);
|
|
21
|
+
if (t) {
|
|
22
|
+
if (F(e), k) {
|
|
23
|
+
t.focus();
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
t.scrollIntoView({
|
|
27
|
+
behavior: "smooth",
|
|
28
|
+
block: "nearest",
|
|
29
|
+
inline: "nearest"
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}, [k]), K = d(() => I.findIndex((e) => W(e) === P), [
|
|
33
|
+
P,
|
|
34
|
+
W,
|
|
35
|
+
I
|
|
36
|
+
]), q = s(() => {
|
|
37
|
+
C.current?.focus(), F(null);
|
|
38
|
+
}, [C]), J = s(() => {
|
|
39
|
+
if (P) {
|
|
40
|
+
let e = I.find((e) => W(e) === P);
|
|
41
|
+
e && S(e);
|
|
42
|
+
}
|
|
43
|
+
}, [
|
|
44
|
+
S,
|
|
45
|
+
P,
|
|
46
|
+
W,
|
|
47
|
+
I
|
|
48
|
+
]), Y = s(() => {
|
|
49
|
+
if (I.length !== 0) {
|
|
50
|
+
if (K < I.length - 1) {
|
|
51
|
+
G(W(I[K + 1]));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (k) {
|
|
55
|
+
q();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
G(W(I[0]));
|
|
59
|
+
}
|
|
60
|
+
}, [
|
|
61
|
+
K,
|
|
62
|
+
G,
|
|
63
|
+
W,
|
|
64
|
+
I,
|
|
65
|
+
k,
|
|
66
|
+
q
|
|
67
|
+
]), X = s(() => {
|
|
68
|
+
if (I.length !== 0) {
|
|
69
|
+
if (K > 0) {
|
|
70
|
+
G(W(I[K - 1]));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (k) {
|
|
74
|
+
q();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
G(W(I[I.length - 1]));
|
|
78
|
+
}
|
|
79
|
+
}, [
|
|
80
|
+
K,
|
|
81
|
+
G,
|
|
82
|
+
W,
|
|
83
|
+
I,
|
|
84
|
+
k,
|
|
85
|
+
q
|
|
86
|
+
]), Z = i({
|
|
87
|
+
isLoading: R,
|
|
88
|
+
error: z,
|
|
89
|
+
isEmpty: L,
|
|
90
|
+
open: y,
|
|
91
|
+
selectNext: Y,
|
|
92
|
+
selectPrevious: X,
|
|
93
|
+
selectItem: J
|
|
94
|
+
}), Q = s((e, t) => {
|
|
95
|
+
G(t), S(e);
|
|
96
|
+
}, [G, S]);
|
|
97
|
+
u(N, () => ({
|
|
98
|
+
focusFirstOption: () => {
|
|
99
|
+
I.length > 0 && G(W(I[0]));
|
|
100
|
+
},
|
|
101
|
+
focusLastOption: () => {
|
|
102
|
+
I.length > 0 && G(W(I[I.length - 1]));
|
|
103
|
+
},
|
|
104
|
+
selectNext: Y,
|
|
105
|
+
selectPrevious: X,
|
|
106
|
+
selectItem: J
|
|
107
|
+
}), [
|
|
108
|
+
G,
|
|
109
|
+
W,
|
|
110
|
+
I,
|
|
111
|
+
Y,
|
|
112
|
+
X,
|
|
113
|
+
J
|
|
114
|
+
]), c(() => {
|
|
115
|
+
I.length > 0 && w && G(W(I[0]));
|
|
116
|
+
}, [
|
|
117
|
+
I,
|
|
118
|
+
y,
|
|
119
|
+
W,
|
|
120
|
+
G,
|
|
121
|
+
w
|
|
122
|
+
]);
|
|
123
|
+
let $ = {
|
|
124
|
+
fetchUsers: o,
|
|
125
|
+
fetchAvatarUrls: v,
|
|
126
|
+
onSelectedUserChange: S,
|
|
127
|
+
value: b,
|
|
128
|
+
avatars: B,
|
|
129
|
+
activeId: P,
|
|
130
|
+
setActiveId: F,
|
|
131
|
+
listboxId: U,
|
|
132
|
+
getOptionId: W
|
|
133
|
+
};
|
|
134
|
+
return /* @__PURE__ */ g(e.Provider, {
|
|
135
|
+
value: $,
|
|
136
|
+
children: /* @__PURE__ */ _(h.Root, {
|
|
137
|
+
modal: !1,
|
|
138
|
+
open: y,
|
|
139
|
+
children: [/* @__PURE__ */ g(h.Anchor, { children: x }), /* @__PURE__ */ g(h.ContentContainer, {
|
|
140
|
+
...M,
|
|
141
|
+
align: "start",
|
|
142
|
+
className: m(t.popoverContainer, M?.className),
|
|
143
|
+
onOpenAutoFocus: (e) => {
|
|
144
|
+
e.preventDefault();
|
|
145
|
+
},
|
|
146
|
+
children: /* @__PURE__ */ g(h.MainContent, {
|
|
147
|
+
"aria-activedescendant": P,
|
|
148
|
+
"aria-owns": Array.from(H.current.values()).map((e) => e.id).join(" "),
|
|
149
|
+
"aria-roledescription": O,
|
|
150
|
+
className: t.popoverContent,
|
|
151
|
+
id: U,
|
|
152
|
+
onKeyDown: Z,
|
|
153
|
+
role: "listbox",
|
|
154
|
+
tabIndex: -1,
|
|
155
|
+
children: /* @__PURE__ */ g(n, {
|
|
156
|
+
error: z,
|
|
157
|
+
handleInvite: j,
|
|
158
|
+
handleOptionClick: Q,
|
|
159
|
+
isEmpty: L,
|
|
160
|
+
isLoading: R,
|
|
161
|
+
loadingAriaLabel: D,
|
|
162
|
+
optionRefs: H,
|
|
163
|
+
options: I,
|
|
164
|
+
renderEmpty: E,
|
|
165
|
+
renderError: T
|
|
166
|
+
})
|
|
167
|
+
})
|
|
168
|
+
})]
|
|
169
|
+
})
|
|
170
|
+
});
|
|
165
171
|
});
|
|
166
|
-
export {
|
|
167
|
-
mt as UserSelectorHeadless
|
|
168
|
-
};
|
|
172
|
+
export { v as UserSelectorHeadless };
|
|
@@ -1,113 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import a from "clsx";
|
|
4
|
-
import C, { forwardRef as d } from "react";
|
|
5
|
-
import { useIntl as v } from "react-intl";
|
|
6
|
-
import S from "./messages.js";
|
|
7
|
-
import { isUserContactType as O } from "./utils/isUserContactType.js";
|
|
8
|
-
import { jsx as r, jsxs as _ } from "react/jsx-runtime";
|
|
9
|
-
import '../../styles/user-selector-list-item.css';const U = "_userSelectorListItem_1m2q6_1", q = "_listItemAvatar_1m2q6_18", A = "_userInfo_1m2q6_21", g = "_title_1m2q6_28", E = "_userName_1m2q6_34", T = "_userEmail_1m2q6_35", k = "_userSelectorListItemInviteIcon_1m2q6_43", o = {
|
|
10
|
-
userSelectorListItem: U,
|
|
11
|
-
listItemAvatar: q,
|
|
12
|
-
userInfo: A,
|
|
13
|
-
title: g,
|
|
14
|
-
userName: E,
|
|
15
|
-
userEmail: T,
|
|
16
|
-
userSelectorListItemInviteIcon: k
|
|
17
|
-
}, y = /* @__PURE__ */ d(({
|
|
18
|
-
renderAvatar: c,
|
|
19
|
-
title: t,
|
|
20
|
-
subtitle: m,
|
|
21
|
-
onClick: s,
|
|
22
|
-
className: e,
|
|
23
|
-
id: n,
|
|
24
|
-
selected: u,
|
|
25
|
-
isCollaborator: i = !0,
|
|
26
|
-
...l
|
|
27
|
-
}, I) => {
|
|
28
|
-
const h = /* @__PURE__ */ C.cloneElement(c(), {
|
|
29
|
-
className: a(o.listItemAvatar)
|
|
30
|
-
}), {
|
|
31
|
-
formatMessage: N
|
|
32
|
-
} = v(), f = /* @__PURE__ */ _("div", {
|
|
33
|
-
ref: I,
|
|
34
|
-
"aria-selected": u,
|
|
35
|
-
className: a(o.userSelectorListItem, e),
|
|
36
|
-
id: n,
|
|
37
|
-
...s ? {
|
|
38
|
-
onClick: s
|
|
39
|
-
} : {},
|
|
40
|
-
...l,
|
|
41
|
-
children: [h, /* @__PURE__ */ _("div", {
|
|
42
|
-
className: a(o.userInfo),
|
|
43
|
-
children: [/* @__PURE__ */ r("div", {
|
|
44
|
-
className: a(o.title),
|
|
45
|
-
children: /* @__PURE__ */ r(p, {
|
|
46
|
-
as: "span",
|
|
47
|
-
className: a(o.userName),
|
|
48
|
-
variant: "bodyDefaultSemibold",
|
|
49
|
-
children: t
|
|
50
|
-
})
|
|
51
|
-
}), /* @__PURE__ */ r(p, {
|
|
52
|
-
as: "span",
|
|
53
|
-
className: a(o.userEmail),
|
|
54
|
-
color: "textOnLightSecondary",
|
|
55
|
-
variant: "caption",
|
|
56
|
-
children: m
|
|
57
|
-
})]
|
|
58
|
-
}), !i && /* @__PURE__ */ r(b, {
|
|
59
|
-
className: o.userSelectorListItemInviteIcon
|
|
60
|
-
})]
|
|
61
|
-
});
|
|
62
|
-
return i ? f : /* @__PURE__ */ r(x, {
|
|
63
|
-
content: N(S.inviteCollaboratorsTooltip),
|
|
64
|
-
side: "right",
|
|
65
|
-
children: f
|
|
66
|
-
});
|
|
67
|
-
}), j = /* @__PURE__ */ d(({
|
|
68
|
-
renderAvatar: c,
|
|
69
|
-
userContact: t,
|
|
70
|
-
onClick: m,
|
|
71
|
-
id: s,
|
|
72
|
-
...e
|
|
73
|
-
}, n) => {
|
|
74
|
-
const i = v().formatMessage(S.userName, {
|
|
75
|
-
name: t.name,
|
|
76
|
-
isCurrentUser: !!t.isCurrentUser
|
|
77
|
-
});
|
|
78
|
-
return /* @__PURE__ */ r(y, {
|
|
79
|
-
ref: n,
|
|
80
|
-
id: s,
|
|
81
|
-
onClick: () => {
|
|
82
|
-
m?.(t, s);
|
|
83
|
-
},
|
|
84
|
-
renderAvatar: () => c(t),
|
|
85
|
-
subtitle: t.email,
|
|
86
|
-
title: i,
|
|
87
|
-
...e
|
|
88
|
-
});
|
|
89
|
-
}), G = /* @__PURE__ */ d(function(t, m) {
|
|
90
|
-
const {
|
|
91
|
-
className: s,
|
|
92
|
-
userContact: e,
|
|
93
|
-
renderAvatar: n,
|
|
94
|
-
renderCustomOption: u,
|
|
95
|
-
...i
|
|
96
|
-
} = t, l = O(e), I = l ? !0 : e.hideOnClick ?? !0;
|
|
97
|
-
return /* @__PURE__ */ r(L.Option, {
|
|
98
|
-
ref: m,
|
|
99
|
-
className: s,
|
|
100
|
-
hideOnClick: I,
|
|
101
|
-
value: e.value,
|
|
102
|
-
...i,
|
|
103
|
-
children: l ? /* @__PURE__ */ r(j, {
|
|
104
|
-
renderAvatar: n,
|
|
105
|
-
userContact: e
|
|
106
|
-
}) : u(e, () => n(e))
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
export {
|
|
110
|
-
G as UserSelectorComboboxOption,
|
|
111
|
-
j as UserSelectorListItem,
|
|
112
|
-
y as UserSelectorListItemInfo
|
|
113
|
-
};
|
|
1
|
+
import { n as e, r as t, t as n } from "../../chunks/user-selector-list-item.js";
|
|
2
|
+
export { n as UserSelectorComboboxOption, e as UserSelectorListItem, t as UserSelectorListItemInfo };
|
|
@@ -1,108 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { useIntl as D } from "react-intl";
|
|
4
|
-
import { Combobox as p, Text as M, Divider as N, Avatar as h, IconBadge as T } from "@box/blueprint-web";
|
|
5
|
-
import { ComboboxWithApi as W } from "@box/combobox-with-api";
|
|
6
|
-
import u from "./messages.js";
|
|
7
|
-
import { b as w, O as b, a as y } from "../../chunks/buildOptionsWithOverlay.js";
|
|
8
|
-
import { UserSelectorComboboxOption as Y } from "./user-selector-list-item.js";
|
|
9
|
-
import { defaultRenderCustomOption as j } from "./utils/defaultRenderCustomOption.js";
|
|
10
|
-
import { getInitials as k } from "./utils/getInitials.js";
|
|
11
|
-
import { isUserContactType as O } from "./utils/isUserContactType.js";
|
|
12
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
13
|
-
import '../../styles/user-selector.css';const B = "_overlayHeader_zdn0a_1", P = "_overlaySeparatorOption_zdn0a_8", q = "_textArea_zdn0a_15", m = {
|
|
14
|
-
overlayHeader: B,
|
|
15
|
-
overlaySeparatorOption: P,
|
|
16
|
-
textArea: q
|
|
17
|
-
}, se = (x) => {
|
|
18
|
-
const {
|
|
19
|
-
fetchedAvatarUrls: A,
|
|
20
|
-
fetchUsers: v,
|
|
21
|
-
onSelectedUsersChange: g,
|
|
22
|
-
selectedUsers: i,
|
|
23
|
-
variant: _,
|
|
24
|
-
className: C,
|
|
25
|
-
defaultOptions: S,
|
|
26
|
-
overlayDividerIndex: a,
|
|
27
|
-
overlayTitle: c,
|
|
28
|
-
renderCustomOption: U = j,
|
|
29
|
-
...V
|
|
30
|
-
} = x, d = D(), f = (e) => {
|
|
31
|
-
if (!(e.value === b || e.value === y)) {
|
|
32
|
-
if (O(e)) {
|
|
33
|
-
const {
|
|
34
|
-
name: t,
|
|
35
|
-
isExternalUser: l,
|
|
36
|
-
id: n
|
|
37
|
-
} = e, s = /* @__PURE__ */ r(h, {
|
|
38
|
-
alt: d.formatMessage(u.userAvatar),
|
|
39
|
-
colorIndex: n,
|
|
40
|
-
src: A[n],
|
|
41
|
-
text: k(t)
|
|
42
|
-
});
|
|
43
|
-
return l ? /* @__PURE__ */ r(T, {
|
|
44
|
-
offset: {
|
|
45
|
-
right: -4,
|
|
46
|
-
bottom: -2
|
|
47
|
-
},
|
|
48
|
-
size: "medium",
|
|
49
|
-
variant: "collaborator-external",
|
|
50
|
-
children: s
|
|
51
|
-
}) : s;
|
|
52
|
-
}
|
|
53
|
-
return /* @__PURE__ */ r(h, {
|
|
54
|
-
...e.avatar
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}, E = (e) => {
|
|
58
|
-
if (!O(e))
|
|
59
|
-
return e.chipVariant;
|
|
60
|
-
}, R = z(async (e) => {
|
|
61
|
-
const t = await v(e);
|
|
62
|
-
if (!c || a === void 0 || a === null || a < 0)
|
|
63
|
-
return t;
|
|
64
|
-
const l = new Set(i.map((o) => o.value)), n = t.filter((o) => !l.has(o.value)), s = t.slice(0, a + 1).filter((o) => !l.has(o.value)).length, L = s > 0 ? s - 1 : -1;
|
|
65
|
-
return w(n, c, L);
|
|
66
|
-
}, [v, c, a, i]), I = (e) => e.value === b && "label" in e ? /* @__PURE__ */ r(p.Option, {
|
|
67
|
-
className: m.overlayHeader,
|
|
68
|
-
disabled: !0,
|
|
69
|
-
value: e.value,
|
|
70
|
-
children: /* @__PURE__ */ r(M, {
|
|
71
|
-
as: "span",
|
|
72
|
-
variant: "bodySmallSemibold",
|
|
73
|
-
color: "textOnLightSecondary",
|
|
74
|
-
children: e.label
|
|
75
|
-
})
|
|
76
|
-
}) : e.value === y ? /* @__PURE__ */ r(p.Option, {
|
|
77
|
-
className: m.overlaySeparatorOption,
|
|
78
|
-
disabled: !0,
|
|
79
|
-
value: e.value,
|
|
80
|
-
children: /* @__PURE__ */ r(N, {
|
|
81
|
-
"aria-hidden": !0
|
|
82
|
-
})
|
|
83
|
-
}) : /* @__PURE__ */ r(Y, {
|
|
84
|
-
renderAvatar: f,
|
|
85
|
-
renderCustomOption: U,
|
|
86
|
-
userContact: e
|
|
87
|
-
});
|
|
88
|
-
return /* @__PURE__ */ r(W, {
|
|
89
|
-
as: "input",
|
|
90
|
-
className: H(C, _ === "textarea" && m.textArea),
|
|
91
|
-
defaultOptions: S,
|
|
92
|
-
displayAvatar: f,
|
|
93
|
-
displayChipVariant: E,
|
|
94
|
-
displayValue: (e) => e.name,
|
|
95
|
-
fetcher: R,
|
|
96
|
-
freeInput: !1,
|
|
97
|
-
loadingAriaLabel: d.formatMessage(u.loading),
|
|
98
|
-
multiselect: !0,
|
|
99
|
-
noResultMessage: d.formatMessage(u.noResults),
|
|
100
|
-
onValueChange: g,
|
|
101
|
-
renderOption: I,
|
|
102
|
-
value: i,
|
|
103
|
-
...V
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
export {
|
|
107
|
-
se as default
|
|
108
|
-
};
|
|
1
|
+
import { t as e } from "../../chunks/user-selector.js";
|
|
2
|
+
export { e as default };
|
|
@@ -1,46 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { jsx as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
color: "textOnLightSecondary",
|
|
26
|
-
style: {
|
|
27
|
-
textTransform: "uppercase"
|
|
28
|
-
},
|
|
29
|
-
variant: "bodyDefaultBold",
|
|
30
|
-
children: a
|
|
31
|
-
}), /* @__PURE__ */ r("div", {
|
|
32
|
-
children: i ? /* @__PURE__ */ r(i, {
|
|
33
|
-
...t,
|
|
34
|
-
...e
|
|
35
|
-
}) : /* @__PURE__ */ r(s, {
|
|
36
|
-
...t,
|
|
37
|
-
...e
|
|
38
|
-
})
|
|
39
|
-
})]
|
|
40
|
-
}, a))
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
g.displayName = "variants";
|
|
44
|
-
export {
|
|
45
|
-
g as VariantsAggregator
|
|
1
|
+
import { Fragment as e } from "react";
|
|
2
|
+
import { Text as t } from "@box/blueprint-web";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
var i = ({ defaultProps: i, DefaultComponentTemplate: a, variantsMap: o, containerStyle: s }) => {
|
|
5
|
+
let c = Object.entries(o);
|
|
6
|
+
return /* @__PURE__ */ n("div", {
|
|
7
|
+
style: {
|
|
8
|
+
display: "grid",
|
|
9
|
+
gridTemplateColumns: "auto auto",
|
|
10
|
+
alignItems: "baseline",
|
|
11
|
+
gap: "254px 12px",
|
|
12
|
+
...s
|
|
13
|
+
},
|
|
14
|
+
children: c.map(([o, { props: s = {}, ComponentTemplate: c }]) => /* @__PURE__ */ r(e, { children: [/* @__PURE__ */ n(t, {
|
|
15
|
+
as: "span",
|
|
16
|
+
color: "textOnLightSecondary",
|
|
17
|
+
style: { textTransform: "uppercase" },
|
|
18
|
+
variant: "bodyDefaultBold",
|
|
19
|
+
children: o
|
|
20
|
+
}), /* @__PURE__ */ n("div", { children: n(c || a, {
|
|
21
|
+
...i,
|
|
22
|
+
...s
|
|
23
|
+
}) })] }, o))
|
|
24
|
+
});
|
|
46
25
|
};
|
|
26
|
+
i.displayName = "variants";
|
|
27
|
+
export { i as VariantsAggregator };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { r as e } from "../../../chunks/user-selector-list-item.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
function n(n, r) {
|
|
5
|
+
return /* @__PURE__ */ t(e, {
|
|
6
|
+
renderAvatar: r,
|
|
7
|
+
subtitle: n.subtitle,
|
|
8
|
+
title: n.name
|
|
9
|
+
});
|
|
9
10
|
}
|
|
10
|
-
export {
|
|
11
|
-
n as defaultRenderCustomOption
|
|
12
|
-
};
|
|
11
|
+
export { n as defaultRenderCustomOption };
|