@xaui/native 0.9.1-alpha.3 → 0.9.1-alpha.31
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-3FV4COTM.js +68 -0
- package/dist/chunk-423RQBOX.js +21 -0
- package/dist/chunk-42FMGB5M.js +661 -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-5PTBRJM7.cjs +346 -0
- package/dist/chunk-5RQ7AZPN.cjs +455 -0
- package/dist/chunk-5Z4P6WHR.cjs +525 -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-AETWQQWU.cjs +92 -0
- package/dist/chunk-ANNUYP55.cjs +431 -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-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-FNEUOBCV.cjs +174 -0
- package/dist/chunk-G7K652GC.js +145 -0
- package/dist/chunk-GGW42MY4.js +20 -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-IHOCANCQ.js +293 -0
- package/dist/chunk-JDFV4W6N.cjs +700 -0
- package/dist/chunk-KOC3KQIT.js +124 -0
- package/dist/chunk-KPWZLUES.cjs +124 -0
- package/dist/chunk-L7JN6OBQ.cjs +314 -0
- package/dist/chunk-MC7SY2QH.cjs +20 -0
- package/dist/chunk-MDVSCWJI.js +314 -0
- package/dist/chunk-N527BTY4.cjs +366 -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-RDTKAAHX.js +346 -0
- package/dist/chunk-TGZZ3RZU.cjs +86 -0
- package/dist/{chunk-2KXQATVL.js → chunk-TZG3DERP.js} +46 -46
- 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-ZH5XVNHG.js +92 -0
- package/dist/chunk-ZH6BHLQR.js +431 -0
- package/dist/chunk-ZP2E2H2G.cjs +119 -0
- package/dist/chunk-ZVWXM3UK.cjs +293 -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/divider/index.cjs +13 -0
- package/dist/components/divider/index.d.cts +117 -0
- package/dist/components/divider/index.d.ts +117 -0
- package/dist/components/divider/index.js +13 -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 +252 -4
- package/dist/index.d.cts +110 -4
- package/dist/index.d.ts +110 -4
- package/dist/index.js +271 -23
- 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 +184 -18
- package/dist/chunk-QAMNNTGM.js +0 -637
- package/dist/chunk-V63JO65F.cjs +0 -637
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SelectionFill
|
|
3
|
+
} from "./chunk-BA2DBSAN.js";
|
|
4
|
+
import {
|
|
5
|
+
useControllableState
|
|
6
|
+
} from "./chunk-F6W3JQ7K.js";
|
|
7
|
+
import {
|
|
8
|
+
PressableFeedback
|
|
9
|
+
} from "./chunk-BFMTUMTU.js";
|
|
10
|
+
import {
|
|
11
|
+
usePressState
|
|
12
|
+
} from "./chunk-423RQBOX.js";
|
|
13
|
+
import {
|
|
14
|
+
createRecipe,
|
|
15
|
+
radiusAxis
|
|
16
|
+
} from "./chunk-4GTAZM2C.js";
|
|
17
|
+
import {
|
|
18
|
+
useXAUITheme
|
|
19
|
+
} from "./chunk-A3EGFI6T.js";
|
|
20
|
+
import {
|
|
21
|
+
childrenToString,
|
|
22
|
+
createSlotContext
|
|
23
|
+
} from "./chunk-E2CWBQTV.js";
|
|
24
|
+
import {
|
|
25
|
+
useStyleProps
|
|
26
|
+
} from "./chunk-URSKA2VR.js";
|
|
27
|
+
|
|
28
|
+
// src/components/checkbox/checkbox-indicator.tsx
|
|
29
|
+
import { forwardRef } from "react";
|
|
30
|
+
import { View } from "react-native";
|
|
31
|
+
|
|
32
|
+
// src/components/checkbox/checkbox.context.ts
|
|
33
|
+
var [CheckboxProvider, useCheckbox] = createSlotContext("Checkbox");
|
|
34
|
+
|
|
35
|
+
// src/components/checkbox/checkbox-indicator.tsx
|
|
36
|
+
import { jsx } from "react/jsx-runtime";
|
|
37
|
+
var CheckboxIndicator = forwardRef(
|
|
38
|
+
function CheckboxIndicator2({ children, animation = true, style, ...props }, ref) {
|
|
39
|
+
const { indicatorStyle, fillStyle, isSelected, isIndeterminate } = useCheckbox();
|
|
40
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
41
|
+
const isFilled = isSelected || isIndeterminate;
|
|
42
|
+
const mark = children ?? (isIndeterminate ? /* @__PURE__ */ jsx(Dash, {}) : /* @__PURE__ */ jsx(Check, {}));
|
|
43
|
+
return /* @__PURE__ */ jsx(View, { ref, ...rest, style: [indicatorStyle, styleProps, style], children: /* @__PURE__ */ jsx(SelectionFill, { isVisible: isFilled, style: fillStyle, animation, children: mark }) });
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
CheckboxIndicator.displayName = "XAUI.Checkbox.Indicator";
|
|
47
|
+
function Check() {
|
|
48
|
+
const { checkStyle } = useCheckbox();
|
|
49
|
+
return /* @__PURE__ */ jsx(View, { style: checkStyle });
|
|
50
|
+
}
|
|
51
|
+
function Dash() {
|
|
52
|
+
const { dashStyle } = useCheckbox();
|
|
53
|
+
return /* @__PURE__ */ jsx(View, { style: dashStyle });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/components/checkbox/checkbox-label.tsx
|
|
57
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
58
|
+
import { Text } from "react-native";
|
|
59
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
60
|
+
var CheckboxLabel = forwardRef2(
|
|
61
|
+
function CheckboxLabel2({ children, style, ...props }, ref) {
|
|
62
|
+
const { labelStyle } = useCheckbox();
|
|
63
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
64
|
+
return /* @__PURE__ */ jsx2(Text, { ref, style: [labelStyle, styleProps, style], ...rest, children });
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
CheckboxLabel.displayName = "XAUI.Checkbox.Label";
|
|
68
|
+
|
|
69
|
+
// src/components/checkbox/checkbox.tsx
|
|
70
|
+
import { forwardRef as forwardRef3, useCallback, useMemo } from "react";
|
|
71
|
+
|
|
72
|
+
// src/components/checkbox/checkbox.recipe.ts
|
|
73
|
+
var SLOTS = ["root", "indicator", "fill", "check", "dash", "label"];
|
|
74
|
+
var VARIANT_TOKENS = {
|
|
75
|
+
primary: {
|
|
76
|
+
bg: "fieldBackground",
|
|
77
|
+
border: "fieldBorder",
|
|
78
|
+
bgSelected: "accent",
|
|
79
|
+
fgSelected: "accentForeground"
|
|
80
|
+
},
|
|
81
|
+
// `bg: 'default'` is the neutral *token*, not this variant's name — the two namespaces
|
|
82
|
+
// meet here as they do on the `Input`, and for the same reason: on a card,
|
|
83
|
+
// `fieldBackground` is the card's own colour and the box would vanish into it.
|
|
84
|
+
secondary: {
|
|
85
|
+
bg: "default",
|
|
86
|
+
border: "fieldBorder",
|
|
87
|
+
bgSelected: "accent",
|
|
88
|
+
fgSelected: "accentForeground"
|
|
89
|
+
},
|
|
90
|
+
tertiary: {
|
|
91
|
+
border: "fieldBorder",
|
|
92
|
+
bgSelected: "accent",
|
|
93
|
+
fgSelected: "accentForeground"
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
function sizeAxis(step) {
|
|
97
|
+
const { box, radius, label, gap, stroke } = step;
|
|
98
|
+
return (theme) => {
|
|
99
|
+
const side = theme.spacing(box);
|
|
100
|
+
return {
|
|
101
|
+
root: { gap: theme.spacing(gap) },
|
|
102
|
+
indicator: { width: side, height: side, borderRadius: theme.radius[radius] },
|
|
103
|
+
check: {
|
|
104
|
+
width: side * CHECK_WIDTH,
|
|
105
|
+
height: side * CHECK_HEIGHT,
|
|
106
|
+
borderStartWidth: stroke,
|
|
107
|
+
borderBottomWidth: stroke,
|
|
108
|
+
// An "L" has its ink in one corner, not in the middle of its box, so rotating it
|
|
109
|
+
// about that box's centre leaves the tick sitting low. Rotating by −45° maps a
|
|
110
|
+
// point to `(dy − dx)·√2/2`, and over the two strokes that spans `H` at the top
|
|
111
|
+
// and `H − t − W` at the bottom — an ink centre `(H − t)·√2/4` **below** the box
|
|
112
|
+
// centre, which flexbox then dutifully centres. Lifting by exactly that is what
|
|
113
|
+
// makes the mark look centred rather than measure centred.
|
|
114
|
+
//
|
|
115
|
+
// Both transforms live here, and not half here and half in a sheet, because
|
|
116
|
+
// `transform` is a whole value: the recipe's merge replaces it rather than
|
|
117
|
+
// blending, so a second step would drop the first.
|
|
118
|
+
transform: [
|
|
119
|
+
{ translateY: -((side * CHECK_HEIGHT - stroke) * Math.SQRT2) / 4 },
|
|
120
|
+
{ rotate: "-45deg" }
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
// The third state's mark: the check's long stroke, on its own and level.
|
|
124
|
+
dash: {
|
|
125
|
+
width: side * CHECK_WIDTH,
|
|
126
|
+
height: stroke,
|
|
127
|
+
borderRadius: stroke / 2
|
|
128
|
+
},
|
|
129
|
+
label: {
|
|
130
|
+
fontSize: theme.fontSizes[label],
|
|
131
|
+
lineHeight: theme.lineHeights[label]
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
var CHECK_WIDTH = 0.5;
|
|
137
|
+
var CHECK_HEIGHT = 0.25;
|
|
138
|
+
var SIZES = {
|
|
139
|
+
sm: { box: 5, radius: "sm", gap: 2, label: "sm", stroke: 2 },
|
|
140
|
+
md: { box: 6, radius: "md", gap: 2, label: "md", stroke: 2 },
|
|
141
|
+
lg: { box: 7, radius: "md", gap: 2.5, label: "lg", stroke: 2.5 }
|
|
142
|
+
};
|
|
143
|
+
var checkboxRecipe = createRecipe({
|
|
144
|
+
slots: SLOTS,
|
|
145
|
+
base: (theme) => ({
|
|
146
|
+
root: { flexDirection: "row", alignItems: "center", alignSelf: "flex-start" },
|
|
147
|
+
indicator: {
|
|
148
|
+
alignItems: "center",
|
|
149
|
+
justifyContent: "center",
|
|
150
|
+
borderWidth: theme.borderWidth.field,
|
|
151
|
+
borderCurve: "continuous",
|
|
152
|
+
// The fill is laid inside the box and has to stop at its corners.
|
|
153
|
+
overflow: "hidden"
|
|
154
|
+
},
|
|
155
|
+
// Laid over the box rather than sized to it: the two corners are the indicator's, and
|
|
156
|
+
// an inset of zero is what keeps the fill inside the border it is clipped by.
|
|
157
|
+
fill: {
|
|
158
|
+
position: "absolute",
|
|
159
|
+
top: 0,
|
|
160
|
+
bottom: 0,
|
|
161
|
+
start: 0,
|
|
162
|
+
end: 0,
|
|
163
|
+
alignItems: "center",
|
|
164
|
+
justifyContent: "center"
|
|
165
|
+
},
|
|
166
|
+
label: {
|
|
167
|
+
fontFamily: theme.fontFamilies.body,
|
|
168
|
+
color: theme.colors.foreground
|
|
169
|
+
}
|
|
170
|
+
}),
|
|
171
|
+
variantTokens: VARIANT_TOKENS,
|
|
172
|
+
/**
|
|
173
|
+
* Where the variant's colours land. The border width follows the *presence* of the
|
|
174
|
+
* border role, exactly as on the `Input`.
|
|
175
|
+
*
|
|
176
|
+
* `bgSelected` and `fgSelected` are painted unconditionally, on two slots the indicator
|
|
177
|
+
* only mounts while it is ticked — which is what keeps selection out of the cache key
|
|
178
|
+
* and inside the tint pass at the same time. An axis would have given up the second.
|
|
179
|
+
*/
|
|
180
|
+
paint: (theme, colors) => ({
|
|
181
|
+
indicator: {
|
|
182
|
+
backgroundColor: colors.bg,
|
|
183
|
+
borderColor: colors.border,
|
|
184
|
+
borderWidth: colors.border ? theme.borderWidth.field : 0
|
|
185
|
+
},
|
|
186
|
+
fill: { backgroundColor: colors.bgSelected },
|
|
187
|
+
check: { borderColor: colors.fgSelected },
|
|
188
|
+
dash: { backgroundColor: colors.fgSelected }
|
|
189
|
+
}),
|
|
190
|
+
variants: {
|
|
191
|
+
size: {
|
|
192
|
+
sm: sizeAxis(SIZES.sm),
|
|
193
|
+
md: sizeAxis(SIZES.md),
|
|
194
|
+
lg: sizeAxis(SIZES.lg)
|
|
195
|
+
},
|
|
196
|
+
radius: radiusAxis("indicator"),
|
|
197
|
+
/**
|
|
198
|
+
* Declared after `size` so its border wins. The resting fill is dropped rather than
|
|
199
|
+
* repainted — `undefined` over a colour is what RN reads as "no background" — because
|
|
200
|
+
* a box that is wrong should read as an outline, not as a filled control that happens
|
|
201
|
+
* to be red at the edge. HeroUI reaches the same shape with a compound.
|
|
202
|
+
*/
|
|
203
|
+
isInvalid: {
|
|
204
|
+
true: (theme) => ({
|
|
205
|
+
indicator: { borderColor: theme.colors.danger, backgroundColor: void 0 },
|
|
206
|
+
fill: { backgroundColor: theme.colors.danger },
|
|
207
|
+
check: { borderColor: theme.colors.dangerForeground },
|
|
208
|
+
dash: { backgroundColor: theme.colors.dangerForeground },
|
|
209
|
+
// The label turns with it: on a long form the field that is wrong has to be
|
|
210
|
+
// findable without reading every message.
|
|
211
|
+
label: { color: theme.colors.danger }
|
|
212
|
+
})
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
/** What `primary` adds to a filled box — the `Input`'s compound, on a smaller field. */
|
|
216
|
+
compoundVariants: [
|
|
217
|
+
{
|
|
218
|
+
when: { variant: "primary" },
|
|
219
|
+
style: (theme) => ({ indicator: theme.shadows.field })
|
|
220
|
+
}
|
|
221
|
+
],
|
|
222
|
+
states: {
|
|
223
|
+
disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
|
|
224
|
+
},
|
|
225
|
+
defaultVariants: { variant: "secondary", size: "md" }
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
// src/components/checkbox/checkbox.tsx
|
|
229
|
+
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
230
|
+
var CheckboxRoot = forwardRef3(function Checkbox({
|
|
231
|
+
children,
|
|
232
|
+
variant,
|
|
233
|
+
size,
|
|
234
|
+
radius,
|
|
235
|
+
color,
|
|
236
|
+
isSelected,
|
|
237
|
+
defaultSelected = false,
|
|
238
|
+
onSelectedChange,
|
|
239
|
+
isIndeterminate = false,
|
|
240
|
+
isInvalid = false,
|
|
241
|
+
isDisabled = false,
|
|
242
|
+
asChild = false,
|
|
243
|
+
accessibilityRole,
|
|
244
|
+
accessibilityState,
|
|
245
|
+
animation,
|
|
246
|
+
style,
|
|
247
|
+
onPress,
|
|
248
|
+
onPressIn,
|
|
249
|
+
onPressOut,
|
|
250
|
+
...props
|
|
251
|
+
}, ref) {
|
|
252
|
+
const theme = useXAUITheme();
|
|
253
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
254
|
+
const [isPressed, press] = usePressState({ onPressIn, onPressOut });
|
|
255
|
+
const [selected, setSelected] = useControllableState({
|
|
256
|
+
value: isSelected,
|
|
257
|
+
defaultValue: defaultSelected,
|
|
258
|
+
onChange: onSelectedChange
|
|
259
|
+
});
|
|
260
|
+
const handlePress = useCallback(
|
|
261
|
+
(event) => {
|
|
262
|
+
setSelected((current) => isIndeterminate ? true : !current);
|
|
263
|
+
onPress?.(event);
|
|
264
|
+
},
|
|
265
|
+
[setSelected, isIndeterminate, onPress]
|
|
266
|
+
);
|
|
267
|
+
const selection = {
|
|
268
|
+
variant,
|
|
269
|
+
size,
|
|
270
|
+
radius,
|
|
271
|
+
isInvalid: isInvalid ? "true" : void 0
|
|
272
|
+
};
|
|
273
|
+
const states = { pressed: isPressed, disabled: isDisabled };
|
|
274
|
+
const styles = checkboxRecipe.resolve({ theme, selection, states });
|
|
275
|
+
const tint = color && !isInvalid ? checkboxRecipe.tint({ theme, color, selection, states }) : void 0;
|
|
276
|
+
const context = useMemo(
|
|
277
|
+
() => ({
|
|
278
|
+
// The tint never reaches the box **at rest**, only the two nodes that say the box
|
|
279
|
+
// is ticked. `paint` writes the resting fill from `bg` and the tint pass re-runs
|
|
280
|
+
// `paint`, so applying `tint.indicator` here would paint an unticked box in the
|
|
281
|
+
// caller's brand colour — which reads as ticked, which is the one thing it is not.
|
|
282
|
+
indicatorStyle: styles.indicator,
|
|
283
|
+
fillStyle: tint ? [styles.fill, tint.fill] : styles.fill,
|
|
284
|
+
checkStyle: tint ? [styles.check, tint.check] : styles.check,
|
|
285
|
+
dashStyle: tint ? [styles.dash, tint.dash] : styles.dash,
|
|
286
|
+
labelStyle: styles.label,
|
|
287
|
+
isSelected: selected,
|
|
288
|
+
isIndeterminate,
|
|
289
|
+
isDisabled,
|
|
290
|
+
isInvalid
|
|
291
|
+
}),
|
|
292
|
+
[styles, tint, selected, isIndeterminate, isDisabled, isInvalid]
|
|
293
|
+
);
|
|
294
|
+
const rootStyle = [
|
|
295
|
+
styles.root,
|
|
296
|
+
tint?.root,
|
|
297
|
+
styleProps,
|
|
298
|
+
typeof style === "function" ? style({ pressed: isPressed }) : style
|
|
299
|
+
];
|
|
300
|
+
const text = childrenToString(children);
|
|
301
|
+
const content = text !== null ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
302
|
+
/* @__PURE__ */ jsx3(CheckboxIndicator, {}),
|
|
303
|
+
/* @__PURE__ */ jsx3(CheckboxLabel, { children: text })
|
|
304
|
+
] }) : children ?? /* @__PURE__ */ jsx3(CheckboxIndicator, {});
|
|
305
|
+
return /* @__PURE__ */ jsx3(CheckboxProvider, { value: context, children: /* @__PURE__ */ jsx3(
|
|
306
|
+
PressableFeedback,
|
|
307
|
+
{
|
|
308
|
+
ref,
|
|
309
|
+
isPressed,
|
|
310
|
+
isDisabled,
|
|
311
|
+
asChild,
|
|
312
|
+
animation,
|
|
313
|
+
accessibilityRole: accessibilityRole ?? "checkbox",
|
|
314
|
+
accessibilityState: {
|
|
315
|
+
// `'mixed'` is the platform's own word for the third state, and it is the only
|
|
316
|
+
// thing that tells a screen reader this box speaks for rows it cannot see.
|
|
317
|
+
checked: isIndeterminate ? "mixed" : selected,
|
|
318
|
+
disabled: isDisabled,
|
|
319
|
+
...accessibilityState
|
|
320
|
+
},
|
|
321
|
+
"aria-invalid": isInvalid,
|
|
322
|
+
...rest,
|
|
323
|
+
style: rootStyle,
|
|
324
|
+
onPress: handlePress,
|
|
325
|
+
onPressIn: press.onPressIn,
|
|
326
|
+
onPressOut: press.onPressOut,
|
|
327
|
+
children: asChild ? children : content
|
|
328
|
+
}
|
|
329
|
+
) });
|
|
330
|
+
});
|
|
331
|
+
CheckboxRoot.displayName = "XAUI.Checkbox.Root";
|
|
332
|
+
|
|
333
|
+
// src/components/checkbox/index.ts
|
|
334
|
+
var Checkbox2 = Object.assign(CheckboxRoot, {
|
|
335
|
+
Indicator: CheckboxIndicator,
|
|
336
|
+
Label: CheckboxLabel
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
export {
|
|
340
|
+
useCheckbox,
|
|
341
|
+
CheckboxIndicator,
|
|
342
|
+
CheckboxLabel,
|
|
343
|
+
checkboxRecipe,
|
|
344
|
+
CheckboxRoot,
|
|
345
|
+
Checkbox2 as Checkbox
|
|
346
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunkGPVNCJ3Zcjs = require('./chunk-GPVNCJ3Z.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunk7DPL3ZDScjs = require('./chunk-7DPL3ZDS.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkEJQCQPETcjs = require('./chunk-EJQCQPET.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkGLGU2WFLcjs = require('./chunk-GLGU2WFL.cjs');
|
|
13
|
+
|
|
14
|
+
// src/system/close-button/close-button.tsx
|
|
15
|
+
var _react = require('react');
|
|
16
|
+
var _reactnative = require('react-native');
|
|
17
|
+
|
|
18
|
+
// src/system/close-button/close-button.style.ts
|
|
19
|
+
|
|
20
|
+
var closeButtonSheet = _reactnative.StyleSheet.create({
|
|
21
|
+
bar: { transform: [{ rotate: "45deg" }] },
|
|
22
|
+
barMirrored: { transform: [{ rotate: "-45deg" }] }
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// src/system/close-button/close-button.tsx
|
|
26
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
27
|
+
var HIT_SLOP = 8;
|
|
28
|
+
var CloseButton = _react.forwardRef.call(void 0, function CloseButton2({
|
|
29
|
+
name,
|
|
30
|
+
children,
|
|
31
|
+
baseStyle,
|
|
32
|
+
glyphStyle,
|
|
33
|
+
accessibilityRole = "button",
|
|
34
|
+
hitSlop = HIT_SLOP,
|
|
35
|
+
style,
|
|
36
|
+
onPressIn,
|
|
37
|
+
onPressOut,
|
|
38
|
+
...props
|
|
39
|
+
}, ref) {
|
|
40
|
+
const [styleProps, rest] = _chunkGLGU2WFLcjs.useStyleProps.call(void 0, props);
|
|
41
|
+
const [isPressed, press] = _chunk7DPL3ZDScjs.usePressState.call(void 0, { onPressIn, onPressOut });
|
|
42
|
+
if (!rest.accessibilityLabel && !rest["aria-label"]) {
|
|
43
|
+
_chunkEJQCQPETcjs.warnDev.call(void 0,
|
|
44
|
+
`${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.`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
48
|
+
_chunkGPVNCJ3Zcjs.PressableFeedback,
|
|
49
|
+
{
|
|
50
|
+
ref,
|
|
51
|
+
isPressed,
|
|
52
|
+
accessibilityRole,
|
|
53
|
+
hitSlop,
|
|
54
|
+
...rest,
|
|
55
|
+
style: [
|
|
56
|
+
baseStyle,
|
|
57
|
+
styleProps,
|
|
58
|
+
typeof style === "function" ? style({ pressed: isPressed }) : style
|
|
59
|
+
],
|
|
60
|
+
onPressIn: press.onPressIn,
|
|
61
|
+
onPressOut: press.onPressOut,
|
|
62
|
+
children: _nullishCoalesce(children, () => ( /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
63
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: [glyphStyle, closeButtonSheet.bar] }),
|
|
64
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: [glyphStyle, closeButtonSheet.barMirrored] })
|
|
65
|
+
] })))
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
CloseButton.displayName = "XAUI.CloseButton";
|
|
70
|
+
|
|
71
|
+
// src/system/close-button/close-button.recipe.ts
|
|
72
|
+
function closeButtonBase(theme) {
|
|
73
|
+
return {
|
|
74
|
+
close: { alignItems: "center", justifyContent: "center" },
|
|
75
|
+
closeGlyph: {
|
|
76
|
+
position: "absolute",
|
|
77
|
+
height: theme.borderWidth.default * 1.5,
|
|
78
|
+
borderRadius: theme.borderWidth.default
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
exports.CloseButton = CloseButton; exports.closeButtonBase = closeButtonBase;
|
|
@@ -2,35 +2,21 @@ import {
|
|
|
2
2
|
ThemeContext,
|
|
3
3
|
alpha,
|
|
4
4
|
mix
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-A3EGFI6T.js";
|
|
6
|
+
import {
|
|
7
|
+
stableHash
|
|
8
|
+
} from "./chunk-GGW42MY4.js";
|
|
6
9
|
|
|
7
10
|
// src/provider/xaui-provider.tsx
|
|
8
11
|
import { useColorScheme } from "react-native";
|
|
9
12
|
|
|
10
|
-
// src/utils/stable-hash.ts
|
|
11
|
-
function canonical(value) {
|
|
12
|
-
if (value === null || typeof value !== "object") return 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: mix(s.accent, s.
|
|
31
|
-
successPressed: mix(s.success, s.
|
|
32
|
-
warningPressed: mix(s.warning, s.
|
|
33
|
-
dangerPressed: mix(s.danger, s.
|
|
16
|
+
accentPressed: mix(s.accent, s.foreground, 0.1),
|
|
17
|
+
successPressed: mix(s.success, s.foreground, 0.1),
|
|
18
|
+
warningPressed: mix(s.warning, s.foreground, 0.1),
|
|
19
|
+
dangerPressed: mix(s.danger, s.foreground, 0.1),
|
|
34
20
|
defaultPressed: mix(s.default, s.defaultForeground, 0.04),
|
|
35
21
|
surfacePressed: mix(s.surface, s.surfaceForeground, 0.08),
|
|
36
22
|
defaultSoft: alpha(s.default, 0.5),
|
|
@@ -63,6 +49,7 @@ function deriveColors(s) {
|
|
|
63
49
|
}
|
|
64
50
|
|
|
65
51
|
// src/theme/scales.ts
|
|
52
|
+
import { Platform } from "react-native";
|
|
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: 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)",
|
|
@@ -387,6 +386,7 @@ function createTheme(config = {}) {
|
|
|
387
386
|
var defaultTheme = createTheme();
|
|
388
387
|
|
|
389
388
|
// src/provider/xaui-provider.tsx
|
|
389
|
+
import { jsx } from "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 = useColorScheme();
|
|
396
396
|
const resolved = colorMode === "system" ? scheme === "dark" ? "dark" : "light" : colorMode;
|
|
397
|
-
return /* @__PURE__ */
|
|
397
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: theme[resolved], children });
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
// src/theme/palette.ts
|