@rexezuge/web 1.2.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.
- package/dist/AppPage.js +1 -1
- package/dist/AppPage.js.map +1 -1
- package/dist/Badge.js +1 -1
- package/dist/Badge.js.map +1 -1
- package/dist/Button.js +2 -2
- package/dist/Button.js.map +1 -1
- package/dist/Card.js +1 -1
- package/dist/Card.js.map +1 -1
- package/dist/ContextBar.js +1 -1
- package/dist/ContextBar.js.map +1 -1
- package/dist/FocusInput.js +2 -2
- package/dist/FocusInput.js.map +1 -1
- package/dist/Input.js +1 -1
- package/dist/Input.js.map +1 -1
- package/dist/LanguageSelector.js +1 -1
- package/dist/LanguageSelector.js.map +1 -1
- package/dist/LoadingButton.d.ts +1 -1
- package/dist/LoadingButton.d.ts.map +1 -1
- package/dist/LoadingButton.js +1 -1
- package/dist/LoadingButton.js.map +1 -1
- package/dist/NoticeBar.d.ts +1 -1
- package/dist/NoticeBar.d.ts.map +1 -1
- package/dist/NoticeBar.js.map +1 -1
- package/dist/PageHeaderCard.js +1 -1
- package/dist/PageHeaderCard.js.map +1 -1
- package/dist/PageState.js +1 -1
- package/dist/PageState.js.map +1 -1
- package/dist/Pagination.js +2 -2
- package/dist/Pagination.js.map +1 -1
- package/dist/ReadOnlyField.js +3 -3
- package/dist/ReadOnlyField.js.map +1 -1
- package/dist/RefreshButton.js +1 -1
- package/dist/RefreshButton.js.map +1 -1
- package/dist/Spinner.js +1 -1
- package/dist/Spinner.js.map +1 -1
- package/dist/TypeToConfirmModal.js +4 -4
- package/dist/TypeToConfirmModal.js.map +1 -1
- package/dist/Unauthorized.js +1 -1
- package/dist/Unauthorized.js.map +1 -1
- package/dist/index.d.ts +51 -51
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -27
- package/dist/index.js.map +1 -1
- package/dist/useCopyToClipboard.js +1 -1
- package/dist/useCopyToClipboard.js.map +1 -1
- package/dist/useCurrentUser.d.ts +1 -1
- package/dist/useCurrentUser.d.ts.map +1 -1
- package/dist/useCurrentUser.js.map +1 -1
- package/dist/useNotice.js +1 -1
- package/dist/useNotice.js.map +1 -1
- package/package.json +3 -3
package/dist/AppPage.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from
|
|
2
|
+
import { cn } from "./utils.js";
|
|
3
3
|
function AppPage({ variant = 'wide', className, children }) {
|
|
4
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
5
|
}
|
package/dist/AppPage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppPage.js","sourceRoot":"","sources":["../src/AppPage.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,
|
|
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
|
|
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,
|
|
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
|
|
3
|
-
import { Spinner } from
|
|
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.
|
package/dist/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,
|
|
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
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,
|
|
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"]}
|
package/dist/ContextBar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from
|
|
2
|
+
import { cn } from "./utils.js";
|
|
3
3
|
function ContextBar({ home, crumb, actions, className }) {
|
|
4
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
5
|
}
|
package/dist/ContextBar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextBar.js","sourceRoot":"","sources":["../src/ContextBar.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,
|
|
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"]}
|
package/dist/FocusInput.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import { Input } from
|
|
4
|
-
import { theme } from
|
|
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 };
|
package/dist/FocusInput.js.map
CHANGED
|
@@ -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,
|
|
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
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,
|
|
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"]}
|
package/dist/LanguageSelector.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { LocaleUtil, SUPPORTED_LOCALES } from '@rexezuge/shared';
|
|
3
|
-
import { Select } from
|
|
3
|
+
import { Select } from "./Input.js";
|
|
4
4
|
function LanguageSelector({ value, onChange, label, unknownLabel, supported = SUPPORTED_LOCALES, disabled, }) {
|
|
5
5
|
if (value === null) {
|
|
6
6
|
return (_jsx(Select, { "aria-label": label, value: "", disabled: true, onChange: () => undefined, children: _jsx("option", { value: "", children: unknownLabel }) }));
|
|
@@ -1 +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,
|
|
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"]}
|
package/dist/LoadingButton.d.ts
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/LoadingButton.js
CHANGED
|
@@ -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
|
|
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,
|
|
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"]}
|
package/dist/NoticeBar.d.ts
CHANGED
package/dist/NoticeBar.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoticeBar.d.ts","sourceRoot":"","sources":["../src/NoticeBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,
|
|
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"}
|
package/dist/NoticeBar.js.map
CHANGED
|
@@ -1 +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"]}
|
|
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"]}
|
package/dist/PageHeaderCard.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Card } from
|
|
2
|
+
import { Card } from "./Card.js";
|
|
3
3
|
function PageHeaderCard({ icon, title, description, actions }) {
|
|
4
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
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageHeaderCard.js","sourceRoot":"","sources":["../src/PageHeaderCard.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"PageHeaderCard.js","sourceRoot":"","sources":["../src/PageHeaderCard.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAY,CAAC;AAuClC,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.tsx';\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"]}
|
package/dist/PageState.js
CHANGED
package/dist/PageState.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageState.js","sourceRoot":"","sources":["../src/PageState.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"PageState.js","sourceRoot":"","sources":["../src/PageState.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAC;AAE9C;;;;;;;;;;GAUG;AAEH,kFAAkF;AAClF,SAAS,cAAc,CAAC,EAAE,KAAK,GAAG,UAAU,EAAsB;IAChE,OAAO,CACL,cAAK,SAAS,EAAC,2CAA2C,EAAC,IAAI,EAAC,QAAQ,gBAAa,KAAK,YACxF,cAAK,SAAS,EAAC,gGAAgG,GAAG,GAC9G,CACP,CAAC;AACJ,CAAC;AAED,yEAAyE;AACzE,SAAS,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,EAA4C;IAC7E,OAAO,CACL,eAAK,SAAS,EAAC,0DAA0D,aACtE,IAAI,IAAI,cAAK,SAAS,EAAC,0BAA0B,YAAE,IAAI,GAAO,EAC9D,OAAO,IACJ,CACP,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAS,kBAAkB,CAAC,EAC1B,OAAO,EACP,YAAY,EACZ,WAAW,EACX,SAAS,EACT,SAAS,EACT,QAAQ,GAST;IACC,OAAO,CACL,KAAC,UAAU,IAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,EAAC,SAAS,EAAE,SAAS,YACnE,eAAK,SAAS,EAAC,KAAK,aAClB,YAAG,SAAS,EAAC,6DAA6D,YAAE,OAAO,GAAK,EACxF,eAAK,SAAS,EAAC,YAAY,aACzB,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,QAAQ,EAClB,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;gCACjB,KAAK,CAAC,eAAe,EAAE,CAAC;gCACxB,QAAQ,EAAE,CAAC;4BACb,CAAC,YAEA,WAAW,GACL,EACT,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,QAAQ,EAClB,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;gCACjB,KAAK,CAAC,eAAe,EAAE,CAAC;gCACxB,SAAS,EAAE,CAAC;4BACd,CAAC,YAEA,YAAY,GACN,IACL,IACF,GACK,CACd,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import type { ReactNode } from 'react';\nimport { ModalShell } from './ModalShell.tsx';\n\n/**\n * The shared loading / empty / error states.\n *\n * Converged from `components/layout/PageState.tsx` (Durable-DAV,\n * Durable-DAV-Router) and `EmptyState` (CalDAV-Bridge), which were the same two\n * components under two names.\n *\n * Same reasoning as `ModalShell`: the label arrives as a prop rather than from\n * `useTranslation`, so a consumer is not required to run a translation library\n * to render a spinner.\n */\n\n/** The shared spinner. `label` is announced, so it should say what is loading. */\nfunction LoadingSpinner({ label = 'Loading…' }: { label?: string }) {\n return (\n <div className=\"min-h-64 flex items-center justify-center\" role=\"status\" aria-label={label}>\n <div className=\"h-10 w-10 rounded-full border-2 border-[var(--color-accent)] border-t-transparent animate-spin\" />\n </div>\n );\n}\n\n/** The shared centered empty message, with an optional icon above it. */\nfunction EmptyState({ icon, message }: { icon?: ReactNode; message: ReactNode }) {\n return (\n <div className=\"text-center text-[var(--color-text-muted)] py-10 text-sm\">\n {icon && <div className=\"mb-3 flex justify-center\">{icon}</div>}\n {message}\n </div>\n );\n}\n\n/**\n * A confirmation for a destructive action.\n *\n * `message` is required to **name the thing being deleted**, not to say \"this\n * item\" — the operator is the only one who can tell whether they meant to\n * delete it, so the dialog has to be specific. That is a contract on the\n * caller, not something the component can enforce, which is why `message` is a\n * `ReactNode` the caller composes rather than a template this fills in.\n *\n * No confirm timer: a dialog that arms itself makes the operator wait for a\n * decision they were already qualified to make.\n *\n * Both handlers stop propagation, because a confirm that fires twice deletes\n * two things.\n */\nfunction ConfirmDeleteModal({\n message,\n confirmLabel,\n cancelLabel,\n ariaLabel,\n onConfirm,\n onCancel,\n}: {\n /** The full question, naming what will be deleted. */\n message: ReactNode;\n confirmLabel: string;\n cancelLabel: string;\n ariaLabel: string;\n onConfirm: () => void;\n onCancel: () => void;\n}) {\n return (\n <ModalShell onClose={onCancel} widthClass=\"w-80\" ariaLabel={ariaLabel}>\n <div className=\"p-6\">\n <p className=\"text-sm text-[var(--color-text-secondary)] text-center mb-6\">{message}</p>\n <div className=\"flex gap-3\">\n <button\n type=\"button\"\n className=\"flex-1\"\n onClick={(event) => {\n event.stopPropagation();\n onCancel();\n }}\n >\n {cancelLabel}\n </button>\n <button\n type=\"button\"\n className=\"flex-1\"\n onClick={(event) => {\n event.stopPropagation();\n onConfirm();\n }}\n >\n {confirmLabel}\n </button>\n </div>\n </div>\n </ModalShell>\n );\n}\n\nexport { ConfirmDeleteModal, EmptyState, LoadingSpinner };\n"]}
|
package/dist/Pagination.js
CHANGED
package/dist/Pagination.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.js","sourceRoot":"","sources":["../src/Pagination.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Pagination.js","sourceRoot":"","sources":["../src/Pagination.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAc,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,sGAAsG;AACtG,SAAS,YAAY,CAAC,KAAa,EAAE,QAAgB;IACnD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC,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n/**\n * Pager controls.\n *\n * ## Provenance\n *\n * `components/ui/Pagination.tsx` in **AWS-AccessBridge**, with the arithmetic\n * (`totalPages`, `clampPage`, `pageNumbers`) that this component reached for\n * across `lib/pagination.ts` and `lib/presentation.ts` inlined, because a\n * consumer importing the pager should not have to import two more modules to\n * understand it. The DAV repos' `VolumeFilePager` (Durable-DAV and\n * Durable-DAV-Router) is the family's other pager and informs two decisions: it\n * gates on the rows actually being present, and it renders nothing at all when\n * the collection fits on one page.\n *\n * The API is normalized away from the AWS names (`currentPage`, `totalPages`,\n * `onPageChange`) to `page`, `pageCount`, `onChange`. `pageCount` may be\n * derived instead of passed: give `total` and `pageSize` and the pager does the\n * arithmetic, which is what the DAV pager did by hand at its call site.\n *\n * `full` shows a window of page numbers (AWS's default); `compact` shows\n * \"Page X of Y\" (AWS's other variant, and what the DAV pager renders). Both\n * render `null` for a single page.\n */\n\n/** How many pages `total` items occupy. A non-positive page size yields 1, never `Infinity`/`NaN`. */\nfunction pageCountFor(total: number, pageSize: number): number {\n if (!Number.isFinite(total) || !Number.isFinite(pageSize) || pageSize <= 0 || total <= 0) {\n return 1;\n }\n return Math.ceil(total / pageSize);\n}\n\n/** Pins `page` into `[1, pageCount]`, rounding to the first page when it cannot be read. */\nfunction clampPage(page: number, pageCount: number): number {\n const upper = Math.max(1, Math.trunc(Number.isFinite(pageCount) ? pageCount : 1));\n const wanted = Number.isFinite(page) ? Math.trunc(page) : 1;\n return Math.min(upper, Math.max(1, wanted));\n}\n\n/**\n * The 1-based page numbers to show, keeping the current page as close to the\n * middle of the window as the ends allow. The window is clamped against\n * `windowSize` rather than a fixed `pageCount - 2`, so a non-default window\n * cannot emit page numbers past the last page.\n */\nfunction pageWindow(currentPage: number, pageCount: number, windowSize = 5): number[] {\n const count = Math.min(windowSize, pageCount);\n if (count <= 0) {\n return [];\n }\n const start = Math.max(1, Math.min(currentPage - Math.floor(windowSize / 2), pageCount - count + 1));\n return Array.from({ length: count }, (_, index) => start + index);\n}\n\n/** Overridable text, so an i18next app is not stuck with the English defaults. */\ninterface PaginationLabels {\n /** Prev-button accessible name / label. */\n previous?: string;\n /** Next-button accessible name / label. */\n next?: string;\n /** The \"Page X of Y\" summary in `compact` (and as the pager's `aria-label` in `full`). */\n summary?: (page: number, pageCount: number) => string;\n}\n\ninterface PaginationProps {\n /** The page being displayed, 1-based. Clamped into range for rendering. */\n page: number;\n /** Total pages. Omit to derive it from `total` and `pageSize`. */\n pageCount?: number;\n /** Total item count across every page. */\n total?: number;\n /** Items per page. */\n pageSize?: number;\n /** Called with the 1-based page to move to; already clamped into range. */\n onChange: (page: number) => void;\n /** `full` shows page numbers, `compact` shows a summary. */\n variant?: 'full' | 'compact';\n labels?: PaginationLabels;\n}\n\nfunction Pagination({\n page,\n pageCount,\n total,\n pageSize,\n onChange,\n variant = 'full',\n labels = {},\n}: Readonly<PaginationProps>): ReactElement | null {\n const derivedPageCount = pageCount ?? (total !== undefined && pageSize !== undefined ? pageCountFor(total, pageSize) : 1);\n const pages = Math.max(1, Math.trunc(Number.isFinite(derivedPageCount) ? derivedPageCount : 1));\n const current = clampPage(page, pages);\n const previousLabel = labels.previous ?? 'Previous';\n const nextLabel = labels.next ?? 'Next';\n const summaryLabel = labels.summary ?? ((page: number, count: number) => `Page ${page} of ${count}`);\n\n // Nothing to page: a single-page list shows no pager rather than a disabled one.\n if (pages <= 1) {\n return null;\n }\n\n const step = (next: number): void => {\n const target = clampPage(next, pages);\n if (target !== current) {\n onChange(target);\n }\n };\n\n const summary = <span className=\"text-xs text-[var(--color-text-muted)] tabular-nums\">{summaryLabel(current, pages)}</span>;\n\n return (\n <nav className=\"flex flex-wrap items-center gap-2\" aria-label={summaryLabel(current, pages)}>\n <Button variant=\"secondary\" size=\"sm\" disabled={current <= 1} onClick={() => step(current - 1)} aria-label={previousLabel}>\n {previousLabel}\n </Button>\n {variant === 'compact' ? (\n summary\n ) : (\n <div className=\"flex items-center gap-1\">\n {pageWindow(current, pages).map((pageNumber) => (\n <Button\n key={pageNumber}\n variant=\"secondary\"\n size=\"sm\"\n className={cn(pageNumber === current && 'bg-[var(--color-accent)] text-[#0d1008]')}\n aria-current={pageNumber === current ? 'page' : undefined}\n onClick={() => step(pageNumber)}\n >\n {pageNumber}\n </Button>\n ))}\n </div>\n )}\n <Button variant=\"secondary\" size=\"sm\" disabled={current >= pages} onClick={() => step(current + 1)} aria-label={nextLabel}>\n {nextLabel}\n </Button>\n </nav>\n );\n}\n\nexport { Pagination, clampPage, pageCountFor, pageWindow };\nexport type { PaginationLabels, PaginationProps };\n"]}
|
package/dist/ReadOnlyField.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId } from 'react';
|
|
3
3
|
import { Check, Copy } from 'lucide-react';
|
|
4
|
-
import { Label } from
|
|
5
|
-
import { cn } from
|
|
6
|
-
import { useCopyToClipboard } from
|
|
4
|
+
import { Label } from "./Input.js";
|
|
5
|
+
import { cn } from "./utils.js";
|
|
6
|
+
import { useCopyToClipboard } from "./useCopyToClipboard.js";
|
|
7
7
|
function ReadOnlyField({ label, value, showCopy = false, copyLabel, className }) {
|
|
8
8
|
const { copied, copy } = useCopyToClipboard();
|
|
9
9
|
// The four copies rendered `<Label>{label}</Label>` with no `htmlFor`, so the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadOnlyField.js","sourceRoot":"","sources":["../src/ReadOnlyField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAY,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ReadOnlyField.js","sourceRoot":"","sources":["../src/ReadOnlyField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAY,MAAM,OAAO,CAAC;AACxC,OA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Aa,EAAE,CAAC","sourcesContent":["import { useId, useState } from 'react';\nimport { Check, Copy } from 'lucide-react';\nimport { Label } from './Input.tsx';\nimport { cn } from './utils.ts';\nimport { useCopyToClipboard } from './useCopyToClipboard.ts';\n\n/**\n * A labelled, read-only value with an optional copy button.\n *\n * ## Provenance\n *\n * `components/shared/ReadOnlyField.tsx` in **Durable-DAV**, **Durable-DAV-Router**,\n * **Edge-Git** and **Mail-Otter** — four copies in two shapes. The three outside\n * Durable-DAV inlined the clipboard handler; Durable-DAV's called its\n * `useCopyToClipboard` hook, which is the version that converged into\n * `@rexezuge/web` and is the one this uses.\n *\n * ## The third bug, which all four copies carried\n *\n * Every copy rendered `<Label>{label}</Label>` with no `htmlFor`, so the value\n * input had **no accessible name** — announced as a bare \"edit text\" for a field\n * whose contents are, in every call site in the family, a credential or an\n * identifier. The click target and the name both depend on the `for`, and\n * neither is visible in the markup that omits it. `useId` pairs them here so a\n * caller cannot forget.\n *\n * The difference was not cosmetic. The inlined three called\n * `navigator.clipboard.writeText` unguarded, so on a plain-HTTP deployment the\n * handler threw synchronously before reporting anything — and where they did\n * guard it, a denied permission still showed the checkmark for a copy that never\n * happened. Every value this component is pointed at in the family is a secret\n * or an identifier, so the false success sends the operator away believing they\n * have something they do not. See `useCopyToClipboard` for both failures.\n */\n\ninterface ReadOnlyFieldProps {\n /** The field's label. */\n label: string;\n /** The value, shown verbatim and selectable. */\n value: string;\n /** Show the copy button. Defaults to false. */\n showCopy?: boolean;\n /**\n * The copy button's accessible name and tooltip.\n *\n * Required whenever `showCopy` is set — a copy button carrying only an icon is\n * announced as \"button\" with nothing else.\n */\n copyLabel?: string;\n /** Merged last onto the value's `<input>`. */\n className?: string;\n}\n\nfunction ReadOnlyField({ label, value, showCopy = false, copyLabel, className }: Readonly<ReadOnlyFieldProps>) {\n const { copied, copy } = useCopyToClipboard();\n // The four copies rendered `<Label>{label}</Label>` with no `htmlFor`, so the\n // value input had **no accessible name** — a screen reader announced a bare\n // \"edit text\" for a field holding a secret. The kit's own `Input.tsx` records\n // this hazard; `useId` pairs the label without asking a caller for an id.\n const inputId = useId();\n\n return (\n <div>\n <Label className=\"mb-1.5\" htmlFor={inputId}>\n {label}\n </Label>\n <div className=\"flex\">\n <input\n id={inputId}\n readOnly\n value={value}\n className={cn(\n 'min-w-0 px-3 py-2 bg-[var(--color-surface-base)] border border-[var(--color-border)] text-[var(--color-text-secondary)] text-sm flex-1',\n showCopy ? 'rounded-l-lg border-r-0' : 'rounded-lg',\n className,\n )}\n />\n {showCopy && (\n <button\n type=\"button\"\n onClick={() => copy(value)}\n title={copyLabel}\n aria-label={copyLabel}\n // `aria-live` so the confirmation is announced. The icon swap alone\n // is invisible to a screen reader, which would make the success\n // state silent for exactly the users copying a secret by hand.\n aria-live=\"polite\"\n className=\"px-3 py-2 rounded-r-lg bg-[var(--color-surface-3)] hover:bg-[var(--color-surface-4)] border border-[var(--color-border)] text-[var(--color-text-secondary)] transition-colors duration-150\"\n >\n {copied ? (\n <Check className=\"h-3.5 w-3.5 text-[var(--color-success-text)]\" aria-hidden=\"true\" />\n ) : (\n <Copy className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n )}\n </button>\n )}\n </div>\n </div>\n );\n}\n\nexport { ReadOnlyField };\nexport type { ReadOnlyFieldProps };\n"]}
|
package/dist/RefreshButton.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { RefreshCw } from 'lucide-react';
|
|
3
|
-
import { Button } from
|
|
3
|
+
import { Button } from "./Button.js";
|
|
4
4
|
function RefreshButton({ onRefresh, loading, label, className }) {
|
|
5
5
|
return (_jsxs(Button, { variant: "secondary", size: "sm", onClick: onRefresh, loading: loading, className: className, children: [_jsx(RefreshCw, { className: "h-3.5 w-3.5", "aria-hidden": "true" }), label] }));
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefreshButton.js","sourceRoot":"","sources":["../src/RefreshButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"RefreshButton.js","sourceRoot":"","sources":["../src/RefreshButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAc,CAAC;AAoCtC,SAAS,aAAa,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAgC;IAC3F,OAAO,CACL,MAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,aAC9F,KAAC,SAAS,IAAC,SAAS,EAAC,aAAa,iBAAa,MAAM,GAAG,EACvD,KAAK,IACC,CACV,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import { RefreshCw } from 'lucide-react';\nimport { Button } from './Button.tsx';\n\n/**\n * The refresh control.\n *\n * ## Provenance\n *\n * `components/shared/RefreshButton.tsx` in **Durable-DAV**, **Durable-DAV-Router**,\n * **Edge-Git** and **Mail-Otter** — four byte-identical copies.\n *\n * ## Why the icon stays but the label does not\n *\n * This is the one place the kit takes `lucide-react` as a peer, and the split is\n * deliberate. `RefreshCw` is iconography: reimplementing its path data in this\n * package would fork lucide's artwork and freeze it at whatever version the kit\n * vendored it. A label, by contrast, is the consuming app's string catalogue —\n * the app knows whether this reads \"Refresh\" or \"Neu laden\", and a kit that\n * hard-codes English text for it has taken over something it should not own.\n *\n * So: glyph in, string out. That is also why the kit's own `Button` keeps\n * using its own `Spinner` rather than lucide's `Loader2` — chrome is cheap to\n * draw, iconography is not.\n *\n * `loading` is passed straight through to `Button`, which already blocks\n * activation while busy, so a caller does not also thread `disabled`.\n */\n\ninterface RefreshButtonProps {\n onRefresh: () => void;\n /** Shows the spinner and blocks activation until the caller's work clears. */\n loading?: boolean;\n /** The button's text. */\n label: string;\n className?: string;\n}\n\nfunction RefreshButton({ onRefresh, loading, label, className }: Readonly<RefreshButtonProps>) {\n return (\n <Button variant=\"secondary\" size=\"sm\" onClick={onRefresh} loading={loading} className={className}>\n <RefreshCw className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n {label}\n </Button>\n );\n}\n\nexport { RefreshButton };\nexport type { RefreshButtonProps };\n"]}
|
package/dist/Spinner.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { theme } from
|
|
2
|
+
import { theme } from "./theme.js";
|
|
3
3
|
function Spinner({ size = 24, color = theme.spinnerBlue, label, padding = '16px 0', style }) {
|
|
4
4
|
return (_jsxs("div", { style: { textAlign: 'center', padding, ...style }, children: [_jsx("div", { className: "animate-spin", "aria-hidden": "true", style: {
|
|
5
5
|
width: `${size}px`,
|
package/dist/Spinner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.js","sourceRoot":"","sources":["../src/Spinner.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Spinner.js","sourceRoot":"","sources":["../src/Spinner.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AA8BnC,SAAS,OAAO,CAAC,EAAE,IAAI,GAAG,EAAE,EAAE,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE,OAAO,GAAG,QAAQ,EAAE,KAAK,EAA0B;IACjH,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,aACpD,cACE,SAAS,EAAC,cAAc,iBACZ,MAAM,EAClB,KAAK,EAAE;oBACL,KAAK,EAAE,GAAG,IAAI,IAAI;oBAClB,MAAM,EAAE,GAAG,IAAI,IAAI;oBACnB,YAAY,EAAE,KAAK;oBACnB,MAAM,EAAE,aAAa,KAAK,EAAE;oBAC5B,cAAc,EAAE,aAAa;oBAC7B,MAAM,EAAE,QAAQ;iBACjB,GACD,EACD,KAAK,CAAC,CAAC,CAAC,YAAG,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,YAAG,KAAK,GAAK,CAAC,CAAC,CAAC,IAAI,IAC1E,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import type { CSSProperties } from 'react';\nimport { theme } from './theme.ts';\n\n/**\n * The loading ring.\n *\n * ## Provenance\n *\n * `components/ui/Spinner.tsx` in **AWS-AccessBridge** — the only named spinner\n * in the family. The other repos inline the same ring into their buttons as a\n * `Loader2` icon from `lucide-react`, which the kit does not depend on, so this\n * component *is* the kit's spinner vocabulary: `Button` and `LoadingButton`\n * render it while busy.\n *\n * The ring is a bordered circle with one transparent edge, animated by\n * Tailwind's `animate-spin` (present in every consuming app's stylesheet).\n */\n\ninterface SpinnerProps {\n /** Diameter in pixels. */\n size?: number;\n /** Border colour; `currentColor` inherits from the surrounding text. */\n color?: string;\n /** Optional caption under the ring. */\n label?: string;\n /** Padding around the whole block, as a CSS shorthand. */\n padding?: string;\n /** Extra styles for the outer wrapper. */\n style?: CSSProperties;\n}\n\nfunction Spinner({ size = 24, color = theme.spinnerBlue, label, padding = '16px 0', style }: Readonly<SpinnerProps>): React.JSX.Element {\n return (\n <div style={{ textAlign: 'center', padding, ...style }}>\n <div\n className=\"animate-spin\"\n aria-hidden=\"true\"\n style={{\n width: `${size}px`,\n height: `${size}px`,\n borderRadius: '50%',\n border: `2px solid ${color}`,\n borderTopColor: 'transparent',\n margin: '0 auto',\n }}\n />\n {label ? <p style={{ color: '#9ca3af', marginTop: '12px' }}>{label}</p> : null}\n </div>\n );\n}\n\nexport { Spinner };\nexport type { SpinnerProps };\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { AlertTriangle, Check, Copy } from 'lucide-react';
|
|
4
|
-
import { Button } from
|
|
5
|
-
import { Input, Label } from
|
|
6
|
-
import { ModalShell } from
|
|
7
|
-
import { useCopyToClipboard } from
|
|
4
|
+
import { Button } from "./Button.js";
|
|
5
|
+
import { Input, Label } from "./Input.js";
|
|
6
|
+
import { ModalShell } from "./ModalShell.js";
|
|
7
|
+
import { useCopyToClipboard } from "./useCopyToClipboard.js";
|
|
8
8
|
function TypeToConfirmModal({ title, description, expectedName, confirmLabel, cancelLabel, copyLabel, promptLabel, onConfirm, onCancel, loading = false, }) {
|
|
9
9
|
const [input, setInput] = useState('');
|
|
10
10
|
const { copied, copy } = useCopyToClipboard();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeToConfirmModal.js","sourceRoot":"","sources":["../src/TypeToConfirmModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"TypeToConfirmModal.js","sourceRoot":"","sources":["../src/TypeToConfirmModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAc,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,YAAa,CAAC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M,GAAG,CACpD,GACM,IACL,EACN,eAAK,SAAS,EAAC,kBAAkB,aAC/B,KAAC,KAAK,IAAC,OAAO,EAAC,sBAAsB,YAAE,WAAW,GAAS,EAC3D,KAAC,KAAK,IACJ,EAAE,EAAC,sBAAsB,EACzB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACjD,WAAW,EAAE,YAAY,EACzB,YAAY,EAAC,KAAK,EAClB,SAAS,SACT,IACE,EACN,eAAK,SAAS,EAAC,YAAY,aACzB,KAAC,MAAM,IACL,OAAO,EAAC,OAAO,EACf,SAAS,EAAC,QAAQ,EAClB,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;gCACjB,KAAK,CAAC,eAAe,EAAE,CAAC;gCACxB,QAAQ,EAAE,CAAC;4BACb,CAAC,YAEA,WAAW,GACL,EACT,KAAC,MAAM,IACL,OAAO,EAAC,QAAQ,EAChB,SAAS,EAAC,QAAQ;4BAClB,kEAAkE;4BAClE,gEAAgE;4BAChE,QAAQ,EAAE,CAAC,OAAO,EAClB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;gCACjB,KAAK,CAAC,eAAe,EAAE,CAAC;gCACxB,SAAS,EAAE,CAAC;4BACd,CAAC,YAEA,YAAY,GACN,IACL,IACF,GACK,CACd,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import { useState } from 'react';\nimport { AlertTriangle, Check, Copy } from 'lucide-react';\nimport { Button } from './Button.tsx';\nimport { Input, Label } from './Input.tsx';\nimport { ModalShell } from './ModalShell.tsx';\nimport { useCopyToClipboard } from './useCopyToClipboard.ts';\n\n/**\n * The \"type the name to confirm this destructive action\" dialog.\n *\n * ## Provenance\n *\n * `components/modals/TypeToConfirmModal.tsx` in **Durable-DAV**,\n * **Durable-DAV-Router**, **Edge-Git** and **Mail-Otter** — four copies that\n * agreed on the interaction and each carried its own clipboard handler.\n *\n * ## Why this exists alongside `ConfirmDeleteModal`\n *\n * The two are not interchangeable, and merging them would lose the distinction\n * that makes either useful. A confirmation whose button is always armed asks\n * nothing of the operator; this one requires typing the exact name, which is\n * the right price for deleting a volume, a branch, or a credential. A repo\n * that wants the cheap one uses {@link ConfirmDeleteModal}; a repo that wants\n * this one names the thing twice.\n *\n * ## The match is exact, not case-insensitive\n *\n * All four copies compared `input.trim() === expectedName`. That is\n * intentional and is kept: a confirmation the operator has to get exactly right\n * is a confirmation they read. Trimming is allowed because it is invisible; case\n * folding is not, because a name differing only in case may well be a different\n * resource on a case-insensitive backend.\n */\n\ninterface TypeToConfirmModalProps {\n /** The dialog's heading, and its accessible name. */\n title: string;\n /** The line under the heading, explaining what happens on confirm. */\n description: string;\n /** The string the operator must type. Shown, and offered as a copy. */\n expectedName: string;\n confirmLabel: string;\n cancelLabel: string;\n /** The copy button's accessible name and tooltip. */\n copyLabel: string;\n /** The prompt over the input. Name the thing: `Type \"prod\" to confirm`. */\n promptLabel: string;\n onConfirm: () => void;\n onCancel: () => void;\n loading?: boolean;\n}\n\nfunction TypeToConfirmModal({\n title,\n description,\n expectedName,\n confirmLabel,\n cancelLabel,\n copyLabel,\n promptLabel,\n onConfirm,\n onCancel,\n loading = false,\n}: Readonly<TypeToConfirmModalProps>) {\n const [input, setInput] = useState('');\n const { copied, copy } = useCopyToClipboard();\n\n const matched = input.trim() === expectedName;\n\n return (\n // `closeLabel` is deliberately not `cancelLabel`: a dialog whose corner\n // close button and body cancel button share a name is announced as two\n // identical buttons. `ModalShell` defaults it to \"Close\" for that reason.\n <ModalShell onClose={onCancel} widthClass=\"w-full max-w-md mx-4\" ariaLabel={title}>\n <div className=\"p-6\">\n <div className=\"flex items-center justify-center w-10 h-10 rounded-full bg-[var(--color-error-bg)] mb-4 mx-auto\">\n <AlertTriangle className=\"h-5 w-5 text-[var(--color-error-text)]\" aria-hidden=\"true\" />\n </div>\n <h2 className=\"text-base font-semibold text-[var(--color-text-primary)] text-center mb-2\">{title}</h2>\n <p className=\"text-sm text-[var(--color-text-secondary)] text-center mb-4\">{description}</p>\n <div className=\"flex items-center justify-center gap-2 mb-4\">\n <code className=\"px-2.5 py-1.5 rounded-lg bg-[var(--color-surface-base)] border border-[var(--color-border)] text-sm font-mono text-[var(--color-text-primary)] break-all\">\n {expectedName}\n </code>\n <button\n type=\"button\"\n onClick={() => copy(expectedName)}\n title={copyLabel}\n aria-label={copyLabel}\n className=\"px-2.5 py-2 rounded-lg bg-[var(--color-surface-3)] hover:bg-[var(--color-surface-4)] border border-[var(--color-border)] text-[var(--color-text-secondary)] transition-colors duration-150\"\n >\n {copied ? (\n <Check className=\"h-3.5 w-3.5 text-[var(--color-success-text)]\" aria-hidden=\"true\" />\n ) : (\n <Copy className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n )}\n </button>\n </div>\n <div className=\"space-y-1.5 mb-6\">\n <Label htmlFor=\"danger-confirm-input\">{promptLabel}</Label>\n <Input\n id=\"danger-confirm-input\"\n value={input}\n onChange={(event) => setInput(event.target.value)}\n placeholder={expectedName}\n autoComplete=\"off\"\n autoFocus\n />\n </div>\n <div className=\"flex gap-3\">\n <Button\n variant=\"ghost\"\n className=\"flex-1\"\n onClick={(event) => {\n event.stopPropagation();\n onCancel();\n }}\n >\n {cancelLabel}\n </Button>\n <Button\n variant=\"danger\"\n className=\"flex-1\"\n // Armed only on an exact match. `loading` is forwarded separately\n // so a confirm already in flight cannot be fired a second time.\n disabled={!matched}\n loading={loading}\n onClick={(event) => {\n event.stopPropagation();\n onConfirm();\n }}\n >\n {confirmLabel}\n </Button>\n </div>\n </div>\n </ModalShell>\n );\n}\n\nexport { TypeToConfirmModal };\nexport type { TypeToConfirmModalProps };\n"]}
|
package/dist/Unauthorized.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ZERO_TRUST_AUTHENTICATION_PATH } from
|
|
2
|
+
import { ZERO_TRUST_AUTHENTICATION_PATH } from "./constants.js";
|
|
3
3
|
function Unauthorized({ title, message, actionLabel, onAuthenticate }) {
|
|
4
4
|
const authenticate = onAuthenticate ??
|
|
5
5
|
(() => {
|
package/dist/Unauthorized.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Unauthorized.js","sourceRoot":"","sources":["../src/Unauthorized.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Unauthorized.js","sourceRoot":"","sources":["../src/Unauthorized.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AA6ChE,SAAS,YAAY,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAA+B;IAChG,MAAM,YAAY,GAChB,cAAc;QACd,CAAC,GAAS,EAAE;YACV,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,8BAA8B,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IAEL,OAAO,CACL,cAAK,SAAS,EAAC,wGAAwG,YACrH,eAAK,SAAS,EAAC,kBAAkB,aAC/B,aAAI,SAAS,EAAC,+BAA+B,YAAE,KAAK,GAAM,EACzD,OAAO,IAAI,YAAG,SAAS,EAAC,4CAA4C,YAAE,OAAO,GAAK,EACnF,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,YAAY,EACrB,SAAS,EAAC,+SAA+S,YAExT,WAAW,GACL,IACL,GACF,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { ZERO_TRUST_AUTHENTICATION_PATH } from './constants.ts';\n\n/**\n * The \"you are not signed in\" page.\n *\n * ## Provenance\n *\n * `components/layout/Unauthorized.tsx` in **Durable-DAV**, **Durable-DAV-Router**,\n * **Edge-Git**, **Mail-Otter** and **Edge-Sonic** — five copies, byte-identical\n * apart from the doc comment — plus `Unauthorized.tsx` at the components root\n * in **AWS-AccessBridge** and **CalDAV-Bridge**.\n *\n * ## Why `onAuthenticate` is an argument and not a fixed `location.assign`\n *\n * All seven copies hard-coded `globalThis.location.assign(ZERO_TRUST_AUTHENTICATION_PATH)`.\n * That is untestable — jsdom refuses to navigate, so the one branch that\n * matters (what happens when the operator actually clicks the button) had no\n * assertions at all — and it hard-codes a routing assumption into a component\n * that a repo may not share.\n *\n * The default keeps the original behaviour for a repo that wants it, and a\n * caller with a different sign-in route passes its own.\n */\n\ninterface UnauthorizedProps {\n /** The heading. Required: this is the page's only `h1`. */\n title: string;\n /**\n * Why they are being stopped.\n *\n * Optional, and `null`/omitted renders no paragraph rather than an empty one.\n * A blank line under the heading reads as a rendering bug.\n */\n message?: string;\n /** The sign-in button's label. Required. */\n actionLabel: string;\n /**\n * What the button does.\n *\n * Defaults to navigating to {@link ZERO_TRUST_AUTHENTICATION_PATH}, which is\n * what every copy in the family did.\n */\n onAuthenticate?: () => void;\n}\n\nfunction Unauthorized({ title, message, actionLabel, onAuthenticate }: Readonly<UnauthorizedProps>) {\n const authenticate =\n onAuthenticate ??\n ((): void => {\n globalThis.location.assign(ZERO_TRUST_AUTHENTICATION_PATH);\n });\n\n return (\n <div className=\"bg-[var(--color-surface-base)] text-[var(--color-text-primary)] flex items-center justify-center py-16\">\n <div className=\"text-center px-6\">\n <h1 className=\"text-lg font-medium mt-4 mb-1\">{title}</h1>\n {message && <p className=\"text-[var(--color-text-secondary)] text-sm\">{message}</p>}\n <button\n type=\"button\"\n onClick={authenticate}\n className=\"mt-6 inline-flex items-center justify-center rounded-xl bg-[var(--color-accent)] px-5 py-2.5 text-sm font-medium text-[#0d1008] transition-colors hover:bg-[var(--color-accent-dim)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--color-accent)]\"\n >\n {actionLabel}\n </button>\n </div>\n </div>\n );\n}\n\nexport { Unauthorized };\nexport type { UnauthorizedProps };\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -51,55 +51,55 @@
|
|
|
51
51
|
* exactly one consumer, so each stays with it — see `constants.ts` and the
|
|
52
52
|
* per-module provenance notes for the list.
|
|
53
53
|
*/
|
|
54
|
-
export { Badge, badgeBaseClass, badgeClass, badgeVariantClass } from './Badge';
|
|
55
|
-
export type { BadgeProps, BadgeVariant } from './Badge';
|
|
56
|
-
export { Button, buttonBaseClass, buttonClass, buttonSizeClass, buttonVariantClass } from './Button';
|
|
57
|
-
export type { ButtonProps, ButtonSize, ButtonVariant } from './Button';
|
|
58
|
-
export { Card, cardClass, cardHeaderClass, cardTitleClass, CardHeader, CardTitle } from './Card';
|
|
59
|
-
export type { CardHeaderProps, CardProps, CardTitleProps } from './Card';
|
|
60
|
-
export { FocusInput } from './FocusInput';
|
|
61
|
-
export type { FocusInputProps } from './FocusInput';
|
|
62
|
-
export { Input, Label, Select, Textarea, fieldClass } from './Input';
|
|
63
|
-
export type { InputProps, LabelProps, SelectProps, TextareaProps } from './Input';
|
|
64
|
-
export { LoadingButton } from './LoadingButton';
|
|
65
|
-
export type { LoadingButtonProps } from './LoadingButton';
|
|
66
|
-
export { ModalShell } from './ModalShell';
|
|
67
|
-
export type { ModalShellProps } from './ModalShell';
|
|
68
|
-
export { ConfirmDeleteModal, EmptyState, LoadingSpinner } from './PageState';
|
|
69
|
-
export { AppPage } from './AppPage';
|
|
70
|
-
export type { AppPageProps, AppPageVariant } from './AppPage';
|
|
71
|
-
export { PageHeaderCard } from './PageHeaderCard';
|
|
72
|
-
export type { PageHeaderCardProps } from './PageHeaderCard';
|
|
73
|
-
export { ContextBar } from './ContextBar';
|
|
74
|
-
export type { ContextBarProps } from './ContextBar';
|
|
75
|
-
export { Unauthorized } from './Unauthorized';
|
|
76
|
-
export type { UnauthorizedProps } from './Unauthorized';
|
|
77
|
-
export { NoticeBar } from './NoticeBar';
|
|
78
|
-
export type { NoticeBarProps, NoticeStatusLabels } from './NoticeBar';
|
|
79
|
-
export { LanguageSelector } from './LanguageSelector';
|
|
80
|
-
export type { LanguageSelectorProps } from './LanguageSelector';
|
|
81
|
-
export { RefreshButton } from './RefreshButton';
|
|
82
|
-
export type { RefreshButtonProps } from './RefreshButton';
|
|
83
|
-
export { ReadOnlyField } from './ReadOnlyField';
|
|
84
|
-
export type { ReadOnlyFieldProps } from './ReadOnlyField';
|
|
85
|
-
export { TypeToConfirmModal } from './TypeToConfirmModal';
|
|
86
|
-
export type { TypeToConfirmModalProps } from './TypeToConfirmModal';
|
|
87
|
-
export { useCopyToClipboard } from './useCopyToClipboard';
|
|
88
|
-
export type { UseCopyToClipboardResult } from './useCopyToClipboard';
|
|
89
|
-
export { Pagination, clampPage, pageCountFor, pageWindow } from './Pagination';
|
|
90
|
-
export type { PaginationLabels, PaginationProps } from './Pagination';
|
|
91
|
-
export { Spinner } from './Spinner';
|
|
92
|
-
export type { SpinnerProps } from './Spinner';
|
|
93
|
-
export { btnBase, btnBlueStyle, btnGreenStyle, btnSmallStyle, buttonColors, cardStyle, inputStyle, paginationBtnStyle, tableCardStyle, tdStyle, theme, thStyle, } from './theme';
|
|
94
|
-
export { cn } from './utils';
|
|
95
|
-
export type { ClassDictionary, ClassValue } from './utils';
|
|
96
|
-
export { COPY_FEEDBACK_TIMEOUT_MS, NOTICE_TIMEOUT_MS, ZERO_TRUST_AUTHENTICATION_PATH } from './constants';
|
|
97
|
-
export { useNotice } from './useNotice';
|
|
98
|
-
export type { Notice, NoticeKind, ShowNotice, UseNoticeOptions, UseNoticeResult } from './useNotice';
|
|
99
|
-
export { canonicalizeLanguageTag, DEFAULT_FALLBACK_LANGUAGE, DEFAULT_LANGUAGE_STORAGE_KEY, DEFAULT_SUPPORTED_LANGUAGES, resolveLanguageTag, useSpaLanguage, } from './useSpaLanguage';
|
|
100
|
-
export type { LanguageTag, UseSpaLanguageOptions, UseSpaLanguageResult } from './useSpaLanguage';
|
|
101
|
-
export { CURRENT_USER_PATH, useCurrentUser } from './useCurrentUser';
|
|
102
|
-
export type { CurrentUser, UseCurrentUserOptions, UseCurrentUserResult } from './useCurrentUser';
|
|
103
|
-
export { buildQuery, createApiClient, HttpStatusError, MAX_ERROR_MESSAGE_LENGTH } from './api';
|
|
104
|
-
export type { ApiClient, ApiRequestInit, CreateApiClientOptions, FetchFn, QueryParams, QueryValue } from './api';
|
|
54
|
+
export { Badge, badgeBaseClass, badgeClass, badgeVariantClass } from './Badge.tsx';
|
|
55
|
+
export type { BadgeProps, BadgeVariant } from './Badge.tsx';
|
|
56
|
+
export { Button, buttonBaseClass, buttonClass, buttonSizeClass, buttonVariantClass } from './Button.tsx';
|
|
57
|
+
export type { ButtonProps, ButtonSize, ButtonVariant } from './Button.tsx';
|
|
58
|
+
export { Card, cardClass, cardHeaderClass, cardTitleClass, CardHeader, CardTitle } from './Card.tsx';
|
|
59
|
+
export type { CardHeaderProps, CardProps, CardTitleProps } from './Card.tsx';
|
|
60
|
+
export { FocusInput } from './FocusInput.tsx';
|
|
61
|
+
export type { FocusInputProps } from './FocusInput.tsx';
|
|
62
|
+
export { Input, Label, Select, Textarea, fieldClass } from './Input.tsx';
|
|
63
|
+
export type { InputProps, LabelProps, SelectProps, TextareaProps } from './Input.tsx';
|
|
64
|
+
export { LoadingButton } from './LoadingButton.tsx';
|
|
65
|
+
export type { LoadingButtonProps } from './LoadingButton.tsx';
|
|
66
|
+
export { ModalShell } from './ModalShell.tsx';
|
|
67
|
+
export type { ModalShellProps } from './ModalShell.tsx';
|
|
68
|
+
export { ConfirmDeleteModal, EmptyState, LoadingSpinner } from './PageState.tsx';
|
|
69
|
+
export { AppPage } from './AppPage.tsx';
|
|
70
|
+
export type { AppPageProps, AppPageVariant } from './AppPage.tsx';
|
|
71
|
+
export { PageHeaderCard } from './PageHeaderCard.tsx';
|
|
72
|
+
export type { PageHeaderCardProps } from './PageHeaderCard.tsx';
|
|
73
|
+
export { ContextBar } from './ContextBar.tsx';
|
|
74
|
+
export type { ContextBarProps } from './ContextBar.tsx';
|
|
75
|
+
export { Unauthorized } from './Unauthorized.tsx';
|
|
76
|
+
export type { UnauthorizedProps } from './Unauthorized.tsx';
|
|
77
|
+
export { NoticeBar } from './NoticeBar.tsx';
|
|
78
|
+
export type { NoticeBarProps, NoticeStatusLabels } from './NoticeBar.tsx';
|
|
79
|
+
export { LanguageSelector } from './LanguageSelector.tsx';
|
|
80
|
+
export type { LanguageSelectorProps } from './LanguageSelector.tsx';
|
|
81
|
+
export { RefreshButton } from './RefreshButton.tsx';
|
|
82
|
+
export type { RefreshButtonProps } from './RefreshButton.tsx';
|
|
83
|
+
export { ReadOnlyField } from './ReadOnlyField.tsx';
|
|
84
|
+
export type { ReadOnlyFieldProps } from './ReadOnlyField.tsx';
|
|
85
|
+
export { TypeToConfirmModal } from './TypeToConfirmModal.tsx';
|
|
86
|
+
export type { TypeToConfirmModalProps } from './TypeToConfirmModal.tsx';
|
|
87
|
+
export { useCopyToClipboard } from './useCopyToClipboard.ts';
|
|
88
|
+
export type { UseCopyToClipboardResult } from './useCopyToClipboard.ts';
|
|
89
|
+
export { Pagination, clampPage, pageCountFor, pageWindow } from './Pagination.tsx';
|
|
90
|
+
export type { PaginationLabels, PaginationProps } from './Pagination.tsx';
|
|
91
|
+
export { Spinner } from './Spinner.tsx';
|
|
92
|
+
export type { SpinnerProps } from './Spinner.tsx';
|
|
93
|
+
export { btnBase, btnBlueStyle, btnGreenStyle, btnSmallStyle, buttonColors, cardStyle, inputStyle, paginationBtnStyle, tableCardStyle, tdStyle, theme, thStyle, } from './theme.ts';
|
|
94
|
+
export { cn } from './utils.ts';
|
|
95
|
+
export type { ClassDictionary, ClassValue } from './utils.ts';
|
|
96
|
+
export { COPY_FEEDBACK_TIMEOUT_MS, NOTICE_TIMEOUT_MS, ZERO_TRUST_AUTHENTICATION_PATH } from './constants.ts';
|
|
97
|
+
export { useNotice } from './useNotice.ts';
|
|
98
|
+
export type { Notice, NoticeKind, ShowNotice, UseNoticeOptions, UseNoticeResult } from './useNotice.ts';
|
|
99
|
+
export { canonicalizeLanguageTag, DEFAULT_FALLBACK_LANGUAGE, DEFAULT_LANGUAGE_STORAGE_KEY, DEFAULT_SUPPORTED_LANGUAGES, resolveLanguageTag, useSpaLanguage, } from './useSpaLanguage.ts';
|
|
100
|
+
export type { LanguageTag, UseSpaLanguageOptions, UseSpaLanguageResult } from './useSpaLanguage.ts';
|
|
101
|
+
export { CURRENT_USER_PATH, useCurrentUser } from './useCurrentUser.ts';
|
|
102
|
+
export type { CurrentUser, UseCurrentUserOptions, UseCurrentUserResult } from './useCurrentUser.ts';
|
|
103
|
+
export { buildQuery, createApiClient, HttpStatusError, MAX_ERROR_MESSAGE_LENGTH } from './api.ts';
|
|
104
|
+
export type { ApiClient, ApiRequestInit, CreateApiClientOptions, FetchFn, QueryParams, QueryValue } from './api.ts';
|
|
105
105
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACnF,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE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AwB,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAE7G,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAExG,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,4BAA4B,EAC5B,2BAA2B,EAC3B,kBAAkB,EAClB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,WAAW,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEpG,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACxE,YAAY,EAAE,WAAW,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEpG,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAClG,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,sBAAsB,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -51,39 +51,39 @@
|
|
|
51
51
|
* exactly one consumer, so each stays with it — see `constants.ts` and the
|
|
52
52
|
* per-module provenance notes for the list.
|
|
53
53
|
*/
|
|
54
|
-
export { Badge, badgeBaseClass, badgeClass, badgeVariantClass } from
|
|
55
|
-
export { Button, buttonBaseClass, buttonClass, buttonSizeClass, buttonVariantClass } from
|
|
56
|
-
export { Card, cardClass, cardHeaderClass, cardTitleClass, CardHeader, CardTitle } from
|
|
57
|
-
export { FocusInput } from
|
|
58
|
-
export { Input, Label, Select, Textarea, fieldClass } from
|
|
59
|
-
export { LoadingButton } from
|
|
54
|
+
export { Badge, badgeBaseClass, badgeClass, badgeVariantClass } from "./Badge.js";
|
|
55
|
+
export { Button, buttonBaseClass, buttonClass, buttonSizeClass, buttonVariantClass } from "./Button.js";
|
|
56
|
+
export { Card, cardClass, cardHeaderClass, cardTitleClass, CardHeader, CardTitle } from "./Card.js";
|
|
57
|
+
export { FocusInput } from "./FocusInput.js";
|
|
58
|
+
export { Input, Label, Select, Textarea, fieldClass } from "./Input.js";
|
|
59
|
+
export { LoadingButton } from "./LoadingButton.js";
|
|
60
60
|
// Converged from the `ModalShell` / `ConfirmDeleteModal` / `PageState` copies
|
|
61
61
|
// that Durable-DAV, Durable-DAV-Router, Mail-Otter and Edge-Git each shipped.
|
|
62
62
|
// Deliberately dependency-free — labels are props, not `useTranslation` — so
|
|
63
63
|
// adopting these does not require a translation library or an icon set.
|
|
64
|
-
export { ModalShell } from
|
|
65
|
-
export { ConfirmDeleteModal, EmptyState, LoadingSpinner } from
|
|
64
|
+
export { ModalShell } from "./ModalShell.js";
|
|
65
|
+
export { ConfirmDeleteModal, EmptyState, LoadingSpinner } from "./PageState.js";
|
|
66
66
|
// The second convergence round: page layout, the notice banner, the access
|
|
67
67
|
// page, the language picker, and the two clipboard-bearing controls. Same rule
|
|
68
68
|
// on labels — the app owns its string catalogue. Three of these need
|
|
69
69
|
// `lucide-react`, which is why it is a peer and not a dependency.
|
|
70
|
-
export { AppPage } from
|
|
71
|
-
export { PageHeaderCard } from
|
|
72
|
-
export { ContextBar } from
|
|
73
|
-
export { Unauthorized } from
|
|
74
|
-
export { NoticeBar } from
|
|
75
|
-
export { LanguageSelector } from
|
|
76
|
-
export { RefreshButton } from
|
|
77
|
-
export { ReadOnlyField } from
|
|
78
|
-
export { TypeToConfirmModal } from
|
|
79
|
-
export { useCopyToClipboard } from
|
|
80
|
-
export { Pagination, clampPage, pageCountFor, pageWindow } from
|
|
81
|
-
export { Spinner } from
|
|
82
|
-
export { btnBase, btnBlueStyle, btnGreenStyle, btnSmallStyle, buttonColors, cardStyle, inputStyle, paginationBtnStyle, tableCardStyle, tdStyle, theme, thStyle, } from
|
|
83
|
-
export { cn } from
|
|
84
|
-
export { COPY_FEEDBACK_TIMEOUT_MS, NOTICE_TIMEOUT_MS, ZERO_TRUST_AUTHENTICATION_PATH } from
|
|
85
|
-
export { useNotice } from
|
|
86
|
-
export { canonicalizeLanguageTag, DEFAULT_FALLBACK_LANGUAGE, DEFAULT_LANGUAGE_STORAGE_KEY, DEFAULT_SUPPORTED_LANGUAGES, resolveLanguageTag, useSpaLanguage, } from
|
|
87
|
-
export { CURRENT_USER_PATH, useCurrentUser } from
|
|
88
|
-
export { buildQuery, createApiClient, HttpStatusError, MAX_ERROR_MESSAGE_LENGTH } from
|
|
70
|
+
export { AppPage } from "./AppPage.js";
|
|
71
|
+
export { PageHeaderCard } from "./PageHeaderCard.js";
|
|
72
|
+
export { ContextBar } from "./ContextBar.js";
|
|
73
|
+
export { Unauthorized } from "./Unauthorized.js";
|
|
74
|
+
export { NoticeBar } from "./NoticeBar.js";
|
|
75
|
+
export { LanguageSelector } from "./LanguageSelector.js";
|
|
76
|
+
export { RefreshButton } from "./RefreshButton.js";
|
|
77
|
+
export { ReadOnlyField } from "./ReadOnlyField.js";
|
|
78
|
+
export { TypeToConfirmModal } from "./TypeToConfirmModal.js";
|
|
79
|
+
export { useCopyToClipboard } from "./useCopyToClipboard.js";
|
|
80
|
+
export { Pagination, clampPage, pageCountFor, pageWindow } from "./Pagination.js";
|
|
81
|
+
export { Spinner } from "./Spinner.js";
|
|
82
|
+
export { btnBase, btnBlueStyle, btnGreenStyle, btnSmallStyle, buttonColors, cardStyle, inputStyle, paginationBtnStyle, tableCardStyle, tdStyle, theme, thStyle, } from "./theme.js";
|
|
83
|
+
export { cn } from "./utils.js";
|
|
84
|
+
export { COPY_FEEDBACK_TIMEOUT_MS, NOTICE_TIMEOUT_MS, ZERO_TRUST_AUTHENTICATION_PATH } from "./constants.js";
|
|
85
|
+
export { useNotice } from "./useNotice.js";
|
|
86
|
+
export { canonicalizeLanguageTag, DEFAULT_FALLBACK_LANGUAGE, DEFAULT_LANGUAGE_STORAGE_KEY, DEFAULT_SUPPORTED_LANGUAGES, resolveLanguageTag, useSpaLanguage, } from "./useSpaLanguage.js";
|
|
87
|
+
export { CURRENT_USER_PATH, useCurrentUser } from "./useCurrentUser.js";
|
|
88
|
+
export { buildQuery, createApiClient, HttpStatusError, MAX_ERROR_MESSAGE_LENGTH } from "./api.js";
|
|
89
89
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAa,CAAC;AAGnF,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAc,CAAC;AAGzG,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAY,CAAC;AAGrG,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAC;AAG9C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAa,CAAC;AAGzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAC;AAGpD,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,wEAAwE;AACxE,OAAO,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ACzB,4BAA4B,EAC5B,2BAA2B,EAC3B,kBAAkB,EAClB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGxE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC","sourcesContent":["/**\n * `@rexezuge/web` — the SPA layer of the kit.\n *\n * React primitives, the hooks every app's shell needs, and the one API client.\n * Every export is the converged form of a framework that lived as copies inside\n * the nine consumer repos; see the `## Provenance` block at the top of each\n * module for what it replaced and which copy won.\n *\n * ```ts\n * import { AppPage, Button, Card, createApiClient, useCurrentUser, useNotice, useSpaLanguage } from '@rexezuge/web';\n * ```\n *\n * ## What a consumer must provide\n *\n * - **The CSS variables the class-based components read.** All six Tailwind\n * repos define the same set, so this is usually already present:\n * `--color-accent`, `--color-accent-dim`, `--color-border`,\n * `--color-surface-base`, `--color-surface-1..4`,\n * `--color-text-primary`, `--color-text-secondary`, `--color-text-muted`, and\n * `--color-{success,error,warning,info,neutral}-{bg,text}`.\n * - **`animate-spin`**, for `Spinner` (and therefore `Button`'s busy state).\n * Tailwind ships it; a non-Tailwind app defines the keyframes once.\n * - **A dependency on `@rexezuge/errors`**, which `api.ts` imports for\n * `ServiceError` and the status classes.\n *\n * ## Glyphs in, strings out\n *\n * Three components (`RefreshButton`, `ReadOnlyField`, `TypeToConfirmModal`) take\n * their icon from `lucide-react`, which is why it is a peer rather than a\n * dependency. Everything *sayable* is a prop: no component here calls\n * `useTranslation`, because the app rendering a dialog knows what it says and a\n * kit that hard-codes English for it has taken over the app's string catalogue.\n *\n * The dividing line is deliberate. `Button` keeps using this package's own\n * `Spinner` rather than lucide's `Loader2` — chrome is cheap to draw, iconography\n * is not, and vendoring a glyph's path data freezes it at whatever version was\n * current when it was copied.\n *\n * ## Migrating the copies\n *\n * `codemods/` rewrites the family's `../components/…` imports onto this package\n * for every component converged here, and names the ones it has not. Those\n * imports are **relative**, so this is a separate transform from the\n * `@scope/pkg` one — see `codemods/src/web-components.ts`.\n *\n * ## What is deliberately not here\n *\n * Domain badges (`ConnectionBadge`, `TaskRunStatusBadge`, …), the OAuth\n * `?oauth2=` notice seeding, the D1 bookmark header, WebDAV `207` handling, the\n * authed-first public fallback, and every app's `SUPPORTED_LANGUAGES`. Each had\n * exactly one consumer, so each stays with it — see `constants.ts` and the\n * per-module provenance notes for the list.\n */\n\nexport { Badge, badgeBaseClass, badgeClass, badgeVariantClass } from './Badge.tsx';\nexport type { BadgeProps, BadgeVariant } from './Badge.tsx';\n\nexport { Button, buttonBaseClass, buttonClass, buttonSizeClass, buttonVariantClass } from './Button.tsx';\nexport type { ButtonProps, ButtonSize, ButtonVariant } from './Button.tsx';\n\nexport { Card, cardClass, cardHeaderClass, cardTitleClass, CardHeader, CardTitle } from './Card.tsx';\nexport type { CardHeaderProps, CardProps, CardTitleProps } from './Card.tsx';\n\nexport { FocusInput } from './FocusInput.tsx';\nexport type { FocusInputProps } from './FocusInput.tsx';\n\nexport { Input, Label, Select, Textarea, fieldClass } from './Input.tsx';\nexport type { InputProps, LabelProps, SelectProps, TextareaProps } from './Input.tsx';\n\nexport { LoadingButton } from './LoadingButton.tsx';\nexport type { LoadingButtonProps } from './LoadingButton.tsx';\n\n// Converged from the `ModalShell` / `ConfirmDeleteModal` / `PageState` copies\n// that Durable-DAV, Durable-DAV-Router, Mail-Otter and Edge-Git each shipped.\n// Deliberately dependency-free — labels are props, not `useTranslation` — so\n// adopting these does not require a translation library or an icon set.\nexport { ModalShell } from './ModalShell.tsx';\nexport type { ModalShellProps } from './ModalShell.tsx';\nexport { ConfirmDeleteModal, EmptyState, LoadingSpinner } from './PageState.tsx';\n\n// The second convergence round: page layout, the notice banner, the access\n// page, the language picker, and the two clipboard-bearing controls. Same rule\n// on labels — the app owns its string catalogue. Three of these need\n// `lucide-react`, which is why it is a peer and not a dependency.\nexport { AppPage } from './AppPage.tsx';\nexport type { AppPageProps, AppPageVariant } from './AppPage.tsx';\nexport { PageHeaderCard } from './PageHeaderCard.tsx';\nexport type { PageHeaderCardProps } from './PageHeaderCard.tsx';\nexport { ContextBar } from './ContextBar.tsx';\nexport type { ContextBarProps } from './ContextBar.tsx';\nexport { Unauthorized } from './Unauthorized.tsx';\nexport type { UnauthorizedProps } from './Unauthorized.tsx';\nexport { NoticeBar } from './NoticeBar.tsx';\nexport type { NoticeBarProps, NoticeStatusLabels } from './NoticeBar.tsx';\nexport { LanguageSelector } from './LanguageSelector.tsx';\nexport type { LanguageSelectorProps } from './LanguageSelector.tsx';\nexport { RefreshButton } from './RefreshButton.tsx';\nexport type { RefreshButtonProps } from './RefreshButton.tsx';\nexport { ReadOnlyField } from './ReadOnlyField.tsx';\nexport type { ReadOnlyFieldProps } from './ReadOnlyField.tsx';\nexport { TypeToConfirmModal } from './TypeToConfirmModal.tsx';\nexport type { TypeToConfirmModalProps } from './TypeToConfirmModal.tsx';\nexport { useCopyToClipboard } from './useCopyToClipboard.ts';\nexport type { UseCopyToClipboardResult } from './useCopyToClipboard.ts';\n\nexport { Pagination, clampPage, pageCountFor, pageWindow } from './Pagination.tsx';\nexport type { PaginationLabels, PaginationProps } from './Pagination.tsx';\n\nexport { Spinner } from './Spinner.tsx';\nexport type { SpinnerProps } from './Spinner.tsx';\n\nexport {\n btnBase,\n btnBlueStyle,\n btnGreenStyle,\n btnSmallStyle,\n buttonColors,\n cardStyle,\n inputStyle,\n paginationBtnStyle,\n tableCardStyle,\n tdStyle,\n theme,\n thStyle,\n} from './theme.ts';\n\nexport { cn } from './utils.ts';\nexport type { ClassDictionary, ClassValue } from './utils.ts';\n\nexport { COPY_FEEDBACK_TIMEOUT_MS, NOTICE_TIMEOUT_MS, ZERO_TRUST_AUTHENTICATION_PATH } from './constants.ts';\n\nexport { useNotice } from './useNotice.ts';\nexport type { Notice, NoticeKind, ShowNotice, UseNoticeOptions, UseNoticeResult } from './useNotice.ts';\n\nexport {\n canonicalizeLanguageTag,\n DEFAULT_FALLBACK_LANGUAGE,\n DEFAULT_LANGUAGE_STORAGE_KEY,\n DEFAULT_SUPPORTED_LANGUAGES,\n resolveLanguageTag,\n useSpaLanguage,\n} from './useSpaLanguage.ts';\nexport type { LanguageTag, UseSpaLanguageOptions, UseSpaLanguageResult } from './useSpaLanguage.ts';\n\nexport { CURRENT_USER_PATH, useCurrentUser } from './useCurrentUser.ts';\nexport type { CurrentUser, UseCurrentUserOptions, UseCurrentUserResult } from './useCurrentUser.ts';\n\nexport { buildQuery, createApiClient, HttpStatusError, MAX_ERROR_MESSAGE_LENGTH } from './api.ts';\nexport type { ApiClient, ApiRequestInit, CreateApiClientOptions, FetchFn, QueryParams, QueryValue } from './api.ts';\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { COPY_FEEDBACK_TIMEOUT_MS } from
|
|
2
|
+
import { COPY_FEEDBACK_TIMEOUT_MS } from "./constants.js";
|
|
3
3
|
function useCopyToClipboard() {
|
|
4
4
|
const [copied, setCopied] = useState(false);
|
|
5
5
|
const resetTimer = useRef(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCopyToClipboard.js","sourceRoot":"","sources":["../src/useCopyToClipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useCopyToClipboard.js","sourceRoot":"","sources":["../src/useCopyToClipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAsD1D,SAAS,kBAAkB;IACzB,MAAM,CAAC,MAAM,EAAE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IMEOUT_MS } from './constants.ts';\n\n/**\n * Copy text to the clipboard, reporting success only when it happened.\n *\n * ## Provenance\n *\n * `hooks/useCopyToClipboard.ts` in **Durable-DAV** — the one copy that had\n * solved the two failures the others carried. The other three handlers were\n * inlined into `ReadOnlyField` (Edge-Git, Mail-Otter, Durable-DAV-Router) and\n * `TypeToConfirmModal`, and were byte-identical to each other.\n *\n * ## The two live bugs this converges away\n *\n * 1. **`navigator.clipboard` is absent in an insecure context.** A plain\n * `navigator.clipboard.writeText` throws *synchronously* there, so the\n * handler dies before setting state. Where it was guarded with\n * `if (clipboard)`, the guard fell through to `setCopied(true)` anyway and\n * showed a checkmark for a copy that never happened.\n * 2. **The write is a promise that rejects on a denied permission.** Awaiting\n * it is not enough; the rejection has to be handled, or it surfaces as an\n * unhandled rejection *and* the checkmark still appears.\n *\n * That second case is why this is a hook rather than a helper. The honest\n * answer — \"nothing was copied, so there is nothing to undo\" — is expressed by\n * `copied` simply never becoming true, which is state a helper function cannot\n * hold.\n *\n * Every call site in the family is a secret reveal: a bucket credential's\n * copy-once password, a resource name typed to confirm a destructive action.\n * A false success sends the operator away believing they have something they do\n * not.\n *\n * ## Timer handling\n *\n * The reset timer is a ref and is cleared on unmount. Local `setTimeout` handles\n * in the inlined copies leaked both ways: a modal closed inside the feedback\n * window set state on an unmounted component, and repeated clicks each replaced\n * the timer without cancelling the previous one, so an early timer could clear\n * the checkmark while a later copy was still pending.\n */\n\ninterface UseCopyToClipboardResult {\n /**\n * True only after a write that actually resolved.\n *\n * Never optimistically set: a denied permission or an insecure context leaves\n * this `false`, which is the answer that matters — there is nothing to undo.\n */\n copied: boolean;\n /** Writes `text`, or does nothing if the clipboard is unavailable. */\n copy: (text: string) => void;\n}\n\nfunction useCopyToClipboard(): UseCopyToClipboardResult {\n const [copied, setCopied] = useState(false);\n const resetTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(\n () => () => {\n if (resetTimer.current !== null) clearTimeout(resetTimer.current);\n },\n [],\n );\n\n const copy = useCallback((text: string): void => {\n // Optional chaining rather than an assumption: `navigator.clipboard` is\n // genuinely absent over plain HTTP, and for a self-hosted deployment over\n // plain HTTP that is a normal configuration, not an error to surface.\n const clipboard = globalThis.navigator?.clipboard as Clipboard | undefined;\n // Nothing was copied, so there is nothing to report and nothing to undo.\n if (!clipboard) return;\n\n void clipboard\n .writeText(text)\n .then(() => {\n setCopied(true);\n // Cancel any pending reset before arming a new one. Replacing the\n // handle without clearing leaves the earlier timer live, and it can\n // clear the checkmark for a copy that is still being reported.\n if (resetTimer.current !== null) clearTimeout(resetTimer.current);\n resetTimer.current = setTimeout(() => {\n resetTimer.current = null;\n setCopied(false);\n }, COPY_FEEDBACK_TIMEOUT_MS);\n })\n // Leave `copied` false rather than flashing and clearing it: a rejection\n // means the text is still on screen and unread, so the affordance must\n // not claim otherwise.\n .catch(() => undefined);\n }, []);\n\n return { copied, copy };\n}\n\nexport { useCopyToClipboard };\nexport type { UseCopyToClipboardResult };\n"]}
|
package/dist/useCurrentUser.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentUser.d.ts","sourceRoot":"","sources":["../src/useCurrentUser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useCurrentUser.d.ts","sourceRoot":"","sources":["../src/useCurrentUser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,+FAA+F;AAC/F,UAAU,WAAW;IACnB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,UAAU,qBAAqB;IAC7B,2EAA2E;IAC3E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O,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC1C,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { ServiceError } from '@rexezuge/errors';\nimport type { ApiClient } from './api';\n\n/**\n * The signed-in account, fetched once on mount.\n *\n * ## Provenance\n *\n * `hooks/useCurrentUser.ts` in **CalDAV-Bridge**, **Durable-DAV**,\n * **Durable-DAV-Router**, **Edge-Git**, **Edge-Sonic** and **Mail-Otter** — six\n * copies that differ on the three questions this hook exists to answer:\n *\n * 1. **Who fetches.** CalDAV-Bridge, Edge-Git, Edge-Sonic and Mail-Otter call a\n * module-level `loadCurrentUser()` from `services/userService`; Durable-DAV\n * and Durable-DAV-Router call the same helper but keep the client injectable.\n * The kit normalizes to the injectable form: the hook takes the client, so\n * nothing about the request path is baked in and a test hands it a stub.\n * 2. **What a failure means.** Durable-DAV-Router records the bug in a comment:\n * `authorized` was set to `false` for *any* failure, so a 500 or a dropped\n * connection rendered \"Sign In With Cloudflare Access\" to a caller who was\n * signed in — and the only way back was a hard reload. Its fix is a separate\n * `error` flag meaning \"we could not find out\", rendered as a retry. That is\n * the shape here: `error` carries the failure, `user` stays `null`, and the\n * caller decides what a retry looks like. A 401 is not special-cased — a 401\n * *is* an error, and a shell that renders a sign-in prompt from it should do\n * so because the app says so.\n * 3. **Effect dependencies.** Durable-DAV documents the other half of the bug:\n * the effect listed `onError` (its only dependency), `SpaApp` passed an\n * inline arrow, so the effect re-ran on every render and issued an\n * unbounded stream of `GET /user/me` from first paint. The kit takes the\n * same cure: the client is read through a ref, and the effect is keyed on\n * `reloadKey` alone. A caller can pass a fresh client every render and the\n * request count is unchanged.\n *\n * ## Normalization\n *\n * `useCurrentUser(client)` returns `{ user, loading, error, reload }`. The\n * `authorized` tri-state (`null`/`true`/`false`) is gone: `loading` already\n * distinguishes \"in flight\" from \"answered\", and `error` distinguishes\n * \"answered badly\" from \"not signed in\" — a caller that wants `authorized`\n * derives it as `loading ? null : user !== null`. `setUser` is gone too; a\n * change to the account is a refresh (`reload()`), which is what the sources\n * do at every call site anyway.\n */\n\n/** The account shape a caller reads. `preferredLanguage` is what `useSpaLanguage` consumes. */\ninterface CurrentUser {\n preferredLanguage?: string | null;\n}\n\ninterface UseCurrentUserOptions {\n /** The path to GET. Defaults to `/user/me`, the family's profile route. */\n path?: string;\n}\n\ninterface UseCurrentUserResult<TUser> {\n /** The account, or `null` until it loads (and after a failure). */\n user: TUser | null;\n /** `true` while the request is in flight, including the first one. */\n loading: boolean;\n /** The normalized failure, or `null`. A `ServiceError`, always. */\n error: ServiceError | null;\n /** Re-runs the request. */\n reload: () => void;\n}\n\n/** The profile route every repo in the family serves. */\nconst CURRENT_USER_PATH = '/user/me';\n\nfunction useCurrentUser<TUser = CurrentUser>(\n client: ApiClient,\n { path = CURRENT_USER_PATH }: Readonly<UseCurrentUserOptions> = {},\n): UseCurrentUserResult<TUser> {\n const [user, setUser] = useState<TUser | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<ServiceError | null>(null);\n const [reloadKey, setReloadKey] = useState(0);\n\n // Read through a ref so a caller's fresh client instance cannot re-run the\n // effect; refreshing is explicit, through `reload`.\n const clientRef = useRef(client);\n useEffect(() => {\n clientRef.current = client;\n }, [client]);\n\n const reload = useCallback(() => {\n setReloadKey((key) => key + 1);\n }, []);\n\n useEffect(() => {\n let cancelled = false;\n setLoading(true);\n clientRef.current\n .get<TUser>(path)\n .then((me) => {\n if (cancelled) {\n return;\n }\n setUser(me);\n setError(null);\n setLoading(false);\n })\n .catch((cause: unknown) => {\n if (cancelled) {\n return;\n }\n // Normalized here as well as in the client: a client that is not this\n // package's (`createApiClient`) may throw anything, and a hook that\n // promises a `ServiceError` should deliver one.\n setError(ServiceError.from(cause));\n setLoading(false);\n });\n return () => {\n cancelled = true;\n };\n }, [path, reloadKey]);\n\n return { user, loading, error, reload };\n}\n\nexport { CURRENT_USER_PATH, useCurrentUser };\nexport type { CurrentUser, UseCurrentUserOptions, UseCurrentUserResult };\n"]}
|
|
1
|
+
{"version":3,"file":"useCurrentUser.js","sourceRoot":"","sources":["../src/useCurrentUser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAkEhD,yDAAyD;AACzD,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAErC,SAAS,cAAc,CACrB,MAAiB,EACjB,EAAE,IAAI,GAAG,iBAAiB,KAAsC,EAAE;IAElE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IACrD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAsB,IAAI,CAAC,CAAC;IAC9D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE9C,2EAA2E;IAC3E,oDAAoD;IACpD,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IACjC,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;IAC7B,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,YAAY,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACjC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,SAAS,CAAC,OAAO;aACd,GAAG,CAAQ,IAAI,CAAC;aAChB,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE;YACX,IAAI,SAAS,EAAE,CAAC;gBACd,OAAO;YACT,CAAC;YACD,OAAO,CAAC,EAAE,CAAC,CAAC;YACZ,QAAQ,CAAC,IAAI,CAAC,CAAC;YACf,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YACxB,IAAI,SAAS,EAAE,CAAC;gBACd,OAAO;YACT,CAAC;YACD,sEAAsE;YACtE,oEAAoE;YACpE,gDAAgD;YAChD,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YACnC,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;QACL,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IAEtB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC1C,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { ServiceError } from '@rexezuge/errors';\nimport type { ApiClient } from './api.ts';\n\n/**\n * The signed-in account, fetched once on mount.\n *\n * ## Provenance\n *\n * `hooks/useCurrentUser.ts` in **CalDAV-Bridge**, **Durable-DAV**,\n * **Durable-DAV-Router**, **Edge-Git**, **Edge-Sonic** and **Mail-Otter** — six\n * copies that differ on the three questions this hook exists to answer:\n *\n * 1. **Who fetches.** CalDAV-Bridge, Edge-Git, Edge-Sonic and Mail-Otter call a\n * module-level `loadCurrentUser()` from `services/userService`; Durable-DAV\n * and Durable-DAV-Router call the same helper but keep the client injectable.\n * The kit normalizes to the injectable form: the hook takes the client, so\n * nothing about the request path is baked in and a test hands it a stub.\n * 2. **What a failure means.** Durable-DAV-Router records the bug in a comment:\n * `authorized` was set to `false` for *any* failure, so a 500 or a dropped\n * connection rendered \"Sign In With Cloudflare Access\" to a caller who was\n * signed in — and the only way back was a hard reload. Its fix is a separate\n * `error` flag meaning \"we could not find out\", rendered as a retry. That is\n * the shape here: `error` carries the failure, `user` stays `null`, and the\n * caller decides what a retry looks like. A 401 is not special-cased — a 401\n * *is* an error, and a shell that renders a sign-in prompt from it should do\n * so because the app says so.\n * 3. **Effect dependencies.** Durable-DAV documents the other half of the bug:\n * the effect listed `onError` (its only dependency), `SpaApp` passed an\n * inline arrow, so the effect re-ran on every render and issued an\n * unbounded stream of `GET /user/me` from first paint. The kit takes the\n * same cure: the client is read through a ref, and the effect is keyed on\n * `reloadKey` alone. A caller can pass a fresh client every render and the\n * request count is unchanged.\n *\n * ## Normalization\n *\n * `useCurrentUser(client)` returns `{ user, loading, error, reload }`. The\n * `authorized` tri-state (`null`/`true`/`false`) is gone: `loading` already\n * distinguishes \"in flight\" from \"answered\", and `error` distinguishes\n * \"answered badly\" from \"not signed in\" — a caller that wants `authorized`\n * derives it as `loading ? null : user !== null`. `setUser` is gone too; a\n * change to the account is a refresh (`reload()`), which is what the sources\n * do at every call site anyway.\n */\n\n/** The account shape a caller reads. `preferredLanguage` is what `useSpaLanguage` consumes. */\ninterface CurrentUser {\n preferredLanguage?: string | null;\n}\n\ninterface UseCurrentUserOptions {\n /** The path to GET. Defaults to `/user/me`, the family's profile route. */\n path?: string;\n}\n\ninterface UseCurrentUserResult<TUser> {\n /** The account, or `null` until it loads (and after a failure). */\n user: TUser | null;\n /** `true` while the request is in flight, including the first one. */\n loading: boolean;\n /** The normalized failure, or `null`. A `ServiceError`, always. */\n error: ServiceError | null;\n /** Re-runs the request. */\n reload: () => void;\n}\n\n/** The profile route every repo in the family serves. */\nconst CURRENT_USER_PATH = '/user/me';\n\nfunction useCurrentUser<TUser = CurrentUser>(\n client: ApiClient,\n { path = CURRENT_USER_PATH }: Readonly<UseCurrentUserOptions> = {},\n): UseCurrentUserResult<TUser> {\n const [user, setUser] = useState<TUser | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<ServiceError | null>(null);\n const [reloadKey, setReloadKey] = useState(0);\n\n // Read through a ref so a caller's fresh client instance cannot re-run the\n // effect; refreshing is explicit, through `reload`.\n const clientRef = useRef(client);\n useEffect(() => {\n clientRef.current = client;\n }, [client]);\n\n const reload = useCallback(() => {\n setReloadKey((key) => key + 1);\n }, []);\n\n useEffect(() => {\n let cancelled = false;\n setLoading(true);\n clientRef.current\n .get<TUser>(path)\n .then((me) => {\n if (cancelled) {\n return;\n }\n setUser(me);\n setError(null);\n setLoading(false);\n })\n .catch((cause: unknown) => {\n if (cancelled) {\n return;\n }\n // Normalized here as well as in the client: a client that is not this\n // package's (`createApiClient`) may throw anything, and a hook that\n // promises a `ServiceError` should deliver one.\n setError(ServiceError.from(cause));\n setLoading(false);\n });\n return () => {\n cancelled = true;\n };\n }, [path, reloadKey]);\n\n return { user, loading, error, reload };\n}\n\nexport { CURRENT_USER_PATH, useCurrentUser };\nexport type { CurrentUser, UseCurrentUserOptions, UseCurrentUserResult };\n"]}
|
package/dist/useNotice.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { NOTICE_TIMEOUT_MS } from
|
|
2
|
+
import { NOTICE_TIMEOUT_MS } from "./constants.js";
|
|
3
3
|
function useNotice({ dismissAfterMs = NOTICE_TIMEOUT_MS, initial = null } = {}) {
|
|
4
4
|
const [notice, setNotice] = useState(initial);
|
|
5
5
|
const timerRef = useRef(null);
|
package/dist/useNotice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotice.js","sourceRoot":"","sources":["../src/useNotice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,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AO,GAAG,IAAI,CAAC;YACxB,SAAS,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,EAAE,cAAc,CAAC,CAAC;IACrB,CAAC,EACD,CAAC,qBAAqB,EAAE,cAAc,CAAC,CACxC,CAAC;IAEF,wEAAwE;IACxE,yDAAyD;IACzD,SAAS,CAAC,GAAG,EAAE,CAAC,qBAAqB,EAAE,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAEhE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;AAC/C,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { NOTICE_TIMEOUT_MS } from './constants.ts';\n\n/**\n * A transient status message.\n *\n * ## Provenance\n *\n * `hooks/useNotice.ts` in **CalDAV-Bridge**, **Durable-DAV**,\n * **Durable-DAV-Router**, **Edge-Git**, **Edge-Sonic** and **Mail-Otter** — six\n * copies of one hook, with AWS-AccessBridge's `useToast` as the seventh in\n * everything but name. Each contributes one thing:\n *\n * - **Durable-DAV** — the unmount cleanup. Its comment records the bug: the\n * timer was only ever cleared in favour of the *next* notice, so unmounting\n * with a notice showing left it live to call `setState` on a gone component.\n * - **Edge-Sonic** — `clearNotice`, a dismissal that is not just \"replace it\",\n * and the exported `ShowNotice` type so feature tabs stop re-spelling the\n * setter's signature.\n * - **CalDAV-Bridge / Mail-Otter** — seeding the first notice from the URL's\n * `?oauth2=` result. That is *left local*: the parameter names are\n * product-specific, and a hook that reads a query string is a hook a test\n * has to fake a location for. A consumer seeds its own notice by passing\n * `initial` — see `UseNoticeOptions`.\n * - **All six** — a ref-held timer, so a new notice replaces the old one's\n * dismissal instead of being cut short by it (\"the error banner vanished\n * before I read it\").\n *\n * ## Normalization\n *\n * The type is `{ kind, message }`. Every copy used `{ type, text }`, and the\n * field names collided with the DOM's `type` on unrelated elements often enough\n * that `kind`/`message` read better at the call sites that build one by hand\n * (`describeProbe` in Edge-Sonic returns a notice-shaped value). The imperative\n * API is `showNotice(kind, message)` — positional, as every copy had it, so a\n * call site reads as the event it reports — plus `dismissNotice()`.\n */\n\ntype NoticeKind = 'success' | 'error';\n\n/** One transient message. `kind` is the tone, `message` the sentence. */\ninterface Notice {\n kind: NoticeKind;\n message: string;\n}\n\n/** The setter views and hooks are handed. */\ntype ShowNotice = (kind: NoticeKind, message: string) => void;\n\ninterface UseNoticeOptions {\n /** How long a notice stays up. Defaults to `NOTICE_TIMEOUT_MS`. */\n dismissAfterMs?: number;\n /** A notice to start with — the URL-seeded OAuth result, in a consumer. */\n initial?: Notice | null;\n}\n\ninterface UseNoticeResult {\n /** The notice to render, or `null` when there is nothing to say. */\n notice: Notice | null;\n /** Shows a notice, replacing any notice already showing (and its timer). */\n showNotice: ShowNotice;\n /** Hides the notice and cancels its pending dismissal. */\n dismissNotice: () => void;\n}\n\nfunction useNotice({ dismissAfterMs = NOTICE_TIMEOUT_MS, initial = null }: Readonly<UseNoticeOptions> = {}): UseNoticeResult {\n const [notice, setNotice] = useState<Notice | null>(initial);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const clearPendingDismissal = useCallback(() => {\n if (timerRef.current === null) {\n return;\n }\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }, []);\n\n const dismissNotice = useCallback(() => {\n clearPendingDismissal();\n setNotice(null);\n }, [clearPendingDismissal]);\n\n const showNotice = useCallback<ShowNotice>(\n (kind, message) => {\n // Replace the pending dismissal rather than stacking a second timer: two\n // live timers mean the first notice's timeout fires while the second is\n // still on screen.\n clearPendingDismissal();\n setNotice({ kind, message });\n timerRef.current = setTimeout(() => {\n timerRef.current = null;\n setNotice(null);\n }, dismissAfterMs);\n },\n [clearPendingDismissal, dismissAfterMs],\n );\n\n // Unmounting cancels the dismissal. Without this the timer outlives the\n // component and calls `setState` on a tree that is gone.\n useEffect(() => clearPendingDismissal, [clearPendingDismissal]);\n\n return { notice, showNotice, dismissNotice };\n}\n\nexport { useNotice };\nexport type { Notice, NoticeKind, ShowNotice, UseNoticeOptions, UseNoticeResult };\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rexezuge/web",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@rexezuge/errors": "1.
|
|
29
|
-
"@rexezuge/shared": "1.
|
|
28
|
+
"@rexezuge/errors": "1.3.0",
|
|
29
|
+
"@rexezuge/shared": "1.3.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"lucide-react": "^1.49.0",
|