@xaui/native 0.9.1-alpha.4 → 0.9.1-alpha.40
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-2EGR4LWD.js +145 -0
- package/dist/chunk-2NRZKJG7.js +531 -0
- package/dist/chunk-2PMXMKS5.js +67 -0
- package/dist/chunk-2XPG2243.js +586 -0
- package/dist/chunk-36PRYGAM.js +13 -0
- package/dist/chunk-3E7CDKFO.cjs +696 -0
- package/dist/chunk-3GFRSZYR.js +54 -0
- package/dist/chunk-423RQBOX.js +21 -0
- package/dist/chunk-4CUZZWFW.js +92 -0
- package/dist/chunk-4GTAZM2C.js +174 -0
- package/dist/chunk-4KFKWBN5.cjs +89 -0
- package/dist/{chunk-3QBT3Q65.cjs → chunk-57SJ4LJF.cjs} +7 -2
- package/dist/chunk-5R26NM4M.cjs +402 -0
- package/dist/chunk-5VKYNBNA.js +607 -0
- package/dist/chunk-64MXEVT3.js +66 -0
- package/dist/chunk-6DOLGZVV.cjs +147 -0
- package/dist/chunk-6L2TS2R3.cjs +92 -0
- package/dist/chunk-6UEZJRVI.js +669 -0
- package/dist/chunk-734MFAX4.js +27 -0
- package/dist/chunk-73RKQC5X.js +104 -0
- package/dist/chunk-7DPL3ZDS.cjs +21 -0
- package/dist/chunk-7EIHHOHP.cjs +42 -0
- package/dist/chunk-7GHM4GKL.cjs +119 -0
- package/dist/chunk-7YF5NAHQ.cjs +74 -0
- package/dist/{chunk-X2K2FX3W.js → chunk-A3EGFI6T.js} +6 -1
- package/dist/chunk-ABAGZTXZ.cjs +736 -0
- package/dist/{chunk-AW63PTQ4.cjs → chunk-ACAPTWE3.cjs} +85 -81
- package/dist/chunk-AMCSSOJT.cjs +104 -0
- package/dist/chunk-BA2DBSAN.js +102 -0
- package/dist/chunk-BRRXFOBY.js +431 -0
- package/dist/chunk-C5YLPCFC.cjs +293 -0
- package/dist/chunk-DA3OKXHV.cjs +700 -0
- package/dist/chunk-DD4276RF.js +366 -0
- package/dist/chunk-DG2I4PJG.js +701 -0
- package/dist/chunk-DHGLGSH6.js +661 -0
- package/dist/chunk-DIBUQ46Y.js +346 -0
- package/dist/chunk-EGLLDKN6.js +9 -0
- package/dist/chunk-EJQCQPET.cjs +9 -0
- package/dist/chunk-EKS3W46M.cjs +66 -0
- package/dist/chunk-EZEYMLO3.js +402 -0
- package/dist/chunk-F6CQ6CBI.cjs +112 -0
- package/dist/chunk-F6W3JQ7K.js +42 -0
- package/dist/chunk-FHUYHV6J.js +89 -0
- package/dist/chunk-FNEUOBCV.cjs +174 -0
- package/dist/chunk-G7P3ERYF.cjs +478 -0
- package/dist/chunk-GA6PBWNT.js +147 -0
- package/dist/chunk-GFUZ3MUT.cjs +455 -0
- package/dist/chunk-GGW43Q37.cjs +1 -0
- package/dist/chunk-GTR5X65M.cjs +27 -0
- package/dist/chunk-H4E4HDEP.cjs +13 -0
- package/dist/chunk-H7DS4IO7.js +198 -0
- package/dist/chunk-HDVVZG4S.cjs +198 -0
- package/dist/chunk-IKJVLJKT.js +151 -0
- package/dist/chunk-J3MB4PI5.cjs +531 -0
- package/dist/chunk-K72UDPVN.js +119 -0
- package/dist/chunk-KCMYU7WF.js +86 -0
- package/dist/chunk-LRN3RNDO.js +940 -0
- package/dist/chunk-LTX6TB5I.js +124 -0
- package/dist/chunk-LUPCPLND.cjs +145 -0
- package/dist/chunk-M63GFNKV.js +194 -0
- package/dist/chunk-N3KTZMPG.js +293 -0
- package/dist/chunk-NCTOTTVW.js +13 -0
- package/dist/chunk-NWGLP6JX.cjs +410 -0
- package/dist/chunk-R73XQK7X.cjs +314 -0
- package/dist/chunk-RU7JCMWC.cjs +881 -0
- package/dist/chunk-SNIHUKDA.cjs +184 -0
- package/dist/chunk-T5FV5F7A.cjs +607 -0
- package/dist/chunk-TDTUAIFF.cjs +153 -0
- package/dist/chunk-TJ74XVZN.cjs +431 -0
- package/dist/chunk-TK44VBIE.cjs +194 -0
- package/dist/chunk-UAWBAD4E.cjs +346 -0
- package/dist/chunk-UFTCTTKK.js +381 -0
- package/dist/chunk-WDDXU3OH.cjs +67 -0
- package/dist/chunk-WFEMJCXO.cjs +13 -0
- package/dist/chunk-WHJTBTYM.js +0 -0
- package/dist/{chunk-2KXQATVL.js → chunk-WKCQ6VGW.js} +59 -55
- package/dist/chunk-XFPQFCEK.js +455 -0
- package/dist/chunk-XSQPVDFH.cjs +60 -0
- package/dist/chunk-XTC2SLFT.js +153 -0
- package/dist/chunk-XV735BSA.cjs +366 -0
- package/dist/chunk-XWNG2U4K.cjs +124 -0
- package/dist/chunk-YGYYJ3LQ.js +314 -0
- package/dist/chunk-YVHT2UVW.js +74 -0
- package/dist/chunk-ZFOOJK37.cjs +86 -0
- package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
- package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
- package/dist/components/accordion/index.cjs +35 -0
- package/dist/components/accordion/index.d.cts +299 -0
- package/dist/components/accordion/index.d.ts +299 -0
- package/dist/components/accordion/index.js +35 -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/avatar/index.cjs +16 -0
- package/dist/components/avatar/index.d.cts +131 -0
- package/dist/components/avatar/index.d.ts +131 -0
- package/dist/components/avatar/index.js +16 -0
- package/dist/components/badge/index.cjs +15 -0
- package/dist/components/badge/index.d.cts +157 -0
- package/dist/components/badge/index.d.ts +157 -0
- package/dist/components/badge/index.js +15 -0
- package/dist/components/button/index.cjs +22 -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 +22 -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/field-group/index.cjs +27 -0
- package/dist/components/field-group/index.d.cts +270 -0
- package/dist/components/field-group/index.d.ts +270 -0
- package/dist/components/field-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/menu/index.cjs +49 -0
- package/dist/components/menu/index.d.cts +351 -0
- package/dist/components/menu/index.d.ts +351 -0
- package/dist/components/menu/index.js +49 -0
- package/dist/components/popover/index.cjs +38 -0
- package/dist/components/popover/index.d.cts +254 -0
- package/dist/components/popover/index.d.ts +254 -0
- package/dist/components/popover/index.js +38 -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/select/index.cjs +50 -0
- package/dist/components/select/index.d.cts +498 -0
- package/dist/components/select/index.d.ts +498 -0
- package/dist/components/select/index.js +50 -0
- package/dist/components/skeleton/index.cjs +11 -0
- package/dist/components/skeleton/index.d.cts +111 -0
- package/dist/components/skeleton/index.d.ts +111 -0
- package/dist/components/skeleton/index.js +11 -0
- package/dist/components/spinner/index.cjs +17 -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 +17 -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/text-field/index.cjs +25 -0
- package/dist/components/text-field/index.d.cts +205 -0
- package/dist/components/text-field/index.d.ts +205 -0
- package/dist/components/text-field/index.js +25 -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 +400 -4
- package/dist/index.d.cts +118 -4
- package/dist/index.d.ts +118 -4
- package/dist/index.js +423 -27
- package/dist/placement-DHa0Rrh1.d.cts +38 -0
- package/dist/placement-DHa0Rrh1.d.ts +38 -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 +73 -4
- package/dist/system/index.d.cts +379 -193
- package/dist/system/index.d.ts +379 -193
- package/dist/system/index.js +87 -18
- package/dist/text-field.type-0l73acce.d.ts +167 -0
- package/dist/text-field.type-DBh06DU5.d.cts +167 -0
- package/dist/theme/index.cjs +5 -3
- package/dist/theme/index.d.cts +55 -24
- package/dist/theme/index.d.ts +55 -24
- package/dist/theme/index.js +4 -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 +254 -18
- package/dist/chunk-ECDWSSHJ.js +0 -688
- package/dist/chunk-IYFGO523.cjs +0 -688
|
@@ -0,0 +1,174 @@
|
|
|
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
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
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 = _chunk57SJ4LJFcjs.deriveTint.call(void 0, color, theme);
|
|
21
|
+
const colors = {};
|
|
22
|
+
for (const [role, token] of Object.entries(_nullishCoalesce(tokens, () => ( {})))) {
|
|
23
|
+
colors[role] = tint[tintSliceFor(token)];
|
|
24
|
+
}
|
|
25
|
+
return colors;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// src/system/recipe/style-cache.ts
|
|
29
|
+
var _reactnative = require('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(_nullishCoalesce(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] ? _optionalChain([states, 'optionalAccess', _ => _[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(_nullishCoalesce(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 _nullishCoalesce(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(_nullishCoalesce(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] = _nullishCoalesce(built[slot], () => ( {}));
|
|
92
|
+
const created = _reactnative.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}:${_nullishCoalesce(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 : _optionalChain([config, 'access', _2 => _2.variantTokens, 'optionalAccess', _3 => _3[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
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
exports.createRecipe = createRecipe; exports.radiusAxis = radiusAxis;
|
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 _chunkEKS3W46Mcjs = require('./chunk-EKS3W46M.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunk4KFKWBN5cjs = require('./chunk-4KFKWBN5.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunk7EIHHOHPcjs = require('./chunk-7EIHHOHP.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunk3E7CDKFOcjs = require('./chunk-3E7CDKFO.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunk7DPL3ZDScjs = require('./chunk-7DPL3ZDS.cjs');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
var _chunkFNEUOBCVcjs = require('./chunk-FNEUOBCV.cjs');
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
var _chunk7GHM4GKLcjs = require('./chunk-7GHM4GKL.cjs');
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
var _chunkTK44VBIEcjs = require('./chunk-TK44VBIE.cjs');
|
|
33
|
+
|
|
34
|
+
// src/components/accordion/accordion-content.tsx
|
|
35
|
+
var _react = require('react');
|
|
36
|
+
var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
37
|
+
|
|
38
|
+
// src/components/accordion/accordion.animation.ts
|
|
39
|
+
|
|
40
|
+
var LAYOUT = _reactnativereanimated.LinearTransition.springify().damping(140).stiffness(1600).mass(4);
|
|
41
|
+
var CONTENT_MS = 200;
|
|
42
|
+
var contentEntering = _reactnativereanimated.FadeIn.duration(CONTENT_MS).easing(
|
|
43
|
+
_reactnativereanimated.Easing.out(_reactnativereanimated.Easing.ease)
|
|
44
|
+
);
|
|
45
|
+
var contentExiting = _reactnativereanimated.FadeOut.duration(CONTENT_MS).easing(
|
|
46
|
+
_reactnativereanimated.Easing.in(_reactnativereanimated.Easing.ease)
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
// src/components/accordion/accordion.context.ts
|
|
50
|
+
var [AccordionProvider, useAccordion] = _chunk7GHM4GKLcjs.createSlotContext.call(void 0, "Accordion");
|
|
51
|
+
var [AccordionItemProvider, useAccordionItem] = _chunk7GHM4GKLcjs.createSlotContext.call(void 0, "Accordion.Item");
|
|
52
|
+
|
|
53
|
+
// src/components/accordion/accordion-content.tsx
|
|
54
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
55
|
+
var AccordionContent = _react.forwardRef.call(void 0,
|
|
56
|
+
function AccordionContent2({ children, style, ...props }, ref) {
|
|
57
|
+
const { contentStyle } = useAccordion();
|
|
58
|
+
const { isExpanded } = useAccordionItem();
|
|
59
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
60
|
+
if (!isExpanded) return null;
|
|
61
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
62
|
+
_reactnativereanimated2.default.View,
|
|
63
|
+
{
|
|
64
|
+
ref,
|
|
65
|
+
entering: contentEntering,
|
|
66
|
+
exiting: contentExiting,
|
|
67
|
+
...rest,
|
|
68
|
+
style: [contentStyle, styleProps, style],
|
|
69
|
+
children
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
AccordionContent.displayName = "XAUI.Accordion.Content";
|
|
75
|
+
|
|
76
|
+
// src/components/accordion/accordion-indicator.tsx
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
function AccordionIndicator({
|
|
86
|
+
as = _chunk4KFKWBN5cjs.ChevronDownIcon,
|
|
87
|
+
...props
|
|
88
|
+
}) {
|
|
89
|
+
const { indicatorStyle } = useAccordion();
|
|
90
|
+
const { isExpanded } = useAccordionItem();
|
|
91
|
+
const progress = _reactnativereanimated.useSharedValue.call(void 0, isExpanded ? 1 : 0);
|
|
92
|
+
_react.useEffect.call(void 0, () => {
|
|
93
|
+
progress.set(_reactnativereanimated.withSpring.call(void 0, isExpanded ? 1 : 0, _chunkEKS3W46Mcjs.INDICATOR_SPRING));
|
|
94
|
+
}, [isExpanded, progress]);
|
|
95
|
+
const rotation = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
|
|
96
|
+
transform: [
|
|
97
|
+
{
|
|
98
|
+
rotate: `${_reactnativereanimated.interpolate.call(void 0, progress.get(), [0, 1], [_chunkEKS3W46Mcjs.INDICATOR_ROTATION[0], _chunkEKS3W46Mcjs.INDICATOR_ROTATION[1]])}deg`
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}));
|
|
102
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, { style: [indicatorStyle, rotation], children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4KFKWBN5cjs.Icon, { as, ...props }) });
|
|
103
|
+
}
|
|
104
|
+
AccordionIndicator.displayName = "XAUI.Accordion.Indicator";
|
|
105
|
+
|
|
106
|
+
// src/components/accordion/accordion-item.tsx
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
var AccordionItem = _react.forwardRef.call(void 0,
|
|
111
|
+
function AccordionItem2({ value, children, isDisabled = false, style, ...props }, ref) {
|
|
112
|
+
const { itemStyle, isDisabled: isRootDisabled, isExpanded } = useAccordion();
|
|
113
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
114
|
+
const expanded = isExpanded(value);
|
|
115
|
+
const disabled = isRootDisabled || isDisabled;
|
|
116
|
+
const context = _react.useMemo.call(void 0,
|
|
117
|
+
() => ({ value, isExpanded: expanded, isDisabled: disabled }),
|
|
118
|
+
[value, expanded, disabled]
|
|
119
|
+
);
|
|
120
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AccordionItemProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
121
|
+
_reactnativereanimated2.default.View,
|
|
122
|
+
{
|
|
123
|
+
ref,
|
|
124
|
+
layout: LAYOUT,
|
|
125
|
+
...rest,
|
|
126
|
+
style: [itemStyle, styleProps, style],
|
|
127
|
+
children: typeof children === "function" ? children(context) : children
|
|
128
|
+
}
|
|
129
|
+
) });
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
AccordionItem.displayName = "XAUI.Accordion.Item";
|
|
133
|
+
|
|
134
|
+
// src/components/accordion/accordion-trigger.tsx
|
|
135
|
+
|
|
136
|
+
var _reactnative = require('react-native');
|
|
137
|
+
|
|
138
|
+
var AccordionTrigger = _react.forwardRef.call(void 0,
|
|
139
|
+
function AccordionTrigger2({
|
|
140
|
+
children,
|
|
141
|
+
asChild = false,
|
|
142
|
+
accessibilityRole = "button",
|
|
143
|
+
accessibilityState,
|
|
144
|
+
style,
|
|
145
|
+
onPress,
|
|
146
|
+
onPressIn,
|
|
147
|
+
onPressOut,
|
|
148
|
+
...props
|
|
149
|
+
}, ref) {
|
|
150
|
+
const { triggerStyle, triggerPressedStyle, labelStyle, glyph, toggle } = useAccordion();
|
|
151
|
+
const { value, isExpanded, isDisabled } = useAccordionItem();
|
|
152
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
153
|
+
const [isPressed, press] = _chunk7DPL3ZDScjs.usePressState.call(void 0, { onPressIn, onPressOut });
|
|
154
|
+
const handlePress = _react.useCallback.call(void 0,
|
|
155
|
+
(event) => {
|
|
156
|
+
_optionalChain([onPress, 'optionalCall', _ => _(event)]);
|
|
157
|
+
toggle(value);
|
|
158
|
+
},
|
|
159
|
+
[onPress, toggle, value]
|
|
160
|
+
);
|
|
161
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4KFKWBN5cjs.IconContext.Provider, { value: glyph, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
162
|
+
_chunk3E7CDKFOcjs.PressableFeedback,
|
|
163
|
+
{
|
|
164
|
+
ref,
|
|
165
|
+
isPressed,
|
|
166
|
+
isDisabled,
|
|
167
|
+
asChild,
|
|
168
|
+
accessibilityRole,
|
|
169
|
+
accessibilityState: {
|
|
170
|
+
disabled: isDisabled,
|
|
171
|
+
expanded: isExpanded,
|
|
172
|
+
...accessibilityState
|
|
173
|
+
},
|
|
174
|
+
...rest,
|
|
175
|
+
style: [
|
|
176
|
+
triggerStyle,
|
|
177
|
+
isPressed && triggerPressedStyle,
|
|
178
|
+
styleProps,
|
|
179
|
+
typeof style === "function" ? style({ pressed: isPressed }) : style
|
|
180
|
+
],
|
|
181
|
+
onPress: handlePress,
|
|
182
|
+
onPressIn: press.onPressIn,
|
|
183
|
+
onPressOut: press.onPressOut,
|
|
184
|
+
children: asChild ? children : wrapText(children, labelStyle)
|
|
185
|
+
}
|
|
186
|
+
) });
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
AccordionTrigger.displayName = "XAUI.Accordion.Trigger";
|
|
190
|
+
function wrapText(children, style) {
|
|
191
|
+
return _react.Children.map(
|
|
192
|
+
children,
|
|
193
|
+
(child) => typeof child === "string" || typeof child === "number" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style, children: child }) : child
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// src/components/accordion/accordion.tsx
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
// src/components/accordion/accordion.hook.ts
|
|
203
|
+
|
|
204
|
+
function useExpansion({
|
|
205
|
+
value,
|
|
206
|
+
defaultValue,
|
|
207
|
+
onValueChange,
|
|
208
|
+
selectionMode,
|
|
209
|
+
isCollapsible
|
|
210
|
+
}) {
|
|
211
|
+
const [current, setCurrent] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
|
|
212
|
+
value,
|
|
213
|
+
defaultValue: _nullishCoalesce(defaultValue, () => ( (selectionMode === "multiple" ? [] : ""))),
|
|
214
|
+
onChange: onValueChange
|
|
215
|
+
});
|
|
216
|
+
const isExpanded = _react.useCallback.call(void 0,
|
|
217
|
+
(item) => Array.isArray(current) ? current.includes(item) : current === item,
|
|
218
|
+
[current]
|
|
219
|
+
);
|
|
220
|
+
const toggle = _react.useCallback.call(void 0,
|
|
221
|
+
(item) => {
|
|
222
|
+
setCurrent((value_) => nextValue(value_, item, selectionMode, isCollapsible));
|
|
223
|
+
},
|
|
224
|
+
[isCollapsible, selectionMode, setCurrent]
|
|
225
|
+
);
|
|
226
|
+
return _react.useMemo.call(void 0, () => ({ isExpanded, toggle }), [isExpanded, toggle]);
|
|
227
|
+
}
|
|
228
|
+
function nextValue(current, item, selectionMode, isCollapsible) {
|
|
229
|
+
if (selectionMode === "multiple") {
|
|
230
|
+
const list = Array.isArray(current) ? current : current ? [current] : [];
|
|
231
|
+
if (!list.includes(item)) return [...list, item];
|
|
232
|
+
if (!isCollapsible && list.length === 1) return current;
|
|
233
|
+
return list.filter((value) => value !== item);
|
|
234
|
+
}
|
|
235
|
+
if (current !== item) return item;
|
|
236
|
+
return isCollapsible ? "" : current;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// src/components/accordion/accordion.recipe.ts
|
|
240
|
+
|
|
241
|
+
var SLOTS = [
|
|
242
|
+
"root",
|
|
243
|
+
"container",
|
|
244
|
+
"separator",
|
|
245
|
+
"item",
|
|
246
|
+
"trigger",
|
|
247
|
+
"indicator",
|
|
248
|
+
"content"
|
|
249
|
+
];
|
|
250
|
+
var VARIANT_TOKENS = {
|
|
251
|
+
primary: { bg: "surface", fg: "surfaceForeground" },
|
|
252
|
+
secondary: { bg: "surfaceSecondary", fg: "surfaceSecondaryForeground" },
|
|
253
|
+
tertiary: { border: "border", fg: "foreground" },
|
|
254
|
+
ghost: { fg: "foreground" }
|
|
255
|
+
};
|
|
256
|
+
var HAIRLINE = _reactnative.StyleSheet.hairlineWidth;
|
|
257
|
+
var SIZES = {
|
|
258
|
+
xs: { padding: 2.5, gap: 2.5, label: "sm", glyph: "md", radius: "md" },
|
|
259
|
+
sm: { padding: 3, gap: 3, label: "md", glyph: "lg", radius: "lg" },
|
|
260
|
+
md: { padding: 3, gap: 4, label: "md", glyph: "lg", radius: "xl" },
|
|
261
|
+
lg: { padding: 4, gap: 4, label: "lg", glyph: "xl", radius: "2xl" }
|
|
262
|
+
};
|
|
263
|
+
var TRIGGER_PADDING_VERTICAL = 4;
|
|
264
|
+
function sizeAxis(step) {
|
|
265
|
+
const { padding, gap, label, glyph, radius } = step;
|
|
266
|
+
return (theme) => ({
|
|
267
|
+
// Both layers, at the same value: the outer one draws the corner, the inner one is
|
|
268
|
+
// what a pressed row is cut against.
|
|
269
|
+
root: { borderRadius: theme.radius[radius] },
|
|
270
|
+
container: { borderRadius: theme.radius[radius] },
|
|
271
|
+
trigger: {
|
|
272
|
+
paddingVertical: theme.spacing(TRIGGER_PADDING_VERTICAL),
|
|
273
|
+
paddingHorizontal: theme.spacing(padding),
|
|
274
|
+
gap: theme.spacing(gap),
|
|
275
|
+
fontSize: theme.fontSizes[label],
|
|
276
|
+
lineHeight: theme.lineHeights[label]
|
|
277
|
+
},
|
|
278
|
+
indicator: { fontSize: theme.fontSizes[glyph] },
|
|
279
|
+
content: {
|
|
280
|
+
paddingHorizontal: theme.spacing(padding),
|
|
281
|
+
paddingBottom: theme.spacing(TRIGGER_PADDING_VERTICAL)
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
var accordionRecipe = _chunkFNEUOBCVcjs.createRecipe.call(void 0, {
|
|
286
|
+
slots: SLOTS,
|
|
287
|
+
base: (theme) => ({
|
|
288
|
+
// The root carries the shadow and the border; it must **not** clip. On iOS
|
|
289
|
+
// `overflow: 'hidden'` sets `masksToBounds`, which clips the layer's own shadow along
|
|
290
|
+
// with everything else, and a lifted `primary` would have none at all.
|
|
291
|
+
root: { flexDirection: "column", borderCurve: "continuous" },
|
|
292
|
+
// So the clipping is one layer in. This is the one extra node in the component, and
|
|
293
|
+
// it is here for a platform constraint rather than for layout: a single layer cannot
|
|
294
|
+
// both cast a shadow and clip its children on iOS. Without it a pressed row paints
|
|
295
|
+
// over the card's rounded corner, square, for as long as a finger is on it.
|
|
296
|
+
container: { flexDirection: "column", overflow: "hidden" },
|
|
297
|
+
separator: { height: HAIRLINE, backgroundColor: theme.colors.separator },
|
|
298
|
+
// This one is load-bearing: it is what makes the height animation read as a panel
|
|
299
|
+
// unrolling rather than as content sliding out from behind the row above it.
|
|
300
|
+
item: { flexDirection: "column", overflow: "hidden" },
|
|
301
|
+
trigger: {
|
|
302
|
+
flexDirection: "row",
|
|
303
|
+
alignItems: "center",
|
|
304
|
+
justifyContent: "space-between",
|
|
305
|
+
fontFamily: theme.fontFamilies.body,
|
|
306
|
+
fontWeight: theme.fontWeights.medium
|
|
307
|
+
},
|
|
308
|
+
indicator: { alignItems: "center", justifyContent: "center" }
|
|
309
|
+
}),
|
|
310
|
+
variantTokens: VARIANT_TOKENS,
|
|
311
|
+
/**
|
|
312
|
+
* The fill is the **root's**, never the row's. A row that painted its own would stack
|
|
313
|
+
* two fills where the separator sits, and the hairline would disappear into the seam.
|
|
314
|
+
*/
|
|
315
|
+
paint: (theme, colors) => ({
|
|
316
|
+
root: {
|
|
317
|
+
backgroundColor: colors.bg,
|
|
318
|
+
borderColor: colors.border,
|
|
319
|
+
borderWidth: colors.border ? theme.borderWidth.default : 0
|
|
320
|
+
},
|
|
321
|
+
trigger: { color: colors.fg },
|
|
322
|
+
indicator: { color: theme.colors.muted }
|
|
323
|
+
}),
|
|
324
|
+
variants: {
|
|
325
|
+
size: {
|
|
326
|
+
xs: sizeAxis(SIZES.xs),
|
|
327
|
+
sm: sizeAxis(SIZES.sm),
|
|
328
|
+
md: sizeAxis(SIZES.md),
|
|
329
|
+
lg: sizeAxis(SIZES.lg)
|
|
330
|
+
},
|
|
331
|
+
radius: _chunkFNEUOBCVcjs.radiusAxis.call(void 0, "root", "container")
|
|
332
|
+
},
|
|
333
|
+
/**
|
|
334
|
+
* A container inset from its own edge, and its separators inset with it. `ghost` has no
|
|
335
|
+
* edge to be inset from, so its rows run the full width and the hairline runs with them
|
|
336
|
+
* — which is the difference between a list on a page and a list in a box.
|
|
337
|
+
*
|
|
338
|
+
* `primary` is the only one lifted. It is the one that reads as a card, and HeroUI puts
|
|
339
|
+
* their `--shadow-surface` on exactly that variant. `secondary` and `tertiary` have too
|
|
340
|
+
* little fill to lift — a shadow under either would read as dirt rather than as height
|
|
341
|
+
* — and in dark mode the theme's surface shadow is already nothing (§4), which is why
|
|
342
|
+
* this names the role rather than a set of numbers.
|
|
343
|
+
*/
|
|
344
|
+
compoundVariants: [
|
|
345
|
+
...["primary", "secondary", "tertiary"].map((variant) => ({
|
|
346
|
+
when: { variant },
|
|
347
|
+
style: (theme) => ({
|
|
348
|
+
separator: { marginHorizontal: theme.spacing(3) }
|
|
349
|
+
})
|
|
350
|
+
})),
|
|
351
|
+
{
|
|
352
|
+
when: { variant: "primary" },
|
|
353
|
+
style: (theme) => ({
|
|
354
|
+
root: theme.shadows.surface
|
|
355
|
+
})
|
|
356
|
+
}
|
|
357
|
+
],
|
|
358
|
+
states: {
|
|
359
|
+
// On the row, not on the root: pressing one row must not tint the whole container.
|
|
360
|
+
pressed: (theme) => ({
|
|
361
|
+
trigger: { backgroundColor: theme.colors.defaultSoftPressed }
|
|
362
|
+
}),
|
|
363
|
+
disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
|
|
364
|
+
},
|
|
365
|
+
defaultVariants: { variant: "ghost", size: "md" }
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
// src/components/accordion/accordion.tsx
|
|
369
|
+
|
|
370
|
+
var AccordionRoot = _react.forwardRef.call(void 0, function Accordion({
|
|
371
|
+
children,
|
|
372
|
+
variant,
|
|
373
|
+
size,
|
|
374
|
+
radius,
|
|
375
|
+
color,
|
|
376
|
+
selectionMode = "single",
|
|
377
|
+
value,
|
|
378
|
+
defaultValue,
|
|
379
|
+
onValueChange,
|
|
380
|
+
isDisabled = false,
|
|
381
|
+
isCollapsible = true,
|
|
382
|
+
hasSeparator = true,
|
|
383
|
+
asChild = false,
|
|
384
|
+
style,
|
|
385
|
+
...props
|
|
386
|
+
}, ref) {
|
|
387
|
+
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
|
|
388
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
389
|
+
const { isExpanded, toggle } = useExpansion({
|
|
390
|
+
value,
|
|
391
|
+
defaultValue,
|
|
392
|
+
onValueChange,
|
|
393
|
+
selectionMode,
|
|
394
|
+
isCollapsible
|
|
395
|
+
});
|
|
396
|
+
const selection = { variant, size, radius };
|
|
397
|
+
const styles = accordionRecipe.resolve({
|
|
398
|
+
theme,
|
|
399
|
+
selection,
|
|
400
|
+
states: { disabled: isDisabled }
|
|
401
|
+
});
|
|
402
|
+
const pressed = accordionRecipe.resolve({
|
|
403
|
+
theme,
|
|
404
|
+
selection,
|
|
405
|
+
states: { pressed: true }
|
|
406
|
+
});
|
|
407
|
+
const tint = color ? accordionRecipe.tint({ theme, color, selection }) : void 0;
|
|
408
|
+
const context = _react.useMemo.call(void 0, () => {
|
|
409
|
+
const trigger = _reactnative.StyleSheet.flatten([styles.trigger, _optionalChain([tint, 'optionalAccess', _2 => _2.trigger])]);
|
|
410
|
+
const indicator = _reactnative.StyleSheet.flatten([
|
|
411
|
+
styles.indicator,
|
|
412
|
+
_optionalChain([tint, 'optionalAccess', _3 => _3.indicator])
|
|
413
|
+
]);
|
|
414
|
+
return {
|
|
415
|
+
separatorStyle: styles.separator,
|
|
416
|
+
itemStyle: styles.item,
|
|
417
|
+
triggerStyle: tint ? [styles.trigger, tint.trigger] : styles.trigger,
|
|
418
|
+
triggerPressedStyle: pressed.trigger,
|
|
419
|
+
indicatorStyle: styles.indicator,
|
|
420
|
+
contentStyle: styles.content,
|
|
421
|
+
// The trigger is a row of views, so a stringifiable child is wrapped in a `Text` of
|
|
422
|
+
// its own — and that text takes the type the recipe put on the row.
|
|
423
|
+
labelStyle: {
|
|
424
|
+
color: trigger.color,
|
|
425
|
+
fontFamily: trigger.fontFamily,
|
|
426
|
+
fontWeight: trigger.fontWeight,
|
|
427
|
+
fontSize: trigger.fontSize,
|
|
428
|
+
lineHeight: trigger.lineHeight
|
|
429
|
+
},
|
|
430
|
+
glyph: {
|
|
431
|
+
size: indicator.fontSize,
|
|
432
|
+
color: typeof indicator.color === "string" ? indicator.color : void 0
|
|
433
|
+
},
|
|
434
|
+
isDisabled,
|
|
435
|
+
isExpanded,
|
|
436
|
+
toggle
|
|
437
|
+
};
|
|
438
|
+
}, [styles, pressed, tint, isDisabled, isExpanded, toggle]);
|
|
439
|
+
const rootStyle = [styles.root, _optionalChain([tint, 'optionalAccess', _4 => _4.root]), styleProps, style];
|
|
440
|
+
const items = _react.Children.toArray(children);
|
|
441
|
+
const rows = items.map((child, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
442
|
+
child,
|
|
443
|
+
hasSeparator && index < items.length - 1 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, { layout: LAYOUT, style: styles.separator }) : null
|
|
444
|
+
] }, index));
|
|
445
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AccordionProvider, { value: context, children: asChild ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7GHM4GKLcjs.Slot, { ref, ...rest, style: rootStyle, children }) : (
|
|
446
|
+
// Two layers, and the only place in the library where a root has one inside it.
|
|
447
|
+
// A single layer cannot both cast a shadow and clip its children on iOS, and this
|
|
448
|
+
// component needs both: `primary` is lifted, and a pressed row has to be cut
|
|
449
|
+
// against the card's rounded corner rather than painting over it.
|
|
450
|
+
//
|
|
451
|
+
// The layout transition is on each of them as well as on every row. Without it on
|
|
452
|
+
// the outer one the accordion's own height jumps to its new total in one frame
|
|
453
|
+
// while the rows inside it are still animating.
|
|
454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, { ref, layout: LAYOUT, ...rest, style: rootStyle, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, { layout: LAYOUT, style: styles.container, children: rows }) })
|
|
455
|
+
) });
|
|
456
|
+
});
|
|
457
|
+
AccordionRoot.displayName = "XAUI.Accordion.Root";
|
|
458
|
+
|
|
459
|
+
// src/components/accordion/index.ts
|
|
460
|
+
var Accordion2 = Object.assign(AccordionRoot, {
|
|
461
|
+
Item: AccordionItem,
|
|
462
|
+
Trigger: AccordionTrigger,
|
|
463
|
+
Indicator: AccordionIndicator,
|
|
464
|
+
Content: AccordionContent
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
exports.LAYOUT = LAYOUT; exports.useAccordion = useAccordion; exports.useAccordionItem = useAccordionItem; exports.AccordionContent = AccordionContent; exports.AccordionIndicator = AccordionIndicator; exports.AccordionItem = AccordionItem; exports.AccordionTrigger = AccordionTrigger; exports.accordionRecipe = accordionRecipe; exports.AccordionRoot = AccordionRoot; exports.Accordion = Accordion2;
|