@rexezuge/web 1.1.0 → 1.3.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 (71) 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/Badge.js +1 -1
  7. package/dist/Badge.js.map +1 -1
  8. package/dist/Button.js +2 -2
  9. package/dist/Button.js.map +1 -1
  10. package/dist/Card.js +1 -1
  11. package/dist/Card.js.map +1 -1
  12. package/dist/ContextBar.d.ts +43 -0
  13. package/dist/ContextBar.d.ts.map +1 -0
  14. package/dist/ContextBar.js +7 -0
  15. package/dist/ContextBar.js.map +1 -0
  16. package/dist/FocusInput.js +2 -2
  17. package/dist/FocusInput.js.map +1 -1
  18. package/dist/Input.js +1 -1
  19. package/dist/Input.js.map +1 -1
  20. package/dist/LanguageSelector.d.ts +57 -0
  21. package/dist/LanguageSelector.d.ts.map +1 -0
  22. package/dist/LanguageSelector.js +12 -0
  23. package/dist/LanguageSelector.js.map +1 -0
  24. package/dist/LoadingButton.d.ts +1 -1
  25. package/dist/LoadingButton.d.ts.map +1 -1
  26. package/dist/LoadingButton.js +1 -1
  27. package/dist/LoadingButton.js.map +1 -1
  28. package/dist/NoticeBar.d.ts +50 -0
  29. package/dist/NoticeBar.d.ts.map +1 -0
  30. package/dist/NoticeBar.js +12 -0
  31. package/dist/NoticeBar.js.map +1 -0
  32. package/dist/PageHeaderCard.d.ts +40 -0
  33. package/dist/PageHeaderCard.d.ts.map +1 -0
  34. package/dist/PageHeaderCard.js +7 -0
  35. package/dist/PageHeaderCard.js.map +1 -0
  36. package/dist/PageState.js +1 -1
  37. package/dist/PageState.js.map +1 -1
  38. package/dist/Pagination.js +2 -2
  39. package/dist/Pagination.js.map +1 -1
  40. package/dist/ReadOnlyField.d.ts +49 -0
  41. package/dist/ReadOnlyField.d.ts.map +1 -0
  42. package/dist/ReadOnlyField.js +17 -0
  43. package/dist/ReadOnlyField.js.map +1 -0
  44. package/dist/RefreshButton.d.ts +36 -0
  45. package/dist/RefreshButton.d.ts.map +1 -0
  46. package/dist/RefreshButton.js +8 -0
  47. package/dist/RefreshButton.js.map +1 -0
  48. package/dist/Spinner.js +1 -1
  49. package/dist/Spinner.js.map +1 -1
  50. package/dist/TypeToConfirmModal.d.ts +47 -0
  51. package/dist/TypeToConfirmModal.d.ts.map +1 -0
  52. package/dist/TypeToConfirmModal.js +24 -0
  53. package/dist/TypeToConfirmModal.js.map +1 -0
  54. package/dist/Unauthorized.d.ts +45 -0
  55. package/dist/Unauthorized.d.ts.map +1 -0
  56. package/dist/Unauthorized.js +11 -0
  57. package/dist/Unauthorized.js.map +1 -0
  58. package/dist/index.d.ts +72 -32
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +52 -18
  61. package/dist/index.js.map +1 -1
  62. package/dist/useCopyToClipboard.d.ts +54 -0
  63. package/dist/useCopyToClipboard.d.ts.map +1 -0
  64. package/dist/useCopyToClipboard.js +40 -0
  65. package/dist/useCopyToClipboard.js.map +1 -0
  66. package/dist/useCurrentUser.d.ts +1 -1
  67. package/dist/useCurrentUser.d.ts.map +1 -1
  68. package/dist/useCurrentUser.js.map +1 -1
  69. package/dist/useNotice.js +1 -1
  70. package/dist/useNotice.js.map +1 -1
  71. 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.js";
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,YAAY,CAAC;AAiChC,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.ts';\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"]}
package/dist/Badge.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cn } from './utils';
2
+ import { cn } from "./utils.js";
3
3
  /** Layout and type scale, shared by every variant. */
4
4
  const badgeBaseClass = 'inline-flex shrink-0 items-center rounded-md px-2 py-0.5 text-xs font-medium';
5
5
  /** The tone palette. `neutral` is the default: an unknown verdict is not a failure. */
package/dist/Badge.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.js","sourceRoot":"","sources":["../src/Badge.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AA2B7B,sDAAsD;AACtD,MAAM,cAAc,GAAG,8EAA8E,CAAC;AAEtG,uFAAuF;AACvF,MAAM,iBAAiB,GAAiC;IACtD,OAAO,EAAE,+DAA+D;IACxE,OAAO,EAAE,+DAA+D;IACxE,OAAO,EAAE,+DAA+D;IACxE,KAAK,EAAE,2DAA2D;IAClE,IAAI,EAAE,yDAAyD;CAChE,CAAC;AAOF,SAAS,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,GAAG,SAAS,EAAE,GAAG,IAAI,EAAwB;IAC9E,OAAO,eAAM,SAAS,EAAE,EAAE,CAAC,cAAc,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,KAAM,IAAI,GAAI,CAAC;AAClG,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU,CAAC,UAAwB,SAAS,EAAE,SAAkB;IACvE,OAAO,EAAE,CAAC,cAAc,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC;AACnE,CAAC;AAED,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import type { HTMLAttributes, ReactElement } from 'react';\nimport { cn } from './utils';\n\n/**\n * A status pill.\n *\n * ## Provenance\n *\n * `components/ui/Badge.tsx` in **CalDAV-Bridge**, **Durable-DAV**,\n * **Durable-DAV-Router**, **Edge-Git**, **Edge-Sonic** and **Mail-Otter** — six\n * copies that agree on the base classes, the five variants, and the `neutral`\n * default. Edge-Sonic's is the best of them (its props spread onto the DOM\n * element, so a badge can carry `id`/`role`/`data-*`), so it is the shape here.\n *\n * The variants are *tones*, not statuses: every repo additionally carries a\n * stack of domain badges (`ConnectionBadge`, `VisibilityBadge`,\n * `TaskRunStatusBadge`, …) that map its own status vocabulary onto a tone and\n * translate a label with `t()`. Those are product vocabularies with\n * product-specific translation keys, so they stay with their apps — the kit\n * ships the tone layer and `badgeClass()` so a consumer's own\n * `variantFor(status)` maps onto it without re-deriving the classes.\n *\n * Requires the CSS variables `--color-{success,error,warning,info,neutral}-{bg,text}`,\n * which all six consuming apps already define.\n */\n\ntype BadgeVariant = 'success' | 'error' | 'warning' | 'info' | 'neutral';\n\n/** Layout and type scale, shared by every variant. */\nconst badgeBaseClass = 'inline-flex shrink-0 items-center rounded-md px-2 py-0.5 text-xs font-medium';\n\n/** The tone palette. `neutral` is the default: an unknown verdict is not a failure. */\nconst badgeVariantClass: Record<BadgeVariant, string> = {\n neutral: 'bg-[var(--color-neutral-bg)] text-[var(--color-neutral-text)]',\n success: 'bg-[var(--color-success-bg)] text-[var(--color-success-text)]',\n warning: 'bg-[var(--color-warning-bg)] text-[var(--color-warning-text)]',\n error: 'bg-[var(--color-error-bg)] text-[var(--color-error-text)]',\n info: 'bg-[var(--color-info-bg)] text-[var(--color-info-text)]',\n};\n\ninterface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n /** Tone; defaults to `neutral`. */\n variant?: BadgeVariant;\n}\n\nfunction Badge({ className, variant = 'neutral', ...rest }: Readonly<BadgeProps>): ReactElement {\n return <span className={cn(badgeBaseClass, badgeVariantClass[variant], className)} {...rest} />;\n}\n\n/**\n * The class string for a badge, for callers building the element themselves —\n * a `<button>` that looks like a badge, or a domain badge wrapper that adds\n * `t()`-translated children.\n */\nfunction badgeClass(variant: BadgeVariant = 'neutral', className?: string): string {\n return cn(badgeBaseClass, badgeVariantClass[variant], className);\n}\n\nexport { Badge, badgeBaseClass, badgeClass, badgeVariantClass };\nexport type { BadgeProps, BadgeVariant };\n"]}
1
+ {"version":3,"file":"Badge.js","sourceRoot":"","sources":["../src/Badge.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AA2BhC,sDAAsD;AACtD,MAAM,cAAc,GAAG,8EAA8E,CAAC;AAEtG,uFAAuF;AACvF,MAAM,iBAAiB,GAAiC;IACtD,OAAO,EAAE,+DAA+D;IACxE,OAAO,EAAE,+DAA+D;IACxE,OAAO,EAAE,+DAA+D;IACxE,KAAK,EAAE,2DAA2D;IAClE,IAAI,EAAE,yDAAyD;CAChE,CAAC;AAOF,SAAS,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,GAAG,SAAS,EAAE,GAAG,IAAI,EAAwB;IAC9E,OAAO,eAAM,SAAS,EAAE,EAAE,CAAC,cAAc,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,KAAM,IAAI,GAAI,CAAC;AAClG,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU,CAAC,UAAwB,SAAS,EAAE,SAAkB;IACvE,OAAO,EAAE,CAAC,cAAc,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC;AACnE,CAAC;AAED,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import type { HTMLAttributes, ReactElement } from 'react';\nimport { cn } from './utils.ts';\n\n/**\n * A status pill.\n *\n * ## Provenance\n *\n * `components/ui/Badge.tsx` in **CalDAV-Bridge**, **Durable-DAV**,\n * **Durable-DAV-Router**, **Edge-Git**, **Edge-Sonic** and **Mail-Otter** — six\n * copies that agree on the base classes, the five variants, and the `neutral`\n * default. Edge-Sonic's is the best of them (its props spread onto the DOM\n * element, so a badge can carry `id`/`role`/`data-*`), so it is the shape here.\n *\n * The variants are *tones*, not statuses: every repo additionally carries a\n * stack of domain badges (`ConnectionBadge`, `VisibilityBadge`,\n * `TaskRunStatusBadge`, …) that map its own status vocabulary onto a tone and\n * translate a label with `t()`. Those are product vocabularies with\n * product-specific translation keys, so they stay with their apps — the kit\n * ships the tone layer and `badgeClass()` so a consumer's own\n * `variantFor(status)` maps onto it without re-deriving the classes.\n *\n * Requires the CSS variables `--color-{success,error,warning,info,neutral}-{bg,text}`,\n * which all six consuming apps already define.\n */\n\ntype BadgeVariant = 'success' | 'error' | 'warning' | 'info' | 'neutral';\n\n/** Layout and type scale, shared by every variant. */\nconst badgeBaseClass = 'inline-flex shrink-0 items-center rounded-md px-2 py-0.5 text-xs font-medium';\n\n/** The tone palette. `neutral` is the default: an unknown verdict is not a failure. */\nconst badgeVariantClass: Record<BadgeVariant, string> = {\n neutral: 'bg-[var(--color-neutral-bg)] text-[var(--color-neutral-text)]',\n success: 'bg-[var(--color-success-bg)] text-[var(--color-success-text)]',\n warning: 'bg-[var(--color-warning-bg)] text-[var(--color-warning-text)]',\n error: 'bg-[var(--color-error-bg)] text-[var(--color-error-text)]',\n info: 'bg-[var(--color-info-bg)] text-[var(--color-info-text)]',\n};\n\ninterface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n /** Tone; defaults to `neutral`. */\n variant?: BadgeVariant;\n}\n\nfunction Badge({ className, variant = 'neutral', ...rest }: Readonly<BadgeProps>): ReactElement {\n return <span className={cn(badgeBaseClass, badgeVariantClass[variant], className)} {...rest} />;\n}\n\n/**\n * The class string for a badge, for callers building the element themselves —\n * a `<button>` that looks like a badge, or a domain badge wrapper that adds\n * `t()`-translated children.\n */\nfunction badgeClass(variant: BadgeVariant = 'neutral', className?: string): string {\n return cn(badgeBaseClass, badgeVariantClass[variant], className);\n}\n\nexport { Badge, badgeBaseClass, badgeClass, badgeVariantClass };\nexport type { BadgeProps, BadgeVariant };\n"]}
package/dist/Button.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { cn } from './utils';
3
- import { Spinner } from './Spinner';
2
+ import { cn } from "./utils.js";
3
+ import { Spinner } from "./Spinner.js";
4
4
  /**
5
5
  * Layout and focus affordance. The focus ring is on `focus-visible`, so a
6
6
  * pointer press does not paint it and a keyboard press always does.
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyCpC;;;GAGG;AACH,MAAM,eAAe,GACnB,uPAAuP,CAAC;AAE1P,MAAM,kBAAkB,GAAkC;IACxD,OAAO,EAAE,4EAA4E;IACrF,SAAS,EAAE,gGAAgG;IAC3G,KAAK,EAAE,4HAA4H;IACnI,MAAM,EAAE,gFAAgF;CACzF,CAAC;AAEF,MAAM,eAAe,GAA+B;IAClD,EAAE,EAAE,qBAAqB;IACzB,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,uBAAuB;CAC5B,CAAC;AAeF,SAAS,MAAM,CAAC,EACd,SAAS,EACT,OAAO,GAAG,WAAW,EACrB,IAAI,GAAG,IAAI,EACX,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,OAAO,EACP,IAAI,GAAG,QAAQ,EACf,GAAG,IAAI,EACe;IACtB,MAAM,WAAW,GAAG,CAAC,KAAoC,EAAQ,EAAE;QACjE,yEAAyE;QACzE,2EAA2E;QAC3E,IAAI,QAAQ,IAAI,OAAO,EAAE,CAAC;YACxB,OAAO;QACT,CAAC;QACD,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO,CACL,kBACE,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,kBAAkB,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,EAC7F,QAAQ,EAAE,QAAQ,IAAI,OAAO,eAClB,OAAO,IAAI,SAAS,EAC/B,OAAO,EAAE,WAAW,KAChB,IAAI,aAEP,OAAO,CAAC,CAAC,CAAC,KAAC,OAAO,IAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAC,cAAc,EAAC,OAAO,EAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,EACvE,QAAQ,IACF,CACV,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,WAAW,CAClB,EAAE,OAAO,GAAG,WAAW,EAAE,IAAI,GAAG,IAAI,KAAqD,EAAE,EAC3F,SAAkB;IAElB,OAAO,EAAE,CAAC,eAAe,EAAE,kBAAkB,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;AAC5F,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import type { ButtonHTMLAttributes, MouseEvent, ReactElement } from 'react';\nimport { cn } from './utils';\nimport { Spinner } from './Spinner';\n\n/**\n * The one button.\n *\n * ## Provenance\n *\n * `components/ui/Button.tsx` in **CalDAV-Bridge**, **Durable-DAV**,\n * **Durable-DAV-Router**, **Edge-Git**, **Edge-Sonic** and **Mail-Otter** — six\n * copies written from one design, agreeing on the base classes, the four\n * variants (`primary`/`secondary`/`ghost`/`danger`) and the three sizes. The\n * differences that had to be settled:\n *\n * - **Default variant.** CalDAV-Bridge defaults to `primary`; the other five\n * default to `secondary`. The majority wins: a page of solid-coloured\n * buttons is noise, and `primary` should mark the one action that matters.\n * - **`type`.** Durable-DAV and Edge-Sonic default it to `button`; the others\n * leave the HTML default (`submit`) in place, so a `<Button>` inside a\n * `<form>` submits it. The explicit default is kept — it is the documented\n * fix, and a consumer that wants a submit button passes `type=\"submit\"`.\n * - **`ghost` hover.** Four repos hover to `--color-surface-3` with\n * `--color-text-secondary`; Edge-Sonic uses `surface-2`/`text-muted`. The\n * majority wins.\n * - **`danger` hover.** Four repos use `hover:brightness-125`; Edge-Sonic uses\n * `hover:opacity-90`. The majority wins.\n *\n * ## Loading\n *\n * Converged from **AWS-AccessBridge**'s `components/ui/LoadingButton.tsx`, the\n * one place the family tracked busy state itself. Its two behaviours fold\n * cleanly into this component's `loading` prop: the button is `disabled` while\n * loading (so neither a pointer, a keyboard, nor a screen reader can activate\n * it), *and* the click handler bails out, so a synthesized `click()` — which\n * jsdom and some test harnesses dispatch without honouring `disabled` — cannot\n * fire a second submission. The ring is this package's `Spinner`, which\n * inherits the button's text colour.\n */\n\ntype ButtonVariant = 'primary' | 'secondary' | 'danger' | 'ghost';\ntype ButtonSize = 'sm' | 'md' | 'lg';\n\n/**\n * Layout and focus affordance. The focus ring is on `focus-visible`, so a\n * pointer press does not paint it and a keyboard press always does.\n */\nconst buttonBaseClass =\n 'inline-flex items-center justify-center gap-2 rounded-lg text-sm font-medium transition-colors duration-150 disabled:opacity-50 disabled:pointer-events-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)]';\n\nconst buttonVariantClass: Record<ButtonVariant, string> = {\n primary: 'bg-[var(--color-accent)] text-[#0d1008] hover:bg-[var(--color-accent-dim)]',\n secondary: 'bg-[var(--color-surface-3)] text-[var(--color-text-primary)] hover:bg-[var(--color-surface-4)]',\n ghost: 'bg-transparent text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-3)] hover:text-[var(--color-text-primary)]',\n danger: 'bg-[var(--color-error-bg)] text-[var(--color-error-text)] hover:brightness-125',\n};\n\nconst buttonSizeClass: Record<ButtonSize, string> = {\n sm: 'px-3 py-1.5 text-xs',\n md: 'px-4 py-2',\n lg: 'px-5 py-2.5 text-base',\n};\n\ninterface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** Visual weight; defaults to `secondary`. */\n variant?: ButtonVariant;\n /** Control size; defaults to `md`. */\n size?: ButtonSize;\n /**\n * Shows the spinner and blocks activation until it clears. A busy button is\n * a disabled button: the prop alone is enough, no `disabled` bookkeeping at\n * the call site.\n */\n loading?: boolean;\n}\n\nfunction Button({\n className,\n variant = 'secondary',\n size = 'md',\n loading = false,\n disabled = false,\n children,\n onClick,\n type = 'button',\n ...rest\n}: Readonly<ButtonProps>): ReactElement {\n const handleClick = (event: MouseEvent<HTMLButtonElement>): void => {\n // Belt and braces: `disabled` already stops a real pointer or key press,\n // and this stops a synthesized event from re-entering an in-flight action.\n if (disabled || loading) {\n return;\n }\n onClick?.(event);\n };\n\n return (\n <button\n type={type}\n className={cn(buttonBaseClass, buttonVariantClass[variant], buttonSizeClass[size], className)}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n onClick={handleClick}\n {...rest}\n >\n {loading ? <Spinner size={16} color=\"currentColor\" padding=\"0\" /> : null}\n {children}\n </button>\n );\n}\n\n/**\n * The class string for a button, for callers rendering the element themselves —\n * a link styled as a button, or a toolbar control that is not a `<button>`.\n */\nfunction buttonClass(\n { variant = 'secondary', size = 'md' }: { variant?: ButtonVariant; size?: ButtonSize } = {},\n className?: string,\n): string {\n return cn(buttonBaseClass, buttonVariantClass[variant], buttonSizeClass[size], className);\n}\n\nexport { Button, buttonBaseClass, buttonClass, buttonSizeClass, buttonVariantClass };\nexport type { ButtonProps, ButtonSize, ButtonVariant };\n"]}
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAe,CAAC;AAyCxC;;;GAGG;AACH,MAAM,eAAe,GACnB,uPAAuP,CAAC;AAE1P,MAAM,kBAAkB,GAAkC;IACxD,OAAO,EAAE,4EAA4E;IACrF,SAAS,EAAE,gGAAgG;IAC3G,KAAK,EAAE,4HAA4H;IACnI,MAAM,EAAE,gFAAgF;CACzF,CAAC;AAEF,MAAM,eAAe,GAA+B;IAClD,EAAE,EAAE,qBAAqB;IACzB,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,uBAAuB;CAC5B,CAAC;AAeF,SAAS,MAAM,CAAC,EACd,SAAS,EACT,OAAO,GAAG,WAAW,EACrB,IAAI,GAAG,IAAI,EACX,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,OAAO,EACP,IAAI,GAAG,QAAQ,EACf,GAAG,IAAI,EACe;IACtB,MAAM,WAAW,GAAG,CAAC,KAAoC,EAAQ,EAAE;QACjE,yEAAyE;QACzE,2EAA2E;QAC3E,IAAI,QAAQ,IAAI,OAAO,EAAE,CAAC;YACxB,OAAO;QACT,CAAC;QACD,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO,CACL,kBACE,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,kBAAkB,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,EAC7F,QAAQ,EAAE,QAAQ,IAAI,OAAO,eAClB,OAAO,IAAI,SAAS,EAC/B,OAAO,EAAE,WAAW,KAChB,IAAI,aAEP,OAAO,CAAC,CAAC,CAAC,KAAC,OAAO,IAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAC,cAAc,EAAC,OAAO,EAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,EACvE,QAAQ,IACF,CACV,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,WAAW,CAClB,EAAE,OAAO,GAAG,WAAW,EAAE,IAAI,GAAG,IAAI,KAAqD,EAAE,EAC3F,SAAkB;IAElB,OAAO,EAAE,CAAC,eAAe,EAAE,kBAAkB,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;AAC5F,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import type { ButtonHTMLAttributes, MouseEvent, ReactElement } from 'react';\nimport { cn } from './utils.ts';\nimport { Spinner } from './Spinner.tsx';\n\n/**\n * The one button.\n *\n * ## Provenance\n *\n * `components/ui/Button.tsx` in **CalDAV-Bridge**, **Durable-DAV**,\n * **Durable-DAV-Router**, **Edge-Git**, **Edge-Sonic** and **Mail-Otter** — six\n * copies written from one design, agreeing on the base classes, the four\n * variants (`primary`/`secondary`/`ghost`/`danger`) and the three sizes. The\n * differences that had to be settled:\n *\n * - **Default variant.** CalDAV-Bridge defaults to `primary`; the other five\n * default to `secondary`. The majority wins: a page of solid-coloured\n * buttons is noise, and `primary` should mark the one action that matters.\n * - **`type`.** Durable-DAV and Edge-Sonic default it to `button`; the others\n * leave the HTML default (`submit`) in place, so a `<Button>` inside a\n * `<form>` submits it. The explicit default is kept — it is the documented\n * fix, and a consumer that wants a submit button passes `type=\"submit\"`.\n * - **`ghost` hover.** Four repos hover to `--color-surface-3` with\n * `--color-text-secondary`; Edge-Sonic uses `surface-2`/`text-muted`. The\n * majority wins.\n * - **`danger` hover.** Four repos use `hover:brightness-125`; Edge-Sonic uses\n * `hover:opacity-90`. The majority wins.\n *\n * ## Loading\n *\n * Converged from **AWS-AccessBridge**'s `components/ui/LoadingButton.tsx`, the\n * one place the family tracked busy state itself. Its two behaviours fold\n * cleanly into this component's `loading` prop: the button is `disabled` while\n * loading (so neither a pointer, a keyboard, nor a screen reader can activate\n * it), *and* the click handler bails out, so a synthesized `click()` — which\n * jsdom and some test harnesses dispatch without honouring `disabled` — cannot\n * fire a second submission. The ring is this package's `Spinner`, which\n * inherits the button's text colour.\n */\n\ntype ButtonVariant = 'primary' | 'secondary' | 'danger' | 'ghost';\ntype ButtonSize = 'sm' | 'md' | 'lg';\n\n/**\n * Layout and focus affordance. The focus ring is on `focus-visible`, so a\n * pointer press does not paint it and a keyboard press always does.\n */\nconst buttonBaseClass =\n 'inline-flex items-center justify-center gap-2 rounded-lg text-sm font-medium transition-colors duration-150 disabled:opacity-50 disabled:pointer-events-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)]';\n\nconst buttonVariantClass: Record<ButtonVariant, string> = {\n primary: 'bg-[var(--color-accent)] text-[#0d1008] hover:bg-[var(--color-accent-dim)]',\n secondary: 'bg-[var(--color-surface-3)] text-[var(--color-text-primary)] hover:bg-[var(--color-surface-4)]',\n ghost: 'bg-transparent text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-3)] hover:text-[var(--color-text-primary)]',\n danger: 'bg-[var(--color-error-bg)] text-[var(--color-error-text)] hover:brightness-125',\n};\n\nconst buttonSizeClass: Record<ButtonSize, string> = {\n sm: 'px-3 py-1.5 text-xs',\n md: 'px-4 py-2',\n lg: 'px-5 py-2.5 text-base',\n};\n\ninterface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** Visual weight; defaults to `secondary`. */\n variant?: ButtonVariant;\n /** Control size; defaults to `md`. */\n size?: ButtonSize;\n /**\n * Shows the spinner and blocks activation until it clears. A busy button is\n * a disabled button: the prop alone is enough, no `disabled` bookkeeping at\n * the call site.\n */\n loading?: boolean;\n}\n\nfunction Button({\n className,\n variant = 'secondary',\n size = 'md',\n loading = false,\n disabled = false,\n children,\n onClick,\n type = 'button',\n ...rest\n}: Readonly<ButtonProps>): ReactElement {\n const handleClick = (event: MouseEvent<HTMLButtonElement>): void => {\n // Belt and braces: `disabled` already stops a real pointer or key press,\n // and this stops a synthesized event from re-entering an in-flight action.\n if (disabled || loading) {\n return;\n }\n onClick?.(event);\n };\n\n return (\n <button\n type={type}\n className={cn(buttonBaseClass, buttonVariantClass[variant], buttonSizeClass[size], className)}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n onClick={handleClick}\n {...rest}\n >\n {loading ? <Spinner size={16} color=\"currentColor\" padding=\"0\" /> : null}\n {children}\n </button>\n );\n}\n\n/**\n * The class string for a button, for callers rendering the element themselves —\n * a link styled as a button, or a toolbar control that is not a `<button>`.\n */\nfunction buttonClass(\n { variant = 'secondary', size = 'md' }: { variant?: ButtonVariant; size?: ButtonSize } = {},\n className?: string,\n): string {\n return cn(buttonBaseClass, buttonVariantClass[variant], buttonSizeClass[size], className);\n}\n\nexport { Button, buttonBaseClass, buttonClass, buttonSizeClass, buttonVariantClass };\nexport type { ButtonProps, ButtonSize, ButtonVariant };\n"]}
package/dist/Card.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cn } from './utils';
2
+ import { cn } from "./utils.js";
3
3
  /**
4
4
  * Surface primitives: `Card`, `CardHeader`, `CardTitle`.
5
5
  *
package/dist/Card.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Card.js","sourceRoot":"","sources":["../src/Card.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,wBAAwB;AACxB,MAAM,SAAS,GAAG,gFAAgF,CAAC;AAInG,SAAS,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAuB;IACvD,OAAO,cAAK,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,KAAM,IAAI,GAAI,CAAC;AAChE,CAAC;AAED,+DAA+D;AAC/D,MAAM,eAAe,GAAG,8CAA8C,CAAC;AAIvE,SAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAA6B;IACnE,OAAO,cAAK,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,KAAM,IAAI,GAAI,CAAC;AACtE,CAAC;AAED,0FAA0F;AAC1F,MAAM,cAAc,GAAG,wDAAwD,CAAC;AAIhF,SAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAA4B;IACjE,OAAO,aAAI,SAAS,EAAE,EAAE,CAAC,cAAc,EAAE,SAAS,CAAC,KAAM,IAAI,GAAI,CAAC;AACpE,CAAC;AAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import type { HTMLAttributes, ReactElement } from 'react';\nimport { cn } from './utils';\n\n/**\n * Surface primitives: `Card`, `CardHeader`, `CardTitle`.\n *\n * ## Provenance\n *\n * `components/ui/Card.tsx` in **CalDAV-Bridge**, **Durable-DAV**,\n * **Durable-DAV-Router**, **Edge-Git**, **Edge-Sonic** and **Mail-Otter** — six\n * copies that are identical apart from Edge-Sonic's two improvements, both of\n * which are adopted here:\n *\n * 1. **Props spread onto the DOM element.** The other five take only\n * `className` and `children`, so a card that needs an `id`, a `role` or a\n * `data-testid` has to be wrapped in a redundant element.\n * 2. **The base classes live in one exported string** rather than being\n * re-spelled by `CardHeader`/`CardTitle`, so a change to the surface lands\n * once.\n *\n * `CardTitle` renders an `<h2>` in every copy. No copy in the family\n * parameterised the heading level, and inventing a `headingLevel` prop here\n * would strand the other six call sites, so the level stays fixed and a caller\n * that needs a different level composes the class string it needs from\n * `cardTitleClass`.\n */\n\n/** The card surface. */\nconst cardClass = 'rounded-xl border border-[var(--color-border)] bg-[var(--color-surface-1)] p-5';\n\ninterface CardProps extends HTMLAttributes<HTMLDivElement> {}\n\nfunction Card({ className, ...rest }: Readonly<CardProps>): ReactElement {\n return <div className={cn(cardClass, className)} {...rest} />;\n}\n\n/** The header row: title on the left, actions on the right. */\nconst cardHeaderClass = 'mb-4 flex items-center justify-between gap-3';\n\ninterface CardHeaderProps extends HTMLAttributes<HTMLDivElement> {}\n\nfunction CardHeader({ className, ...rest }: Readonly<CardHeaderProps>): ReactElement {\n return <div className={cn(cardHeaderClass, className)} {...rest} />;\n}\n\n/** The card's title. Renders an `<h2>`; nested headings override the level via `role`. */\nconst cardTitleClass = 'text-lg font-semibold text-[var(--color-text-primary)]';\n\ninterface CardTitleProps extends HTMLAttributes<HTMLHeadingElement> {}\n\nfunction CardTitle({ className, ...rest }: Readonly<CardTitleProps>): ReactElement {\n return <h2 className={cn(cardTitleClass, className)} {...rest} />;\n}\n\nexport { Card, cardClass, cardHeaderClass, cardTitleClass, CardHeader, CardTitle };\nexport type { CardHeaderProps, CardProps, CardTitleProps };\n"]}
1
+ {"version":3,"file":"Card.js","sourceRoot":"","sources":["../src/Card.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,wBAAwB;AACxB,MAAM,SAAS,GAAG,gFAAgF,CAAC;AAInG,SAAS,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAuB;IACvD,OAAO,cAAK,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,KAAM,IAAI,GAAI,CAAC;AAChE,CAAC;AAED,+DAA+D;AAC/D,MAAM,eAAe,GAAG,8CAA8C,CAAC;AAIvE,SAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAA6B;IACnE,OAAO,cAAK,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,KAAM,IAAI,GAAI,CAAC;AACtE,CAAC;AAED,0FAA0F;AAC1F,MAAM,cAAc,GAAG,wDAAwD,CAAC;AAIhF,SAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAA4B;IACjE,OAAO,aAAI,SAAS,EAAE,EAAE,CAAC,cAAc,EAAE,SAAS,CAAC,KAAM,IAAI,GAAI,CAAC;AACpE,CAAC;AAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import type { HTMLAttributes, ReactElement } from 'react';\nimport { cn } from './utils.ts';\n\n/**\n * Surface primitives: `Card`, `CardHeader`, `CardTitle`.\n *\n * ## Provenance\n *\n * `components/ui/Card.tsx` in **CalDAV-Bridge**, **Durable-DAV**,\n * **Durable-DAV-Router**, **Edge-Git**, **Edge-Sonic** and **Mail-Otter** — six\n * copies that are identical apart from Edge-Sonic's two improvements, both of\n * which are adopted here:\n *\n * 1. **Props spread onto the DOM element.** The other five take only\n * `className` and `children`, so a card that needs an `id`, a `role` or a\n * `data-testid` has to be wrapped in a redundant element.\n * 2. **The base classes live in one exported string** rather than being\n * re-spelled by `CardHeader`/`CardTitle`, so a change to the surface lands\n * once.\n *\n * `CardTitle` renders an `<h2>` in every copy. No copy in the family\n * parameterised the heading level, and inventing a `headingLevel` prop here\n * would strand the other six call sites, so the level stays fixed and a caller\n * that needs a different level composes the class string it needs from\n * `cardTitleClass`.\n */\n\n/** The card surface. */\nconst cardClass = 'rounded-xl border border-[var(--color-border)] bg-[var(--color-surface-1)] p-5';\n\ninterface CardProps extends HTMLAttributes<HTMLDivElement> {}\n\nfunction Card({ className, ...rest }: Readonly<CardProps>): ReactElement {\n return <div className={cn(cardClass, className)} {...rest} />;\n}\n\n/** The header row: title on the left, actions on the right. */\nconst cardHeaderClass = 'mb-4 flex items-center justify-between gap-3';\n\ninterface CardHeaderProps extends HTMLAttributes<HTMLDivElement> {}\n\nfunction CardHeader({ className, ...rest }: Readonly<CardHeaderProps>): ReactElement {\n return <div className={cn(cardHeaderClass, className)} {...rest} />;\n}\n\n/** The card's title. Renders an `<h2>`; nested headings override the level via `role`. */\nconst cardTitleClass = 'text-lg font-semibold text-[var(--color-text-primary)]';\n\ninterface CardTitleProps extends HTMLAttributes<HTMLHeadingElement> {}\n\nfunction CardTitle({ className, ...rest }: Readonly<CardTitleProps>): ReactElement {\n return <h2 className={cn(cardTitleClass, className)} {...rest} />;\n}\n\nexport { Card, cardClass, cardHeaderClass, cardTitleClass, CardHeader, CardTitle };\nexport type { CardHeaderProps, CardProps, CardTitleProps };\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.js";
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,YAAY,CAAC;AA0ChC,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.ts';\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"]}
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
- import { Input } from './Input';
4
- import { theme } from './theme';
3
+ import { Input } from "./Input.js";
4
+ import { theme } from "./theme.js";
5
5
  function FocusInput({ style, onFocus, onBlur, ...rest }) {
6
6
  const [focused, setFocused] = useState(false);
7
7
  const focusStyle = { borderColor: focused ? theme.focusBorder : theme.border, ...style };
@@ -1 +1 @@
1
- {"version":3,"file":"FocusInput.js","sourceRoot":"","sources":["../src/FocusInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAoF,MAAM,OAAO,CAAC;AACnH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AA8BhC,SAAS,UAAU,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAA6B;IAChF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,UAAU,GAAkB,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IAExG,MAAM,WAAW,GAAG,CAAC,KAAmC,EAAQ,EAAE;QAChE,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,CAAC,KAAmC,EAAQ,EAAE;QAC/D,UAAU,CAAC,KAAK,CAAC,CAAC;QAClB,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,KAAC,KAAK,OAAK,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,GAAI,CAAC;AAC1F,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { useState, type CSSProperties, type FocusEvent, type InputHTMLAttributes, type ReactElement } from 'react';\nimport { Input } from './Input';\nimport { theme } from './theme';\n\n/**\n * A text field that paints its border while it holds focus.\n *\n * ## Provenance\n *\n * `components/ui/FocusInput.tsx` in **AWS-AccessBridge** — the only copy in the\n * family, and the only AWS primitive still in active use after the Tailwind\n * repos' `Input` absorbed the focus treatment into its class list\n * (`focus:border-[var(--color-accent)]`). It is kept because the two mechanisms\n * are not equivalent for a consumer without Tailwind: the class version needs\n * the stylesheet, the inline version needs nothing.\n *\n * Two normalizations from the original:\n *\n * - It **renders `Input`**, so the field's base styling (padding, radius,\n * disabled opacity, placeholder colour) comes from the kit instead of a\n * second, drifting copy.\n * - It no longer re-spells `inputStyle`. The original built its own style\n * object and merged the caller's over it; this one passes `style` straight\n * through, which is the same contract with one less place to change.\n *\n * Auto-focus is the standard `autoFocus` attribute — React applies it on mount,\n * and a component-level `focus()` call in an effect would race the caller's own\n * focus management for no gain.\n */\n\ninterface FocusInputProps extends InputHTMLAttributes<HTMLInputElement> {}\n\nfunction FocusInput({ style, onFocus, onBlur, ...rest }: Readonly<FocusInputProps>): ReactElement {\n const [focused, setFocused] = useState(false);\n const focusStyle: CSSProperties = { borderColor: focused ? theme.focusBorder : theme.border, ...style };\n\n const handleFocus = (event: FocusEvent<HTMLInputElement>): void => {\n setFocused(true);\n onFocus?.(event);\n };\n\n const handleBlur = (event: FocusEvent<HTMLInputElement>): void => {\n setFocused(false);\n onBlur?.(event);\n };\n\n return <Input {...rest} style={focusStyle} onFocus={handleFocus} onBlur={handleBlur} />;\n}\n\nexport { FocusInput };\nexport type { FocusInputProps };\n"]}
1
+ {"version":3,"file":"FocusInput.js","sourceRoot":"","sources":["../src/FocusInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAoF,MAAM,OAAO,CAAC;AACnH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AA8BnC,SAAS,UAAU,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAA6B;IAChF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,UAAU,GAAkB,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IAExG,MAAM,WAAW,GAAG,CAAC,KAAmC,EAAQ,EAAE;QAChE,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,CAAC,KAAmC,EAAQ,EAAE;QAC/D,UAAU,CAAC,KAAK,CAAC,CAAC;QAClB,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,KAAC,KAAK,OAAK,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,GAAI,CAAC;AAC1F,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { useState, type CSSProperties, type FocusEvent, type InputHTMLAttributes, type ReactElement } from 'react';\nimport { Input } from './Input.tsx';\nimport { theme } from './theme.ts';\n\n/**\n * A text field that paints its border while it holds focus.\n *\n * ## Provenance\n *\n * `components/ui/FocusInput.tsx` in **AWS-AccessBridge** — the only copy in the\n * family, and the only AWS primitive still in active use after the Tailwind\n * repos' `Input` absorbed the focus treatment into its class list\n * (`focus:border-[var(--color-accent)]`). It is kept because the two mechanisms\n * are not equivalent for a consumer without Tailwind: the class version needs\n * the stylesheet, the inline version needs nothing.\n *\n * Two normalizations from the original:\n *\n * - It **renders `Input`**, so the field's base styling (padding, radius,\n * disabled opacity, placeholder colour) comes from the kit instead of a\n * second, drifting copy.\n * - It no longer re-spells `inputStyle`. The original built its own style\n * object and merged the caller's over it; this one passes `style` straight\n * through, which is the same contract with one less place to change.\n *\n * Auto-focus is the standard `autoFocus` attribute — React applies it on mount,\n * and a component-level `focus()` call in an effect would race the caller's own\n * focus management for no gain.\n */\n\ninterface FocusInputProps extends InputHTMLAttributes<HTMLInputElement> {}\n\nfunction FocusInput({ style, onFocus, onBlur, ...rest }: Readonly<FocusInputProps>): ReactElement {\n const [focused, setFocused] = useState(false);\n const focusStyle: CSSProperties = { borderColor: focused ? theme.focusBorder : theme.border, ...style };\n\n const handleFocus = (event: FocusEvent<HTMLInputElement>): void => {\n setFocused(true);\n onFocus?.(event);\n };\n\n const handleBlur = (event: FocusEvent<HTMLInputElement>): void => {\n setFocused(false);\n onBlur?.(event);\n };\n\n return <Input {...rest} style={focusStyle} onFocus={handleFocus} onBlur={handleBlur} />;\n}\n\nexport { FocusInput };\nexport type { FocusInputProps };\n"]}
package/dist/Input.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cn } from './utils';
2
+ import { cn } from "./utils.js";
3
3
  /**
4
4
  * Form controls: `Input`, `Select`, `Textarea`, `Label`.
5
5
  *
package/dist/Input.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sourceRoot":"","sources":["../src/Input.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,mDAAmD;AACnD,MAAM,UAAU,GACd,6RAA6R,CAAC;AAIhS,SAAS,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAwB;IACzD,OAAO,gBAAO,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,KAAM,IAAI,GAAI,CAAC;AACnE,CAAC;AAID,SAAS,MAAM,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAyB;IACrE,OAAO,CACL,iBAAQ,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,KAAM,IAAI,YACnD,QAAQ,GACF,CACV,CAAC;AACJ,CAAC;AAID,SAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAA2B;IAC/D,OAAO,mBAAU,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,mBAAmB,EAAE,SAAS,CAAC,KAAM,IAAI,GAAI,CAAC;AAC3F,CAAC;AAQD,SAAS,KAAK,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,EAAwB;IACjE,OAAO,CACL,gBAAO,OAAO,EAAE,OAAO,EAAE,SAAS,EAAC,+DAA+D,KAAK,IAAI,YACxG,QAAQ,GACH,CACT,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import type {\n InputHTMLAttributes,\n LabelHTMLAttributes,\n ReactElement,\n ReactNode,\n SelectHTMLAttributes,\n TextareaHTMLAttributes,\n} from 'react';\nimport { cn } from './utils';\n\n/**\n * Form controls: `Input`, `Select`, `Textarea`, `Label`.\n *\n * ## Provenance\n *\n * `components/ui/Input.tsx` in **CalDAV-Bridge**, **Durable-DAV**,\n * **Durable-DAV-Router**, **Edge-Git**, **Edge-Sonic** and **Mail-Otter** — six\n * copies that all export the same four controls and agree on the field classes\n * up to two drifting details, both settled the Edge-Sonic way:\n *\n * 1. **One shared class string** (`fieldClass`) instead of four re-spelled\n * copies. CalDAV-Bridge, Durable-DAV-Router, Edge-Git and Mail-Otter omit\n * `w-full` from their `Select`; CalDAV-Bridge's `Select`/`Label` and every\n * `Textarea` re-spell the field classes minus one property. A placeholder\n * colour that matches an input but not its select is a difference nobody\n * notices until a client is looking at both.\n * 2. **`htmlFor` is stated, not spread.** Edge-Sonic's `Label` takes `htmlFor`\n * and `children` explicitly, because a label with no `for` is announced as\n * unassociated text: the click target and the accessible name both depend\n * on it, and neither is visible in the markup that omits it.\n *\n * ## Error state\n *\n * None of the six copies carries an error state — each renders its field-level\n * error beside the input with its own markup (a `<p>` in `--color-error-text`,\n * or the app's notice bar), and none of them wires `aria-invalid`. Rather than\n * invent a sixth shape, the kit leaves the element to do what it already does:\n * `aria-invalid` and `aria-describedby` are standard input attributes and both\n * spread through here, and a consumer whose design reddens the border on error\n * passes the class itself (`className={error ? 'border-[var(--color-error-text)]' : undefined}`).\n */\n\n/** The shared look of every text-entry control. */\nconst fieldClass =\n 'w-full rounded-lg border border-[var(--color-border)] bg-[var(--color-surface-base)] px-3 py-2 text-sm text-[var(--color-text-primary)] placeholder:text-[var(--color-text-muted)] transition-colors duration-150 focus:border-[var(--color-accent)] focus:outline-none disabled:opacity-60';\n\ninterface InputProps extends InputHTMLAttributes<HTMLInputElement> {}\n\nfunction Input({ className, ...rest }: Readonly<InputProps>): ReactElement {\n return <input className={cn(fieldClass, className)} {...rest} />;\n}\n\ninterface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {}\n\nfunction Select({ className, children, ...rest }: Readonly<SelectProps>): ReactElement {\n return (\n <select className={cn(fieldClass, className)} {...rest}>\n {children}\n </select>\n );\n}\n\ninterface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {}\n\nfunction Textarea({ className, ...rest }: Readonly<TextareaProps>): ReactElement {\n return <textarea className={cn(fieldClass, 'min-h-20 resize-y', className)} {...rest} />;\n}\n\ninterface LabelProps extends Omit<LabelHTMLAttributes<HTMLLabelElement>, 'htmlFor'> {\n /** The `id` of the control this label names. */\n htmlFor?: string;\n children: ReactNode;\n}\n\nfunction Label({ children, htmlFor, ...rest }: Readonly<LabelProps>): ReactElement {\n return (\n <label htmlFor={htmlFor} className=\"mb-1 block text-xs font-medium text-[var(--color-text-muted)]\" {...rest}>\n {children}\n </label>\n );\n}\n\nexport { Input, Label, Select, Textarea, fieldClass };\nexport type { InputProps, LabelProps, SelectProps, TextareaProps };\n"]}
1
+ {"version":3,"file":"Input.js","sourceRoot":"","sources":["../src/Input.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,mDAAmD;AACnD,MAAM,UAAU,GACd,6RAA6R,CAAC;AAIhS,SAAS,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAwB;IACzD,OAAO,gBAAO,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,KAAM,IAAI,GAAI,CAAC;AACnE,CAAC;AAID,SAAS,MAAM,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAyB;IACrE,OAAO,CACL,iBAAQ,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,KAAM,IAAI,YACnD,QAAQ,GACF,CACV,CAAC;AACJ,CAAC;AAID,SAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAA2B;IAC/D,OAAO,mBAAU,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,mBAAmB,EAAE,SAAS,CAAC,KAAM,IAAI,GAAI,CAAC;AAC3F,CAAC;AAQD,SAAS,KAAK,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,EAAwB;IACjE,OAAO,CACL,gBAAO,OAAO,EAAE,OAAO,EAAE,SAAS,EAAC,+DAA+D,KAAK,IAAI,YACxG,QAAQ,GACH,CACT,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import type {\n InputHTMLAttributes,\n LabelHTMLAttributes,\n ReactElement,\n ReactNode,\n SelectHTMLAttributes,\n TextareaHTMLAttributes,\n} from 'react';\nimport { cn } from './utils.ts';\n\n/**\n * Form controls: `Input`, `Select`, `Textarea`, `Label`.\n *\n * ## Provenance\n *\n * `components/ui/Input.tsx` in **CalDAV-Bridge**, **Durable-DAV**,\n * **Durable-DAV-Router**, **Edge-Git**, **Edge-Sonic** and **Mail-Otter** — six\n * copies that all export the same four controls and agree on the field classes\n * up to two drifting details, both settled the Edge-Sonic way:\n *\n * 1. **One shared class string** (`fieldClass`) instead of four re-spelled\n * copies. CalDAV-Bridge, Durable-DAV-Router, Edge-Git and Mail-Otter omit\n * `w-full` from their `Select`; CalDAV-Bridge's `Select`/`Label` and every\n * `Textarea` re-spell the field classes minus one property. A placeholder\n * colour that matches an input but not its select is a difference nobody\n * notices until a client is looking at both.\n * 2. **`htmlFor` is stated, not spread.** Edge-Sonic's `Label` takes `htmlFor`\n * and `children` explicitly, because a label with no `for` is announced as\n * unassociated text: the click target and the accessible name both depend\n * on it, and neither is visible in the markup that omits it.\n *\n * ## Error state\n *\n * None of the six copies carries an error state — each renders its field-level\n * error beside the input with its own markup (a `<p>` in `--color-error-text`,\n * or the app's notice bar), and none of them wires `aria-invalid`. Rather than\n * invent a sixth shape, the kit leaves the element to do what it already does:\n * `aria-invalid` and `aria-describedby` are standard input attributes and both\n * spread through here, and a consumer whose design reddens the border on error\n * passes the class itself (`className={error ? 'border-[var(--color-error-text)]' : undefined}`).\n */\n\n/** The shared look of every text-entry control. */\nconst fieldClass =\n 'w-full rounded-lg border border-[var(--color-border)] bg-[var(--color-surface-base)] px-3 py-2 text-sm text-[var(--color-text-primary)] placeholder:text-[var(--color-text-muted)] transition-colors duration-150 focus:border-[var(--color-accent)] focus:outline-none disabled:opacity-60';\n\ninterface InputProps extends InputHTMLAttributes<HTMLInputElement> {}\n\nfunction Input({ className, ...rest }: Readonly<InputProps>): ReactElement {\n return <input className={cn(fieldClass, className)} {...rest} />;\n}\n\ninterface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {}\n\nfunction Select({ className, children, ...rest }: Readonly<SelectProps>): ReactElement {\n return (\n <select className={cn(fieldClass, className)} {...rest}>\n {children}\n </select>\n );\n}\n\ninterface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {}\n\nfunction Textarea({ className, ...rest }: Readonly<TextareaProps>): ReactElement {\n return <textarea className={cn(fieldClass, 'min-h-20 resize-y', className)} {...rest} />;\n}\n\ninterface LabelProps extends Omit<LabelHTMLAttributes<HTMLLabelElement>, 'htmlFor'> {\n /** The `id` of the control this label names. */\n htmlFor?: string;\n children: ReactNode;\n}\n\nfunction Label({ children, htmlFor, ...rest }: Readonly<LabelProps>): ReactElement {\n return (\n <label htmlFor={htmlFor} className=\"mb-1 block text-xs font-medium text-[var(--color-text-muted)]\" {...rest}>\n {children}\n </label>\n );\n}\n\nexport { Input, Label, Select, Textarea, fieldClass };\nexport type { InputProps, LabelProps, SelectProps, TextareaProps };\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.js";
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,YAAa,CAAC;AAyDrC,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.tsx';\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"]}
@@ -1,5 +1,5 @@
1
1
  import { type ReactElement, type ReactNode } from 'react';
2
- import { type ButtonSize, type ButtonVariant } from './Button';
2
+ import { type ButtonSize, type ButtonVariant } from './Button.tsx';
3
3
  /**
4
4
  * A button that owns its own busy state.
5
5
  *
@@ -1 +1 @@
1
- {"version":3,"file":"LoadingButton.d.ts","sourceRoot":"","sources":["../src/LoadingButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0C,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClG,OAAO,EAAU,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,UAAU,kBAAkB;IAC1B,+EAA+E;IAC/E,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACpC,sDAAsD;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,sCAAsC;IACtC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;IACpB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iBAAS,aAAa,CAAC,EACrB,OAAO,EACP,QAAgB,EAChB,OAAmB,EACnB,IAAW,EACX,QAAQ,EACR,IAAe,EACf,SAAS,GACV,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GAAG,YAAY,CAiC7C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"LoadingButton.d.ts","sourceRoot":"","sources":["../src/LoadingButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0C,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClG,OAAO,EAAU,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,UAAU,kBAAkB;IAC1B,+EAA+E;IAC/E,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACpC,sDAAsD;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,sCAAsC;IACtC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;IACpB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iBAAS,aAAa,CAAC,EACrB,OAAO,EACP,QAAgB,EAChB,OAAmB,EACnB,IAAW,EACX,QAAQ,EACR,IAAe,EACf,SAAS,GACV,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GAAG,YAAY,CAiC7C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCallback, useState } from 'react';
3
- import { Button } from './Button';
3
+ import { Button } from "./Button.js";
4
4
  function LoadingButton({ onClick, disabled = false, variant = 'primary', size = 'md', children, type = 'button', className, }) {
5
5
  const [loading, setLoading] = useState(false);
6
6
  const handleClick = useCallback((event) => {
@@ -1 +1 @@
1
- {"version":3,"file":"LoadingButton.js","sourceRoot":"","sources":["../src/LoadingButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAsD,MAAM,OAAO,CAAC;AAClG,OAAO,EAAE,MAAM,EAAuC,MAAM,UAAU,CAAC;AA4CvE,SAAS,aAAa,CAAC,EACrB,OAAO,EACP,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,IAAI,EACX,QAAQ,EACR,IAAI,GAAG,QAAQ,EACf,SAAS,GACoB;IAC7B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,KAAoC,EAAE,EAAE;QACvC,IAAI,QAAQ,IAAI,OAAO,EAAE,CAAC;YACxB,OAAO;QACT,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC;QACzB,IAAI,MAAM,YAAY,OAAO,EAAE,CAAC;YAC9B,UAAU,CAAC,IAAI,CAAC,CAAC;YACjB,uEAAuE;YACvE,uEAAuE;YACvE,EAAE;YACF,8DAA8D;YAC9D,uEAAuE;YACvE,uEAAuE;YACvE,uEAAuE;YACvE,mDAAmD;YACnD,MAAM,MAAM,GAAG,GAAS,EAAE;gBACxB,UAAU,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC,CAAC;YACF,KAAK,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,EACD,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAC7B,CAAC;IAEF,OAAO,CACL,KAAC,MAAM,IAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,YAC/H,QAAQ,GACF,CACV,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import { useCallback, useState, type MouseEvent, type ReactElement, type ReactNode } from 'react';\nimport { Button, type ButtonSize, type ButtonVariant } from './Button';\n\n/**\n * A button that owns its own busy state.\n *\n * ## Provenance\n *\n * `components/ui/LoadingButton.tsx` in **AWS-AccessBridge**. `Button` absorbed\n * everything it does — the `loading` prop, the disabled-while-busy semantics,\n * the spinner — so a consumer that drives state itself should reach for\n * `Button`. This wrapper stays for the call sites that hand it an async\n * `onClick` and let it track the in-flight promise, which is the shape every\n * `LoadingButton` in that repo uses.\n *\n * Two normalizations from the original:\n *\n * - **Variant names.** `'blue' | 'green' | 'red'` became the kit's\n * `'primary' | 'secondary' | 'danger' | 'ghost'`; the original's default\n * (`'blue'`, the solid action colour) maps to `primary`, and that default is\n * kept even though `Button` itself defaults to `secondary` — a caller that\n * reaches for this component wants the action to be the loudest thing it can\n * be, and the original's call sites all relied on it.\n * - **The handler is fire-and-forget with `void`.** `onClick` may return a\n * promise; the button holds `loading` until it settles, and the promise is\n * deliberately not awaited inside the handler so an `await`-less call site\n * reads the same as an async one.\n */\n\ninterface LoadingButtonProps {\n /** Runs on activation; the button is busy until a returned promise settles. */\n onClick: () => Promise<void> | void;\n /** Blocks activation regardless of the busy state. */\n disabled?: boolean;\n /** Visual weight; defaults to `primary`. */\n variant?: ButtonVariant;\n /** Control size; defaults to `md`. */\n size?: ButtonSize;\n children: ReactNode;\n /** Defaults to `button`, matching `Button`. */\n type?: 'button' | 'submit' | 'reset';\n /** Extra classes, merged over the button's. */\n className?: string;\n}\n\nfunction LoadingButton({\n onClick,\n disabled = false,\n variant = 'primary',\n size = 'md',\n children,\n type = 'button',\n className,\n}: Readonly<LoadingButtonProps>): ReactElement {\n const [loading, setLoading] = useState(false);\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n if (disabled || loading) {\n return;\n }\n const result = onClick();\n if (result instanceof Promise) {\n setLoading(true);\n // The state flip is scheduled before the await, not after it: a caller\n // reading the tree right after the click must already see the spinner.\n //\n // A rejection clears the busy state and is deliberately *not*\n // re-thrown: the handler is fire-and-forget, so re-throwing would only\n // produce an unhandled rejection (and a failed test run under vitest).\n // The call site owns its error reporting — every AWS-AccessBridge call\n // site does exactly that inside its own `onClick`.\n const settle = (): void => {\n setLoading(false);\n };\n void result.then(settle, settle);\n }\n },\n [disabled, loading, onClick],\n );\n\n return (\n <Button variant={variant} size={size} type={type} className={className} loading={loading} disabled={disabled} onClick={handleClick}>\n {children}\n </Button>\n );\n}\n\nexport { LoadingButton };\nexport type { LoadingButtonProps };\n"]}
1
+ {"version":3,"file":"LoadingButton.js","sourceRoot":"","sources":["../src/LoadingButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAsD,MAAM,OAAO,CAAC;AAClG,OAAO,EAAE,MAAM,EAAuC,MAAM,aAAc,CAAC;AA4C3E,SAAS,aAAa,CAAC,EACrB,OAAO,EACP,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,IAAI,EACX,QAAQ,EACR,IAAI,GAAG,QAAQ,EACf,SAAS,GACoB;IAC7B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,KAAoC,EAAE,EAAE;QACvC,IAAI,QAAQ,IAAI,OAAO,EAAE,CAAC;YACxB,OAAO;QACT,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC;QACzB,IAAI,MAAM,YAAY,OAAO,EAAE,CAAC;YAC9B,UAAU,CAAC,IAAI,CAAC,CAAC;YACjB,uEAAuE;YACvE,uEAAuE;YACvE,EAAE;YACF,8DAA8D;YAC9D,uEAAuE;YACvE,uEAAuE;YACvE,uEAAuE;YACvE,mDAAmD;YACnD,MAAM,MAAM,GAAG,GAAS,EAAE;gBACxB,UAAU,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC,CAAC;YACF,KAAK,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,EACD,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAC7B,CAAC;IAEF,OAAO,CACL,KAAC,MAAM,IAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,YAC/H,QAAQ,GACF,CACV,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import { useCallback, useState, type MouseEvent, type ReactElement, type ReactNode } from 'react';\nimport { Button, type ButtonSize, type ButtonVariant } from './Button.tsx';\n\n/**\n * A button that owns its own busy state.\n *\n * ## Provenance\n *\n * `components/ui/LoadingButton.tsx` in **AWS-AccessBridge**. `Button` absorbed\n * everything it does — the `loading` prop, the disabled-while-busy semantics,\n * the spinner — so a consumer that drives state itself should reach for\n * `Button`. This wrapper stays for the call sites that hand it an async\n * `onClick` and let it track the in-flight promise, which is the shape every\n * `LoadingButton` in that repo uses.\n *\n * Two normalizations from the original:\n *\n * - **Variant names.** `'blue' | 'green' | 'red'` became the kit's\n * `'primary' | 'secondary' | 'danger' | 'ghost'`; the original's default\n * (`'blue'`, the solid action colour) maps to `primary`, and that default is\n * kept even though `Button` itself defaults to `secondary` — a caller that\n * reaches for this component wants the action to be the loudest thing it can\n * be, and the original's call sites all relied on it.\n * - **The handler is fire-and-forget with `void`.** `onClick` may return a\n * promise; the button holds `loading` until it settles, and the promise is\n * deliberately not awaited inside the handler so an `await`-less call site\n * reads the same as an async one.\n */\n\ninterface LoadingButtonProps {\n /** Runs on activation; the button is busy until a returned promise settles. */\n onClick: () => Promise<void> | void;\n /** Blocks activation regardless of the busy state. */\n disabled?: boolean;\n /** Visual weight; defaults to `primary`. */\n variant?: ButtonVariant;\n /** Control size; defaults to `md`. */\n size?: ButtonSize;\n children: ReactNode;\n /** Defaults to `button`, matching `Button`. */\n type?: 'button' | 'submit' | 'reset';\n /** Extra classes, merged over the button's. */\n className?: string;\n}\n\nfunction LoadingButton({\n onClick,\n disabled = false,\n variant = 'primary',\n size = 'md',\n children,\n type = 'button',\n className,\n}: Readonly<LoadingButtonProps>): ReactElement {\n const [loading, setLoading] = useState(false);\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n if (disabled || loading) {\n return;\n }\n const result = onClick();\n if (result instanceof Promise) {\n setLoading(true);\n // The state flip is scheduled before the await, not after it: a caller\n // reading the tree right after the click must already see the spinner.\n //\n // A rejection clears the busy state and is deliberately *not*\n // re-thrown: the handler is fire-and-forget, so re-throwing would only\n // produce an unhandled rejection (and a failed test run under vitest).\n // The call site owns its error reporting — every AWS-AccessBridge call\n // site does exactly that inside its own `onClick`.\n const settle = (): void => {\n setLoading(false);\n };\n void result.then(settle, settle);\n }\n },\n [disabled, loading, onClick],\n );\n\n return (\n <Button variant={variant} size={size} type={type} className={className} loading={loading} disabled={disabled} onClick={handleClick}>\n {children}\n </Button>\n );\n}\n\nexport { LoadingButton };\nexport type { LoadingButtonProps };\n"]}
@@ -0,0 +1,50 @@
1
+ import type { Notice, NoticeKind } from './useNotice.ts';
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,gBAAgB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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.ts';\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"]}