@luxfi/ui 6.0.0 → 6.1.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/components/Badge.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,QAAA,MAAM,UAAU;;;8CAoDd,CAAA;AAmCF,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,GAAG;IACrD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAA;AAED,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,OAAmB,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,2CAM5E"}
@@ -0,0 +1,91 @@
1
+ import { jsx as _jsx } from 'react/jsx-runtime'
2
+ import { Stack, styled, Text } from 'tamagui'
3
+
4
+ const BadgeFrame = styled(Stack, {
5
+ name: 'Badge',
6
+ flexDirection: 'row',
7
+ alignItems: 'center',
8
+ justifyContent: 'center',
9
+ paddingHorizontal: '$2',
10
+ paddingVertical: '$1',
11
+ borderRadius: '$2',
12
+ variants: {
13
+ variant: {
14
+ default: {
15
+ backgroundColor: '$backgroundHover',
16
+ },
17
+ primary: {
18
+ backgroundColor: '$primary',
19
+ },
20
+ success: {
21
+ backgroundColor: '$success',
22
+ },
23
+ warning: {
24
+ backgroundColor: '$warning',
25
+ },
26
+ error: {
27
+ backgroundColor: '$error',
28
+ },
29
+ outline: {
30
+ backgroundColor: 'transparent',
31
+ borderWidth: 1,
32
+ borderColor: '$borderColor',
33
+ },
34
+ },
35
+ size: {
36
+ sm: {
37
+ paddingHorizontal: '$1.5',
38
+ paddingVertical: 2,
39
+ },
40
+ md: {
41
+ paddingHorizontal: '$2',
42
+ paddingVertical: '$1',
43
+ },
44
+ lg: {
45
+ paddingHorizontal: '$3',
46
+ paddingVertical: '$1.5',
47
+ },
48
+ },
49
+ },
50
+ defaultVariants: {
51
+ variant: 'default',
52
+ size: 'md',
53
+ },
54
+ })
55
+ const BadgeText = styled(Text, {
56
+ name: 'BadgeText',
57
+ fontSize: 12,
58
+ fontWeight: '500',
59
+ variants: {
60
+ variant: {
61
+ default: {
62
+ color: '$color',
63
+ },
64
+ primary: {
65
+ color: 'white',
66
+ },
67
+ success: {
68
+ color: 'white',
69
+ },
70
+ warning: {
71
+ color: 'white',
72
+ },
73
+ error: {
74
+ color: 'white',
75
+ },
76
+ outline: {
77
+ color: '$color',
78
+ },
79
+ },
80
+ },
81
+ defaultVariants: {
82
+ variant: 'default',
83
+ },
84
+ })
85
+ export function Badge({ children, variant = 'default', ...props }) {
86
+ return _jsx(BadgeFrame, {
87
+ variant: variant,
88
+ ...props,
89
+ children: _jsx(BadgeText, { variant: variant, children: children }),
90
+ })
91
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGhD,QAAA,MAAM,WAAW;;;;;8CAgHf,CAAA;AAsBF,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,GAAG;IACvD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AAED,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,2CAU/D;yBAVe,MAAM"}
@@ -0,0 +1,137 @@
1
+ import { styled } from '@tamagui/core'
2
+ import { jsx as _jsx } from 'react/jsx-runtime'
3
+ import { Stack, Text } from 'tamagui'
4
+
5
+ const ButtonFrame = styled(Stack, {
6
+ name: 'Button',
7
+ tag: 'button',
8
+ alignItems: 'center',
9
+ justifyContent: 'center',
10
+ flexDirection: 'row',
11
+ gap: '$2',
12
+ borderRadius: '$3',
13
+ paddingHorizontal: '$4',
14
+ paddingVertical: '$3',
15
+ cursor: 'pointer',
16
+ pressStyle: {
17
+ opacity: 0.8,
18
+ scale: 0.98,
19
+ },
20
+ hoverStyle: {
21
+ opacity: 0.9,
22
+ },
23
+ focusStyle: {
24
+ outlineWidth: 2,
25
+ outlineColor: '$primary',
26
+ outlineStyle: 'solid',
27
+ outlineOffset: 2,
28
+ },
29
+ disabledStyle: {
30
+ opacity: 0.5,
31
+ cursor: 'not-allowed',
32
+ },
33
+ variants: {
34
+ variant: {
35
+ primary: {
36
+ backgroundColor: '$primary',
37
+ color: 'white',
38
+ hoverStyle: {
39
+ backgroundColor: '$primaryHover',
40
+ },
41
+ },
42
+ secondary: {
43
+ backgroundColor: '$secondary',
44
+ color: '$color',
45
+ hoverStyle: {
46
+ backgroundColor: '$secondaryHover',
47
+ },
48
+ },
49
+ outline: {
50
+ backgroundColor: 'transparent',
51
+ borderWidth: 1,
52
+ borderColor: '$borderColor',
53
+ color: '$color',
54
+ hoverStyle: {
55
+ backgroundColor: '$backgroundHover',
56
+ },
57
+ },
58
+ ghost: {
59
+ backgroundColor: 'transparent',
60
+ color: '$color',
61
+ hoverStyle: {
62
+ backgroundColor: '$backgroundHover',
63
+ },
64
+ },
65
+ destructive: {
66
+ backgroundColor: '$error',
67
+ color: 'white',
68
+ hoverStyle: {
69
+ backgroundColor: '$errorDark',
70
+ },
71
+ },
72
+ },
73
+ size: {
74
+ sm: {
75
+ paddingHorizontal: '$3',
76
+ paddingVertical: '$2',
77
+ height: 32,
78
+ },
79
+ md: {
80
+ paddingHorizontal: '$4',
81
+ paddingVertical: '$3',
82
+ height: 40,
83
+ },
84
+ lg: {
85
+ paddingHorizontal: '$5',
86
+ paddingVertical: '$4',
87
+ height: 48,
88
+ },
89
+ xl: {
90
+ paddingHorizontal: '$6',
91
+ paddingVertical: '$5',
92
+ height: 56,
93
+ },
94
+ },
95
+ fullWidth: {
96
+ true: {
97
+ width: '100%',
98
+ },
99
+ },
100
+ circular: {
101
+ true: {
102
+ borderRadius: '$round',
103
+ paddingHorizontal: 0,
104
+ aspectRatio: 1,
105
+ },
106
+ },
107
+ },
108
+ defaultVariants: {
109
+ variant: 'primary',
110
+ size: 'md',
111
+ },
112
+ })
113
+ const ButtonText = styled(Text, {
114
+ name: 'ButtonText',
115
+ fontFamily: '$body',
116
+ fontWeight: '600',
117
+ color: 'inherit',
118
+ variants: {
119
+ size: {
120
+ sm: { fontSize: 13 },
121
+ md: { fontSize: 14 },
122
+ lg: { fontSize: 16 },
123
+ xl: { fontSize: 18 },
124
+ },
125
+ },
126
+ defaultVariants: {
127
+ size: 'md',
128
+ },
129
+ })
130
+ export function Button({ children, size, ...props }) {
131
+ return _jsx(ButtonFrame, {
132
+ size: size,
133
+ ...props,
134
+ children: typeof children === 'string' ? _jsx(ButtonText, { size: size, children: children }) : children,
135
+ })
136
+ }
137
+ Button.displayName = 'Button'
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../src/components/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGhD,eAAO,MAAM,IAAI;;;;8CA8Df,CAAA;AAEF,eAAO,MAAM,UAAU,qPAGrB,CAAA;AAEF,eAAO,MAAM,SAAS;;;8CAGpB,CAAA;AAEF,eAAO,MAAM,eAAe;;8CAI1B,CAAA;AAEF,eAAO,MAAM,WAAW,qPAGtB,CAAA;AAEF,eAAO,MAAM,UAAU,qPAOrB,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA"}
@@ -0,0 +1,86 @@
1
+ import { styled } from '@tamagui/core'
2
+ import { H3, Stack, Text } from 'tamagui'
3
+ export const Card = styled(Stack, {
4
+ name: 'Card',
5
+ backgroundColor: '$card',
6
+ borderRadius: '$4',
7
+ borderWidth: 1,
8
+ borderColor: '$borderColor',
9
+ padding: '$4',
10
+ gap: '$3',
11
+ variants: {
12
+ variant: {
13
+ default: {},
14
+ elevated: {
15
+ shadowColor: '$black',
16
+ shadowOffset: { width: 0, height: 4 },
17
+ shadowOpacity: 0.1,
18
+ shadowRadius: 8,
19
+ elevation: 4,
20
+ },
21
+ outline: {
22
+ backgroundColor: 'transparent',
23
+ borderWidth: 1,
24
+ borderColor: '$borderColor',
25
+ },
26
+ ghost: {
27
+ backgroundColor: 'transparent',
28
+ borderWidth: 0,
29
+ },
30
+ },
31
+ size: {
32
+ sm: {
33
+ padding: '$3',
34
+ gap: '$2',
35
+ },
36
+ md: {
37
+ padding: '$4',
38
+ gap: '$3',
39
+ },
40
+ lg: {
41
+ padding: '$5',
42
+ gap: '$4',
43
+ },
44
+ },
45
+ hoverable: {
46
+ true: {
47
+ cursor: 'pointer',
48
+ hoverStyle: {
49
+ backgroundColor: '$cardHover',
50
+ },
51
+ pressStyle: {
52
+ opacity: 0.9,
53
+ },
54
+ },
55
+ },
56
+ },
57
+ defaultVariants: {
58
+ variant: 'default',
59
+ size: 'md',
60
+ },
61
+ })
62
+ export const CardHeader = styled(Stack, {
63
+ name: 'CardHeader',
64
+ gap: '$2',
65
+ })
66
+ export const CardTitle = styled(H3, {
67
+ name: 'CardTitle',
68
+ fontWeight: '600',
69
+ })
70
+ export const CardDescription = styled(Text, {
71
+ name: 'CardDescription',
72
+ color: '$mutedForeground',
73
+ fontSize: 14,
74
+ })
75
+ export const CardContent = styled(Stack, {
76
+ name: 'CardContent',
77
+ gap: '$3',
78
+ })
79
+ export const CardFooter = styled(Stack, {
80
+ name: 'CardFooter',
81
+ flexDirection: 'row',
82
+ alignItems: 'center',
83
+ justifyContent: 'flex-end',
84
+ gap: '$2',
85
+ paddingTop: '$3',
86
+ })
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../src/components/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGhD,eAAO,MAAM,UAAU;;;;8CAiErB,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAA"}
@@ -0,0 +1,64 @@
1
+ import { styled } from '@tamagui/core'
2
+ import { Stack } from 'tamagui'
3
+ export const IconButton = styled(Stack, {
4
+ name: 'IconButton',
5
+ tag: 'button',
6
+ alignItems: 'center',
7
+ justifyContent: 'center',
8
+ borderRadius: '$2',
9
+ cursor: 'pointer',
10
+ pressStyle: {
11
+ opacity: 0.8,
12
+ scale: 0.95,
13
+ },
14
+ hoverStyle: {
15
+ backgroundColor: '$backgroundHover',
16
+ },
17
+ focusStyle: {
18
+ outlineWidth: 2,
19
+ outlineColor: '$primary',
20
+ outlineStyle: 'solid',
21
+ },
22
+ disabledStyle: {
23
+ opacity: 0.5,
24
+ cursor: 'not-allowed',
25
+ },
26
+ variants: {
27
+ variant: {
28
+ default: {
29
+ backgroundColor: 'transparent',
30
+ },
31
+ filled: {
32
+ backgroundColor: '$secondary',
33
+ },
34
+ outline: {
35
+ backgroundColor: 'transparent',
36
+ borderWidth: 1,
37
+ borderColor: '$borderColor',
38
+ },
39
+ },
40
+ size: {
41
+ sm: {
42
+ width: 28,
43
+ height: 28,
44
+ },
45
+ md: {
46
+ width: 36,
47
+ height: 36,
48
+ },
49
+ lg: {
50
+ width: 44,
51
+ height: 44,
52
+ },
53
+ },
54
+ circular: {
55
+ true: {
56
+ borderRadius: '$round',
57
+ },
58
+ },
59
+ },
60
+ defaultVariants: {
61
+ variant: 'default',
62
+ size: 'md',
63
+ },
64
+ })
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../src/components/Input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAGvC,QAAA,MAAM,UAAU;;;;;;;;;;;8CAwCd,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,UAAU,CAAC,EAAE,UAAU,CAAC,GAAG;IACvE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAA;IACrC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC/B,CAAA;AAED,eAAO,MAAM,KAAK;;;;;;;;;;;;YARR,MAAM;mBACC,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI;kBACvB,MAAM;WACb,MAAM,GAAG,QAAQ,GAAG,UAAU;kBACvB,KAAK,CAAC,SAAS;mBACd,KAAK,CAAC,SAAS;oDA2B/B,CAAA"}
@@ -0,0 +1,71 @@
1
+ import { forwardRef } from 'react'
2
+ import { jsx as _jsx, jsxs as _jsxs } from 'react/jsx-runtime'
3
+ import { styled, XStack } from 'tamagui'
4
+
5
+ const InputFrame = styled(XStack, {
6
+ name: 'InputFrame',
7
+ alignItems: 'center',
8
+ backgroundColor: '$backgroundHover',
9
+ borderRadius: '$3',
10
+ borderWidth: 1,
11
+ borderColor: '$borderColor',
12
+ paddingHorizontal: '$3',
13
+ height: 48,
14
+ gap: '$2',
15
+ focusWithinStyle: {
16
+ borderColor: '$primary',
17
+ },
18
+ variants: {
19
+ size: {
20
+ sm: {
21
+ height: 36,
22
+ paddingHorizontal: '$2',
23
+ },
24
+ md: {
25
+ height: 48,
26
+ paddingHorizontal: '$3',
27
+ },
28
+ lg: {
29
+ height: 56,
30
+ paddingHorizontal: '$4',
31
+ },
32
+ },
33
+ error: {
34
+ true: {
35
+ borderColor: '$red10',
36
+ },
37
+ },
38
+ },
39
+ defaultVariants: {
40
+ size: 'md',
41
+ },
42
+ })
43
+ export const Input = forwardRef(
44
+ ({ value, onChangeText, placeholder, type = 'text', leftElement, rightElement, size, error, ...props }, ref) => {
45
+ return _jsxs(InputFrame, {
46
+ size: size,
47
+ error: error,
48
+ ...props,
49
+ children: [
50
+ leftElement,
51
+ _jsx('input', {
52
+ ref: ref,
53
+ value: value,
54
+ onChange: (e) => onChangeText?.(e.target.value),
55
+ placeholder: placeholder,
56
+ type: type,
57
+ style: {
58
+ flex: 1,
59
+ backgroundColor: 'transparent',
60
+ border: 'none',
61
+ outline: 'none',
62
+ fontSize: 16,
63
+ color: 'inherit',
64
+ },
65
+ }),
66
+ rightElement,
67
+ ],
68
+ })
69
+ }
70
+ )
71
+ Input.displayName = 'Input'
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../src/components/Modal.tsx"],"names":[],"mappings":"AAmDA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,wBAAgB,KAAK,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,UAAU,2CA+CxE"}
@@ -0,0 +1,98 @@
1
+ import { X } from '@tamagui/lucide-icons'
2
+ import { jsx as _jsx, jsxs as _jsxs } from 'react/jsx-runtime'
3
+ import { Dialog, Stack, styled, Text } from 'tamagui'
4
+ import { IconButton } from './IconButton'
5
+
6
+ const _Overlay = styled(Stack, {
7
+ name: 'ModalOverlay',
8
+ position: 'absolute',
9
+ top: 0,
10
+ left: 0,
11
+ right: 0,
12
+ bottom: 0,
13
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
14
+ justifyContent: 'center',
15
+ alignItems: 'center',
16
+ animation: 'quick',
17
+ opacity: 0,
18
+ enterStyle: { opacity: 0 },
19
+ exitStyle: { opacity: 0 },
20
+ })
21
+ const _ModalContent = styled(Stack, {
22
+ name: 'ModalContent',
23
+ backgroundColor: '$background',
24
+ borderRadius: '$4',
25
+ padding: '$4',
26
+ width: '100%',
27
+ maxWidth: 420,
28
+ maxHeight: '85vh',
29
+ animation: 'medium',
30
+ y: 20,
31
+ opacity: 0,
32
+ enterStyle: { y: 20, opacity: 0 },
33
+ exitStyle: { y: 20, opacity: 0 },
34
+ })
35
+ const ModalHeader = styled(Stack, {
36
+ name: 'ModalHeader',
37
+ flexDirection: 'row',
38
+ alignItems: 'center',
39
+ justifyContent: 'space-between',
40
+ marginBottom: '$3',
41
+ })
42
+ const ModalTitle = styled(Text, {
43
+ name: 'ModalTitle',
44
+ fontSize: 18,
45
+ fontWeight: '600',
46
+ color: '$color',
47
+ })
48
+ export function Modal({ open, onOpenChange, title, children }) {
49
+ return _jsx(Dialog, {
50
+ modal: true,
51
+ open: open,
52
+ onOpenChange: onOpenChange,
53
+ children: _jsxs(Dialog.Portal, {
54
+ children: [
55
+ _jsx(
56
+ Dialog.Overlay,
57
+ { animation: 'quick', opacity: 0.5, enterStyle: { opacity: 0 }, exitStyle: { opacity: 0 } },
58
+ 'overlay'
59
+ ),
60
+ _jsxs(
61
+ Dialog.Content,
62
+ {
63
+ bordered: true,
64
+ elevate: true,
65
+ animation: [
66
+ 'medium',
67
+ {
68
+ opacity: {
69
+ overshootClamping: true,
70
+ },
71
+ },
72
+ ],
73
+ enterStyle: { x: 0, y: -20, opacity: 0, scale: 0.9 },
74
+ exitStyle: { x: 0, y: 10, opacity: 0, scale: 0.95 },
75
+ width: '100%',
76
+ maxWidth: 420,
77
+ padding: '$4',
78
+ borderRadius: '$4',
79
+ children: [
80
+ title &&
81
+ _jsxs(ModalHeader, {
82
+ children: [
83
+ _jsx(Dialog.Title, { children: _jsx(ModalTitle, { children: title }) }),
84
+ _jsx(Dialog.Close, {
85
+ asChild: true,
86
+ children: _jsx(IconButton, { size: 'sm', variant: 'default', children: _jsx(X, { size: 16 }) }),
87
+ }),
88
+ ],
89
+ }),
90
+ children,
91
+ ],
92
+ },
93
+ 'content'
94
+ ),
95
+ ],
96
+ }),
97
+ })
98
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../src/components/Skeleton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,eAAO,MAAM,QAAQ;;;;8CA6CnB,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAA"}
@@ -0,0 +1,44 @@
1
+ import { Stack, styled } from 'tamagui'
2
+ export const Skeleton = styled(Stack, {
3
+ name: 'Skeleton',
4
+ backgroundColor: '$backgroundHover',
5
+ borderRadius: '$2',
6
+ animation: 'lazy',
7
+ // Pulse animation via opacity
8
+ animateOnly: ['opacity'],
9
+ opacity: 1,
10
+ enterStyle: {
11
+ opacity: 0.5,
12
+ },
13
+ variants: {
14
+ variant: {
15
+ text: {
16
+ height: 16,
17
+ width: '100%',
18
+ },
19
+ circular: {
20
+ borderRadius: 1000,
21
+ },
22
+ rectangular: {
23
+ borderRadius: '$2',
24
+ },
25
+ },
26
+ width: {
27
+ sm: { width: 60 },
28
+ md: { width: 100 },
29
+ lg: { width: 160 },
30
+ full: { width: '100%' },
31
+ },
32
+ height: {
33
+ sm: { height: 16 },
34
+ md: { height: 24 },
35
+ lg: { height: 40 },
36
+ xl: { height: 60 },
37
+ },
38
+ },
39
+ defaultVariants: {
40
+ variant: 'rectangular',
41
+ width: 'full',
42
+ height: 'md',
43
+ },
44
+ })
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../src/components/Spinner.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,QAAA,MAAM,YAAY;;8CAqChB,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAA;AAExD,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,2CAE1C"}
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx } from 'react/jsx-runtime'
2
+ import { Stack, styled } from 'tamagui'
3
+
4
+ const SpinnerFrame = styled(Stack, {
5
+ name: 'Spinner',
6
+ borderWidth: 2,
7
+ borderColor: '$borderColor',
8
+ borderTopColor: '$primary',
9
+ borderRadius: 1000,
10
+ animation: 'lazy',
11
+ rotate: '0deg',
12
+ variants: {
13
+ size: {
14
+ sm: {
15
+ width: 16,
16
+ height: 16,
17
+ borderWidth: 2,
18
+ },
19
+ md: {
20
+ width: 24,
21
+ height: 24,
22
+ borderWidth: 2,
23
+ },
24
+ lg: {
25
+ width: 32,
26
+ height: 32,
27
+ borderWidth: 3,
28
+ },
29
+ xl: {
30
+ width: 48,
31
+ height: 48,
32
+ borderWidth: 4,
33
+ },
34
+ },
35
+ },
36
+ defaultVariants: {
37
+ size: 'md',
38
+ },
39
+ })
40
+ export function Spinner(props) {
41
+ return _jsx(SpinnerFrame, { ...props })
42
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/components/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,OAAO,CAAC,GAAG;IACnD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC1B,CAAA;AAED,wBAAgB,MAAM,CAAC,EAAE,IAAW,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,2CAY5D"}
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from 'react/jsx-runtime'
2
+ import { Switch as TSwitch } from 'tamagui'
3
+ export function Switch({ size = 'md', ...props }) {
4
+ const sizeMap = {
5
+ sm: '$2',
6
+ md: '$3',
7
+ lg: '$4',
8
+ }
9
+ return _jsx(TSwitch, { size: sizeMap[size], ...props, children: _jsx(TSwitch.Thumb, { animation: 'quick' }) })
10
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenLogo.d.ts","sourceRoot":"","sources":["../../src/components/TokenLogo.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGhD,QAAA,MAAM,cAAc;;8CAqBlB,CAAA;AA4BF,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,GAAG;IAC7D,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,2CAY5E;yBAZe,SAAS"}
@@ -0,0 +1,57 @@
1
+ import { styled } from '@tamagui/core'
2
+ import { jsx as _jsx } from 'react/jsx-runtime'
3
+ import { Image, Stack, Text } from 'tamagui'
4
+
5
+ const TokenLogoFrame = styled(Stack, {
6
+ name: 'TokenLogo',
7
+ alignItems: 'center',
8
+ justifyContent: 'center',
9
+ borderRadius: '$round',
10
+ overflow: 'hidden',
11
+ backgroundColor: '$muted',
12
+ variants: {
13
+ size: {
14
+ xs: { width: 20, height: 20 },
15
+ sm: { width: 24, height: 24 },
16
+ md: { width: 32, height: 32 },
17
+ lg: { width: 40, height: 40 },
18
+ xl: { width: 48, height: 48 },
19
+ },
20
+ },
21
+ defaultVariants: {
22
+ size: 'md',
23
+ },
24
+ })
25
+ const TokenImage = styled(Image, {
26
+ name: 'TokenImage',
27
+ width: '100%',
28
+ height: '100%',
29
+ })
30
+ const TokenFallback = styled(Text, {
31
+ name: 'TokenFallback',
32
+ fontWeight: '600',
33
+ color: '$mutedForeground',
34
+ variants: {
35
+ size: {
36
+ xs: { fontSize: 8 },
37
+ sm: { fontSize: 10 },
38
+ md: { fontSize: 12 },
39
+ lg: { fontSize: 14 },
40
+ xl: { fontSize: 16 },
41
+ },
42
+ },
43
+ defaultVariants: {
44
+ size: 'md',
45
+ },
46
+ })
47
+ export function TokenLogo({ symbol, logoURI, size, ...props }) {
48
+ const fallbackText = symbol.slice(0, 3).toUpperCase()
49
+ return _jsx(TokenLogoFrame, {
50
+ size: size,
51
+ ...props,
52
+ children: logoURI
53
+ ? _jsx(TokenImage, { source: { uri: logoURI } })
54
+ : _jsx(TokenFallback, { size: size, children: fallbackText }),
55
+ })
56
+ }
57
+ TokenLogo.displayName = 'TokenLogo'
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/components/Tooltip.tsx"],"names":[],"mappings":"AA0BA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAgB,OAAO,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAW,EAAE,EAAE,YAAY,2CAUvE"}
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from 'react/jsx-runtime'
2
+ import { Paragraph, styled, Tooltip as TTooltip } from 'tamagui'
3
+
4
+ const TooltipContent = styled(TTooltip.Content, {
5
+ name: 'TooltipContent',
6
+ backgroundColor: '$background',
7
+ borderRadius: '$2',
8
+ paddingHorizontal: '$3',
9
+ paddingVertical: '$2',
10
+ borderWidth: 1,
11
+ borderColor: '$borderColor',
12
+ enterStyle: { x: 0, y: -5, opacity: 0, scale: 0.9 },
13
+ exitStyle: { x: 0, y: -5, opacity: 0, scale: 0.9 },
14
+ animation: [
15
+ 'quick',
16
+ {
17
+ opacity: {
18
+ overshootClamping: true,
19
+ },
20
+ },
21
+ ],
22
+ })
23
+ const TooltipArrow = styled(TTooltip.Arrow, {
24
+ name: 'TooltipArrow',
25
+ })
26
+ export function Tooltip({ content, children, delay = 300 }) {
27
+ return _jsxs(TTooltip, {
28
+ delay: delay,
29
+ children: [
30
+ _jsx(TTooltip.Trigger, { asChild: true, children: children }),
31
+ _jsxs(TooltipContent, { children: [_jsx(TooltipArrow, {}), _jsx(Paragraph, { size: '$2', children: content })] }),
32
+ ],
33
+ })
34
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AAGhD,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AAGtD,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AAGtD,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * UI Components
3
+ */
4
+ // Core components
5
+
6
+ export { Badge } from './Badge'
7
+ export { Button } from './Button'
8
+ export { Card } from './Card'
9
+ export { IconButton } from './IconButton'
10
+ export { Input } from './Input'
11
+ // Feedback components
12
+ export { Modal } from './Modal'
13
+ export { Skeleton } from './Skeleton'
14
+ export { Spinner } from './Spinner'
15
+ // Form components
16
+ export { Switch } from './Switch'
17
+ // Display components
18
+ export { TokenLogo } from './TokenLogo'
19
+ export { Tooltip } from './Tooltip'
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,SAAS,CAAA;AAGvB,cAAc,cAAc,CAAA;AAG5B,OAAO,EACL,KAAK,EACL,MAAM,EACN,MAAM,EACN,MAAM,EACN,IAAI,EACJ,SAAS,EACT,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,SAAS,EACT,OAAO,EACP,UAAU,EACV,KAAK,EACL,KAAK,EACL,QAAQ,EACR,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,GACT,MAAM,SAAS,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @luxfi/ui - Tamagui-based UI components for Lux Exchange
3
+ *
4
+ * This package provides cross-platform UI components that work on
5
+ * web, iOS, and Android using Tamagui.
6
+ */
7
+ // Theme
8
+
9
+ // Re-export Tamagui primitives
10
+ export {
11
+ H1,
12
+ H2,
13
+ H3,
14
+ H4,
15
+ H5,
16
+ H6,
17
+ Image,
18
+ Input,
19
+ Label,
20
+ Paragraph,
21
+ ScrollView,
22
+ Separator,
23
+ Spinner,
24
+ Stack,
25
+ Text,
26
+ TextArea,
27
+ Theme,
28
+ useMedia,
29
+ useTheme,
30
+ XStack,
31
+ YStack,
32
+ ZStack,
33
+ } from 'tamagui'
34
+ // Components
35
+ export * from './components'
36
+ export * from './theme'
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Theme exports
3
+ */
4
+
5
+ export * from './themes'
6
+ export * from './tokens'
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../src/theme/themes.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCrB,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCpB,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,OAAO,UAAU,CAAA"}
@@ -0,0 +1,73 @@
1
+ import { createTheme } from '@tamagui/core'
2
+ /**
3
+ * Light theme
4
+ */
5
+ export const lightTheme = createTheme({
6
+ background: '#FFFFFF',
7
+ backgroundHover: '#F4F4F5',
8
+ backgroundPress: '#E4E4E7',
9
+ backgroundFocus: '#F4F4F5',
10
+ backgroundStrong: '#FAFAFA',
11
+ backgroundTransparent: 'transparent',
12
+ color: '#09090B',
13
+ colorHover: '#18181B',
14
+ colorPress: '#27272A',
15
+ colorFocus: '#18181B',
16
+ colorTransparent: 'transparent',
17
+ borderColor: '#E4E4E7',
18
+ borderColorHover: '#D4D4D8',
19
+ borderColorPress: '#A1A1AA',
20
+ borderColorFocus: '#FF6B00',
21
+ placeholderColor: '#A1A1AA',
22
+ // Semantic
23
+ primary: '#FF6B00',
24
+ primaryHover: '#FF8C00',
25
+ secondary: '#F4F4F5',
26
+ secondaryHover: '#E4E4E7',
27
+ success: '#22C55E',
28
+ warning: '#F59E0B',
29
+ error: '#EF4444',
30
+ info: '#3B82F6',
31
+ // Card
32
+ card: '#FFFFFF',
33
+ cardHover: '#FAFAFA',
34
+ // Muted
35
+ muted: '#F4F4F5',
36
+ mutedForeground: '#71717A',
37
+ })
38
+ /**
39
+ * Dark theme
40
+ */
41
+ export const darkTheme = createTheme({
42
+ background: '#09090B',
43
+ backgroundHover: '#18181B',
44
+ backgroundPress: '#27272A',
45
+ backgroundFocus: '#18181B',
46
+ backgroundStrong: '#0A0A0A',
47
+ backgroundTransparent: 'transparent',
48
+ color: '#FAFAFA',
49
+ colorHover: '#FFFFFF',
50
+ colorPress: '#E4E4E7',
51
+ colorFocus: '#FFFFFF',
52
+ colorTransparent: 'transparent',
53
+ borderColor: '#27272A',
54
+ borderColorHover: '#3F3F46',
55
+ borderColorPress: '#52525B',
56
+ borderColorFocus: '#FF6B00',
57
+ placeholderColor: '#71717A',
58
+ // Semantic
59
+ primary: '#FF6B00',
60
+ primaryHover: '#FF8C00',
61
+ secondary: '#27272A',
62
+ secondaryHover: '#3F3F46',
63
+ success: '#22C55E',
64
+ warning: '#F59E0B',
65
+ error: '#EF4444',
66
+ info: '#3B82F6',
67
+ // Card
68
+ card: '#18181B',
69
+ cardHover: '#27272A',
70
+ // Muted
71
+ muted: '#27272A',
72
+ mutedForeground: '#A1A1AA',
73
+ })
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/theme/tokens.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAuGjB,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,OAAO,MAAM,CAAA"}
@@ -0,0 +1,101 @@
1
+ import { createTokens } from '@tamagui/core'
2
+ /**
3
+ * Design tokens for Lux Exchange
4
+ * Based on Tailwind/shadcn design system
5
+ */
6
+ export const tokens = createTokens({
7
+ color: {
8
+ // Brand colors
9
+ luxPrimary: '#FF6B00',
10
+ luxSecondary: '#FF8C00',
11
+ // Base colors
12
+ white: '#FFFFFF',
13
+ black: '#000000',
14
+ // Gray scale
15
+ gray50: '#FAFAFA',
16
+ gray100: '#F4F4F5',
17
+ gray200: '#E4E4E7',
18
+ gray300: '#D4D4D8',
19
+ gray400: '#A1A1AA',
20
+ gray500: '#71717A',
21
+ gray600: '#52525B',
22
+ gray700: '#3F3F46',
23
+ gray800: '#27272A',
24
+ gray900: '#18181B',
25
+ gray950: '#09090B',
26
+ // Semantic colors
27
+ success: '#22C55E',
28
+ successDark: '#16A34A',
29
+ warning: '#F59E0B',
30
+ warningDark: '#D97706',
31
+ error: '#EF4444',
32
+ errorDark: '#DC2626',
33
+ info: '#3B82F6',
34
+ infoDark: '#2563EB',
35
+ // Transparent
36
+ transparent: 'transparent',
37
+ },
38
+ space: {
39
+ 0: 0,
40
+ 1: 4,
41
+ 2: 8,
42
+ 3: 12,
43
+ 4: 16,
44
+ 5: 20,
45
+ 6: 24,
46
+ 7: 28,
47
+ 8: 32,
48
+ 9: 36,
49
+ 10: 40,
50
+ 11: 44,
51
+ 12: 48,
52
+ 14: 56,
53
+ 16: 64,
54
+ 20: 80,
55
+ 24: 96,
56
+ 28: 112,
57
+ 32: 128,
58
+ true: 16,
59
+ },
60
+ size: {
61
+ 0: 0,
62
+ 1: 4,
63
+ 2: 8,
64
+ 3: 12,
65
+ 4: 16,
66
+ 5: 20,
67
+ 6: 24,
68
+ 7: 28,
69
+ 8: 32,
70
+ 9: 36,
71
+ 10: 40,
72
+ 11: 44,
73
+ 12: 48,
74
+ 14: 56,
75
+ 16: 64,
76
+ 20: 80,
77
+ true: 16,
78
+ },
79
+ radius: {
80
+ 0: 0,
81
+ 1: 4,
82
+ 2: 8,
83
+ 3: 12,
84
+ 4: 16,
85
+ 5: 20,
86
+ 6: 24,
87
+ round: 9999,
88
+ true: 8,
89
+ },
90
+ zIndex: {
91
+ 0: 0,
92
+ 1: 100,
93
+ 2: 200,
94
+ 3: 300,
95
+ 4: 400,
96
+ 5: 500,
97
+ modal: 1000,
98
+ popover: 1100,
99
+ tooltip: 1200,
100
+ },
101
+ })
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@luxfi/ui",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "dependencies": {
5
5
  "@gorhom/bottom-sheet": "4.6.4",
6
6
  "@react-native-masked-view/masked-view": "0.3.2",
7
7
  "@shopify/flash-list": "1.7.6",
8
8
  "@shopify/react-native-skia": "2.2.20",
9
9
  "@storybook/react": "8.5.2",
10
- "@hanzogui/adapt": "2.0.1",
11
- "@hanzogui/animations-css": "2.0.1",
12
- "@hanzogui/animations-react-native": "2.0.1",
13
- "@hanzogui/font-geist-sans": "2.0.1",
14
- "@hanzogui/helpers-icon": "2.0.1",
15
- "@hanzogui/portal": "2.0.1",
16
- "@hanzogui/react-native-media-driver": "2.0.1",
17
- "@hanzogui/remove-scroll": "2.0.1",
18
- "@hanzogui/theme-base": "2.0.1",
10
+ "@hanzogui/adapt": "2.0.3",
11
+ "@hanzogui/animations-css": "2.0.3",
12
+ "@hanzogui/animations-react-native": "2.0.3",
13
+ "@hanzogui/font-geist-sans": "2.0.3",
14
+ "@hanzogui/helpers-icon": "2.0.3",
15
+ "@hanzogui/portal": "2.0.3",
16
+ "@hanzogui/react-native-media-driver": "2.0.3",
17
+ "@hanzogui/remove-scroll": "2.0.3",
18
+ "@hanzogui/theme-base": "2.0.3",
19
19
  "@tanstack/react-query": "5.90.20",
20
20
  "@testing-library/react": "16.3.0",
21
21
  "ethers": "5.7.2",
@@ -34,21 +34,21 @@
34
34
  "react-native-safe-area-context": "5.4.0",
35
35
  "react-native-svg": "15.13.0",
36
36
  "react-native-webview": "13.13.5",
37
- "@hanzo/gui": "2.0.1",
38
- "@luxfi/utilities": "^1.0.0",
37
+ "@hanzo/gui": "2.0.3",
38
+ "@luxfi/utilities": "workspace:^",
39
39
  "uuid": "9.0.0",
40
40
  "wcag-contrast": "3.0.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@storybook/test": "8.5.2",
44
- "@hanzogui/animations-moti": "2.0.1",
45
- "@hanzogui/core": "2.0.1",
44
+ "@hanzogui/animations-moti": "2.0.3",
45
+ "@hanzogui/core": "2.0.3",
46
46
  "@types/chrome": "0.0.304",
47
47
  "@types/fs-extra": "11.0.2",
48
48
  "@types/node": "22.13.1",
49
49
  "@types/qrcode": "1.5.5",
50
50
  "@typescript/native-preview": "7.0.0-dev.20260108.1",
51
- "@luxfi/eslint-config": "^1.0.0",
51
+ "@luxfi/eslint-config": "workspace:^",
52
52
  "@vitejs/plugin-react": "4.7.0",
53
53
  "camelcase": "6.3.0",
54
54
  "cheerio": "1.0.0-rc.12",
@@ -59,7 +59,7 @@
59
59
  "typescript": "5.8.3",
60
60
  "uppercamelcase": "3.0.0",
61
61
  "vitest": "3.2.1",
62
- "vitest-presets": "*"
62
+ "vitest-presets": "workspace:^"
63
63
  },
64
64
  "files": ["types", "dist"],
65
65
  "main": "./src/index.ts",
package/README.md DELETED
@@ -1,109 +0,0 @@
1
- # `ui` Package
2
-
3
- This package holds a component library and themes that can be used across all apps.
4
-
5
- ## UI Package Philosophy
6
-
7
- The `ui` package contains all low level components that are shared between apps. It should *not* contain components that are specific to any one app or Uniswap business logic. Each component should be guided by the following principles:
8
-
9
- - All components should be compatible with all platforms.
10
- - Wrap as many implementation details as possible, including any direct exports from Tamagui.
11
- - Export only what’s needed from `ui/src` or another allowlisted path.
12
- - Only include components that will be used beyond a single feature.
13
-
14
- Components that are shared between all applications but encode Uniswap business logic should most likely be placed in the `uniswap` package!
15
-
16
- ## Icons and Logos
17
-
18
- Icons and logos are placed in `ui/src/components/{icons|logos}`. These files are generated from placing the file in `packages/ui/src/assets/icons` or `packages/ui/src/assets/logos/svg` and running the generate command(s):
19
-
20
- ```bash
21
- # Generate all icons
22
- bun ui build:icons
23
- # Generate any icons that do not yet have an existing TS file
24
- bun ui build:icons:missing
25
- ```
26
-
27
- When adding an SVG, please ensure you replace color references as needed with `currentColor` to ensure the asset respects the color property when used.
28
-
29
- Custom icons that take props can be added to the same icons import by adding the file in `packages/ui/src/components/icons/index.ts`.
30
-
31
- ## Core Components
32
-
33
- Many base components are available in the UI library. While some are customized `tamagui` elements or even fully custom elements, many are simple or direct exposure of `tamagui` elements. If you would like to use any `tamagui` elements, please add them through this library to ensure a layer of abstraction between tamagui and our usage when possible.
34
-
35
- Below are summaries of the most commonly used elements.
36
-
37
- ### Flex
38
-
39
- The `Flex` component is the core organizational element of the UI library, acting as a base of a flexbox styling approach. Shortcuts are available for `row`, `grow`, `shrink`, `fill`, and `centered`. All other styling props can be added directly as needed.
40
-
41
- ### Text
42
-
43
- The `Text` element is the core element for displaying text through the app. The `variant` prop takes in the text variant from our design system (e.g `heading1`, `body2`, etc.) that is desired. All other text styling props can be added directly as needed.
44
-
45
- ## Theme and Platform
46
-
47
- ### Theming
48
-
49
- Theming is applied through two primary methods:
50
-
51
- 1. Any components that take in design systems values (e.g `heading1`, `body2`, etc.) will automatically respect the theme.
52
- 2. In all other cases, `useSporeColors` will return the current theme colors to be used in any component.
53
-
54
- To force a specific theme usage, the `Theme` wrapper will ensure other theme elements pick up the specific theme.
55
-
56
- ```javascript
57
- <Theme name="dark">
58
- ...
59
- </Theme>
60
- ```
61
-
62
- ### Screen Size Differences
63
-
64
- All breakpoints for both vertical and horizontal sizing have been defined in `packages/ui/src/theme/breakpoints.ts`.
65
-
66
- To account for screen size references, components take in props to adapt custom style per breakpoint, like so:
67
-
68
- ```javascript
69
- <Flex
70
- margin="20"
71
- $short={{ margin: 10 }}
72
- >
73
- ...
74
- </Flex>
75
- ```
76
-
77
- When components cannot take in these props or a value needs to be resued multiple times, the `useMedia` hook allows these same breakpoint values to be defined programmatically.
78
-
79
- ### Colors
80
-
81
- We've made a hook `useSporeColors()` which gives you access to the current theme, and you can access the values off it as follows:
82
-
83
- ```tsx
84
- import { useSporeColors } from 'ui/src'
85
-
86
- function MyComponent() {
87
- const colors = useSporeColors()
88
-
89
- colors.accent1.val // returns something like #fff
90
- colors.accent1.get() // returns a "dynamic" color value
91
- }
92
- ```
93
-
94
- #### When to use `.get()` vs `.val`
95
-
96
- After some discussion we've come to prefer `.val` by default. This will always return the raw string color (in our case hex color) on all platforms, whereas `.get()` returns either an Object (iOS) or a string, which can cause issues when used with things like animations, or external components.
97
-
98
- Using .val has some performance downside vs .get in that all usages of .val will re-render when themes change, whereas .get will avoid re-renders on iOS and Web by optimizing to platform-specific constructs. On iOS, it optimizes to [DynamicColorIOS](https://reactnative.dev/docs/dynamiccolorios), on web a CSS variable like `var(--accent1)`.
99
-
100
- So if/when we notice slowness in our light/dark mode change, we'll want to check if our usages of .val are causing expensive re-renders and see if we can convert them to .get.
101
-
102
- In summary:
103
-
104
- - Prefer `.val` which always returns the original color string, like `#fff`.
105
- - Using `.get()` returns a dynamic value depending on the platform and avoids re-rendering when themes change between light and dark. This is nice for fast light/dark mode switching (and in the future if we use sub-themes, it would also avoid re-renders there).
106
- - On Android it returns the same as .val, `#fff`
107
- - On iOS, it returns an object like `{ dynamic: { light: '#fff', dark: '#000' } }`
108
- - On the web, it returns a CSS variable string, `var(--colorName)`
109
- - You can call `.get('web')` to only optimize for web, or `.get('ios')` to only optimize for ios.