@box/user-selector 1.21.23

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 (106) hide show
  1. package/LICENSE +379 -0
  2. package/README.md +47 -0
  3. package/dist/chunks/user-selector-headless.module.js +16 -0
  4. package/dist/esm/index.js +6 -0
  5. package/dist/esm/lib/messages.js +46 -0
  6. package/dist/esm/lib/shared.js +9 -0
  7. package/dist/esm/lib/user-selector-container.js +43 -0
  8. package/dist/esm/lib/user-selector-headless/components/user-avatar.js +32 -0
  9. package/dist/esm/lib/user-selector-headless/components/user-selector-content.js +51 -0
  10. package/dist/esm/lib/user-selector-headless/components/user-selector-default-empty.js +43 -0
  11. package/dist/esm/lib/user-selector-headless/components/user-selector-default-error.js +20 -0
  12. package/dist/esm/lib/user-selector-headless/components/user-selector-skeleton.js +27 -0
  13. package/dist/esm/lib/user-selector-headless/hooks/use-avatars.js +22 -0
  14. package/dist/esm/lib/user-selector-headless/hooks/use-keyboard-navigation.js +27 -0
  15. package/dist/esm/lib/user-selector-headless/hooks/use-select-options.js +28 -0
  16. package/dist/esm/lib/user-selector-headless/user-selector-context.js +11 -0
  17. package/dist/esm/lib/user-selector-headless/user-selector-headless.js +168 -0
  18. package/dist/esm/lib/user-selector-list-item.js +114 -0
  19. package/dist/esm/lib/user-selector.js +77 -0
  20. package/dist/esm/lib/utils/VariantsAggregator.js +46 -0
  21. package/dist/esm/lib/utils/defaultRenderCustomOption.js +12 -0
  22. package/dist/esm/lib/utils/getInitials.js +7 -0
  23. package/dist/esm/lib/utils/isUserContactType.js +6 -0
  24. package/dist/i18n/bn-IN.js +12 -0
  25. package/dist/i18n/bn-IN.properties +20 -0
  26. package/dist/i18n/da-DK.js +12 -0
  27. package/dist/i18n/da-DK.properties +20 -0
  28. package/dist/i18n/de-DE.js +12 -0
  29. package/dist/i18n/de-DE.properties +20 -0
  30. package/dist/i18n/en-AU.js +12 -0
  31. package/dist/i18n/en-AU.properties +20 -0
  32. package/dist/i18n/en-CA.js +12 -0
  33. package/dist/i18n/en-CA.properties +20 -0
  34. package/dist/i18n/en-GB.js +12 -0
  35. package/dist/i18n/en-GB.properties +20 -0
  36. package/dist/i18n/en-US.js +12 -0
  37. package/dist/i18n/en-US.properties +20 -0
  38. package/dist/i18n/en-x-pseudo.js +12 -0
  39. package/dist/i18n/en-x-pseudo.properties +20 -0
  40. package/dist/i18n/es-419.js +12 -0
  41. package/dist/i18n/es-419.properties +20 -0
  42. package/dist/i18n/es-ES.js +12 -0
  43. package/dist/i18n/es-ES.properties +20 -0
  44. package/dist/i18n/fi-FI.js +12 -0
  45. package/dist/i18n/fi-FI.properties +20 -0
  46. package/dist/i18n/fr-CA.js +12 -0
  47. package/dist/i18n/fr-CA.properties +20 -0
  48. package/dist/i18n/fr-FR.js +12 -0
  49. package/dist/i18n/fr-FR.properties +20 -0
  50. package/dist/i18n/hi-IN.js +12 -0
  51. package/dist/i18n/hi-IN.properties +20 -0
  52. package/dist/i18n/it-IT.js +12 -0
  53. package/dist/i18n/it-IT.properties +20 -0
  54. package/dist/i18n/ja-JP.js +12 -0
  55. package/dist/i18n/ja-JP.properties +20 -0
  56. package/dist/i18n/json/src/lib/messages.json +1 -0
  57. package/dist/i18n/ko-KR.js +12 -0
  58. package/dist/i18n/ko-KR.properties +20 -0
  59. package/dist/i18n/nb-NO.js +12 -0
  60. package/dist/i18n/nb-NO.properties +20 -0
  61. package/dist/i18n/nl-NL.js +12 -0
  62. package/dist/i18n/nl-NL.properties +20 -0
  63. package/dist/i18n/pl-PL.js +12 -0
  64. package/dist/i18n/pl-PL.properties +20 -0
  65. package/dist/i18n/pt-BR.js +12 -0
  66. package/dist/i18n/pt-BR.properties +20 -0
  67. package/dist/i18n/ru-RU.js +12 -0
  68. package/dist/i18n/ru-RU.properties +20 -0
  69. package/dist/i18n/sv-SE.js +12 -0
  70. package/dist/i18n/sv-SE.properties +20 -0
  71. package/dist/i18n/tr-TR.js +12 -0
  72. package/dist/i18n/tr-TR.properties +20 -0
  73. package/dist/i18n/zh-CN.js +12 -0
  74. package/dist/i18n/zh-CN.properties +20 -0
  75. package/dist/i18n/zh-TW.js +12 -0
  76. package/dist/i18n/zh-TW.properties +20 -0
  77. package/dist/styles/user-selector-headless.css +1 -0
  78. package/dist/styles/user-selector-list-item.css +1 -0
  79. package/dist/styles/user-selector.css +1 -0
  80. package/dist/types/index.d.ts +3 -0
  81. package/dist/types/lib/messages.d.ts +53 -0
  82. package/dist/types/lib/shared.d.ts +2 -0
  83. package/dist/types/lib/stories/shared-headless.d.ts +4 -0
  84. package/dist/types/lib/stories/shared.d.ts +18 -0
  85. package/dist/types/lib/stories/utils/getCaretCoordinates.d.ts +5 -0
  86. package/dist/types/lib/stories/utils/testUsers.d.ts +13 -0
  87. package/dist/types/lib/types.d.ts +33 -0
  88. package/dist/types/lib/user-selector-container.d.ts +13 -0
  89. package/dist/types/lib/user-selector-headless/components/user-avatar.d.ts +6 -0
  90. package/dist/types/lib/user-selector-headless/components/user-selector-content.d.ts +15 -0
  91. package/dist/types/lib/user-selector-headless/components/user-selector-default-empty.d.ts +4 -0
  92. package/dist/types/lib/user-selector-headless/components/user-selector-default-error.d.ts +1 -0
  93. package/dist/types/lib/user-selector-headless/components/user-selector-skeleton.d.ts +5 -0
  94. package/dist/types/lib/user-selector-headless/hooks/use-avatars.d.ts +7 -0
  95. package/dist/types/lib/user-selector-headless/hooks/use-keyboard-navigation.d.ts +11 -0
  96. package/dist/types/lib/user-selector-headless/hooks/use-select-options.d.ts +14 -0
  97. package/dist/types/lib/user-selector-headless/types.d.ts +0 -0
  98. package/dist/types/lib/user-selector-headless/user-selector-context.d.ts +15 -0
  99. package/dist/types/lib/user-selector-headless/user-selector-headless.d.ts +28 -0
  100. package/dist/types/lib/user-selector-list-item.d.ts +56 -0
  101. package/dist/types/lib/user-selector.d.ts +37 -0
  102. package/dist/types/lib/utils/VariantsAggregator.d.ts +15 -0
  103. package/dist/types/lib/utils/defaultRenderCustomOption.d.ts +4 -0
  104. package/dist/types/lib/utils/getInitials.d.ts +1 -0
  105. package/dist/types/lib/utils/isUserContactType.d.ts +2 -0
  106. package/package.json +52 -0
@@ -0,0 +1,43 @@
1
+ import { Text as l } from "@box/blueprint-web";
2
+ import { AvatarPlusBadge as i } from "@box/blueprint-web-assets/icons/Line";
3
+ import { useCallback as n } from "react";
4
+ import { useIntl as p } from "react-intl";
5
+ import a from "../../messages.js";
6
+ import { useUserSelector as u } from "../user-selector-context.js";
7
+ import { s as r } from "../../../../chunks/user-selector-headless.module.js";
8
+ import { jsxs as m, jsx as s } from "react/jsx-runtime";
9
+ const g = ({
10
+ handleInvite: e
11
+ }) => {
12
+ const {
13
+ formatMessage: t
14
+ } = p(), {
15
+ value: o
16
+ } = u(), c = n(() => {
17
+ e == null || e(o);
18
+ }, [e, o]);
19
+ return /* @__PURE__ */ m("div", {
20
+ className: r.userSelectorEmptyContainer,
21
+ children: [/* @__PURE__ */ s("div", {
22
+ className: r.userSelectorEmptyText,
23
+ children: t(a.emptyMessage)
24
+ }), e && /* @__PURE__ */ m("button", {
25
+ className: r.userSelectorInviteRow,
26
+ onClick: c,
27
+ tabIndex: 0,
28
+ type: "button",
29
+ children: [/* @__PURE__ */ s("span", {
30
+ className: r.userSelectorInviteButtonIcon,
31
+ children: /* @__PURE__ */ s(i, {})
32
+ }), /* @__PURE__ */ s(l, {
33
+ as: "span",
34
+ className: r.userName,
35
+ variant: "bodyDefault",
36
+ children: t(a.inviteCollaborators)
37
+ })]
38
+ })]
39
+ });
40
+ };
41
+ export {
42
+ g as UserSelectorDefaultEmpty
43
+ };
@@ -0,0 +1,20 @@
1
+ import { InlineNotice as t } from "@box/blueprint-web";
2
+ import { useIntl as s, FormattedMessage as a } from "react-intl";
3
+ import r from "../../messages.js";
4
+ import { jsx as e } from "react/jsx-runtime";
5
+ const l = () => {
6
+ const {
7
+ formatMessage: o
8
+ } = s();
9
+ return /* @__PURE__ */ e(t, {
10
+ title: o(r.errorMessage),
11
+ variant: "error",
12
+ variantIconAriaLabel: "error",
13
+ children: /* @__PURE__ */ e(a, {
14
+ ...r.errorMessageDescription
15
+ })
16
+ });
17
+ };
18
+ export {
19
+ l as UserSelectorDefaultError
20
+ };
@@ -0,0 +1,27 @@
1
+ import { Ghost as t } from "@box/blueprint-web";
2
+ import { Size8 as r, Size5 as a } from "@box/blueprint-web-assets/tokens/tokens";
3
+ import { s as i } from "../../../../chunks/user-selector-headless.module.js";
4
+ import { jsx as e, jsxs as l } from "react/jsx-runtime";
5
+ const S = ({
6
+ loadingAriaLabel: o
7
+ }) => /* @__PURE__ */ e("div", {
8
+ "aria-label": o,
9
+ children: Array.from({
10
+ length: 4
11
+ }, (h, s) => /* @__PURE__ */ l("div", {
12
+ className: i.userSelectorGhostStateItem,
13
+ children: [/* @__PURE__ */ e(t, {
14
+ className: i.titleGhost,
15
+ height: r,
16
+ variant: "rectangle",
17
+ width: r
18
+ }), /* @__PURE__ */ e(t, {
19
+ height: a,
20
+ variant: "rectangle",
21
+ width: "100%"
22
+ })]
23
+ }, s))
24
+ });
25
+ export {
26
+ S as UserSelectorSkeleton
27
+ };
@@ -0,0 +1,22 @@
1
+ import { useState as u, useCallback as l, useEffect as v } from "react";
2
+ const o = ({
3
+ fetchAvatarUrls: s,
4
+ options: a
5
+ }) => {
6
+ const [e, t] = u({}), r = l(async (c) => {
7
+ try {
8
+ const n = await s(c);
9
+ t(n);
10
+ } catch {
11
+ t({});
12
+ }
13
+ }, [s, t]);
14
+ return v(() => {
15
+ a.length > 0 && r(a);
16
+ }, [a, r]), {
17
+ avatars: e
18
+ };
19
+ };
20
+ export {
21
+ o as useAvatars
22
+ };
@@ -0,0 +1,27 @@
1
+ import { useCallback as t } from "react";
2
+ const n = ({
3
+ isLoading: a,
4
+ error: e,
5
+ isEmpty: u,
6
+ open: b,
7
+ selectNext: f,
8
+ selectPrevious: k,
9
+ selectItem: o
10
+ }) => t((r) => {
11
+ if (!(!b || a || e || u))
12
+ switch (r.key) {
13
+ case "ArrowDown":
14
+ r.preventDefault(), f();
15
+ break;
16
+ case "ArrowUp":
17
+ r.preventDefault(), k();
18
+ break;
19
+ case "Enter":
20
+ case " ":
21
+ r.preventDefault(), o();
22
+ break;
23
+ }
24
+ }, [e, u, a, b, f, k, o]);
25
+ export {
26
+ n as useKeyboardNavigation
27
+ };
@@ -0,0 +1,28 @@
1
+ import d from "lodash/debounce";
2
+ import { useState as e, useCallback as y, useMemo as E, useEffect as b } from "react";
3
+ const S = ({
4
+ fetcher: r,
5
+ value: n,
6
+ debounceTime: a = 250,
7
+ allowEmptyQuery: f = !1
8
+ }) => {
9
+ const [u, o] = e(!1), [m, c] = e(!1), [g, l] = e(null), [h, i] = e([]), p = y(async (O) => {
10
+ try {
11
+ const s = await r(O);
12
+ c((s == null ? void 0 : s.length) === 0), i(s);
13
+ } catch (s) {
14
+ l(s);
15
+ } finally {
16
+ o(!1);
17
+ }
18
+ }, [r]), t = E(() => d(p, a), [p, a]);
19
+ return b(() => (n.length || f ? (o(!0), l(null), c(!1), t(n)) : (t.cancel(), o(!1), i([]), l(null), c(!1)), () => t.cancel()), [n, t, f]), {
20
+ isLoading: u,
21
+ isEmpty: m,
22
+ error: g,
23
+ options: h
24
+ };
25
+ };
26
+ export {
27
+ S as useSelectOptions
28
+ };
@@ -0,0 +1,11 @@
1
+ import { createContext as t, useContext as r } from "react";
2
+ const o = /* @__PURE__ */ t(null), n = () => {
3
+ const e = r(o);
4
+ if (!e)
5
+ throw new Error("useUserSelector must be used within a UserSelectorProvider");
6
+ return e;
7
+ };
8
+ export {
9
+ o as UserSelectorContext,
10
+ n as useUserSelector
11
+ };
@@ -0,0 +1,168 @@
1
+ import { Popover as m } from "@box/blueprint-web";
2
+ import { forwardRef as J, useState as Q, useId as W, useRef as X, useMemo as D, useCallback as i, useImperativeHandle as Y, useEffect as Z } from "react";
3
+ import { UserSelectorContent as _ } from "./components/user-selector-content.js";
4
+ import { useAvatars as F } from "./hooks/use-avatars.js";
5
+ import { useKeyboardNavigation as U } from "./hooks/use-keyboard-navigation.js";
6
+ import { useSelectOptions as E } from "./hooks/use-select-options.js";
7
+ import { UserSelectorContext as tt } from "./user-selector-context.js";
8
+ import { s as K } from "../../../chunks/user-selector-headless.module.js";
9
+ import { jsx as f, jsxs as ot } from "react/jsx-runtime";
10
+ const pt = /* @__PURE__ */ J(({
11
+ fetchUsers: g,
12
+ fetchAvatarUrls: w,
13
+ open: d,
14
+ value: y,
15
+ rootElement: M,
16
+ onSelectedUserChange: a,
17
+ inputElementRef: C,
18
+ focusOnOpen: A = !1,
19
+ renderError: P,
20
+ renderEmpty: R,
21
+ loadingAriaLabel: $,
22
+ ariaRoleDescription: H,
23
+ nativeFocusEnabled: c = !0,
24
+ allowEmptyQuery: L = !1,
25
+ onInvite: V,
26
+ popoverContentContainerProps: q
27
+ }, S) => {
28
+ const [s, I] = Q(null), {
29
+ options: t,
30
+ isEmpty: N,
31
+ isLoading: b,
32
+ error: j
33
+ } = E({
34
+ fetcher: g,
35
+ value: y,
36
+ allowEmptyQuery: L
37
+ }), {
38
+ avatars: T
39
+ } = F({
40
+ fetchAvatarUrls: w,
41
+ options: t
42
+ }), p = W(), h = X(/* @__PURE__ */ new Map()), k = D(() => `listbox-${p}`, [p]), e = i((o) => `${p}-option-${o.id}`, [p]), n = i((o) => {
43
+ const r = h.current.get(o);
44
+ if (r) {
45
+ if (I(o), c) {
46
+ r.focus();
47
+ return;
48
+ }
49
+ r.scrollIntoView({
50
+ behavior: "smooth",
51
+ block: "nearest",
52
+ inline: "nearest"
53
+ });
54
+ }
55
+ }, [c]), l = D(() => t.findIndex((o) => e(o) === s), [s, e, t]), u = i(() => {
56
+ var o;
57
+ (o = C.current) == null || o.focus(), I(null);
58
+ }, [C]), x = i(() => {
59
+ if (s) {
60
+ const o = t.find((r) => e(r) === s);
61
+ o && a(o);
62
+ }
63
+ }, [a, s, e, t]), v = i(() => {
64
+ if (t.length === 0)
65
+ return;
66
+ if (l < t.length - 1) {
67
+ const r = e(t[l + 1]);
68
+ n(r);
69
+ return;
70
+ }
71
+ if (c) {
72
+ u();
73
+ return;
74
+ }
75
+ const o = e(t[0]);
76
+ n(o);
77
+ }, [l, n, e, t, c, u]), O = i(() => {
78
+ if (t.length === 0)
79
+ return;
80
+ if (l > 0) {
81
+ const r = e(t[l - 1]);
82
+ n(r);
83
+ return;
84
+ }
85
+ if (c) {
86
+ u();
87
+ return;
88
+ }
89
+ const o = e(t[t.length - 1]);
90
+ n(o);
91
+ }, [l, n, e, t, c, u]), z = U({
92
+ isLoading: b,
93
+ error: j,
94
+ isEmpty: N,
95
+ open: d,
96
+ selectNext: v,
97
+ selectPrevious: O,
98
+ selectItem: x
99
+ }), B = i((o, r) => {
100
+ n(r), a(o);
101
+ }, [n, a]);
102
+ Y(S, () => ({
103
+ focusFirstOption: () => {
104
+ t.length > 0 && n(e(t[0]));
105
+ },
106
+ focusLastOption: () => {
107
+ t.length > 0 && n(e(t[t.length - 1]));
108
+ },
109
+ selectNext: v,
110
+ selectPrevious: O,
111
+ selectItem: x
112
+ }), [n, e, t, v, O, x]), Z(() => {
113
+ t.length > 0 && A && n(e(t[0]));
114
+ }, [t, d, e, n, A]);
115
+ const G = {
116
+ fetchUsers: g,
117
+ fetchAvatarUrls: w,
118
+ onSelectedUserChange: a,
119
+ value: y,
120
+ avatars: T,
121
+ activeId: s,
122
+ setActiveId: I,
123
+ listboxId: k,
124
+ getOptionId: e
125
+ };
126
+ return /* @__PURE__ */ f(tt.Provider, {
127
+ value: G,
128
+ children: /* @__PURE__ */ ot(m.Root, {
129
+ modal: !1,
130
+ open: d,
131
+ children: [/* @__PURE__ */ f(m.Anchor, {
132
+ children: M
133
+ }), /* @__PURE__ */ f(m.ContentContainer, {
134
+ ...q,
135
+ align: "start",
136
+ className: K.popoverContainer,
137
+ onOpenAutoFocus: (o) => {
138
+ o.preventDefault();
139
+ },
140
+ children: /* @__PURE__ */ f(m.MainContent, {
141
+ "aria-activedescendant": s,
142
+ "aria-owns": Array.from(h.current.values()).map((o) => o.id).join(" "),
143
+ "aria-roledescription": H,
144
+ className: K.popoverContent,
145
+ id: k,
146
+ onKeyDown: z,
147
+ role: "listbox",
148
+ tabIndex: -1,
149
+ children: /* @__PURE__ */ f(_, {
150
+ error: j,
151
+ handleInvite: V,
152
+ handleOptionClick: B,
153
+ isEmpty: N,
154
+ isLoading: b,
155
+ loadingAriaLabel: $,
156
+ optionRefs: h,
157
+ options: t,
158
+ renderEmpty: R,
159
+ renderError: P
160
+ })
161
+ })
162
+ })]
163
+ })
164
+ });
165
+ });
166
+ export {
167
+ pt as UserSelectorHeadless
168
+ };
@@ -0,0 +1,114 @@
1
+ import { Text as f, Tooltip as N, Combobox as x } from "@box/blueprint-web";
2
+ import { AvatarPlusBadge as b } from "@box/blueprint-web-assets/icons/Line";
3
+ import m from "clsx";
4
+ import q, { forwardRef as _ } 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 { jsxs as p, jsx as s } from "react/jsx-runtime";
9
+ import '../../styles/user-selector-list-item.css';const U = "_userSelectorListItemBase_1m2q6_1", A = "_userSelectorListItem_1m2q6_1", g = "_listItemAvatar_1m2q6_18", E = "_userInfo_1m2q6_21", T = "_title_1m2q6_28", y = "_userName_1m2q6_34", B = "_userEmail_1m2q6_35", C = "_userSelectorListItemInviteIcon_1m2q6_43", i = {
10
+ userSelectorListItemBase: U,
11
+ userSelectorListItem: A,
12
+ listItemAvatar: g,
13
+ userInfo: E,
14
+ title: T,
15
+ userName: y,
16
+ userEmail: B,
17
+ userSelectorListItemInviteIcon: C
18
+ }, j = /* @__PURE__ */ _(({
19
+ renderAvatar: l,
20
+ title: t,
21
+ subtitle: r,
22
+ onClick: o,
23
+ className: e,
24
+ id: n,
25
+ selected: u,
26
+ isCollaborator: a = !0,
27
+ ...c
28
+ }, I) => {
29
+ const L = /* @__PURE__ */ q.cloneElement(l(), {
30
+ className: m(i.listItemAvatar)
31
+ }), {
32
+ formatMessage: h
33
+ } = v(), d = /* @__PURE__ */ p("div", {
34
+ ref: I,
35
+ "aria-selected": u,
36
+ className: m(i.userSelectorListItem, e),
37
+ id: n,
38
+ ...o ? {
39
+ onClick: o
40
+ } : {},
41
+ ...c,
42
+ children: [L, /* @__PURE__ */ p("div", {
43
+ className: m(i.userInfo),
44
+ children: [/* @__PURE__ */ s("div", {
45
+ className: m(i.title),
46
+ children: /* @__PURE__ */ s(f, {
47
+ as: "span",
48
+ className: m(i.userName),
49
+ variant: "bodyDefaultSemibold",
50
+ children: t
51
+ })
52
+ }), /* @__PURE__ */ s(f, {
53
+ as: "span",
54
+ className: m(i.userEmail),
55
+ color: "textOnLightSecondary",
56
+ variant: "caption",
57
+ children: r
58
+ })]
59
+ }), !a && /* @__PURE__ */ s(b, {
60
+ className: i.userSelectorListItemInviteIcon
61
+ })]
62
+ });
63
+ return a ? d : /* @__PURE__ */ s(N, {
64
+ content: h(S.inviteCollaboratorsTooltip),
65
+ side: "right",
66
+ children: d
67
+ });
68
+ }), M = /* @__PURE__ */ _(({
69
+ renderAvatar: l,
70
+ userContact: t,
71
+ onClick: r,
72
+ id: o,
73
+ ...e
74
+ }, n) => {
75
+ const a = v().formatMessage(S.userName, {
76
+ name: t.name,
77
+ isCurrentUser: !!t.isCurrentUser
78
+ });
79
+ return /* @__PURE__ */ s(j, {
80
+ ref: n,
81
+ id: o,
82
+ onClick: () => {
83
+ r == null || r(t, o);
84
+ },
85
+ renderAvatar: () => l(t),
86
+ subtitle: t.email,
87
+ title: a,
88
+ ...e
89
+ });
90
+ }), H = /* @__PURE__ */ _(function(t, r) {
91
+ const {
92
+ className: o,
93
+ userContact: e,
94
+ renderAvatar: n,
95
+ renderCustomOption: u,
96
+ ...a
97
+ } = t, c = O(e), I = c ? !0 : e.hideOnClick ?? !0;
98
+ return /* @__PURE__ */ s(x.Option, {
99
+ ref: r,
100
+ className: o,
101
+ hideOnClick: I,
102
+ value: e.value,
103
+ ...a,
104
+ children: c ? /* @__PURE__ */ s(M, {
105
+ renderAvatar: n,
106
+ userContact: e
107
+ }) : u(e, () => n(e))
108
+ });
109
+ });
110
+ export {
111
+ H as UserSelectorComboboxOption,
112
+ M as UserSelectorListItem,
113
+ j as UserSelectorListItemInfo
114
+ };
@@ -0,0 +1,77 @@
1
+ import { Avatar as i, IconBadge as y } from "@box/blueprint-web";
2
+ import { ComboboxWithApi as I } from "@box/combobox-with-api";
3
+ import O from "clsx";
4
+ import { useIntl as M } from "react-intl";
5
+ import a from "./messages.js";
6
+ import { UserSelectorComboboxOption as V } from "./user-selector-list-item.js";
7
+ import { defaultRenderCustomOption as R } from "./utils/defaultRenderCustomOption.js";
8
+ import { getInitials as S } from "./utils/getInitials.js";
9
+ import { isUserContactType as l } from "./utils/isUserContactType.js";
10
+ import { jsx as t } from "react/jsx-runtime";
11
+ import '../../styles/user-selector.css';const _ = "_textArea_shf88_1", N = {
12
+ textArea: _
13
+ }, D = (m) => {
14
+ const {
15
+ fetchedAvatarUrls: c,
16
+ fetchUsers: f,
17
+ onSelectedUsersChange: u,
18
+ selectedUsers: p,
19
+ variant: d,
20
+ className: x,
21
+ defaultOptions: g,
22
+ renderCustomOption: h = R,
23
+ ...v
24
+ } = m, r = M(), s = (e) => {
25
+ if (l(e)) {
26
+ const {
27
+ name: U,
28
+ isExternalUser: b,
29
+ id: o
30
+ } = e, n = /* @__PURE__ */ t(i, {
31
+ alt: r.formatMessage(a.userAvatar),
32
+ colorIndex: o,
33
+ src: c[o],
34
+ text: S(U)
35
+ });
36
+ return b ? /* @__PURE__ */ t(y, {
37
+ offset: {
38
+ right: -4,
39
+ bottom: -2
40
+ },
41
+ size: "medium",
42
+ variant: "collaborator-external",
43
+ children: n
44
+ }) : n;
45
+ }
46
+ return /* @__PURE__ */ t(i, {
47
+ ...e.avatar
48
+ });
49
+ }, A = (e) => {
50
+ if (!l(e))
51
+ return e.chipVariant;
52
+ }, C = (e) => /* @__PURE__ */ t(V, {
53
+ renderAvatar: s,
54
+ renderCustomOption: h,
55
+ userContact: e
56
+ });
57
+ return /* @__PURE__ */ t(I, {
58
+ as: "input",
59
+ className: O(x, d === "textarea" && N.textArea),
60
+ defaultOptions: g,
61
+ displayAvatar: s,
62
+ displayChipVariant: A,
63
+ displayValue: (e) => e.name,
64
+ fetcher: f,
65
+ freeInput: !1,
66
+ loadingAriaLabel: r.formatMessage(a.loading),
67
+ multiselect: !0,
68
+ noResultMessage: r.formatMessage(a.noResults),
69
+ onValueChange: u,
70
+ renderOption: C,
71
+ value: p,
72
+ ...v
73
+ });
74
+ };
75
+ export {
76
+ D as default
77
+ };
@@ -0,0 +1,46 @@
1
+ import { Text as d } from "@box/blueprint-web";
2
+ import { Fragment as m } from "react";
3
+ import { jsx as r, jsxs as c } from "react/jsx-runtime";
4
+ const g = ({
5
+ defaultProps: t,
6
+ DefaultComponentTemplate: s,
7
+ variantsMap: n,
8
+ containerStyle: o
9
+ }) => {
10
+ const l = Object.entries(n);
11
+ return /* @__PURE__ */ r("div", {
12
+ style: {
13
+ display: "grid",
14
+ gridTemplateColumns: "auto auto",
15
+ alignItems: "baseline",
16
+ gap: "254px 12px",
17
+ ...o
18
+ },
19
+ children: l.map(([a, {
20
+ props: e = {},
21
+ ComponentTemplate: i
22
+ }]) => /* @__PURE__ */ c(m, {
23
+ children: [/* @__PURE__ */ r(d, {
24
+ as: "span",
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
46
+ };
@@ -0,0 +1,12 @@
1
+ import { UserSelectorListItemInfo as r } from "../user-selector-list-item.js";
2
+ import { jsx as o } from "react/jsx-runtime";
3
+ function n(t, e) {
4
+ return /* @__PURE__ */ o(r, {
5
+ renderAvatar: e,
6
+ subtitle: t.subtitle,
7
+ title: t.name
8
+ });
9
+ }
10
+ export {
11
+ n as defaultRenderCustomOption
12
+ };
@@ -0,0 +1,7 @@
1
+ const a = (e) => {
2
+ const t = e.replace(/[[({<]+.*[\])}>]+/g, "").trim(), s = t.slice(0, 1), n = t.slice(t.lastIndexOf(" ") + 1, t.lastIndexOf(" ") + 2);
3
+ return (s + n).toUpperCase();
4
+ };
5
+ export {
6
+ a as getInitials
7
+ };
@@ -0,0 +1,6 @@
1
+ function i(n) {
2
+ return "email" in n && "id" in n && "name" in n && "value" in n;
3
+ }
4
+ export {
5
+ i as isUserContactType
6
+ };
@@ -0,0 +1,12 @@
1
+ export default {
2
+ "groupSharedFeatures.userSelector.emptyMessage": "কোন সহযোগী খুঁজে পাওয়া যাচ্ছে না",
3
+ "groupSharedFeatures.userSelector.errorMessage": "আমরা ব্যবহারকারীদের লোড করতে লোড করতে পারিনি",
4
+ "groupSharedFeatures.userSelector.errorMessageDescription": "অনুগ্রহ করে পরে আবার চেষ্টা করুন",
5
+ "groupSharedFeatures.userSelector.inviteCollaborators": "সহযোগীদের আমন্ত্রণ জানান",
6
+ "groupSharedFeatures.userSelector.inviteCollaboratorsTooltip": "এই ব্যক্তির অ্যাক্সেস নেই এবং আমন্ত্রণ জানানো না হলে বিজ্ঞপ্তি দেওয়া হবে না.",
7
+ "groupSharedFeatures.userSelector.loading": "লোড হচ্ছে",
8
+ "groupSharedFeatures.userSelector.noResults": "কোনো ফলাফল নেই",
9
+ "groupSharedFeatures.userSelector.tryAgain": "আবার চেষ্টা করুন",
10
+ "groupSharedFeatures.userSelector.userAvatar": "ব্যবহারকারীর অবতার",
11
+ "groupSharedFeatures.userSelector.userName": "{name} {isCurrentUser, select, true { (আমি)} other {}}"
12
+ }
@@ -0,0 +1,20 @@
1
+ # Text displayed when no results are found
2
+ groupSharedFeatures.userSelector.emptyMessage = কোন সহযোগী খুঁজে পাওয়া যাচ্ছে না
3
+ # Text displayed when an error occurs
4
+ groupSharedFeatures.userSelector.errorMessage = আমরা ব্যবহারকারীদের লোড করতে লোড করতে পারিনি
5
+ # Text displayed when an error occurs
6
+ groupSharedFeatures.userSelector.errorMessageDescription = অনুগ্রহ করে পরে আবার চেষ্টা করুন
7
+ # Text displayed when no results are found and the user can invite collaborators
8
+ groupSharedFeatures.userSelector.inviteCollaborators = সহযোগীদের আমন্ত্রণ জানান
9
+ # Tooltip text displayed when a user is not a collaborator
10
+ groupSharedFeatures.userSelector.inviteCollaboratorsTooltip = এই ব্যক্তির অ্যাক্সেস নেই এবং আমন্ত্রণ জানানো না হলে বিজ্ঞপ্তি দেওয়া হবে না.
11
+ # Aria label for loading indicator
12
+ groupSharedFeatures.userSelector.loading = লোড হচ্ছে
13
+ # Text displayed when no results are found
14
+ groupSharedFeatures.userSelector.noResults = কোনো ফলাফল নেই
15
+ # Text for the "Try again" button
16
+ groupSharedFeatures.userSelector.tryAgain = আবার চেষ্টা করুন
17
+ # Alt text for user avatar image
18
+ groupSharedFeatures.userSelector.userAvatar = ব্যবহারকারীর অবতার
19
+ # User name with optional "me" marker for current user
20
+ groupSharedFeatures.userSelector.userName = {name} {isCurrentUser, select, true { (আমি)} other {}}
@@ -0,0 +1,12 @@
1
+ export default {
2
+ "groupSharedFeatures.userSelector.emptyMessage": "Ingen samarbejdspartnere blev fundet",
3
+ "groupSharedFeatures.userSelector.errorMessage": "Vi kunne ikke indlæse brugere",
4
+ "groupSharedFeatures.userSelector.errorMessageDescription": "Prøv igen senere",
5
+ "groupSharedFeatures.userSelector.inviteCollaborators": "Inviter samarbejdspartnere",
6
+ "groupSharedFeatures.userSelector.inviteCollaboratorsTooltip": "Denne person har ikke adgang og vil ikke blive underrettet, medmindre vedkommende er inviteret.",
7
+ "groupSharedFeatures.userSelector.loading": "Indlæser",
8
+ "groupSharedFeatures.userSelector.noResults": "Ingen resultater",
9
+ "groupSharedFeatures.userSelector.tryAgain": "Prøv igen",
10
+ "groupSharedFeatures.userSelector.userAvatar": "Bruger avatar",
11
+ "groupSharedFeatures.userSelector.userName": "{name} {isCurrentUser, select, true { (mig)} other {}}"
12
+ }