@xaui/native 0.9.1-alpha.3 → 0.9.1-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-27ZRTZEE.js +293 -0
- package/dist/chunk-3FV4COTM.js +68 -0
- package/dist/chunk-423RQBOX.js +21 -0
- package/dist/chunk-4GTAZM2C.js +174 -0
- package/dist/chunk-4XPLPQLM.cjs +147 -0
- package/dist/{chunk-3QBT3Q65.cjs → chunk-57SJ4LJF.cjs} +7 -2
- package/dist/chunk-5GO7MAVY.cjs +74 -0
- package/dist/chunk-5RQ7AZPN.cjs +455 -0
- package/dist/chunk-5Z4P6WHR.cjs +525 -0
- package/dist/chunk-6RVCGLKZ.js +661 -0
- package/dist/chunk-7DPL3ZDS.cjs +21 -0
- package/dist/chunk-7EIHHOHP.cjs +42 -0
- package/dist/chunk-7SEZGVTY.js +62 -0
- package/dist/chunk-7XKQJQF2.cjs +70 -0
- package/dist/{chunk-X2K2FX3W.js → chunk-A3EGFI6T.js} +6 -1
- package/dist/chunk-A5OCK3C2.js +525 -0
- package/dist/chunk-BA2DBSAN.js +102 -0
- package/dist/chunk-BFMTUMTU.js +669 -0
- package/dist/chunk-BVJQ3UPZ.js +62 -0
- package/dist/chunk-DFME724B.js +147 -0
- package/dist/chunk-E2CWBQTV.js +119 -0
- package/dist/chunk-E4TS6632.cjs +314 -0
- package/dist/chunk-EGLLDKN6.js +9 -0
- package/dist/chunk-EJQCQPET.cjs +9 -0
- package/dist/chunk-F6CQ6CBI.cjs +112 -0
- package/dist/chunk-F6W3JQ7K.js +42 -0
- package/dist/chunk-FMZQW35T.js +431 -0
- package/dist/chunk-FNEUOBCV.cjs +174 -0
- package/dist/chunk-G7K652GC.js +145 -0
- package/dist/chunk-GGW42MY4.js +20 -0
- package/dist/chunk-GI24YJPE.js +314 -0
- package/dist/chunk-GLGU2WFL.cjs +190 -0
- package/dist/chunk-GPVNCJ3Z.cjs +696 -0
- package/dist/chunk-GVQOD3VW.js +74 -0
- package/dist/chunk-KOC3KQIT.js +124 -0
- package/dist/chunk-KPWZLUES.cjs +124 -0
- package/dist/chunk-KWCHSIMI.cjs +293 -0
- package/dist/chunk-MC7SY2QH.cjs +20 -0
- package/dist/chunk-N527BTY4.cjs +366 -0
- package/dist/chunk-NBFWWQFW.cjs +346 -0
- package/dist/chunk-NYRXUGVL.js +104 -0
- package/dist/{chunk-AW63PTQ4.cjs → chunk-OHEHPQLC.cjs} +72 -72
- package/dist/chunk-Q3WFY5N3.js +366 -0
- package/dist/chunk-QGN2BBJO.cjs +104 -0
- package/dist/chunk-TGZZ3RZU.cjs +86 -0
- package/dist/{chunk-2KXQATVL.js → chunk-TZG3DERP.js} +46 -46
- package/dist/chunk-UBQLKIZC.cjs +431 -0
- package/dist/chunk-URSKA2VR.js +190 -0
- package/dist/chunk-V4WDMM6Z.js +86 -0
- package/dist/chunk-VJEER76X.js +455 -0
- package/dist/chunk-VZBWYWEI.cjs +736 -0
- package/dist/chunk-WR7YLDVV.cjs +68 -0
- package/dist/chunk-X4HQ4H2V.js +701 -0
- package/dist/chunk-XFSW3ZNI.cjs +145 -0
- package/dist/chunk-XQFAUDR2.cjs +62 -0
- package/dist/chunk-YKL6XHM6.js +346 -0
- package/dist/chunk-ZP2E2H2G.cjs +119 -0
- package/dist/chunk-ZSLNGBDS.cjs +700 -0
- package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
- package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
- package/dist/components/alert/index.cjs +20 -0
- package/dist/components/alert/index.d.cts +169 -0
- package/dist/components/alert/index.d.ts +169 -0
- package/dist/components/alert/index.js +20 -0
- package/dist/components/button/index.cjs +21 -0
- package/dist/components/button/index.d.cts +613 -0
- package/dist/components/button/index.d.ts +613 -0
- package/dist/components/button/index.js +21 -0
- package/dist/components/card/index.cjs +22 -0
- package/dist/components/card/index.d.cts +620 -0
- package/dist/components/card/index.d.ts +620 -0
- package/dist/components/card/index.js +22 -0
- package/dist/components/checkbox/index.cjs +26 -0
- package/dist/components/checkbox/index.d.cts +1136 -0
- package/dist/components/checkbox/index.d.ts +1136 -0
- package/dist/components/checkbox/index.js +26 -0
- package/dist/components/chip/index.cjs +20 -0
- package/dist/components/chip/index.d.cts +608 -0
- package/dist/components/chip/index.d.ts +608 -0
- package/dist/components/chip/index.js +20 -0
- package/dist/components/input/index.cjs +25 -0
- package/dist/components/input/index.d.cts +205 -0
- package/dist/components/input/index.d.ts +205 -0
- package/dist/components/input/index.js +25 -0
- package/dist/components/input-group/index.cjs +27 -0
- package/dist/components/input-group/index.d.cts +270 -0
- package/dist/components/input-group/index.d.ts +270 -0
- package/dist/components/input-group/index.js +27 -0
- package/dist/components/input-otp/index.cjs +29 -0
- package/dist/components/input-otp/index.d.cts +325 -0
- package/dist/components/input-otp/index.d.ts +325 -0
- package/dist/components/input-otp/index.js +29 -0
- package/dist/components/radio/index.cjs +26 -0
- package/dist/components/radio/index.d.cts +1102 -0
- package/dist/components/radio/index.d.ts +1102 -0
- package/dist/components/radio/index.js +26 -0
- package/dist/components/spinner/index.cjs +16 -0
- package/dist/components/spinner/index.d.cts +104 -0
- package/dist/components/spinner/index.d.ts +104 -0
- package/dist/components/spinner/index.js +16 -0
- package/dist/components/switch/index.cjs +27 -0
- package/dist/components/switch/index.d.cts +1154 -0
- package/dist/components/switch/index.d.ts +1154 -0
- package/dist/components/switch/index.js +27 -0
- package/dist/components/text-area/index.cjs +14 -0
- package/dist/components/text-area/index.d.cts +73 -0
- package/dist/components/text-area/index.d.ts +73 -0
- package/dist/components/text-area/index.js +14 -0
- package/dist/components/typography/index.cjs +15 -0
- package/dist/components/typography/index.d.cts +116 -0
- package/dist/components/typography/index.d.ts +116 -0
- package/dist/components/typography/index.js +15 -0
- package/dist/components/view/index.cjs +17 -0
- package/dist/components/view/index.d.cts +152 -0
- package/dist/components/view/index.d.ts +152 -0
- package/dist/components/view/index.js +17 -0
- package/dist/create-recipe-BdVd2ffi.d.ts +114 -0
- package/dist/create-recipe-dC7wMfnj.d.cts +114 -0
- package/dist/icon.type-Kml72iSz.d.ts +73 -0
- package/dist/icon.type-d_i9ma-i.d.cts +73 -0
- package/dist/index.cjs +246 -4
- package/dist/index.d.cts +109 -4
- package/dist/index.d.ts +109 -4
- package/dist/index.js +266 -24
- package/dist/input.type-BUMDlzL9.d.cts +167 -0
- package/dist/input.type-D2qgi03E.d.ts +167 -0
- package/dist/pressable-feedback.type-BA2C9sSz.d.cts +127 -0
- package/dist/pressable-feedback.type-Bs4dQlGj.d.ts +127 -0
- package/dist/style-props.type-CfnoGEP7.d.cts +31 -0
- package/dist/style-props.type-CfnoGEP7.d.ts +31 -0
- package/dist/system/index.cjs +60 -3
- package/dist/system/index.d.cts +347 -181
- package/dist/system/index.d.ts +347 -181
- package/dist/system/index.js +71 -14
- package/dist/theme/index.cjs +4 -3
- package/dist/theme/index.d.cts +34 -23
- package/dist/theme/index.d.ts +34 -23
- package/dist/theme/index.js +3 -2
- package/dist/{theme.type-C9bFJKFm.d.cts → theme.type-C2gNHpEx.d.cts} +1 -1
- package/dist/{theme.type-C9bFJKFm.d.ts → theme.type-C2gNHpEx.d.ts} +1 -1
- package/package.json +174 -18
- package/dist/chunk-QAMNNTGM.js +0 -637
- package/dist/chunk-V63JO65F.cjs +0 -637
|
@@ -2,67 +2,54 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkMC7SY2QHcjs = require('./chunk-MC7SY2QH.cjs');
|
|
6
9
|
|
|
7
10
|
// src/provider/xaui-provider.tsx
|
|
8
11
|
var _reactnative = require('react-native');
|
|
9
12
|
|
|
10
|
-
// src/utils/stable-hash.ts
|
|
11
|
-
function canonical(value) {
|
|
12
|
-
if (value === null || typeof value !== "object") return _nullishCoalesce(JSON.stringify(value), () => ( "null"));
|
|
13
|
-
if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
|
|
14
|
-
const entries = Object.entries(value).filter(([, v]) => typeof v !== "function").sort(([a], [b]) => a < b ? -1 : 1).map(([k, v]) => `${JSON.stringify(k)}:${canonical(v)}`);
|
|
15
|
-
return `{${entries.join(",")}}`;
|
|
16
|
-
}
|
|
17
|
-
function stableHash(value) {
|
|
18
|
-
const input = canonical(value);
|
|
19
|
-
let hash = 2166136261;
|
|
20
|
-
for (let i = 0; i < input.length; i++) {
|
|
21
|
-
hash ^= input.charCodeAt(i);
|
|
22
|
-
hash = Math.imul(hash, 16777619) >>> 0;
|
|
23
|
-
}
|
|
24
|
-
return hash.toString(36);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
13
|
// src/theme/derive-colors.ts
|
|
28
14
|
function deriveColors(s) {
|
|
29
15
|
return {
|
|
30
|
-
accentPressed:
|
|
31
|
-
successPressed:
|
|
32
|
-
warningPressed:
|
|
33
|
-
dangerPressed:
|
|
34
|
-
defaultPressed:
|
|
35
|
-
surfacePressed:
|
|
36
|
-
defaultSoft:
|
|
16
|
+
accentPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.accent, s.foreground, 0.1),
|
|
17
|
+
successPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.success, s.foreground, 0.1),
|
|
18
|
+
warningPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.warning, s.foreground, 0.1),
|
|
19
|
+
dangerPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.danger, s.foreground, 0.1),
|
|
20
|
+
defaultPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.default, s.defaultForeground, 0.04),
|
|
21
|
+
surfacePressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.08),
|
|
22
|
+
defaultSoft: _chunk57SJ4LJFcjs.alpha.call(void 0, s.default, 0.5),
|
|
37
23
|
defaultSoftForeground: s.defaultForeground,
|
|
38
|
-
defaultSoftPressed:
|
|
39
|
-
accentSoft:
|
|
40
|
-
accentSoftForeground:
|
|
41
|
-
accentSoftPressed:
|
|
42
|
-
successSoft:
|
|
43
|
-
successSoftForeground:
|
|
44
|
-
successSoftPressed:
|
|
45
|
-
warningSoft:
|
|
46
|
-
warningSoftForeground:
|
|
47
|
-
warningSoftPressed:
|
|
48
|
-
dangerSoft:
|
|
49
|
-
dangerSoftForeground:
|
|
50
|
-
dangerSoftPressed:
|
|
51
|
-
backgroundSecondary:
|
|
52
|
-
backgroundTertiary:
|
|
24
|
+
defaultSoftPressed: _chunk57SJ4LJFcjs.alpha.call(void 0, s.default, 0.6),
|
|
25
|
+
accentSoft: _chunk57SJ4LJFcjs.alpha.call(void 0, s.accent, 0.15),
|
|
26
|
+
accentSoftForeground: _chunk57SJ4LJFcjs.mix.call(void 0, s.accent, s.foreground, 0.2),
|
|
27
|
+
accentSoftPressed: _chunk57SJ4LJFcjs.alpha.call(void 0, s.accent, 0.2),
|
|
28
|
+
successSoft: _chunk57SJ4LJFcjs.alpha.call(void 0, s.success, 0.15),
|
|
29
|
+
successSoftForeground: _chunk57SJ4LJFcjs.mix.call(void 0, s.success, s.foreground, 0.3),
|
|
30
|
+
successSoftPressed: _chunk57SJ4LJFcjs.alpha.call(void 0, s.success, 0.2),
|
|
31
|
+
warningSoft: _chunk57SJ4LJFcjs.alpha.call(void 0, s.warning, 0.15),
|
|
32
|
+
warningSoftForeground: _chunk57SJ4LJFcjs.mix.call(void 0, s.warning, s.foreground, 0.35),
|
|
33
|
+
warningSoftPressed: _chunk57SJ4LJFcjs.alpha.call(void 0, s.warning, 0.2),
|
|
34
|
+
dangerSoft: _chunk57SJ4LJFcjs.alpha.call(void 0, s.danger, 0.15),
|
|
35
|
+
dangerSoftForeground: _chunk57SJ4LJFcjs.mix.call(void 0, s.danger, s.foreground, 0.2),
|
|
36
|
+
dangerSoftPressed: _chunk57SJ4LJFcjs.alpha.call(void 0, s.danger, 0.2),
|
|
37
|
+
backgroundSecondary: _chunk57SJ4LJFcjs.mix.call(void 0, s.background, s.foreground, 0.04),
|
|
38
|
+
backgroundTertiary: _chunk57SJ4LJFcjs.mix.call(void 0, s.background, s.foreground, 0.08),
|
|
53
39
|
backgroundInverse: s.foreground,
|
|
54
|
-
borderSecondary:
|
|
55
|
-
borderTertiary:
|
|
56
|
-
separatorSecondary:
|
|
57
|
-
separatorTertiary:
|
|
58
|
-
fieldPressed:
|
|
40
|
+
borderSecondary: _chunk57SJ4LJFcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.22),
|
|
41
|
+
borderTertiary: _chunk57SJ4LJFcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.34),
|
|
42
|
+
separatorSecondary: _chunk57SJ4LJFcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.15),
|
|
43
|
+
separatorTertiary: _chunk57SJ4LJFcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.19),
|
|
44
|
+
fieldPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.fieldBackground, s.fieldForeground, 0.1),
|
|
59
45
|
fieldFocus: s.fieldBackground,
|
|
60
|
-
fieldBorderPressed:
|
|
61
|
-
fieldBorderFocus:
|
|
46
|
+
fieldBorderPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.12),
|
|
47
|
+
fieldBorderFocus: _chunk57SJ4LJFcjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.26)
|
|
62
48
|
};
|
|
63
49
|
}
|
|
64
50
|
|
|
65
51
|
// src/theme/scales.ts
|
|
52
|
+
|
|
66
53
|
var SPACING_UNIT = 4;
|
|
67
54
|
var RADIUS_BASE = 12;
|
|
68
55
|
function buildRadius(base) {
|
|
@@ -75,7 +62,16 @@ function buildRadius(base) {
|
|
|
75
62
|
"2xl": base * 2,
|
|
76
63
|
"3xl": base * 3,
|
|
77
64
|
"4xl": base * 4,
|
|
78
|
-
|
|
65
|
+
/**
|
|
66
|
+
* HeroUI's value, reached from the other side of the scale: their `--radius-field` is
|
|
67
|
+
* an alias of their `--radius-xl`, and their base is 8 where ours is 12 — so their
|
|
68
|
+
* field corner is 12 points and, at our default base, so is this.
|
|
69
|
+
*
|
|
70
|
+
* It coincides with `lg` today and is still its own key, because that is what lets a
|
|
71
|
+
* theme round its fields without rounding its cards. It was `base * 1.75`, which put a
|
|
72
|
+
* 48-tall field at 87% of its geometric maximum — a gélule rather than a rounded box.
|
|
73
|
+
*/
|
|
74
|
+
field: base,
|
|
79
75
|
full: 9999
|
|
80
76
|
};
|
|
81
77
|
}
|
|
@@ -114,7 +110,10 @@ var fontWeights = {
|
|
|
114
110
|
var fontFamilies = {
|
|
115
111
|
body: "System",
|
|
116
112
|
heading: "System",
|
|
117
|
-
|
|
113
|
+
// `'monospace'` is an Android family name, not a generic one: iOS does not resolve it and
|
|
114
|
+
// silently falls back to the system face, so code set with it is not monospaced there.
|
|
115
|
+
// Menlo is the face iOS ships, and it is what HeroUI Native selects for the same reason.
|
|
116
|
+
mono: _reactnative.Platform.OS === "ios" ? "Menlo" : "monospace"
|
|
118
117
|
};
|
|
119
118
|
var borderWidth = { default: 1, field: 1 };
|
|
120
119
|
var opacity = { disabled: 0.5 };
|
|
@@ -171,7 +170,7 @@ var tokens = {
|
|
|
171
170
|
foreground: "#18181b",
|
|
172
171
|
surface: "#ffffff",
|
|
173
172
|
surfaceForeground: "#18181b",
|
|
174
|
-
surfaceSecondary: "#
|
|
173
|
+
surfaceSecondary: "#ececee",
|
|
175
174
|
surfaceSecondaryForeground: "#18181b",
|
|
176
175
|
surfaceTertiary: "#e4e4e7",
|
|
177
176
|
surfaceTertiaryForeground: "#18181b",
|
|
@@ -179,7 +178,7 @@ var tokens = {
|
|
|
179
178
|
overlayForeground: "#18181b",
|
|
180
179
|
backdrop: "rgba(0, 0, 0, 0.2)",
|
|
181
180
|
muted: "#71717a",
|
|
182
|
-
default: "#
|
|
181
|
+
default: "#e4e4e7",
|
|
183
182
|
defaultForeground: "#18181b",
|
|
184
183
|
accent: "#9333ea",
|
|
185
184
|
accentForeground: "#faf5ff",
|
|
@@ -189,7 +188,7 @@ var tokens = {
|
|
|
189
188
|
fieldBorder: "#e4e4e7",
|
|
190
189
|
success: "#15803d",
|
|
191
190
|
successForeground: "#fafafa",
|
|
192
|
-
warning: "#
|
|
191
|
+
warning: "#c2410c",
|
|
193
192
|
warningForeground: "#fafafa",
|
|
194
193
|
danger: "#dc2626",
|
|
195
194
|
dangerForeground: "#fafafa",
|
|
@@ -199,24 +198,24 @@ var tokens = {
|
|
|
199
198
|
separator: "#d4d4d8",
|
|
200
199
|
focus: "#9333ea",
|
|
201
200
|
link: "#18181b",
|
|
202
|
-
accentPressed: "#
|
|
203
|
-
successPressed: "#
|
|
204
|
-
warningPressed: "#
|
|
205
|
-
dangerPressed: "#
|
|
206
|
-
defaultPressed: "#
|
|
201
|
+
accentPressed: "#8533d3",
|
|
202
|
+
successPressed: "#1b753a",
|
|
203
|
+
warningPressed: "#af3e15",
|
|
204
|
+
dangerPressed: "#c72927",
|
|
205
|
+
defaultPressed: "#dbdbde",
|
|
207
206
|
surfacePressed: "#eaeaea",
|
|
208
|
-
defaultSoft: "rgba(
|
|
207
|
+
defaultSoft: "rgba(228, 228, 231, 0.5)",
|
|
209
208
|
defaultSoftForeground: "#18181b",
|
|
210
|
-
defaultSoftPressed: "rgba(
|
|
209
|
+
defaultSoftPressed: "rgba(228, 228, 231, 0.6)",
|
|
211
210
|
accentSoft: "rgba(147, 51, 234, 0.15)",
|
|
212
211
|
accentSoftForeground: "#7833bc",
|
|
213
212
|
accentSoftPressed: "rgba(147, 51, 234, 0.2)",
|
|
214
213
|
successSoft: "rgba(21, 128, 61, 0.15)",
|
|
215
214
|
successSoftForeground: "#205f34",
|
|
216
215
|
successSoftPressed: "rgba(21, 128, 61, 0.2)",
|
|
217
|
-
warningSoft: "rgba(
|
|
218
|
-
warningSoftForeground: "#
|
|
219
|
-
warningSoftPressed: "rgba(
|
|
216
|
+
warningSoft: "rgba(194, 65, 12, 0.15)",
|
|
217
|
+
warningSoftForeground: "#82361e",
|
|
218
|
+
warningSoftPressed: "rgba(194, 65, 12, 0.2)",
|
|
220
219
|
dangerSoft: "rgba(220, 38, 38, 0.15)",
|
|
221
220
|
dangerSoftForeground: "#b22b28",
|
|
222
221
|
dangerSoftPressed: "rgba(220, 38, 38, 0.2)",
|
|
@@ -259,7 +258,7 @@ var tokens = {
|
|
|
259
258
|
fieldBorder: "#3f3f46",
|
|
260
259
|
success: "#4ade80",
|
|
261
260
|
successForeground: "#18181b",
|
|
262
|
-
warning: "#
|
|
261
|
+
warning: "#fb923c",
|
|
263
262
|
warningForeground: "#18181b",
|
|
264
263
|
danger: "#f87171",
|
|
265
264
|
dangerForeground: "#18181b",
|
|
@@ -269,10 +268,10 @@ var tokens = {
|
|
|
269
268
|
separator: "#52525b",
|
|
270
269
|
focus: "#c084fc",
|
|
271
270
|
link: "#fafafa",
|
|
272
|
-
accentPressed: "#
|
|
273
|
-
successPressed: "#
|
|
274
|
-
warningPressed: "#
|
|
275
|
-
dangerPressed: "#
|
|
271
|
+
accentPressed: "#c691fd",
|
|
272
|
+
successPressed: "#64e18d",
|
|
273
|
+
warningPressed: "#fc9d55",
|
|
274
|
+
dangerPressed: "#fa807e",
|
|
276
275
|
defaultPressed: "#2e2e31",
|
|
277
276
|
surfacePressed: "#27272a",
|
|
278
277
|
defaultSoft: "rgba(39, 39, 42, 0.5)",
|
|
@@ -284,9 +283,9 @@ var tokens = {
|
|
|
284
283
|
successSoft: "rgba(74, 222, 128, 0.15)",
|
|
285
284
|
successSoftForeground: "#8de8a6",
|
|
286
285
|
successSoftPressed: "rgba(74, 222, 128, 0.2)",
|
|
287
|
-
warningSoft: "rgba(251,
|
|
288
|
-
warningSoftForeground: "#
|
|
289
|
-
warningSoftPressed: "rgba(251,
|
|
286
|
+
warningSoft: "rgba(251, 146, 60, 0.15)",
|
|
287
|
+
warningSoftForeground: "#feb887",
|
|
288
|
+
warningSoftPressed: "rgba(251, 146, 60, 0.2)",
|
|
290
289
|
dangerSoft: "rgba(248, 113, 113, 0.15)",
|
|
291
290
|
dangerSoftForeground: "#fc8f8c",
|
|
292
291
|
dangerSoftPressed: "rgba(248, 113, 113, 0.2)",
|
|
@@ -377,7 +376,7 @@ function resolveMode(mode, config, id) {
|
|
|
377
376
|
};
|
|
378
377
|
}
|
|
379
378
|
function createTheme(config = {}) {
|
|
380
|
-
const id = stableHash(config);
|
|
379
|
+
const id = _chunkMC7SY2QHcjs.stableHash.call(void 0, config);
|
|
381
380
|
return {
|
|
382
381
|
id,
|
|
383
382
|
light: resolveMode("light", config, id),
|
|
@@ -387,6 +386,7 @@ function createTheme(config = {}) {
|
|
|
387
386
|
var defaultTheme = createTheme();
|
|
388
387
|
|
|
389
388
|
// src/provider/xaui-provider.tsx
|
|
389
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
390
390
|
function XAUIProvider({
|
|
391
391
|
children,
|
|
392
392
|
theme = defaultTheme,
|
|
@@ -394,7 +394,7 @@ function XAUIProvider({
|
|
|
394
394
|
}) {
|
|
395
395
|
const scheme = _reactnative.useColorScheme.call(void 0, );
|
|
396
396
|
const resolved = colorMode === "system" ? scheme === "dark" ? "dark" : "light" : colorMode;
|
|
397
|
-
return /* @__PURE__ */
|
|
397
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk57SJ4LJFcjs.ThemeContext.Provider, { value: theme[resolved], children });
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
// src/theme/palette.ts
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CloseButton,
|
|
3
|
+
closeButtonBase
|
|
4
|
+
} from "./chunk-V4WDMM6Z.js";
|
|
5
|
+
import {
|
|
6
|
+
Icon
|
|
7
|
+
} from "./chunk-3FV4COTM.js";
|
|
8
|
+
import {
|
|
9
|
+
createRecipe,
|
|
10
|
+
radiusAxis
|
|
11
|
+
} from "./chunk-4GTAZM2C.js";
|
|
12
|
+
import {
|
|
13
|
+
useXAUITheme
|
|
14
|
+
} from "./chunk-A3EGFI6T.js";
|
|
15
|
+
import {
|
|
16
|
+
Slot,
|
|
17
|
+
childrenToString,
|
|
18
|
+
createSlotContext
|
|
19
|
+
} from "./chunk-E2CWBQTV.js";
|
|
20
|
+
import {
|
|
21
|
+
useStyleProps
|
|
22
|
+
} from "./chunk-URSKA2VR.js";
|
|
23
|
+
|
|
24
|
+
// src/components/alert/alert-close.tsx
|
|
25
|
+
import { forwardRef } from "react";
|
|
26
|
+
|
|
27
|
+
// src/components/alert/alert.context.ts
|
|
28
|
+
var [AlertProvider, useAlert] = createSlotContext("Alert");
|
|
29
|
+
|
|
30
|
+
// src/components/alert/alert-close.tsx
|
|
31
|
+
import { jsx } from "react/jsx-runtime";
|
|
32
|
+
var AlertClose = forwardRef(function AlertClose2({ isDisabled, ...props }, ref) {
|
|
33
|
+
const { closeStyle, closeGlyphStyle, isDisabled: isAlertDisabled } = useAlert();
|
|
34
|
+
return /* @__PURE__ */ jsx(
|
|
35
|
+
CloseButton,
|
|
36
|
+
{
|
|
37
|
+
ref,
|
|
38
|
+
name: "Alert.Close",
|
|
39
|
+
baseStyle: closeStyle,
|
|
40
|
+
glyphStyle: closeGlyphStyle,
|
|
41
|
+
isDisabled: isDisabled ?? isAlertDisabled,
|
|
42
|
+
...props
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
AlertClose.displayName = "XAUI.Alert.Close";
|
|
47
|
+
|
|
48
|
+
// src/components/alert/alert-content.tsx
|
|
49
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
50
|
+
import { View } from "react-native";
|
|
51
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
52
|
+
var AlertContent = forwardRef2(
|
|
53
|
+
function AlertContent2({ children, style, ...props }, ref) {
|
|
54
|
+
const { contentStyle } = useAlert();
|
|
55
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
56
|
+
return /* @__PURE__ */ jsx2(View, { ref, style: [contentStyle, styleProps, style], ...rest, children });
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
AlertContent.displayName = "XAUI.Alert.Content";
|
|
60
|
+
|
|
61
|
+
// src/components/alert/alert-description.tsx
|
|
62
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
63
|
+
import { Text } from "react-native";
|
|
64
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
65
|
+
var AlertDescription = forwardRef3(
|
|
66
|
+
function AlertDescription2({ children, style, ...props }, ref) {
|
|
67
|
+
const { descriptionStyle } = useAlert();
|
|
68
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
69
|
+
return /* @__PURE__ */ jsx3(Text, { ref, style: [descriptionStyle, styleProps, style], ...rest, children });
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
AlertDescription.displayName = "XAUI.Alert.Description";
|
|
73
|
+
|
|
74
|
+
// src/components/alert/alert-icon.tsx
|
|
75
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
76
|
+
import { View as View2 } from "react-native";
|
|
77
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
78
|
+
var AlertIcon = forwardRef4(function AlertIcon2({ as, children, source, size, color, style, ...props }, ref) {
|
|
79
|
+
const { iconStyle, icon } = useAlert();
|
|
80
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
81
|
+
const glyphSize = size ?? icon.size;
|
|
82
|
+
const glyphColor = color ?? icon.color;
|
|
83
|
+
return /* @__PURE__ */ jsx4(View2, { ref, style: [iconStyle, styleProps, style], ...rest, children: as ? /* @__PURE__ */ jsx4(Icon, { as, size: glyphSize, color: glyphColor }) : source ? /* @__PURE__ */ jsx4(Icon, { source, size: glyphSize, color: glyphColor }) : /* @__PURE__ */ jsx4(Icon, { size: glyphSize, color: glyphColor, children }) });
|
|
84
|
+
});
|
|
85
|
+
AlertIcon.displayName = "XAUI.Alert.Icon";
|
|
86
|
+
|
|
87
|
+
// src/components/alert/alert-title.tsx
|
|
88
|
+
import { forwardRef as forwardRef5 } from "react";
|
|
89
|
+
import { Text as Text2 } from "react-native";
|
|
90
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
91
|
+
var AlertTitle = forwardRef5(function AlertTitle2({ children, style, ...props }, ref) {
|
|
92
|
+
const { titleStyle } = useAlert();
|
|
93
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
94
|
+
return /* @__PURE__ */ jsx5(Text2, { ref, style: [titleStyle, styleProps, style], ...rest, children });
|
|
95
|
+
});
|
|
96
|
+
AlertTitle.displayName = "XAUI.Alert.Title";
|
|
97
|
+
|
|
98
|
+
// src/components/alert/alert.tsx
|
|
99
|
+
import { forwardRef as forwardRef6, useMemo } from "react";
|
|
100
|
+
import { StyleSheet, View as View3 } from "react-native";
|
|
101
|
+
|
|
102
|
+
// src/components/alert/alert.recipe.ts
|
|
103
|
+
var SLOTS = [
|
|
104
|
+
"root",
|
|
105
|
+
"icon",
|
|
106
|
+
"iconGlyph",
|
|
107
|
+
"content",
|
|
108
|
+
"title",
|
|
109
|
+
"description",
|
|
110
|
+
"close",
|
|
111
|
+
"closeGlyph"
|
|
112
|
+
];
|
|
113
|
+
var VARIANT_TOKENS = {
|
|
114
|
+
default: { bg: "surface", fg: "surfaceForeground" },
|
|
115
|
+
primary: { bg: "accent", fg: "accentForeground" },
|
|
116
|
+
secondary: { bg: "accentSoft", fg: "accentSoftForeground" },
|
|
117
|
+
success: { bg: "success", fg: "successForeground" },
|
|
118
|
+
"success-soft": { bg: "successSoft", fg: "successSoftForeground" },
|
|
119
|
+
warning: { bg: "warning", fg: "warningForeground" },
|
|
120
|
+
"warning-soft": { bg: "warningSoft", fg: "warningSoftForeground" },
|
|
121
|
+
danger: { bg: "danger", fg: "dangerForeground" },
|
|
122
|
+
"danger-soft": { bg: "dangerSoft", fg: "dangerSoftForeground" }
|
|
123
|
+
};
|
|
124
|
+
var DESCRIPTION_OPACITY = 0.6;
|
|
125
|
+
function sizeAxis(step) {
|
|
126
|
+
const { padding, gap, contentGap, title, description, glyph, cross, radius } = step;
|
|
127
|
+
return (theme) => ({
|
|
128
|
+
root: {
|
|
129
|
+
padding: theme.spacing(padding),
|
|
130
|
+
gap: theme.spacing(gap),
|
|
131
|
+
borderRadius: theme.radius[radius]
|
|
132
|
+
},
|
|
133
|
+
icon: { paddingTop: (theme.lineHeights[title] - theme.fontSizes[glyph]) / 2 },
|
|
134
|
+
iconGlyph: { fontSize: theme.fontSizes[glyph] },
|
|
135
|
+
content: { gap: theme.spacing(contentGap) },
|
|
136
|
+
title: {
|
|
137
|
+
fontSize: theme.fontSizes[title],
|
|
138
|
+
lineHeight: theme.lineHeights[title]
|
|
139
|
+
},
|
|
140
|
+
description: {
|
|
141
|
+
fontSize: theme.fontSizes[description],
|
|
142
|
+
lineHeight: theme.lineHeights[description]
|
|
143
|
+
},
|
|
144
|
+
// The touch target is the glyph's box; the shared `CloseButton` grows it outwards
|
|
145
|
+
// with `hitSlop`, because a cross big enough to hit is a cross too big to look right.
|
|
146
|
+
close: { width: theme.fontSizes[glyph], height: theme.fontSizes[glyph] },
|
|
147
|
+
closeGlyph: { width: theme.spacing(cross) }
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
var SIZES = {
|
|
151
|
+
xs: {
|
|
152
|
+
padding: 2,
|
|
153
|
+
gap: 2,
|
|
154
|
+
contentGap: 0.5,
|
|
155
|
+
title: "xs",
|
|
156
|
+
description: "xs",
|
|
157
|
+
glyph: "sm",
|
|
158
|
+
cross: 2,
|
|
159
|
+
radius: "lg"
|
|
160
|
+
},
|
|
161
|
+
sm: {
|
|
162
|
+
padding: 2.5,
|
|
163
|
+
gap: 2.5,
|
|
164
|
+
contentGap: 0.5,
|
|
165
|
+
title: "sm",
|
|
166
|
+
description: "xs",
|
|
167
|
+
glyph: "md",
|
|
168
|
+
cross: 2,
|
|
169
|
+
radius: "xl"
|
|
170
|
+
},
|
|
171
|
+
md: {
|
|
172
|
+
padding: 3,
|
|
173
|
+
gap: 3,
|
|
174
|
+
contentGap: 1,
|
|
175
|
+
title: "md",
|
|
176
|
+
description: "sm",
|
|
177
|
+
glyph: "lg",
|
|
178
|
+
cross: 2.5,
|
|
179
|
+
radius: "2xl"
|
|
180
|
+
},
|
|
181
|
+
lg: {
|
|
182
|
+
padding: 4,
|
|
183
|
+
gap: 3.5,
|
|
184
|
+
contentGap: 1,
|
|
185
|
+
title: "lg",
|
|
186
|
+
description: "md",
|
|
187
|
+
glyph: "xl",
|
|
188
|
+
cross: 3,
|
|
189
|
+
radius: "3xl"
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
var alertRecipe = createRecipe({
|
|
193
|
+
slots: SLOTS,
|
|
194
|
+
// The cross's own geometry — thickness and centring — belongs to the shared
|
|
195
|
+
// `CloseButton`; what stays below is the box and bar size this component's scale sets.
|
|
196
|
+
base: (theme) => ({
|
|
197
|
+
...closeButtonBase(theme),
|
|
198
|
+
root: {
|
|
199
|
+
flexDirection: "row",
|
|
200
|
+
// Top-aligned, not centred: an alert's message can run to three lines, and an icon
|
|
201
|
+
// floating beside the middle of a paragraph reads as decoration rather than as the
|
|
202
|
+
// mark of what the paragraph is. A single-line alert centres itself with
|
|
203
|
+
// `alignItems="center"` on the root — one prop, and it is the caller's call.
|
|
204
|
+
alignItems: "flex-start",
|
|
205
|
+
borderWidth: 0,
|
|
206
|
+
// iOS's squircle. Free on Android, and it is what makes a radius this large read as
|
|
207
|
+
// a shape rather than as four arcs meeting straight edges.
|
|
208
|
+
borderCurve: "continuous"
|
|
209
|
+
// Deliberately no `overflow: 'hidden'`: on iOS it clips the node's own shadow, so a
|
|
210
|
+
// `default` alert would lose the elevation the variant just gave it.
|
|
211
|
+
},
|
|
212
|
+
// `flex: 1` and not `flexGrow`: the root is a row, so the content has to be measured
|
|
213
|
+
// from a zero basis to take exactly what the icon and the close leave — the opposite
|
|
214
|
+
// of the `Card`'s body, which grows in a column where a zero basis collapses it.
|
|
215
|
+
content: { flex: 1 },
|
|
216
|
+
// `medium`, not `semibold`. An alert's title sits in prose rather than on a control:
|
|
217
|
+
// one weight above the description is enough to rank them.
|
|
218
|
+
title: {
|
|
219
|
+
fontFamily: theme.fontFamilies.heading,
|
|
220
|
+
fontWeight: theme.fontWeights.medium
|
|
221
|
+
},
|
|
222
|
+
description: {
|
|
223
|
+
fontFamily: theme.fontFamilies.body,
|
|
224
|
+
fontWeight: theme.fontWeights.regular,
|
|
225
|
+
opacity: DESCRIPTION_OPACITY
|
|
226
|
+
}
|
|
227
|
+
}),
|
|
228
|
+
variantTokens: VARIANT_TOKENS,
|
|
229
|
+
/**
|
|
230
|
+
* Where the variant's colours land, for every variant at once.
|
|
231
|
+
*
|
|
232
|
+
* The icon takes the **title's** colour rather than a status colour of its own — on a
|
|
233
|
+
* `danger` alert the readable colour is the one the title already uses, and on a
|
|
234
|
+
* `danger-soft` one that token *is* the red. HeroUI arrives at the same place from the
|
|
235
|
+
* other direction, colouring the icon by status on a neutral surface; here the variant
|
|
236
|
+
* decides both, and an icon that has to disagree with its alert says so itself with
|
|
237
|
+
* `<Alert.Icon color={…} />`.
|
|
238
|
+
*/
|
|
239
|
+
paint: (theme, colors) => ({
|
|
240
|
+
root: {
|
|
241
|
+
backgroundColor: colors.bg,
|
|
242
|
+
borderColor: colors.border,
|
|
243
|
+
borderWidth: colors.border ? theme.borderWidth.default : 0
|
|
244
|
+
},
|
|
245
|
+
iconGlyph: { color: colors.fg },
|
|
246
|
+
title: { color: colors.fg },
|
|
247
|
+
description: { color: colors.fg },
|
|
248
|
+
closeGlyph: { backgroundColor: colors.fg }
|
|
249
|
+
}),
|
|
250
|
+
/** Declaration order is application order: `radius` overrides the radius `size` set. */
|
|
251
|
+
variants: {
|
|
252
|
+
size: {
|
|
253
|
+
xs: sizeAxis(SIZES.xs),
|
|
254
|
+
sm: sizeAxis(SIZES.sm),
|
|
255
|
+
md: sizeAxis(SIZES.md),
|
|
256
|
+
lg: sizeAxis(SIZES.lg)
|
|
257
|
+
},
|
|
258
|
+
radius: radiusAxis("root")
|
|
259
|
+
},
|
|
260
|
+
/**
|
|
261
|
+
* The elevation belongs to the one variant that is a surface standing on the background,
|
|
262
|
+
* exactly as on the `Card`. A tinted alert already separates itself by its fill, and a
|
|
263
|
+
* shadow under it would read as dirt. In dark mode the theme's `surface` shadow is
|
|
264
|
+
* already nothing (§4), which is why this names the role instead of a set of numbers.
|
|
265
|
+
*/
|
|
266
|
+
compoundVariants: [
|
|
267
|
+
{
|
|
268
|
+
when: { variant: "default" },
|
|
269
|
+
style: (theme) => ({ root: theme.shadows.surface })
|
|
270
|
+
}
|
|
271
|
+
],
|
|
272
|
+
states: {
|
|
273
|
+
disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
|
|
274
|
+
},
|
|
275
|
+
defaultVariants: { variant: "default", size: "md" }
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
// src/components/alert/alert.tsx
|
|
279
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
280
|
+
var AlertRoot = forwardRef6(function Alert({
|
|
281
|
+
children,
|
|
282
|
+
variant,
|
|
283
|
+
size,
|
|
284
|
+
radius,
|
|
285
|
+
color,
|
|
286
|
+
isDisabled = false,
|
|
287
|
+
asChild = false,
|
|
288
|
+
accessibilityRole = "alert",
|
|
289
|
+
// Android reads a live region aloud when its content changes, which is what makes an
|
|
290
|
+
// alert that *appears* announce itself instead of waiting to be found. `'polite'`
|
|
291
|
+
// rather than `'assertive'`: it queues behind whatever is being read instead of
|
|
292
|
+
// cutting it off. A static alert that is part of the page sets `'none'`.
|
|
293
|
+
accessibilityLiveRegion = "polite",
|
|
294
|
+
style,
|
|
295
|
+
...props
|
|
296
|
+
}, ref) {
|
|
297
|
+
const theme = useXAUITheme();
|
|
298
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
299
|
+
const selection = { variant, size, radius };
|
|
300
|
+
const states = { disabled: isDisabled };
|
|
301
|
+
const styles = alertRecipe.resolve({ theme, selection, states });
|
|
302
|
+
const tint = color ? alertRecipe.tint({ theme, color, selection, states }) : void 0;
|
|
303
|
+
const context = useMemo(() => {
|
|
304
|
+
const glyph = StyleSheet.flatten([styles.iconGlyph, tint?.iconGlyph]);
|
|
305
|
+
return {
|
|
306
|
+
iconStyle: styles.icon,
|
|
307
|
+
contentStyle: styles.content,
|
|
308
|
+
titleStyle: tint ? [styles.title, tint.title] : styles.title,
|
|
309
|
+
descriptionStyle: tint ? [styles.description, tint.description] : styles.description,
|
|
310
|
+
closeStyle: styles.close,
|
|
311
|
+
closeGlyphStyle: tint ? [styles.closeGlyph, tint.closeGlyph] : styles.closeGlyph,
|
|
312
|
+
icon: {
|
|
313
|
+
size: glyph.fontSize,
|
|
314
|
+
// `ColorValue` also covers the platform's opaque colours, which `Icon` cannot
|
|
315
|
+
// hand to a third-party component expecting a string.
|
|
316
|
+
color: typeof glyph.color === "string" ? glyph.color : void 0
|
|
317
|
+
},
|
|
318
|
+
isDisabled
|
|
319
|
+
};
|
|
320
|
+
}, [styles, tint, isDisabled]);
|
|
321
|
+
const rootStyle = [styles.root, tint?.root, styleProps, style];
|
|
322
|
+
const text = childrenToString(children);
|
|
323
|
+
const content = text !== null ? /* @__PURE__ */ jsx6(AlertDescription, { children: text }) : children;
|
|
324
|
+
const surface = asChild ? (
|
|
325
|
+
// R12 — the caller's element *is* the alert, so it takes the children it was written
|
|
326
|
+
// with and the auto-wrap does not apply.
|
|
327
|
+
/* @__PURE__ */ jsx6(
|
|
328
|
+
Slot,
|
|
329
|
+
{
|
|
330
|
+
ref,
|
|
331
|
+
accessibilityRole,
|
|
332
|
+
accessibilityLiveRegion,
|
|
333
|
+
...rest,
|
|
334
|
+
style: rootStyle,
|
|
335
|
+
children
|
|
336
|
+
}
|
|
337
|
+
)
|
|
338
|
+
) : /* @__PURE__ */ jsx6(
|
|
339
|
+
View3,
|
|
340
|
+
{
|
|
341
|
+
ref,
|
|
342
|
+
accessibilityRole,
|
|
343
|
+
accessibilityLiveRegion,
|
|
344
|
+
...rest,
|
|
345
|
+
style: rootStyle,
|
|
346
|
+
children: content
|
|
347
|
+
}
|
|
348
|
+
);
|
|
349
|
+
return /* @__PURE__ */ jsx6(AlertProvider, { value: context, children: surface });
|
|
350
|
+
});
|
|
351
|
+
AlertRoot.displayName = "XAUI.Alert.Root";
|
|
352
|
+
|
|
353
|
+
// src/components/alert/index.ts
|
|
354
|
+
var Alert2 = Object.assign(AlertRoot, {
|
|
355
|
+
Icon: AlertIcon,
|
|
356
|
+
Content: AlertContent,
|
|
357
|
+
Title: AlertTitle,
|
|
358
|
+
Description: AlertDescription,
|
|
359
|
+
Close: AlertClose
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
export {
|
|
363
|
+
useAlert,
|
|
364
|
+
alertRecipe,
|
|
365
|
+
Alert2 as Alert
|
|
366
|
+
};
|