@alixpartners/ui-components 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ToastProvider-D5LImZ-Q.js +1136 -0
- package/dist/assets/Creatable.css +1 -1
- package/dist/assets/Dialog.css +1 -1
- package/dist/assets/Dropdown.css +1 -1
- package/dist/assets/FilePicker.css +1 -1
- package/dist/assets/NavBar.css +1 -1
- package/dist/assets/SplitButton.css +1 -1
- package/dist/assets/TagsFields.css +1 -1
- package/dist/assets/Tooltip.css +1 -1
- package/dist/components/Banner/Banner.test.js +1 -1
- package/dist/components/Button/Button.test.js +124 -3217
- package/dist/components/Checkbox/Checkbox.js +7 -6
- package/dist/components/Checkbox/Checkbox.test.js +47 -47
- package/dist/components/Creatable/Creatable.js +107 -108
- package/dist/components/Dialog/Dialog.d.ts +21 -7
- package/dist/components/Dialog/Dialog.js +296 -61
- package/dist/components/Dialog/Dialog.test.d.ts +1 -0
- package/dist/components/Dialog/Dialog.test.js +368 -0
- package/dist/components/Dropdown/Dropdown.js +78 -79
- package/dist/components/FilePicker/FilePicker.js +6 -6
- package/dist/components/FilePicker/FilePicker.test.js +1 -1
- package/dist/components/Ghost/Ghost.test.js +6 -6
- package/dist/components/Input/Input.test.js +2 -2
- package/dist/components/NavBar/NavBar.js +16 -16
- package/dist/components/Radio/Radio.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.test.js +1 -1
- package/dist/components/Search/Search.test.js +1 -1
- package/dist/components/SplitButton/SplitButton.js +8 -9
- package/dist/components/SplitButton/SplitButton.test.js +1 -1
- package/dist/components/Tag/Tag.test.js +1 -1
- package/dist/components/TagsFields/TagsFields.js +3 -4
- package/dist/components/Textarea/Textarea.test.js +2 -2
- package/dist/components/Toast/Toast.d.ts +5 -19
- package/dist/components/Toast/Toast.js +65 -62
- package/dist/components/Toast/Toast.test.js +47 -30
- package/dist/components/ToastProvider/ToastContext.d.ts +11 -0
- package/dist/components/ToastProvider/ToastProvider.d.ts +19 -0
- package/dist/components/ToastProvider/ToastProvider.js +7 -0
- package/dist/components/ToastProvider/ToastProvider.test.d.ts +1 -0
- package/dist/components/ToastProvider/ToastProvider.test.js +264 -0
- package/dist/components/ToastProvider/types.d.ts +54 -0
- package/dist/components/ToastProvider/useToast.d.ts +28 -0
- package/dist/components/Toggle/Toggle.js +31 -30
- package/dist/components/Toggle/Toggle.test.js +9 -9
- package/dist/components/Tooltip/Tooltip.js +20 -19
- package/dist/{index-2H7slGYV.js → index-7CBv-Jx6.js} +1 -1
- package/dist/{index-DpfPnSMn.js → index-BymOxiM6.js} +2 -2
- package/dist/index-C-3_YVJ1.js +1539 -0
- package/dist/{index-BKtdMA_j.js → index-C4ffg1vf.js} +24 -23
- package/dist/{index-BGZDIjm9.js → index-Chv2KjIL.js} +171 -168
- package/dist/{index-BJXIvJs4.js → index-CpsmI33B.js} +24 -23
- package/dist/index-CxAtPSMM.js +27 -0
- package/dist/{index-CjQV7MmW.js → index-DEphED6n.js} +11 -11
- package/dist/index-DM51yNMI.js +237 -0
- package/dist/{index-CVWHq7Pr.js → index-D_3jWVyV.js} +37 -36
- package/dist/index-DkTDHhag.js +3098 -0
- package/dist/index-DrR82jOT.js +142 -0
- package/dist/magic-string.es-uPKorP4O.js +663 -0
- package/dist/main.d.ts +5 -0
- package/dist/main.js +48 -42
- package/dist/useToast-Cz5MGKnw.js +11 -0
- package/dist/{vi.ClIskdbk-CFW_9sOK.js → vi.bdSIJ99Y-017e_Pkz.js} +9494 -10227
- package/package.json +6 -3
- package/dist/index-DWydnyjJ.js +0 -245
- package/dist/index-DieLVN0p.js +0 -1664
- package/dist/magic-string.es-D4UQQyt0.js +0 -859
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Toast variant types - matches existing Toast component
|
|
4
|
+
*/
|
|
5
|
+
export type ToastVariant = 'success' | 'warning' | 'error';
|
|
6
|
+
/**
|
|
7
|
+
* Position configuration for toast container
|
|
8
|
+
*/
|
|
9
|
+
export type AnchorOrigin = {
|
|
10
|
+
vertical: 'top' | 'bottom';
|
|
11
|
+
horizontal: 'left' | 'center' | 'right';
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Options for individual toast display
|
|
15
|
+
*/
|
|
16
|
+
export interface ToastOptions {
|
|
17
|
+
/** Duration in milliseconds. 0 = persistent (never auto-dismiss) */
|
|
18
|
+
duration?: number;
|
|
19
|
+
/** Whether to hide the icon */
|
|
20
|
+
noIcon?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* ToastProvider component props
|
|
24
|
+
*/
|
|
25
|
+
export interface ToastProviderProps {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
/** Maximum number of toasts visible at once. Default: 3 */
|
|
28
|
+
maxSnack?: number;
|
|
29
|
+
/** Position of toast container. Default: { vertical: 'top', horizontal: 'center' } */
|
|
30
|
+
anchorOrigin?: AnchorOrigin;
|
|
31
|
+
/** Default auto-hide duration in milliseconds. Default: 3000 */
|
|
32
|
+
autoHideDuration?: number;
|
|
33
|
+
/** Prevent duplicate messages. Default: true */
|
|
34
|
+
preventDuplicate?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Return type for useToast hook
|
|
38
|
+
*/
|
|
39
|
+
export interface UseToastReturn {
|
|
40
|
+
/** Show a success toast */
|
|
41
|
+
success(message: string, options?: ToastOptions): string;
|
|
42
|
+
/** Show a warning toast */
|
|
43
|
+
warning(message: string, options?: ToastOptions): string;
|
|
44
|
+
/** Show an error toast */
|
|
45
|
+
error(message: string, options?: ToastOptions): string;
|
|
46
|
+
/** Close a specific toast by ID */
|
|
47
|
+
close(id: string): void;
|
|
48
|
+
/** Close all visible toasts immediately */
|
|
49
|
+
closeAll(): void;
|
|
50
|
+
}
|
|
51
|
+
export declare const DEFAULT_ANCHOR_ORIGIN: AnchorOrigin;
|
|
52
|
+
export declare const DEFAULT_MAX_SNACK = 3;
|
|
53
|
+
export declare const DEFAULT_AUTO_HIDE_DURATION = 3000;
|
|
54
|
+
export declare const DEFAULT_PREVENT_DUPLICATE = true;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { UseToastReturn } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to access toast notification functions.
|
|
4
|
+
* Must be used within a ToastProvider.
|
|
5
|
+
*
|
|
6
|
+
* @returns {UseToastReturn} Object with methods to show and manage toasts
|
|
7
|
+
* @throws {Error} If used outside of ToastProvider
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* function MyComponent() {
|
|
12
|
+
* const toast = useToast()
|
|
13
|
+
*
|
|
14
|
+
* const handleSave = async () => {
|
|
15
|
+
* try {
|
|
16
|
+
* await saveData()
|
|
17
|
+
* toast.success('Data saved successfully!')
|
|
18
|
+
* } catch {
|
|
19
|
+
* toast.error('Failed to save data')
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* return <button onClick={handleSave}>Save</button>
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function useToast(): UseToastReturn;
|
|
28
|
+
export default useToast;
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { jsxs as k, jsx as d } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
2
|
+
import * as m from "react";
|
|
3
3
|
import { useId as D, useEffect as M, useState as j } from "react";
|
|
4
4
|
import { c as F } from "../../clsx-OuTLNxxd.js";
|
|
5
|
-
import { d as y, u as H, c as K,
|
|
6
|
-
import { u as
|
|
7
|
-
import
|
|
5
|
+
import { d as y, u as H, P, c as K, b as A } from "../../index-DM51yNMI.js";
|
|
6
|
+
import { u as U } from "../../index-BZPx6jYI.js";
|
|
7
|
+
import { u as q } from "../../index-CxAtPSMM.js";
|
|
8
|
+
import '../../assets/Toggle.css';var v = "Switch", [z] = A(v), [L, O] = z(v), T = m.forwardRef(
|
|
8
9
|
(r, c) => {
|
|
9
10
|
const {
|
|
10
11
|
__scopeSwitch: e,
|
|
11
12
|
name: n,
|
|
12
13
|
checked: o,
|
|
13
|
-
defaultChecked:
|
|
14
|
+
defaultChecked: p,
|
|
14
15
|
required: s,
|
|
15
16
|
disabled: a,
|
|
16
17
|
value: i = "on",
|
|
17
|
-
onCheckedChange:
|
|
18
|
+
onCheckedChange: h,
|
|
18
19
|
form: l,
|
|
19
20
|
..._
|
|
20
|
-
} = r, [t, u] =
|
|
21
|
+
} = r, [t, u] = m.useState(null), S = y(c, (w) => u(w)), C = m.useRef(!1), g = t ? l || !!t.closest("form") : !0, [b, I] = H({
|
|
21
22
|
prop: o,
|
|
22
|
-
defaultProp:
|
|
23
|
-
onChange:
|
|
24
|
-
caller:
|
|
23
|
+
defaultProp: p ?? !1,
|
|
24
|
+
onChange: h,
|
|
25
|
+
caller: v
|
|
25
26
|
});
|
|
26
27
|
return /* @__PURE__ */ k(L, { scope: e, checked: b, disabled: a, children: [
|
|
27
28
|
/* @__PURE__ */ d(
|
|
@@ -36,8 +37,8 @@ import '../../assets/Toggle.css';var S = "Switch", [z, se] = K(S), [L, O] = z(S)
|
|
|
36
37
|
disabled: a,
|
|
37
38
|
value: i,
|
|
38
39
|
..._,
|
|
39
|
-
ref:
|
|
40
|
-
onClick:
|
|
40
|
+
ref: S,
|
|
41
|
+
onClick: K(r.onClick, (w) => {
|
|
41
42
|
I((B) => !B), g && (C.current = w.isPropagationStopped(), C.current || w.stopPropagation());
|
|
42
43
|
})
|
|
43
44
|
}
|
|
@@ -59,8 +60,8 @@ import '../../assets/Toggle.css';var S = "Switch", [z, se] = K(S), [L, O] = z(S)
|
|
|
59
60
|
] });
|
|
60
61
|
}
|
|
61
62
|
);
|
|
62
|
-
T.displayName =
|
|
63
|
-
var E = "SwitchThumb", N =
|
|
63
|
+
T.displayName = v;
|
|
64
|
+
var E = "SwitchThumb", N = m.forwardRef(
|
|
64
65
|
(r, c) => {
|
|
65
66
|
const { __scopeSwitch: e, ...n } = r, o = O(E, e);
|
|
66
67
|
return /* @__PURE__ */ d(
|
|
@@ -75,16 +76,16 @@ var E = "SwitchThumb", N = h.forwardRef(
|
|
|
75
76
|
}
|
|
76
77
|
);
|
|
77
78
|
N.displayName = E;
|
|
78
|
-
var W = "SwitchBubbleInput", x =
|
|
79
|
+
var W = "SwitchBubbleInput", x = m.forwardRef(
|
|
79
80
|
({
|
|
80
81
|
__scopeSwitch: r,
|
|
81
82
|
control: c,
|
|
82
83
|
checked: e,
|
|
83
84
|
bubbles: n = !0,
|
|
84
85
|
...o
|
|
85
|
-
},
|
|
86
|
-
const s =
|
|
87
|
-
return
|
|
86
|
+
}, p) => {
|
|
87
|
+
const s = m.useRef(null), a = y(s, p), i = U(e), h = q(c);
|
|
88
|
+
return m.useEffect(() => {
|
|
88
89
|
const l = s.current;
|
|
89
90
|
if (!l) return;
|
|
90
91
|
const _ = window.HTMLInputElement.prototype, u = Object.getOwnPropertyDescriptor(
|
|
@@ -92,8 +93,8 @@ var W = "SwitchBubbleInput", x = h.forwardRef(
|
|
|
92
93
|
"checked"
|
|
93
94
|
).set;
|
|
94
95
|
if (i !== e && u) {
|
|
95
|
-
const
|
|
96
|
-
u.call(l, e), l.dispatchEvent(
|
|
96
|
+
const S = new Event("click", { bubbles: n });
|
|
97
|
+
u.call(l, e), l.dispatchEvent(S);
|
|
97
98
|
}
|
|
98
99
|
}, [i, e, n]), /* @__PURE__ */ d(
|
|
99
100
|
"input",
|
|
@@ -106,7 +107,7 @@ var W = "SwitchBubbleInput", x = h.forwardRef(
|
|
|
106
107
|
ref: a,
|
|
107
108
|
style: {
|
|
108
109
|
...o.style,
|
|
109
|
-
...
|
|
110
|
+
...h,
|
|
110
111
|
position: "absolute",
|
|
111
112
|
pointerEvents: "none",
|
|
112
113
|
opacity: 0,
|
|
@@ -121,7 +122,7 @@ function R(r) {
|
|
|
121
122
|
return r ? "checked" : "unchecked";
|
|
122
123
|
}
|
|
123
124
|
var X = T, Y = N;
|
|
124
|
-
const G = "Toggle-module__wrapper___rjhvi", J = "Toggle-module__root___mhwY4", Q = "Toggle-module__thumb___mWKFb", V = "Toggle-module__label___DMfcr", Z = "Toggle-module__disabled___sxlCk",
|
|
125
|
+
const G = "Toggle-module__wrapper___rjhvi", J = "Toggle-module__root___mhwY4", Q = "Toggle-module__thumb___mWKFb", V = "Toggle-module__label___DMfcr", Z = "Toggle-module__disabled___sxlCk", f = {
|
|
125
126
|
wrapper: G,
|
|
126
127
|
root: J,
|
|
127
128
|
thumb: Q,
|
|
@@ -134,23 +135,23 @@ function ae({
|
|
|
134
135
|
disabled: e = !1,
|
|
135
136
|
labelPosition: n = "left",
|
|
136
137
|
onChange: o,
|
|
137
|
-
className:
|
|
138
|
+
className: p,
|
|
138
139
|
...s
|
|
139
140
|
}) {
|
|
140
141
|
const a = D();
|
|
141
142
|
M(() => {
|
|
142
|
-
|
|
143
|
+
h(c);
|
|
143
144
|
}, [c]);
|
|
144
|
-
const [i,
|
|
145
|
-
|
|
145
|
+
const [i, h] = j(c), l = (t) => {
|
|
146
|
+
h(t), o == null || o(t);
|
|
146
147
|
}, _ = (t) => {
|
|
147
148
|
var u;
|
|
148
149
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), l(!i)), (u = s.onKeyDown) == null || u.call(s, t);
|
|
149
150
|
};
|
|
150
|
-
return /* @__PURE__ */ k("div", { className: F(
|
|
151
|
-
n === "left" && /* @__PURE__ */ d("label", { className:
|
|
152
|
-
/* @__PURE__ */ d(X, { className:
|
|
153
|
-
n === "right" && /* @__PURE__ */ d("label", { className:
|
|
151
|
+
return /* @__PURE__ */ k("div", { className: F(f.wrapper, e && f.disabled, p), children: [
|
|
152
|
+
n === "left" && /* @__PURE__ */ d("label", { className: f.label, htmlFor: a, children: r }),
|
|
153
|
+
/* @__PURE__ */ d(X, { className: f.root, checked: i, disabled: e, onCheckedChange: l, id: a, onKeyDown: _, ...s, children: /* @__PURE__ */ d(Y, { className: f.thumb }) }),
|
|
154
|
+
n === "right" && /* @__PURE__ */ d("label", { className: f.label, htmlFor: a, children: r })
|
|
154
155
|
] });
|
|
155
156
|
}
|
|
156
157
|
export {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import { d, i as n, r as g, g as t, s as l, v as
|
|
2
|
+
import { d, i as n, r as g, g as t, s as l, v as b, f as r } from "../../vi.bdSIJ99Y-017e_Pkz.js";
|
|
3
3
|
import a from "./Toggle.js";
|
|
4
4
|
d("Toggle", () => {
|
|
5
5
|
d("Rendering", () => {
|
|
@@ -85,17 +85,17 @@ d("Toggle", () => {
|
|
|
85
85
|
});
|
|
86
86
|
}), d("User Interactions", () => {
|
|
87
87
|
n("should call onChange when clicked", () => {
|
|
88
|
-
const e =
|
|
88
|
+
const e = b.fn();
|
|
89
89
|
g(/* @__PURE__ */ s(a, { label: "Test toggle", onChange: e }));
|
|
90
90
|
const o = l.getByTestId("toggle-root");
|
|
91
91
|
r.click(o), t(e).toHaveBeenCalledTimes(1), t(e).toHaveBeenCalledWith(!0);
|
|
92
92
|
}), n("should toggle checked state when clicked", () => {
|
|
93
|
-
const e =
|
|
93
|
+
const e = b.fn();
|
|
94
94
|
g(/* @__PURE__ */ s(a, { label: "Test toggle", onChange: e }));
|
|
95
95
|
const o = l.getByTestId("toggle-root");
|
|
96
96
|
o.focus(), t(o).not.toBeChecked(), r.click(o), t(o).toBeChecked(), t(e).toHaveBeenCalledWith(!0), r.click(o), t(o).not.toBeChecked(), t(e).toHaveBeenCalledWith(!1);
|
|
97
97
|
}), n("should not call onChange when disabled", () => {
|
|
98
|
-
const e =
|
|
98
|
+
const e = b.fn();
|
|
99
99
|
g(/* @__PURE__ */ s(a, { label: "Test toggle", disabled: !0, onChange: e }));
|
|
100
100
|
const o = l.getByTestId("toggle-root");
|
|
101
101
|
r.click(o), t(e).not.toHaveBeenCalled();
|
|
@@ -104,7 +104,7 @@ d("Toggle", () => {
|
|
|
104
104
|
const e = l.getByTestId("toggle-root");
|
|
105
105
|
t(e).not.toBeChecked(), r.click(e), t(e).not.toBeChecked();
|
|
106
106
|
}), n("should handle keyboard interactions", () => {
|
|
107
|
-
const e =
|
|
107
|
+
const e = b.fn();
|
|
108
108
|
g(/* @__PURE__ */ s(a, { label: "Test toggle", onChange: e }));
|
|
109
109
|
const o = l.getByTestId("toggle-root");
|
|
110
110
|
o.focus(), t(o).not.toBeChecked(), r.keyDown(o, {
|
|
@@ -113,7 +113,7 @@ d("Toggle", () => {
|
|
|
113
113
|
key: " "
|
|
114
114
|
}), t(e).toHaveBeenCalledTimes(2), t(e).toHaveBeenCalledWith(!1), t(o).not.toBeChecked();
|
|
115
115
|
}), n("should handle Enter key interactions", () => {
|
|
116
|
-
const e =
|
|
116
|
+
const e = b.fn();
|
|
117
117
|
g(/* @__PURE__ */ s(a, { label: "Test toggle", onChange: e }));
|
|
118
118
|
const o = l.getByTestId("toggle-root");
|
|
119
119
|
t(o).not.toBeChecked(), r.keyDown(o, {
|
|
@@ -125,8 +125,8 @@ d("Toggle", () => {
|
|
|
125
125
|
g(/* @__PURE__ */ s(a, { label: "Test toggle" })), g(/* @__PURE__ */ s(a, { label: "Test toggle" }));
|
|
126
126
|
const e = l.queryAllByTestId("toggle-root");
|
|
127
127
|
t(e).toHaveLength(2);
|
|
128
|
-
const o = e.map((h) => h.getAttribute("id")),
|
|
129
|
-
t(
|
|
128
|
+
const o = e.map((h) => h.getAttribute("id")), c = Array.from(new Set(o)).length;
|
|
129
|
+
t(c).toBe(2);
|
|
130
130
|
}), n("should have proper ARIA attributes", () => {
|
|
131
131
|
g(/* @__PURE__ */ s(a, { label: "Test toggle" }));
|
|
132
132
|
const e = l.getByTestId("toggle-root");
|
|
@@ -142,7 +142,7 @@ d("Toggle", () => {
|
|
|
142
142
|
}), n("should not be focusable when disabled", () => {
|
|
143
143
|
g(/* @__PURE__ */ s(a, { label: "Test toggle", disabled: !0 }));
|
|
144
144
|
const e = l.getByTestId("toggle-root");
|
|
145
|
-
|
|
145
|
+
t(e).toBeDisabled();
|
|
146
146
|
});
|
|
147
147
|
});
|
|
148
148
|
});
|
|
@@ -3,10 +3,11 @@ import * as i from "react";
|
|
|
3
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
|
-
import { P as G,
|
|
7
|
-
import {
|
|
8
|
-
import { u as
|
|
9
|
-
import {
|
|
6
|
+
import { P as G, u as te, d as F, c as C, b as oe, h as re } from "../../index-DM51yNMI.js";
|
|
7
|
+
import { P as ne, D as le } from "../../index-DrR82jOT.js";
|
|
8
|
+
import { u as ie } from "../../index-7CBv-Jx6.js";
|
|
9
|
+
import { R as se, A as ae, a as ce, c as B, C as ue } from "../../index-C-3_YVJ1.js";
|
|
10
|
+
import { P as K } from "../../index-BymOxiM6.js";
|
|
10
11
|
import '../../assets/Tooltip.css';var pe = Object.freeze({
|
|
11
12
|
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
12
13
|
position: "absolute",
|
|
@@ -30,7 +31,7 @@ import '../../assets/Tooltip.css';var pe = Object.freeze({
|
|
|
30
31
|
)
|
|
31
32
|
);
|
|
32
33
|
U.displayName = de;
|
|
33
|
-
var fe = U, [D
|
|
34
|
+
var fe = U, [D] = oe("Tooltip", [
|
|
34
35
|
B
|
|
35
36
|
]), L = B(), V = "TooltipProvider", he = 700, A = "tooltip.open", [ve, I] = D(V), $ = (t) => {
|
|
36
37
|
const {
|
|
@@ -77,25 +78,25 @@ var R = "Tooltip", [_e, O] = D(R), Y = (t) => {
|
|
|
77
78
|
onOpenChange: s,
|
|
78
79
|
disableHoverableContent: a,
|
|
79
80
|
delayDuration: h
|
|
80
|
-
} = t, l = I(R, t.__scopeTooltip), f = L(o), [c, d] = i.useState(null), v =
|
|
81
|
+
} = t, l = I(R, t.__scopeTooltip), f = L(o), [c, d] = i.useState(null), v = ie(), p = i.useRef(0), m = a ?? l.disableHoverableContent, _ = h ?? l.delayDuration, T = i.useRef(!1), [g, x] = te({
|
|
81
82
|
prop: r,
|
|
82
83
|
defaultProp: n ?? !1,
|
|
83
|
-
onChange: (
|
|
84
|
-
|
|
84
|
+
onChange: (S) => {
|
|
85
|
+
S ? (l.onOpen(), document.dispatchEvent(new CustomEvent(A))) : l.onClose(), s == null || s(S);
|
|
85
86
|
},
|
|
86
87
|
caller: R
|
|
87
88
|
}), w = i.useMemo(() => g ? T.current ? "delayed-open" : "instant-open" : "closed", [g]), E = i.useCallback(() => {
|
|
88
89
|
window.clearTimeout(p.current), p.current = 0, T.current = !1, x(!0);
|
|
89
90
|
}, [x]), P = i.useCallback(() => {
|
|
90
91
|
window.clearTimeout(p.current), p.current = 0, x(!1);
|
|
91
|
-
}, [x]),
|
|
92
|
+
}, [x]), H = i.useCallback(() => {
|
|
92
93
|
window.clearTimeout(p.current), p.current = window.setTimeout(() => {
|
|
93
94
|
T.current = !0, x(!0), p.current = 0;
|
|
94
95
|
}, _);
|
|
95
96
|
}, [_, x]);
|
|
96
97
|
return i.useEffect(() => () => {
|
|
97
98
|
p.current && (window.clearTimeout(p.current), p.current = 0);
|
|
98
|
-
}, []), /* @__PURE__ */ u(
|
|
99
|
+
}, []), /* @__PURE__ */ u(se, { ...f, children: /* @__PURE__ */ u(
|
|
99
100
|
_e,
|
|
100
101
|
{
|
|
101
102
|
scope: o,
|
|
@@ -105,8 +106,8 @@ var R = "Tooltip", [_e, O] = D(R), Y = (t) => {
|
|
|
105
106
|
trigger: c,
|
|
106
107
|
onTriggerChange: d,
|
|
107
108
|
onTriggerEnter: i.useCallback(() => {
|
|
108
|
-
l.isOpenDelayedRef.current ?
|
|
109
|
-
}, [l.isOpenDelayedRef,
|
|
109
|
+
l.isOpenDelayedRef.current ? H() : E();
|
|
110
|
+
}, [l.isOpenDelayedRef, H, E]),
|
|
110
111
|
onTriggerLeave: i.useCallback(() => {
|
|
111
112
|
m ? P() : (window.clearTimeout(p.current), p.current = 0);
|
|
112
113
|
}, [P, m]),
|
|
@@ -121,7 +122,7 @@ Y.displayName = R;
|
|
|
121
122
|
var N = "TooltipTrigger", X = i.forwardRef(
|
|
122
123
|
(t, o) => {
|
|
123
124
|
const { __scopeTooltip: e, ...r } = t, n = O(N, e), s = I(N, e), a = L(e), h = i.useRef(null), l = F(o, h, n.onTriggerChange), f = i.useRef(!1), c = i.useRef(!1), d = i.useCallback(() => f.current = !1, []);
|
|
124
|
-
return i.useEffect(() => () => document.removeEventListener("pointerup", d), [d]), /* @__PURE__ */ u(
|
|
125
|
+
return i.useEffect(() => () => document.removeEventListener("pointerup", d), [d]), /* @__PURE__ */ u(ae, { asChild: !0, ...a, children: /* @__PURE__ */ u(
|
|
125
126
|
G.button,
|
|
126
127
|
{
|
|
127
128
|
"aria-describedby": n.open ? n.contentId : void 0,
|
|
@@ -151,7 +152,7 @@ var M = "TooltipPortal", [me, Te] = D(M, {
|
|
|
151
152
|
forceMount: void 0
|
|
152
153
|
}), q = (t) => {
|
|
153
154
|
const { __scopeTooltip: o, forceMount: e, children: r, container: n } = t, s = O(M, o);
|
|
154
|
-
return /* @__PURE__ */ u(me, { scope: o, forceMount: e, children: /* @__PURE__ */ u(K, { present: e || s.open, children: /* @__PURE__ */ u(
|
|
155
|
+
return /* @__PURE__ */ u(me, { scope: o, forceMount: e, children: /* @__PURE__ */ u(K, { present: e || s.open, children: /* @__PURE__ */ u(ne, { asChild: !0, container: n, children: r }) }) });
|
|
155
156
|
};
|
|
156
157
|
q.displayName = M;
|
|
157
158
|
var b = "TooltipContent", W = i.forwardRef(
|
|
@@ -204,7 +205,7 @@ var b = "TooltipContent", W = i.forwardRef(
|
|
|
204
205
|
return window.addEventListener("scroll", d, { capture: !0 }), () => window.removeEventListener("scroll", d, { capture: !0 });
|
|
205
206
|
}
|
|
206
207
|
}, [l.trigger, c]), /* @__PURE__ */ u(
|
|
207
|
-
|
|
208
|
+
le,
|
|
208
209
|
{
|
|
209
210
|
asChild: !0,
|
|
210
211
|
disableOutsidePointerEvents: !1,
|
|
@@ -213,7 +214,7 @@ var b = "TooltipContent", W = i.forwardRef(
|
|
|
213
214
|
onFocusOutside: (d) => d.preventDefault(),
|
|
214
215
|
onDismiss: c,
|
|
215
216
|
children: /* @__PURE__ */ k(
|
|
216
|
-
|
|
217
|
+
ue,
|
|
217
218
|
{
|
|
218
219
|
"data-state": l.stateAttribute,
|
|
219
220
|
...f,
|
|
@@ -244,7 +245,7 @@ var J = "TooltipArrow", Q = i.forwardRef(
|
|
|
244
245
|
return ge(
|
|
245
246
|
J,
|
|
246
247
|
e
|
|
247
|
-
).isInside ? null : /* @__PURE__ */ u(
|
|
248
|
+
).isInside ? null : /* @__PURE__ */ u(ce, { ...n, ...r, ref: o });
|
|
248
249
|
}
|
|
249
250
|
);
|
|
250
251
|
Q.displayName = J;
|
|
@@ -341,7 +342,7 @@ function Oe(t) {
|
|
|
341
342
|
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
343
|
}
|
|
343
344
|
var De = $, Le = Y, ke = X, Ae = q, Ne = W, Ie = Q;
|
|
344
|
-
const Me = "Tooltip-module__tooltip___LjRUX",
|
|
345
|
+
const Me = "Tooltip-module__tooltip___LjRUX", He = "Tooltip-module__closable___MjoEb", y = {
|
|
345
346
|
"tooltip-container": "Tooltip-module__tooltip-container___X4jVa",
|
|
346
347
|
tooltip: Me,
|
|
347
348
|
"tooltip-md": "Tooltip-module__tooltip-md___v79jI",
|
|
@@ -352,7 +353,7 @@ const Me = "Tooltip-module__tooltip___LjRUX", Se = "Tooltip-module__closable___M
|
|
|
352
353
|
"tooltip-light": "Tooltip-module__tooltip-light___f9BKo",
|
|
353
354
|
"tooltip-close-icon": "Tooltip-module__tooltip-close-icon___EceS-",
|
|
354
355
|
"tooltip-content": "Tooltip-module__tooltip-content___fjJv5",
|
|
355
|
-
closable:
|
|
356
|
+
closable: He,
|
|
356
357
|
"tooltip-enter": "Tooltip-module__tooltip-enter___KfwAg",
|
|
357
358
|
"tooltip-enter-active": "Tooltip-module__tooltip-enter-active___L7FtU",
|
|
358
359
|
"tooltip-exit": "Tooltip-module__tooltip-exit___RLxZG",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as a from "react";
|
|
2
|
-
import { d as T, i as A } from "./index-
|
|
2
|
+
import { d as T, i as A } from "./index-DM51yNMI.js";
|
|
3
3
|
function E(n, e) {
|
|
4
4
|
return a.useReducer((r, t) => e[r][t] ?? r, n);
|
|
5
5
|
}
|
|
@@ -35,7 +35,7 @@ function P(n) {
|
|
|
35
35
|
if (e) {
|
|
36
36
|
let i;
|
|
37
37
|
const m = e.ownerDocument.defaultView ?? window, d = (u) => {
|
|
38
|
-
const g = l(t.current).includes(u.animationName);
|
|
38
|
+
const g = l(t.current).includes(CSS.escape(u.animationName));
|
|
39
39
|
if (u.target === e && g && (s("ANIMATION_END"), !o.current)) {
|
|
40
40
|
const O = e.style.animationFillMode;
|
|
41
41
|
e.style.animationFillMode = "forwards", i = m.setTimeout(() => {
|