@xaui/native 0.9.1-alpha.40 → 0.9.1-alpha.42
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-TJ74XVZN.cjs → chunk-3JXI2IHV.cjs} +8 -8
- package/dist/{chunk-C5YLPCFC.cjs → chunk-4KSKQD37.cjs} +5 -5
- package/dist/{chunk-DA3OKXHV.cjs → chunk-54CWXA34.cjs} +59 -59
- package/dist/{chunk-XV735BSA.cjs → chunk-66FOASTP.cjs} +6 -6
- package/dist/{chunk-UFTCTTKK.js → chunk-6CO6FM67.js} +15 -15
- package/dist/{chunk-RU7JCMWC.cjs → chunk-76XDVA24.cjs} +6 -6
- package/dist/{chunk-G7P3ERYF.cjs → chunk-7KLBTMXV.cjs} +5 -5
- package/dist/{chunk-NWGLP6JX.cjs → chunk-7TOG4TVU.cjs} +15 -15
- package/dist/{chunk-ZFOOJK37.cjs → chunk-AAVCMCJ3.cjs} +2 -2
- package/dist/{chunk-T5FV5F7A.cjs → chunk-C5LONNXT.cjs} +6 -6
- package/dist/{chunk-XFPQFCEK.js → chunk-DY3SUG5P.js} +6 -6
- package/dist/{chunk-KCMYU7WF.js → chunk-EYD4H4X6.js} +1 -1
- package/dist/{chunk-DHGLGSH6.js → chunk-FBCWNXZC.js} +58 -58
- package/dist/{chunk-2XPG2243.js → chunk-GJSFKH4L.js} +16 -16
- package/dist/{chunk-DD4276RF.js → chunk-HA6BFY3A.js} +6 -6
- package/dist/{chunk-GFUZ3MUT.cjs → chunk-HOI5425P.cjs} +6 -6
- package/dist/{chunk-LRN3RNDO.js → chunk-JKP4TPIL.js} +16 -16
- package/dist/{chunk-6UEZJRVI.js → chunk-LIUO6D3D.js} +75 -75
- package/dist/{chunk-DIBUQ46Y.js → chunk-MXGER5PI.js} +5 -5
- package/dist/{chunk-EZEYMLO3.js → chunk-N5AEXTUM.js} +4 -4
- package/dist/chunk-NA262TF2.js +724 -0
- package/dist/{chunk-R73XQK7X.cjs → chunk-NCCRQK3P.cjs} +5 -5
- package/dist/{chunk-5VKYNBNA.js → chunk-NHZRQM5J.js} +4 -4
- package/dist/chunk-QWMVMLSU.cjs +407 -0
- package/dist/{chunk-GA6PBWNT.js → chunk-QZ24MZRX.js} +1 -1
- package/dist/{chunk-YVHT2UVW.js → chunk-R7BU4CPS.js} +1 -1
- package/dist/{chunk-6DOLGZVV.cjs → chunk-S4QUM4EE.cjs} +4 -4
- package/dist/{chunk-DG2I4PJG.js → chunk-SACDOFGF.js} +15 -15
- package/dist/{chunk-ABAGZTXZ.cjs → chunk-SIP5J7HU.cjs} +15 -15
- package/dist/{chunk-3E7CDKFO.cjs → chunk-TGMVEHV7.cjs} +61 -61
- package/dist/{chunk-YGYYJ3LQ.js → chunk-TRETQZEW.js} +5 -5
- package/dist/{chunk-UAWBAD4E.cjs → chunk-URA25DU4.cjs} +5 -5
- package/dist/{chunk-BRRXFOBY.js → chunk-USF6EWYR.js} +7 -7
- package/dist/{chunk-5R26NM4M.cjs → chunk-VPQPFLT5.cjs} +6 -6
- package/dist/chunk-VT34G7RT.js +518 -0
- package/dist/{chunk-7YF5NAHQ.cjs → chunk-VZK3NLBH.cjs} +7 -7
- package/dist/{chunk-N3KTZMPG.js → chunk-XNMZQSY5.js} +5 -5
- package/dist/chunk-ZTBA7CNK.cjs +510 -0
- package/dist/components/accordion/index.cjs +5 -5
- package/dist/components/accordion/index.js +4 -4
- package/dist/components/alert/index.cjs +6 -6
- package/dist/components/alert/index.js +5 -5
- package/dist/components/avatar/index.cjs +4 -4
- package/dist/components/avatar/index.js +3 -3
- package/dist/components/badge/index.cjs +4 -4
- package/dist/components/badge/index.js +3 -3
- package/dist/components/button/index.cjs +5 -5
- package/dist/components/button/index.js +4 -4
- package/dist/components/card/index.cjs +5 -5
- package/dist/components/card/index.js +4 -4
- package/dist/components/checkbox/index.cjs +5 -5
- package/dist/components/checkbox/index.js +4 -4
- package/dist/components/chip/index.cjs +6 -6
- package/dist/components/chip/index.js +5 -5
- package/dist/components/divider/index.cjs +4 -4
- package/dist/components/divider/index.js +3 -3
- package/dist/components/field-group/index.cjs +5 -5
- package/dist/components/field-group/index.js +4 -4
- package/dist/components/input-otp/index.cjs +4 -4
- package/dist/components/input-otp/index.js +3 -3
- package/dist/components/menu/index.cjs +5 -5
- package/dist/components/menu/index.js +4 -4
- package/dist/components/popover/index.cjs +5 -5
- package/dist/components/popover/index.js +4 -4
- package/dist/components/radio/index.cjs +5 -5
- package/dist/components/radio/index.js +4 -4
- package/dist/components/select/index.cjs +5 -5
- package/dist/components/select/index.js +4 -4
- package/dist/components/slider/index.cjs +33 -0
- package/dist/components/slider/index.d.cts +284 -0
- package/dist/components/slider/index.d.ts +284 -0
- package/dist/components/slider/index.js +33 -0
- package/dist/components/spinner/index.cjs +1 -1
- package/dist/components/spinner/index.js +1 -1
- package/dist/components/switch/index.cjs +5 -5
- package/dist/components/switch/index.js +4 -4
- package/dist/components/tabs/index.cjs +33 -0
- package/dist/components/tabs/index.d.cts +261 -0
- package/dist/components/tabs/index.d.ts +261 -0
- package/dist/components/tabs/index.js +33 -0
- package/dist/components/text-area/index.cjs +5 -5
- package/dist/components/text-area/index.js +4 -4
- package/dist/components/text-field/index.cjs +4 -4
- package/dist/components/text-field/index.js +3 -3
- package/dist/components/typography/index.cjs +4 -4
- package/dist/components/typography/index.js +3 -3
- package/dist/index.cjs +73 -27
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +84 -38
- package/dist/system/index.cjs +7 -7
- package/dist/system/index.js +7 -7
- package/package.json +21 -1
- package/dist/{chunk-4CUZZWFW.js → chunk-26OGEFQI.js} +3 -3
- package/dist/{chunk-H7DS4IO7.js → chunk-346QBNUD.js} +4 -4
- package/dist/{chunk-J3MB4PI5.cjs → chunk-A7YB7YWX.cjs} +3 -3
- package/dist/{chunk-AMCSSOJT.cjs → chunk-BNFIFRQA.cjs} +3 -3
- package/dist/{chunk-6L2TS2R3.cjs → chunk-KSUV74BE.cjs} +3 -3
- package/dist/{chunk-HDVVZG4S.cjs → chunk-RKCWYUGA.cjs} +3 -3
- package/dist/{chunk-2NRZKJG7.js → chunk-S2WNWMNT.js} +4 -4
- package/dist/{chunk-73RKQC5X.js → chunk-SZLXPF3G.js} +3 -3
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
import { useControllableState } from "./chunk-F6W3JQ7K.js";
|
|
2
|
+
import { PressableFeedback } from "./chunk-LIUO6D3D.js";
|
|
3
|
+
import { usePressState } from "./chunk-423RQBOX.js";
|
|
4
|
+
import { childrenToString, createSlotContext } from "./chunk-K72UDPVN.js";
|
|
5
|
+
import { createRecipe, radiusAxis } from "./chunk-4GTAZM2C.js";
|
|
6
|
+
import { useXAUITheme } from "./chunk-A3EGFI6T.js";
|
|
7
|
+
import { useStyleProps } from "./chunk-M63GFNKV.js";
|
|
8
|
+
|
|
9
|
+
// src/components/tabs/tabs-content.tsx
|
|
10
|
+
import { forwardRef } from "react";
|
|
11
|
+
import { View } from "react-native";
|
|
12
|
+
|
|
13
|
+
// src/components/tabs/tabs.context.ts
|
|
14
|
+
var [TabsProvider, useTabs] = createSlotContext("Tabs");
|
|
15
|
+
var [TabsTriggerProvider, useTabsTrigger] = createSlotContext("Tabs.Trigger");
|
|
16
|
+
|
|
17
|
+
// src/components/tabs/tabs-content.tsx
|
|
18
|
+
import { jsx } from "react/jsx-runtime";
|
|
19
|
+
var TabsContent = forwardRef(function TabsContent2({
|
|
20
|
+
value,
|
|
21
|
+
children,
|
|
22
|
+
accessibilityRole = "tab",
|
|
23
|
+
style,
|
|
24
|
+
...props
|
|
25
|
+
}, ref) {
|
|
26
|
+
const {
|
|
27
|
+
value: selected
|
|
28
|
+
} = useTabs();
|
|
29
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
30
|
+
if (selected !== value) return null;
|
|
31
|
+
return /* @__PURE__ */jsx(View, {
|
|
32
|
+
ref,
|
|
33
|
+
accessibilityRole,
|
|
34
|
+
...rest,
|
|
35
|
+
style: [styleProps, style],
|
|
36
|
+
children
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
TabsContent.displayName = "XAUI.Tabs.Content";
|
|
40
|
+
|
|
41
|
+
// src/components/tabs/tabs-indicator.tsx
|
|
42
|
+
import { useEffect } from "react";
|
|
43
|
+
import Animated, { useAnimatedStyle, useSharedValue, withSpring } from "react-native-reanimated";
|
|
44
|
+
|
|
45
|
+
// src/components/tabs/tabs.animation.ts
|
|
46
|
+
var INDICATOR_SPRING = {
|
|
47
|
+
damping: 20,
|
|
48
|
+
stiffness: 220,
|
|
49
|
+
mass: 0.6
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// src/components/tabs/tabs-indicator.tsx
|
|
53
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
54
|
+
const _worklet_8628400712537_init_data = {
|
|
55
|
+
code: "function chunkVT34G7RTJs1(){const{x,width,hasArrived}=this.__closure;return{transform:[{translateX:x.get()}],width:width.get(),opacity:hasArrived.get()?1:0};}",
|
|
56
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-VT34G7RT.js",
|
|
57
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunkVT34G7RTJs1\",\"x\",\"width\",\"hasArrived\",\"__closure\",\"transform\",\"translateX\",\"get\",\"opacity\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-VT34G7RT.js\"],\"mappings\":\"AAkFkC,SAAAA,iBAAA,QAAAC,CAAA,CAAAC,KAAA,CAAAC,UAAA,OAAAC,SAAA,OAAO,CACrCC,SAAS,CAAE,CAAC,CAAEC,UAAU,CAAEL,CAAC,CAACM,GAAG,CAAC,CAAE,CAAC,CAAC,CACpCL,KAAK,CAAEA,KAAK,CAACK,GAAG,CAAC,CAAC,CAClBC,OAAO,CAAEL,UAAU,CAACI,GAAG,CAAC,CAAC,CAAG,CAAC,CAAG,CAClC,CAAC\",\"ignoreList\":[]}"
|
|
58
|
+
};
|
|
59
|
+
function TabsIndicator({
|
|
60
|
+
style,
|
|
61
|
+
...props
|
|
62
|
+
}) {
|
|
63
|
+
const {
|
|
64
|
+
indicatorStyle,
|
|
65
|
+
value,
|
|
66
|
+
rects
|
|
67
|
+
} = useTabs();
|
|
68
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
69
|
+
const rect = value === void 0 ? void 0 : rects[value];
|
|
70
|
+
const x = useSharedValue(rect?.x ?? 0);
|
|
71
|
+
const width = useSharedValue(rect?.width ?? 0);
|
|
72
|
+
const hasArrived = useSharedValue(rect !== void 0);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (rect === void 0) return;
|
|
75
|
+
if (hasArrived.get()) {
|
|
76
|
+
x.set(withSpring(rect.x, INDICATOR_SPRING));
|
|
77
|
+
width.set(withSpring(rect.width, INDICATOR_SPRING));
|
|
78
|
+
} else {
|
|
79
|
+
x.set(rect.x);
|
|
80
|
+
width.set(rect.width);
|
|
81
|
+
hasArrived.set(true);
|
|
82
|
+
}
|
|
83
|
+
}, [rect, hasArrived, width, x]);
|
|
84
|
+
const travel = useAnimatedStyle(function chunkVT34G7RTJs1Factory({
|
|
85
|
+
_worklet_8628400712537_init_data,
|
|
86
|
+
x,
|
|
87
|
+
width,
|
|
88
|
+
hasArrived
|
|
89
|
+
}) {
|
|
90
|
+
const _e = [new global.Error(), -4, -27];
|
|
91
|
+
const chunkVT34G7RTJs1 = () => ({
|
|
92
|
+
transform: [{
|
|
93
|
+
translateX: x.get()
|
|
94
|
+
}],
|
|
95
|
+
width: width.get(),
|
|
96
|
+
opacity: hasArrived.get() ? 1 : 0
|
|
97
|
+
});
|
|
98
|
+
chunkVT34G7RTJs1.__closure = {
|
|
99
|
+
x,
|
|
100
|
+
width,
|
|
101
|
+
hasArrived
|
|
102
|
+
};
|
|
103
|
+
chunkVT34G7RTJs1.__workletHash = 8628400712537;
|
|
104
|
+
chunkVT34G7RTJs1.__pluginVersion = "0.7.4";
|
|
105
|
+
chunkVT34G7RTJs1.__initData = _worklet_8628400712537_init_data;
|
|
106
|
+
chunkVT34G7RTJs1.__stackDetails = _e;
|
|
107
|
+
return chunkVT34G7RTJs1;
|
|
108
|
+
}({
|
|
109
|
+
_worklet_8628400712537_init_data,
|
|
110
|
+
x,
|
|
111
|
+
width,
|
|
112
|
+
hasArrived
|
|
113
|
+
}));
|
|
114
|
+
return /* @__PURE__ */jsx2(Animated.View, {
|
|
115
|
+
...rest,
|
|
116
|
+
style: [indicatorStyle, travel, styleProps, style]
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
TabsIndicator.displayName = "XAUI.Tabs.Indicator";
|
|
120
|
+
|
|
121
|
+
// src/components/tabs/tabs-label.tsx
|
|
122
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
123
|
+
import { Text } from "react-native";
|
|
124
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
125
|
+
var TabsLabel = forwardRef2(function TabsLabel2({
|
|
126
|
+
children,
|
|
127
|
+
numberOfLines = 1,
|
|
128
|
+
style,
|
|
129
|
+
...props
|
|
130
|
+
}, ref) {
|
|
131
|
+
const {
|
|
132
|
+
labelStyle,
|
|
133
|
+
labelSelectedStyle
|
|
134
|
+
} = useTabs();
|
|
135
|
+
const {
|
|
136
|
+
isSelected
|
|
137
|
+
} = useTabsTrigger();
|
|
138
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
139
|
+
return /* @__PURE__ */jsx3(Text, {
|
|
140
|
+
ref,
|
|
141
|
+
numberOfLines,
|
|
142
|
+
...rest,
|
|
143
|
+
style: [labelStyle, isSelected && labelSelectedStyle, styleProps, style],
|
|
144
|
+
children
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
TabsLabel.displayName = "XAUI.Tabs.Label";
|
|
148
|
+
|
|
149
|
+
// src/components/tabs/tabs-list.tsx
|
|
150
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
151
|
+
import { View as View2 } from "react-native";
|
|
152
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
153
|
+
var TabsList = forwardRef3(function TabsList2({
|
|
154
|
+
children,
|
|
155
|
+
accessibilityRole = "tablist",
|
|
156
|
+
style,
|
|
157
|
+
...props
|
|
158
|
+
}, ref) {
|
|
159
|
+
const {
|
|
160
|
+
listStyle
|
|
161
|
+
} = useTabs();
|
|
162
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
163
|
+
return /* @__PURE__ */jsx4(View2, {
|
|
164
|
+
ref,
|
|
165
|
+
accessibilityRole,
|
|
166
|
+
...rest,
|
|
167
|
+
style: [listStyle, styleProps, style],
|
|
168
|
+
children
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
TabsList.displayName = "XAUI.Tabs.List";
|
|
172
|
+
|
|
173
|
+
// src/components/tabs/tabs-trigger.tsx
|
|
174
|
+
import { forwardRef as forwardRef4, useCallback, useMemo } from "react";
|
|
175
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
176
|
+
var TabsTrigger = forwardRef4(function TabsTrigger2({
|
|
177
|
+
value,
|
|
178
|
+
children,
|
|
179
|
+
isDisabled = false,
|
|
180
|
+
asChild = false,
|
|
181
|
+
accessibilityRole = "tab",
|
|
182
|
+
accessibilityState,
|
|
183
|
+
style,
|
|
184
|
+
onLayout,
|
|
185
|
+
onPress,
|
|
186
|
+
onPressIn,
|
|
187
|
+
onPressOut,
|
|
188
|
+
...props
|
|
189
|
+
}, ref) {
|
|
190
|
+
const {
|
|
191
|
+
triggerStyle,
|
|
192
|
+
value: selected,
|
|
193
|
+
isDisabled: isRootDisabled,
|
|
194
|
+
select,
|
|
195
|
+
setRect
|
|
196
|
+
} = useTabs();
|
|
197
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
198
|
+
const [isPressed, press] = usePressState({
|
|
199
|
+
onPressIn,
|
|
200
|
+
onPressOut
|
|
201
|
+
});
|
|
202
|
+
const isSelected = selected === value;
|
|
203
|
+
const disabled = isRootDisabled || isDisabled;
|
|
204
|
+
const measure = useCallback(event => {
|
|
205
|
+
onLayout?.(event);
|
|
206
|
+
const {
|
|
207
|
+
x,
|
|
208
|
+
width
|
|
209
|
+
} = event.nativeEvent.layout;
|
|
210
|
+
setRect(value, {
|
|
211
|
+
x,
|
|
212
|
+
width
|
|
213
|
+
});
|
|
214
|
+
}, [onLayout, setRect, value]);
|
|
215
|
+
const handlePress = useCallback(event => {
|
|
216
|
+
onPress?.(event);
|
|
217
|
+
select(value);
|
|
218
|
+
}, [onPress, select, value]);
|
|
219
|
+
const context = useMemo(() => ({
|
|
220
|
+
isSelected,
|
|
221
|
+
isPressed,
|
|
222
|
+
isDisabled: disabled
|
|
223
|
+
}), [isSelected, isPressed, disabled]);
|
|
224
|
+
const text = typeof children === "function" ? null : childrenToString(children);
|
|
225
|
+
return /* @__PURE__ */jsx5(TabsTriggerProvider, {
|
|
226
|
+
value: context,
|
|
227
|
+
children: /* @__PURE__ */jsx5(PressableFeedback, {
|
|
228
|
+
ref,
|
|
229
|
+
isPressed,
|
|
230
|
+
isDisabled: disabled,
|
|
231
|
+
asChild,
|
|
232
|
+
accessibilityRole,
|
|
233
|
+
accessibilityState: {
|
|
234
|
+
disabled,
|
|
235
|
+
selected: isSelected,
|
|
236
|
+
...accessibilityState
|
|
237
|
+
},
|
|
238
|
+
...rest,
|
|
239
|
+
onLayout: measure,
|
|
240
|
+
style: [triggerStyle, styleProps, typeof style === "function" ? style({
|
|
241
|
+
pressed: isPressed
|
|
242
|
+
}) : style],
|
|
243
|
+
onPress: handlePress,
|
|
244
|
+
onPressIn: press.onPressIn,
|
|
245
|
+
onPressOut: press.onPressOut,
|
|
246
|
+
children: typeof children === "function" ? children(context) : text !== null ?
|
|
247
|
+
// R3 — a stringifiable tab becomes its label, which is what makes the common
|
|
248
|
+
// case `<Tabs.Trigger value="all">Tout</Tabs.Trigger>`.
|
|
249
|
+
/* @__PURE__ */
|
|
250
|
+
jsx5(TabsLabel, {
|
|
251
|
+
children: text
|
|
252
|
+
}) : children
|
|
253
|
+
})
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
TabsTrigger.displayName = "XAUI.Tabs.Trigger";
|
|
257
|
+
|
|
258
|
+
// src/components/tabs/tabs.tsx
|
|
259
|
+
import { forwardRef as forwardRef5, useCallback as useCallback2, useMemo as useMemo2, useState } from "react";
|
|
260
|
+
import { StyleSheet, View as View3 } from "react-native";
|
|
261
|
+
|
|
262
|
+
// src/components/tabs/tabs.recipe.ts
|
|
263
|
+
var SLOTS = ["root", "list", "trigger", "label", "indicator", "content"];
|
|
264
|
+
var VARIANT_TOKENS = {
|
|
265
|
+
primary: {
|
|
266
|
+
bg: "default",
|
|
267
|
+
bgSelected: "segment",
|
|
268
|
+
fgSelected: "segmentForeground"
|
|
269
|
+
},
|
|
270
|
+
secondary: {
|
|
271
|
+
bgSelected: "accent",
|
|
272
|
+
fgSelected: "foreground"
|
|
273
|
+
},
|
|
274
|
+
// The accent rather than the foreground: with nothing else moving, the colour is the
|
|
275
|
+
// whole signal, and a chosen tab in plain ink reads as one that is merely darker.
|
|
276
|
+
light: {
|
|
277
|
+
fgSelected: "accent"
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
var SIZES = {
|
|
281
|
+
sm: {
|
|
282
|
+
paddingHorizontal: 2.5,
|
|
283
|
+
paddingVertical: 1,
|
|
284
|
+
gap: 1,
|
|
285
|
+
label: "sm"
|
|
286
|
+
},
|
|
287
|
+
md: {
|
|
288
|
+
paddingHorizontal: 3,
|
|
289
|
+
paddingVertical: 1.5,
|
|
290
|
+
gap: 1.5,
|
|
291
|
+
label: "md"
|
|
292
|
+
},
|
|
293
|
+
lg: {
|
|
294
|
+
paddingHorizontal: 4,
|
|
295
|
+
paddingVertical: 2,
|
|
296
|
+
gap: 2,
|
|
297
|
+
label: "lg"
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
var TRACK_INSET = 3;
|
|
301
|
+
function sizeAxis(step) {
|
|
302
|
+
const {
|
|
303
|
+
paddingHorizontal,
|
|
304
|
+
paddingVertical,
|
|
305
|
+
gap,
|
|
306
|
+
label
|
|
307
|
+
} = step;
|
|
308
|
+
return theme => ({
|
|
309
|
+
trigger: {
|
|
310
|
+
paddingHorizontal: theme.spacing(paddingHorizontal),
|
|
311
|
+
paddingVertical: theme.spacing(paddingVertical),
|
|
312
|
+
gap: theme.spacing(gap)
|
|
313
|
+
},
|
|
314
|
+
label: {
|
|
315
|
+
fontSize: theme.fontSizes[label],
|
|
316
|
+
lineHeight: theme.lineHeights[label]
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
var tabsRecipe = createRecipe({
|
|
321
|
+
slots: SLOTS,
|
|
322
|
+
base: theme => ({
|
|
323
|
+
root: {
|
|
324
|
+
flexDirection: "column",
|
|
325
|
+
gap: theme.spacing(2)
|
|
326
|
+
},
|
|
327
|
+
list: {
|
|
328
|
+
// Hugs its tabs rather than filling the row. A tab bar as wide as the screen with
|
|
329
|
+
// three tabs in it is a segmented control pretending to be a navigation bar.
|
|
330
|
+
alignSelf: "flex-start",
|
|
331
|
+
flexDirection: "row",
|
|
332
|
+
alignItems: "center",
|
|
333
|
+
borderCurve: "continuous"
|
|
334
|
+
},
|
|
335
|
+
trigger: {
|
|
336
|
+
flexDirection: "row",
|
|
337
|
+
alignItems: "center",
|
|
338
|
+
justifyContent: "center"
|
|
339
|
+
},
|
|
340
|
+
label: {
|
|
341
|
+
fontFamily: theme.fontFamilies.body,
|
|
342
|
+
fontWeight: theme.fontWeights.medium,
|
|
343
|
+
color: theme.colors.muted
|
|
344
|
+
},
|
|
345
|
+
// Behind the triggers, not over them: it is the surface the chosen tab sits on.
|
|
346
|
+
indicator: {
|
|
347
|
+
position: "absolute",
|
|
348
|
+
zIndex: 0,
|
|
349
|
+
borderCurve: "continuous"
|
|
350
|
+
}
|
|
351
|
+
}),
|
|
352
|
+
variantTokens: VARIANT_TOKENS,
|
|
353
|
+
paint: (_theme, colors) => ({
|
|
354
|
+
list: {
|
|
355
|
+
backgroundColor: colors.bg
|
|
356
|
+
},
|
|
357
|
+
indicator: {
|
|
358
|
+
backgroundColor: colors.bgSelected
|
|
359
|
+
},
|
|
360
|
+
// Read by the root and handed to the chosen trigger's label alone, which is why it is
|
|
361
|
+
// on a slot the recipe otherwise leaves to `muted`.
|
|
362
|
+
content: {
|
|
363
|
+
color: colors.fgSelected
|
|
364
|
+
}
|
|
365
|
+
}),
|
|
366
|
+
variants: {
|
|
367
|
+
size: {
|
|
368
|
+
sm: sizeAxis(SIZES.sm),
|
|
369
|
+
md: sizeAxis(SIZES.md),
|
|
370
|
+
lg: sizeAxis(SIZES.lg)
|
|
371
|
+
},
|
|
372
|
+
radius: radiusAxis("list", "indicator")
|
|
373
|
+
},
|
|
374
|
+
/**
|
|
375
|
+
* Where the shapes differ, and `light` is absent on purpose: the base gives the list no
|
|
376
|
+
* padding, no corner and no edge, so a shape that adds none of them is the base itself.
|
|
377
|
+
* `primary` is a pill inside a filled track, so the track is padded and both corners are
|
|
378
|
+
* round; `secondary` is a rule along a bottom edge, so the track carries a hairline and
|
|
379
|
+
* the indicator is that rule.
|
|
380
|
+
*/
|
|
381
|
+
compoundVariants: [{
|
|
382
|
+
when: {
|
|
383
|
+
variant: "primary"
|
|
384
|
+
},
|
|
385
|
+
style: theme => ({
|
|
386
|
+
list: {
|
|
387
|
+
padding: TRACK_INSET,
|
|
388
|
+
borderRadius: theme.radius["3xl"]
|
|
389
|
+
},
|
|
390
|
+
indicator: {
|
|
391
|
+
top: TRACK_INSET,
|
|
392
|
+
bottom: TRACK_INSET,
|
|
393
|
+
borderRadius: theme.radius["3xl"],
|
|
394
|
+
...theme.shadows.surface
|
|
395
|
+
}
|
|
396
|
+
})
|
|
397
|
+
}, {
|
|
398
|
+
when: {
|
|
399
|
+
variant: "secondary"
|
|
400
|
+
},
|
|
401
|
+
style: theme => ({
|
|
402
|
+
list: {
|
|
403
|
+
borderBottomWidth: theme.borderWidth.default,
|
|
404
|
+
borderColor: theme.colors.border
|
|
405
|
+
},
|
|
406
|
+
// Two points rather than a hairline: a rule that says which tab is chosen has to
|
|
407
|
+
// outweigh the one it sits on.
|
|
408
|
+
indicator: {
|
|
409
|
+
bottom: 0,
|
|
410
|
+
height: 2,
|
|
411
|
+
borderRadius: 0
|
|
412
|
+
}
|
|
413
|
+
})
|
|
414
|
+
}],
|
|
415
|
+
states: {
|
|
416
|
+
disabled: theme => ({
|
|
417
|
+
list: {
|
|
418
|
+
opacity: theme.opacity.disabled
|
|
419
|
+
}
|
|
420
|
+
})
|
|
421
|
+
},
|
|
422
|
+
defaultVariants: {
|
|
423
|
+
variant: "primary",
|
|
424
|
+
size: "md"
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
// src/components/tabs/tabs.tsx
|
|
429
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
430
|
+
var TabsRoot = forwardRef5(function Tabs({
|
|
431
|
+
children,
|
|
432
|
+
variant,
|
|
433
|
+
size,
|
|
434
|
+
radius,
|
|
435
|
+
color,
|
|
436
|
+
value: controlledValue,
|
|
437
|
+
defaultValue,
|
|
438
|
+
onValueChange,
|
|
439
|
+
isDisabled = false,
|
|
440
|
+
style,
|
|
441
|
+
...props
|
|
442
|
+
}, ref) {
|
|
443
|
+
const theme = useXAUITheme();
|
|
444
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
445
|
+
const [rects, setRects] = useState({});
|
|
446
|
+
const [value, setValue] = useControllableState({
|
|
447
|
+
value: controlledValue,
|
|
448
|
+
defaultValue,
|
|
449
|
+
onChange: onValueChange
|
|
450
|
+
});
|
|
451
|
+
const selection = {
|
|
452
|
+
variant,
|
|
453
|
+
size,
|
|
454
|
+
radius
|
|
455
|
+
};
|
|
456
|
+
const styles = tabsRecipe.resolve({
|
|
457
|
+
theme,
|
|
458
|
+
selection,
|
|
459
|
+
states: {
|
|
460
|
+
disabled: isDisabled
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
const tint = color ? tabsRecipe.tint({
|
|
464
|
+
theme,
|
|
465
|
+
color,
|
|
466
|
+
selection
|
|
467
|
+
}) : void 0;
|
|
468
|
+
const select = useCallback2(next => setValue(next), [setValue]);
|
|
469
|
+
const setRect = useCallback2((tab, rect) => {
|
|
470
|
+
setRects(current => {
|
|
471
|
+
const previous = current[tab];
|
|
472
|
+
if (previous && previous.x === rect.x && previous.width === rect.width) return current;
|
|
473
|
+
return {
|
|
474
|
+
...current,
|
|
475
|
+
[tab]: rect
|
|
476
|
+
};
|
|
477
|
+
});
|
|
478
|
+
}, []);
|
|
479
|
+
const context = useMemo2(() => {
|
|
480
|
+
const selected = StyleSheet.flatten([styles.content, tint?.content]);
|
|
481
|
+
return {
|
|
482
|
+
listStyle: tint ? [styles.list, tint.list] : styles.list,
|
|
483
|
+
triggerStyle: styles.trigger,
|
|
484
|
+
labelStyle: styles.label,
|
|
485
|
+
labelSelectedStyle: {
|
|
486
|
+
color: selected.color
|
|
487
|
+
},
|
|
488
|
+
indicatorStyle: tint ? [styles.indicator, tint.indicator] : styles.indicator,
|
|
489
|
+
contentStyle: void 0,
|
|
490
|
+
variant: variant ?? "primary",
|
|
491
|
+
value,
|
|
492
|
+
isDisabled,
|
|
493
|
+
select,
|
|
494
|
+
rects,
|
|
495
|
+
setRect
|
|
496
|
+
};
|
|
497
|
+
}, [styles, tint, variant, value, isDisabled, select, rects, setRect]);
|
|
498
|
+
return /* @__PURE__ */jsx6(TabsProvider, {
|
|
499
|
+
value: context,
|
|
500
|
+
children: /* @__PURE__ */jsx6(View3, {
|
|
501
|
+
ref,
|
|
502
|
+
...rest,
|
|
503
|
+
style: [styles.root, styleProps, style],
|
|
504
|
+
children
|
|
505
|
+
})
|
|
506
|
+
});
|
|
507
|
+
});
|
|
508
|
+
TabsRoot.displayName = "XAUI.Tabs.Root";
|
|
509
|
+
|
|
510
|
+
// src/components/tabs/index.ts
|
|
511
|
+
var Tabs2 = Object.assign(TabsRoot, {
|
|
512
|
+
List: TabsList,
|
|
513
|
+
Trigger: TabsTrigger,
|
|
514
|
+
Label: TabsLabel,
|
|
515
|
+
Indicator: TabsIndicator,
|
|
516
|
+
Content: TabsContent
|
|
517
|
+
});
|
|
518
|
+
export { useTabs, useTabsTrigger, TabsContent, TabsIndicator, TabsLabel, TabsList, TabsTrigger, tabsRecipe, TabsRoot, Tabs2 as Tabs };
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkA7YB7YWXcjs = require('./chunk-A7YB7YWX.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _chunk7GHM4GKLcjs = require('./chunk-7GHM4GKL.cjs');
|
|
@@ -23,7 +23,7 @@ var [TextAreaProvider, useTextArea] = _chunk7GHM4GKLcjs.createSlotContext.call(v
|
|
|
23
23
|
var _jsxruntime = require('react/jsx-runtime');
|
|
24
24
|
var TextAreaField = _react.forwardRef.call(void 0,
|
|
25
25
|
function TextAreaField2({ style, scrollEnabled, ...props }, ref) {
|
|
26
|
-
const { textAreaStyle, textArea } =
|
|
26
|
+
const { textAreaStyle, textArea } = _chunkA7YB7YWXcjs.useTextField.call(void 0, );
|
|
27
27
|
const { rows, maxRows } = useTextArea();
|
|
28
28
|
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
29
29
|
const height = _react.useMemo.call(void 0, () => {
|
|
@@ -37,7 +37,7 @@ var TextAreaField = _react.forwardRef.call(void 0,
|
|
|
37
37
|
};
|
|
38
38
|
}, [rows, maxRows, textArea]);
|
|
39
39
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
40
|
-
|
|
40
|
+
_chunkA7YB7YWXcjs.TextFieldField,
|
|
41
41
|
{
|
|
42
42
|
ref,
|
|
43
43
|
multiline: true,
|
|
@@ -56,16 +56,16 @@ TextAreaField.displayName = "XAUI.TextArea.Field";
|
|
|
56
56
|
var DEFAULT_ROWS = 3;
|
|
57
57
|
var TextAreaRoot = _react.forwardRef.call(void 0, function TextArea({ rows = DEFAULT_ROWS, maxRows, children, ...props }, ref) {
|
|
58
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,
|
|
59
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TextAreaProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA7YB7YWXcjs.TextFieldRoot, { ref, ...props, children }) });
|
|
60
60
|
});
|
|
61
61
|
TextAreaRoot.displayName = "XAUI.TextArea.Root";
|
|
62
62
|
|
|
63
63
|
// src/components/text-area/index.ts
|
|
64
64
|
var TextArea2 = Object.assign(TextAreaRoot, {
|
|
65
|
-
Label:
|
|
65
|
+
Label: _chunkA7YB7YWXcjs.TextFieldLabel,
|
|
66
66
|
Field: TextAreaField,
|
|
67
|
-
Description:
|
|
68
|
-
Error:
|
|
67
|
+
Description: _chunkA7YB7YWXcjs.TextFieldDescription,
|
|
68
|
+
Error: _chunkA7YB7YWXcjs.TextFieldError
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
|
|
@@ -6,10 +6,14 @@ import {
|
|
|
6
6
|
} from "./chunk-F6W3JQ7K.js";
|
|
7
7
|
import {
|
|
8
8
|
PressableFeedback
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LIUO6D3D.js";
|
|
10
10
|
import {
|
|
11
11
|
usePressState
|
|
12
12
|
} from "./chunk-423RQBOX.js";
|
|
13
|
+
import {
|
|
14
|
+
childrenToString,
|
|
15
|
+
createSlotContext
|
|
16
|
+
} from "./chunk-K72UDPVN.js";
|
|
13
17
|
import {
|
|
14
18
|
createRecipe,
|
|
15
19
|
radiusAxis
|
|
@@ -17,10 +21,6 @@ import {
|
|
|
17
21
|
import {
|
|
18
22
|
useXAUITheme
|
|
19
23
|
} from "./chunk-A3EGFI6T.js";
|
|
20
|
-
import {
|
|
21
|
-
childrenToString,
|
|
22
|
-
createSlotContext
|
|
23
|
-
} from "./chunk-K72UDPVN.js";
|
|
24
24
|
import {
|
|
25
25
|
useStyleProps
|
|
26
26
|
} from "./chunk-M63GFNKV.js";
|