@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,376 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "EmptyState", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return EmptyState;
|
|
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 _vectoricons = require("@expo/vector-icons");
|
|
15
|
+
const _theme = require("../../theme");
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
17
|
+
if (typeof WeakMap !== "function") return null;
|
|
18
|
+
var cacheBabelInterop = new WeakMap();
|
|
19
|
+
var cacheNodeInterop = new WeakMap();
|
|
20
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
21
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
22
|
+
})(nodeInterop);
|
|
23
|
+
}
|
|
24
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
25
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
28
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
29
|
+
return {
|
|
30
|
+
default: obj
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
34
|
+
if (cache && cache.has(obj)) {
|
|
35
|
+
return cache.get(obj);
|
|
36
|
+
}
|
|
37
|
+
var newObj = {
|
|
38
|
+
__proto__: null
|
|
39
|
+
};
|
|
40
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
|
+
for(var key in obj){
|
|
42
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
43
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
44
|
+
if (desc && (desc.get || desc.set)) {
|
|
45
|
+
Object.defineProperty(newObj, key, desc);
|
|
46
|
+
} else {
|
|
47
|
+
newObj[key] = obj[key];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
newObj.default = obj;
|
|
52
|
+
if (cache) {
|
|
53
|
+
cache.set(obj, newObj);
|
|
54
|
+
}
|
|
55
|
+
return newObj;
|
|
56
|
+
}
|
|
57
|
+
// ── Illustration ──────────────────────────────────────────────────────────────
|
|
58
|
+
// A pure-View recreation of the Figma "collage of cards" illustration.
|
|
59
|
+
// Built at 280×157 px (scaled from the Figma 398×224 desktop version).
|
|
60
|
+
const ILLUS_W = 280;
|
|
61
|
+
const ILLUS_H = 157;
|
|
62
|
+
const SCALE = ILLUS_W / 398; // ≈ 0.703
|
|
63
|
+
const CARD_W = Math.round(160 * SCALE); // 112
|
|
64
|
+
const CARD_H = Math.round(98 * SCALE); // 69
|
|
65
|
+
function scaledPos(left, top) {
|
|
66
|
+
return {
|
|
67
|
+
left: Math.round(left * SCALE),
|
|
68
|
+
top: Math.round(top * SCALE)
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function EmptyIllustration({ cr, dim }) {
|
|
72
|
+
// Purely decorative — hidden from accessibility tree
|
|
73
|
+
// Central active card
|
|
74
|
+
const central = scaledPos(119, 63);
|
|
75
|
+
// Surrounding faded cards
|
|
76
|
+
const positions = [
|
|
77
|
+
scaledPos(-53, 63),
|
|
78
|
+
scaledPos(291, 63),
|
|
79
|
+
scaledPos(33, 173),
|
|
80
|
+
scaledPos(205, 173),
|
|
81
|
+
scaledPos(33, -47),
|
|
82
|
+
scaledPos(205, -47)
|
|
83
|
+
];
|
|
84
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.View, {
|
|
85
|
+
accessible: false,
|
|
86
|
+
importantForAccessibility: "no-hide-descendants",
|
|
87
|
+
style: [
|
|
88
|
+
styles.illusContainer,
|
|
89
|
+
{
|
|
90
|
+
width: ILLUS_W,
|
|
91
|
+
height: ILLUS_H
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
children: [
|
|
95
|
+
positions.map((pos, i)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
96
|
+
style: [
|
|
97
|
+
styles.card,
|
|
98
|
+
{
|
|
99
|
+
left: pos.left,
|
|
100
|
+
top: pos.top,
|
|
101
|
+
width: CARD_W,
|
|
102
|
+
height: CARD_H,
|
|
103
|
+
borderWidth: dim.borderWidth.sysStrokeThin,
|
|
104
|
+
borderRadius: dim.borderRadius.sysRadiusMd,
|
|
105
|
+
borderColor: cr.outline.sysOutlineVariant,
|
|
106
|
+
backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainerLowest
|
|
107
|
+
},
|
|
108
|
+
styles.cardFaded
|
|
109
|
+
]
|
|
110
|
+
}, i)),
|
|
111
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.View, {
|
|
112
|
+
style: [
|
|
113
|
+
styles.card,
|
|
114
|
+
styles.cardActive,
|
|
115
|
+
{
|
|
116
|
+
left: central.left,
|
|
117
|
+
top: central.top,
|
|
118
|
+
width: CARD_W,
|
|
119
|
+
height: CARD_H,
|
|
120
|
+
borderWidth: dim.borderWidth.sysStrokeThin,
|
|
121
|
+
borderRadius: dim.borderRadius.sysRadiusMd,
|
|
122
|
+
borderColor: cr.accent.primary.sysPrimary,
|
|
123
|
+
backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainerLowest,
|
|
124
|
+
shadowColor: cr.accent.primary.sysPrimary
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
children: [
|
|
128
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
129
|
+
style: [
|
|
130
|
+
styles.skeletonLine,
|
|
131
|
+
{
|
|
132
|
+
top: Math.round(15 * SCALE),
|
|
133
|
+
left: Math.round(15 * SCALE),
|
|
134
|
+
width: Math.round(32 * SCALE),
|
|
135
|
+
backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainer
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
}),
|
|
139
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
140
|
+
style: [
|
|
141
|
+
styles.skeletonLine,
|
|
142
|
+
{
|
|
143
|
+
top: Math.round(51 * SCALE),
|
|
144
|
+
left: Math.round(15 * SCALE),
|
|
145
|
+
width: Math.round(96 * SCALE),
|
|
146
|
+
backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainer
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
}),
|
|
150
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
151
|
+
style: [
|
|
152
|
+
styles.skeletonLine,
|
|
153
|
+
{
|
|
154
|
+
top: Math.round(63 * SCALE),
|
|
155
|
+
left: Math.round(15 * SCALE),
|
|
156
|
+
width: Math.round(122 * SCALE),
|
|
157
|
+
backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainer
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
})
|
|
161
|
+
]
|
|
162
|
+
})
|
|
163
|
+
]
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function EmptyState({ style = 'icon', viewport = 'mobile', title = 'No results', description = 'Description if needed', showDescription = true, icon, actionLabel, onAction, showAction, containerStyle }) {
|
|
167
|
+
const { colorRoles: cr, dimensions: dim, typeScale: ts } = (0, _theme.useTheme)();
|
|
168
|
+
const viewportTokens = (0, _react.useMemo)(()=>({
|
|
169
|
+
desktop: {
|
|
170
|
+
iconCircle: 60,
|
|
171
|
+
iconSize: 32,
|
|
172
|
+
titleFontSize: ts.titleMedium.sysFontSize,
|
|
173
|
+
titleLineHeight: ts.titleMedium.sysLineHeight,
|
|
174
|
+
descFontSize: ts.bodyMedium.sysFontSize,
|
|
175
|
+
descLineHeight: ts.bodyMedium.sysLineHeight,
|
|
176
|
+
contentGap: dim.spacing.padding.sysPadding24,
|
|
177
|
+
btnHeight: 40,
|
|
178
|
+
btnPaddingL: dim.spacing.padding.sysPadding16,
|
|
179
|
+
btnPaddingR: dim.spacing.padding.sysPadding24,
|
|
180
|
+
btnGap: dim.spacing.padding.sysPadding8,
|
|
181
|
+
btnFontSize: ts.labelMedium.sysFontSize,
|
|
182
|
+
btnLineHeight: ts.labelMedium.sysLineHeight,
|
|
183
|
+
btnTracking: ts.labelMedium.sysTracking
|
|
184
|
+
},
|
|
185
|
+
mobile: {
|
|
186
|
+
iconCircle: 48,
|
|
187
|
+
iconSize: 24,
|
|
188
|
+
titleFontSize: ts.labelLarge.sysFontSize,
|
|
189
|
+
titleLineHeight: ts.labelLarge.sysLineHeight,
|
|
190
|
+
descFontSize: ts.bodySmall.sysFontSize,
|
|
191
|
+
descLineHeight: ts.bodySmall.sysLineHeight,
|
|
192
|
+
contentGap: dim.spacing.padding.sysPadding16,
|
|
193
|
+
btnHeight: 32,
|
|
194
|
+
btnPaddingL: dim.spacing.padding.sysPadding12,
|
|
195
|
+
btnPaddingR: dim.spacing.padding.sysPadding16,
|
|
196
|
+
btnGap: dim.spacing.padding.sysPadding4,
|
|
197
|
+
btnFontSize: ts.labelSmall.sysFontSize,
|
|
198
|
+
btnLineHeight: ts.labelSmall.sysLineHeight,
|
|
199
|
+
btnTracking: ts.labelSmall.sysTracking
|
|
200
|
+
}
|
|
201
|
+
}), [
|
|
202
|
+
dim,
|
|
203
|
+
ts
|
|
204
|
+
]);
|
|
205
|
+
const vp = viewportTokens[viewport];
|
|
206
|
+
const hasAction = showAction !== undefined ? showAction : !!actionLabel;
|
|
207
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.View, {
|
|
208
|
+
style: [
|
|
209
|
+
styles.root,
|
|
210
|
+
{
|
|
211
|
+
padding: dim.spacing.padding.sysPadding24,
|
|
212
|
+
borderRadius: dim.borderRadius.sysRadiusLg,
|
|
213
|
+
gap: dim.spacing.padding.sysPadding24
|
|
214
|
+
},
|
|
215
|
+
containerStyle
|
|
216
|
+
],
|
|
217
|
+
children: [
|
|
218
|
+
style === 'illustration' ? /*#__PURE__*/ (0, _jsxruntime.jsx)(EmptyIllustration, {
|
|
219
|
+
cr: cr,
|
|
220
|
+
dim: dim
|
|
221
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
222
|
+
style: [
|
|
223
|
+
styles.iconCircle,
|
|
224
|
+
{
|
|
225
|
+
width: vp.iconCircle,
|
|
226
|
+
height: vp.iconCircle,
|
|
227
|
+
backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainerLow
|
|
228
|
+
}
|
|
229
|
+
],
|
|
230
|
+
children: icon ?? /*#__PURE__*/ (0, _jsxruntime.jsx)(_vectoricons.Ionicons, {
|
|
231
|
+
name: "apps-outline",
|
|
232
|
+
size: vp.iconSize,
|
|
233
|
+
color: cr.surface.surface.sysOnSurfaceVariant
|
|
234
|
+
})
|
|
235
|
+
}),
|
|
236
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.View, {
|
|
237
|
+
style: [
|
|
238
|
+
styles.content,
|
|
239
|
+
{
|
|
240
|
+
gap: vp.contentGap
|
|
241
|
+
}
|
|
242
|
+
],
|
|
243
|
+
children: [
|
|
244
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.View, {
|
|
245
|
+
style: [
|
|
246
|
+
styles.textBlock,
|
|
247
|
+
{
|
|
248
|
+
gap: dim.spacing.padding.sysPadding4
|
|
249
|
+
}
|
|
250
|
+
],
|
|
251
|
+
children: [
|
|
252
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.Text, {
|
|
253
|
+
style: {
|
|
254
|
+
color: cr.surface.surface.sysOnSurface,
|
|
255
|
+
fontSize: vp.titleFontSize,
|
|
256
|
+
lineHeight: vp.titleLineHeight,
|
|
257
|
+
fontWeight: '400',
|
|
258
|
+
textAlign: 'center',
|
|
259
|
+
includeFontPadding: false
|
|
260
|
+
},
|
|
261
|
+
children: title
|
|
262
|
+
}),
|
|
263
|
+
showDescription && description && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.Text, {
|
|
264
|
+
style: {
|
|
265
|
+
color: cr.surface.surface.sysOnSurfaceVariant,
|
|
266
|
+
fontSize: vp.descFontSize,
|
|
267
|
+
lineHeight: vp.descLineHeight,
|
|
268
|
+
fontWeight: '400',
|
|
269
|
+
textAlign: 'center',
|
|
270
|
+
includeFontPadding: false
|
|
271
|
+
},
|
|
272
|
+
children: description
|
|
273
|
+
})
|
|
274
|
+
]
|
|
275
|
+
}),
|
|
276
|
+
hasAction && actionLabel && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.Pressable, {
|
|
277
|
+
onPress: onAction,
|
|
278
|
+
accessibilityRole: "button",
|
|
279
|
+
accessibilityLabel: actionLabel,
|
|
280
|
+
style: ({ pressed })=>[
|
|
281
|
+
styles.actionBtn,
|
|
282
|
+
{
|
|
283
|
+
height: vp.btnHeight,
|
|
284
|
+
paddingLeft: vp.btnPaddingL,
|
|
285
|
+
paddingRight: vp.btnPaddingR,
|
|
286
|
+
gap: vp.btnGap,
|
|
287
|
+
borderWidth: dim.borderWidth.sysStrokeThin,
|
|
288
|
+
borderColor: cr.outline.sysOutline
|
|
289
|
+
},
|
|
290
|
+
pressed && {
|
|
291
|
+
opacity: 0.76
|
|
292
|
+
}
|
|
293
|
+
],
|
|
294
|
+
children: [
|
|
295
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_vectoricons.Ionicons, {
|
|
296
|
+
name: "add",
|
|
297
|
+
size: 16,
|
|
298
|
+
color: cr.surface.surface.sysOnSurface
|
|
299
|
+
}),
|
|
300
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.Text, {
|
|
301
|
+
style: {
|
|
302
|
+
color: cr.surface.surface.sysOnSurface,
|
|
303
|
+
fontSize: vp.btnFontSize,
|
|
304
|
+
lineHeight: vp.btnLineHeight,
|
|
305
|
+
letterSpacing: vp.btnTracking,
|
|
306
|
+
fontWeight: '400',
|
|
307
|
+
includeFontPadding: false
|
|
308
|
+
},
|
|
309
|
+
children: actionLabel
|
|
310
|
+
})
|
|
311
|
+
]
|
|
312
|
+
})
|
|
313
|
+
]
|
|
314
|
+
})
|
|
315
|
+
]
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
const styles = _reactnative.StyleSheet.create({
|
|
319
|
+
root: {
|
|
320
|
+
alignItems: 'center',
|
|
321
|
+
alignSelf: 'center'
|
|
322
|
+
},
|
|
323
|
+
// ── Icon circle ───────────────────────────────────────────────────────────
|
|
324
|
+
iconCircle: {
|
|
325
|
+
borderRadius: 9999,
|
|
326
|
+
alignItems: 'center',
|
|
327
|
+
justifyContent: 'center',
|
|
328
|
+
overflow: 'hidden'
|
|
329
|
+
},
|
|
330
|
+
// ── Content block ─────────────────────────────────────────────────────────
|
|
331
|
+
content: {
|
|
332
|
+
alignItems: 'center',
|
|
333
|
+
alignSelf: 'stretch'
|
|
334
|
+
},
|
|
335
|
+
textBlock: {
|
|
336
|
+
alignSelf: 'stretch',
|
|
337
|
+
alignItems: 'center'
|
|
338
|
+
},
|
|
339
|
+
// ── Action button ─────────────────────────────────────────────────────────
|
|
340
|
+
actionBtn: {
|
|
341
|
+
flexDirection: 'row',
|
|
342
|
+
alignItems: 'center',
|
|
343
|
+
justifyContent: 'center',
|
|
344
|
+
borderRadius: 9999,
|
|
345
|
+
overflow: 'hidden'
|
|
346
|
+
},
|
|
347
|
+
// ── Illustration ──────────────────────────────────────────────────────────
|
|
348
|
+
illusContainer: {
|
|
349
|
+
overflow: 'hidden',
|
|
350
|
+
position: 'relative'
|
|
351
|
+
},
|
|
352
|
+
card: {
|
|
353
|
+
position: 'absolute',
|
|
354
|
+
overflow: 'hidden'
|
|
355
|
+
},
|
|
356
|
+
cardFaded: {
|
|
357
|
+
opacity: 0.48
|
|
358
|
+
},
|
|
359
|
+
cardActive: {
|
|
360
|
+
// Active ring: sysPrimary08 spread shadow
|
|
361
|
+
shadowOffset: {
|
|
362
|
+
width: 0,
|
|
363
|
+
height: 0
|
|
364
|
+
},
|
|
365
|
+
shadowOpacity: 0.08,
|
|
366
|
+
shadowRadius: 0,
|
|
367
|
+
elevation: 0
|
|
368
|
+
},
|
|
369
|
+
skeletonLine: {
|
|
370
|
+
position: 'absolute',
|
|
371
|
+
height: Math.round(6 * SCALE),
|
|
372
|
+
borderRadius: 9999
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/react-native/src/components/EmptyState/index.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\n\r\nimport {\r\n Pressable,\r\n StyleProp,\r\n StyleSheet,\r\n Text,\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\n\r\nexport type EmptyStateStyle = 'icon' | 'illustration';\r\nexport type EmptyStateViewport = 'desktop' | 'mobile';\r\n\r\nexport interface EmptyStateProps {\r\n /** Visual style of the graphic area */\r\n style?: EmptyStateStyle;\r\n /** desktop = larger type + 60px icon circle; mobile = smaller type + 48px circle */\r\n viewport?: EmptyStateViewport;\r\n /** Heading text (default: \"No results\") */\r\n title?: string;\r\n /** Body copy below the title */\r\n description?: string;\r\n /** Hide the description even when `description` is provided */\r\n showDescription?: boolean;\r\n /** Custom icon rendered inside the icon circle (icon style only) */\r\n icon?: React.ReactNode;\r\n /** Label for the optional action button */\r\n actionLabel?: string;\r\n onAction?: () => void;\r\n /** Whether the action button is shown (default: true when actionLabel is set) */\r\n showAction?: boolean;\r\n containerStyle?: StyleProp<ViewStyle>;\r\n}\r\n\r\n// ── Illustration ──────────────────────────────────────────────────────────────\r\n// A pure-View recreation of the Figma \"collage of cards\" illustration.\r\n// Built at 280×157 px (scaled from the Figma 398×224 desktop version).\r\n\r\nconst ILLUS_W = 280;\r\nconst ILLUS_H = 157;\r\nconst SCALE = ILLUS_W / 398; // ≈ 0.703\r\n\r\nconst CARD_W = Math.round(160 * SCALE); // 112\r\nconst CARD_H = Math.round(98 * SCALE); // 69\r\n\r\nfunction scaledPos(left: number, top: number) {\r\n return {\r\n left: Math.round(left * SCALE),\r\n top: Math.round(top * SCALE),\r\n };\r\n}\r\n\r\ntype ColorRoles = ReturnType<typeof useTheme>['colorRoles'];\r\ntype Dimensions = ReturnType<typeof useTheme>['dimensions'];\r\n\r\nfunction EmptyIllustration({ cr, dim }: { cr: ColorRoles; dim: Dimensions }) {\r\n // Purely decorative — hidden from accessibility tree\r\n // Central active card\r\n const central = scaledPos(119, 63);\r\n // Surrounding faded cards\r\n const positions = [\r\n scaledPos(-53, 63),\r\n scaledPos(291, 63),\r\n scaledPos(33, 173),\r\n scaledPos(205, 173),\r\n scaledPos(33, -47),\r\n scaledPos(205, -47),\r\n ];\r\n\r\n return (\r\n <View\r\n accessible={false}\r\n importantForAccessibility=\"no-hide-descendants\"\r\n style={[styles.illusContainer, { width: ILLUS_W, height: ILLUS_H }]}\r\n >\r\n {/* Faded background cards */}\r\n {positions.map((pos, i) => (\r\n <View\r\n key={i}\r\n style={[\r\n styles.card,\r\n {\r\n left: pos.left,\r\n top: pos.top,\r\n width: CARD_W,\r\n height: CARD_H,\r\n borderWidth: dim.borderWidth.sysStrokeThin,\r\n borderRadius: dim.borderRadius.sysRadiusMd,\r\n borderColor: cr.outline.sysOutlineVariant,\r\n backgroundColor:\r\n cr.surface.surfaceContainer.sysSurfaceContainerLowest,\r\n },\r\n styles.cardFaded,\r\n ]}\r\n />\r\n ))}\r\n\r\n {/* Central focused card */}\r\n <View\r\n style={[\r\n styles.card,\r\n styles.cardActive,\r\n {\r\n left: central.left,\r\n top: central.top,\r\n width: CARD_W,\r\n height: CARD_H,\r\n borderWidth: dim.borderWidth.sysStrokeThin,\r\n borderRadius: dim.borderRadius.sysRadiusMd,\r\n borderColor: cr.accent.primary.sysPrimary,\r\n backgroundColor:\r\n cr.surface.surfaceContainer.sysSurfaceContainerLowest,\r\n shadowColor: cr.accent.primary.sysPrimary,\r\n },\r\n ]}\r\n >\r\n {/* Skeleton content lines */}\r\n <View\r\n style={[\r\n styles.skeletonLine,\r\n {\r\n top: Math.round(15 * SCALE),\r\n left: Math.round(15 * SCALE),\r\n width: Math.round(32 * SCALE),\r\n backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainer,\r\n },\r\n ]}\r\n />\r\n <View\r\n style={[\r\n styles.skeletonLine,\r\n {\r\n top: Math.round(51 * SCALE),\r\n left: Math.round(15 * SCALE),\r\n width: Math.round(96 * SCALE),\r\n backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainer,\r\n },\r\n ]}\r\n />\r\n <View\r\n style={[\r\n styles.skeletonLine,\r\n {\r\n top: Math.round(63 * SCALE),\r\n left: Math.round(15 * SCALE),\r\n width: Math.round(122 * SCALE),\r\n backgroundColor: cr.surface.surfaceContainer.sysSurfaceContainer,\r\n },\r\n ]}\r\n />\r\n </View>\r\n </View>\r\n );\r\n}\r\n\r\n// ── Component ─────────────────────────────────────────────────────────────────\r\n\r\nexport function EmptyState({\r\n style = 'icon',\r\n viewport = 'mobile',\r\n title = 'No results',\r\n description = 'Description if needed',\r\n showDescription = true,\r\n icon,\r\n actionLabel,\r\n onAction,\r\n showAction,\r\n containerStyle,\r\n}: EmptyStateProps) {\r\n const { colorRoles: cr, dimensions: dim, typeScale: ts } = useTheme();\r\n\r\n const viewportTokens = useMemo(\r\n () =>\r\n ({\r\n desktop: {\r\n iconCircle: 60,\r\n iconSize: 32,\r\n titleFontSize: ts.titleMedium.sysFontSize,\r\n titleLineHeight: ts.titleMedium.sysLineHeight,\r\n descFontSize: ts.bodyMedium.sysFontSize,\r\n descLineHeight: ts.bodyMedium.sysLineHeight,\r\n contentGap: dim.spacing.padding.sysPadding24,\r\n btnHeight: 40,\r\n btnPaddingL: dim.spacing.padding.sysPadding16,\r\n btnPaddingR: dim.spacing.padding.sysPadding24,\r\n btnGap: dim.spacing.padding.sysPadding8,\r\n btnFontSize: ts.labelMedium.sysFontSize,\r\n btnLineHeight: ts.labelMedium.sysLineHeight,\r\n btnTracking: ts.labelMedium.sysTracking,\r\n },\r\n mobile: {\r\n iconCircle: 48,\r\n iconSize: 24,\r\n titleFontSize: ts.labelLarge.sysFontSize,\r\n titleLineHeight: ts.labelLarge.sysLineHeight,\r\n descFontSize: ts.bodySmall.sysFontSize,\r\n descLineHeight: ts.bodySmall.sysLineHeight,\r\n contentGap: dim.spacing.padding.sysPadding16,\r\n btnHeight: 32,\r\n btnPaddingL: dim.spacing.padding.sysPadding12,\r\n btnPaddingR: dim.spacing.padding.sysPadding16,\r\n btnGap: dim.spacing.padding.sysPadding4,\r\n btnFontSize: ts.labelSmall.sysFontSize,\r\n btnLineHeight: ts.labelSmall.sysLineHeight,\r\n btnTracking: ts.labelSmall.sysTracking,\r\n },\r\n }) as const,\r\n [dim, ts],\r\n );\r\n\r\n const vp = viewportTokens[viewport];\r\n const hasAction = showAction !== undefined ? showAction : !!actionLabel;\r\n\r\n return (\r\n <View\r\n style={[\r\n styles.root,\r\n {\r\n padding: dim.spacing.padding.sysPadding24,\r\n borderRadius: dim.borderRadius.sysRadiusLg,\r\n gap: dim.spacing.padding.sysPadding24,\r\n },\r\n containerStyle,\r\n ]}\r\n >\r\n {/* ── Graphic ───────────────────────────────────────────────────────── */}\r\n {style === 'illustration' ? (\r\n <EmptyIllustration cr={cr} dim={dim} />\r\n ) : (\r\n <View\r\n style={[\r\n styles.iconCircle,\r\n {\r\n width: vp.iconCircle,\r\n height: vp.iconCircle,\r\n backgroundColor:\r\n cr.surface.surfaceContainer.sysSurfaceContainerLow,\r\n },\r\n ]}\r\n >\r\n {icon ?? (\r\n <Ionicons\r\n name=\"apps-outline\"\r\n size={vp.iconSize}\r\n color={cr.surface.surface.sysOnSurfaceVariant}\r\n />\r\n )}\r\n </View>\r\n )}\r\n\r\n {/* ── Content ───────────────────────────────────────────────────────── */}\r\n <View style={[styles.content, { gap: vp.contentGap }]}>\r\n {/* Text block */}\r\n <View\r\n style={[styles.textBlock, { gap: dim.spacing.padding.sysPadding4 }]}\r\n >\r\n <Text\r\n style={{\r\n color: cr.surface.surface.sysOnSurface,\r\n fontSize: vp.titleFontSize,\r\n lineHeight: vp.titleLineHeight,\r\n fontWeight: '400',\r\n textAlign: 'center',\r\n includeFontPadding: false,\r\n }}\r\n >\r\n {title}\r\n </Text>\r\n\r\n {showDescription && description && (\r\n <Text\r\n style={{\r\n color: cr.surface.surface.sysOnSurfaceVariant,\r\n fontSize: vp.descFontSize,\r\n lineHeight: vp.descLineHeight,\r\n fontWeight: '400',\r\n textAlign: 'center',\r\n includeFontPadding: false,\r\n }}\r\n >\r\n {description}\r\n </Text>\r\n )}\r\n </View>\r\n\r\n {/* Action button */}\r\n {hasAction && actionLabel && (\r\n <Pressable\r\n onPress={onAction}\r\n accessibilityRole=\"button\"\r\n accessibilityLabel={actionLabel}\r\n style={({ pressed }) => [\r\n styles.actionBtn,\r\n {\r\n height: vp.btnHeight,\r\n paddingLeft: vp.btnPaddingL,\r\n paddingRight: vp.btnPaddingR,\r\n gap: vp.btnGap,\r\n borderWidth: dim.borderWidth.sysStrokeThin,\r\n borderColor: cr.outline.sysOutline,\r\n },\r\n pressed && { opacity: 0.76 },\r\n ]}\r\n >\r\n <Ionicons\r\n name=\"add\"\r\n size={16}\r\n color={cr.surface.surface.sysOnSurface}\r\n />\r\n <Text\r\n style={{\r\n color: cr.surface.surface.sysOnSurface,\r\n fontSize: vp.btnFontSize,\r\n lineHeight: vp.btnLineHeight,\r\n letterSpacing: vp.btnTracking,\r\n fontWeight: '400',\r\n includeFontPadding: false,\r\n }}\r\n >\r\n {actionLabel}\r\n </Text>\r\n </Pressable>\r\n )}\r\n </View>\r\n </View>\r\n );\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n root: {\r\n alignItems: 'center',\r\n alignSelf: 'center',\r\n },\r\n\r\n // ── Icon circle ───────────────────────────────────────────────────────────\r\n iconCircle: {\r\n borderRadius: 9999,\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n overflow: 'hidden',\r\n },\r\n\r\n // ── Content block ─────────────────────────────────────────────────────────\r\n content: {\r\n alignItems: 'center',\r\n alignSelf: 'stretch',\r\n },\r\n textBlock: {\r\n alignSelf: 'stretch',\r\n alignItems: 'center',\r\n },\r\n\r\n // ── Action button ─────────────────────────────────────────────────────────\r\n actionBtn: {\r\n flexDirection: 'row',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n borderRadius: 9999,\r\n overflow: 'hidden',\r\n },\r\n\r\n // ── Illustration ──────────────────────────────────────────────────────────\r\n illusContainer: {\r\n overflow: 'hidden',\r\n position: 'relative',\r\n },\r\n card: {\r\n position: 'absolute',\r\n overflow: 'hidden',\r\n },\r\n cardFaded: {\r\n opacity: 0.48,\r\n },\r\n cardActive: {\r\n // Active ring: sysPrimary08 spread shadow\r\n shadowOffset: { width: 0, height: 0 },\r\n shadowOpacity: 0.08,\r\n shadowRadius: 0,\r\n elevation: 0,\r\n },\r\n skeletonLine: {\r\n position: 'absolute',\r\n height: Math.round(6 * SCALE),\r\n borderRadius: 9999,\r\n },\r\n});\r\n"],"names":["EmptyState","ILLUS_W","ILLUS_H","SCALE","CARD_W","Math","round","CARD_H","scaledPos","left","top","EmptyIllustration","cr","dim","central","positions","View","accessible","importantForAccessibility","style","styles","illusContainer","width","height","map","pos","i","card","borderWidth","sysStrokeThin","borderRadius","sysRadiusMd","borderColor","outline","sysOutlineVariant","backgroundColor","surface","surfaceContainer","sysSurfaceContainerLowest","cardFaded","cardActive","accent","primary","sysPrimary","shadowColor","skeletonLine","sysSurfaceContainer","viewport","title","description","showDescription","icon","actionLabel","onAction","showAction","containerStyle","colorRoles","dimensions","typeScale","ts","useTheme","viewportTokens","useMemo","desktop","iconCircle","iconSize","titleFontSize","titleMedium","sysFontSize","titleLineHeight","sysLineHeight","descFontSize","bodyMedium","descLineHeight","contentGap","spacing","padding","sysPadding24","btnHeight","btnPaddingL","sysPadding16","btnPaddingR","btnGap","sysPadding8","btnFontSize","labelMedium","btnLineHeight","btnTracking","sysTracking","mobile","labelLarge","bodySmall","sysPadding12","sysPadding4","labelSmall","vp","hasAction","undefined","root","sysRadiusLg","gap","sysSurfaceContainerLow","Ionicons","name","size","color","sysOnSurfaceVariant","content","textBlock","Text","sysOnSurface","fontSize","lineHeight","fontWeight","textAlign","includeFontPadding","Pressable","onPress","accessibilityRole","accessibilityLabel","pressed","actionBtn","paddingLeft","paddingRight","sysOutline","opacity","letterSpacing","StyleSheet","create","alignItems","alignSelf","justifyContent","overflow","flexDirection","position","shadowOffset","shadowOpacity","shadowRadius","elevation"],"mappings":";;;;+BAkKgBA;;;eAAAA;;;;+DAlKe;6BASxB;6BAEkB;uBAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BzB,iFAAiF;AACjF,uEAAuE;AACvE,uEAAuE;AAEvE,MAAMC,UAAU;AAChB,MAAMC,UAAU;AAChB,MAAMC,QAAQF,UAAU,KAAK,UAAU;AAEvC,MAAMG,SAASC,KAAKC,KAAK,CAAC,MAAMH,QAAQ,MAAM;AAC9C,MAAMI,SAASF,KAAKC,KAAK,CAAC,KAAKH,QAAQ,KAAK;AAE5C,SAASK,UAAUC,IAAY,EAAEC,GAAW;IAC1C,OAAO;QACLD,MAAMJ,KAAKC,KAAK,CAACG,OAAON;QACxBO,KAAKL,KAAKC,KAAK,CAACI,MAAMP;IACxB;AACF;AAKA,SAASQ,kBAAkB,EAAEC,EAAE,EAAEC,GAAG,EAAuC;IACzE,qDAAqD;IACrD,sBAAsB;IACtB,MAAMC,UAAUN,UAAU,KAAK;IAC/B,0BAA0B;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,WAAW;QACTY,eAAe;QACfJ,YAAY;QACZE,gBAAgB;QAChBrG,cAAc;QACdsG,UAAU;IACZ;IAEA,6EAA6E;IAC7E/G,gBAAgB;QACd+G,UAAU;QACVE,UAAU;IACZ;IACA3G,MAAM;QACJ2G,UAAU;QACVF,UAAU;IACZ;IACA7F,WAAW;QACTsF,SAAS;IACX;IACArF,YAAY;QACV,0CAA0C;QAC1C+F,cAAc;YAAEjH,OAAO;YAAGC,QAAQ;QAAE;QACpCiH,eAAe;QACfC,cAAc;QACdC,WAAW;IACb;IACA7F,cAAc;QACZyF,UAAU;QACV/G,QAAQlB,KAAKC,KAAK,CAAC,IAAIH;QACvB2B,cAAc;IAChB;AACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type TextProps } from 'react-native';
|
|
3
|
+
export type HeaderVariant = 'large' | 'medium' | 'small' | 'headlineLarge' | 'headlineMedium' | 'headlineSmall' | 'titleLarge' | 'titleMedium' | 'titleSmall';
|
|
4
|
+
export interface HeaderTextProps extends TextProps {
|
|
5
|
+
variant?: HeaderVariant;
|
|
6
|
+
emphasized?: boolean;
|
|
7
|
+
color?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function HeaderText({ variant, emphasized, color, style, ...rest }: HeaderTextProps): React.JSX.Element;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "HeaderText", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return HeaderText;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
13
|
+
const _reactnative = require("react-native");
|
|
14
|
+
const _expofont = require("expo-font");
|
|
15
|
+
const _theme = require("../../theme");
|
|
16
|
+
function _interop_require_default(obj) {
|
|
17
|
+
return obj && obj.__esModule ? obj : {
|
|
18
|
+
default: obj
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const FONT_FAMILY = {
|
|
22
|
+
regular: 'GoogleSans_400Regular',
|
|
23
|
+
medium: 'GoogleSans_500Medium',
|
|
24
|
+
semibold: 'GoogleSans_600SemiBold'
|
|
25
|
+
};
|
|
26
|
+
const VARIANT_TOKEN_KEY = {
|
|
27
|
+
large: 'displayLarge',
|
|
28
|
+
medium: 'displayMedium',
|
|
29
|
+
small: 'displaySmall',
|
|
30
|
+
headlineLarge: 'headlineLarge',
|
|
31
|
+
headlineMedium: 'headlineMedium',
|
|
32
|
+
headlineSmall: 'headlineSmall',
|
|
33
|
+
titleLarge: 'titleLarge',
|
|
34
|
+
titleMedium: 'titleMedium',
|
|
35
|
+
titleSmall: 'titleSmall'
|
|
36
|
+
};
|
|
37
|
+
function HeaderText({ variant = 'medium', emphasized = false, color, style, ...rest }) {
|
|
38
|
+
const { typeScale: ts } = (0, _theme.useTheme)();
|
|
39
|
+
const [fontsLoaded] = (0, _expofont.useFonts)({
|
|
40
|
+
GoogleSans_400Regular: require('../../fonts/GoogleSans_400Regular.ttf'),
|
|
41
|
+
GoogleSans_500Medium: require('../../fonts/GoogleSans_500Medium.ttf'),
|
|
42
|
+
GoogleSans_600SemiBold: require('../../fonts/GoogleSans_600SemiBold.ttf')
|
|
43
|
+
});
|
|
44
|
+
const token = ts[VARIANT_TOKEN_KEY[variant]];
|
|
45
|
+
const weight = emphasized ? token.sysFontWeightEmphasized : token.sysFontWeight;
|
|
46
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.Text, {
|
|
47
|
+
accessibilityRole: "header",
|
|
48
|
+
style: [
|
|
49
|
+
{
|
|
50
|
+
fontFamily: fontsLoaded ? FONT_FAMILY[weight] : undefined,
|
|
51
|
+
fontSize: token.sysFontSize,
|
|
52
|
+
lineHeight: token.sysLineHeight,
|
|
53
|
+
letterSpacing: token.sysTracking,
|
|
54
|
+
color
|
|
55
|
+
},
|
|
56
|
+
style
|
|
57
|
+
],
|
|
58
|
+
...rest
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/react-native/src/components/HeaderText/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 HeaderVariant =\r\n | 'large'\r\n | 'medium'\r\n | 'small'\r\n | 'headlineLarge'\r\n | 'headlineMedium'\r\n | 'headlineSmall'\r\n | 'titleLarge'\r\n | 'titleMedium'\r\n | 'titleSmall';\r\n\r\nexport interface HeaderTextProps extends TextProps {\r\n variant?: HeaderVariant;\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<HeaderVariant, string> = {\r\n large: 'displayLarge',\r\n medium: 'displayMedium',\r\n small: 'displaySmall',\r\n headlineLarge: 'headlineLarge',\r\n headlineMedium: 'headlineMedium',\r\n headlineSmall: 'headlineSmall',\r\n titleLarge: 'titleLarge',\r\n titleMedium: 'titleMedium',\r\n titleSmall: 'titleSmall',\r\n};\r\n\r\nexport function HeaderText({\r\n variant = 'medium',\r\n emphasized = false,\r\n color,\r\n style,\r\n ...rest\r\n}: HeaderTextProps) {\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 accessibilityRole=\"header\"\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":["HeaderText","FONT_FAMILY","regular","medium","semibold","VARIANT_TOKEN_KEY","large","small","headlineLarge","headlineMedium","headlineSmall","titleLarge","titleMedium","titleSmall","variant","emphasized","color","style","rest","typeScale","ts","useTheme","fontsLoaded","useFonts","GoogleSans_400Regular","require","GoogleSans_500Medium","GoogleSans_600SemiBold","token","weight","sysFontWeightEmphasized","sysFontWeight","Text","accessibilityRole","fontFamily","undefined","fontSize","sysFontSize","lineHeight","sysLineHeight","letterSpacing","sysTracking"],"mappings":";;;;+BA2CgBA;;;eAAAA;;;;8DA3CE;6BAEmB;0BAEZ;uBAEA;;;;;;AAmBzB,MAAMC,cAAsC;IAC1CC,SAAS;IACTC,QAAQ;IACRC,UAAU;AACZ;AAEA,MAAMC,oBAAmD;IACvDC,OAAO;IACPH,QAAQ;IACRI,OAAO;IACPC,eAAe;IACfC,gBAAgB;IAChBC,eAAe;IACfC,YAAY;IACZC,aAAa;IACbC,YAAY;AACd;AAEO,SAASb,WAAW,EACzBc,UAAU,QAAQ,EAClBC,aAAa,KAAK,EAClBC,KAAK,EACLC,KAAK,EACL,GAAGC,MACa;IAChB,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,CAACf,iBAAiB,CAACS,QAAQ,CAAoB;IAC/D,MAAMe,SAASd,aACXa,MAAME,uBAAuB,GAC7BF,MAAMG,aAAa;IAEvB,qBACE,qBAACC,iBAAI;QACHC,mBAAkB;QAClBhB,OAAO;YACL;gBACEiB,YAAYZ,cAAcrB,WAAW,CAAC4B,OAAO,GAAGM;gBAChDC,UAAUR,MAAMS,WAAW;gBAC3BC,YAAYV,MAAMW,aAAa;gBAC/BC,eAAeZ,MAAMa,WAAW;gBAChCzB;YACF;YACAC;SACD;QACA,GAAGC,IAAI;;AAGd"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextInputProps } from 'react-native';
|
|
3
|
+
export type InputSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export interface InputProps extends Omit<TextInputProps, 'style'> {
|
|
5
|
+
size?: InputSize;
|
|
6
|
+
label?: string;
|
|
7
|
+
helperText?: string;
|
|
8
|
+
errorText?: string;
|
|
9
|
+
invalid?: boolean;
|
|
10
|
+
leadingIcon?: React.ReactNode;
|
|
11
|
+
trailingIcon?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function Input({ size, label, helperText, errorText, invalid, leadingIcon, trailingIcon, editable, onFocus, onBlur, ...rest }: InputProps): React.JSX.Element;
|