@tamagui/demos 1.88.12 → 1.89.0-1706308641099
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/LICENSE +21 -0
- package/dist/esm/AccordionDemo.mjs +58 -0
- package/dist/esm/AddThemeDemo.mjs +35 -0
- package/dist/esm/AlertDialogDemo.mjs +72 -0
- package/dist/esm/AnimationsDemo.mjs +75 -0
- package/dist/esm/AnimationsEnterDemo.mjs +40 -0
- package/dist/esm/AnimationsHoverDemo.mjs +23 -0
- package/dist/esm/AnimationsPresenceDemo.mjs +88 -0
- package/dist/esm/AnimationsTimingDemo.mjs +22 -0
- package/dist/esm/AvatarDemo.mjs +29 -0
- package/dist/esm/BuildAButtonDemo.mjs +101 -0
- package/dist/esm/ButtonDemo.mjs +59 -0
- package/dist/esm/CardDemo.mjs +64 -0
- package/dist/esm/CheckboxDemo.mjs +45 -0
- package/dist/esm/ColorsDemo.mjs +97 -0
- package/dist/esm/DialogDemo.mjs +136 -0
- package/dist/esm/FormsDemo.mjs +35 -0
- package/dist/esm/Grid.mjs +37 -0
- package/dist/esm/GroupDemo.mjs +61 -0
- package/dist/esm/HeadingsDemo.mjs +21 -0
- package/dist/esm/ImageDemo.mjs +12 -0
- package/dist/esm/InputsDemo.mjs +36 -0
- package/dist/esm/LabelDemo.mjs +36 -0
- package/dist/esm/LinearGradientDemo.mjs +24 -0
- package/dist/esm/ListItemDemo.mjs +76 -0
- package/dist/esm/LucideIconsDemo.mjs +58 -0
- package/dist/esm/PopoverDemo.mjs +106 -0
- package/dist/esm/ProgressDemo.mjs +64 -0
- package/dist/esm/RadioGroupDemo.mjs +46 -0
- package/dist/esm/ReplaceThemeDemo.mjs +43 -0
- package/dist/esm/ScrollViewDemo.mjs +50 -0
- package/dist/esm/SelectDemo.mjs +188 -0
- package/dist/esm/SeparatorDemo.mjs +36 -0
- package/dist/esm/ShapesDemo.mjs +18 -0
- package/dist/esm/SheetDemo.mjs +141 -0
- package/dist/esm/SliderDemo.mjs +34 -0
- package/dist/esm/SpinnerDemo.mjs +17 -0
- package/dist/esm/StacksDemo.mjs +80 -0
- package/dist/esm/SwitchDemo.mjs +81 -0
- package/dist/esm/TabsAdvancedDemo.mjs +303 -0
- package/dist/esm/TabsDemo.mjs +158 -0
- package/dist/esm/TextDemo.mjs +28 -0
- package/dist/esm/ThemeBuilderDemo.mjs +154 -0
- package/dist/esm/ThemeInverseDemo.mjs +45 -0
- package/dist/esm/ToastDemo.mjs +98 -0
- package/dist/esm/ToastDuplicateDemo.mjs +48 -0
- package/dist/esm/ToggleGroupDemo.mjs +73 -0
- package/dist/esm/TokensDemo.mjs +90 -0
- package/dist/esm/TooltipDemo.mjs +101 -0
- package/dist/esm/UpdateThemeDemo.mjs +46 -0
- package/dist/esm/index.mjs +49 -0
- package/dist/esm/tamagui.config.mjs +4 -0
- package/dist/esm/useOnIntersecting.mjs +43 -0
- package/dist/jsx/AccordionDemo.mjs +58 -0
- package/dist/jsx/AddThemeDemo.mjs +35 -0
- package/dist/jsx/AlertDialogDemo.mjs +72 -0
- package/dist/jsx/AnimationsDemo.mjs +75 -0
- package/dist/jsx/AnimationsEnterDemo.mjs +40 -0
- package/dist/jsx/AnimationsHoverDemo.mjs +23 -0
- package/dist/jsx/AnimationsPresenceDemo.mjs +88 -0
- package/dist/jsx/AnimationsTimingDemo.mjs +22 -0
- package/dist/jsx/AvatarDemo.mjs +29 -0
- package/dist/jsx/BuildAButtonDemo.mjs +101 -0
- package/dist/jsx/ButtonDemo.mjs +59 -0
- package/dist/jsx/CardDemo.mjs +64 -0
- package/dist/jsx/CheckboxDemo.mjs +45 -0
- package/dist/jsx/ColorsDemo.mjs +97 -0
- package/dist/jsx/DialogDemo.mjs +136 -0
- package/dist/jsx/FormsDemo.mjs +35 -0
- package/dist/jsx/Grid.mjs +37 -0
- package/dist/jsx/GroupDemo.mjs +61 -0
- package/dist/jsx/HeadingsDemo.mjs +21 -0
- package/dist/jsx/ImageDemo.mjs +12 -0
- package/dist/jsx/InputsDemo.mjs +36 -0
- package/dist/jsx/LabelDemo.mjs +36 -0
- package/dist/jsx/LinearGradientDemo.mjs +24 -0
- package/dist/jsx/ListItemDemo.mjs +76 -0
- package/dist/jsx/LucideIconsDemo.mjs +58 -0
- package/dist/jsx/PopoverDemo.mjs +106 -0
- package/dist/jsx/ProgressDemo.mjs +64 -0
- package/dist/jsx/RadioGroupDemo.mjs +46 -0
- package/dist/jsx/ReplaceThemeDemo.mjs +43 -0
- package/dist/jsx/ScrollViewDemo.mjs +50 -0
- package/dist/jsx/SelectDemo.mjs +188 -0
- package/dist/jsx/SeparatorDemo.mjs +36 -0
- package/dist/jsx/ShapesDemo.mjs +18 -0
- package/dist/jsx/SheetDemo.mjs +141 -0
- package/dist/jsx/SliderDemo.mjs +34 -0
- package/dist/jsx/SpinnerDemo.mjs +17 -0
- package/dist/jsx/StacksDemo.mjs +80 -0
- package/dist/jsx/SwitchDemo.mjs +81 -0
- package/dist/jsx/TabsAdvancedDemo.mjs +303 -0
- package/dist/jsx/TabsDemo.mjs +158 -0
- package/dist/jsx/TextDemo.mjs +28 -0
- package/dist/jsx/ThemeBuilderDemo.mjs +154 -0
- package/dist/jsx/ThemeInverseDemo.mjs +45 -0
- package/dist/jsx/ToastDemo.mjs +98 -0
- package/dist/jsx/ToastDuplicateDemo.mjs +48 -0
- package/dist/jsx/ToggleGroupDemo.mjs +73 -0
- package/dist/jsx/TokensDemo.mjs +90 -0
- package/dist/jsx/TooltipDemo.mjs +101 -0
- package/dist/jsx/UpdateThemeDemo.mjs +46 -0
- package/dist/jsx/index.mjs +49 -0
- package/dist/jsx/tamagui.config.mjs +4 -0
- package/dist/jsx/useOnIntersecting.mjs +43 -0
- package/package.json +18 -18
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { AnimatePresence, Button, H5, SizableText, Tabs, XStack, YStack, styled } from "tamagui";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
const demos = ["background", "underline"],
|
|
5
|
+
demosTitle = {
|
|
6
|
+
background: "Background Indicator",
|
|
7
|
+
underline: "Underline Indicator"
|
|
8
|
+
},
|
|
9
|
+
TabsAdvancedDemo = () => {
|
|
10
|
+
const [demoIndex, setDemoIndex] = useState(0),
|
|
11
|
+
demo = demos[demoIndex];
|
|
12
|
+
return /* @__PURE__ */jsxs(Fragment, {
|
|
13
|
+
children: [demo === "underline" ? /* @__PURE__ */jsx(TabsAdvancedUnderline, {}) : /* @__PURE__ */jsx(TabsAdvancedBackground, {}), /* @__PURE__ */jsx(XStack, {
|
|
14
|
+
alignItems: "center",
|
|
15
|
+
space: !0,
|
|
16
|
+
position: "absolute",
|
|
17
|
+
bottom: "$3",
|
|
18
|
+
left: "$4",
|
|
19
|
+
$xxs: {
|
|
20
|
+
display: "none"
|
|
21
|
+
},
|
|
22
|
+
children: /* @__PURE__ */jsx(Button, {
|
|
23
|
+
size: "$2",
|
|
24
|
+
onPress: () => setDemoIndex(x => (x + 1) % demos.length),
|
|
25
|
+
children: demosTitle[demo]
|
|
26
|
+
})
|
|
27
|
+
})]
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
TabsAdvancedBackground = () => {
|
|
31
|
+
const [tabState, setTabState] = useState({
|
|
32
|
+
activeAt: null,
|
|
33
|
+
currentTab: "tab1",
|
|
34
|
+
intentAt: null,
|
|
35
|
+
prevActiveAt: null
|
|
36
|
+
}),
|
|
37
|
+
setCurrentTab = currentTab2 => setTabState({
|
|
38
|
+
...tabState,
|
|
39
|
+
currentTab: currentTab2
|
|
40
|
+
}),
|
|
41
|
+
setIntentIndicator = intentAt2 => setTabState({
|
|
42
|
+
...tabState,
|
|
43
|
+
intentAt: intentAt2
|
|
44
|
+
}),
|
|
45
|
+
setActiveIndicator = activeAt2 => setTabState({
|
|
46
|
+
...tabState,
|
|
47
|
+
prevActiveAt: tabState.activeAt,
|
|
48
|
+
activeAt: activeAt2
|
|
49
|
+
}),
|
|
50
|
+
{
|
|
51
|
+
activeAt,
|
|
52
|
+
intentAt,
|
|
53
|
+
prevActiveAt,
|
|
54
|
+
currentTab
|
|
55
|
+
} = tabState,
|
|
56
|
+
direction = !activeAt || !prevActiveAt || activeAt.x === prevActiveAt.x ? 0 : activeAt.x > prevActiveAt.x ? -1 : 1,
|
|
57
|
+
enterVariant = direction === 1 ? "isLeft" : direction === -1 ? "isRight" : "defaultFade",
|
|
58
|
+
exitVariant = direction === 1 ? "isRight" : direction === -1 ? "isLeft" : "defaultFade",
|
|
59
|
+
handleOnInteraction = (type, layout) => {
|
|
60
|
+
type === "select" ? setActiveIndicator(layout) : setIntentIndicator(layout);
|
|
61
|
+
};
|
|
62
|
+
return /* @__PURE__ */jsxs(Tabs, {
|
|
63
|
+
value: currentTab,
|
|
64
|
+
onValueChange: setCurrentTab,
|
|
65
|
+
orientation: "horizontal",
|
|
66
|
+
size: "$4",
|
|
67
|
+
padding: "$2",
|
|
68
|
+
height: 150,
|
|
69
|
+
flexDirection: "column",
|
|
70
|
+
activationMode: "manual",
|
|
71
|
+
backgroundColor: "$background",
|
|
72
|
+
borderRadius: "$4",
|
|
73
|
+
position: "relative",
|
|
74
|
+
children: [/* @__PURE__ */jsxs(YStack, {
|
|
75
|
+
children: [/* @__PURE__ */jsx(AnimatePresence, {
|
|
76
|
+
children: intentAt && /* @__PURE__ */jsx(TabsRovingIndicator, {
|
|
77
|
+
borderRadius: "$4",
|
|
78
|
+
width: intentAt.width,
|
|
79
|
+
height: intentAt.height,
|
|
80
|
+
x: intentAt.x,
|
|
81
|
+
y: intentAt.y
|
|
82
|
+
})
|
|
83
|
+
}), /* @__PURE__ */jsx(AnimatePresence, {
|
|
84
|
+
children: activeAt && /* @__PURE__ */jsx(TabsRovingIndicator, {
|
|
85
|
+
borderRadius: "$4",
|
|
86
|
+
theme: "active",
|
|
87
|
+
width: activeAt.width,
|
|
88
|
+
height: activeAt.height,
|
|
89
|
+
x: activeAt.x,
|
|
90
|
+
y: activeAt.y
|
|
91
|
+
})
|
|
92
|
+
}), /* @__PURE__ */jsxs(Tabs.List, {
|
|
93
|
+
disablePassBorderRadius: !0,
|
|
94
|
+
loop: !1,
|
|
95
|
+
"aria-label": "Manage your account",
|
|
96
|
+
space: "$2",
|
|
97
|
+
backgroundColor: "transparent",
|
|
98
|
+
children: [/* @__PURE__ */jsx(Tabs.Tab, {
|
|
99
|
+
unstyled: !0,
|
|
100
|
+
value: "tab1",
|
|
101
|
+
onInteraction: handleOnInteraction,
|
|
102
|
+
children: /* @__PURE__ */jsx(SizableText, {
|
|
103
|
+
children: "Profile"
|
|
104
|
+
})
|
|
105
|
+
}), /* @__PURE__ */jsx(Tabs.Tab, {
|
|
106
|
+
unstyled: !0,
|
|
107
|
+
value: "tab2",
|
|
108
|
+
onInteraction: handleOnInteraction,
|
|
109
|
+
children: /* @__PURE__ */jsx(SizableText, {
|
|
110
|
+
children: "Connections"
|
|
111
|
+
})
|
|
112
|
+
}), /* @__PURE__ */jsx(Tabs.Tab, {
|
|
113
|
+
unstyled: !0,
|
|
114
|
+
value: "tab3",
|
|
115
|
+
onInteraction: handleOnInteraction,
|
|
116
|
+
children: /* @__PURE__ */jsx(SizableText, {
|
|
117
|
+
children: "Notifications"
|
|
118
|
+
})
|
|
119
|
+
})]
|
|
120
|
+
})]
|
|
121
|
+
}), /* @__PURE__ */jsx(AnimatePresence, {
|
|
122
|
+
exitBeforeEnter: !0,
|
|
123
|
+
enterVariant,
|
|
124
|
+
exitVariant,
|
|
125
|
+
children: /* @__PURE__ */jsx(AnimatedYStack, {
|
|
126
|
+
animation: "100ms",
|
|
127
|
+
x: 0,
|
|
128
|
+
opacity: 1,
|
|
129
|
+
flex: 1,
|
|
130
|
+
children: /* @__PURE__ */jsx(Tabs.Content, {
|
|
131
|
+
value: currentTab,
|
|
132
|
+
forceMount: !0,
|
|
133
|
+
flex: 1,
|
|
134
|
+
justifyContent: "center",
|
|
135
|
+
children: /* @__PURE__ */jsx(H5, {
|
|
136
|
+
textAlign: "center",
|
|
137
|
+
children: currentTab
|
|
138
|
+
})
|
|
139
|
+
})
|
|
140
|
+
}, currentTab)
|
|
141
|
+
})]
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
TabsAdvancedUnderline = () => {
|
|
145
|
+
const [tabState, setTabState] = useState({
|
|
146
|
+
activeAt: null,
|
|
147
|
+
currentTab: "tab1",
|
|
148
|
+
intentAt: null,
|
|
149
|
+
prevActiveAt: null
|
|
150
|
+
}),
|
|
151
|
+
setCurrentTab = currentTab2 => setTabState({
|
|
152
|
+
...tabState,
|
|
153
|
+
currentTab: currentTab2
|
|
154
|
+
}),
|
|
155
|
+
setIntentIndicator = intentAt2 => setTabState({
|
|
156
|
+
...tabState,
|
|
157
|
+
intentAt: intentAt2
|
|
158
|
+
}),
|
|
159
|
+
setActiveIndicator = activeAt2 => setTabState({
|
|
160
|
+
...tabState,
|
|
161
|
+
prevActiveAt: tabState.activeAt,
|
|
162
|
+
activeAt: activeAt2
|
|
163
|
+
}),
|
|
164
|
+
{
|
|
165
|
+
activeAt,
|
|
166
|
+
intentAt,
|
|
167
|
+
prevActiveAt,
|
|
168
|
+
currentTab
|
|
169
|
+
} = tabState,
|
|
170
|
+
direction = !activeAt || !prevActiveAt || activeAt.x === prevActiveAt.x ? 0 : activeAt.x > prevActiveAt.x ? -1 : 1,
|
|
171
|
+
enterVariant = direction === 1 ? "isLeft" : direction === -1 ? "isRight" : "defaultFade",
|
|
172
|
+
exitVariant = direction === 1 ? "isRight" : direction === -1 ? "isLeft" : "defaultFade",
|
|
173
|
+
handleOnInteraction = (type, layout) => {
|
|
174
|
+
type === "select" ? setActiveIndicator(layout) : setIntentIndicator(layout);
|
|
175
|
+
};
|
|
176
|
+
return /* @__PURE__ */jsxs(Tabs, {
|
|
177
|
+
value: currentTab,
|
|
178
|
+
onValueChange: setCurrentTab,
|
|
179
|
+
orientation: "horizontal",
|
|
180
|
+
size: "$4",
|
|
181
|
+
height: 150,
|
|
182
|
+
flexDirection: "column",
|
|
183
|
+
activationMode: "manual",
|
|
184
|
+
backgroundColor: "$background",
|
|
185
|
+
borderRadius: "$4",
|
|
186
|
+
children: [/* @__PURE__ */jsxs(YStack, {
|
|
187
|
+
children: [/* @__PURE__ */jsx(AnimatePresence, {
|
|
188
|
+
children: intentAt && /* @__PURE__ */jsx(TabsRovingIndicator, {
|
|
189
|
+
width: intentAt.width,
|
|
190
|
+
height: "$0.5",
|
|
191
|
+
x: intentAt.x,
|
|
192
|
+
bottom: 0
|
|
193
|
+
})
|
|
194
|
+
}), /* @__PURE__ */jsx(AnimatePresence, {
|
|
195
|
+
children: activeAt && /* @__PURE__ */jsx(TabsRovingIndicator, {
|
|
196
|
+
theme: "active",
|
|
197
|
+
active: !0,
|
|
198
|
+
width: activeAt.width,
|
|
199
|
+
height: "$0.5",
|
|
200
|
+
x: activeAt.x,
|
|
201
|
+
bottom: 0
|
|
202
|
+
})
|
|
203
|
+
}), /* @__PURE__ */jsxs(Tabs.List, {
|
|
204
|
+
disablePassBorderRadius: !0,
|
|
205
|
+
loop: !1,
|
|
206
|
+
"aria-label": "Manage your account",
|
|
207
|
+
borderBottomLeftRadius: 0,
|
|
208
|
+
borderBottomRightRadius: 0,
|
|
209
|
+
paddingBottom: "$1.5",
|
|
210
|
+
borderColor: "$color3",
|
|
211
|
+
borderBottomWidth: "$0.5",
|
|
212
|
+
backgroundColor: "transparent",
|
|
213
|
+
children: [/* @__PURE__ */jsx(Tabs.Tab, {
|
|
214
|
+
unstyled: !0,
|
|
215
|
+
padding: "$5",
|
|
216
|
+
value: "tab1",
|
|
217
|
+
onInteraction: handleOnInteraction,
|
|
218
|
+
children: /* @__PURE__ */jsx(SizableText, {
|
|
219
|
+
children: "Profile"
|
|
220
|
+
})
|
|
221
|
+
}), /* @__PURE__ */jsx(Tabs.Tab, {
|
|
222
|
+
unstyled: !0,
|
|
223
|
+
padding: "$5",
|
|
224
|
+
value: "tab2",
|
|
225
|
+
onInteraction: handleOnInteraction,
|
|
226
|
+
children: /* @__PURE__ */jsx(SizableText, {
|
|
227
|
+
children: "Connections"
|
|
228
|
+
})
|
|
229
|
+
}), /* @__PURE__ */jsx(Tabs.Tab, {
|
|
230
|
+
unstyled: !0,
|
|
231
|
+
padding: "$5",
|
|
232
|
+
value: "tab3",
|
|
233
|
+
onInteraction: handleOnInteraction,
|
|
234
|
+
children: /* @__PURE__ */jsx(SizableText, {
|
|
235
|
+
children: "Notifications"
|
|
236
|
+
})
|
|
237
|
+
})]
|
|
238
|
+
})]
|
|
239
|
+
}), /* @__PURE__ */jsx(AnimatePresence, {
|
|
240
|
+
exitBeforeEnter: !0,
|
|
241
|
+
enterVariant,
|
|
242
|
+
exitVariant,
|
|
243
|
+
children: /* @__PURE__ */jsx(AnimatedYStack, {
|
|
244
|
+
animation: "100ms",
|
|
245
|
+
x: 0,
|
|
246
|
+
opacity: 1,
|
|
247
|
+
flex: 1,
|
|
248
|
+
children: /* @__PURE__ */jsx(Tabs.Content, {
|
|
249
|
+
value: currentTab,
|
|
250
|
+
forceMount: !0,
|
|
251
|
+
flex: 1,
|
|
252
|
+
justifyContent: "center",
|
|
253
|
+
children: /* @__PURE__ */jsx(H5, {
|
|
254
|
+
textAlign: "center",
|
|
255
|
+
children: currentTab
|
|
256
|
+
})
|
|
257
|
+
})
|
|
258
|
+
}, currentTab)
|
|
259
|
+
})]
|
|
260
|
+
});
|
|
261
|
+
},
|
|
262
|
+
TabsRovingIndicator = ({
|
|
263
|
+
active,
|
|
264
|
+
...props
|
|
265
|
+
}) => /* @__PURE__ */jsx(YStack, {
|
|
266
|
+
position: "absolute",
|
|
267
|
+
backgroundColor: "$color5",
|
|
268
|
+
opacity: 0.7,
|
|
269
|
+
animation: "100ms",
|
|
270
|
+
enterStyle: {
|
|
271
|
+
opacity: 0
|
|
272
|
+
},
|
|
273
|
+
exitStyle: {
|
|
274
|
+
opacity: 0
|
|
275
|
+
},
|
|
276
|
+
...(active && {
|
|
277
|
+
backgroundColor: "$color8",
|
|
278
|
+
opacity: 0.6
|
|
279
|
+
}),
|
|
280
|
+
...props
|
|
281
|
+
}),
|
|
282
|
+
AnimatedYStack = styled(YStack, {
|
|
283
|
+
variants: {
|
|
284
|
+
isLeft: {
|
|
285
|
+
true: {
|
|
286
|
+
x: -25,
|
|
287
|
+
opacity: 0
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
isRight: {
|
|
291
|
+
true: {
|
|
292
|
+
x: 25,
|
|
293
|
+
opacity: 0
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
defaultFade: {
|
|
297
|
+
true: {
|
|
298
|
+
opacity: 0
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
export { TabsAdvancedDemo };
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Button, H5, Separator, SizableText, Tabs, XStack, YStack, isWeb } from "tamagui";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
const demos = ["horizontal", "vertical"],
|
|
5
|
+
demosTitle = {
|
|
6
|
+
horizontal: "Horizontal",
|
|
7
|
+
vertical: "Vertical"
|
|
8
|
+
};
|
|
9
|
+
function TabsDemo() {
|
|
10
|
+
const [demoIndex, setDemoIndex] = useState(0),
|
|
11
|
+
demo = demos[demoIndex];
|
|
12
|
+
return (
|
|
13
|
+
// web only fix for position relative
|
|
14
|
+
/* @__PURE__ */
|
|
15
|
+
jsxs(YStack, {
|
|
16
|
+
paddingHorizontal: "$4",
|
|
17
|
+
...(isWeb && {
|
|
18
|
+
position: "unset"
|
|
19
|
+
}),
|
|
20
|
+
children: [demo === "horizontal" ? /* @__PURE__ */jsx(HorizontalTabs, {}) : /* @__PURE__ */jsx(VerticalTabs, {}), /* @__PURE__ */jsx(XStack, {
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
space: !0,
|
|
23
|
+
position: "absolute",
|
|
24
|
+
bottom: "$3",
|
|
25
|
+
left: "$4",
|
|
26
|
+
$xxs: {
|
|
27
|
+
display: "none"
|
|
28
|
+
},
|
|
29
|
+
children: /* @__PURE__ */jsx(Button, {
|
|
30
|
+
size: "$2",
|
|
31
|
+
onPress: () => setDemoIndex(x => (x + 1) % demos.length),
|
|
32
|
+
children: demosTitle[demo]
|
|
33
|
+
})
|
|
34
|
+
})]
|
|
35
|
+
})
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
const HorizontalTabs = () => /* @__PURE__ */jsxs(Tabs, {
|
|
39
|
+
defaultValue: "tab1",
|
|
40
|
+
orientation: "horizontal",
|
|
41
|
+
flexDirection: "column",
|
|
42
|
+
width: 400,
|
|
43
|
+
height: 150,
|
|
44
|
+
borderRadius: "$4",
|
|
45
|
+
borderWidth: "$0.25",
|
|
46
|
+
overflow: "hidden",
|
|
47
|
+
borderColor: "$borderColor",
|
|
48
|
+
children: [/* @__PURE__ */jsxs(Tabs.List, {
|
|
49
|
+
separator: /* @__PURE__ */jsx(Separator, {
|
|
50
|
+
vertical: !0
|
|
51
|
+
}),
|
|
52
|
+
disablePassBorderRadius: "bottom",
|
|
53
|
+
"aria-label": "Manage your account",
|
|
54
|
+
children: [/* @__PURE__ */jsx(Tabs.Tab, {
|
|
55
|
+
flex: 1,
|
|
56
|
+
value: "tab1",
|
|
57
|
+
children: /* @__PURE__ */jsx(SizableText, {
|
|
58
|
+
fontFamily: "$body",
|
|
59
|
+
children: "Profile"
|
|
60
|
+
})
|
|
61
|
+
}), /* @__PURE__ */jsx(Tabs.Tab, {
|
|
62
|
+
flex: 1,
|
|
63
|
+
value: "tab2",
|
|
64
|
+
children: /* @__PURE__ */jsx(SizableText, {
|
|
65
|
+
fontFamily: "$body",
|
|
66
|
+
children: "Connections"
|
|
67
|
+
})
|
|
68
|
+
}), /* @__PURE__ */jsx(Tabs.Tab, {
|
|
69
|
+
flex: 1,
|
|
70
|
+
value: "tab3",
|
|
71
|
+
children: /* @__PURE__ */jsx(SizableText, {
|
|
72
|
+
fontFamily: "$body",
|
|
73
|
+
children: "Notifications"
|
|
74
|
+
})
|
|
75
|
+
})]
|
|
76
|
+
}), /* @__PURE__ */jsx(Separator, {}), /* @__PURE__ */jsx(TabsContent, {
|
|
77
|
+
value: "tab1",
|
|
78
|
+
children: /* @__PURE__ */jsx(H5, {
|
|
79
|
+
children: "Profile"
|
|
80
|
+
})
|
|
81
|
+
}), /* @__PURE__ */jsx(TabsContent, {
|
|
82
|
+
value: "tab2",
|
|
83
|
+
children: /* @__PURE__ */jsx(H5, {
|
|
84
|
+
children: "Connections"
|
|
85
|
+
})
|
|
86
|
+
}), /* @__PURE__ */jsx(TabsContent, {
|
|
87
|
+
value: "tab3",
|
|
88
|
+
children: /* @__PURE__ */jsx(H5, {
|
|
89
|
+
children: "Notifications"
|
|
90
|
+
})
|
|
91
|
+
})]
|
|
92
|
+
}),
|
|
93
|
+
VerticalTabs = () => /* @__PURE__ */jsxs(Tabs, {
|
|
94
|
+
defaultValue: "tab1",
|
|
95
|
+
flexDirection: "row",
|
|
96
|
+
orientation: "vertical",
|
|
97
|
+
width: 400,
|
|
98
|
+
borderRadius: "$4",
|
|
99
|
+
borderWidth: "$0.25",
|
|
100
|
+
overflow: "hidden",
|
|
101
|
+
borderColor: "$borderColor",
|
|
102
|
+
children: [/* @__PURE__ */jsxs(Tabs.List, {
|
|
103
|
+
disablePassBorderRadius: "end",
|
|
104
|
+
"aria-label": "Manage your account",
|
|
105
|
+
separator: /* @__PURE__ */jsx(Separator, {}),
|
|
106
|
+
children: [/* @__PURE__ */jsx(Tabs.Tab, {
|
|
107
|
+
value: "tab1",
|
|
108
|
+
children: /* @__PURE__ */jsx(SizableText, {
|
|
109
|
+
children: "Profile"
|
|
110
|
+
})
|
|
111
|
+
}), /* @__PURE__ */jsx(Tabs.Tab, {
|
|
112
|
+
value: "tab2",
|
|
113
|
+
children: /* @__PURE__ */jsx(SizableText, {
|
|
114
|
+
children: "Connections"
|
|
115
|
+
})
|
|
116
|
+
}), /* @__PURE__ */jsx(Tabs.Tab, {
|
|
117
|
+
value: "tab3",
|
|
118
|
+
children: /* @__PURE__ */jsx(SizableText, {
|
|
119
|
+
children: "Notifications"
|
|
120
|
+
})
|
|
121
|
+
})]
|
|
122
|
+
}), /* @__PURE__ */jsx(Separator, {
|
|
123
|
+
vertical: !0
|
|
124
|
+
}), /* @__PURE__ */jsx(TabsContent, {
|
|
125
|
+
value: "tab1",
|
|
126
|
+
children: /* @__PURE__ */jsx(H5, {
|
|
127
|
+
textAlign: "center",
|
|
128
|
+
children: "Profile"
|
|
129
|
+
})
|
|
130
|
+
}), /* @__PURE__ */jsx(TabsContent, {
|
|
131
|
+
value: "tab2",
|
|
132
|
+
children: /* @__PURE__ */jsx(H5, {
|
|
133
|
+
textAlign: "center",
|
|
134
|
+
children: "Connections"
|
|
135
|
+
})
|
|
136
|
+
}), /* @__PURE__ */jsx(TabsContent, {
|
|
137
|
+
value: "tab3",
|
|
138
|
+
children: /* @__PURE__ */jsx(H5, {
|
|
139
|
+
textAlign: "center",
|
|
140
|
+
children: "Notifications"
|
|
141
|
+
})
|
|
142
|
+
})]
|
|
143
|
+
}),
|
|
144
|
+
TabsContent = props => /* @__PURE__ */jsx(Tabs.Content, {
|
|
145
|
+
backgroundColor: "$background",
|
|
146
|
+
padding: "$2",
|
|
147
|
+
alignItems: "center",
|
|
148
|
+
justifyContent: "center",
|
|
149
|
+
flex: 1,
|
|
150
|
+
borderColor: "$background",
|
|
151
|
+
borderRadius: "$2",
|
|
152
|
+
borderTopLeftRadius: 0,
|
|
153
|
+
borderTopRightRadius: 0,
|
|
154
|
+
borderWidth: "$2",
|
|
155
|
+
...props,
|
|
156
|
+
children: props.children
|
|
157
|
+
}, "tab3");
|
|
158
|
+
export { TabsDemo };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Paragraph, SizableText, XStack, YStack } from "tamagui";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
function TextDemo() {
|
|
4
|
+
return /* @__PURE__ */jsxs(YStack, {
|
|
5
|
+
space: "$2",
|
|
6
|
+
alignItems: "center",
|
|
7
|
+
children: [/* @__PURE__ */jsx(SizableText, {
|
|
8
|
+
size: "$3",
|
|
9
|
+
children: "SizableText"
|
|
10
|
+
}), /* @__PURE__ */jsxs(XStack, {
|
|
11
|
+
space: !0,
|
|
12
|
+
children: [/* @__PURE__ */jsx(SizableText, {
|
|
13
|
+
theme: "alt1",
|
|
14
|
+
size: "$3",
|
|
15
|
+
children: "alt1"
|
|
16
|
+
}), /* @__PURE__ */jsx(SizableText, {
|
|
17
|
+
theme: "alt2",
|
|
18
|
+
size: "$3",
|
|
19
|
+
children: "alt2"
|
|
20
|
+
})]
|
|
21
|
+
}), /* @__PURE__ */jsx(Paragraph, {
|
|
22
|
+
size: "$2",
|
|
23
|
+
fontWeight: "800",
|
|
24
|
+
children: "Paragraph"
|
|
25
|
+
})]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export { TextDemo };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Square, XStack, YStack } from "tamagui";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
function ThemeBuilderDemo() {
|
|
4
|
+
return /* @__PURE__ */jsx(YStack, {
|
|
5
|
+
fullscreen: !0,
|
|
6
|
+
ov: "hidden",
|
|
7
|
+
children: /* @__PURE__ */jsxs(XStack, {
|
|
8
|
+
mah: 200,
|
|
9
|
+
y: -100,
|
|
10
|
+
x: -50,
|
|
11
|
+
rotate: "-10deg",
|
|
12
|
+
children: [/* @__PURE__ */jsx(Col, {
|
|
13
|
+
y: 35,
|
|
14
|
+
bc: "$color9"
|
|
15
|
+
}), /* @__PURE__ */jsx(Col, {
|
|
16
|
+
size: "$8",
|
|
17
|
+
y: 30,
|
|
18
|
+
bc: "$color7"
|
|
19
|
+
}), /* @__PURE__ */jsx(Col, {
|
|
20
|
+
size: "$6",
|
|
21
|
+
y: -50,
|
|
22
|
+
bc: "$color5"
|
|
23
|
+
}), /* @__PURE__ */jsx(Col, {
|
|
24
|
+
size: "$4",
|
|
25
|
+
bc: "$color3"
|
|
26
|
+
}), /* @__PURE__ */jsx(Col, {
|
|
27
|
+
size: "$2",
|
|
28
|
+
bc: "$color1"
|
|
29
|
+
}), /* @__PURE__ */jsx(Col, {
|
|
30
|
+
size: "$4",
|
|
31
|
+
y: 50,
|
|
32
|
+
bc: "$color3"
|
|
33
|
+
}), /* @__PURE__ */jsx(Col, {
|
|
34
|
+
size: "$6",
|
|
35
|
+
y: 80,
|
|
36
|
+
bc: "$color5"
|
|
37
|
+
}), /* @__PURE__ */jsx(Col, {
|
|
38
|
+
size: "$8",
|
|
39
|
+
bc: "$color7"
|
|
40
|
+
}), /* @__PURE__ */jsx(Col, {
|
|
41
|
+
bc: "$color9"
|
|
42
|
+
}), /* @__PURE__ */jsx(Col, {
|
|
43
|
+
size: "$8",
|
|
44
|
+
bc: "$color7"
|
|
45
|
+
}), /* @__PURE__ */jsx(Col, {
|
|
46
|
+
size: "$6",
|
|
47
|
+
y: 80,
|
|
48
|
+
bc: "$color5"
|
|
49
|
+
}), /* @__PURE__ */jsx(Col, {
|
|
50
|
+
size: "$4",
|
|
51
|
+
y: 50,
|
|
52
|
+
bc: "$color3"
|
|
53
|
+
}), /* @__PURE__ */jsx(Col, {
|
|
54
|
+
size: "$2",
|
|
55
|
+
bc: "$color1"
|
|
56
|
+
}), /* @__PURE__ */jsx(Col, {
|
|
57
|
+
size: "$4",
|
|
58
|
+
bc: "$color3"
|
|
59
|
+
}), /* @__PURE__ */jsx(Col, {
|
|
60
|
+
size: "$6",
|
|
61
|
+
y: -50,
|
|
62
|
+
bc: "$color5"
|
|
63
|
+
}), /* @__PURE__ */jsx(Col, {
|
|
64
|
+
size: "$8",
|
|
65
|
+
y: 30,
|
|
66
|
+
bc: "$color7"
|
|
67
|
+
}), /* @__PURE__ */jsx(Col, {
|
|
68
|
+
y: 35,
|
|
69
|
+
bc: "$color9"
|
|
70
|
+
})]
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function Col(props) {
|
|
75
|
+
const subTheme = props.subTheme ? `_${props.subTheme}` : "";
|
|
76
|
+
return /* @__PURE__ */jsxs(YStack, {
|
|
77
|
+
padding: "$2.5",
|
|
78
|
+
space: "$3.5",
|
|
79
|
+
children: [/* @__PURE__ */jsx(Square, {
|
|
80
|
+
br: "$6",
|
|
81
|
+
size: "$10",
|
|
82
|
+
theme: props.subTheme,
|
|
83
|
+
bg: "$background",
|
|
84
|
+
...props
|
|
85
|
+
}), /* @__PURE__ */jsx(Square, {
|
|
86
|
+
br: "$6",
|
|
87
|
+
size: "$10",
|
|
88
|
+
theme: "orange" + subTheme,
|
|
89
|
+
bg: "$background",
|
|
90
|
+
...props
|
|
91
|
+
}), /* @__PURE__ */jsx(Square, {
|
|
92
|
+
br: "$6",
|
|
93
|
+
size: "$10",
|
|
94
|
+
theme: "yellow" + subTheme,
|
|
95
|
+
bg: "$background",
|
|
96
|
+
...props
|
|
97
|
+
}), /* @__PURE__ */jsx(Square, {
|
|
98
|
+
br: "$6",
|
|
99
|
+
size: "$10",
|
|
100
|
+
theme: "green" + subTheme,
|
|
101
|
+
bg: "$background",
|
|
102
|
+
...props
|
|
103
|
+
}), /* @__PURE__ */jsx(Square, {
|
|
104
|
+
br: "$6",
|
|
105
|
+
size: "$10",
|
|
106
|
+
theme: "blue" + subTheme,
|
|
107
|
+
bg: "$background",
|
|
108
|
+
...props
|
|
109
|
+
}), /* @__PURE__ */jsx(Square, {
|
|
110
|
+
br: "$6",
|
|
111
|
+
size: "$10",
|
|
112
|
+
theme: "purple" + subTheme,
|
|
113
|
+
bg: "$background",
|
|
114
|
+
...props
|
|
115
|
+
}), /* @__PURE__ */jsx(Square, {
|
|
116
|
+
br: "$6",
|
|
117
|
+
size: "$10",
|
|
118
|
+
theme: "pink" + subTheme,
|
|
119
|
+
bg: "$background",
|
|
120
|
+
...props
|
|
121
|
+
}), /* @__PURE__ */jsx(Square, {
|
|
122
|
+
br: "$6",
|
|
123
|
+
size: "$10",
|
|
124
|
+
theme: "red" + subTheme,
|
|
125
|
+
bg: "$background",
|
|
126
|
+
...props
|
|
127
|
+
}), /* @__PURE__ */jsx(Square, {
|
|
128
|
+
br: "$6",
|
|
129
|
+
size: "$10",
|
|
130
|
+
theme: props.subTheme,
|
|
131
|
+
bg: "$background",
|
|
132
|
+
...props
|
|
133
|
+
}), /* @__PURE__ */jsx(Square, {
|
|
134
|
+
br: "$6",
|
|
135
|
+
size: "$10",
|
|
136
|
+
theme: "orange" + subTheme,
|
|
137
|
+
bg: "$background",
|
|
138
|
+
...props
|
|
139
|
+
}), /* @__PURE__ */jsx(Square, {
|
|
140
|
+
br: "$6",
|
|
141
|
+
size: "$10",
|
|
142
|
+
theme: "yellow" + subTheme,
|
|
143
|
+
bg: "$background",
|
|
144
|
+
...props
|
|
145
|
+
}), /* @__PURE__ */jsx(Square, {
|
|
146
|
+
br: "$6",
|
|
147
|
+
size: "$10",
|
|
148
|
+
theme: "green" + subTheme,
|
|
149
|
+
bg: "$background",
|
|
150
|
+
...props
|
|
151
|
+
})]
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
export { ThemeBuilderDemo };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Button, H5, Theme, XStack, YStack, useThemeName } from "tamagui";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
function ThemeInverseDemo() {
|
|
4
|
+
const themeName = useThemeName(),
|
|
5
|
+
opposite = themeName.includes("dark") ? "light" : "dark";
|
|
6
|
+
return /* @__PURE__ */jsxs(XStack, {
|
|
7
|
+
space: !0,
|
|
8
|
+
children: [/* @__PURE__ */jsx(Buttons, {
|
|
9
|
+
title: "Normal",
|
|
10
|
+
name: themeName
|
|
11
|
+
}), /* @__PURE__ */jsx(Theme, {
|
|
12
|
+
inverse: !0,
|
|
13
|
+
children: /* @__PURE__ */jsx(Buttons, {
|
|
14
|
+
title: "Inversed",
|
|
15
|
+
name: themeName.replace(themeName.split("_")[0], opposite)
|
|
16
|
+
})
|
|
17
|
+
})]
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function Buttons(props) {
|
|
21
|
+
return /* @__PURE__ */jsxs(YStack, {
|
|
22
|
+
elevation: "$4",
|
|
23
|
+
backgroundColor: "$background",
|
|
24
|
+
padding: "$4",
|
|
25
|
+
borderRadius: "$4",
|
|
26
|
+
space: "$3",
|
|
27
|
+
children: [/* @__PURE__ */jsx(H5, {
|
|
28
|
+
children: props.title
|
|
29
|
+
}), /* @__PURE__ */jsx(Button, {
|
|
30
|
+
children: props.name
|
|
31
|
+
}), /* @__PURE__ */jsx(Button, {
|
|
32
|
+
themeInverse: !0,
|
|
33
|
+
children: "inversed"
|
|
34
|
+
}), /* @__PURE__ */jsxs(Button, {
|
|
35
|
+
theme: "alt1",
|
|
36
|
+
children: [props.name, "_alt1"]
|
|
37
|
+
}), /* @__PURE__ */jsx(Theme, {
|
|
38
|
+
name: "yellow",
|
|
39
|
+
children: /* @__PURE__ */jsx(Button, {
|
|
40
|
+
children: props.name.split("_")[0] + "_yellow"
|
|
41
|
+
})
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export { ThemeInverseDemo };
|