@xaui/native 0.9.1-alpha.21 → 0.9.1-alpha.23
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-RMLFMRWL.js → chunk-2U6JR7BF.js} +5 -5
- package/dist/{chunk-N7C4UNUL.js → chunk-3JATAB7S.js} +23 -1
- package/dist/chunk-4MHJOWM4.cjs +364 -0
- package/dist/{chunk-2WMVDMFV.cjs → chunk-6HXWQ5AU.cjs} +2 -2
- package/dist/chunk-6WW4CSPY.cjs +82 -0
- package/dist/chunk-AHL33YAO.js +425 -0
- package/dist/{chunk-XHZBXYVU.js → chunk-AKXG43S4.js} +1 -1
- package/dist/{chunk-4NE3SLTM.cjs → chunk-BH5DSJVX.cjs} +102 -73
- package/dist/{chunk-BPBY7ON7.cjs → chunk-BNWS26PX.cjs} +19 -21
- package/dist/{chunk-5LC6KVL3.cjs → chunk-DXGQ43IV.cjs} +3 -3
- package/dist/chunk-E3LXUXE7.js +451 -0
- package/dist/{chunk-ISVUXVFL.js → chunk-FNQF4KQV.js} +19 -71
- package/dist/{chunk-YRCUALUQ.js → chunk-FTCTTBLG.js} +7 -9
- package/dist/{chunk-JL27KVRT.js → chunk-FVP5FUVS.js} +3 -3
- package/dist/{chunk-UL263KGM.cjs → chunk-GBPWTFTU.cjs} +10 -10
- package/dist/{chunk-TUJBDS5M.js → chunk-GG2WWCBK.js} +10 -10
- package/dist/{chunk-EVXZGNPA.cjs → chunk-HUZ4AUM2.cjs} +98 -98
- package/dist/chunk-I6PE5UUH.cjs +425 -0
- package/dist/{chunk-33QILJJH.cjs → chunk-IBEX4XGV.cjs} +11 -11
- package/dist/{chunk-IBRVMLUF.js → chunk-KM2TI5IC.js} +107 -80
- package/dist/chunk-OGC4RKE3.js +364 -0
- package/dist/{chunk-JXLRHKCQ.js → chunk-OYZYWWJ6.js} +1 -1
- package/dist/{chunk-EXX6ATAS.js → chunk-PMO62QK4.js} +101 -101
- package/dist/{chunk-UBA6AEY6.cjs → chunk-RAWOJ3N3.cjs} +8 -8
- package/dist/chunk-TIP3T7JJ.cjs +451 -0
- package/dist/{chunk-APCBIHLR.cjs → chunk-VDRRD6GM.cjs} +29 -81
- package/dist/{chunk-UVO4GFSW.cjs → chunk-YXVKQMCK.cjs} +23 -1
- package/dist/chunk-ZQ3JSWRO.js +82 -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 +17 -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 +17 -0
- package/dist/components/button/index.cjs +6 -7
- package/dist/components/button/index.d.cts +74 -125
- package/dist/components/button/index.d.ts +74 -125
- package/dist/components/button/index.js +5 -6
- package/dist/components/card/index.cjs +5 -6
- package/dist/components/card/index.d.cts +74 -74
- package/dist/components/card/index.d.ts +74 -74
- package/dist/components/card/index.js +4 -5
- package/dist/components/chip/index.cjs +17 -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 +17 -0
- package/dist/components/input/index.cjs +14 -0
- package/dist/components/input/index.d.cts +213 -0
- package/dist/components/input/index.d.ts +213 -0
- package/dist/components/input/index.js +14 -0
- package/dist/components/typography/index.cjs +4 -4
- package/dist/components/typography/index.d.cts +4 -4
- package/dist/components/typography/index.d.ts +4 -4
- package/dist/components/typography/index.js +3 -3
- package/dist/components/view/index.cjs +3 -3
- package/dist/components/view/index.d.cts +7 -7
- package/dist/components/view/index.d.ts +7 -7
- package/dist/components/view/index.js +2 -2
- package/dist/{create-recipe-CC3NNCqF.d.ts → create-recipe-C4JkINrA.d.ts} +18 -5
- package/dist/{create-recipe-CPBFg7ym.d.cts → create-recipe-dBN_ewZc.d.cts} +18 -5
- package/dist/{icon.type-Cs1tMX0W.d.cts → icon.type-CF4KiMKl.d.cts} +1 -1
- package/dist/{icon.type-BkcEPJbK.d.ts → icon.type-Dq4_qePa.d.ts} +1 -1
- package/dist/index.cjs +44 -14
- package/dist/index.d.cts +9 -5
- package/dist/index.d.ts +9 -5
- package/dist/index.js +74 -44
- package/dist/{pressable-feedback.type-wfeiJz5m.d.cts → pressable-feedback.type-BA2C9sSz.d.cts} +1 -1
- package/dist/{pressable-feedback.type-DsvWZXWC.d.ts → pressable-feedback.type-Bs4dQlGj.d.ts} +1 -1
- package/dist/{style-props.type-B1BG5TCm.d.cts → style-props.type-CfnoGEP7.d.cts} +1 -1
- package/dist/{style-props.type-B1BG5TCm.d.ts → style-props.type-CfnoGEP7.d.ts} +1 -1
- package/dist/system/index.cjs +15 -7
- package/dist/system/index.d.cts +175 -101
- package/dist/system/index.d.ts +175 -101
- package/dist/system/index.js +15 -7
- package/dist/theme/index.cjs +2 -2
- package/dist/theme/index.d.cts +10 -10
- package/dist/theme/index.d.ts +10 -10
- package/dist/theme/index.js +1 -1
- package/package.json +31 -1
- package/dist/chunk-RRRGLRRP.cjs +0 -28
- package/dist/chunk-SGHP76GU.js +0 -28
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRecipe
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
Slot,
|
|
6
|
-
useStyleProps
|
|
7
|
-
} from "./chunk-EXX6ATAS.js";
|
|
3
|
+
} from "./chunk-3JATAB7S.js";
|
|
8
4
|
import {
|
|
9
5
|
useXAUITheme
|
|
10
6
|
} from "./chunk-A3EGFI6T.js";
|
|
7
|
+
import {
|
|
8
|
+
Slot,
|
|
9
|
+
useStyleProps
|
|
10
|
+
} from "./chunk-PMO62QK4.js";
|
|
11
11
|
|
|
12
12
|
// src/components/typography/typography.tsx
|
|
13
13
|
import { forwardRef } from "react";
|
|
@@ -145,6 +145,28 @@ function apply(fns, theme, colors) {
|
|
|
145
145
|
return merged;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
// src/system/recipe/radius-axis.ts
|
|
149
|
+
function radiusAxis(slot) {
|
|
150
|
+
const axis = {};
|
|
151
|
+
for (const key of RADIUS_KEYS) {
|
|
152
|
+
axis[key] = (theme) => ({ [slot]: { borderRadius: theme.radius[key] } });
|
|
153
|
+
}
|
|
154
|
+
return axis;
|
|
155
|
+
}
|
|
156
|
+
var RADIUS_KEYS = [
|
|
157
|
+
"xs",
|
|
158
|
+
"sm",
|
|
159
|
+
"md",
|
|
160
|
+
"lg",
|
|
161
|
+
"xl",
|
|
162
|
+
"2xl",
|
|
163
|
+
"3xl",
|
|
164
|
+
"4xl",
|
|
165
|
+
"field",
|
|
166
|
+
"full"
|
|
167
|
+
];
|
|
168
|
+
|
|
148
169
|
export {
|
|
149
|
-
createRecipe
|
|
170
|
+
createRecipe,
|
|
171
|
+
radiusAxis
|
|
150
172
|
};
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunk6WW4CSPYcjs = require('./chunk-6WW4CSPY.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkDXGQ43IVcjs = require('./chunk-DXGQ43IV.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkYXVKQMCKcjs = require('./chunk-YXVKQMCK.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
var _chunkHUZ4AUM2cjs = require('./chunk-HUZ4AUM2.cjs');
|
|
21
|
+
|
|
22
|
+
// src/components/alert/alert-close.tsx
|
|
23
|
+
var _react = require('react');
|
|
24
|
+
|
|
25
|
+
// src/components/alert/alert.context.ts
|
|
26
|
+
var [AlertProvider, useAlert] = _chunkHUZ4AUM2cjs.createSlotContext.call(void 0, "Alert");
|
|
27
|
+
|
|
28
|
+
// src/components/alert/alert-close.tsx
|
|
29
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
30
|
+
var AlertClose = _react.forwardRef.call(void 0, function AlertClose2({ isDisabled, ...props }, ref) {
|
|
31
|
+
const { closeStyle, closeGlyphStyle, isDisabled: isAlertDisabled } = useAlert();
|
|
32
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
33
|
+
_chunk6WW4CSPYcjs.CloseButton,
|
|
34
|
+
{
|
|
35
|
+
ref,
|
|
36
|
+
name: "Alert.Close",
|
|
37
|
+
baseStyle: closeStyle,
|
|
38
|
+
glyphStyle: closeGlyphStyle,
|
|
39
|
+
isDisabled: _nullishCoalesce(isDisabled, () => ( isAlertDisabled)),
|
|
40
|
+
...props
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
AlertClose.displayName = "XAUI.Alert.Close";
|
|
45
|
+
|
|
46
|
+
// src/components/alert/alert-content.tsx
|
|
47
|
+
|
|
48
|
+
var _reactnative = require('react-native');
|
|
49
|
+
|
|
50
|
+
var AlertContent = _react.forwardRef.call(void 0,
|
|
51
|
+
function AlertContent2({ children, style, ...props }, ref) {
|
|
52
|
+
const { contentStyle } = useAlert();
|
|
53
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
54
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, style: [contentStyle, styleProps, style], ...rest, children });
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
AlertContent.displayName = "XAUI.Alert.Content";
|
|
58
|
+
|
|
59
|
+
// src/components/alert/alert-description.tsx
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
var AlertDescription = _react.forwardRef.call(void 0,
|
|
64
|
+
function AlertDescription2({ children, style, ...props }, ref) {
|
|
65
|
+
const { descriptionStyle } = useAlert();
|
|
66
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
67
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { ref, style: [descriptionStyle, styleProps, style], ...rest, children });
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
AlertDescription.displayName = "XAUI.Alert.Description";
|
|
71
|
+
|
|
72
|
+
// src/components/alert/alert-icon.tsx
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
var AlertIcon = _react.forwardRef.call(void 0, function AlertIcon2({ as, children, source, size, color, style, ...props }, ref) {
|
|
77
|
+
const { iconStyle, icon } = useAlert();
|
|
78
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
79
|
+
const glyphSize = _nullishCoalesce(size, () => ( icon.size));
|
|
80
|
+
const glyphColor = _nullishCoalesce(color, () => ( icon.color));
|
|
81
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, style: [iconStyle, styleProps, style], ...rest, children: as ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDXGQ43IVcjs.Icon, { as, size: glyphSize, color: glyphColor }) : source ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDXGQ43IVcjs.Icon, { source, size: glyphSize, color: glyphColor }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDXGQ43IVcjs.Icon, { size: glyphSize, color: glyphColor, children }) });
|
|
82
|
+
});
|
|
83
|
+
AlertIcon.displayName = "XAUI.Alert.Icon";
|
|
84
|
+
|
|
85
|
+
// src/components/alert/alert-title.tsx
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
var AlertTitle = _react.forwardRef.call(void 0, function AlertTitle2({ children, style, ...props }, ref) {
|
|
90
|
+
const { titleStyle } = useAlert();
|
|
91
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
92
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { ref, style: [titleStyle, styleProps, style], ...rest, children });
|
|
93
|
+
});
|
|
94
|
+
AlertTitle.displayName = "XAUI.Alert.Title";
|
|
95
|
+
|
|
96
|
+
// src/components/alert/alert.tsx
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
// src/components/alert/alert.recipe.ts
|
|
101
|
+
var SLOTS = [
|
|
102
|
+
"root",
|
|
103
|
+
"icon",
|
|
104
|
+
"iconGlyph",
|
|
105
|
+
"content",
|
|
106
|
+
"title",
|
|
107
|
+
"description",
|
|
108
|
+
"close",
|
|
109
|
+
"closeGlyph"
|
|
110
|
+
];
|
|
111
|
+
var VARIANT_TOKENS = {
|
|
112
|
+
default: { bg: "surface", fg: "surfaceForeground" },
|
|
113
|
+
primary: { bg: "accent", fg: "accentForeground" },
|
|
114
|
+
secondary: { bg: "accentSoft", fg: "accentSoftForeground" },
|
|
115
|
+
success: { bg: "success", fg: "successForeground" },
|
|
116
|
+
"success-soft": { bg: "successSoft", fg: "successSoftForeground" },
|
|
117
|
+
warning: { bg: "warning", fg: "warningForeground" },
|
|
118
|
+
"warning-soft": { bg: "warningSoft", fg: "warningSoftForeground" },
|
|
119
|
+
danger: { bg: "danger", fg: "dangerForeground" },
|
|
120
|
+
"danger-soft": { bg: "dangerSoft", fg: "dangerSoftForeground" }
|
|
121
|
+
};
|
|
122
|
+
var DESCRIPTION_OPACITY = 0.6;
|
|
123
|
+
function sizeAxis(step) {
|
|
124
|
+
const { padding, gap, contentGap, title, description, glyph, cross, radius } = step;
|
|
125
|
+
return (theme) => ({
|
|
126
|
+
root: {
|
|
127
|
+
padding: theme.spacing(padding),
|
|
128
|
+
gap: theme.spacing(gap),
|
|
129
|
+
borderRadius: theme.radius[radius]
|
|
130
|
+
},
|
|
131
|
+
icon: { paddingTop: (theme.lineHeights[title] - theme.fontSizes[glyph]) / 2 },
|
|
132
|
+
iconGlyph: { fontSize: theme.fontSizes[glyph] },
|
|
133
|
+
content: { gap: theme.spacing(contentGap) },
|
|
134
|
+
title: {
|
|
135
|
+
fontSize: theme.fontSizes[title],
|
|
136
|
+
lineHeight: theme.lineHeights[title]
|
|
137
|
+
},
|
|
138
|
+
description: {
|
|
139
|
+
fontSize: theme.fontSizes[description],
|
|
140
|
+
lineHeight: theme.lineHeights[description]
|
|
141
|
+
},
|
|
142
|
+
// The touch target is the glyph's box; the shared `CloseButton` grows it outwards
|
|
143
|
+
// with `hitSlop`, because a cross big enough to hit is a cross too big to look right.
|
|
144
|
+
close: { width: theme.fontSizes[glyph], height: theme.fontSizes[glyph] },
|
|
145
|
+
closeGlyph: { width: theme.spacing(cross) }
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
var SIZES = {
|
|
149
|
+
xs: {
|
|
150
|
+
padding: 2,
|
|
151
|
+
gap: 2,
|
|
152
|
+
contentGap: 0.5,
|
|
153
|
+
title: "xs",
|
|
154
|
+
description: "xs",
|
|
155
|
+
glyph: "sm",
|
|
156
|
+
cross: 2,
|
|
157
|
+
radius: "lg"
|
|
158
|
+
},
|
|
159
|
+
sm: {
|
|
160
|
+
padding: 2.5,
|
|
161
|
+
gap: 2.5,
|
|
162
|
+
contentGap: 0.5,
|
|
163
|
+
title: "sm",
|
|
164
|
+
description: "xs",
|
|
165
|
+
glyph: "md",
|
|
166
|
+
cross: 2,
|
|
167
|
+
radius: "xl"
|
|
168
|
+
},
|
|
169
|
+
md: {
|
|
170
|
+
padding: 3,
|
|
171
|
+
gap: 3,
|
|
172
|
+
contentGap: 1,
|
|
173
|
+
title: "md",
|
|
174
|
+
description: "sm",
|
|
175
|
+
glyph: "lg",
|
|
176
|
+
cross: 2.5,
|
|
177
|
+
radius: "2xl"
|
|
178
|
+
},
|
|
179
|
+
lg: {
|
|
180
|
+
padding: 4,
|
|
181
|
+
gap: 3.5,
|
|
182
|
+
contentGap: 1,
|
|
183
|
+
title: "lg",
|
|
184
|
+
description: "md",
|
|
185
|
+
glyph: "xl",
|
|
186
|
+
cross: 3,
|
|
187
|
+
radius: "3xl"
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
var alertRecipe = _chunkYXVKQMCKcjs.createRecipe.call(void 0, {
|
|
191
|
+
slots: SLOTS,
|
|
192
|
+
// The cross's own geometry — thickness and centring — belongs to the shared
|
|
193
|
+
// `CloseButton`; what stays below is the box and bar size this component's scale sets.
|
|
194
|
+
base: (theme) => ({
|
|
195
|
+
..._chunk6WW4CSPYcjs.closeButtonBase.call(void 0, theme),
|
|
196
|
+
root: {
|
|
197
|
+
flexDirection: "row",
|
|
198
|
+
// Top-aligned, not centred: an alert's message can run to three lines, and an icon
|
|
199
|
+
// floating beside the middle of a paragraph reads as decoration rather than as the
|
|
200
|
+
// mark of what the paragraph is. A single-line alert centres itself with
|
|
201
|
+
// `alignItems="center"` on the root — one prop, and it is the caller's call.
|
|
202
|
+
alignItems: "flex-start",
|
|
203
|
+
borderWidth: 0,
|
|
204
|
+
// iOS's squircle. Free on Android, and it is what makes a radius this large read as
|
|
205
|
+
// a shape rather than as four arcs meeting straight edges.
|
|
206
|
+
borderCurve: "continuous"
|
|
207
|
+
// Deliberately no `overflow: 'hidden'`: on iOS it clips the node's own shadow, so a
|
|
208
|
+
// `default` alert would lose the elevation the variant just gave it.
|
|
209
|
+
},
|
|
210
|
+
// `flex: 1` and not `flexGrow`: the root is a row, so the content has to be measured
|
|
211
|
+
// from a zero basis to take exactly what the icon and the close leave — the opposite
|
|
212
|
+
// of the `Card`'s body, which grows in a column where a zero basis collapses it.
|
|
213
|
+
content: { flex: 1 },
|
|
214
|
+
// `medium`, not `semibold`. An alert's title sits in prose rather than on a control:
|
|
215
|
+
// one weight above the description is enough to rank them.
|
|
216
|
+
title: {
|
|
217
|
+
fontFamily: theme.fontFamilies.heading,
|
|
218
|
+
fontWeight: theme.fontWeights.medium
|
|
219
|
+
},
|
|
220
|
+
description: {
|
|
221
|
+
fontFamily: theme.fontFamilies.body,
|
|
222
|
+
fontWeight: theme.fontWeights.regular,
|
|
223
|
+
opacity: DESCRIPTION_OPACITY
|
|
224
|
+
}
|
|
225
|
+
}),
|
|
226
|
+
variantTokens: VARIANT_TOKENS,
|
|
227
|
+
/**
|
|
228
|
+
* Where the variant's colours land, for every variant at once.
|
|
229
|
+
*
|
|
230
|
+
* The icon takes the **title's** colour rather than a status colour of its own — on a
|
|
231
|
+
* `danger` alert the readable colour is the one the title already uses, and on a
|
|
232
|
+
* `danger-soft` one that token *is* the red. HeroUI arrives at the same place from the
|
|
233
|
+
* other direction, colouring the icon by status on a neutral surface; here the variant
|
|
234
|
+
* decides both, and an icon that has to disagree with its alert says so itself with
|
|
235
|
+
* `<Alert.Icon color={…} />`.
|
|
236
|
+
*/
|
|
237
|
+
paint: (theme, colors) => ({
|
|
238
|
+
root: {
|
|
239
|
+
backgroundColor: colors.bg,
|
|
240
|
+
borderColor: colors.border,
|
|
241
|
+
borderWidth: colors.border ? theme.borderWidth.default : 0
|
|
242
|
+
},
|
|
243
|
+
iconGlyph: { color: colors.fg },
|
|
244
|
+
title: { color: colors.fg },
|
|
245
|
+
description: { color: colors.fg },
|
|
246
|
+
closeGlyph: { backgroundColor: colors.fg }
|
|
247
|
+
}),
|
|
248
|
+
/** Declaration order is application order: `radius` overrides the radius `size` set. */
|
|
249
|
+
variants: {
|
|
250
|
+
size: {
|
|
251
|
+
xs: sizeAxis(SIZES.xs),
|
|
252
|
+
sm: sizeAxis(SIZES.sm),
|
|
253
|
+
md: sizeAxis(SIZES.md),
|
|
254
|
+
lg: sizeAxis(SIZES.lg)
|
|
255
|
+
},
|
|
256
|
+
radius: _chunkYXVKQMCKcjs.radiusAxis.call(void 0, "root")
|
|
257
|
+
},
|
|
258
|
+
/**
|
|
259
|
+
* The elevation belongs to the one variant that is a surface standing on the background,
|
|
260
|
+
* exactly as on the `Card`. A tinted alert already separates itself by its fill, and a
|
|
261
|
+
* shadow under it would read as dirt. In dark mode the theme's `surface` shadow is
|
|
262
|
+
* already nothing (§4), which is why this names the role instead of a set of numbers.
|
|
263
|
+
*/
|
|
264
|
+
compoundVariants: [
|
|
265
|
+
{
|
|
266
|
+
when: { variant: "default" },
|
|
267
|
+
style: (theme) => ({ root: theme.shadows.surface })
|
|
268
|
+
}
|
|
269
|
+
],
|
|
270
|
+
states: {
|
|
271
|
+
disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
|
|
272
|
+
},
|
|
273
|
+
defaultVariants: { variant: "default", size: "md" }
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
// src/components/alert/alert.tsx
|
|
277
|
+
|
|
278
|
+
var AlertRoot = _react.forwardRef.call(void 0, function Alert({
|
|
279
|
+
children,
|
|
280
|
+
variant,
|
|
281
|
+
size,
|
|
282
|
+
radius,
|
|
283
|
+
color,
|
|
284
|
+
isDisabled = false,
|
|
285
|
+
asChild = false,
|
|
286
|
+
accessibilityRole = "alert",
|
|
287
|
+
// Android reads a live region aloud when its content changes, which is what makes an
|
|
288
|
+
// alert that *appears* announce itself instead of waiting to be found. `'polite'`
|
|
289
|
+
// rather than `'assertive'`: it queues behind whatever is being read instead of
|
|
290
|
+
// cutting it off. A static alert that is part of the page sets `'none'`.
|
|
291
|
+
accessibilityLiveRegion = "polite",
|
|
292
|
+
style,
|
|
293
|
+
...props
|
|
294
|
+
}, ref) {
|
|
295
|
+
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
|
|
296
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
297
|
+
const selection = { variant, size, radius };
|
|
298
|
+
const states = { disabled: isDisabled };
|
|
299
|
+
const styles = alertRecipe.resolve({ theme, selection, states });
|
|
300
|
+
const tint = color ? alertRecipe.tint({ theme, color, selection, states }) : void 0;
|
|
301
|
+
const context = _react.useMemo.call(void 0, () => {
|
|
302
|
+
const glyph = _reactnative.StyleSheet.flatten([styles.iconGlyph, _optionalChain([tint, 'optionalAccess', _ => _.iconGlyph])]);
|
|
303
|
+
return {
|
|
304
|
+
iconStyle: styles.icon,
|
|
305
|
+
contentStyle: styles.content,
|
|
306
|
+
titleStyle: tint ? [styles.title, tint.title] : styles.title,
|
|
307
|
+
descriptionStyle: tint ? [styles.description, tint.description] : styles.description,
|
|
308
|
+
closeStyle: styles.close,
|
|
309
|
+
closeGlyphStyle: tint ? [styles.closeGlyph, tint.closeGlyph] : styles.closeGlyph,
|
|
310
|
+
icon: {
|
|
311
|
+
size: glyph.fontSize,
|
|
312
|
+
// `ColorValue` also covers the platform's opaque colours, which `Icon` cannot
|
|
313
|
+
// hand to a third-party component expecting a string.
|
|
314
|
+
color: typeof glyph.color === "string" ? glyph.color : void 0
|
|
315
|
+
},
|
|
316
|
+
isDisabled
|
|
317
|
+
};
|
|
318
|
+
}, [styles, tint, isDisabled]);
|
|
319
|
+
const rootStyle = [styles.root, _optionalChain([tint, 'optionalAccess', _2 => _2.root]), styleProps, style];
|
|
320
|
+
const text = _chunkHUZ4AUM2cjs.childrenToString.call(void 0, children);
|
|
321
|
+
const content = text !== null ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertDescription, { children: text }) : children;
|
|
322
|
+
const surface = asChild ? (
|
|
323
|
+
// R12 — the caller's element *is* the alert, so it takes the children it was written
|
|
324
|
+
// with and the auto-wrap does not apply.
|
|
325
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
326
|
+
_chunkHUZ4AUM2cjs.Slot,
|
|
327
|
+
{
|
|
328
|
+
ref,
|
|
329
|
+
accessibilityRole,
|
|
330
|
+
accessibilityLiveRegion,
|
|
331
|
+
...rest,
|
|
332
|
+
style: rootStyle,
|
|
333
|
+
children
|
|
334
|
+
}
|
|
335
|
+
)
|
|
336
|
+
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
337
|
+
_reactnative.View,
|
|
338
|
+
{
|
|
339
|
+
ref,
|
|
340
|
+
accessibilityRole,
|
|
341
|
+
accessibilityLiveRegion,
|
|
342
|
+
...rest,
|
|
343
|
+
style: rootStyle,
|
|
344
|
+
children: content
|
|
345
|
+
}
|
|
346
|
+
);
|
|
347
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertProvider, { value: context, children: surface });
|
|
348
|
+
});
|
|
349
|
+
AlertRoot.displayName = "XAUI.Alert.Root";
|
|
350
|
+
|
|
351
|
+
// src/components/alert/index.ts
|
|
352
|
+
var Alert2 = Object.assign(AlertRoot, {
|
|
353
|
+
Icon: AlertIcon,
|
|
354
|
+
Content: AlertContent,
|
|
355
|
+
Title: AlertTitle,
|
|
356
|
+
Description: AlertDescription,
|
|
357
|
+
Close: AlertClose
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
exports.useAlert = useAlert; exports.alertRecipe = alertRecipe; exports.Alert = Alert2;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkHUZ4AUM2cjs = require('./chunk-HUZ4AUM2.cjs');
|
|
4
4
|
|
|
5
5
|
// src/system/portal/portal.tsx
|
|
6
6
|
var _react = require('react');
|
|
@@ -31,7 +31,7 @@ var styles = _reactnative.StyleSheet.create({
|
|
|
31
31
|
container: { flex: 1 }
|
|
32
32
|
});
|
|
33
33
|
function PortalHost({ children, ...props }) {
|
|
34
|
-
const [styleProps] =
|
|
34
|
+
const [styleProps] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
35
35
|
const [portals, setPortals] = _react.useState.call(void 0, /* @__PURE__ */ new Map());
|
|
36
36
|
const addPortal = _react.useCallback.call(void 0, (key, element) => {
|
|
37
37
|
setPortals((current) => new Map(current).set(key, element));
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkBH5DSJVXcjs = require('./chunk-BH5DSJVX.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkHUZ4AUM2cjs = require('./chunk-HUZ4AUM2.cjs');
|
|
9
|
+
|
|
10
|
+
// src/system/close-button/close-button.tsx
|
|
11
|
+
var _react = require('react');
|
|
12
|
+
var _reactnative = require('react-native');
|
|
13
|
+
|
|
14
|
+
// src/system/close-button/close-button.style.ts
|
|
15
|
+
|
|
16
|
+
var closeButtonSheet = _reactnative.StyleSheet.create({
|
|
17
|
+
bar: { transform: [{ rotate: "45deg" }] },
|
|
18
|
+
barMirrored: { transform: [{ rotate: "-45deg" }] }
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// src/system/close-button/close-button.tsx
|
|
22
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
23
|
+
var HIT_SLOP = 8;
|
|
24
|
+
var CloseButton = _react.forwardRef.call(void 0, function CloseButton2({
|
|
25
|
+
name,
|
|
26
|
+
children,
|
|
27
|
+
baseStyle,
|
|
28
|
+
glyphStyle,
|
|
29
|
+
accessibilityRole = "button",
|
|
30
|
+
hitSlop = HIT_SLOP,
|
|
31
|
+
style,
|
|
32
|
+
onPressIn,
|
|
33
|
+
onPressOut,
|
|
34
|
+
...props
|
|
35
|
+
}, ref) {
|
|
36
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
37
|
+
const [isPressed, press] = _chunkBH5DSJVXcjs.usePressState.call(void 0, { onPressIn, onPressOut });
|
|
38
|
+
if (!rest.accessibilityLabel && !rest["aria-label"]) {
|
|
39
|
+
_chunkBH5DSJVXcjs.warnDev.call(void 0,
|
|
40
|
+
`${name}: a close button needs an \`accessibilityLabel\` \u2014 the cross is not text, and the label beside it names what is being dismissed, not the action.`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
44
|
+
_chunkBH5DSJVXcjs.PressableFeedback,
|
|
45
|
+
{
|
|
46
|
+
ref,
|
|
47
|
+
isPressed,
|
|
48
|
+
accessibilityRole,
|
|
49
|
+
hitSlop,
|
|
50
|
+
...rest,
|
|
51
|
+
style: [
|
|
52
|
+
baseStyle,
|
|
53
|
+
styleProps,
|
|
54
|
+
typeof style === "function" ? style({ pressed: isPressed }) : style
|
|
55
|
+
],
|
|
56
|
+
onPressIn: press.onPressIn,
|
|
57
|
+
onPressOut: press.onPressOut,
|
|
58
|
+
children: _nullishCoalesce(children, () => ( /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
59
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: [glyphStyle, closeButtonSheet.bar] }),
|
|
60
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: [glyphStyle, closeButtonSheet.barMirrored] })
|
|
61
|
+
] })))
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
CloseButton.displayName = "XAUI.CloseButton";
|
|
66
|
+
|
|
67
|
+
// src/system/close-button/close-button.recipe.ts
|
|
68
|
+
function closeButtonBase(theme) {
|
|
69
|
+
return {
|
|
70
|
+
close: { alignItems: "center", justifyContent: "center" },
|
|
71
|
+
closeGlyph: {
|
|
72
|
+
position: "absolute",
|
|
73
|
+
height: theme.borderWidth.default * 1.5,
|
|
74
|
+
borderRadius: theme.borderWidth.default
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
exports.CloseButton = CloseButton; exports.closeButtonBase = closeButtonBase;
|