@versaur/react 1.0.7 → 1.0.9
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 +32 -0
- package/dist/blocks.js +448 -386
- package/dist/forms.d.ts +47 -100
- package/dist/forms.js +297 -400
- package/dist/primitive.d.ts +40 -0
- package/dist/primitive.js +127 -113
- package/package.json +2 -2
package/dist/primitive.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ import { Badge as Badge_2 } from '@versaur/core/primitive';
|
|
|
6
6
|
import { BadgeShape } from '@versaur/core/primitive';
|
|
7
7
|
import { BadgeSize } from '@versaur/core/primitive';
|
|
8
8
|
import { BadgeVariant } from '@versaur/core/primitive';
|
|
9
|
+
import { Banner as Banner_2 } from '@versaur/core/primitive';
|
|
10
|
+
import { BannerVariant } from '@versaur/core/primitive';
|
|
9
11
|
import { Button as Button_2 } from '@versaur/core/primitive';
|
|
10
12
|
import { ButtonHTMLAttributes } from 'react';
|
|
11
13
|
import { ButtonSize } from '@versaur/core/primitive';
|
|
@@ -141,6 +143,44 @@ export { BadgeSize }
|
|
|
141
143
|
|
|
142
144
|
export { BadgeVariant }
|
|
143
145
|
|
|
146
|
+
/**
|
|
147
|
+
* Banner component for displaying notifications and alerts
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```tsx
|
|
151
|
+
* <Banner variant="danger" icon={<AlertIcon />} onDismiss={() => {}}>
|
|
152
|
+
* You need to complete your payment
|
|
153
|
+
* </Banner>
|
|
154
|
+
*
|
|
155
|
+
* <Banner variant="warning">
|
|
156
|
+
* This action cannot be undone
|
|
157
|
+
* </Banner>
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
export declare const Banner: ForwardRefExoticComponent<BannerProps & RefAttributes<HTMLDivElement>>;
|
|
161
|
+
|
|
162
|
+
export declare interface BannerProps extends HTMLAttributes<HTMLDivElement> {
|
|
163
|
+
/**
|
|
164
|
+
* Visual style variant
|
|
165
|
+
* @default 'info'
|
|
166
|
+
*/
|
|
167
|
+
variant?: Banner_2.Variant;
|
|
168
|
+
/**
|
|
169
|
+
* Icon to display on the left side
|
|
170
|
+
*/
|
|
171
|
+
icon?: ReactNode;
|
|
172
|
+
/**
|
|
173
|
+
* Callback when dismiss button is clicked
|
|
174
|
+
*/
|
|
175
|
+
onDismiss?: () => void;
|
|
176
|
+
/**
|
|
177
|
+
* Banner content (text, icons, etc.)
|
|
178
|
+
*/
|
|
179
|
+
children?: React.ReactNode;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export { BannerVariant }
|
|
183
|
+
|
|
144
184
|
/**
|
|
145
185
|
* Button component with data-attribute state machine pattern
|
|
146
186
|
*
|
package/dist/primitive.js
CHANGED
|
@@ -1,193 +1,207 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { buttonStyles as
|
|
3
|
-
import { LoaderIcon as
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { u as
|
|
6
|
-
import { c as
|
|
7
|
-
import { I as
|
|
8
|
-
import {
|
|
9
|
-
const
|
|
1
|
+
import { jsxs as x, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { buttonStyles as k, headingStyles as R, textStyles as w, avatarStyles as S, loaderStyles as K, badgeStyles as z, bannerStyles as A, dotStyles as C, kbdStyles as O } from "@versaur/core/primitive";
|
|
3
|
+
import { LoaderIcon as T, UserIcon as U, XIcon as X } from "@versaur/icons";
|
|
4
|
+
import { forwardRef as u, useState as q } from "react";
|
|
5
|
+
import { u as b } from "./use-data-attrs-iPFyfiKN.js";
|
|
6
|
+
import { c as p } from "./cx-B9vmfsc1.js";
|
|
7
|
+
import { I as B, B as F } from "./tooltip-M8EGI3lZ.js";
|
|
8
|
+
import { H as nt, T as lt } from "./tooltip-M8EGI3lZ.js";
|
|
9
|
+
const G = u(
|
|
10
10
|
({
|
|
11
11
|
variant: a = "primary",
|
|
12
|
-
size:
|
|
12
|
+
size: r = "medium",
|
|
13
13
|
loading: t = !1,
|
|
14
14
|
disabled: e = !1,
|
|
15
|
-
pressed:
|
|
15
|
+
pressed: o = !1,
|
|
16
16
|
leftIcon: s,
|
|
17
17
|
rightIcon: n,
|
|
18
|
-
children:
|
|
19
|
-
type:
|
|
20
|
-
onClick:
|
|
21
|
-
className:
|
|
22
|
-
...
|
|
18
|
+
children: l,
|
|
19
|
+
type: d = "button",
|
|
20
|
+
onClick: y,
|
|
21
|
+
className: h,
|
|
22
|
+
...m
|
|
23
23
|
}, N) => {
|
|
24
|
-
const
|
|
25
|
-
let
|
|
26
|
-
|
|
27
|
-
const
|
|
24
|
+
const g = !!s, i = !!n, v = !!l;
|
|
25
|
+
let f;
|
|
26
|
+
g && i && v ? f = "both-text" : g && v ? f = "left-text" : i && v ? f = "right-text" : g && i ? f = "both" : g ? f = "left" : i && (f = "right");
|
|
27
|
+
const H = b({
|
|
28
28
|
disabled: e || t,
|
|
29
29
|
loading: t,
|
|
30
|
-
size:
|
|
30
|
+
size: r,
|
|
31
31
|
variant: a,
|
|
32
|
-
...
|
|
33
|
-
}),
|
|
32
|
+
...f && { iconConfig: f }
|
|
33
|
+
}), j = (I) => {
|
|
34
34
|
if (e || t) {
|
|
35
|
-
|
|
35
|
+
I.preventDefault();
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
y == null || y(I);
|
|
39
39
|
};
|
|
40
|
-
return /* @__PURE__ */
|
|
40
|
+
return /* @__PURE__ */ x(
|
|
41
41
|
"button",
|
|
42
42
|
{
|
|
43
43
|
ref: N,
|
|
44
|
-
type:
|
|
45
|
-
className:
|
|
46
|
-
"aria-pressed":
|
|
44
|
+
type: d,
|
|
45
|
+
className: p(k.button, h),
|
|
46
|
+
"aria-pressed": o ? "true" : void 0,
|
|
47
47
|
"aria-busy": t ? "true" : void 0,
|
|
48
48
|
"aria-disabled": e || t ? "true" : void 0,
|
|
49
|
-
...
|
|
50
|
-
...
|
|
51
|
-
onClick:
|
|
49
|
+
...H,
|
|
50
|
+
...m,
|
|
51
|
+
onClick: j,
|
|
52
52
|
children: [
|
|
53
|
-
t ? /* @__PURE__ */
|
|
53
|
+
t ? /* @__PURE__ */ c(B, { as: T, "aria-label": "Loading", "data-loading-icon": "loader" }) : null,
|
|
54
54
|
s,
|
|
55
|
-
|
|
55
|
+
l,
|
|
56
56
|
n
|
|
57
57
|
]
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
);
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
({ as: a = "h2", size:
|
|
65
|
-
const
|
|
62
|
+
G.displayName = "Button";
|
|
63
|
+
const J = u(
|
|
64
|
+
({ as: a = "h2", size: r, weight: t, intent: e, case: o, transform: s, children: n, className: l, ...d }, y) => {
|
|
65
|
+
const h = a, m = b({
|
|
66
66
|
as: a,
|
|
67
|
-
case:
|
|
67
|
+
case: o,
|
|
68
68
|
intent: e,
|
|
69
|
-
size:
|
|
69
|
+
size: r,
|
|
70
70
|
transform: s,
|
|
71
71
|
weight: t
|
|
72
72
|
});
|
|
73
|
-
return /* @__PURE__ */
|
|
73
|
+
return /* @__PURE__ */ c(h, { ref: y, className: p(R.heading, l), ...m, ...d, children: n });
|
|
74
74
|
}
|
|
75
75
|
);
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
({ as: a = "p", size:
|
|
79
|
-
const
|
|
76
|
+
J.displayName = "Heading";
|
|
77
|
+
const M = u(
|
|
78
|
+
({ as: a = "p", size: r, weight: t, intent: e, case: o, transform: s, children: n, className: l, ...d }, y) => {
|
|
79
|
+
const h = a, m = b({
|
|
80
80
|
as: a,
|
|
81
|
-
case:
|
|
81
|
+
case: o,
|
|
82
82
|
intent: e,
|
|
83
|
-
size:
|
|
83
|
+
size: r,
|
|
84
84
|
transform: s,
|
|
85
85
|
weight: t
|
|
86
86
|
});
|
|
87
|
-
return /* @__PURE__ */
|
|
87
|
+
return /* @__PURE__ */ c(h, { ref: y, className: p(w.text, l), ...m, ...d, children: n });
|
|
88
88
|
}
|
|
89
89
|
);
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
({ variant: a = "primary", size:
|
|
93
|
-
const
|
|
94
|
-
return /* @__PURE__ */
|
|
90
|
+
M.displayName = "Text";
|
|
91
|
+
const L = u(
|
|
92
|
+
({ variant: a = "primary", size: r = "md", shape: t = "circle", children: e, className: o, ...s }, n) => {
|
|
93
|
+
const l = b({ shape: t, size: r, variant: a }), d = e || /* @__PURE__ */ c(B, { as: U });
|
|
94
|
+
return /* @__PURE__ */ c("span", { ref: n, className: p(S.avatar, o), role: "img", ...l, ...s, children: d });
|
|
95
95
|
}
|
|
96
96
|
);
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
const [n,
|
|
100
|
-
return n ? null : /* @__PURE__ */
|
|
97
|
+
L.displayName = "Avatar";
|
|
98
|
+
const D = u(({ src: a, alt: r, onError: t, className: e, ...o }, s) => {
|
|
99
|
+
const [n, l] = q(!1);
|
|
100
|
+
return n ? null : /* @__PURE__ */ c(
|
|
101
101
|
"img",
|
|
102
102
|
{
|
|
103
103
|
ref: s,
|
|
104
|
-
className:
|
|
104
|
+
className: p(S["avatar-image"], e),
|
|
105
105
|
src: a,
|
|
106
|
-
alt:
|
|
107
|
-
onError: (
|
|
108
|
-
|
|
106
|
+
alt: r,
|
|
107
|
+
onError: (d) => {
|
|
108
|
+
l(!0), t == null || t(d);
|
|
109
109
|
},
|
|
110
|
-
...
|
|
110
|
+
...o
|
|
111
111
|
}
|
|
112
112
|
);
|
|
113
113
|
});
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
Image:
|
|
117
|
-
}),
|
|
118
|
-
({ type: a = "spinner", size:
|
|
119
|
-
const n =
|
|
120
|
-
size:
|
|
114
|
+
D.displayName = "Avatar.Image";
|
|
115
|
+
const st = Object.assign(L, {
|
|
116
|
+
Image: D
|
|
117
|
+
}), P = u(
|
|
118
|
+
({ type: a = "spinner", size: r = "sm", children: t, className: e, ...o }, s) => {
|
|
119
|
+
const n = b({
|
|
120
|
+
size: r,
|
|
121
121
|
type: a
|
|
122
122
|
});
|
|
123
|
-
return /* @__PURE__ */
|
|
124
|
-
a === "spinner" && /* @__PURE__ */
|
|
123
|
+
return /* @__PURE__ */ x("div", { ref: s, className: p(K.loader, e), ...n, ...o, children: [
|
|
124
|
+
a === "spinner" && /* @__PURE__ */ c(B, { as: T, "aria-hidden": "true" }),
|
|
125
125
|
t
|
|
126
126
|
] });
|
|
127
127
|
}
|
|
128
128
|
);
|
|
129
|
-
|
|
130
|
-
const
|
|
129
|
+
P.displayName = "Loader";
|
|
130
|
+
const Q = u(
|
|
131
131
|
({
|
|
132
132
|
variant: a = "primary",
|
|
133
|
-
size:
|
|
133
|
+
size: r = "medium",
|
|
134
134
|
shape: t = "rounded",
|
|
135
135
|
iconLeft: e,
|
|
136
|
-
iconRight:
|
|
136
|
+
iconRight: o,
|
|
137
137
|
maxWidth: s,
|
|
138
138
|
children: n,
|
|
139
|
-
style:
|
|
140
|
-
className:
|
|
141
|
-
...
|
|
142
|
-
},
|
|
143
|
-
const
|
|
144
|
-
let
|
|
145
|
-
|
|
146
|
-
const
|
|
139
|
+
style: l,
|
|
140
|
+
className: d,
|
|
141
|
+
...y
|
|
142
|
+
}, h) => {
|
|
143
|
+
const m = !!e, N = !!o, g = !!n;
|
|
144
|
+
let i;
|
|
145
|
+
m && N && g ? i = "both-text" : m && g ? i = "left-text" : N && g ? i = "right-text" : m && N ? i = "both" : m ? i = "left" : N && (i = "right");
|
|
146
|
+
const v = b({
|
|
147
147
|
shape: t,
|
|
148
|
-
size:
|
|
148
|
+
size: r,
|
|
149
149
|
variant: a,
|
|
150
|
-
...
|
|
151
|
-
}),
|
|
152
|
-
...
|
|
150
|
+
...i && { iconConfig: i }
|
|
151
|
+
}), f = {
|
|
152
|
+
...l,
|
|
153
153
|
...s && { "--vers-comp-badge-max-width": s }
|
|
154
154
|
};
|
|
155
|
-
return /* @__PURE__ */
|
|
155
|
+
return /* @__PURE__ */ x("div", { ref: h, className: p(z.badge, d), ...v, ...y, style: f, children: [
|
|
156
156
|
e,
|
|
157
157
|
n,
|
|
158
|
-
|
|
158
|
+
o
|
|
159
159
|
] });
|
|
160
160
|
}
|
|
161
161
|
);
|
|
162
|
-
|
|
163
|
-
const
|
|
164
|
-
({ variant: a = "
|
|
165
|
-
const
|
|
166
|
-
size: o,
|
|
162
|
+
Q.displayName = "Badge";
|
|
163
|
+
const V = u(
|
|
164
|
+
({ variant: a = "info", icon: r, onDismiss: t, children: e, className: o, ...s }, n) => {
|
|
165
|
+
const l = b({
|
|
167
166
|
variant: a
|
|
168
167
|
});
|
|
169
|
-
return /* @__PURE__ */
|
|
168
|
+
return /* @__PURE__ */ x("div", { ref: n, className: p(A.banner, o), ...l, ...s, children: [
|
|
169
|
+
r && /* @__PURE__ */ c("div", { className: A.icon, children: r }),
|
|
170
|
+
/* @__PURE__ */ c("div", { className: A.content, children: e }),
|
|
171
|
+
t && /* @__PURE__ */ c(F, { as: X, variant: "ghost", size: "small", onClick: t, "aria-label": "Dismiss banner" })
|
|
172
|
+
] });
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
V.displayName = "Banner";
|
|
176
|
+
const Y = u(
|
|
177
|
+
({ variant: a = "primary", size: r = "medium", className: t, ...e }, o) => {
|
|
178
|
+
const s = b({
|
|
179
|
+
size: r,
|
|
180
|
+
variant: a
|
|
181
|
+
});
|
|
182
|
+
return /* @__PURE__ */ c("span", { ref: o, className: p(C.dot, t), ...s, ...e });
|
|
170
183
|
}
|
|
171
184
|
);
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
({ variant: a = "filled", size:
|
|
175
|
-
const n =
|
|
176
|
-
return /* @__PURE__ */
|
|
185
|
+
Y.displayName = "Dot";
|
|
186
|
+
const Z = u(
|
|
187
|
+
({ variant: a = "filled", size: r = "md", children: t, className: e, ...o }, s) => {
|
|
188
|
+
const n = b({ size: r, variant: a });
|
|
189
|
+
return /* @__PURE__ */ c("kbd", { ref: s, className: p(O.kbd, e), ...n, ...o, children: t });
|
|
177
190
|
}
|
|
178
191
|
);
|
|
179
|
-
|
|
192
|
+
Z.displayName = "Kbd";
|
|
180
193
|
export {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
194
|
+
st as Avatar,
|
|
195
|
+
Q as Badge,
|
|
196
|
+
V as Banner,
|
|
197
|
+
G as Button,
|
|
198
|
+
F as ButtonIcon,
|
|
199
|
+
Y as Dot,
|
|
200
|
+
J as Heading,
|
|
201
|
+
nt as Hr,
|
|
202
|
+
B as Icon,
|
|
203
|
+
Z as Kbd,
|
|
204
|
+
P as Loader,
|
|
205
|
+
M as Text,
|
|
206
|
+
lt as Tooltip
|
|
193
207
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versaur/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "React components for Versaur Design System",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react": "^18.0.0 || ^19.0.0",
|
|
50
50
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
51
|
-
"@versaur/core": "0.0.
|
|
51
|
+
"@versaur/core": "0.0.5",
|
|
52
52
|
"@versaur/icons": "1.0.0"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|