@dloizides/ui-feedback 1.7.0 → 1.11.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.10.0
4
+
5
+ Adopts `@dloizides/ui-motion` for `PageSkeleton`: the loader now shows a moving
6
+ **shimmer** (a highlight band sweeping across each block) instead of an opacity pulse,
7
+ so loading states read as modern/ant-design-like. There is now ONE shimmer
8
+ implementation in the kit — the ui-motion `<Skeleton>` primitive — and `PageSkeleton`
9
+ owns only the page LAYOUT (how many bars/blocks, their sizes and spacing).
10
+
11
+ - **Add runtime dependency `@dloizides/ui-motion` (`^1.0.1`).**
12
+ - **`PageSkeleton` internals reimplemented on ui-motion `<Skeleton>`.** Each placeholder
13
+ block (header bar, list-row avatar + text lines, card) is now a `<Skeleton>` with the
14
+ same `width`/`height`/`borderRadius`/base colour it had before. The bespoke
15
+ `Animated.loop` opacity pulse (and its `Animated`/`Easing`/`Platform` imports) is gone.
16
+ - **Reduced-motion is now handled by `<Skeleton>`** (via `@dloizides/rn-web-hooks`
17
+ `useReducedMotion`): the sweep is suppressed and a static block is shown.
18
+ - **Public API unchanged.** `PageSkeletonProps` (`rows`, `showHeader`, `variant`), the
19
+ rendered layout, and the `page-skeleton` testID are identical to 1.9.0. Only the
20
+ internal animated primitive was swapped.
21
+ - `ToastHost` (fade+slide) is intentionally left as-is — it remains the reference
22
+ enter/exit pattern.
23
+
3
24
  ## 1.7.0
4
25
 
5
26
  Closes the API gap that kept `kefi-web`, `erevna-web` and `katalogos-web` on their
package/dist/index.d.mts CHANGED
@@ -127,6 +127,12 @@ declare const LoadingFallback: React.FC<LoadingFallbackProps>;
127
127
  *
128
128
  * Improves perceived performance (Speed Index) by showing immediate visual
129
129
  * feedback while page content loads.
130
+ *
131
+ * Each placeholder block is a `@dloizides/ui-motion` <Skeleton> — a rounded block
132
+ * with a highlight band that sweeps across it (translateX shimmer). This is the ONE
133
+ * shimmer implementation in the kit: PageSkeleton owns only the page LAYOUT (how many
134
+ * bars/blocks, their sizes and spacing), not the animation. Under reduced-motion the
135
+ * <Skeleton> suppresses the sweep and renders a static block on its own.
130
136
  */
131
137
 
132
138
  interface PageSkeletonProps {
@@ -139,6 +145,51 @@ interface PageSkeletonProps {
139
145
  }
140
146
  declare const PageSkeleton: React.FC<PageSkeletonProps>;
141
147
 
148
+ /**
149
+ * AsyncSurface — the load / error / loaded contract every data screen shares, resolved once.
150
+ *
151
+ * failed → the shared `<ErrorState>` WITH a retry button
152
+ * loading → the shared shimmer `<PageSkeleton>` (NOT a bare spinner on a blank page)
153
+ * ok → the screen's content
154
+ *
155
+ * Pure composition over this package's own `ErrorState` and `PageSkeleton`, so no screen
156
+ * hand-rolls a spinner or an error card and every one of them fails the same way.
157
+ *
158
+ * EMPTY states are deliberately NOT handled here — an empty list is a per-screen designed
159
+ * message + call-to-action (`<EmptyListState>`), not a generic card.
160
+ *
161
+ * ── Why the branch order is what it is, and why it is pinned by a test ──────────────────
162
+ * This component was duplicated in two portals with OPPOSITE branch order, and the
163
+ * difference was a live bug. React Query holds `isError` true while a retry refetch is in
164
+ * flight and raises `isLoading`/`isFetching` at the same time, so during a retry a surface
165
+ * is genuinely BOTH loading and failed. Checking `loading` first makes that overlap render
166
+ * as: error card → skeleton → error card. The retry button is unmounted from under the
167
+ * operator's cursor mid-click, and a user whose first retry failed cannot reach a second.
168
+ *
169
+ * Error therefore wins: a surface that is both loading and failed keeps saying it failed.
170
+ * `AsyncSurface.test.tsx` asserts the both-true case directly — the ordering is a
171
+ * behavioural contract, not an implementation detail, and it must not silently flip back.
172
+ */
173
+
174
+ interface AsyncSurfaceProps {
175
+ /** Truthy while the query is in flight. */
176
+ loading: boolean;
177
+ /** Truthy when the query failed. Takes precedence over `loading` — see the docblock. */
178
+ isError: boolean;
179
+ onRetry: () => void;
180
+ /** Skeleton rows while loading. Match the surface so the layout does not jump. */
181
+ skeletonRows?: number;
182
+ /** `'cards'` for dashboard tiles, `'list'` for tables and forms. */
183
+ variant?: 'list' | 'cards';
184
+ /**
185
+ * Failure message. Defaults to the `common.loadFailed` key from the provider's `t`, so the
186
+ * server's raw text is never shown to a user.
187
+ */
188
+ message?: string;
189
+ children: React.ReactNode;
190
+ }
191
+ declare const AsyncSurface: ({ loading, isError, onRetry, skeletonRows, variant, message, children, }: AsyncSurfaceProps) => React.ReactNode;
192
+
142
193
  /**
143
194
  * ConfirmDialog - modal confirm/cancel dialog with optional destructive + loading states.
144
195
  */
@@ -459,4 +510,4 @@ declare class AppErrorBoundary extends Component<AppErrorBoundaryProps, AppError
459
510
  render(): ReactNode;
460
511
  }
461
512
 
462
- export { AppErrorBoundary, type AppErrorBoundaryProps, ConfirmDialog, type ConfirmDialogProps, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, EmptyListState, type EmptyListStateProps, type ErrorBoundaryLabels, type ErrorFallbackState, ErrorState, type ErrorStateProps, FEEDBACK_TEST_IDS, type FeedbackColorScale, type FeedbackNavigate, type FeedbackTheme, type FeedbackThemeColors, type FeedbackThemePalette, type FeedbackThemeSemantic, type FeedbackTranslate, FeedbackUiProvider, type FeedbackUiProviderProps, type FeedbackUiValue, LoadingFallback, type LoadingFallbackProps, MODAL_OVERLAY_COLOR, PageSkeleton, type PageSkeletonProps, type ToastBus, ToastHost, type ToastHostProps, type ToastInput, type ToastPush, type ToastType, type FeedbackColorScale as UiColorScale, type FeedbackNavigate as UiNavigate, FeedbackUiProvider as UiProvider, type FeedbackUiProviderProps as UiProviderProps, type FeedbackTheme as UiTheme, type FeedbackThemeColors as UiThemeColors, type FeedbackThemePalette as UiThemePalette, type FeedbackThemeSemantic as UiThemeSemantic, type FeedbackTranslate as UiTranslate, type FeedbackUiValue as UiValue, WARMING_QUIET_PERIOD_MS, type WarmingInfo, WarmingOverlay, type WarmingOverlayLabels, type WarmingOverlayProps, type WarmingSnapshot, createToastBus, getWarmingSnapshot, notifyWarming, settleWarming, subscribeWarming, useFeedbackUi, useFeedbackUi as useUi };
513
+ export { AppErrorBoundary, type AppErrorBoundaryProps, AsyncSurface, type AsyncSurfaceProps, ConfirmDialog, type ConfirmDialogProps, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, EmptyListState, type EmptyListStateProps, type ErrorBoundaryLabels, type ErrorFallbackState, ErrorState, type ErrorStateProps, FEEDBACK_TEST_IDS, type FeedbackColorScale, type FeedbackNavigate, type FeedbackTheme, type FeedbackThemeColors, type FeedbackThemePalette, type FeedbackThemeSemantic, type FeedbackTranslate, FeedbackUiProvider, type FeedbackUiProviderProps, type FeedbackUiValue, LoadingFallback, type LoadingFallbackProps, MODAL_OVERLAY_COLOR, PageSkeleton, type PageSkeletonProps, type ToastBus, ToastHost, type ToastHostProps, type ToastInput, type ToastPush, type ToastType, type FeedbackColorScale as UiColorScale, type FeedbackNavigate as UiNavigate, FeedbackUiProvider as UiProvider, type FeedbackUiProviderProps as UiProviderProps, type FeedbackTheme as UiTheme, type FeedbackThemeColors as UiThemeColors, type FeedbackThemePalette as UiThemePalette, type FeedbackThemeSemantic as UiThemeSemantic, type FeedbackTranslate as UiTranslate, type FeedbackUiValue as UiValue, WARMING_QUIET_PERIOD_MS, type WarmingInfo, WarmingOverlay, type WarmingOverlayLabels, type WarmingOverlayProps, type WarmingSnapshot, createToastBus, getWarmingSnapshot, notifyWarming, settleWarming, subscribeWarming, useFeedbackUi, useFeedbackUi as useUi };
package/dist/index.d.ts CHANGED
@@ -127,6 +127,12 @@ declare const LoadingFallback: React.FC<LoadingFallbackProps>;
127
127
  *
128
128
  * Improves perceived performance (Speed Index) by showing immediate visual
129
129
  * feedback while page content loads.
130
+ *
131
+ * Each placeholder block is a `@dloizides/ui-motion` <Skeleton> — a rounded block
132
+ * with a highlight band that sweeps across it (translateX shimmer). This is the ONE
133
+ * shimmer implementation in the kit: PageSkeleton owns only the page LAYOUT (how many
134
+ * bars/blocks, their sizes and spacing), not the animation. Under reduced-motion the
135
+ * <Skeleton> suppresses the sweep and renders a static block on its own.
130
136
  */
131
137
 
132
138
  interface PageSkeletonProps {
@@ -139,6 +145,51 @@ interface PageSkeletonProps {
139
145
  }
140
146
  declare const PageSkeleton: React.FC<PageSkeletonProps>;
141
147
 
148
+ /**
149
+ * AsyncSurface — the load / error / loaded contract every data screen shares, resolved once.
150
+ *
151
+ * failed → the shared `<ErrorState>` WITH a retry button
152
+ * loading → the shared shimmer `<PageSkeleton>` (NOT a bare spinner on a blank page)
153
+ * ok → the screen's content
154
+ *
155
+ * Pure composition over this package's own `ErrorState` and `PageSkeleton`, so no screen
156
+ * hand-rolls a spinner or an error card and every one of them fails the same way.
157
+ *
158
+ * EMPTY states are deliberately NOT handled here — an empty list is a per-screen designed
159
+ * message + call-to-action (`<EmptyListState>`), not a generic card.
160
+ *
161
+ * ── Why the branch order is what it is, and why it is pinned by a test ──────────────────
162
+ * This component was duplicated in two portals with OPPOSITE branch order, and the
163
+ * difference was a live bug. React Query holds `isError` true while a retry refetch is in
164
+ * flight and raises `isLoading`/`isFetching` at the same time, so during a retry a surface
165
+ * is genuinely BOTH loading and failed. Checking `loading` first makes that overlap render
166
+ * as: error card → skeleton → error card. The retry button is unmounted from under the
167
+ * operator's cursor mid-click, and a user whose first retry failed cannot reach a second.
168
+ *
169
+ * Error therefore wins: a surface that is both loading and failed keeps saying it failed.
170
+ * `AsyncSurface.test.tsx` asserts the both-true case directly — the ordering is a
171
+ * behavioural contract, not an implementation detail, and it must not silently flip back.
172
+ */
173
+
174
+ interface AsyncSurfaceProps {
175
+ /** Truthy while the query is in flight. */
176
+ loading: boolean;
177
+ /** Truthy when the query failed. Takes precedence over `loading` — see the docblock. */
178
+ isError: boolean;
179
+ onRetry: () => void;
180
+ /** Skeleton rows while loading. Match the surface so the layout does not jump. */
181
+ skeletonRows?: number;
182
+ /** `'cards'` for dashboard tiles, `'list'` for tables and forms. */
183
+ variant?: 'list' | 'cards';
184
+ /**
185
+ * Failure message. Defaults to the `common.loadFailed` key from the provider's `t`, so the
186
+ * server's raw text is never shown to a user.
187
+ */
188
+ message?: string;
189
+ children: React.ReactNode;
190
+ }
191
+ declare const AsyncSurface: ({ loading, isError, onRetry, skeletonRows, variant, message, children, }: AsyncSurfaceProps) => React.ReactNode;
192
+
142
193
  /**
143
194
  * ConfirmDialog - modal confirm/cancel dialog with optional destructive + loading states.
144
195
  */
@@ -459,4 +510,4 @@ declare class AppErrorBoundary extends Component<AppErrorBoundaryProps, AppError
459
510
  render(): ReactNode;
460
511
  }
461
512
 
462
- export { AppErrorBoundary, type AppErrorBoundaryProps, ConfirmDialog, type ConfirmDialogProps, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, EmptyListState, type EmptyListStateProps, type ErrorBoundaryLabels, type ErrorFallbackState, ErrorState, type ErrorStateProps, FEEDBACK_TEST_IDS, type FeedbackColorScale, type FeedbackNavigate, type FeedbackTheme, type FeedbackThemeColors, type FeedbackThemePalette, type FeedbackThemeSemantic, type FeedbackTranslate, FeedbackUiProvider, type FeedbackUiProviderProps, type FeedbackUiValue, LoadingFallback, type LoadingFallbackProps, MODAL_OVERLAY_COLOR, PageSkeleton, type PageSkeletonProps, type ToastBus, ToastHost, type ToastHostProps, type ToastInput, type ToastPush, type ToastType, type FeedbackColorScale as UiColorScale, type FeedbackNavigate as UiNavigate, FeedbackUiProvider as UiProvider, type FeedbackUiProviderProps as UiProviderProps, type FeedbackTheme as UiTheme, type FeedbackThemeColors as UiThemeColors, type FeedbackThemePalette as UiThemePalette, type FeedbackThemeSemantic as UiThemeSemantic, type FeedbackTranslate as UiTranslate, type FeedbackUiValue as UiValue, WARMING_QUIET_PERIOD_MS, type WarmingInfo, WarmingOverlay, type WarmingOverlayLabels, type WarmingOverlayProps, type WarmingSnapshot, createToastBus, getWarmingSnapshot, notifyWarming, settleWarming, subscribeWarming, useFeedbackUi, useFeedbackUi as useUi };
513
+ export { AppErrorBoundary, type AppErrorBoundaryProps, AsyncSurface, type AsyncSurfaceProps, ConfirmDialog, type ConfirmDialogProps, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, EmptyListState, type EmptyListStateProps, type ErrorBoundaryLabels, type ErrorFallbackState, ErrorState, type ErrorStateProps, FEEDBACK_TEST_IDS, type FeedbackColorScale, type FeedbackNavigate, type FeedbackTheme, type FeedbackThemeColors, type FeedbackThemePalette, type FeedbackThemeSemantic, type FeedbackTranslate, FeedbackUiProvider, type FeedbackUiProviderProps, type FeedbackUiValue, LoadingFallback, type LoadingFallbackProps, MODAL_OVERLAY_COLOR, PageSkeleton, type PageSkeletonProps, type ToastBus, ToastHost, type ToastHostProps, type ToastInput, type ToastPush, type ToastType, type FeedbackColorScale as UiColorScale, type FeedbackNavigate as UiNavigate, FeedbackUiProvider as UiProvider, type FeedbackUiProviderProps as UiProviderProps, type FeedbackTheme as UiTheme, type FeedbackThemeColors as UiThemeColors, type FeedbackThemePalette as UiThemePalette, type FeedbackThemeSemantic as UiThemeSemantic, type FeedbackTranslate as UiTranslate, type FeedbackUiValue as UiValue, WARMING_QUIET_PERIOD_MS, type WarmingInfo, WarmingOverlay, type WarmingOverlayLabels, type WarmingOverlayProps, type WarmingSnapshot, createToastBus, getWarmingSnapshot, notifyWarming, settleWarming, subscribeWarming, useFeedbackUi, useFeedbackUi as useUi };
package/dist/index.js CHANGED
@@ -1,12 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var React3 = require('react');
3
+ var react = require('react');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var reactNative = require('react-native');
6
-
7
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
-
9
- var React3__default = /*#__PURE__*/_interopDefault(React3);
6
+ var uiMotion = require('@dloizides/ui-motion');
10
7
 
11
8
  // src/context/FeedbackUiContext.tsx
12
9
  var DEFAULT_FEEDBACK_VALUE = {
@@ -33,18 +30,18 @@ var DEFAULT_FEEDBACK_VALUE = {
33
30
  },
34
31
  t: (key) => key
35
32
  };
36
- var FeedbackUiContext = React3.createContext(DEFAULT_FEEDBACK_VALUE);
33
+ var FeedbackUiContext = react.createContext(DEFAULT_FEEDBACK_VALUE);
37
34
  var FeedbackUiProvider = ({
38
35
  theme,
39
36
  t,
40
37
  navigate,
41
38
  children
42
39
  }) => {
43
- const value = React3.useMemo(() => ({ theme, t, navigate }), [theme, t, navigate]);
40
+ const value = react.useMemo(() => ({ theme, t, navigate }), [theme, t, navigate]);
44
41
  return /* @__PURE__ */ jsxRuntime.jsx(FeedbackUiContext.Provider, { value, children });
45
42
  };
46
43
  function useFeedbackUi() {
47
- return React3.useContext(FeedbackUiContext);
44
+ return react.useContext(FeedbackUiContext);
48
45
  }
49
46
 
50
47
  // src/constants.ts
@@ -155,7 +152,7 @@ var EmptyListState = ({
155
152
  const { theme, t, navigate } = useFeedbackUi();
156
153
  const { colors } = theme;
157
154
  const primary = theme.palette.primary["500"];
158
- const handlePress = React3.useCallback(() => {
155
+ const handlePress = react.useCallback(() => {
159
156
  if (typeof ctaRoute === "string" && typeof navigate === "function") navigate(ctaRoute);
160
157
  }, [navigate, ctaRoute]);
161
158
  const showCta = typeof ctaTextKey === "string" && typeof ctaHintKey === "string" && typeof ctaRoute === "string";
@@ -204,30 +201,30 @@ var LoadingFallback = ({ fullScreen = false, size = "large" }) => {
204
201
  }
205
202
  );
206
203
  };
207
- var ANIMATION_DURATION_MS = 1200;
208
204
  var SKELETON_BORDER_RADIUS = 4;
209
- var SKELETON_OPACITY_START = 0.3;
210
- var SKELETON_OPACITY_END = 0.7;
205
+ var CARD_BORDER_RADIUS = 8;
211
206
  var DEFAULT_ROWS = 5;
207
+ var HEADER_HEIGHT = 32;
208
+ var HEADER_WIDTH = "60%";
209
+ var AVATAR_SIZE = 48;
210
+ var AVATAR_BORDER_RADIUS = 24;
211
+ var TEXT_LINE_HEIGHT = 16;
212
+ var TEXT_LINE_FULL_WIDTH = "100%";
213
+ var TEXT_LINE_SHORT_WIDTH = "70%";
214
+ var CARD_HEIGHT = 120;
212
215
  var styles4 = reactNative.StyleSheet.create({
213
216
  container: {
214
217
  flex: 1,
215
218
  padding: 16
216
219
  },
217
220
  header: {
218
- height: 32,
219
- borderRadius: SKELETON_BORDER_RADIUS,
220
- marginBottom: 24,
221
- width: "60%"
221
+ marginBottom: 24
222
222
  },
223
223
  row: {
224
224
  flexDirection: "row",
225
225
  marginBottom: 16
226
226
  },
227
227
  avatar: {
228
- width: 48,
229
- height: 48,
230
- borderRadius: 24,
231
228
  marginRight: 12
232
229
  },
233
230
  textContainer: {
@@ -235,19 +232,9 @@ var styles4 = reactNative.StyleSheet.create({
235
232
  justifyContent: "center"
236
233
  },
237
234
  textLine: {
238
- height: 16,
239
- borderRadius: SKELETON_BORDER_RADIUS,
240
235
  marginBottom: 8
241
236
  },
242
- textLineShort: {
243
- width: "70%"
244
- },
245
- textLineFull: {
246
- width: "100%"
247
- },
248
237
  card: {
249
- height: 120,
250
- borderRadius: 8,
251
238
  marginBottom: 16
252
239
  }
253
240
  });
@@ -258,40 +245,51 @@ var PageSkeleton = ({
258
245
  }) => {
259
246
  const { theme, t } = useFeedbackUi();
260
247
  const colors = theme.colors;
261
- const animatedValue = React3__default.default.useRef(new reactNative.Animated.Value(0)).current;
262
- React3__default.default.useEffect(() => {
263
- const animation = reactNative.Animated.loop(
264
- reactNative.Animated.sequence([
265
- reactNative.Animated.timing(animatedValue, {
266
- toValue: 1,
267
- duration: ANIMATION_DURATION_MS,
268
- easing: reactNative.Easing.inOut(reactNative.Easing.ease),
269
- useNativeDriver: reactNative.Platform.OS !== "web"
270
- }),
271
- reactNative.Animated.timing(animatedValue, {
272
- toValue: 0,
273
- duration: ANIMATION_DURATION_MS,
274
- easing: reactNative.Easing.inOut(reactNative.Easing.ease),
275
- useNativeDriver: reactNative.Platform.OS !== "web"
276
- })
277
- ])
278
- );
279
- animation.start();
280
- return () => animation.stop();
281
- }, [animatedValue]);
282
- const opacity = animatedValue.interpolate({
283
- inputRange: [0, 1],
284
- outputRange: [SKELETON_OPACITY_START, SKELETON_OPACITY_END]
285
- });
286
248
  const skeletonColor = String(colors.border);
287
249
  const renderListRow = (index) => /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles4.row, children: [
288
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [styles4.avatar, { backgroundColor: skeletonColor, opacity }] }),
250
+ /* @__PURE__ */ jsxRuntime.jsx(
251
+ uiMotion.Skeleton,
252
+ {
253
+ backgroundColor: skeletonColor,
254
+ borderRadius: AVATAR_BORDER_RADIUS,
255
+ height: AVATAR_SIZE,
256
+ style: styles4.avatar,
257
+ width: AVATAR_SIZE
258
+ }
259
+ ),
289
260
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles4.textContainer, children: [
290
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [styles4.textLine, styles4.textLineFull, { backgroundColor: skeletonColor, opacity }] }),
291
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [styles4.textLine, styles4.textLineShort, { backgroundColor: skeletonColor, opacity }] })
261
+ /* @__PURE__ */ jsxRuntime.jsx(
262
+ uiMotion.Skeleton,
263
+ {
264
+ backgroundColor: skeletonColor,
265
+ borderRadius: SKELETON_BORDER_RADIUS,
266
+ height: TEXT_LINE_HEIGHT,
267
+ style: styles4.textLine,
268
+ width: TEXT_LINE_FULL_WIDTH
269
+ }
270
+ ),
271
+ /* @__PURE__ */ jsxRuntime.jsx(
272
+ uiMotion.Skeleton,
273
+ {
274
+ backgroundColor: skeletonColor,
275
+ borderRadius: SKELETON_BORDER_RADIUS,
276
+ height: TEXT_LINE_HEIGHT,
277
+ style: styles4.textLine,
278
+ width: TEXT_LINE_SHORT_WIDTH
279
+ }
280
+ )
292
281
  ] })
293
282
  ] }, index);
294
- const renderCard = (index) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [styles4.card, { backgroundColor: skeletonColor, opacity }] }, index);
283
+ const renderCard = (index) => /* @__PURE__ */ jsxRuntime.jsx(
284
+ uiMotion.Skeleton,
285
+ {
286
+ backgroundColor: skeletonColor,
287
+ borderRadius: CARD_BORDER_RADIUS,
288
+ height: CARD_HEIGHT,
289
+ style: styles4.card
290
+ },
291
+ index
292
+ );
295
293
  const rowElements = Array.from({ length: rows }, (_, i) => variant === "cards" ? renderCard(i) : renderListRow(i));
296
294
  return /* @__PURE__ */ jsxRuntime.jsxs(
297
295
  reactNative.View,
@@ -302,12 +300,36 @@ var PageSkeleton = ({
302
300
  style: [styles4.container, { backgroundColor: colors.background }],
303
301
  testID: FEEDBACK_TEST_IDS.pageSkeleton,
304
302
  children: [
305
- showHeader ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [styles4.header, { backgroundColor: skeletonColor, opacity }] }) : null,
303
+ showHeader ? /* @__PURE__ */ jsxRuntime.jsx(
304
+ uiMotion.Skeleton,
305
+ {
306
+ backgroundColor: skeletonColor,
307
+ borderRadius: SKELETON_BORDER_RADIUS,
308
+ height: HEADER_HEIGHT,
309
+ style: styles4.header,
310
+ width: HEADER_WIDTH
311
+ }
312
+ ) : null,
306
313
  rowElements
307
314
  ]
308
315
  }
309
316
  );
310
317
  };
318
+ var DEFAULT_SKELETON_ROWS = 6;
319
+ var AsyncSurface = ({
320
+ loading,
321
+ isError,
322
+ onRetry,
323
+ skeletonRows = DEFAULT_SKELETON_ROWS,
324
+ variant = "list",
325
+ message,
326
+ children
327
+ }) => {
328
+ const { t } = useFeedbackUi();
329
+ if (isError) return /* @__PURE__ */ jsxRuntime.jsx(ErrorState, { message: message ?? t("common.loadFailed"), onRetry });
330
+ if (loading) return /* @__PURE__ */ jsxRuntime.jsx(PageSkeleton, { showHeader: true, rows: skeletonRows, variant });
331
+ return children;
332
+ };
311
333
  var DIALOG_MAX_WIDTH = 400;
312
334
  var styles5 = reactNative.StyleSheet.create({
313
335
  overlay: {
@@ -373,7 +395,7 @@ var ConfirmDialog = ({
373
395
  destructive = false
374
396
  }) => {
375
397
  const { theme, t } = useFeedbackUi();
376
- const colorStyles = React3.useMemo(
398
+ const colorStyles = react.useMemo(
377
399
  () => ({
378
400
  dialog: { backgroundColor: theme.colors.surfaceElevated },
379
401
  title: { color: theme.colors.text },
@@ -517,19 +539,19 @@ function sanitizeToastText(input, maxLength) {
517
539
  return stripped.length > maxLength ? stripped.slice(0, maxLength) : stripped;
518
540
  }
519
541
  var ToastItem = ({ message, onDone, colors, durationMs, fadeMs, testID }) => {
520
- const opacityRef = React3.useRef(new reactNative.Animated.Value(0));
521
- const translateYRef = React3.useRef(new reactNative.Animated.Value(TOAST_INITIAL_TRANSLATE_Y));
542
+ const opacityRef = react.useRef(new reactNative.Animated.Value(0));
543
+ const translateYRef = react.useRef(new reactNative.Animated.Value(TOAST_INITIAL_TRANSLATE_Y));
522
544
  const opacity = opacityRef.current;
523
545
  const translateY = translateYRef.current;
524
- const backgroundColor = React3.useMemo(() => {
546
+ const backgroundColor = react.useMemo(() => {
525
547
  if (message.type === "success") return colors.success;
526
548
  if (message.type === "error") return colors.error;
527
549
  return colors.primary;
528
550
  }, [colors.error, colors.primary, colors.success, message.type]);
529
- const handleDone = React3.useCallback(() => {
551
+ const handleDone = react.useCallback(() => {
530
552
  onDone(message.id);
531
553
  }, [message.id, onDone]);
532
- React3.useEffect(() => {
554
+ react.useEffect(() => {
533
555
  const useNative = reactNative.Platform.OS !== "web";
534
556
  reactNative.Animated.parallel([
535
557
  reactNative.Animated.timing(opacity, { toValue: 1, duration: fadeMs, useNativeDriver: useNative }),
@@ -567,9 +589,9 @@ var ToastHost = ({
567
589
  maxLength = DEFAULT_MAX_LENGTH,
568
590
  toastTestID = FEEDBACK_TEST_IDS.notificationToast
569
591
  }) => {
570
- const [messages, setMessages] = React3.useState([]);
592
+ const [messages, setMessages] = react.useState([]);
571
593
  const { theme } = useFeedbackUi();
572
- const colors = React3.useMemo(
594
+ const colors = react.useMemo(
573
595
  () => ({
574
596
  primary: theme.palette.primary["500"],
575
597
  success: (theme.semantic.success ?? theme.semantic.error)["500"],
@@ -578,16 +600,16 @@ var ToastHost = ({
578
600
  }),
579
601
  [theme]
580
602
  );
581
- const push = React3.useCallback(
603
+ const push = react.useCallback(
582
604
  (toast) => {
583
605
  setMessages((s) => [...s, { id: nextId(), type: toast.type, text: sanitizeToastText(toast.text, maxLength) }]);
584
606
  },
585
607
  [maxLength]
586
608
  );
587
- const remove = React3.useCallback((id) => {
609
+ const remove = react.useCallback((id) => {
588
610
  setMessages((s) => s.filter((x) => x.id !== id));
589
611
  }, []);
590
- React3.useEffect(() => subscribe(push), [subscribe, push]);
612
+ react.useEffect(() => subscribe(push), [subscribe, push]);
591
613
  if (messages.length === 0) return null;
592
614
  return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles6.container, children: messages.map((m) => /* @__PURE__ */ jsxRuntime.jsx(
593
615
  ToastItem,
@@ -710,7 +732,7 @@ var WarmingOverlay = ({
710
732
  showAttempt = false
711
733
  }) => {
712
734
  const ctx = useFeedbackUi();
713
- const snapshot2 = React3.useSyncExternalStore(subscribeWarming, getWarmingSnapshot, getWarmingSnapshot);
735
+ const snapshot2 = react.useSyncExternalStore(subscribeWarming, getWarmingSnapshot, getWarmingSnapshot);
714
736
  const theme = themeOverride ?? ctx.theme;
715
737
  const mergedLabels = { ...DEFAULT_WARMING_LABELS, ...labels };
716
738
  if (!snapshot2.isWarming) return null;
@@ -951,7 +973,7 @@ function resolveRetryable(retryable, error) {
951
973
  return retryable(error);
952
974
  }
953
975
  var INITIAL_STATE = { hasError: false, error: null, recovering: false };
954
- var AppErrorBoundary = class extends React3.Component {
976
+ var AppErrorBoundary = class extends react.Component {
955
977
  constructor(props) {
956
978
  super(props);
957
979
  this.handleRetry = () => {
@@ -997,6 +1019,7 @@ var AppErrorBoundary = class extends React3.Component {
997
1019
  };
998
1020
 
999
1021
  exports.AppErrorBoundary = AppErrorBoundary;
1022
+ exports.AsyncSurface = AsyncSurface;
1000
1023
  exports.ConfirmDialog = ConfirmDialog;
1001
1024
  exports.DEFAULT_ERROR_BOUNDARY_LABELS = DEFAULT_ERROR_BOUNDARY_LABELS;
1002
1025
  exports.DISABLED_OPACITY = DISABLED_OPACITY;