@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,174 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deriveTint
|
|
3
|
+
} from "./chunk-A3EGFI6T.js";
|
|
4
|
+
|
|
5
|
+
// src/system/recipe/resolve-tint.ts
|
|
6
|
+
var TINT_SLICE_BY_SUFFIX = [
|
|
7
|
+
[/SoftForeground$/, "softForeground"],
|
|
8
|
+
[/SoftPressed$/, "softPressed"],
|
|
9
|
+
[/Soft$/, "soft"],
|
|
10
|
+
[/Foreground$/, "foreground"],
|
|
11
|
+
[/Pressed$/, "pressed"]
|
|
12
|
+
];
|
|
13
|
+
function tintSliceFor(token) {
|
|
14
|
+
for (const [suffix, slice] of TINT_SLICE_BY_SUFFIX) {
|
|
15
|
+
if (suffix.test(token)) return slice;
|
|
16
|
+
}
|
|
17
|
+
return "base";
|
|
18
|
+
}
|
|
19
|
+
function resolveTint(tokens, color, theme) {
|
|
20
|
+
const tint = deriveTint(color, theme);
|
|
21
|
+
const colors = {};
|
|
22
|
+
for (const [role, token] of Object.entries(tokens ?? {})) {
|
|
23
|
+
colors[role] = tint[tintSliceFor(token)];
|
|
24
|
+
}
|
|
25
|
+
return colors;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// src/system/recipe/style-cache.ts
|
|
29
|
+
import { StyleSheet } from "react-native";
|
|
30
|
+
|
|
31
|
+
// src/system/recipe/variant-map.ts
|
|
32
|
+
var STATE_ORDER = ["focused", "pressed", "disabled"];
|
|
33
|
+
function resolveSelection(defaultVariants, selection) {
|
|
34
|
+
const resolved = { ...defaultVariants };
|
|
35
|
+
for (const [axis, value] of Object.entries(selection ?? {})) {
|
|
36
|
+
if (value !== void 0) resolved[axis] = value;
|
|
37
|
+
}
|
|
38
|
+
return resolved;
|
|
39
|
+
}
|
|
40
|
+
function resolveVariantColors(tokens, theme) {
|
|
41
|
+
const colors = {};
|
|
42
|
+
for (const [role, token] of entriesOf(tokens)) {
|
|
43
|
+
const value = theme.colors[token];
|
|
44
|
+
if (value === void 0) {
|
|
45
|
+
throw new Error(
|
|
46
|
+
`XAUI: the recipe names "${token}" for its "${role}" role, but the theme has no such colour token. Check the spelling against XAUIColors.`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
colors[role] = value;
|
|
50
|
+
}
|
|
51
|
+
return colors;
|
|
52
|
+
}
|
|
53
|
+
function activeStateFns(states, active) {
|
|
54
|
+
const fns = [];
|
|
55
|
+
for (const state of STATE_ORDER) {
|
|
56
|
+
const fn = active[state] ? states?.[state] : void 0;
|
|
57
|
+
if (fn) fns.push(fn);
|
|
58
|
+
}
|
|
59
|
+
return fns;
|
|
60
|
+
}
|
|
61
|
+
function collectStyleFns(config, selection, states) {
|
|
62
|
+
const fns = [];
|
|
63
|
+
if (config.base) fns.push(config.base);
|
|
64
|
+
if (config.paint) fns.push(config.paint);
|
|
65
|
+
for (const [axis, values] of Object.entries(config.variants ?? {})) {
|
|
66
|
+
const value = selection[axis];
|
|
67
|
+
const fn = value === void 0 ? void 0 : values[value];
|
|
68
|
+
if (fn) fns.push(fn);
|
|
69
|
+
}
|
|
70
|
+
for (const compound of config.compoundVariants ?? []) {
|
|
71
|
+
if (appliesTo(compound.when, selection)) fns.push(compound.style);
|
|
72
|
+
}
|
|
73
|
+
return [...fns, ...activeStateFns(config.states, states)];
|
|
74
|
+
}
|
|
75
|
+
function appliesTo(when, selection) {
|
|
76
|
+
return Object.entries(when).every(([axis, value]) => selection[axis] === value);
|
|
77
|
+
}
|
|
78
|
+
function entriesOf(tokens) {
|
|
79
|
+
return Object.entries(tokens ?? {});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// src/system/recipe/style-cache.ts
|
|
83
|
+
function createStyleCache(slots) {
|
|
84
|
+
const entries = /* @__PURE__ */ new Map();
|
|
85
|
+
return {
|
|
86
|
+
read(key, build) {
|
|
87
|
+
const hit = entries.get(key);
|
|
88
|
+
if (hit) return hit;
|
|
89
|
+
const built = build();
|
|
90
|
+
const complete = {};
|
|
91
|
+
for (const slot of slots) complete[slot] = built[slot] ?? {};
|
|
92
|
+
const created = StyleSheet.create(complete);
|
|
93
|
+
entries.set(key, created);
|
|
94
|
+
return created;
|
|
95
|
+
},
|
|
96
|
+
get size() {
|
|
97
|
+
return entries.size;
|
|
98
|
+
},
|
|
99
|
+
clear() {
|
|
100
|
+
entries.clear();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function cacheKey(theme, selection, states) {
|
|
105
|
+
const axes = Object.keys(selection).sort().map((axis) => `${axis}:${selection[axis] ?? "-"}`).join("|");
|
|
106
|
+
const active = STATE_ORDER.filter((state) => states[state]).join(",");
|
|
107
|
+
return `${theme.id}|${theme.mode}|${axes}|${active}`;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// src/system/recipe/create-recipe.ts
|
|
111
|
+
function createRecipe(config) {
|
|
112
|
+
const cache = createStyleCache(config.slots);
|
|
113
|
+
const tokensFor = (variant) => variant === void 0 ? void 0 : config.variantTokens?.[variant];
|
|
114
|
+
return {
|
|
115
|
+
slots: config.slots,
|
|
116
|
+
resolve({ theme, selection, states = {} }) {
|
|
117
|
+
const resolved = resolveSelection(config.defaultVariants, selection);
|
|
118
|
+
return cache.read(cacheKey(theme, resolved, states), () => {
|
|
119
|
+
const colors = resolveVariantColors(tokensFor(resolved.variant), theme);
|
|
120
|
+
return apply(collectStyleFns(config, resolved, states), theme, colors);
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
tint({ theme, color, selection, states = {} }) {
|
|
124
|
+
if (!config.paint) return {};
|
|
125
|
+
const resolved = resolveSelection(config.defaultVariants, selection);
|
|
126
|
+
const tokens = tokensFor(resolved.variant);
|
|
127
|
+
if (!tokens) return {};
|
|
128
|
+
const colors = resolveTint(tokens, color, theme);
|
|
129
|
+
const fns = [config.paint, ...activeStateFns(config.states, states)];
|
|
130
|
+
return apply(fns, theme, colors);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function apply(fns, theme, colors) {
|
|
135
|
+
const merged = {};
|
|
136
|
+
for (const fn of fns) {
|
|
137
|
+
const produced = fn(theme, colors);
|
|
138
|
+
for (const slot of Object.keys(produced)) {
|
|
139
|
+
const style = produced[slot];
|
|
140
|
+
if (!style) continue;
|
|
141
|
+
const previous = merged[slot];
|
|
142
|
+
merged[slot] = previous ? { ...previous, ...style } : style;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return merged;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// src/system/recipe/radius-axis.ts
|
|
149
|
+
function radiusAxis(...slots) {
|
|
150
|
+
const axis = {};
|
|
151
|
+
for (const key of RADIUS_KEYS) {
|
|
152
|
+
axis[key] = (theme) => Object.fromEntries(
|
|
153
|
+
slots.map((slot) => [slot, { borderRadius: theme.radius[key] }])
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
return axis;
|
|
157
|
+
}
|
|
158
|
+
var RADIUS_KEYS = [
|
|
159
|
+
"xs",
|
|
160
|
+
"sm",
|
|
161
|
+
"md",
|
|
162
|
+
"lg",
|
|
163
|
+
"xl",
|
|
164
|
+
"2xl",
|
|
165
|
+
"3xl",
|
|
166
|
+
"4xl",
|
|
167
|
+
"field",
|
|
168
|
+
"full"
|
|
169
|
+
];
|
|
170
|
+
|
|
171
|
+
export {
|
|
172
|
+
createRecipe,
|
|
173
|
+
radiusAxis
|
|
174
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
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 _chunk5Z4P6WHRcjs = require('./chunk-5Z4P6WHR.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkWR7YLDVVcjs = require('./chunk-WR7YLDVV.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkZP2E2H2Gcjs = require('./chunk-ZP2E2H2G.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunkGLGU2WFLcjs = require('./chunk-GLGU2WFL.cjs');
|
|
15
|
+
|
|
16
|
+
// src/components/input-group/input-group-field.tsx
|
|
17
|
+
var _react = require('react');
|
|
18
|
+
|
|
19
|
+
// src/components/input-group/input-group.context.ts
|
|
20
|
+
var [InputGroupProvider, useInputGroup] = _chunkZP2E2H2Gcjs.createSlotContext.call(void 0, "InputGroup");
|
|
21
|
+
|
|
22
|
+
// src/components/input-group/input-group.utils.ts
|
|
23
|
+
function decoratorPadding(prefixWidth, suffixWidth) {
|
|
24
|
+
const paddingStart = prefixWidth > 0 ? prefixWidth : void 0;
|
|
25
|
+
const paddingEnd = suffixWidth > 0 ? suffixWidth : void 0;
|
|
26
|
+
if (paddingStart === void 0 && paddingEnd === void 0) return void 0;
|
|
27
|
+
return { paddingStart, paddingEnd };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// src/components/input-group/input-group-field.tsx
|
|
31
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
32
|
+
var InputGroupField = _react.forwardRef.call(void 0,
|
|
33
|
+
function InputGroupField2({ style, ...props }, ref) {
|
|
34
|
+
const { prefixWidth, suffixWidth } = useInputGroup();
|
|
35
|
+
const padding = _react.useMemo.call(void 0,
|
|
36
|
+
() => decoratorPadding(prefixWidth, suffixWidth),
|
|
37
|
+
[prefixWidth, suffixWidth]
|
|
38
|
+
);
|
|
39
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5Z4P6WHRcjs.InputField, { ref, ...props, style: [padding, style] });
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
InputGroupField.displayName = "XAUI.InputGroup.Field";
|
|
43
|
+
|
|
44
|
+
// src/components/input-group/input-group-icon.tsx
|
|
45
|
+
|
|
46
|
+
function InputGroupIcon({ size, color, ...rest }) {
|
|
47
|
+
const { icon } = _chunk5Z4P6WHRcjs.useInput.call(void 0, );
|
|
48
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWR7YLDVVcjs.Icon, { size: _nullishCoalesce(size, () => ( icon.size)), color: _nullishCoalesce(color, () => ( icon.color)), ...rest });
|
|
49
|
+
}
|
|
50
|
+
InputGroupIcon.displayName = "XAUI.InputGroup.Icon";
|
|
51
|
+
|
|
52
|
+
// src/components/input-group/input-group-prefix.tsx
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
// src/components/input-group/input-group-decorator.tsx
|
|
56
|
+
|
|
57
|
+
var _reactnative = require('react-native');
|
|
58
|
+
|
|
59
|
+
var InputGroupDecorator = _react.forwardRef.call(void 0,
|
|
60
|
+
function InputGroupDecorator2({ side, children, isDecorative = false, onLayout, style, ...props }, ref) {
|
|
61
|
+
const { prefixStyle, suffixStyle, isDisabled } = _chunk5Z4P6WHRcjs.useInput.call(void 0, );
|
|
62
|
+
const { setPrefixWidth, setSuffixWidth } = useInputGroup();
|
|
63
|
+
const [styleProps, rest] = _chunkGLGU2WFLcjs.useStyleProps.call(void 0, props);
|
|
64
|
+
const report = side === "prefix" ? setPrefixWidth : setSuffixWidth;
|
|
65
|
+
const handleLayout = _react.useCallback.call(void 0,
|
|
66
|
+
(event) => {
|
|
67
|
+
report(event.nativeEvent.layout.width);
|
|
68
|
+
_optionalChain([onLayout, 'optionalCall', _ => _(event)]);
|
|
69
|
+
},
|
|
70
|
+
[report, onLayout]
|
|
71
|
+
);
|
|
72
|
+
const isInert = isDecorative || isDisabled;
|
|
73
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
74
|
+
_reactnative.View,
|
|
75
|
+
{
|
|
76
|
+
ref,
|
|
77
|
+
accessibilityElementsHidden: isDecorative || void 0,
|
|
78
|
+
importantForAccessibility: isDecorative ? "no-hide-descendants" : void 0,
|
|
79
|
+
pointerEvents: isInert ? "none" : void 0,
|
|
80
|
+
...rest,
|
|
81
|
+
style: [side === "prefix" ? prefixStyle : suffixStyle, styleProps, style],
|
|
82
|
+
onLayout: handleLayout,
|
|
83
|
+
children
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
InputGroupDecorator.displayName = "XAUI.InputGroup.Decorator";
|
|
89
|
+
|
|
90
|
+
// src/components/input-group/input-group-prefix.tsx
|
|
91
|
+
|
|
92
|
+
var InputGroupPrefix = _react.forwardRef.call(void 0,
|
|
93
|
+
function InputGroupPrefix2(props, ref) {
|
|
94
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputGroupDecorator, { ref, side: "prefix", ...props });
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
InputGroupPrefix.displayName = "XAUI.InputGroup.Prefix";
|
|
98
|
+
|
|
99
|
+
// src/components/input-group/input-group-suffix.tsx
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
var InputGroupSuffix = _react.forwardRef.call(void 0,
|
|
103
|
+
function InputGroupSuffix2(props, ref) {
|
|
104
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputGroupDecorator, { ref, side: "suffix", ...props });
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
InputGroupSuffix.displayName = "XAUI.InputGroup.Suffix";
|
|
108
|
+
|
|
109
|
+
// src/components/input-group/input-group.tsx
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
var InputGroupRoot = _react.forwardRef.call(void 0, function InputGroup({ children, asChild = false, style, ...props }, ref) {
|
|
114
|
+
const [styleProps, rest] = _chunkGLGU2WFLcjs.useStyleProps.call(void 0, props);
|
|
115
|
+
const [prefixWidth, setPrefixWidth] = _react.useState.call(void 0, 0);
|
|
116
|
+
const [suffixWidth, setSuffixWidth] = _react.useState.call(void 0, 0);
|
|
117
|
+
const context = _react.useMemo.call(void 0,
|
|
118
|
+
() => ({ prefixWidth, suffixWidth, setPrefixWidth, setSuffixWidth }),
|
|
119
|
+
[prefixWidth, suffixWidth]
|
|
120
|
+
);
|
|
121
|
+
const rootStyle = [styleProps, style];
|
|
122
|
+
const surface = asChild ? (
|
|
123
|
+
// R12 — the caller's element *is* the row.
|
|
124
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZP2E2H2Gcjs.Slot, { ref, ...rest, style: rootStyle, children })
|
|
125
|
+
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, ...rest, style: rootStyle, children });
|
|
126
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputGroupProvider, { value: context, children: surface });
|
|
127
|
+
});
|
|
128
|
+
InputGroupRoot.displayName = "XAUI.InputGroup.Root";
|
|
129
|
+
|
|
130
|
+
// src/components/input-group/index.ts
|
|
131
|
+
var InputGroup2 = Object.assign(InputGroupRoot, {
|
|
132
|
+
Prefix: InputGroupPrefix,
|
|
133
|
+
Field: InputGroupField,
|
|
134
|
+
Suffix: InputGroupSuffix,
|
|
135
|
+
Icon: InputGroupIcon
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
exports.useInputGroup = useInputGroup; exports.decoratorPadding = decoratorPadding; exports.InputGroupField = InputGroupField; exports.InputGroupIcon = InputGroupIcon; exports.InputGroupPrefix = InputGroupPrefix; exports.InputGroupSuffix = InputGroupSuffix; exports.InputGroupRoot = InputGroupRoot; exports.InputGroup = InputGroup2;
|
|
@@ -107,7 +107,10 @@ function deriveTint(tint, theme) {
|
|
|
107
107
|
foreground,
|
|
108
108
|
soft: alpha(tint, 0.15),
|
|
109
109
|
softForeground: mix(tint, theme.colors.foreground, 0.2),
|
|
110
|
-
|
|
110
|
+
// Towards the mode's ink, not the tint's own foreground — the same single direction
|
|
111
|
+
// the token layer takes (P2-API-REVIEW §E). A raw tint has to behave like `accent`
|
|
112
|
+
// under the finger as much as it does at rest.
|
|
113
|
+
pressed: mix(tint, theme.colors.foreground, 0.1),
|
|
111
114
|
softPressed: alpha(tint, 0.2)
|
|
112
115
|
};
|
|
113
116
|
cache.set(key, derived);
|
|
@@ -122,4 +125,6 @@ function deriveTint(tint, theme) {
|
|
|
122
125
|
|
|
123
126
|
|
|
124
127
|
|
|
125
|
-
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
exports.ThemeContext = ThemeContext; exports.useXAUITheme = useXAUITheme; exports.useColorMode = useColorMode; exports.useThemeColor = useThemeColor; exports.isHex = isHex; exports.mix = mix; exports.alpha = alpha; exports.contrastOn = contrastOn; exports.deriveTint = deriveTint;
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunk5Z4P6WHRcjs = require('./chunk-5Z4P6WHR.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkZP2E2H2Gcjs = require('./chunk-ZP2E2H2G.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunkGLGU2WFLcjs = require('./chunk-GLGU2WFL.cjs');
|
|
15
|
+
|
|
16
|
+
// src/components/text-area/text-area-field.tsx
|
|
17
|
+
var _react = require('react');
|
|
18
|
+
|
|
19
|
+
// src/components/text-area/text-area.context.ts
|
|
20
|
+
var [TextAreaProvider, useTextArea] = _chunkZP2E2H2Gcjs.createSlotContext.call(void 0, "TextArea");
|
|
21
|
+
|
|
22
|
+
// src/components/text-area/text-area-field.tsx
|
|
23
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
24
|
+
var TextAreaField = _react.forwardRef.call(void 0,
|
|
25
|
+
function TextAreaField2({ style, scrollEnabled, ...props }, ref) {
|
|
26
|
+
const { textAreaStyle, textArea } = _chunk5Z4P6WHRcjs.useInput.call(void 0, );
|
|
27
|
+
const { rows, maxRows } = useTextArea();
|
|
28
|
+
const [styleProps, rest] = _chunkGLGU2WFLcjs.useStyleProps.call(void 0, props);
|
|
29
|
+
const height = _react.useMemo.call(void 0, () => {
|
|
30
|
+
const chrome = textArea.paddingVertical * 2;
|
|
31
|
+
return {
|
|
32
|
+
minHeight: rows * textArea.lineHeight + chrome,
|
|
33
|
+
// Unset, the field grows for as long as the text does. With a ceiling it stops
|
|
34
|
+
// there and scrolls, which is the only case that needs `scrollEnabled` — a
|
|
35
|
+
// multiline field that can grow has nothing to scroll.
|
|
36
|
+
maxHeight: maxRows ? maxRows * textArea.lineHeight + chrome : void 0
|
|
37
|
+
};
|
|
38
|
+
}, [rows, maxRows, textArea]);
|
|
39
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
40
|
+
_chunk5Z4P6WHRcjs.InputField,
|
|
41
|
+
{
|
|
42
|
+
ref,
|
|
43
|
+
multiline: true,
|
|
44
|
+
scrollEnabled: _nullishCoalesce(scrollEnabled, () => ( maxRows !== void 0)),
|
|
45
|
+
...rest,
|
|
46
|
+
style: [textAreaStyle, height, styleProps, style]
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
TextAreaField.displayName = "XAUI.TextArea.Field";
|
|
52
|
+
|
|
53
|
+
// src/components/text-area/text-area.tsx
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
var DEFAULT_ROWS = 3;
|
|
57
|
+
var TextAreaRoot = _react.forwardRef.call(void 0, function TextArea({ rows = DEFAULT_ROWS, maxRows, children, ...props }, ref) {
|
|
58
|
+
const context = _react.useMemo.call(void 0, () => ({ rows, maxRows }), [rows, maxRows]);
|
|
59
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TextAreaProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5Z4P6WHRcjs.InputRoot, { ref, ...props, children }) });
|
|
60
|
+
});
|
|
61
|
+
TextAreaRoot.displayName = "XAUI.TextArea.Root";
|
|
62
|
+
|
|
63
|
+
// src/components/text-area/index.ts
|
|
64
|
+
var TextArea2 = Object.assign(TextAreaRoot, {
|
|
65
|
+
Label: _chunk5Z4P6WHRcjs.InputLabel,
|
|
66
|
+
Field: TextAreaField,
|
|
67
|
+
Description: _chunk5Z4P6WHRcjs.InputDescription,
|
|
68
|
+
Error: _chunk5Z4P6WHRcjs.InputError
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
exports.useTextArea = useTextArea; exports.TextArea = TextArea2;
|