@bolerish/ui 0.0.0-stage → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/configuration_schema.json +105 -0
- package/dist/_tokens.js +395 -0
- package/dist/_tokens.js.map +7 -0
- package/dist/accordion.d.ts +17 -0
- package/dist/accordion.js +347 -0
- package/dist/accordion.js.map +7 -0
- package/dist/alert-dialog.d.ts +30 -0
- package/dist/alert-dialog.js +460 -0
- package/dist/alert-dialog.js.map +7 -0
- package/dist/aspect-ratio.d.ts +8 -0
- package/dist/aspect-ratio.js +45 -0
- package/dist/aspect-ratio.js.map +7 -0
- package/dist/attachment.d.ts +39 -0
- package/dist/attachment.js +600 -0
- package/dist/attachment.js.map +7 -0
- package/dist/avatar.d.ts +26 -0
- package/dist/avatar.js +393 -0
- package/dist/avatar.js.map +7 -0
- package/dist/badge.d.ts +10 -0
- package/dist/badge.js +82 -0
- package/dist/badge.js.map +7 -0
- package/dist/banner.d.ts +19 -0
- package/dist/banner.js +127 -0
- package/dist/banner.js.map +7 -0
- package/dist/breadcrumb.d.ts +27 -0
- package/dist/breadcrumb.js +426 -0
- package/dist/breadcrumb.js.map +7 -0
- package/dist/button-group.d.ts +15 -0
- package/dist/button-group.js +330 -0
- package/dist/button-group.js.map +7 -0
- package/dist/button.d.ts +17 -0
- package/dist/button.js +313 -0
- package/dist/button.js.map +7 -0
- package/dist/calendar.d.ts +10 -0
- package/dist/calendar.js +257 -0
- package/dist/calendar.js.map +7 -0
- package/dist/card.d.ts +16 -0
- package/dist/card.js +131 -0
- package/dist/card.js.map +7 -0
- package/dist/carousel.d.ts +34 -0
- package/dist/carousel.js +551 -0
- package/dist/carousel.js.map +7 -0
- package/dist/checkbox.d.ts +8 -0
- package/dist/checkbox.js +113 -0
- package/dist/checkbox.js.map +7 -0
- package/dist/cli.js +6 -0
- package/dist/cli.js.map +7 -0
- package/dist/collapsible.d.ts +17 -0
- package/dist/collapsible.js +337 -0
- package/dist/collapsible.js.map +7 -0
- package/dist/combobox.d.ts +37 -0
- package/dist/combobox.js +692 -0
- package/dist/combobox.js.map +7 -0
- package/dist/content-row.d.ts +32 -0
- package/dist/content-row.js +253 -0
- package/dist/content-row.js.map +7 -0
- package/dist/context-menu.d.ts +9 -0
- package/dist/context-menu.js +86 -0
- package/dist/context-menu.js.map +7 -0
- package/dist/date-picker.d.ts +11 -0
- package/dist/date-picker.js +140 -0
- package/dist/date-picker.js.map +7 -0
- package/dist/dialog.d.ts +33 -0
- package/dist/dialog.js +458 -0
- package/dist/dialog.js.map +7 -0
- package/dist/drawer.d.ts +37 -0
- package/dist/drawer.js +773 -0
- package/dist/drawer.js.map +7 -0
- package/dist/dropdown-menu.d.ts +52 -0
- package/dist/dropdown-menu.js +824 -0
- package/dist/dropdown-menu.js.map +7 -0
- package/dist/empty.d.ts +13 -0
- package/dist/empty.js +136 -0
- package/dist/empty.js.map +7 -0
- package/dist/field.d.ts +21 -0
- package/dist/field.js +578 -0
- package/dist/field.js.map +7 -0
- package/dist/global.css +19 -0
- package/dist/heading.d.ts +9 -0
- package/dist/heading.js +108 -0
- package/dist/heading.js.map +7 -0
- package/dist/hover-card.d.ts +16 -0
- package/dist/hover-card.js +202 -0
- package/dist/hover-card.js.map +7 -0
- package/dist/index.d.ts +96 -0
- package/dist/index.js +524 -0
- package/dist/index.js.map +7 -0
- package/dist/input-group.d.ts +22 -0
- package/dist/input-group.js +458 -0
- package/dist/input-group.js.map +7 -0
- package/dist/input-otp.d.ts +18 -0
- package/dist/input-otp.js +261 -0
- package/dist/input-otp.js.map +7 -0
- package/dist/input.d.ts +9 -0
- package/dist/input.js +141 -0
- package/dist/input.js.map +7 -0
- package/dist/kbd.d.ts +10 -0
- package/dist/kbd.js +66 -0
- package/dist/kbd.js.map +7 -0
- package/dist/label.d.ts +7 -0
- package/dist/label.js +101 -0
- package/dist/label.js.map +7 -0
- package/dist/link.d.ts +18 -0
- package/dist/link.js +194 -0
- package/dist/link.js.map +7 -0
- package/dist/marker.d.ts +15 -0
- package/dist/marker.js +99 -0
- package/dist/marker.js.map +7 -0
- package/dist/menubar.d.ts +26 -0
- package/dist/menubar.js +211 -0
- package/dist/menubar.js.map +7 -0
- package/dist/native-select.d.ts +15 -0
- package/dist/native-select.js +248 -0
- package/dist/native-select.js.map +7 -0
- package/dist/navigation-menu.d.ts +28 -0
- package/dist/navigation-menu.js +598 -0
- package/dist/navigation-menu.js.map +7 -0
- package/dist/p.d.ts +4 -0
- package/dist/p.js +7 -0
- package/dist/p.js.map +7 -0
- package/dist/pagination.d.ts +24 -0
- package/dist/pagination.js +425 -0
- package/dist/pagination.js.map +7 -0
- package/dist/paragraph.d.ts +8 -0
- package/dist/paragraph.js +106 -0
- package/dist/paragraph.js.map +7 -0
- package/dist/popover.d.ts +26 -0
- package/dist/popover.js +413 -0
- package/dist/popover.js.map +7 -0
- package/dist/primitives.d.ts +1 -0
- package/dist/primitives.js +5 -0
- package/dist/primitives.js.map +7 -0
- package/dist/progress.d.ts +8 -0
- package/dist/progress.js +88 -0
- package/dist/progress.js.map +7 -0
- package/dist/radio-group.d.ts +13 -0
- package/dist/radio-group.js +156 -0
- package/dist/radio-group.js.map +7 -0
- package/dist/reset.css +72 -0
- package/dist/scroll-area.d.ts +19 -0
- package/dist/scroll-area.js +302 -0
- package/dist/scroll-area.js.map +7 -0
- package/dist/select.d.ts +34 -0
- package/dist/select.js +649 -0
- package/dist/select.js.map +7 -0
- package/dist/separator.d.ts +9 -0
- package/dist/separator.js +107 -0
- package/dist/separator.js.map +7 -0
- package/dist/skeleton.d.ts +7 -0
- package/dist/skeleton.js +42 -0
- package/dist/skeleton.js.map +7 -0
- package/dist/slider.d.ts +10 -0
- package/dist/slider.js +145 -0
- package/dist/slider.js.map +7 -0
- package/dist/spinner.d.ts +8 -0
- package/dist/spinner.js +49 -0
- package/dist/spinner.js.map +7 -0
- package/dist/styles/control-layout.d.ts +9 -0
- package/dist/styles/merge-styles.d.ts +10 -0
- package/dist/stylex.css +2862 -0
- package/dist/switch.d.ts +9 -0
- package/dist/switch.js +153 -0
- package/dist/switch.js.map +7 -0
- package/dist/table.d.ts +31 -0
- package/dist/table.js +171 -0
- package/dist/table.js.map +7 -0
- package/dist/tabs.d.ts +20 -0
- package/dist/tabs.js +403 -0
- package/dist/tabs.js.map +7 -0
- package/dist/textarea.d.ts +7 -0
- package/dist/textarea.js +76 -0
- package/dist/textarea.js.map +7 -0
- package/dist/theme.d.ts +5 -0
- package/dist/theme.js +44 -0
- package/dist/theme.js.map +7 -0
- package/dist/timeline.d.ts +30 -0
- package/dist/timeline.js +182 -0
- package/dist/timeline.js.map +7 -0
- package/dist/toast.d.ts +14 -0
- package/dist/toast.js +463 -0
- package/dist/toast.js.map +7 -0
- package/dist/toast.stylex.d.ts +8 -0
- package/dist/toggle-group.d.ts +19 -0
- package/dist/toggle-group.js +324 -0
- package/dist/toggle-group.js.map +7 -0
- package/dist/toggle.d.ts +12 -0
- package/dist/toggle.js +192 -0
- package/dist/toggle.js.map +7 -0
- package/dist/tooltip.d.ts +14 -0
- package/dist/tooltip.js +214 -0
- package/dist/tooltip.js.map +7 -0
- package/dist/typography.d.ts +51 -0
- package/package.json +114 -3
- package/README.md +0 -3
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/button-group.tsx
|
|
4
|
+
import { c as _c } from "react/compiler-runtime";
|
|
5
|
+
import * as stylex from "@stylexjs/stylex";
|
|
6
|
+
import { Children, Fragment, cloneElement, isValidElement } from "react";
|
|
7
|
+
import { Separator } from "./separator.js";
|
|
8
|
+
|
|
9
|
+
// src/styles/merge-styles.ts
|
|
10
|
+
function mergeStyles(base, className, style) {
|
|
11
|
+
if (className === void 0 && style === void 0) return base;
|
|
12
|
+
return {
|
|
13
|
+
...base,
|
|
14
|
+
className: [base.className, className].filter(Boolean).join(" ") || void 0,
|
|
15
|
+
style: base.style || style ? {
|
|
16
|
+
...base.style,
|
|
17
|
+
...style
|
|
18
|
+
} : void 0
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// src/button-group.tsx
|
|
23
|
+
import { jsx } from "react/jsx-runtime";
|
|
24
|
+
var styles = {
|
|
25
|
+
root: {
|
|
26
|
+
kGNEyG: "x1qjc9v5",
|
|
27
|
+
k1xSpc: "x3nfvp2",
|
|
28
|
+
kOIVth: "xxhr3t",
|
|
29
|
+
kzqmXN: "xeq5yr9",
|
|
30
|
+
$$css: true
|
|
31
|
+
},
|
|
32
|
+
item: {
|
|
33
|
+
k7Eaqz: "xeuugli",
|
|
34
|
+
kVAEAm: "x1n2onr6",
|
|
35
|
+
k9RWNo: "x135w3n3",
|
|
36
|
+
$$css: true
|
|
37
|
+
},
|
|
38
|
+
text: {
|
|
39
|
+
kGNEyG: "x6s0dn4",
|
|
40
|
+
kWkggS: "xcc0o6n",
|
|
41
|
+
kVAM5u: "x1kqtvf4",
|
|
42
|
+
ksu8eU: "x1y0btm7",
|
|
43
|
+
kMzoRj: "x1al7nqq",
|
|
44
|
+
kMwMTN: "xj9e3ow",
|
|
45
|
+
k1xSpc: "x3nfvp2",
|
|
46
|
+
kGuDYH: "x1lskvfa",
|
|
47
|
+
k63SB2: "xoop9yj",
|
|
48
|
+
kjj79g: "xl56j7k",
|
|
49
|
+
kAzted: "x116rqyj",
|
|
50
|
+
kg3NbH: "x5044ve",
|
|
51
|
+
$$css: true
|
|
52
|
+
},
|
|
53
|
+
separator: {
|
|
54
|
+
kSGwAc: "xkh2ocl",
|
|
55
|
+
kZKoxP: "xt7dq6l",
|
|
56
|
+
kUOVxO: "xz95peq",
|
|
57
|
+
kAzted: "x65nank",
|
|
58
|
+
$$css: true
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var orientationStyles = {
|
|
62
|
+
horizontal: {
|
|
63
|
+
kXwgrk: "x1q0g3np",
|
|
64
|
+
$$css: true
|
|
65
|
+
},
|
|
66
|
+
vertical: {
|
|
67
|
+
kXwgrk: "xdt5ytf",
|
|
68
|
+
$$css: true
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var itemOrientationStyles = {
|
|
72
|
+
horizontal: {
|
|
73
|
+
keTefX: "x1hb08if",
|
|
74
|
+
$$css: true
|
|
75
|
+
},
|
|
76
|
+
vertical: {
|
|
77
|
+
keoZOQ: "x1y332i5",
|
|
78
|
+
$$css: true
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var firstItemStyles = {
|
|
82
|
+
horizontal: {
|
|
83
|
+
keTefX: "x1lziwak",
|
|
84
|
+
$$css: true
|
|
85
|
+
},
|
|
86
|
+
vertical: {
|
|
87
|
+
keoZOQ: "xdj266r",
|
|
88
|
+
$$css: true
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var onlyItemStyles = {
|
|
92
|
+
horizontal: {
|
|
93
|
+
kaIpWk: "x1p5vitp",
|
|
94
|
+
$$css: true
|
|
95
|
+
},
|
|
96
|
+
vertical: {
|
|
97
|
+
kaIpWk: "x1p5vitp",
|
|
98
|
+
$$css: true
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
var firstItemRadiusStyles = {
|
|
102
|
+
horizontal: {
|
|
103
|
+
kqGeR4: "x10ipona",
|
|
104
|
+
kYm2EN: "xjppbhk",
|
|
105
|
+
kIxVMA: "xzn2g6r",
|
|
106
|
+
ksF3WI: "x1a2w583",
|
|
107
|
+
$$css: true
|
|
108
|
+
},
|
|
109
|
+
vertical: {
|
|
110
|
+
kqGeR4: "xfrllxf",
|
|
111
|
+
kYm2EN: "xjppbhk",
|
|
112
|
+
kIxVMA: "xzn2g6r",
|
|
113
|
+
ksF3WI: "xz5i4qs",
|
|
114
|
+
$$css: true
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
var middleItemStyles = {
|
|
118
|
+
horizontal: {
|
|
119
|
+
kaIpWk: "x2u8bby",
|
|
120
|
+
$$css: true
|
|
121
|
+
},
|
|
122
|
+
vertical: {
|
|
123
|
+
kaIpWk: "x2u8bby",
|
|
124
|
+
$$css: true
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
var lastItemStyles = {
|
|
128
|
+
horizontal: {
|
|
129
|
+
kqGeR4: "xfrllxf",
|
|
130
|
+
kYm2EN: "x1ca2soh",
|
|
131
|
+
kIxVMA: "x1ia1hqs",
|
|
132
|
+
ksF3WI: "xz5i4qs",
|
|
133
|
+
$$css: true
|
|
134
|
+
},
|
|
135
|
+
vertical: {
|
|
136
|
+
kqGeR4: "x10ipona",
|
|
137
|
+
kYm2EN: "x1ca2soh",
|
|
138
|
+
kIxVMA: "x1ia1hqs",
|
|
139
|
+
ksF3WI: "x1a2w583",
|
|
140
|
+
$$css: true
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
function isGroupItem(child) {
|
|
144
|
+
return isValidElement(child) && typeof child.type !== "string" && child.type !== Fragment && child.type !== ButtonGroupSeparator;
|
|
145
|
+
}
|
|
146
|
+
function getItemPositionStyle(orientation, isFirst, isLast) {
|
|
147
|
+
if (isFirst && isLast) return onlyItemStyles[orientation];
|
|
148
|
+
if (isFirst) return firstItemRadiusStyles[orientation];
|
|
149
|
+
if (isLast) return lastItemStyles[orientation];
|
|
150
|
+
return middleItemStyles[orientation];
|
|
151
|
+
}
|
|
152
|
+
function ButtonGroup(t0) {
|
|
153
|
+
const $ = _c(22);
|
|
154
|
+
let children;
|
|
155
|
+
let className;
|
|
156
|
+
let props2;
|
|
157
|
+
let role;
|
|
158
|
+
let style;
|
|
159
|
+
let t1;
|
|
160
|
+
let xstyle;
|
|
161
|
+
if ($[0] !== t0) {
|
|
162
|
+
({
|
|
163
|
+
className,
|
|
164
|
+
style,
|
|
165
|
+
children,
|
|
166
|
+
orientation: t1,
|
|
167
|
+
role,
|
|
168
|
+
xstyle,
|
|
169
|
+
...props2
|
|
170
|
+
} = t0);
|
|
171
|
+
$[0] = t0;
|
|
172
|
+
$[1] = children;
|
|
173
|
+
$[2] = className;
|
|
174
|
+
$[3] = props2;
|
|
175
|
+
$[4] = role;
|
|
176
|
+
$[5] = style;
|
|
177
|
+
$[6] = t1;
|
|
178
|
+
$[7] = xstyle;
|
|
179
|
+
} else {
|
|
180
|
+
children = $[1];
|
|
181
|
+
className = $[2];
|
|
182
|
+
props2 = $[3];
|
|
183
|
+
role = $[4];
|
|
184
|
+
style = $[5];
|
|
185
|
+
t1 = $[6];
|
|
186
|
+
xstyle = $[7];
|
|
187
|
+
}
|
|
188
|
+
const orientation = t1 === void 0 ? "horizontal" : t1;
|
|
189
|
+
let content;
|
|
190
|
+
if ($[8] !== children || $[9] !== orientation) {
|
|
191
|
+
const childItems = Children.toArray(children);
|
|
192
|
+
const groupItems = childItems.filter(isGroupItem);
|
|
193
|
+
let position = -1;
|
|
194
|
+
content = [];
|
|
195
|
+
for (const child of childItems) {
|
|
196
|
+
if (!isGroupItem(child)) {
|
|
197
|
+
content.push(child);
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
position = position + 1;
|
|
201
|
+
const isFirst = position === 0;
|
|
202
|
+
const isLast = position === groupItems.length - 1;
|
|
203
|
+
content.push(cloneElement(child, {
|
|
204
|
+
xstyle: [styles.item, itemOrientationStyles[orientation], isFirst && firstItemStyles[orientation], getItemPositionStyle(orientation, isFirst, isLast), child.props.xstyle]
|
|
205
|
+
}));
|
|
206
|
+
}
|
|
207
|
+
$[8] = children;
|
|
208
|
+
$[9] = orientation;
|
|
209
|
+
$[10] = content;
|
|
210
|
+
} else {
|
|
211
|
+
content = $[10];
|
|
212
|
+
}
|
|
213
|
+
const t2 = role ?? "group";
|
|
214
|
+
let t3;
|
|
215
|
+
if ($[11] !== className || $[12] !== orientation || $[13] !== style || $[14] !== xstyle) {
|
|
216
|
+
t3 = mergeStyles(stylex.props(styles.root, orientationStyles[orientation], xstyle), className, style);
|
|
217
|
+
$[11] = className;
|
|
218
|
+
$[12] = orientation;
|
|
219
|
+
$[13] = style;
|
|
220
|
+
$[14] = xstyle;
|
|
221
|
+
$[15] = t3;
|
|
222
|
+
} else {
|
|
223
|
+
t3 = $[15];
|
|
224
|
+
}
|
|
225
|
+
let t4;
|
|
226
|
+
if ($[16] !== content || $[17] !== orientation || $[18] !== props2 || $[19] !== t2 || $[20] !== t3) {
|
|
227
|
+
t4 = /* @__PURE__ */ jsx("div", { ...props2, "data-orientation": orientation, role: t2, ...t3, children: content });
|
|
228
|
+
$[16] = content;
|
|
229
|
+
$[17] = orientation;
|
|
230
|
+
$[18] = props2;
|
|
231
|
+
$[19] = t2;
|
|
232
|
+
$[20] = t3;
|
|
233
|
+
$[21] = t4;
|
|
234
|
+
} else {
|
|
235
|
+
t4 = $[21];
|
|
236
|
+
}
|
|
237
|
+
return t4;
|
|
238
|
+
}
|
|
239
|
+
function ButtonGroupText(t0) {
|
|
240
|
+
const $ = _c(12);
|
|
241
|
+
let className;
|
|
242
|
+
let props2;
|
|
243
|
+
let style;
|
|
244
|
+
let xstyle;
|
|
245
|
+
if ($[0] !== t0) {
|
|
246
|
+
({
|
|
247
|
+
className,
|
|
248
|
+
style,
|
|
249
|
+
xstyle,
|
|
250
|
+
...props2
|
|
251
|
+
} = t0);
|
|
252
|
+
$[0] = t0;
|
|
253
|
+
$[1] = className;
|
|
254
|
+
$[2] = props2;
|
|
255
|
+
$[3] = style;
|
|
256
|
+
$[4] = xstyle;
|
|
257
|
+
} else {
|
|
258
|
+
className = $[1];
|
|
259
|
+
props2 = $[2];
|
|
260
|
+
style = $[3];
|
|
261
|
+
xstyle = $[4];
|
|
262
|
+
}
|
|
263
|
+
let t1;
|
|
264
|
+
if ($[5] !== className || $[6] !== style || $[7] !== xstyle) {
|
|
265
|
+
t1 = mergeStyles(stylex.props(styles.text, xstyle), className, style);
|
|
266
|
+
$[5] = className;
|
|
267
|
+
$[6] = style;
|
|
268
|
+
$[7] = xstyle;
|
|
269
|
+
$[8] = t1;
|
|
270
|
+
} else {
|
|
271
|
+
t1 = $[8];
|
|
272
|
+
}
|
|
273
|
+
let t2;
|
|
274
|
+
if ($[9] !== props2 || $[10] !== t1) {
|
|
275
|
+
t2 = /* @__PURE__ */ jsx("span", { ...props2, ...t1 });
|
|
276
|
+
$[9] = props2;
|
|
277
|
+
$[10] = t1;
|
|
278
|
+
$[11] = t2;
|
|
279
|
+
} else {
|
|
280
|
+
t2 = $[11];
|
|
281
|
+
}
|
|
282
|
+
return t2;
|
|
283
|
+
}
|
|
284
|
+
function ButtonGroupSeparator(t0) {
|
|
285
|
+
const $ = _c(10);
|
|
286
|
+
let props2;
|
|
287
|
+
let t1;
|
|
288
|
+
let xstyle;
|
|
289
|
+
if ($[0] !== t0) {
|
|
290
|
+
({
|
|
291
|
+
orientation: t1,
|
|
292
|
+
xstyle,
|
|
293
|
+
...props2
|
|
294
|
+
} = t0);
|
|
295
|
+
$[0] = t0;
|
|
296
|
+
$[1] = props2;
|
|
297
|
+
$[2] = t1;
|
|
298
|
+
$[3] = xstyle;
|
|
299
|
+
} else {
|
|
300
|
+
props2 = $[1];
|
|
301
|
+
t1 = $[2];
|
|
302
|
+
xstyle = $[3];
|
|
303
|
+
}
|
|
304
|
+
const orientation = t1 === void 0 ? "vertical" : t1;
|
|
305
|
+
let t2;
|
|
306
|
+
if ($[4] !== xstyle) {
|
|
307
|
+
t2 = [styles.separator, xstyle];
|
|
308
|
+
$[4] = xstyle;
|
|
309
|
+
$[5] = t2;
|
|
310
|
+
} else {
|
|
311
|
+
t2 = $[5];
|
|
312
|
+
}
|
|
313
|
+
let t3;
|
|
314
|
+
if ($[6] !== orientation || $[7] !== props2 || $[8] !== t2) {
|
|
315
|
+
t3 = /* @__PURE__ */ jsx(Separator, { ...props2, orientation, xstyle: t2 });
|
|
316
|
+
$[6] = orientation;
|
|
317
|
+
$[7] = props2;
|
|
318
|
+
$[8] = t2;
|
|
319
|
+
$[9] = t3;
|
|
320
|
+
} else {
|
|
321
|
+
t3 = $[9];
|
|
322
|
+
}
|
|
323
|
+
return t3;
|
|
324
|
+
}
|
|
325
|
+
export {
|
|
326
|
+
ButtonGroup,
|
|
327
|
+
ButtonGroupSeparator,
|
|
328
|
+
ButtonGroupText
|
|
329
|
+
};
|
|
330
|
+
//# sourceMappingURL=button-group.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/button-group.tsx", "../src/styles/merge-styles.ts"],
|
|
4
|
+
"sourcesContent": ["\"use client\";\n\nimport { c as _c } from \"react/compiler-runtime\";\nimport { colorVars, radiusVars, sizeVars, spacingVars, typo } from \"@bolerish/tokens/semantic.stylex\";\nimport * as stylex from \"@stylexjs/stylex\";\nimport { Children, Fragment, cloneElement, isValidElement, type ComponentProps, type ReactElement, type ReactNode } from \"react\";\nimport { Separator } from \"./separator\";\nimport { mergeStyles } from \"./styles/merge-styles\";\nimport type { StyledProps } from \"./styles/merge-styles\";\nconst styles = {\n root: {\n kGNEyG: \"x1qjc9v5\",\n k1xSpc: \"x3nfvp2\",\n kOIVth: \"xxhr3t\",\n kzqmXN: \"xeq5yr9\",\n $$css: true\n },\n item: {\n k7Eaqz: \"xeuugli\",\n kVAEAm: \"x1n2onr6\",\n k9RWNo: \"x135w3n3\",\n $$css: true\n },\n text: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xcc0o6n\",\n kVAM5u: \"x1kqtvf4\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"x1al7nqq\",\n kMwMTN: \"xj9e3ow\",\n k1xSpc: \"x3nfvp2\",\n kGuDYH: \"x1lskvfa\",\n k63SB2: \"xoop9yj\",\n kjj79g: \"xl56j7k\",\n kAzted: \"x116rqyj\",\n kg3NbH: \"x5044ve\",\n $$css: true\n },\n separator: {\n kSGwAc: \"xkh2ocl\",\n kZKoxP: \"xt7dq6l\",\n kUOVxO: \"xz95peq\",\n kAzted: \"x65nank\",\n $$css: true\n }\n};\nconst orientationStyles = {\n horizontal: {\n kXwgrk: \"x1q0g3np\",\n $$css: true\n },\n vertical: {\n kXwgrk: \"xdt5ytf\",\n $$css: true\n }\n};\nconst itemOrientationStyles = {\n horizontal: {\n keTefX: \"x1hb08if\",\n $$css: true\n },\n vertical: {\n keoZOQ: \"x1y332i5\",\n $$css: true\n }\n};\nconst firstItemStyles = {\n horizontal: {\n keTefX: \"x1lziwak\",\n $$css: true\n },\n vertical: {\n keoZOQ: \"xdj266r\",\n $$css: true\n }\n};\nconst onlyItemStyles = {\n horizontal: {\n kaIpWk: \"x1p5vitp\",\n $$css: true\n },\n vertical: {\n kaIpWk: \"x1p5vitp\",\n $$css: true\n }\n};\nconst firstItemRadiusStyles = {\n horizontal: {\n kqGeR4: \"x10ipona\",\n kYm2EN: \"xjppbhk\",\n kIxVMA: \"xzn2g6r\",\n ksF3WI: \"x1a2w583\",\n $$css: true\n },\n vertical: {\n kqGeR4: \"xfrllxf\",\n kYm2EN: \"xjppbhk\",\n kIxVMA: \"xzn2g6r\",\n ksF3WI: \"xz5i4qs\",\n $$css: true\n }\n};\nconst middleItemStyles = {\n horizontal: {\n kaIpWk: \"x2u8bby\",\n $$css: true\n },\n vertical: {\n kaIpWk: \"x2u8bby\",\n $$css: true\n }\n};\nconst lastItemStyles = {\n horizontal: {\n kqGeR4: \"xfrllxf\",\n kYm2EN: \"x1ca2soh\",\n kIxVMA: \"x1ia1hqs\",\n ksF3WI: \"xz5i4qs\",\n $$css: true\n },\n vertical: {\n kqGeR4: \"x10ipona\",\n kYm2EN: \"x1ca2soh\",\n kIxVMA: \"x1ia1hqs\",\n ksF3WI: \"x1a2w583\",\n $$css: true\n }\n};\ntype StyleProps = {\n xstyle?: stylex.StyleXStyles;\n};\ntype GroupItem = ReactElement<StyleProps>;\nfunction isGroupItem(child: ReactNode): child is GroupItem {\n return isValidElement(child) && typeof child.type !== \"string\" && child.type !== Fragment && child.type !== ButtonGroupSeparator;\n}\nfunction getItemPositionStyle(orientation: \"horizontal\" | \"vertical\", isFirst: boolean, isLast: boolean) {\n if (isFirst && isLast) return onlyItemStyles[orientation];\n if (isFirst) return firstItemRadiusStyles[orientation];\n if (isLast) return lastItemStyles[orientation];\n return middleItemStyles[orientation];\n}\n\n/** Direct children must be Bolerish buttons or components that forward xstyle. Fragments and native elements are not styled as group items. */\nexport type ButtonGroupProps = StyledProps<ComponentProps<\"div\">> & StyleProps & {\n orientation?: \"horizontal\" | \"vertical\";\n};\nexport function ButtonGroup(t0) {\n const $ = _c(22);\n let children;\n let className;\n let props;\n let role;\n let style;\n let t1;\n let xstyle;\n if ($[0] !== t0) {\n ({\n className,\n style,\n children,\n orientation: t1,\n role,\n xstyle,\n ...props\n } = t0);\n $[0] = t0;\n $[1] = children;\n $[2] = className;\n $[3] = props;\n $[4] = role;\n $[5] = style;\n $[6] = t1;\n $[7] = xstyle;\n } else {\n children = $[1];\n className = $[2];\n props = $[3];\n role = $[4];\n style = $[5];\n t1 = $[6];\n xstyle = $[7];\n }\n const orientation = t1 === undefined ? \"horizontal\" : t1;\n let content;\n if ($[8] !== children || $[9] !== orientation) {\n const childItems = Children.toArray(children);\n const groupItems = childItems.filter(isGroupItem);\n let position = -1;\n content = [];\n for (const child of childItems) {\n if (!isGroupItem(child)) {\n content.push(child);\n continue;\n }\n position = position + 1;\n const isFirst = position === 0;\n const isLast = position === groupItems.length - 1;\n content.push(cloneElement(child, {\n xstyle: [styles.item, itemOrientationStyles[orientation], isFirst && firstItemStyles[orientation], getItemPositionStyle(orientation, isFirst, isLast), child.props.xstyle]\n }));\n }\n $[8] = children;\n $[9] = orientation;\n $[10] = content;\n } else {\n content = $[10];\n }\n const t2 = role ?? \"group\";\n let t3;\n if ($[11] !== className || $[12] !== orientation || $[13] !== style || $[14] !== xstyle) {\n t3 = mergeStyles(stylex.props(styles.root, orientationStyles[orientation], xstyle), className, style);\n $[11] = className;\n $[12] = orientation;\n $[13] = style;\n $[14] = xstyle;\n $[15] = t3;\n } else {\n t3 = $[15];\n }\n let t4;\n if ($[16] !== content || $[17] !== orientation || $[18] !== props || $[19] !== t2 || $[20] !== t3) {\n t4 = <div {...props} data-orientation={orientation} role={t2} {...t3}>{content}</div>;\n $[16] = content;\n $[17] = orientation;\n $[18] = props;\n $[19] = t2;\n $[20] = t3;\n $[21] = t4;\n } else {\n t4 = $[21];\n }\n return t4;\n}\nexport function ButtonGroupText(t0) {\n const $ = _c(12);\n let className;\n let props;\n let style;\n let xstyle;\n if ($[0] !== t0) {\n ({\n className,\n style,\n xstyle,\n ...props\n } = t0);\n $[0] = t0;\n $[1] = className;\n $[2] = props;\n $[3] = style;\n $[4] = xstyle;\n } else {\n className = $[1];\n props = $[2];\n style = $[3];\n xstyle = $[4];\n }\n let t1;\n if ($[5] !== className || $[6] !== style || $[7] !== xstyle) {\n t1 = mergeStyles(stylex.props(styles.text, xstyle), className, style);\n $[5] = className;\n $[6] = style;\n $[7] = xstyle;\n $[8] = t1;\n } else {\n t1 = $[8];\n }\n let t2;\n if ($[9] !== props || $[10] !== t1) {\n t2 = <span {...props} {...t1} />;\n $[9] = props;\n $[10] = t1;\n $[11] = t2;\n } else {\n t2 = $[11];\n }\n return t2;\n}\nexport function ButtonGroupSeparator(t0) {\n const $ = _c(10);\n let props;\n let t1;\n let xstyle;\n if ($[0] !== t0) {\n ({\n orientation: t1,\n xstyle,\n ...props\n } = t0);\n $[0] = t0;\n $[1] = props;\n $[2] = t1;\n $[3] = xstyle;\n } else {\n props = $[1];\n t1 = $[2];\n xstyle = $[3];\n }\n const orientation = t1 === undefined ? \"vertical\" : t1;\n let t2;\n if ($[4] !== xstyle) {\n t2 = [styles.separator, xstyle];\n $[4] = xstyle;\n $[5] = t2;\n } else {\n t2 = $[5];\n }\n let t3;\n if ($[6] !== orientation || $[7] !== props || $[8] !== t2) {\n t3 = <Separator {...props} orientation={orientation} xstyle={t2} />;\n $[6] = orientation;\n $[7] = props;\n $[8] = t2;\n $[9] = t3;\n } else {\n t3 = $[9];\n }\n return t3;\n}", "import type * as stylex from \"@stylexjs/stylex\";\nimport type { CSSProperties } from \"react\";\nexport type StyledProps<Props> = Props extends unknown ? Omit<Props, \"className\" | \"style\"> & {\n className?: string;\n style?: CSSProperties;\n} : never;\nexport function mergeStyles(base: ReturnType<typeof stylex.props>, className?: string, style?: CSSProperties): {\n className?: string;\n style?: CSSProperties;\n} {\n if (className === undefined && style === undefined) return base;\n return {\n ...base,\n className: [base.className, className].filter(Boolean).join(\" \") || undefined,\n style: base.style || style ? {\n ...base.style,\n ...style\n } : undefined\n };\n}"],
|
|
5
|
+
"mappings": ";;;AAEA,SAAS,KAAK,UAAU;AAExB,YAAY,YAAY;AACxB,SAAS,UAAU,UAAU,cAAc,sBAA8E;AACzH,SAAS,iBAAiB;;;ACAnB,SAAS,YAAY,MAAuC,WAAoB,OAGrF;AACA,MAAI,cAAc,UAAa,UAAU,OAAW,QAAO;AAC3D,SAAO;AAAA,IACL,GAAG;AAAA,IACH,WAAW,CAAC,KAAK,WAAW,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,KAAK;AAAA,IACpE,OAAO,KAAK,SAAS,QAAQ;AAAA,MAC3B,GAAG,KAAK;AAAA,MACR,GAAG;AAAA,IACL,IAAI;AAAA,EACN;AACF;;;AD0MS;AApNT,IAAM,SAAS;AAAA,EACb,MAAM;AAAA,IACJ,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO;AAAA,EACT;AAAA,EACA,MAAM;AAAA,IACJ,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO;AAAA,EACT;AAAA,EACA,MAAM;AAAA,IACJ,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,OAAO;AAAA,EACT;AAAA,EACA,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AAAA,EACX;AACA,SAAO;AACT;AACO,SAAS,qBAAqB,IAAI;AACvC,QAAM,IAAI,GAAG,EAAE;AACf,MAAIA;AACJ,MAAI;AACJ,MAAI;AACJ,MAAI,EAAE,CAAC,MAAM,IAAI;AACf,KAAC;AAAA,MACC,aAAa;AAAA,MACb;AAAA,MACA,GAAGA;AAAA,IACL,IAAI;AACJ,MAAE,CAAC,IAAI;AACP,MAAE,CAAC,IAAIA;AACP,MAAE,CAAC,IAAI;AACP,MAAE,CAAC,IAAI;AAAA,EACT,OAAO;AACL,IAAAA,SAAQ,EAAE,CAAC;AACX,SAAK,EAAE,CAAC;AACR,aAAS,EAAE,CAAC;AAAA,EACd;AACA,QAAM,cAAc,OAAO,SAAY,aAAa;AACpD,MAAI;AACJ,MAAI,EAAE,CAAC,MAAM,QAAQ;AACnB,SAAK,CAAC,OAAO,WAAW,MAAM;AAC9B,MAAE,CAAC,IAAI;AACP,MAAE,CAAC,IAAI;AAAA,EACT,OAAO;AACL,SAAK,EAAE,CAAC;AAAA,EACV;AACA,MAAI;AACJ,MAAI,EAAE,CAAC,MAAM,eAAe,EAAE,CAAC,MAAMA,UAAS,EAAE,CAAC,MAAM,IAAI;AACzD,SAAK,oBAAC,aAAW,GAAGA,QAAO,aAA0B,QAAQ,IAAI;AACjE,MAAE,CAAC,IAAI;AACP,MAAE,CAAC,IAAIA;AACP,MAAE,CAAC,IAAI;AACP,MAAE,CAAC,IAAI;AAAA,EACT,OAAO;AACL,SAAK,EAAE,CAAC;AAAA,EACV;AACA,SAAO;AACT;",
|
|
6
|
+
"names": ["props"]
|
|
7
|
+
}
|
package/dist/button.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
2
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
3
|
+
import type { ControlLayoutStyles } from "./styles/control-layout";
|
|
4
|
+
import type { StyledProps } from "./styles/merge-styles";
|
|
5
|
+
type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "destructive";
|
|
6
|
+
type ButtonSize = "sm" | "md" | "lg" | "icon-xs" | "icon-sm" | "icon-md" | "icon-lg" | "icon-xl";
|
|
7
|
+
export type ButtonProps = StyledProps<ComponentProps<typeof ButtonPrimitive>> & {
|
|
8
|
+
align?: "start" | "center" | "end" | "space-between";
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
size?: ButtonSize;
|
|
11
|
+
/** Use an icon size for icon-only buttons, and add an accessible name. */
|
|
12
|
+
shape?: "default" | "square" | "circle";
|
|
13
|
+
variant?: ButtonVariant;
|
|
14
|
+
xstyle?: ControlLayoutStyles;
|
|
15
|
+
};
|
|
16
|
+
export declare function Button({ className, style, align, children, disabled, size, shape, variant, xstyle, ...props }: ButtonProps): import("react").JSX.Element;
|
|
17
|
+
export {};
|
package/dist/button.js
ADDED
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/button.tsx
|
|
4
|
+
import { c as _c } from "react/compiler-runtime";
|
|
5
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
6
|
+
import * as stylex from "@stylexjs/stylex";
|
|
7
|
+
|
|
8
|
+
// src/styles/merge-styles.ts
|
|
9
|
+
function mergeStyles(base, className, style) {
|
|
10
|
+
if (className === void 0 && style === void 0) return base;
|
|
11
|
+
return {
|
|
12
|
+
...base,
|
|
13
|
+
className: [base.className, className].filter(Boolean).join(" ") || void 0,
|
|
14
|
+
style: base.style || style ? {
|
|
15
|
+
...base.style,
|
|
16
|
+
...style
|
|
17
|
+
} : void 0
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// src/button.tsx
|
|
22
|
+
import { jsx } from "react/jsx-runtime";
|
|
23
|
+
var styles = {
|
|
24
|
+
root: {
|
|
25
|
+
kGNEyG: "x6s0dn4",
|
|
26
|
+
kysU6D: "xjyslct",
|
|
27
|
+
ksu8eU: "x1y0btm7",
|
|
28
|
+
kMzoRj: "x1al7nqq",
|
|
29
|
+
kkrTdU: "x1ypdohk",
|
|
30
|
+
k1xSpc: "x3nfvp2",
|
|
31
|
+
kGuDYH: "x1lskvfa",
|
|
32
|
+
k63SB2: "xoop9yj",
|
|
33
|
+
kOIVth: "x136xbx3",
|
|
34
|
+
kHBbk8: "xc8icb0",
|
|
35
|
+
kLWn49: "x15rnifv",
|
|
36
|
+
kI3sdo: "x1a2a7pz",
|
|
37
|
+
kVQacm: "xb3r6kr",
|
|
38
|
+
kVAEAm: "x1n2onr6",
|
|
39
|
+
kIyJzY: "xznvecg",
|
|
40
|
+
k1ekBW: "x1qsmvhx",
|
|
41
|
+
kAMwcw: "xrkjf8i",
|
|
42
|
+
kfSwDN: "x87ps6o",
|
|
43
|
+
khDVqt: "xuxw1ft",
|
|
44
|
+
kZs9gx: "x768paa",
|
|
45
|
+
kiEn40: "x1m0b1kh",
|
|
46
|
+
k7shQP: "x9v5kkp",
|
|
47
|
+
kPJHz1: "x1k4h2j2",
|
|
48
|
+
kYPGJ8: "x1s07b3s",
|
|
49
|
+
ks3ayO: "x17ctvpv",
|
|
50
|
+
k5JduY: "x1s928wv",
|
|
51
|
+
kv0HGH: "xarstr8",
|
|
52
|
+
kloYau: "x2q1x1w",
|
|
53
|
+
kwXMNM: "x1j6awrg",
|
|
54
|
+
kPNhGg: "x1byudbu",
|
|
55
|
+
kRicXK: "x1ywzrc5",
|
|
56
|
+
kA8PQs: "xe2lpi4",
|
|
57
|
+
kDVEDD: "xi4xitw",
|
|
58
|
+
$$css: true
|
|
59
|
+
},
|
|
60
|
+
primaryInteraction: {
|
|
61
|
+
kWkggS: "x1k98rc1 xgmwful x1bbutf3",
|
|
62
|
+
ks3ayO: "x17ctvpv",
|
|
63
|
+
$$css: true
|
|
64
|
+
},
|
|
65
|
+
solidInteraction: {
|
|
66
|
+
ks3ayO: "x17ctvpv x1pcu9v8 xy53125",
|
|
67
|
+
$$css: true
|
|
68
|
+
},
|
|
69
|
+
surfaceInteraction: {
|
|
70
|
+
ks3ayO: "x17ctvpv x1l7l6la x1b6uf5z",
|
|
71
|
+
$$css: true
|
|
72
|
+
},
|
|
73
|
+
iconContent: {
|
|
74
|
+
kOIVth: "xxhr3t",
|
|
75
|
+
kgeoSG: "x12vebyb",
|
|
76
|
+
$$css: true
|
|
77
|
+
},
|
|
78
|
+
disabled: {
|
|
79
|
+
kWkggS: "xx34gk8",
|
|
80
|
+
kVAM5u: "x1kqtvf4",
|
|
81
|
+
kMwMTN: "xdmzwdx",
|
|
82
|
+
ks3ayO: "x17ctvpv",
|
|
83
|
+
$$css: true
|
|
84
|
+
},
|
|
85
|
+
disabledGhost: {
|
|
86
|
+
kWkggS: "x1ail9j1",
|
|
87
|
+
kVAM5u: "x1p2lc83",
|
|
88
|
+
$$css: true
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var alignStyles = {
|
|
92
|
+
start: {
|
|
93
|
+
kjj79g: "x1nhvcw1",
|
|
94
|
+
$$css: true
|
|
95
|
+
},
|
|
96
|
+
center: {
|
|
97
|
+
kjj79g: "xl56j7k",
|
|
98
|
+
$$css: true
|
|
99
|
+
},
|
|
100
|
+
end: {
|
|
101
|
+
kjj79g: "x13a6bvl",
|
|
102
|
+
$$css: true
|
|
103
|
+
},
|
|
104
|
+
"space-between": {
|
|
105
|
+
kjj79g: "x1qughib",
|
|
106
|
+
$$css: true
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var sizeStyles = {
|
|
110
|
+
sm: {
|
|
111
|
+
kaIpWk: "x1p5vitp",
|
|
112
|
+
kZKoxP: "x1dvwle6",
|
|
113
|
+
kg3NbH: "x5044ve",
|
|
114
|
+
$$css: true
|
|
115
|
+
},
|
|
116
|
+
md: {
|
|
117
|
+
kaIpWk: "x1p5vitp",
|
|
118
|
+
kZKoxP: "x1f00wt4",
|
|
119
|
+
kg3NbH: "x9eqyeb",
|
|
120
|
+
$$css: true
|
|
121
|
+
},
|
|
122
|
+
lg: {
|
|
123
|
+
kaIpWk: "x1p5vitp",
|
|
124
|
+
kZKoxP: "x4rnblq",
|
|
125
|
+
kg3NbH: "x1tswxol",
|
|
126
|
+
$$css: true
|
|
127
|
+
},
|
|
128
|
+
"icon-xs": {
|
|
129
|
+
kaIpWk: "x1p5vitp",
|
|
130
|
+
kZKoxP: "x1nb8khz",
|
|
131
|
+
kg3NbH: "xnjsko4",
|
|
132
|
+
kzqmXN: "xcasm8m",
|
|
133
|
+
$$css: true
|
|
134
|
+
},
|
|
135
|
+
"icon-sm": {
|
|
136
|
+
kaIpWk: "x1p5vitp",
|
|
137
|
+
kZKoxP: "x1dvwle6",
|
|
138
|
+
kg3NbH: "xnjsko4",
|
|
139
|
+
kzqmXN: "x1g37zm5",
|
|
140
|
+
$$css: true
|
|
141
|
+
},
|
|
142
|
+
"icon-md": {
|
|
143
|
+
kaIpWk: "x1p5vitp",
|
|
144
|
+
kZKoxP: "x1f00wt4",
|
|
145
|
+
kg3NbH: "xnjsko4",
|
|
146
|
+
kzqmXN: "x18pndxb",
|
|
147
|
+
$$css: true
|
|
148
|
+
},
|
|
149
|
+
"icon-lg": {
|
|
150
|
+
kaIpWk: "x1p5vitp",
|
|
151
|
+
kZKoxP: "x4rnblq",
|
|
152
|
+
kg3NbH: "xnjsko4",
|
|
153
|
+
kzqmXN: "x16zkcgh",
|
|
154
|
+
$$css: true
|
|
155
|
+
},
|
|
156
|
+
"icon-xl": {
|
|
157
|
+
kaIpWk: "x1p5vitp",
|
|
158
|
+
kZKoxP: "x15h3g2r",
|
|
159
|
+
kg3NbH: "xnjsko4",
|
|
160
|
+
kzqmXN: "x1wis873",
|
|
161
|
+
$$css: true
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
var variantStyles = {
|
|
165
|
+
primary: {
|
|
166
|
+
kWkggS: "x1k98rc1",
|
|
167
|
+
kVAM5u: "x1lpgi1j",
|
|
168
|
+
kMwMTN: "x8p6z4r",
|
|
169
|
+
$$css: true
|
|
170
|
+
},
|
|
171
|
+
secondary: {
|
|
172
|
+
kWkggS: "xcc0o6n",
|
|
173
|
+
kVAM5u: "xmt3ebw",
|
|
174
|
+
kMwMTN: "x1t28c4i",
|
|
175
|
+
$$css: true
|
|
176
|
+
},
|
|
177
|
+
outline: {
|
|
178
|
+
kWkggS: "x1ail9j1",
|
|
179
|
+
kVAM5u: "xmt3ebw",
|
|
180
|
+
kMwMTN: "x1t28c4i",
|
|
181
|
+
$$css: true
|
|
182
|
+
},
|
|
183
|
+
ghost: {
|
|
184
|
+
kWkggS: "x1ail9j1",
|
|
185
|
+
kVAM5u: "x1p2lc83",
|
|
186
|
+
kMwMTN: "x1t28c4i",
|
|
187
|
+
$$css: true
|
|
188
|
+
},
|
|
189
|
+
destructive: {
|
|
190
|
+
kWkggS: "xezvvoc",
|
|
191
|
+
kVAM5u: "x18a8tw4",
|
|
192
|
+
kMwMTN: "xppjnsa",
|
|
193
|
+
$$css: true
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
var shapeStyles = {
|
|
197
|
+
default: {
|
|
198
|
+
$$css: true
|
|
199
|
+
},
|
|
200
|
+
square: {
|
|
201
|
+
kg3NbH: "xnjsko4",
|
|
202
|
+
$$css: true
|
|
203
|
+
},
|
|
204
|
+
circle: {
|
|
205
|
+
kaIpWk: "xwhwt5f",
|
|
206
|
+
kg3NbH: "xnjsko4",
|
|
207
|
+
$$css: true
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
var squareStyles = {
|
|
211
|
+
sm: {
|
|
212
|
+
kzqmXN: "x1g37zm5",
|
|
213
|
+
$$css: true
|
|
214
|
+
},
|
|
215
|
+
md: {
|
|
216
|
+
kzqmXN: "x18pndxb",
|
|
217
|
+
$$css: true
|
|
218
|
+
},
|
|
219
|
+
lg: {
|
|
220
|
+
kzqmXN: "x16zkcgh",
|
|
221
|
+
$$css: true
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
function Button(t0) {
|
|
225
|
+
const $ = _c(28);
|
|
226
|
+
let children;
|
|
227
|
+
let className;
|
|
228
|
+
let disabled;
|
|
229
|
+
let props2;
|
|
230
|
+
let style;
|
|
231
|
+
let t1;
|
|
232
|
+
let t2;
|
|
233
|
+
let t3;
|
|
234
|
+
let t4;
|
|
235
|
+
let xstyle;
|
|
236
|
+
if ($[0] !== t0) {
|
|
237
|
+
({
|
|
238
|
+
className,
|
|
239
|
+
style,
|
|
240
|
+
align: t1,
|
|
241
|
+
children,
|
|
242
|
+
disabled,
|
|
243
|
+
size: t2,
|
|
244
|
+
shape: t3,
|
|
245
|
+
variant: t4,
|
|
246
|
+
xstyle,
|
|
247
|
+
...props2
|
|
248
|
+
} = t0);
|
|
249
|
+
$[0] = t0;
|
|
250
|
+
$[1] = children;
|
|
251
|
+
$[2] = className;
|
|
252
|
+
$[3] = disabled;
|
|
253
|
+
$[4] = props2;
|
|
254
|
+
$[5] = style;
|
|
255
|
+
$[6] = t1;
|
|
256
|
+
$[7] = t2;
|
|
257
|
+
$[8] = t3;
|
|
258
|
+
$[9] = t4;
|
|
259
|
+
$[10] = xstyle;
|
|
260
|
+
} else {
|
|
261
|
+
children = $[1];
|
|
262
|
+
className = $[2];
|
|
263
|
+
disabled = $[3];
|
|
264
|
+
props2 = $[4];
|
|
265
|
+
style = $[5];
|
|
266
|
+
t1 = $[6];
|
|
267
|
+
t2 = $[7];
|
|
268
|
+
t3 = $[8];
|
|
269
|
+
t4 = $[9];
|
|
270
|
+
xstyle = $[10];
|
|
271
|
+
}
|
|
272
|
+
const align = t1 === void 0 ? "center" : t1;
|
|
273
|
+
const size = t2 === void 0 ? "md" : t2;
|
|
274
|
+
const shape = t3 === void 0 ? "default" : t3;
|
|
275
|
+
const variant = t4 === void 0 ? "primary" : t4;
|
|
276
|
+
const isStandardSize = size === "sm" || size === "md" || size === "lg";
|
|
277
|
+
const shapeWidth = isStandardSize && shape !== "default" && squareStyles[size];
|
|
278
|
+
const hasSolidBackground = variant === "primary" || variant === "destructive";
|
|
279
|
+
let t5;
|
|
280
|
+
if ($[11] !== align || $[12] !== className || $[13] !== disabled || $[14] !== hasSolidBackground || $[15] !== isStandardSize || $[16] !== shape || $[17] !== shapeWidth || $[18] !== size || $[19] !== style || $[20] !== variant || $[21] !== xstyle) {
|
|
281
|
+
t5 = mergeStyles(stylex.props(styles.root, alignStyles[align], variantStyles[variant], sizeStyles[size], !isStandardSize && styles.iconContent, shapeStyles[shape], shapeWidth, hasSolidBackground ? styles.solidInteraction : styles.surfaceInteraction, variant === "primary" && styles.primaryInteraction, disabled && styles.disabled, disabled && variant === "ghost" && styles.disabledGhost, xstyle), className, style);
|
|
282
|
+
$[11] = align;
|
|
283
|
+
$[12] = className;
|
|
284
|
+
$[13] = disabled;
|
|
285
|
+
$[14] = hasSolidBackground;
|
|
286
|
+
$[15] = isStandardSize;
|
|
287
|
+
$[16] = shape;
|
|
288
|
+
$[17] = shapeWidth;
|
|
289
|
+
$[18] = size;
|
|
290
|
+
$[19] = style;
|
|
291
|
+
$[20] = variant;
|
|
292
|
+
$[21] = xstyle;
|
|
293
|
+
$[22] = t5;
|
|
294
|
+
} else {
|
|
295
|
+
t5 = $[22];
|
|
296
|
+
}
|
|
297
|
+
let t6;
|
|
298
|
+
if ($[23] !== children || $[24] !== disabled || $[25] !== props2 || $[26] !== t5) {
|
|
299
|
+
t6 = /* @__PURE__ */ jsx(ButtonPrimitive, { ...props2, disabled, ...t5, children });
|
|
300
|
+
$[23] = children;
|
|
301
|
+
$[24] = disabled;
|
|
302
|
+
$[25] = props2;
|
|
303
|
+
$[26] = t5;
|
|
304
|
+
$[27] = t6;
|
|
305
|
+
} else {
|
|
306
|
+
t6 = $[27];
|
|
307
|
+
}
|
|
308
|
+
return t6;
|
|
309
|
+
}
|
|
310
|
+
export {
|
|
311
|
+
Button
|
|
312
|
+
};
|
|
313
|
+
//# sourceMappingURL=button.js.map
|