@versaur/react 1.0.5 → 1.0.6
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/blocks.d.ts +26 -26
- package/dist/blocks.js +556 -640
- package/dist/forms.d.ts +2 -2
- package/dist/forms.js +303 -336
- package/dist/overlay-parts-Zq9CuT31.js +24 -0
- package/dist/primitive.d.ts +35 -36
- package/dist/primitive.js +115 -127
- package/dist/tooltip-M8EGI3lZ.js +200 -0
- package/dist/utils.js +1 -1
- package/package.json +2 -2
- package/dist/checkbox.module-D4Do_b6S.js +0 -9
- package/dist/overlay-parts-YglazEA-.js +0 -29
- package/dist/tokens.d.ts +0 -1
- package/dist/tokens.js +0 -1
- package/dist/tooltip-CmKPCktA.js +0 -212
- package/dist/versaur-react.css +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { overlayPartsStyles as l } from "@versaur/core/utils";
|
|
3
|
+
import { forwardRef as t } from "react";
|
|
4
|
+
import { c as y } from "./cx-B9vmfsc1.js";
|
|
5
|
+
const d = t(
|
|
6
|
+
({ children: a, className: e, ...r }, s) => /* @__PURE__ */ o("div", { ref: s, className: y(l.header, e), ...r, children: a })
|
|
7
|
+
);
|
|
8
|
+
d.displayName = "OverlayHeader";
|
|
9
|
+
const i = t(
|
|
10
|
+
({ children: a, as: e = "h2", className: r, ...s }, m) => /* @__PURE__ */ o(e, { ref: m, className: y(l.title, r), ...s, children: a })
|
|
11
|
+
);
|
|
12
|
+
i.displayName = "OverlayTitle";
|
|
13
|
+
const v = t(({ children: a, className: e, ...r }, s) => /* @__PURE__ */ o("div", { ref: s, className: y(l.body, e), ...r, children: a }));
|
|
14
|
+
v.displayName = "OverlayBody";
|
|
15
|
+
const c = t(
|
|
16
|
+
({ children: a, className: e, ...r }, s) => /* @__PURE__ */ o("div", { ref: s, className: y(l.footer, e), ...r, children: a })
|
|
17
|
+
);
|
|
18
|
+
c.displayName = "OverlayFooter";
|
|
19
|
+
export {
|
|
20
|
+
v as O,
|
|
21
|
+
c as a,
|
|
22
|
+
d as b,
|
|
23
|
+
i as c
|
|
24
|
+
};
|
package/dist/primitive.d.ts
CHANGED
|
@@ -1,47 +1,46 @@
|
|
|
1
|
-
import { Avatar as Avatar_2 } from '
|
|
2
|
-
import { AvatarShape } from '
|
|
3
|
-
import { AvatarSize } from '
|
|
4
|
-
import { AvatarVariant } from '
|
|
5
|
-
import { Badge as Badge_2 } from '
|
|
6
|
-
import { BadgeShape } from '
|
|
7
|
-
import { BadgeSize } from '
|
|
8
|
-
import { BadgeVariant } from '
|
|
9
|
-
import { Button as Button_2 } from '
|
|
1
|
+
import { Avatar as Avatar_2 } from '@versaur/core/primitive';
|
|
2
|
+
import { AvatarShape } from '@versaur/core/primitive';
|
|
3
|
+
import { AvatarSize } from '@versaur/core/primitive';
|
|
4
|
+
import { AvatarVariant } from '@versaur/core/primitive';
|
|
5
|
+
import { Badge as Badge_2 } from '@versaur/core/primitive';
|
|
6
|
+
import { BadgeShape } from '@versaur/core/primitive';
|
|
7
|
+
import { BadgeSize } from '@versaur/core/primitive';
|
|
8
|
+
import { BadgeVariant } from '@versaur/core/primitive';
|
|
9
|
+
import { Button as Button_2 } from '@versaur/core/primitive';
|
|
10
10
|
import { ButtonHTMLAttributes } from 'react';
|
|
11
|
-
import { ButtonSize } from '
|
|
12
|
-
import { ButtonVariant } from '
|
|
11
|
+
import { ButtonSize } from '@versaur/core/primitive';
|
|
12
|
+
import { ButtonVariant } from '@versaur/core/primitive';
|
|
13
13
|
import { ComponentType } from 'react';
|
|
14
14
|
import { default as default_2 } from 'react';
|
|
15
|
-
import { Dot as Dot_2 } from '
|
|
16
|
-
import { DotSize } from '
|
|
17
|
-
import { DotVariant } from '
|
|
15
|
+
import { Dot as Dot_2 } from '@versaur/core/primitive';
|
|
16
|
+
import { DotSize } from '@versaur/core/primitive';
|
|
17
|
+
import { DotVariant } from '@versaur/core/primitive';
|
|
18
18
|
import { ForwardRefExoticComponent } from 'react';
|
|
19
|
-
import { Heading as Heading_2 } from '
|
|
20
|
-
import { HeadingAs } from '
|
|
21
|
-
import { HeadingIntent } from '
|
|
22
|
-
import { HeadingSize } from '
|
|
23
|
-
import { HeadingWeight } from '
|
|
24
|
-
import { Hr as Hr_2 } from '
|
|
25
|
-
import { HrOrientation } from '
|
|
26
|
-
import { HrSize } from '
|
|
27
|
-
import { HrSpacing } from '
|
|
28
|
-
import { HrVariant } from '
|
|
19
|
+
import { Heading as Heading_2 } from '@versaur/core/primitive';
|
|
20
|
+
import { HeadingAs } from '@versaur/core/primitive';
|
|
21
|
+
import { HeadingIntent } from '@versaur/core/primitive';
|
|
22
|
+
import { HeadingSize } from '@versaur/core/primitive';
|
|
23
|
+
import { HeadingWeight } from '@versaur/core/primitive';
|
|
24
|
+
import { Hr as Hr_2 } from '@versaur/core/primitive';
|
|
25
|
+
import { HrOrientation } from '@versaur/core/primitive';
|
|
26
|
+
import { HrSize } from '@versaur/core/primitive';
|
|
27
|
+
import { HrSpacing } from '@versaur/core/primitive';
|
|
28
|
+
import { HrVariant } from '@versaur/core/primitive';
|
|
29
29
|
import { HTMLAttributes } from 'react';
|
|
30
30
|
import { Icon as Icon_2 } from '@versaur/core/primitive';
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import { IconSize } from '../../../../../core/src/components/primitive';
|
|
31
|
+
import { IconIntent } from '@versaur/core/primitive';
|
|
32
|
+
import { IconSize } from '@versaur/core/primitive';
|
|
34
33
|
import { ImgHTMLAttributes } from 'react';
|
|
35
|
-
import { Kbd as Kbd_2 } from '
|
|
36
|
-
import { Loader as Loader_2 } from '
|
|
34
|
+
import { Kbd as Kbd_2 } from '@versaur/core/primitive';
|
|
35
|
+
import { Loader as Loader_2 } from '@versaur/core/primitive';
|
|
37
36
|
import { ReactNode } from 'react';
|
|
38
37
|
import { RefAttributes } from 'react';
|
|
39
38
|
import { SVGProps } from 'react';
|
|
40
|
-
import { Text as Text_3 } from '
|
|
41
|
-
import { TextAs } from '
|
|
42
|
-
import { TextIntent } from '
|
|
43
|
-
import { TextSize } from '
|
|
44
|
-
import { TextWeight } from '
|
|
39
|
+
import { Text as Text_3 } from '@versaur/core/primitive';
|
|
40
|
+
import { TextAs } from '@versaur/core/primitive';
|
|
41
|
+
import { TextIntent } from '@versaur/core/primitive';
|
|
42
|
+
import { TextSize } from '@versaur/core/primitive';
|
|
43
|
+
import { TextWeight } from '@versaur/core/primitive';
|
|
45
44
|
|
|
46
45
|
export declare const Avatar: ForwardRefExoticComponent<AvatarProps & RefAttributes<HTMLSpanElement>> & {
|
|
47
46
|
Image: ForwardRefExoticComponent<AvatarImageProps & RefAttributes<HTMLImageElement>>;
|
|
@@ -368,8 +367,8 @@ export { IconIntent }
|
|
|
368
367
|
|
|
369
368
|
export declare type IconProps = Omit<SVGProps<SVGSVGElement>, "ref"> & {
|
|
370
369
|
as: ComponentType<SVGProps<SVGSVGElement>>;
|
|
371
|
-
intent?:
|
|
372
|
-
size?:
|
|
370
|
+
intent?: Icon_2.Intent | "inherit";
|
|
371
|
+
size?: Icon_2.Size | "inherit";
|
|
373
372
|
};
|
|
374
373
|
|
|
375
374
|
export { IconSize }
|
package/dist/primitive.js
CHANGED
|
@@ -1,205 +1,193 @@
|
|
|
1
|
-
import { jsxs as v, jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { jsxs as v, jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { buttonStyles as j, headingStyles as R, textStyles as k, avatarStyles as I, loaderStyles as w, badgeStyles as K, dotStyles as O, kbdStyles as U } from "@versaur/core/primitive";
|
|
3
|
+
import { LoaderIcon as S, UserIcon as q } from "@versaur/icons";
|
|
4
|
+
import { forwardRef as p, useState as z } from "react";
|
|
5
|
+
import { u as h } from "./use-data-attrs-iPFyfiKN.js";
|
|
4
6
|
import { c as g } from "./cx-B9vmfsc1.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
const j = "_button_1xs3y_2", w = {
|
|
9
|
-
button: j
|
|
10
|
-
}, R = "_avatar_gbt5b_2", I = {
|
|
11
|
-
avatar: R,
|
|
12
|
-
"avatar-image": "_avatar-image_gbt5b_135"
|
|
13
|
-
}, K = "_badge_1ekpk_2", z = {
|
|
14
|
-
badge: K
|
|
15
|
-
}, O = "_dot_r4bz1_2", U = {
|
|
16
|
-
dot: O
|
|
17
|
-
}, q = "_heading_8cumv_2", C = {
|
|
18
|
-
heading: q
|
|
19
|
-
}, F = "_text_1a15x_2", G = {
|
|
20
|
-
text: F
|
|
21
|
-
}, J = "_loader_1wtnu_2", M = {
|
|
22
|
-
loader: J
|
|
23
|
-
}, P = "_kbd_io10s_6", Q = {
|
|
24
|
-
kbd: P
|
|
25
|
-
}, V = b(
|
|
7
|
+
import { I as A } from "./tooltip-M8EGI3lZ.js";
|
|
8
|
+
import { B as et, H as st, T as rt } from "./tooltip-M8EGI3lZ.js";
|
|
9
|
+
const C = p(
|
|
26
10
|
({
|
|
27
11
|
variant: a = "primary",
|
|
28
|
-
size:
|
|
12
|
+
size: o = "medium",
|
|
29
13
|
loading: t = !1,
|
|
30
14
|
disabled: e = !1,
|
|
31
|
-
pressed:
|
|
15
|
+
pressed: r = !1,
|
|
32
16
|
leftIcon: s,
|
|
33
17
|
rightIcon: n,
|
|
34
|
-
children:
|
|
35
|
-
type:
|
|
36
|
-
onClick:
|
|
37
|
-
className:
|
|
38
|
-
...
|
|
39
|
-
},
|
|
40
|
-
const
|
|
18
|
+
children: i,
|
|
19
|
+
type: c = "button",
|
|
20
|
+
onClick: f,
|
|
21
|
+
className: b,
|
|
22
|
+
...d
|
|
23
|
+
}, N) => {
|
|
24
|
+
const y = !!s, l = !!n, x = !!i;
|
|
41
25
|
let m;
|
|
42
|
-
|
|
43
|
-
const
|
|
26
|
+
y && l && x ? m = "both-text" : y && x ? m = "left-text" : l && x ? m = "right-text" : y && l ? m = "both" : y ? m = "left" : l && (m = "right");
|
|
27
|
+
const D = h({
|
|
44
28
|
disabled: e || t,
|
|
45
29
|
loading: t,
|
|
46
|
-
size:
|
|
30
|
+
size: o,
|
|
47
31
|
variant: a,
|
|
48
32
|
...m && { iconConfig: m }
|
|
49
|
-
}),
|
|
33
|
+
}), H = (B) => {
|
|
50
34
|
if (e || t) {
|
|
51
|
-
|
|
35
|
+
B.preventDefault();
|
|
52
36
|
return;
|
|
53
37
|
}
|
|
54
|
-
|
|
38
|
+
f == null || f(B);
|
|
55
39
|
};
|
|
56
40
|
return /* @__PURE__ */ v(
|
|
57
41
|
"button",
|
|
58
42
|
{
|
|
59
|
-
ref:
|
|
60
|
-
type:
|
|
61
|
-
className: g(
|
|
62
|
-
"aria-pressed":
|
|
43
|
+
ref: N,
|
|
44
|
+
type: c,
|
|
45
|
+
className: g(j.button, b),
|
|
46
|
+
"aria-pressed": r ? "true" : void 0,
|
|
63
47
|
"aria-busy": t ? "true" : void 0,
|
|
64
48
|
"aria-disabled": e || t ? "true" : void 0,
|
|
65
|
-
...
|
|
66
|
-
...
|
|
67
|
-
onClick:
|
|
49
|
+
...D,
|
|
50
|
+
...d,
|
|
51
|
+
onClick: H,
|
|
68
52
|
children: [
|
|
69
|
-
t ? /* @__PURE__ */
|
|
53
|
+
t ? /* @__PURE__ */ u(A, { as: S, "aria-label": "Loading", "data-loading-icon": "loader" }) : null,
|
|
70
54
|
s,
|
|
71
|
-
|
|
55
|
+
i,
|
|
72
56
|
n
|
|
73
57
|
]
|
|
74
58
|
}
|
|
75
59
|
);
|
|
76
60
|
}
|
|
77
61
|
);
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
({ as: a = "h2", size:
|
|
81
|
-
const
|
|
62
|
+
C.displayName = "Button";
|
|
63
|
+
const F = p(
|
|
64
|
+
({ as: a = "h2", size: o, weight: t, intent: e, case: r, transform: s, children: n, className: i, ...c }, f) => {
|
|
65
|
+
const b = a, d = h({
|
|
82
66
|
as: a,
|
|
83
|
-
case:
|
|
67
|
+
case: r,
|
|
84
68
|
intent: e,
|
|
85
|
-
size:
|
|
69
|
+
size: o,
|
|
86
70
|
transform: s,
|
|
87
71
|
weight: t
|
|
88
72
|
});
|
|
89
|
-
return /* @__PURE__ */
|
|
73
|
+
return /* @__PURE__ */ u(b, { ref: f, className: g(R.heading, i), ...d, ...c, children: n });
|
|
90
74
|
}
|
|
91
75
|
);
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
({ as: a = "p", size:
|
|
95
|
-
const
|
|
76
|
+
F.displayName = "Heading";
|
|
77
|
+
const G = p(
|
|
78
|
+
({ as: a = "p", size: o, weight: t, intent: e, case: r, transform: s, children: n, className: i, ...c }, f) => {
|
|
79
|
+
const b = a, d = h({
|
|
96
80
|
as: a,
|
|
97
|
-
case:
|
|
81
|
+
case: r,
|
|
98
82
|
intent: e,
|
|
99
|
-
size:
|
|
83
|
+
size: o,
|
|
100
84
|
transform: s,
|
|
101
85
|
weight: t
|
|
102
86
|
});
|
|
103
|
-
return /* @__PURE__ */
|
|
87
|
+
return /* @__PURE__ */ u(b, { ref: f, className: g(k.text, i), ...d, ...c, children: n });
|
|
104
88
|
}
|
|
105
89
|
);
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
({ variant: a = "primary", size:
|
|
109
|
-
const
|
|
110
|
-
return /* @__PURE__ */
|
|
90
|
+
G.displayName = "Text";
|
|
91
|
+
const T = p(
|
|
92
|
+
({ variant: a = "primary", size: o = "md", shape: t = "circle", children: e, className: r, ...s }, n) => {
|
|
93
|
+
const i = h({ shape: t, size: o, variant: a }), c = e || /* @__PURE__ */ u(A, { as: q });
|
|
94
|
+
return /* @__PURE__ */ u("span", { ref: n, className: g(I.avatar, r), role: "img", ...i, ...s, children: c });
|
|
111
95
|
}
|
|
112
96
|
);
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
const [n,
|
|
116
|
-
return n ? null : /* @__PURE__ */
|
|
97
|
+
T.displayName = "Avatar";
|
|
98
|
+
const L = p(({ src: a, alt: o, onError: t, className: e, ...r }, s) => {
|
|
99
|
+
const [n, i] = z(!1);
|
|
100
|
+
return n ? null : /* @__PURE__ */ u(
|
|
117
101
|
"img",
|
|
118
102
|
{
|
|
119
103
|
ref: s,
|
|
120
104
|
className: g(I["avatar-image"], e),
|
|
121
105
|
src: a,
|
|
122
|
-
alt:
|
|
123
|
-
onError: (
|
|
124
|
-
|
|
106
|
+
alt: o,
|
|
107
|
+
onError: (c) => {
|
|
108
|
+
i(!0), t == null || t(c);
|
|
125
109
|
},
|
|
126
|
-
...
|
|
110
|
+
...r
|
|
127
111
|
}
|
|
128
112
|
);
|
|
129
113
|
});
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
Image:
|
|
133
|
-
}),
|
|
134
|
-
({ type: a = "spinner", size:
|
|
135
|
-
const n =
|
|
136
|
-
size:
|
|
114
|
+
L.displayName = "Avatar.Image";
|
|
115
|
+
const W = Object.assign(T, {
|
|
116
|
+
Image: L
|
|
117
|
+
}), J = p(
|
|
118
|
+
({ type: a = "spinner", size: o = "sm", children: t, className: e, ...r }, s) => {
|
|
119
|
+
const n = h({
|
|
120
|
+
size: o,
|
|
137
121
|
type: a
|
|
138
122
|
});
|
|
139
|
-
return /* @__PURE__ */ v("div", { ref: s, className: g(
|
|
140
|
-
a === "spinner" && /* @__PURE__ */
|
|
123
|
+
return /* @__PURE__ */ v("div", { ref: s, className: g(w.loader, e), ...n, ...r, children: [
|
|
124
|
+
a === "spinner" && /* @__PURE__ */ u(A, { as: S, "aria-hidden": "true" }),
|
|
141
125
|
t
|
|
142
126
|
] });
|
|
143
127
|
}
|
|
144
128
|
);
|
|
145
|
-
|
|
146
|
-
const
|
|
129
|
+
J.displayName = "Loader";
|
|
130
|
+
const M = p(
|
|
147
131
|
({
|
|
148
132
|
variant: a = "primary",
|
|
149
|
-
size:
|
|
133
|
+
size: o = "medium",
|
|
150
134
|
shape: t = "rounded",
|
|
151
135
|
iconLeft: e,
|
|
152
|
-
iconRight:
|
|
136
|
+
iconRight: r,
|
|
153
137
|
maxWidth: s,
|
|
154
138
|
children: n,
|
|
155
|
-
style:
|
|
156
|
-
className:
|
|
157
|
-
...
|
|
158
|
-
},
|
|
159
|
-
const
|
|
160
|
-
let
|
|
161
|
-
|
|
162
|
-
const x =
|
|
139
|
+
style: i,
|
|
140
|
+
className: c,
|
|
141
|
+
...f
|
|
142
|
+
}, b) => {
|
|
143
|
+
const d = !!e, N = !!r, y = !!n;
|
|
144
|
+
let l;
|
|
145
|
+
d && N && y ? l = "both-text" : d && y ? l = "left-text" : N && y ? l = "right-text" : d && N ? l = "both" : d ? l = "left" : N && (l = "right");
|
|
146
|
+
const x = h({
|
|
163
147
|
shape: t,
|
|
164
|
-
size:
|
|
148
|
+
size: o,
|
|
165
149
|
variant: a,
|
|
166
|
-
...
|
|
150
|
+
...l && { iconConfig: l }
|
|
167
151
|
}), m = {
|
|
168
|
-
...
|
|
152
|
+
...i,
|
|
169
153
|
...s && { "--vers-comp-badge-max-width": s }
|
|
170
154
|
};
|
|
171
|
-
return /* @__PURE__ */ v("div", { ref:
|
|
155
|
+
return /* @__PURE__ */ v("div", { ref: b, className: g(K.badge, c), ...x, ...f, style: m, children: [
|
|
172
156
|
e,
|
|
173
157
|
n,
|
|
174
|
-
|
|
158
|
+
r
|
|
175
159
|
] });
|
|
176
160
|
}
|
|
177
161
|
);
|
|
178
|
-
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
})
|
|
191
|
-
|
|
162
|
+
M.displayName = "Badge";
|
|
163
|
+
const P = p(
|
|
164
|
+
({ variant: a = "primary", size: o = "medium", className: t, ...e }, r) => {
|
|
165
|
+
const s = h({
|
|
166
|
+
size: o,
|
|
167
|
+
variant: a
|
|
168
|
+
});
|
|
169
|
+
return /* @__PURE__ */ u("span", { ref: r, className: g(O.dot, t), ...s, ...e });
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
P.displayName = "Dot";
|
|
173
|
+
const Q = p(
|
|
174
|
+
({ variant: a = "filled", size: o = "md", children: t, className: e, ...r }, s) => {
|
|
175
|
+
const n = h({ size: o, variant: a });
|
|
176
|
+
return /* @__PURE__ */ u("kbd", { ref: s, className: g(U.kbd, e), ...n, ...r, children: t });
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
Q.displayName = "Kbd";
|
|
192
180
|
export {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
181
|
+
W as Avatar,
|
|
182
|
+
M as Badge,
|
|
183
|
+
C as Button,
|
|
184
|
+
et as ButtonIcon,
|
|
185
|
+
P as Dot,
|
|
186
|
+
F as Heading,
|
|
187
|
+
st as Hr,
|
|
188
|
+
A as Icon,
|
|
189
|
+
Q as Kbd,
|
|
190
|
+
J as Loader,
|
|
191
|
+
G as Text,
|
|
192
|
+
rt as Tooltip
|
|
205
193
|
};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { iconStyles as P, hrStyles as R, buttonIconStyles as $, tooltipStyles as S } from "@versaur/core/primitive";
|
|
3
|
+
import w, { forwardRef as T, useEffect as q, useRef as B } from "react";
|
|
4
|
+
import { u as b } from "./use-data-attrs-iPFyfiKN.js";
|
|
5
|
+
import { c as f } from "./cx-B9vmfsc1.js";
|
|
6
|
+
import { LoaderIcon as M } from "@versaur/icons";
|
|
7
|
+
const y = w.forwardRef(function({ intent: i = "inherit", size: r = "inherit", as: a, className: o, ...t }, e) {
|
|
8
|
+
const n = b({ intent: i, size: r });
|
|
9
|
+
return /* @__PURE__ */ u(a, { ref: e, className: f(P.icon, o), ...n, ...t });
|
|
10
|
+
});
|
|
11
|
+
y.displayName = "Icon";
|
|
12
|
+
const _ = T(
|
|
13
|
+
({ orientation: s, variant: i, size: r, spacing: a, className: o, ...t }, e) => {
|
|
14
|
+
const n = b({
|
|
15
|
+
orientation: s,
|
|
16
|
+
size: r,
|
|
17
|
+
spacing: a,
|
|
18
|
+
variant: i
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ u(
|
|
21
|
+
"hr",
|
|
22
|
+
{
|
|
23
|
+
ref: e,
|
|
24
|
+
className: f(R.hr, o),
|
|
25
|
+
role: "separator",
|
|
26
|
+
"aria-orientation": s === "vertical" ? "vertical" : void 0,
|
|
27
|
+
...n,
|
|
28
|
+
...t
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
_.displayName = "Hr";
|
|
34
|
+
const g = T(
|
|
35
|
+
({
|
|
36
|
+
as: s,
|
|
37
|
+
variant: i = "primary",
|
|
38
|
+
size: r = "medium",
|
|
39
|
+
loading: a = !1,
|
|
40
|
+
disabled: o = !1,
|
|
41
|
+
pressed: t = !1,
|
|
42
|
+
type: e = "button",
|
|
43
|
+
onClick: n,
|
|
44
|
+
iconProps: l = {},
|
|
45
|
+
"aria-label": c,
|
|
46
|
+
className: m,
|
|
47
|
+
...v
|
|
48
|
+
}, h) => {
|
|
49
|
+
const E = b({
|
|
50
|
+
disabled: o || a,
|
|
51
|
+
loading: a,
|
|
52
|
+
size: r,
|
|
53
|
+
variant: i
|
|
54
|
+
}), L = (d) => {
|
|
55
|
+
if (o || a) {
|
|
56
|
+
d.preventDefault();
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
n == null || n(d);
|
|
60
|
+
};
|
|
61
|
+
return /* @__PURE__ */ u(
|
|
62
|
+
"button",
|
|
63
|
+
{
|
|
64
|
+
ref: h,
|
|
65
|
+
type: e,
|
|
66
|
+
className: f($["button-icon"], m),
|
|
67
|
+
"aria-label": c,
|
|
68
|
+
"aria-pressed": t ? "true" : void 0,
|
|
69
|
+
"aria-busy": a ? "true" : void 0,
|
|
70
|
+
"aria-disabled": o || a ? "true" : void 0,
|
|
71
|
+
...E,
|
|
72
|
+
...v,
|
|
73
|
+
onClick: L,
|
|
74
|
+
children: a ? /* @__PURE__ */ u(y, { as: M, "aria-label": "Loading", "data-loading-icon": "loader" }) : /* @__PURE__ */ u(y, { as: s, ...l })
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
g.displayName = "ButtonIcon";
|
|
80
|
+
function j({ id: s, tooltipRef: i, placement: r, gap: a, triggerType: o }) {
|
|
81
|
+
q(() => {
|
|
82
|
+
const t = i.current;
|
|
83
|
+
if (!t || !s)
|
|
84
|
+
return;
|
|
85
|
+
let e = null;
|
|
86
|
+
if (t.parentElement && (e = t.parentElement.querySelector(`[data-tooltip-trigger="${s}"]`)), !e) {
|
|
87
|
+
let p = t.parentElement;
|
|
88
|
+
for (; p && !e && (e = p.querySelector(`[data-tooltip-trigger="${s}"]`), !(e || p.classList.contains("sbdocs-story") || p.classList.contains("docblock-storylet"))); )
|
|
89
|
+
p = p.parentElement;
|
|
90
|
+
}
|
|
91
|
+
if (e || (e = document.querySelector(`[data-tooltip-trigger="${s}"]`)), !e)
|
|
92
|
+
return;
|
|
93
|
+
let n = null;
|
|
94
|
+
const l = () => {
|
|
95
|
+
n && (clearTimeout(n), n = null), t.matches(":popover-open") || t.showPopover();
|
|
96
|
+
}, c = () => {
|
|
97
|
+
n && clearTimeout(n), n = setTimeout(() => {
|
|
98
|
+
t.matches(":popover-open") && t.hidePopover(), n = null;
|
|
99
|
+
}, 100);
|
|
100
|
+
}, m = () => {
|
|
101
|
+
(o === "hover" || o === "all") && l();
|
|
102
|
+
}, v = () => {
|
|
103
|
+
(o === "hover" || o === "all") && c();
|
|
104
|
+
}, h = () => {
|
|
105
|
+
(o === "focus" || o === "all") && l();
|
|
106
|
+
}, E = () => {
|
|
107
|
+
o === "hover" && t.hidePopover();
|
|
108
|
+
}, L = () => {
|
|
109
|
+
o === "focus" && (t.matches(":popover-open") ? t.hidePopover() : l());
|
|
110
|
+
}, d = () => {
|
|
111
|
+
n && (clearTimeout(n), n = null);
|
|
112
|
+
}, I = () => {
|
|
113
|
+
(o === "hover" || o === "all") && c();
|
|
114
|
+
};
|
|
115
|
+
return e.addEventListener("mouseenter", m), e.addEventListener("mouseleave", v), e.addEventListener("focus", h), e.addEventListener("blur", E), e.addEventListener("click", L), t.addEventListener("mouseenter", d), t.addEventListener("mouseleave", I), () => {
|
|
116
|
+
n && clearTimeout(n), e.removeEventListener("mouseenter", m), e.removeEventListener("mouseleave", v), e.removeEventListener("focus", h), e.removeEventListener("blur", E), e.removeEventListener("click", L), t.removeEventListener("mouseenter", d), t.removeEventListener("mouseleave", I);
|
|
117
|
+
};
|
|
118
|
+
}, [s, r, a, o]);
|
|
119
|
+
}
|
|
120
|
+
function k(...s) {
|
|
121
|
+
return (i) => {
|
|
122
|
+
s.forEach((r) => {
|
|
123
|
+
if (typeof r == "function")
|
|
124
|
+
r(i);
|
|
125
|
+
else if (r && "current" in r)
|
|
126
|
+
try {
|
|
127
|
+
r.current = i;
|
|
128
|
+
} catch {
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const D = 8, x = T(
|
|
134
|
+
({ id: s, children: i, placement: r = "top", gap: a = D, triggerType: o = "all", style: t, className: e, ...n }, l) => {
|
|
135
|
+
const c = B(null), m = b({
|
|
136
|
+
placement: r
|
|
137
|
+
});
|
|
138
|
+
return j({
|
|
139
|
+
gap: a,
|
|
140
|
+
id: s,
|
|
141
|
+
placement: r,
|
|
142
|
+
tooltipRef: c,
|
|
143
|
+
triggerType: o
|
|
144
|
+
}), /* @__PURE__ */ u(
|
|
145
|
+
"div",
|
|
146
|
+
{
|
|
147
|
+
ref: k(c, l),
|
|
148
|
+
id: s,
|
|
149
|
+
className: f(S.tooltip, e),
|
|
150
|
+
...m,
|
|
151
|
+
style: {
|
|
152
|
+
"--_gap": `${a}px`,
|
|
153
|
+
positionAnchor: `--tooltip-${s}`,
|
|
154
|
+
...t
|
|
155
|
+
},
|
|
156
|
+
...n,
|
|
157
|
+
popover: "auto",
|
|
158
|
+
children: i
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
x.displayName = "Tooltip";
|
|
164
|
+
const A = T(
|
|
165
|
+
({ children: s, maxWidth: i, maxLines: r = 2, style: a, className: o, ...t }, e) => {
|
|
166
|
+
const n = {
|
|
167
|
+
"--_lines": r,
|
|
168
|
+
"--_max-width": i,
|
|
169
|
+
...a
|
|
170
|
+
};
|
|
171
|
+
return /* @__PURE__ */ u("div", { ref: e, className: f(S["tooltip-text"], o), style: n, ...t, children: s });
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
A.displayName = "Tooltip.Text";
|
|
175
|
+
function F(s) {
|
|
176
|
+
const { id: i, triggerType: r = "all", ...a } = s, o = {
|
|
177
|
+
"data-tooltip-trigger": i,
|
|
178
|
+
style: { anchorName: `--tooltip-${i}` },
|
|
179
|
+
...Object.fromEntries(Object.entries(a).map(([t, e]) => [t, String(e)]))
|
|
180
|
+
};
|
|
181
|
+
return r !== "focus" && (o.popoverTarget = i), o;
|
|
182
|
+
}
|
|
183
|
+
function H(s) {
|
|
184
|
+
const { id: i } = s, r = document.getElementById(i);
|
|
185
|
+
r && r.matches(":popover-open") && requestAnimationFrame(() => {
|
|
186
|
+
const a = document.querySelector(`[data-tooltip-trigger="${i}"]`);
|
|
187
|
+
a && document.activeElement === a && a.blur(), r.matches(":popover-open") && r.hidePopover();
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
const N = x;
|
|
191
|
+
N.Text = A;
|
|
192
|
+
N.getTooltipTriggerProps = F;
|
|
193
|
+
N.close = H;
|
|
194
|
+
export {
|
|
195
|
+
g as B,
|
|
196
|
+
_ as H,
|
|
197
|
+
y as I,
|
|
198
|
+
N as T,
|
|
199
|
+
k as c
|
|
200
|
+
};
|
package/dist/utils.js
CHANGED