@compsych-ui-components/react-native 4.0.4 → 4.0.13
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 +22 -14
- package/src/components/ActionSheet/index.d.ts +16 -0
- package/src/components/ActionSheet/index.js +256 -0
- package/src/components/ActionSheet/index.js.map +1 -0
- package/src/components/Alert/index.d.ts +24 -0
- package/src/components/Alert/index.js +304 -0
- package/src/components/Alert/index.js.map +1 -0
- package/src/components/Avatar/index.d.ts +22 -0
- package/src/components/Avatar/index.js +253 -0
- package/src/components/Avatar/index.js.map +1 -0
- package/src/components/Badge/index.d.ts +12 -0
- package/src/components/Badge/index.js +206 -0
- package/src/components/Badge/index.js.map +1 -0
- package/src/components/BodyText/index.d.ts +9 -0
- package/src/components/BodyText/index.js +58 -0
- package/src/components/BodyText/index.js.map +1 -0
- package/src/components/Breadcrumb/index.d.ts +24 -0
- package/src/components/Breadcrumb/index.js +194 -0
- package/src/components/Breadcrumb/index.js.map +1 -0
- package/src/components/Button/index.d.ts +16 -0
- package/src/components/Button/index.js +260 -0
- package/src/components/Button/index.js.map +1 -0
- package/src/components/Checkbox/index.d.ts +16 -0
- package/src/components/Checkbox/index.js +196 -0
- package/src/components/Checkbox/index.js.map +1 -0
- package/src/components/Chip/index.d.ts +18 -0
- package/src/components/Chip/index.js +280 -0
- package/src/components/Chip/index.js.map +1 -0
- package/src/components/Divider/index.d.ts +11 -0
- package/src/components/Divider/index.js +59 -0
- package/src/components/Divider/index.js.map +1 -0
- package/src/components/EmptyState/index.d.ts +25 -0
- package/src/components/EmptyState/index.js +376 -0
- package/src/components/EmptyState/index.js.map +1 -0
- package/src/components/HeaderText/index.d.ts +9 -0
- package/src/components/HeaderText/index.js +62 -0
- package/src/components/HeaderText/index.js.map +1 -0
- package/src/components/Input/index.d.ts +13 -0
- package/src/components/Input/index.js +231 -0
- package/src/components/Input/index.js.map +1 -0
- package/src/components/List/index.d.ts +19 -0
- package/src/components/List/index.js +170 -0
- package/src/components/List/index.js.map +1 -0
- package/src/components/Pagination/index.d.ts +15 -0
- package/src/components/Pagination/index.js +322 -0
- package/src/components/Pagination/index.js.map +1 -0
- package/src/components/PlanCard/index.d.ts +27 -0
- package/src/components/PlanCard/index.js +364 -0
- package/src/components/PlanCard/index.js.map +1 -0
- package/src/components/ProgressTracker/index.d.ts +26 -0
- package/src/components/ProgressTracker/index.js +180 -0
- package/src/components/ProgressTracker/index.js.map +1 -0
- package/src/components/PromotionCard/index.d.ts +23 -0
- package/src/components/PromotionCard/index.js +496 -0
- package/src/components/PromotionCard/index.js.map +1 -0
- package/src/components/RadioButton/index.d.ts +15 -0
- package/src/components/RadioButton/index.js +188 -0
- package/src/components/RadioButton/index.js.map +1 -0
- package/src/components/ScreenContainer/index.d.ts +15 -0
- package/src/components/ScreenContainer/index.js +43 -0
- package/src/components/ScreenContainer/index.js.map +1 -0
- package/src/components/SegmentedControl/index.d.ts +16 -0
- package/src/components/SegmentedControl/index.js +115 -0
- package/src/components/SegmentedControl/index.js.map +1 -0
- package/src/components/SelectionCard/index.d.ts +16 -0
- package/src/components/SelectionCard/index.js +222 -0
- package/src/components/SelectionCard/index.js.map +1 -0
- package/src/components/ServiceCard/index.d.ts +22 -0
- package/src/components/ServiceCard/index.js +385 -0
- package/src/components/ServiceCard/index.js.map +1 -0
- package/src/components/Slider/index.d.ts +24 -0
- package/src/components/Slider/index.js +320 -0
- package/src/components/Slider/index.js.map +1 -0
- package/src/components/Snackbar/index.d.ts +13 -0
- package/src/components/Snackbar/index.js +229 -0
- package/src/components/Snackbar/index.js.map +1 -0
- package/src/components/Switch/index.d.ts +14 -0
- package/src/components/Switch/index.js +221 -0
- package/src/components/Switch/index.js.map +1 -0
- package/src/components/Tooltip/index.d.ts +21 -0
- package/src/components/Tooltip/index.js +206 -0
- package/src/components/Tooltip/index.js.map +1 -0
- package/src/icons/AtomIcon.d.ts +2 -0
- package/src/icons/AtomIcon.js +85 -0
- package/src/icons/AtomIcon.js.map +1 -0
- package/src/icons/BinocularsIcon.d.ts +2 -0
- package/src/icons/BinocularsIcon.js +103 -0
- package/src/icons/BinocularsIcon.js.map +1 -0
- package/src/icons/FileChartColumnIncreasingIcon.d.ts +2 -0
- package/src/icons/FileChartColumnIncreasingIcon.js +97 -0
- package/src/icons/FileChartColumnIncreasingIcon.js.map +1 -0
- package/src/icons/FlagIcon.d.ts +2 -0
- package/src/icons/FlagIcon.js +71 -0
- package/src/icons/FlagIcon.js.map +1 -0
- package/src/icons/GlobeIcon.d.ts +2 -0
- package/src/icons/GlobeIcon.js +71 -0
- package/src/icons/GlobeIcon.js.map +1 -0
- package/src/icons/GraduationCapIcon.d.ts +2 -0
- package/src/icons/GraduationCapIcon.js +85 -0
- package/src/icons/GraduationCapIcon.js.map +1 -0
- package/src/icons/HandHeartIcon.d.ts +2 -0
- package/src/icons/HandHeartIcon.js +91 -0
- package/src/icons/HandHeartIcon.js.map +1 -0
- package/src/icons/HandshakeIcon.d.ts +2 -0
- package/src/icons/HandshakeIcon.js +97 -0
- package/src/icons/HandshakeIcon.js.map +1 -0
- package/src/icons/HazeIcon.d.ts +2 -0
- package/src/icons/HazeIcon.js +115 -0
- package/src/icons/HazeIcon.js.map +1 -0
- package/src/icons/HeartHandshakeIcon.d.ts +2 -0
- package/src/icons/HeartHandshakeIcon.js +71 -0
- package/src/icons/HeartHandshakeIcon.js.map +1 -0
- package/src/icons/HourglassIcon.d.ts +2 -0
- package/src/icons/HourglassIcon.js +91 -0
- package/src/icons/HourglassIcon.js.map +1 -0
- package/src/icons/IdCardIcon.d.ts +2 -0
- package/src/icons/IdCardIcon.js +97 -0
- package/src/icons/IdCardIcon.js.map +1 -0
- package/src/icons/MessageCirclePlusIcon.d.ts +2 -0
- package/src/icons/MessageCirclePlusIcon.js +85 -0
- package/src/icons/MessageCirclePlusIcon.js.map +1 -0
- package/src/icons/MountainSnowIcon.d.ts +2 -0
- package/src/icons/MountainSnowIcon.js +79 -0
- package/src/icons/MountainSnowIcon.js.map +1 -0
- package/src/icons/SnowflakeIcon.d.ts +2 -0
- package/src/icons/SnowflakeIcon.js +139 -0
- package/src/icons/SnowflakeIcon.js.map +1 -0
- package/src/icons/StethoscopeIcon.d.ts +2 -0
- package/src/icons/StethoscopeIcon.js +97 -0
- package/src/icons/StethoscopeIcon.js.map +1 -0
- package/src/icons/UserRoundIcon.d.ts +2 -0
- package/src/icons/UserRoundIcon.js +79 -0
- package/src/icons/UserRoundIcon.js.map +1 -0
- package/src/icons/WheatIcon.d.ts +2 -0
- package/src/icons/WheatIcon.js +115 -0
- package/src/icons/WheatIcon.js.map +1 -0
- package/src/icons/index.d.ts +22 -0
- package/src/icons/index.js +109 -0
- package/src/icons/index.js.map +1 -0
- package/src/icons/types.d.ts +16 -0
- package/src/icons/types.js +52 -0
- package/src/icons/types.js.map +1 -0
- package/src/index.d.ts +60 -2
- package/src/index.js +197 -5
- package/src/index.js.map +1 -1
- package/src/theme/ThemeContext.d.ts +258 -0
- package/src/theme/ThemeContext.js +15 -0
- package/src/theme/ThemeContext.js.map +1 -0
- package/src/theme/ThemeProvider.d.ts +27 -0
- package/src/theme/ThemeProvider.js +66 -0
- package/src/theme/ThemeProvider.js.map +1 -0
- package/src/theme/defaultTheme.d.ts +13 -0
- package/src/theme/defaultTheme.js +14 -0
- package/src/theme/defaultTheme.js.map +1 -0
- package/src/theme/index.d.ts +5 -0
- package/src/theme/index.js +26 -0
- package/src/theme/index.js.map +1 -0
- package/src/theme/mergeTheme.d.ts +7 -0
- package/src/theme/mergeTheme.js +40 -0
- package/src/theme/mergeTheme.js.map +1 -0
- package/src/theme/types.d.ts +25 -0
- package/src/theme/types.js +6 -0
- package/src/theme/types.js.map +1 -0
- package/src/theme/useTheme.d.ts +10 -0
- package/src/theme/useTheme.js +17 -0
- package/src/theme/useTheme.js.map +1 -0
- package/src/tokens.d.ts +253 -0
- package/src/tokens.js +265 -0
- package/src/tokens.js.map +1 -0
- package/src/lib/button.d.ts +0 -7
- package/src/lib/button.js +0 -58
- package/src/lib/button.js.map +0 -1
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "Input", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return Input;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
13
|
+
const _reactnative = require("react-native");
|
|
14
|
+
const _theme = require("../../theme");
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
16
|
+
if (typeof WeakMap !== "function") return null;
|
|
17
|
+
var cacheBabelInterop = new WeakMap();
|
|
18
|
+
var cacheNodeInterop = new WeakMap();
|
|
19
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
20
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
21
|
+
})(nodeInterop);
|
|
22
|
+
}
|
|
23
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
24
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
25
|
+
return obj;
|
|
26
|
+
}
|
|
27
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
28
|
+
return {
|
|
29
|
+
default: obj
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
33
|
+
if (cache && cache.has(obj)) {
|
|
34
|
+
return cache.get(obj);
|
|
35
|
+
}
|
|
36
|
+
var newObj = {
|
|
37
|
+
__proto__: null
|
|
38
|
+
};
|
|
39
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
40
|
+
for(var key in obj){
|
|
41
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
42
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
43
|
+
if (desc && (desc.get || desc.set)) {
|
|
44
|
+
Object.defineProperty(newObj, key, desc);
|
|
45
|
+
} else {
|
|
46
|
+
newObj[key] = obj[key];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
newObj.default = obj;
|
|
51
|
+
if (cache) {
|
|
52
|
+
cache.set(obj, newObj);
|
|
53
|
+
}
|
|
54
|
+
return newObj;
|
|
55
|
+
}
|
|
56
|
+
// Focus-ring halo: 4px spread, sysPrimary08 colour — achieved with a fixed
|
|
57
|
+
// 4px-padded wrapper whose background switches on focus.
|
|
58
|
+
const RING_SIZE = 4;
|
|
59
|
+
function Input({ size = 'md', label, helperText, errorText, invalid = false, leadingIcon, trailingIcon, editable = true, onFocus, onBlur, ...rest }) {
|
|
60
|
+
const { colorRoles: cr, dimensions: dim, typeScale: ts } = (0, _theme.useTheme)();
|
|
61
|
+
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
62
|
+
const SIZE_TOKENS = (0, _react.useMemo)(()=>({
|
|
63
|
+
sm: {
|
|
64
|
+
height: 40,
|
|
65
|
+
paddingH: dim.spacing.padding.sysPadding12,
|
|
66
|
+
paddingV: dim.spacing.padding.sysPadding8,
|
|
67
|
+
gap: dim.spacing.padding.sysPadding4,
|
|
68
|
+
fontSize: ts.bodySmall.sysFontSize,
|
|
69
|
+
lineHeight: ts.bodySmall.sysLineHeight,
|
|
70
|
+
radius: dim.borderRadius.sysRadiusSm,
|
|
71
|
+
iconSize: 20
|
|
72
|
+
},
|
|
73
|
+
md: {
|
|
74
|
+
height: 48,
|
|
75
|
+
paddingH: dim.spacing.padding.sysPadding16,
|
|
76
|
+
paddingV: dim.spacing.padding.sysPadding12,
|
|
77
|
+
gap: dim.spacing.padding.sysPadding8,
|
|
78
|
+
fontSize: ts.bodyMedium.sysFontSize,
|
|
79
|
+
lineHeight: ts.bodyMedium.sysLineHeight,
|
|
80
|
+
radius: dim.borderRadius.sysRadiusSm,
|
|
81
|
+
iconSize: 20
|
|
82
|
+
},
|
|
83
|
+
lg: {
|
|
84
|
+
height: 56,
|
|
85
|
+
paddingH: dim.spacing.padding.sysPadding20,
|
|
86
|
+
paddingV: dim.spacing.padding.sysPadding16,
|
|
87
|
+
gap: dim.spacing.padding.sysPadding8,
|
|
88
|
+
fontSize: ts.bodyMedium.sysFontSize,
|
|
89
|
+
lineHeight: ts.bodyMedium.sysLineHeight,
|
|
90
|
+
radius: dim.borderRadius.sysRadiusMd,
|
|
91
|
+
iconSize: 20
|
|
92
|
+
}
|
|
93
|
+
}), [
|
|
94
|
+
dim,
|
|
95
|
+
ts
|
|
96
|
+
]);
|
|
97
|
+
const s = SIZE_TOKENS[size];
|
|
98
|
+
const isDisabled = editable === false;
|
|
99
|
+
const hasError = invalid || !!errorText;
|
|
100
|
+
// ── Border ──────────────────────────────────────────────────────────────
|
|
101
|
+
const borderWidth = isFocused || hasError ? dim.borderWidth.sysStrokeMedium : dim.borderWidth.sysStrokeThin;
|
|
102
|
+
const borderColor = hasError ? cr.error.sysError : isFocused ? cr.accent.primary.sysPrimary : cr.outline.sysOutlineVariant;
|
|
103
|
+
// ── Text colours ─────────────────────────────────────────────────────────
|
|
104
|
+
const textColor = cr.surface.surface.sysOnSurface;
|
|
105
|
+
const placeholderColor = cr.surface.surface.sysOnSurfaceVariant;
|
|
106
|
+
// ── Helper / error text ──────────────────────────────────────────────────
|
|
107
|
+
const supportingText = errorText ?? helperText;
|
|
108
|
+
const supportingColor = hasError ? cr.error.sysError : cr.surface.surface.sysOnSurfaceVariant;
|
|
109
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.View, {
|
|
110
|
+
style: [
|
|
111
|
+
styles.wrapper,
|
|
112
|
+
isDisabled && styles.disabled
|
|
113
|
+
],
|
|
114
|
+
children: [
|
|
115
|
+
label && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.Text, {
|
|
116
|
+
style: [
|
|
117
|
+
styles.label,
|
|
118
|
+
{
|
|
119
|
+
color: hasError ? cr.error.sysError : cr.surface.surface.sysOnSurfaceVariant,
|
|
120
|
+
fontSize: ts.labelMedium.sysFontSize,
|
|
121
|
+
lineHeight: ts.labelMedium.sysLineHeight
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
children: label
|
|
125
|
+
}),
|
|
126
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
127
|
+
style: {
|
|
128
|
+
padding: RING_SIZE,
|
|
129
|
+
borderRadius: s.radius + RING_SIZE,
|
|
130
|
+
backgroundColor: isFocused && !hasError ? cr.transparent.primary.sysPrimary08 : 'transparent'
|
|
131
|
+
},
|
|
132
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.View, {
|
|
133
|
+
style: {
|
|
134
|
+
height: s.height,
|
|
135
|
+
borderRadius: s.radius,
|
|
136
|
+
borderWidth,
|
|
137
|
+
borderColor,
|
|
138
|
+
backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainerLowest,
|
|
139
|
+
flexDirection: 'row',
|
|
140
|
+
alignItems: 'center',
|
|
141
|
+
paddingHorizontal: s.paddingH,
|
|
142
|
+
paddingVertical: s.paddingV,
|
|
143
|
+
gap: s.gap,
|
|
144
|
+
overflow: 'hidden'
|
|
145
|
+
},
|
|
146
|
+
children: [
|
|
147
|
+
leadingIcon && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
148
|
+
style: {
|
|
149
|
+
width: s.iconSize,
|
|
150
|
+
height: s.iconSize,
|
|
151
|
+
alignItems: 'center',
|
|
152
|
+
justifyContent: 'center',
|
|
153
|
+
flexShrink: 0
|
|
154
|
+
},
|
|
155
|
+
children: leadingIcon
|
|
156
|
+
}),
|
|
157
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.TextInput, {
|
|
158
|
+
...rest,
|
|
159
|
+
editable: editable,
|
|
160
|
+
accessibilityLabel: label ?? rest.placeholder,
|
|
161
|
+
accessibilityHint: supportingText,
|
|
162
|
+
accessibilityState: {
|
|
163
|
+
disabled: isDisabled
|
|
164
|
+
},
|
|
165
|
+
onFocus: (e)=>{
|
|
166
|
+
setIsFocused(true);
|
|
167
|
+
onFocus?.(e);
|
|
168
|
+
},
|
|
169
|
+
onBlur: (e)=>{
|
|
170
|
+
setIsFocused(false);
|
|
171
|
+
onBlur?.(e);
|
|
172
|
+
},
|
|
173
|
+
style: {
|
|
174
|
+
flex: 1,
|
|
175
|
+
fontSize: s.fontSize,
|
|
176
|
+
lineHeight: s.lineHeight,
|
|
177
|
+
color: textColor,
|
|
178
|
+
includeFontPadding: false,
|
|
179
|
+
// Reset RN TextInput default padding/margin
|
|
180
|
+
padding: 0,
|
|
181
|
+
margin: 0
|
|
182
|
+
},
|
|
183
|
+
placeholderTextColor: placeholderColor
|
|
184
|
+
}),
|
|
185
|
+
trailingIcon && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
186
|
+
style: {
|
|
187
|
+
width: s.iconSize,
|
|
188
|
+
height: s.iconSize,
|
|
189
|
+
alignItems: 'center',
|
|
190
|
+
justifyContent: 'center',
|
|
191
|
+
flexShrink: 0
|
|
192
|
+
},
|
|
193
|
+
children: trailingIcon
|
|
194
|
+
})
|
|
195
|
+
]
|
|
196
|
+
})
|
|
197
|
+
}),
|
|
198
|
+
supportingText && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.Text, {
|
|
199
|
+
style: [
|
|
200
|
+
styles.supporting,
|
|
201
|
+
{
|
|
202
|
+
color: supportingColor,
|
|
203
|
+
fontSize: ts.bodySmall.sysFontSize,
|
|
204
|
+
lineHeight: ts.bodySmall.sysLineHeight
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
children: supportingText
|
|
208
|
+
})
|
|
209
|
+
]
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
const styles = _reactnative.StyleSheet.create({
|
|
213
|
+
wrapper: {
|
|
214
|
+
gap: 4
|
|
215
|
+
},
|
|
216
|
+
disabled: {
|
|
217
|
+
opacity: 0.48
|
|
218
|
+
},
|
|
219
|
+
label: {
|
|
220
|
+
fontWeight: '500',
|
|
221
|
+
includeFontPadding: false,
|
|
222
|
+
// indent to align with the input text (ring padding + horizontal padding)
|
|
223
|
+
paddingLeft: RING_SIZE
|
|
224
|
+
},
|
|
225
|
+
supporting: {
|
|
226
|
+
includeFontPadding: false,
|
|
227
|
+
paddingLeft: RING_SIZE
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/react-native/src/components/Input/index.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\r\n\r\nimport {\r\n StyleSheet,\r\n Text,\r\n TextInput,\r\n TextInputProps,\r\n View,\r\n} from 'react-native';\r\n\r\nimport { useTheme } from '../../theme';\r\n\r\nexport type InputSize = 'sm' | 'md' | 'lg';\r\n\r\nexport interface InputProps extends Omit<TextInputProps, 'style'> {\r\n size?: InputSize;\r\n label?: string;\r\n helperText?: string;\r\n errorText?: string;\r\n invalid?: boolean;\r\n leadingIcon?: React.ReactNode;\r\n trailingIcon?: React.ReactNode;\r\n}\r\n\r\n// Focus-ring halo: 4px spread, sysPrimary08 colour — achieved with a fixed\r\n// 4px-padded wrapper whose background switches on focus.\r\nconst RING_SIZE = 4;\r\n\r\nexport function Input({\r\n size = 'md',\r\n label,\r\n helperText,\r\n errorText,\r\n invalid = false,\r\n leadingIcon,\r\n trailingIcon,\r\n editable = true,\r\n onFocus,\r\n onBlur,\r\n ...rest\r\n}: InputProps) {\r\n const { colorRoles: cr, dimensions: dim, typeScale: ts } = useTheme();\r\n const [isFocused, setIsFocused] = useState(false);\r\n\r\n const SIZE_TOKENS = useMemo(\r\n () => ({\r\n sm: {\r\n height: 40,\r\n paddingH: dim.spacing.padding.sysPadding12,\r\n paddingV: dim.spacing.padding.sysPadding8,\r\n gap: dim.spacing.padding.sysPadding4,\r\n fontSize: ts.bodySmall.sysFontSize,\r\n lineHeight: ts.bodySmall.sysLineHeight,\r\n radius: dim.borderRadius.sysRadiusSm,\r\n iconSize: 20,\r\n },\r\n md: {\r\n height: 48,\r\n paddingH: dim.spacing.padding.sysPadding16,\r\n paddingV: dim.spacing.padding.sysPadding12,\r\n gap: dim.spacing.padding.sysPadding8,\r\n fontSize: ts.bodyMedium.sysFontSize,\r\n lineHeight: ts.bodyMedium.sysLineHeight,\r\n radius: dim.borderRadius.sysRadiusSm,\r\n iconSize: 20,\r\n },\r\n lg: {\r\n height: 56,\r\n paddingH: dim.spacing.padding.sysPadding20,\r\n paddingV: dim.spacing.padding.sysPadding16,\r\n gap: dim.spacing.padding.sysPadding8,\r\n fontSize: ts.bodyMedium.sysFontSize,\r\n lineHeight: ts.bodyMedium.sysLineHeight,\r\n radius: dim.borderRadius.sysRadiusMd,\r\n iconSize: 20,\r\n },\r\n }),\r\n [dim, ts],\r\n );\r\n\r\n const s = SIZE_TOKENS[size];\r\n const isDisabled = editable === false;\r\n const hasError = invalid || !!errorText;\r\n\r\n // ── Border ──────────────────────────────────────────────────────────────\r\n const borderWidth =\r\n isFocused || hasError\r\n ? dim.borderWidth.sysStrokeMedium\r\n : dim.borderWidth.sysStrokeThin;\r\n\r\n const borderColor = hasError\r\n ? cr.error.sysError\r\n : isFocused\r\n ? cr.accent.primary.sysPrimary\r\n : cr.outline.sysOutlineVariant;\r\n\r\n // ── Text colours ─────────────────────────────────────────────────────────\r\n const textColor = cr.surface.surface.sysOnSurface;\r\n const placeholderColor = cr.surface.surface.sysOnSurfaceVariant;\r\n\r\n // ── Helper / error text ──────────────────────────────────────────────────\r\n const supportingText = errorText ?? helperText;\r\n const supportingColor = hasError\r\n ? cr.error.sysError\r\n : cr.surface.surface.sysOnSurfaceVariant;\r\n\r\n return (\r\n <View style={[styles.wrapper, isDisabled && styles.disabled]}>\r\n {/* Label */}\r\n {label && (\r\n <Text\r\n style={[\r\n styles.label,\r\n {\r\n color: hasError\r\n ? cr.error.sysError\r\n : cr.surface.surface.sysOnSurfaceVariant,\r\n fontSize: ts.labelMedium.sysFontSize,\r\n lineHeight: ts.labelMedium.sysLineHeight,\r\n },\r\n ]}\r\n >\r\n {label}\r\n </Text>\r\n )}\r\n\r\n {/* Focus-ring halo wrapper — always 4px padding, bg appears on focus */}\r\n <View\r\n style={{\r\n padding: RING_SIZE,\r\n borderRadius: s.radius + RING_SIZE,\r\n backgroundColor:\r\n isFocused && !hasError\r\n ? cr.transparent.primary.sysPrimary08\r\n : 'transparent',\r\n }}\r\n >\r\n {/* Input container */}\r\n <View\r\n style={{\r\n height: s.height,\r\n borderRadius: s.radius,\r\n borderWidth,\r\n borderColor,\r\n backgroundColor:\r\n cr.surface.surfaceContainer.sysSurfaceContainerLowest,\r\n flexDirection: 'row',\r\n alignItems: 'center',\r\n paddingHorizontal: s.paddingH,\r\n paddingVertical: s.paddingV,\r\n gap: s.gap,\r\n overflow: 'hidden',\r\n }}\r\n >\r\n {/* Leading icon */}\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 flexShrink: 0,\r\n }}\r\n >\r\n {leadingIcon}\r\n </View>\r\n )}\r\n\r\n {/* Text input */}\r\n <TextInput\r\n {...rest}\r\n editable={editable}\r\n accessibilityLabel={label ?? rest.placeholder}\r\n accessibilityHint={supportingText}\r\n accessibilityState={{ disabled: isDisabled }}\r\n onFocus={(e) => {\r\n setIsFocused(true);\r\n onFocus?.(e);\r\n }}\r\n onBlur={(e) => {\r\n setIsFocused(false);\r\n onBlur?.(e);\r\n }}\r\n style={{\r\n flex: 1,\r\n fontSize: s.fontSize,\r\n lineHeight: s.lineHeight,\r\n color: textColor,\r\n includeFontPadding: false,\r\n // Reset RN TextInput default padding/margin\r\n padding: 0,\r\n margin: 0,\r\n }}\r\n placeholderTextColor={placeholderColor}\r\n />\r\n\r\n {/* Trailing icon */}\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 flexShrink: 0,\r\n }}\r\n >\r\n {trailingIcon}\r\n </View>\r\n )}\r\n </View>\r\n </View>\r\n\r\n {/* Supporting text: error message or helper text */}\r\n {supportingText && (\r\n <Text\r\n style={[\r\n styles.supporting,\r\n {\r\n color: supportingColor,\r\n fontSize: ts.bodySmall.sysFontSize,\r\n lineHeight: ts.bodySmall.sysLineHeight,\r\n },\r\n ]}\r\n >\r\n {supportingText}\r\n </Text>\r\n )}\r\n </View>\r\n );\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n wrapper: {\r\n gap: 4,\r\n },\r\n disabled: {\r\n opacity: 0.48,\r\n },\r\n label: {\r\n fontWeight: '500',\r\n includeFontPadding: false,\r\n // indent to align with the input text (ring padding + horizontal padding)\r\n paddingLeft: RING_SIZE,\r\n },\r\n supporting: {\r\n includeFontPadding: false,\r\n paddingLeft: RING_SIZE,\r\n },\r\n});\r\n"],"names":["Input","RING_SIZE","size","label","helperText","errorText","invalid","leadingIcon","trailingIcon","editable","onFocus","onBlur","rest","colorRoles","cr","dimensions","dim","typeScale","ts","useTheme","isFocused","setIsFocused","useState","SIZE_TOKENS","useMemo","sm","height","paddingH","spacing","padding","sysPadding12","paddingV","sysPadding8","gap","sysPadding4","fontSize","bodySmall","sysFontSize","lineHeight","sysLineHeight","radius","borderRadius","sysRadiusSm","iconSize","md","sysPadding16","bodyMedium","lg","sysPadding20","sysRadiusMd","s","isDisabled","hasError","borderWidth","sysStrokeMedium","sysStrokeThin","borderColor","error","sysError","accent","primary","sysPrimary","outline","sysOutlineVariant","textColor","surface","sysOnSurface","placeholderColor","sysOnSurfaceVariant","supportingText","supportingColor","View","style","styles","wrapper","disabled","Text","color","labelMedium","backgroundColor","transparent","sysPrimary08","surfaceContainer","sysSurfaceContainerLowest","flexDirection","alignItems","paddingHorizontal","paddingVertical","overflow","width","justifyContent","flexShrink","TextInput","accessibilityLabel","placeholder","accessibilityHint","accessibilityState","e","flex","includeFontPadding","margin","placeholderTextColor","supporting","StyleSheet","create","opacity","fontWeight","paddingLeft"],"mappings":";;;;+BA4BgBA;;;eAAAA;;;;+DA5ByB;6BAQlC;uBAEkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAczB,2EAA2E;AAC3E,yDAAyD;AACzD,MAAMC,YAAY;AAEX,SAASD,MAAM,EACpBE,OAAO,IAAI,EACXC,KAAK,EACLC,UAAU,EACVC,SAAS,EACTC,UAAU,KAAK,EACfC,WAAW,EACXC,YAAY,EACZC,WAAW,IAAI,EACfC,OAAO,EACPC,MAAM,EACN,GAAGC,MACQ;IACX,MAAM,EAAEC,YAAYC,EAAE,EAAEC,YAAYC,GAAG,EAAEC,WAAWC,EAAE,EAAE,GAAGC,IAAAA,eAAQ;IACnE,MAAM,CAACC,WAAWC,aAAa,GAAGC,IAAAA,eAAQ,EAAC;IAE3C,MAAMC,cAAcC,IAAAA,cAAO,EACzB,IAAO,CAAA;YACLC,IAAI;gBACFC,QAAQ;gBACRC,UAAUX,IAAIY,OAAO,CAACC,OAAO,CAACC,YAAY;gBAC1CC,UAAUf,IAAIY,OAAO,CAACC,OAAO,CAACG,WAAW;gBACzCC,KAAKjB,IAAIY,OAAO,CAACC,OAAO,CAACK,WAAW;gBACpCC,UAAUjB,GAAGkB,SAAS,CAACC,WAAW;gBAClCC,YAAYpB,GAAGkB,SAAS,CAACG,aAAa;gBACtCC,QAAQxB,IAAIyB,YAAY,CAACC,WAAW;gBACpCC,UAAU;YACZ;YACAC,IAAI;gBACFlB,QAAQ;gBACRC,UAAUX,IAAIY,OAAO,CAACC,OAAO,CAACgB,YAAY;gBAC1Cd,UAAUf,IAAIY,OAAO,CAACC,OAAO,CAACC,YAAY;gBAC1CG,KAAKjB,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UAAUxB;4BAAW;4BAC3CzC,SAAS,CAACuF;gCACR5E,aAAa;gCACbX,UAAUuF;4BACZ;4BACAtF,QAAQ,CAACsF;gCACP5E,aAAa;gCACbV,SAASsF;4BACX;4BACAzB,OAAO;gCACL0B,MAAM;gCACN/D,UAAUe,EAAEf,QAAQ;gCACpBG,YAAYY,EAAEZ,UAAU;gCACxBuC,OAAOb;gCACPmC,oBAAoB;gCACpB,4CAA4C;gCAC5CtE,SAAS;gCACTuE,QAAQ;4BACV;4BACAC,sBAAsBlC;;wBAIvB3D,8BACC,qBAAC+D,iBAAI;4BACHC,OAAO;gCACLiB,OAAOvC,EAAEP,QAAQ;gCACjBjB,QAAQwB,EAAEP,QAAQ;gCAClB0C,YAAY;gCACZK,gBAAgB;gCAChBC,YAAY;4BACd;sCAECnF;;;;;YAOR6D,gCACC,qBAACO,iBAAI;gBACHJ,OAAO;oBACLC,OAAO6B,UAAU;oBACjB;wBACEzB,OAAOP;wBACPnC,UAAUjB,GAAGkB,SAAS,CAACC,WAAW;wBAClCC,YAAYpB,GAAGkB,SAAS,CAACG,aAAa;oBACxC;iBACD;0BAEA8B;;;;AAKX;AAEA,MAAMI,SAAS8B,uBAAU,CAACC,MAAM,CAAC;IAC/B9B,SAAS;QACPzC,KAAK;IACP;IACA0C,UAAU;QACR8B,SAAS;IACX;IACAtG,OAAO;QACLuG,YAAY;QACZP,oBAAoB;QACpB,0EAA0E;QAC1EQ,aAAa1G;IACf;IACAqG,YAAY;QACVH,oBAAoB;QACpBQ,aAAa1G;IACf;AACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export type ListItemType = 'simple' | 'detailed';
|
|
4
|
+
export interface ListItemProps {
|
|
5
|
+
type?: ListItemType;
|
|
6
|
+
label: string;
|
|
7
|
+
subLabel?: string;
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
onPress?: () => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
showDivider?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface ListProps {
|
|
14
|
+
items: Omit<ListItemProps, 'showDivider'>[];
|
|
15
|
+
type?: ListItemType;
|
|
16
|
+
style?: StyleProp<ViewStyle>;
|
|
17
|
+
}
|
|
18
|
+
export declare function ListItem({ type, label, subLabel, icon, onPress, disabled, showDivider, }: ListItemProps): React.JSX.Element;
|
|
19
|
+
export declare function List({ items, type, style }: ListProps): React.JSX.Element;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get List () {
|
|
13
|
+
return List;
|
|
14
|
+
},
|
|
15
|
+
get ListItem () {
|
|
16
|
+
return ListItem;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
20
|
+
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
21
|
+
const _reactnative = require("react-native");
|
|
22
|
+
const _vectoricons = require("@expo/vector-icons");
|
|
23
|
+
const _theme = require("../../theme");
|
|
24
|
+
const _BodyText = require("../BodyText");
|
|
25
|
+
function _interop_require_default(obj) {
|
|
26
|
+
return obj && obj.__esModule ? obj : {
|
|
27
|
+
default: obj
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function ListItem({ type = 'simple', label, subLabel, icon, onPress, disabled = false, showDivider = true }) {
|
|
31
|
+
const { colorRoles: cr, dimensions: dim } = (0, _theme.useTheme)();
|
|
32
|
+
const isDetailed = type === 'detailed';
|
|
33
|
+
const content = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.View, {
|
|
34
|
+
style: [
|
|
35
|
+
styles.itemRow,
|
|
36
|
+
{
|
|
37
|
+
gap: dim.spacing.padding.sysPadding12
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
children: [
|
|
41
|
+
isDetailed ? // Detailed: icon inside circular badge
|
|
42
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
43
|
+
style: [
|
|
44
|
+
styles.iconBadge,
|
|
45
|
+
{
|
|
46
|
+
backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainerLow
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
children: icon
|
|
50
|
+
}) : // Simple: bare icon
|
|
51
|
+
icon && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
52
|
+
style: styles.simpleIcon,
|
|
53
|
+
children: icon
|
|
54
|
+
}),
|
|
55
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.View, {
|
|
56
|
+
style: styles.textBlock,
|
|
57
|
+
children: [
|
|
58
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_BodyText.BodyText, {
|
|
59
|
+
variant: "medium",
|
|
60
|
+
emphasized: isDetailed,
|
|
61
|
+
color: cr.surface.surface.sysOnSurface,
|
|
62
|
+
children: label
|
|
63
|
+
}),
|
|
64
|
+
isDetailed && subLabel && /*#__PURE__*/ (0, _jsxruntime.jsx)(_BodyText.BodyText, {
|
|
65
|
+
variant: "small",
|
|
66
|
+
color: cr.surface.surface.sysOnSurfaceVariant,
|
|
67
|
+
children: subLabel
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
}),
|
|
71
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_vectoricons.Ionicons, {
|
|
72
|
+
name: "chevron-forward",
|
|
73
|
+
size: 20,
|
|
74
|
+
color: cr.outline.sysOutlineFixed,
|
|
75
|
+
accessible: false
|
|
76
|
+
})
|
|
77
|
+
]
|
|
78
|
+
});
|
|
79
|
+
const divider = showDivider ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
80
|
+
style: [
|
|
81
|
+
styles.divider,
|
|
82
|
+
{
|
|
83
|
+
// Indent past icon + gap: 24px (simple) or 48px+16px (detailed)
|
|
84
|
+
marginLeft: isDetailed ? 64 : 36,
|
|
85
|
+
borderBottomColor: cr.outline.sysOutline
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}) : null;
|
|
89
|
+
if (onPress) {
|
|
90
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.View, {
|
|
91
|
+
style: disabled && styles.disabled,
|
|
92
|
+
children: [
|
|
93
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.Pressable, {
|
|
94
|
+
onPress: disabled ? undefined : onPress,
|
|
95
|
+
accessibilityRole: "button",
|
|
96
|
+
accessibilityLabel: label,
|
|
97
|
+
accessibilityState: {
|
|
98
|
+
disabled
|
|
99
|
+
},
|
|
100
|
+
style: ({ pressed })=>[
|
|
101
|
+
isDetailed ? {
|
|
102
|
+
paddingTop: dim.spacing.padding.sysPadding12
|
|
103
|
+
} : {
|
|
104
|
+
paddingVertical: dim.spacing.padding.sysPadding16
|
|
105
|
+
},
|
|
106
|
+
pressed && !disabled && styles.pressed
|
|
107
|
+
],
|
|
108
|
+
children: content
|
|
109
|
+
}),
|
|
110
|
+
divider
|
|
111
|
+
]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.View, {
|
|
115
|
+
style: disabled && styles.disabled,
|
|
116
|
+
children: [
|
|
117
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
118
|
+
style: isDetailed ? {
|
|
119
|
+
paddingTop: dim.spacing.padding.sysPadding12
|
|
120
|
+
} : {
|
|
121
|
+
paddingVertical: dim.spacing.padding.sysPadding16
|
|
122
|
+
},
|
|
123
|
+
children: content
|
|
124
|
+
}),
|
|
125
|
+
divider
|
|
126
|
+
]
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function List({ items, type = 'simple', style }) {
|
|
130
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
131
|
+
style: style,
|
|
132
|
+
children: items.map((item, index)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(ListItem, {
|
|
133
|
+
...item,
|
|
134
|
+
type: item.type ?? type,
|
|
135
|
+
showDivider: index < items.length - 1
|
|
136
|
+
}, index))
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
const styles = _reactnative.StyleSheet.create({
|
|
140
|
+
itemRow: {
|
|
141
|
+
flexDirection: 'row',
|
|
142
|
+
alignItems: 'center'
|
|
143
|
+
},
|
|
144
|
+
simpleIcon: {
|
|
145
|
+
width: 24,
|
|
146
|
+
height: 24
|
|
147
|
+
},
|
|
148
|
+
iconBadge: {
|
|
149
|
+
width: 48,
|
|
150
|
+
height: 48,
|
|
151
|
+
borderRadius: 999,
|
|
152
|
+
alignItems: 'center',
|
|
153
|
+
justifyContent: 'center'
|
|
154
|
+
},
|
|
155
|
+
textBlock: {
|
|
156
|
+
flex: 1,
|
|
157
|
+
minWidth: 0
|
|
158
|
+
},
|
|
159
|
+
divider: {
|
|
160
|
+
borderBottomWidth: _reactnative.StyleSheet.hairlineWidth
|
|
161
|
+
},
|
|
162
|
+
pressed: {
|
|
163
|
+
backgroundColor: 'rgba(0,0,0,0.04)'
|
|
164
|
+
},
|
|
165
|
+
disabled: {
|
|
166
|
+
opacity: 0.48
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/react-native/src/components/List/index.tsx"],"sourcesContent":["import React from 'react';\r\n\r\nimport {\r\n Pressable,\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 { BodyText } from '../BodyText';\r\n\r\nexport type ListItemType = 'simple' | 'detailed';\r\n\r\nexport interface ListItemProps {\r\n type?: ListItemType;\r\n label: string;\r\n subLabel?: string;\r\n icon?: React.ReactNode;\r\n onPress?: () => void;\r\n disabled?: boolean;\r\n showDivider?: boolean;\r\n}\r\n\r\nexport interface ListProps {\r\n items: Omit<ListItemProps, 'showDivider'>[];\r\n type?: ListItemType;\r\n style?: StyleProp<ViewStyle>;\r\n}\r\n\r\n// ── ListItem ──────────────────────────────────────────────────────────────────\r\n\r\nexport function ListItem({\r\n type = 'simple',\r\n label,\r\n subLabel,\r\n icon,\r\n onPress,\r\n disabled = false,\r\n showDivider = true,\r\n}: ListItemProps) {\r\n const { colorRoles: cr, dimensions: dim } = useTheme();\r\n const isDetailed = type === 'detailed';\r\n\r\n const content = (\r\n <View style={[styles.itemRow, { gap: dim.spacing.padding.sysPadding12 }]}>\r\n {isDetailed ? (\r\n // Detailed: icon inside circular badge\r\n <View\r\n style={[\r\n styles.iconBadge,\r\n {\r\n backgroundColor:\r\n cr.surface.surfaceContainer.sysSurfaceContainerLow,\r\n },\r\n ]}\r\n >\r\n {icon}\r\n </View>\r\n ) : (\r\n // Simple: bare icon\r\n icon && <View style={styles.simpleIcon}>{icon}</View>\r\n )}\r\n\r\n <View style={styles.textBlock}>\r\n <BodyText\r\n variant=\"medium\"\r\n emphasized={isDetailed}\r\n color={cr.surface.surface.sysOnSurface}\r\n >\r\n {label}\r\n </BodyText>\r\n {isDetailed && subLabel && (\r\n <BodyText\r\n variant=\"small\"\r\n color={cr.surface.surface.sysOnSurfaceVariant}\r\n >\r\n {subLabel}\r\n </BodyText>\r\n )}\r\n </View>\r\n\r\n <Ionicons\r\n name=\"chevron-forward\"\r\n size={20}\r\n color={cr.outline.sysOutlineFixed}\r\n accessible={false}\r\n />\r\n </View>\r\n );\r\n\r\n const divider = showDivider ? (\r\n <View\r\n style={[\r\n styles.divider,\r\n {\r\n // Indent past icon + gap: 24px (simple) or 48px+16px (detailed)\r\n marginLeft: isDetailed ? 64 : 36,\r\n borderBottomColor: cr.outline.sysOutline,\r\n },\r\n ]}\r\n />\r\n ) : null;\r\n\r\n if (onPress) {\r\n return (\r\n <View style={disabled && styles.disabled}>\r\n <Pressable\r\n onPress={disabled ? undefined : onPress}\r\n accessibilityRole=\"button\"\r\n accessibilityLabel={label}\r\n accessibilityState={{ disabled }}\r\n style={({ pressed }) => [\r\n isDetailed\r\n ? { paddingTop: dim.spacing.padding.sysPadding12 }\r\n : {\r\n paddingVertical: dim.spacing.padding.sysPadding16,\r\n },\r\n pressed && !disabled && styles.pressed,\r\n ]}\r\n >\r\n {content}\r\n </Pressable>\r\n {divider}\r\n </View>\r\n );\r\n }\r\n\r\n return (\r\n <View style={disabled && styles.disabled}>\r\n <View\r\n style={\r\n isDetailed\r\n ? { paddingTop: dim.spacing.padding.sysPadding12 }\r\n : { paddingVertical: dim.spacing.padding.sysPadding16 }\r\n }\r\n >\r\n {content}\r\n </View>\r\n {divider}\r\n </View>\r\n );\r\n}\r\n\r\n// ── List ──────────────────────────────────────────────────────────────────────\r\n\r\nexport function List({ items, type = 'simple', style }: ListProps) {\r\n return (\r\n <View style={style}>\r\n {items.map((item, index) => (\r\n <ListItem\r\n key={index}\r\n {...item}\r\n type={item.type ?? type}\r\n showDivider={index < items.length - 1}\r\n />\r\n ))}\r\n </View>\r\n );\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n itemRow: {\r\n flexDirection: 'row',\r\n alignItems: 'center',\r\n },\r\n simpleIcon: {\r\n width: 24,\r\n height: 24,\r\n },\r\n iconBadge: {\r\n width: 48,\r\n height: 48,\r\n borderRadius: 999,\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n },\r\n textBlock: {\r\n flex: 1,\r\n minWidth: 0,\r\n },\r\n divider: {\r\n borderBottomWidth: StyleSheet.hairlineWidth,\r\n },\r\n pressed: {\r\n backgroundColor: 'rgba(0,0,0,0.04)',\r\n },\r\n disabled: {\r\n opacity: 0.48,\r\n },\r\n});\r\n"],"names":["List","ListItem","type","label","subLabel","icon","onPress","disabled","showDivider","colorRoles","cr","dimensions","dim","useTheme","isDetailed","content","View","style","styles","itemRow","gap","spacing","padding","sysPadding12","iconBadge","backgroundColor","surface","surfaceContainer","sysSurfaceContainerLow","simpleIcon","textBlock","BodyText","variant","emphasized","color","sysOnSurface","sysOnSurfaceVariant","Ionicons","name","size","outline","sysOutlineFixed","accessible","divider","marginLeft","borderBottomColor","sysOutline","Pressable","undefined","accessibilityRole","accessibilityLabel","accessibilityState","pressed","paddingTop","paddingVertical","sysPadding16","items","map","item","index","length","StyleSheet","create","flexDirection","alignItems","width","height","borderRadius","justifyContent","flex","minWidth","borderBottomWidth","hairlineWidth","opacity"],"mappings":";;;;;;;;;;;QAqJgBA;eAAAA;;QAlHAC;eAAAA;;;;8DAnCE;6BAQX;6BAEkB;uBAEA;0BACA;;;;;;AAsBlB,SAASA,SAAS,EACvBC,OAAO,QAAQ,EACfC,KAAK,EACLC,QAAQ,EACRC,IAAI,EACJC,OAAO,EACPC,WAAW,KAAK,EAChBC,cAAc,IAAI,EACJ;IACd,MAAM,EAAEC,YAAYC,EAAE,EAAEC,YAAYC,GAAG,EAAE,GAAGC,IAAAA,eAAQ;IACpD,MAAMC,aAAaZ,SAAS;IAE5B,MAAMa,wBACJ,sBAACC,iBAAI;QAACC,OAAO;YAACC,OAAOC,OAAO;YAAE;gBAAEC,KAAKR,IAAIS,OAAO,CAACC,OAAO,CAACC,YAAY;YAAC;SAAE;;YACrET,aACC,uCAAuC;0BACvC,qBAACE,iBAAI;gBACHC,OAAO;oBACLC,OAAOM,SAAS;oBAChB;wBACEC,iBACEf,GAAGgB,OAAO,CAACC,gBAAgB,CAACC,sBAAsB;oBACtD;iBACD;0BAEAvB;iBAGH,oBAAoB;YACpBA,sBAAQ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ACEH,aACI;oBAAEuC,YAAYzC,IAAIS,OAAO,CAACC,OAAO,CAACC,YAAY;gBAAC,IAC/C;oBAAE+B,iBAAiB1C,IAAIS,OAAO,CAACC,OAAO,CAACiC,YAAY;gBAAC;0BAGzDxC;;YAEF4B;;;AAGP;AAIO,SAAS3C,KAAK,EAAEwD,KAAK,EAAEtD,OAAO,QAAQ,EAAEe,KAAK,EAAa;IAC/D,qBACE,qBAACD,iBAAI;QAACC,OAAOA;kBACVuC,MAAMC,GAAG,CAAC,CAACC,MAAMC,sBAChB,qBAAC1D;gBAEE,GAAGyD,IAAI;gBACRxD,MAAMwD,KAAKxD,IAAI,IAAIA;gBACnBM,aAAamD,QAAQH,MAAMI,MAAM,GAAG;eAH/BD;;AAQf;AAEA,MAAMzC,SAAS2C,uBAAU,CAACC,MAAM,CAAC;IAC/B3C,SAAS;QACP4C,eAAe;QACfC,YAAY;IACd;IACAnC,YAAY;QACVoC,OAAO;QACPC,QAAQ;IACV;IACA1C,WAAW;QACTyC,OAAO;QACPC,QAAQ;QACRC,cAAc;QACdH,YAAY;QACZI,gBAAgB;IAClB;IACAtC,WAAW;QACTuC,MAAM;QACNC,UAAU;IACZ;IACA3B,SAAS;QACP4B,mBAAmBV,uBAAU,CAACW,aAAa;IAC7C;IACApB,SAAS;QACP3B,iBAAiB;IACnB;IACAlB,UAAU;QACRkE,SAAS;IACX;AACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export type PaginationSize = 'sm' | 'lg';
|
|
4
|
+
export interface PaginationProps {
|
|
5
|
+
size?: PaginationSize;
|
|
6
|
+
totalPages: number;
|
|
7
|
+
currentPage: number;
|
|
8
|
+
onPageChange: (page: number) => void;
|
|
9
|
+
/** How many page numbers to show on each side of the current page */
|
|
10
|
+
siblingCount?: number;
|
|
11
|
+
/** On mobile/compact layouts — renders only prev + next arrows (no page numbers) */
|
|
12
|
+
compact?: boolean;
|
|
13
|
+
style?: StyleProp<ViewStyle>;
|
|
14
|
+
}
|
|
15
|
+
export declare function Pagination({ size, totalPages, currentPage, onPageChange, siblingCount, compact, style, }: PaginationProps): React.JSX.Element;
|