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