@satellatickets/ui 0.0.0-stage → 0.1.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/NOTICE.md +9 -0
- package/README.md +84 -3
- package/dist/native/index.d.ts +91 -0
- package/dist/native/index.js +699 -0
- package/dist/web/index.d.ts +97 -0
- package/dist/web/index.js +626 -0
- package/dist/web/styles.css +553 -0
- package/package.json +89 -3
|
@@ -0,0 +1,626 @@
|
|
|
1
|
+
import { UIContext, buttonIconSize, createUIContextValue, iconSizePx, textVariantStyles, useBrand, useButton, useColorScheme, useTheme } from "@satellatickets/core";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cssVariables } from "@satellatickets/tokens";
|
|
4
|
+
import { useMemo, useSyncExternalStore } from "react";
|
|
5
|
+
//#region src/_internal/cx.ts
|
|
6
|
+
/** Une clases CSS ignorando valores falsos. */
|
|
7
|
+
function cx(...parts) {
|
|
8
|
+
return parts.filter(Boolean).join(" ");
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/badge/Badge.module.css
|
|
12
|
+
var Badge_module_default = {
|
|
13
|
+
"danger": "sui-danger-iCOp0a",
|
|
14
|
+
"info": "sui-info-iCOp0a",
|
|
15
|
+
"root": "sui-root-iCOp0a",
|
|
16
|
+
"success": "sui-success-iCOp0a",
|
|
17
|
+
"warning": "sui-warning-iCOp0a"
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/badge/Badge.web.tsx
|
|
21
|
+
const variantClass$1 = {
|
|
22
|
+
success: Badge_module_default.success,
|
|
23
|
+
warning: Badge_module_default.warning,
|
|
24
|
+
danger: Badge_module_default.danger,
|
|
25
|
+
info: Badge_module_default.info
|
|
26
|
+
};
|
|
27
|
+
function Badge({ variant = "info", className, testID, children }) {
|
|
28
|
+
return /* @__PURE__ */ jsx("span", {
|
|
29
|
+
className: cx(Badge_module_default.root, variantClass$1[variant], className),
|
|
30
|
+
"data-testid": testID,
|
|
31
|
+
children
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/box/Box.module.css
|
|
36
|
+
var Box_module_default = { "root": "sui-root-fYQz2a" };
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/box/Box.web.tsx
|
|
39
|
+
function Box({ as: Tag = "div", padding, paddingX, paddingY, background, radius, borderColor, shadow, flex, className, style, testID, children }) {
|
|
40
|
+
const vars = {};
|
|
41
|
+
if (padding !== void 0) vars["--box-padding"] = `var(${cssVariables[`space.${padding}`]})`;
|
|
42
|
+
if (paddingX !== void 0) vars["--box-padding-x"] = `var(${cssVariables[`space.${paddingX}`]})`;
|
|
43
|
+
if (paddingY !== void 0) vars["--box-padding-y"] = `var(${cssVariables[`space.${paddingY}`]})`;
|
|
44
|
+
if (background !== void 0) vars["--box-background"] = `var(${cssVariables[`color.bg.${background}`]})`;
|
|
45
|
+
if (radius !== void 0) vars["--box-radius"] = `var(${cssVariables[`radius.${radius}`]})`;
|
|
46
|
+
if (borderColor !== void 0) {
|
|
47
|
+
vars["--box-border-color"] = `var(${cssVariables[`color.border.${borderColor}`]})`;
|
|
48
|
+
vars["--box-border-width"] = `var(${cssVariables["borderWidth.thin"]})`;
|
|
49
|
+
}
|
|
50
|
+
if (shadow !== void 0) vars["--box-shadow"] = `var(${cssVariables[`shadow.${shadow}`]})`;
|
|
51
|
+
if (flex !== void 0) vars["--box-flex"] = String(flex);
|
|
52
|
+
return /* @__PURE__ */ jsx(Tag, {
|
|
53
|
+
className: cx(Box_module_default.root, className),
|
|
54
|
+
style: {
|
|
55
|
+
...vars,
|
|
56
|
+
...style
|
|
57
|
+
},
|
|
58
|
+
"data-testid": testID,
|
|
59
|
+
children
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region ../icons/src/icons.ts
|
|
64
|
+
const icons = {
|
|
65
|
+
"arrow-left": [{
|
|
66
|
+
"type": "path",
|
|
67
|
+
"d": "m12 19-7-7 7-7"
|
|
68
|
+
}, {
|
|
69
|
+
"type": "path",
|
|
70
|
+
"d": "M19 12H5"
|
|
71
|
+
}],
|
|
72
|
+
"arrow-right": [{
|
|
73
|
+
"type": "path",
|
|
74
|
+
"d": "M5 12h14"
|
|
75
|
+
}, {
|
|
76
|
+
"type": "path",
|
|
77
|
+
"d": "m12 5 7 7-7 7"
|
|
78
|
+
}],
|
|
79
|
+
"calendar": [
|
|
80
|
+
{
|
|
81
|
+
"type": "path",
|
|
82
|
+
"d": "M8 2v3"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"type": "path",
|
|
86
|
+
"d": "M16 2v3"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"type": "rect",
|
|
90
|
+
"x": 3,
|
|
91
|
+
"y": 3,
|
|
92
|
+
"width": 18,
|
|
93
|
+
"height": 18,
|
|
94
|
+
"rx": 2
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"type": "path",
|
|
98
|
+
"d": "M3 9h18"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"check": [{
|
|
102
|
+
"type": "path",
|
|
103
|
+
"d": "M20 6 9 17l-5-5"
|
|
104
|
+
}],
|
|
105
|
+
"chevron-down": [{
|
|
106
|
+
"type": "path",
|
|
107
|
+
"d": "m6 9 6 6 6-6"
|
|
108
|
+
}],
|
|
109
|
+
"chevron-left": [{
|
|
110
|
+
"type": "path",
|
|
111
|
+
"d": "m15 18-6-6 6-6"
|
|
112
|
+
}],
|
|
113
|
+
"chevron-right": [{
|
|
114
|
+
"type": "path",
|
|
115
|
+
"d": "m9 18 6-6-6-6"
|
|
116
|
+
}],
|
|
117
|
+
"chevron-up": [{
|
|
118
|
+
"type": "path",
|
|
119
|
+
"d": "m18 15-6-6-6 6"
|
|
120
|
+
}],
|
|
121
|
+
"circle-alert": [
|
|
122
|
+
{
|
|
123
|
+
"type": "circle",
|
|
124
|
+
"cx": 12,
|
|
125
|
+
"cy": 12,
|
|
126
|
+
"r": 10
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"type": "line",
|
|
130
|
+
"x1": 12,
|
|
131
|
+
"y1": 8,
|
|
132
|
+
"x2": 12,
|
|
133
|
+
"y2": 12
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"type": "line",
|
|
137
|
+
"x1": 12,
|
|
138
|
+
"y1": 16,
|
|
139
|
+
"x2": 12.01,
|
|
140
|
+
"y2": 16
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"circle-check": [{
|
|
144
|
+
"type": "circle",
|
|
145
|
+
"cx": 12,
|
|
146
|
+
"cy": 12,
|
|
147
|
+
"r": 10
|
|
148
|
+
}, {
|
|
149
|
+
"type": "path",
|
|
150
|
+
"d": "m16 9-5.5 5.5L8 12"
|
|
151
|
+
}],
|
|
152
|
+
"circle-x": [
|
|
153
|
+
{
|
|
154
|
+
"type": "circle",
|
|
155
|
+
"cx": 12,
|
|
156
|
+
"cy": 12,
|
|
157
|
+
"r": 10
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"type": "path",
|
|
161
|
+
"d": "m15 9-6 6"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"type": "path",
|
|
165
|
+
"d": "m9 9 6 6"
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"eye-off": [
|
|
169
|
+
{
|
|
170
|
+
"type": "path",
|
|
171
|
+
"d": "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"type": "path",
|
|
175
|
+
"d": "M14.084 14.158a3 3 0 0 1-4.242-4.242"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"type": "path",
|
|
179
|
+
"d": "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"type": "path",
|
|
183
|
+
"d": "m2 2 20 20"
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"eye": [{
|
|
187
|
+
"type": "path",
|
|
188
|
+
"d": "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"
|
|
189
|
+
}, {
|
|
190
|
+
"type": "circle",
|
|
191
|
+
"cx": 12,
|
|
192
|
+
"cy": 12,
|
|
193
|
+
"r": 3
|
|
194
|
+
}],
|
|
195
|
+
"globe": [
|
|
196
|
+
{
|
|
197
|
+
"type": "circle",
|
|
198
|
+
"cx": 12,
|
|
199
|
+
"cy": 12,
|
|
200
|
+
"r": 10
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"type": "path",
|
|
204
|
+
"d": "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"type": "path",
|
|
208
|
+
"d": "M2 12h20"
|
|
209
|
+
}
|
|
210
|
+
],
|
|
211
|
+
"info": [
|
|
212
|
+
{
|
|
213
|
+
"type": "circle",
|
|
214
|
+
"cx": 12,
|
|
215
|
+
"cy": 12,
|
|
216
|
+
"r": 10
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"type": "path",
|
|
220
|
+
"d": "M12 16v-4"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"type": "path",
|
|
224
|
+
"d": "M12 8h.01"
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
"loader-circle": [{
|
|
228
|
+
"type": "path",
|
|
229
|
+
"d": "M21 12a9 9 0 1 1-6.219-8.56"
|
|
230
|
+
}],
|
|
231
|
+
"map-pin": [{
|
|
232
|
+
"type": "path",
|
|
233
|
+
"d": "M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"
|
|
234
|
+
}, {
|
|
235
|
+
"type": "circle",
|
|
236
|
+
"cx": 12,
|
|
237
|
+
"cy": 10,
|
|
238
|
+
"r": 3
|
|
239
|
+
}],
|
|
240
|
+
"menu": [
|
|
241
|
+
{
|
|
242
|
+
"type": "path",
|
|
243
|
+
"d": "M4 5h16"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"type": "path",
|
|
247
|
+
"d": "M4 12h16"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"type": "path",
|
|
251
|
+
"d": "M4 19h16"
|
|
252
|
+
}
|
|
253
|
+
],
|
|
254
|
+
"minus": [{
|
|
255
|
+
"type": "path",
|
|
256
|
+
"d": "M5 12h14"
|
|
257
|
+
}],
|
|
258
|
+
"plus": [{
|
|
259
|
+
"type": "path",
|
|
260
|
+
"d": "M5 12h14"
|
|
261
|
+
}, {
|
|
262
|
+
"type": "path",
|
|
263
|
+
"d": "M12 5v14"
|
|
264
|
+
}],
|
|
265
|
+
"search": [{
|
|
266
|
+
"type": "path",
|
|
267
|
+
"d": "m21 21-4.34-4.34"
|
|
268
|
+
}, {
|
|
269
|
+
"type": "circle",
|
|
270
|
+
"cx": 11,
|
|
271
|
+
"cy": 11,
|
|
272
|
+
"r": 8
|
|
273
|
+
}],
|
|
274
|
+
"settings": [{
|
|
275
|
+
"type": "path",
|
|
276
|
+
"d": "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"
|
|
277
|
+
}, {
|
|
278
|
+
"type": "circle",
|
|
279
|
+
"cx": 12,
|
|
280
|
+
"cy": 12,
|
|
281
|
+
"r": 3
|
|
282
|
+
}],
|
|
283
|
+
"ticket": [
|
|
284
|
+
{
|
|
285
|
+
"type": "path",
|
|
286
|
+
"d": "M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"type": "path",
|
|
290
|
+
"d": "M13 5v2"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"type": "path",
|
|
294
|
+
"d": "M13 17v2"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"type": "path",
|
|
298
|
+
"d": "M13 11v2"
|
|
299
|
+
}
|
|
300
|
+
],
|
|
301
|
+
"triangle-alert": [
|
|
302
|
+
{
|
|
303
|
+
"type": "path",
|
|
304
|
+
"d": "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"type": "path",
|
|
308
|
+
"d": "M12 9v4"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"type": "path",
|
|
312
|
+
"d": "M12 17h.01"
|
|
313
|
+
}
|
|
314
|
+
],
|
|
315
|
+
"user": [{
|
|
316
|
+
"type": "path",
|
|
317
|
+
"d": "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"
|
|
318
|
+
}, {
|
|
319
|
+
"type": "circle",
|
|
320
|
+
"cx": 12,
|
|
321
|
+
"cy": 7,
|
|
322
|
+
"r": 4
|
|
323
|
+
}],
|
|
324
|
+
"x": [{
|
|
325
|
+
"type": "path",
|
|
326
|
+
"d": "M18 6 6 18"
|
|
327
|
+
}, {
|
|
328
|
+
"type": "path",
|
|
329
|
+
"d": "m6 6 12 12"
|
|
330
|
+
}]
|
|
331
|
+
};
|
|
332
|
+
//#endregion
|
|
333
|
+
//#region src/icon/Icon.module.css
|
|
334
|
+
var Icon_module_default = { "root": "sui-root-JxbEOq" };
|
|
335
|
+
//#endregion
|
|
336
|
+
//#region src/icon/Icon.web.tsx
|
|
337
|
+
function renderElement(element, index) {
|
|
338
|
+
switch (element.type) {
|
|
339
|
+
case "path": return /* @__PURE__ */ jsx("path", { d: element.d }, index);
|
|
340
|
+
case "circle": return /* @__PURE__ */ jsx("circle", {
|
|
341
|
+
cx: element.cx,
|
|
342
|
+
cy: element.cy,
|
|
343
|
+
r: element.r
|
|
344
|
+
}, index);
|
|
345
|
+
case "line": return /* @__PURE__ */ jsx("line", {
|
|
346
|
+
x1: element.x1,
|
|
347
|
+
y1: element.y1,
|
|
348
|
+
x2: element.x2,
|
|
349
|
+
y2: element.y2
|
|
350
|
+
}, index);
|
|
351
|
+
case "rect": return /* @__PURE__ */ jsx("rect", {
|
|
352
|
+
x: element.x,
|
|
353
|
+
y: element.y,
|
|
354
|
+
width: element.width,
|
|
355
|
+
height: element.height,
|
|
356
|
+
...element.rx === void 0 ? {} : { rx: element.rx }
|
|
357
|
+
}, index);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function Icon({ name, size = "md", color = "primary", label, className, testID }) {
|
|
361
|
+
const px = iconSizePx[size];
|
|
362
|
+
const decorative = label === void 0;
|
|
363
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
364
|
+
className: cx(Icon_module_default.root, className),
|
|
365
|
+
width: px,
|
|
366
|
+
height: px,
|
|
367
|
+
viewBox: `0 0 24 24`,
|
|
368
|
+
fill: "none",
|
|
369
|
+
stroke: `var(${cssVariables[`color.text.${color}`]})`,
|
|
370
|
+
strokeWidth: 2,
|
|
371
|
+
strokeLinecap: "round",
|
|
372
|
+
strokeLinejoin: "round",
|
|
373
|
+
role: decorative ? void 0 : "img",
|
|
374
|
+
"aria-label": label,
|
|
375
|
+
"aria-hidden": decorative ? true : void 0,
|
|
376
|
+
focusable: "false",
|
|
377
|
+
"data-testid": testID,
|
|
378
|
+
children: [decorative ? null : /* @__PURE__ */ jsx("title", { children: label }), icons[name].map(renderElement)]
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
//#endregion
|
|
382
|
+
//#region src/spinner/Spinner.module.css
|
|
383
|
+
var Spinner_module_default = {
|
|
384
|
+
"icon": "sui-icon-iFfE_q",
|
|
385
|
+
"root": "sui-root-iFfE_q",
|
|
386
|
+
"spin": "sui-spin-iFfE_q"
|
|
387
|
+
};
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/spinner/Spinner.web.tsx
|
|
390
|
+
/**
|
|
391
|
+
* Indicador de carga indeterminada. Versión mínima (ROADMAP Fase 3): el icono
|
|
392
|
+
* `loader-circle` girando. Con `label` es una barra de progreso indeterminada
|
|
393
|
+
* para los lectores de pantalla; sin él, es decorativo.
|
|
394
|
+
*/
|
|
395
|
+
function Spinner({ size = "md", color = "primary", label, className, testID }) {
|
|
396
|
+
const decorative = label === void 0;
|
|
397
|
+
return /* @__PURE__ */ jsx("span", {
|
|
398
|
+
className: cx(Spinner_module_default.root, className),
|
|
399
|
+
role: decorative ? void 0 : "progressbar",
|
|
400
|
+
"aria-label": label,
|
|
401
|
+
"aria-hidden": decorative ? true : void 0,
|
|
402
|
+
"data-testid": testID,
|
|
403
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
404
|
+
name: "loader-circle",
|
|
405
|
+
size,
|
|
406
|
+
color,
|
|
407
|
+
className: Spinner_module_default.icon
|
|
408
|
+
})
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
//#endregion
|
|
412
|
+
//#region src/button/Button.module.css
|
|
413
|
+
var Button_module_default = {
|
|
414
|
+
"content": "sui-content-FZ-IiW",
|
|
415
|
+
"danger": "sui-danger-FZ-IiW",
|
|
416
|
+
"fullWidth": "sui-fullWidth-FZ-IiW",
|
|
417
|
+
"ghost": "sui-ghost-FZ-IiW",
|
|
418
|
+
"label": "sui-label-FZ-IiW",
|
|
419
|
+
"lg": "sui-lg-FZ-IiW",
|
|
420
|
+
"loading": "sui-loading-FZ-IiW",
|
|
421
|
+
"md": "sui-md-FZ-IiW",
|
|
422
|
+
"primary": "sui-primary-FZ-IiW",
|
|
423
|
+
"root": "sui-root-FZ-IiW",
|
|
424
|
+
"secondary": "sui-secondary-FZ-IiW",
|
|
425
|
+
"sm": "sui-sm-FZ-IiW",
|
|
426
|
+
"spinner": "sui-spinner-FZ-IiW"
|
|
427
|
+
};
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region src/button/Button.web.tsx
|
|
430
|
+
const variantClass = {
|
|
431
|
+
primary: Button_module_default.primary,
|
|
432
|
+
secondary: Button_module_default.secondary,
|
|
433
|
+
ghost: Button_module_default.ghost,
|
|
434
|
+
danger: Button_module_default.danger
|
|
435
|
+
};
|
|
436
|
+
const sizeClass = {
|
|
437
|
+
sm: Button_module_default.sm,
|
|
438
|
+
md: Button_module_default.md,
|
|
439
|
+
lg: Button_module_default.lg
|
|
440
|
+
};
|
|
441
|
+
function Button({ variant = "primary", size = "md", disabled = false, loading = false, iconStart, iconEnd, fullWidth = false, onPress, accessibilityLabel, type = "button", className, style, testID, ref, children }) {
|
|
442
|
+
const { interactive, press } = useButton({
|
|
443
|
+
disabled,
|
|
444
|
+
loading,
|
|
445
|
+
onPress
|
|
446
|
+
});
|
|
447
|
+
const iconSize = buttonIconSize[size];
|
|
448
|
+
function handleClick(event) {
|
|
449
|
+
if (!interactive) event.preventDefault();
|
|
450
|
+
press();
|
|
451
|
+
}
|
|
452
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
453
|
+
ref,
|
|
454
|
+
type,
|
|
455
|
+
className: cx(Button_module_default.root, variantClass[variant], sizeClass[size], fullWidth && Button_module_default.fullWidth, loading && Button_module_default.loading, className),
|
|
456
|
+
style,
|
|
457
|
+
disabled,
|
|
458
|
+
"aria-disabled": loading ? true : void 0,
|
|
459
|
+
"aria-busy": loading ? true : void 0,
|
|
460
|
+
"aria-label": accessibilityLabel,
|
|
461
|
+
"data-testid": testID,
|
|
462
|
+
onClick: handleClick,
|
|
463
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
464
|
+
className: Button_module_default.content,
|
|
465
|
+
children: [
|
|
466
|
+
iconStart === void 0 ? null : /* @__PURE__ */ jsx(Icon, {
|
|
467
|
+
name: iconStart,
|
|
468
|
+
size: iconSize
|
|
469
|
+
}),
|
|
470
|
+
/* @__PURE__ */ jsx("span", {
|
|
471
|
+
className: Button_module_default.label,
|
|
472
|
+
children
|
|
473
|
+
}),
|
|
474
|
+
iconEnd === void 0 ? null : /* @__PURE__ */ jsx(Icon, {
|
|
475
|
+
name: iconEnd,
|
|
476
|
+
size: iconSize
|
|
477
|
+
})
|
|
478
|
+
]
|
|
479
|
+
}), loading ? /* @__PURE__ */ jsx("span", {
|
|
480
|
+
className: Button_module_default.spinner,
|
|
481
|
+
children: /* @__PURE__ */ jsx(Spinner, { size: iconSize })
|
|
482
|
+
}) : null]
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
//#endregion
|
|
486
|
+
//#region src/stack/Stack.module.css
|
|
487
|
+
var Stack_module_default = {
|
|
488
|
+
"alignCenter": "sui-alignCenter-oAyu1G",
|
|
489
|
+
"alignEnd": "sui-alignEnd-oAyu1G",
|
|
490
|
+
"alignStart": "sui-alignStart-oAyu1G",
|
|
491
|
+
"alignStretch": "sui-alignStretch-oAyu1G",
|
|
492
|
+
"column": "sui-column-oAyu1G",
|
|
493
|
+
"justifyAround": "sui-justifyAround-oAyu1G",
|
|
494
|
+
"justifyBetween": "sui-justifyBetween-oAyu1G",
|
|
495
|
+
"justifyCenter": "sui-justifyCenter-oAyu1G",
|
|
496
|
+
"justifyEnd": "sui-justifyEnd-oAyu1G",
|
|
497
|
+
"justifyStart": "sui-justifyStart-oAyu1G",
|
|
498
|
+
"row": "sui-row-oAyu1G",
|
|
499
|
+
"stack": "sui-stack-oAyu1G",
|
|
500
|
+
"wrap": "sui-wrap-oAyu1G"
|
|
501
|
+
};
|
|
502
|
+
//#endregion
|
|
503
|
+
//#region src/stack/Stack.web.tsx
|
|
504
|
+
const directionClass = {
|
|
505
|
+
column: Stack_module_default.column,
|
|
506
|
+
row: Stack_module_default.row
|
|
507
|
+
};
|
|
508
|
+
const alignClass$1 = {
|
|
509
|
+
stretch: Stack_module_default.alignStretch,
|
|
510
|
+
start: Stack_module_default.alignStart,
|
|
511
|
+
center: Stack_module_default.alignCenter,
|
|
512
|
+
end: Stack_module_default.alignEnd
|
|
513
|
+
};
|
|
514
|
+
const justifyClass = {
|
|
515
|
+
start: Stack_module_default.justifyStart,
|
|
516
|
+
center: Stack_module_default.justifyCenter,
|
|
517
|
+
end: Stack_module_default.justifyEnd,
|
|
518
|
+
between: Stack_module_default.justifyBetween,
|
|
519
|
+
around: Stack_module_default.justifyAround
|
|
520
|
+
};
|
|
521
|
+
function Stack({ direction = "column", gap, align = "stretch", justify = "start", wrap = false, className, style, ...boxProps }) {
|
|
522
|
+
const gapStyle = gap === void 0 ? void 0 : { "--stack-gap": `var(${cssVariables[`space.${gap}`]})` };
|
|
523
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
524
|
+
...boxProps,
|
|
525
|
+
className: cx(Stack_module_default.stack, directionClass[direction], alignClass$1[align], justifyClass[justify], wrap && Stack_module_default.wrap, className),
|
|
526
|
+
style: {
|
|
527
|
+
...gapStyle,
|
|
528
|
+
...style
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
//#endregion
|
|
533
|
+
//#region src/text/Text.module.css
|
|
534
|
+
var Text_module_default = {
|
|
535
|
+
"center": "sui-center-ca3VdW",
|
|
536
|
+
"left": "sui-left-ca3VdW",
|
|
537
|
+
"right": "sui-right-ca3VdW",
|
|
538
|
+
"root": "sui-root-ca3VdW",
|
|
539
|
+
"truncate": "sui-truncate-ca3VdW",
|
|
540
|
+
"uppercase": "sui-uppercase-ca3VdW"
|
|
541
|
+
};
|
|
542
|
+
//#endregion
|
|
543
|
+
//#region src/text/Text.web.tsx
|
|
544
|
+
const defaultElement = {
|
|
545
|
+
hero: "h1",
|
|
546
|
+
display: "h1",
|
|
547
|
+
title: "h2",
|
|
548
|
+
heading: "h3",
|
|
549
|
+
subheading: "h4",
|
|
550
|
+
body: "p",
|
|
551
|
+
bodySmall: "p",
|
|
552
|
+
label: "span",
|
|
553
|
+
caption: "span",
|
|
554
|
+
code: "code"
|
|
555
|
+
};
|
|
556
|
+
const alignClass = {
|
|
557
|
+
left: Text_module_default.left,
|
|
558
|
+
center: Text_module_default.center,
|
|
559
|
+
right: Text_module_default.right
|
|
560
|
+
};
|
|
561
|
+
function Text({ variant = "body", color = "primary", align, truncate = false, as, className, style, testID, children }) {
|
|
562
|
+
const spec = textVariantStyles[variant];
|
|
563
|
+
const Tag = as ?? defaultElement[variant];
|
|
564
|
+
const vars = {
|
|
565
|
+
"--text-family": `var(${cssVariables[`font.family.${spec.family}`]})`,
|
|
566
|
+
"--text-size": `var(${cssVariables[`font.size.${spec.size}`]})`,
|
|
567
|
+
"--text-line-height": `var(${cssVariables[`font.lineHeight.${spec.size}`]})`,
|
|
568
|
+
"--text-weight": `var(${cssVariables[`font.weight.${spec.weight}`]})`,
|
|
569
|
+
"--text-color": `var(${cssVariables[`color.text.${color}`]})`
|
|
570
|
+
};
|
|
571
|
+
if (spec.letterSpacing !== void 0) vars["--text-letter-spacing"] = `${spec.letterSpacing}px`;
|
|
572
|
+
return /* @__PURE__ */ jsx(Tag, {
|
|
573
|
+
className: cx(Text_module_default.root, spec.uppercase && Text_module_default.uppercase, align && alignClass[align], truncate && Text_module_default.truncate, className),
|
|
574
|
+
style: {
|
|
575
|
+
...vars,
|
|
576
|
+
...style
|
|
577
|
+
},
|
|
578
|
+
"data-testid": testID,
|
|
579
|
+
children
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
//#endregion
|
|
583
|
+
//#region src/ui-provider/UIProvider.module.css
|
|
584
|
+
var UIProvider_module_default = { "root": "sui-root-QoB9YG" };
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region src/ui-provider/UIProvider.web.tsx
|
|
587
|
+
const DARK_QUERY = "(prefers-color-scheme: dark)";
|
|
588
|
+
function subscribe(onChange) {
|
|
589
|
+
if (typeof window === "undefined") return () => {};
|
|
590
|
+
const media = window.matchMedia(DARK_QUERY);
|
|
591
|
+
media.addEventListener("change", onChange);
|
|
592
|
+
return () => media.removeEventListener("change", onChange);
|
|
593
|
+
}
|
|
594
|
+
function getSnapshot() {
|
|
595
|
+
return typeof window !== "undefined" && window.matchMedia(DARK_QUERY).matches ? "dark" : "light";
|
|
596
|
+
}
|
|
597
|
+
function getServerSnapshot() {
|
|
598
|
+
return "light";
|
|
599
|
+
}
|
|
600
|
+
/** Esquema preferido por el sistema (`prefers-color-scheme`), estable en SSR. */
|
|
601
|
+
function useSystemColorScheme() {
|
|
602
|
+
return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Activa tema y marca para todo lo que envuelve (ADR-010). Pone `data-theme` y
|
|
606
|
+
* `data-brand` en un contenedor sin caja propia; `tokens.css` hace el resto.
|
|
607
|
+
*/
|
|
608
|
+
function UIProvider({ theme = "system", brand, children }) {
|
|
609
|
+
const system = useSystemColorScheme();
|
|
610
|
+
const value = useMemo(() => createUIContextValue(theme, system, brand), [
|
|
611
|
+
theme,
|
|
612
|
+
system,
|
|
613
|
+
brand
|
|
614
|
+
]);
|
|
615
|
+
return /* @__PURE__ */ jsx(UIContext.Provider, {
|
|
616
|
+
value,
|
|
617
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
618
|
+
className: UIProvider_module_default.root,
|
|
619
|
+
"data-theme": value.colorScheme,
|
|
620
|
+
"data-brand": brand,
|
|
621
|
+
children
|
|
622
|
+
})
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
//#endregion
|
|
626
|
+
export { Badge, Box, Button, Icon, Spinner, Stack, Text, UIProvider, useBrand, useColorScheme, useTheme };
|