@kavagy/react 0.1.1
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/CHANGELOG.md +35 -0
- package/THIRD_PARTY_NOTICES.md +30 -0
- package/dist/avatar/avatar.d.ts +189 -0
- package/dist/avatar/avatar.d.ts.map +1 -0
- package/dist/avatar/avatar.js +185 -0
- package/dist/avatar/avatar.js.map +1 -0
- package/dist/avatar/index.d.ts +2 -0
- package/dist/avatar/index.js +2 -0
- package/dist/badges/badges.d.ts +149 -0
- package/dist/badges/badges.d.ts.map +1 -0
- package/dist/badges/badges.js +269 -0
- package/dist/badges/badges.js.map +1 -0
- package/dist/badges/index.d.ts +2 -0
- package/dist/badges/index.js +2 -0
- package/dist/button/button.d.ts +208 -0
- package/dist/button/button.d.ts.map +1 -0
- package/dist/button/button.js +158 -0
- package/dist/button/button.js.map +1 -0
- package/dist/button/index.d.ts +2 -0
- package/dist/button/index.js +2 -0
- package/dist/button-utility/button-utility.d.ts +59 -0
- package/dist/button-utility/button-utility.d.ts.map +1 -0
- package/dist/button-utility/button-utility.js +78 -0
- package/dist/button-utility/button-utility.js.map +1 -0
- package/dist/button-utility/index.d.ts +2 -0
- package/dist/button-utility/index.js +2 -0
- package/dist/checkbox/checkbox.d.ts +23 -0
- package/dist/checkbox/checkbox.d.ts.map +1 -0
- package/dist/checkbox/checkbox.js +81 -0
- package/dist/checkbox/checkbox.js.map +1 -0
- package/dist/checkbox/index.d.ts +2 -0
- package/dist/checkbox/index.js +2 -0
- package/dist/dropdown/dropdown.d.ts +33 -0
- package/dist/dropdown/dropdown.d.ts.map +1 -0
- package/dist/dropdown/dropdown.js +128 -0
- package/dist/dropdown/dropdown.js.map +1 -0
- package/dist/dropdown/index.d.ts +2 -0
- package/dist/dropdown/index.js +2 -0
- package/dist/featured-icon/featured-icon.d.ts +141 -0
- package/dist/featured-icon/featured-icon.d.ts.map +1 -0
- package/dist/featured-icon/featured-icon.js +292 -0
- package/dist/featured-icon/featured-icon.js.map +1 -0
- package/dist/featured-icon/index.d.ts +2 -0
- package/dist/featured-icon/index.js +2 -0
- package/dist/input/index.d.ts +2 -0
- package/dist/input/index.js +2 -0
- package/dist/input/input.d.ts +42 -0
- package/dist/input/input.d.ts.map +1 -0
- package/dist/input/input.js +136 -0
- package/dist/input/input.js.map +1 -0
- package/dist/modal/index.d.ts +2 -0
- package/dist/modal/index.js +2 -0
- package/dist/modal/modal.d.ts +8 -0
- package/dist/modal/modal.d.ts.map +1 -0
- package/dist/modal/modal.js +35 -0
- package/dist/modal/modal.js.map +1 -0
- package/dist/radio-buttons/index.d.ts +2 -0
- package/dist/radio-buttons/index.js +2 -0
- package/dist/radio-buttons/radio-buttons.d.ts +30 -0
- package/dist/radio-buttons/radio-buttons.d.ts.map +1 -0
- package/dist/radio-buttons/radio-buttons.js +71 -0
- package/dist/radio-buttons/radio-buttons.js.map +1 -0
- package/dist/select/index.d.ts +2 -0
- package/dist/select/index.js +2 -0
- package/dist/select/select.d.ts +40 -0
- package/dist/select/select.d.ts.map +1 -0
- package/dist/select/select.js +198 -0
- package/dist/select/select.js.map +1 -0
- package/dist/styles.css +2843 -0
- package/dist/table/index.d.ts +2 -0
- package/dist/table/index.js +2 -0
- package/dist/table/table.d.ts +61 -0
- package/dist/table/table.d.ts.map +1 -0
- package/dist/table/table.js +208 -0
- package/dist/table/table.js.map +1 -0
- package/dist/tabs/index.d.ts +2 -0
- package/dist/tabs/index.js +2 -0
- package/dist/tabs/tabs.d.ts +62 -0
- package/dist/tabs/tabs.d.ts.map +1 -0
- package/dist/tabs/tabs.js +120 -0
- package/dist/tabs/tabs.js.map +1 -0
- package/dist/textarea/index.d.ts +2 -0
- package/dist/textarea/index.js +2 -0
- package/dist/textarea/textarea.d.ts +26 -0
- package/dist/textarea/textarea.d.ts.map +1 -0
- package/dist/textarea/textarea.js +74 -0
- package/dist/textarea/textarea.js.map +1 -0
- package/dist/toggle/index.d.ts +2 -0
- package/dist/toggle/index.js +2 -0
- package/dist/toggle/toggle.d.ts +151 -0
- package/dist/toggle/toggle.d.ts.map +1 -0
- package/dist/toggle/toggle.js +145 -0
- package/dist/toggle/toggle.js.map +1 -0
- package/dist/tooltip/index.d.ts +2 -0
- package/dist/tooltip/index.js +2 -0
- package/dist/tooltip/tooltip.d.ts +59 -0
- package/dist/tooltip/tooltip.d.ts.map +1 -0
- package/dist/tooltip/tooltip.js +86 -0
- package/dist/tooltip/tooltip.js.map +1 -0
- package/dist/utils/cx.d.ts +21 -0
- package/dist/utils/cx.d.ts.map +1 -0
- package/dist/utils/cx.js +75 -0
- package/dist/utils/cx.js.map +1 -0
- package/dist/utils/is-react-component.d.ts +9 -0
- package/dist/utils/is-react-component.d.ts.map +1 -0
- package/dist/utils/is-react-component.js +17 -0
- package/dist/utils/is-react-component.js.map +1 -0
- package/dist/utils/tv.d.ts +6 -0
- package/dist/utils/tv.d.ts.map +1 -0
- package/dist/utils/tv.js +11 -0
- package/dist/utils/tv.js.map +1 -0
- package/package.json +146 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../utils/cx.js";
|
|
3
|
+
import { tv } from "../utils/tv.js";
|
|
4
|
+
import { isReactComponent } from "../utils/is-react-component.js";
|
|
5
|
+
import { X } from "@kavagy/icons";
|
|
6
|
+
import { forwardRef, isValidElement } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/badges/badges.tsx
|
|
9
|
+
const badgeStyles = tv({
|
|
10
|
+
slots: {
|
|
11
|
+
root: "inline-flex w-max items-center gap-1 whitespace-nowrap font-medium",
|
|
12
|
+
addon: "",
|
|
13
|
+
dismissButton: "flex cursor-pointer items-center justify-center transition duration-100 ease-linear outline-focus-ring focus-visible:outline-2"
|
|
14
|
+
},
|
|
15
|
+
variants: {
|
|
16
|
+
size: {
|
|
17
|
+
sm: {
|
|
18
|
+
root: "px-2 py-0.5 text-xs",
|
|
19
|
+
dismissButton: "p-0.5"
|
|
20
|
+
},
|
|
21
|
+
md: {
|
|
22
|
+
root: "px-2.5 py-0.5 text-sm",
|
|
23
|
+
dismissButton: "p-0.5"
|
|
24
|
+
},
|
|
25
|
+
lg: {
|
|
26
|
+
root: "gap-1.5 px-3 py-1 text-sm",
|
|
27
|
+
dismissButton: "p-0.5"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
type: {
|
|
31
|
+
"pill-color": { root: "rounded-full ring-1 ring-inset" },
|
|
32
|
+
color: { root: "rounded-md ring-1 ring-inset" },
|
|
33
|
+
modern: { root: "rounded-md bg-primary text-secondary ring-1 ring-primary shadow-xs" }
|
|
34
|
+
},
|
|
35
|
+
color: {
|
|
36
|
+
gray: {},
|
|
37
|
+
brand: {},
|
|
38
|
+
error: {},
|
|
39
|
+
warning: {},
|
|
40
|
+
success: {},
|
|
41
|
+
blue: {},
|
|
42
|
+
indigo: {},
|
|
43
|
+
pink: {},
|
|
44
|
+
orange: {}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
compoundVariants: [
|
|
48
|
+
{
|
|
49
|
+
type: ["pill-color", "color"],
|
|
50
|
+
color: "gray",
|
|
51
|
+
class: {
|
|
52
|
+
root: "bg-utility-neutral-50 text-utility-neutral-700 ring-utility-neutral-200",
|
|
53
|
+
addon: "text-utility-neutral-500"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: ["pill-color", "color"],
|
|
58
|
+
color: "brand",
|
|
59
|
+
class: {
|
|
60
|
+
root: "bg-utility-brand-50 text-utility-brand-700 ring-utility-brand-200",
|
|
61
|
+
addon: "text-utility-brand-500"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: ["pill-color", "color"],
|
|
66
|
+
color: "error",
|
|
67
|
+
class: {
|
|
68
|
+
root: "bg-utility-red-50 text-utility-red-700 ring-utility-red-200",
|
|
69
|
+
addon: "text-utility-red-500"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
type: ["pill-color", "color"],
|
|
74
|
+
color: "warning",
|
|
75
|
+
class: {
|
|
76
|
+
root: "bg-utility-yellow-50 text-utility-yellow-700 ring-utility-yellow-200",
|
|
77
|
+
addon: "text-utility-yellow-500"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: ["pill-color", "color"],
|
|
82
|
+
color: "success",
|
|
83
|
+
class: {
|
|
84
|
+
root: "bg-utility-green-50 text-utility-green-700 ring-utility-green-200",
|
|
85
|
+
addon: "text-utility-green-500"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: ["pill-color", "color"],
|
|
90
|
+
color: "blue",
|
|
91
|
+
class: {
|
|
92
|
+
root: "bg-utility-blue-50 text-utility-blue-700 ring-utility-blue-200",
|
|
93
|
+
addon: "text-utility-blue-500"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
type: ["pill-color", "color"],
|
|
98
|
+
color: "indigo",
|
|
99
|
+
class: {
|
|
100
|
+
root: "bg-utility-indigo-50 text-utility-indigo-700 ring-utility-indigo-200",
|
|
101
|
+
addon: "text-utility-indigo-500"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
type: ["pill-color", "color"],
|
|
106
|
+
color: "pink",
|
|
107
|
+
class: {
|
|
108
|
+
root: "bg-utility-pink-50 text-utility-pink-700 ring-utility-pink-200",
|
|
109
|
+
addon: "text-utility-pink-500"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
type: ["pill-color", "color"],
|
|
114
|
+
color: "orange",
|
|
115
|
+
class: {
|
|
116
|
+
root: "bg-utility-orange-50 text-utility-orange-700 ring-utility-orange-200",
|
|
117
|
+
addon: "text-utility-orange-500"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
type: "modern",
|
|
122
|
+
color: "gray",
|
|
123
|
+
class: { addon: "text-utility-neutral-500" }
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: "modern",
|
|
127
|
+
color: "brand",
|
|
128
|
+
class: { addon: "text-utility-brand-500" }
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
type: "modern",
|
|
132
|
+
color: "error",
|
|
133
|
+
class: { addon: "text-utility-red-500" }
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
type: "modern",
|
|
137
|
+
color: "warning",
|
|
138
|
+
class: { addon: "text-utility-yellow-500" }
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
type: "modern",
|
|
142
|
+
color: "success",
|
|
143
|
+
class: { addon: "text-utility-green-500" }
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
type: "modern",
|
|
147
|
+
color: "blue",
|
|
148
|
+
class: { addon: "text-utility-blue-500" }
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
type: "modern",
|
|
152
|
+
color: "indigo",
|
|
153
|
+
class: { addon: "text-utility-indigo-500" }
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
type: "modern",
|
|
157
|
+
color: "pink",
|
|
158
|
+
class: { addon: "text-utility-pink-500" }
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
type: "modern",
|
|
162
|
+
color: "orange",
|
|
163
|
+
class: { addon: "text-utility-orange-500" }
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
type: "pill-color",
|
|
167
|
+
class: { dismissButton: "rounded-full" }
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
type: ["color", "modern"],
|
|
171
|
+
class: { dismissButton: "rounded-[3px]" }
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
color: "gray",
|
|
175
|
+
class: { dismissButton: "text-utility-neutral-400 hover:bg-utility-neutral-100 hover:text-utility-neutral-500" }
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
color: "brand",
|
|
179
|
+
class: { dismissButton: "text-utility-brand-400 hover:bg-utility-brand-100 hover:text-utility-brand-500" }
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
color: "error",
|
|
183
|
+
class: { dismissButton: "text-utility-red-400 hover:bg-utility-red-100 hover:text-utility-red-500" }
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
color: "warning",
|
|
187
|
+
class: { dismissButton: "text-utility-yellow-400 hover:bg-utility-yellow-100 hover:text-utility-yellow-500" }
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
color: "success",
|
|
191
|
+
class: { dismissButton: "text-utility-green-400 hover:bg-utility-green-100 hover:text-utility-green-500" }
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
color: "blue",
|
|
195
|
+
class: { dismissButton: "text-utility-blue-400 hover:bg-utility-blue-100 hover:text-utility-blue-500" }
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
color: "indigo",
|
|
199
|
+
class: { dismissButton: "text-utility-indigo-400 hover:bg-utility-indigo-100 hover:text-utility-indigo-500" }
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
color: "pink",
|
|
203
|
+
class: { dismissButton: "text-utility-pink-400 hover:bg-utility-pink-100 hover:text-utility-pink-500" }
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
color: "orange",
|
|
207
|
+
class: { dismissButton: "text-utility-orange-400 hover:bg-utility-orange-100 hover:text-utility-orange-500" }
|
|
208
|
+
}
|
|
209
|
+
],
|
|
210
|
+
defaultVariants: {
|
|
211
|
+
size: "md",
|
|
212
|
+
type: "pill-color",
|
|
213
|
+
color: "gray"
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
const Badge = forwardRef(function Badge(props, ref) {
|
|
217
|
+
const { size, type, color, dot, iconLeading: IconLeading, iconTrailing: IconTrailing, onDismiss, dismissLabel = "Remove", children, className } = props;
|
|
218
|
+
const slots = badgeStyles({
|
|
219
|
+
size,
|
|
220
|
+
type,
|
|
221
|
+
color
|
|
222
|
+
});
|
|
223
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
224
|
+
ref,
|
|
225
|
+
"data-badge": true,
|
|
226
|
+
className: cx(slots.root(), className),
|
|
227
|
+
children: [
|
|
228
|
+
dot && /* @__PURE__ */ jsx("svg", {
|
|
229
|
+
"aria-hidden": "true",
|
|
230
|
+
"data-icon": "dot",
|
|
231
|
+
viewBox: "0 0 6 6",
|
|
232
|
+
fill: "none",
|
|
233
|
+
className: cx("size-2", slots.addon()),
|
|
234
|
+
children: /* @__PURE__ */ jsx("circle", {
|
|
235
|
+
cx: "3",
|
|
236
|
+
cy: "3",
|
|
237
|
+
r: "3",
|
|
238
|
+
fill: "currentColor"
|
|
239
|
+
})
|
|
240
|
+
}),
|
|
241
|
+
isValidElement(IconLeading) && IconLeading,
|
|
242
|
+
isReactComponent(IconLeading) && /* @__PURE__ */ jsx(IconLeading, {
|
|
243
|
+
"data-icon": "leading",
|
|
244
|
+
className: cx("size-3 stroke-[3px]", slots.addon())
|
|
245
|
+
}),
|
|
246
|
+
children,
|
|
247
|
+
isValidElement(IconTrailing) && IconTrailing,
|
|
248
|
+
isReactComponent(IconTrailing) && /* @__PURE__ */ jsx(IconTrailing, {
|
|
249
|
+
"data-icon": "trailing",
|
|
250
|
+
className: cx("size-3 stroke-[3px]", slots.addon())
|
|
251
|
+
}),
|
|
252
|
+
onDismiss && /* @__PURE__ */ jsx("button", {
|
|
253
|
+
type: "button",
|
|
254
|
+
"aria-label": dismissLabel,
|
|
255
|
+
onClick: onDismiss,
|
|
256
|
+
className: slots.dismissButton(),
|
|
257
|
+
children: /* @__PURE__ */ jsx(X, {
|
|
258
|
+
"data-icon": "dismiss",
|
|
259
|
+
className: "size-3 stroke-[3px] transition-inherit-all"
|
|
260
|
+
})
|
|
261
|
+
})
|
|
262
|
+
]
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
Badge.displayName = "Badge";
|
|
266
|
+
//#endregion
|
|
267
|
+
export { Badge, badgeStyles };
|
|
268
|
+
|
|
269
|
+
//# sourceMappingURL=badges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badges.js","names":["CloseX"],"sources":["../../src/badges/badges.tsx"],"sourcesContent":["'use client';\n\n/* @kavagy-source: untitledui/base/badges/badges.tsx */\n\nimport { X as CloseX } from '@kavagy/icons';\nimport type { FC, ReactNode } from 'react';\nimport { forwardRef, isValidElement } from 'react';\nimport { cx } from '../utils/cx';\nimport { isReactComponent } from '../utils/is-react-component';\nimport type { VariantProps } from '../utils/tv';\nimport { tv } from '../utils/tv';\n\n// `slate`, `sky`, and `purple` existed in the original scaffold (@untitledui) but have no\n// matching `utility.*` scale in the Kavagy token taxonomy — only the families listed\n// below do. See docs/ARCHITECTURE.md, \"Token taxonomy\" section.\nexport const badgeStyles = tv({\n slots: {\n root: 'inline-flex w-max items-center gap-1 whitespace-nowrap font-medium',\n addon: '',\n dismissButton:\n 'flex cursor-pointer items-center justify-center transition duration-100 ease-linear outline-focus-ring focus-visible:outline-2',\n },\n variants: {\n size: {\n sm: { root: 'px-2 py-0.5 text-xs', dismissButton: 'p-0.5' },\n md: { root: 'px-2.5 py-0.5 text-sm', dismissButton: 'p-0.5' },\n lg: { root: 'gap-1.5 px-3 py-1 text-sm', dismissButton: 'p-0.5' },\n },\n type: {\n 'pill-color': { root: 'rounded-full ring-1 ring-inset' },\n color: { root: 'rounded-md ring-1 ring-inset' },\n modern: { root: 'rounded-md bg-primary text-secondary ring-1 ring-primary shadow-xs' },\n },\n color: {\n gray: {},\n brand: {},\n error: {},\n warning: {},\n success: {},\n blue: {},\n indigo: {},\n pink: {},\n orange: {},\n },\n },\n compoundVariants: [\n {\n type: ['pill-color', 'color'],\n color: 'gray',\n class: {\n root: 'bg-utility-neutral-50 text-utility-neutral-700 ring-utility-neutral-200',\n addon: 'text-utility-neutral-500',\n },\n },\n {\n type: ['pill-color', 'color'],\n color: 'brand',\n class: {\n root: 'bg-utility-brand-50 text-utility-brand-700 ring-utility-brand-200',\n addon: 'text-utility-brand-500',\n },\n },\n {\n type: ['pill-color', 'color'],\n color: 'error',\n class: {\n root: 'bg-utility-red-50 text-utility-red-700 ring-utility-red-200',\n addon: 'text-utility-red-500',\n },\n },\n {\n type: ['pill-color', 'color'],\n color: 'warning',\n class: {\n root: 'bg-utility-yellow-50 text-utility-yellow-700 ring-utility-yellow-200',\n addon: 'text-utility-yellow-500',\n },\n },\n {\n type: ['pill-color', 'color'],\n color: 'success',\n class: {\n root: 'bg-utility-green-50 text-utility-green-700 ring-utility-green-200',\n addon: 'text-utility-green-500',\n },\n },\n {\n type: ['pill-color', 'color'],\n color: 'blue',\n class: {\n root: 'bg-utility-blue-50 text-utility-blue-700 ring-utility-blue-200',\n addon: 'text-utility-blue-500',\n },\n },\n {\n type: ['pill-color', 'color'],\n color: 'indigo',\n class: {\n root: 'bg-utility-indigo-50 text-utility-indigo-700 ring-utility-indigo-200',\n addon: 'text-utility-indigo-500',\n },\n },\n {\n type: ['pill-color', 'color'],\n color: 'pink',\n class: {\n root: 'bg-utility-pink-50 text-utility-pink-700 ring-utility-pink-200',\n addon: 'text-utility-pink-500',\n },\n },\n {\n type: ['pill-color', 'color'],\n color: 'orange',\n class: {\n root: 'bg-utility-orange-50 text-utility-orange-700 ring-utility-orange-200',\n addon: 'text-utility-orange-500',\n },\n },\n { type: 'modern', color: 'gray', class: { addon: 'text-utility-neutral-500' } },\n { type: 'modern', color: 'brand', class: { addon: 'text-utility-brand-500' } },\n { type: 'modern', color: 'error', class: { addon: 'text-utility-red-500' } },\n { type: 'modern', color: 'warning', class: { addon: 'text-utility-yellow-500' } },\n { type: 'modern', color: 'success', class: { addon: 'text-utility-green-500' } },\n { type: 'modern', color: 'blue', class: { addon: 'text-utility-blue-500' } },\n { type: 'modern', color: 'indigo', class: { addon: 'text-utility-indigo-500' } },\n { type: 'modern', color: 'pink', class: { addon: 'text-utility-pink-500' } },\n { type: 'modern', color: 'orange', class: { addon: 'text-utility-orange-500' } },\n { type: 'pill-color', class: { dismissButton: 'rounded-full' } },\n { type: ['color', 'modern'], class: { dismissButton: 'rounded-[3px]' } },\n {\n color: 'gray',\n class: {\n dismissButton:\n 'text-utility-neutral-400 hover:bg-utility-neutral-100 hover:text-utility-neutral-500',\n },\n },\n {\n color: 'brand',\n class: {\n dismissButton:\n 'text-utility-brand-400 hover:bg-utility-brand-100 hover:text-utility-brand-500',\n },\n },\n {\n color: 'error',\n class: {\n dismissButton: 'text-utility-red-400 hover:bg-utility-red-100 hover:text-utility-red-500',\n },\n },\n {\n color: 'warning',\n class: {\n dismissButton:\n 'text-utility-yellow-400 hover:bg-utility-yellow-100 hover:text-utility-yellow-500',\n },\n },\n {\n color: 'success',\n class: {\n dismissButton:\n 'text-utility-green-400 hover:bg-utility-green-100 hover:text-utility-green-500',\n },\n },\n {\n color: 'blue',\n class: {\n dismissButton:\n 'text-utility-blue-400 hover:bg-utility-blue-100 hover:text-utility-blue-500',\n },\n },\n {\n color: 'indigo',\n class: {\n dismissButton:\n 'text-utility-indigo-400 hover:bg-utility-indigo-100 hover:text-utility-indigo-500',\n },\n },\n {\n color: 'pink',\n class: {\n dismissButton:\n 'text-utility-pink-400 hover:bg-utility-pink-100 hover:text-utility-pink-500',\n },\n },\n {\n color: 'orange',\n class: {\n dismissButton:\n 'text-utility-orange-400 hover:bg-utility-orange-100 hover:text-utility-orange-500',\n },\n },\n ],\n defaultVariants: { size: 'md', type: 'pill-color', color: 'gray' },\n});\n\ntype BadgeVariants = VariantProps<typeof badgeStyles>;\n\nexport interface BadgeProps {\n size?: BadgeVariants['size'];\n type?: BadgeVariants['type'];\n color?: BadgeVariants['color'];\n /** Renders a status dot before the content. */\n dot?: boolean;\n iconLeading?: FC<{ className?: string }> | ReactNode;\n iconTrailing?: FC<{ className?: string }> | ReactNode;\n /** Renders a close button; once `onDismiss` is passed, the badge becomes dismissible. */\n onDismiss?: () => void;\n dismissLabel?: string;\n children?: ReactNode;\n className?: string;\n}\n\nexport const Badge = forwardRef<HTMLSpanElement, BadgeProps>(function Badge(props, ref) {\n const {\n size,\n type,\n color,\n dot,\n iconLeading: IconLeading,\n iconTrailing: IconTrailing,\n onDismiss,\n dismissLabel = 'Remove',\n children,\n className,\n } = props;\n\n const slots = badgeStyles({ size, type, color });\n\n return (\n <span ref={ref} data-badge className={cx(slots.root(), className)}>\n {dot && (\n <svg\n aria-hidden=\"true\"\n data-icon=\"dot\"\n viewBox=\"0 0 6 6\"\n fill=\"none\"\n className={cx('size-2', slots.addon())}\n >\n <circle cx=\"3\" cy=\"3\" r=\"3\" fill=\"currentColor\" />\n </svg>\n )}\n\n {isValidElement(IconLeading) && IconLeading}\n {isReactComponent(IconLeading) && (\n <IconLeading data-icon=\"leading\" className={cx('size-3 stroke-[3px]', slots.addon())} />\n )}\n\n {children}\n\n {isValidElement(IconTrailing) && IconTrailing}\n {isReactComponent(IconTrailing) && (\n <IconTrailing data-icon=\"trailing\" className={cx('size-3 stroke-[3px]', slots.addon())} />\n )}\n\n {onDismiss && (\n <button\n type=\"button\"\n aria-label={dismissLabel}\n onClick={onDismiss}\n className={slots.dismissButton()}\n >\n <CloseX data-icon=\"dismiss\" className=\"size-3 stroke-[3px] transition-inherit-all\" />\n </button>\n )}\n </span>\n );\n});\n\nBadge.displayName = 'Badge';\n"],"mappings":"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"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { VariantProps } from "../utils/tv.js";
|
|
2
|
+
import { FC, ReactNode } from "react";
|
|
3
|
+
import { ButtonProps as ButtonProps$1, LinkProps } from "react-aria-components";
|
|
4
|
+
//#region src/button/button.d.ts
|
|
5
|
+
export declare const buttonStyles: import("tailwind-variants").TVReturnType<{
|
|
6
|
+
size: {
|
|
7
|
+
xs: {
|
|
8
|
+
root: string;
|
|
9
|
+
};
|
|
10
|
+
sm: {
|
|
11
|
+
root: string;
|
|
12
|
+
};
|
|
13
|
+
md: {
|
|
14
|
+
root: string;
|
|
15
|
+
};
|
|
16
|
+
lg: {
|
|
17
|
+
root: string;
|
|
18
|
+
};
|
|
19
|
+
xl: {
|
|
20
|
+
root: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
color: {
|
|
24
|
+
primary: {
|
|
25
|
+
root: string;
|
|
26
|
+
};
|
|
27
|
+
secondary: {
|
|
28
|
+
root: string;
|
|
29
|
+
};
|
|
30
|
+
tertiary: {
|
|
31
|
+
root: string;
|
|
32
|
+
};
|
|
33
|
+
'link-color': {
|
|
34
|
+
root: string;
|
|
35
|
+
};
|
|
36
|
+
'link-gray': {
|
|
37
|
+
root: string;
|
|
38
|
+
};
|
|
39
|
+
'primary-destructive': {
|
|
40
|
+
root: string;
|
|
41
|
+
};
|
|
42
|
+
'secondary-destructive': {
|
|
43
|
+
root: string;
|
|
44
|
+
};
|
|
45
|
+
'tertiary-destructive': {
|
|
46
|
+
root: string;
|
|
47
|
+
};
|
|
48
|
+
'link-destructive': {
|
|
49
|
+
root: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
isLink: {
|
|
53
|
+
true: {};
|
|
54
|
+
};
|
|
55
|
+
noTextPadding: {
|
|
56
|
+
false: {
|
|
57
|
+
text: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
}, {
|
|
61
|
+
root: string[];
|
|
62
|
+
icon: string;
|
|
63
|
+
text: string;
|
|
64
|
+
}, undefined, {
|
|
65
|
+
size: {
|
|
66
|
+
xs: {
|
|
67
|
+
root: string;
|
|
68
|
+
};
|
|
69
|
+
sm: {
|
|
70
|
+
root: string;
|
|
71
|
+
};
|
|
72
|
+
md: {
|
|
73
|
+
root: string;
|
|
74
|
+
};
|
|
75
|
+
lg: {
|
|
76
|
+
root: string;
|
|
77
|
+
};
|
|
78
|
+
xl: {
|
|
79
|
+
root: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
color: {
|
|
83
|
+
primary: {
|
|
84
|
+
root: string;
|
|
85
|
+
};
|
|
86
|
+
secondary: {
|
|
87
|
+
root: string;
|
|
88
|
+
};
|
|
89
|
+
tertiary: {
|
|
90
|
+
root: string;
|
|
91
|
+
};
|
|
92
|
+
'link-color': {
|
|
93
|
+
root: string;
|
|
94
|
+
};
|
|
95
|
+
'link-gray': {
|
|
96
|
+
root: string;
|
|
97
|
+
};
|
|
98
|
+
'primary-destructive': {
|
|
99
|
+
root: string;
|
|
100
|
+
};
|
|
101
|
+
'secondary-destructive': {
|
|
102
|
+
root: string;
|
|
103
|
+
};
|
|
104
|
+
'tertiary-destructive': {
|
|
105
|
+
root: string;
|
|
106
|
+
};
|
|
107
|
+
'link-destructive': {
|
|
108
|
+
root: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
isLink: {
|
|
112
|
+
true: {};
|
|
113
|
+
};
|
|
114
|
+
noTextPadding: {
|
|
115
|
+
false: {
|
|
116
|
+
text: string;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
}, {
|
|
120
|
+
root: string[];
|
|
121
|
+
icon: string;
|
|
122
|
+
text: string;
|
|
123
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
124
|
+
size: {
|
|
125
|
+
xs: {
|
|
126
|
+
root: string;
|
|
127
|
+
};
|
|
128
|
+
sm: {
|
|
129
|
+
root: string;
|
|
130
|
+
};
|
|
131
|
+
md: {
|
|
132
|
+
root: string;
|
|
133
|
+
};
|
|
134
|
+
lg: {
|
|
135
|
+
root: string;
|
|
136
|
+
};
|
|
137
|
+
xl: {
|
|
138
|
+
root: string;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
color: {
|
|
142
|
+
primary: {
|
|
143
|
+
root: string;
|
|
144
|
+
};
|
|
145
|
+
secondary: {
|
|
146
|
+
root: string;
|
|
147
|
+
};
|
|
148
|
+
tertiary: {
|
|
149
|
+
root: string;
|
|
150
|
+
};
|
|
151
|
+
'link-color': {
|
|
152
|
+
root: string;
|
|
153
|
+
};
|
|
154
|
+
'link-gray': {
|
|
155
|
+
root: string;
|
|
156
|
+
};
|
|
157
|
+
'primary-destructive': {
|
|
158
|
+
root: string;
|
|
159
|
+
};
|
|
160
|
+
'secondary-destructive': {
|
|
161
|
+
root: string;
|
|
162
|
+
};
|
|
163
|
+
'tertiary-destructive': {
|
|
164
|
+
root: string;
|
|
165
|
+
};
|
|
166
|
+
'link-destructive': {
|
|
167
|
+
root: string;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
isLink: {
|
|
171
|
+
true: {};
|
|
172
|
+
};
|
|
173
|
+
noTextPadding: {
|
|
174
|
+
false: {
|
|
175
|
+
text: string;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
}, {
|
|
179
|
+
root: string[];
|
|
180
|
+
icon: string;
|
|
181
|
+
text: string;
|
|
182
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
183
|
+
type ButtonVariants = VariantProps<typeof buttonStyles>;
|
|
184
|
+
export interface ButtonBaseProps {
|
|
185
|
+
size?: ButtonVariants['size'];
|
|
186
|
+
color?: ButtonVariants['color'];
|
|
187
|
+
isDisabled?: boolean;
|
|
188
|
+
isLoading?: boolean;
|
|
189
|
+
iconLeading?: FC<{
|
|
190
|
+
className?: string;
|
|
191
|
+
}> | ReactNode;
|
|
192
|
+
iconTrailing?: FC<{
|
|
193
|
+
className?: string;
|
|
194
|
+
}> | ReactNode;
|
|
195
|
+
noTextPadding?: boolean;
|
|
196
|
+
showTextWhileLoading?: boolean;
|
|
197
|
+
children?: ReactNode;
|
|
198
|
+
className?: string;
|
|
199
|
+
}
|
|
200
|
+
export interface ButtonProps extends ButtonBaseProps, Omit<ButtonProps$1, 'children' | 'className' | 'style'> {
|
|
201
|
+
href?: never;
|
|
202
|
+
}
|
|
203
|
+
export interface ButtonLinkProps extends ButtonBaseProps, Omit<LinkProps, 'children' | 'className' | 'style'> {
|
|
204
|
+
href: NonNullable<LinkProps['href']>;
|
|
205
|
+
}
|
|
206
|
+
export declare const Button: import("react").ForwardRefExoticComponent<(ButtonProps | ButtonLinkProps) & import("react").RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
207
|
+
//#endregion
|
|
208
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","names":[],"sources":["../../src/button/button.tsx"],"mappings":";;;;qBAgBa,0CAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyEpB,iBAAiB,oBAAoB;iBAEzB;EACf,OAAO;EACP,QAAQ;EACR;EACA;EACA,cAAc;IAAK;OAAwB;EAC3C,eAAe;IAAK;OAAwB;EAC5C;EACA;EACA,WAAW;EACX;;iBAGe,oBACP,iBACN,KAAK;EACP;;iBAGe,wBACP,iBACN,KAAK;EACP,MAAM,YAAY;;qBAGP,wBAAM,2BAAA,cAAA,mCAAA,cAAA,oBAAA"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../utils/cx.js";
|
|
3
|
+
import { tv } from "../utils/tv.js";
|
|
4
|
+
import { isReactComponent } from "../utils/is-react-component.js";
|
|
5
|
+
import { forwardRef, isValidElement } from "react";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Button as Button$1, Link } from "react-aria-components";
|
|
8
|
+
//#region src/button/button.tsx
|
|
9
|
+
const buttonStyles = tv({
|
|
10
|
+
slots: {
|
|
11
|
+
root: [
|
|
12
|
+
"group relative inline-flex h-max cursor-pointer items-center justify-center whitespace-nowrap",
|
|
13
|
+
"outline-focus-ring transition duration-100 ease-linear before:absolute",
|
|
14
|
+
"focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
15
|
+
"in-data-input-wrapper:shadow-xs in-data-input-wrapper:focus:!z-50 in-data-input-wrapper:in-data-leading:-mr-px in-data-input-wrapper:in-data-leading:rounded-r-none in-data-input-wrapper:in-data-leading:before:rounded-r-none in-data-input-wrapper:in-data-trailing:-ml-px in-data-input-wrapper:in-data-trailing:rounded-l-none in-data-input-wrapper:in-data-trailing:before:rounded-l-none",
|
|
16
|
+
"disabled:cursor-not-allowed disabled:opacity-50 in-data-input-wrapper:disabled:opacity-100",
|
|
17
|
+
"*:data-icon:pointer-events-none *:data-icon:size-5 *:data-icon:shrink-0 *:data-icon:transition-inherit-all"
|
|
18
|
+
],
|
|
19
|
+
icon: "pointer-events-none size-5 shrink-0 transition-inherit-all",
|
|
20
|
+
text: "transition-inherit-all"
|
|
21
|
+
},
|
|
22
|
+
variants: {
|
|
23
|
+
size: {
|
|
24
|
+
xs: { root: "gap-1 rounded-lg px-2.5 py-1.5 text-sm font-semibold before:rounded-[7px] data-icon-only:p-2 in-data-input-wrapper:px-3.5 in-data-input-wrapper:py-2.5 in-data-input-wrapper:data-icon-only:p-2.5 *:data-icon:size-4 *:data-icon:stroke-[2.25px]" },
|
|
25
|
+
sm: { root: "gap-1 rounded-lg px-3 py-2 text-sm font-semibold before:rounded-[7px] data-icon-only:p-2 in-data-input-wrapper:px-3.5 in-data-input-wrapper:py-2.5 in-data-input-wrapper:data-icon-only:p-2.5" },
|
|
26
|
+
md: { root: "gap-1 rounded-lg px-3.5 py-2.5 text-sm font-semibold before:rounded-[7px] data-icon-only:p-2.5 in-data-input-wrapper:gap-1.5 in-data-input-wrapper:px-4 in-data-input-wrapper:text-md in-data-input-wrapper:data-icon-only:p-3" },
|
|
27
|
+
lg: { root: "gap-1.5 rounded-lg px-4 py-2.5 text-md font-semibold before:rounded-[7px] data-icon-only:p-3" },
|
|
28
|
+
xl: { root: "gap-1.5 rounded-lg px-4.5 py-3 text-md font-semibold before:rounded-[7px] data-icon-only:p-3.5" }
|
|
29
|
+
},
|
|
30
|
+
color: {
|
|
31
|
+
primary: { root: "bg-brand-solid text-primary_on-brand shadow-xs-skeuomorphic ring-1 ring-transparent ring-inset hover:bg-brand-solid_hover data-loading:bg-brand-solid_hover before:absolute before:inset-px before:border before:border-white/12 before:mask-b-from-0% *:data-icon:text-primary_on-brand/60 hover:*:data-icon:text-primary_on-brand/70" },
|
|
32
|
+
secondary: { root: "bg-primary text-secondary shadow-xs-skeuomorphic ring-1 ring-primary ring-inset hover:bg-primary_hover hover:text-secondary_hover data-loading:bg-primary_hover *:data-icon:text-fg-quaternary hover:*:data-icon:text-fg-quaternary_hover" },
|
|
33
|
+
tertiary: { root: "text-tertiary hover:bg-primary_hover hover:text-tertiary_hover data-loading:bg-primary_hover *:data-icon:text-fg-quaternary hover:*:data-icon:text-fg-quaternary_hover" },
|
|
34
|
+
"link-color": { root: "justify-normal rounded p-0! text-brand-secondary hover:text-brand-secondary_hover *:data-text:underline *:data-text:decoration-transparent hover:*:data-text:decoration-fg-brand-secondary_alt *:data-icon:text-fg-brand-secondary_alt hover:*:data-icon:text-fg-brand-secondary_hover" },
|
|
35
|
+
"link-gray": { root: "justify-normal rounded p-0! text-tertiary hover:text-tertiary_hover *:data-text:underline *:data-text:decoration-transparent hover:*:data-text:decoration-fg-quaternary *:data-icon:text-fg-quaternary hover:*:data-icon:text-fg-quaternary_hover" },
|
|
36
|
+
"primary-destructive": { root: "bg-error-solid text-white shadow-xs-skeuomorphic ring-1 ring-transparent outline-error ring-inset hover:bg-error-solid_hover data-loading:bg-error-solid_hover before:absolute before:inset-px before:border before:border-white/12 before:mask-b-from-0% *:data-icon:text-white/60 hover:*:data-icon:text-white/70" },
|
|
37
|
+
"secondary-destructive": { root: "bg-primary text-error-primary shadow-xs-skeuomorphic ring-1 ring-error_subtle outline-error ring-inset hover:bg-error-primary hover:text-error-primary_hover data-loading:bg-error-primary *:data-icon:text-fg-error-secondary hover:*:data-icon:text-fg-error-primary" },
|
|
38
|
+
"tertiary-destructive": { root: "text-error-primary outline-error hover:bg-error-primary hover:text-error-primary_hover data-loading:bg-error-primary *:data-icon:text-fg-error-secondary hover:*:data-icon:text-fg-error-primary" },
|
|
39
|
+
"link-destructive": { root: "justify-normal rounded p-0! text-error-primary outline-error hover:text-error-primary_hover *:data-text:underline *:data-text:decoration-transparent *:data-text:underline-offset-2 hover:*:data-text:decoration-current *:data-icon:text-fg-error-secondary hover:*:data-icon:text-fg-error-primary" }
|
|
40
|
+
},
|
|
41
|
+
isLink: { true: {} },
|
|
42
|
+
noTextPadding: { false: { text: "px-0.5" } }
|
|
43
|
+
},
|
|
44
|
+
compoundVariants: [
|
|
45
|
+
{
|
|
46
|
+
isLink: true,
|
|
47
|
+
size: "xs",
|
|
48
|
+
class: { root: "gap-1 *:data-text:underline-offset-3" }
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
isLink: true,
|
|
52
|
+
size: "sm",
|
|
53
|
+
class: { root: "gap-1 *:data-text:underline-offset-3" }
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
isLink: true,
|
|
57
|
+
size: "md",
|
|
58
|
+
class: { root: "gap-1 *:data-text:underline-offset-4" }
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
isLink: true,
|
|
62
|
+
size: "lg",
|
|
63
|
+
class: { root: "gap-1.5 *:data-text:underline-offset-4" }
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
isLink: true,
|
|
67
|
+
size: "xl",
|
|
68
|
+
class: { root: "gap-1.5 *:data-text:underline-offset-4" }
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
defaultVariants: {
|
|
72
|
+
size: "sm",
|
|
73
|
+
color: "primary",
|
|
74
|
+
noTextPadding: false
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
const Button = forwardRef(function Button(props, ref) {
|
|
78
|
+
const { size, color, children, className, noTextPadding, iconLeading: IconLeading, iconTrailing: IconTrailing, isDisabled, isLoading, showTextWhileLoading, ...rest } = props;
|
|
79
|
+
const href = "href" in props ? props.href : void 0;
|
|
80
|
+
const isLinkStyle = color === "link-gray" || color === "link-color" || color === "link-destructive";
|
|
81
|
+
const isIconOnly = Boolean((IconLeading || IconTrailing) && !children);
|
|
82
|
+
const slots = buttonStyles({
|
|
83
|
+
size,
|
|
84
|
+
color,
|
|
85
|
+
isLink: isLinkStyle,
|
|
86
|
+
noTextPadding: isLinkStyle ? true : Boolean(noTextPadding)
|
|
87
|
+
});
|
|
88
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
89
|
+
isValidElement(IconLeading) && IconLeading,
|
|
90
|
+
isReactComponent(IconLeading) && /* @__PURE__ */ jsx(IconLeading, {
|
|
91
|
+
"data-icon": "leading",
|
|
92
|
+
className: slots.icon()
|
|
93
|
+
}),
|
|
94
|
+
isLoading && /* @__PURE__ */ jsxs("svg", {
|
|
95
|
+
fill: "none",
|
|
96
|
+
"aria-hidden": "true",
|
|
97
|
+
"data-icon": "loading",
|
|
98
|
+
viewBox: "0 0 20 20",
|
|
99
|
+
className: cx(slots.icon(), !showTextWhileLoading && "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"),
|
|
100
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
101
|
+
className: "stroke-current opacity-30",
|
|
102
|
+
cx: "10",
|
|
103
|
+
cy: "10",
|
|
104
|
+
r: "8",
|
|
105
|
+
fill: "none",
|
|
106
|
+
strokeWidth: "2"
|
|
107
|
+
}), /* @__PURE__ */ jsx("circle", {
|
|
108
|
+
className: "origin-center animate-spin stroke-current",
|
|
109
|
+
cx: "10",
|
|
110
|
+
cy: "10",
|
|
111
|
+
r: "8",
|
|
112
|
+
fill: "none",
|
|
113
|
+
strokeWidth: "2",
|
|
114
|
+
strokeDasharray: "12.5 50",
|
|
115
|
+
strokeLinecap: "round"
|
|
116
|
+
})]
|
|
117
|
+
}),
|
|
118
|
+
children && /* @__PURE__ */ jsx("span", {
|
|
119
|
+
"data-text": true,
|
|
120
|
+
className: slots.text(),
|
|
121
|
+
children
|
|
122
|
+
}),
|
|
123
|
+
isValidElement(IconTrailing) && IconTrailing,
|
|
124
|
+
isReactComponent(IconTrailing) && /* @__PURE__ */ jsx(IconTrailing, {
|
|
125
|
+
"data-icon": "trailing",
|
|
126
|
+
className: slots.icon()
|
|
127
|
+
})
|
|
128
|
+
] });
|
|
129
|
+
const shared = {
|
|
130
|
+
"data-loading": isLoading ? true : void 0,
|
|
131
|
+
"data-icon-only": isIconOnly ? true : void 0,
|
|
132
|
+
isDisabled,
|
|
133
|
+
className: cx(slots.root(), (isLoading || href && (isDisabled || isLoading)) && "pointer-events-none", isLoading && (showTextWhileLoading ? "[&>*:not([data-icon=loading]):not([data-text])]:hidden" : "[&>*:not([data-icon=loading])]:invisible"), className),
|
|
134
|
+
children: content
|
|
135
|
+
};
|
|
136
|
+
if (href !== void 0) {
|
|
137
|
+
const { href: _drop, ...linkRest } = rest;
|
|
138
|
+
return /* @__PURE__ */ jsx(Link, {
|
|
139
|
+
...linkRest,
|
|
140
|
+
...shared,
|
|
141
|
+
ref,
|
|
142
|
+
href: isDisabled ? void 0 : href
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
const buttonRest = rest;
|
|
146
|
+
return /* @__PURE__ */ jsx(Button$1, {
|
|
147
|
+
...buttonRest,
|
|
148
|
+
...shared,
|
|
149
|
+
ref,
|
|
150
|
+
type: buttonRest.type ?? "button",
|
|
151
|
+
isPending: isLoading
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
Button.displayName = "Button";
|
|
155
|
+
//#endregion
|
|
156
|
+
export { Button, buttonStyles };
|
|
157
|
+
|
|
158
|
+
//# sourceMappingURL=button.js.map
|