@tamagui/demos 1.113.1 → 1.114.0
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/esm/AccordionDemo.native.js +79 -66
- package/dist/esm/AccordionDemo.native.js.map +6 -1
- package/dist/esm/AddThemeDemo.native.js +34 -25
- package/dist/esm/AddThemeDemo.native.js.map +6 -1
- package/dist/esm/AlertDialogDemo.native.js +84 -66
- package/dist/esm/AlertDialogDemo.native.js.map +6 -1
- package/dist/esm/AnimationsDemo.native.js +75 -65
- package/dist/esm/AnimationsDemo.native.js.map +6 -1
- package/dist/esm/AnimationsEnterDemo.native.js +38 -33
- package/dist/esm/AnimationsEnterDemo.native.js.map +6 -1
- package/dist/esm/AnimationsHoverDemo.native.js +6 -4
- package/dist/esm/AnimationsHoverDemo.native.js.map +6 -1
- package/dist/esm/AnimationsPresenceDemo.native.js +91 -78
- package/dist/esm/AnimationsPresenceDemo.native.js.map +6 -1
- package/dist/esm/AnimationsTimingDemo.native.js +6 -4
- package/dist/esm/AnimationsTimingDemo.native.js.map +6 -1
- package/dist/esm/AvatarDemo.native.js +34 -23
- package/dist/esm/AvatarDemo.native.js.map +6 -1
- package/dist/esm/BuildAButtonDemo.native.js +94 -73
- package/dist/esm/BuildAButtonDemo.native.js.map +6 -1
- package/dist/esm/ButtonDemo.native.js +68 -51
- package/dist/esm/ButtonDemo.native.js.map +6 -1
- package/dist/esm/CardDemo.native.js +63 -47
- package/dist/esm/CardDemo.native.js.map +6 -1
- package/dist/esm/CheckboxDemo.native.js +36 -31
- package/dist/esm/CheckboxDemo.native.js.map +6 -1
- package/dist/esm/CheckboxHeadlessDemo.native.js +33 -26
- package/dist/esm/CheckboxHeadlessDemo.native.js.map +6 -1
- package/dist/esm/CheckboxUnstyledDemo.native.js +40 -36
- package/dist/esm/CheckboxUnstyledDemo.native.js.map +6 -1
- package/dist/esm/ColorsDemo.native.js +106 -84
- package/dist/esm/ColorsDemo.native.js.map +6 -1
- package/dist/esm/DialogDemo.native.js +156 -122
- package/dist/esm/DialogDemo.native.js.map +6 -1
- package/dist/esm/FormsDemo.native.js +25 -18
- package/dist/esm/FormsDemo.native.js.map +6 -1
- package/dist/esm/Grid.native.js +22 -23
- package/dist/esm/Grid.native.js.map +6 -1
- package/dist/esm/GroupDemo.native.js +72 -55
- package/dist/esm/GroupDemo.native.js.map +6 -1
- package/dist/esm/HeadingsDemo.native.js +25 -16
- package/dist/esm/HeadingsDemo.native.js.map +6 -1
- package/dist/esm/ImageDemo.native.js +5 -3
- package/dist/esm/ImageDemo.native.js.map +6 -1
- package/dist/esm/InputsDemo.native.js +31 -21
- package/dist/esm/InputsDemo.native.js.map +6 -1
- package/dist/esm/LabelDemo.native.js +40 -29
- package/dist/esm/LabelDemo.native.js.map +6 -1
- package/dist/esm/LinearGradientDemo.native.js +43 -20
- package/dist/esm/LinearGradientDemo.native.js.map +6 -1
- package/dist/esm/ListItemDemo.native.js +63 -50
- package/dist/esm/ListItemDemo.native.js.map +6 -1
- package/dist/esm/LucideIconsDemo.native.js +44 -38
- package/dist/esm/LucideIconsDemo.native.js.map +6 -1
- package/dist/esm/NewInputsDemo.native.js +31 -21
- package/dist/esm/NewInputsDemo.native.js.map +6 -1
- package/dist/esm/PopoverDemo.native.js +139 -108
- package/dist/esm/PopoverDemo.native.js.map +6 -1
- package/dist/esm/ProgressDemo.native.js +85 -68
- package/dist/esm/ProgressDemo.native.js.map +6 -1
- package/dist/esm/RadioGroupDemo.native.js +38 -28
- package/dist/esm/RadioGroupDemo.native.js.map +6 -1
- package/dist/esm/RadioGroupHeadlessDemo.native.js +65 -75
- package/dist/esm/RadioGroupHeadlessDemo.native.js.map +6 -1
- package/dist/esm/RadioGroupUnstyledDemo.native.js +96 -94
- package/dist/esm/RadioGroupUnstyledDemo.native.js.map +6 -1
- package/dist/esm/ReplaceThemeDemo.native.js +29 -25
- package/dist/esm/ReplaceThemeDemo.native.js.map +6 -1
- package/dist/esm/ScrollViewDemo.native.js +48 -37
- package/dist/esm/ScrollViewDemo.native.js.map +6 -1
- package/dist/esm/SelectDemo.native.js +267 -187
- package/dist/esm/SelectDemo.native.js.map +6 -1
- package/dist/esm/SeparatorDemo.native.js +42 -29
- package/dist/esm/SeparatorDemo.native.js.map +6 -1
- package/dist/esm/ShapesDemo.native.js +17 -12
- package/dist/esm/ShapesDemo.native.js.map +6 -1
- package/dist/esm/SheetDemo.native.js +183 -133
- package/dist/esm/SheetDemo.native.js.map +6 -1
- package/dist/esm/SliderDemo.native.js +30 -22
- package/dist/esm/SliderDemo.native.js.map +6 -1
- package/dist/esm/SpinnerDemo.native.js +15 -10
- package/dist/esm/SpinnerDemo.native.js.map +6 -1
- package/dist/esm/StacksDemo.native.js +85 -67
- package/dist/esm/StacksDemo.native.js.map +6 -1
- package/dist/esm/SwitchDemo.native.js +76 -57
- package/dist/esm/SwitchDemo.native.js.map +6 -1
- package/dist/esm/SwitchHeadlessDemo.native.js +63 -45
- package/dist/esm/SwitchHeadlessDemo.native.js.map +6 -1
- package/dist/esm/SwitchUnstyledDemo.native.js +50 -46
- package/dist/esm/SwitchUnstyledDemo.native.js.map +6 -1
- package/dist/esm/TabsAdvancedDemo.native.js +297 -297
- package/dist/esm/TabsAdvancedDemo.native.js.map +6 -1
- package/dist/esm/TabsDemo.native.js +149 -126
- package/dist/esm/TabsDemo.native.js.map +6 -1
- package/dist/esm/TextDemo.native.js +30 -21
- package/dist/esm/TextDemo.native.js.map +6 -1
- package/dist/esm/ThemeBuilderDemo.native.js +170 -137
- package/dist/esm/ThemeBuilderDemo.native.js.map +6 -1
- package/dist/esm/ThemeInverseDemo.native.js +43 -30
- package/dist/esm/ThemeInverseDemo.native.js.map +6 -1
- package/dist/esm/ToastDemo.native.js +83 -73
- package/dist/esm/ToastDemo.native.js.map +6 -1
- package/dist/esm/ToastDuplicateDemo.native.js +61 -45
- package/dist/esm/ToastDuplicateDemo.native.js.map +6 -1
- package/dist/esm/ToggleGroupDemo.native.js +76 -58
- package/dist/esm/ToggleGroupDemo.native.js.map +6 -1
- package/dist/esm/TokensDemo.native.js +107 -94
- package/dist/esm/TokensDemo.native.js.map +6 -1
- package/dist/esm/TooltipDemo.native.js +109 -85
- package/dist/esm/TooltipDemo.native.js.map +6 -1
- package/dist/esm/UpdateThemeDemo.native.js +31 -28
- package/dist/esm/UpdateThemeDemo.native.js.map +6 -1
- package/dist/esm/WebNativeImageDemo.native.js +5 -3
- package/dist/esm/WebNativeImageDemo.native.js.map +6 -1
- package/dist/esm/index.native.js +58 -58
- package/dist/esm/index.native.js.map +6 -1
- package/dist/esm/tamagui.config.native.js +5 -2
- package/dist/esm/tamagui.config.native.js.map +6 -1
- package/dist/esm/useOnIntersecting.native.js +39 -42
- package/dist/esm/useOnIntersecting.native.js.map +6 -1
- package/package.json +19 -19
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { AnimatePresence, Button, H5, SizableText, Tabs, XStack, YStack, styled } from "tamagui";
|
|
4
|
-
var demos = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
var demos = [
|
|
5
|
+
"background",
|
|
6
|
+
"underline"
|
|
7
|
+
], demosTitle = {
|
|
8
|
+
background: "Background Indicator",
|
|
9
|
+
underline: "Underline Indicator"
|
|
10
|
+
}, TabsAdvancedDemo = function() {
|
|
11
|
+
var [demoIndex, setDemoIndex] = React.useState(0), demo = demos[demoIndex];
|
|
12
|
+
return /* @__PURE__ */ _jsxs(_Fragment, {
|
|
13
|
+
children: [
|
|
14
|
+
demo === "underline" ? /* @__PURE__ */ _jsx(TabsAdvancedUnderline, {}) : /* @__PURE__ */ _jsx(TabsAdvancedBackground, {}),
|
|
15
|
+
/* @__PURE__ */ _jsx(XStack, {
|
|
14
16
|
alignItems: "center",
|
|
15
17
|
gap: "$4",
|
|
16
18
|
position: "absolute",
|
|
@@ -19,333 +21,331 @@ var demos = ["background", "underline"],
|
|
|
19
21
|
$xxs: {
|
|
20
22
|
display: "none"
|
|
21
23
|
},
|
|
22
|
-
children: /* @__PURE__ */_jsx(Button, {
|
|
24
|
+
children: /* @__PURE__ */ _jsx(Button, {
|
|
23
25
|
size: "$2",
|
|
24
|
-
onPress: function
|
|
25
|
-
return setDemoIndex(function
|
|
26
|
+
onPress: function() {
|
|
27
|
+
return setDemoIndex(function(x) {
|
|
26
28
|
return (x + 1) % demos.length;
|
|
27
29
|
});
|
|
28
30
|
},
|
|
29
31
|
children: demosTitle[demo]
|
|
30
32
|
})
|
|
31
|
-
})
|
|
33
|
+
})
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
}, TabsAdvancedBackground = function() {
|
|
37
|
+
var [tabState, setTabState] = React.useState(
|
|
38
|
+
/**
|
|
39
|
+
* Layout of the Tab user might intend to select (hovering / focusing)
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* Layout of the Tab user selected
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
* Used to get the direction of activation for animating the active indicator
|
|
46
|
+
*/
|
|
47
|
+
{
|
|
48
|
+
activeAt: null,
|
|
49
|
+
currentTab: "tab1",
|
|
50
|
+
intentAt: null,
|
|
51
|
+
prevActiveAt: null
|
|
52
|
+
}
|
|
53
|
+
), setCurrentTab = function(currentTab2) {
|
|
54
|
+
return setTabState({
|
|
55
|
+
...tabState,
|
|
56
|
+
currentTab: currentTab2
|
|
32
57
|
});
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
activeAt,
|
|
72
|
-
intentAt,
|
|
73
|
-
prevActiveAt,
|
|
74
|
-
currentTab
|
|
75
|
-
} = tabState,
|
|
76
|
-
direction = function () {
|
|
77
|
-
return !activeAt || !prevActiveAt || activeAt.x === prevActiveAt.x ? 0 : activeAt.x > prevActiveAt.x ? -1 : 1;
|
|
78
|
-
}(),
|
|
79
|
-
handleOnInteraction = function (type, layout) {
|
|
80
|
-
type === "select" ? setActiveIndicator(layout) : setIntentIndicator(layout);
|
|
81
|
-
};
|
|
82
|
-
return /* @__PURE__ */_jsxs(Tabs, {
|
|
83
|
-
value: currentTab,
|
|
84
|
-
onValueChange: setCurrentTab,
|
|
85
|
-
orientation: "horizontal",
|
|
86
|
-
size: "$4",
|
|
87
|
-
padding: "$2",
|
|
88
|
-
height: 150,
|
|
89
|
-
flexDirection: "column",
|
|
90
|
-
activationMode: "manual",
|
|
91
|
-
backgroundColor: "$background",
|
|
92
|
-
borderRadius: "$4",
|
|
93
|
-
position: "relative",
|
|
94
|
-
children: [/* @__PURE__ */_jsxs(YStack, {
|
|
95
|
-
children: [/* @__PURE__ */_jsx(AnimatePresence, {
|
|
96
|
-
children: intentAt && /* @__PURE__ */_jsx(TabsRovingIndicator, {
|
|
97
|
-
borderRadius: "$4",
|
|
98
|
-
width: intentAt.width,
|
|
99
|
-
height: intentAt.height,
|
|
100
|
-
x: intentAt.x,
|
|
101
|
-
y: intentAt.y
|
|
102
|
-
})
|
|
103
|
-
}), /* @__PURE__ */_jsx(AnimatePresence, {
|
|
104
|
-
children: activeAt && /* @__PURE__ */_jsx(TabsRovingIndicator, {
|
|
105
|
-
borderRadius: "$4",
|
|
106
|
-
theme: "active",
|
|
107
|
-
width: activeAt.width,
|
|
108
|
-
height: activeAt.height,
|
|
109
|
-
x: activeAt.x,
|
|
110
|
-
y: activeAt.y
|
|
111
|
-
})
|
|
112
|
-
}), /* @__PURE__ */_jsxs(Tabs.List, {
|
|
113
|
-
disablePassBorderRadius: !0,
|
|
114
|
-
loop: !1,
|
|
115
|
-
"aria-label": "Manage your account",
|
|
116
|
-
gap: "$2",
|
|
117
|
-
backgroundColor: "transparent",
|
|
118
|
-
children: [/* @__PURE__ */_jsx(Tabs.Tab, {
|
|
119
|
-
unstyled: !0,
|
|
120
|
-
paddingVertical: "$2",
|
|
121
|
-
paddingHorizontal: "$3",
|
|
122
|
-
value: "tab1",
|
|
123
|
-
onInteraction: handleOnInteraction,
|
|
124
|
-
children: /* @__PURE__ */_jsx(SizableText, {
|
|
125
|
-
children: "Profile"
|
|
126
|
-
})
|
|
127
|
-
}), /* @__PURE__ */_jsx(Tabs.Tab, {
|
|
128
|
-
unstyled: !0,
|
|
129
|
-
paddingVertical: "$2",
|
|
130
|
-
paddingHorizontal: "$3",
|
|
131
|
-
value: "tab2",
|
|
132
|
-
onInteraction: handleOnInteraction,
|
|
133
|
-
children: /* @__PURE__ */_jsx(SizableText, {
|
|
134
|
-
children: "Connections"
|
|
58
|
+
}, setIntentIndicator = function(intentAt2) {
|
|
59
|
+
return setTabState({
|
|
60
|
+
...tabState,
|
|
61
|
+
intentAt: intentAt2
|
|
62
|
+
});
|
|
63
|
+
}, setActiveIndicator = function(activeAt2) {
|
|
64
|
+
return setTabState({
|
|
65
|
+
...tabState,
|
|
66
|
+
prevActiveAt: tabState.activeAt,
|
|
67
|
+
activeAt: activeAt2
|
|
68
|
+
});
|
|
69
|
+
}, { activeAt, intentAt, prevActiveAt, currentTab } = tabState, direction = function() {
|
|
70
|
+
return !activeAt || !prevActiveAt || activeAt.x === prevActiveAt.x ? 0 : activeAt.x > prevActiveAt.x ? -1 : 1;
|
|
71
|
+
}(), handleOnInteraction = function(type, layout) {
|
|
72
|
+
type === "select" ? setActiveIndicator(layout) : setIntentIndicator(layout);
|
|
73
|
+
};
|
|
74
|
+
return /* @__PURE__ */ _jsxs(Tabs, {
|
|
75
|
+
value: currentTab,
|
|
76
|
+
onValueChange: setCurrentTab,
|
|
77
|
+
orientation: "horizontal",
|
|
78
|
+
size: "$4",
|
|
79
|
+
padding: "$2",
|
|
80
|
+
height: 150,
|
|
81
|
+
flexDirection: "column",
|
|
82
|
+
activationMode: "manual",
|
|
83
|
+
backgroundColor: "$background",
|
|
84
|
+
borderRadius: "$4",
|
|
85
|
+
position: "relative",
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ _jsxs(YStack, {
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ _jsx(AnimatePresence, {
|
|
90
|
+
children: intentAt && /* @__PURE__ */ _jsx(TabsRovingIndicator, {
|
|
91
|
+
borderRadius: "$4",
|
|
92
|
+
width: intentAt.width,
|
|
93
|
+
height: intentAt.height,
|
|
94
|
+
x: intentAt.x,
|
|
95
|
+
y: intentAt.y
|
|
135
96
|
})
|
|
136
|
-
}),
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ _jsx(AnimatePresence, {
|
|
99
|
+
children: activeAt && /* @__PURE__ */ _jsx(TabsRovingIndicator, {
|
|
100
|
+
borderRadius: "$4",
|
|
101
|
+
theme: "active",
|
|
102
|
+
width: activeAt.width,
|
|
103
|
+
height: activeAt.height,
|
|
104
|
+
x: activeAt.x,
|
|
105
|
+
y: activeAt.y
|
|
144
106
|
})
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ _jsxs(Tabs.List, {
|
|
109
|
+
disablePassBorderRadius: !0,
|
|
110
|
+
loop: !1,
|
|
111
|
+
"aria-label": "Manage your account",
|
|
112
|
+
gap: "$2",
|
|
113
|
+
backgroundColor: "transparent",
|
|
114
|
+
children: [
|
|
115
|
+
/* @__PURE__ */ _jsx(Tabs.Tab, {
|
|
116
|
+
unstyled: !0,
|
|
117
|
+
paddingVertical: "$2",
|
|
118
|
+
paddingHorizontal: "$3",
|
|
119
|
+
value: "tab1",
|
|
120
|
+
onInteraction: handleOnInteraction,
|
|
121
|
+
children: /* @__PURE__ */ _jsx(SizableText, {
|
|
122
|
+
children: "Profile"
|
|
123
|
+
})
|
|
124
|
+
}),
|
|
125
|
+
/* @__PURE__ */ _jsx(Tabs.Tab, {
|
|
126
|
+
unstyled: !0,
|
|
127
|
+
paddingVertical: "$2",
|
|
128
|
+
paddingHorizontal: "$3",
|
|
129
|
+
value: "tab2",
|
|
130
|
+
onInteraction: handleOnInteraction,
|
|
131
|
+
children: /* @__PURE__ */ _jsx(SizableText, {
|
|
132
|
+
children: "Connections"
|
|
133
|
+
})
|
|
134
|
+
}),
|
|
135
|
+
/* @__PURE__ */ _jsx(Tabs.Tab, {
|
|
136
|
+
unstyled: !0,
|
|
137
|
+
paddingVertical: "$2",
|
|
138
|
+
paddingHorizontal: "$3",
|
|
139
|
+
value: "tab3",
|
|
140
|
+
onInteraction: handleOnInteraction,
|
|
141
|
+
children: /* @__PURE__ */ _jsx(SizableText, {
|
|
142
|
+
children: "Notifications"
|
|
143
|
+
})
|
|
144
|
+
})
|
|
145
|
+
]
|
|
146
|
+
})
|
|
147
|
+
]
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ _jsx(AnimatePresence, {
|
|
148
150
|
exitBeforeEnter: !0,
|
|
149
151
|
custom: {
|
|
150
152
|
direction
|
|
151
153
|
},
|
|
152
154
|
initial: !1,
|
|
153
|
-
children: /* @__PURE__ */_jsx(AnimatedYStack, {
|
|
154
|
-
children: /* @__PURE__ */_jsx(Tabs.Content, {
|
|
155
|
+
children: /* @__PURE__ */ _jsx(AnimatedYStack, {
|
|
156
|
+
children: /* @__PURE__ */ _jsx(Tabs.Content, {
|
|
155
157
|
value: currentTab,
|
|
156
158
|
forceMount: !0,
|
|
157
159
|
flex: 1,
|
|
158
160
|
justifyContent: "center",
|
|
159
|
-
children: /* @__PURE__ */_jsx(H5, {
|
|
161
|
+
children: /* @__PURE__ */ _jsx(H5, {
|
|
160
162
|
textAlign: "center",
|
|
161
163
|
children: currentTab
|
|
162
164
|
})
|
|
163
165
|
})
|
|
164
166
|
}, currentTab)
|
|
165
|
-
})
|
|
167
|
+
})
|
|
168
|
+
]
|
|
169
|
+
});
|
|
170
|
+
}, TabsAdvancedUnderline = function() {
|
|
171
|
+
var [tabState, setTabState] = React.useState(
|
|
172
|
+
/**
|
|
173
|
+
* Layout of the Tab user might intend to select (hovering / focusing)
|
|
174
|
+
*/
|
|
175
|
+
/**
|
|
176
|
+
* Layout of the Tab user selected
|
|
177
|
+
*/
|
|
178
|
+
/**
|
|
179
|
+
* Used to get the direction of activation for animating the active indicator
|
|
180
|
+
*/
|
|
181
|
+
{
|
|
182
|
+
activeAt: null,
|
|
183
|
+
currentTab: "tab1",
|
|
184
|
+
intentAt: null,
|
|
185
|
+
prevActiveAt: null
|
|
186
|
+
}
|
|
187
|
+
), setCurrentTab = function(currentTab2) {
|
|
188
|
+
return setTabState({
|
|
189
|
+
...tabState,
|
|
190
|
+
currentTab: currentTab2
|
|
166
191
|
});
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
});
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
activeAt,
|
|
206
|
-
intentAt,
|
|
207
|
-
prevActiveAt,
|
|
208
|
-
currentTab
|
|
209
|
-
} = tabState,
|
|
210
|
-
direction = function () {
|
|
211
|
-
return !activeAt || !prevActiveAt || activeAt.x === prevActiveAt.x ? 0 : activeAt.x > prevActiveAt.x ? -1 : 1;
|
|
212
|
-
}(),
|
|
213
|
-
handleOnInteraction = function (type, layout) {
|
|
214
|
-
type === "select" ? setActiveIndicator(layout) : setIntentIndicator(layout);
|
|
215
|
-
};
|
|
216
|
-
return /* @__PURE__ */_jsxs(Tabs, {
|
|
217
|
-
value: currentTab,
|
|
218
|
-
onValueChange: setCurrentTab,
|
|
219
|
-
orientation: "horizontal",
|
|
220
|
-
size: "$4",
|
|
221
|
-
height: 150,
|
|
222
|
-
flexDirection: "column",
|
|
223
|
-
activationMode: "manual",
|
|
224
|
-
backgroundColor: "$background",
|
|
225
|
-
borderRadius: "$4",
|
|
226
|
-
children: [/* @__PURE__ */_jsxs(YStack, {
|
|
227
|
-
children: [/* @__PURE__ */_jsx(AnimatePresence, {
|
|
228
|
-
children: intentAt && /* @__PURE__ */_jsx(TabsRovingIndicator, {
|
|
229
|
-
width: intentAt.width,
|
|
230
|
-
height: "$0.5",
|
|
231
|
-
x: intentAt.x,
|
|
232
|
-
bottom: 0
|
|
233
|
-
})
|
|
234
|
-
}), /* @__PURE__ */_jsx(AnimatePresence, {
|
|
235
|
-
children: activeAt && /* @__PURE__ */_jsx(TabsRovingIndicator, {
|
|
236
|
-
theme: "active",
|
|
237
|
-
active: !0,
|
|
238
|
-
width: activeAt.width,
|
|
239
|
-
height: "$0.5",
|
|
240
|
-
x: activeAt.x,
|
|
241
|
-
bottom: 0
|
|
242
|
-
})
|
|
243
|
-
}), /* @__PURE__ */_jsxs(Tabs.List, {
|
|
244
|
-
disablePassBorderRadius: !0,
|
|
245
|
-
loop: !1,
|
|
246
|
-
"aria-label": "Manage your account",
|
|
247
|
-
borderBottomLeftRadius: 0,
|
|
248
|
-
borderBottomRightRadius: 0,
|
|
249
|
-
paddingBottom: "$1.5",
|
|
250
|
-
borderColor: "$color3",
|
|
251
|
-
borderBottomWidth: "$0.5",
|
|
252
|
-
backgroundColor: "transparent",
|
|
253
|
-
children: [/* @__PURE__ */_jsx(Tabs.Tab, {
|
|
254
|
-
unstyled: !0,
|
|
255
|
-
paddingHorizontal: "$3",
|
|
256
|
-
paddingVertical: "$2",
|
|
257
|
-
value: "tab1",
|
|
258
|
-
onInteraction: handleOnInteraction,
|
|
259
|
-
children: /* @__PURE__ */_jsx(SizableText, {
|
|
260
|
-
children: "Profile"
|
|
261
|
-
})
|
|
262
|
-
}), /* @__PURE__ */_jsx(Tabs.Tab, {
|
|
263
|
-
unstyled: !0,
|
|
264
|
-
paddingHorizontal: "$3",
|
|
265
|
-
paddingVertical: "$2",
|
|
266
|
-
value: "tab2",
|
|
267
|
-
onInteraction: handleOnInteraction,
|
|
268
|
-
children: /* @__PURE__ */_jsx(SizableText, {
|
|
269
|
-
children: "Connections"
|
|
192
|
+
}, setIntentIndicator = function(intentAt2) {
|
|
193
|
+
return setTabState({
|
|
194
|
+
...tabState,
|
|
195
|
+
intentAt: intentAt2
|
|
196
|
+
});
|
|
197
|
+
}, setActiveIndicator = function(activeAt2) {
|
|
198
|
+
return setTabState({
|
|
199
|
+
...tabState,
|
|
200
|
+
prevActiveAt: tabState.activeAt,
|
|
201
|
+
activeAt: activeAt2
|
|
202
|
+
});
|
|
203
|
+
}, { activeAt, intentAt, prevActiveAt, currentTab } = tabState, direction = function() {
|
|
204
|
+
return !activeAt || !prevActiveAt || activeAt.x === prevActiveAt.x ? 0 : activeAt.x > prevActiveAt.x ? -1 : 1;
|
|
205
|
+
}(), handleOnInteraction = function(type, layout) {
|
|
206
|
+
type === "select" ? setActiveIndicator(layout) : setIntentIndicator(layout);
|
|
207
|
+
};
|
|
208
|
+
return /* @__PURE__ */ _jsxs(Tabs, {
|
|
209
|
+
value: currentTab,
|
|
210
|
+
onValueChange: setCurrentTab,
|
|
211
|
+
orientation: "horizontal",
|
|
212
|
+
size: "$4",
|
|
213
|
+
height: 150,
|
|
214
|
+
flexDirection: "column",
|
|
215
|
+
activationMode: "manual",
|
|
216
|
+
backgroundColor: "$background",
|
|
217
|
+
borderRadius: "$4",
|
|
218
|
+
children: [
|
|
219
|
+
/* @__PURE__ */ _jsxs(YStack, {
|
|
220
|
+
children: [
|
|
221
|
+
/* @__PURE__ */ _jsx(AnimatePresence, {
|
|
222
|
+
children: intentAt && /* @__PURE__ */ _jsx(TabsRovingIndicator, {
|
|
223
|
+
width: intentAt.width,
|
|
224
|
+
height: "$0.5",
|
|
225
|
+
x: intentAt.x,
|
|
226
|
+
bottom: 0
|
|
270
227
|
})
|
|
271
|
-
}),
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
228
|
+
}),
|
|
229
|
+
/* @__PURE__ */ _jsx(AnimatePresence, {
|
|
230
|
+
children: activeAt && /* @__PURE__ */ _jsx(TabsRovingIndicator, {
|
|
231
|
+
theme: "active",
|
|
232
|
+
active: !0,
|
|
233
|
+
width: activeAt.width,
|
|
234
|
+
height: "$0.5",
|
|
235
|
+
x: activeAt.x,
|
|
236
|
+
bottom: 0
|
|
279
237
|
})
|
|
280
|
-
})
|
|
281
|
-
|
|
282
|
-
|
|
238
|
+
}),
|
|
239
|
+
/* @__PURE__ */ _jsxs(Tabs.List, {
|
|
240
|
+
disablePassBorderRadius: !0,
|
|
241
|
+
loop: !1,
|
|
242
|
+
"aria-label": "Manage your account",
|
|
243
|
+
borderBottomLeftRadius: 0,
|
|
244
|
+
borderBottomRightRadius: 0,
|
|
245
|
+
paddingBottom: "$1.5",
|
|
246
|
+
borderColor: "$color3",
|
|
247
|
+
borderBottomWidth: "$0.5",
|
|
248
|
+
backgroundColor: "transparent",
|
|
249
|
+
children: [
|
|
250
|
+
/* @__PURE__ */ _jsx(Tabs.Tab, {
|
|
251
|
+
unstyled: !0,
|
|
252
|
+
paddingHorizontal: "$3",
|
|
253
|
+
paddingVertical: "$2",
|
|
254
|
+
value: "tab1",
|
|
255
|
+
onInteraction: handleOnInteraction,
|
|
256
|
+
children: /* @__PURE__ */ _jsx(SizableText, {
|
|
257
|
+
children: "Profile"
|
|
258
|
+
})
|
|
259
|
+
}),
|
|
260
|
+
/* @__PURE__ */ _jsx(Tabs.Tab, {
|
|
261
|
+
unstyled: !0,
|
|
262
|
+
paddingHorizontal: "$3",
|
|
263
|
+
paddingVertical: "$2",
|
|
264
|
+
value: "tab2",
|
|
265
|
+
onInteraction: handleOnInteraction,
|
|
266
|
+
children: /* @__PURE__ */ _jsx(SizableText, {
|
|
267
|
+
children: "Connections"
|
|
268
|
+
})
|
|
269
|
+
}),
|
|
270
|
+
/* @__PURE__ */ _jsx(Tabs.Tab, {
|
|
271
|
+
unstyled: !0,
|
|
272
|
+
paddingHorizontal: "$3",
|
|
273
|
+
paddingVertical: "$2",
|
|
274
|
+
value: "tab3",
|
|
275
|
+
onInteraction: handleOnInteraction,
|
|
276
|
+
children: /* @__PURE__ */ _jsx(SizableText, {
|
|
277
|
+
children: "Notifications"
|
|
278
|
+
})
|
|
279
|
+
})
|
|
280
|
+
]
|
|
281
|
+
})
|
|
282
|
+
]
|
|
283
|
+
}),
|
|
284
|
+
/* @__PURE__ */ _jsx(AnimatePresence, {
|
|
283
285
|
exitBeforeEnter: !0,
|
|
284
286
|
custom: {
|
|
285
287
|
direction
|
|
286
288
|
},
|
|
287
289
|
initial: !1,
|
|
288
|
-
children: /* @__PURE__ */_jsx(AnimatedYStack, {
|
|
289
|
-
children: /* @__PURE__ */_jsx(Tabs.Content, {
|
|
290
|
+
children: /* @__PURE__ */ _jsx(AnimatedYStack, {
|
|
291
|
+
children: /* @__PURE__ */ _jsx(Tabs.Content, {
|
|
290
292
|
value: currentTab,
|
|
291
293
|
forceMount: !0,
|
|
292
294
|
flex: 1,
|
|
293
295
|
justifyContent: "center",
|
|
294
|
-
children: /* @__PURE__ */_jsx(H5, {
|
|
296
|
+
children: /* @__PURE__ */ _jsx(H5, {
|
|
295
297
|
textAlign: "center",
|
|
296
298
|
children: currentTab
|
|
297
299
|
})
|
|
298
300
|
})
|
|
299
301
|
}, currentTab)
|
|
300
|
-
})
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
position: "absolute",
|
|
310
|
-
backgroundColor: "$color5",
|
|
311
|
-
opacity: 0.7,
|
|
312
|
-
animation: "100ms",
|
|
313
|
-
enterStyle: {
|
|
314
|
-
opacity: 0
|
|
315
|
-
},
|
|
316
|
-
exitStyle: {
|
|
317
|
-
opacity: 0
|
|
318
|
-
},
|
|
319
|
-
...(active && {
|
|
320
|
-
backgroundColor: "$color8",
|
|
321
|
-
opacity: 0.6
|
|
322
|
-
}),
|
|
323
|
-
...props
|
|
324
|
-
});
|
|
325
|
-
},
|
|
326
|
-
AnimatedYStack = styled(YStack, {
|
|
327
|
-
flex: 1,
|
|
328
|
-
x: 0,
|
|
329
|
-
opacity: 1,
|
|
302
|
+
})
|
|
303
|
+
]
|
|
304
|
+
});
|
|
305
|
+
}, TabsRovingIndicator = function(param) {
|
|
306
|
+
var { active, ...props } = param;
|
|
307
|
+
return /* @__PURE__ */ _jsx(YStack, {
|
|
308
|
+
position: "absolute",
|
|
309
|
+
backgroundColor: "$color5",
|
|
310
|
+
opacity: 0.7,
|
|
330
311
|
animation: "100ms",
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
312
|
+
enterStyle: {
|
|
313
|
+
opacity: 0
|
|
314
|
+
},
|
|
315
|
+
exitStyle: {
|
|
316
|
+
opacity: 0
|
|
317
|
+
},
|
|
318
|
+
...active && {
|
|
319
|
+
backgroundColor: "$color8",
|
|
320
|
+
opacity: 0.6
|
|
321
|
+
},
|
|
322
|
+
...props
|
|
323
|
+
});
|
|
324
|
+
}, AnimatedYStack = styled(YStack, {
|
|
325
|
+
flex: 1,
|
|
326
|
+
x: 0,
|
|
327
|
+
opacity: 1,
|
|
328
|
+
animation: "100ms",
|
|
329
|
+
variants: {
|
|
330
|
+
// 1 = right, 0 = nowhere, -1 = left
|
|
331
|
+
direction: {
|
|
332
|
+
":number": function(direction) {
|
|
333
|
+
return {
|
|
334
|
+
enterStyle: {
|
|
335
|
+
x: direction > 0 ? -25 : 25,
|
|
336
|
+
opacity: 0
|
|
337
|
+
},
|
|
338
|
+
exitStyle: {
|
|
339
|
+
zIndex: 0,
|
|
340
|
+
x: direction < 0 ? -25 : 25,
|
|
341
|
+
opacity: 0
|
|
342
|
+
}
|
|
343
|
+
};
|
|
347
344
|
}
|
|
348
345
|
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
export {
|
|
349
|
+
TabsAdvancedDemo
|
|
350
|
+
};
|
|
351
|
+
//# sourceMappingURL=TabsAdvancedDemo.js.map
|