@rexezuge/web 1.0.9 → 1.2.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.
Files changed (54) hide show
  1. package/README.md +28 -13
  2. package/dist/AppPage.d.ts +33 -0
  3. package/dist/AppPage.d.ts.map +1 -0
  4. package/dist/AppPage.js +7 -0
  5. package/dist/AppPage.js.map +1 -0
  6. package/dist/ContextBar.d.ts +43 -0
  7. package/dist/ContextBar.d.ts.map +1 -0
  8. package/dist/ContextBar.js +7 -0
  9. package/dist/ContextBar.js.map +1 -0
  10. package/dist/LanguageSelector.d.ts +57 -0
  11. package/dist/LanguageSelector.d.ts.map +1 -0
  12. package/dist/LanguageSelector.js +12 -0
  13. package/dist/LanguageSelector.js.map +1 -0
  14. package/dist/ModalShell.d.ts +53 -0
  15. package/dist/ModalShell.d.ts.map +1 -0
  16. package/dist/ModalShell.js +22 -0
  17. package/dist/ModalShell.js.map +1 -0
  18. package/dist/NoticeBar.d.ts +50 -0
  19. package/dist/NoticeBar.d.ts.map +1 -0
  20. package/dist/NoticeBar.js +12 -0
  21. package/dist/NoticeBar.js.map +1 -0
  22. package/dist/PageHeaderCard.d.ts +40 -0
  23. package/dist/PageHeaderCard.d.ts.map +1 -0
  24. package/dist/PageHeaderCard.js +7 -0
  25. package/dist/PageHeaderCard.js.map +1 -0
  26. package/dist/PageState.d.ts +47 -0
  27. package/dist/PageState.d.ts.map +1 -0
  28. package/dist/PageState.js +47 -0
  29. package/dist/PageState.js.map +1 -0
  30. package/dist/ReadOnlyField.d.ts +49 -0
  31. package/dist/ReadOnlyField.d.ts.map +1 -0
  32. package/dist/ReadOnlyField.js +17 -0
  33. package/dist/ReadOnlyField.js.map +1 -0
  34. package/dist/RefreshButton.d.ts +36 -0
  35. package/dist/RefreshButton.d.ts.map +1 -0
  36. package/dist/RefreshButton.js +8 -0
  37. package/dist/RefreshButton.js.map +1 -0
  38. package/dist/TypeToConfirmModal.d.ts +47 -0
  39. package/dist/TypeToConfirmModal.d.ts.map +1 -0
  40. package/dist/TypeToConfirmModal.js +24 -0
  41. package/dist/TypeToConfirmModal.js.map +1 -0
  42. package/dist/Unauthorized.d.ts +45 -0
  43. package/dist/Unauthorized.d.ts.map +1 -0
  44. package/dist/Unauthorized.js +11 -0
  45. package/dist/Unauthorized.js.map +1 -0
  46. package/dist/index.d.ts +44 -1
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +41 -1
  49. package/dist/index.js.map +1 -1
  50. package/dist/useCopyToClipboard.d.ts +54 -0
  51. package/dist/useCopyToClipboard.d.ts.map +1 -0
  52. package/dist/useCopyToClipboard.js +40 -0
  53. package/dist/useCopyToClipboard.js.map +1 -0
  54. package/package.json +5 -3
package/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  React UI primitives, hooks, and API client for the family SPAs.
4
4
 
5
- Depends on `@rexezuge/errors` (every rejection is a `ServiceError`) and `@rexezuge/shared`. Peer-depends on `react` + `react-dom` 19 — the kit stays version-agnostic and the app owns the renderer.
5
+ Depends on `@rexezuge/errors` (every rejection is a `ServiceError`) and `@rexezuge/shared`. Peer-depends on `react` + `react-dom` 19 — the kit stays version-agnostic and the app owns the renderer — and on `lucide-react` `^1.49`, which three of the converged components use for their glyphs.
6
+
7
+ **Glyphs in, strings out.** No component in this package calls `useTranslation`: every label is a prop, because the app rendering a dialog knows what it says. Icons are the exception — vendoring a glyph's path data freezes it at whatever version was current when it was copied, so `lucide-react` is a peer and the icons come from the app's own copy. `Button` deliberately keeps using this package's own `Spinner` rather than lucide's `Loader2`; chrome is cheap to draw, iconography is not.
6
8
 
7
9
  ```bash
8
10
  pnpm add @rexezuge/web
@@ -14,16 +16,28 @@ pnpm add @rexezuge/web
14
16
 
15
17
  Class-based primitives over the CSS variables every Tailwind consumer already defines (`--color-accent`, `--color-surface-*`, `--color-text-*`, `--color-{success,error,warning,info,neutral}-{bg,text}`); `Spinner` (and `Button`'s busy state) additionally needs `animate-spin`.
16
18
 
17
- | Export | Notes |
18
- | ---------------------------------------------------------- | -------------------------------------------------------------- |
19
- | `Button` / `LoadingButton` | variants + sizes via `buttonClass`; loading state with spinner |
20
- | `Badge` | `badgeClass` / `badgeVariantClass` status pills |
21
- | `Card`, `CardHeader`, `CardTitle` | layout shells |
22
- | `Input`, `Label`, `Select`, `Textarea`, `FocusInput` | form controls, `fieldClass` shared styling |
23
- | `Pagination` (+ `pageWindow`, `pageCountFor`, `clampPage`) | windowed page navigation |
24
- | `Spinner` | standalone busy indicator |
25
- | `theme` (+ `buttonColors`, `inputStyle`, …) | legacy inline-style escape hatch |
26
- | `cn` | conditional class join |
19
+ | Export | Notes |
20
+ | ---------------------------------------------------------- | ----------------------------------------------------------------------- |
21
+ | `Button` / `LoadingButton` | variants + sizes via `buttonClass`; loading state with spinner |
22
+ | `Badge` | `badgeClass` / `badgeVariantClass` status pills |
23
+ | `Card`, `CardHeader`, `CardTitle` | layout shells |
24
+ | `Input`, `Label`, `Select`, `Textarea`, `FocusInput` | form controls, `fieldClass` shared styling |
25
+ | `Pagination` (+ `pageWindow`, `pageCountFor`, `clampPage`) | windowed page navigation |
26
+ | `Spinner` | standalone busy indicator |
27
+ | `AppPage` | `wide` / `narrow` / `hero` page container |
28
+ | `PageHeaderCard` | the standard page-title header |
29
+ | `ContextBar` | sticky sub-page bar; `home` is a node, so no router is imposed |
30
+ | `Unauthorized` | the "not signed in" page |
31
+ | `NoticeBar` | renders `useNotice`'s own `Notice`; errors assert, successes are polite |
32
+ | `LanguageSelector` | the 12-locale picker, off `LocaleUtil`'s shared table |
33
+ | `ModalShell` | portal dialog frame; a click inside never reaches the backdrop |
34
+ | `ConfirmDeleteModal` | an always-armed destructive confirmation |
35
+ | `TypeToConfirmModal` | arms only on an exact name match |
36
+ | `RefreshButton` | refresh control, `loading` blocks activation |
37
+ | `ReadOnlyField` | read-only value with an optional copy button |
38
+ | `EmptyState` / `LoadingSpinner` | the shared page states |
39
+ | `theme` (+ `buttonColors`, `inputStyle`, …) | legacy inline-style escape hatch |
40
+ | `cn` | conditional class join |
27
41
 
28
42
  ```tsx
29
43
  import { Button, Card, CardHeader, CardTitle, useNotice } from '@rexezuge/web';
@@ -43,8 +57,9 @@ function Panel() {
43
57
 
44
58
  ## 2. Hooks
45
59
 
46
- - **`useNotice`** — timed notice stack (`NOTICE_TIMEOUT_MS`, `COPY_FEEDBACK_TIMEOUT_MS`); `showNotice` returns a dismiss handle.
47
- - **`useSpaLanguage`** — `localStorage`-persisted language with `Accept-Language` default (`DEFAULT_SUPPORTED_LANGUAGES`, `resolveLanguageTag`, `canonicalizeLanguageTag`).
60
+ - **`useNotice`** — one transient message, `{ notice, showNotice, dismissNotice }`. `notice` is `null` when there is nothing to say, which is what `NoticeBar` takes. A new notice replaces the old one's pending dismissal rather than stacking a second timer.
61
+ - **`useCopyToClipboard`** — `{ copied, copy }`, where `copied` becomes true **only** after a write that actually resolved. A denied permission or a plain-HTTP deployment leaves it `false`, which is the answer that matters: there is nothing to undo. Every value the family copies is a credential or an identifier, so a false success sends the operator away believing they have something they do not.
62
+ - **`useSpaLanguage`** — `localStorage`-persisted language with `Accept-Language` default (`DEFAULT_SUPPORTED_LANGUAGES`, `resolveLanguageTag`, `canonicalizeLanguageTag`). Hand the resolved tag to `LanguageSelector`.
48
63
  - **`useCurrentUser`** — fetches `CURRENT_USER_PATH` (`/user`), with loading/error states for shell gating.
49
64
 
50
65
  ## 3. API client
@@ -0,0 +1,33 @@
1
+ import type { ReactNode } from 'react';
2
+ /**
3
+ * The one page container.
4
+ *
5
+ * ## Provenance
6
+ *
7
+ * `components/layout/AppPage.tsx` in **Durable-DAV**, **Durable-DAV-Router**,
8
+ * **Edge-Git** and **Edge-Sonic** — four copies, three of them identical.
9
+ *
10
+ * ## The divergence, and which side won
11
+ *
12
+ * Three copies used `max-w-7xl`; Edge-Sonic's used `max-w-5xl` and recorded
13
+ * why: the operator surface is two lists and two forms, and the wider measure
14
+ * only adds line length to prose already at its readable limit. That is the
15
+ * better answer, so it is the one here — with `className` as the documented
16
+ * escape hatch for a repo that genuinely wants the wider measure, because the
17
+ * decision is per-app and a vendored copy would freeze ours.
18
+ *
19
+ * `hero` follows `wide` rather than carrying its own width: a hero that is
20
+ * wider than the page it introduces is a layout bug, not a style.
21
+ */
22
+ /** `wide` is the default for every view. `narrow` is for centered forms. */
23
+ type AppPageVariant = 'wide' | 'narrow' | 'hero';
24
+ interface AppPageProps {
25
+ variant?: AppPageVariant;
26
+ /** Merged last, so it wins over the variant's own classes. */
27
+ className?: string;
28
+ children: ReactNode;
29
+ }
30
+ declare function AppPage({ variant, className, children }: Readonly<AppPageProps>): import("react").JSX.Element;
31
+ export { AppPage };
32
+ export type { AppPageProps, AppPageVariant };
33
+ //# sourceMappingURL=AppPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppPage.d.ts","sourceRoot":"","sources":["../src/AppPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4EAA4E;AAC5E,KAAK,cAAc,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEjD,UAAU,YAAY;IACpB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,iBAAS,OAAO,CAAC,EAAE,OAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,YAAY,CAAC,+BAcjF;AAED,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from './utils';
3
+ function AppPage({ variant = 'wide', className, children }) {
4
+ return (_jsx("div", { className: cn('mx-auto w-full px-6', variant === 'wide' && 'max-w-5xl py-8 space-y-4', variant === 'narrow' && 'max-w-2xl py-8 space-y-4', variant === 'hero' && 'max-w-5xl py-16', className), children: children }));
5
+ }
6
+ export { AppPage };
7
+ //# sourceMappingURL=AppPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppPage.js","sourceRoot":"","sources":["../src/AppPage.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAiC7B,SAAS,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,SAAS,EAAE,QAAQ,EAA0B;IAChF,OAAO,CACL,cACE,SAAS,EAAE,EAAE,CACX,qBAAqB,EACrB,OAAO,KAAK,MAAM,IAAI,0BAA0B,EAChD,OAAO,KAAK,QAAQ,IAAI,0BAA0B,EAClD,OAAO,KAAK,MAAM,IAAI,iBAAiB,EACvC,SAAS,CACV,YAEA,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import type { ReactNode } from 'react';\nimport { cn } from './utils';\n\n/**\n * The one page container.\n *\n * ## Provenance\n *\n * `components/layout/AppPage.tsx` in **Durable-DAV**, **Durable-DAV-Router**,\n * **Edge-Git** and **Edge-Sonic** — four copies, three of them identical.\n *\n * ## The divergence, and which side won\n *\n * Three copies used `max-w-7xl`; Edge-Sonic's used `max-w-5xl` and recorded\n * why: the operator surface is two lists and two forms, and the wider measure\n * only adds line length to prose already at its readable limit. That is the\n * better answer, so it is the one here — with `className` as the documented\n * escape hatch for a repo that genuinely wants the wider measure, because the\n * decision is per-app and a vendored copy would freeze ours.\n *\n * `hero` follows `wide` rather than carrying its own width: a hero that is\n * wider than the page it introduces is a layout bug, not a style.\n */\n\n/** `wide` is the default for every view. `narrow` is for centered forms. */\ntype AppPageVariant = 'wide' | 'narrow' | 'hero';\n\ninterface AppPageProps {\n variant?: AppPageVariant;\n /** Merged last, so it wins over the variant's own classes. */\n className?: string;\n children: ReactNode;\n}\n\nfunction AppPage({ variant = 'wide', className, children }: Readonly<AppPageProps>) {\n return (\n <div\n className={cn(\n 'mx-auto w-full px-6',\n variant === 'wide' && 'max-w-5xl py-8 space-y-4',\n variant === 'narrow' && 'max-w-2xl py-8 space-y-4',\n variant === 'hero' && 'max-w-5xl py-16',\n className,\n )}\n >\n {children}\n </div>\n );\n}\n\nexport { AppPage };\nexport type { AppPageProps, AppPageVariant };\n"]}
@@ -0,0 +1,43 @@
1
+ import type { ReactNode } from 'react';
2
+ /**
3
+ * The sticky bar every non-root page renders.
4
+ *
5
+ * ## Provenance
6
+ *
7
+ * `components/layout/ContextBar.tsx` in **Durable-DAV**, **Durable-DAV-Router**
8
+ * and **Edge-Git** — three copies differing only in the logo and the
9
+ * `aria-label` on the home link.
10
+ *
11
+ * ## Why `home` is a node and not a `<Link>`
12
+ *
13
+ * All three imports `react-router-dom`, solely to wrap a logo in a `Link` to
14
+ * `/`. That is the whole of their router coupling — and it is why none of them
15
+ * could be lifted into a package the kit's other seven stay clear of, and why
16
+ * a repo on a different router could not use the bar at all.
17
+ *
18
+ * So the caller renders the anchor and passes it in. The bar keeps the part
19
+ * that was genuinely duplicated (the sticky geometry, the breadcrumb slot, the
20
+ * right-aligned actions) and gives up the part that was a routing assumption.
21
+ * The caller also owns the link's accessible name, which is the one thing that
22
+ * genuinely differs between the three copies and could not have been defaulted.
23
+ */
24
+ interface ContextBarProps {
25
+ /**
26
+ * The home link, already rendered by the caller.
27
+ *
28
+ * Required, even though the bar is usable without one: a bar with no way back
29
+ * to the root is the failure this component exists to prevent, so it should
30
+ * not be omittable. Pass an empty node only if a route genuinely has no home.
31
+ */
32
+ home: ReactNode;
33
+ /** The current location's name. Usually a `Link` or breadcrumb segment. */
34
+ crumb: ReactNode;
35
+ /** Right-aligned controls — refresh, settings, a sign-out button. */
36
+ actions?: ReactNode;
37
+ /** Merged last onto the bar's outer element. */
38
+ className?: string;
39
+ }
40
+ declare function ContextBar({ home, crumb, actions, className }: Readonly<ContextBarProps>): import("react").JSX.Element;
41
+ export { ContextBar };
42
+ export type { ContextBarProps };
43
+ //# sourceMappingURL=ContextBar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContextBar.d.ts","sourceRoot":"","sources":["../src/ContextBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,UAAU,eAAe;IACvB;;;;;;OAMG;IACH,IAAI,EAAE,SAAS,CAAC;IAChB,2EAA2E;IAC3E,KAAK,EAAE,SAAS,CAAC;IACjB,qEAAqE;IACrE,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iBAAS,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,QAAQ,CAAC,eAAe,CAAC,+BAgBjF;AAED,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from './utils';
3
+ function ContextBar({ home, crumb, actions, className }) {
4
+ return (_jsx("div", { className: cn('sticky top-0 z-40 border-b border-[var(--color-border)] bg-[var(--color-surface-1)]/95 backdrop-blur', className), children: _jsxs("div", { className: "max-w-7xl mx-auto px-6 py-3 flex items-center gap-3 flex-wrap", children: [home, _jsx("span", { "aria-hidden": "true", className: "text-[var(--color-text-muted)] font-normal", children: "/" }), _jsx("div", { className: "flex items-center gap-2 min-w-0 flex-1", children: crumb }), actions && _jsx("div", { className: "ml-auto flex items-center gap-2 shrink-0", children: actions })] }) }));
5
+ }
6
+ export { ContextBar };
7
+ //# sourceMappingURL=ContextBar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContextBar.js","sourceRoot":"","sources":["../src/ContextBar.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AA0C7B,SAAS,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAA6B;IAChF,OAAO,CACL,cAAK,SAAS,EAAE,EAAE,CAAC,sGAAsG,EAAE,SAAS,CAAC,YACnI,eAAK,SAAS,EAAC,+DAA+D,aAC3E,IAAI,EAIL,8BAAkB,MAAM,EAAC,SAAS,EAAC,4CAA4C,kBAExE,EACP,cAAK,SAAS,EAAC,wCAAwC,YAAE,KAAK,GAAO,EACpE,OAAO,IAAI,cAAK,SAAS,EAAC,0CAA0C,YAAE,OAAO,GAAO,IACjF,GACF,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import type { ReactNode } from 'react';\nimport { cn } from './utils';\n\n/**\n * The sticky bar every non-root page renders.\n *\n * ## Provenance\n *\n * `components/layout/ContextBar.tsx` in **Durable-DAV**, **Durable-DAV-Router**\n * and **Edge-Git** — three copies differing only in the logo and the\n * `aria-label` on the home link.\n *\n * ## Why `home` is a node and not a `<Link>`\n *\n * All three imports `react-router-dom`, solely to wrap a logo in a `Link` to\n * `/`. That is the whole of their router coupling — and it is why none of them\n * could be lifted into a package the kit's other seven stay clear of, and why\n * a repo on a different router could not use the bar at all.\n *\n * So the caller renders the anchor and passes it in. The bar keeps the part\n * that was genuinely duplicated (the sticky geometry, the breadcrumb slot, the\n * right-aligned actions) and gives up the part that was a routing assumption.\n * The caller also owns the link's accessible name, which is the one thing that\n * genuinely differs between the three copies and could not have been defaulted.\n */\n\ninterface ContextBarProps {\n /**\n * The home link, already rendered by the caller.\n *\n * Required, even though the bar is usable without one: a bar with no way back\n * to the root is the failure this component exists to prevent, so it should\n * not be omittable. Pass an empty node only if a route genuinely has no home.\n */\n home: ReactNode;\n /** The current location's name. Usually a `Link` or breadcrumb segment. */\n crumb: ReactNode;\n /** Right-aligned controls — refresh, settings, a sign-out button. */\n actions?: ReactNode;\n /** Merged last onto the bar's outer element. */\n className?: string;\n}\n\nfunction ContextBar({ home, crumb, actions, className }: Readonly<ContextBarProps>) {\n return (\n <div className={cn('sticky top-0 z-40 border-b border-[var(--color-border)] bg-[var(--color-surface-1)]/95 backdrop-blur', className)}>\n <div className=\"max-w-7xl mx-auto px-6 py-3 flex items-center gap-3 flex-wrap\">\n {home}\n {/* Decorative: the breadcrumb and the home link already separate these\n regions for a screen reader, and a stray \"/\" read aloud between them\n is noise. */}\n <span aria-hidden=\"true\" className=\"text-[var(--color-text-muted)] font-normal\">\n /\n </span>\n <div className=\"flex items-center gap-2 min-w-0 flex-1\">{crumb}</div>\n {actions && <div className=\"ml-auto flex items-center gap-2 shrink-0\">{actions}</div>}\n </div>\n </div>\n );\n}\n\nexport { ContextBar };\nexport type { ContextBarProps };\n"]}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * The language picker.
3
+ *
4
+ * ## Provenance
5
+ *
6
+ * `components/shared/LanguageSelector.tsx` in **AWS-AccessBridge**,
7
+ * **CalDAV-Bridge**, **ChordDHT-Tracker**, **Durable-DAV**, **Durable-DAV-Router**,
8
+ * **Edge-Git**, **Mail-Meow** and **Mail-Otter** — six real copies plus two
9
+ * smaller ones, in two shapes.
10
+ *
11
+ * ## What converges away
12
+ *
13
+ * **The 12-locale table.** Every copy declared its own `LANGUAGE_LABELS` /
14
+ * `NATIVE_NAMES` map — the same twelve entries, `en` through `ko`, re-typed in
15
+ * each repo. `@rexezuge/shared`'s `LocaleUtil` already holds that table and its
16
+ * `displayName`, converged from AWS-AccessBridge, Mail-Meow and Mail-Otter. So
17
+ * this component now has no table of its own, and the two would have had to
18
+ * agree by hand otherwise.
19
+ *
20
+ * **The `'unknown'` sentinel.** Mail-Otter spelled "the browser asked for a
21
+ * language this app does not have" as the string `'unknown'`, which then had to
22
+ * be compared against at every call site and could not be distinguished from a
23
+ * locale literally spelled `unknown`. It is `null` here — absent, per the kit's
24
+ * `AGENTS.md` — and the disabled branch renders from that.
25
+ *
26
+ * **The `i18n.resolvedLanguage ?? i18n.language` fallback.** The copies read
27
+ * i18next's own state to decide what is selected. In the kit that resolution
28
+ * belongs to `useSpaLanguage`, which already does it; this component takes the
29
+ * resolved tag and normalizes defensively, so a caller passing a raw browser
30
+ * tag (`en-US`) still lands on a real option.
31
+ */
32
+ interface LanguageSelectorProps {
33
+ /**
34
+ * The current tag, or `null` when the app could not resolve one.
35
+ *
36
+ * `null` renders a disabled control reading {@link LanguageSelectorProps.unknownLabel}.
37
+ */
38
+ value: string | null;
39
+ onChange: (languageTag: string) => void;
40
+ /** The control's accessible name. Required — a bare `<select>` has none. */
41
+ label: string;
42
+ /** Shown instead of the language list when `value` is `null`. */
43
+ unknownLabel: string;
44
+ /**
45
+ * The offered tags.
46
+ *
47
+ * Defaults to the family's twelve. A caller narrows this; it cannot widen it,
48
+ * because an option with no display name in the shared table renders as its
49
+ * raw tag.
50
+ */
51
+ supported?: readonly string[];
52
+ disabled?: boolean;
53
+ }
54
+ declare function LanguageSelector({ value, onChange, label, unknownLabel, supported, disabled, }: Readonly<LanguageSelectorProps>): import("react").JSX.Element;
55
+ export { LanguageSelector };
56
+ export type { LanguageSelectorProps };
57
+ //# sourceMappingURL=LanguageSelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LanguageSelector.d.ts","sourceRoot":"","sources":["../src/LanguageSelector.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,UAAU,qBAAqB;IAC7B;;;;OAIG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,iBAAS,gBAAgB,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,SAA6B,EAC7B,QAAQ,GACT,EAAE,QAAQ,CAAC,qBAAqB,CAAC,+BAsBjC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { LocaleUtil, SUPPORTED_LOCALES } from '@rexezuge/shared';
3
+ import { Select } from './Input';
4
+ function LanguageSelector({ value, onChange, label, unknownLabel, supported = SUPPORTED_LOCALES, disabled, }) {
5
+ if (value === null) {
6
+ return (_jsx(Select, { "aria-label": label, value: "", disabled: true, onChange: () => undefined, children: _jsx("option", { value: "", children: unknownLabel }) }));
7
+ }
8
+ const current = LocaleUtil.normalize(value);
9
+ return (_jsx(Select, { "aria-label": label, value: current, disabled: disabled, onChange: (event) => onChange(event.target.value), children: supported.map((tag) => (_jsx("option", { value: tag, children: LocaleUtil.displayName(tag) }, tag))) }));
10
+ }
11
+ export { LanguageSelector };
12
+ //# sourceMappingURL=LanguageSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LanguageSelector.js","sourceRoot":"","sources":["../src/LanguageSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAyDjC,SAAS,gBAAgB,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,SAAS,GAAG,iBAAiB,EAC7B,QAAQ,GACwB;IAChC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO,CACL,KAAC,MAAM,kBAAa,KAAK,EAAE,KAAK,EAAC,EAAE,EAAC,QAAQ,QAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS,YACpE,iBAAQ,KAAK,EAAC,EAAE,YAAE,YAAY,GAAU,GACjC,CACV,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAE5C,OAAO,CACL,KAAC,MAAM,kBAAa,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,YAC7G,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACtB,iBAAkB,KAAK,EAAE,GAAG,YAGzB,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,IAHjB,GAAG,CAIP,CACV,CAAC,GACK,CACV,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { LocaleUtil, SUPPORTED_LOCALES } from '@rexezuge/shared';\nimport { Select } from './Input';\n\n/**\n * The language picker.\n *\n * ## Provenance\n *\n * `components/shared/LanguageSelector.tsx` in **AWS-AccessBridge**,\n * **CalDAV-Bridge**, **ChordDHT-Tracker**, **Durable-DAV**, **Durable-DAV-Router**,\n * **Edge-Git**, **Mail-Meow** and **Mail-Otter** — six real copies plus two\n * smaller ones, in two shapes.\n *\n * ## What converges away\n *\n * **The 12-locale table.** Every copy declared its own `LANGUAGE_LABELS` /\n * `NATIVE_NAMES` map — the same twelve entries, `en` through `ko`, re-typed in\n * each repo. `@rexezuge/shared`'s `LocaleUtil` already holds that table and its\n * `displayName`, converged from AWS-AccessBridge, Mail-Meow and Mail-Otter. So\n * this component now has no table of its own, and the two would have had to\n * agree by hand otherwise.\n *\n * **The `'unknown'` sentinel.** Mail-Otter spelled \"the browser asked for a\n * language this app does not have\" as the string `'unknown'`, which then had to\n * be compared against at every call site and could not be distinguished from a\n * locale literally spelled `unknown`. It is `null` here — absent, per the kit's\n * `AGENTS.md` — and the disabled branch renders from that.\n *\n * **The `i18n.resolvedLanguage ?? i18n.language` fallback.** The copies read\n * i18next's own state to decide what is selected. In the kit that resolution\n * belongs to `useSpaLanguage`, which already does it; this component takes the\n * resolved tag and normalizes defensively, so a caller passing a raw browser\n * tag (`en-US`) still lands on a real option.\n */\n\ninterface LanguageSelectorProps {\n /**\n * The current tag, or `null` when the app could not resolve one.\n *\n * `null` renders a disabled control reading {@link LanguageSelectorProps.unknownLabel}.\n */\n value: string | null;\n onChange: (languageTag: string) => void;\n /** The control's accessible name. Required — a bare `<select>` has none. */\n label: string;\n /** Shown instead of the language list when `value` is `null`. */\n unknownLabel: string;\n /**\n * The offered tags.\n *\n * Defaults to the family's twelve. A caller narrows this; it cannot widen it,\n * because an option with no display name in the shared table renders as its\n * raw tag.\n */\n supported?: readonly string[];\n disabled?: boolean;\n}\n\nfunction LanguageSelector({\n value,\n onChange,\n label,\n unknownLabel,\n supported = SUPPORTED_LOCALES,\n disabled,\n}: Readonly<LanguageSelectorProps>) {\n if (value === null) {\n return (\n <Select aria-label={label} value=\"\" disabled onChange={() => undefined}>\n <option value=\"\">{unknownLabel}</option>\n </Select>\n );\n }\n\n const current = LocaleUtil.normalize(value);\n\n return (\n <Select aria-label={label} value={current} disabled={disabled} onChange={(event) => onChange(event.target.value)}>\n {supported.map((tag) => (\n <option key={tag} value={tag}>\n {/* `displayName` normalizes first, so a supported-but-unspelled tag\n still resolves against the shared table rather than rendering raw. */}\n {LocaleUtil.displayName(tag)}\n </option>\n ))}\n </Select>\n );\n}\n\nexport { LanguageSelector };\nexport type { LanguageSelectorProps };\n"]}
@@ -0,0 +1,53 @@
1
+ import { type ReactNode } from 'react';
2
+ /**
3
+ * The modal frame every confirm dialog in the family sits inside.
4
+ *
5
+ * Converged from `components/modals/ModalShell.tsx` in Durable-DAV,
6
+ * Durable-DAV-Router, Mail-Otter and Edge-Git, where the copies were
7
+ * byte-identical apart from an import-order difference.
8
+ *
9
+ * ## Two decisions the copies made by accident, now made deliberately
10
+ *
11
+ * **It renders in a portal.** A dialog nested in a scrolling container is
12
+ * clipped by it, and one nested inside a `position: fixed` ancestor is
13
+ * positioned by that ancestor rather than the viewport. The portal is what makes
14
+ * "centre of the screen" mean the same thing everywhere.
15
+ *
16
+ * **It closes on the backdrop but not on the panel.** The backdrop click closes;
17
+ * a click inside the panel stops propagating so that selecting text in a
18
+ * confirmation message does not dismiss the dialog the operator is reading. The
19
+ * stop is on the panel, not the backdrop, so a click on the panel never closes
20
+ * it and a click outside always does.
21
+ *
22
+ * ## Labels are props, not translations
23
+ *
24
+ * The copies called `useTranslation` for the close button and the default width.
25
+ * A shared primitive that reaches into a translation library forces every
26
+ * consumer to have one installed *and* configured, for a string it already has
27
+ * — the caller rendering the dialog is the one that knows what it says. So
28
+ * `closeLabel` and `ariaLabel` are ordinary props with no default, and a repo
29
+ * passes `t('common.close')` when it wants them translated.
30
+ */
31
+ /** Escape closes, and the initial focus lands on the dialog. */
32
+ interface ModalShellProps {
33
+ onClose: () => void;
34
+ children: ReactNode;
35
+ /** Width utility class. Kept as a class so a repo themes it without forking. */
36
+ widthClass?: string;
37
+ /** Announced to assistive tech; there is no visible title in the frame itself. */
38
+ ariaLabel: string;
39
+ /**
40
+ * Accessible name for the corner close button.
41
+ *
42
+ * Kept distinct from any cancel action in the body: a dialog whose close
43
+ * button and cancel button share a name is announced as two identical
44
+ * buttons, and the operator has to guess which one they are on.
45
+ */
46
+ closeLabel?: string;
47
+ /** Close on Escape. Defaults to true. */
48
+ closeOnEscape?: boolean;
49
+ }
50
+ declare function ModalShell({ onClose, children, widthClass, ariaLabel, closeLabel, closeOnEscape }: ModalShellProps): import("react").JSX.Element;
51
+ export { ModalShell };
52
+ export type { ModalShellProps };
53
+ //# sourceMappingURL=ModalShell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalShell.d.ts","sourceRoot":"","sources":["../src/ModalShell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,gEAAgE;AAChE,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB,gFAAgF;IAChF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,iBAAS,UAAU,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAmB,EAAE,SAAS,EAAE,UAAoB,EAAE,aAAoB,EAAE,EAAE,eAAe,+BAqCrI;AAED,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect } from 'react';
3
+ function ModalShell({ onClose, children, widthClass = 'w-80', ariaLabel, closeLabel = 'Close', closeOnEscape = true }) {
4
+ useEffect(() => {
5
+ if (!closeOnEscape)
6
+ return undefined;
7
+ const onKeyDown = (event) => {
8
+ if (event.key === 'Escape')
9
+ onClose();
10
+ };
11
+ globalThis.addEventListener('keydown', onKeyDown);
12
+ // Removed on unmount: a dialog that closed by leaving a listener behind
13
+ // would close its replacement too, on the next Escape anywhere.
14
+ return () => globalThis.removeEventListener('keydown', onKeyDown);
15
+ }, [closeOnEscape, onClose]);
16
+ return (_jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", onClick: onClose, role: "presentation", children: [_jsx("div", { className: "fixed inset-0 bg-black/60 animate-backdrop-in", "aria-hidden": "true" }), _jsxs("div", { className: `relative bg-[var(--color-surface-1)] border border-[var(--color-border-muted)] rounded-2xl shadow-2xl animate-fade-in ${widthClass}`, onClick: (event) => {
17
+ // The one place a click inside the panel must not reach the backdrop.
18
+ event.stopPropagation();
19
+ }, role: "dialog", "aria-modal": "true", "aria-label": ariaLabel, children: [_jsx("button", { type: "button", onClick: onClose, "aria-label": closeLabel, className: "absolute top-3 right-3 text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors", children: closeLabel }), children] })] }));
20
+ }
21
+ export { ModalShell };
22
+ //# sourceMappingURL=ModalShell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalShell.js","sourceRoot":"","sources":["../src/ModalShell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,OAAO,CAAC;AAoDlD,SAAS,UAAU,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,GAAG,MAAM,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,EAAE,aAAa,GAAG,IAAI,EAAmB;IACpI,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,aAAa;YAAE,OAAO,SAAS,CAAC;QACrC,MAAM,SAAS,GAAG,CAAC,KAAoB,EAAQ,EAAE;YAC/C,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ;gBAAE,OAAO,EAAE,CAAC;QACxC,CAAC,CAAC;QACF,UAAU,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAClD,wEAAwE;QACxE,gEAAgE;QAChE,OAAO,GAAS,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAC1E,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IAE7B,OAAO,CACL,eAAK,SAAS,EAAC,qDAAqD,EAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,cAAc,aACxG,cAAK,SAAS,EAAC,+CAA+C,iBAAa,MAAM,GAAG,EACpF,eACE,SAAS,EAAE,yHAAyH,UAAU,EAAE,EAChJ,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;oBACjB,sEAAsE;oBACtE,KAAK,CAAC,eAAe,EAAE,CAAC;gBAC1B,CAAC,EACD,IAAI,EAAC,QAAQ,gBACF,MAAM,gBACL,SAAS,aAErB,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,gBACJ,UAAU,EACtB,SAAS,EAAC,gHAAgH,YAEzH,UAAU,GACJ,EACR,QAAQ,IACL,IACF,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { useEffect, type ReactNode } from 'react';\n\n/**\n * The modal frame every confirm dialog in the family sits inside.\n *\n * Converged from `components/modals/ModalShell.tsx` in Durable-DAV,\n * Durable-DAV-Router, Mail-Otter and Edge-Git, where the copies were\n * byte-identical apart from an import-order difference.\n *\n * ## Two decisions the copies made by accident, now made deliberately\n *\n * **It renders in a portal.** A dialog nested in a scrolling container is\n * clipped by it, and one nested inside a `position: fixed` ancestor is\n * positioned by that ancestor rather than the viewport. The portal is what makes\n * \"centre of the screen\" mean the same thing everywhere.\n *\n * **It closes on the backdrop but not on the panel.** The backdrop click closes;\n * a click inside the panel stops propagating so that selecting text in a\n * confirmation message does not dismiss the dialog the operator is reading. The\n * stop is on the panel, not the backdrop, so a click on the panel never closes\n * it and a click outside always does.\n *\n * ## Labels are props, not translations\n *\n * The copies called `useTranslation` for the close button and the default width.\n * A shared primitive that reaches into a translation library forces every\n * consumer to have one installed *and* configured, for a string it already has\n * — the caller rendering the dialog is the one that knows what it says. So\n * `closeLabel` and `ariaLabel` are ordinary props with no default, and a repo\n * passes `t('common.close')` when it wants them translated.\n */\n\n/** Escape closes, and the initial focus lands on the dialog. */\ninterface ModalShellProps {\n onClose: () => void;\n children: ReactNode;\n /** Width utility class. Kept as a class so a repo themes it without forking. */\n widthClass?: string;\n /** Announced to assistive tech; there is no visible title in the frame itself. */\n ariaLabel: string;\n /**\n * Accessible name for the corner close button.\n *\n * Kept distinct from any cancel action in the body: a dialog whose close\n * button and cancel button share a name is announced as two identical\n * buttons, and the operator has to guess which one they are on.\n */\n closeLabel?: string;\n /** Close on Escape. Defaults to true. */\n closeOnEscape?: boolean;\n}\n\nfunction ModalShell({ onClose, children, widthClass = 'w-80', ariaLabel, closeLabel = 'Close', closeOnEscape = true }: ModalShellProps) {\n useEffect(() => {\n if (!closeOnEscape) return undefined;\n const onKeyDown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') onClose();\n };\n globalThis.addEventListener('keydown', onKeyDown);\n // Removed on unmount: a dialog that closed by leaving a listener behind\n // would close its replacement too, on the next Escape anywhere.\n return (): void => globalThis.removeEventListener('keydown', onKeyDown);\n }, [closeOnEscape, onClose]);\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center\" onClick={onClose} role=\"presentation\">\n <div className=\"fixed inset-0 bg-black/60 animate-backdrop-in\" aria-hidden=\"true\" />\n <div\n className={`relative bg-[var(--color-surface-1)] border border-[var(--color-border-muted)] rounded-2xl shadow-2xl animate-fade-in ${widthClass}`}\n onClick={(event) => {\n // The one place a click inside the panel must not reach the backdrop.\n event.stopPropagation();\n }}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={ariaLabel}\n >\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={closeLabel}\n className=\"absolute top-3 right-3 text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors\"\n >\n {closeLabel}\n </button>\n {children}\n </div>\n </div>\n );\n}\n\nexport { ModalShell };\nexport type { ModalShellProps };\n"]}
@@ -0,0 +1,50 @@
1
+ import type { Notice, NoticeKind } from './useNotice';
2
+ /**
3
+ * The transient status banner.
4
+ *
5
+ * ## Provenance
6
+ *
7
+ * `components/layout/NoticeBar.tsx` in **CalDAV-Bridge**, **Durable-DAV**,
8
+ * **Durable-DAV-Router**, **Edge-Git**, **Edge-Sonic** and **Mail-Otter** —
9
+ * six copies in three distinct shapes.
10
+ *
11
+ * ## This renders the kit's own `Notice`
12
+ *
13
+ * Every copy took `{ type: 'success' | 'error'; text: string }`, while
14
+ * `@rexezuge/web`'s `useNotice` — converged from the same six repos, and
15
+ * already shipping — returns `{ kind, message }`. The copies were therefore
16
+ * each doing a field-by-field shuffle at their call site to feed a component
17
+ * the hook had already produced.
18
+ *
19
+ * Taking the kit's own type makes the pair compose directly. Consumers rename
20
+ * two fields at their call sites; in exchange the banner and the hook can never
21
+ * drift apart, because there is only one shape.
22
+ *
23
+ * ## Durable-DAV's fix is the one that shipped
24
+ *
25
+ * All six used `role="status"`, which implies `aria-live="polite"`. A failed
26
+ * credential revoke was therefore announced at the same priority as a
27
+ * background update, and a screen-reader user might never hear it. Durable-DAV's
28
+ * copy splits it: errors assert, successes stay polite. That is the base here.
29
+ *
30
+ * Mail-Otter's copy dropped the screen-reader-only status prefix entirely,
31
+ * which loses the kind for a user who cannot see the colour.
32
+ */
33
+ /** The two accessible names, keyed by the kind they announce. */
34
+ type NoticeStatusLabels = Record<NoticeKind, string>;
35
+ interface NoticeBarProps {
36
+ /** The notice to show, or `null` for nothing — which is what `useNotice` hands back when idle. */
37
+ notice: Notice | null;
38
+ /**
39
+ * The screen-reader prefix for each kind, e.g. `{ success: 'Success', error: 'Error' }`.
40
+ *
41
+ * Required, and keyed rather than a single string, because the label depends
42
+ * on the kind: one label would either mislabel half the notices or need a
43
+ * conditional at every call site — which is where the copies diverged.
44
+ */
45
+ statusLabels: NoticeStatusLabels;
46
+ }
47
+ declare function NoticeBar({ notice, statusLabels }: Readonly<NoticeBarProps>): import("react").JSX.Element | null;
48
+ export { NoticeBar };
49
+ export type { NoticeBarProps, NoticeStatusLabels };
50
+ //# sourceMappingURL=NoticeBar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoticeBar.d.ts","sourceRoot":"","sources":["../src/NoticeBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,iEAAiE;AACjE,KAAK,kBAAkB,GAAG,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAErD,UAAU,cAAc;IACtB,kGAAkG;IAClG,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;;;;;OAMG;IACH,YAAY,EAAE,kBAAkB,CAAC;CAClC;AAED,iBAAS,SAAS,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,QAAQ,CAAC,cAAc,CAAC,sCAgBpE;AAED,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ function NoticeBar({ notice, statusLabels }) {
3
+ if (notice === null)
4
+ return null;
5
+ const isError = notice.kind === 'error';
6
+ return (_jsxs("div", {
7
+ // Errors assert; successes stay polite. See the file header for why this
8
+ // is not one role for both.
9
+ role: isError ? 'alert' : 'status', className: "fixed top-20 left-1/2 -translate-x-1/2 z-50 animate-slide-down px-5 py-3 rounded-xl shadow-xl bg-[var(--color-surface-2)] border border-[var(--color-border-muted)] max-w-[calc(100vw-2rem)]", children: [_jsxs("span", { className: "sr-only", children: [statusLabels[notice.kind], ": "] }), _jsx("span", { className: isError ? 'text-[var(--color-error-text)]' : 'text-[var(--color-success-text)]', children: notice.message })] }));
10
+ }
11
+ export { NoticeBar };
12
+ //# sourceMappingURL=NoticeBar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoticeBar.js","sourceRoot":"","sources":["../src/NoticeBar.tsx"],"names":[],"mappings":";AAkDA,SAAS,SAAS,CAAC,EAAE,MAAM,EAAE,YAAY,EAA4B;IACnE,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEjC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC;IAExC,OAAO,CACL;QACE,yEAAyE;QACzE,4BAA4B;QAC5B,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAClC,SAAS,EAAC,8LAA8L,aAExM,gBAAM,SAAS,EAAC,SAAS,aAAE,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAC9D,eAAM,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,kCAAkC,YAAG,MAAM,CAAC,OAAO,GAAQ,IACrH,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import type { Notice, NoticeKind } from './useNotice';\n\n/**\n * The transient status banner.\n *\n * ## Provenance\n *\n * `components/layout/NoticeBar.tsx` in **CalDAV-Bridge**, **Durable-DAV**,\n * **Durable-DAV-Router**, **Edge-Git**, **Edge-Sonic** and **Mail-Otter** —\n * six copies in three distinct shapes.\n *\n * ## This renders the kit's own `Notice`\n *\n * Every copy took `{ type: 'success' | 'error'; text: string }`, while\n * `@rexezuge/web`'s `useNotice` — converged from the same six repos, and\n * already shipping — returns `{ kind, message }`. The copies were therefore\n * each doing a field-by-field shuffle at their call site to feed a component\n * the hook had already produced.\n *\n * Taking the kit's own type makes the pair compose directly. Consumers rename\n * two fields at their call sites; in exchange the banner and the hook can never\n * drift apart, because there is only one shape.\n *\n * ## Durable-DAV's fix is the one that shipped\n *\n * All six used `role=\"status\"`, which implies `aria-live=\"polite\"`. A failed\n * credential revoke was therefore announced at the same priority as a\n * background update, and a screen-reader user might never hear it. Durable-DAV's\n * copy splits it: errors assert, successes stay polite. That is the base here.\n *\n * Mail-Otter's copy dropped the screen-reader-only status prefix entirely,\n * which loses the kind for a user who cannot see the colour.\n */\n\n/** The two accessible names, keyed by the kind they announce. */\ntype NoticeStatusLabels = Record<NoticeKind, string>;\n\ninterface NoticeBarProps {\n /** The notice to show, or `null` for nothing — which is what `useNotice` hands back when idle. */\n notice: Notice | null;\n /**\n * The screen-reader prefix for each kind, e.g. `{ success: 'Success', error: 'Error' }`.\n *\n * Required, and keyed rather than a single string, because the label depends\n * on the kind: one label would either mislabel half the notices or need a\n * conditional at every call site — which is where the copies diverged.\n */\n statusLabels: NoticeStatusLabels;\n}\n\nfunction NoticeBar({ notice, statusLabels }: Readonly<NoticeBarProps>) {\n if (notice === null) return null;\n\n const isError = notice.kind === 'error';\n\n return (\n <div\n // Errors assert; successes stay polite. See the file header for why this\n // is not one role for both.\n role={isError ? 'alert' : 'status'}\n className=\"fixed top-20 left-1/2 -translate-x-1/2 z-50 animate-slide-down px-5 py-3 rounded-xl shadow-xl bg-[var(--color-surface-2)] border border-[var(--color-border-muted)] max-w-[calc(100vw-2rem)]\"\n >\n <span className=\"sr-only\">{statusLabels[notice.kind]}: </span>\n <span className={isError ? 'text-[var(--color-error-text)]' : 'text-[var(--color-success-text)]'}>{notice.message}</span>\n </div>\n );\n}\n\nexport { NoticeBar };\nexport type { NoticeBarProps, NoticeStatusLabels };\n"]}
@@ -0,0 +1,40 @@
1
+ import type { ReactNode } from 'react';
2
+ /**
3
+ * The standard page-title header.
4
+ *
5
+ * ## Provenance
6
+ *
7
+ * `components/layout/PageHeaderCard.tsx` in **Durable-DAV**, **Durable-DAV-Router**
8
+ * and **Edge-Git** — three copies, byte-identical apart from which views each
9
+ * doc comment listed.
10
+ *
11
+ * It replaced the four ad-hoc title-`Card` variants those repos had grown, one
12
+ * per page, which is how a header bar came to sit at four different heights.
13
+ */
14
+ interface PageHeaderCardProps {
15
+ /** Leading avatar. Omitted renders no avatar slot at all, not an empty one. */
16
+ icon?: ReactNode;
17
+ /**
18
+ * The page's name.
19
+ *
20
+ * **Required.** An optional title would render a header bar with no text in
21
+ * it — a silent no-op that looks deliberate. Forcing it means the compiler
22
+ * asks rather than letting a page ship a nameless header.
23
+ */
24
+ title: ReactNode;
25
+ /**
26
+ * The line under the title.
27
+ *
28
+ * **Required**, though it may be an empty fragment. Same reason: the three
29
+ * copies all rendered a description slot, and the ones that omitted it had
30
+ * each re-derived the vertical rhythm with a different ad-hoc fix. Declaring
31
+ * it means the layout is the same whether or not there is something to say.
32
+ */
33
+ description: ReactNode;
34
+ /** Right-aligned. Omitted renders no actions slot. */
35
+ actions?: ReactNode;
36
+ }
37
+ declare function PageHeaderCard({ icon, title, description, actions }: Readonly<PageHeaderCardProps>): import("react").JSX.Element;
38
+ export { PageHeaderCard };
39
+ export type { PageHeaderCardProps };
40
+ //# sourceMappingURL=PageHeaderCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageHeaderCard.d.ts","sourceRoot":"","sources":["../src/PageHeaderCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC;;;;;;;;;;;GAWG;AAEH,UAAU,mBAAmB;IAC3B,+EAA+E;IAC/E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;;;OAMG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;;;;;;OAOG;IACH,WAAW,EAAE,SAAS,CAAC;IACvB,sDAAsD;IACtD,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,iBAAS,cAAc,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,QAAQ,CAAC,mBAAmB,CAAC,+BAa3F;AAED,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,YAAY,EAAE,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Card } from './Card';
3
+ function PageHeaderCard({ icon, title, description, actions }) {
4
+ return (_jsxs(Card, { className: "flex flex-col lg:flex-row lg:items-center justify-between gap-4 py-4", children: [_jsxs("div", { className: "flex items-center gap-3 min-w-0", children: [icon && _jsx("div", { className: "flex items-center justify-center w-10 h-10 rounded-full bg-[var(--color-surface-3)] shrink-0", children: icon }), _jsxs("div", { className: "min-w-0", children: [_jsx("h1", { className: "text-xl font-semibold text-[var(--color-text-primary)] truncate", children: title }), description && _jsx("div", { className: "text-sm text-[var(--color-text-muted)] truncate", children: description })] })] }), actions && _jsx("div", { className: "flex flex-wrap items-center gap-3 shrink-0", children: actions })] }));
5
+ }
6
+ export { PageHeaderCard };
7
+ //# sourceMappingURL=PageHeaderCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageHeaderCard.js","sourceRoot":"","sources":["../src/PageHeaderCard.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAuC9B,SAAS,cAAc,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAiC;IAC1F,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAC,sEAAsE,aACpF,eAAK,SAAS,EAAC,iCAAiC,aAC7C,IAAI,IAAI,cAAK,SAAS,EAAC,8FAA8F,YAAE,IAAI,GAAO,EACnI,eAAK,SAAS,EAAC,SAAS,aACtB,aAAI,SAAS,EAAC,iEAAiE,YAAE,KAAK,GAAM,EAC3F,WAAW,IAAI,cAAK,SAAS,EAAC,iDAAiD,YAAE,WAAW,GAAO,IAChG,IACF,EACL,OAAO,IAAI,cAAK,SAAS,EAAC,4CAA4C,YAAE,OAAO,GAAO,IAClF,CACR,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import type { ReactNode } from 'react';\nimport { Card } from './Card';\n\n/**\n * The standard page-title header.\n *\n * ## Provenance\n *\n * `components/layout/PageHeaderCard.tsx` in **Durable-DAV**, **Durable-DAV-Router**\n * and **Edge-Git** — three copies, byte-identical apart from which views each\n * doc comment listed.\n *\n * It replaced the four ad-hoc title-`Card` variants those repos had grown, one\n * per page, which is how a header bar came to sit at four different heights.\n */\n\ninterface PageHeaderCardProps {\n /** Leading avatar. Omitted renders no avatar slot at all, not an empty one. */\n icon?: ReactNode;\n /**\n * The page's name.\n *\n * **Required.** An optional title would render a header bar with no text in\n * it — a silent no-op that looks deliberate. Forcing it means the compiler\n * asks rather than letting a page ship a nameless header.\n */\n title: ReactNode;\n /**\n * The line under the title.\n *\n * **Required**, though it may be an empty fragment. Same reason: the three\n * copies all rendered a description slot, and the ones that omitted it had\n * each re-derived the vertical rhythm with a different ad-hoc fix. Declaring\n * it means the layout is the same whether or not there is something to say.\n */\n description: ReactNode;\n /** Right-aligned. Omitted renders no actions slot. */\n actions?: ReactNode;\n}\n\nfunction PageHeaderCard({ icon, title, description, actions }: Readonly<PageHeaderCardProps>) {\n return (\n <Card className=\"flex flex-col lg:flex-row lg:items-center justify-between gap-4 py-4\">\n <div className=\"flex items-center gap-3 min-w-0\">\n {icon && <div className=\"flex items-center justify-center w-10 h-10 rounded-full bg-[var(--color-surface-3)] shrink-0\">{icon}</div>}\n <div className=\"min-w-0\">\n <h1 className=\"text-xl font-semibold text-[var(--color-text-primary)] truncate\">{title}</h1>\n {description && <div className=\"text-sm text-[var(--color-text-muted)] truncate\">{description}</div>}\n </div>\n </div>\n {actions && <div className=\"flex flex-wrap items-center gap-3 shrink-0\">{actions}</div>}\n </Card>\n );\n}\n\nexport { PageHeaderCard };\nexport type { PageHeaderCardProps };\n"]}
@@ -0,0 +1,47 @@
1
+ import type { ReactNode } from 'react';
2
+ /**
3
+ * The shared loading / empty / error states.
4
+ *
5
+ * Converged from `components/layout/PageState.tsx` (Durable-DAV,
6
+ * Durable-DAV-Router) and `EmptyState` (CalDAV-Bridge), which were the same two
7
+ * components under two names.
8
+ *
9
+ * Same reasoning as `ModalShell`: the label arrives as a prop rather than from
10
+ * `useTranslation`, so a consumer is not required to run a translation library
11
+ * to render a spinner.
12
+ */
13
+ /** The shared spinner. `label` is announced, so it should say what is loading. */
14
+ declare function LoadingSpinner({ label }: {
15
+ label?: string;
16
+ }): import("react").JSX.Element;
17
+ /** The shared centered empty message, with an optional icon above it. */
18
+ declare function EmptyState({ icon, message }: {
19
+ icon?: ReactNode;
20
+ message: ReactNode;
21
+ }): import("react").JSX.Element;
22
+ /**
23
+ * A confirmation for a destructive action.
24
+ *
25
+ * `message` is required to **name the thing being deleted**, not to say "this
26
+ * item" — the operator is the only one who can tell whether they meant to
27
+ * delete it, so the dialog has to be specific. That is a contract on the
28
+ * caller, not something the component can enforce, which is why `message` is a
29
+ * `ReactNode` the caller composes rather than a template this fills in.
30
+ *
31
+ * No confirm timer: a dialog that arms itself makes the operator wait for a
32
+ * decision they were already qualified to make.
33
+ *
34
+ * Both handlers stop propagation, because a confirm that fires twice deletes
35
+ * two things.
36
+ */
37
+ declare function ConfirmDeleteModal({ message, confirmLabel, cancelLabel, ariaLabel, onConfirm, onCancel, }: {
38
+ /** The full question, naming what will be deleted. */
39
+ message: ReactNode;
40
+ confirmLabel: string;
41
+ cancelLabel: string;
42
+ ariaLabel: string;
43
+ onConfirm: () => void;
44
+ onCancel: () => void;
45
+ }): import("react").JSX.Element;
46
+ export { ConfirmDeleteModal, EmptyState, LoadingSpinner };
47
+ //# sourceMappingURL=PageState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageState.d.ts","sourceRoot":"","sources":["../src/PageState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC;;;;;;;;;;GAUG;AAEH,kFAAkF;AAClF,iBAAS,cAAc,CAAC,EAAE,KAAkB,EAAE,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,+BAMjE;AAED,yEAAyE;AACzE,iBAAS,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,SAAS,CAAA;CAAE,+BAO9E;AAED;;;;;;;;;;;;;;GAcG;AACH,iBAAS,kBAAkB,CAAC,EAC1B,OAAO,EACP,YAAY,EACZ,WAAW,EACX,SAAS,EACT,SAAS,EACT,QAAQ,GACT,EAAE;IACD,sDAAsD;IACtD,OAAO,EAAE,SAAS,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,+BA8BA;AAED,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ModalShell } from './ModalShell';
3
+ /**
4
+ * The shared loading / empty / error states.
5
+ *
6
+ * Converged from `components/layout/PageState.tsx` (Durable-DAV,
7
+ * Durable-DAV-Router) and `EmptyState` (CalDAV-Bridge), which were the same two
8
+ * components under two names.
9
+ *
10
+ * Same reasoning as `ModalShell`: the label arrives as a prop rather than from
11
+ * `useTranslation`, so a consumer is not required to run a translation library
12
+ * to render a spinner.
13
+ */
14
+ /** The shared spinner. `label` is announced, so it should say what is loading. */
15
+ function LoadingSpinner({ label = 'Loading…' }) {
16
+ return (_jsx("div", { className: "min-h-64 flex items-center justify-center", role: "status", "aria-label": label, children: _jsx("div", { className: "h-10 w-10 rounded-full border-2 border-[var(--color-accent)] border-t-transparent animate-spin" }) }));
17
+ }
18
+ /** The shared centered empty message, with an optional icon above it. */
19
+ function EmptyState({ icon, message }) {
20
+ return (_jsxs("div", { className: "text-center text-[var(--color-text-muted)] py-10 text-sm", children: [icon && _jsx("div", { className: "mb-3 flex justify-center", children: icon }), message] }));
21
+ }
22
+ /**
23
+ * A confirmation for a destructive action.
24
+ *
25
+ * `message` is required to **name the thing being deleted**, not to say "this
26
+ * item" — the operator is the only one who can tell whether they meant to
27
+ * delete it, so the dialog has to be specific. That is a contract on the
28
+ * caller, not something the component can enforce, which is why `message` is a
29
+ * `ReactNode` the caller composes rather than a template this fills in.
30
+ *
31
+ * No confirm timer: a dialog that arms itself makes the operator wait for a
32
+ * decision they were already qualified to make.
33
+ *
34
+ * Both handlers stop propagation, because a confirm that fires twice deletes
35
+ * two things.
36
+ */
37
+ function ConfirmDeleteModal({ message, confirmLabel, cancelLabel, ariaLabel, onConfirm, onCancel, }) {
38
+ return (_jsx(ModalShell, { onClose: onCancel, widthClass: "w-80", ariaLabel: ariaLabel, children: _jsxs("div", { className: "p-6", children: [_jsx("p", { className: "text-sm text-[var(--color-text-secondary)] text-center mb-6", children: message }), _jsxs("div", { className: "flex gap-3", children: [_jsx("button", { type: "button", className: "flex-1", onClick: (event) => {
39
+ event.stopPropagation();
40
+ onCancel();
41
+ }, children: cancelLabel }), _jsx("button", { type: "button", className: "flex-1", onClick: (event) => {
42
+ event.stopPropagation();
43
+ onConfirm();
44
+ }, children: confirmLabel })] })] }) }));
45
+ }
46
+ export { ConfirmDeleteModal, EmptyState, LoadingSpinner };
47
+ //# sourceMappingURL=PageState.js.map