@molecule/app-ui-react 1.1.0 → 1.2.1

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 CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-09-24T08:01:39.991Z
6
+ Generated: 2026-09-26T05:12:25.359Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-ui-react
@@ -471,6 +471,35 @@ interface ConfirmButtonProps extends Omit<
471
471
  }
472
472
  ```
473
473
 
474
+ #### `ConfirmDialogProps`
475
+
476
+ Props for {@link ConfirmDialog}.
477
+
478
+ ```typescript
479
+ interface ConfirmDialogProps {
480
+ /** Whether the dialog is open. */
481
+ open: boolean
482
+ /** Called when the dialog should close (escape, backdrop, cancel). */
483
+ onClose: () => void
484
+ /** Title. */
485
+ title: ReactNode
486
+ /** Body / warning text. */
487
+ description: ReactNode
488
+ /** Confirm-button label (e.g. "Delete"). */
489
+ confirmLabel?: ReactNode
490
+ /** Cancel-button label. */
491
+ cancelLabel?: ReactNode
492
+ /** Called when the user confirms. */
493
+ onConfirm: () => void | Promise<void>
494
+ /** Is the confirm action destructive? Defaults to true. */
495
+ destructive?: boolean
496
+ /** Extra body content between description and footer. */
497
+ children?: ReactNode
498
+ /** Disables both buttons. Set it yourself while your `onConfirm` promise is pending — the dialog does not track it and does not auto-close. */
499
+ loading?: boolean
500
+ }
501
+ ```
502
+
474
503
  #### `ContainerProps`
475
504
 
476
505
  Props for the Container layout component.
@@ -826,6 +855,32 @@ interface LanguagePickerProps extends Omit<
826
855
  }
827
856
  ```
828
857
 
858
+ #### `LoadErrorBannerProps`
859
+
860
+ Props for {@link LoadErrorBanner}. Rest props are forwarded to the root
861
+ `<div>`, so they are typed as its attributes.
862
+
863
+ ```typescript
864
+ interface LoadErrorBannerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
865
+ /** The primary error line (e.g. the localized "Could not load X."). */
866
+ message: React.ReactNode
867
+ /** Secondary line under the message (status code, hint). */
868
+ detail?: React.ReactNode
869
+ /**
870
+ * Called when Retry is clicked. Return the promise; while pending, the
871
+ * button is disabled and shows "Retrying…". Omit for a display-only
872
+ * banner.
873
+ */
874
+ onRetry?: () => void | Promise<void>
875
+ /** Retry-button label. Falls back to a localized "Retry". */
876
+ retryLabel?: React.ReactNode
877
+ /** `data-mol-id` for the retry button (default `load-error-retry`). */
878
+ retryMolId?: string
879
+ /** Extra content between message and retry row (e.g. an error code). */
880
+ children?: React.ReactNode
881
+ }
882
+ ```
883
+
829
884
  #### `ModalProps`
830
885
 
831
886
  Props for the Modal/Dialog component.
@@ -992,6 +1047,46 @@ interface ProgressProps extends BaseProps {
992
1047
  }
993
1048
  ```
994
1049
 
1050
+ #### `PromptDialogProps`
1051
+
1052
+ Props for {@link PromptDialog}.
1053
+
1054
+ ```typescript
1055
+ interface PromptDialogProps {
1056
+ /** Whether the dialog is open. */
1057
+ open: boolean
1058
+ /** Called when the dialog should close (escape, backdrop, cancel, or a fulfilled {@link PromptDialogProps.onSubmit}). */
1059
+ onClose: () => void
1060
+ /** Dialog heading. */
1061
+ title: React.ReactNode
1062
+ /** Explanatory line under the title. */
1063
+ description?: React.ReactNode
1064
+ /** Input placeholder. */
1065
+ placeholder?: string
1066
+ /** Value the input starts from every time the dialog opens. */
1067
+ initialValue?: string
1068
+ /**
1069
+ * Called with the entered value on confirm. Resolve to close the dialog;
1070
+ * reject or throw to keep it open (show the error via {@link PromptDialogProps.children}).
1071
+ */
1072
+ onSubmit: (value: string) => void | Promise<void>
1073
+ /** Confirm-button label. Falls back to a localized "Confirm". */
1074
+ confirmLabel?: React.ReactNode
1075
+ /** Cancel-button label. Falls back to a localized "Cancel". */
1076
+ cancelLabel?: React.ReactNode
1077
+ /** Render the confirm button in the error color (e.g. an irreversible reset). */
1078
+ destructive?: boolean
1079
+ /** `data-mol-id` for the text input. */
1080
+ inputMolId?: string
1081
+ /** `data-mol-id` for the confirm button. */
1082
+ confirmMolId?: string
1083
+ /** `data-mol-id` for the cancel button. */
1084
+ cancelMolId?: string
1085
+ /** Extra body content under the input (error banners, hints). */
1086
+ children?: React.ReactNode
1087
+ }
1088
+ ```
1089
+
995
1090
  #### `RadioGroupProps`
996
1091
 
997
1092
  Props for the RadioGroup component.
@@ -1059,6 +1154,151 @@ interface RadioOption<T = string> {
1059
1154
  }
1060
1155
  ```
1061
1156
 
1157
+ #### `ResponsiveAppShellContentProps`
1158
+
1159
+ Props for the {@link ResponsiveAppShellContent} sub-component.
1160
+
1161
+ ```typescript
1162
+ interface ResponsiveAppShellContentProps {
1163
+ /** The routed page content — typically an `<Outlet />`. */
1164
+ children: ReactNode
1165
+ /** Extra classes on the `<main>`. */
1166
+ className?: string
1167
+ /** Inline styles on the `<main>` (rarely needed — layout is owned). */
1168
+ style?: React.CSSProperties
1169
+ /** `data-mol-id` override. Default: `'shell-content'`. */
1170
+ dataMolId?: string
1171
+ /** `data-testid` override. */
1172
+ testId?: string
1173
+ }
1174
+ ```
1175
+
1176
+ #### `ResponsiveAppShellDrawerProps`
1177
+
1178
+ Props for the {@link ResponsiveAppShellDrawer} sub-component.
1179
+
1180
+ ```typescript
1181
+ interface ResponsiveAppShellDrawerProps {
1182
+ /**
1183
+ * Nav content — the links, same as (or adapted from) the Sidebar's. Only
1184
+ * mounted while the drawer is open on a below-breakpoint viewport.
1185
+ */
1186
+ children: ReactNode
1187
+ /**
1188
+ * Header row content (typically the brand), rendered next to the close
1189
+ * button.
1190
+ */
1191
+ header?: ReactNode
1192
+ /**
1193
+ * Accessible name for the dialog and its `<nav>` landmark. Defaults to the
1194
+ * `appShell.primaryNav` translation (English fallback `"Primary
1195
+ * navigation"`).
1196
+ */
1197
+ navLabel?: string
1198
+ /** Below-nav content (user card, sign-out), after the `<nav>`. */
1199
+ footer?: ReactNode
1200
+ /** Whether the panel shows a close (X) button. Default: `true`. */
1201
+ showCloseButton?: boolean
1202
+ /** Extra classes on the dialog panel. */
1203
+ className?: string
1204
+ /** `data-mol-id` override for the panel. Default: `'shell-drawer'`. */
1205
+ dataMolId?: string
1206
+ /** `data-mol-id` override for the close button. Default: `'shell-drawer-close'`. */
1207
+ closeDataMolId?: string
1208
+ /** `data-testid` override for the panel. */
1209
+ testId?: string
1210
+ }
1211
+ ```
1212
+
1213
+ #### `ResponsiveAppShellProps`
1214
+
1215
+ Props for the {@link ResponsiveAppShell} root.
1216
+
1217
+ ```typescript
1218
+ interface ResponsiveAppShellProps {
1219
+ /**
1220
+ * The shell sub-components — `<ResponsiveAppShell.TopBar />`,
1221
+ * `<ResponsiveAppShell.Sidebar />`, `<ResponsiveAppShell.Drawer />` and
1222
+ * `<ResponsiveAppShell.Content />`.
1223
+ */
1224
+ children: ReactNode
1225
+ /**
1226
+ * Sidebar (and drawer) width: `'sm'` (208px), `'md'` (240px, default),
1227
+ * `'lg'` (256px) or an exact pixel number.
1228
+ */
1229
+ sidebarWidth?: ShellSidebarWidth
1230
+ /** Extra classes on the root flex-row container. */
1231
+ className?: string
1232
+ /**
1233
+ * `data-mol-id` for the root container. Defaults to `'shell-root'`.
1234
+ */
1235
+ dataMolId?: string
1236
+ }
1237
+ ```
1238
+
1239
+ #### `ResponsiveAppShellSidebarProps`
1240
+
1241
+ Props for the {@link ResponsiveAppShellSidebar} sub-component.
1242
+
1243
+ ```typescript
1244
+ interface ResponsiveAppShellSidebarProps {
1245
+ /**
1246
+ * Nav content — the links (they land inside the sidebar's `<nav>` landmark;
1247
+ * pass `aria-current="page"` from the active one yourself). Typically the
1248
+ * SAME element variable the Drawer receives, so only the mounted
1249
+ * breakpoint's copy ever instantiates.
1250
+ */
1251
+ children: ReactNode
1252
+ /**
1253
+ * Accessible name for the sidebar's `<nav>` landmark. Defaults to the
1254
+ * `appShell.primaryNav` translation (English fallback `"Primary
1255
+ * navigation"`).
1256
+ */
1257
+ navLabel?: string
1258
+ /**
1259
+ * Below-nav content (user card, quick action) — rendered after the `<nav>`
1260
+ * in a bordered footer row, so it does not sit inside the nav landmark.
1261
+ */
1262
+ footer?: ReactNode
1263
+ /** Extra classes on the `<aside>`. */
1264
+ className?: string
1265
+ /** `data-mol-id` override. Default: `'shell-sidebar'`. */
1266
+ dataMolId?: string
1267
+ /** `data-testid` override. */
1268
+ testId?: string
1269
+ }
1270
+ ```
1271
+
1272
+ #### `ResponsiveAppShellTopBarProps`
1273
+
1274
+ Props for the {@link ResponsiveAppShellTopBar} sub-component.
1275
+
1276
+ ```typescript
1277
+ interface ResponsiveAppShellTopBarProps {
1278
+ /**
1279
+ * Brand/title node, rendered after the menu trigger — typically a
1280
+ * `<Link to="/…">` with the app name or logo. The shell wraps it in a
1281
+ * flex row; style the node itself.
1282
+ */
1283
+ brand?: ReactNode
1284
+ /** Trailing actions — user menu, theme toggle, search, etc. */
1285
+ actions?: ReactNode
1286
+ /**
1287
+ * Render the top bar only below the breakpoint (mount-conditioned, not
1288
+ * CSS-hidden — no dead DOM on desktop). For apps whose desktop shell has
1289
+ * no top bar (e.g. the sidebar carries everything). Default: `false`
1290
+ * (top bar on every breakpoint).
1291
+ */
1292
+ mobileOnly?: boolean
1293
+ /** Extra classes on the `<header>`. */
1294
+ className?: string
1295
+ /** `data-mol-id` override. Default: `'shell-topbar'`. */
1296
+ dataMolId?: string
1297
+ /** `data-testid` override. */
1298
+ testId?: string
1299
+ }
1300
+ ```
1301
+
1062
1302
  #### `SelectElementProps`
1063
1303
 
1064
1304
  Base props for select elements.
@@ -1853,6 +2093,19 @@ Framework-agnostic mouse event handler.
1853
2093
  type MouseEventHandler = EventHandler<MouseEvent>
1854
2094
  ```
1855
2095
 
2096
+ #### `ShellSidebarWidth`
2097
+
2098
+ Semantic sidebar width — the same stack-agnostic presets
2099
+ `@molecule/app-sidebar-layout-react` uses, so both shells render the same
2100
+ fleet geometry: `sm` → 208px, `md` → 240px (default), `lg` → 256px. A raw
2101
+ `number` is an exact pixel width. Applied via inline style (a specific
2102
+ pixel width is the documented "value a swappable ClassMap cannot express
2103
+ as a token" case).
2104
+
2105
+ ```typescript
2106
+ type ShellSidebarWidth = 'sm' | 'md' | 'lg' | number
2107
+ ```
2108
+
1856
2109
  #### `Size`
1857
2110
 
1858
2111
  Standard size scale used across all molecule UI components (buttons, inputs, badges, etc.).
@@ -1912,6 +2165,30 @@ function cn(inputs?: (string | false | null | undefined)[]): string
1912
2165
 
1913
2166
  **Returns:** A single space-separated class string.
1914
2167
 
2168
+ #### `ConfirmDialog(props)`
2169
+
2170
+ Are-you-sure-style confirmation modal for destructive actions.
2171
+
2172
+ Use standalone (around delete buttons, revoke tokens, irreversible
2173
+ migrations) or with a DangerZoneSection action.
2174
+
2175
+ ```typescript
2176
+ function ConfirmDialog({
2177
+ open,
2178
+ onClose,
2179
+ title,
2180
+ description,
2181
+ confirmLabel,
2182
+ cancelLabel,
2183
+ onConfirm,
2184
+ destructive = true,
2185
+ children,
2186
+ loading,
2187
+ }: ConfirmDialogProps): JSX.Element
2188
+ ```
2189
+
2190
+ - `props` — Component props (see {@link ConfirmDialogProps}).
2191
+
1915
2192
  #### `Icon(props)`
1916
2193
 
1917
2194
  Renders an SVG glyph looked up by `name` from the bonded
@@ -1978,6 +2255,24 @@ function LanguagePicker({
1978
2255
 
1979
2256
  - `props` — {@link LanguagePickerProps}
1980
2257
 
2258
+ #### `LoadErrorBanner(props)`
2259
+
2260
+ Error banner with an owned pending-state Retry button.
2261
+
2262
+ ```typescript
2263
+ function LoadErrorBanner({
2264
+ message,
2265
+ detail,
2266
+ onRetry,
2267
+ retryLabel,
2268
+ retryMolId = 'load-error-retry',
2269
+ children,
2270
+ ...rest
2271
+ }: LoadErrorBannerProps): JSX.Element
2272
+ ```
2273
+
2274
+ - `props` — Component props (see {@link LoadErrorBannerProps}).
2275
+
1981
2276
  #### `PanelCloseProvider(props)`
1982
2277
 
1983
2278
  Provides the panel-close callback to descendants. Rendered internally
@@ -1992,6 +2287,127 @@ function PanelCloseProvider({ close, children }: PanelCloseProviderProps): JSX.E
1992
2287
 
1993
2288
  **Returns:** The children wrapped in the close-context provider.
1994
2289
 
2290
+ #### `PromptDialog(props)`
2291
+
2292
+ Modal that asks the user for a short string, replacing `window.prompt`.
2293
+
2294
+ ```typescript
2295
+ function PromptDialog({
2296
+ open,
2297
+ onClose,
2298
+ title,
2299
+ description,
2300
+ placeholder,
2301
+ initialValue = '',
2302
+ onSubmit,
2303
+ confirmLabel,
2304
+ cancelLabel,
2305
+ destructive = false,
2306
+ inputMolId,
2307
+ confirmMolId,
2308
+ cancelMolId,
2309
+ children,
2310
+ }: PromptDialogProps): JSX.Element
2311
+ ```
2312
+
2313
+ - `props` — Component props (see {@link PromptDialogProps}).
2314
+
2315
+ #### `ResponsiveAppShellContent(props)`
2316
+
2317
+ The shell's `<main>` landmark. Grows to fill the row and may shrink below
2318
+ its content width, so page-level `overflow-x` strips scroll inside the
2319
+ page instead of widening the whole shell.
2320
+
2321
+ ```typescript
2322
+ function ResponsiveAppShellContent({
2323
+ children,
2324
+ className,
2325
+ style,
2326
+ dataMolId = 'shell-content',
2327
+ testId,
2328
+ }: ResponsiveAppShellContentProps): JSX.Element
2329
+ ```
2330
+
2331
+ - `props` — The page content and class/id overrides.
2332
+
2333
+ **Returns:** The main landmark.
2334
+
2335
+ #### `ResponsiveAppShellDrawer(props)`
2336
+
2337
+ The mobile nav drawer (<768px): a left-anchored dialog panel over a
2338
+ backdrop, opened by the menu trigger the TopBar renders.
2339
+
2340
+ Implements the WAI-ARIA APG dialog pattern — focus moves into the panel on
2341
+ open and returns to the previously focused element (the trigger) on close,
2342
+ Tab is trapped inside, Escape and backdrop clicks close, body scroll locks
2343
+ (reference-counted with any stacked `<Modal>`), and the shell closes it on
2344
+ SPA navigation. Renders nothing on desktop or while closed.
2345
+
2346
+ ```typescript
2347
+ function ResponsiveAppShellDrawer({
2348
+ children,
2349
+ header,
2350
+ navLabel,
2351
+ footer,
2352
+ showCloseButton = true,
2353
+ className,
2354
+ dataMolId = 'shell-drawer',
2355
+ closeDataMolId = 'shell-drawer-close',
2356
+ testId,
2357
+ }: ResponsiveAppShellDrawerProps): JSX.Element | null
2358
+ ```
2359
+
2360
+ - `props` — Nav children, header/nav-label/footer slots, close-button and class/id overrides.
2361
+
2362
+ **Returns:** The drawer portal while open on mobile, otherwise `null`.
2363
+
2364
+ #### `ResponsiveAppShellSidebar(props)`
2365
+
2366
+ The desktop sidebar (`<aside>` + `<nav>` landmarks). Renders NOTHING below
2367
+ 768px — the {@link ResponsiveAppShellDrawer} carries the nav there.
2368
+
2369
+ Full viewport height, sticky at the top edge, scrolls internally when its
2370
+ content outgrows the viewport.
2371
+
2372
+ ```typescript
2373
+ function ResponsiveAppShellSidebar({
2374
+ children,
2375
+ navLabel,
2376
+ footer,
2377
+ className,
2378
+ dataMolId = 'shell-sidebar',
2379
+ testId,
2380
+ }: ResponsiveAppShellSidebarProps): JSX.Element | null
2381
+ ```
2382
+
2383
+ - `props` — Nav children, nav label, footer slot, class/id overrides.
2384
+
2385
+ **Returns:** The sidebar landmarks, or `null` below the breakpoint.
2386
+
2387
+ #### `ResponsiveAppShellTopBar(props)`
2388
+
2389
+ The shell's `<header>` landmark: menu trigger (mobile, when a Drawer is
2390
+ composed), brand, and trailing actions.
2391
+
2392
+ Sticks to the top of the viewport by default. The menu trigger renders
2393
+ only while a `ResponsiveAppShell.Drawer` is part of the composition AND
2394
+ the viewport is below the breakpoint.
2395
+
2396
+ ```typescript
2397
+ function ResponsiveAppShellTopBar({
2398
+ brand,
2399
+ actions,
2400
+ mobileOnly = false,
2401
+ className,
2402
+ dataMolId = 'shell-topbar',
2403
+ testId,
2404
+ }: ResponsiveAppShellTopBarProps): JSX.Element | null
2405
+ ```
2406
+
2407
+ - `props` — Brand/actions slots, `mobileOnly`, and class/id overrides.
2408
+
2409
+ **Returns:** The header landmark, or `null` when `mobileOnly` is set on desktop.
2410
+
1995
2411
  #### `SidebarUserCard(props)`
1996
2412
 
1997
2413
  Sidebar-resident user-account card: avatar + name + status line, opens
@@ -2069,6 +2485,27 @@ function ToastProvider({
2069
2485
 
2070
2486
  **Returns:** The rendered provider with toast container.
2071
2487
 
2488
+ #### `useIsDesktop(query)`
2489
+
2490
+ Whether the viewport is at least 768px wide (the fleet's `md` breakpoint).
2491
+
2492
+ Reads `window.matchMedia` synchronously in the state initializer, so the
2493
+ FIRST client render is already correct — no mobile-then-desktop swap frame
2494
+ (this is time-tracking's QA-hardened version; the naive
2495
+ "state starts false, sync in an effect" variant mounts the wrong shell for
2496
+ one frame and double-fetches route data on desktop). Subscribes to
2497
+ `change` events afterwards. Guarded for non-browser environments
2498
+ (SSR/node): returns `false` (the mobile shell) when no `window.matchMedia`
2499
+ exists.
2500
+
2501
+ ```typescript
2502
+ function useIsDesktop(query?: string): boolean
2503
+ ```
2504
+
2505
+ - `query` — Override the media query. Defaults to `(min-width: 768px)`.
2506
+
2507
+ **Returns:** Whether the desktop shell should mount.
2508
+
2072
2509
  #### `usePanelClose()`
2073
2510
 
2074
2511
  Returns the callback that dismisses the drawer the current panel is
@@ -2583,6 +3020,24 @@ const RadioGroup: React.ForwardRefExoticComponent<
2583
3020
  >
2584
3021
  ```
2585
3022
 
3023
+ #### `ResponsiveAppShell`
3024
+
3025
+ The responsive app shell family — see the {@link ResponsiveAppShellBase |
3026
+ root component} and the module docs for the full contract.
3027
+
3028
+ Consumed as `<ResponsiveAppShell.TopBar />`, `.Sidebar`, `.Drawer` and
3029
+ `.Content` inside `<ResponsiveAppShell>`; each is also exported as a named
3030
+ component (`ResponsiveAppShellTopBar`, …) for star-import consumers.
3031
+
3032
+ ```typescript
3033
+ const ResponsiveAppShell: typeof ResponsiveAppShellBase & {
3034
+ TopBar: typeof ResponsiveAppShellTopBar
3035
+ Sidebar: typeof ResponsiveAppShellSidebar
3036
+ Drawer: typeof ResponsiveAppShellDrawer
3037
+ Content: typeof ResponsiveAppShellContent
3038
+ }
3039
+ ```
3040
+
2586
3041
  #### `Select`
2587
3042
 
2588
3043
  Select component.
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/components/Alert.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,OAAO,KAAK,EAAE,UAAU,EAAgB,MAAM,kBAAkB,CAAA;AAyBhE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,KAAK;WAAoD,OAAO;wCAkD5E,CAAA"}
1
+ {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/components/Alert.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,OAAO,KAAK,EAAE,UAAU,EAAgB,MAAM,kBAAkB,CAAA;AAyBhE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,KAAK;WAAoD,OAAO;wCAwD5E,CAAA"}
@@ -40,12 +40,15 @@ const statusIconMap = {
40
40
  * page's normal content, and it announces politely (`role="status"`)
41
41
  * instead of interrupting.
42
42
  */
43
- export const Alert = forwardRef(({ children, title, status = 'info', variant: _variant, live = true, dismissible, onDismiss, icon, dismissLabel, className, style, testId, }, ref) => {
43
+ export const Alert = forwardRef(({ children, title, status = 'info', variant, live = true, dismissible, onDismiss, icon, dismissLabel, className, style, testId, }, ref) => {
44
44
  const cm = getClassMap();
45
45
  const alertVariant = statusVariantMap[status] || 'default';
46
46
  const iconName = statusIconMap[alertVariant];
47
47
  const defaultIcon = iconName ? renderIcon(iconName, cm.iconMd) : null;
48
- const alertClasses = cm.cn(cm.alert({ variant: alertVariant }), className);
48
+ const alertClasses = cm.cn(cm.alert({ variant: alertVariant }),
49
+ // The core contract types variant="left-accent"; render it as a 4px
50
+ // status-colored leading bar (previously silently dropped).
51
+ variant === 'left-accent' && cm.alertLeftAccent({ variant: alertVariant }), className);
49
52
  const role = live ? 'alert' : 'status';
50
53
  return (_jsxs("div", { ref: ref, role: role, className: alertClasses, style: style, "data-testid": testId, children: [(icon || defaultIcon) && (_jsx("span", { className: cm.alertIconWrapper, children: (icon || defaultIcon) })), _jsxs("div", { className: cm.alertContent, children: [title && _jsx("h5", { className: cm.alertTitle, children: title }), _jsx("div", { className: cm.alertDescription, children: children })] }), dismissible && (_jsx("button", { type: "button", onClick: onDismiss, className: cm.alertDismiss, "aria-label": dismissLabel ?? t('ui.alert.dismiss', undefined, { defaultValue: 'Dismiss' }), children: renderIcon('x-mark', cm.iconSm) }))] }));
51
54
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../src/components/Alert.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AAGtC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAEvD,MAAM,gBAAgB,GACpB;IACE,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,SAAS;IACpB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;CACb,CAAA;AAEH;;GAEG;AACH,MAAM,aAAa,GAA6B;IAC9C,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,sBAAsB;IAC/B,KAAK,EAAE,UAAU;CAClB,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAC7B,CACE,EACE,QAAQ,EACR,KAAK,EACL,MAAM,GAAG,MAAM,EACf,OAAO,EAAE,QAAQ,EACjB,IAAI,GAAG,IAAI,EACX,WAAW,EACX,SAAS,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AO,CAAA"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * ConfirmDialog component — the shared "Are you sure?" modal.
3
+ *
4
+ * Promoted from `@molecule/app-danger-zone-react` (2026-09-24) so every app
5
+ * confirms destructive actions through the framework bundle instead of
6
+ * hand-rolling `window.confirm` (broken headless + on touch) or reaching for
7
+ * the danger-zone feature package just to render one dialog. For an INLINE
8
+ * two-click arm/commit affordance use {@link ConfirmButton}; for a dialog
9
+ * that also collects text use {@link PromptDialog}.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * import { ConfirmDialog } from '@molecule/app-ui-react'
14
+ *
15
+ * <ConfirmDialog
16
+ * open={confirmOpen}
17
+ * onClose={() => setConfirmOpen(false)}
18
+ * title="Delete vault?"
19
+ * description="This action cannot be undone."
20
+ * confirmLabel={t('vault.delete', {}, { defaultValue: 'Delete' })}
21
+ * onConfirm={handleDelete}
22
+ * />
23
+ * ```
24
+ *
25
+ * @remarks
26
+ * Does NOT track `onConfirm`'s promise and does NOT close itself on confirm:
27
+ * set `loading` yourself while the action runs, then call `onClose()` when it
28
+ * settles — otherwise users can double-fire the destructive action or be left
29
+ * staring at an open dialog. Cancel/Confirm fall back to the `confirm.*`
30
+ * i18n keys (companion bond: `@molecule/app-locales-danger-zone`); pass
31
+ * `confirmLabel`/`cancelLabel` for action-specific wording ("Delete",
32
+ * "Revoke"). `destructive` (default true) only switches the confirm button
33
+ * color. `data-mol-id` for e2e locators goes on YOUR trigger button; the
34
+ * dialog's own buttons are text-labeled ("Cancel"/confirm label) so
35
+ * `getByRole('button', { name })` reaches them.
36
+ *
37
+ * @module
38
+ */
39
+ import type { JSX, ReactNode } from 'react';
40
+ /** Props for {@link ConfirmDialog}. */
41
+ export interface ConfirmDialogProps {
42
+ /** Whether the dialog is open. */
43
+ open: boolean;
44
+ /** Called when the dialog should close (escape, backdrop, cancel). */
45
+ onClose: () => void;
46
+ /** Title. */
47
+ title: ReactNode;
48
+ /** Body / warning text. */
49
+ description: ReactNode;
50
+ /** Confirm-button label (e.g. "Delete"). */
51
+ confirmLabel?: ReactNode;
52
+ /** Cancel-button label. */
53
+ cancelLabel?: ReactNode;
54
+ /** Called when the user confirms. */
55
+ onConfirm: () => void | Promise<void>;
56
+ /** Is the confirm action destructive? Defaults to true. */
57
+ destructive?: boolean;
58
+ /** Extra body content between description and footer. */
59
+ children?: ReactNode;
60
+ /** Disables both buttons. Set it yourself while your `onConfirm` promise is pending — the dialog does not track it and does not auto-close. */
61
+ loading?: boolean;
62
+ }
63
+ /**
64
+ * Are-you-sure-style confirmation modal for destructive actions.
65
+ *
66
+ * Use standalone (around delete buttons, revoke tokens, irreversible
67
+ * migrations) or with a DangerZoneSection action.
68
+ * @param props - Component props (see {@link ConfirmDialogProps}).
69
+ */
70
+ export declare function ConfirmDialog({ open, onClose, title, description, confirmLabel, cancelLabel, onConfirm, destructive, children, loading, }: ConfirmDialogProps): JSX.Element;
71
+ //# sourceMappingURL=ConfirmDialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfirmDialog.d.ts","sourceRoot":"","sources":["../../src/components/ConfirmDialog.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQ3C,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IACjC,kCAAkC;IAClC,IAAI,EAAE,OAAO,CAAA;IACb,sEAAsE;IACtE,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,aAAa;IACb,KAAK,EAAE,SAAS,CAAA;IAChB,2BAA2B;IAC3B,WAAW,EAAE,SAAS,CAAA;IACtB,4CAA4C;IAC5C,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,qCAAqC;IACrC,SAAS,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,2DAA2D;IAC3D,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,+IAA+I;IAC/I,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,OAAO,EACP,KAAK,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,SAAS,EACT,WAAkB,EAClB,QAAQ,EACR,OAAO,GACR,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CA2BlC"}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTranslation } from '@molecule/app-react';
3
+ import { getClassMap } from '@molecule/app-ui';
4
+ import { Button } from './Button.js';
5
+ import { Modal } from './Modal.js';
6
+ /**
7
+ * Are-you-sure-style confirmation modal for destructive actions.
8
+ *
9
+ * Use standalone (around delete buttons, revoke tokens, irreversible
10
+ * migrations) or with a DangerZoneSection action.
11
+ * @param props - Component props (see {@link ConfirmDialogProps}).
12
+ */
13
+ export function ConfirmDialog({ open, onClose, title, description, confirmLabel, cancelLabel, onConfirm, destructive = true, children, loading, }) {
14
+ const cm = getClassMap();
15
+ const { t } = useTranslation();
16
+ return (_jsx(Modal, { open: open, onClose: onClose, children: _jsxs("div", { className: cm.stack(3), children: [_jsx("h2", { className: cm.cn(cm.textSize('lg'), cm.fontWeight('bold')), children: title }), _jsx("p", { className: cm.textSize('sm'), children: description }), children, _jsxs("div", { className: cm.flex({ justify: 'end', gap: 'sm' }), children: [_jsx(Button, { variant: "ghost", onClick: onClose, disabled: loading, children: cancelLabel ?? t('confirm.cancel', {}, { defaultValue: 'Cancel' }) }), _jsx(Button, { variant: "solid", color: destructive ? 'error' : 'primary', onClick: () => void onConfirm(), disabled: loading, children: loading
17
+ ? '…'
18
+ : (confirmLabel ?? t('confirm.confirm', {}, { defaultValue: 'Confirm' })) })] })] }) }));
19
+ }
20
+ //# sourceMappingURL=ConfirmDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfirmDialog.js","sourceRoot":"","sources":["../../src/components/ConfirmDialog.tsx"],"names":[],"mappings":";AAyCA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AA0BlC;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,IAAI,EACJ,OAAO,EACP,KAAK,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,SAAS,EACT,WAAW,GAAG,IAAI,EAClB,QAAQ,EACR,OAAO,GACY;IACnB,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IACxB,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;IAC9B,OAAO,CACL,KAAC,KAAK,IAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,YACjC,eAAK,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,aACzB,aAAI,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,YAAG,KAAK,GAAM,EAC5E,YAAG,SAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAG,WAAW,GAAK,EACjD,QAAQ,EACT,eAAK,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,aACpD,KAAC,MAAM,IAAC,OAAO,EAAC,OAAO,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,YACxD,WAAW,IAA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