expo-dev-client-components 1.0.0 → 1.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.
- package/CHANGELOG.md +6 -0
- package/README.md +129 -0
- package/assets/branch-icon-light.png +0 -0
- package/assets/branch-icon-light@2x.png +0 -0
- package/assets/branch-icon-light@3x.png +0 -0
- package/assets/branch-icon.png +0 -0
- package/assets/branch-icon@2x.png +0 -0
- package/assets/branch-icon@3x.png +0 -0
- package/assets/check-icon-light.png +0 -0
- package/assets/check-icon-light@2x.png +0 -0
- package/assets/check-icon-light@3x.png +0 -0
- package/assets/check-icon.png +0 -0
- package/assets/check-icon@2x.png +0 -0
- package/assets/check-icon@3x.png +0 -0
- package/assets/clipboard-icon.png +0 -0
- package/assets/clipboard-icon@2x.png +0 -0
- package/assets/clipboard-icon@3x.png +0 -0
- package/assets/debug-icon.png +0 -0
- package/assets/debug-icon@2x.png +0 -0
- package/assets/debug-icon@3x.png +0 -0
- package/assets/extensions-filled-active-icon-light.png +0 -0
- package/assets/extensions-filled-active-icon-light@2x.png +0 -0
- package/assets/extensions-filled-active-icon-light@3x.png +0 -0
- package/assets/extensions-filled-active-icon.png +0 -0
- package/assets/extensions-filled-active-icon@2x.png +0 -0
- package/assets/extensions-filled-active-icon@3x.png +0 -0
- package/assets/extensions-filled-inactive-icon-light.png +0 -0
- package/assets/extensions-filled-inactive-icon-light@2x.png +0 -0
- package/assets/extensions-filled-inactive-icon-light@3x.png +0 -0
- package/assets/extensions-filled-inactive-icon.png +0 -0
- package/assets/extensions-filled-inactive-icon@2x.png +0 -0
- package/assets/extensions-filled-inactive-icon@3x.png +0 -0
- package/assets/extensions-icon-light.png +0 -0
- package/assets/extensions-icon-light@2x.png +0 -0
- package/assets/extensions-icon-light@3x.png +0 -0
- package/assets/extensions-icon.png +0 -0
- package/assets/extensions-icon@2x.png +0 -0
- package/assets/extensions-icon@3x.png +0 -0
- package/assets/home-filled-active-icon-light.png +0 -0
- package/assets/home-filled-active-icon-light@2x.png +0 -0
- package/assets/home-filled-active-icon-light@3x.png +0 -0
- package/assets/home-filled-inactive-icon-light.png +0 -0
- package/assets/home-filled-inactive-icon-light@2x.png +0 -0
- package/assets/home-filled-inactive-icon-light@3x.png +0 -0
- package/assets/info-icon-light.png +0 -0
- package/assets/info-icon-light@2x.png +0 -0
- package/assets/info-icon-light@3x.png +0 -0
- package/assets/info-icon.png +0 -0
- package/assets/info-icon@2x.png +0 -0
- package/assets/info-icon@3x.png +0 -0
- package/assets/inspect-element-icon.png +0 -0
- package/assets/inspect-element-icon@2x.png +0 -0
- package/assets/inspect-element-icon@3x.png +0 -0
- package/assets/loading-indicator-icon.png +0 -0
- package/assets/loading-indicator-icon@2x.png +0 -0
- package/assets/loading-indicator-icon@3x.png +0 -0
- package/assets/performance-icon.png +0 -0
- package/assets/performance-icon@2x.png +0 -0
- package/assets/performance-icon@3x.png +0 -0
- package/assets/run-icon.png +0 -0
- package/assets/run-icon@2x.png +0 -0
- package/assets/run-icon@3x.png +0 -0
- package/assets/settings-filled-active-icon-light.png +0 -0
- package/assets/settings-filled-active-icon-light@2x.png +0 -0
- package/assets/settings-filled-active-icon-light@3x.png +0 -0
- package/assets/settings-filled-inactive-icon-light.png +0 -0
- package/assets/settings-filled-inactive-icon-light@2x.png +0 -0
- package/assets/settings-filled-inactive-icon-light@3x.png +0 -0
- package/assets/shake-device-icon-light.png +0 -0
- package/assets/shake-device-icon-light@2x.png +0 -0
- package/assets/shake-device-icon-light@3x.png +0 -0
- package/assets/show-menu-at-launch-icon-light.png +0 -0
- package/assets/show-menu-at-launch-icon-light@2x.png +0 -0
- package/assets/show-menu-at-launch-icon-light@3x.png +0 -0
- package/assets/three-finger-long-press-icon-light.png +0 -0
- package/assets/three-finger-long-press-icon-light@2x.png +0 -0
- package/assets/three-finger-long-press-icon-light@3x.png +0 -0
- package/assets/update-icon-light.png +0 -0
- package/assets/update-icon-light@2x.png +0 -0
- package/assets/update-icon-light@3x.png +0 -0
- package/assets/update-icon.png +0 -0
- package/assets/update-icon@2x.png +0 -0
- package/assets/update-icon@3x.png +0 -0
- package/assets/user-icon-light.png +0 -0
- package/assets/user-icon-light@2x.png +0 -0
- package/assets/user-icon-light@3x.png +0 -0
- package/assets/warning-triangle-icon-light.png +0 -0
- package/assets/warning-triangle-icon-light@2x.png +0 -0
- package/assets/warning-triangle-icon-light@3x.png +0 -0
- package/assets/warning-triangle-icon.png +0 -0
- package/assets/warning-triangle-icon@2x.png +0 -0
- package/assets/warning-triangle-icon@3x.png +0 -0
- package/assets/x-icon-light.png +0 -0
- package/assets/x-icon-light@2x.png +0 -0
- package/assets/x-icon-light@3x.png +0 -0
- package/assets/x-icon.png +0 -0
- package/assets/x-icon@2x.png +0 -0
- package/assets/x-icon@3x.png +0 -0
- package/build/Button.d.ts +46 -22
- package/build/Button.d.ts.map +1 -0
- package/build/Button.js +4 -3
- package/build/Button.js.map +1 -1
- package/build/Image.d.ts +7 -1
- package/build/Image.d.ts.map +1 -0
- package/build/Image.js +1 -1
- package/build/Image.js.map +1 -1
- package/build/Text.d.ts +36 -10
- package/build/Text.d.ts.map +1 -0
- package/build/Text.js +30 -21
- package/build/Text.js.map +1 -1
- package/build/View.d.ts +80 -28
- package/build/View.d.ts.map +1 -0
- package/build/View.js +93 -43
- package/build/View.js.map +1 -1
- package/build/create-primitive.d.ts +41 -0
- package/build/create-primitive.d.ts.map +1 -0
- package/build/create-primitive.js +73 -0
- package/build/create-primitive.js.map +1 -0
- package/build/icons/BranchIcon.d.ts +4 -0
- package/build/icons/BranchIcon.d.ts.map +1 -0
- package/build/icons/BranchIcon.js +11 -0
- package/build/icons/BranchIcon.js.map +1 -0
- package/build/icons/CheckIcon.d.ts +1 -0
- package/build/icons/CheckIcon.d.ts.map +1 -0
- package/build/icons/CheckIcon.js +5 -1
- package/build/icons/CheckIcon.js.map +1 -1
- package/build/icons/ChevronRightIcon.d.ts +1 -0
- package/build/icons/ChevronRightIcon.d.ts.map +1 -0
- package/build/icons/ClipboardIcon.d.ts +4 -0
- package/build/icons/ClipboardIcon.d.ts.map +1 -0
- package/build/icons/ClipboardIcon.js +7 -0
- package/build/icons/ClipboardIcon.js.map +1 -0
- package/build/icons/DebugIcon.d.ts +4 -0
- package/build/icons/DebugIcon.d.ts.map +1 -0
- package/build/icons/DebugIcon.js +7 -0
- package/build/icons/DebugIcon.js.map +1 -0
- package/build/icons/ExpoLogoIcon.d.ts +1 -0
- package/build/icons/ExpoLogoIcon.d.ts.map +1 -0
- package/build/icons/ExtensionsFilledIcon.d.ts +8 -0
- package/build/icons/ExtensionsFilledIcon.d.ts.map +1 -0
- package/build/icons/ExtensionsFilledIcon.js +24 -0
- package/build/icons/ExtensionsFilledIcon.js.map +1 -0
- package/build/icons/ExtensionsIcon.d.ts +4 -0
- package/build/icons/ExtensionsIcon.d.ts.map +1 -0
- package/build/icons/ExtensionsIcon.js +11 -0
- package/build/icons/ExtensionsIcon.js.map +1 -0
- package/build/icons/HomeFilledIcon.d.ts +1 -0
- package/build/icons/HomeFilledIcon.d.ts.map +1 -0
- package/build/icons/HomeFilledIcon.js +16 -1
- package/build/icons/HomeFilledIcon.js.map +1 -1
- package/build/icons/InfoIcon.d.ts +1 -0
- package/build/icons/InfoIcon.d.ts.map +1 -0
- package/build/icons/InfoIcon.js +5 -1
- package/build/icons/InfoIcon.js.map +1 -1
- package/build/icons/InspectElementIcon.d.ts +4 -0
- package/build/icons/InspectElementIcon.d.ts.map +1 -0
- package/build/icons/InspectElementIcon.js +7 -0
- package/build/icons/InspectElementIcon.js.map +1 -0
- package/build/icons/LoadingIndicatorIcon.d.ts +4 -0
- package/build/icons/LoadingIndicatorIcon.d.ts.map +1 -0
- package/build/icons/LoadingIndicatorIcon.js +7 -0
- package/build/icons/LoadingIndicatorIcon.js.map +1 -0
- package/build/icons/PerformanceIcon.d.ts +4 -0
- package/build/icons/PerformanceIcon.d.ts.map +1 -0
- package/build/icons/PerformanceIcon.js +7 -0
- package/build/icons/PerformanceIcon.js.map +1 -0
- package/build/icons/QuestionMarkIcon.d.ts +1 -0
- package/build/icons/QuestionMarkIcon.d.ts.map +1 -0
- package/build/icons/RefreshIcon.d.ts +1 -0
- package/build/icons/RefreshIcon.d.ts.map +1 -0
- package/build/icons/RunIcon.d.ts +4 -0
- package/build/icons/RunIcon.d.ts.map +1 -0
- package/build/icons/RunIcon.js +7 -0
- package/build/icons/RunIcon.js.map +1 -0
- package/build/icons/SettingsFilledIcon.d.ts +1 -0
- package/build/icons/SettingsFilledIcon.d.ts.map +1 -0
- package/build/icons/SettingsFilledIcon.js +16 -1
- package/build/icons/SettingsFilledIcon.js.map +1 -1
- package/build/icons/ShakeDeviceIcon.d.ts +1 -0
- package/build/icons/ShakeDeviceIcon.d.ts.map +1 -0
- package/build/icons/ShakeDeviceIcon.js +5 -1
- package/build/icons/ShakeDeviceIcon.js.map +1 -1
- package/build/icons/ShowMenuIcon.d.ts +1 -0
- package/build/icons/ShowMenuIcon.d.ts.map +1 -0
- package/build/icons/ShowMenuIcon.js +5 -1
- package/build/icons/ShowMenuIcon.js.map +1 -1
- package/build/icons/TerminalIcon.d.ts +1 -0
- package/build/icons/TerminalIcon.d.ts.map +1 -0
- package/build/icons/ThreeFingerPressIcon.d.ts +1 -0
- package/build/icons/ThreeFingerPressIcon.d.ts.map +1 -0
- package/build/icons/ThreeFingerPressIcon.js +5 -1
- package/build/icons/ThreeFingerPressIcon.js.map +1 -1
- package/build/icons/ToolbarOverlayIcon.d.ts +1 -0
- package/build/icons/ToolbarOverlayIcon.d.ts.map +1 -0
- package/build/icons/UpdateIcon.d.ts +4 -0
- package/build/icons/UpdateIcon.d.ts.map +1 -0
- package/build/icons/UpdateIcon.js +11 -0
- package/build/icons/UpdateIcon.js.map +1 -0
- package/build/icons/UserIcon.d.ts +1 -0
- package/build/icons/UserIcon.d.ts.map +1 -0
- package/build/icons/UserIcon.js +5 -1
- package/build/icons/UserIcon.js.map +1 -1
- package/build/icons/WarningIcon.d.ts +4 -0
- package/build/icons/WarningIcon.d.ts.map +1 -0
- package/build/icons/WarningIcon.js +11 -0
- package/build/icons/WarningIcon.js.map +1 -0
- package/build/icons/XIcon.d.ts +1 -0
- package/build/icons/XIcon.d.ts.map +1 -0
- package/build/icons/XIcon.js +5 -1
- package/build/icons/XIcon.js.map +1 -1
- package/build/icons/index.d.ts +13 -1
- package/build/icons/index.d.ts.map +1 -0
- package/build/icons/index.js +12 -1
- package/build/icons/index.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -0
- package/build/theme.d.ts +128 -131
- package/build/theme.d.ts.map +1 -0
- package/build/theme.js +77 -73
- package/build/theme.js.map +1 -1
- package/build/useExpoTheme.d.ts +236 -0
- package/build/useExpoTheme.d.ts.map +1 -0
- package/build/useExpoTheme.js +24 -3
- package/build/useExpoTheme.js.map +1 -1
- package/package.json +15 -9
- package/setupTests.js +35 -0
- package/src/Button.tsx +4 -3
- package/src/Image.tsx +1 -1
- package/src/Text.tsx +35 -21
- package/src/View.tsx +115 -44
- package/src/create-primitive.tsx +128 -0
- package/src/icons/BranchIcon.tsx +14 -0
- package/src/icons/CheckIcon.tsx +6 -1
- package/src/icons/ClipboardIcon.tsx +9 -0
- package/src/icons/DebugIcon.tsx +9 -0
- package/src/icons/ExtensionsFilledIcon.tsx +31 -0
- package/src/icons/ExtensionsIcon.tsx +14 -0
- package/src/icons/HomeFilledIcon.tsx +17 -1
- package/src/icons/InfoIcon.tsx +6 -1
- package/src/icons/InspectElementIcon.tsx +9 -0
- package/src/icons/LoadingIndicatorIcon.tsx +9 -0
- package/src/icons/PerformanceIcon.tsx +9 -0
- package/src/icons/RunIcon.tsx +9 -0
- package/src/icons/SettingsFilledIcon.tsx +17 -1
- package/src/icons/ShakeDeviceIcon.tsx +6 -1
- package/src/icons/ShowMenuIcon.tsx +6 -1
- package/src/icons/ThreeFingerPressIcon.tsx +6 -1
- package/src/icons/UpdateIcon.tsx +14 -0
- package/src/icons/UserIcon.tsx +6 -1
- package/src/icons/WarningIcon.tsx +14 -0
- package/src/icons/XIcon.tsx +6 -1
- package/src/icons/index.ts +12 -1
- package/src/theme.ts +90 -78
- package/src/useExpoTheme.tsx +50 -0
- package/src/useExpoTheme.ts +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 1.1.0 — 2022-04-18
|
|
14
|
+
|
|
15
|
+
### 🎉 New features
|
|
16
|
+
|
|
17
|
+
- Extend components to include the spacing scale from `@expo/styleguide-native` ([#16309](https://github.com/expo/expo/pull/16309) by [@ajsmth](https://github.com/ajsmth))
|
|
18
|
+
|
|
13
19
|
## 1.0.0 — 2021-12-22
|
|
14
20
|
|
|
15
21
|
_This version does not introduce any user-facing changes._
|
package/README.md
CHANGED
|
@@ -24,6 +24,135 @@ function ExampleRow() {
|
|
|
24
24
|
}
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
### Documentation
|
|
28
|
+
|
|
29
|
+
`create-primitive` is a utility that generates a set of themed react-native components.
|
|
30
|
+
|
|
31
|
+
Features:
|
|
32
|
+
|
|
33
|
+
- theme-ability
|
|
34
|
+
- typesafety
|
|
35
|
+
- clear and flexible API
|
|
36
|
+
|
|
37
|
+
## API
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { Text } from 'react-native';
|
|
41
|
+
import { create } from './create-primitives';
|
|
42
|
+
|
|
43
|
+
const Heading = create(Text, {
|
|
44
|
+
base: {
|
|
45
|
+
fontFamily: 'Helvetica',
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
variants: {
|
|
49
|
+
size: {
|
|
50
|
+
large: {
|
|
51
|
+
fontSize: 28,
|
|
52
|
+
lineHeight: 34,
|
|
53
|
+
},
|
|
54
|
+
medium: {
|
|
55
|
+
fontSize: 22,
|
|
56
|
+
lineHeight: 28,
|
|
57
|
+
},
|
|
58
|
+
small: {
|
|
59
|
+
fontSize: 18,
|
|
60
|
+
lineHeight: 22,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
color: {
|
|
64
|
+
success: {
|
|
65
|
+
color: 'green',
|
|
66
|
+
},
|
|
67
|
+
danger: {
|
|
68
|
+
color: 'red',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
This above produces a `Heading` component that can be used like so:
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
function App() {
|
|
79
|
+
return (
|
|
80
|
+
<Heading size="medium" color="success">
|
|
81
|
+
Hi
|
|
82
|
+
</Heading>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
All of the variants are captured by typescript which makes using them a breeze.
|
|
88
|
+
|
|
89
|
+
## Declarative Selectors
|
|
90
|
+
|
|
91
|
+
We can extend the `Heading` component above with selectors:
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
const Heading = create(RNText, {
|
|
95
|
+
variants: {
|
|
96
|
+
// ....
|
|
97
|
+
},
|
|
98
|
+
selectors: {
|
|
99
|
+
// when device theme is 'light'...
|
|
100
|
+
light: {
|
|
101
|
+
color: {
|
|
102
|
+
// ...any `Heading` with `color="success"`...
|
|
103
|
+
success: {
|
|
104
|
+
// ...will have these styles applied
|
|
105
|
+
color: 'green',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
You can also pass selectors to primitives for one-off instances where you need a specific style:
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
function App() {
|
|
117
|
+
return (
|
|
118
|
+
<View>
|
|
119
|
+
<Heading
|
|
120
|
+
selectors={{
|
|
121
|
+
dark: { color: 'green' },
|
|
122
|
+
light: { color: 'blue' },
|
|
123
|
+
}}>
|
|
124
|
+
Hi
|
|
125
|
+
</Heading>
|
|
126
|
+
</View>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Flexibility
|
|
132
|
+
|
|
133
|
+
You can use any style library you'd like - for example using tailwind for a terser, readable configuration.
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
import tw from 'somewhere';
|
|
137
|
+
import { create } from './create-primitives';
|
|
138
|
+
|
|
139
|
+
const Heading = create(RNText, {
|
|
140
|
+
size: {
|
|
141
|
+
large: tw('text-4xl'),
|
|
142
|
+
medium: tw('text-3xl'),
|
|
143
|
+
small: tw('text-2xl'),
|
|
144
|
+
},
|
|
145
|
+
weight: {
|
|
146
|
+
normal: tw('font-medium'),
|
|
147
|
+
heavy: tw('font-semibold'),
|
|
148
|
+
},
|
|
149
|
+
color: {
|
|
150
|
+
success: tw('text-green-500'),
|
|
151
|
+
danger: tw('text-red-500'),
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
27
156
|
## Installation in managed Expo projects
|
|
28
157
|
|
|
29
158
|
There are no native dependencies exported and so this module should be compatible with any RN project
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/assets/check-icon.png
CHANGED
|
Binary file
|
package/assets/check-icon@2x.png
CHANGED
|
Binary file
|
package/assets/check-icon@3x.png
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/assets/info-icon.png
CHANGED
|
Binary file
|
package/assets/info-icon@2x.png
CHANGED
|
Binary file
|
package/assets/info-icon@3x.png
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/assets/x-icon.png
CHANGED
|
Binary file
|
package/assets/x-icon@2x.png
CHANGED
|
Binary file
|
package/assets/x-icon@3x.png
CHANGED
|
Binary file
|
package/build/Button.d.ts
CHANGED
|
@@ -3,36 +3,54 @@ import { Animated } from 'react-native';
|
|
|
3
3
|
declare const Container: React.ForwardRefExoticComponent<Pick<Animated.AnimatedProps<import("react-native").PressableProps & React.RefAttributes<import("react-native").View>> & {
|
|
4
4
|
children?: React.ReactNode;
|
|
5
5
|
} & {
|
|
6
|
-
margin?: "
|
|
7
|
-
mx?: "
|
|
8
|
-
my?: "
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
margin?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
7
|
+
mx?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
8
|
+
my?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
9
|
+
mb?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
10
|
+
mt?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
11
|
+
padding?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
12
|
+
px?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
13
|
+
py?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
14
|
+
pb?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
15
|
+
pt?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
16
|
+
rounded?: "small" | "medium" | "large" | "none" | "full" | undefined;
|
|
17
|
+
roundedTop?: "small" | "medium" | "large" | "none" | "full" | undefined;
|
|
18
|
+
roundedBottom?: "small" | "medium" | "large" | "none" | "full" | undefined;
|
|
15
19
|
bg?: "transparent" | "primary" | "secondary" | "tertiary" | "ghost" | "default" | "disabled" | undefined;
|
|
16
20
|
border?: "ghost" | undefined;
|
|
17
21
|
shadow?: "button" | undefined;
|
|
18
|
-
}
|
|
22
|
+
} & {
|
|
23
|
+
selectors?: {
|
|
24
|
+
light?: (import("react-native").ViewStyle | import("react-native").TextStyle | import("react-native").ImageStyle) | undefined;
|
|
25
|
+
dark?: (import("react-native").ViewStyle | import("react-native").TextStyle | import("react-native").ImageStyle) | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
}, "selectors" | "padding" | "margin" | keyof import("react-native").PressableProps | "key" | "bg" | "border" | "shadow" | "mx" | "my" | "mb" | "mt" | "px" | "py" | "pb" | "pt" | "rounded" | "roundedTop" | "roundedBottom"> & React.RefAttributes<Animated.AnimatedProps<import("react-native").PressableProps & React.RefAttributes<import("react-native").View>>>>;
|
|
19
28
|
export declare const Button: {
|
|
20
29
|
Container: React.ForwardRefExoticComponent<Pick<Animated.AnimatedProps<import("react-native").PressableProps & React.RefAttributes<import("react-native").View>> & {
|
|
21
30
|
children?: React.ReactNode;
|
|
22
31
|
} & {
|
|
23
|
-
margin?: "
|
|
24
|
-
mx?: "
|
|
25
|
-
my?: "
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
margin?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
33
|
+
mx?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
34
|
+
my?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
35
|
+
mb?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
36
|
+
mt?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
37
|
+
padding?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
38
|
+
px?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
39
|
+
py?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
40
|
+
pb?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
41
|
+
pt?: "0" | "1" | "2" | "3" | "4" | "0.5" | "1.5" | "2.5" | "3.5" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | ("small" | "micro" | "tiny" | "medium" | "large" | "xl") | undefined;
|
|
42
|
+
rounded?: "small" | "medium" | "large" | "none" | "full" | undefined;
|
|
43
|
+
roundedTop?: "small" | "medium" | "large" | "none" | "full" | undefined;
|
|
44
|
+
roundedBottom?: "small" | "medium" | "large" | "none" | "full" | undefined;
|
|
32
45
|
bg?: "transparent" | "primary" | "secondary" | "tertiary" | "ghost" | "default" | "disabled" | undefined;
|
|
33
46
|
border?: "ghost" | undefined;
|
|
34
47
|
shadow?: "button" | undefined;
|
|
35
|
-
}
|
|
48
|
+
} & {
|
|
49
|
+
selectors?: {
|
|
50
|
+
light?: (import("react-native").ViewStyle | import("react-native").TextStyle | import("react-native").ImageStyle) | undefined;
|
|
51
|
+
dark?: (import("react-native").ViewStyle | import("react-native").TextStyle | import("react-native").ImageStyle) | undefined;
|
|
52
|
+
} | undefined;
|
|
53
|
+
}, "selectors" | "padding" | "margin" | keyof import("react-native").PressableProps | "key" | "bg" | "border" | "shadow" | "mx" | "my" | "mb" | "mt" | "px" | "py" | "pb" | "pt" | "rounded" | "roundedTop" | "roundedBottom"> & React.RefAttributes<Animated.AnimatedProps<import("react-native").PressableProps & React.RefAttributes<import("react-native").View>>>>;
|
|
36
54
|
ScaleOnPressContainer: typeof ScaleOnPressContainer;
|
|
37
55
|
Text: React.ForwardRefExoticComponent<import("react-native").TextProps & {
|
|
38
56
|
children?: React.ReactNode;
|
|
@@ -41,8 +59,13 @@ export declare const Button: {
|
|
|
41
59
|
align?: "center" | undefined;
|
|
42
60
|
size?: "small" | "medium" | "large" | undefined;
|
|
43
61
|
leading?: "large" | undefined;
|
|
44
|
-
type?: "mono" | undefined;
|
|
45
|
-
weight?: "
|
|
62
|
+
type?: "mono" | "InterBlack" | "InterBlackItalic" | "InterBold" | "InterBoldItalic" | "InterExtraBold" | "InterExtraBoldItalic" | "InterExtraLight" | "InterExtraLightItalic" | "InterRegular" | "InterItalic" | "InterLight" | "InterLightItalic" | "InterMedium" | "InterMediumItalic" | "InterSemiBold" | "InterSemiBoldItalic" | "InterThin" | "InterThinItalic" | undefined;
|
|
63
|
+
weight?: "light" | "bold" | "medium" | "thin" | "extralight" | "normal" | "semibold" | "extrabold" | "black" | undefined;
|
|
64
|
+
} & {
|
|
65
|
+
selectors?: {
|
|
66
|
+
light?: (import("react-native").ViewStyle | import("react-native").TextStyle | import("react-native").ImageStyle) | undefined;
|
|
67
|
+
dark?: (import("react-native").ViewStyle | import("react-native").TextStyle | import("react-native").ImageStyle) | undefined;
|
|
68
|
+
} | undefined;
|
|
46
69
|
} & React.RefAttributes<import("react-native").TextProps>>;
|
|
47
70
|
};
|
|
48
71
|
declare type ScalingPressableProps = {
|
|
@@ -50,3 +73,4 @@ declare type ScalingPressableProps = {
|
|
|
50
73
|
};
|
|
51
74
|
declare function ScaleOnPressContainer({ minScale, ...props }: React.ComponentProps<typeof Container> & ScalingPressableProps): JSX.Element;
|
|
52
75
|
export {};
|
|
76
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAkB,QAAQ,EAA4C,MAAM,cAAc,CAAC;AAkDlG,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;uWAgDb,CAAC;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIlB,CAAC;AAEF,aAAK,qBAAqB,GAAG;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAkCF,iBAAS,qBAAqB,CAAC,EAC7B,QAAgB,EAChB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG,qBAAqB,eAoDhE"}
|
package/build/Button.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { lightTheme, darkTheme, borderRadius, shadows, palette } from '@expo/styleguide-native';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import { create } from '
|
|
3
|
+
import { Text as RNText, Animated, useColorScheme, Pressable as RNPressable } from 'react-native';
|
|
4
|
+
import { create } from './create-primitive';
|
|
5
5
|
import { rounded, margin, padding, text } from './theme';
|
|
6
6
|
const AnimatedPressable = Animated.createAnimatedComponent(RNPressable);
|
|
7
7
|
const Text = create(RNText, {
|
|
8
8
|
base: {
|
|
9
|
-
|
|
9
|
+
fontFamily: 'Inter-Regular',
|
|
10
10
|
color: lightTheme.text.default,
|
|
11
11
|
fontSize: 16,
|
|
12
|
+
lineHeight: 22,
|
|
12
13
|
},
|
|
13
14
|
props: {
|
|
14
15
|
accessibilityRole: 'text',
|
package/build/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAChG,OAAO,KAA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AAQ,CAAC,IAAI,IAAC,KAAK,EAAE,aAAa,IAAG,KAAK,CAAC,QAAQ,CAAiB,CAC3D,CACb,CAAC;AACJ,CAAC","sourcesContent":["import { lightTheme, darkTheme, borderRadius, shadows, palette } from '@expo/styleguide-native';\nimport * as React from 'react';\nimport { Pressable as RNPressable, Text as RNText, Animated, useColorScheme } from 'react-native';\nimport { create } from 'react-native-primitives';\n\nimport { rounded, margin, padding, text } from './theme';\n\nconst AnimatedPressable = Animated.createAnimatedComponent(RNPressable);\n\nconst Text = create(RNText, {\n base: {\n fontWeight: '400',\n color: lightTheme.text.default,\n fontSize: 16,\n },\n\n props: {\n accessibilityRole: 'text',\n },\n\n variants: {\n ...text,\n\n color: {\n primary: { color: lightTheme.button.primary.foreground },\n secondary: { color: lightTheme.button.secondary.foreground },\n tertiary: { color: lightTheme.button.tertiary.foreground },\n ghost: { color: lightTheme.button.ghost.foreground },\n transparent: { color: lightTheme.button.transparent.foreground },\n default: { color: lightTheme.text.default },\n },\n },\n\n selectors: {\n dark: {\n base: {\n color: darkTheme.text.default,\n },\n\n color: {\n primary: { color: darkTheme.button.primary.foreground },\n secondary: { color: darkTheme.button.secondary.foreground },\n tertiary: { color: darkTheme.button.tertiary.foreground },\n ghost: { color: darkTheme.button.ghost.foreground },\n transparent: { color: darkTheme.button.transparent.foreground },\n default: { color: darkTheme.text.default },\n },\n },\n },\n});\n\nconst Container = create(AnimatedPressable, {\n base: {\n overflow: 'hidden',\n borderRadius: borderRadius.medium,\n },\n\n props: {\n accessibilityRole: 'button',\n android_disableSound: true,\n },\n\n variants: {\n bg: {\n default: { backgroundColor: lightTheme.background.default },\n primary: { backgroundColor: lightTheme.button.primary.background },\n secondary: { backgroundColor: lightTheme.button.secondary.background },\n tertiary: { backgroundColor: lightTheme.button.tertiary.background },\n ghost: { backgroundColor: lightTheme.button.ghost.background },\n transparent: { backgroundColor: lightTheme.button.transparent.background },\n disabled: { backgroundColor: lightTheme.status.default },\n },\n\n border: {\n ghost: { borderColor: lightTheme.button.ghost.border, borderWidth: 1 },\n },\n\n shadow: {\n button: shadows.button,\n },\n\n ...rounded,\n ...padding,\n ...margin,\n },\n\n selectors: {\n dark: {\n bg: {\n default: { backgroundColor: darkTheme.background.default },\n primary: { backgroundColor: darkTheme.button.primary.background },\n secondary: { backgroundColor: darkTheme.button.secondary.background },\n tertiary: { backgroundColor: darkTheme.button.tertiary.background },\n ghost: { backgroundColor: darkTheme.button.ghost.background },\n transparent: { backgroundColor: darkTheme.button.transparent.background },\n disabled: { backgroundColor: darkTheme.status.default },\n },\n },\n },\n});\n\nexport const Button = {\n Container,\n ScaleOnPressContainer,\n Text,\n};\n\ntype ScalingPressableProps = {\n minScale?: number;\n};\n\ntype NoOptionals<T> = {\n [P in keyof T]-?: T[P];\n};\n\ntype ContainerProps = React.ComponentProps<typeof Container>;\ntype ContainerBackgroundColors = NoOptionals<ContainerProps>['bg'];\n\nconst lightHighlightColorMap: Record<ContainerBackgroundColors, string> = {\n disabled: 'transparent',\n default: lightTheme.background.secondary,\n primary: lightTheme.background.tertiary,\n secondary: lightTheme.background.quaternary,\n tertiary: palette.light.gray[600],\n ghost: lightTheme.background.tertiary,\n transparent: lightTheme.background.secondary,\n};\n\nconst darkHighlightColorMap: Record<ContainerBackgroundColors, string> = {\n disabled: 'transparent',\n default: darkTheme.background.secondary,\n primary: darkTheme.background.tertiary,\n secondary: darkTheme.background.quaternary,\n tertiary: palette.dark.gray[600],\n ghost: darkTheme.background.tertiary,\n transparent: darkTheme.background.secondary,\n};\n\nconst highlightColorMap = {\n dark: darkHighlightColorMap,\n light: lightHighlightColorMap,\n};\n\nfunction ScaleOnPressContainer({\n minScale = 0.975,\n ...props\n}: React.ComponentProps<typeof Container> & ScalingPressableProps) {\n const theme = useColorScheme();\n const animatedValue = React.useRef(new Animated.Value(0));\n const [isPressing, setIsPressing] = React.useState(false);\n\n const onPressIn = React.useCallback(() => {\n setIsPressing(true);\n\n Animated.spring(animatedValue.current, {\n toValue: 1,\n stiffness: 1000,\n damping: 500,\n mass: 3,\n overshootClamping: true,\n useNativeDriver: true,\n }).start();\n }, []);\n\n const onPressOut = React.useCallback(() => {\n setIsPressing(false);\n Animated.spring(animatedValue.current, {\n toValue: 0,\n stiffness: 1000,\n damping: 500,\n mass: 3,\n overshootClamping: true,\n useNativeDriver: true,\n }).start();\n }, []);\n\n const scale = animatedValue.current.interpolate({\n inputRange: [0, 1],\n outputRange: [1, minScale],\n });\n\n const scaleStyle = { transform: [{ scale }] };\n\n let backgroundColor = 'transparent';\n\n if (props.bg && isPressing && theme != null) {\n backgroundColor = highlightColorMap[theme][props.bg];\n }\n\n const underlayStyle = {\n backgroundColor,\n };\n\n return (\n <Container onPressIn={onPressIn} onPressOut={onPressOut} {...props} style={[scaleStyle]}>\n <Animated.View style={underlayStyle}>{props.children}</Animated.View>\n </Container>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAChG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AAElG,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEzD,MAAM,iBAAiB,GAAG,QAAQ,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;AAExE,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE;IAC1B,IAAI,EAAE;QACJ,UAAU,EAAE,eAAe;QAC3B,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,OAAO;QAC9B,QAAQ,EA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AE,IAAI;YACvB,eAAe,EAAE,IAAI;SACtB,CAAC,CAAC,KAAK,EAAE,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC;QAC9C,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAClB,WAAW,EAAE,CAAC,CAAC,EAAE,QAAQ,CAAC;KAC3B,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAE9C,IAAI,eAAe,GAAG,aAAa,CAAC;IAEpC,IAAI,KAAK,CAAC,EAAE,IAAI,UAAU,IAAI,KAAK,IAAI,IAAI,EAAE;QAC3C,eAAe,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;KACtD;IAED,MAAM,aAAa,GAAG;QACpB,eAAe;KAChB,CAAC;IAEF,OAAO,CACL,oBAAC,SAAS,IAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,KAAM,KAAK,EAAE,KAAK,EAAE,CAAC,UAAU,CAAC;QACrF,oBAAC,QAAQ,CAAC,IAAI,IAAC,KAAK,EAAE,aAAa,IAAG,KAAK,CAAC,QAAQ,CAAiB,CAC3D,CACb,CAAC;AACJ,CAAC","sourcesContent":["import { lightTheme, darkTheme, borderRadius, shadows, palette } from '@expo/styleguide-native';\nimport * as React from 'react';\nimport { Text as RNText, Animated, useColorScheme, Pressable as RNPressable } from 'react-native';\n\nimport { create } from './create-primitive';\nimport { rounded, margin, padding, text } from './theme';\n\nconst AnimatedPressable = Animated.createAnimatedComponent(RNPressable);\n\nconst Text = create(RNText, {\n base: {\n fontFamily: 'Inter-Regular',\n color: lightTheme.text.default,\n fontSize: 16,\n lineHeight: 22,\n },\n\n props: {\n accessibilityRole: 'text',\n },\n\n variants: {\n ...text,\n\n color: {\n primary: { color: lightTheme.button.primary.foreground },\n secondary: { color: lightTheme.button.secondary.foreground },\n tertiary: { color: lightTheme.button.tertiary.foreground },\n ghost: { color: lightTheme.button.ghost.foreground },\n transparent: { color: lightTheme.button.transparent.foreground },\n default: { color: lightTheme.text.default },\n },\n },\n\n selectors: {\n dark: {\n base: {\n color: darkTheme.text.default,\n },\n\n color: {\n primary: { color: darkTheme.button.primary.foreground },\n secondary: { color: darkTheme.button.secondary.foreground },\n tertiary: { color: darkTheme.button.tertiary.foreground },\n ghost: { color: darkTheme.button.ghost.foreground },\n transparent: { color: darkTheme.button.transparent.foreground },\n default: { color: darkTheme.text.default },\n },\n },\n },\n});\n\nconst Container = create(AnimatedPressable, {\n base: {\n overflow: 'hidden',\n borderRadius: borderRadius.medium,\n },\n\n props: {\n accessibilityRole: 'button',\n android_disableSound: true,\n },\n\n variants: {\n bg: {\n default: { backgroundColor: lightTheme.background.default },\n primary: { backgroundColor: lightTheme.button.primary.background },\n secondary: { backgroundColor: lightTheme.button.secondary.background },\n tertiary: { backgroundColor: lightTheme.button.tertiary.background },\n ghost: { backgroundColor: lightTheme.button.ghost.background },\n transparent: { backgroundColor: lightTheme.button.transparent.background },\n disabled: { backgroundColor: lightTheme.status.default },\n },\n\n border: {\n ghost: { borderColor: lightTheme.button.ghost.border, borderWidth: 1 },\n },\n\n shadow: {\n button: shadows.button,\n },\n\n ...rounded,\n ...padding,\n ...margin,\n },\n\n selectors: {\n dark: {\n bg: {\n default: { backgroundColor: darkTheme.background.default },\n primary: { backgroundColor: darkTheme.button.primary.background },\n secondary: { backgroundColor: darkTheme.button.secondary.background },\n tertiary: { backgroundColor: darkTheme.button.tertiary.background },\n ghost: { backgroundColor: darkTheme.button.ghost.background },\n transparent: { backgroundColor: darkTheme.button.transparent.background },\n disabled: { backgroundColor: darkTheme.status.default },\n },\n },\n },\n});\n\nexport const Button = {\n Container,\n ScaleOnPressContainer,\n Text,\n};\n\ntype ScalingPressableProps = {\n minScale?: number;\n};\n\ntype NoOptionals<T> = {\n [P in keyof T]-?: T[P];\n};\n\ntype ContainerProps = React.ComponentProps<typeof Container>;\ntype ContainerBackgroundColors = NoOptionals<ContainerProps>['bg'];\n\nconst lightHighlightColorMap: Record<ContainerBackgroundColors, string> = {\n disabled: 'transparent',\n default: lightTheme.background.secondary,\n primary: lightTheme.background.tertiary,\n secondary: lightTheme.background.quaternary,\n tertiary: palette.light.gray[600],\n ghost: lightTheme.background.tertiary,\n transparent: lightTheme.background.secondary,\n};\n\nconst darkHighlightColorMap: Record<ContainerBackgroundColors, string> = {\n disabled: 'transparent',\n default: darkTheme.background.secondary,\n primary: darkTheme.background.tertiary,\n secondary: darkTheme.background.quaternary,\n tertiary: palette.dark.gray[600],\n ghost: darkTheme.background.tertiary,\n transparent: darkTheme.background.secondary,\n};\n\nconst highlightColorMap = {\n dark: darkHighlightColorMap,\n light: lightHighlightColorMap,\n};\n\nfunction ScaleOnPressContainer({\n minScale = 0.975,\n ...props\n}: React.ComponentProps<typeof Container> & ScalingPressableProps) {\n const theme = useColorScheme();\n const animatedValue = React.useRef(new Animated.Value(0));\n const [isPressing, setIsPressing] = React.useState(false);\n\n const onPressIn = React.useCallback(() => {\n setIsPressing(true);\n\n Animated.spring(animatedValue.current, {\n toValue: 1,\n stiffness: 1000,\n damping: 500,\n mass: 3,\n overshootClamping: true,\n useNativeDriver: true,\n }).start();\n }, []);\n\n const onPressOut = React.useCallback(() => {\n setIsPressing(false);\n Animated.spring(animatedValue.current, {\n toValue: 0,\n stiffness: 1000,\n damping: 500,\n mass: 3,\n overshootClamping: true,\n useNativeDriver: true,\n }).start();\n }, []);\n\n const scale = animatedValue.current.interpolate({\n inputRange: [0, 1],\n outputRange: [1, minScale],\n });\n\n const scaleStyle = { transform: [{ scale }] };\n\n let backgroundColor = 'transparent';\n\n if (props.bg && isPressing && theme != null) {\n backgroundColor = highlightColorMap[theme][props.bg];\n }\n\n const underlayStyle = {\n backgroundColor,\n };\n\n return (\n <Container onPressIn={onPressIn} onPressOut={onPressOut} {...props} style={[scaleStyle]}>\n <Animated.View style={underlayStyle}>{props.children}</Animated.View>\n </Container>\n );\n}\n"]}
|