tempest-react-sdk 0.13.0 → 0.14.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.
@@ -3054,6 +3054,63 @@ export declare interface InstallBackgroundSyncOptions {
3054
3054
  maxRetentionMinutes?: number;
3055
3055
  }
3056
3056
 
3057
+ /**
3058
+ * Dismissible bottom banner that invites the user to install the PWA. Wired to
3059
+ * {@link useBeforeInstallPrompt}: it renders only when the browser captured an
3060
+ * install prompt and the app is not already running standalone — so on
3061
+ * platforms that never fire `beforeinstallprompt` (e.g. iOS Safari) it stays
3062
+ * hidden and you can surface manual instructions elsewhere.
3063
+ *
3064
+ * @example
3065
+ * <InstallBanner
3066
+ * title="Instale o FAMACHApp"
3067
+ * description="Acesso offline e atalho na tela inicial."
3068
+ * storageKey="famacha:install-dismissed"
3069
+ * />
3070
+ */
3071
+ export declare function InstallBanner({ title, description, installLabel, dismissLabel, icon, storageKey, onResult, className, }: InstallBannerProps): JSX.Element | null;
3072
+
3073
+ export declare interface InstallBannerProps {
3074
+ /** Headline. Default `"Instale o app"`. */
3075
+ title?: ReactNode;
3076
+ /** Supporting copy under the title. */
3077
+ description?: ReactNode;
3078
+ /** Install button label. Default `"Instalar"`. */
3079
+ installLabel?: string;
3080
+ /** Accessible label for the dismiss button. Default `"Dispensar"`. */
3081
+ dismissLabel?: string;
3082
+ /** Optional leading icon. */
3083
+ icon?: ReactNode;
3084
+ /**
3085
+ * `localStorage` key used to remember dismissal across reloads. Omit to
3086
+ * make dismissal last only for the current session (component state).
3087
+ */
3088
+ storageKey?: string;
3089
+ /** Called with the user's choice after the install prompt resolves. */
3090
+ onResult?: (outcome: InstallOutcome) => void;
3091
+ className?: string;
3092
+ }
3093
+
3094
+ /**
3095
+ * Button wired to the PWA install prompt ({@link useBeforeInstallPrompt}).
3096
+ * Renders nothing when the app can't be installed — no prompt captured yet,
3097
+ * already installed, or running standalone — so you can drop it anywhere
3098
+ * without guarding visibility yourself.
3099
+ *
3100
+ * Inherits every {@link Button} prop (`variant`, `size`, `leftIcon`, …).
3101
+ *
3102
+ * @example
3103
+ * <InstallButton variant="primary" leftIcon={<Download />} />
3104
+ */
3105
+ export declare function InstallButton({ label, onResult, ...props }: InstallButtonProps): JSX.Element | null;
3106
+
3107
+ export declare interface InstallButtonProps extends Omit<ButtonProps, "onClick" | "children"> {
3108
+ /** Button label. Default `"Instalar app"`. */
3109
+ label?: ReactNode;
3110
+ /** Called with the user's choice after the install prompt resolves. */
3111
+ onResult?: (outcome: InstallOutcome) => void;
3112
+ }
3113
+
3057
3114
  /**
3058
3115
  * Install a `notificationclick` handler that focuses an existing client when
3059
3116
  * possible and falls back to opening a new window.
@@ -3065,6 +3122,8 @@ export declare interface InstallNotificationClickHandlerOptions {
3065
3122
  resolveUrl?: (data: unknown) => string;
3066
3123
  }
3067
3124
 
3125
+ export declare type InstallOutcome = "accepted" | "dismissed" | "unsupported";
3126
+
3068
3127
  /**
3069
3128
  * Precache the app shell at `install` and serve it offline:
3070
3129
  * - reads `precache-manifest.json` (emitted by `tempestPwaManifest()`),
@@ -4993,13 +5052,33 @@ export declare interface SpacerProps extends HTMLAttributes<HTMLDivElement> {
4993
5052
  axis?: SpacerAxis;
4994
5053
  }
4995
5054
 
4996
- /** Loading spinner with preset sizes (xs..xl). Provide `label` for screen readers. */
4997
- export declare function Spinner({ size, className, label }: SpinnerProps): JSX.Element;
5055
+ /**
5056
+ * Loading spinner with preset sizes (xs..xl). Provide `label` for screen
5057
+ * readers, `caption` for a visible message, and `overlay` to center it inside a
5058
+ * full-area container (e.g. a Suspense / route fallback).
5059
+ *
5060
+ * @example
5061
+ * <Spinner />
5062
+ * <Spinner size="lg" caption="Carregando…" overlay />
5063
+ */
5064
+ export declare function Spinner({ size, className, label, caption, overlay, }: SpinnerProps): JSX.Element;
4998
5065
 
4999
5066
  export declare interface SpinnerProps {
5000
5067
  size?: SpinnerSize;
5001
5068
  className?: string;
5069
+ /** Accessible label announced by screen readers. */
5002
5070
  label?: string;
5071
+ /**
5072
+ * Visible caption rendered under the spinner. When set, the spinner and
5073
+ * caption are wrapped in a centered column.
5074
+ */
5075
+ caption?: ReactNode;
5076
+ /**
5077
+ * Center the spinner inside a full-area overlay (fills the nearest
5078
+ * positioned ancestor; pair with a relative container or a route fallback).
5079
+ * Implies the wrapped layout.
5080
+ */
5081
+ overlay?: boolean;
5003
5082
  }
5004
5083
 
5005
5084
  export declare type SpinnerSize = "xs" | "sm" | "md" | "lg" | "xl";
@@ -5411,7 +5490,7 @@ export declare type ThemeMode = "light" | "dark" | "system";
5411
5490
  * Pair with `themeInitScript()` in the HTML head to prevent the flash of
5412
5491
  * incorrect theme on first paint.
5413
5492
  */
5414
- export declare function ThemeProvider({ children, defaultTheme, storageKey, target, attribute, }: ThemeProviderProps): JSX.Element;
5493
+ export declare function ThemeProvider({ children, defaultTheme, storageKey, target, attribute, themeColor, }: ThemeProviderProps): JSX.Element;
5415
5494
 
5416
5495
  export declare interface ThemeProviderProps {
5417
5496
  children: ReactNode;
@@ -5420,12 +5499,30 @@ export declare interface ThemeProviderProps {
5420
5499
  /** localStorage key used to persist the preference. Pass `null` to disable persistence. Default: `"tempest-theme"`. */
5421
5500
  storageKey?: string | null;
5422
5501
  /**
5423
- * Element that receives the `data-tempest-theme` attribute. Defaults to
5502
+ * Element that receives the theme attribute(s). Defaults to
5424
5503
  * `document.documentElement`. Override when scoping the theme to a subtree.
5425
5504
  */
5426
5505
  target?: () => HTMLElement | null;
5427
- /** Attribute name written on the target. Default: `"data-tempest-theme"`. */
5428
- attribute?: string;
5506
+ /**
5507
+ * Attribute name(s) written on the target with the resolved theme
5508
+ * (`"light"` / `"dark"`). Default: `"data-tempest-theme"`.
5509
+ *
5510
+ * Pass an array to mirror the theme onto more than one attribute — handy
5511
+ * when the SDK components read `data-tempest-theme` but the host app's own
5512
+ * CSS keys off a different attribute (e.g. `["data-tempest-theme",
5513
+ * "data-theme"]`). Avoids a separate sync effect in the consumer.
5514
+ */
5515
+ attribute?: string | string[];
5516
+ /**
5517
+ * When set, keeps `<meta name="theme-color">` in sync with the resolved
5518
+ * theme — `content` becomes `themeColor.dark` in dark mode and
5519
+ * `themeColor.light` in light mode. The meta tag must already exist in the
5520
+ * document `<head>`. No-op when omitted.
5521
+ */
5522
+ themeColor?: {
5523
+ light: string;
5524
+ dark: string;
5525
+ };
5429
5526
  }
5430
5527
 
5431
5528
  /**
@@ -5826,6 +5923,12 @@ export declare interface UseBeforeInstallPromptResult {
5826
5923
  installable: boolean;
5827
5924
  /** True after the user accepts the install prompt. */
5828
5925
  installed: boolean;
5926
+ /**
5927
+ * True when the app is already running as an installed PWA (display-mode
5928
+ * `standalone`/`fullscreen`/`minimal-ui`, or iOS `navigator.standalone`).
5929
+ * Use it to hide install affordances for users who already installed.
5930
+ */
5931
+ isStandalone: boolean;
5829
5932
  /** Show the install prompt. Resolves with the user's choice. */
5830
5933
  prompt: () => Promise<"accepted" | "dismissed" | "unsupported">;
5831
5934
  }