@webority-technologies/mobile 0.0.4 → 0.0.6
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/README.md +72 -0
- package/lib/commonjs/components/Accordion/Accordion.js +20 -1
- package/lib/commonjs/components/Avatar/Avatar.js +12 -2
- package/lib/commonjs/components/Badge/Badge.js +17 -10
- package/lib/commonjs/components/Banner/Banner.js +17 -5
- package/lib/commonjs/components/Button/Button.js +5 -2
- package/lib/commonjs/components/Card/Card.js +22 -10
- package/lib/commonjs/components/Carousel/Carousel.js +18 -1
- package/lib/commonjs/components/Chip/Chip.js +27 -15
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +19 -9
- package/lib/commonjs/components/ListItem/ListItem.js +15 -8
- package/lib/commonjs/components/Rating/Rating.js +11 -1
- package/lib/commonjs/components/Stepper/Stepper.js +13 -3
- package/lib/module/components/Accordion/Accordion.js +20 -1
- package/lib/module/components/Avatar/Avatar.js +12 -2
- package/lib/module/components/Badge/Badge.js +17 -10
- package/lib/module/components/Banner/Banner.js +17 -5
- package/lib/module/components/Button/Button.js +6 -3
- package/lib/module/components/Card/Card.js +22 -10
- package/lib/module/components/Carousel/Carousel.js +18 -1
- package/lib/module/components/Chip/Chip.js +27 -15
- package/lib/module/components/ImageGallery/ImageGallery.js +11 -1
- package/lib/module/components/ListItem/ListItem.js +15 -8
- package/lib/module/components/Rating/Rating.js +11 -1
- package/lib/module/components/Stepper/Stepper.js +13 -3
- package/lib/typescript/commonjs/components/Accordion/Accordion.d.ts +7 -0
- package/lib/typescript/commonjs/components/Avatar/Avatar.d.ts +6 -0
- package/lib/typescript/commonjs/components/Badge/Badge.d.ts +6 -0
- package/lib/typescript/commonjs/components/Banner/Banner.d.ts +6 -0
- package/lib/typescript/commonjs/components/Button/Button.d.ts +5 -0
- package/lib/typescript/commonjs/components/Card/Card.d.ts +6 -0
- package/lib/typescript/commonjs/components/Carousel/Carousel.d.ts +7 -0
- package/lib/typescript/commonjs/components/Chip/Chip.d.ts +6 -0
- package/lib/typescript/commonjs/components/ImageGallery/ImageGallery.d.ts +6 -0
- package/lib/typescript/commonjs/components/ListItem/ListItem.d.ts +6 -0
- package/lib/typescript/commonjs/components/Rating/Rating.d.ts +6 -0
- package/lib/typescript/commonjs/components/Stepper/Stepper.d.ts +6 -0
- package/lib/typescript/module/components/Accordion/Accordion.d.ts +7 -0
- package/lib/typescript/module/components/Avatar/Avatar.d.ts +6 -0
- package/lib/typescript/module/components/Badge/Badge.d.ts +6 -0
- package/lib/typescript/module/components/Banner/Banner.d.ts +6 -0
- package/lib/typescript/module/components/Button/Button.d.ts +5 -0
- package/lib/typescript/module/components/Card/Card.d.ts +6 -0
- package/lib/typescript/module/components/Carousel/Carousel.d.ts +7 -0
- package/lib/typescript/module/components/Chip/Chip.d.ts +6 -0
- package/lib/typescript/module/components/ImageGallery/ImageGallery.d.ts +6 -0
- package/lib/typescript/module/components/ListItem/ListItem.d.ts +6 -0
- package/lib/typescript/module/components/Rating/Rating.d.ts +6 -0
- package/lib/typescript/module/components/Stepper/Stepper.d.ts +6 -0
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _index = require("../../theme/index.js");
|
|
10
10
|
var _hapticUtils = require("../../utils/hapticUtils.js");
|
|
11
|
+
var _index2 = require("../Skeleton/index.js");
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
14
|
const sizePxMap = {
|
|
@@ -83,6 +84,7 @@ const Rating = exports.Rating = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
83
84
|
size = 'md',
|
|
84
85
|
tone = 'warning',
|
|
85
86
|
label,
|
|
87
|
+
loading = false,
|
|
86
88
|
accessibilityLabel,
|
|
87
89
|
style,
|
|
88
90
|
testID
|
|
@@ -168,7 +170,7 @@ const Rating = exports.Rating = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
168
170
|
children: star
|
|
169
171
|
}, i));
|
|
170
172
|
}
|
|
171
|
-
|
|
173
|
+
const rendered = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
172
174
|
style: [styles.wrapper, style],
|
|
173
175
|
ref: ref,
|
|
174
176
|
testID: testID,
|
|
@@ -198,6 +200,14 @@ const Rating = exports.Rating = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
198
200
|
children: stars
|
|
199
201
|
})]
|
|
200
202
|
});
|
|
203
|
+
if (loading) {
|
|
204
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.SkeletonContent, {
|
|
205
|
+
loading: true,
|
|
206
|
+
mode: "auto",
|
|
207
|
+
children: rendered
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
return rendered;
|
|
201
211
|
});
|
|
202
212
|
Rating.displayName = 'Rating';
|
|
203
213
|
const starStyles = _reactNative.StyleSheet.create({
|
|
@@ -8,6 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _index = require("../../theme/index.js");
|
|
10
10
|
var _hapticUtils = require("../../utils/hapticUtils.js");
|
|
11
|
+
var _index2 = require("../Skeleton/index.js");
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
14
|
const CIRCLE_SIZE = 24;
|
|
@@ -164,6 +165,7 @@ const Stepper = exports.Stepper = /*#__PURE__*/(0, _react.forwardRef)((props, re
|
|
|
164
165
|
onStepPress,
|
|
165
166
|
variant = 'horizontal',
|
|
166
167
|
tone = 'primary',
|
|
168
|
+
loading = false,
|
|
167
169
|
accessibilityLabel,
|
|
168
170
|
style,
|
|
169
171
|
testID
|
|
@@ -238,7 +240,7 @@ const Stepper = exports.Stepper = /*#__PURE__*/(0, _react.forwardRef)((props, re
|
|
|
238
240
|
fontSize: theme.typography.fontSize.xs
|
|
239
241
|
}],
|
|
240
242
|
numberOfLines: 1,
|
|
241
|
-
children: step
|
|
243
|
+
children: step?.label ?? ' '
|
|
242
244
|
})]
|
|
243
245
|
}, step.key);
|
|
244
246
|
})]
|
|
@@ -286,7 +288,7 @@ const Stepper = exports.Stepper = /*#__PURE__*/(0, _react.forwardRef)((props, re
|
|
|
286
288
|
fontWeight: theme.typography.fontWeight.semibold
|
|
287
289
|
}],
|
|
288
290
|
numberOfLines: 1,
|
|
289
|
-
children: step
|
|
291
|
+
children: step?.label ?? ' '
|
|
290
292
|
}), step.description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
291
293
|
style: [styles.vDescription, {
|
|
292
294
|
color: theme.colors.text.secondary,
|
|
@@ -299,7 +301,7 @@ const Stepper = exports.Stepper = /*#__PURE__*/(0, _react.forwardRef)((props, re
|
|
|
299
301
|
}, step.key);
|
|
300
302
|
})
|
|
301
303
|
});
|
|
302
|
-
|
|
304
|
+
const rendered = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
303
305
|
ref: ref,
|
|
304
306
|
style: [styles.container, style],
|
|
305
307
|
testID: testID,
|
|
@@ -312,6 +314,14 @@ const Stepper = exports.Stepper = /*#__PURE__*/(0, _react.forwardRef)((props, re
|
|
|
312
314
|
},
|
|
313
315
|
children: variant === 'horizontal' ? renderHorizontal() : renderVertical()
|
|
314
316
|
});
|
|
317
|
+
if (loading) {
|
|
318
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.SkeletonContent, {
|
|
319
|
+
loading: true,
|
|
320
|
+
mode: "auto",
|
|
321
|
+
children: rendered
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
return rendered;
|
|
315
325
|
});
|
|
316
326
|
Stepper.displayName = 'Stepper';
|
|
317
327
|
const buildStyles = theme => _reactNative.StyleSheet.create({
|
|
@@ -4,6 +4,7 @@ import React, { createContext, useCallback, useContext, useEffect, useMemo, useR
|
|
|
4
4
|
import { Animated, Easing, LayoutAnimation, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
5
5
|
import { useTheme } from "../../theme/index.js";
|
|
6
6
|
import { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
7
|
+
import { SkeletonContent } from "../Skeleton/index.js";
|
|
7
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
9
|
const AccordionGroupContext = /*#__PURE__*/createContext(null);
|
|
9
10
|
const useAccordionGroup = () => useContext(AccordionGroupContext);
|
|
@@ -86,7 +87,8 @@ const Accordion = props => {
|
|
|
86
87
|
style,
|
|
87
88
|
headerStyle,
|
|
88
89
|
contentStyle,
|
|
89
|
-
testID
|
|
90
|
+
testID,
|
|
91
|
+
loading = false
|
|
90
92
|
} = props;
|
|
91
93
|
const theme = useTheme();
|
|
92
94
|
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
@@ -152,6 +154,23 @@ const Accordion = props => {
|
|
|
152
154
|
backgroundColor: theme.colors.background.elevated,
|
|
153
155
|
borderRadius: theme.radius.md
|
|
154
156
|
}] : null;
|
|
157
|
+
if (loading) {
|
|
158
|
+
return /*#__PURE__*/_jsx(SkeletonContent, {
|
|
159
|
+
loading: true,
|
|
160
|
+
mode: "auto",
|
|
161
|
+
style: [cardStyle, style],
|
|
162
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
163
|
+
style: styles.header,
|
|
164
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
165
|
+
style: [styles.title, {
|
|
166
|
+
fontSize: theme.typography.fontSize.base
|
|
167
|
+
}],
|
|
168
|
+
numberOfLines: 1,
|
|
169
|
+
children: title ?? ' '
|
|
170
|
+
})
|
|
171
|
+
})
|
|
172
|
+
});
|
|
173
|
+
}
|
|
155
174
|
return /*#__PURE__*/_jsxs(View, {
|
|
156
175
|
style: [cardStyle, style],
|
|
157
176
|
testID: testID,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import React, { Children, cloneElement, forwardRef, isValidElement, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { Animated, Easing, Image, StyleSheet, Text, View } from 'react-native';
|
|
5
5
|
import { useTheme } from "../../theme/index.js";
|
|
6
|
+
import { SkeletonContent } from "../Skeleton/index.js";
|
|
6
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
8
|
const sizeMap = {
|
|
8
9
|
xs: 24,
|
|
@@ -64,6 +65,7 @@ const Avatar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
64
65
|
statusPosition = 'bottomRight',
|
|
65
66
|
backgroundColor,
|
|
66
67
|
color,
|
|
68
|
+
loading = false,
|
|
67
69
|
accessibilityLabel,
|
|
68
70
|
style,
|
|
69
71
|
textStyle,
|
|
@@ -84,7 +86,7 @@ const Avatar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
84
86
|
const statusSize = Math.max(8, Math.round(dimension * 0.25));
|
|
85
87
|
const statusBorder = 2;
|
|
86
88
|
const a11yLabel = accessibilityLabel ?? (name ? `${name}'s avatar` : 'Avatar');
|
|
87
|
-
|
|
89
|
+
const rendered = /*#__PURE__*/_jsxs(View, {
|
|
88
90
|
ref: ref,
|
|
89
91
|
style: [styles.root, {
|
|
90
92
|
width: dimension,
|
|
@@ -114,7 +116,7 @@ const Avatar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
114
116
|
}, textStyle],
|
|
115
117
|
numberOfLines: 1,
|
|
116
118
|
allowFontScaling: false,
|
|
117
|
-
children: initials
|
|
119
|
+
children: initials ?? ' '
|
|
118
120
|
}), status ? /*#__PURE__*/_jsx(View, {
|
|
119
121
|
style: [styles.status, statusPosition === 'topRight' ? styles.statusTopRight : styles.statusBottomRight, {
|
|
120
122
|
width: statusSize,
|
|
@@ -128,6 +130,14 @@ const Avatar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
128
130
|
pointerEvents: "none"
|
|
129
131
|
}) : null]
|
|
130
132
|
});
|
|
133
|
+
if (loading) {
|
|
134
|
+
return /*#__PURE__*/_jsx(SkeletonContent, {
|
|
135
|
+
loading: true,
|
|
136
|
+
mode: "auto",
|
|
137
|
+
children: rendered
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return rendered;
|
|
131
141
|
});
|
|
132
142
|
Avatar.displayName = 'Avatar';
|
|
133
143
|
const styles = StyleSheet.create({
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import React, { forwardRef, useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { Animated, Easing, StyleSheet, Text, View } from 'react-native';
|
|
5
5
|
import { useTheme } from "../../theme/index.js";
|
|
6
|
+
import { SkeletonContent } from "../Skeleton/index.js";
|
|
6
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
8
|
const toneFor = (theme, tone) => {
|
|
8
9
|
switch (tone) {
|
|
@@ -97,6 +98,7 @@ const Badge = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
97
98
|
tone = 'error',
|
|
98
99
|
size = 'sm',
|
|
99
100
|
invisible = false,
|
|
101
|
+
loading = false,
|
|
100
102
|
children,
|
|
101
103
|
anchor = 'topRight',
|
|
102
104
|
pulse = false,
|
|
@@ -169,23 +171,28 @@ const Badge = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
169
171
|
}, textStyle],
|
|
170
172
|
numberOfLines: 1,
|
|
171
173
|
allowFontScaling: false,
|
|
172
|
-
children: formatted
|
|
174
|
+
children: formatted ?? ' '
|
|
173
175
|
}) : null
|
|
174
176
|
}) : null;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
return /*#__PURE__*/_jsx(View, {
|
|
177
|
+
const rendered = children ? /*#__PURE__*/_jsxs(View, {
|
|
178
|
+
ref: ref,
|
|
179
|
+
style: [styles.wrapper, style],
|
|
180
|
+
testID: testID,
|
|
181
|
+
children: [children, badgeContent]
|
|
182
|
+
}) : /*#__PURE__*/_jsx(View, {
|
|
184
183
|
ref: ref,
|
|
185
184
|
style: style,
|
|
186
185
|
testID: testID,
|
|
187
186
|
children: badgeContent
|
|
188
187
|
});
|
|
188
|
+
if (loading) {
|
|
189
|
+
return /*#__PURE__*/_jsx(SkeletonContent, {
|
|
190
|
+
loading: true,
|
|
191
|
+
mode: "auto",
|
|
192
|
+
children: rendered
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
return rendered;
|
|
189
196
|
});
|
|
190
197
|
Badge.displayName = 'Badge';
|
|
191
198
|
const styles = StyleSheet.create({
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import React, { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { Animated, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
5
5
|
import { useTheme } from "../../theme/index.js";
|
|
6
|
+
import { SkeletonContent } from "../Skeleton/index.js";
|
|
6
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
8
|
const Banner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
9
|
const {
|
|
@@ -15,6 +16,7 @@ const Banner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
15
16
|
onDismiss,
|
|
16
17
|
visible = true,
|
|
17
18
|
animateMount = true,
|
|
19
|
+
loading = false,
|
|
18
20
|
accessibilityLabel,
|
|
19
21
|
style,
|
|
20
22
|
testID
|
|
@@ -59,6 +61,8 @@ const Banner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
59
61
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
62
|
}, [visible]);
|
|
61
63
|
if (!mounted) return null;
|
|
64
|
+
const safeTitle = title ?? ' ';
|
|
65
|
+
const safeMessageString = typeof message === 'string' ? message ?? ' ' : '';
|
|
62
66
|
const renderIcon = () => {
|
|
63
67
|
if (icon === false) return null;
|
|
64
68
|
if (icon) return /*#__PURE__*/_jsx(View, {
|
|
@@ -81,7 +85,7 @@ const Banner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
81
85
|
const messageString = typeof message === 'string' ? message : '';
|
|
82
86
|
const builtA11y = accessibilityLabel ?? (title ? `${title}. ${messageString}` : messageString || undefined);
|
|
83
87
|
const liveRegion = variant === 'error' ? 'assertive' : 'polite';
|
|
84
|
-
|
|
88
|
+
const rendered = /*#__PURE__*/_jsxs(Animated.View, {
|
|
85
89
|
ref: ref,
|
|
86
90
|
accessibilityRole: 'alert',
|
|
87
91
|
accessibilityLiveRegion: liveRegion,
|
|
@@ -104,7 +108,7 @@ const Banner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
104
108
|
style: styles.row,
|
|
105
109
|
children: [renderIcon(), /*#__PURE__*/_jsxs(View, {
|
|
106
110
|
style: styles.textBlock,
|
|
107
|
-
children: [title ? /*#__PURE__*/_jsx(Text, {
|
|
111
|
+
children: [title || loading ? /*#__PURE__*/_jsx(Text, {
|
|
108
112
|
style: {
|
|
109
113
|
color: theme.colors.text.primary,
|
|
110
114
|
fontSize: theme.typography.fontSize.base,
|
|
@@ -112,15 +116,15 @@ const Banner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
112
116
|
lineHeight: 20
|
|
113
117
|
},
|
|
114
118
|
numberOfLines: 2,
|
|
115
|
-
children:
|
|
116
|
-
}) : null, typeof message === 'string' ? /*#__PURE__*/_jsx(Text, {
|
|
119
|
+
children: safeTitle
|
|
120
|
+
}) : null, typeof message === 'string' || loading ? /*#__PURE__*/_jsx(Text, {
|
|
117
121
|
style: {
|
|
118
122
|
color: theme.colors.text.secondary,
|
|
119
123
|
fontSize: theme.typography.fontSize.sm,
|
|
120
124
|
lineHeight: 18,
|
|
121
125
|
marginTop: title ? 2 : 0
|
|
122
126
|
},
|
|
123
|
-
children:
|
|
127
|
+
children: safeMessageString || ' '
|
|
124
128
|
}) : /*#__PURE__*/_jsx(View, {
|
|
125
129
|
style: {
|
|
126
130
|
marginTop: title ? 2 : 0
|
|
@@ -174,6 +178,14 @@ const Banner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
174
178
|
})
|
|
175
179
|
}) : null]
|
|
176
180
|
});
|
|
181
|
+
if (loading) {
|
|
182
|
+
return /*#__PURE__*/_jsx(SkeletonContent, {
|
|
183
|
+
loading: true,
|
|
184
|
+
mode: "auto",
|
|
185
|
+
children: rendered
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return rendered;
|
|
177
189
|
});
|
|
178
190
|
Banner.displayName = 'Banner';
|
|
179
191
|
const tintFor = (theme, variant) => {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, useMemo } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { Animated, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
5
5
|
import { useTheme } from "../../theme/index.js";
|
|
6
6
|
import { usePressAnimation } from "../../hooks/usePressAnimation.js";
|
|
7
7
|
import { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
8
|
+
import { Spinner } from "../Spinner/index.js";
|
|
8
9
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
const Button = /*#__PURE__*/forwardRef((props, ref) => {
|
|
10
11
|
const {
|
|
@@ -50,9 +51,11 @@ const Button = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
50
51
|
const accessibleLabel = accessibilityLabel ?? title;
|
|
51
52
|
const content = /*#__PURE__*/_jsx(View, {
|
|
52
53
|
style: styles.contentRow,
|
|
53
|
-
children: loading ? /*#__PURE__*/_jsx(
|
|
54
|
+
children: loading ? /*#__PURE__*/_jsx(Spinner, {
|
|
55
|
+
variant: "circular",
|
|
56
|
+
size: "small",
|
|
54
57
|
color: variantStyles.textColor,
|
|
55
|
-
|
|
58
|
+
accessibilityLabel: "Loading"
|
|
56
59
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
57
60
|
children: [leftIcon ? /*#__PURE__*/_jsx(View, {
|
|
58
61
|
style: styles.iconLeft,
|
|
@@ -5,6 +5,7 @@ import { Animated, Image, Pressable, StyleSheet, View } from 'react-native';
|
|
|
5
5
|
import { useTheme } from "../../theme/index.js";
|
|
6
6
|
import { usePressAnimation } from "../../hooks/usePressAnimation.js";
|
|
7
7
|
import { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
8
|
+
import { SkeletonContent } from "../Skeleton/index.js";
|
|
8
9
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
const paddingMap = {
|
|
10
11
|
none: 'none',
|
|
@@ -27,6 +28,7 @@ const Card = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27
28
|
imageHeight = 160,
|
|
28
29
|
imageAspectRatio,
|
|
29
30
|
imageOverlay,
|
|
31
|
+
loading = false,
|
|
30
32
|
onPress,
|
|
31
33
|
accessibilityLabel,
|
|
32
34
|
accessibilityHint,
|
|
@@ -127,12 +129,13 @@ const Card = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
127
129
|
children: innerContent
|
|
128
130
|
})]
|
|
129
131
|
}) : innerContent;
|
|
132
|
+
let rendered;
|
|
130
133
|
if (isInteractive) {
|
|
131
134
|
const handlePress = event => {
|
|
132
135
|
triggerHaptic('selection');
|
|
133
136
|
onPress?.(event);
|
|
134
137
|
};
|
|
135
|
-
|
|
138
|
+
rendered = /*#__PURE__*/_jsx(Animated.View, {
|
|
136
139
|
style: [{
|
|
137
140
|
transform: [{
|
|
138
141
|
scale
|
|
@@ -156,16 +159,25 @@ const Card = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
156
159
|
children: content
|
|
157
160
|
})
|
|
158
161
|
});
|
|
162
|
+
} else {
|
|
163
|
+
rendered = /*#__PURE__*/_jsx(View, {
|
|
164
|
+
ref: ref,
|
|
165
|
+
accessibilityLabel: accessibilityLabel,
|
|
166
|
+
accessibilityHint: accessibilityHint,
|
|
167
|
+
accessibilityRole: accessibilityRole,
|
|
168
|
+
testID: testID,
|
|
169
|
+
style: [containerStyle, style],
|
|
170
|
+
children: content
|
|
171
|
+
});
|
|
159
172
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
});
|
|
173
|
+
if (loading) {
|
|
174
|
+
return /*#__PURE__*/_jsx(SkeletonContent, {
|
|
175
|
+
loading: true,
|
|
176
|
+
mode: "auto",
|
|
177
|
+
children: rendered
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
return rendered;
|
|
169
181
|
});
|
|
170
182
|
Card.displayName = 'Card';
|
|
171
183
|
const buildStyles = theme => StyleSheet.create({
|
|
@@ -26,6 +26,7 @@ import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo
|
|
|
26
26
|
import { Animated, Dimensions, FlatList, Image, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
|
|
27
27
|
import { useTheme } from "../../theme/index.js";
|
|
28
28
|
import { triggerHaptic } from "../../utils/index.js";
|
|
29
|
+
import { SkeletonContent } from "../Skeleton/index.js";
|
|
29
30
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
30
31
|
// We intentionally use a generic forwardRef wrapper — the inner component is
|
|
31
32
|
// untyped at the generic level (forwardRef can't preserve generics in TS yet),
|
|
@@ -49,7 +50,8 @@ const CarouselInner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
49
50
|
accessibilityLabel,
|
|
50
51
|
testID,
|
|
51
52
|
showThumbnails = false,
|
|
52
|
-
renderThumbnail
|
|
53
|
+
renderThumbnail,
|
|
54
|
+
loading = false
|
|
53
55
|
} = props;
|
|
54
56
|
const theme = useTheme();
|
|
55
57
|
const isControlled = typeof controlledIndex === 'number';
|
|
@@ -210,6 +212,21 @@ const CarouselInner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
210
212
|
offset: slideStride * i,
|
|
211
213
|
index: i
|
|
212
214
|
}), [slideStride]);
|
|
215
|
+
if (loading) {
|
|
216
|
+
const slideWidth = itemWidth === 'screen' ? containerWidth || 320 : itemWidth;
|
|
217
|
+
return /*#__PURE__*/_jsx(SkeletonContent, {
|
|
218
|
+
loading: true,
|
|
219
|
+
mode: "auto",
|
|
220
|
+
style: [styles.container, containerStyle],
|
|
221
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
222
|
+
style: {
|
|
223
|
+
width: slideWidth,
|
|
224
|
+
height: 160,
|
|
225
|
+
borderRadius: 12
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
});
|
|
229
|
+
}
|
|
213
230
|
return /*#__PURE__*/_jsxs(View, {
|
|
214
231
|
style: [styles.container, containerStyle],
|
|
215
232
|
onLayout: e => setContainerWidth(e.nativeEvent.layout.width),
|
|
@@ -5,6 +5,7 @@ import { Animated, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
|
5
5
|
import { useTheme } from "../../theme/index.js";
|
|
6
6
|
import { usePressAnimation } from "../../hooks/usePressAnimation.js";
|
|
7
7
|
import { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
8
|
+
import { SkeletonContent } from "../Skeleton/index.js";
|
|
8
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
const toneFor = (theme, tone) => {
|
|
10
11
|
switch (tone) {
|
|
@@ -96,6 +97,7 @@ const Chip = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
96
97
|
tone = 'neutral',
|
|
97
98
|
size = 'md',
|
|
98
99
|
disabled = false,
|
|
100
|
+
loading = false,
|
|
99
101
|
accessibilityLabel,
|
|
100
102
|
style,
|
|
101
103
|
textStyle,
|
|
@@ -154,7 +156,7 @@ const Chip = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
154
156
|
fontWeight: theme.typography.fontWeight.medium
|
|
155
157
|
}, textStyle],
|
|
156
158
|
numberOfLines: 1,
|
|
157
|
-
children: label
|
|
159
|
+
children: label ?? ' '
|
|
158
160
|
}), onClose ? /*#__PURE__*/_jsx(Pressable, {
|
|
159
161
|
onPress: handleClose,
|
|
160
162
|
disabled: disabled,
|
|
@@ -195,8 +197,9 @@ const Chip = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
195
197
|
borderColor,
|
|
196
198
|
opacity: disabled ? 0.55 : 1
|
|
197
199
|
};
|
|
200
|
+
let rendered;
|
|
198
201
|
if (isPressable) {
|
|
199
|
-
|
|
202
|
+
rendered = /*#__PURE__*/_jsx(Animated.View, {
|
|
200
203
|
style: {
|
|
201
204
|
transform: [{
|
|
202
205
|
scale
|
|
@@ -228,20 +231,29 @@ const Chip = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
228
231
|
children: content
|
|
229
232
|
})
|
|
230
233
|
});
|
|
234
|
+
} else {
|
|
235
|
+
rendered = /*#__PURE__*/_jsx(View, {
|
|
236
|
+
ref: ref,
|
|
237
|
+
style: [styles.base, baseStyle, style],
|
|
238
|
+
accessible: true,
|
|
239
|
+
accessibilityRole: "text",
|
|
240
|
+
accessibilityLabel: a11yLabel,
|
|
241
|
+
accessibilityState: {
|
|
242
|
+
selected,
|
|
243
|
+
disabled
|
|
244
|
+
},
|
|
245
|
+
testID: testID,
|
|
246
|
+
children: content
|
|
247
|
+
});
|
|
231
248
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
disabled
|
|
241
|
-
},
|
|
242
|
-
testID: testID,
|
|
243
|
-
children: content
|
|
244
|
-
});
|
|
249
|
+
if (loading) {
|
|
250
|
+
return /*#__PURE__*/_jsx(SkeletonContent, {
|
|
251
|
+
loading: true,
|
|
252
|
+
mode: "auto",
|
|
253
|
+
children: rendered
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
return rendered;
|
|
245
257
|
});
|
|
246
258
|
Chip.displayName = 'Chip';
|
|
247
259
|
const styles = StyleSheet.create({
|
|
@@ -25,6 +25,7 @@ import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
|
25
25
|
import Animated, { runOnJS, useAnimatedStyle, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
|
|
26
26
|
import { Carousel } from "../Carousel/index.js";
|
|
27
27
|
import { AppIcon } from "../AppIcon/index.js";
|
|
28
|
+
import { SkeletonContent } from "../Skeleton/index.js";
|
|
28
29
|
import { useTheme } from "../../theme/index.js";
|
|
29
30
|
import { triggerHaptic } from "../../utils/index.js";
|
|
30
31
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -44,6 +45,7 @@ const ImageGallery = ({
|
|
|
44
45
|
enableLightbox = true,
|
|
45
46
|
enablePinchZoom = true,
|
|
46
47
|
onIndexChange,
|
|
48
|
+
loading = false,
|
|
47
49
|
accessibilityLabel,
|
|
48
50
|
containerStyle,
|
|
49
51
|
testID
|
|
@@ -85,7 +87,7 @@ const ImageGallery = ({
|
|
|
85
87
|
style: styles.thumbnailImage,
|
|
86
88
|
resizeMode: "cover"
|
|
87
89
|
}), [styles]);
|
|
88
|
-
|
|
90
|
+
const rendered = /*#__PURE__*/_jsxs(View, {
|
|
89
91
|
style: [styles.container, containerStyle],
|
|
90
92
|
testID: testID,
|
|
91
93
|
accessibilityLabel: accessibilityLabel ?? 'Image gallery',
|
|
@@ -120,6 +122,14 @@ const ImageGallery = ({
|
|
|
120
122
|
onIndexChange: handleIndexChange
|
|
121
123
|
}) : null]
|
|
122
124
|
});
|
|
125
|
+
if (loading) {
|
|
126
|
+
return /*#__PURE__*/_jsx(SkeletonContent, {
|
|
127
|
+
loading: true,
|
|
128
|
+
mode: "auto",
|
|
129
|
+
children: rendered
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return rendered;
|
|
123
133
|
};
|
|
124
134
|
ImageGallery.displayName = 'ImageGallery';
|
|
125
135
|
|
|
@@ -6,6 +6,7 @@ import { useTheme } from "../../theme/index.js";
|
|
|
6
6
|
import { usePressAnimation } from "../../hooks/usePressAnimation.js";
|
|
7
7
|
import { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
8
8
|
import { Swipeable } from "../Swipeable/index.js";
|
|
9
|
+
import { SkeletonContent } from "../Skeleton/index.js";
|
|
9
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
11
|
const sizeFor = (theme, size) => {
|
|
11
12
|
switch (size) {
|
|
@@ -51,6 +52,7 @@ const chevronStyles = StyleSheet.create({
|
|
|
51
52
|
const ListItem = /*#__PURE__*/forwardRef((props, ref) => {
|
|
52
53
|
const {
|
|
53
54
|
title,
|
|
55
|
+
loading = false,
|
|
54
56
|
subtitle,
|
|
55
57
|
description,
|
|
56
58
|
left,
|
|
@@ -103,7 +105,7 @@ const ListItem = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
103
105
|
color: disabled ? theme.colors.text.disabled : theme.colors.text.primary
|
|
104
106
|
}],
|
|
105
107
|
numberOfLines: 1,
|
|
106
|
-
children: title
|
|
108
|
+
children: title ?? ' '
|
|
107
109
|
}), subtitle ? /*#__PURE__*/_jsx(Text, {
|
|
108
110
|
style: [styles.subtitle, {
|
|
109
111
|
fontSize: sz.subtitleSize,
|
|
@@ -174,15 +176,20 @@ const ListItem = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
174
176
|
|
|
175
177
|
// Wrap in Swipeable only when at least one side has actions; otherwise keep zero gesture overhead.
|
|
176
178
|
const hasSwipe = leftActions && leftActions.length > 0 || rightActions && rightActions.length > 0;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
const final = hasSwipe ? /*#__PURE__*/_jsx(Swipeable, {
|
|
180
|
+
leftActions: leftActions,
|
|
181
|
+
rightActions: rightActions,
|
|
182
|
+
accessibilityLabel: a11yLabel,
|
|
183
|
+
children: rendered
|
|
184
|
+
}) : rendered;
|
|
185
|
+
if (loading) {
|
|
186
|
+
return /*#__PURE__*/_jsx(SkeletonContent, {
|
|
187
|
+
loading: true,
|
|
188
|
+
mode: "auto",
|
|
189
|
+
children: final
|
|
183
190
|
});
|
|
184
191
|
}
|
|
185
|
-
return
|
|
192
|
+
return final;
|
|
186
193
|
});
|
|
187
194
|
ListItem.displayName = 'ListItem';
|
|
188
195
|
const buildStyles = theme => StyleSheet.create({
|
|
@@ -4,6 +4,7 @@ import React, { forwardRef, useCallback, useMemo, useRef } from 'react';
|
|
|
4
4
|
import { Animated, Easing, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
5
5
|
import { useTheme } from "../../theme/index.js";
|
|
6
6
|
import { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
7
|
+
import { SkeletonContent } from "../Skeleton/index.js";
|
|
7
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
9
|
const sizePxMap = {
|
|
9
10
|
sm: 16,
|
|
@@ -78,6 +79,7 @@ const Rating = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
78
79
|
size = 'md',
|
|
79
80
|
tone = 'warning',
|
|
80
81
|
label,
|
|
82
|
+
loading = false,
|
|
81
83
|
accessibilityLabel,
|
|
82
84
|
style,
|
|
83
85
|
testID
|
|
@@ -163,7 +165,7 @@ const Rating = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
163
165
|
children: star
|
|
164
166
|
}, i));
|
|
165
167
|
}
|
|
166
|
-
|
|
168
|
+
const rendered = /*#__PURE__*/_jsxs(View, {
|
|
167
169
|
style: [styles.wrapper, style],
|
|
168
170
|
ref: ref,
|
|
169
171
|
testID: testID,
|
|
@@ -193,6 +195,14 @@ const Rating = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
193
195
|
children: stars
|
|
194
196
|
})]
|
|
195
197
|
});
|
|
198
|
+
if (loading) {
|
|
199
|
+
return /*#__PURE__*/_jsx(SkeletonContent, {
|
|
200
|
+
loading: true,
|
|
201
|
+
mode: "auto",
|
|
202
|
+
children: rendered
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
return rendered;
|
|
196
206
|
});
|
|
197
207
|
Rating.displayName = 'Rating';
|
|
198
208
|
const starStyles = StyleSheet.create({
|