@tamagui/demos 1.27.2 → 1.27.3

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.
Files changed (53) hide show
  1. package/package.json +18 -18
  2. package/dist/esm/AddThemeDemo.mjs +0 -36
  3. package/dist/esm/AlertDialogDemo.mjs +0 -53
  4. package/dist/esm/AnimationsDemo.mjs +0 -89
  5. package/dist/esm/AnimationsEnterDemo.mjs +0 -40
  6. package/dist/esm/AnimationsHoverDemo.mjs +0 -27
  7. package/dist/esm/AnimationsPresenceDemo.mjs +0 -73
  8. package/dist/esm/AnimationsTimingDemo.mjs +0 -26
  9. package/dist/esm/AvatarDemo.mjs +0 -30
  10. package/dist/esm/ButtonDemo.mjs +0 -25
  11. package/dist/esm/ButtonNewDemo.mjs +0 -31
  12. package/dist/esm/CardDemo.mjs +0 -48
  13. package/dist/esm/CheckboxDemo.mjs +0 -22
  14. package/dist/esm/ColorsDemo.mjs +0 -98
  15. package/dist/esm/DialogDemo.mjs +0 -84
  16. package/dist/esm/FormsDemo.mjs +0 -36
  17. package/dist/esm/GroupDemo.mjs +0 -25
  18. package/dist/esm/HeadingsDemo.mjs +0 -16
  19. package/dist/esm/ImageDemo.mjs +0 -18
  20. package/dist/esm/InputsDemo.mjs +0 -31
  21. package/dist/esm/LabelDemo.mjs +0 -18
  22. package/dist/esm/LinearGradientDemo.mjs +0 -33
  23. package/dist/esm/ListItemDemo.mjs +0 -47
  24. package/dist/esm/LucideIconsDemo.mjs +0 -52
  25. package/dist/esm/PopoverDemo.mjs +0 -76
  26. package/dist/esm/ProgressDemo.mjs +0 -59
  27. package/dist/esm/RadioGroupDemo.mjs +0 -21
  28. package/dist/esm/ReplaceThemeDemo.mjs +0 -49
  29. package/dist/esm/ScrollViewDemo.mjs +0 -18
  30. package/dist/esm/SelectDemo.mjs +0 -137
  31. package/dist/esm/SeparatorDemo.mjs +0 -20
  32. package/dist/esm/ShapesDemo.mjs +0 -12
  33. package/dist/esm/SheetDemo.mjs +0 -91
  34. package/dist/esm/SliderDemo.mjs +0 -19
  35. package/dist/esm/SpinnerDemo.mjs +0 -12
  36. package/dist/esm/StacksDemo.mjs +0 -58
  37. package/dist/esm/SwitchDemo.mjs +0 -33
  38. package/dist/esm/TabsAdvancedDemo.mjs +0 -283
  39. package/dist/esm/TabsDemo.mjs +0 -141
  40. package/dist/esm/TextDemo.mjs +0 -16
  41. package/dist/esm/ThemeInverseDemo.mjs +0 -42
  42. package/dist/esm/ToastDemo.mjs +0 -101
  43. package/dist/esm/ToastDuplicateDemo.mjs +0 -44
  44. package/dist/esm/ToggleGroupDemo.mjs +0 -49
  45. package/dist/esm/TokensDemo.mjs +0 -87
  46. package/dist/esm/TooltipDemo.mjs +0 -68
  47. package/dist/esm/UpdateThemeDemo.mjs +0 -56
  48. package/dist/esm/conf.mjs +0 -5
  49. package/dist/esm/index.mjs +0 -48
  50. package/dist/esm/tamagui.config.mjs +0 -6
  51. package/dist/esm/useOnIntersecting.mjs +0 -68
  52. package/dist/jsx/ButtonHeadlessDemo.mjs +0 -92
  53. package/dist/jsx/ButtonSimpleDemo.mjs +0 -24
@@ -1,87 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { getConfig } from "@tamagui/core";
3
- import { useState } from "react";
4
- import { Button, H2, H3, H4, Separator, Square, XGroup, XStack, YStack } from "tamagui";
5
- const sections = [
6
- {
7
- name: `Size`,
8
- key: `size`
9
- },
10
- {
11
- name: `Space`,
12
- key: "space"
13
- },
14
- {
15
- name: `Space (-)`,
16
- key: `spaceNegative`
17
- },
18
- {
19
- name: `Radius`,
20
- key: `radius`
21
- }
22
- ];
23
- function TokensDemo() {
24
- const [section, setSection] = useState("size");
25
- return /* @__PURE__ */ jsxs(YStack, { space: true, children: [
26
- /* @__PURE__ */ jsx(XGroup, { alignItems: "center", alignSelf: "center", children: sections.map(({ name, key }) => {
27
- return /* @__PURE__ */ jsx(XGroup.Item, { children: /* @__PURE__ */ jsx(
28
- Button,
29
- {
30
- size: "$3",
31
- theme: section === key ? "active" : null,
32
- fontFamily: "$silkscreen",
33
- onPress: () => setSection(key),
34
- children: name
35
- }
36
- ) }, key);
37
- }) }),
38
- (section === "size" || section === "spaceNegative" || section === "space" || section === "radius") && /* @__PURE__ */ jsx(SizeSection, { section })
39
- ] });
40
- }
41
- function SizeSection({ section }) {
42
- const allTokens = getConfig().tokens;
43
- const tokens = allTokens[section.startsWith("space") ? "space" : section];
44
- const st = Object.keys(tokens).sort((a, b) => parseFloat(a) > parseFloat(b) ? 1 : -1);
45
- const spaceTokens = st.filter((t) => parseFloat(t) >= 0);
46
- const spaceTokensNegative = st.filter((t) => parseFloat(t) < 0).sort((a, b) => parseFloat(a) > parseFloat(b) ? -1 : 1);
47
- return /* @__PURE__ */ jsxs(YStack, { flex: 1, space: true, children: [
48
- /* @__PURE__ */ jsx(H2, { children: "Sizes" }),
49
- /* @__PURE__ */ jsx(YStack, { width: "100%", space: "$2", separator: /* @__PURE__ */ jsx(Separator, {}), children: (section === "spaceNegative" ? spaceTokensNegative : spaceTokens).map(
50
- (token) => {
51
- var _a, _b, _c, _d, _e;
52
- return /* @__PURE__ */ jsxs(XStack, { width: "100%", alignItems: "center", children: [
53
- /* @__PURE__ */ jsx(YStack, { width: "25%", children: /* @__PURE__ */ jsxs(H3, { size: "$6", children: [
54
- "$",
55
- token
56
- ] }) }),
57
- /* @__PURE__ */ jsx(YStack, { width: "20%", children: /* @__PURE__ */ jsxs(H4, { size: "$5", children: [
58
- (_a = tokens[token]) == null ? void 0 : _a.val,
59
- "px"
60
- ] }) }),
61
- /* @__PURE__ */ jsx(
62
- Square,
63
- {
64
- size: (_b = tokens[token]) == null ? void 0 : _b.val,
65
- backgroundColor: "$color5",
66
- ...section === "spaceNegative" && {
67
- backgroundColor: "$red5",
68
- size: -((_c = tokens[spaceTokensNegative.find(
69
- (t) => parseFloat(t) === -parseFloat(token)
70
- ) ?? token]) == null ? void 0 : _c.val)
71
- },
72
- ...section === "radius" && {
73
- // @ts-ignore
74
- size: (_d = allTokens.size[token]) == null ? void 0 : _d.val,
75
- borderRadius: (_e = tokens[token]) == null ? void 0 : _e.val
76
- }
77
- }
78
- )
79
- ] }, token);
80
- }
81
- ) })
82
- ] });
83
- }
84
- export {
85
- TokensDemo
86
- };
87
- //# sourceMappingURL=TokensDemo.mjs.map
@@ -1,68 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import {
3
- ChevronDown,
4
- ChevronLeft,
5
- ChevronRight,
6
- ChevronUp,
7
- Circle
8
- } from "@tamagui/lucide-icons";
9
- import {
10
- Button,
11
- Paragraph,
12
- Theme,
13
- Tooltip,
14
- TooltipGroup,
15
- XStack,
16
- YStack
17
- } from "tamagui";
18
- function TooltipDemo() {
19
- return /* @__PURE__ */ jsx(TooltipGroup, { delay: { open: 3e3, close: 100 }, children: /* @__PURE__ */ jsxs(YStack, { space: "$2", alignSelf: "center", children: [
20
- /* @__PURE__ */ jsxs(XStack, { space: "$2", children: [
21
- /* @__PURE__ */ jsx(Demo, { groupId: "0", placement: "top-end", Icon: Circle }),
22
- /* @__PURE__ */ jsx(Demo, { groupId: "1", placement: "top", Icon: ChevronUp }),
23
- /* @__PURE__ */ jsx(Demo, { groupId: "2", placement: "top-start", Icon: Circle })
24
- ] }),
25
- /* @__PURE__ */ jsxs(XStack, { space: "$2", children: [
26
- /* @__PURE__ */ jsx(Demo, { groupId: "3", placement: "left", Icon: ChevronLeft }),
27
- /* @__PURE__ */ jsx(YStack, { flex: 1 }),
28
- /* @__PURE__ */ jsx(Demo, { groupId: "4", placement: "right", Icon: ChevronRight })
29
- ] }),
30
- /* @__PURE__ */ jsxs(XStack, { space: "$2", children: [
31
- /* @__PURE__ */ jsx(Demo, { groupId: "5", placement: "bottom-end", Icon: Circle }),
32
- /* @__PURE__ */ jsx(Demo, { groupId: "6", placement: "bottom", Icon: ChevronDown }),
33
- /* @__PURE__ */ jsx(Demo, { groupId: "7", placement: "bottom-start", Icon: Circle })
34
- ] })
35
- ] }) });
36
- }
37
- function Demo({ Icon, ...props }) {
38
- return /* @__PURE__ */ jsxs(Tooltip, { ...props, children: [
39
- /* @__PURE__ */ jsx(Tooltip.Trigger, { children: /* @__PURE__ */ jsx(Button, { icon: Icon, circular: true }) }),
40
- /* @__PURE__ */ jsx(Theme, { inverse: true, children: /* @__PURE__ */ jsxs(
41
- Tooltip.Content,
42
- {
43
- enterStyle: { x: 0, y: -5, opacity: 0, scale: 0.9 },
44
- exitStyle: { x: 0, y: -5, opacity: 0, scale: 0.9 },
45
- scale: 1,
46
- x: 0,
47
- y: 0,
48
- opacity: 1,
49
- animation: [
50
- "quick",
51
- {
52
- opacity: {
53
- overshootClamping: true
54
- }
55
- }
56
- ],
57
- children: [
58
- /* @__PURE__ */ jsx(Tooltip.Arrow, {}),
59
- /* @__PURE__ */ jsx(Paragraph, { size: "$2", lineHeight: "$1", children: "Hello world" })
60
- ]
61
- }
62
- ) })
63
- ] });
64
- }
65
- export {
66
- TooltipDemo
67
- };
68
- //# sourceMappingURL=TooltipDemo.mjs.map
@@ -1,56 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import * as Config from "@tamagui/config";
3
- import { addTheme, updateTheme } from "@tamagui/theme";
4
- import { useState } from "react";
5
- import {
6
- Button,
7
- Square,
8
- Theme,
9
- XStack,
10
- YStack,
11
- getVariableValue,
12
- useForceUpdate,
13
- useIsomorphicLayoutEffect
14
- } from "tamagui";
15
- const colors = Config.config.tokens.color;
16
- const colorKeys = Object.keys(colors);
17
- function UpdateThemeDemo() {
18
- const [theme, setTheme] = useState();
19
- const update = useForceUpdate();
20
- useIsomorphicLayoutEffect(() => {
21
- addTheme({
22
- name: "custom",
23
- insertCSS: true,
24
- theme: {
25
- color: "red",
26
- color2: "blue"
27
- }
28
- });
29
- setTheme("custom");
30
- }, []);
31
- return /* @__PURE__ */ jsxs(YStack, { alignItems: "center", space: true, children: [
32
- /* @__PURE__ */ jsx(XStack, { gap: "$5", children: /* @__PURE__ */ jsx(Theme, { name: theme ?? null, children: /* @__PURE__ */ jsx(Square, { borderRadius: "$8", size: 100, backgroundColor: "$color" }) }) }),
33
- /* @__PURE__ */ jsx(
34
- Button,
35
- {
36
- onPress: () => {
37
- const randomColor = getVariableValue(
38
- colors[colorKeys[Math.floor(Math.random() * colorKeys.length)]]
39
- );
40
- updateTheme({
41
- name: "custom",
42
- theme: {
43
- color: randomColor
44
- }
45
- });
46
- update();
47
- },
48
- children: "Set to random color"
49
- }
50
- )
51
- ] });
52
- }
53
- export {
54
- UpdateThemeDemo
55
- };
56
- //# sourceMappingURL=UpdateThemeDemo.mjs.map
package/dist/esm/conf.mjs DELETED
@@ -1,5 +0,0 @@
1
- import { config as config2 } from "@tamagui/config";
2
- export {
3
- config2 as config
4
- };
5
- //# sourceMappingURL=conf.mjs.map
@@ -1,48 +0,0 @@
1
- export * from "./AlertDialogDemo";
2
- export * from "./AnimationsDemo";
3
- export * from "./AnimationsEnterDemo";
4
- export * from "./AnimationsHoverDemo";
5
- export * from "./AnimationsTimingDemo";
6
- export * from "./AnimationsPresenceDemo";
7
- export * from "./AvatarDemo";
8
- export * from "./ButtonDemo";
9
- export * from "./ButtonNewDemo";
10
- export * from "./CardDemo";
11
- export * from "./DialogDemo";
12
- export * from "./AddThemeDemo";
13
- export * from "./UpdateThemeDemo";
14
- export * from "./ReplaceThemeDemo";
15
- export * from "./FormsDemo";
16
- export * from "./InputsDemo";
17
- export * from "./GroupDemo";
18
- export * from "./HeadingsDemo";
19
- export * from "./ImageDemo";
20
- export * from "./LabelDemo";
21
- export * from "./LinearGradientDemo";
22
- export * from "./ListItemDemo";
23
- export * from "./LucideIconsDemo";
24
- export * from "./PopoverDemo";
25
- export * from "./ProgressDemo";
26
- export * from "./RadioGroupDemo";
27
- export * from "./SelectDemo";
28
- export * from "./SeparatorDemo";
29
- export * from "./ShapesDemo";
30
- export * from "./ScrollViewDemo";
31
- export * from "./SheetDemo";
32
- export * from "./SliderDemo";
33
- export * from "./SpinnerDemo";
34
- export * from "./StacksDemo";
35
- export * from "./SwitchDemo";
36
- export * from "./CheckboxDemo";
37
- export * from "./TextDemo";
38
- export * from "./ThemeInverseDemo";
39
- export * from "./TooltipDemo";
40
- export * from "./ColorsDemo";
41
- export * from "./TokensDemo";
42
- export * from "./ToastDemo";
43
- export * from "./ToastDuplicateDemo";
44
- export * from "./TabsDemo";
45
- export * from "./TabsAdvancedDemo";
46
- export * from "./ToggleGroupDemo";
47
- export * from "./useOnIntersecting";
48
- //# sourceMappingURL=index.mjs.map
@@ -1,6 +0,0 @@
1
- import { config } from "./conf";
2
- var tamagui_config_default = config;
3
- export {
4
- tamagui_config_default as default
5
- };
6
- //# sourceMappingURL=tamagui.config.mjs.map
@@ -1,68 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { isWeb, useEvent } from "tamagui";
3
- function useIsIntersecting(refs, { once, ...opts } = {}) {
4
- const [values, setValues] = useState([]);
5
- if (isWeb) {
6
- useOnIntersecting(
7
- refs,
8
- (entries) => {
9
- const intersecting = entries.some((x) => x == null ? void 0 : x.isIntersecting);
10
- if (once && !intersecting)
11
- return;
12
- setValues((prev) => {
13
- const next = entries.map((e) => (e == null ? void 0 : e.isIntersecting) ?? false);
14
- if (prev.length === next.length && prev.every((e, i) => e === next[i])) {
15
- return prev;
16
- }
17
- return next;
18
- });
19
- },
20
- opts
21
- );
22
- }
23
- return Array.isArray(refs) ? values : values[0];
24
- }
25
- function useOnIntersecting(refsIn, incomingCbRaw, { threshold = 0, root, rootMargin } = {}, mountArgs = []) {
26
- const onIntersectEvent = useEvent(incomingCbRaw);
27
- useEffect(() => {
28
- const refs = Array.isArray(refsIn) ? refsIn : [refsIn];
29
- if (!refs.length)
30
- return;
31
- let dispose = null;
32
- let currentEntries = [];
33
- const options = {
34
- threshold,
35
- root,
36
- rootMargin
37
- };
38
- const io = new IntersectionObserver((entries) => {
39
- currentEntries = refs.map((ref, index) => {
40
- return entries.find((x) => x.target === ref.current) ?? currentEntries[index] ?? null;
41
- });
42
- dispose == null ? void 0 : dispose();
43
- dispose = onIntersectEvent(currentEntries) || null;
44
- }, options);
45
- for (const ref of refs) {
46
- if (ref.current) {
47
- io.observe(ref.current);
48
- }
49
- }
50
- return () => {
51
- dispose == null ? void 0 : dispose();
52
- io.disconnect();
53
- };
54
- }, [
55
- onIntersectEvent,
56
- refsIn,
57
- root,
58
- rootMargin,
59
- threshold,
60
- // eslint-disable-next-line react-hooks/exhaustive-deps
61
- ...mountArgs
62
- ]);
63
- }
64
- export {
65
- useIsIntersecting,
66
- useOnIntersecting
67
- };
68
- //# sourceMappingURL=useOnIntersecting.mjs.map
@@ -1,92 +0,0 @@
1
- import { ButtonBase } from "@tamagui/button";
2
- import { getButtonSized } from "@tamagui/get-button-sized";
3
- import { Activity, Airplay } from "@tamagui/lucide-icons";
4
- import {
5
- XGroup,
6
- XStack,
7
- YStack,
8
- getFontSize,
9
- styled,
10
- withStaticProperties
11
- } from "tamagui";
12
- const ButtonFrame = styled(ButtonBase, {
13
- tag: "button",
14
- justifyContent: "center",
15
- alignItems: "center",
16
- flexWrap: "nowrap",
17
- flexDirection: "row",
18
- cursor: "pointer",
19
- hoverTheme: true,
20
- pressTheme: true,
21
- backgrounded: true,
22
- borderWidth: 1,
23
- borderColor: "$borderColor",
24
- pressStyle: {
25
- borderColor: "$borderColorPress"
26
- },
27
- focusStyle: {
28
- outlineColor: "$borderColorFocus",
29
- outlineStyle: "solid",
30
- outlineWidth: 2
31
- },
32
- variants: {
33
- size: {
34
- "...size": getButtonSized
35
- },
36
- active: {
37
- true: {
38
- hoverStyle: {
39
- backgroundColor: "$background"
40
- }
41
- }
42
- },
43
- disabled: {
44
- true: {
45
- pointerEvents: "none",
46
- opacity: 0.5
47
- }
48
- }
49
- },
50
- defaultVariants: {
51
- size: "$true"
52
- }
53
- });
54
- const TextFrame = styled(ButtonBase.Text, {
55
- // ... your styles
56
- });
57
- const Button = withStaticProperties(ButtonFrame, {
58
- Text: TextFrame,
59
- Icon: ButtonBase.Icon
60
- });
61
- const SimpleButton = ButtonFrame.styleable((props, ref) => {
62
- const { color, icon: Icon, iconAfter: IconAfter, size = "$3", ...buttonProps } = props;
63
- const fontSize = getFontSize(size);
64
- const iconSize = fontSize * 2;
65
- return <Button ref={ref} size={size} {...buttonProps}>
66
- {Icon && <Button.Icon size={iconSize}><Icon /></Button.Icon>}
67
- <Button.Text color={color} size={props.size}>{props.children}</Button.Text>
68
- {IconAfter && <Button.Icon size={iconSize}><IconAfter /></Button.Icon>}
69
- </Button>;
70
- });
71
- function ButtonHeadlessDemo(props) {
72
- return <YStack padding="$3" space="$3" {...props}>
73
- <SimpleButton>Plain</SimpleButton>
74
- <SimpleButton alignSelf="center" size="$6" space="$3" icon={Airplay}>Large</SimpleButton>
75
- <XStack space="$2" justifyContent="center">
76
- <SimpleButton size="$3" theme="alt2">Alt2</SimpleButton>
77
- <SimpleButton size="$3" theme="yellow">Yellow</SimpleButton>
78
- </XStack>
79
- <XStack space="$2">
80
- <SimpleButton themeInverse size="$3">Small Inverse</SimpleButton>
81
- <SimpleButton size="$3" space="$1.5" iconAfter={Activity}>After</SimpleButton>
82
- </XStack>
83
- <XGroup>
84
- <XGroup.Item><SimpleButton width="50%" size="$2" disabled>disabled</SimpleButton></XGroup.Item>
85
- <XGroup.Item><SimpleButton width="50%" size="$2" chromeless>chromeless</SimpleButton></XGroup.Item>
86
- </XGroup>
87
- </YStack>;
88
- }
89
- export {
90
- ButtonHeadlessDemo
91
- };
92
- //# sourceMappingURL=ButtonHeadlessDemo.mjs.map
@@ -1,24 +0,0 @@
1
- import { Activity, Airplay } from "@tamagui/lucide-icons";
2
- import { Button, XGroup, XStack, YStack } from "tamagui";
3
- function ButtonSimpleDemo(props) {
4
- return <YStack padding="$3" space="$3" {...props}>
5
- <Button>Plain</Button>
6
- <Button alignSelf="center" icon={Airplay} size="$6">Large</Button>
7
- <XStack space="$2" justifyContent="center">
8
- <Button size="$3" theme="alt2">Alt2</Button>
9
- <Button size="$3" theme="yellow">Yellow</Button>
10
- </XStack>
11
- <XStack space="$2">
12
- <Button themeInverse size="$3">Small Inverse</Button>
13
- <Button iconAfter={Activity} size="$3">After</Button>
14
- </XStack>
15
- <XGroup>
16
- <XGroup.Item><Button width="50%" size="$2" disabled opacity={0.5}>disabled</Button></XGroup.Item>
17
- <XGroup.Item><Button width="50%" size="$2" chromeless>chromeless</Button></XGroup.Item>
18
- </XGroup>
19
- </YStack>;
20
- }
21
- export {
22
- ButtonSimpleDemo
23
- };
24
- //# sourceMappingURL=ButtonSimpleDemo.mjs.map