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