@compsych-ui-components/react-native 7.0.5 → 7.0.9
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/package.json +3 -7
- package/src/components/ActionSheet/index.d.ts +10 -1
- package/src/components/ActionSheet/index.js +59 -28
- package/src/components/ActionSheet/index.js.map +1 -1
- package/src/components/BodyText/index.d.ts +1 -0
- package/src/components/BodyText/index.js.map +1 -1
- package/src/components/Button/index.d.ts +1 -1
- package/src/components/Button/index.js +57 -37
- package/src/components/Button/index.js.map +1 -1
- package/src/components/ChatBubble/index.js +16 -14
- package/src/components/ChatBubble/index.js.map +1 -1
- package/src/components/ChatInput/index.d.ts +3 -1
- package/src/components/ChatInput/index.js +105 -98
- package/src/components/ChatInput/index.js.map +1 -1
- package/src/components/Checkbox/index.js.map +1 -1
- package/src/components/DateTimePicker/index.d.ts +16 -0
- package/src/components/DateTimePicker/index.js +587 -0
- package/src/components/DateTimePicker/index.js.map +1 -0
- package/src/components/Input/index.js +2 -3
- package/src/components/Input/index.js.map +1 -1
- package/src/components/Pagination/index.js.map +1 -1
- package/src/components/RadioButton/index.js.map +1 -1
- package/src/components/ScreenContainer/index.d.ts +2 -0
- package/src/components/ScreenContainer/index.js +2 -2
- package/src/components/ScreenContainer/index.js.map +1 -1
- package/src/components/SegmentedControl/index.d.ts +3 -3
- package/src/components/SegmentedControl/index.js +27 -40
- package/src/components/SegmentedControl/index.js.map +1 -1
- package/src/components/SelectionCard/index.js +12 -9
- package/src/components/SelectionCard/index.js.map +1 -1
- package/src/components/ServiceCard/index.js +141 -47
- package/src/components/ServiceCard/index.js.map +1 -1
- package/src/components/StatusChip/index.d.ts +15 -0
- package/src/components/StatusChip/index.js +80 -0
- package/src/components/StatusChip/index.js.map +1 -0
- package/src/icons/index.d.ts +8 -21
- package/src/icons/index.js +12 -92
- package/src/icons/index.js.map +1 -1
- package/src/icons/types.d.ts +3 -1
- package/src/icons/types.js +4 -4
- package/src/icons/types.js.map +1 -1
- package/src/index.d.ts +6 -5
- package/src/index.js +16 -60
- package/src/index.js.map +1 -1
- package/src/components/PromotionCard/index.d.ts +0 -23
- package/src/components/PromotionCard/index.js +0 -514
- package/src/components/PromotionCard/index.js.map +0 -1
- package/src/icons/AtomIcon.d.ts +0 -2
- package/src/icons/AtomIcon.js +0 -85
- package/src/icons/AtomIcon.js.map +0 -1
- package/src/icons/BinocularsIcon.d.ts +0 -2
- package/src/icons/BinocularsIcon.js +0 -103
- package/src/icons/BinocularsIcon.js.map +0 -1
- package/src/icons/FileChartColumnIncreasingIcon.d.ts +0 -2
- package/src/icons/FileChartColumnIncreasingIcon.js +0 -97
- package/src/icons/FileChartColumnIncreasingIcon.js.map +0 -1
- package/src/icons/FlagIcon.d.ts +0 -2
- package/src/icons/FlagIcon.js +0 -71
- package/src/icons/FlagIcon.js.map +0 -1
- package/src/icons/GlobeIcon.d.ts +0 -2
- package/src/icons/GlobeIcon.js +0 -71
- package/src/icons/GlobeIcon.js.map +0 -1
- package/src/icons/GraduationCapIcon.d.ts +0 -2
- package/src/icons/GraduationCapIcon.js +0 -85
- package/src/icons/GraduationCapIcon.js.map +0 -1
- package/src/icons/HandHeartIcon.d.ts +0 -2
- package/src/icons/HandHeartIcon.js +0 -91
- package/src/icons/HandHeartIcon.js.map +0 -1
- package/src/icons/HandshakeIcon.d.ts +0 -2
- package/src/icons/HandshakeIcon.js +0 -97
- package/src/icons/HandshakeIcon.js.map +0 -1
- package/src/icons/HazeIcon.d.ts +0 -2
- package/src/icons/HazeIcon.js +0 -115
- package/src/icons/HazeIcon.js.map +0 -1
- package/src/icons/HeartHandshakeIcon.d.ts +0 -2
- package/src/icons/HeartHandshakeIcon.js +0 -71
- package/src/icons/HeartHandshakeIcon.js.map +0 -1
- package/src/icons/HourglassIcon.d.ts +0 -2
- package/src/icons/HourglassIcon.js +0 -91
- package/src/icons/HourglassIcon.js.map +0 -1
- package/src/icons/IdCardIcon.d.ts +0 -2
- package/src/icons/IdCardIcon.js +0 -97
- package/src/icons/IdCardIcon.js.map +0 -1
- package/src/icons/MessageCirclePlusIcon.d.ts +0 -2
- package/src/icons/MessageCirclePlusIcon.js +0 -85
- package/src/icons/MessageCirclePlusIcon.js.map +0 -1
- package/src/icons/MountainSnowIcon.d.ts +0 -2
- package/src/icons/MountainSnowIcon.js +0 -79
- package/src/icons/MountainSnowIcon.js.map +0 -1
- package/src/icons/SnowflakeIcon.d.ts +0 -2
- package/src/icons/SnowflakeIcon.js +0 -139
- package/src/icons/SnowflakeIcon.js.map +0 -1
- package/src/icons/StethoscopeIcon.d.ts +0 -2
- package/src/icons/StethoscopeIcon.js +0 -97
- package/src/icons/StethoscopeIcon.js.map +0 -1
- package/src/icons/UserRoundIcon.d.ts +0 -2
- package/src/icons/UserRoundIcon.js +0 -79
- package/src/icons/UserRoundIcon.js.map +0 -1
- package/src/icons/WheatIcon.d.ts +0 -2
- package/src/icons/WheatIcon.js +0 -115
- package/src/icons/WheatIcon.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compsych-ui-components/react-native",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.9",
|
|
4
4
|
"description": "ComPsych React Native Design System — components, icons, tokens, and theming",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -23,15 +23,11 @@
|
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@expo/vector-icons": ">=15.0.0",
|
|
25
25
|
"expo-font": ">=13.0.0",
|
|
26
|
-
"
|
|
26
|
+
"lucide-react-native": ">=0.400.0",
|
|
27
27
|
"react": ">=18.0.0",
|
|
28
28
|
"react-native": ">=0.73.0",
|
|
29
|
+
"react-native-linear-gradient": ">=2.0.0",
|
|
29
30
|
"react-native-svg": ">=15.0.0"
|
|
30
31
|
},
|
|
31
|
-
"peerDependenciesMeta": {
|
|
32
|
-
"expo-linear-gradient": {
|
|
33
|
-
"optional": true
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
32
|
"type": "commonjs"
|
|
37
33
|
}
|
|
@@ -3,6 +3,7 @@ import { StyleProp, ViewStyle } from 'react-native';
|
|
|
3
3
|
export interface ActionSheetAction {
|
|
4
4
|
label: string;
|
|
5
5
|
onPress: () => void;
|
|
6
|
+
loading?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export interface ActionSheetProps {
|
|
8
9
|
visible: boolean;
|
|
@@ -11,6 +12,14 @@ export interface ActionSheetProps {
|
|
|
11
12
|
children?: React.ReactNode;
|
|
12
13
|
primaryAction?: ActionSheetAction;
|
|
13
14
|
secondaryAction?: ActionSheetAction;
|
|
15
|
+
/**
|
|
16
|
+
* `half` — floats at the bottom with a 6 px inset gutter; all corners
|
|
17
|
+
* rounded; content limited to maxHeight. Default.
|
|
18
|
+
* `full` — fills the screen from 10 px below the top; only top corners
|
|
19
|
+
* rounded; content expands to fill; close button appears on both
|
|
20
|
+
* sides of the title for one-handed reachability.
|
|
21
|
+
*/
|
|
22
|
+
variant?: 'half' | 'full';
|
|
14
23
|
style?: StyleProp<ViewStyle>;
|
|
15
24
|
}
|
|
16
|
-
export declare function ActionSheet({ visible, onClose, title, children, primaryAction, secondaryAction, style, }: ActionSheetProps): React.JSX.Element;
|
|
25
|
+
export declare function ActionSheet({ visible, onClose, title, children, primaryAction, secondaryAction, variant, style, }: ActionSheetProps): React.JSX.Element;
|
|
@@ -56,17 +56,26 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
56
56
|
}
|
|
57
57
|
return newObj;
|
|
58
58
|
}
|
|
59
|
-
function ActionSheet({ visible, onClose, title, children, primaryAction, secondaryAction, style }) {
|
|
59
|
+
function ActionSheet({ visible, onClose, title, children, primaryAction, secondaryAction, variant = 'half', style }) {
|
|
60
60
|
const { colorRoles: cr, dimensions: dim } = (0, _theme.useTheme)();
|
|
61
|
+
const isFull = variant === 'full';
|
|
61
62
|
const dynamicStyles = (0, _react.useMemo)(()=>({
|
|
62
|
-
|
|
63
|
+
sheetWrapperHalf: {
|
|
63
64
|
paddingHorizontal: dim.spacing.padding.sysPadding6,
|
|
64
65
|
paddingBottom: dim.spacing.padding.sysPadding6
|
|
65
66
|
},
|
|
66
|
-
|
|
67
|
+
sheetWrapperFull: {
|
|
68
|
+
marginTop: 10
|
|
69
|
+
},
|
|
70
|
+
sheetHalf: {
|
|
67
71
|
backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainerLowest,
|
|
68
72
|
borderRadius: dim.borderRadius.sysRadiusXxl
|
|
69
73
|
},
|
|
74
|
+
sheetFull: {
|
|
75
|
+
backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainerLowest,
|
|
76
|
+
borderTopLeftRadius: dim.borderRadius.sysRadiusXxl,
|
|
77
|
+
borderTopRightRadius: dim.borderRadius.sysRadiusXxl
|
|
78
|
+
},
|
|
70
79
|
titleRow: {
|
|
71
80
|
paddingHorizontal: dim.spacing.padding.sysPadding16,
|
|
72
81
|
paddingVertical: dim.spacing.padding.sysPadding8
|
|
@@ -86,6 +95,21 @@ function ActionSheet({ visible, onClose, title, children, primaryAction, seconda
|
|
|
86
95
|
cr,
|
|
87
96
|
dim
|
|
88
97
|
]);
|
|
98
|
+
const closeButton = /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.Pressable, {
|
|
99
|
+
onPress: onClose,
|
|
100
|
+
accessibilityRole: "button",
|
|
101
|
+
accessibilityLabel: "Close",
|
|
102
|
+
style: ({ pressed })=>[
|
|
103
|
+
styles.closeButtonSize,
|
|
104
|
+
dynamicStyles.closeButton,
|
|
105
|
+
pressed && styles.closePressed
|
|
106
|
+
],
|
|
107
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_vectoricons.Ionicons, {
|
|
108
|
+
name: "close",
|
|
109
|
+
size: 20,
|
|
110
|
+
color: cr.surface.surface.sysOnSurface
|
|
111
|
+
})
|
|
112
|
+
});
|
|
89
113
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.Modal, {
|
|
90
114
|
visible: visible,
|
|
91
115
|
transparent: true,
|
|
@@ -101,14 +125,15 @@ function ActionSheet({ visible, onClose, title, children, primaryAction, seconda
|
|
|
101
125
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
102
126
|
style: [
|
|
103
127
|
styles.sheetWrapper,
|
|
104
|
-
dynamicStyles.
|
|
128
|
+
isFull ? dynamicStyles.sheetWrapperFull : dynamicStyles.sheetWrapperHalf,
|
|
105
129
|
style
|
|
106
130
|
],
|
|
107
131
|
pointerEvents: "box-none",
|
|
108
132
|
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.View, {
|
|
109
133
|
style: [
|
|
110
134
|
styles.sheet,
|
|
111
|
-
|
|
135
|
+
isFull ? styles.sheetFull : styles.sheetHalf,
|
|
136
|
+
isFull ? dynamicStyles.sheetFull : dynamicStyles.sheetHalf
|
|
112
137
|
],
|
|
113
138
|
children: [
|
|
114
139
|
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.View, {
|
|
@@ -126,7 +151,7 @@ function ActionSheet({ visible, onClose, title, children, primaryAction, seconda
|
|
|
126
151
|
dynamicStyles.titleRow
|
|
127
152
|
],
|
|
128
153
|
children: [
|
|
129
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
154
|
+
isFull ? closeButton : /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
130
155
|
style: styles.closeButtonSize
|
|
131
156
|
}),
|
|
132
157
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_HeaderText.HeaderText, {
|
|
@@ -136,27 +161,13 @@ function ActionSheet({ visible, onClose, title, children, primaryAction, seconda
|
|
|
136
161
|
style: styles.titleText,
|
|
137
162
|
children: title ?? ''
|
|
138
163
|
}),
|
|
139
|
-
|
|
140
|
-
onPress: onClose,
|
|
141
|
-
accessibilityRole: "button",
|
|
142
|
-
accessibilityLabel: "Close",
|
|
143
|
-
style: ({ pressed })=>[
|
|
144
|
-
styles.closeButtonSize,
|
|
145
|
-
dynamicStyles.closeButton,
|
|
146
|
-
pressed && styles.closePressed
|
|
147
|
-
],
|
|
148
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_vectoricons.Ionicons, {
|
|
149
|
-
name: "close",
|
|
150
|
-
size: 20,
|
|
151
|
-
color: cr.surface.surface.sysOnSurface
|
|
152
|
-
})
|
|
153
|
-
})
|
|
164
|
+
closeButton
|
|
154
165
|
]
|
|
155
166
|
})
|
|
156
167
|
]
|
|
157
168
|
}),
|
|
158
169
|
children && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.ScrollView, {
|
|
159
|
-
style: styles.
|
|
170
|
+
style: isFull ? styles.contentFull : styles.contentHalf,
|
|
160
171
|
contentContainerStyle: dynamicStyles.contentInner,
|
|
161
172
|
showsVerticalScrollIndicator: false,
|
|
162
173
|
children: children
|
|
@@ -169,6 +180,7 @@ function ActionSheet({ visible, onClose, title, children, primaryAction, seconda
|
|
|
169
180
|
variant: "filled",
|
|
170
181
|
size: "xl",
|
|
171
182
|
fullWidth: true,
|
|
183
|
+
loading: primaryAction.loading,
|
|
172
184
|
onPress: primaryAction.onPress
|
|
173
185
|
}),
|
|
174
186
|
secondaryAction && /*#__PURE__*/ (0, _jsxruntime.jsx)(_Button.Button, {
|
|
@@ -199,10 +211,13 @@ const styles = _reactnative.StyleSheet.create({
|
|
|
199
211
|
flex: 1,
|
|
200
212
|
justifyContent: 'flex-end'
|
|
201
213
|
},
|
|
214
|
+
// ── half ────────────────────────────────────────────────────────────────────
|
|
202
215
|
sheet: {
|
|
203
216
|
borderWidth: 1,
|
|
204
217
|
borderColor: 'rgba(255,255,255,0.4)',
|
|
205
|
-
overflow: 'hidden'
|
|
218
|
+
overflow: 'hidden'
|
|
219
|
+
},
|
|
220
|
+
sheetHalf: {
|
|
206
221
|
shadowColor: '#000',
|
|
207
222
|
shadowOffset: {
|
|
208
223
|
width: 0,
|
|
@@ -212,15 +227,34 @@ const styles = _reactnative.StyleSheet.create({
|
|
|
212
227
|
shadowRadius: 16,
|
|
213
228
|
elevation: 8
|
|
214
229
|
},
|
|
230
|
+
contentHalf: {
|
|
231
|
+
maxHeight: 400
|
|
232
|
+
},
|
|
233
|
+
// ── full ────────────────────────────────────────────────────────────────────
|
|
234
|
+
sheetFull: {
|
|
235
|
+
flex: 1,
|
|
236
|
+
shadowColor: '#000',
|
|
237
|
+
shadowOffset: {
|
|
238
|
+
width: 0,
|
|
239
|
+
height: 15
|
|
240
|
+
},
|
|
241
|
+
shadowOpacity: 0.18,
|
|
242
|
+
shadowRadius: 75,
|
|
243
|
+
elevation: 16
|
|
244
|
+
},
|
|
245
|
+
contentFull: {
|
|
246
|
+
flex: 1
|
|
247
|
+
},
|
|
248
|
+
// ── shared ──────────────────────────────────────────────────────────────────
|
|
215
249
|
toolbar: {
|
|
216
250
|
alignItems: 'center',
|
|
217
251
|
width: '100%'
|
|
218
252
|
},
|
|
219
253
|
grabberRow: {
|
|
254
|
+
width: '100%',
|
|
220
255
|
height: 16,
|
|
221
|
-
justifyContent: 'flex-
|
|
256
|
+
justifyContent: 'flex-start',
|
|
222
257
|
alignItems: 'center',
|
|
223
|
-
paddingBottom: 0,
|
|
224
258
|
paddingTop: 5
|
|
225
259
|
},
|
|
226
260
|
grabber: {
|
|
@@ -247,9 +281,6 @@ const styles = _reactnative.StyleSheet.create({
|
|
|
247
281
|
},
|
|
248
282
|
closePressed: {
|
|
249
283
|
opacity: 0.7
|
|
250
|
-
},
|
|
251
|
-
content: {
|
|
252
|
-
maxHeight: 400
|
|
253
284
|
}
|
|
254
285
|
});
|
|
255
286
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/react-native/src/components/ActionSheet/index.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\n\r\nimport {\r\n Modal,\r\n Pressable,\r\n ScrollView,\r\n StyleProp,\r\n StyleSheet,\r\n View,\r\n ViewStyle,\r\n} from 'react-native';\r\n\r\nimport { Ionicons } from '@expo/vector-icons';\r\n\r\nimport { useTheme } from '../../theme';\r\nimport { Button } from '../Button';\r\nimport { HeaderText } from '../HeaderText';\r\n\r\nexport interface ActionSheetAction {\r\n label: string;\r\n onPress: () => void;\r\n}\r\n\r\nexport interface ActionSheetProps {\r\n visible: boolean;\r\n onClose: () => void;\r\n title?: string;\r\n children?: React.ReactNode;\r\n primaryAction?: ActionSheetAction;\r\n secondaryAction?: ActionSheetAction;\r\n style?: StyleProp<ViewStyle>;\r\n}\r\n\r\nexport function ActionSheet({\r\n visible,\r\n onClose,\r\n title,\r\n children,\r\n primaryAction,\r\n secondaryAction,\r\n style,\r\n}: ActionSheetProps) {\r\n const { colorRoles: cr, dimensions: dim } = useTheme();\r\n\r\n const dynamicStyles = useMemo(\r\n () => ({\r\n sheetWrapper: {\r\n paddingHorizontal: dim.spacing.padding.sysPadding6,\r\n paddingBottom: dim.spacing.padding.sysPadding6,\r\n },\r\n sheet: {\r\n backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainerLowest,\r\n borderRadius: dim.borderRadius.sysRadiusXxl,\r\n },\r\n titleRow: {\r\n paddingHorizontal: dim.spacing.padding.sysPadding16,\r\n paddingVertical: dim.spacing.padding.sysPadding8,\r\n },\r\n closeButton: {\r\n borderRadius: dim.borderRadius.sysRadiusFull,\r\n backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainer,\r\n },\r\n contentInner: {\r\n padding: dim.spacing.padding.sysPadding16,\r\n },\r\n actions: {\r\n padding: dim.spacing.padding.sysPadding24,\r\n gap: dim.spacing.padding.sysPadding12,\r\n },\r\n }),\r\n [cr, dim],\r\n );\r\n\r\n return (\r\n <Modal\r\n visible={visible}\r\n transparent\r\n animationType=\"slide\"\r\n onRequestClose={onClose}\r\n statusBarTranslucent\r\n >\r\n {/* Backdrop */}\r\n <Pressable style={styles.backdrop} onPress={onClose} accessible={false} />\r\n\r\n {/* Sheet */}\r\n <View\r\n style={[styles.sheetWrapper, dynamicStyles.sheetWrapper, style]}\r\n pointerEvents=\"box-none\"\r\n >\r\n <View style={[styles.sheet, dynamicStyles.sheet]}>\r\n {/* Toolbar */}\r\n <View style={styles.toolbar}>\r\n {/* Grabber */}\r\n <View style={styles.grabberRow}>\r\n <View style={styles.grabber} />\r\n </View>\r\n\r\n {/* Title row */}\r\n <View style={[styles.titleRow, dynamicStyles.titleRow]}>\r\n {/* Invisible spacer to balance the close button */}\r\n <View style={styles.closeButtonSize} />\r\n\r\n <HeaderText\r\n variant=\"titleSmall\"\r\n emphasized\r\n color={cr.surface.surface.sysOnSurface}\r\n style={styles.titleText}\r\n >\r\n {title ?? ''}\r\n </HeaderText>\r\n\r\n {/* Close button */}\r\n <Pressable\r\n onPress={onClose}\r\n accessibilityRole=\"button\"\r\n accessibilityLabel=\"Close\"\r\n style={({ pressed }) => [\r\n styles.closeButtonSize,\r\n dynamicStyles.closeButton,\r\n pressed && styles.closePressed,\r\n ]}\r\n >\r\n <Ionicons\r\n name=\"close\"\r\n size={20}\r\n color={cr.surface.surface.sysOnSurface}\r\n />\r\n </Pressable>\r\n </View>\r\n </View>\r\n\r\n {/* Content */}\r\n {children && (\r\n <ScrollView\r\n style={styles.content}\r\n contentContainerStyle={dynamicStyles.contentInner}\r\n showsVerticalScrollIndicator={false}\r\n >\r\n {children}\r\n </ScrollView>\r\n )}\r\n\r\n {/* Actions */}\r\n {(primaryAction || secondaryAction) && (\r\n <View style={dynamicStyles.actions}>\r\n {primaryAction && (\r\n <Button\r\n label={primaryAction.label}\r\n variant=\"filled\"\r\n size=\"xl\"\r\n fullWidth\r\n onPress={primaryAction.onPress}\r\n />\r\n )}\r\n {secondaryAction && (\r\n <Button\r\n label={secondaryAction.label}\r\n variant=\"outlined\"\r\n size=\"xl\"\r\n fullWidth\r\n onPress={secondaryAction.onPress}\r\n />\r\n )}\r\n </View>\r\n )}\r\n </View>\r\n </View>\r\n </Modal>\r\n );\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n backdrop: {\r\n position: 'absolute', top: 0, left: 0, right: 0, bottom: 0,\r\n backgroundColor: 'rgba(0,0,0,0.4)',\r\n },\r\n sheetWrapper: {\r\n flex: 1,\r\n justifyContent: 'flex-end',\r\n },\r\n sheet: {\r\n borderWidth: 1,\r\n borderColor: 'rgba(255,255,255,0.4)',\r\n overflow: 'hidden',\r\n shadowColor: '#000',\r\n shadowOffset: { width: 0, height: 4 },\r\n shadowOpacity: 0.1,\r\n shadowRadius: 16,\r\n elevation: 8,\r\n },\r\n toolbar: {\r\n alignItems: 'center',\r\n width: '100%',\r\n },\r\n grabberRow: {\r\n height: 16,\r\n justifyContent: 'flex-end',\r\n alignItems: 'center',\r\n paddingBottom: 0,\r\n paddingTop: 5,\r\n },\r\n grabber: {\r\n width: 36,\r\n height: 5,\r\n borderRadius: 100,\r\n backgroundColor: '#ccc',\r\n },\r\n titleRow: {\r\n flexDirection: 'row',\r\n alignItems: 'center',\r\n justifyContent: 'space-between',\r\n width: '100%',\r\n },\r\n titleText: {\r\n flex: 1,\r\n textAlign: 'center',\r\n },\r\n closeButtonSize: {\r\n width: 32,\r\n height: 32,\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n },\r\n closePressed: {\r\n opacity: 0.7,\r\n },\r\n content: {\r\n maxHeight: 400,\r\n },\r\n});\r\n"],"names":["ActionSheet","visible","onClose","title","children","primaryAction","secondaryAction","style","colorRoles","cr","dimensions","dim","useTheme","dynamicStyles","useMemo","sheetWrapper","paddingHorizontal","spacing","padding","sysPadding6","paddingBottom","sheet","backgroundColor","surface","surfaceContainer","sysSurfaceContainerLowest","borderRadius","sysRadiusXxl","titleRow","sysPadding16","paddingVertical","sysPadding8","closeButton","sysRadiusFull","sysSurfaceContainer","contentInner","actions","sysPadding24","gap","sysPadding12","Modal","transparent","animationType","onRequestClose","statusBarTranslucent","Pressable","styles","backdrop","onPress","accessible","View","pointerEvents","toolbar","grabberRow","grabber","closeButtonSize","HeaderText","variant","emphasized","color","sysOnSurface","titleText","accessibilityRole","accessibilityLabel","pressed","closePressed","Ionicons","name","size","ScrollView","content","contentContainerStyle","showsVerticalScrollIndicator","Button","label","fullWidth","StyleSheet","create","position","top","left","right","bottom","flex","justifyContent","borderWidth","borderColor","overflow","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","alignItems","paddingTop","flexDirection","textAlign","opacity","maxHeight"],"mappings":";;;;+BAiCgBA;;;eAAAA;;;;+DAjCe;6BAUxB;6BAEkB;uBAEA;wBACF;4BACI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBpB,SAASA,YAAY,EAC1BC,OAAO,EACPC,OAAO,EACPC,KAAK,EACLC,QAAQ,EACRC,aAAa,EACbC,eAAe,EACfC,KAAK,EACY;IACjB,MAAM,EAAEC,YAAYC,EAAE,EAAEC,YAAYC,GAAG,EAAE,GAAGC,IAAAA,eAAQ;IAEpD,MAAMC,gBAAgBC,IAAAA,cAAO,EAC3B,IAAO,CAAA;YACLC,cAAc;gBACZC,mBAAmBL,IAAIM,OAAO,CAACC,OAAO,CAACC,WAAW;gBAClDC,eAAeT,IAAIM,OAAO,CAACC,OAAO,CAACC,WAAW;YAChD;YACAE,OAAO;gBACLC,iBAAiBb,GAAGc,OAAO,CAACC,gBAAgB,CAACC,yBAAyB;gBACtEC,cAAcf,IAAIe,YAAY,CAACC,YAAY;YAC7C;YACAC,UAAU;gBACRZ,mBAAmBL,IAAIM,OAAO,CAACC,OAAO,CAACW,YAAY;gBACnDC,iBAAiBnB,IAAIM,OAAO,CAACC,OAAO,CAACa,WAAW;YAClD;YACAC,aAAa;gBACXN,cAAcf,IAAIe,YAAY,CAACO,aAAa;gBAC5CX,iBAAiBb,GAAGc,OAAO,CAACC,gBAAgB,CAACU,mBAAmB;YAClE;YACAC,cAAc;gBACZjB,SAASP,IAAIM,OAAO,CAACC,OAAO,CAACW,YAAY;YAC3C;YACAO,SAAS;gBACPlB,SAASP,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BM,OAAO;IACT;IACA7B,WAAW;QACTsB,MAAM;QACNe,WAAW;IACb;IACA3C,iBAAiB;QACfmC,OAAO;QACPC,QAAQ;QACRI,YAAY;QACZX,gBAAgB;IAClB;IACAnB,cAAc;QACZkC,SAAS;IACX;IACA7B,SAAS;QACP8B,WAAW;IACb;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/react-native/src/components/ActionSheet/index.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\n\r\nimport {\r\n Modal,\r\n Pressable,\r\n ScrollView,\r\n StyleProp,\r\n StyleSheet,\r\n View,\r\n ViewStyle,\r\n} from 'react-native';\r\n\r\nimport { Ionicons } from '@expo/vector-icons';\r\n\r\nimport { useTheme } from '../../theme';\r\nimport { Button } from '../Button';\r\nimport { HeaderText } from '../HeaderText';\r\n\r\nexport interface ActionSheetAction {\r\n label: string;\r\n onPress: () => void;\r\n loading?: boolean;\r\n}\r\n\r\nexport interface ActionSheetProps {\r\n visible: boolean;\r\n onClose: () => void;\r\n title?: string;\r\n children?: React.ReactNode;\r\n primaryAction?: ActionSheetAction;\r\n secondaryAction?: ActionSheetAction;\r\n /**\r\n * `half` — floats at the bottom with a 6 px inset gutter; all corners\r\n * rounded; content limited to maxHeight. Default.\r\n * `full` — fills the screen from 10 px below the top; only top corners\r\n * rounded; content expands to fill; close button appears on both\r\n * sides of the title for one-handed reachability.\r\n */\r\n variant?: 'half' | 'full';\r\n style?: StyleProp<ViewStyle>;\r\n}\r\n\r\nexport function ActionSheet({\r\n visible,\r\n onClose,\r\n title,\r\n children,\r\n primaryAction,\r\n secondaryAction,\r\n variant = 'half',\r\n style,\r\n}: ActionSheetProps) {\r\n const { colorRoles: cr, dimensions: dim } = useTheme();\r\n const isFull = variant === 'full';\r\n\r\n const dynamicStyles = useMemo(\r\n () => ({\r\n sheetWrapperHalf: {\r\n paddingHorizontal: dim.spacing.padding.sysPadding6,\r\n paddingBottom: dim.spacing.padding.sysPadding6,\r\n },\r\n sheetWrapperFull: {\r\n marginTop: 10,\r\n },\r\n sheetHalf: {\r\n backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainerLowest,\r\n borderRadius: dim.borderRadius.sysRadiusXxl,\r\n },\r\n sheetFull: {\r\n backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainerLowest,\r\n borderTopLeftRadius: dim.borderRadius.sysRadiusXxl,\r\n borderTopRightRadius: dim.borderRadius.sysRadiusXxl,\r\n },\r\n titleRow: {\r\n paddingHorizontal: dim.spacing.padding.sysPadding16,\r\n paddingVertical: dim.spacing.padding.sysPadding8,\r\n },\r\n closeButton: {\r\n borderRadius: dim.borderRadius.sysRadiusFull,\r\n backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainer,\r\n },\r\n contentInner: {\r\n padding: dim.spacing.padding.sysPadding16,\r\n },\r\n actions: {\r\n padding: dim.spacing.padding.sysPadding24,\r\n gap: dim.spacing.padding.sysPadding12,\r\n },\r\n }),\r\n [cr, dim],\r\n );\r\n\r\n const closeButton = (\r\n <Pressable\r\n onPress={onClose}\r\n accessibilityRole=\"button\"\r\n accessibilityLabel=\"Close\"\r\n style={({ pressed }) => [\r\n styles.closeButtonSize,\r\n dynamicStyles.closeButton,\r\n pressed && styles.closePressed,\r\n ]}\r\n >\r\n <Ionicons\r\n name=\"close\"\r\n size={20}\r\n color={cr.surface.surface.sysOnSurface}\r\n />\r\n </Pressable>\r\n );\r\n\r\n return (\r\n <Modal\r\n visible={visible}\r\n transparent\r\n animationType=\"slide\"\r\n onRequestClose={onClose}\r\n statusBarTranslucent\r\n >\r\n {/* Backdrop */}\r\n <Pressable style={styles.backdrop} onPress={onClose} accessible={false} />\r\n\r\n {/* Sheet wrapper */}\r\n <View\r\n style={[\r\n styles.sheetWrapper,\r\n isFull\r\n ? dynamicStyles.sheetWrapperFull\r\n : dynamicStyles.sheetWrapperHalf,\r\n style,\r\n ]}\r\n pointerEvents=\"box-none\"\r\n >\r\n <View\r\n style={[\r\n styles.sheet,\r\n isFull ? styles.sheetFull : styles.sheetHalf,\r\n isFull ? dynamicStyles.sheetFull : dynamicStyles.sheetHalf,\r\n ]}\r\n >\r\n {/* Toolbar */}\r\n <View style={styles.toolbar}>\r\n {/* Grabber */}\r\n <View style={styles.grabberRow}>\r\n <View style={styles.grabber} />\r\n </View>\r\n\r\n {/* Title row */}\r\n <View style={[styles.titleRow, dynamicStyles.titleRow]}>\r\n {/* Left slot: close button (full) or invisible spacer (half) */}\r\n {isFull ? closeButton : <View style={styles.closeButtonSize} />}\r\n\r\n <HeaderText\r\n variant=\"titleSmall\"\r\n emphasized\r\n color={cr.surface.surface.sysOnSurface}\r\n style={styles.titleText}\r\n >\r\n {title ?? ''}\r\n </HeaderText>\r\n\r\n {/* Right close button — always shown */}\r\n {closeButton}\r\n </View>\r\n </View>\r\n\r\n {/* Content */}\r\n {children && (\r\n <ScrollView\r\n style={isFull ? styles.contentFull : styles.contentHalf}\r\n contentContainerStyle={dynamicStyles.contentInner}\r\n showsVerticalScrollIndicator={false}\r\n >\r\n {children}\r\n </ScrollView>\r\n )}\r\n\r\n {/* Actions */}\r\n {(primaryAction || secondaryAction) && (\r\n <View style={dynamicStyles.actions}>\r\n {primaryAction && (\r\n <Button\r\n label={primaryAction.label}\r\n variant=\"filled\"\r\n size=\"xl\"\r\n fullWidth\r\n loading={primaryAction.loading}\r\n onPress={primaryAction.onPress}\r\n />\r\n )}\r\n {secondaryAction && (\r\n <Button\r\n label={secondaryAction.label}\r\n variant=\"outlined\"\r\n size=\"xl\"\r\n fullWidth\r\n onPress={secondaryAction.onPress}\r\n />\r\n )}\r\n </View>\r\n )}\r\n </View>\r\n </View>\r\n </Modal>\r\n );\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n backdrop: {\r\n position: 'absolute',\r\n top: 0,\r\n left: 0,\r\n right: 0,\r\n bottom: 0,\r\n backgroundColor: 'rgba(0,0,0,0.4)',\r\n },\r\n sheetWrapper: {\r\n flex: 1,\r\n justifyContent: 'flex-end',\r\n },\r\n // ── half ────────────────────────────────────────────────────────────────────\r\n sheet: {\r\n borderWidth: 1,\r\n borderColor: 'rgba(255,255,255,0.4)',\r\n overflow: 'hidden',\r\n },\r\n sheetHalf: {\r\n shadowColor: '#000',\r\n shadowOffset: { width: 0, height: 4 },\r\n shadowOpacity: 0.1,\r\n shadowRadius: 16,\r\n elevation: 8,\r\n },\r\n contentHalf: {\r\n maxHeight: 400,\r\n },\r\n // ── full ────────────────────────────────────────────────────────────────────\r\n sheetFull: {\r\n flex: 1,\r\n shadowColor: '#000',\r\n shadowOffset: { width: 0, height: 15 },\r\n shadowOpacity: 0.18,\r\n shadowRadius: 75,\r\n elevation: 16,\r\n },\r\n contentFull: {\r\n flex: 1,\r\n },\r\n // ── shared ──────────────────────────────────────────────────────────────────\r\n toolbar: {\r\n alignItems: 'center',\r\n width: '100%',\r\n },\r\n grabberRow: {\r\n width: '100%',\r\n height: 16,\r\n justifyContent: 'flex-start',\r\n alignItems: 'center',\r\n paddingTop: 5,\r\n },\r\n grabber: {\r\n width: 36,\r\n height: 5,\r\n borderRadius: 100,\r\n backgroundColor: '#ccc',\r\n },\r\n titleRow: {\r\n flexDirection: 'row',\r\n alignItems: 'center',\r\n justifyContent: 'space-between',\r\n width: '100%',\r\n },\r\n titleText: {\r\n flex: 1,\r\n textAlign: 'center',\r\n },\r\n closeButtonSize: {\r\n width: 32,\r\n height: 32,\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n },\r\n closePressed: {\r\n opacity: 0.7,\r\n },\r\n});\r\n"],"names":["ActionSheet","visible","onClose","title","children","primaryAction","secondaryAction","variant","style","colorRoles","cr","dimensions","dim","useTheme","isFull","dynamicStyles","useMemo","sheetWrapperHalf","paddingHorizontal","spacing","padding","sysPadding6","paddingBottom","sheetWrapperFull","marginTop","sheetHalf","backgroundColor","surface","surfaceContainer","sysSurfaceContainerLowest","borderRadius","sysRadiusXxl","sheetFull","borderTopLeftRadius","borderTopRightRadius","titleRow","sysPadding16","paddingVertical","sysPadding8","closeButton","sysRadiusFull","sysSurfaceContainer","contentInner","actions","sysPadding24","gap","sysPadding12","Pressable","onPress","accessibilityRole","accessibilityLabel","pressed","styles","closeButtonSize","closePressed","Ionicons","name","size","color","sysOnSurface","Modal","transparent","animationType","onRequestClose","statusBarTranslucent","backdrop","accessible","View","sheetWrapper","pointerEvents","sheet","toolbar","grabberRow","grabber","HeaderText","emphasized","titleText","ScrollView","contentFull","contentHalf","contentContainerStyle","showsVerticalScrollIndicator","Button","label","fullWidth","loading","StyleSheet","create","position","top","left","right","bottom","flex","justifyContent","borderWidth","borderColor","overflow","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","maxHeight","alignItems","paddingTop","flexDirection","textAlign","opacity"],"mappings":";;;;+BA0CgBA;;;eAAAA;;;;+DA1Ce;6BAUxB;6BAEkB;uBAEA;wBACF;4BACI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BpB,SAASA,YAAY,EAC1BC,OAAO,EACPC,OAAO,EACPC,KAAK,EACLC,QAAQ,EACRC,aAAa,EACbC,eAAe,EACfC,UAAU,MAAM,EAChBC,KAAK,EACY;IACjB,MAAM,EAAEC,YAAYC,EAAE,EAAEC,YAAYC,GAAG,EAAE,GAAGC,IAAAA,eAAQ;IACpD,MAAMC,SAASP,YAAY;IAE3B,MAAMQ,gBAAgBC,IAAAA,cAAO,EAC3B,IAAO,CAAA;YACLC,kBAAkB;gBAChBC,mBAAmBN,IAAIO,OAAO,CAACC,OAAO,CAACC,WAAW;gBAClDC,eAAeV,IAAIO,OAAO,CAACC,OAAO,CAACC,WAAW;YAChD;YACAE,kBAAkB;gBAChBC,WAAW;YACb;YACAC,WAAW;gBACTC,iBAAiBhB,GAAGiB,OAAO,CAACC,gBAAgB,CAACC,yBAAyB;gBACtEC,cAAclB,IAAIkB,YAAY,CAACC,YAAY;YAC7C;YACAC,WAAW;gBACTN,iBAAiBhB,GAAGiB,OAAO,CAACC,gBAAgB,CAACC,yB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,MAAK;oCACL2B,SAAS;oCACTpC,SAAS1C,gBAAgB0C,OAAO;;;;;;;;;AASlD;AAEA,MAAMI,SAASkC,uBAAU,CAACC,MAAM,CAAC;IAC/BtB,UAAU;QACRuB,UAAU;QACVC,KAAK;QACLC,MAAM;QACNC,OAAO;QACPC,QAAQ;QACRlE,iBAAiB;IACnB;IACA0C,cAAc;QACZyB,MAAM;QACNC,gBAAgB;IAClB;IACA,+EAA+E;IAC/ExB,OAAO;QACLyB,aAAa;QACbC,aAAa;QACbC,UAAU;IACZ;IACAxE,WAAW;QACTyE,aAAa;QACbC,cAAc;YAAEC,OAAO;YAAGC,QAAQ;QAAE;QACpCC,eAAe;QACfC,cAAc;QACdC,WAAW;IACb;IACAzB,aAAa;QACX0B,WAAW;IACb;IACA,+EAA+E;IAC/EzE,WAAW;QACT6D,MAAM;QACNK,aAAa;QACbC,cAAc;YAAEC,OAAO;YAAGC,QAAQ;QAAG;QACrCC,eAAe;QACfC,cAAc;QACdC,WAAW;IACb;IACA1B,aAAa;QACXe,MAAM;IACR;IACA,+EAA+E;IAC/EtB,SAAS;QACPmC,YAAY;QACZN,OAAO;IACT;IACA5B,YAAY;QACV4B,OAAO;QACPC,QAAQ;QACRP,gBAAgB;QAChBY,YAAY;QACZC,YAAY;IACd;IACAlC,SAAS;QACP2B,OAAO;QACPC,QAAQ;QACRvE,cAAc;QACdJ,iBAAiB;IACnB;IACAS,UAAU;QACRyE,eAAe;QACfF,YAAY;QACZZ,gBAAgB;QAChBM,OAAO;IACT;IACAxB,WAAW;QACTiB,MAAM;QACNgB,WAAW;IACb;IACAxD,iBAAiB;QACf+C,OAAO;QACPC,QAAQ;QACRK,YAAY;QACZZ,gBAAgB;IAClB;IACAxC,cAAc;QACZwD,SAAS;IACX;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/react-native/src/components/BodyText/index.tsx"],"sourcesContent":["import React from 'react';\r\n\r\nimport { Text, type TextProps } from 'react-native';\r\n\r\nimport { useFonts } from 'expo-font';\r\n\r\nimport { useTheme } from '../../theme';\r\n\r\nexport type BodyVariant =\r\n | 'large'\r\n | 'medium'\r\n | 'small'\r\n | 'labelLarge'\r\n | 'labelMedium'\r\n | 'labelSmall';\r\n\r\nexport interface BodyTextProps extends TextProps {\r\n variant?: BodyVariant;\r\n emphasized?: boolean;\r\n color?: string;\r\n}\r\n\r\nconst FONT_FAMILY: Record<string, string> = {\r\n regular: 'GoogleSans_400Regular',\r\n medium: 'GoogleSans_500Medium',\r\n semibold: 'GoogleSans_600SemiBold',\r\n};\r\n\r\nconst VARIANT_TOKEN_KEY: Record<BodyVariant, string> = {\r\n large: 'bodyLarge',\r\n medium: 'bodyMedium',\r\n small: 'bodySmall',\r\n labelLarge: 'labelLarge',\r\n labelMedium: 'labelMedium',\r\n labelSmall: 'labelSmall',\r\n};\r\n\r\nexport function BodyText({\r\n variant = 'medium',\r\n emphasized = false,\r\n color,\r\n style,\r\n ...rest\r\n}: BodyTextProps) {\r\n const { typeScale: ts } = useTheme();\r\n\r\n const [fontsLoaded] = useFonts({\r\n GoogleSans_400Regular: require('../../fonts/GoogleSans_400Regular.ttf'),\r\n GoogleSans_500Medium: require('../../fonts/GoogleSans_500Medium.ttf'),\r\n GoogleSans_600SemiBold: require('../../fonts/GoogleSans_600SemiBold.ttf'),\r\n });\r\n\r\n const token = ts[VARIANT_TOKEN_KEY[variant] as keyof typeof ts];\r\n const weight = emphasized\r\n ? token.sysFontWeightEmphasized\r\n : token.sysFontWeight;\r\n\r\n return (\r\n <Text\r\n style={[\r\n {\r\n fontFamily: fontsLoaded ? FONT_FAMILY[weight] : undefined,\r\n fontSize: token.sysFontSize,\r\n lineHeight: token.sysLineHeight,\r\n letterSpacing: token.sysTracking,\r\n color,\r\n },\r\n style,\r\n ]}\r\n {...rest}\r\n />\r\n );\r\n}\r\n"],"names":["BodyText","FONT_FAMILY","regular","medium","semibold","VARIANT_TOKEN_KEY","large","small","labelLarge","labelMedium","labelSmall","variant","emphasized","color","style","rest","typeScale","ts","useTheme","fontsLoaded","useFonts","GoogleSans_400Regular","require","GoogleSans_500Medium","GoogleSans_600SemiBold","token","weight","sysFontWeightEmphasized","sysFontWeight","Text","fontFamily","undefined","fontSize","sysFontSize","lineHeight","sysLineHeight","letterSpacing","sysTracking"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/react-native/src/components/BodyText/index.tsx"],"sourcesContent":["import React from 'react';\r\n\r\nimport { Text, type TextProps } from 'react-native';\r\n\r\nimport { useFonts } from 'expo-font';\r\n\r\nimport { useTheme } from '../../theme';\r\n\r\nexport type BodyVariant =\r\n | 'large'\r\n | 'medium'\r\n | 'small'\r\n | 'labelLarge'\r\n | 'labelMedium'\r\n | 'labelSmall';\r\n\r\nexport interface BodyTextProps extends TextProps {\r\n variant?: BodyVariant;\r\n emphasized?: boolean;\r\n color?: string;\r\n children?: React.ReactNode;\r\n}\r\n\r\nconst FONT_FAMILY: Record<string, string> = {\r\n regular: 'GoogleSans_400Regular',\r\n medium: 'GoogleSans_500Medium',\r\n semibold: 'GoogleSans_600SemiBold',\r\n};\r\n\r\nconst VARIANT_TOKEN_KEY: Record<BodyVariant, string> = {\r\n large: 'bodyLarge',\r\n medium: 'bodyMedium',\r\n small: 'bodySmall',\r\n labelLarge: 'labelLarge',\r\n labelMedium: 'labelMedium',\r\n labelSmall: 'labelSmall',\r\n};\r\n\r\nexport function BodyText({\r\n variant = 'medium',\r\n emphasized = false,\r\n color,\r\n style,\r\n ...rest\r\n}: BodyTextProps) {\r\n const { typeScale: ts } = useTheme();\r\n\r\n const [fontsLoaded] = useFonts({\r\n GoogleSans_400Regular: require('../../fonts/GoogleSans_400Regular.ttf'),\r\n GoogleSans_500Medium: require('../../fonts/GoogleSans_500Medium.ttf'),\r\n GoogleSans_600SemiBold: require('../../fonts/GoogleSans_600SemiBold.ttf'),\r\n });\r\n\r\n const token = ts[VARIANT_TOKEN_KEY[variant] as keyof typeof ts];\r\n const weight = emphasized\r\n ? token.sysFontWeightEmphasized\r\n : token.sysFontWeight;\r\n\r\n return (\r\n <Text\r\n style={[\r\n {\r\n fontFamily: fontsLoaded ? FONT_FAMILY[weight] : undefined,\r\n fontSize: token.sysFontSize,\r\n lineHeight: token.sysLineHeight,\r\n letterSpacing: token.sysTracking,\r\n color,\r\n },\r\n style,\r\n ]}\r\n {...rest}\r\n />\r\n );\r\n}\r\n"],"names":["BodyText","FONT_FAMILY","regular","medium","semibold","VARIANT_TOKEN_KEY","large","small","labelLarge","labelMedium","labelSmall","variant","emphasized","color","style","rest","typeScale","ts","useTheme","fontsLoaded","useFonts","GoogleSans_400Regular","require","GoogleSans_500Medium","GoogleSans_600SemiBold","token","weight","sysFontWeightEmphasized","sysFontWeight","Text","fontFamily","undefined","fontSize","sysFontSize","lineHeight","sysLineHeight","letterSpacing","sysTracking"],"mappings":";;;;+BAsCgBA;;;eAAAA;;;;8DAtCE;6BAEmB;0BAEZ;uBAEA;;;;;;AAiBzB,MAAMC,cAAsC;IAC1CC,SAAS;IACTC,QAAQ;IACRC,UAAU;AACZ;AAEA,MAAMC,oBAAiD;IACrDC,OAAO;IACPH,QAAQ;IACRI,OAAO;IACPC,YAAY;IACZC,aAAa;IACbC,YAAY;AACd;AAEO,SAASV,SAAS,EACvBW,UAAU,QAAQ,EAClBC,aAAa,KAAK,EAClBC,KAAK,EACLC,KAAK,EACL,GAAGC,MACW;IACd,MAAM,EAAEC,WAAWC,EAAE,EAAE,GAAGC,IAAAA,eAAQ;IAElC,MAAM,CAACC,YAAY,GAAGC,IAAAA,kBAAQ,EAAC;QAC7BC,uBAAuBC,QAAQ;QAC/BC,sBAAsBD,QAAQ;QAC9BE,wBAAwBF,QAAQ;IAClC;IAEA,MAAMG,QAAQR,EAAE,CAACZ,iBAAiB,CAACM,QAAQ,CAAoB;IAC/D,MAAMe,SAASd,aACXa,MAAME,uBAAuB,GAC7BF,MAAMG,aAAa;IAEvB,qBACE,qBAACC,iBAAI;QACHf,OAAO;YACL;gBACEgB,YAAYX,cAAclB,WAAW,CAACyB,OAAO,GAAGK;gBAChDC,UAAUP,MAAMQ,WAAW;gBAC3BC,YAAYT,MAAMU,aAAa;gBAC/BC,eAAeX,MAAMY,WAAW;gBAChCxB;YACF;YACAC;SACD;QACA,GAAGC,IAAI;;AAGd"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type PressableProps } from 'react-native';
|
|
3
|
-
export type ButtonVariant = 'filled' | 'tonal' | 'outlined' | 'elevated' | 'text' | 'danger' | 'danger-outlined' | 'warning';
|
|
3
|
+
export type ButtonVariant = 'filled' | 'tonal' | 'outlined' | 'elevated' | 'inverted' | 'text' | 'danger' | 'danger-outlined' | 'warning';
|
|
4
4
|
export type ButtonSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
5
5
|
export interface ButtonProps extends Omit<PressableProps, 'children' | 'style'> {
|
|
6
6
|
variant?: ButtonVariant;
|
|
@@ -80,6 +80,12 @@ function Button({ variant = 'filled', size = 'md', label, disabled = false, load
|
|
|
80
80
|
borderColor: 'transparent',
|
|
81
81
|
borderWidth: 0
|
|
82
82
|
},
|
|
83
|
+
inverted: {
|
|
84
|
+
bg: cr.accent.primary.sysOnPrimary,
|
|
85
|
+
label: cr.surface.surface.sysOnSurface,
|
|
86
|
+
borderColor: cr.outline.sysOutline,
|
|
87
|
+
borderWidth: dim.borderWidth.sysStrokeThin
|
|
88
|
+
},
|
|
83
89
|
text: {
|
|
84
90
|
bg: 'transparent',
|
|
85
91
|
label: cr.surface.surface.sysOnSurface,
|
|
@@ -196,50 +202,65 @@ function Button({ variant = 'filled', size = 'md', label, disabled = false, load
|
|
|
196
202
|
shadowOpacity: 0.1,
|
|
197
203
|
shadowRadius: 16,
|
|
198
204
|
elevation: 2
|
|
205
|
+
} : {},
|
|
206
|
+
// Inverted: a deliberately sharper, more pronounced "lifted off the
|
|
207
|
+
// screen" shadow — tighter radius reads as a crisper edge, higher
|
|
208
|
+
// opacity/offset than Elevated's soft lv2 shadow.
|
|
209
|
+
...variant === 'inverted' ? {
|
|
210
|
+
shadowColor: '#000',
|
|
211
|
+
shadowOffset: {
|
|
212
|
+
width: 0,
|
|
213
|
+
height: 6
|
|
214
|
+
},
|
|
215
|
+
shadowOpacity: 0.11,
|
|
216
|
+
shadowRadius: 8,
|
|
217
|
+
elevation: 10
|
|
199
218
|
} : {}
|
|
200
219
|
}
|
|
201
220
|
],
|
|
202
|
-
children: /*#__PURE__*/ (0, _jsxruntime.
|
|
221
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
203
222
|
style: [
|
|
204
223
|
styles.content,
|
|
205
224
|
{
|
|
206
225
|
gap: dim.spacing.padding.sysPadding8
|
|
207
226
|
}
|
|
208
227
|
],
|
|
209
|
-
children:
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
228
|
+
children: loading ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.ActivityIndicator, {
|
|
229
|
+
size: s.iconSize,
|
|
230
|
+
color: v.label
|
|
231
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
232
|
+
children: [
|
|
233
|
+
!iconOnly && leadingIcon && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
234
|
+
style: {
|
|
235
|
+
width: s.iconSize,
|
|
236
|
+
height: s.iconSize,
|
|
237
|
+
alignItems: 'center',
|
|
238
|
+
justifyContent: 'center'
|
|
239
|
+
},
|
|
240
|
+
children: leadingIcon
|
|
241
|
+
}),
|
|
242
|
+
!iconOnly && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.Text, {
|
|
243
|
+
style: {
|
|
244
|
+
color: v.label,
|
|
245
|
+
fontSize: s.fontSize,
|
|
246
|
+
lineHeight: s.lineHeight,
|
|
247
|
+
fontWeight: '600',
|
|
248
|
+
includeFontPadding: false
|
|
249
|
+
},
|
|
250
|
+
numberOfLines: 1,
|
|
251
|
+
children: label
|
|
252
|
+
}),
|
|
253
|
+
trailingIcon && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
254
|
+
style: {
|
|
255
|
+
width: s.iconSize,
|
|
256
|
+
height: s.iconSize,
|
|
257
|
+
alignItems: 'center',
|
|
258
|
+
justifyContent: 'center'
|
|
259
|
+
},
|
|
260
|
+
children: trailingIcon
|
|
261
|
+
})
|
|
262
|
+
]
|
|
263
|
+
})
|
|
243
264
|
})
|
|
244
265
|
});
|
|
245
266
|
}
|
|
@@ -247,8 +268,7 @@ const styles = _reactnative.StyleSheet.create({
|
|
|
247
268
|
root: {
|
|
248
269
|
flexDirection: 'row',
|
|
249
270
|
justifyContent: 'center',
|
|
250
|
-
alignItems: 'center'
|
|
251
|
-
overflow: 'hidden'
|
|
271
|
+
alignItems: 'center'
|
|
252
272
|
},
|
|
253
273
|
content: {
|
|
254
274
|
flexDirection: 'row',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/react-native/src/components/Button/index.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\n\r\nimport {\r\n ActivityIndicator,\r\n Pressable,\r\n type PressableProps,\r\n StyleSheet,\r\n Text,\r\n View,\r\n} from 'react-native';\r\n\r\nimport { useTheme } from '../../theme';\r\n\r\nexport type ButtonVariant =\r\n | 'filled'\r\n | 'tonal'\r\n | 'outlined'\r\n | 'elevated'\r\n | 'text'\r\n | 'danger'\r\n | 'danger-outlined'\r\n | 'warning';\r\n\r\nexport type ButtonSize = 'sm' | 'md' | 'lg' | 'xl';\r\n\r\nexport interface ButtonProps extends Omit<\r\n PressableProps,\r\n 'children' | 'style'\r\n> {\r\n variant?: ButtonVariant;\r\n size?: ButtonSize;\r\n label: string;\r\n disabled?: boolean;\r\n loading?: boolean;\r\n fullWidth?: boolean;\r\n iconOnly?: boolean;\r\n leadingIcon?: React.ReactNode;\r\n trailingIcon?: React.ReactNode;\r\n}\r\n\r\nexport function Button({\r\n variant = 'filled',\r\n size = 'md',\r\n label,\r\n disabled = false,\r\n loading = false,\r\n fullWidth = false,\r\n iconOnly = false,\r\n leadingIcon,\r\n trailingIcon,\r\n onPress,\r\n accessibilityLabel,\r\n ...rest\r\n}: ButtonProps) {\r\n const {\r\n colorRoles: cr,\r\n dimensions: dim,\r\n typeScale: ts,\r\n iconography: ico,\r\n } = useTheme();\r\n\r\n const VARIANT_TOKENS = useMemo(\r\n () =>\r\n ({\r\n filled: {\r\n bg: cr.accent.primary.sysPrimary,\r\n label: cr.accent.primary.sysOnPrimary,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n tonal: {\r\n bg: cr.addOn.primaryFixed.sysPrimaryFixedDim,\r\n label: cr.addOn.primaryFixed.sysOnPrimaryFixed,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n outlined: {\r\n bg: 'transparent',\r\n label: cr.surface.surface.sysOnSurface,\r\n borderColor: cr.outline.sysOutline,\r\n borderWidth: dim.borderWidth.sysStrokeThin,\r\n },\r\n elevated: {\r\n bg: cr.surface.surfaceContainer.sysSurfaceContainerLowest,\r\n label: cr.surface.surface.sysOnSurface,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n text: {\r\n bg: 'transparent',\r\n label: cr.surface.surface.sysOnSurface,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n danger: {\r\n bg: cr.error.sysError,\r\n label: cr.error.sysOnError,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n 'danger-outlined': {\r\n bg: 'transparent',\r\n label: cr.error.sysError,\r\n borderColor: cr.error.sysErrorContainer,\r\n borderWidth: dim.borderWidth.sysStrokeThin,\r\n },\r\n warning: {\r\n bg: cr.custom.warning.sysWarning,\r\n label: cr.custom.warning.sysOnWarning,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n }) as Record<\r\n ButtonVariant,\r\n { bg: string; label: string; borderColor: string; borderWidth: number }\r\n >,\r\n [cr, dim],\r\n );\r\n\r\n const SIZE_TOKENS = useMemo(\r\n () => ({\r\n sm: {\r\n height: 32,\r\n paddingH: dim.spacing.padding.sysPadding12,\r\n paddingV: dim.spacing.padding.sysPadding4,\r\n fontSize: ts.labelSmall.sysFontSize,\r\n lineHeight: ts.labelSmall.sysLineHeight,\r\n iconSize: ico.sysSizeXs,\r\n },\r\n md: {\r\n height: 40,\r\n paddingH: dim.spacing.padding.sysPadding16,\r\n paddingV: dim.spacing.padding.sysPadding8,\r\n fontSize: ts.labelMedium.sysFontSize,\r\n lineHeight: ts.labelMedium.sysLineHeight,\r\n iconSize: ico.sysSizeXs,\r\n },\r\n lg: {\r\n height: 48,\r\n paddingH: dim.spacing.padding.sysPadding24,\r\n paddingV: dim.spacing.padding.sysPadding12,\r\n fontSize: ts.labelLarge.sysFontSize,\r\n lineHeight: ts.labelLarge.sysLineHeight,\r\n iconSize: ico.sysSizeSm,\r\n },\r\n xl: {\r\n height: 56,\r\n paddingH: dim.spacing.padding.sysPadding32,\r\n paddingV: dim.spacing.padding.sysPadding16,\r\n fontSize: ts.titleSmall.sysFontSize,\r\n lineHeight: ts.titleSmall.sysLineHeight,\r\n iconSize: ico.sysSizeMd,\r\n },\r\n }),\r\n [dim, ts, ico],\r\n );\r\n\r\n const v = VARIANT_TOKENS[variant];\r\n const s = SIZE_TOKENS[size];\r\n const isDisabled = disabled || loading;\r\n const paddingH = variant === 'text' ? 0 : s.paddingH;\r\n\r\n return (\r\n <Pressable\r\n {...rest}\r\n onPress={isDisabled ? undefined : onPress}\r\n accessibilityRole=\"button\"\r\n accessibilityLabel={accessibilityLabel ?? label}\r\n accessibilityState={{ disabled: isDisabled, busy: loading }}\r\n style={({ pressed }) => [\r\n styles.root,\r\n {\r\n backgroundColor: v.bg,\r\n borderColor: v.borderColor,\r\n borderWidth: v.borderWidth,\r\n borderRadius: dim.borderRadius.sysRadiusFull,\r\n ...(iconOnly\r\n ? { width: s.height, height: s.height }\r\n : variant === 'text'\r\n ? {\r\n // Text variant is content-height (no fixed container). Figma:\r\n // sm=26px, md=28px, lg=31px, xl=32px — each resolves to\r\n // lineHeight + 2×paddingV, not the standard fixed height.\r\n paddingHorizontal: 0,\r\n paddingVertical: s.paddingV,\r\n }\r\n : {\r\n height: s.height,\r\n paddingHorizontal: paddingH,\r\n paddingVertical: s.paddingV,\r\n }),\r\n ...(fullWidth && !iconOnly ? { alignSelf: 'stretch' } : {}),\r\n opacity: isDisabled ? 0.48 : pressed ? 0.82 : 1,\r\n // Elevated: Figma specifies two drop shadows — RN only supports one\r\n // on iOS, so we use the larger/more visible one (lv2: 0px 4px 16px\r\n // rgba(0,0,0,0.10)) and fall back to elevation: 2 on Android.\r\n ...(variant === 'elevated'\r\n ? {\r\n shadowColor: '#000',\r\n shadowOffset: { width: 0, height: 4 },\r\n shadowOpacity: 0.1,\r\n shadowRadius: 16,\r\n elevation: 2,\r\n }\r\n : {}),\r\n },\r\n ]}\r\n >\r\n <View style={[styles.content, { gap: dim.spacing.padding.sysPadding8 }]}>\r\n {loading ? (\r\n <ActivityIndicator size={s.iconSize} color={v.label} />\r\n ) : leadingIcon ? (\r\n <View\r\n style={{\r\n width: s.iconSize,\r\n height: s.iconSize,\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n }}\r\n >\r\n {leadingIcon}\r\n </View>\r\n ) : null}\r\n\r\n {!iconOnly && (\r\n <Text\r\n style={{\r\n color: v.label,\r\n fontSize: s.fontSize,\r\n lineHeight: s.lineHeight,\r\n fontWeight: '600',\r\n includeFontPadding: false,\r\n }}\r\n numberOfLines={1}\r\n >\r\n {label}\r\n </Text>\r\n )}\r\n\r\n {trailingIcon && (\r\n <View\r\n style={{\r\n width: s.iconSize,\r\n height: s.iconSize,\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n }}\r\n >\r\n {trailingIcon}\r\n </View>\r\n )}\r\n </View>\r\n </Pressable>\r\n );\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n root: {\r\n flexDirection: 'row',\r\n justifyContent: 'center',\r\n alignItems: 'center',\r\n overflow: 'hidden',\r\n },\r\n content: {\r\n flexDirection: 'row',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n },\r\n});\r\n"],"names":["Button","variant","size","label","disabled","loading","fullWidth","iconOnly","leadingIcon","trailingIcon","onPress","accessibilityLabel","rest","colorRoles","cr","dimensions","dim","typeScale","ts","iconography","ico","useTheme","VARIANT_TOKENS","useMemo","filled","bg","accent","primary","sysPrimary","sysOnPrimary","borderColor","borderWidth","tonal","addOn","primaryFixed","sysPrimaryFixedDim","sysOnPrimaryFixed","outlined","surface","sysOnSurface","outline","sysOutline","sysStrokeThin","elevated","surfaceContainer","sysSurfaceContainerLowest","text","danger","error","sysError","sysOnError","sysErrorContainer","warning","custom","sysWarning","sysOnWarning","SIZE_TOKENS","sm","height","paddingH","spacing","padding","sysPadding12","paddingV","sysPadding4","fontSize","labelSmall","sysFontSize","lineHeight","sysLineHeight","iconSize","sysSizeXs","md","sysPadding16","sysPadding8","labelMedium","lg","sysPadding24","labelLarge","sysSizeSm","xl","sysPadding32","titleSmall","sysSizeMd","v","s","isDisabled","Pressable","undefined","accessibilityRole","accessibilityState","busy","style","pressed","styles","root","backgroundColor","borderRadius","sysRadiusFull","width","paddingHorizontal","paddingVertical","alignSelf","opacity","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","View","content","gap","ActivityIndicator","color","alignItems","justifyContent","Text","fontWeight","includeFontPadding","numberOfLines","StyleSheet","create","flexDirection","overflow"],"mappings":";;;;+BAwCgBA;;;eAAAA;;;;+DAxCe;6BASxB;uBAEkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BlB,SAASA,OAAO,EACrBC,UAAU,QAAQ,EAClBC,OAAO,IAAI,EACXC,KAAK,EACLC,WAAW,KAAK,EAChBC,UAAU,KAAK,EACfC,YAAY,KAAK,EACjBC,WAAW,KAAK,EAChBC,WAAW,EACXC,YAAY,EACZC,OAAO,EACPC,kBAAkB,EAClB,GAAGC,MACS;IACZ,MAAM,EACJC,YAAYC,EAAE,EACdC,YAAYC,GAAG,EACfC,WAAWC,EAAE,EACbC,aAAaC,GAAG,EACjB,GAAGC,IAAAA,eAAQ;IAEZ,MAAMC,iBAAiBC,IAAAA,cAAO,EAC5B,IACG,CAAA;YACCC,QAAQ;gBACNC,IAAIX,GAAGY,MAAM,CAACC,OAAO,CAACC,UAAU;gBAChCzB,OAAOW,GAAGY,MAAM,CAACC,OAAO,CAACE,YAAY;gBACrCC,aAAa;gBACbC,aAAa;YACf;YACAC,OAAO;gBACLP,IAAIX,GAAGmB,KAAK,CAACC,YAAY,CAACC,kBAAkB;gBAC5ChC,OAAOW,GAAGmB,KAAK,CAACC,YAAY,CAACE,iBAAiB;gBAC9CN,aAAa;gBACbC,aAAa;YACf;YACAM,UAAU;gBACRZ,IAAI;gBACJtB,OAAOW,GAAGwB,OAAO,CAACA,OAAO,CAACC,YAAY;gBACtCT,aAAahB,GAAG0B,OAAO,CAACC,UAAU;gBAClCV,aAAaf,IAAIe,WAAW,CAACW,aAAa;YAC5C;YACAC,UAAU;gBACRlB,IAAIX,GAAGwB,OAAO,CAACM,gBAAgB,CAACC,yBAAyB;gBACzD1C,OAAOW,GAAGwB,OAAO,CAACA,OAAO,CAACC,YAAY;gBACtCT,aAAa;gBACbC,aAAa;Y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AAEf,QAAQ;wBAClB4C,YAAY;wBACZC,gBAAgB;oBAClB;8BAEC1G;;;;;AAMb;AAEA,MAAMqF,SAAS0B,uBAAU,CAACC,MAAM,CAAC;IAC/B1B,MAAM;QACJ2B,eAAe;QACfP,gBAAgB;QAChBD,YAAY;QACZS,UAAU;IACZ;IACAb,SAAS;QACPY,eAAe;QACfR,YAAY;QACZC,gBAAgB;IAClB;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/react-native/src/components/Button/index.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\n\r\nimport {\r\n ActivityIndicator,\r\n Pressable,\r\n type PressableProps,\r\n StyleSheet,\r\n Text,\r\n View,\r\n} from 'react-native';\r\n\r\nimport { useTheme } from '../../theme';\r\n\r\nexport type ButtonVariant =\r\n | 'filled'\r\n | 'tonal'\r\n | 'outlined'\r\n | 'elevated'\r\n | 'inverted'\r\n | 'text'\r\n | 'danger'\r\n | 'danger-outlined'\r\n | 'warning';\r\n\r\nexport type ButtonSize = 'sm' | 'md' | 'lg' | 'xl';\r\n\r\nexport interface ButtonProps extends Omit<\r\n PressableProps,\r\n 'children' | 'style'\r\n> {\r\n variant?: ButtonVariant;\r\n size?: ButtonSize;\r\n label: string;\r\n disabled?: boolean;\r\n loading?: boolean;\r\n fullWidth?: boolean;\r\n iconOnly?: boolean;\r\n leadingIcon?: React.ReactNode;\r\n trailingIcon?: React.ReactNode;\r\n}\r\n\r\nexport function Button({\r\n variant = 'filled',\r\n size = 'md',\r\n label,\r\n disabled = false,\r\n loading = false,\r\n fullWidth = false,\r\n iconOnly = false,\r\n leadingIcon,\r\n trailingIcon,\r\n onPress,\r\n accessibilityLabel,\r\n ...rest\r\n}: ButtonProps) {\r\n const {\r\n colorRoles: cr,\r\n dimensions: dim,\r\n typeScale: ts,\r\n iconography: ico,\r\n } = useTheme();\r\n\r\n const VARIANT_TOKENS = useMemo(\r\n () =>\r\n ({\r\n filled: {\r\n bg: cr.accent.primary.sysPrimary,\r\n label: cr.accent.primary.sysOnPrimary,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n tonal: {\r\n bg: cr.addOn.primaryFixed.sysPrimaryFixedDim,\r\n label: cr.addOn.primaryFixed.sysOnPrimaryFixed,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n outlined: {\r\n bg: 'transparent',\r\n label: cr.surface.surface.sysOnSurface,\r\n borderColor: cr.outline.sysOutline,\r\n borderWidth: dim.borderWidth.sysStrokeThin,\r\n },\r\n elevated: {\r\n bg: cr.surface.surfaceContainer.sysSurfaceContainerLowest,\r\n label: cr.surface.surface.sysOnSurface,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n inverted: {\r\n bg: cr.accent.primary.sysOnPrimary,\r\n label: cr.surface.surface.sysOnSurface,\r\n borderColor: cr.outline.sysOutline,\r\n borderWidth: dim.borderWidth.sysStrokeThin,\r\n },\r\n text: {\r\n bg: 'transparent',\r\n label: cr.surface.surface.sysOnSurface,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n danger: {\r\n bg: cr.error.sysError,\r\n label: cr.error.sysOnError,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n 'danger-outlined': {\r\n bg: 'transparent',\r\n label: cr.error.sysError,\r\n borderColor: cr.error.sysErrorContainer,\r\n borderWidth: dim.borderWidth.sysStrokeThin,\r\n },\r\n warning: {\r\n bg: cr.custom.warning.sysWarning,\r\n label: cr.custom.warning.sysOnWarning,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n }) as Record<\r\n ButtonVariant,\r\n { bg: string; label: string; borderColor: string; borderWidth: number }\r\n >,\r\n [cr, dim],\r\n );\r\n\r\n const SIZE_TOKENS = useMemo(\r\n () => ({\r\n sm: {\r\n height: 32,\r\n paddingH: dim.spacing.padding.sysPadding12,\r\n paddingV: dim.spacing.padding.sysPadding4,\r\n fontSize: ts.labelSmall.sysFontSize,\r\n lineHeight: ts.labelSmall.sysLineHeight,\r\n iconSize: ico.sysSizeXs,\r\n },\r\n md: {\r\n height: 40,\r\n paddingH: dim.spacing.padding.sysPadding16,\r\n paddingV: dim.spacing.padding.sysPadding8,\r\n fontSize: ts.labelMedium.sysFontSize,\r\n lineHeight: ts.labelMedium.sysLineHeight,\r\n iconSize: ico.sysSizeXs,\r\n },\r\n lg: {\r\n height: 48,\r\n paddingH: dim.spacing.padding.sysPadding24,\r\n paddingV: dim.spacing.padding.sysPadding12,\r\n fontSize: ts.labelLarge.sysFontSize,\r\n lineHeight: ts.labelLarge.sysLineHeight,\r\n iconSize: ico.sysSizeSm,\r\n },\r\n xl: {\r\n height: 56,\r\n paddingH: dim.spacing.padding.sysPadding32,\r\n paddingV: dim.spacing.padding.sysPadding16,\r\n fontSize: ts.titleSmall.sysFontSize,\r\n lineHeight: ts.titleSmall.sysLineHeight,\r\n iconSize: ico.sysSizeMd,\r\n },\r\n }),\r\n [dim, ts, ico],\r\n );\r\n\r\n const v = VARIANT_TOKENS[variant];\r\n const s = SIZE_TOKENS[size];\r\n const isDisabled = disabled || loading;\r\n const paddingH = variant === 'text' ? 0 : s.paddingH;\r\n\r\n return (\r\n <Pressable\r\n {...rest}\r\n onPress={isDisabled ? undefined : onPress}\r\n accessibilityRole=\"button\"\r\n accessibilityLabel={accessibilityLabel ?? label}\r\n accessibilityState={{ disabled: isDisabled, busy: loading }}\r\n style={({ pressed }) => [\r\n styles.root,\r\n {\r\n backgroundColor: v.bg,\r\n borderColor: v.borderColor,\r\n borderWidth: v.borderWidth,\r\n borderRadius: dim.borderRadius.sysRadiusFull,\r\n ...(iconOnly\r\n ? { width: s.height, height: s.height }\r\n : variant === 'text'\r\n ? {\r\n // Text variant is content-height (no fixed container). Figma:\r\n // sm=26px, md=28px, lg=31px, xl=32px — each resolves to\r\n // lineHeight + 2×paddingV, not the standard fixed height.\r\n paddingHorizontal: 0,\r\n paddingVertical: s.paddingV,\r\n }\r\n : {\r\n height: s.height,\r\n paddingHorizontal: paddingH,\r\n paddingVertical: s.paddingV,\r\n }),\r\n ...(fullWidth && !iconOnly ? { alignSelf: 'stretch' } : {}),\r\n opacity: isDisabled ? 0.48 : pressed ? 0.82 : 1,\r\n // Elevated: Figma specifies two drop shadows — RN only supports one\r\n // on iOS, so we use the larger/more visible one (lv2: 0px 4px 16px\r\n // rgba(0,0,0,0.10)) and fall back to elevation: 2 on Android.\r\n ...(variant === 'elevated'\r\n ? {\r\n shadowColor: '#000',\r\n shadowOffset: { width: 0, height: 4 },\r\n shadowOpacity: 0.1,\r\n shadowRadius: 16,\r\n elevation: 2,\r\n }\r\n : {}),\r\n // Inverted: a deliberately sharper, more pronounced \"lifted off the\r\n // screen\" shadow — tighter radius reads as a crisper edge, higher\r\n // opacity/offset than Elevated's soft lv2 shadow.\r\n ...(variant === 'inverted'\r\n ? {\r\n shadowColor: '#000',\r\n shadowOffset: { width: 0, height: 6 },\r\n shadowOpacity: 0.11,\r\n shadowRadius: 8,\r\n elevation: 10,\r\n }\r\n : {}),\r\n },\r\n ]}\r\n >\r\n <View style={[styles.content, { gap: dim.spacing.padding.sysPadding8 }]}>\r\n {loading ? (\r\n <ActivityIndicator size={s.iconSize} color={v.label} />\r\n ) : (\r\n <>\r\n {!iconOnly && leadingIcon && (\r\n <View\r\n style={{\r\n width: s.iconSize,\r\n height: s.iconSize,\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n }}\r\n >\r\n {leadingIcon}\r\n </View>\r\n )}\r\n {!iconOnly && (\r\n <Text\r\n style={{\r\n color: v.label,\r\n fontSize: s.fontSize,\r\n lineHeight: s.lineHeight,\r\n fontWeight: '600',\r\n includeFontPadding: false,\r\n }}\r\n numberOfLines={1}\r\n >\r\n {label}\r\n </Text>\r\n )}\r\n {trailingIcon && (\r\n <View\r\n style={{\r\n width: s.iconSize,\r\n height: s.iconSize,\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n }}\r\n >\r\n {trailingIcon}\r\n </View>\r\n )}\r\n </>\r\n )}\r\n </View>\r\n </Pressable>\r\n );\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n root: {\r\n flexDirection: 'row',\r\n justifyContent: 'center',\r\n alignItems: 'center',\r\n // No overflow: 'hidden' here — on iOS that clips to bounds, which cuts\r\n // off the elevated/inverted drop shadow (shadows render outside the\r\n // layer's frame). Background/border-radius already render correctly\r\n // rounded without it, and this button's content (icon + text) never\r\n // overflows its own corners.\r\n },\r\n content: {\r\n flexDirection: 'row',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n },\r\n});\r\n"],"names":["Button","variant","size","label","disabled","loading","fullWidth","iconOnly","leadingIcon","trailingIcon","onPress","accessibilityLabel","rest","colorRoles","cr","dimensions","dim","typeScale","ts","iconography","ico","useTheme","VARIANT_TOKENS","useMemo","filled","bg","accent","primary","sysPrimary","sysOnPrimary","borderColor","borderWidth","tonal","addOn","primaryFixed","sysPrimaryFixedDim","sysOnPrimaryFixed","outlined","surface","sysOnSurface","outline","sysOutline","sysStrokeThin","elevated","surfaceContainer","sysSurfaceContainerLowest","inverted","text","danger","error","sysError","sysOnError","sysErrorContainer","warning","custom","sysWarning","sysOnWarning","SIZE_TOKENS","sm","height","paddingH","spacing","padding","sysPadding12","paddingV","sysPadding4","fontSize","labelSmall","sysFontSize","lineHeight","sysLineHeight","iconSize","sysSizeXs","md","sysPadding16","sysPadding8","labelMedium","lg","sysPadding24","labelLarge","sysSizeSm","xl","sysPadding32","titleSmall","sysSizeMd","v","s","isDisabled","Pressable","undefined","accessibilityRole","accessibilityState","busy","style","pressed","styles","root","backgroundColor","borderRadius","sysRadiusFull","width","paddingHorizontal","paddingVertical","alignSelf","opacity","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","View","content","gap","ActivityIndicator","color","alignItems","justifyContent","Text","fontWeight","includeFontPadding","numberOfLines","StyleSheet","create","flexDirection"],"mappings":";;;;+BAyCgBA;;;eAAAA;;;;+DAzCe;6BASxB;uBAEkB;;;;;;;;;;;;;;;;;;;;;;;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ACLqB,OAAO7B,EAAElF,KAAK;4BACd+D,UAAUoB,EAAEpB,QAAQ;4BACpBG,YAAYiB,EAAEjB,UAAU;4BACxBiD,YAAY;4BACZC,oBAAoB;wBACtB;wBACAC,eAAe;kCAEdrH;;oBAGJM,8BACC,qBAACqG,iBAAI;wBACHjB,OAAO;4BACLO,OAAOd,EAAEf,QAAQ;4BACjBZ,QAAQ2B,EAAEf,QAAQ;4BAClB4C,YAAY;4BACZC,gBAAgB;wBAClB;kCAEC3G;;;;;;AAQjB;AAEA,MAAMsF,SAAS0B,uBAAU,CAACC,MAAM,CAAC;IAC/B1B,MAAM;QACJ2B,eAAe;QACfP,gBAAgB;QAChBD,YAAY;IAMd;IACAJ,SAAS;QACPY,eAAe;QACfR,YAAY;QACZC,gBAAgB;IAClB;AACF"}
|
|
@@ -60,19 +60,21 @@ function ChatBubble({ variant, message, timestamp, onThumbsUp, onThumbsDown, sty
|
|
|
60
60
|
const isOutgoing = variant === 'outgoing';
|
|
61
61
|
const tokenStyles = (0, _react.useMemo)(()=>({
|
|
62
62
|
bubble: {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
paddingHorizontal: dim.spacing.padding.sysPadding12,
|
|
66
|
-
borderRadius: dim.borderRadius.sysRadiusMd
|
|
63
|
+
paddingVertical: dim.spacing.padding.sysPadding12,
|
|
64
|
+
paddingHorizontal: dim.spacing.padding.sysPadding16
|
|
67
65
|
},
|
|
68
66
|
bubbleIncoming: {
|
|
69
|
-
backgroundColor: cr.surface.surfaceContainer.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
borderBottomLeftRadius: dim.borderRadius.sysRadiusXs
|
|
67
|
+
backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainer,
|
|
68
|
+
borderTopLeftRadius: dim.borderRadius.sysRadiusLg,
|
|
69
|
+
borderTopRightRadius: dim.borderRadius.sysRadiusLg,
|
|
70
|
+
borderBottomLeftRadius: dim.borderRadius.sysRadiusXs,
|
|
71
|
+
borderBottomRightRadius: dim.borderRadius.sysRadiusXs
|
|
73
72
|
},
|
|
74
73
|
bubbleOutgoing: {
|
|
75
74
|
backgroundColor: cr.accent.primary.sysPrimary,
|
|
75
|
+
borderTopLeftRadius: dim.borderRadius.sysRadiusXl,
|
|
76
|
+
borderTopRightRadius: dim.borderRadius.sysRadiusXl,
|
|
77
|
+
borderBottomLeftRadius: dim.borderRadius.sysRadiusXl,
|
|
76
78
|
borderBottomRightRadius: dim.borderRadius.sysRadiusXs
|
|
77
79
|
},
|
|
78
80
|
metaRow: {
|
|
@@ -99,6 +101,7 @@ function ChatBubble({ variant, message, timestamp, onThumbsUp, onThumbsDown, sty
|
|
|
99
101
|
style
|
|
100
102
|
],
|
|
101
103
|
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.View, {
|
|
104
|
+
style: styles.bubbleWrapper,
|
|
102
105
|
children: [
|
|
103
106
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
104
107
|
style: [
|
|
@@ -108,7 +111,6 @@ function ChatBubble({ variant, message, timestamp, onThumbsUp, onThumbsDown, sty
|
|
|
108
111
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_BodyText.BodyText, {
|
|
109
112
|
variant: "medium",
|
|
110
113
|
color: textColor,
|
|
111
|
-
style: styles.messageText,
|
|
112
114
|
children: message
|
|
113
115
|
})
|
|
114
116
|
}),
|
|
@@ -167,10 +169,12 @@ const styles = _reactnative.StyleSheet.create({
|
|
|
167
169
|
width: '100%'
|
|
168
170
|
},
|
|
169
171
|
rowIncoming: {
|
|
170
|
-
justifyContent: 'flex-start'
|
|
172
|
+
justifyContent: 'flex-start',
|
|
173
|
+
paddingRight: 64
|
|
171
174
|
},
|
|
172
175
|
rowOutgoing: {
|
|
173
|
-
justifyContent: 'flex-end'
|
|
176
|
+
justifyContent: 'flex-end',
|
|
177
|
+
paddingLeft: 32
|
|
174
178
|
},
|
|
175
179
|
metaIncoming: {
|
|
176
180
|
justifyContent: 'flex-start'
|
|
@@ -178,9 +182,7 @@ const styles = _reactnative.StyleSheet.create({
|
|
|
178
182
|
metaOutgoing: {
|
|
179
183
|
justifyContent: 'flex-end'
|
|
180
184
|
},
|
|
181
|
-
|
|
182
|
-
flexShrink: 1
|
|
183
|
-
},
|
|
185
|
+
bubbleWrapper: {},
|
|
184
186
|
pressed: {
|
|
185
187
|
opacity: 0.6
|
|
186
188
|
}
|