@tamagui/demos 1.7.5 → 1.7.7
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/cjs/TabsAnimatedDemo.js +167 -0
- package/dist/cjs/TabsAnimatedDemo.js.map +7 -0
- package/dist/cjs/TabsHighlightedDemo.js +6 -10
- package/dist/cjs/TabsHighlightedDemo.js.map +2 -2
- package/dist/esm/TabsAnimatedDemo.js +143 -0
- package/dist/esm/TabsAnimatedDemo.js.map +7 -0
- package/dist/esm/TabsAnimatedDemo.mjs +143 -0
- package/dist/esm/TabsAnimatedDemo.mjs.map +7 -0
- package/dist/esm/TabsHighlightedDemo.js +6 -10
- package/dist/esm/TabsHighlightedDemo.js.map +2 -2
- package/dist/esm/TabsHighlightedDemo.mjs +6 -10
- package/dist/esm/TabsHighlightedDemo.mjs.map +2 -2
- package/dist/jsx/TabsAnimatedDemo.js +114 -0
- package/dist/jsx/TabsAnimatedDemo.js.map +7 -0
- package/dist/jsx/TabsAnimatedDemo.mjs +114 -0
- package/dist/jsx/TabsAnimatedDemo.mjs.map +7 -0
- package/dist/jsx/TabsHighlightedDemo.js +5 -9
- package/dist/jsx/TabsHighlightedDemo.js.map +2 -2
- package/dist/jsx/TabsHighlightedDemo.mjs +5 -9
- package/dist/jsx/TabsHighlightedDemo.mjs.map +2 -2
- package/package.json +17 -17
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var TabsAnimatedDemo_exports = {};
|
|
20
|
+
__export(TabsAnimatedDemo_exports, {
|
|
21
|
+
TabsAnimatedDemo: () => TabsAnimatedDemo
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(TabsAnimatedDemo_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var import_tamagui = require("tamagui");
|
|
27
|
+
function TabsAnimatedDemo() {
|
|
28
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.XStack, { maxHeight: "100%", maxWidth: "100%", justifyContent: "flex-start", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tamagui.XStack, { space: "$3", px: "$8", children: [
|
|
29
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(UnderlineTabs, {}),
|
|
30
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(HighlightTabs, {})
|
|
31
|
+
] }) });
|
|
32
|
+
}
|
|
33
|
+
const UnderlineTabs = () => {
|
|
34
|
+
const [currentTab, setCurrentTab] = (0, import_react.useState)("tab1");
|
|
35
|
+
const [direction, setDirection] = (0, import_react.useState)(0);
|
|
36
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
37
|
+
import_tamagui.Tabs,
|
|
38
|
+
{
|
|
39
|
+
value: currentTab,
|
|
40
|
+
onValueChange: setCurrentTab,
|
|
41
|
+
onDirectionChange: setDirection,
|
|
42
|
+
orientation: "vertical",
|
|
43
|
+
width: 300,
|
|
44
|
+
br: "$4",
|
|
45
|
+
ai: "center",
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.YStack, { borderColor: "$color3", borderRightWidth: "$0.5", mr: "$2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tamagui.YStack, { children: [
|
|
48
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
49
|
+
import_tamagui.Tabs.RovingIndicator,
|
|
50
|
+
{
|
|
51
|
+
highlightMode: "hoverOrFocus",
|
|
52
|
+
width: "$0.5",
|
|
53
|
+
right: 0,
|
|
54
|
+
animation: "100ms"
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
58
|
+
import_tamagui.Tabs.RovingIndicator,
|
|
59
|
+
{
|
|
60
|
+
highlightMode: "select",
|
|
61
|
+
width: "$0.5",
|
|
62
|
+
right: 0,
|
|
63
|
+
animation: "100ms"
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tamagui.Tabs.List, { "aria-label": "Manage your account", flexDirection: "column", children: [
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab1", children: "Profile" }),
|
|
68
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab2", children: "Connections" }),
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab3", children: "Notifications" })
|
|
70
|
+
] })
|
|
71
|
+
] }) }),
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.AnimatePresence, { exitBeforeEnter: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
73
|
+
import_tamagui.Tabs.Content,
|
|
74
|
+
{
|
|
75
|
+
value: currentTab,
|
|
76
|
+
forceMount: true,
|
|
77
|
+
p: "$2",
|
|
78
|
+
animation: "100ms",
|
|
79
|
+
o: 1,
|
|
80
|
+
y: 0,
|
|
81
|
+
f: 1,
|
|
82
|
+
enterStyle: {
|
|
83
|
+
...direction === -1 ? { y: -25 } : {},
|
|
84
|
+
...direction === 1 ? { y: 25 } : {},
|
|
85
|
+
opacity: 0
|
|
86
|
+
},
|
|
87
|
+
exitStyle: {
|
|
88
|
+
...direction === -1 ? { y: 25 } : {},
|
|
89
|
+
...direction === 1 ? { y: -25 } : {},
|
|
90
|
+
opacity: 0
|
|
91
|
+
},
|
|
92
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.H5, { ta: "center", children: currentTab })
|
|
93
|
+
},
|
|
94
|
+
currentTab
|
|
95
|
+
) })
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
const HighlightTabs = () => {
|
|
101
|
+
const [currentTab, setCurrentTab] = (0, import_react.useState)("tab1");
|
|
102
|
+
const [direction, setDirection] = (0, import_react.useState)(0);
|
|
103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
104
|
+
import_tamagui.Tabs,
|
|
105
|
+
{
|
|
106
|
+
value: currentTab,
|
|
107
|
+
onValueChange: setCurrentTab,
|
|
108
|
+
onDirectionChange: setDirection,
|
|
109
|
+
orientation: "horizontal",
|
|
110
|
+
br: "$4",
|
|
111
|
+
flexDirection: "column",
|
|
112
|
+
children: [
|
|
113
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tamagui.YStack, { children: [
|
|
114
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
115
|
+
import_tamagui.Tabs.RovingIndicator,
|
|
116
|
+
{
|
|
117
|
+
highlightMode: "hoverOrFocus",
|
|
118
|
+
borderRadius: "$4",
|
|
119
|
+
animation: "100ms"
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
123
|
+
import_tamagui.Tabs.RovingIndicator,
|
|
124
|
+
{
|
|
125
|
+
highlightMode: "select",
|
|
126
|
+
borderRadius: "$4",
|
|
127
|
+
animation: "100ms"
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tamagui.Tabs.List, { "aria-label": "Manage your account", children: [
|
|
131
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab1", children: "Profile" }),
|
|
132
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab2", children: "Connections" }),
|
|
133
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab3", children: "Notifications" })
|
|
134
|
+
] })
|
|
135
|
+
] }),
|
|
136
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.AnimatePresence, { exitBeforeEnter: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
137
|
+
import_tamagui.Tabs.Content,
|
|
138
|
+
{
|
|
139
|
+
value: currentTab,
|
|
140
|
+
forceMount: true,
|
|
141
|
+
p: "$2",
|
|
142
|
+
animation: "100ms",
|
|
143
|
+
o: 1,
|
|
144
|
+
x: 0,
|
|
145
|
+
enterStyle: {
|
|
146
|
+
...direction === -1 ? { x: -25 } : {},
|
|
147
|
+
...direction === 1 ? { x: 25 } : {},
|
|
148
|
+
opacity: 0
|
|
149
|
+
},
|
|
150
|
+
exitStyle: {
|
|
151
|
+
...direction === -1 ? { x: 25 } : {},
|
|
152
|
+
...direction === 1 ? { x: -25 } : {},
|
|
153
|
+
opacity: 0
|
|
154
|
+
},
|
|
155
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.H5, { ta: "center", children: currentTab })
|
|
156
|
+
},
|
|
157
|
+
currentTab
|
|
158
|
+
) })
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
};
|
|
163
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
164
|
+
0 && (module.exports = {
|
|
165
|
+
TabsAnimatedDemo
|
|
166
|
+
});
|
|
167
|
+
//# sourceMappingURL=TabsAnimatedDemo.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/TabsAnimatedDemo.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useState } from 'react'\nimport { AnimatePresence, H5, Tabs, XStack, YStack } from 'tamagui'\n\nexport function TabsAnimatedDemo() {\n return (\n <XStack maxHeight=\"100%\" maxWidth=\"100%\" justifyContent=\"flex-start\">\n <XStack space=\"$3\" px=\"$8\">\n <UnderlineTabs />\n <HighlightTabs />\n </XStack>\n </XStack>\n )\n}\n\nconst UnderlineTabs = () => {\n const [currentTab, setCurrentTab] = useState('tab1')\n const [direction, setDirection] = useState<-1 | 0 | 1>(0)\n\n return (\n <Tabs\n value={currentTab}\n onValueChange={setCurrentTab}\n onDirectionChange={setDirection}\n orientation=\"vertical\"\n width={300}\n br=\"$4\"\n ai=\"center\"\n >\n <YStack borderColor=\"$color3\" borderRightWidth=\"$0.5\" mr=\"$2\">\n <YStack>\n <Tabs.RovingIndicator\n highlightMode=\"hoverOrFocus\"\n width=\"$0.5\"\n right={0}\n animation=\"100ms\"\n />\n <Tabs.RovingIndicator\n highlightMode=\"select\"\n width=\"$0.5\"\n right={0}\n animation=\"100ms\"\n />\n <Tabs.List aria-label=\"Manage your account\" flexDirection=\"column\">\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab1\">\n Profile\n </Tabs.Trigger>\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab2\">\n Connections\n </Tabs.Trigger>\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab3\">\n Notifications\n </Tabs.Trigger>\n </Tabs.List>\n </YStack>\n </YStack>\n <AnimatePresence exitBeforeEnter>\n <Tabs.Content\n value={currentTab}\n key={currentTab}\n forceMount\n p=\"$2\"\n animation=\"100ms\"\n o={1}\n y={0}\n f={1}\n enterStyle={{\n ...(direction === -1 ? { y: -25 } : {}),\n ...(direction === 1 ? { y: 25 } : {}),\n opacity: 0,\n }}\n exitStyle={{\n ...(direction === -1 ? { y: 25 } : {}),\n ...(direction === 1 ? { y: -25 } : {}),\n opacity: 0,\n }}\n >\n <H5 ta=\"center\">{currentTab}</H5>\n </Tabs.Content>\n </AnimatePresence>\n </Tabs>\n )\n}\n\nconst HighlightTabs = () => {\n const [currentTab, setCurrentTab] = useState('tab1')\n const [direction, setDirection] = useState<-1 | 0 | 1>(0)\n\n return (\n <Tabs\n value={currentTab}\n onValueChange={setCurrentTab}\n onDirectionChange={setDirection}\n orientation=\"horizontal\"\n br=\"$4\"\n flexDirection=\"column\"\n >\n <YStack>\n <Tabs.RovingIndicator\n highlightMode=\"hoverOrFocus\"\n borderRadius=\"$4\"\n animation=\"100ms\"\n />\n <Tabs.RovingIndicator\n highlightMode=\"select\"\n borderRadius=\"$4\"\n animation=\"100ms\"\n />\n <Tabs.List aria-label=\"Manage your account\">\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab1\">\n Profile\n </Tabs.Trigger>\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab2\">\n Connections\n </Tabs.Trigger>\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab3\">\n Notifications\n </Tabs.Trigger>\n </Tabs.List>\n </YStack>\n <AnimatePresence exitBeforeEnter>\n <Tabs.Content\n value={currentTab}\n key={currentTab}\n forceMount\n p=\"$2\"\n animation=\"100ms\"\n o={1}\n x={0}\n enterStyle={{\n ...(direction === -1 ? { x: -25 } : {}),\n ...(direction === 1 ? { x: 25 } : {}),\n opacity: 0,\n }}\n exitStyle={{\n ...(direction === -1 ? { x: 25 } : {}),\n ...(direction === 1 ? { x: -25 } : {}),\n opacity: 0,\n }}\n >\n <H5 ta=\"center\">{currentTab}</H5>\n </Tabs.Content>\n </AnimatePresence>\n </Tabs>\n )\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMM;AANN,mBAAyB;AACzB,qBAA0D;AAEnD,SAAS,mBAAmB;AACjC,SACE,4CAAC,yBAAO,WAAU,QAAO,UAAS,QAAO,gBAAe,cACtD,uDAAC,yBAAO,OAAM,MAAK,IAAG,MACpB;AAAA,gDAAC,iBAAc;AAAA,IACf,4CAAC,iBAAc;AAAA,KACjB,GACF;AAEJ;AAEA,MAAM,gBAAgB,MAAM;AAC1B,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,MAAM;AACnD,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAqB,CAAC;AAExD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,eAAe;AAAA,MACf,mBAAmB;AAAA,MACnB,aAAY;AAAA,MACZ,OAAO;AAAA,MACP,IAAG;AAAA,MACH,IAAG;AAAA,MAEH;AAAA,oDAAC,yBAAO,aAAY,WAAU,kBAAiB,QAAO,IAAG,MACvD,uDAAC,yBACC;AAAA;AAAA,YAAC,oBAAK;AAAA,YAAL;AAAA,cACC,eAAc;AAAA,cACd,OAAM;AAAA,cACN,OAAO;AAAA,cACP,WAAU;AAAA;AAAA,UACZ;AAAA,UACA;AAAA,YAAC,oBAAK;AAAA,YAAL;AAAA,cACC,eAAc;AAAA,cACd,OAAM;AAAA,cACN,OAAO;AAAA,cACP,WAAU;AAAA;AAAA,UACZ;AAAA,UACA,6CAAC,oBAAK,MAAL,EAAU,cAAW,uBAAsB,eAAc,UACxD;AAAA,wDAAC,oBAAK,SAAL,EAAa,UAAQ,M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
-
p: "$2",
|
|
97
96
|
height: 150,
|
|
98
97
|
flexDirection: "column",
|
|
99
98
|
activationMode: "manual",
|
|
@@ -101,10 +100,10 @@ const HighlightTabs = () => {
|
|
|
101
100
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
102
101
|
import_tamagui.Tabs.List,
|
|
103
102
|
{
|
|
103
|
+
scrollable: true,
|
|
104
104
|
loop: false,
|
|
105
105
|
"aria-label": "Manage your account",
|
|
106
106
|
disablePassBorderRadius: true,
|
|
107
|
-
overflow: "visible",
|
|
108
107
|
children: [
|
|
109
108
|
intentIndicatorLayout && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
110
109
|
TabsRovingIndicator,
|
|
@@ -121,9 +120,9 @@ const HighlightTabs = () => {
|
|
|
121
120
|
theme: "active",
|
|
122
121
|
active: true,
|
|
123
122
|
width: selectionIndicatorLayout.width,
|
|
124
|
-
height:
|
|
123
|
+
height: selectionIndicatorLayout.height,
|
|
125
124
|
x: selectionIndicatorLayout.x,
|
|
126
|
-
y:
|
|
125
|
+
y: selectionIndicatorLayout.y
|
|
127
126
|
}
|
|
128
127
|
),
|
|
129
128
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -132,7 +131,6 @@ const HighlightTabs = () => {
|
|
|
132
131
|
unstyled: true,
|
|
133
132
|
color: "$color12",
|
|
134
133
|
value: "tab1",
|
|
135
|
-
size: "$3",
|
|
136
134
|
onSelectedLayoutChange: handleUpdateSelectionIndicator,
|
|
137
135
|
onHoveredLayoutChange: setHoverIndicatorLayout,
|
|
138
136
|
onFocusedLayoutChange: setFocusIndicatorLayout,
|
|
@@ -144,7 +142,6 @@ const HighlightTabs = () => {
|
|
|
144
142
|
{
|
|
145
143
|
unstyled: true,
|
|
146
144
|
color: "$color12",
|
|
147
|
-
size: "$3",
|
|
148
145
|
value: "tab2",
|
|
149
146
|
onSelectedLayoutChange: handleUpdateSelectionIndicator,
|
|
150
147
|
onHoveredLayoutChange: setHoverIndicatorLayout,
|
|
@@ -157,7 +154,6 @@ const HighlightTabs = () => {
|
|
|
157
154
|
{
|
|
158
155
|
unstyled: true,
|
|
159
156
|
color: "$color12",
|
|
160
|
-
size: "$3",
|
|
161
157
|
value: "tab3",
|
|
162
158
|
onSelectedLayoutChange: handleUpdateSelectionIndicator,
|
|
163
159
|
onHoveredLayoutChange: setHoverIndicatorLayout,
|
|
@@ -168,15 +164,15 @@ const HighlightTabs = () => {
|
|
|
168
164
|
]
|
|
169
165
|
}
|
|
170
166
|
),
|
|
171
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
167
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
172
168
|
import_tamagui.AnimatePresence,
|
|
173
169
|
{
|
|
174
170
|
exitBeforeEnter: true,
|
|
175
171
|
enterVariant,
|
|
176
172
|
exitVariant,
|
|
177
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnimatedYStack, { animation: "100ms", x: 0, o: 1,
|
|
173
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnimatedYStack, { animation: "100ms", x: 0, o: 1, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.Tabs.Content, { value: currentTab, forceMount: true, p: "$2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.H5, { ta: "center", children: currentTab }) }) }, currentTab)
|
|
178
174
|
}
|
|
179
|
-
)
|
|
175
|
+
)
|
|
180
176
|
]
|
|
181
177
|
}
|
|
182
178
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/TabsHighlightedDemo.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useMemo, useRef, useState } from 'react'\nimport {\n AnimatePresence,\n H5,\n Stack,\n TabTriggerLayout,\n Tabs,\n XStack,\n YStack,\n styled,\n} from 'tamagui'\n\nexport function TabsHighlightedDemo() {\n return (\n <XStack maxHeight=\"100%\" maxWidth=\"100%\" justifyContent=\"flex-start\" px=\"$4\">\n <HighlightTabs />\n </XStack>\n )\n}\n\nconst TabsRovingIndicator = styled(Stack, {\n name: 'TabsRovingIndicator',\n variants: {\n active: {\n true: {\n backgroundColor: '$color8',\n },\n },\n variants: {\n active: {\n true: {\n backgroundColor: '$color8',\n },\n },\n enter: {\n true: {\n opacity: 0,\n },\n },\n exit: {\n true: {\n opacity: 0,\n },\n },\n },\n },\n defaultVariants: {\n position: 'absolute',\n backgroundColor: '$color5',\n opacity: 1,\n animation: '100ms',\n borderRadius: '$4',\n },\n})\n\nconst AnimatedYStack = styled(YStack, {\n variants: {\n isLeft: { true: { x: -25, opacity: 0 } },\n isRight: { true: { x: 25, opacity: 0 } },\n } as const,\n})\n\nconst HighlightTabs = () => {\n const [currentTab, setCurrentTab] = useState('tab1')\n const [focusIndicatorLayout, setFocusIndicatorLayout] =\n useState<TabTriggerLayout | null>(null)\n const [hoverIndicatorLayout, setHoverIndicatorLayout] =\n useState<TabTriggerLayout | null>(null)\n const [selectionIndicatorLayout, setSelectionIndicatorLayout] =\n useState<TabTriggerLayout | null>(null)\n const prevSelectionIndicatorLayout = useRef<TabTriggerLayout | null>(null)\n const handleUpdateSelectionIndicator = (newSize: TabTriggerLayout | null) => {\n prevSelectionIndicatorLayout.current = selectionIndicatorLayout\n setSelectionIndicatorLayout(newSize)\n }\n\n const intentIndicatorLayout = hoverIndicatorLayout || focusIndicatorLayout\n\n /**\n * -1: from left\n * 0: n/a\n * 1: from right\n */\n const direction = useMemo(() => {\n if (\n !selectionIndicatorLayout ||\n !prevSelectionIndicatorLayout.current ||\n selectionIndicatorLayout.x === prevSelectionIndicatorLayout.current.x\n ) {\n return 0\n }\n return selectionIndicatorLayout.x > prevSelectionIndicatorLayout.current.x ? 1 : -1\n }, [selectionIndicatorLayout])\n\n const enterVariant =\n direction === 1 ? 'isLeft' : direction === -1 ? 'isRight' : undefined\n const exitVariant =\n direction === 1 ? 'isRight' : direction === -1 ? 'isLeft' : undefined\n\n return (\n <Tabs\n value={currentTab}\n onValueChange={setCurrentTab}\n orientation=\"horizontal\"\n br=\"$4\"\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeM;AAfN,mBAA0C;AAC1C,qBASO;AAEA,SAAS,sBAAsB;AACpC,SACE,4CAAC,yBAAO,WAAU,QAAO,UAAS,QAAO,gBAAe,cAAa,IAAG,MACtE,sDAAC,iBAAc,GACjB;AAEJ;AAEA,MAAM,0BAAsB,uBAAO,sBAAO;AAAA,EACxC,MAAM;AAAA,EACN,UAAU;AAAA,IACR,QAAQ;AAAA,MACN,MAAM;AAAA,QACJ,iBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,IACA,UAAU;AAAA,MACR,QAAQ;AAAA,QACN,MAAM;AAAA,UACJ,iBAAiB;AAAA,QACnB;AAAA,MACF;AAAA,MACA,OAAO;AAAA,QACL,MAAM;AAAA,UACJ,SAAS;AAAA,QACX;AAAA,MACF;AAAA,MACA,MAAM;AAAA,QACJ,MAAM;AAAA,UACJ,SAAS;AAAA,QACX;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB,SAAS;AAAA,IACT,WAAW;AAAA,IACX,cAAc;AAAA,EAChB;AACF,CAAC;AAED,MAAM,qBAAiB,uBAAO,uBAAQ;AAAA,EACpC,UAAU;AAAA,IACR,QAAQ,EAAE,MAAM,EAAE,GAAG,KAAK,SAAS,EAAE,EAAE;AAAA,IACvC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,SAAS,EAAE,EAAE;AAAA,EACzC;AACF,CAAC;AAED,MAAM,gBAAgB,MAAM;AAC1B,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,MAAM;AACnD,QAAM,CAAC,sBAAsB,uBAAuB,QAClD,uBAAkC,IAAI;AACxC,QAAM,CAAC,sBAAsB,uBAAuB,QAClD,uBAAkC,IAAI;AACxC,QAAM,CAAC,0BAA0B,2BAA2B,QAC1D,uBAAkC,IAAI;AACxC,QAAM,mCAA+B,qBAAgC,IAAI;AACzE,QAAM,iCAAiC,CAAC,YAAqC;AAC3E,iCAA6B,UAAU;AACvC,gCAA4B,OAAO;AAAA,EACrC;AAEA,QAAM,wBAAwB,wBAAwB;AAOtD,QAAM,gBAAY,sBAAQ,MAAM;AAC9B,QACE,CAAC,4BACD,CAAC,6BAA6B,WAC9B,yBAAyB,MAAM,6BAA6B,QAAQ,GACpE;AACA,aAAO;AAAA,IACT;AACA,WAAO,yBAAyB,IAAI,6BAA6B,QAAQ,IAAI,IAAI;AAAA,EACnF,GAAG,CAAC,wBAAwB,CAAC;AAE7B,QAAM,eACJ,cAAc,IAAI,WAAW,cAAc,KAAK,YAAY;AAC9D,QAAM,cACJ,cAAc,IAAI,YAAY,cAAc,KAAK,WAAW;AAE9D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,eAAe;AAAA,MACf,aAAY;AAAA,MACZ,IAAG;AAAA,MACH,
|
|
4
|
+
"sourcesContent": ["import { useMemo, useRef, useState } from 'react'\nimport {\n AnimatePresence,\n H5,\n Stack,\n TabTriggerLayout,\n Tabs,\n XStack,\n YStack,\n styled,\n} from 'tamagui'\n\nexport function TabsHighlightedDemo() {\n return (\n <XStack maxHeight=\"100%\" maxWidth=\"100%\" justifyContent=\"flex-start\" px=\"$4\">\n <HighlightTabs />\n </XStack>\n )\n}\n\nconst TabsRovingIndicator = styled(Stack, {\n name: 'TabsRovingIndicator',\n variants: {\n active: {\n true: {\n backgroundColor: '$color8',\n },\n },\n variants: {\n active: {\n true: {\n backgroundColor: '$color8',\n },\n },\n enter: {\n true: {\n opacity: 0,\n },\n },\n exit: {\n true: {\n opacity: 0,\n },\n },\n },\n },\n defaultVariants: {\n position: 'absolute',\n backgroundColor: '$color5',\n opacity: 1,\n animation: '100ms',\n borderRadius: '$4',\n },\n})\n\nconst AnimatedYStack = styled(YStack, {\n variants: {\n isLeft: { true: { x: -25, opacity: 0 } },\n isRight: { true: { x: 25, opacity: 0 } },\n } as const,\n})\n\nconst HighlightTabs = () => {\n const [currentTab, setCurrentTab] = useState('tab1')\n const [focusIndicatorLayout, setFocusIndicatorLayout] =\n useState<TabTriggerLayout | null>(null)\n const [hoverIndicatorLayout, setHoverIndicatorLayout] =\n useState<TabTriggerLayout | null>(null)\n const [selectionIndicatorLayout, setSelectionIndicatorLayout] =\n useState<TabTriggerLayout | null>(null)\n const prevSelectionIndicatorLayout = useRef<TabTriggerLayout | null>(null)\n const handleUpdateSelectionIndicator = (newSize: TabTriggerLayout | null) => {\n prevSelectionIndicatorLayout.current = selectionIndicatorLayout\n setSelectionIndicatorLayout(newSize)\n }\n\n const intentIndicatorLayout = hoverIndicatorLayout || focusIndicatorLayout\n\n /**\n * -1: from left\n * 0: n/a\n * 1: from right\n */\n const direction = useMemo(() => {\n if (\n !selectionIndicatorLayout ||\n !prevSelectionIndicatorLayout.current ||\n selectionIndicatorLayout.x === prevSelectionIndicatorLayout.current.x\n ) {\n return 0\n }\n return selectionIndicatorLayout.x > prevSelectionIndicatorLayout.current.x ? 1 : -1\n }, [selectionIndicatorLayout])\n\n const enterVariant =\n direction === 1 ? 'isLeft' : direction === -1 ? 'isRight' : undefined\n const exitVariant =\n direction === 1 ? 'isRight' : direction === -1 ? 'isLeft' : undefined\n\n return (\n <Tabs\n value={currentTab}\n onValueChange={setCurrentTab}\n orientation=\"horizontal\"\n br=\"$4\"\n height={150}\n flexDirection=\"column\"\n activationMode=\"manual\"\n >\n <Tabs.List\n scrollable\n loop={false}\n aria-label=\"Manage your account\"\n disablePassBorderRadius\n >\n {intentIndicatorLayout && (\n <TabsRovingIndicator\n width={intentIndicatorLayout.width}\n height={intentIndicatorLayout.height}\n x={intentIndicatorLayout.x}\n y={intentIndicatorLayout.y}\n />\n )}\n {selectionIndicatorLayout && (\n <TabsRovingIndicator\n theme=\"active\"\n active\n width={selectionIndicatorLayout.width}\n height={selectionIndicatorLayout.height}\n x={selectionIndicatorLayout.x}\n y={selectionIndicatorLayout.y}\n />\n )}\n <Tabs.Trigger\n unstyled\n color=\"$color12\"\n value=\"tab1\"\n onSelectedLayoutChange={handleUpdateSelectionIndicator}\n onHoveredLayoutChange={setHoverIndicatorLayout}\n onFocusedLayoutChange={setFocusIndicatorLayout}\n >\n Profile\n </Tabs.Trigger>\n <Tabs.Trigger\n unstyled\n color=\"$color12\"\n value=\"tab2\"\n onSelectedLayoutChange={handleUpdateSelectionIndicator}\n onHoveredLayoutChange={setHoverIndicatorLayout}\n onFocusedLayoutChange={setFocusIndicatorLayout}\n >\n Connections\n </Tabs.Trigger>\n <Tabs.Trigger\n unstyled\n color=\"$color12\"\n value=\"tab3\"\n onSelectedLayoutChange={handleUpdateSelectionIndicator}\n onHoveredLayoutChange={setHoverIndicatorLayout}\n onFocusedLayoutChange={setFocusIndicatorLayout}\n >\n Notifications\n </Tabs.Trigger>\n </Tabs.List>\n\n <AnimatePresence\n exitBeforeEnter\n enterVariant={enterVariant}\n exitVariant={exitVariant}\n >\n <AnimatedYStack key={currentTab} animation=\"100ms\" x={0} o={1}>\n <Tabs.Content value={currentTab} forceMount p=\"$2\">\n <H5 ta=\"center\">{currentTab}</H5>\n </Tabs.Content>\n </AnimatedYStack>\n </AnimatePresence>\n </Tabs>\n )\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeM;AAfN,mBAA0C;AAC1C,qBASO;AAEA,SAAS,sBAAsB;AACpC,SACE,4CAAC,yBAAO,WAAU,QAAO,UAAS,QAAO,gBAAe,cAAa,IAAG,MACtE,sDAAC,iBAAc,GACjB;AAEJ;AAEA,MAAM,0BAAsB,uBAAO,sBAAO;AAAA,EACxC,MAAM;AAAA,EACN,UAAU;AAAA,IACR,QAAQ;AAAA,MACN,MAAM;AAAA,QACJ,iBA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AQ;AAAA,kBACR,OAAM;AAAA,kBACN,OAAM;AAAA,kBACN,wBAAwB;AAAA,kBACxB,uBAAuB;AAAA,kBACvB,uBAAuB;AAAA,kBACxB;AAAA;AAAA,cAED;AAAA;AAAA;AAAA,QACF;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,iBAAe;AAAA,YACf;AAAA,YACA;AAAA,YAEA,sDAAC,kBAAgC,WAAU,SAAQ,GAAG,GAAG,GAAG,GAC1D,sDAAC,oBAAK,SAAL,EAAa,OAAO,YAAY,YAAU,MAAC,GAAE,MAC5C,sDAAC,qBAAG,IAAG,UAAU,sBAAW,GAC9B,KAHmB,UAIrB;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { AnimatePresence, H5, Tabs, XStack, YStack } from "tamagui";
|
|
4
|
+
function TabsAnimatedDemo() {
|
|
5
|
+
return /* @__PURE__ */ jsx(XStack, { maxHeight: "100%", maxWidth: "100%", justifyContent: "flex-start", children: /* @__PURE__ */ jsxs(XStack, { space: "$3", px: "$8", children: [
|
|
6
|
+
/* @__PURE__ */ jsx(UnderlineTabs, {}),
|
|
7
|
+
/* @__PURE__ */ jsx(HighlightTabs, {})
|
|
8
|
+
] }) });
|
|
9
|
+
}
|
|
10
|
+
const UnderlineTabs = () => {
|
|
11
|
+
const [currentTab, setCurrentTab] = useState("tab1");
|
|
12
|
+
const [direction, setDirection] = useState(0);
|
|
13
|
+
return /* @__PURE__ */ jsxs(
|
|
14
|
+
Tabs,
|
|
15
|
+
{
|
|
16
|
+
value: currentTab,
|
|
17
|
+
onValueChange: setCurrentTab,
|
|
18
|
+
onDirectionChange: setDirection,
|
|
19
|
+
orientation: "vertical",
|
|
20
|
+
width: 300,
|
|
21
|
+
br: "$4",
|
|
22
|
+
ai: "center",
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsx(YStack, { borderColor: "$color3", borderRightWidth: "$0.5", mr: "$2", children: /* @__PURE__ */ jsxs(YStack, { children: [
|
|
25
|
+
/* @__PURE__ */ jsx(
|
|
26
|
+
Tabs.RovingIndicator,
|
|
27
|
+
{
|
|
28
|
+
highlightMode: "hoverOrFocus",
|
|
29
|
+
width: "$0.5",
|
|
30
|
+
right: 0,
|
|
31
|
+
animation: "100ms"
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
Tabs.RovingIndicator,
|
|
36
|
+
{
|
|
37
|
+
highlightMode: "select",
|
|
38
|
+
width: "$0.5",
|
|
39
|
+
right: 0,
|
|
40
|
+
animation: "100ms"
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ jsxs(Tabs.List, { "aria-label": "Manage your account", flexDirection: "column", children: [
|
|
44
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab1", children: "Profile" }),
|
|
45
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab2", children: "Connections" }),
|
|
46
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab3", children: "Notifications" })
|
|
47
|
+
] })
|
|
48
|
+
] }) }),
|
|
49
|
+
/* @__PURE__ */ jsx(AnimatePresence, { exitBeforeEnter: true, children: /* @__PURE__ */ jsx(
|
|
50
|
+
Tabs.Content,
|
|
51
|
+
{
|
|
52
|
+
value: currentTab,
|
|
53
|
+
forceMount: true,
|
|
54
|
+
p: "$2",
|
|
55
|
+
animation: "100ms",
|
|
56
|
+
o: 1,
|
|
57
|
+
y: 0,
|
|
58
|
+
f: 1,
|
|
59
|
+
enterStyle: {
|
|
60
|
+
...direction === -1 ? { y: -25 } : {},
|
|
61
|
+
...direction === 1 ? { y: 25 } : {},
|
|
62
|
+
opacity: 0
|
|
63
|
+
},
|
|
64
|
+
exitStyle: {
|
|
65
|
+
...direction === -1 ? { y: 25 } : {},
|
|
66
|
+
...direction === 1 ? { y: -25 } : {},
|
|
67
|
+
opacity: 0
|
|
68
|
+
},
|
|
69
|
+
children: /* @__PURE__ */ jsx(H5, { ta: "center", children: currentTab })
|
|
70
|
+
},
|
|
71
|
+
currentTab
|
|
72
|
+
) })
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
const HighlightTabs = () => {
|
|
78
|
+
const [currentTab, setCurrentTab] = useState("tab1");
|
|
79
|
+
const [direction, setDirection] = useState(0);
|
|
80
|
+
return /* @__PURE__ */ jsxs(
|
|
81
|
+
Tabs,
|
|
82
|
+
{
|
|
83
|
+
value: currentTab,
|
|
84
|
+
onValueChange: setCurrentTab,
|
|
85
|
+
onDirectionChange: setDirection,
|
|
86
|
+
orientation: "horizontal",
|
|
87
|
+
br: "$4",
|
|
88
|
+
flexDirection: "column",
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ jsxs(YStack, { children: [
|
|
91
|
+
/* @__PURE__ */ jsx(
|
|
92
|
+
Tabs.RovingIndicator,
|
|
93
|
+
{
|
|
94
|
+
highlightMode: "hoverOrFocus",
|
|
95
|
+
borderRadius: "$4",
|
|
96
|
+
animation: "100ms"
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
Tabs.RovingIndicator,
|
|
101
|
+
{
|
|
102
|
+
highlightMode: "select",
|
|
103
|
+
borderRadius: "$4",
|
|
104
|
+
animation: "100ms"
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
/* @__PURE__ */ jsxs(Tabs.List, { "aria-label": "Manage your account", children: [
|
|
108
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab1", children: "Profile" }),
|
|
109
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab2", children: "Connections" }),
|
|
110
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab3", children: "Notifications" })
|
|
111
|
+
] })
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ jsx(AnimatePresence, { exitBeforeEnter: true, children: /* @__PURE__ */ jsx(
|
|
114
|
+
Tabs.Content,
|
|
115
|
+
{
|
|
116
|
+
value: currentTab,
|
|
117
|
+
forceMount: true,
|
|
118
|
+
p: "$2",
|
|
119
|
+
animation: "100ms",
|
|
120
|
+
o: 1,
|
|
121
|
+
x: 0,
|
|
122
|
+
enterStyle: {
|
|
123
|
+
...direction === -1 ? { x: -25 } : {},
|
|
124
|
+
...direction === 1 ? { x: 25 } : {},
|
|
125
|
+
opacity: 0
|
|
126
|
+
},
|
|
127
|
+
exitStyle: {
|
|
128
|
+
...direction === -1 ? { x: 25 } : {},
|
|
129
|
+
...direction === 1 ? { x: -25 } : {},
|
|
130
|
+
opacity: 0
|
|
131
|
+
},
|
|
132
|
+
children: /* @__PURE__ */ jsx(H5, { ta: "center", children: currentTab })
|
|
133
|
+
},
|
|
134
|
+
currentTab
|
|
135
|
+
) })
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
export {
|
|
141
|
+
TabsAnimatedDemo
|
|
142
|
+
};
|
|
143
|
+
//# sourceMappingURL=TabsAnimatedDemo.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/TabsAnimatedDemo.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useState } from 'react'\nimport { AnimatePresence, H5, Tabs, XStack, YStack } from 'tamagui'\n\nexport function TabsAnimatedDemo() {\n return (\n <XStack maxHeight=\"100%\" maxWidth=\"100%\" justifyContent=\"flex-start\">\n <XStack space=\"$3\" px=\"$8\">\n <UnderlineTabs />\n <HighlightTabs />\n </XStack>\n </XStack>\n )\n}\n\nconst UnderlineTabs = () => {\n const [currentTab, setCurrentTab] = useState('tab1')\n const [direction, setDirection] = useState<-1 | 0 | 1>(0)\n\n return (\n <Tabs\n value={currentTab}\n onValueChange={setCurrentTab}\n onDirectionChange={setDirection}\n orientation=\"vertical\"\n width={300}\n br=\"$4\"\n ai=\"center\"\n >\n <YStack borderColor=\"$color3\" borderRightWidth=\"$0.5\" mr=\"$2\">\n <YStack>\n <Tabs.RovingIndicator\n highlightMode=\"hoverOrFocus\"\n width=\"$0.5\"\n right={0}\n animation=\"100ms\"\n />\n <Tabs.RovingIndicator\n highlightMode=\"select\"\n width=\"$0.5\"\n right={0}\n animation=\"100ms\"\n />\n <Tabs.List aria-label=\"Manage your account\" flexDirection=\"column\">\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab1\">\n Profile\n </Tabs.Trigger>\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab2\">\n Connections\n </Tabs.Trigger>\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab3\">\n Notifications\n </Tabs.Trigger>\n </Tabs.List>\n </YStack>\n </YStack>\n <AnimatePresence exitBeforeEnter>\n <Tabs.Content\n value={currentTab}\n key={currentTab}\n forceMount\n p=\"$2\"\n animation=\"100ms\"\n o={1}\n y={0}\n f={1}\n enterStyle={{\n ...(direction === -1 ? { y: -25 } : {}),\n ...(direction === 1 ? { y: 25 } : {}),\n opacity: 0,\n }}\n exitStyle={{\n ...(direction === -1 ? { y: 25 } : {}),\n ...(direction === 1 ? { y: -25 } : {}),\n opacity: 0,\n }}\n >\n <H5 ta=\"center\">{currentTab}</H5>\n </Tabs.Content>\n </AnimatePresence>\n </Tabs>\n )\n}\n\nconst HighlightTabs = () => {\n const [currentTab, setCurrentTab] = useState('tab1')\n const [direction, setDirection] = useState<-1 | 0 | 1>(0)\n\n return (\n <Tabs\n value={currentTab}\n onValueChange={setCurrentTab}\n onDirectionChange={setDirection}\n orientation=\"horizontal\"\n br=\"$4\"\n flexDirection=\"column\"\n >\n <YStack>\n <Tabs.RovingIndicator\n highlightMode=\"hoverOrFocus\"\n borderRadius=\"$4\"\n animation=\"100ms\"\n />\n <Tabs.RovingIndicator\n highlightMode=\"select\"\n borderRadius=\"$4\"\n animation=\"100ms\"\n />\n <Tabs.List aria-label=\"Manage your account\">\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab1\">\n Profile\n </Tabs.Trigger>\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab2\">\n Connections\n </Tabs.Trigger>\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab3\">\n Notifications\n </Tabs.Trigger>\n </Tabs.List>\n </YStack>\n <AnimatePresence exitBeforeEnter>\n <Tabs.Content\n value={currentTab}\n key={currentTab}\n forceMount\n p=\"$2\"\n animation=\"100ms\"\n o={1}\n x={0}\n enterStyle={{\n ...(direction === -1 ? { x: -25 } : {}),\n ...(direction === 1 ? { x: 25 } : {}),\n opacity: 0,\n }}\n exitStyle={{\n ...(direction === -1 ? { x: 25 } : {}),\n ...(direction === 1 ? { x: -25 } : {}),\n opacity: 0,\n }}\n >\n <H5 ta=\"center\">{currentTab}</H5>\n </Tabs.Content>\n </AnimatePresence>\n </Tabs>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAMM,SACE,KADF;AANN,SAAS,gBAAgB;AACzB,SAAS,iBAAiB,IAAI,MAAM,QAAQ,cAAc;AAEnD,SAAS,mBAAmB;AACjC,SACE,oBAAC,UAAO,WAAU,QAAO,UAAS,QAAO,gBAAe,cACtD,+BAAC,UAAO,OAAM,MAAK,IAAG,MACpB;AAAA,wBAAC,iBAAc;AAAA,IACf,oBAAC,iBAAc;AAAA,KACjB,GACF;AAEJ;AAEA,MAAM,gBAAgB,MAAM;AAC1B,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,MAAM;AACnD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAqB,CAAC;AAExD,SACE;AAAA,IAAC;AAAA;A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,CAAC;AAAA,cACrC,GAAI,cAAc,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC;AAAA,cACnC,SAAS;AAAA,YACX;AAAA,YACA,WAAW;AAAA,cACT,GAAI,cAAc,KAAK,EAAE,GAAG,GAAG,IAAI,CAAC;AAAA,cACpC,GAAI,cAAc,IAAI,EAAE,GAAG,IAAI,IAAI,CAAC;AAAA,cACpC,SAAS;AAAA,YACX;AAAA,YAEA,8BAAC,MAAG,IAAG,UAAU,sBAAW;AAAA;AAAA,UAjBvB;AAAA,QAkBP,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { AnimatePresence, H5, Tabs, XStack, YStack } from "tamagui";
|
|
4
|
+
function TabsAnimatedDemo() {
|
|
5
|
+
return /* @__PURE__ */ jsx(XStack, { maxHeight: "100%", maxWidth: "100%", justifyContent: "flex-start", children: /* @__PURE__ */ jsxs(XStack, { space: "$3", px: "$8", children: [
|
|
6
|
+
/* @__PURE__ */ jsx(UnderlineTabs, {}),
|
|
7
|
+
/* @__PURE__ */ jsx(HighlightTabs, {})
|
|
8
|
+
] }) });
|
|
9
|
+
}
|
|
10
|
+
const UnderlineTabs = () => {
|
|
11
|
+
const [currentTab, setCurrentTab] = useState("tab1");
|
|
12
|
+
const [direction, setDirection] = useState(0);
|
|
13
|
+
return /* @__PURE__ */ jsxs(
|
|
14
|
+
Tabs,
|
|
15
|
+
{
|
|
16
|
+
value: currentTab,
|
|
17
|
+
onValueChange: setCurrentTab,
|
|
18
|
+
onDirectionChange: setDirection,
|
|
19
|
+
orientation: "vertical",
|
|
20
|
+
width: 300,
|
|
21
|
+
br: "$4",
|
|
22
|
+
ai: "center",
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsx(YStack, { borderColor: "$color3", borderRightWidth: "$0.5", mr: "$2", children: /* @__PURE__ */ jsxs(YStack, { children: [
|
|
25
|
+
/* @__PURE__ */ jsx(
|
|
26
|
+
Tabs.RovingIndicator,
|
|
27
|
+
{
|
|
28
|
+
highlightMode: "hoverOrFocus",
|
|
29
|
+
width: "$0.5",
|
|
30
|
+
right: 0,
|
|
31
|
+
animation: "100ms"
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
Tabs.RovingIndicator,
|
|
36
|
+
{
|
|
37
|
+
highlightMode: "select",
|
|
38
|
+
width: "$0.5",
|
|
39
|
+
right: 0,
|
|
40
|
+
animation: "100ms"
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ jsxs(Tabs.List, { "aria-label": "Manage your account", flexDirection: "column", children: [
|
|
44
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab1", children: "Profile" }),
|
|
45
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab2", children: "Connections" }),
|
|
46
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab3", children: "Notifications" })
|
|
47
|
+
] })
|
|
48
|
+
] }) }),
|
|
49
|
+
/* @__PURE__ */ jsx(AnimatePresence, { exitBeforeEnter: true, children: /* @__PURE__ */ jsx(
|
|
50
|
+
Tabs.Content,
|
|
51
|
+
{
|
|
52
|
+
value: currentTab,
|
|
53
|
+
forceMount: true,
|
|
54
|
+
p: "$2",
|
|
55
|
+
animation: "100ms",
|
|
56
|
+
o: 1,
|
|
57
|
+
y: 0,
|
|
58
|
+
f: 1,
|
|
59
|
+
enterStyle: {
|
|
60
|
+
...direction === -1 ? { y: -25 } : {},
|
|
61
|
+
...direction === 1 ? { y: 25 } : {},
|
|
62
|
+
opacity: 0
|
|
63
|
+
},
|
|
64
|
+
exitStyle: {
|
|
65
|
+
...direction === -1 ? { y: 25 } : {},
|
|
66
|
+
...direction === 1 ? { y: -25 } : {},
|
|
67
|
+
opacity: 0
|
|
68
|
+
},
|
|
69
|
+
children: /* @__PURE__ */ jsx(H5, { ta: "center", children: currentTab })
|
|
70
|
+
},
|
|
71
|
+
currentTab
|
|
72
|
+
) })
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
const HighlightTabs = () => {
|
|
78
|
+
const [currentTab, setCurrentTab] = useState("tab1");
|
|
79
|
+
const [direction, setDirection] = useState(0);
|
|
80
|
+
return /* @__PURE__ */ jsxs(
|
|
81
|
+
Tabs,
|
|
82
|
+
{
|
|
83
|
+
value: currentTab,
|
|
84
|
+
onValueChange: setCurrentTab,
|
|
85
|
+
onDirectionChange: setDirection,
|
|
86
|
+
orientation: "horizontal",
|
|
87
|
+
br: "$4",
|
|
88
|
+
flexDirection: "column",
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ jsxs(YStack, { children: [
|
|
91
|
+
/* @__PURE__ */ jsx(
|
|
92
|
+
Tabs.RovingIndicator,
|
|
93
|
+
{
|
|
94
|
+
highlightMode: "hoverOrFocus",
|
|
95
|
+
borderRadius: "$4",
|
|
96
|
+
animation: "100ms"
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
Tabs.RovingIndicator,
|
|
101
|
+
{
|
|
102
|
+
highlightMode: "select",
|
|
103
|
+
borderRadius: "$4",
|
|
104
|
+
animation: "100ms"
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
/* @__PURE__ */ jsxs(Tabs.List, { "aria-label": "Manage your account", children: [
|
|
108
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab1", children: "Profile" }),
|
|
109
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab2", children: "Connections" }),
|
|
110
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { unstyled: true, color: "$color12", value: "tab3", children: "Notifications" })
|
|
111
|
+
] })
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ jsx(AnimatePresence, { exitBeforeEnter: true, children: /* @__PURE__ */ jsx(
|
|
114
|
+
Tabs.Content,
|
|
115
|
+
{
|
|
116
|
+
value: currentTab,
|
|
117
|
+
forceMount: true,
|
|
118
|
+
p: "$2",
|
|
119
|
+
animation: "100ms",
|
|
120
|
+
o: 1,
|
|
121
|
+
x: 0,
|
|
122
|
+
enterStyle: {
|
|
123
|
+
...direction === -1 ? { x: -25 } : {},
|
|
124
|
+
...direction === 1 ? { x: 25 } : {},
|
|
125
|
+
opacity: 0
|
|
126
|
+
},
|
|
127
|
+
exitStyle: {
|
|
128
|
+
...direction === -1 ? { x: 25 } : {},
|
|
129
|
+
...direction === 1 ? { x: -25 } : {},
|
|
130
|
+
opacity: 0
|
|
131
|
+
},
|
|
132
|
+
children: /* @__PURE__ */ jsx(H5, { ta: "center", children: currentTab })
|
|
133
|
+
},
|
|
134
|
+
currentTab
|
|
135
|
+
) })
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
export {
|
|
141
|
+
TabsAnimatedDemo
|
|
142
|
+
};
|
|
143
|
+
//# sourceMappingURL=TabsAnimatedDemo.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/TabsAnimatedDemo.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useState } from 'react'\nimport { AnimatePresence, H5, Tabs, XStack, YStack } from 'tamagui'\n\nexport function TabsAnimatedDemo() {\n return (\n <XStack maxHeight=\"100%\" maxWidth=\"100%\" justifyContent=\"flex-start\">\n <XStack space=\"$3\" px=\"$8\">\n <UnderlineTabs />\n <HighlightTabs />\n </XStack>\n </XStack>\n )\n}\n\nconst UnderlineTabs = () => {\n const [currentTab, setCurrentTab] = useState('tab1')\n const [direction, setDirection] = useState<-1 | 0 | 1>(0)\n\n return (\n <Tabs\n value={currentTab}\n onValueChange={setCurrentTab}\n onDirectionChange={setDirection}\n orientation=\"vertical\"\n width={300}\n br=\"$4\"\n ai=\"center\"\n >\n <YStack borderColor=\"$color3\" borderRightWidth=\"$0.5\" mr=\"$2\">\n <YStack>\n <Tabs.RovingIndicator\n highlightMode=\"hoverOrFocus\"\n width=\"$0.5\"\n right={0}\n animation=\"100ms\"\n />\n <Tabs.RovingIndicator\n highlightMode=\"select\"\n width=\"$0.5\"\n right={0}\n animation=\"100ms\"\n />\n <Tabs.List aria-label=\"Manage your account\" flexDirection=\"column\">\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab1\">\n Profile\n </Tabs.Trigger>\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab2\">\n Connections\n </Tabs.Trigger>\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab3\">\n Notifications\n </Tabs.Trigger>\n </Tabs.List>\n </YStack>\n </YStack>\n <AnimatePresence exitBeforeEnter>\n <Tabs.Content\n value={currentTab}\n key={currentTab}\n forceMount\n p=\"$2\"\n animation=\"100ms\"\n o={1}\n y={0}\n f={1}\n enterStyle={{\n ...(direction === -1 ? { y: -25 } : {}),\n ...(direction === 1 ? { y: 25 } : {}),\n opacity: 0,\n }}\n exitStyle={{\n ...(direction === -1 ? { y: 25 } : {}),\n ...(direction === 1 ? { y: -25 } : {}),\n opacity: 0,\n }}\n >\n <H5 ta=\"center\">{currentTab}</H5>\n </Tabs.Content>\n </AnimatePresence>\n </Tabs>\n )\n}\n\nconst HighlightTabs = () => {\n const [currentTab, setCurrentTab] = useState('tab1')\n const [direction, setDirection] = useState<-1 | 0 | 1>(0)\n\n return (\n <Tabs\n value={currentTab}\n onValueChange={setCurrentTab}\n onDirectionChange={setDirection}\n orientation=\"horizontal\"\n br=\"$4\"\n flexDirection=\"column\"\n >\n <YStack>\n <Tabs.RovingIndicator\n highlightMode=\"hoverOrFocus\"\n borderRadius=\"$4\"\n animation=\"100ms\"\n />\n <Tabs.RovingIndicator\n highlightMode=\"select\"\n borderRadius=\"$4\"\n animation=\"100ms\"\n />\n <Tabs.List aria-label=\"Manage your account\">\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab1\">\n Profile\n </Tabs.Trigger>\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab2\">\n Connections\n </Tabs.Trigger>\n <Tabs.Trigger unstyled color=\"$color12\" value=\"tab3\">\n Notifications\n </Tabs.Trigger>\n </Tabs.List>\n </YStack>\n <AnimatePresence exitBeforeEnter>\n <Tabs.Content\n value={currentTab}\n key={currentTab}\n forceMount\n p=\"$2\"\n animation=\"100ms\"\n o={1}\n x={0}\n enterStyle={{\n ...(direction === -1 ? { x: -25 } : {}),\n ...(direction === 1 ? { x: 25 } : {}),\n opacity: 0,\n }}\n exitStyle={{\n ...(direction === -1 ? { x: 25 } : {}),\n ...(direction === 1 ? { x: -25 } : {}),\n opacity: 0,\n }}\n >\n <H5 ta=\"center\">{currentTab}</H5>\n </Tabs.Content>\n </AnimatePresence>\n </Tabs>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAMM,SACE,KADF;AANN,SAAS,gBAAgB;AACzB,SAAS,iBAAiB,IAAI,MAAM,QAAQ,cAAc;AAEnD,SAAS,mBAAmB;AACjC,SACE,oBAAC,UAAO,WAAU,QAAO,UAAS,QAAO,gBAAe,cACtD,+BAAC,UAAO,OAAM,MAAK,IAAG,MACpB;AAAA,wBAAC,iBAAc;AAAA,IACf,oBAAC,iBAAc;AAAA,KACjB,GACF;AAEJ;AAEA,MAAM,gBAAgB,MAAM;AAC1B,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,MAAM;AACnD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAqB,CAAC;AAExD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,eAAe;AAAA,MACf,mBAAmB;AAAA,MACnB,aAAY;AAAA,MACZ,O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