@dloizides/ui-feedback 1.11.0 → 1.12.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,6 +1,22 @@
1
1
  # Changelog
2
2
 
3
- ## 1.10.0
3
+ ## 1.12.0
4
+
5
+ Opt-in additions to `ErrorState` for full-screen error surfaces (an import-error or
6
+ load-error screen that needs a heading, an icon and a way out other than retry). Every
7
+ prop is optional: a caller passing none of them renders the same element tree as 1.11.0,
8
+ pinned by `ErrorState.test.tsx` baseline snapshots recorded before the change.
9
+
10
+ - **Add `title?: string`** — rendered above the message with `accessibilityRole="header"`
11
+ (`role="heading"` on web), testID `${testID}-title`. When a title is present the message
12
+ uses `theme.colors.textSecondary` instead of the error colour.
13
+ - **Add `icon?: React.ReactNode`** — rendered inside a circular well tinted with
14
+ `theme.semantic.error['500']` at low opacity; the well is `aria-hidden`, testID `${testID}-icon`.
15
+ - **Add `secondaryAction?: ErrorStateAction`** (`{ label, hint, onPress, testID }`) — an
16
+ outline button (`theme.colors.border`) laid out in a row beside retry.
17
+ - **Export type `ErrorStateAction`.** No new colour literals; no new dependencies.
18
+
19
+ ## 1.11.0
4
20
 
5
21
  Adopts `@dloizides/ui-motion` for `PageSkeleton`: the loader now shows a moving
6
22
  **shimmer** (a highlight band sweeping across each block) instead of an opacity pulse,
package/dist/index.d.mts CHANGED
@@ -80,16 +80,37 @@ declare const FEEDBACK_TEST_IDS: {
80
80
  readonly errorBoundary: "error-boundary";
81
81
  };
82
82
 
83
+ /**
84
+ * Opt-in pieces of ErrorState: the decorative icon well and the outline secondary action.
85
+ * Both read colours only from the injected theme.
86
+ */
87
+
88
+ interface ErrorStateAction {
89
+ label: string;
90
+ hint: string;
91
+ onPress: () => void;
92
+ testID: string;
93
+ }
94
+
83
95
  /**
84
96
  * ErrorState - generic error display with optional retry button.
97
+ *
98
+ * Opt-in (1.12.0): `title`, a decorative `icon` well and a `secondaryAction`. A caller
99
+ * passing none of them renders the same element tree as before.
85
100
  */
86
101
 
87
102
  interface ErrorStateProps {
88
103
  message: string;
89
104
  onRetry?: () => void;
90
105
  testID?: string;
106
+ /** Heading above the message (role="heading" on web). */
107
+ title?: string;
108
+ /** Rendered inside a circular well above the title; decorative (aria-hidden). */
109
+ icon?: React.ReactNode;
110
+ /** Outline button beside retry, e.g. "Back to library". */
111
+ secondaryAction?: ErrorStateAction;
91
112
  }
92
- declare const ErrorState: ({ message, onRetry, testID, }: ErrorStateProps) => React.ReactElement;
113
+ declare const ErrorState: ({ message, onRetry, testID, title, icon, secondaryAction, }: ErrorStateProps) => React.ReactElement;
93
114
 
94
115
  /**
95
116
  * EmptyListState - empty-collection message with an optional call-to-action.
@@ -469,10 +490,15 @@ interface AppErrorBoundaryProps {
469
490
  retryable?: (error: Error) => boolean;
470
491
  /**
471
492
  * Called from `componentDidMount` ONLY when the mount was clean (nothing caught).
472
- * The chunk-aware apps use it to release their one-shot reload guard: a clean mount
473
- * proves the current chunks loaded, so a FUTURE deploy is allowed to auto-recover
474
- * again. Deliberately NOT called on an errored mount — that would re-arm the guard
475
- * during the very failure it is meant to bound, and reintroduce the reload loop.
493
+ * Deliberately NOT called on an errored mount.
494
+ *
495
+ * ⚠️ A CLEAN MOUNT DOES NOT PROVE THE PAGE LOADED. On a lazy route the boundary commits
496
+ * clean because a Suspense fallback rendered, and the dynamic import rejects AFTER this
497
+ * fires. A guard released here is therefore released mid-failure, which is how the
498
+ * chunk-reload loop went unbounded. Anything wired here must be safe to call during the
499
+ * failure it bounds — `clearChunkRecoveryFlag` from `@dloizides/utils` >= 1.8.0 is
500
+ * (it refuses to release a record still inside its cooldown); a plain "reset my
501
+ * counter" callback is not.
476
502
  */
477
503
  onMount?: () => void;
478
504
  /**
@@ -510,4 +536,4 @@ declare class AppErrorBoundary extends Component<AppErrorBoundaryProps, AppError
510
536
  render(): ReactNode;
511
537
  }
512
538
 
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 };
539
+ 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 ErrorStateAction, 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
@@ -80,16 +80,37 @@ declare const FEEDBACK_TEST_IDS: {
80
80
  readonly errorBoundary: "error-boundary";
81
81
  };
82
82
 
83
+ /**
84
+ * Opt-in pieces of ErrorState: the decorative icon well and the outline secondary action.
85
+ * Both read colours only from the injected theme.
86
+ */
87
+
88
+ interface ErrorStateAction {
89
+ label: string;
90
+ hint: string;
91
+ onPress: () => void;
92
+ testID: string;
93
+ }
94
+
83
95
  /**
84
96
  * ErrorState - generic error display with optional retry button.
97
+ *
98
+ * Opt-in (1.12.0): `title`, a decorative `icon` well and a `secondaryAction`. A caller
99
+ * passing none of them renders the same element tree as before.
85
100
  */
86
101
 
87
102
  interface ErrorStateProps {
88
103
  message: string;
89
104
  onRetry?: () => void;
90
105
  testID?: string;
106
+ /** Heading above the message (role="heading" on web). */
107
+ title?: string;
108
+ /** Rendered inside a circular well above the title; decorative (aria-hidden). */
109
+ icon?: React.ReactNode;
110
+ /** Outline button beside retry, e.g. "Back to library". */
111
+ secondaryAction?: ErrorStateAction;
91
112
  }
92
- declare const ErrorState: ({ message, onRetry, testID, }: ErrorStateProps) => React.ReactElement;
113
+ declare const ErrorState: ({ message, onRetry, testID, title, icon, secondaryAction, }: ErrorStateProps) => React.ReactElement;
93
114
 
94
115
  /**
95
116
  * EmptyListState - empty-collection message with an optional call-to-action.
@@ -469,10 +490,15 @@ interface AppErrorBoundaryProps {
469
490
  retryable?: (error: Error) => boolean;
470
491
  /**
471
492
  * Called from `componentDidMount` ONLY when the mount was clean (nothing caught).
472
- * The chunk-aware apps use it to release their one-shot reload guard: a clean mount
473
- * proves the current chunks loaded, so a FUTURE deploy is allowed to auto-recover
474
- * again. Deliberately NOT called on an errored mount — that would re-arm the guard
475
- * during the very failure it is meant to bound, and reintroduce the reload loop.
493
+ * Deliberately NOT called on an errored mount.
494
+ *
495
+ * ⚠️ A CLEAN MOUNT DOES NOT PROVE THE PAGE LOADED. On a lazy route the boundary commits
496
+ * clean because a Suspense fallback rendered, and the dynamic import rejects AFTER this
497
+ * fires. A guard released here is therefore released mid-failure, which is how the
498
+ * chunk-reload loop went unbounded. Anything wired here must be safe to call during the
499
+ * failure it bounds — `clearChunkRecoveryFlag` from `@dloizides/utils` >= 1.8.0 is
500
+ * (it refuses to release a record still inside its cooldown); a plain "reset my
501
+ * counter" callback is not.
476
502
  */
477
503
  onMount?: () => void;
478
504
  /**
@@ -510,4 +536,4 @@ declare class AppErrorBoundary extends Component<AppErrorBoundaryProps, AppError
510
536
  render(): ReactNode;
511
537
  }
512
538
 
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 };
539
+ 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 ErrorStateAction, 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 };