@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.
Files changed (50) hide show
  1. package/README.md +72 -0
  2. package/lib/commonjs/components/Accordion/Accordion.js +20 -1
  3. package/lib/commonjs/components/Avatar/Avatar.js +12 -2
  4. package/lib/commonjs/components/Badge/Badge.js +17 -10
  5. package/lib/commonjs/components/Banner/Banner.js +17 -5
  6. package/lib/commonjs/components/Button/Button.js +5 -2
  7. package/lib/commonjs/components/Card/Card.js +22 -10
  8. package/lib/commonjs/components/Carousel/Carousel.js +18 -1
  9. package/lib/commonjs/components/Chip/Chip.js +27 -15
  10. package/lib/commonjs/components/ImageGallery/ImageGallery.js +19 -9
  11. package/lib/commonjs/components/ListItem/ListItem.js +15 -8
  12. package/lib/commonjs/components/Rating/Rating.js +11 -1
  13. package/lib/commonjs/components/Stepper/Stepper.js +13 -3
  14. package/lib/module/components/Accordion/Accordion.js +20 -1
  15. package/lib/module/components/Avatar/Avatar.js +12 -2
  16. package/lib/module/components/Badge/Badge.js +17 -10
  17. package/lib/module/components/Banner/Banner.js +17 -5
  18. package/lib/module/components/Button/Button.js +6 -3
  19. package/lib/module/components/Card/Card.js +22 -10
  20. package/lib/module/components/Carousel/Carousel.js +18 -1
  21. package/lib/module/components/Chip/Chip.js +27 -15
  22. package/lib/module/components/ImageGallery/ImageGallery.js +11 -1
  23. package/lib/module/components/ListItem/ListItem.js +15 -8
  24. package/lib/module/components/Rating/Rating.js +11 -1
  25. package/lib/module/components/Stepper/Stepper.js +13 -3
  26. package/lib/typescript/commonjs/components/Accordion/Accordion.d.ts +7 -0
  27. package/lib/typescript/commonjs/components/Avatar/Avatar.d.ts +6 -0
  28. package/lib/typescript/commonjs/components/Badge/Badge.d.ts +6 -0
  29. package/lib/typescript/commonjs/components/Banner/Banner.d.ts +6 -0
  30. package/lib/typescript/commonjs/components/Button/Button.d.ts +5 -0
  31. package/lib/typescript/commonjs/components/Card/Card.d.ts +6 -0
  32. package/lib/typescript/commonjs/components/Carousel/Carousel.d.ts +7 -0
  33. package/lib/typescript/commonjs/components/Chip/Chip.d.ts +6 -0
  34. package/lib/typescript/commonjs/components/ImageGallery/ImageGallery.d.ts +6 -0
  35. package/lib/typescript/commonjs/components/ListItem/ListItem.d.ts +6 -0
  36. package/lib/typescript/commonjs/components/Rating/Rating.d.ts +6 -0
  37. package/lib/typescript/commonjs/components/Stepper/Stepper.d.ts +6 -0
  38. package/lib/typescript/module/components/Accordion/Accordion.d.ts +7 -0
  39. package/lib/typescript/module/components/Avatar/Avatar.d.ts +6 -0
  40. package/lib/typescript/module/components/Badge/Badge.d.ts +6 -0
  41. package/lib/typescript/module/components/Banner/Banner.d.ts +6 -0
  42. package/lib/typescript/module/components/Button/Button.d.ts +5 -0
  43. package/lib/typescript/module/components/Card/Card.d.ts +6 -0
  44. package/lib/typescript/module/components/Carousel/Carousel.d.ts +7 -0
  45. package/lib/typescript/module/components/Chip/Chip.d.ts +6 -0
  46. package/lib/typescript/module/components/ImageGallery/ImageGallery.d.ts +6 -0
  47. package/lib/typescript/module/components/ListItem/ListItem.d.ts +6 -0
  48. package/lib/typescript/module/components/Rating/Rating.d.ts +6 -0
  49. package/lib/typescript/module/components/Stepper/Stepper.d.ts +6 -0
  50. package/package.json +1 -1
package/README.md CHANGED
@@ -394,6 +394,78 @@ For runnable usage of every component, see [`example/`](../../example/).
394
394
 
395
395
  ---
396
396
 
397
+ ## Designing skeleton-aware components
398
+
399
+ Presentational primitives (`Card`, `ListItem`, `Avatar`, `Badge`, `Banner`, `Chip`,
400
+ `Rating`, `Stepper`, `ImageGallery`) accept an optional
401
+ `loading?: boolean` prop. When `true`, the component renders its normal layout wrapped
402
+ in `<SkeletonContent loading mode="auto">` — the walker replaces every `<Text>`,
403
+ `<Image>`, and sized leaf `<View>` with a shimmer block matching the element's
404
+ dimensions. When `loading` is `false` or omitted, behaviour is unchanged.
405
+
406
+ Conventions for components that opt into this pattern:
407
+
408
+ - **Render gracefully with undefined data.** Use optional chaining and string defaults
409
+ so the auto walker has leaves to skeletonize even before data arrives:
410
+ `{item?.title ?? ' '}`, `{item?.subtitle ?? ' '}`. Never let a `<Text>` render `undefined`.
411
+ - **Use explicit dimensions on visual elements.** Set `width`/`height` on `<Image>` and
412
+ `<View>` leaves, and `fontSize` on `<Text>`, so the walker can size each shimmer
413
+ block correctly. Inline styles, `StyleSheet.create`, and arrays all work — they get
414
+ flattened.
415
+ - **Wrap once at the top.** Don't sprinkle `<SkeletonContent>` inside subtrees; wrap the
416
+ component's final return so the entire layout becomes a single coherent placeholder.
417
+ - **For data-driven lists, prefer `<SkeletonList>`.** It owns the "show N placeholder
418
+ rows while loading, then real data" branching so callers don't hand-roll it.
419
+
420
+ Before / after with `Card`:
421
+
422
+ ```tsx
423
+ // Before — caller hand-rolls a placeholder branch
424
+ {
425
+ loading ? (
426
+ <SkeletonCard />
427
+ ) : (
428
+ <Card>
429
+ <Text>{site.name}</Text>
430
+ <Text>{site.address}</Text>
431
+ </Card>
432
+ );
433
+ }
434
+
435
+ // After — Card itself is skeleton-aware
436
+ <Card loading={loading}>
437
+ <Text>{site?.name ?? ' '}</Text>
438
+ <Text>{site?.address ?? ' '}</Text>
439
+ </Card>;
440
+ ```
441
+
442
+ ### Two flavours of `loading`
443
+
444
+ Same prop name, different semantic by category:
445
+
446
+ - **Display primitives** (`Card`, `ListItem`, `Avatar`, `Badge`, `Banner`, `Chip`, `Rating`,
447
+ `Stepper`, `ImageGallery`) — `loading={true}` renders the component as a skeleton placeholder
448
+ via `SkeletonContent`'s auto walker. Use when the data driving the component is still being
449
+ fetched.
450
+ - **Interactive triggers** (`Button`) — `loading={true}` swaps the label for an inline `Spinner`,
451
+ hides leading/trailing icons, and disables press handling. The button keeps its footprint and
452
+ visual style. Use when an action is in flight (submit, save, delete) — pending action, not
453
+ data fetch.
454
+
455
+ Before / after with `Button`:
456
+
457
+ ```tsx
458
+ // Before — caller swaps a separate spinner in
459
+ {
460
+ submitting ? <Spinner size="small" /> : <Button title="Save" onPress={save} />;
461
+ }
462
+
463
+ // After — Button itself signals the in-flight action
464
+ <Button title="Save" loading={submitting} onPress={save} />;
465
+ ```
466
+
467
+ ---
468
+
397
469
  ## License
398
470
 
399
471
  MIT. Copyright © Webority Technologies.
@@ -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 AccordionGroupContext = /*#__PURE__*/(0, _react.createContext)(null);
@@ -92,7 +93,8 @@ const Accordion = props => {
92
93
  style,
93
94
  headerStyle,
94
95
  contentStyle,
95
- testID
96
+ testID,
97
+ loading = false
96
98
  } = props;
97
99
  const theme = (0, _index.useTheme)();
98
100
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
@@ -158,6 +160,23 @@ const Accordion = props => {
158
160
  backgroundColor: theme.colors.background.elevated,
159
161
  borderRadius: theme.radius.md
160
162
  }] : null;
163
+ if (loading) {
164
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.SkeletonContent, {
165
+ loading: true,
166
+ mode: "auto",
167
+ style: [cardStyle, style],
168
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
169
+ style: styles.header,
170
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
171
+ style: [styles.title, {
172
+ fontSize: theme.typography.fontSize.base
173
+ }],
174
+ numberOfLines: 1,
175
+ children: title ?? ' '
176
+ })
177
+ })
178
+ });
179
+ }
161
180
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
162
181
  style: [cardStyle, style],
163
182
  testID: testID,
@@ -7,6 +7,7 @@ exports.default = exports.AvatarGroup = exports.Avatar = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  var _index = require("../../theme/index.js");
10
+ var _index2 = require("../Skeleton/index.js");
10
11
  var _jsxRuntime = require("react/jsx-runtime");
11
12
  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); }
12
13
  const sizeMap = {
@@ -69,6 +70,7 @@ const Avatar = exports.Avatar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
69
70
  statusPosition = 'bottomRight',
70
71
  backgroundColor,
71
72
  color,
73
+ loading = false,
72
74
  accessibilityLabel,
73
75
  style,
74
76
  textStyle,
@@ -89,7 +91,7 @@ const Avatar = exports.Avatar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
89
91
  const statusSize = Math.max(8, Math.round(dimension * 0.25));
90
92
  const statusBorder = 2;
91
93
  const a11yLabel = accessibilityLabel ?? (name ? `${name}'s avatar` : 'Avatar');
92
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
94
+ const rendered = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
93
95
  ref: ref,
94
96
  style: [styles.root, {
95
97
  width: dimension,
@@ -119,7 +121,7 @@ const Avatar = exports.Avatar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
119
121
  }, textStyle],
120
122
  numberOfLines: 1,
121
123
  allowFontScaling: false,
122
- children: initials
124
+ children: initials ?? ' '
123
125
  }), status ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
124
126
  style: [styles.status, statusPosition === 'topRight' ? styles.statusTopRight : styles.statusBottomRight, {
125
127
  width: statusSize,
@@ -133,6 +135,14 @@ const Avatar = exports.Avatar = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
133
135
  pointerEvents: "none"
134
136
  }) : null]
135
137
  });
138
+ if (loading) {
139
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.SkeletonContent, {
140
+ loading: true,
141
+ mode: "auto",
142
+ children: rendered
143
+ });
144
+ }
145
+ return rendered;
136
146
  });
137
147
  Avatar.displayName = 'Avatar';
138
148
  const styles = _reactNative.StyleSheet.create({
@@ -7,6 +7,7 @@ exports.default = exports.Badge = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  var _index = require("../../theme/index.js");
10
+ var _index2 = require("../Skeleton/index.js");
10
11
  var _jsxRuntime = require("react/jsx-runtime");
11
12
  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); }
12
13
  const toneFor = (theme, tone) => {
@@ -102,6 +103,7 @@ const Badge = exports.Badge = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
102
103
  tone = 'error',
103
104
  size = 'sm',
104
105
  invisible = false,
106
+ loading = false,
105
107
  children,
106
108
  anchor = 'topRight',
107
109
  pulse = false,
@@ -174,23 +176,28 @@ const Badge = exports.Badge = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
174
176
  }, textStyle],
175
177
  numberOfLines: 1,
176
178
  allowFontScaling: false,
177
- children: formatted
179
+ children: formatted ?? ' '
178
180
  }) : null
179
181
  }) : null;
180
- if (children) {
181
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
182
- ref: ref,
183
- style: [styles.wrapper, style],
184
- testID: testID,
185
- children: [children, badgeContent]
186
- });
187
- }
188
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
182
+ const rendered = children ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
183
+ ref: ref,
184
+ style: [styles.wrapper, style],
185
+ testID: testID,
186
+ children: [children, badgeContent]
187
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
189
188
  ref: ref,
190
189
  style: style,
191
190
  testID: testID,
192
191
  children: badgeContent
193
192
  });
193
+ if (loading) {
194
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.SkeletonContent, {
195
+ loading: true,
196
+ mode: "auto",
197
+ children: rendered
198
+ });
199
+ }
200
+ return rendered;
194
201
  });
195
202
  Badge.displayName = 'Badge';
196
203
  const styles = _reactNative.StyleSheet.create({
@@ -7,6 +7,7 @@ exports.default = exports.Banner = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  var _index = require("../../theme/index.js");
10
+ var _index2 = require("../Skeleton/index.js");
10
11
  var _jsxRuntime = require("react/jsx-runtime");
11
12
  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); }
12
13
  const Banner = exports.Banner = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
@@ -20,6 +21,7 @@ const Banner = exports.Banner = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
20
21
  onDismiss,
21
22
  visible = true,
22
23
  animateMount = true,
24
+ loading = false,
23
25
  accessibilityLabel,
24
26
  style,
25
27
  testID
@@ -64,6 +66,8 @@ const Banner = exports.Banner = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
64
66
  // eslint-disable-next-line react-hooks/exhaustive-deps
65
67
  }, [visible]);
66
68
  if (!mounted) return null;
69
+ const safeTitle = title ?? ' ';
70
+ const safeMessageString = typeof message === 'string' ? message ?? ' ' : '';
67
71
  const renderIcon = () => {
68
72
  if (icon === false) return null;
69
73
  if (icon) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
@@ -86,7 +90,7 @@ const Banner = exports.Banner = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
86
90
  const messageString = typeof message === 'string' ? message : '';
87
91
  const builtA11y = accessibilityLabel ?? (title ? `${title}. ${messageString}` : messageString || undefined);
88
92
  const liveRegion = variant === 'error' ? 'assertive' : 'polite';
89
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Animated.View, {
93
+ const rendered = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Animated.View, {
90
94
  ref: ref,
91
95
  accessibilityRole: 'alert',
92
96
  accessibilityLiveRegion: liveRegion,
@@ -109,7 +113,7 @@ const Banner = exports.Banner = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
109
113
  style: styles.row,
110
114
  children: [renderIcon(), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
111
115
  style: styles.textBlock,
112
- children: [title ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
116
+ children: [title || loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
113
117
  style: {
114
118
  color: theme.colors.text.primary,
115
119
  fontSize: theme.typography.fontSize.base,
@@ -117,15 +121,15 @@ const Banner = exports.Banner = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
117
121
  lineHeight: 20
118
122
  },
119
123
  numberOfLines: 2,
120
- children: title
121
- }) : null, typeof message === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
124
+ children: safeTitle
125
+ }) : null, typeof message === 'string' || loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
122
126
  style: {
123
127
  color: theme.colors.text.secondary,
124
128
  fontSize: theme.typography.fontSize.sm,
125
129
  lineHeight: 18,
126
130
  marginTop: title ? 2 : 0
127
131
  },
128
- children: message
132
+ children: safeMessageString || ' '
129
133
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
130
134
  style: {
131
135
  marginTop: title ? 2 : 0
@@ -179,6 +183,14 @@ const Banner = exports.Banner = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
179
183
  })
180
184
  }) : null]
181
185
  });
186
+ if (loading) {
187
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.SkeletonContent, {
188
+ loading: true,
189
+ mode: "auto",
190
+ children: rendered
191
+ });
192
+ }
193
+ return rendered;
182
194
  });
183
195
  Banner.displayName = 'Banner';
184
196
  const tintFor = (theme, variant) => {
@@ -9,6 +9,7 @@ var _reactNative = require("react-native");
9
9
  var _index = require("../../theme/index.js");
10
10
  var _usePressAnimation = require("../../hooks/usePressAnimation.js");
11
11
  var _hapticUtils = require("../../utils/hapticUtils.js");
12
+ var _index2 = require("../Spinner/index.js");
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  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); }
14
15
  const Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
@@ -55,9 +56,11 @@ const Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
55
56
  const accessibleLabel = accessibilityLabel ?? title;
56
57
  const content = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
57
58
  style: styles.contentRow,
58
- children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
59
+ children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Spinner, {
60
+ variant: "circular",
61
+ size: "small",
59
62
  color: variantStyles.textColor,
60
- size: size === 'xs' || size === 'sm' ? 'small' : 'small'
63
+ accessibilityLabel: "Loading"
61
64
  }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
62
65
  children: [leftIcon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
63
66
  style: styles.iconLeft,
@@ -9,6 +9,7 @@ var _reactNative = require("react-native");
9
9
  var _index = require("../../theme/index.js");
10
10
  var _usePressAnimation = require("../../hooks/usePressAnimation.js");
11
11
  var _hapticUtils = require("../../utils/hapticUtils.js");
12
+ var _index2 = require("../Skeleton/index.js");
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  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); }
14
15
  const paddingMap = {
@@ -32,6 +33,7 @@ const Card = exports.Card = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
32
33
  imageHeight = 160,
33
34
  imageAspectRatio,
34
35
  imageOverlay,
36
+ loading = false,
35
37
  onPress,
36
38
  accessibilityLabel,
37
39
  accessibilityHint,
@@ -132,12 +134,13 @@ const Card = exports.Card = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
132
134
  children: innerContent
133
135
  })]
134
136
  }) : innerContent;
137
+ let rendered;
135
138
  if (isInteractive) {
136
139
  const handlePress = event => {
137
140
  (0, _hapticUtils.triggerHaptic)('selection');
138
141
  onPress?.(event);
139
142
  };
140
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
143
+ rendered = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
141
144
  style: [{
142
145
  transform: [{
143
146
  scale
@@ -161,16 +164,25 @@ const Card = exports.Card = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
161
164
  children: content
162
165
  })
163
166
  });
167
+ } else {
168
+ rendered = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
169
+ ref: ref,
170
+ accessibilityLabel: accessibilityLabel,
171
+ accessibilityHint: accessibilityHint,
172
+ accessibilityRole: accessibilityRole,
173
+ testID: testID,
174
+ style: [containerStyle, style],
175
+ children: content
176
+ });
164
177
  }
165
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
166
- ref: ref,
167
- accessibilityLabel: accessibilityLabel,
168
- accessibilityHint: accessibilityHint,
169
- accessibilityRole: accessibilityRole,
170
- testID: testID,
171
- style: [containerStyle, style],
172
- children: content
173
- });
178
+ if (loading) {
179
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.SkeletonContent, {
180
+ loading: true,
181
+ mode: "auto",
182
+ children: rendered
183
+ });
184
+ }
185
+ return rendered;
174
186
  });
175
187
  Card.displayName = 'Card';
176
188
  const buildStyles = theme => _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 _index2 = require("../../utils/index.js");
11
+ var _index3 = 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
  /**
@@ -54,7 +55,8 @@ const CarouselInner = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
54
55
  accessibilityLabel,
55
56
  testID,
56
57
  showThumbnails = false,
57
- renderThumbnail
58
+ renderThumbnail,
59
+ loading = false
58
60
  } = props;
59
61
  const theme = (0, _index.useTheme)();
60
62
  const isControlled = typeof controlledIndex === 'number';
@@ -215,6 +217,21 @@ const CarouselInner = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
215
217
  offset: slideStride * i,
216
218
  index: i
217
219
  }), [slideStride]);
220
+ if (loading) {
221
+ const slideWidth = itemWidth === 'screen' ? containerWidth || 320 : itemWidth;
222
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.SkeletonContent, {
223
+ loading: true,
224
+ mode: "auto",
225
+ style: [styles.container, containerStyle],
226
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
227
+ style: {
228
+ width: slideWidth,
229
+ height: 160,
230
+ borderRadius: 12
231
+ }
232
+ })
233
+ });
234
+ }
218
235
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
219
236
  style: [styles.container, containerStyle],
220
237
  onLayout: e => setContainerWidth(e.nativeEvent.layout.width),
@@ -9,6 +9,7 @@ var _reactNative = require("react-native");
9
9
  var _index = require("../../theme/index.js");
10
10
  var _usePressAnimation = require("../../hooks/usePressAnimation.js");
11
11
  var _hapticUtils = require("../../utils/hapticUtils.js");
12
+ var _index2 = require("../Skeleton/index.js");
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  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); }
14
15
  const toneFor = (theme, tone) => {
@@ -101,6 +102,7 @@ const Chip = exports.Chip = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
101
102
  tone = 'neutral',
102
103
  size = 'md',
103
104
  disabled = false,
105
+ loading = false,
104
106
  accessibilityLabel,
105
107
  style,
106
108
  textStyle,
@@ -159,7 +161,7 @@ const Chip = exports.Chip = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
159
161
  fontWeight: theme.typography.fontWeight.medium
160
162
  }, textStyle],
161
163
  numberOfLines: 1,
162
- children: label
164
+ children: label ?? ' '
163
165
  }), onClose ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
164
166
  onPress: handleClose,
165
167
  disabled: disabled,
@@ -200,8 +202,9 @@ const Chip = exports.Chip = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
200
202
  borderColor,
201
203
  opacity: disabled ? 0.55 : 1
202
204
  };
205
+ let rendered;
203
206
  if (isPressable) {
204
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
207
+ rendered = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
205
208
  style: {
206
209
  transform: [{
207
210
  scale
@@ -233,20 +236,29 @@ const Chip = exports.Chip = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
233
236
  children: content
234
237
  })
235
238
  });
239
+ } else {
240
+ rendered = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
241
+ ref: ref,
242
+ style: [styles.base, baseStyle, style],
243
+ accessible: true,
244
+ accessibilityRole: "text",
245
+ accessibilityLabel: a11yLabel,
246
+ accessibilityState: {
247
+ selected,
248
+ disabled
249
+ },
250
+ testID: testID,
251
+ children: content
252
+ });
236
253
  }
237
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
238
- ref: ref,
239
- style: [styles.base, baseStyle, style],
240
- accessible: true,
241
- accessibilityRole: "text",
242
- accessibilityLabel: a11yLabel,
243
- accessibilityState: {
244
- selected,
245
- disabled
246
- },
247
- testID: testID,
248
- children: content
249
- });
254
+ if (loading) {
255
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.SkeletonContent, {
256
+ loading: true,
257
+ mode: "auto",
258
+ children: rendered
259
+ });
260
+ }
261
+ return rendered;
250
262
  });
251
263
  Chip.displayName = 'Chip';
252
264
  const styles = _reactNative.StyleSheet.create({
@@ -10,8 +10,9 @@ var _reactNativeGestureHandler = require("react-native-gesture-handler");
10
10
  var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
11
11
  var _index = require("../Carousel/index.js");
12
12
  var _index2 = require("../AppIcon/index.js");
13
- var _index3 = require("../../theme/index.js");
14
- var _index4 = require("../../utils/index.js");
13
+ var _index3 = require("../Skeleton/index.js");
14
+ var _index4 = require("../../theme/index.js");
15
+ var _index5 = require("../../utils/index.js");
15
16
  var _jsxRuntime = require("react/jsx-runtime");
16
17
  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); }
17
18
  /**
@@ -49,11 +50,12 @@ const ImageGallery = ({
49
50
  enableLightbox = true,
50
51
  enablePinchZoom = true,
51
52
  onIndexChange,
53
+ loading = false,
52
54
  accessibilityLabel,
53
55
  containerStyle,
54
56
  testID
55
57
  }) => {
56
- const theme = (0, _index3.useTheme)();
58
+ const theme = (0, _index4.useTheme)();
57
59
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
58
60
  const [currentIndex, setCurrentIndex] = (0, _react.useState)(clamp(initialIndex, 0, Math.max(0, images.length - 1)));
59
61
  const [lightboxOpen, setLightboxOpen] = (0, _react.useState)(false);
@@ -63,11 +65,11 @@ const ImageGallery = ({
63
65
  }, [onIndexChange]);
64
66
  const openLightbox = (0, _react.useCallback)(() => {
65
67
  if (!enableLightbox) return;
66
- (0, _index4.triggerHaptic)('selection');
68
+ (0, _index5.triggerHaptic)('selection');
67
69
  setLightboxOpen(true);
68
70
  }, [enableLightbox]);
69
71
  const closeLightbox = (0, _react.useCallback)(() => {
70
- (0, _index4.triggerHaptic)('selection');
72
+ (0, _index5.triggerHaptic)('selection');
71
73
  setLightboxOpen(false);
72
74
  }, []);
73
75
  const renderImage = (0, _react.useCallback)((image, idx) => {
@@ -90,7 +92,7 @@ const ImageGallery = ({
90
92
  style: styles.thumbnailImage,
91
93
  resizeMode: "cover"
92
94
  }), [styles]);
93
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
95
+ const rendered = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
94
96
  style: [styles.container, containerStyle],
95
97
  testID: testID,
96
98
  accessibilityLabel: accessibilityLabel ?? 'Image gallery',
@@ -125,6 +127,14 @@ const ImageGallery = ({
125
127
  onIndexChange: handleIndexChange
126
128
  }) : null]
127
129
  });
130
+ if (loading) {
131
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.SkeletonContent, {
132
+ loading: true,
133
+ mode: "auto",
134
+ children: rendered
135
+ });
136
+ }
137
+ return rendered;
128
138
  };
129
139
  exports.ImageGallery = ImageGallery;
130
140
  ImageGallery.displayName = 'ImageGallery';
@@ -140,13 +150,13 @@ const Lightbox = ({
140
150
  onClose,
141
151
  onIndexChange
142
152
  }) => {
143
- const theme = (0, _index3.useTheme)();
153
+ const theme = (0, _index4.useTheme)();
144
154
  const styles = (0, _react.useMemo)(() => buildLightboxStyles(theme), [theme]);
145
155
  const carouselRef = (0, _react.useRef)(null);
146
156
  const [activeIndex, setActiveIndex] = (0, _react.useState)(initialIndex);
147
157
  const handleSwipe = (0, _react.useCallback)(idx => {
148
158
  if (idx !== activeIndex) {
149
- (0, _index4.triggerHaptic)('selection');
159
+ (0, _index5.triggerHaptic)('selection');
150
160
  setActiveIndex(idx);
151
161
  onIndexChange(idx);
152
162
  }
@@ -255,7 +265,7 @@ const ZoomableImage = ({
255
265
  savedTranslateY.value = 0;
256
266
  }
257
267
  }, [active, scale, translateX, translateY, savedScale, savedTranslateX, savedTranslateY]);
258
- const triggerImpact = (0, _react.useCallback)(() => (0, _index4.triggerHaptic)('impactLight'), []);
268
+ const triggerImpact = (0, _react.useCallback)(() => (0, _index5.triggerHaptic)('impactLight'), []);
259
269
  const pinch = (0, _react.useMemo)(() => _reactNativeGestureHandler.Gesture.Pinch().enabled(enabled).onStart(() => {
260
270
  'worklet';
261
271
 
@@ -10,6 +10,7 @@ var _index = require("../../theme/index.js");
10
10
  var _usePressAnimation = require("../../hooks/usePressAnimation.js");
11
11
  var _hapticUtils = require("../../utils/hapticUtils.js");
12
12
  var _index2 = require("../Swipeable/index.js");
13
+ var _index3 = require("../Skeleton/index.js");
13
14
  var _jsxRuntime = require("react/jsx-runtime");
14
15
  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); }
15
16
  const sizeFor = (theme, size) => {
@@ -56,6 +57,7 @@ const chevronStyles = _reactNative.StyleSheet.create({
56
57
  const ListItem = exports.ListItem = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
57
58
  const {
58
59
  title,
60
+ loading = false,
59
61
  subtitle,
60
62
  description,
61
63
  left,
@@ -108,7 +110,7 @@ const ListItem = exports.ListItem = /*#__PURE__*/(0, _react.forwardRef)((props,
108
110
  color: disabled ? theme.colors.text.disabled : theme.colors.text.primary
109
111
  }],
110
112
  numberOfLines: 1,
111
- children: title
113
+ children: title ?? ' '
112
114
  }), subtitle ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
113
115
  style: [styles.subtitle, {
114
116
  fontSize: sz.subtitleSize,
@@ -179,15 +181,20 @@ const ListItem = exports.ListItem = /*#__PURE__*/(0, _react.forwardRef)((props,
179
181
 
180
182
  // Wrap in Swipeable only when at least one side has actions; otherwise keep zero gesture overhead.
181
183
  const hasSwipe = leftActions && leftActions.length > 0 || rightActions && rightActions.length > 0;
182
- if (hasSwipe) {
183
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Swipeable, {
184
- leftActions: leftActions,
185
- rightActions: rightActions,
186
- accessibilityLabel: a11yLabel,
187
- children: rendered
184
+ const final = hasSwipe ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Swipeable, {
185
+ leftActions: leftActions,
186
+ rightActions: rightActions,
187
+ accessibilityLabel: a11yLabel,
188
+ children: rendered
189
+ }) : rendered;
190
+ if (loading) {
191
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.SkeletonContent, {
192
+ loading: true,
193
+ mode: "auto",
194
+ children: final
188
195
  });
189
196
  }
190
- return rendered;
197
+ return final;
191
198
  });
192
199
  ListItem.displayName = 'ListItem';
193
200
  const buildStyles = theme => _reactNative.StyleSheet.create({