@tamagui/demos 1.88.13 → 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,188 @@
|
|
|
1
|
+
import { Check, ChevronDown, ChevronUp } from "@tamagui/lucide-icons";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import { Adapt, Label, Select, Sheet, XStack, YStack, getFontSize } from "tamagui";
|
|
4
|
+
import { LinearGradient } from "tamagui/linear-gradient";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
function SelectDemo() {
|
|
7
|
+
return /* @__PURE__ */jsxs(YStack, {
|
|
8
|
+
space: !0,
|
|
9
|
+
children: [/* @__PURE__ */jsxs(XStack, {
|
|
10
|
+
ai: "center",
|
|
11
|
+
space: !0,
|
|
12
|
+
children: [/* @__PURE__ */jsx(Label, {
|
|
13
|
+
f: 1,
|
|
14
|
+
fb: 0,
|
|
15
|
+
children: "Custom"
|
|
16
|
+
}), /* @__PURE__ */jsx(SelectDemoItem, {})]
|
|
17
|
+
}), /* @__PURE__ */jsxs(XStack, {
|
|
18
|
+
ai: "center",
|
|
19
|
+
space: !0,
|
|
20
|
+
children: [/* @__PURE__ */jsx(Label, {
|
|
21
|
+
f: 1,
|
|
22
|
+
fb: 0,
|
|
23
|
+
children: "Native"
|
|
24
|
+
}), /* @__PURE__ */jsx(SelectDemoItem, {
|
|
25
|
+
native: !0
|
|
26
|
+
})]
|
|
27
|
+
})]
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function SelectDemoItem(props) {
|
|
31
|
+
const [val, setVal] = useState("apple");
|
|
32
|
+
return /* @__PURE__ */jsxs(Select, {
|
|
33
|
+
id: "food",
|
|
34
|
+
value: val,
|
|
35
|
+
onValueChange: setVal,
|
|
36
|
+
disablePreventBodyScroll: !0,
|
|
37
|
+
...props,
|
|
38
|
+
children: [/* @__PURE__ */jsx(Select.Trigger, {
|
|
39
|
+
width: 220,
|
|
40
|
+
iconAfter: ChevronDown,
|
|
41
|
+
children: /* @__PURE__ */jsx(Select.Value, {
|
|
42
|
+
placeholder: "Something"
|
|
43
|
+
})
|
|
44
|
+
}), /* @__PURE__ */jsx(Adapt, {
|
|
45
|
+
when: "sm",
|
|
46
|
+
platform: "touch",
|
|
47
|
+
children: /* @__PURE__ */jsxs(Sheet, {
|
|
48
|
+
native: !!props.native,
|
|
49
|
+
modal: !0,
|
|
50
|
+
dismissOnSnapToBottom: !0,
|
|
51
|
+
animationConfig: {
|
|
52
|
+
type: "spring",
|
|
53
|
+
damping: 20,
|
|
54
|
+
mass: 1.2,
|
|
55
|
+
stiffness: 250
|
|
56
|
+
},
|
|
57
|
+
children: [/* @__PURE__ */jsx(Sheet.Frame, {
|
|
58
|
+
children: /* @__PURE__ */jsx(Sheet.ScrollView, {
|
|
59
|
+
children: /* @__PURE__ */jsx(Adapt.Contents, {})
|
|
60
|
+
})
|
|
61
|
+
}), /* @__PURE__ */jsx(Sheet.Overlay, {
|
|
62
|
+
animation: "lazy",
|
|
63
|
+
enterStyle: {
|
|
64
|
+
opacity: 0
|
|
65
|
+
},
|
|
66
|
+
exitStyle: {
|
|
67
|
+
opacity: 0
|
|
68
|
+
}
|
|
69
|
+
})]
|
|
70
|
+
})
|
|
71
|
+
}), /* @__PURE__ */jsxs(Select.Content, {
|
|
72
|
+
zIndex: 2e5,
|
|
73
|
+
children: [/* @__PURE__ */jsxs(Select.ScrollUpButton, {
|
|
74
|
+
alignItems: "center",
|
|
75
|
+
justifyContent: "center",
|
|
76
|
+
position: "relative",
|
|
77
|
+
width: "100%",
|
|
78
|
+
height: "$3",
|
|
79
|
+
children: [/* @__PURE__ */jsx(YStack, {
|
|
80
|
+
zIndex: 10,
|
|
81
|
+
children: /* @__PURE__ */jsx(ChevronUp, {
|
|
82
|
+
size: 20
|
|
83
|
+
})
|
|
84
|
+
}), /* @__PURE__ */jsx(LinearGradient, {
|
|
85
|
+
start: [0, 0],
|
|
86
|
+
end: [0, 1],
|
|
87
|
+
fullscreen: !0,
|
|
88
|
+
colors: ["$background", "transparent"],
|
|
89
|
+
borderRadius: "$4"
|
|
90
|
+
})]
|
|
91
|
+
}), /* @__PURE__ */jsxs(Select.Viewport, {
|
|
92
|
+
minWidth: 200,
|
|
93
|
+
children: [/* @__PURE__ */jsxs(Select.Group, {
|
|
94
|
+
children: [/* @__PURE__ */jsx(Select.Label, {
|
|
95
|
+
children: "Fruits"
|
|
96
|
+
}), useMemo(() => items.map((item, i) => /* @__PURE__ */jsxs(Select.Item, {
|
|
97
|
+
index: i,
|
|
98
|
+
value: item.name.toLowerCase(),
|
|
99
|
+
children: [/* @__PURE__ */jsx(Select.ItemText, {
|
|
100
|
+
children: item.name
|
|
101
|
+
}), /* @__PURE__ */jsx(Select.ItemIndicator, {
|
|
102
|
+
marginLeft: "auto",
|
|
103
|
+
children: /* @__PURE__ */jsx(Check, {
|
|
104
|
+
size: 16
|
|
105
|
+
})
|
|
106
|
+
})]
|
|
107
|
+
}, item.name)), [items])]
|
|
108
|
+
}), props.native && /* @__PURE__ */jsx(YStack, {
|
|
109
|
+
position: "absolute",
|
|
110
|
+
right: 0,
|
|
111
|
+
top: 0,
|
|
112
|
+
bottom: 0,
|
|
113
|
+
alignItems: "center",
|
|
114
|
+
justifyContent: "center",
|
|
115
|
+
width: "$4",
|
|
116
|
+
pointerEvents: "none",
|
|
117
|
+
children: /* @__PURE__ */jsx(ChevronDown, {
|
|
118
|
+
size: getFontSize(props.size ?? "$true")
|
|
119
|
+
})
|
|
120
|
+
})]
|
|
121
|
+
}), /* @__PURE__ */jsxs(Select.ScrollDownButton, {
|
|
122
|
+
alignItems: "center",
|
|
123
|
+
justifyContent: "center",
|
|
124
|
+
position: "relative",
|
|
125
|
+
width: "100%",
|
|
126
|
+
height: "$3",
|
|
127
|
+
children: [/* @__PURE__ */jsx(YStack, {
|
|
128
|
+
zIndex: 10,
|
|
129
|
+
children: /* @__PURE__ */jsx(ChevronDown, {
|
|
130
|
+
size: 20
|
|
131
|
+
})
|
|
132
|
+
}), /* @__PURE__ */jsx(LinearGradient, {
|
|
133
|
+
start: [0, 0],
|
|
134
|
+
end: [0, 1],
|
|
135
|
+
fullscreen: !0,
|
|
136
|
+
colors: ["transparent", "$background"],
|
|
137
|
+
borderRadius: "$4"
|
|
138
|
+
})]
|
|
139
|
+
})]
|
|
140
|
+
})]
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
const items = [{
|
|
144
|
+
name: "Apple"
|
|
145
|
+
}, {
|
|
146
|
+
name: "Pear"
|
|
147
|
+
}, {
|
|
148
|
+
name: "Blackberry"
|
|
149
|
+
}, {
|
|
150
|
+
name: "Peach"
|
|
151
|
+
}, {
|
|
152
|
+
name: "Apricot"
|
|
153
|
+
}, {
|
|
154
|
+
name: "Melon"
|
|
155
|
+
}, {
|
|
156
|
+
name: "Honeydew"
|
|
157
|
+
}, {
|
|
158
|
+
name: "Starfruit"
|
|
159
|
+
}, {
|
|
160
|
+
name: "Blueberry"
|
|
161
|
+
}, {
|
|
162
|
+
name: "Raspberry"
|
|
163
|
+
}, {
|
|
164
|
+
name: "Strawberry"
|
|
165
|
+
}, {
|
|
166
|
+
name: "Mango"
|
|
167
|
+
}, {
|
|
168
|
+
name: "Pineapple"
|
|
169
|
+
}, {
|
|
170
|
+
name: "Lime"
|
|
171
|
+
}, {
|
|
172
|
+
name: "Lemon"
|
|
173
|
+
}, {
|
|
174
|
+
name: "Coconut"
|
|
175
|
+
}, {
|
|
176
|
+
name: "Guava"
|
|
177
|
+
}, {
|
|
178
|
+
name: "Papaya"
|
|
179
|
+
}, {
|
|
180
|
+
name: "Orange"
|
|
181
|
+
}, {
|
|
182
|
+
name: "Grape"
|
|
183
|
+
}, {
|
|
184
|
+
name: "Jackfruit"
|
|
185
|
+
}, {
|
|
186
|
+
name: "Durian"
|
|
187
|
+
}];
|
|
188
|
+
export { SelectDemo, SelectDemoItem };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Paragraph, Separator, XStack, YStack } from "tamagui";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
function SeparatorDemo() {
|
|
4
|
+
return /* @__PURE__ */jsxs(YStack, {
|
|
5
|
+
width: "100%",
|
|
6
|
+
maxWidth: 300,
|
|
7
|
+
marginHorizontal: 15,
|
|
8
|
+
children: [/* @__PURE__ */jsx(Paragraph, {
|
|
9
|
+
fontWeight: "800",
|
|
10
|
+
children: "Tamagui"
|
|
11
|
+
}), /* @__PURE__ */jsx(Paragraph, {
|
|
12
|
+
children: "A cross-platform component library."
|
|
13
|
+
}), /* @__PURE__ */jsx(Separator, {
|
|
14
|
+
marginVertical: 15
|
|
15
|
+
}), /* @__PURE__ */jsxs(XStack, {
|
|
16
|
+
height: 20,
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
children: [/* @__PURE__ */jsx(Paragraph, {
|
|
19
|
+
children: "Blog"
|
|
20
|
+
}), /* @__PURE__ */jsx(Separator, {
|
|
21
|
+
alignSelf: "stretch",
|
|
22
|
+
vertical: !0,
|
|
23
|
+
marginHorizontal: 15
|
|
24
|
+
}), /* @__PURE__ */jsx(Paragraph, {
|
|
25
|
+
children: "Docs"
|
|
26
|
+
}), /* @__PURE__ */jsx(Separator, {
|
|
27
|
+
alignSelf: "stretch",
|
|
28
|
+
vertical: !0,
|
|
29
|
+
marginHorizontal: 15
|
|
30
|
+
}), /* @__PURE__ */jsx(Paragraph, {
|
|
31
|
+
children: "Source"
|
|
32
|
+
})]
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export { SeparatorDemo };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Circle, Square, XStack } from "tamagui";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
function ShapesDemo() {
|
|
4
|
+
return /* @__PURE__ */jsxs(XStack, {
|
|
5
|
+
padding: "$2",
|
|
6
|
+
space: "$4",
|
|
7
|
+
children: [/* @__PURE__ */jsx(Square, {
|
|
8
|
+
size: 100,
|
|
9
|
+
backgroundColor: "$color",
|
|
10
|
+
elevation: "$4"
|
|
11
|
+
}), /* @__PURE__ */jsx(Circle, {
|
|
12
|
+
size: 100,
|
|
13
|
+
backgroundColor: "$color",
|
|
14
|
+
elevation: "$4"
|
|
15
|
+
})]
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export { ShapesDemo };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { ChevronDown, ChevronUp } from "@tamagui/lucide-icons";
|
|
2
|
+
import { Sheet } from "@tamagui/sheet";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Button, H2, Input, Paragraph, XStack, YStack } from "tamagui";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
const spModes = ["percent", "constant", "fit", "mixed"],
|
|
7
|
+
SheetDemo = () => {
|
|
8
|
+
const [position, setPosition] = useState(0),
|
|
9
|
+
[open, setOpen] = useState(!1),
|
|
10
|
+
[modal, setModal] = useState(!0),
|
|
11
|
+
[innerOpen, setInnerOpen] = useState(!1),
|
|
12
|
+
[snapPointsMode, setSnapPointsMode] = useState("percent"),
|
|
13
|
+
[mixedFitDemo, setMixedFitDemo] = useState(!1),
|
|
14
|
+
isPercent = snapPointsMode === "percent",
|
|
15
|
+
isConstant = snapPointsMode === "constant",
|
|
16
|
+
isFit = snapPointsMode === "fit",
|
|
17
|
+
isMixed = snapPointsMode === "mixed",
|
|
18
|
+
snapPoints = isPercent ? [85, 50, 25] : isConstant ? [256, 190] : isFit ? void 0 : mixedFitDemo ? ["fit", 110] : ["80%", 256, 190];
|
|
19
|
+
return /* @__PURE__ */jsxs(Fragment, {
|
|
20
|
+
children: [/* @__PURE__ */jsxs(YStack, {
|
|
21
|
+
space: !0,
|
|
22
|
+
children: [/* @__PURE__ */jsxs(XStack, {
|
|
23
|
+
space: !0,
|
|
24
|
+
$sm: {
|
|
25
|
+
flexDirection: "column",
|
|
26
|
+
alignItems: "center"
|
|
27
|
+
},
|
|
28
|
+
children: [/* @__PURE__ */jsx(Button, {
|
|
29
|
+
onPress: () => setOpen(!0),
|
|
30
|
+
children: "Open"
|
|
31
|
+
}), /* @__PURE__ */jsx(Button, {
|
|
32
|
+
onPress: () => setModal(x => !x),
|
|
33
|
+
children: modal ? "Type: Modal" : "Type: Inline"
|
|
34
|
+
}), /* @__PURE__ */jsx(Button, {
|
|
35
|
+
onPress: () => setSnapPointsMode(prev => spModes[(spModes.indexOf(prev) + 1) % spModes.length]),
|
|
36
|
+
children: `Mode: ${{
|
|
37
|
+
percent: "Percentage",
|
|
38
|
+
constant: "Constant",
|
|
39
|
+
fit: "Fit",
|
|
40
|
+
mixed: "Mixed"
|
|
41
|
+
}[snapPointsMode]}`
|
|
42
|
+
})]
|
|
43
|
+
}), isMixed ? /* @__PURE__ */jsx(Button, {
|
|
44
|
+
onPress: () => setMixedFitDemo(x => !x),
|
|
45
|
+
children: `Snap Points: ${JSON.stringify(snapPoints)}`
|
|
46
|
+
}) : /* @__PURE__ */jsx(XStack, {
|
|
47
|
+
paddingVertical: "$2.5",
|
|
48
|
+
justifyContent: "center",
|
|
49
|
+
children: /* @__PURE__ */jsx(Paragraph, {
|
|
50
|
+
children: `Snap Points: ${isFit ? "(none)" : JSON.stringify(snapPoints)}`
|
|
51
|
+
})
|
|
52
|
+
})]
|
|
53
|
+
}), /* @__PURE__ */jsxs(Sheet, {
|
|
54
|
+
forceRemoveScrollEnabled: open,
|
|
55
|
+
modal,
|
|
56
|
+
open,
|
|
57
|
+
onOpenChange: setOpen,
|
|
58
|
+
snapPoints,
|
|
59
|
+
snapPointsMode,
|
|
60
|
+
dismissOnSnapToBottom: !0,
|
|
61
|
+
position,
|
|
62
|
+
onPositionChange: setPosition,
|
|
63
|
+
zIndex: 1e5,
|
|
64
|
+
animation: "medium",
|
|
65
|
+
children: [/* @__PURE__ */jsx(Sheet.Overlay, {
|
|
66
|
+
animation: "lazy",
|
|
67
|
+
enterStyle: {
|
|
68
|
+
opacity: 0
|
|
69
|
+
},
|
|
70
|
+
exitStyle: {
|
|
71
|
+
opacity: 0
|
|
72
|
+
}
|
|
73
|
+
}), /* @__PURE__ */jsx(Sheet.Handle, {}), /* @__PURE__ */jsxs(Sheet.Frame, {
|
|
74
|
+
padding: "$4",
|
|
75
|
+
justifyContent: "center",
|
|
76
|
+
alignItems: "center",
|
|
77
|
+
space: "$5",
|
|
78
|
+
children: [/* @__PURE__ */jsx(Button, {
|
|
79
|
+
size: "$6",
|
|
80
|
+
circular: !0,
|
|
81
|
+
icon: ChevronDown,
|
|
82
|
+
onPress: () => setOpen(!1)
|
|
83
|
+
}), /* @__PURE__ */jsx(Input, {
|
|
84
|
+
width: 200
|
|
85
|
+
}), modal && isPercent && /* @__PURE__ */jsxs(Fragment, {
|
|
86
|
+
children: [/* @__PURE__ */jsx(InnerSheet, {
|
|
87
|
+
open: innerOpen,
|
|
88
|
+
onOpenChange: setInnerOpen
|
|
89
|
+
}), /* @__PURE__ */jsx(Button, {
|
|
90
|
+
size: "$6",
|
|
91
|
+
circular: !0,
|
|
92
|
+
icon: ChevronUp,
|
|
93
|
+
onPress: () => setInnerOpen(!0)
|
|
94
|
+
})]
|
|
95
|
+
})]
|
|
96
|
+
})]
|
|
97
|
+
})]
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
function InnerSheet(props) {
|
|
101
|
+
return /* @__PURE__ */jsxs(Sheet, {
|
|
102
|
+
animation: "medium",
|
|
103
|
+
modal: !0,
|
|
104
|
+
snapPoints: [90],
|
|
105
|
+
dismissOnSnapToBottom: !0,
|
|
106
|
+
...props,
|
|
107
|
+
children: [/* @__PURE__ */jsx(Sheet.Overlay, {
|
|
108
|
+
animation: "medium",
|
|
109
|
+
enterStyle: {
|
|
110
|
+
opacity: 0
|
|
111
|
+
},
|
|
112
|
+
exitStyle: {
|
|
113
|
+
opacity: 0
|
|
114
|
+
}
|
|
115
|
+
}), /* @__PURE__ */jsx(Sheet.Handle, {}), /* @__PURE__ */jsx(Sheet.Frame, {
|
|
116
|
+
flex: 1,
|
|
117
|
+
justifyContent: "center",
|
|
118
|
+
alignItems: "center",
|
|
119
|
+
space: "$5",
|
|
120
|
+
children: /* @__PURE__ */jsx(Sheet.ScrollView, {
|
|
121
|
+
children: /* @__PURE__ */jsxs(YStack, {
|
|
122
|
+
p: "$5",
|
|
123
|
+
gap: "$8",
|
|
124
|
+
children: [/* @__PURE__ */jsx(Button, {
|
|
125
|
+
size: "$6",
|
|
126
|
+
circular: !0,
|
|
127
|
+
alignSelf: "center",
|
|
128
|
+
icon: ChevronDown,
|
|
129
|
+
onPress: () => props.onOpenChange?.(!1)
|
|
130
|
+
}), /* @__PURE__ */jsx(H2, {
|
|
131
|
+
children: "Hello world"
|
|
132
|
+
}), [1, 2, 3, 4, 5, 6, 7, 8].map(i => /* @__PURE__ */jsx(Paragraph, {
|
|
133
|
+
size: "$8",
|
|
134
|
+
children: "Eu officia sunt ipsum nisi dolore labore est laborum laborum in esse ad pariatur. Dolor excepteur esse deserunt voluptate labore ea. Exercitation ipsum deserunt occaecat cupidatat consequat est adipisicing velit cupidatat ullamco veniam aliquip reprehenderit officia. Officia labore culpa ullamco velit. In sit occaecat velit ipsum fugiat esse aliqua dolor sint."
|
|
135
|
+
}, i))]
|
|
136
|
+
})
|
|
137
|
+
})
|
|
138
|
+
})]
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
export { SheetDemo };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Slider, XStack } from "tamagui";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
function SliderDemo() {
|
|
4
|
+
return /* @__PURE__ */jsxs(XStack, {
|
|
5
|
+
height: 200,
|
|
6
|
+
alignItems: "center",
|
|
7
|
+
space: "$8",
|
|
8
|
+
children: [/* @__PURE__ */jsx(SimpleSlider, {
|
|
9
|
+
height: 200,
|
|
10
|
+
orientation: "vertical"
|
|
11
|
+
}), /* @__PURE__ */jsx(SimpleSlider, {
|
|
12
|
+
width: 200
|
|
13
|
+
})]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function SimpleSlider({
|
|
17
|
+
children,
|
|
18
|
+
...props
|
|
19
|
+
}) {
|
|
20
|
+
return /* @__PURE__ */jsxs(Slider, {
|
|
21
|
+
defaultValue: [50],
|
|
22
|
+
max: 100,
|
|
23
|
+
step: 1,
|
|
24
|
+
...props,
|
|
25
|
+
children: [/* @__PURE__ */jsx(Slider.Track, {
|
|
26
|
+
children: /* @__PURE__ */jsx(Slider.TrackActive, {})
|
|
27
|
+
}), /* @__PURE__ */jsx(Slider.Thumb, {
|
|
28
|
+
index: 0,
|
|
29
|
+
circular: !0,
|
|
30
|
+
elevate: !0
|
|
31
|
+
}), children]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export { SliderDemo };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Spinner, YStack } from "tamagui";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
function SpinnerDemo() {
|
|
4
|
+
return /* @__PURE__ */jsxs(YStack, {
|
|
5
|
+
padding: "$3",
|
|
6
|
+
space: "$4",
|
|
7
|
+
alignItems: "center",
|
|
8
|
+
children: [/* @__PURE__ */jsx(Spinner, {
|
|
9
|
+
size: "small",
|
|
10
|
+
color: "$green10"
|
|
11
|
+
}), /* @__PURE__ */jsx(Spinner, {
|
|
12
|
+
size: "large",
|
|
13
|
+
color: "$orange10"
|
|
14
|
+
})]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export { SpinnerDemo };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { XStack, YStack, ZStack } from "tamagui";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
function StacksDemo() {
|
|
4
|
+
return /* @__PURE__ */jsxs(XStack, {
|
|
5
|
+
maxWidth: 250,
|
|
6
|
+
padding: "$2",
|
|
7
|
+
alignSelf: "center",
|
|
8
|
+
space: !0,
|
|
9
|
+
children: [/* @__PURE__ */jsxs(YStack, {
|
|
10
|
+
flex: 1,
|
|
11
|
+
space: "$2",
|
|
12
|
+
borderWidth: 2,
|
|
13
|
+
borderColor: "$color",
|
|
14
|
+
borderRadius: "$4",
|
|
15
|
+
padding: "$2",
|
|
16
|
+
children: [/* @__PURE__ */jsx(YStack, {
|
|
17
|
+
backgroundColor: "$color",
|
|
18
|
+
borderRadius: "$3",
|
|
19
|
+
padding: "$2"
|
|
20
|
+
}), /* @__PURE__ */jsx(YStack, {
|
|
21
|
+
backgroundColor: "$color",
|
|
22
|
+
borderRadius: "$3",
|
|
23
|
+
padding: "$2"
|
|
24
|
+
}), /* @__PURE__ */jsx(YStack, {
|
|
25
|
+
backgroundColor: "$color",
|
|
26
|
+
borderRadius: "$3",
|
|
27
|
+
padding: "$2"
|
|
28
|
+
})]
|
|
29
|
+
}), /* @__PURE__ */jsxs(XStack, {
|
|
30
|
+
flex: 1,
|
|
31
|
+
space: "$2",
|
|
32
|
+
borderWidth: 2,
|
|
33
|
+
borderColor: "$color",
|
|
34
|
+
borderRadius: "$4",
|
|
35
|
+
padding: "$2",
|
|
36
|
+
children: [/* @__PURE__ */jsx(YStack, {
|
|
37
|
+
backgroundColor: "$color",
|
|
38
|
+
borderRadius: "$3",
|
|
39
|
+
padding: "$2"
|
|
40
|
+
}), /* @__PURE__ */jsx(YStack, {
|
|
41
|
+
backgroundColor: "$color",
|
|
42
|
+
borderRadius: "$3",
|
|
43
|
+
padding: "$2"
|
|
44
|
+
}), /* @__PURE__ */jsx(YStack, {
|
|
45
|
+
backgroundColor: "$color",
|
|
46
|
+
borderRadius: "$3",
|
|
47
|
+
padding: "$2"
|
|
48
|
+
})]
|
|
49
|
+
}), /* @__PURE__ */jsxs(ZStack, {
|
|
50
|
+
maxWidth: 50,
|
|
51
|
+
maxHeight: 85,
|
|
52
|
+
width: 100,
|
|
53
|
+
flex: 1,
|
|
54
|
+
children: [/* @__PURE__ */jsx(YStack, {
|
|
55
|
+
fullscreen: !0,
|
|
56
|
+
borderRadius: "$4",
|
|
57
|
+
padding: "$2",
|
|
58
|
+
borderColor: "$color",
|
|
59
|
+
borderWidth: 2
|
|
60
|
+
}), /* @__PURE__ */jsx(YStack, {
|
|
61
|
+
borderColor: "$color",
|
|
62
|
+
fullscreen: !0,
|
|
63
|
+
y: 10,
|
|
64
|
+
x: 10,
|
|
65
|
+
borderWidth: 2,
|
|
66
|
+
borderRadius: "$4",
|
|
67
|
+
padding: "$2"
|
|
68
|
+
}), /* @__PURE__ */jsx(YStack, {
|
|
69
|
+
borderColor: "$color",
|
|
70
|
+
fullscreen: !0,
|
|
71
|
+
y: 20,
|
|
72
|
+
x: 20,
|
|
73
|
+
borderWidth: 2,
|
|
74
|
+
borderRadius: "$4",
|
|
75
|
+
padding: "$2"
|
|
76
|
+
})]
|
|
77
|
+
})]
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
export { StacksDemo };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Label, Separator, Switch, XStack, YStack } from "tamagui";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
function SwitchDemo() {
|
|
4
|
+
return /* @__PURE__ */jsxs(YStack, {
|
|
5
|
+
width: 200,
|
|
6
|
+
alignItems: "center",
|
|
7
|
+
space: "$3",
|
|
8
|
+
children: [/* @__PURE__ */jsxs(XStack, {
|
|
9
|
+
space: "$3",
|
|
10
|
+
$xs: {
|
|
11
|
+
flexDirection: "column"
|
|
12
|
+
},
|
|
13
|
+
children: [/* @__PURE__ */jsx(SwitchWithLabel, {
|
|
14
|
+
size: "$2"
|
|
15
|
+
}), /* @__PURE__ */jsx(SwitchWithLabel, {
|
|
16
|
+
size: "$2",
|
|
17
|
+
defaultChecked: !0
|
|
18
|
+
})]
|
|
19
|
+
}), /* @__PURE__ */jsxs(XStack, {
|
|
20
|
+
space: "$3",
|
|
21
|
+
$xs: {
|
|
22
|
+
flexDirection: "column"
|
|
23
|
+
},
|
|
24
|
+
children: [/* @__PURE__ */jsx(SwitchWithLabel, {
|
|
25
|
+
size: "$3"
|
|
26
|
+
}), /* @__PURE__ */jsx(SwitchWithLabel, {
|
|
27
|
+
size: "$3",
|
|
28
|
+
defaultChecked: !0
|
|
29
|
+
})]
|
|
30
|
+
}), /* @__PURE__ */jsxs(XStack, {
|
|
31
|
+
space: "$3",
|
|
32
|
+
$xs: {
|
|
33
|
+
flexDirection: "column"
|
|
34
|
+
},
|
|
35
|
+
children: [/* @__PURE__ */jsx(SwitchWithLabel, {
|
|
36
|
+
size: "$4"
|
|
37
|
+
}), /* @__PURE__ */jsx(SwitchWithLabel, {
|
|
38
|
+
size: "$4",
|
|
39
|
+
defaultChecked: !0
|
|
40
|
+
})]
|
|
41
|
+
}), /* @__PURE__ */jsxs(XStack, {
|
|
42
|
+
space: "$3",
|
|
43
|
+
$xs: {
|
|
44
|
+
flexDirection: "column"
|
|
45
|
+
},
|
|
46
|
+
children: [/* @__PURE__ */jsx(SwitchWithLabel, {
|
|
47
|
+
size: "$5"
|
|
48
|
+
}), /* @__PURE__ */jsx(SwitchWithLabel, {
|
|
49
|
+
size: "$5",
|
|
50
|
+
defaultChecked: !0
|
|
51
|
+
})]
|
|
52
|
+
})]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function SwitchWithLabel(props) {
|
|
56
|
+
const id = `switch-${props.size.toString().slice(1)}-${props.defaultChecked ?? ""}}`;
|
|
57
|
+
return /* @__PURE__ */jsxs(XStack, {
|
|
58
|
+
width: 200,
|
|
59
|
+
alignItems: "center",
|
|
60
|
+
space: "$4",
|
|
61
|
+
children: [/* @__PURE__ */jsx(Label, {
|
|
62
|
+
paddingRight: "$0",
|
|
63
|
+
minWidth: 90,
|
|
64
|
+
justifyContent: "flex-end",
|
|
65
|
+
size: props.size,
|
|
66
|
+
htmlFor: id,
|
|
67
|
+
children: "Accept"
|
|
68
|
+
}), /* @__PURE__ */jsx(Separator, {
|
|
69
|
+
minHeight: 20,
|
|
70
|
+
vertical: !0
|
|
71
|
+
}), /* @__PURE__ */jsx(Switch, {
|
|
72
|
+
id,
|
|
73
|
+
size: props.size,
|
|
74
|
+
defaultChecked: props.defaultChecked,
|
|
75
|
+
children: /* @__PURE__ */jsx(Switch.Thumb, {
|
|
76
|
+
animation: "quicker"
|
|
77
|
+
})
|
|
78
|
+
})]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
export { SwitchDemo, SwitchWithLabel };
|