@alixpartners/ui-components 2.0.1 → 2.0.2

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.
@@ -1,19 +1,34 @@
1
1
  import { DataAttributes } from '../../types/data-attributes';
2
- import { DropdownOption } from '../Dropdown/Dropdown';
2
+ import { DropdownOption, LabelTooltipProps } from '../Dropdown/Dropdown';
3
3
  import { InteractiveEventHandlers } from '../../types/native-events';
4
4
  type TagsFieldsProps = {
5
5
  className?: string;
6
- label: string;
7
- required?: boolean;
6
+ label?: string;
8
7
  options: DropdownOption[];
9
- multiSelect?: boolean;
10
8
  value?: string[];
9
+ disabled?: boolean;
10
+ required?: boolean;
11
+ searchable?: boolean;
12
+ searchPlaceholder?: string;
13
+ errorMessage?: string;
11
14
  helpText?: string;
12
15
  helpLink?: string;
13
16
  helpLinkText?: string;
14
- disabled?: boolean;
15
- errorMessage?: string;
16
17
  onChange?: (selectedValues: string[]) => void;
18
+ onSearch?: (searchTerm: string) => void;
19
+ grouped?: boolean;
20
+ multiSelect?: boolean;
21
+ align?: 'left' | 'right';
22
+ onToggleChange?: (checked: boolean) => void;
23
+ toggleLabel?: string;
24
+ dropdownTriggerClassName?: string;
25
+ dropdownMenuClassName?: string;
26
+ labelTooltip?: LabelTooltipProps;
27
+ unselect?: boolean;
28
+ selectedOptionLabel?: string;
29
+ selectedOptionsLabel?: string;
30
+ allOptionsSelectedLabel?: string;
31
+ caseSensitive?: boolean;
17
32
  } & DataAttributes & InteractiveEventHandlers;
18
33
  /**
19
34
  * A dropdown input for tag-based selections where selected items are displayed as tags.
@@ -36,5 +51,5 @@ type TagsFieldsProps = {
36
51
  * @param {DataAttributes} [props.data-*] - Additional `data-` attributes forwarded to the root element
37
52
  * @returns {JSX.Element} The rendered TagsFields component
38
53
  */
39
- export default function TagsFields({ label, required, multiSelect, value, helpText, helpLink, helpLinkText, disabled, errorMessage, onChange, className, ...props }: TagsFieldsProps): import("react/jsx-runtime").JSX.Element;
54
+ export default function TagsFields({ className, label, options, value, disabled, required, searchable, searchPlaceholder, errorMessage, helpText, helpLink, helpLinkText, onChange, onSearch, multiSelect, grouped, align, dropdownMenuClassName, labelTooltip, unselect, selectedOptionLabel, selectedOptionsLabel, allOptionsSelectedLabel, caseSensitive, ...props }: TagsFieldsProps): import("react/jsx-runtime").JSX.Element;
40
55
  export {};
@@ -1,21 +1,231 @@
1
- import { jsx as p } from "react/jsx-runtime";
2
- import u from "../Dropdown/Dropdown.js";
3
- function F({
4
- label: r,
5
- required: s = !1,
6
- multiSelect: e = !1,
7
- value: o,
8
- helpText: t,
9
- helpLink: a,
10
- helpLinkText: f,
11
- disabled: i,
12
- errorMessage: l,
1
+ import { jsxs as _, jsx as o } from "react/jsx-runtime";
2
+ import { c as m } from "../../clsx-OuTLNxxd.js";
3
+ import { useState as h, useRef as O, useEffect as N, useCallback as ee } from "react";
4
+ import W from "../Icon/Icon.js";
5
+ import Ie from "../Button/Button.js";
6
+ import "../Input/Input.js";
7
+ import Fe from "../Tooltip/Tooltip.js";
8
+ import { R as ve, A as Te, P as Ne, C as Le } from "../../index-BKtdMA_j.js";
9
+ import '../../assets/TagsFields.css';const De = "TagsFields-module__dropdownContainer___GIsND", Ce = "TagsFields-module__dropdownLabel___AUP9W", ye = "TagsFields-module__dropdownLabelDisabled___hilvh", Oe = "TagsFields-module__required___Ybg21", ke = "TagsFields-module__dropdownWrapper___KxTZl", Re = "TagsFields-module__selectedItemsCreatable___Pnf8l", xe = "TagsFields-module__selectedItem___Tp6lp", Ae = "TagsFields-module__selectedItemLabel___SwoJL", Se = "TagsFields-module__removeButton___od0yh", We = "TagsFields-module__removeIcon___2WRCF", Ee = "TagsFields-module__singleSelectedCreatableItem___QwENt", Me = "TagsFields-module__singleSelectedCreatableItemRemoveButton___1PeN7", Ve = "TagsFields-module__dropdownActions___USb5V", Be = "TagsFields-module__dropdownArrow___JT9d3", Pe = "TagsFields-module__dropdownArrowOpen___jPfTk", je = "TagsFields-module__dropdownMenu___gPhtC", qe = "TagsFields-module__dropdownCreatableSearchContainer___mltcH", Ge = "TagsFields-module__disabled___1OfNF", ze = "TagsFields-module__dropdownCreatableError___R6oyD", Je = "TagsFields-module__creatableInput___qz9jI", Qe = "TagsFields-module__optionsList___qyawx", Ue = "TagsFields-module__categoryGroup___In039", Ye = "TagsFields-module__categoryDivider___eROv0", Ke = "TagsFields-module__categoryLabel___Cv2h5", He = "TagsFields-module__optionItem___UujFS", Xe = "TagsFields-module__optionItemDisabled___9gB8N", Ze = "TagsFields-module__optionItemFocused___4rsDt", $e = "TagsFields-module__optionContent___QSC9G", et = "TagsFields-module__optionLabel___N-fQ7", tt = "TagsFields-module__tickIcon___3uRY-", st = "TagsFields-module__noOptions___ugYj9", lt = "TagsFields-module__helpers___ab6f-", ot = "TagsFields-module__helpText___Qzdqh", dt = "TagsFields-module__helpTextDisabled___m-oFo", nt = "TagsFields-module__helpLink___JQDmR", at = "TagsFields-module__helpLinkDisabled___Nk1BX", rt = "TagsFields-module__errorMessage___b-ugf", t = {
10
+ dropdownContainer: De,
11
+ dropdownLabel: Ce,
12
+ "label-text": "TagsFields-module__label-text___aVbdd",
13
+ dropdownLabelDisabled: ye,
14
+ "label-tooltip-icon": "TagsFields-module__label-tooltip-icon___LEeee",
15
+ required: Oe,
16
+ dropdownWrapper: ke,
17
+ selectedItemsCreatable: Re,
18
+ selectedItem: xe,
19
+ selectedItemLabel: Ae,
20
+ removeButton: Se,
21
+ removeIcon: We,
22
+ singleSelectedCreatableItem: Ee,
23
+ singleSelectedCreatableItemRemoveButton: Me,
24
+ dropdownActions: Ve,
25
+ dropdownArrow: Be,
26
+ dropdownArrowOpen: Pe,
27
+ dropdownMenu: je,
28
+ "dropdown-container-grouped": "TagsFields-module__dropdown-container-grouped___-Gp5y",
29
+ "dropdown-container-multi-select": "TagsFields-module__dropdown-container-multi-select___cf1jL",
30
+ dropdownCreatableSearchContainer: qe,
31
+ disabled: Ge,
32
+ dropdownCreatableError: ze,
33
+ creatableInput: Je,
34
+ optionsList: Qe,
35
+ categoryGroup: Ue,
36
+ categoryDivider: Ye,
37
+ categoryLabel: Ke,
38
+ optionItem: He,
39
+ optionItemDisabled: Xe,
40
+ optionItemFocused: Ze,
41
+ optionContent: $e,
42
+ optionLabel: et,
43
+ tickIcon: tt,
44
+ noOptions: st,
45
+ helpers: lt,
46
+ helpText: ot,
47
+ helpTextDisabled: dt,
48
+ helpLink: nt,
49
+ helpLinkDisabled: at,
50
+ errorMessage: rt
51
+ };
52
+ function ht({
53
+ className: te,
54
+ label: E,
55
+ options: M,
56
+ value: I = [],
57
+ disabled: g = !1,
58
+ required: se = !1,
59
+ searchable: q = !1,
60
+ searchPlaceholder: le = "Search options...",
61
+ errorMessage: L,
62
+ helpText: k,
63
+ helpLink: V,
64
+ helpLinkText: B,
13
65
  onChange: d,
14
- className: m,
15
- ...n
66
+ onSearch: F,
67
+ multiSelect: b = !1,
68
+ grouped: oe = !1,
69
+ align: G = "left",
70
+ dropdownMenuClassName: de,
71
+ labelTooltip: w,
72
+ unselect: R = !1,
73
+ selectedOptionLabel: it = "option selected",
74
+ selectedOptionsLabel: ct = "options selected",
75
+ allOptionsSelectedLabel: z,
76
+ caseSensitive: J = !1,
77
+ ...ne
16
78
  }) {
17
- return /* @__PURE__ */ p(u, { label: r, required: s, isTagsFields: !0, multiSelect: e, value: o, helpText: t, helpLink: a, helpLinkText: f, disabled: i, errorMessage: l, onChange: d, className: m, ...n });
79
+ const [n, v] = h(I), [a, f] = h(!1), [Q, u] = h(""), [D, r] = h(-1), [x, T] = h([]), U = O(null), ae = O(null), P = O(null), C = O(null), [re, ie] = h(0), [ce, _e] = h(0), Y = O(I);
80
+ N(() => {
81
+ JSON.stringify(Y.current) !== JSON.stringify(I) && (v(I), Y.current = I);
82
+ }, [I]), N(() => {
83
+ var l;
84
+ const e = (l = ae.current) == null ? void 0 : l.getBoundingClientRect().width;
85
+ e && ie(e);
86
+ }, []), N(() => {
87
+ var l;
88
+ const e = (l = P.current) == null ? void 0 : l.getBoundingClientRect().width;
89
+ e && _e(e);
90
+ }, []), N(() => {
91
+ a && T([...n]);
92
+ }, [a, n]);
93
+ const K = Q.trim(), i = M.filter((e) => {
94
+ const l = J ? e.label : e.label.toLowerCase(), s = J ? K : K.toLowerCase();
95
+ return l.includes(s);
96
+ });
97
+ N(() => {
98
+ a && q && C.current && C.current.focus();
99
+ }, [a, q]);
100
+ const ue = (e) => {
101
+ f(e), e ? (T([...n]), u(""), r(-1)) : (u(""), r(-1), T([]));
102
+ }, pe = ee((e) => {
103
+ if (e.disabled) return;
104
+ let l = [];
105
+ if (b)
106
+ l = x.includes(e.value) ? x.filter((s) => s !== e.value) : [...x, e.value];
107
+ else {
108
+ if (n.includes(e.value))
109
+ if (R)
110
+ l = [];
111
+ else
112
+ return;
113
+ else
114
+ l = [e.value];
115
+ v(l), d == null || d(l), f(!1), u(""), r(-1), T([]);
116
+ return;
117
+ }
118
+ T(l);
119
+ }, [b, d, x, n, R]), j = ee((e) => {
120
+ var l;
121
+ if (!e.disabled) {
122
+ if (b) {
123
+ const S = n.includes(e.value) ? n.filter((y) => y !== e.value) : [...n, e.value];
124
+ v(S), d == null || d(S), f(!0), u(""), r(-1);
125
+ } else if (n.includes(e.value)) {
126
+ if (R) {
127
+ const s = [];
128
+ v(s), d == null || d(s), f(!1), u(""), r(-1);
129
+ }
130
+ } else {
131
+ const s = [e.value];
132
+ v(s), d == null || d(s), f(!1), u(""), r(-1);
133
+ }
134
+ (l = P.current) == null || l.focus();
135
+ }
136
+ }, [b, d, n, R]), me = (e) => {
137
+ f(!0), u(e), r(-1), F == null || F(e);
138
+ }, H = (e) => {
139
+ f(!0), u(e), r(-1), F == null || F(e);
140
+ }, X = (e) => {
141
+ const l = n.filter((s) => s !== e);
142
+ v(l), d == null || d(l);
143
+ };
144
+ N(() => {
145
+ const e = (l) => {
146
+ if (a)
147
+ switch (l.key) {
148
+ case "ArrowDown":
149
+ l.preventDefault(), r((s) => s < i.length - 1 ? s + 1 : 0);
150
+ break;
151
+ case "ArrowUp":
152
+ l.preventDefault(), r((s) => s > 0 ? s - 1 : i.length - 1);
153
+ break;
154
+ case "Enter":
155
+ if (l.preventDefault(), D >= 0 && D < i.length) {
156
+ const s = i[D];
157
+ j(s);
158
+ }
159
+ break;
160
+ case "Escape":
161
+ l.preventDefault(), f(!1), u(""), r(-1), T([]);
162
+ break;
163
+ }
164
+ };
165
+ return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
166
+ }, [a, D, i, j, pe]);
167
+ const A = n, c = M.filter((e) => A.includes(e.value)), be = !!L, Z = M.filter((e) => !e.disabled), fe = Z.length > 0 && Z.every((e) => A.includes(e.value)), ge = i.reduce((e, l) => {
168
+ const s = l.category || "default";
169
+ return e[s] || (e[s] = []), e[s].push(l), e;
170
+ }, {}), we = i, {
171
+ onBlur: p,
172
+ ...$
173
+ } = ne;
174
+ return /* @__PURE__ */ _("div", { ref: U, className: m(t.dropdownContainer, oe && t["dropdown-container-grouped"], b && t["dropdown-container-multi-select"], te), ...$, children: [
175
+ E && /* @__PURE__ */ _("label", { className: m(t.dropdownLabel, g && t.dropdownLabelDisabled), children: [
176
+ /* @__PURE__ */ o("span", { title: E, className: t["label-text"], children: E }),
177
+ se && /* @__PURE__ */ o("span", { className: t.required, children: "*" }),
178
+ w && /* @__PURE__ */ o(Fe, { content: w.content, size: w.size, theme: w.theme, tipSide: w.tipSide, tipAlignment: w.tipAlignment, startVisible: w.startVisible, children: /* @__PURE__ */ o(W, { icon: "ap-icon-info", className: t["label-tooltip-icon"] }) })
179
+ ] }),
180
+ /* @__PURE__ */ o(ve, { open: a, onOpenChange: ue, children: /* @__PURE__ */ _("div", { className: t.dropdownWrapper, children: [
181
+ /* @__PURE__ */ o(Te, { children: /* @__PURE__ */ _("div", { tabIndex: 0, ref: P, className: m(t.dropdownCreatableSearchContainer, g && t.disabled, be && t.dropdownCreatableError), onBlur: (e) => {
182
+ a || p == null || p(e);
183
+ }, onClick: () => {
184
+ var e;
185
+ if (!b && c.length > 0)
186
+ return H("");
187
+ (e = C.current) == null || e.focus();
188
+ }, ...$, children: [
189
+ c.length > 0 && /* @__PURE__ */ o("div", { className: m(t.selectedItemsCreatable), children: b ? c.length > 3 ? /* @__PURE__ */ o("div", { className: t.selectedItem, children: /* @__PURE__ */ o("span", { className: t.selectedItemLabel, children: fe && z ? z : `${c.length} options selected` }) }) : c.map((e) => /* @__PURE__ */ _("div", { className: t.selectedItem, children: [
190
+ /* @__PURE__ */ o("span", { className: t.selectedItemLabel, children: e.label }),
191
+ /* @__PURE__ */ o("button", { type: "button", className: t.removeButton, onClick: () => X(e.value), disabled: g, children: /* @__PURE__ */ o(W, { icon: "ap-icon-close", className: t.removeIcon }) })
192
+ ] }, e.value)) : c.length > 0 && /* @__PURE__ */ _("div", { className: t.singleSelectedCreatableItem, children: [
193
+ /* @__PURE__ */ o("span", { className: t.selectedItemLabel, children: c[0].label }),
194
+ /* @__PURE__ */ o(Ie, { type: "tertiary", variant: "default", size: "sm", onClick: () => X(c[0].value), disabled: g, icon: "ap-icon-add-filled", className: t.singleSelectedCreatableItemRemoveButton })
195
+ ] }) }),
196
+ (b || !c.length) && /* @__PURE__ */ o("input", { ref: C, placeholder: c.length > 0 ? "" : le, value: Q, onChange: (e) => me(e.target.value), onFocus: (e) => H(e.target.value), onBlur: (e) => {
197
+ a || p == null || p(e);
198
+ }, disabled: g, className: t.creatableInput }),
199
+ /* @__PURE__ */ o("div", { className: t.dropdownActions, children: /* @__PURE__ */ o(W, { icon: "ap-icon-expand-more", className: m(t.dropdownArrow, a && t.dropdownArrowOpen) }) })
200
+ ] }) }),
201
+ /* @__PURE__ */ o(Ne, { children: /* @__PURE__ */ o(Le, { align: G === "right" ? "end" : "start", side: "bottom", avoidCollisions: !0, sideOffset: 6, collisionPadding: 8, style: {
202
+ minWidth: re,
203
+ zIndex: 9999
204
+ }, onInteractOutside: (e) => {
205
+ var s;
206
+ e.target === C.current && e.preventDefault(), ((s = U.current) == null ? void 0 : s.contains(e.target)) || p == null || p(e);
207
+ }, children: a && /* @__PURE__ */ o("div", { style: {
208
+ minWidth: ce
209
+ }, className: m(t.dropdownMenu, de, G === "right" && t.dropdownMenuRight), children: /* @__PURE__ */ _("div", { className: t.optionsList, "data-dropdown-options-list": !0, children: [
210
+ i.length > 0 ? Object.entries(ge).map(([e, l]) => /* @__PURE__ */ _("div", { className: t.categoryGroup, children: [
211
+ e !== "default" && /* @__PURE__ */ o("div", { className: t.categoryDivider, children: /* @__PURE__ */ o("span", { className: t.categoryLabel, children: e }) }),
212
+ l.map((s) => {
213
+ const S = we.indexOf(s), y = i.find((he) => he.value === s.value);
214
+ return /* @__PURE__ */ o("button", { title: (y == null ? void 0 : y.label) || s.label, type: "button", className: m(t.optionItem, A.includes(s.value) && t.optionItemSelected, s.disabled && t.optionItemDisabled, S === D && t.optionItemFocused), onClick: () => j(s), disabled: s.disabled, "data-dropdown-option-item": !0, children: /* @__PURE__ */ _("div", { className: t.optionContent, children: [
215
+ /* @__PURE__ */ o("span", { className: t.optionLabel, children: s.label }),
216
+ A.includes(s.value) && /* @__PURE__ */ o(W, { icon: "ap-icon-check", className: t.tickIcon })
217
+ ] }) }, s.value);
218
+ })
219
+ ] }, e)) : null,
220
+ i.length === 0 && /* @__PURE__ */ o("div", { className: t.noOptions, children: "No options found" })
221
+ ] }) }) }) })
222
+ ] }) }),
223
+ (L || k || V && B) && /* @__PURE__ */ _("div", { className: t.helpers, children: [
224
+ L ? /* @__PURE__ */ o("span", { title: L, className: t.errorMessage, children: L }) : k && /* @__PURE__ */ o("span", { title: k, className: m(t.helpText, g && t.helpTextDisabled), children: k }),
225
+ V && B && /* @__PURE__ */ o("a", { href: V, className: m(t.helpLink, g && t.helpLinkDisabled), target: "_blank", rel: "noopener noreferrer", children: B })
226
+ ] })
227
+ ] });
18
228
  }
19
229
  export {
20
- F as default
230
+ ht as default
21
231
  };
@@ -0,0 +1,226 @@
1
+ import * as i from "react";
2
+ import { u as G, c as H, d as O, P as _, a as P, g as K } from "./index-DWydnyjJ.js";
3
+ import { c as x, R as $, A as w, P as j, D as U, C as V, a as W } from "./index-DieLVN0p.js";
4
+ import { h as Z, R as q, u as z, F as B } from "./index-BGZDIjm9.js";
5
+ import { u as J } from "./index-2H7slGYV.js";
6
+ import { P as E } from "./index-DpfPnSMn.js";
7
+ import { jsx as p } from "react/jsx-runtime";
8
+ var m = "Popover", [F, de] = H(m, [
9
+ x
10
+ ]), g = x(), [Q, d] = F(m), b = (e) => {
11
+ const {
12
+ __scopePopover: n,
13
+ children: t,
14
+ open: a,
15
+ defaultOpen: o,
16
+ onOpenChange: r,
17
+ modal: s = !1
18
+ } = e, c = g(n), u = i.useRef(null), [l, h] = i.useState(!1), [C, f] = G({
19
+ prop: a,
20
+ defaultProp: o ?? !1,
21
+ onChange: r,
22
+ caller: m
23
+ });
24
+ return /* @__PURE__ */ p($, { ...c, children: /* @__PURE__ */ p(
25
+ Q,
26
+ {
27
+ scope: n,
28
+ contentId: J(),
29
+ triggerRef: u,
30
+ open: C,
31
+ onOpenChange: f,
32
+ onOpenToggle: i.useCallback(() => f((R) => !R), [f]),
33
+ hasCustomAnchor: l,
34
+ onCustomAnchorAdd: i.useCallback(() => h(!0), []),
35
+ onCustomAnchorRemove: i.useCallback(() => h(!1), []),
36
+ modal: s,
37
+ children: t
38
+ }
39
+ ) });
40
+ };
41
+ b.displayName = m;
42
+ var N = "PopoverAnchor", S = i.forwardRef(
43
+ (e, n) => {
44
+ const { __scopePopover: t, ...a } = e, o = d(N, t), r = g(t), { onCustomAnchorAdd: s, onCustomAnchorRemove: c } = o;
45
+ return i.useEffect(() => (s(), () => c()), [s, c]), /* @__PURE__ */ p(w, { ...r, ...a, ref: n });
46
+ }
47
+ );
48
+ S.displayName = N;
49
+ var y = "PopoverTrigger", D = i.forwardRef(
50
+ (e, n) => {
51
+ const { __scopePopover: t, ...a } = e, o = d(y, t), r = g(t), s = O(n, o.triggerRef), c = /* @__PURE__ */ p(
52
+ _.button,
53
+ {
54
+ type: "button",
55
+ "aria-haspopup": "dialog",
56
+ "aria-expanded": o.open,
57
+ "aria-controls": o.contentId,
58
+ "data-state": L(o.open),
59
+ ...a,
60
+ ref: s,
61
+ onClick: P(e.onClick, o.onOpenToggle)
62
+ }
63
+ );
64
+ return o.hasCustomAnchor ? c : /* @__PURE__ */ p(w, { asChild: !0, ...r, children: c });
65
+ }
66
+ );
67
+ D.displayName = y;
68
+ var A = "PopoverPortal", [X, Y] = F(A, {
69
+ forceMount: void 0
70
+ }), M = (e) => {
71
+ const { __scopePopover: n, forceMount: t, children: a, container: o } = e, r = d(A, n);
72
+ return /* @__PURE__ */ p(X, { scope: n, forceMount: t, children: /* @__PURE__ */ p(E, { present: t || r.open, children: /* @__PURE__ */ p(j, { asChild: !0, container: o, children: a }) }) });
73
+ };
74
+ M.displayName = A;
75
+ var v = "PopoverContent", T = i.forwardRef(
76
+ (e, n) => {
77
+ const t = Y(v, e.__scopePopover), { forceMount: a = t.forceMount, ...o } = e, r = d(v, e.__scopePopover);
78
+ return /* @__PURE__ */ p(E, { present: a || r.open, children: r.modal ? /* @__PURE__ */ p(oe, { ...o, ref: n }) : /* @__PURE__ */ p(re, { ...o, ref: n }) });
79
+ }
80
+ );
81
+ T.displayName = v;
82
+ var ee = K("PopoverContent.RemoveScroll"), oe = i.forwardRef(
83
+ (e, n) => {
84
+ const t = d(v, e.__scopePopover), a = i.useRef(null), o = O(n, a), r = i.useRef(!1);
85
+ return i.useEffect(() => {
86
+ const s = a.current;
87
+ if (s) return Z(s);
88
+ }, []), /* @__PURE__ */ p(q, { as: ee, allowPinchZoom: !0, children: /* @__PURE__ */ p(
89
+ k,
90
+ {
91
+ ...e,
92
+ ref: o,
93
+ trapFocus: t.open,
94
+ disableOutsidePointerEvents: !0,
95
+ onCloseAutoFocus: P(e.onCloseAutoFocus, (s) => {
96
+ var c;
97
+ s.preventDefault(), r.current || (c = t.triggerRef.current) == null || c.focus();
98
+ }),
99
+ onPointerDownOutside: P(
100
+ e.onPointerDownOutside,
101
+ (s) => {
102
+ const c = s.detail.originalEvent, u = c.button === 0 && c.ctrlKey === !0, l = c.button === 2 || u;
103
+ r.current = l;
104
+ },
105
+ { checkForDefaultPrevented: !1 }
106
+ ),
107
+ onFocusOutside: P(
108
+ e.onFocusOutside,
109
+ (s) => s.preventDefault(),
110
+ { checkForDefaultPrevented: !1 }
111
+ )
112
+ }
113
+ ) });
114
+ }
115
+ ), re = i.forwardRef(
116
+ (e, n) => {
117
+ const t = d(v, e.__scopePopover), a = i.useRef(!1), o = i.useRef(!1);
118
+ return /* @__PURE__ */ p(
119
+ k,
120
+ {
121
+ ...e,
122
+ ref: n,
123
+ trapFocus: !1,
124
+ disableOutsidePointerEvents: !1,
125
+ onCloseAutoFocus: (r) => {
126
+ var s, c;
127
+ (s = e.onCloseAutoFocus) == null || s.call(e, r), r.defaultPrevented || (a.current || (c = t.triggerRef.current) == null || c.focus(), r.preventDefault()), a.current = !1, o.current = !1;
128
+ },
129
+ onInteractOutside: (r) => {
130
+ var u, l;
131
+ (u = e.onInteractOutside) == null || u.call(e, r), r.defaultPrevented || (a.current = !0, r.detail.originalEvent.type === "pointerdown" && (o.current = !0));
132
+ const s = r.target;
133
+ ((l = t.triggerRef.current) == null ? void 0 : l.contains(s)) && r.preventDefault(), r.detail.originalEvent.type === "focusin" && o.current && r.preventDefault();
134
+ }
135
+ }
136
+ );
137
+ }
138
+ ), k = i.forwardRef(
139
+ (e, n) => {
140
+ const {
141
+ __scopePopover: t,
142
+ trapFocus: a,
143
+ onOpenAutoFocus: o,
144
+ onCloseAutoFocus: r,
145
+ disableOutsidePointerEvents: s,
146
+ onEscapeKeyDown: c,
147
+ onPointerDownOutside: u,
148
+ onFocusOutside: l,
149
+ onInteractOutside: h,
150
+ ...C
151
+ } = e, f = d(v, t), R = g(t);
152
+ return z(), /* @__PURE__ */ p(
153
+ B,
154
+ {
155
+ asChild: !0,
156
+ loop: !0,
157
+ trapped: a,
158
+ onMountAutoFocus: o,
159
+ onUnmountAutoFocus: r,
160
+ children: /* @__PURE__ */ p(
161
+ U,
162
+ {
163
+ asChild: !0,
164
+ disableOutsidePointerEvents: s,
165
+ onInteractOutside: h,
166
+ onEscapeKeyDown: c,
167
+ onPointerDownOutside: u,
168
+ onFocusOutside: l,
169
+ onDismiss: () => f.onOpenChange(!1),
170
+ children: /* @__PURE__ */ p(
171
+ V,
172
+ {
173
+ "data-state": L(f.open),
174
+ role: "dialog",
175
+ id: f.contentId,
176
+ ...R,
177
+ ...C,
178
+ ref: n,
179
+ style: {
180
+ ...C.style,
181
+ "--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
182
+ "--radix-popover-content-available-width": "var(--radix-popper-available-width)",
183
+ "--radix-popover-content-available-height": "var(--radix-popper-available-height)",
184
+ "--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
185
+ "--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
186
+ }
187
+ }
188
+ )
189
+ }
190
+ )
191
+ }
192
+ );
193
+ }
194
+ ), I = "PopoverClose", te = i.forwardRef(
195
+ (e, n) => {
196
+ const { __scopePopover: t, ...a } = e, o = d(I, t);
197
+ return /* @__PURE__ */ p(
198
+ _.button,
199
+ {
200
+ type: "button",
201
+ ...a,
202
+ ref: n,
203
+ onClick: P(e.onClick, () => o.onOpenChange(!1))
204
+ }
205
+ );
206
+ }
207
+ );
208
+ te.displayName = I;
209
+ var ne = "PopoverArrow", ae = i.forwardRef(
210
+ (e, n) => {
211
+ const { __scopePopover: t, ...a } = e, o = g(t);
212
+ return /* @__PURE__ */ p(W, { ...o, ...a, ref: n });
213
+ }
214
+ );
215
+ ae.displayName = ne;
216
+ function L(e) {
217
+ return e ? "open" : "closed";
218
+ }
219
+ var fe = b, ve = S, Pe = D, ge = M, he = T;
220
+ export {
221
+ ve as A,
222
+ he as C,
223
+ ge as P,
224
+ fe as R,
225
+ Pe as T
226
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alixpartners/ui-components",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"