@alixpartners/ui-components 2.0.0-beta.18 → 2.0.0-beta.18.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.
|
@@ -45,10 +45,10 @@ function P({
|
|
|
45
45
|
l == null || l(), o === void 0 && ((i = d.current) == null || i.close());
|
|
46
46
|
}, E = () => {
|
|
47
47
|
var i;
|
|
48
|
-
e == null || e(),
|
|
48
|
+
e == null || e(), o === void 0 && ((i = d.current) == null || i.close(), l == null || l());
|
|
49
49
|
}, G = () => {
|
|
50
50
|
var i;
|
|
51
|
-
r == null || r(),
|
|
51
|
+
r == null || r(), o === void 0 && ((i = d.current) == null || i.close(), l == null || l());
|
|
52
52
|
};
|
|
53
53
|
return /* @__PURE__ */ c("div", { className: M, ...R, children: [
|
|
54
54
|
s && /* @__PURE__ */ a("div", { ref: w, onClick: A, children: s }),
|
|
@@ -36,6 +36,9 @@ type DropdownProps = {
|
|
|
36
36
|
labelTooltip?: LabelTooltipProps;
|
|
37
37
|
isTagsFields?: boolean;
|
|
38
38
|
unselect?: boolean;
|
|
39
|
+
selectedOptionLabel?: string;
|
|
40
|
+
selectedOptionsLabel?: string;
|
|
41
|
+
allOptionsSelectedLabel?: string;
|
|
39
42
|
} & DataAttributes & InteractiveEventHandlers;
|
|
40
43
|
/**
|
|
41
44
|
* A flexible dropdown component that supports single and multi-select functionality with search, categorization, and keyboard navigation.
|
|
@@ -68,5 +71,5 @@ type DropdownProps = {
|
|
|
68
71
|
* @param {boolean} [props.unselect] - Whether single select dropdown allows deselection of selected items (defaults to false)
|
|
69
72
|
* @returns {JSX.Element} The rendered Dropdown component
|
|
70
73
|
*/
|
|
71
|
-
export default function Dropdown({ className, label, options, value, placeholder, disabled, required, searchable, searchPlaceholder, errorMessage, helpText, helpLink, helpLinkText, onChange, onSearch, multiSelect, grouped, align, onToggleChange, toggleLabel, isCreatable, dropdownTriggerClassName, dropdownMenuClassName, hideSelectedItems, labelTooltip, isTagsFields, unselect, ...props }: DropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
74
|
+
export default function Dropdown({ className, label, options, value, placeholder, disabled, required, searchable, searchPlaceholder, errorMessage, helpText, helpLink, helpLinkText, onChange, onSearch, multiSelect, grouped, align, onToggleChange, toggleLabel, isCreatable, dropdownTriggerClassName, dropdownMenuClassName, hideSelectedItems, labelTooltip, isTagsFields, unselect, selectedOptionLabel, selectedOptionsLabel, allOptionsSelectedLabel, ...props }: DropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
72
75
|
export {};
|
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
1
|
+
import { jsx as t, jsxs as v } from "react/jsx-runtime";
|
|
2
2
|
import { c as A } from "../../clsx-OuTLNxxd.js";
|
|
3
3
|
import * as m from "react";
|
|
4
|
-
import { useState as V, useRef as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { u as
|
|
12
|
-
import { c as
|
|
13
|
-
import { h as
|
|
14
|
-
import { u as
|
|
15
|
-
import { P as
|
|
16
|
-
import '../../assets/Dropdown.css';var
|
|
17
|
-
|
|
18
|
-
]),
|
|
4
|
+
import { useState as V, useRef as $, useEffect as W, useCallback as ne } from "react";
|
|
5
|
+
import j from "../Icon/Icon.js";
|
|
6
|
+
import no from "../Toggle/Toggle.js";
|
|
7
|
+
import de from "../Button/Button.js";
|
|
8
|
+
import ve from "../Ghost/Ghost.js";
|
|
9
|
+
import lo from "../Search/Search.js";
|
|
10
|
+
import so from "../Tooltip/Tooltip.js";
|
|
11
|
+
import { u as ao, c as co, d as he, P as be, a as U, g as io } from "../../index-DWydnyjJ.js";
|
|
12
|
+
import { c as De, R as po, A as ge, P as uo, D as _o, C as mo, a as fo } from "../../index-DieLVN0p.js";
|
|
13
|
+
import { h as wo, R as vo, u as ho, F as bo } from "../../index-BGZDIjm9.js";
|
|
14
|
+
import { u as Do } from "../../index-2H7slGYV.js";
|
|
15
|
+
import { P as Ce } from "../../index-DpfPnSMn.js";
|
|
16
|
+
import '../../assets/Dropdown.css';var Q = "Popover", [Ie, $t] = co(Q, [
|
|
17
|
+
De
|
|
18
|
+
]), K = De(), [go, B] = Ie(Q), Ne = (n) => {
|
|
19
19
|
const {
|
|
20
20
|
__scopePopover: p,
|
|
21
|
-
children:
|
|
21
|
+
children: c,
|
|
22
22
|
open: s,
|
|
23
23
|
defaultOpen: a,
|
|
24
24
|
onOpenChange: d,
|
|
25
25
|
modal: _ = !1
|
|
26
|
-
} = n, u =
|
|
26
|
+
} = n, u = K(p), R = m.useRef(null), [b, x] = m.useState(!1), [F, y] = ao({
|
|
27
27
|
prop: s,
|
|
28
28
|
defaultProp: a ?? !1,
|
|
29
29
|
onChange: d,
|
|
30
|
-
caller:
|
|
30
|
+
caller: Q
|
|
31
31
|
});
|
|
32
|
-
return /* @__PURE__ */ t(
|
|
33
|
-
|
|
32
|
+
return /* @__PURE__ */ t(po, { ...u, children: /* @__PURE__ */ t(
|
|
33
|
+
go,
|
|
34
34
|
{
|
|
35
35
|
scope: p,
|
|
36
|
-
contentId:
|
|
36
|
+
contentId: Do(),
|
|
37
37
|
triggerRef: R,
|
|
38
38
|
open: F,
|
|
39
39
|
onOpenChange: y,
|
|
40
|
-
onOpenToggle: m.useCallback(() => y((
|
|
40
|
+
onOpenToggle: m.useCallback(() => y((i) => !i), [y]),
|
|
41
41
|
hasCustomAnchor: b,
|
|
42
42
|
onCustomAnchorAdd: m.useCallback(() => x(!0), []),
|
|
43
43
|
onCustomAnchorRemove: m.useCallback(() => x(!1), []),
|
|
44
44
|
modal: _,
|
|
45
|
-
children:
|
|
45
|
+
children: c
|
|
46
46
|
}
|
|
47
47
|
) });
|
|
48
48
|
};
|
|
49
|
-
|
|
50
|
-
var
|
|
49
|
+
Ne.displayName = Q;
|
|
50
|
+
var Oe = "PopoverAnchor", Pe = m.forwardRef(
|
|
51
51
|
(n, p) => {
|
|
52
|
-
const { __scopePopover:
|
|
53
|
-
return m.useEffect(() => (_(), () => u()), [_, u]), /* @__PURE__ */ t(
|
|
52
|
+
const { __scopePopover: c, ...s } = n, a = B(Oe, c), d = K(c), { onCustomAnchorAdd: _, onCustomAnchorRemove: u } = a;
|
|
53
|
+
return m.useEffect(() => (_(), () => u()), [_, u]), /* @__PURE__ */ t(ge, { ...d, ...s, ref: p });
|
|
54
54
|
}
|
|
55
55
|
);
|
|
56
|
-
|
|
57
|
-
var
|
|
56
|
+
Pe.displayName = Oe;
|
|
57
|
+
var Ae = "PopoverTrigger", Re = m.forwardRef(
|
|
58
58
|
(n, p) => {
|
|
59
|
-
const { __scopePopover:
|
|
60
|
-
|
|
59
|
+
const { __scopePopover: c, ...s } = n, a = B(Ae, c), d = K(c), _ = he(p, a.triggerRef), u = /* @__PURE__ */ t(
|
|
60
|
+
be.button,
|
|
61
61
|
{
|
|
62
62
|
type: "button",
|
|
63
63
|
"aria-haspopup": "dialog",
|
|
64
64
|
"aria-expanded": a.open,
|
|
65
65
|
"aria-controls": a.contentId,
|
|
66
|
-
"data-state":
|
|
66
|
+
"data-state": Ee(a.open),
|
|
67
67
|
...s,
|
|
68
68
|
ref: _,
|
|
69
|
-
onClick:
|
|
69
|
+
onClick: U(n.onClick, a.onOpenToggle)
|
|
70
70
|
}
|
|
71
71
|
);
|
|
72
|
-
return a.hasCustomAnchor ? u : /* @__PURE__ */ t(
|
|
72
|
+
return a.hasCustomAnchor ? u : /* @__PURE__ */ t(ge, { asChild: !0, ...d, children: u });
|
|
73
73
|
}
|
|
74
74
|
);
|
|
75
|
-
|
|
76
|
-
var
|
|
75
|
+
Re.displayName = Ae;
|
|
76
|
+
var le = "PopoverPortal", [Co, Io] = Ie(le, {
|
|
77
77
|
forceMount: void 0
|
|
78
|
-
}),
|
|
79
|
-
const { __scopePopover: p, forceMount:
|
|
80
|
-
return /* @__PURE__ */ t(
|
|
78
|
+
}), ye = (n) => {
|
|
79
|
+
const { __scopePopover: p, forceMount: c, children: s, container: a } = n, d = B(le, p);
|
|
80
|
+
return /* @__PURE__ */ t(Co, { scope: p, forceMount: c, children: /* @__PURE__ */ t(Ce, { present: c || d.open, children: /* @__PURE__ */ t(uo, { asChild: !0, container: a, children: s }) }) });
|
|
81
81
|
};
|
|
82
|
-
|
|
83
|
-
var z = "PopoverContent",
|
|
82
|
+
ye.displayName = le;
|
|
83
|
+
var z = "PopoverContent", Le = m.forwardRef(
|
|
84
84
|
(n, p) => {
|
|
85
|
-
const
|
|
86
|
-
return /* @__PURE__ */ t(
|
|
85
|
+
const c = Io(z, n.__scopePopover), { forceMount: s = c.forceMount, ...a } = n, d = B(z, n.__scopePopover);
|
|
86
|
+
return /* @__PURE__ */ t(Ce, { present: s || d.open, children: d.modal ? /* @__PURE__ */ t(Oo, { ...a, ref: p }) : /* @__PURE__ */ t(Po, { ...a, ref: p }) });
|
|
87
87
|
}
|
|
88
88
|
);
|
|
89
|
-
|
|
90
|
-
var
|
|
89
|
+
Le.displayName = z;
|
|
90
|
+
var No = io("PopoverContent.RemoveScroll"), Oo = m.forwardRef(
|
|
91
91
|
(n, p) => {
|
|
92
|
-
const
|
|
92
|
+
const c = B(z, n.__scopePopover), s = m.useRef(null), a = he(p, s), d = m.useRef(!1);
|
|
93
93
|
return m.useEffect(() => {
|
|
94
94
|
const _ = s.current;
|
|
95
|
-
if (_) return
|
|
96
|
-
}, []), /* @__PURE__ */ t(
|
|
97
|
-
|
|
95
|
+
if (_) return wo(_);
|
|
96
|
+
}, []), /* @__PURE__ */ t(vo, { as: No, allowPinchZoom: !0, children: /* @__PURE__ */ t(
|
|
97
|
+
ke,
|
|
98
98
|
{
|
|
99
99
|
...n,
|
|
100
100
|
ref: a,
|
|
101
|
-
trapFocus:
|
|
101
|
+
trapFocus: c.open,
|
|
102
102
|
disableOutsidePointerEvents: !0,
|
|
103
|
-
onCloseAutoFocus:
|
|
103
|
+
onCloseAutoFocus: U(n.onCloseAutoFocus, (_) => {
|
|
104
104
|
var u;
|
|
105
|
-
_.preventDefault(), d.current || (u =
|
|
105
|
+
_.preventDefault(), d.current || (u = c.triggerRef.current) == null || u.focus();
|
|
106
106
|
}),
|
|
107
|
-
onPointerDownOutside:
|
|
107
|
+
onPointerDownOutside: U(
|
|
108
108
|
n.onPointerDownOutside,
|
|
109
109
|
(_) => {
|
|
110
110
|
const u = _.detail.originalEvent, R = u.button === 0 && u.ctrlKey === !0, b = u.button === 2 || R;
|
|
@@ -112,7 +112,7 @@ var bo = no("PopoverContent.RemoveScroll"), Do = m.forwardRef(
|
|
|
112
112
|
},
|
|
113
113
|
{ checkForDefaultPrevented: !1 }
|
|
114
114
|
),
|
|
115
|
-
onFocusOutside:
|
|
115
|
+
onFocusOutside: U(
|
|
116
116
|
n.onFocusOutside,
|
|
117
117
|
(_) => _.preventDefault(),
|
|
118
118
|
{ checkForDefaultPrevented: !1 }
|
|
@@ -120,11 +120,11 @@ var bo = no("PopoverContent.RemoveScroll"), Do = m.forwardRef(
|
|
|
120
120
|
}
|
|
121
121
|
) });
|
|
122
122
|
}
|
|
123
|
-
),
|
|
123
|
+
), Po = m.forwardRef(
|
|
124
124
|
(n, p) => {
|
|
125
|
-
const
|
|
125
|
+
const c = B(z, n.__scopePopover), s = m.useRef(!1), a = m.useRef(!1);
|
|
126
126
|
return /* @__PURE__ */ t(
|
|
127
|
-
|
|
127
|
+
ke,
|
|
128
128
|
{
|
|
129
129
|
...n,
|
|
130
130
|
ref: p,
|
|
@@ -132,21 +132,21 @@ var bo = no("PopoverContent.RemoveScroll"), Do = m.forwardRef(
|
|
|
132
132
|
disableOutsidePointerEvents: !1,
|
|
133
133
|
onCloseAutoFocus: (d) => {
|
|
134
134
|
var _, u;
|
|
135
|
-
(_ = n.onCloseAutoFocus) == null || _.call(n, d), d.defaultPrevented || (s.current || (u =
|
|
135
|
+
(_ = n.onCloseAutoFocus) == null || _.call(n, d), d.defaultPrevented || (s.current || (u = c.triggerRef.current) == null || u.focus(), d.preventDefault()), s.current = !1, a.current = !1;
|
|
136
136
|
},
|
|
137
137
|
onInteractOutside: (d) => {
|
|
138
138
|
var R, b;
|
|
139
139
|
(R = n.onInteractOutside) == null || R.call(n, d), d.defaultPrevented || (s.current = !0, d.detail.originalEvent.type === "pointerdown" && (a.current = !0));
|
|
140
140
|
const _ = d.target;
|
|
141
|
-
((b =
|
|
141
|
+
((b = c.triggerRef.current) == null ? void 0 : b.contains(_)) && d.preventDefault(), d.detail.originalEvent.type === "focusin" && a.current && d.preventDefault();
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
);
|
|
145
145
|
}
|
|
146
|
-
),
|
|
146
|
+
), ke = m.forwardRef(
|
|
147
147
|
(n, p) => {
|
|
148
148
|
const {
|
|
149
|
-
__scopePopover:
|
|
149
|
+
__scopePopover: c,
|
|
150
150
|
trapFocus: s,
|
|
151
151
|
onOpenAutoFocus: a,
|
|
152
152
|
onCloseAutoFocus: d,
|
|
@@ -156,9 +156,9 @@ var bo = no("PopoverContent.RemoveScroll"), Do = m.forwardRef(
|
|
|
156
156
|
onFocusOutside: b,
|
|
157
157
|
onInteractOutside: x,
|
|
158
158
|
...F
|
|
159
|
-
} = n, y = B(z,
|
|
160
|
-
return
|
|
161
|
-
|
|
159
|
+
} = n, y = B(z, c), i = K(c);
|
|
160
|
+
return ho(), /* @__PURE__ */ t(
|
|
161
|
+
bo,
|
|
162
162
|
{
|
|
163
163
|
asChild: !0,
|
|
164
164
|
loop: !0,
|
|
@@ -166,7 +166,7 @@ var bo = no("PopoverContent.RemoveScroll"), Do = m.forwardRef(
|
|
|
166
166
|
onMountAutoFocus: a,
|
|
167
167
|
onUnmountAutoFocus: d,
|
|
168
168
|
children: /* @__PURE__ */ t(
|
|
169
|
-
|
|
169
|
+
_o,
|
|
170
170
|
{
|
|
171
171
|
asChild: !0,
|
|
172
172
|
disableOutsidePointerEvents: _,
|
|
@@ -176,12 +176,12 @@ var bo = no("PopoverContent.RemoveScroll"), Do = m.forwardRef(
|
|
|
176
176
|
onFocusOutside: b,
|
|
177
177
|
onDismiss: () => y.onOpenChange(!1),
|
|
178
178
|
children: /* @__PURE__ */ t(
|
|
179
|
-
|
|
179
|
+
mo,
|
|
180
180
|
{
|
|
181
|
-
"data-state":
|
|
181
|
+
"data-state": Ee(y.open),
|
|
182
182
|
role: "dialog",
|
|
183
183
|
id: y.contentId,
|
|
184
|
-
...
|
|
184
|
+
...i,
|
|
185
185
|
...F,
|
|
186
186
|
ref: p,
|
|
187
187
|
style: {
|
|
@@ -199,93 +199,93 @@ var bo = no("PopoverContent.RemoveScroll"), Do = m.forwardRef(
|
|
|
199
199
|
}
|
|
200
200
|
);
|
|
201
201
|
}
|
|
202
|
-
),
|
|
202
|
+
), xe = "PopoverClose", Ao = m.forwardRef(
|
|
203
203
|
(n, p) => {
|
|
204
|
-
const { __scopePopover:
|
|
204
|
+
const { __scopePopover: c, ...s } = n, a = B(xe, c);
|
|
205
205
|
return /* @__PURE__ */ t(
|
|
206
|
-
|
|
206
|
+
be.button,
|
|
207
207
|
{
|
|
208
208
|
type: "button",
|
|
209
209
|
...s,
|
|
210
210
|
ref: p,
|
|
211
|
-
onClick:
|
|
211
|
+
onClick: U(n.onClick, () => a.onOpenChange(!1))
|
|
212
212
|
}
|
|
213
213
|
);
|
|
214
214
|
}
|
|
215
215
|
);
|
|
216
|
-
|
|
217
|
-
var
|
|
216
|
+
Ao.displayName = xe;
|
|
217
|
+
var Ro = "PopoverArrow", yo = m.forwardRef(
|
|
218
218
|
(n, p) => {
|
|
219
|
-
const { __scopePopover:
|
|
220
|
-
return /* @__PURE__ */ t(
|
|
219
|
+
const { __scopePopover: c, ...s } = n, a = K(c);
|
|
220
|
+
return /* @__PURE__ */ t(fo, { ...a, ...s, ref: p });
|
|
221
221
|
}
|
|
222
222
|
);
|
|
223
|
-
|
|
224
|
-
function
|
|
223
|
+
yo.displayName = Ro;
|
|
224
|
+
function Ee(n) {
|
|
225
225
|
return n ? "open" : "closed";
|
|
226
226
|
}
|
|
227
|
-
var
|
|
228
|
-
const
|
|
229
|
-
dropdownContainer:
|
|
230
|
-
dropdownLabel:
|
|
227
|
+
var Lo = Ne, ko = Pe, xo = Re, Eo = ye, Mo = Le;
|
|
228
|
+
const So = "Dropdown-module__dropdownContainer___beNhQ", Fo = "Dropdown-module__dropdownLabel___T9FmB", Vo = "Dropdown-module__dropdownLabelDisabled___SLRmM", Bo = "Dropdown-module__required___ChI1m", To = "Dropdown-module__dropdownWrapper___AUuWD", Wo = "Dropdown-module__dropdownTrigger___Rue93", Go = "Dropdown-module__dropdownTriggerDisabled___63wkd", zo = "Dropdown-module__dropdownTriggerOpen___cbm8V", qo = "Dropdown-module__dropdownTriggerError___Uu02x", Jo = "Dropdown-module__dropdownContent___zLMhL", $o = "Dropdown-module__dropdownSelectedItems___iXnpQ", jo = "Dropdown-module__selectedItemsCreatable___SCjLK", Uo = "Dropdown-module__selectedItem___2jO4z", Ko = "Dropdown-module__selectedItemLabel___efVI-", Xo = "Dropdown-module__removeButton___9r85B", Yo = "Dropdown-module__removeIcon___st3b-", Zo = "Dropdown-module__singleSelectedCreatableItem___BKFLb", Ho = "Dropdown-module__singleSelectedCreatableItemRemoveButton___w3XXp", Qo = "Dropdown-module__selectedOptionLabel___7Zdh3", et = "Dropdown-module__placeholder___fWdch", ot = "Dropdown-module__dropdownActions___d55Fa", tt = "Dropdown-module__dropdownArrow___dLbrb", rt = "Dropdown-module__dropdownArrowOpen___Z4Nh1", nt = "Dropdown-module__dropdownMenu___toYcy", dt = "Dropdown-module__dropdownMenuToolbar___gFne0", lt = "Dropdown-module__searchContainer___4kUvD", st = "Dropdown-module__search___JmgDx", at = "Dropdown-module__dropdownCreatableSearchContainer___sbs0F", ct = "Dropdown-module__disabled___0FjAX", it = "Dropdown-module__dropdownCreatableError___gwBGw", pt = "Dropdown-module__creatableInput___meKz6", ut = "Dropdown-module__optionsList___rk2hi", _t = "Dropdown-module__categoryGroup___Np2bP", mt = "Dropdown-module__categoryDivider___Gh6F0", ft = "Dropdown-module__categoryLabel___B9IDR", wt = "Dropdown-module__optionItem___7pi10", vt = "Dropdown-module__optionItemDisabled___aepUD", ht = "Dropdown-module__optionItemFocused___u2781", bt = "Dropdown-module__optionContent___nf1VC", Dt = "Dropdown-module__optionLabel___sJerM", gt = "Dropdown-module__tickIcon___hYdCr", Ct = "Dropdown-module__noOptions___8vmhM", It = "Dropdown-module__helpers___s4ulA", Nt = "Dropdown-module__helpText___YooJE", Ot = "Dropdown-module__helpTextDisabled___Ct4qq", Pt = "Dropdown-module__helpLink___-Zwpq", At = "Dropdown-module__helpLinkDisabled___r-opC", Rt = "Dropdown-module__errorMessage___3Mopi", yt = "Dropdown-module__selectAllContainer___Dlk3J", Lt = "Dropdown-module__actionButtons___-2nvr", o = {
|
|
229
|
+
dropdownContainer: So,
|
|
230
|
+
dropdownLabel: Fo,
|
|
231
231
|
"label-text": "Dropdown-module__label-text___VEqG-",
|
|
232
|
-
dropdownLabelDisabled:
|
|
232
|
+
dropdownLabelDisabled: Vo,
|
|
233
233
|
"label-tooltip-icon": "Dropdown-module__label-tooltip-icon___JYVOm",
|
|
234
|
-
required:
|
|
235
|
-
dropdownWrapper:
|
|
234
|
+
required: Bo,
|
|
235
|
+
dropdownWrapper: To,
|
|
236
236
|
"dropdown-menu-trigger": "Dropdown-module__dropdown-menu-trigger___fgqVT",
|
|
237
|
-
dropdownTrigger:
|
|
238
|
-
dropdownTriggerDisabled:
|
|
239
|
-
dropdownTriggerOpen:
|
|
240
|
-
dropdownTriggerError:
|
|
241
|
-
dropdownContent:
|
|
242
|
-
dropdownSelectedItems:
|
|
243
|
-
selectedItemsCreatable:
|
|
244
|
-
selectedItem:
|
|
245
|
-
selectedItemLabel:
|
|
246
|
-
removeButton:
|
|
247
|
-
removeIcon:
|
|
248
|
-
singleSelectedCreatableItem:
|
|
249
|
-
singleSelectedCreatableItemRemoveButton:
|
|
250
|
-
selectedOptionLabel:
|
|
251
|
-
placeholder:
|
|
252
|
-
dropdownActions:
|
|
253
|
-
dropdownArrow:
|
|
254
|
-
dropdownArrowOpen:
|
|
255
|
-
dropdownMenu:
|
|
237
|
+
dropdownTrigger: Wo,
|
|
238
|
+
dropdownTriggerDisabled: Go,
|
|
239
|
+
dropdownTriggerOpen: zo,
|
|
240
|
+
dropdownTriggerError: qo,
|
|
241
|
+
dropdownContent: Jo,
|
|
242
|
+
dropdownSelectedItems: $o,
|
|
243
|
+
selectedItemsCreatable: jo,
|
|
244
|
+
selectedItem: Uo,
|
|
245
|
+
selectedItemLabel: Ko,
|
|
246
|
+
removeButton: Xo,
|
|
247
|
+
removeIcon: Yo,
|
|
248
|
+
singleSelectedCreatableItem: Zo,
|
|
249
|
+
singleSelectedCreatableItemRemoveButton: Ho,
|
|
250
|
+
selectedOptionLabel: Qo,
|
|
251
|
+
placeholder: et,
|
|
252
|
+
dropdownActions: ot,
|
|
253
|
+
dropdownArrow: tt,
|
|
254
|
+
dropdownArrowOpen: rt,
|
|
255
|
+
dropdownMenu: nt,
|
|
256
256
|
"dropdown-container-grouped": "Dropdown-module__dropdown-container-grouped___1twhU",
|
|
257
257
|
"dropdown-container-multi-select": "Dropdown-module__dropdown-container-multi-select___zdaum",
|
|
258
|
-
dropdownMenuToolbar:
|
|
259
|
-
searchContainer:
|
|
260
|
-
search:
|
|
261
|
-
dropdownCreatableSearchContainer:
|
|
262
|
-
disabled:
|
|
263
|
-
dropdownCreatableError:
|
|
264
|
-
creatableInput:
|
|
265
|
-
optionsList:
|
|
266
|
-
categoryGroup:
|
|
267
|
-
categoryDivider:
|
|
268
|
-
categoryLabel:
|
|
269
|
-
optionItem:
|
|
270
|
-
optionItemDisabled:
|
|
271
|
-
optionItemFocused:
|
|
272
|
-
optionContent:
|
|
273
|
-
optionLabel:
|
|
274
|
-
tickIcon:
|
|
275
|
-
noOptions:
|
|
276
|
-
helpers:
|
|
277
|
-
helpText:
|
|
278
|
-
helpTextDisabled:
|
|
279
|
-
helpLink:
|
|
280
|
-
helpLinkDisabled:
|
|
281
|
-
errorMessage:
|
|
282
|
-
selectAllContainer:
|
|
283
|
-
actionButtons:
|
|
258
|
+
dropdownMenuToolbar: dt,
|
|
259
|
+
searchContainer: lt,
|
|
260
|
+
search: st,
|
|
261
|
+
dropdownCreatableSearchContainer: at,
|
|
262
|
+
disabled: ct,
|
|
263
|
+
dropdownCreatableError: it,
|
|
264
|
+
creatableInput: pt,
|
|
265
|
+
optionsList: ut,
|
|
266
|
+
categoryGroup: _t,
|
|
267
|
+
categoryDivider: mt,
|
|
268
|
+
categoryLabel: ft,
|
|
269
|
+
optionItem: wt,
|
|
270
|
+
optionItemDisabled: vt,
|
|
271
|
+
optionItemFocused: ht,
|
|
272
|
+
optionContent: bt,
|
|
273
|
+
optionLabel: Dt,
|
|
274
|
+
tickIcon: gt,
|
|
275
|
+
noOptions: Ct,
|
|
276
|
+
helpers: It,
|
|
277
|
+
helpText: Nt,
|
|
278
|
+
helpTextDisabled: Ot,
|
|
279
|
+
helpLink: Pt,
|
|
280
|
+
helpLinkDisabled: At,
|
|
281
|
+
errorMessage: Rt,
|
|
282
|
+
selectAllContainer: yt,
|
|
283
|
+
actionButtons: Lt
|
|
284
284
|
};
|
|
285
|
-
function
|
|
285
|
+
function jt({
|
|
286
286
|
className: n,
|
|
287
287
|
label: p,
|
|
288
|
-
options:
|
|
288
|
+
options: c,
|
|
289
289
|
value: s = [],
|
|
290
290
|
placeholder: a = "Select options...",
|
|
291
291
|
disabled: d = !1,
|
|
@@ -296,212 +296,212 @@ function Gt({
|
|
|
296
296
|
helpText: x,
|
|
297
297
|
helpLink: F,
|
|
298
298
|
helpLinkText: y,
|
|
299
|
-
onChange:
|
|
299
|
+
onChange: i,
|
|
300
300
|
onSearch: E,
|
|
301
301
|
multiSelect: D = !1,
|
|
302
|
-
grouped:
|
|
303
|
-
align:
|
|
304
|
-
onToggleChange:
|
|
305
|
-
toggleLabel:
|
|
302
|
+
grouped: Me = !1,
|
|
303
|
+
align: se = "left",
|
|
304
|
+
onToggleChange: X,
|
|
305
|
+
toggleLabel: Se,
|
|
306
306
|
isCreatable: g = !1,
|
|
307
|
-
dropdownTriggerClassName:
|
|
308
|
-
dropdownMenuClassName:
|
|
309
|
-
hideSelectedItems:
|
|
307
|
+
dropdownTriggerClassName: Fe,
|
|
308
|
+
dropdownMenuClassName: Ve,
|
|
309
|
+
hideSelectedItems: Be = !1,
|
|
310
310
|
labelTooltip: T,
|
|
311
311
|
isTagsFields: C = !1,
|
|
312
|
-
unselect:
|
|
313
|
-
|
|
312
|
+
unselect: Y = !1,
|
|
313
|
+
selectedOptionLabel: Te = " option selected",
|
|
314
|
+
selectedOptionsLabel: We = " options selected",
|
|
315
|
+
allOptionsSelectedLabel: Z,
|
|
316
|
+
...ee
|
|
314
317
|
}) {
|
|
315
|
-
const [f, M] = V(s), [O, P] = V(!1), [L, I] = V(""), [q,
|
|
318
|
+
const [f, M] = V(s), [O, P] = V(!1), [L, I] = V(""), [q, w] = V(-1), [S, k] = V([]), Ge = $(null), ae = $(null), ce = $(null), J = $(null), [ie, ze] = V(0), [qe, Je] = V(0), [$e, je] = V(s.length > 0 ? s.join(", ") : a ?? ""), pe = $(s);
|
|
316
319
|
W(() => {
|
|
317
|
-
JSON.stringify(
|
|
320
|
+
JSON.stringify(pe.current) !== JSON.stringify(s) && (M(s), pe.current = s);
|
|
318
321
|
}, [s]), W(() => {
|
|
319
322
|
var r;
|
|
320
|
-
const e = (r =
|
|
321
|
-
e &&
|
|
323
|
+
const e = (r = ae.current) == null ? void 0 : r.getBoundingClientRect().width;
|
|
324
|
+
e && ze(e);
|
|
322
325
|
}, []), W(() => {
|
|
323
326
|
var r;
|
|
324
|
-
const e = (r =
|
|
325
|
-
e &&
|
|
327
|
+
const e = (r = ce.current) == null ? void 0 : r.getBoundingClientRect().width;
|
|
328
|
+
e && Je(e);
|
|
326
329
|
}, []), W(() => {
|
|
327
330
|
O && k([...f]);
|
|
328
331
|
}, [O, f]);
|
|
329
|
-
const N =
|
|
332
|
+
const N = c.filter((e) => e.label.toLowerCase().includes(L.toLowerCase()));
|
|
330
333
|
W(() => {
|
|
331
|
-
|
|
334
|
+
je(s.length > 0 ? s.join(", ") : a ?? "");
|
|
332
335
|
}, [s, a]), W(() => {
|
|
333
336
|
O && (u || g || C) && J.current && J.current.focus();
|
|
334
337
|
}, [O, u, g, C]);
|
|
335
|
-
const
|
|
336
|
-
P(e), e ? (k([...f]), I(""),
|
|
337
|
-
},
|
|
338
|
+
const Ue = (e) => {
|
|
339
|
+
P(e), e ? (k([...f]), I(""), w(-1)) : (I(""), w(-1), k([]));
|
|
340
|
+
}, oe = ne((e) => {
|
|
338
341
|
if (e.disabled) return;
|
|
339
342
|
let r = [];
|
|
340
343
|
if (D)
|
|
341
344
|
r = S.includes(e.value) ? S.filter((l) => l !== e.value) : [...S, e.value];
|
|
342
345
|
else {
|
|
343
346
|
if (f.includes(e.value))
|
|
344
|
-
if (
|
|
347
|
+
if (Y)
|
|
345
348
|
r = [];
|
|
346
349
|
else
|
|
347
350
|
return;
|
|
348
351
|
else
|
|
349
352
|
r = [e.value];
|
|
350
|
-
M(r),
|
|
353
|
+
M(r), i == null || i(r), P(!1), I(""), w(-1), k([]);
|
|
351
354
|
return;
|
|
352
355
|
}
|
|
353
356
|
k(r);
|
|
354
|
-
}, [D,
|
|
355
|
-
M(S),
|
|
356
|
-
},
|
|
357
|
-
P(!1), I(""),
|
|
358
|
-
},
|
|
359
|
-
I(e),
|
|
360
|
-
},
|
|
357
|
+
}, [D, i, S, f, Y]), Ke = () => {
|
|
358
|
+
M(S), i == null || i(S), P(!1), I(""), w(-1), k([]);
|
|
359
|
+
}, Xe = () => {
|
|
360
|
+
P(!1), I(""), w(-1), k([]);
|
|
361
|
+
}, Ye = (e) => {
|
|
362
|
+
I(e), w(-1), E == null || E(e);
|
|
363
|
+
}, Ze = ne((e) => {
|
|
361
364
|
const r = {
|
|
362
365
|
value: e,
|
|
363
366
|
label: e,
|
|
364
367
|
disabled: !1
|
|
365
368
|
};
|
|
366
|
-
if (
|
|
369
|
+
if (c.push(r), D) {
|
|
367
370
|
const G = f.includes(e) ? f : [...f, e];
|
|
368
|
-
M(G),
|
|
371
|
+
M(G), i == null || i(G), I(""), P(!0), w(-1);
|
|
369
372
|
} else {
|
|
370
373
|
const l = [e];
|
|
371
|
-
M(l),
|
|
374
|
+
M(l), i == null || i(l), I(""), P(!1), w(-1);
|
|
372
375
|
}
|
|
373
|
-
}, [D,
|
|
376
|
+
}, [D, i, c, f]), te = ne((e) => {
|
|
374
377
|
if (!e.disabled)
|
|
375
378
|
if (D) {
|
|
376
379
|
const l = f.includes(e.value) ? f.filter((G) => G !== e.value) : [...f, e.value];
|
|
377
|
-
M(l),
|
|
380
|
+
M(l), i == null || i(l), P(!0), I(""), w(-1);
|
|
378
381
|
} else if (f.includes(e.value)) {
|
|
379
|
-
if (
|
|
382
|
+
if (Y) {
|
|
380
383
|
const r = [];
|
|
381
|
-
M(r),
|
|
384
|
+
M(r), i == null || i(r), P(!1), I(""), w(-1);
|
|
382
385
|
}
|
|
383
386
|
} else {
|
|
384
387
|
const r = [e.value];
|
|
385
|
-
M(r),
|
|
388
|
+
M(r), i == null || i(r), P(!1), I(""), w(-1);
|
|
386
389
|
}
|
|
387
|
-
}, [D,
|
|
388
|
-
P(!0), I(e),
|
|
389
|
-
}, pe = (e) => {
|
|
390
|
-
P(!0), I(e), v(-1), E == null || E(e);
|
|
391
|
-
}, Xe = (e) => {
|
|
392
|
-
Y == null || Y(e);
|
|
390
|
+
}, [D, i, f, Y]), He = (e) => {
|
|
391
|
+
P(!0), I(e), w(-1), E == null || E(e);
|
|
393
392
|
}, ue = (e) => {
|
|
393
|
+
P(!0), I(e), w(-1), E == null || E(e);
|
|
394
|
+
}, Qe = (e) => {
|
|
395
|
+
X == null || X(e);
|
|
396
|
+
}, _e = (e) => {
|
|
394
397
|
const r = f.filter((l) => l !== e);
|
|
395
|
-
M(r),
|
|
398
|
+
M(r), i == null || i(r);
|
|
396
399
|
};
|
|
397
400
|
W(() => {
|
|
398
401
|
const e = (r) => {
|
|
399
402
|
if (O)
|
|
400
403
|
switch (r.key) {
|
|
401
404
|
case "ArrowDown":
|
|
402
|
-
r.preventDefault(),
|
|
405
|
+
r.preventDefault(), w((l) => l < N.length - 1 ? l + 1 : 0);
|
|
403
406
|
break;
|
|
404
407
|
case "ArrowUp":
|
|
405
|
-
r.preventDefault(),
|
|
408
|
+
r.preventDefault(), w((l) => l > 0 ? l - 1 : N.length - 1);
|
|
406
409
|
break;
|
|
407
410
|
case "Enter":
|
|
408
411
|
if (r.preventDefault(), q >= 0 && q < N.length) {
|
|
409
412
|
const l = N[q];
|
|
410
|
-
g || C ?
|
|
413
|
+
g || C ? te(l) : oe(l);
|
|
411
414
|
}
|
|
412
415
|
break;
|
|
413
416
|
case "Escape":
|
|
414
|
-
r.preventDefault(), P(!1), I(""),
|
|
417
|
+
r.preventDefault(), P(!1), I(""), w(-1), k([]);
|
|
415
418
|
break;
|
|
416
419
|
}
|
|
417
420
|
};
|
|
418
421
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
419
|
-
}, [O, q, N, g, C,
|
|
420
|
-
const
|
|
422
|
+
}, [O, q, N, g, C, te, oe]);
|
|
423
|
+
const H = g || C ? f : O ? S : f, h = c.filter((e) => H.includes(e.value)), me = !!b, eo = JSON.stringify(S) !== JSON.stringify(f), fe = c.filter((e) => !e.disabled), we = fe.length > 0 && fe.every((e) => H.includes(e.value)), oo = N.reduce((e, r) => {
|
|
421
424
|
const l = r.category || "default";
|
|
422
425
|
return e[l] || (e[l] = []), e[l].push(r), e;
|
|
423
|
-
}, {}),
|
|
424
|
-
return /* @__PURE__ */
|
|
425
|
-
p && /* @__PURE__ */
|
|
426
|
+
}, {}), to = N;
|
|
427
|
+
return /* @__PURE__ */ v("div", { ref: Ge, className: A(o.dropdownContainer, Me && o["dropdown-container-grouped"], D && o["dropdown-container-multi-select"], n), ...ee, children: [
|
|
428
|
+
p && /* @__PURE__ */ v("label", { className: A(o.dropdownLabel, d && o.dropdownLabelDisabled), children: [
|
|
426
429
|
/* @__PURE__ */ t("span", { title: p, className: o["label-text"], children: p }),
|
|
427
430
|
_ && /* @__PURE__ */ t("span", { className: o.required, children: "*" }),
|
|
428
|
-
T && /* @__PURE__ */ t(
|
|
431
|
+
T && /* @__PURE__ */ t(so, { content: T.content, size: T.size, theme: T.theme, tipSide: T.tipSide, tipAlignment: T.tipAlignment, startVisible: T.startVisible, children: /* @__PURE__ */ t(j, { icon: "ap-icon-info", className: o["label-tooltip-icon"] }) })
|
|
429
432
|
] }),
|
|
430
|
-
/* @__PURE__ */ t(
|
|
431
|
-
!g && !C && /* @__PURE__ */ t(
|
|
432
|
-
!
|
|
433
|
+
/* @__PURE__ */ t(Lo, { open: O, onOpenChange: Ue, children: /* @__PURE__ */ v("div", { className: o.dropdownWrapper, children: [
|
|
434
|
+
!g && !C && /* @__PURE__ */ t(xo, { disabled: d, className: A(o["dropdown-menu-trigger"], o.dropdownTrigger, Fe, O && o.dropdownTriggerOpen, d && o.dropdownTriggerDisabled, me && o.dropdownTriggerError), ref: ae, ...ee, children: /* @__PURE__ */ v("div", { className: o.dropdownContent, children: [
|
|
435
|
+
!Be && /* @__PURE__ */ t("div", { className: o.dropdownSelectedItems, children: h.length > 0 ? D ? we && Z ? Z : h.length === 1 ? `${h.length}${Te}` : `${h.length}${We}` : (
|
|
433
436
|
// For single select, show the selected option label
|
|
434
437
|
/* @__PURE__ */ t("span", { className: o.selectedOptionLabel, children: h[0].label })
|
|
435
|
-
) : /* @__PURE__ */ t("span", { title:
|
|
436
|
-
/* @__PURE__ */ t("div", { className: o.dropdownActions, children: /* @__PURE__ */ t(
|
|
438
|
+
) : /* @__PURE__ */ t("span", { title: $e, className: o.placeholder, children: a }) }),
|
|
439
|
+
/* @__PURE__ */ t("div", { className: o.dropdownActions, children: /* @__PURE__ */ t(j, { icon: "ap-icon-expand-more", className: A(o.dropdownArrow, O && o.dropdownArrowOpen) }) })
|
|
437
440
|
] }) }),
|
|
438
|
-
(g || C) && /* @__PURE__ */ t(
|
|
441
|
+
(g || C) && /* @__PURE__ */ t(ko, { children: /* @__PURE__ */ v("div", { ref: ce, className: A(o.dropdownCreatableSearchContainer, d && o.disabled, me && o.dropdownCreatableError), onClick: () => {
|
|
439
442
|
var e;
|
|
440
443
|
if (!D && h.length > 0)
|
|
441
|
-
return
|
|
444
|
+
return ue("");
|
|
442
445
|
(e = J.current) == null || e.focus();
|
|
443
|
-
}, ...
|
|
444
|
-
h.length > 0 && /* @__PURE__ */ t("div", { className: A(o.selectedItemsCreatable), children: D ? h.length > 3 ? /* @__PURE__ */ t("div", { className: o.selectedItem, children: /* @__PURE__ */
|
|
445
|
-
h.length,
|
|
446
|
-
" options selected"
|
|
447
|
-
] }) }) : h.map((e) => /* @__PURE__ */ w("div", { className: o.selectedItem, children: [
|
|
446
|
+
}, ...ee, children: [
|
|
447
|
+
h.length > 0 && /* @__PURE__ */ t("div", { className: A(o.selectedItemsCreatable), children: D ? h.length > 3 ? /* @__PURE__ */ t("div", { className: o.selectedItem, children: /* @__PURE__ */ t("span", { className: o.selectedItemLabel, children: we && Z ? Z : `${h.length} options selected` }) }) : h.map((e) => /* @__PURE__ */ v("div", { className: o.selectedItem, children: [
|
|
448
448
|
/* @__PURE__ */ t("span", { className: o.selectedItemLabel, children: e.label }),
|
|
449
|
-
/* @__PURE__ */ t("button", { type: "button", className: o.removeButton, onClick: () =>
|
|
450
|
-
] }, e.value)) : h.length > 0 && /* @__PURE__ */
|
|
449
|
+
/* @__PURE__ */ t("button", { type: "button", className: o.removeButton, onClick: () => _e(e.value), disabled: d, children: /* @__PURE__ */ t(j, { icon: "ap-icon-close", className: o.removeIcon }) })
|
|
450
|
+
] }, e.value)) : h.length > 0 && /* @__PURE__ */ v("div", { className: o.singleSelectedCreatableItem, children: [
|
|
451
451
|
/* @__PURE__ */ t("span", { className: o.selectedItemLabel, children: h[0].label }),
|
|
452
|
-
/* @__PURE__ */ t(
|
|
452
|
+
/* @__PURE__ */ t(de, { type: "tertiary", variant: "default", size: "sm", onClick: () => _e(h[0].value), disabled: d, icon: "ap-icon-add-filled", className: o.singleSelectedCreatableItemRemoveButton })
|
|
453
453
|
] }) }),
|
|
454
|
-
(D || !h.length) && /* @__PURE__ */ t("input", { ref: J, placeholder: h.length > 0 ? "" : R, value: L, onChange: (e) =>
|
|
455
|
-
/* @__PURE__ */ t("div", { className: o.dropdownActions, children: /* @__PURE__ */ t(
|
|
454
|
+
(D || !h.length) && /* @__PURE__ */ t("input", { ref: J, placeholder: h.length > 0 ? "" : R, value: L, onChange: (e) => He(e.target.value), onFocus: (e) => ue(e.target.value), disabled: d, className: o.creatableInput }),
|
|
455
|
+
/* @__PURE__ */ t("div", { className: o.dropdownActions, children: /* @__PURE__ */ t(j, { icon: "ap-icon-expand-more", className: A(o.dropdownArrow, O && o.dropdownArrowOpen) }) })
|
|
456
456
|
] }) }),
|
|
457
|
-
/* @__PURE__ */ t(
|
|
458
|
-
minWidth:
|
|
457
|
+
/* @__PURE__ */ t(Eo, { children: /* @__PURE__ */ t(Mo, { align: se === "right" ? "end" : "start", side: "bottom", avoidCollisions: !0, sideOffset: 6, collisionPadding: 8, style: {
|
|
458
|
+
minWidth: ie,
|
|
459
459
|
zIndex: 9999
|
|
460
460
|
}, onInteractOutside: (e) => {
|
|
461
461
|
e.target === J.current && e.preventDefault();
|
|
462
|
-
}, children: O && /* @__PURE__ */
|
|
463
|
-
minWidth: g || C ?
|
|
464
|
-
}, className: A(o.dropdownMenu,
|
|
465
|
-
!g && !C && (u || D) && /* @__PURE__ */
|
|
466
|
-
u && /* @__PURE__ */
|
|
467
|
-
/* @__PURE__ */ t(
|
|
468
|
-
|
|
462
|
+
}, children: O && /* @__PURE__ */ v("div", { style: {
|
|
463
|
+
minWidth: g || C ? qe : ie
|
|
464
|
+
}, className: A(o.dropdownMenu, Ve, se === "right" && o.dropdownMenuRight), children: [
|
|
465
|
+
!g && !C && (u || D) && /* @__PURE__ */ v("div", { className: o.dropdownMenuToolbar, children: [
|
|
466
|
+
u && /* @__PURE__ */ v("div", { className: o.searchContainer, children: [
|
|
467
|
+
/* @__PURE__ */ t(lo, { placeholder: R, value: L, onChange: Ye, className: o.search }),
|
|
468
|
+
X && /* @__PURE__ */ t(no, { label: Se, onChange: Qe })
|
|
469
469
|
] }),
|
|
470
|
-
D && !g && !C && /* @__PURE__ */
|
|
471
|
-
/* @__PURE__ */ t(
|
|
470
|
+
D && !g && !C && /* @__PURE__ */ v("div", { className: o.selectAllContainer, children: [
|
|
471
|
+
/* @__PURE__ */ t(ve, { variant: "default", noIcon: !0, onClick: () => {
|
|
472
472
|
const e = N.filter((r) => !r.disabled).map((r) => r.value);
|
|
473
473
|
k(e);
|
|
474
474
|
}, disabled: N.filter((e) => !e.disabled).length === 0, children: "Select all" }),
|
|
475
|
-
/* @__PURE__ */ t(
|
|
475
|
+
/* @__PURE__ */ t(ve, { variant: "default", noIcon: !0, onClick: () => k([]), disabled: S.length === 0, children: "Deselect all" })
|
|
476
476
|
] })
|
|
477
477
|
] }),
|
|
478
|
-
/* @__PURE__ */
|
|
479
|
-
N.length > 0 ? Object.entries(
|
|
478
|
+
/* @__PURE__ */ v("div", { className: o.optionsList, "data-dropdown-options-list": !0, children: [
|
|
479
|
+
N.length > 0 ? Object.entries(oo).map(([e, r]) => /* @__PURE__ */ v("div", { className: o.categoryGroup, children: [
|
|
480
480
|
e !== "default" && /* @__PURE__ */ t("div", { className: o.categoryDivider, children: /* @__PURE__ */ t("span", { className: o.categoryLabel, children: e }) }),
|
|
481
481
|
r.map((l) => {
|
|
482
|
-
const G =
|
|
483
|
-
return /* @__PURE__ */ t("button", { title: (
|
|
482
|
+
const G = to.indexOf(l), re = N.find((ro) => ro.value === l.value);
|
|
483
|
+
return /* @__PURE__ */ t("button", { title: (re == null ? void 0 : re.label) || l.label, type: "button", className: A(o.optionItem, H.includes(l.value) && o.optionItemSelected, l.disabled && o.optionItemDisabled, G === q && o.optionItemFocused), onClick: () => g || C ? te(l) : oe(l), disabled: l.disabled, "data-dropdown-option-item": !0, children: /* @__PURE__ */ v("div", { className: o.optionContent, children: [
|
|
484
484
|
/* @__PURE__ */ t("span", { className: o.optionLabel, children: l.label }),
|
|
485
|
-
|
|
485
|
+
H.includes(l.value) && /* @__PURE__ */ t(j, { icon: "ap-icon-check", className: o.tickIcon })
|
|
486
486
|
] }) }, l.value);
|
|
487
487
|
})
|
|
488
488
|
] }, e)) : null,
|
|
489
|
-
g && L !== "" && !N.find((e) => e.label === L) && /* @__PURE__ */ t("button", { type: "button", className: A(o.optionItem, o.optionItemCreatable), title: L ? `Create "${L}"` : "Create new option", onClick: () =>
|
|
489
|
+
g && L !== "" && !N.find((e) => e.label === L) && /* @__PURE__ */ t("button", { type: "button", className: A(o.optionItem, o.optionItemCreatable), title: L ? `Create "${L}"` : "Create new option", onClick: () => Ze(L), children: /* @__PURE__ */ t("div", { className: o.optionContent, children: /* @__PURE__ */ t("span", { className: o.optionLabel, children: L ? `Create "${L}"` : "Create new option" }) }) }),
|
|
490
490
|
N.length === 0 && !g && !C && /* @__PURE__ */ t("div", { className: o.noOptions, children: "No options found" }),
|
|
491
491
|
N.length === 0 && C && /* @__PURE__ */ t("div", { className: o.noOptions, children: "No options found" })
|
|
492
492
|
] }),
|
|
493
|
-
D && !g && !C && /* @__PURE__ */
|
|
494
|
-
/* @__PURE__ */ t(
|
|
495
|
-
/* @__PURE__ */ t(
|
|
493
|
+
D && !g && !C && /* @__PURE__ */ v("div", { className: o.actionButtons, children: [
|
|
494
|
+
/* @__PURE__ */ t(de, { type: "primary", variant: "cancel", size: "md", onClick: Xe, children: "Cancel" }),
|
|
495
|
+
/* @__PURE__ */ t(de, { type: "primary", variant: "default", size: "md", onClick: Ke, disabled: !eo, children: "Apply" })
|
|
496
496
|
] })
|
|
497
497
|
] }) }) })
|
|
498
498
|
] }) }),
|
|
499
|
-
(b || x || F && y) && /* @__PURE__ */
|
|
499
|
+
(b || x || F && y) && /* @__PURE__ */ v("div", { className: o.helpers, children: [
|
|
500
500
|
b ? /* @__PURE__ */ t("span", { title: b, className: o.errorMessage, children: b }) : x && /* @__PURE__ */ t("span", { title: x, className: A(o.helpText, d && o.helpTextDisabled), children: x }),
|
|
501
501
|
F && y && /* @__PURE__ */ t("a", { href: F, className: A(o.helpLink, d && o.helpLinkDisabled), target: "_blank", rel: "noopener noreferrer", children: y })
|
|
502
502
|
] })
|
|
503
503
|
] });
|
|
504
504
|
}
|
|
505
505
|
export {
|
|
506
|
-
|
|
506
|
+
jt as default
|
|
507
507
|
};
|
|
@@ -31,4 +31,4 @@ export type TooltipProps = {
|
|
|
31
31
|
* @param {() => void} [props.onClose] - Callback fired when the tooltip is closed (only available for 'md' size)
|
|
32
32
|
* @returns {JSX.Element} The rendered Tooltip component
|
|
33
33
|
*/
|
|
34
|
-
export default function Tooltip({ children, content, size, theme, tipSide, tipAlignment, keepVisible, startVisible, onClose, className }: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export default function Tooltip({ children, content, size, theme, tipSide, tipAlignment, keepVisible, startVisible, onClose, className, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as u, jsxs as k } from "react/jsx-runtime";
|
|
2
2
|
import * as i from "react";
|
|
3
|
-
import { useState as
|
|
3
|
+
import { useState as Z } from "react";
|
|
4
4
|
import { c as j } from "../../clsx-OuTLNxxd.js";
|
|
5
5
|
import ee from "../Icon/Icon.js";
|
|
6
6
|
import { P as G, c as te, u as oe, d as F, a as C, h as re } from "../../index-DWydnyjJ.js";
|
|
@@ -157,7 +157,7 @@ q.displayName = M;
|
|
|
157
157
|
var b = "TooltipContent", W = i.forwardRef(
|
|
158
158
|
(t, o) => {
|
|
159
159
|
const e = Te(b, t.__scopeTooltip), { forceMount: r = e.forceMount, side: n = "top", ...s } = t, a = O(b, t.__scopeTooltip);
|
|
160
|
-
return /* @__PURE__ */ u(K, { present: r || a.open, children: a.disableHoverableContent ? /* @__PURE__ */ u(
|
|
160
|
+
return /* @__PURE__ */ u(K, { present: r || a.open, children: a.disableHoverableContent ? /* @__PURE__ */ u(z, { side: n, ...s, ref: o }) : /* @__PURE__ */ u(ye, { side: n, ...s, ref: o }) });
|
|
161
161
|
}
|
|
162
162
|
), ye = i.forwardRef((t, o) => {
|
|
163
163
|
const e = O(b, t.__scopeTooltip), r = I(b, t.__scopeTooltip), n = i.useRef(null), s = F(o, n), [a, h] = i.useState(null), { trigger: l, onClose: f } = e, c = n.current, { onPointerInTransitChange: d } = r, v = i.useCallback(() => {
|
|
@@ -184,8 +184,8 @@ var b = "TooltipContent", W = i.forwardRef(
|
|
|
184
184
|
};
|
|
185
185
|
return document.addEventListener("pointermove", m), () => document.removeEventListener("pointermove", m);
|
|
186
186
|
}
|
|
187
|
-
}, [l, c, a, f, v]), /* @__PURE__ */ u(
|
|
188
|
-
}), [xe, ge] = D(R, { isInside: !1 }), Ce = re("TooltipContent"),
|
|
187
|
+
}, [l, c, a, f, v]), /* @__PURE__ */ u(z, { ...t, ref: s });
|
|
188
|
+
}), [xe, ge] = D(R, { isInside: !1 }), Ce = re("TooltipContent"), z = i.forwardRef(
|
|
189
189
|
(t, o) => {
|
|
190
190
|
const {
|
|
191
191
|
__scopeTooltip: e,
|
|
@@ -238,16 +238,16 @@ var b = "TooltipContent", W = i.forwardRef(
|
|
|
238
238
|
}
|
|
239
239
|
);
|
|
240
240
|
W.displayName = b;
|
|
241
|
-
var
|
|
241
|
+
var J = "TooltipArrow", Q = i.forwardRef(
|
|
242
242
|
(t, o) => {
|
|
243
243
|
const { __scopeTooltip: e, ...r } = t, n = L(e);
|
|
244
244
|
return ge(
|
|
245
|
-
|
|
245
|
+
J,
|
|
246
246
|
e
|
|
247
247
|
).isInside ? null : /* @__PURE__ */ u(se, { ...n, ...r, ref: o });
|
|
248
248
|
}
|
|
249
249
|
);
|
|
250
|
-
|
|
250
|
+
Q.displayName = J;
|
|
251
251
|
function be(t, o) {
|
|
252
252
|
const e = Math.abs(o.top - t.y), r = Math.abs(o.bottom - t.y), n = Math.abs(o.right - t.x), s = Math.abs(o.left - t.x);
|
|
253
253
|
switch (Math.min(e, r, n, s)) {
|
|
@@ -340,7 +340,7 @@ function Oe(t) {
|
|
|
340
340
|
}
|
|
341
341
|
return e.pop(), o.length === 1 && e.length === 1 && o[0].x === e[0].x && o[0].y === e[0].y ? o : o.concat(e);
|
|
342
342
|
}
|
|
343
|
-
var De = $, Le = Y, ke = X, Ae = q, Ne = W, Ie =
|
|
343
|
+
var De = $, Le = Y, ke = X, Ae = q, Ne = W, Ie = Q;
|
|
344
344
|
const Me = "Tooltip-module__tooltip___LjRUX", Se = "Tooltip-module__closable___MjoEb", y = {
|
|
345
345
|
"tooltip-container": "Tooltip-module__tooltip-container___X4jVa",
|
|
346
346
|
tooltip: Me,
|
|
@@ -370,7 +370,7 @@ function Ye({
|
|
|
370
370
|
onClose: l,
|
|
371
371
|
className: f
|
|
372
372
|
}) {
|
|
373
|
-
const [c, d] =
|
|
373
|
+
const [c, d] = Z(h), v = () => {
|
|
374
374
|
d(!1);
|
|
375
375
|
}, p = (_) => {
|
|
376
376
|
_.key === "Escape" && d(!1);
|
|
@@ -385,7 +385,9 @@ function Ye({
|
|
|
385
385
|
alignItems: "center",
|
|
386
386
|
justifyContent: "center"
|
|
387
387
|
}, className: y["tooltip-trigger"], children: t }) }),
|
|
388
|
-
/* @__PURE__ */ u(Ae, { children: /* @__PURE__ */ u(Ne, {
|
|
388
|
+
/* @__PURE__ */ u(Ae, { children: /* @__PURE__ */ u(Ne, { style: {
|
|
389
|
+
zIndex: 9999
|
|
390
|
+
}, align: s, side: n, sideOffset: 0, children: /* @__PURE__ */ k("div", { id: "tooltip", role: "tooltip", className: j(y.tooltip, y[`tooltip-${e}`], y[`tooltip-${r}`], y[`tooltip-${n}`], y[`tooltip-${s}`], l && y.closable), children: [
|
|
389
391
|
/* @__PURE__ */ u("div", { className: y["tooltip-content"], children: o }),
|
|
390
392
|
(l || a) && e === "md" && /* @__PURE__ */ u("button", { className: y["tooltip-close-button"], onClick: v, children: /* @__PURE__ */ u(ee, { icon: "ap-icon-close", className: y["tooltip-close-icon"] }) }),
|
|
391
393
|
/* @__PURE__ */ u(Ie, { width: 12, height: 6, className: y["tooltip-arrow"] })
|