@box/user-selector 1.74.32 → 1.74.34

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 (29) hide show
  1. package/dist/chunks/buildOptionsWithOverlay.js +21 -22
  2. package/dist/chunks/user-selector-headless.module.js +13 -14
  3. package/dist/chunks/user-selector-list-item.js +84 -0
  4. package/dist/chunks/user-selector.js +89 -0
  5. package/dist/esm/index.js +4 -9
  6. package/dist/esm/lib/messages.js +42 -44
  7. package/dist/esm/lib/shared.js +6 -8
  8. package/dist/esm/lib/user-selector-container.js +29 -42
  9. package/dist/esm/lib/user-selector-headless/components/user-avatar.js +25 -31
  10. package/dist/esm/lib/user-selector-headless/components/user-selector-content.js +27 -50
  11. package/dist/esm/lib/user-selector-headless/components/user-selector-default-empty.js +34 -42
  12. package/dist/esm/lib/user-selector-headless/components/user-selector-default-error.js +13 -19
  13. package/dist/esm/lib/user-selector-headless/components/user-selector-skeleton.js +19 -25
  14. package/dist/esm/lib/user-selector-headless/hooks/use-avatars.js +13 -21
  15. package/dist/esm/lib/user-selector-headless/hooks/use-keyboard-navigation.js +25 -27
  16. package/dist/esm/lib/user-selector-headless/hooks/use-select-options.js +24 -27
  17. package/dist/esm/lib/user-selector-headless/user-selector-context.js +6 -10
  18. package/dist/esm/lib/user-selector-headless/user-selector-headless.js +171 -167
  19. package/dist/esm/lib/user-selector-list-item.js +2 -113
  20. package/dist/esm/lib/user-selector.js +2 -108
  21. package/dist/esm/lib/utils/VariantsAggregator.js +26 -45
  22. package/dist/esm/lib/utils/buildOptionsWithOverlay.js +2 -4
  23. package/dist/esm/lib/utils/defaultRenderCustomOption.js +10 -11
  24. package/dist/esm/lib/utils/getInitials.js +4 -6
  25. package/dist/esm/lib/utils/isUserContactType.js +3 -5
  26. package/dist/styles/user-selector-headless.css +1 -1
  27. package/dist/styles/user-selector-list-item.css +1 -1
  28. package/dist/styles/user-selector.css +1 -1
  29. package/package.json +8 -8
@@ -1,23 +1,22 @@
1
- const c = "__combobox_overlay_header__", l = "__combobox_overlay_separator__";
2
- function o(a, e, t) {
3
- if (!a || a.length === 0)
4
- return a ?? void 0;
5
- let _ = [...a];
6
- if (t >= 0 && t < _.length - 1) {
7
- const n = {
8
- name: "",
9
- value: l
10
- };
11
- _ = [..._.slice(0, t + 1), n, ..._.slice(t + 1)];
12
- }
13
- return e && _.length > 0 && t >= 0 && (_ = [{
14
- name: "",
15
- value: c,
16
- label: e
17
- }, ..._]), _;
1
+ var e = "__combobox_overlay_header__", t = "__combobox_overlay_separator__";
2
+ function n(n, r, i) {
3
+ if (!n || n.length === 0) return n ?? void 0;
4
+ let a = [...n];
5
+ if (i >= 0 && i < a.length - 1) {
6
+ let e = {
7
+ name: "",
8
+ value: t
9
+ };
10
+ a = [
11
+ ...a.slice(0, i + 1),
12
+ e,
13
+ ...a.slice(i + 1)
14
+ ];
15
+ }
16
+ return r && a.length > 0 && i >= 0 && (a = [{
17
+ name: "",
18
+ value: e,
19
+ label: r
20
+ }, ...a]), a;
18
21
  }
19
- export {
20
- c as O,
21
- l as a,
22
- o as b
23
- };
22
+ export { e as n, t as r, n as t };
@@ -1,15 +1,14 @@
1
- import '../styles/user-selector-headless.css';const t = "_userSelectorInviteRow_19h0i_2", e = "_popoverContainer_19h0i_19", o = "_popoverContent_19h0i_27", r = "_userSelectorListItem_19h0i_2", s = "_listItemAvatar_19h0i_38", n = "_userSelectorGhostStateItem_19h0i_42", c = "_titleGhost_19h0i_48", i = "_userSelectorEmptyText_19h0i_52", _ = "_userSelectorEmptyContainer_19h0i_65", l = "_userSelectorInviteButtonIcon_19h0i_80", u = {
2
- userSelectorInviteRow: t,
3
- popoverContainer: e,
4
- popoverContent: o,
5
- userSelectorListItem: r,
6
- listItemAvatar: s,
7
- userSelectorGhostStateItem: n,
8
- titleGhost: c,
9
- userSelectorEmptyText: i,
10
- userSelectorEmptyContainer: _,
11
- userSelectorInviteButtonIcon: l
12
- };
13
- export {
14
- u as s
1
+ import '../styles/user-selector-headless.css';var e = {
2
+ userSelectorListItemBase: "_userSelectorListItemBase_19h0i_2",
3
+ userSelectorInviteRow: "_userSelectorInviteRow_19h0i_2",
4
+ popoverContainer: "_popoverContainer_19h0i_19",
5
+ popoverContent: "_popoverContent_19h0i_27",
6
+ userSelectorListItem: "_userSelectorListItem_19h0i_2",
7
+ listItemAvatar: "_listItemAvatar_19h0i_38",
8
+ userSelectorGhostStateItem: "_userSelectorGhostStateItem_19h0i_42",
9
+ titleGhost: "_titleGhost_19h0i_48",
10
+ userSelectorEmptyText: "_userSelectorEmptyText_19h0i_52",
11
+ userSelectorEmptyContainer: "_userSelectorEmptyContainer_19h0i_65",
12
+ userSelectorInviteButtonIcon: "_userSelectorInviteButtonIcon_19h0i_80"
15
13
  };
14
+ export { e as t };
@@ -0,0 +1,84 @@
1
+ import e from "../esm/lib/messages.js";
2
+ import { isUserContactType as t } from "../esm/lib/utils/isUserContactType.js";
3
+ import n, { forwardRef as r } from "react";
4
+ import i from "clsx";
5
+ import { useIntl as a } from "react-intl";
6
+ import { Combobox as o, Text as s, Tooltip as c } from "@box/blueprint-web";
7
+ import { AvatarPlusBadge as l } from "@box/blueprint-web-assets/icons/Line";
8
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
9
+ import '../styles/user-selector-list-item.css';var f = {
10
+ userSelectorListItemBase: "_userSelectorListItemBase_1m2q6_1",
11
+ userSelectorListItem: "_userSelectorListItem_1m2q6_1",
12
+ listItemAvatar: "_listItemAvatar_1m2q6_18",
13
+ userInfo: "_userInfo_1m2q6_21",
14
+ title: "_title_1m2q6_28",
15
+ userName: "_userName_1m2q6_34",
16
+ userEmail: "_userEmail_1m2q6_35",
17
+ userSelectorListItemInviteIcon: "_userSelectorListItemInviteIcon_1m2q6_43"
18
+ }, p = /* @__PURE__ */ r(({ renderAvatar: t, title: r, subtitle: o, onClick: p, className: m, id: h, selected: g, isCollaborator: _ = !0, ...v }, y) => {
19
+ let b = /* @__PURE__ */ n.cloneElement(t(), { className: i(f.listItemAvatar) }), { formatMessage: x } = a(), S = /* @__PURE__ */ d("div", {
20
+ ref: y,
21
+ "aria-selected": g,
22
+ className: i(f.userSelectorListItem, m),
23
+ id: h,
24
+ ...p ? { onClick: p } : {},
25
+ ...v,
26
+ children: [
27
+ b,
28
+ /* @__PURE__ */ d("div", {
29
+ className: i(f.userInfo),
30
+ children: [/* @__PURE__ */ u("div", {
31
+ className: i(f.title),
32
+ children: /* @__PURE__ */ u(s, {
33
+ as: "span",
34
+ className: i(f.userName),
35
+ variant: "bodyDefaultSemibold",
36
+ children: r
37
+ })
38
+ }), /* @__PURE__ */ u(s, {
39
+ as: "span",
40
+ className: i(f.userEmail),
41
+ color: "textOnLightSecondary",
42
+ variant: "caption",
43
+ children: o
44
+ })]
45
+ }),
46
+ !_ && /* @__PURE__ */ u(l, { className: f.userSelectorListItemInviteIcon })
47
+ ]
48
+ });
49
+ return _ ? S : /* @__PURE__ */ u(c, {
50
+ content: x(e.inviteCollaboratorsTooltip),
51
+ side: "right",
52
+ children: S
53
+ });
54
+ }), m = /* @__PURE__ */ r(({ renderAvatar: t, userContact: n, onClick: r, id: i, ...o }, s) => {
55
+ let c = a().formatMessage(e.userName, {
56
+ name: n.name,
57
+ isCurrentUser: !!n.isCurrentUser
58
+ });
59
+ return /* @__PURE__ */ u(p, {
60
+ ref: s,
61
+ id: i,
62
+ onClick: () => {
63
+ r?.(n, i);
64
+ },
65
+ renderAvatar: () => t(n),
66
+ subtitle: n.email,
67
+ title: c,
68
+ ...o
69
+ });
70
+ }), h = /* @__PURE__ */ r(function(e, n) {
71
+ let { className: r, userContact: i, renderAvatar: a, renderCustomOption: s, ...c } = e, l = t(i), d = l ? !0 : i.hideOnClick ?? !0;
72
+ return /* @__PURE__ */ u(o.Option, {
73
+ ref: n,
74
+ className: r,
75
+ hideOnClick: d,
76
+ value: i.value,
77
+ ...c,
78
+ children: l ? /* @__PURE__ */ u(m, {
79
+ renderAvatar: a,
80
+ userContact: i
81
+ }) : s(i, () => a(i))
82
+ });
83
+ });
84
+ export { m as n, p as r, h as t };
@@ -0,0 +1,89 @@
1
+ import { t as e } from "./buildOptionsWithOverlay.js";
2
+ import t from "../esm/lib/messages.js";
3
+ import { t as n } from "./user-selector-list-item.js";
4
+ import { isUserContactType as r } from "../esm/lib/utils/isUserContactType.js";
5
+ import { defaultRenderCustomOption as i } from "../esm/lib/utils/defaultRenderCustomOption.js";
6
+ import { getInitials as a } from "../esm/lib/utils/getInitials.js";
7
+ import { useCallback as o } from "react";
8
+ import s from "clsx";
9
+ import { useIntl as c } from "react-intl";
10
+ import { Avatar as l, Combobox as u, Divider as d, IconBadge as f, Text as p } from "@box/blueprint-web";
11
+ import { ComboboxWithApi as m } from "@box/combobox-with-api";
12
+ import { jsx as h } from "react/jsx-runtime";
13
+ import '../styles/user-selector.css';var g = {
14
+ overlayHeader: "_overlayHeader_zdn0a_1",
15
+ overlaySeparatorOption: "_overlaySeparatorOption_zdn0a_8",
16
+ textArea: "_textArea_zdn0a_15"
17
+ }, _ = (_) => {
18
+ let { fetchedAvatarUrls: v, fetchUsers: y, onSelectedUsersChange: b, selectedUsers: x, variant: S, className: C, defaultOptions: w, overlayDividerIndex: T, overlayTitle: E, renderCustomOption: D = i, ...O } = _, k = c(), A = (e) => {
19
+ if (!(e.value === "__combobox_overlay_header__" || e.value === "__combobox_overlay_separator__")) {
20
+ if (r(e)) {
21
+ let { name: n, isExternalUser: r, id: i } = e, o = /* @__PURE__ */ h(l, {
22
+ alt: k.formatMessage(t.userAvatar),
23
+ colorIndex: i,
24
+ src: v[i],
25
+ text: a(n)
26
+ });
27
+ return r ? /* @__PURE__ */ h(f, {
28
+ offset: {
29
+ right: -4,
30
+ bottom: -2
31
+ },
32
+ size: "medium",
33
+ variant: "collaborator-external",
34
+ children: o
35
+ }) : o;
36
+ }
37
+ return /* @__PURE__ */ h(l, { ...e.avatar });
38
+ }
39
+ }, j = (e) => {
40
+ if (!r(e)) return e.chipVariant;
41
+ }, M = o(async (t) => {
42
+ let n = await y(t);
43
+ if (!E || T == null || T < 0) return n;
44
+ let r = new Set(x.map((e) => e.value)), i = n.filter((e) => !r.has(e.value)), a = n.slice(0, T + 1).filter((e) => !r.has(e.value)).length;
45
+ return e(i, E, a > 0 ? a - 1 : -1);
46
+ }, [
47
+ y,
48
+ E,
49
+ T,
50
+ x
51
+ ]);
52
+ return /* @__PURE__ */ h(m, {
53
+ as: "input",
54
+ className: s(C, S === "textarea" && g.textArea),
55
+ defaultOptions: w,
56
+ displayAvatar: A,
57
+ displayChipVariant: j,
58
+ displayValue: (e) => e.name,
59
+ fetcher: M,
60
+ freeInput: !1,
61
+ loadingAriaLabel: k.formatMessage(t.loading),
62
+ multiselect: !0,
63
+ noResultMessage: k.formatMessage(t.noResults),
64
+ onValueChange: b,
65
+ renderOption: (e) => e.value === "__combobox_overlay_header__" && "label" in e ? /* @__PURE__ */ h(u.Option, {
66
+ className: g.overlayHeader,
67
+ disabled: !0,
68
+ value: e.value,
69
+ children: /* @__PURE__ */ h(p, {
70
+ as: "span",
71
+ variant: "bodySmallSemibold",
72
+ color: "textOnLightSecondary",
73
+ children: e.label
74
+ })
75
+ }) : e.value === "__combobox_overlay_separator__" ? /* @__PURE__ */ h(u.Option, {
76
+ className: g.overlaySeparatorOption,
77
+ disabled: !0,
78
+ value: e.value,
79
+ children: /* @__PURE__ */ h(d, { "aria-hidden": !0 })
80
+ }) : /* @__PURE__ */ h(n, {
81
+ renderAvatar: A,
82
+ renderCustomOption: D,
83
+ userContact: e
84
+ }),
85
+ value: x,
86
+ ...O
87
+ });
88
+ };
89
+ export { _ as t };
package/dist/esm/index.js CHANGED
@@ -1,9 +1,4 @@
1
- import { O as o, a as A } from "../chunks/buildOptionsWithOverlay.js";
2
- import { UserSelectorContainer as s } from "./lib/user-selector-container.js";
3
- import { UserSelectorHeadless as a } from "./lib/user-selector-headless/user-selector-headless.js";
4
- export {
5
- o as OVERLAY_HEADER_VALUE,
6
- A as OVERLAY_SEPARATOR_VALUE,
7
- s as UserSelectorContainer,
8
- a as UserSelectorHeadless
9
- };
1
+ import { n as e, r as t } from "../chunks/buildOptionsWithOverlay.js";
2
+ import { UserSelectorContainer as n } from "./lib/user-selector-container.js";
3
+ import { UserSelectorHeadless as r } from "./lib/user-selector-headless/user-selector-headless.js";
4
+ export { e as OVERLAY_HEADER_VALUE, t as OVERLAY_SEPARATOR_VALUE, n as UserSelectorContainer, r as UserSelectorHeadless };
@@ -1,46 +1,44 @@
1
1
  import { defineMessages as e } from "react-intl";
2
- const s = e({
3
- loading: {
4
- id: "groupSharedFeatures.userSelector.loading",
5
- defaultMessage: "Loading"
6
- },
7
- noResults: {
8
- id: "groupSharedFeatures.userSelector.noResults",
9
- defaultMessage: "No results"
10
- },
11
- tryAgain: {
12
- id: "groupSharedFeatures.userSelector.tryAgain",
13
- defaultMessage: "Try again"
14
- },
15
- userAvatar: {
16
- id: "groupSharedFeatures.userSelector.userAvatar",
17
- defaultMessage: "User avatar"
18
- },
19
- userName: {
20
- id: "groupSharedFeatures.userSelector.userName",
21
- defaultMessage: "{name} {isCurrentUser, select, true { (me)} other {}}"
22
- },
23
- errorMessage: {
24
- id: "groupSharedFeatures.userSelector.errorMessage",
25
- defaultMessage: "We were unable to load users"
26
- },
27
- errorMessageDescription: {
28
- id: "groupSharedFeatures.userSelector.errorMessageDescription",
29
- defaultMessage: "Please try again later"
30
- },
31
- emptyMessage: {
32
- id: "groupSharedFeatures.userSelector.emptyMessage",
33
- defaultMessage: "No collaborators found"
34
- },
35
- inviteCollaborators: {
36
- id: "groupSharedFeatures.userSelector.inviteCollaborators",
37
- defaultMessage: "Invite Collaborators"
38
- },
39
- inviteCollaboratorsTooltip: {
40
- id: "groupSharedFeatures.userSelector.inviteCollaboratorsTooltip",
41
- defaultMessage: "This person doesn't have access and won't be notified unless invited."
42
- }
2
+ var t = e({
3
+ loading: {
4
+ id: "groupSharedFeatures.userSelector.loading",
5
+ defaultMessage: "Loading"
6
+ },
7
+ noResults: {
8
+ id: "groupSharedFeatures.userSelector.noResults",
9
+ defaultMessage: "No results"
10
+ },
11
+ tryAgain: {
12
+ id: "groupSharedFeatures.userSelector.tryAgain",
13
+ defaultMessage: "Try again"
14
+ },
15
+ userAvatar: {
16
+ id: "groupSharedFeatures.userSelector.userAvatar",
17
+ defaultMessage: "User avatar"
18
+ },
19
+ userName: {
20
+ id: "groupSharedFeatures.userSelector.userName",
21
+ defaultMessage: "{name} {isCurrentUser, select, true { (me)} other {}}"
22
+ },
23
+ errorMessage: {
24
+ id: "groupSharedFeatures.userSelector.errorMessage",
25
+ defaultMessage: "We were unable to load users"
26
+ },
27
+ errorMessageDescription: {
28
+ id: "groupSharedFeatures.userSelector.errorMessageDescription",
29
+ defaultMessage: "Please try again later"
30
+ },
31
+ emptyMessage: {
32
+ id: "groupSharedFeatures.userSelector.emptyMessage",
33
+ defaultMessage: "No collaborators found"
34
+ },
35
+ inviteCollaborators: {
36
+ id: "groupSharedFeatures.userSelector.inviteCollaborators",
37
+ defaultMessage: "Invite Collaborators"
38
+ },
39
+ inviteCollaboratorsTooltip: {
40
+ id: "groupSharedFeatures.userSelector.inviteCollaboratorsTooltip",
41
+ defaultMessage: "This person doesn't have access and won't be notified unless invited."
42
+ }
43
43
  });
44
- export {
45
- s as default
46
- };
44
+ export { t as default };
@@ -1,9 +1,7 @@
1
- const a = {
2
- email: "a@abc.com",
3
- id: 123,
4
- name: "a",
5
- value: "a"
6
- };
7
- export {
8
- a as placeholderUser
1
+ var e = {
2
+ email: "a@abc.com",
3
+ id: 123,
4
+ name: "a",
5
+ value: "a"
9
6
  };
7
+ export { e as placeholderUser };
@@ -1,43 +1,30 @@
1
- import { useRef as g, useState as p, useCallback as u, useEffect as m } from "react";
2
- import v from "./user-selector.js";
3
- import { defaultRenderCustomOption as F } from "./utils/defaultRenderCustomOption.js";
4
- import { isUserContactType as l } from "./utils/isUserContactType.js";
5
- import { jsx as R } from "react/jsx-runtime";
6
- const b = ({
7
- fetchAvatarUrls: a,
8
- fetchUsers: c,
9
- onSelectedUsersChange: h,
10
- selectedUsers: r,
11
- renderCustomOption: d = F,
12
- ...y
13
- }) => {
14
- const i = g(!0), [n, e] = p([]), [C, s] = p({}), O = u(async (t) => {
15
- const o = await c(t);
16
- return e(o), o;
17
- }, [c, e]), f = u(async (t) => {
18
- try {
19
- const o = await a(t);
20
- s(o);
21
- } catch {
22
- s({});
23
- }
24
- }, [a, s]);
25
- return m(() => {
26
- if (i.current && (i.current = !1, r.length > 0)) {
27
- const t = r.filter(l);
28
- e(t);
29
- }
30
- }, [r, e]), m(() => {
31
- n.length > 0 && f(n.filter(l));
32
- }, [n, f]), /* @__PURE__ */ R(v, {
33
- fetchedAvatarUrls: C,
34
- fetchUsers: O,
35
- onSelectedUsersChange: h,
36
- renderCustomOption: d,
37
- selectedUsers: r,
38
- ...y
39
- });
40
- };
41
- export {
42
- b as UserSelectorContainer
1
+ import { isUserContactType as e } from "./utils/isUserContactType.js";
2
+ import { t } from "../../chunks/user-selector.js";
3
+ import { defaultRenderCustomOption as n } from "./utils/defaultRenderCustomOption.js";
4
+ import { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
5
+ import { jsx as s } from "react/jsx-runtime";
6
+ var c = ({ fetchAvatarUrls: c, fetchUsers: l, onSelectedUsersChange: u, selectedUsers: d, renderCustomOption: f = n, ...p }) => {
7
+ let m = a(!0), [h, g] = o([]), [_, v] = o({}), y = r(async (e) => {
8
+ let t = await l(e);
9
+ return g(t), t;
10
+ }, [l, g]), b = r(async (e) => {
11
+ try {
12
+ v(await c(e));
13
+ } catch {
14
+ v({});
15
+ }
16
+ }, [c, v]);
17
+ return i(() => {
18
+ m.current && (m.current = !1, d.length > 0 && g(d.filter(e)));
19
+ }, [d, g]), i(() => {
20
+ h.length > 0 && b(h.filter(e));
21
+ }, [h, b]), /* @__PURE__ */ s(t, {
22
+ fetchedAvatarUrls: _,
23
+ fetchUsers: y,
24
+ onSelectedUsersChange: u,
25
+ renderCustomOption: f,
26
+ selectedUsers: d,
27
+ ...p
28
+ });
43
29
  };
30
+ export { c as UserSelectorContainer };
@@ -1,32 +1,26 @@
1
- import { Avatar as i, IconBadge as m } from "@box/blueprint-web";
2
- import { useIntl as l } from "react-intl";
3
- import n from "../../messages.js";
4
- import { getInitials as f } from "../../utils/getInitials.js";
5
- import { useUserSelector as c } from "../user-selector-context.js";
6
- import { s as p } from "../../../../chunks/user-selector-headless.module.js";
7
- import { jsx as a } from "react/jsx-runtime";
8
- const U = ({
9
- userContact: r
10
- }) => {
11
- const o = l(), {
12
- avatars: s
13
- } = c(), e = f(r.name), t = /* @__PURE__ */ a(i, {
14
- alt: o.formatMessage(n.userAvatar),
15
- className: p.listItemAvatar,
16
- colorIndex: r.id,
17
- src: s[r.id],
18
- text: e
19
- });
20
- return r.isExternalUser ? /* @__PURE__ */ a(m, {
21
- offset: {
22
- right: -4,
23
- bottom: -2
24
- },
25
- size: "medium",
26
- variant: "collaborator-external",
27
- children: t
28
- }) : t;
29
- };
30
- export {
31
- U as UserAvatar
1
+ import e from "../../messages.js";
2
+ import { getInitials as t } from "../../utils/getInitials.js";
3
+ import { useUserSelector as n } from "../user-selector-context.js";
4
+ import { t as r } from "../../../../chunks/user-selector-headless.module.js";
5
+ import { useIntl as i } from "react-intl";
6
+ import { Avatar as a, IconBadge as o } from "@box/blueprint-web";
7
+ import { jsx as s } from "react/jsx-runtime";
8
+ var c = ({ userContact: c }) => {
9
+ let l = i(), { avatars: u } = n(), d = t(c.name), f = /* @__PURE__ */ s(a, {
10
+ alt: l.formatMessage(e.userAvatar),
11
+ className: r.listItemAvatar,
12
+ colorIndex: c.id,
13
+ src: u[c.id],
14
+ text: d
15
+ });
16
+ return c.isExternalUser ? /* @__PURE__ */ s(o, {
17
+ offset: {
18
+ right: -4,
19
+ bottom: -2
20
+ },
21
+ size: "medium",
22
+ variant: "collaborator-external",
23
+ children: f
24
+ }) : f;
32
25
  };
26
+ export { c as UserAvatar };
@@ -1,51 +1,28 @@
1
- import { UserSelectorListItem as d } from "../../user-selector-list-item.js";
2
- import { useUserSelector as v } from "../user-selector-context.js";
3
- import { s as I } from "../../../../chunks/user-selector-headless.module.js";
4
- import { UserAvatar as b } from "./user-avatar.js";
5
- import { UserSelectorDefaultEmpty as k } from "./user-selector-default-empty.js";
6
- import { UserSelectorDefaultError as x } from "./user-selector-default-error.js";
7
- import { UserSelectorSkeleton as A } from "./user-selector-skeleton.js";
8
- import { jsx as r } from "react/jsx-runtime";
9
- const q = ({
10
- renderError: o,
11
- renderEmpty: s,
12
- loadingAriaLabel: c,
13
- optionRefs: l,
14
- handleOptionClick: i,
15
- options: f,
16
- isEmpty: u,
17
- isLoading: n,
18
- error: m,
19
- handleInvite: S
20
- }) => {
21
- const {
22
- value: p,
23
- activeId: U,
24
- getOptionId: C
25
- } = v();
26
- return m ? o ? o(m) : /* @__PURE__ */ r(x, {}) : u ? s ? s(p) : /* @__PURE__ */ r(k, {
27
- handleInvite: S
28
- }) : n ? /* @__PURE__ */ r(A, {
29
- loadingAriaLabel: c
30
- }) : f.map((e) => {
31
- const t = C(e);
32
- return /* @__PURE__ */ r(d, {
33
- ref: (a) => {
34
- a ? l.current.set(t, a) : l.current.delete(t);
35
- },
36
- className: I.userSelectorListItem,
37
- id: t,
38
- isCollaborator: e.isCollaborator,
39
- onClick: i,
40
- renderAvatar: () => /* @__PURE__ */ r(b, {
41
- userContact: e
42
- }),
43
- role: "option",
44
- selected: t === U,
45
- userContact: e
46
- }, e.id);
47
- });
48
- };
49
- export {
50
- q as UserSelectorContent
1
+ import { n as e } from "../../../../chunks/user-selector-list-item.js";
2
+ import { useUserSelector as t } from "../user-selector-context.js";
3
+ import { t as n } from "../../../../chunks/user-selector-headless.module.js";
4
+ import { UserAvatar as r } from "./user-avatar.js";
5
+ import { UserSelectorDefaultEmpty as i } from "./user-selector-default-empty.js";
6
+ import { UserSelectorDefaultError as a } from "./user-selector-default-error.js";
7
+ import { UserSelectorSkeleton as o } from "./user-selector-skeleton.js";
8
+ import { jsx as s } from "react/jsx-runtime";
9
+ var c = ({ renderError: c, renderEmpty: l, loadingAriaLabel: u, optionRefs: d, handleOptionClick: f, options: p, isEmpty: m, isLoading: h, error: g, handleInvite: _ }) => {
10
+ let { value: v, activeId: y, getOptionId: b } = t();
11
+ return g ? c ? c(g) : /* @__PURE__ */ s(a, {}) : m ? l ? l(v) : /* @__PURE__ */ s(i, { handleInvite: _ }) : h ? /* @__PURE__ */ s(o, { loadingAriaLabel: u }) : p.map((t) => {
12
+ let i = b(t);
13
+ return /* @__PURE__ */ s(e, {
14
+ ref: (e) => {
15
+ e ? d.current.set(i, e) : d.current.delete(i);
16
+ },
17
+ className: n.userSelectorListItem,
18
+ id: i,
19
+ isCollaborator: t.isCollaborator,
20
+ onClick: f,
21
+ renderAvatar: () => /* @__PURE__ */ s(r, { userContact: t }),
22
+ role: "option",
23
+ selected: i === y,
24
+ userContact: t
25
+ }, t.id);
26
+ });
51
27
  };
28
+ export { c as UserSelectorContent };