@rexezuge/web 1.2.0 → 1.4.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.d.ts +6 -2
- package/dist/AppPage.d.ts.map +1 -1
- package/dist/AppPage.js +1 -7
- package/dist/AppPage.js.map +7 -1
- package/dist/Badge.d.ts +9 -3
- package/dist/Badge.d.ts.map +1 -1
- package/dist/Badge.js +1 -25
- package/dist/Badge.js.map +7 -1
- package/dist/Button.d.ts +6 -2
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +1 -39
- package/dist/Button.js.map +7 -1
- package/dist/Card.d.ts +12 -9
- package/dist/Card.d.ts.map +1 -1
- package/dist/Card.js +1 -42
- package/dist/Card.js.map +7 -1
- package/dist/ContextBar.d.ts +9 -3
- package/dist/ContextBar.d.ts.map +1 -1
- package/dist/ContextBar.js +1 -7
- package/dist/ContextBar.js.map +7 -1
- package/dist/FocusInput.d.ts +1 -2
- package/dist/FocusInput.d.ts.map +1 -1
- package/dist/FocusInput.js +1 -19
- package/dist/FocusInput.js.map +7 -1
- package/dist/Input.d.ts +9 -8
- package/dist/Input.d.ts.map +1 -1
- package/dist/Input.js +1 -49
- package/dist/Input.js.map +7 -1
- package/dist/LanguageSelector.d.ts +6 -2
- package/dist/LanguageSelector.d.ts.map +1 -1
- package/dist/LanguageSelector.js +1 -12
- package/dist/LanguageSelector.js.map +7 -1
- package/dist/LoadingButton.d.ts +19 -7
- package/dist/LoadingButton.d.ts.map +1 -1
- package/dist/LoadingButton.js +1 -30
- package/dist/LoadingButton.js.map +7 -1
- package/dist/ModalShell.d.ts +12 -4
- package/dist/ModalShell.d.ts.map +1 -1
- package/dist/ModalShell.js +1 -22
- package/dist/ModalShell.js.map +7 -1
- package/dist/NoticeBar.d.ts +7 -3
- package/dist/NoticeBar.d.ts.map +1 -1
- package/dist/NoticeBar.js +1 -12
- package/dist/NoticeBar.js.map +7 -1
- package/dist/PageHeaderCard.d.ts +6 -2
- package/dist/PageHeaderCard.d.ts.map +1 -1
- package/dist/PageHeaderCard.js +1 -7
- package/dist/PageHeaderCard.js.map +7 -1
- package/dist/PageState.d.ts +9 -3
- package/dist/PageState.d.ts.map +1 -1
- package/dist/PageState.js +1 -47
- package/dist/PageState.js.map +7 -1
- package/dist/Pagination.d.ts +36 -12
- package/dist/Pagination.d.ts.map +1 -1
- package/dist/Pagination.js +1 -75
- package/dist/Pagination.js.map +7 -1
- package/dist/ReadOnlyField.d.ts +12 -4
- package/dist/ReadOnlyField.d.ts.map +1 -1
- package/dist/ReadOnlyField.js +1 -17
- package/dist/ReadOnlyField.js.map +7 -1
- package/dist/RefreshButton.d.ts +6 -2
- package/dist/RefreshButton.d.ts.map +1 -1
- package/dist/RefreshButton.js +1 -8
- package/dist/RefreshButton.js.map +7 -1
- package/dist/Spinner.d.ts +15 -5
- package/dist/Spinner.d.ts.map +1 -1
- package/dist/Spinner.js +1 -14
- package/dist/Spinner.js.map +7 -1
- package/dist/TypeToConfirmModal.d.ts +15 -5
- package/dist/TypeToConfirmModal.d.ts.map +1 -1
- package/dist/TypeToConfirmModal.js +1 -24
- package/dist/TypeToConfirmModal.js.map +7 -1
- package/dist/Unauthorized.d.ts +6 -2
- package/dist/Unauthorized.d.ts.map +1 -1
- package/dist/Unauthorized.js +1 -11
- package/dist/Unauthorized.js.map +7 -1
- package/dist/api.d.ts +27 -9
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +1 -258
- package/dist/api.js.map +7 -1
- package/dist/constants.js +1 -49
- package/dist/constants.js.map +7 -1
- package/dist/index.d.ts +51 -51
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -89
- package/dist/index.js.map +7 -1
- package/dist/theme.d.ts +24 -8
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +1 -134
- package/dist/theme.js.map +7 -1
- package/dist/useCopyToClipboard.d.ts +3 -1
- package/dist/useCopyToClipboard.d.ts.map +1 -1
- package/dist/useCopyToClipboard.js +1 -40
- package/dist/useCopyToClipboard.js.map +7 -1
- package/dist/useCurrentUser.d.ts +22 -8
- package/dist/useCurrentUser.d.ts.map +1 -1
- package/dist/useCurrentUser.js +1 -49
- package/dist/useCurrentUser.js.map +7 -1
- package/dist/useNotice.d.ts +21 -7
- package/dist/useNotice.d.ts.map +1 -1
- package/dist/useNotice.js +1 -34
- package/dist/useNotice.js.map +7 -1
- package/dist/useSpaLanguage.d.ts +27 -11
- package/dist/useSpaLanguage.d.ts.map +1 -1
- package/dist/useSpaLanguage.js +1 -149
- package/dist/useSpaLanguage.js.map +7 -1
- package/dist/utils.d.ts +6 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -346
- package/dist/utils.js.map +7 -1
- package/package.json +4 -4
package/dist/Input.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/Input.tsx"],
|
|
4
|
+
"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/**\nThe shared look of every text-entry control.\n*/\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\ntype InputProps = InputHTMLAttributes<HTMLInputElement>;\n\nfunction Input({ className, ...rest }: Readonly<InputProps>): ReactElement {\n return <input className={cn(fieldClass, className)} {...rest} />;\n}\n\ntype SelectProps = 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\ntype TextareaProps = 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 /**\n The `id` of the control this label names.\n */\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"],
|
|
5
|
+
"mappings": "wCAQA,OAAS,MAAAA,MAAU,aAqCnB,MAAMC,EACJ,8RAIF,SAASC,EAAM,CAAE,UAAAC,EAAW,GAAGC,CAAI,EAAwB,CACzD,OAAOC,EAAA,QAAA,CAAO,UAAWL,EAAGC,EAAYE,CAAS,EAAC,GAAMC,CAAI,CAAA,CAC9D,CAIA,SAASE,EAAO,CAAE,UAAAH,EAAW,SAAAI,EAAU,GAAGH,CAAI,EAAyB,CACrE,OACEC,EAAA,SAAA,CAAQ,UAAWL,EAAGC,EAAYE,CAAS,EAAC,GAAMC,EAAI,SACnDG,CAAQ,CAAA,CAGf,CAIA,SAASC,EAAS,CAAE,UAAAL,EAAW,GAAGC,CAAI,EAA2B,CAC/D,OAAOC,EAAA,WAAA,CAAU,UAAWL,EAAGC,EAAY,oBAAqBE,CAAS,EAAC,GAAMC,CAAI,CAAA,CACtF,CAUA,SAASK,EAAM,CAAE,SAAAF,EAAU,QAAAG,EAAS,GAAGN,CAAI,EAAwB,CACjE,OACEC,EAAA,QAAA,CAAO,QAASK,EAAS,UAAU,gEAA+D,GAAKN,EAAI,SACxGG,CAAQ,CAAA,CAGf",
|
|
6
|
+
"names": ["cn", "fieldClass", "Input", "className", "rest", "_jsx", "Select", "children", "Textarea", "Label", "htmlFor"]
|
|
7
|
+
}
|
|
@@ -37,9 +37,13 @@ interface LanguageSelectorProps {
|
|
|
37
37
|
*/
|
|
38
38
|
value: string | null;
|
|
39
39
|
onChange: (languageTag: string) => void;
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
The control's accessible name. Required — a bare `<select>` has none.
|
|
42
|
+
*/
|
|
41
43
|
label: string;
|
|
42
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
Shown instead of the language list when `value` is `null`.
|
|
46
|
+
*/
|
|
43
47
|
unknownLabel: string;
|
|
44
48
|
/**
|
|
45
49
|
* The offered tags.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LanguageSelector.d.ts","sourceRoot":"","sources":["../src/LanguageSelector.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,UAAU,qBAAqB;IAC7B;;;;OAIG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC
|
|
1
|
+
{"version":3,"file":"LanguageSelector.d.ts","sourceRoot":"","sources":["../src/LanguageSelector.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,UAAU,qBAAqB;IAC7B;;;;OAIG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;MAEE;IACF,KAAK,EAAE,MAAM,CAAC;IACd;;MAEE;IACF,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,iBAAS,gBAAgB,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,SAA6B,EAC7B,QAAQ,GACT,EAAE,QAAQ,CAAC,qBAAqB,CAAC,+BAsBjC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,qBAAqB,EAAE,CAAC"}
|
package/dist/LanguageSelector.js
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { LocaleUtil, SUPPORTED_LOCALES } from '@rexezuge/shared';
|
|
3
|
-
import { Select } from './Input';
|
|
4
|
-
function LanguageSelector({ value, onChange, label, unknownLabel, supported = SUPPORTED_LOCALES, disabled, }) {
|
|
5
|
-
if (value === null) {
|
|
6
|
-
return (_jsx(Select, { "aria-label": label, value: "", disabled: true, onChange: () => undefined, children: _jsx("option", { value: "", children: unknownLabel }) }));
|
|
7
|
-
}
|
|
8
|
-
const current = LocaleUtil.normalize(value);
|
|
9
|
-
return (_jsx(Select, { "aria-label": label, value: current, disabled: disabled, onChange: (event) => onChange(event.target.value), children: supported.map((tag) => (_jsx("option", { value: tag, children: LocaleUtil.displayName(tag) }, tag))) }));
|
|
10
|
-
}
|
|
11
|
-
export { LanguageSelector };
|
|
12
|
-
//# sourceMappingURL=LanguageSelector.js.map
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{LocaleUtil as n,SUPPORTED_LOCALES as m}from"@rexezuge/shared";import{Select as i}from"./Input.js";function p({value:a,onChange:o,label:l,unknownLabel:t,supported:u=m,disabled:c}){if(a===null)return r(i,{"aria-label":l,value:"",disabled:!0,onChange:()=>{},children:r("option",{value:"",children:t})});const d=n.normalize(a);return r(i,{"aria-label":l,value:d,disabled:c,onChange:e=>o(e.target.value),children:u.map(e=>r("option",{value:e,children:n.displayName(e)},e))})}export{p as LanguageSelector};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/LanguageSelector.tsx"],
|
|
4
|
+
"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 /**\n The control's accessible name. Required — a bare `<select>` has none.\n */\n label: string;\n /**\n Shown instead of the language list when `value` is `null`.\n */\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={() => {}}>\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"],
|
|
5
|
+
"mappings": "wCAAA,OAAS,cAAAA,EAAY,qBAAAC,MAAyB,mBAC9C,OAAS,UAAAC,MAAc,aA6DvB,SAASC,EAAiB,CACxB,MAAAC,EACA,SAAAC,EACA,MAAAC,EACA,aAAAC,EACA,UAAAC,EAAYP,EACZ,SAAAQ,CAAQ,EACwB,CAChC,GAAIL,IAAU,KACZ,OACEM,EAACR,EAAM,CAAA,aAAaI,EAAO,MAAM,GAAG,SAAQ,GAAC,SAAU,IAAK,CAAE,EAAC,SAC7DI,EAAA,SAAA,CAAQ,MAAM,GAAE,SAAEH,CAAY,CAAA,CAAU,CAAA,EAK9C,MAAMI,EAAUX,EAAW,UAAUI,CAAK,EAE1C,OACEM,EAACR,EAAM,CAAA,aAAaI,EAAO,MAAOK,EAAS,SAAUF,EAAU,SAAWG,GAAUP,EAASO,EAAM,OAAO,KAAK,EAAC,SAC7GJ,EAAU,IAAKK,GACdH,EAAA,SAAA,CAAkB,MAAOG,EAAG,SAGzBb,EAAW,YAAYa,CAAG,CAAC,EAHjBA,CAAG,CAKjB,CAAC,CAAA,CAGR",
|
|
6
|
+
"names": ["LocaleUtil", "SUPPORTED_LOCALES", "Select", "LanguageSelector", "value", "onChange", "label", "unknownLabel", "supported", "disabled", "_jsx", "current", "event", "tag"]
|
|
7
|
+
}
|
package/dist/LoadingButton.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
-
import { type ButtonSize, type ButtonVariant } from './Button';
|
|
2
|
+
import { type ButtonSize, type ButtonVariant } from './Button.tsx';
|
|
3
3
|
/**
|
|
4
4
|
* A button that owns its own busy state.
|
|
5
5
|
*
|
|
@@ -26,18 +26,30 @@ import { type ButtonSize, type ButtonVariant } from './Button';
|
|
|
26
26
|
* reads the same as an async one.
|
|
27
27
|
*/
|
|
28
28
|
interface LoadingButtonProps {
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
Runs on activation; the button is busy until a returned promise settles.
|
|
31
|
+
*/
|
|
30
32
|
onClick: () => Promise<void> | void;
|
|
31
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
Blocks activation regardless of the busy state.
|
|
35
|
+
*/
|
|
32
36
|
disabled?: boolean;
|
|
33
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
Visual weight; defaults to `primary`.
|
|
39
|
+
*/
|
|
34
40
|
variant?: ButtonVariant;
|
|
35
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
Control size; defaults to `md`.
|
|
43
|
+
*/
|
|
36
44
|
size?: ButtonSize;
|
|
37
45
|
children: ReactNode;
|
|
38
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
Defaults to `button`, matching `Button`.
|
|
48
|
+
*/
|
|
39
49
|
type?: 'button' | 'submit' | 'reset';
|
|
40
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
Extra classes, merged over the button's.
|
|
52
|
+
*/
|
|
41
53
|
className?: string;
|
|
42
54
|
}
|
|
43
55
|
declare function LoadingButton({ onClick, disabled, variant, size, children, type, className, }: Readonly<LoadingButtonProps>): ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingButton.d.ts","sourceRoot":"","sources":["../src/LoadingButton.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"LoadingButton.d.ts","sourceRoot":"","sources":["../src/LoadingButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,EAAU,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,UAAU,kBAAkB;IAC1B;;MAEE;IACF,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACpC;;MAEE;IACF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;MAEE;IACF,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;MAEE;IACF,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;IACpB;;MAEE;IACF,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC;;MAEE;IACF,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,CA+B7C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/LoadingButton.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useCallback, useState } from 'react';
|
|
3
|
-
import { Button } from './Button';
|
|
4
|
-
function LoadingButton({ onClick, disabled = false, variant = 'primary', size = 'md', children, type = 'button', className, }) {
|
|
5
|
-
const [loading, setLoading] = useState(false);
|
|
6
|
-
const handleClick = useCallback((event) => {
|
|
7
|
-
if (disabled || loading) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
const result = onClick();
|
|
11
|
-
if (result instanceof Promise) {
|
|
12
|
-
setLoading(true);
|
|
13
|
-
// The state flip is scheduled before the await, not after it: a caller
|
|
14
|
-
// reading the tree right after the click must already see the spinner.
|
|
15
|
-
//
|
|
16
|
-
// A rejection clears the busy state and is deliberately *not*
|
|
17
|
-
// re-thrown: the handler is fire-and-forget, so re-throwing would only
|
|
18
|
-
// produce an unhandled rejection (and a failed test run under vitest).
|
|
19
|
-
// The call site owns its error reporting — every AWS-AccessBridge call
|
|
20
|
-
// site does exactly that inside its own `onClick`.
|
|
21
|
-
const settle = () => {
|
|
22
|
-
setLoading(false);
|
|
23
|
-
};
|
|
24
|
-
void result.then(settle, settle);
|
|
25
|
-
}
|
|
26
|
-
}, [disabled, loading, onClick]);
|
|
27
|
-
return (_jsx(Button, { variant: variant, size: size, type: type, className: className, loading: loading, disabled: disabled, onClick: handleClick, children: children }));
|
|
28
|
-
}
|
|
29
|
-
export { LoadingButton };
|
|
30
|
-
//# sourceMappingURL=LoadingButton.js.map
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import{useCallback as d,useState as p}from"react";import{Button as g}from"./Button.js";function h({onClick:n,disabled:t=!1,variant:a="primary",size:i="md",children:c,type:l="button",className:u}){const[e,o]=p(!1),f=d(()=>{if(t||e)return;const r=n();if(!(r instanceof Promise))return;o(!0);const s=()=>{o(!1)};r.then(s).catch(s)},[t,e,n]);return m(g,{variant:a,size:i,type:l,className:u,loading:e,disabled:t,onClick:f,children:c})}export{h as LoadingButton};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/LoadingButton.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useCallback, useState, 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 /**\n Runs on activation; the button is busy until a returned promise settles.\n */\n onClick: () => Promise<void> | void;\n /**\n Blocks activation regardless of the busy state.\n */\n disabled?: boolean;\n /**\n Visual weight; defaults to `primary`.\n */\n variant?: ButtonVariant;\n /**\n Control size; defaults to `md`.\n */\n size?: ButtonSize;\n children: ReactNode;\n /**\n Defaults to `button`, matching `Button`.\n */\n type?: 'button' | 'submit' | 'reset';\n /**\n Extra classes, merged over the button's.\n */\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 if (disabled || loading) {\n return;\n }\n const result = onClick();\n if (!(result instanceof Promise)) {\n return;\n }\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).catch(settle);\n }, [disabled, loading, onClick]);\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"],
|
|
5
|
+
"mappings": "wCAAA,OAAS,eAAAA,EAAa,YAAAC,MAAmD,QACzE,OAAS,UAAAC,MAAmD,cAwD5D,SAASC,EAAc,CACrB,QAAAC,EACA,SAAAC,EAAW,GACX,QAAAC,EAAU,UACV,KAAAC,EAAO,KACP,SAAAC,EACA,KAAAC,EAAO,SACP,UAAAC,CAAS,EACoB,CAC7B,KAAM,CAACC,EAASC,CAAU,EAAIX,EAAS,EAAK,EAEtCY,EAAcb,EAAY,IAAK,CACnC,GAAIK,GAAYM,EACd,OAEF,MAAMG,EAASV,EAAO,EACtB,GAAI,EAAEU,aAAkB,SACtB,OAEFF,EAAW,EAAI,EASf,MAAMG,EAAS,IAAW,CACxBH,EAAW,EAAK,CAClB,EACKE,EAAO,KAAKC,CAAM,EAAE,MAAMA,CAAM,CACvC,EAAG,CAACV,EAAUM,EAASP,CAAO,CAAC,EAE/B,OACEY,EAACd,EAAM,CAAC,QAASI,EAAS,KAAMC,EAAM,KAAME,EAAM,UAAWC,EAAW,QAASC,EAAS,SAAUN,EAAU,QAASQ,EAAW,SAC/HL,CAAQ,CAAA,CAGf",
|
|
6
|
+
"names": ["useCallback", "useState", "Button", "LoadingButton", "onClick", "disabled", "variant", "size", "children", "type", "className", "loading", "setLoading", "handleClick", "result", "settle", "_jsx"]
|
|
7
|
+
}
|
package/dist/ModalShell.d.ts
CHANGED
|
@@ -28,13 +28,19 @@ import { type ReactNode } from 'react';
|
|
|
28
28
|
* `closeLabel` and `ariaLabel` are ordinary props with no default, and a repo
|
|
29
29
|
* passes `t('common.close')` when it wants them translated.
|
|
30
30
|
*/
|
|
31
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
Escape closes, and the initial focus lands on the dialog.
|
|
33
|
+
*/
|
|
32
34
|
interface ModalShellProps {
|
|
33
35
|
onClose: () => void;
|
|
34
36
|
children: ReactNode;
|
|
35
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
Width utility class. Kept as a class so a repo themes it without forking.
|
|
39
|
+
*/
|
|
36
40
|
widthClass?: string;
|
|
37
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
Announced to assistive tech; there is no visible title in the frame itself.
|
|
43
|
+
*/
|
|
38
44
|
ariaLabel: string;
|
|
39
45
|
/**
|
|
40
46
|
* Accessible name for the corner close button.
|
|
@@ -44,7 +50,9 @@ interface ModalShellProps {
|
|
|
44
50
|
* buttons, and the operator has to guess which one they are on.
|
|
45
51
|
*/
|
|
46
52
|
closeLabel?: string;
|
|
47
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
Close on Escape. Defaults to true.
|
|
55
|
+
*/
|
|
48
56
|
closeOnEscape?: boolean;
|
|
49
57
|
}
|
|
50
58
|
declare function ModalShell({ onClose, children, widthClass, ariaLabel, closeLabel, closeOnEscape }: ModalShellProps): import("react").JSX.Element;
|
package/dist/ModalShell.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalShell.d.ts","sourceRoot":"","sources":["../src/ModalShell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH
|
|
1
|
+
{"version":3,"file":"ModalShell.d.ts","sourceRoot":"","sources":["../src/ModalShell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;;EAEE;AACF,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB;;MAEE;IACF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;MAEE;IACF,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;MAEE;IACF,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,iBAAS,UAAU,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAmB,EAAE,SAAS,EAAE,UAAoB,EAAE,aAAoB,EAAE,EAAE,eAAe,+BAqCrI;AAED,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,CAAC"}
|
package/dist/ModalShell.js
CHANGED
|
@@ -1,22 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
|
-
function ModalShell({ onClose, children, widthClass = 'w-80', ariaLabel, closeLabel = 'Close', closeOnEscape = true }) {
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
if (!closeOnEscape)
|
|
6
|
-
return undefined;
|
|
7
|
-
const onKeyDown = (event) => {
|
|
8
|
-
if (event.key === 'Escape')
|
|
9
|
-
onClose();
|
|
10
|
-
};
|
|
11
|
-
globalThis.addEventListener('keydown', onKeyDown);
|
|
12
|
-
// Removed on unmount: a dialog that closed by leaving a listener behind
|
|
13
|
-
// would close its replacement too, on the next Escape anywhere.
|
|
14
|
-
return () => globalThis.removeEventListener('keydown', onKeyDown);
|
|
15
|
-
}, [closeOnEscape, onClose]);
|
|
16
|
-
return (_jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", onClick: onClose, role: "presentation", children: [_jsx("div", { className: "fixed inset-0 bg-black/60 animate-backdrop-in", "aria-hidden": "true" }), _jsxs("div", { className: `relative bg-[var(--color-surface-1)] border border-[var(--color-border-muted)] rounded-2xl shadow-2xl animate-fade-in ${widthClass}`, onClick: (event) => {
|
|
17
|
-
// The one place a click inside the panel must not reach the backdrop.
|
|
18
|
-
event.stopPropagation();
|
|
19
|
-
}, role: "dialog", "aria-modal": "true", "aria-label": ariaLabel, children: [_jsx("button", { type: "button", onClick: onClose, "aria-label": closeLabel, className: "absolute top-3 right-3 text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors", children: closeLabel }), children] })] }));
|
|
20
|
-
}
|
|
21
|
-
export { ModalShell };
|
|
22
|
-
//# sourceMappingURL=ModalShell.js.map
|
|
1
|
+
import{jsx as i,jsxs as o}from"react/jsx-runtime";import{useEffect as c}from"react";function m({onClose:e,children:n,widthClass:d="w-80",ariaLabel:l,closeLabel:t="Close",closeOnEscape:a=!0}){return c(()=>{if(!a)return;const r=s=>{s.key==="Escape"&&e()};return addEventListener("keydown",r),()=>removeEventListener("keydown",r)},[a,e]),o("div",{className:"fixed inset-0 z-50 flex items-center justify-center",onClick:e,role:"presentation",children:[i("div",{className:"fixed inset-0 bg-black/60 animate-backdrop-in","aria-hidden":"true"}),o("div",{className:`relative bg-[var(--color-surface-1)] border border-[var(--color-border-muted)] rounded-2xl shadow-2xl animate-fade-in ${d}`,onClick:r=>{r.stopPropagation()},role:"dialog","aria-modal":"true","aria-label":l,children:[i("button",{type:"button",onClick:e,"aria-label":t,className:"absolute top-3 right-3 text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors",children:t}),n]})]})}export{m as ModalShell};
|
package/dist/ModalShell.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/ModalShell.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useEffect, type ReactNode } from 'react';\n\n/**\n * The modal frame every confirm dialog in the family sits inside.\n *\n * Converged from `components/modals/ModalShell.tsx` in Durable-DAV,\n * Durable-DAV-Router, Mail-Otter and Edge-Git, where the copies were\n * byte-identical apart from an import-order difference.\n *\n * ## Two decisions the copies made by accident, now made deliberately\n *\n * **It renders in a portal.** A dialog nested in a scrolling container is\n * clipped by it, and one nested inside a `position: fixed` ancestor is\n * positioned by that ancestor rather than the viewport. The portal is what makes\n * \"centre of the screen\" mean the same thing everywhere.\n *\n * **It closes on the backdrop but not on the panel.** The backdrop click closes;\n * a click inside the panel stops propagating so that selecting text in a\n * confirmation message does not dismiss the dialog the operator is reading. The\n * stop is on the panel, not the backdrop, so a click on the panel never closes\n * it and a click outside always does.\n *\n * ## Labels are props, not translations\n *\n * The copies called `useTranslation` for the close button and the default width.\n * A shared primitive that reaches into a translation library forces every\n * consumer to have one installed *and* configured, for a string it already has\n * — the caller rendering the dialog is the one that knows what it says. So\n * `closeLabel` and `ariaLabel` are ordinary props with no default, and a repo\n * passes `t('common.close')` when it wants them translated.\n */\n\n/**\nEscape closes, and the initial focus lands on the dialog.\n*/\ninterface ModalShellProps {\n onClose: () => void;\n children: ReactNode;\n /**\n Width utility class. Kept as a class so a repo themes it without forking.\n */\n widthClass?: string;\n /**\n Announced to assistive tech; there is no visible title in the frame itself.\n */\n ariaLabel: string;\n /**\n * Accessible name for the corner close button.\n *\n * Kept distinct from any cancel action in the body: a dialog whose close\n * button and cancel button share a name is announced as two identical\n * buttons, and the operator has to guess which one they are on.\n */\n closeLabel?: string;\n /**\n Close on Escape. Defaults to true.\n */\n closeOnEscape?: boolean;\n}\n\nfunction ModalShell({ onClose, children, widthClass = 'w-80', ariaLabel, closeLabel = 'Close', closeOnEscape = true }: ModalShellProps) {\n useEffect(() => {\n if (!closeOnEscape) return;\n const onKeyDown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') onClose();\n };\n addEventListener('keydown', onKeyDown);\n // Removed on unmount: a dialog that closed by leaving a listener behind\n // would close its replacement too, on the next Escape anywhere.\n return (): void => removeEventListener('keydown', onKeyDown);\n }, [closeOnEscape, onClose]);\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center\" onClick={onClose} role=\"presentation\">\n <div className=\"fixed inset-0 bg-black/60 animate-backdrop-in\" aria-hidden=\"true\" />\n <div\n className={`relative bg-[var(--color-surface-1)] border border-[var(--color-border-muted)] rounded-2xl shadow-2xl animate-fade-in ${widthClass}`}\n onClick={(event) => {\n // The one place a click inside the panel must not reach the backdrop.\n event.stopPropagation();\n }}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={ariaLabel}\n >\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={closeLabel}\n className=\"absolute top-3 right-3 text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors\"\n >\n {closeLabel}\n </button>\n {children}\n </div>\n </div>\n );\n}\n\nexport { ModalShell };\nexport type { ModalShellProps };\n"],
|
|
5
|
+
"mappings": "kDAAA,OAAS,aAAAA,MAAiC,QA4D1C,SAASC,EAAW,CAAE,QAAAC,EAAS,SAAAC,EAAU,WAAAC,EAAa,OAAQ,UAAAC,EAAW,WAAAC,EAAa,QAAS,cAAAC,EAAgB,EAAI,EAAmB,CACpI,OAAAP,EAAU,IAAK,CACb,GAAI,CAACO,EAAe,OACpB,MAAMC,EAAaC,GAA8B,CAC3CA,EAAM,MAAQ,UAAUP,EAAO,CACrC,EACA,wBAAiB,UAAWM,CAAS,EAG9B,IAAY,oBAAoB,UAAWA,CAAS,CAC7D,EAAG,CAACD,EAAeL,CAAO,CAAC,EAGzBQ,EAAA,MAAA,CAAK,UAAU,sDAAsD,QAASR,EAAS,KAAK,eAAc,SAAA,CACxGS,EAAA,MAAA,CAAK,UAAU,gDAA+C,cAAa,MAAM,CAAA,EACjFD,EAAA,MAAA,CACE,UAAW,yHAAyHN,CAAU,GAC9I,QAAUK,GAAS,CAEjBA,EAAM,gBAAe,CACvB,EACA,KAAK,SAAQ,aACF,OAAM,aACLJ,EAAS,SAAA,CAErBM,EAAA,SAAA,CACE,KAAK,SACL,QAAST,EAAO,aACJI,EACZ,UAAU,iHAAgH,SAEzHA,CAAU,CAAA,EAEZH,CAAQ,CAAA,CAAA,CACL,CAAA,CAAA,CAGZ",
|
|
6
|
+
"names": ["useEffect", "ModalShell", "onClose", "children", "widthClass", "ariaLabel", "closeLabel", "closeOnEscape", "onKeyDown", "event", "_jsxs", "_jsx"]
|
|
7
|
+
}
|
package/dist/NoticeBar.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Notice, NoticeKind } from './useNotice';
|
|
1
|
+
import type { Notice, NoticeKind } from './useNotice.ts';
|
|
2
2
|
/**
|
|
3
3
|
* The transient status banner.
|
|
4
4
|
*
|
|
@@ -30,10 +30,14 @@ import type { Notice, NoticeKind } from './useNotice';
|
|
|
30
30
|
* Mail-Otter's copy dropped the screen-reader-only status prefix entirely,
|
|
31
31
|
* which loses the kind for a user who cannot see the colour.
|
|
32
32
|
*/
|
|
33
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
The two accessible names, keyed by the kind they announce.
|
|
35
|
+
*/
|
|
34
36
|
type NoticeStatusLabels = Record<NoticeKind, string>;
|
|
35
37
|
interface NoticeBarProps {
|
|
36
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
The notice to show, or `null` for nothing — which is what `useNotice` hands back when idle.
|
|
40
|
+
*/
|
|
37
41
|
notice: Notice | null;
|
|
38
42
|
/**
|
|
39
43
|
* The screen-reader prefix for each kind, e.g. `{ success: 'Success', error: 'Error' }`.
|
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;;EAEE;AACF,KAAK,kBAAkB,GAAG,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAErD,UAAU,cAAc;IACtB;;MAEE;IACF,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
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
function NoticeBar({ notice, statusLabels }) {
|
|
3
|
-
if (notice === null)
|
|
4
|
-
return null;
|
|
5
|
-
const isError = notice.kind === 'error';
|
|
6
|
-
return (_jsxs("div", {
|
|
7
|
-
// Errors assert; successes stay polite. See the file header for why this
|
|
8
|
-
// is not one role for both.
|
|
9
|
-
role: isError ? 'alert' : 'status', className: "fixed top-20 left-1/2 -translate-x-1/2 z-50 animate-slide-down px-5 py-3 rounded-xl shadow-xl bg-[var(--color-surface-2)] border border-[var(--color-border-muted)] max-w-[calc(100vw-2rem)]", children: [_jsxs("span", { className: "sr-only", children: [statusLabels[notice.kind], ": "] }), _jsx("span", { className: isError ? 'text-[var(--color-error-text)]' : 'text-[var(--color-success-text)]', children: notice.message })] }));
|
|
10
|
-
}
|
|
11
|
-
export { NoticeBar };
|
|
12
|
-
//# sourceMappingURL=NoticeBar.js.map
|
|
1
|
+
import{jsxs as s,jsx as l}from"react/jsx-runtime";function o({notice:r,statusLabels:a}){if(r===null)return null;const e=r.kind==="error";return s("div",{role:e?"alert":"status",className:"fixed top-20 left-1/2 -translate-x-1/2 z-50 animate-slide-down px-5 py-3 rounded-xl shadow-xl bg-[var(--color-surface-2)] border border-[var(--color-border-muted)] max-w-[calc(100vw-2rem)]",children:[s("span",{className:"sr-only",children:[a[r.kind],": "]}),l("span",{className:e?"text-[var(--color-error-text)]":"text-[var(--color-success-text)]",children:r.message})]})}export{o as NoticeBar};
|
package/dist/NoticeBar.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/NoticeBar.tsx"],
|
|
4
|
+
"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/**\nThe two accessible names, keyed by the kind they announce.\n*/\ntype NoticeStatusLabels = Record<NoticeKind, string>;\n\ninterface NoticeBarProps {\n /**\n The notice to show, or `null` for nothing — which is what `useNotice` hands back when idle.\n */\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"],
|
|
5
|
+
"mappings": "kDAsDA,SAASA,EAAU,CAAE,OAAAC,EAAQ,aAAAC,CAAY,EAA4B,CACnE,GAAID,IAAW,KAAM,OAAO,KAE5B,MAAME,EAAUF,EAAO,OAAS,QAEhC,OACEG,EAAA,MAAA,CAGE,KAAMD,EAAU,QAAU,SAC1B,UAAU,+LAA8L,SAAA,CAExMC,EAAA,OAAA,CAAM,UAAU,UAAS,SAAA,CAAEF,EAAaD,EAAO,IAAI,EAAC,IAAA,CAAA,CAAA,EACpDI,EAAA,OAAA,CAAM,UAAWF,EAAU,iCAAmC,mCAAkC,SAAGF,EAAO,OAAO,CAAA,CAAQ,CAAA,CAAA,CAG/H",
|
|
6
|
+
"names": ["NoticeBar", "notice", "statusLabels", "isError", "_jsxs", "_jsx"]
|
|
7
|
+
}
|
package/dist/PageHeaderCard.d.ts
CHANGED
|
@@ -12,7 +12,9 @@ import type { ReactNode } from 'react';
|
|
|
12
12
|
* per page, which is how a header bar came to sit at four different heights.
|
|
13
13
|
*/
|
|
14
14
|
interface PageHeaderCardProps {
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
Leading avatar. Omitted renders no avatar slot at all, not an empty one.
|
|
17
|
+
*/
|
|
16
18
|
icon?: ReactNode;
|
|
17
19
|
/**
|
|
18
20
|
* The page's name.
|
|
@@ -31,7 +33,9 @@ interface PageHeaderCardProps {
|
|
|
31
33
|
* it means the layout is the same whether or not there is something to say.
|
|
32
34
|
*/
|
|
33
35
|
description: ReactNode;
|
|
34
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
Right-aligned. Omitted renders no actions slot.
|
|
38
|
+
*/
|
|
35
39
|
actions?: ReactNode;
|
|
36
40
|
}
|
|
37
41
|
declare function PageHeaderCard({ icon, title, description, actions }: Readonly<PageHeaderCardProps>): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageHeaderCard.d.ts","sourceRoot":"","sources":["../src/PageHeaderCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC;;;;;;;;;;;GAWG;AAEH,UAAU,mBAAmB;IAC3B
|
|
1
|
+
{"version":3,"file":"PageHeaderCard.d.ts","sourceRoot":"","sources":["../src/PageHeaderCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC;;;;;;;;;;;GAWG;AAEH,UAAU,mBAAmB;IAC3B;;MAEE;IACF,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;;;OAMG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;;;;;;OAOG;IACH,WAAW,EAAE,SAAS,CAAC;IACvB;;MAEE;IACF,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,iBAAS,cAAc,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,QAAQ,CAAC,mBAAmB,CAAC,+BAa3F;AAED,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,YAAY,EAAE,mBAAmB,EAAE,CAAC"}
|
package/dist/PageHeaderCard.js
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Card } from './Card';
|
|
3
|
-
function PageHeaderCard({ icon, title, description, actions }) {
|
|
4
|
-
return (_jsxs(Card, { className: "flex flex-col lg:flex-row lg:items-center justify-between gap-4 py-4", children: [_jsxs("div", { className: "flex items-center gap-3 min-w-0", children: [icon && _jsx("div", { className: "flex items-center justify-center w-10 h-10 rounded-full bg-[var(--color-surface-3)] shrink-0", children: icon }), _jsxs("div", { className: "min-w-0", children: [_jsx("h1", { className: "text-xl font-semibold text-[var(--color-text-primary)] truncate", children: title }), description && _jsx("div", { className: "text-sm text-[var(--color-text-muted)] truncate", children: description })] })] }), actions && _jsx("div", { className: "flex flex-wrap items-center gap-3 shrink-0", children: actions })] }));
|
|
5
|
-
}
|
|
6
|
-
export { PageHeaderCard };
|
|
7
|
-
//# sourceMappingURL=PageHeaderCard.js.map
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{Card as c}from"./Card.js";function i({icon:t,title:a,description:l,actions:s}){return r(c,{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-4 py-4",children:[r("div",{className:"flex items-center gap-3 min-w-0",children:[t&&e("div",{className:"flex items-center justify-center w-10 h-10 rounded-full bg-[var(--color-surface-3)] shrink-0",children:t}),r("div",{className:"min-w-0",children:[e("h1",{className:"text-xl font-semibold text-[var(--color-text-primary)] truncate",children:a}),l&&e("div",{className:"text-sm text-[var(--color-text-muted)] truncate",children:l})]})]}),s&&e("div",{className:"flex flex-wrap items-center gap-3 shrink-0",children:s})]})}export{i as PageHeaderCard};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/PageHeaderCard.tsx"],
|
|
4
|
+
"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 /**\n Leading avatar. Omitted renders no avatar slot at all, not an empty one.\n */\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 /**\n Right-aligned. Omitted renders no actions slot.\n */\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"],
|
|
5
|
+
"mappings": "kDACA,OAAS,QAAAA,MAAY,YA2CrB,SAASC,EAAe,CAAE,KAAAC,EAAM,MAAAC,EAAO,YAAAC,EAAa,QAAAC,CAAO,EAAiC,CAC1F,OACEC,EAACN,EAAI,CAAC,UAAU,uEAAsE,SAAA,CACpFM,EAAA,MAAA,CAAK,UAAU,kCAAiC,SAAA,CAC7CJ,GAAQK,EAAA,MAAA,CAAK,UAAU,+FAA8F,SAAEL,CAAI,CAAA,EAC5HI,EAAA,MAAA,CAAK,UAAU,UAAS,SAAA,CACtBC,EAAA,KAAA,CAAI,UAAU,kEAAiE,SAAEJ,CAAK,CAAA,EACrFC,GAAeG,EAAA,MAAA,CAAK,UAAU,kDAAiD,SAAEH,CAAW,CAAA,CAAO,CAAA,CAAA,CAChG,CAAA,CAAA,EAEPC,GAAWE,EAAA,MAAA,CAAK,UAAU,6CAA4C,SAAEF,CAAO,CAAA,CAAO,CAAA,CAAA,CAG7F",
|
|
6
|
+
"names": ["Card", "PageHeaderCard", "icon", "title", "description", "actions", "_jsxs", "_jsx"]
|
|
7
|
+
}
|
package/dist/PageState.d.ts
CHANGED
|
@@ -10,11 +10,15 @@ import type { ReactNode } from 'react';
|
|
|
10
10
|
* `useTranslation`, so a consumer is not required to run a translation library
|
|
11
11
|
* to render a spinner.
|
|
12
12
|
*/
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
The shared spinner. `label` is announced, so it should say what is loading.
|
|
15
|
+
*/
|
|
14
16
|
declare function LoadingSpinner({ label }: {
|
|
15
17
|
label?: string;
|
|
16
18
|
}): import("react").JSX.Element;
|
|
17
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
The shared centered empty message, with an optional icon above it.
|
|
21
|
+
*/
|
|
18
22
|
declare function EmptyState({ icon, message }: {
|
|
19
23
|
icon?: ReactNode;
|
|
20
24
|
message: ReactNode;
|
|
@@ -35,7 +39,9 @@ declare function EmptyState({ icon, message }: {
|
|
|
35
39
|
* two things.
|
|
36
40
|
*/
|
|
37
41
|
declare function ConfirmDeleteModal({ message, confirmLabel, cancelLabel, ariaLabel, onConfirm, onCancel, }: {
|
|
38
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
The full question, naming what will be deleted.
|
|
44
|
+
*/
|
|
39
45
|
message: ReactNode;
|
|
40
46
|
confirmLabel: string;
|
|
41
47
|
cancelLabel: string;
|
package/dist/PageState.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageState.d.ts","sourceRoot":"","sources":["../src/PageState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC;;;;;;;;;;GAUG;AAEH
|
|
1
|
+
{"version":3,"file":"PageState.d.ts","sourceRoot":"","sources":["../src/PageState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC;;;;;;;;;;GAUG;AAEH;;EAEE;AACF,iBAAS,cAAc,CAAC,EAAE,KAAkB,EAAE,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,+BAMjE;AAED;;EAEE;AACF,iBAAS,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,SAAS,CAAA;CAAE,+BAO9E;AAED;;;;;;;;;;;;;;GAcG;AACH,iBAAS,kBAAkB,CAAC,EAC1B,OAAO,EACP,YAAY,EACZ,WAAW,EACX,SAAS,EACT,SAAS,EACT,QAAQ,GACT,EAAE;IACD;;MAEE;IACF,OAAO,EAAE,SAAS,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,+BA8BA;AAED,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/PageState.js
CHANGED
|
@@ -1,47 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ModalShell } from './ModalShell';
|
|
3
|
-
/**
|
|
4
|
-
* The shared loading / empty / error states.
|
|
5
|
-
*
|
|
6
|
-
* Converged from `components/layout/PageState.tsx` (Durable-DAV,
|
|
7
|
-
* Durable-DAV-Router) and `EmptyState` (CalDAV-Bridge), which were the same two
|
|
8
|
-
* components under two names.
|
|
9
|
-
*
|
|
10
|
-
* Same reasoning as `ModalShell`: the label arrives as a prop rather than from
|
|
11
|
-
* `useTranslation`, so a consumer is not required to run a translation library
|
|
12
|
-
* to render a spinner.
|
|
13
|
-
*/
|
|
14
|
-
/** The shared spinner. `label` is announced, so it should say what is loading. */
|
|
15
|
-
function LoadingSpinner({ label = 'Loading…' }) {
|
|
16
|
-
return (_jsx("div", { className: "min-h-64 flex items-center justify-center", role: "status", "aria-label": label, children: _jsx("div", { className: "h-10 w-10 rounded-full border-2 border-[var(--color-accent)] border-t-transparent animate-spin" }) }));
|
|
17
|
-
}
|
|
18
|
-
/** The shared centered empty message, with an optional icon above it. */
|
|
19
|
-
function EmptyState({ icon, message }) {
|
|
20
|
-
return (_jsxs("div", { className: "text-center text-[var(--color-text-muted)] py-10 text-sm", children: [icon && _jsx("div", { className: "mb-3 flex justify-center", children: icon }), message] }));
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* A confirmation for a destructive action.
|
|
24
|
-
*
|
|
25
|
-
* `message` is required to **name the thing being deleted**, not to say "this
|
|
26
|
-
* item" — the operator is the only one who can tell whether they meant to
|
|
27
|
-
* delete it, so the dialog has to be specific. That is a contract on the
|
|
28
|
-
* caller, not something the component can enforce, which is why `message` is a
|
|
29
|
-
* `ReactNode` the caller composes rather than a template this fills in.
|
|
30
|
-
*
|
|
31
|
-
* No confirm timer: a dialog that arms itself makes the operator wait for a
|
|
32
|
-
* decision they were already qualified to make.
|
|
33
|
-
*
|
|
34
|
-
* Both handlers stop propagation, because a confirm that fires twice deletes
|
|
35
|
-
* two things.
|
|
36
|
-
*/
|
|
37
|
-
function ConfirmDeleteModal({ message, confirmLabel, cancelLabel, ariaLabel, onConfirm, onCancel, }) {
|
|
38
|
-
return (_jsx(ModalShell, { onClose: onCancel, widthClass: "w-80", ariaLabel: ariaLabel, children: _jsxs("div", { className: "p-6", children: [_jsx("p", { className: "text-sm text-[var(--color-text-secondary)] text-center mb-6", children: message }), _jsxs("div", { className: "flex gap-3", children: [_jsx("button", { type: "button", className: "flex-1", onClick: (event) => {
|
|
39
|
-
event.stopPropagation();
|
|
40
|
-
onCancel();
|
|
41
|
-
}, children: cancelLabel }), _jsx("button", { type: "button", className: "flex-1", onClick: (event) => {
|
|
42
|
-
event.stopPropagation();
|
|
43
|
-
onConfirm();
|
|
44
|
-
}, children: confirmLabel })] })] }) }));
|
|
45
|
-
}
|
|
46
|
-
export { ConfirmDeleteModal, EmptyState, LoadingSpinner };
|
|
47
|
-
//# sourceMappingURL=PageState.js.map
|
|
1
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import{ModalShell as c}from"./ModalShell.js";function d({label:t="Loading\u2026"}){return e("div",{className:"min-h-64 flex items-center justify-center",role:"status","aria-label":t,children:e("div",{className:"h-10 w-10 rounded-full border-2 border-[var(--color-accent)] border-t-transparent animate-spin"})})}function m({icon:t,message:r}){return n("div",{className:"text-center text-[var(--color-text-muted)] py-10 text-sm",children:[t&&e("div",{className:"mb-3 flex justify-center",children:t}),r]})}function x({message:t,confirmLabel:r,cancelLabel:l,ariaLabel:o,onConfirm:i,onCancel:s}){return e(c,{onClose:s,widthClass:"w-80",ariaLabel:o,children:n("div",{className:"p-6",children:[e("p",{className:"text-sm text-[var(--color-text-secondary)] text-center mb-6",children:t}),n("div",{className:"flex gap-3",children:[e("button",{type:"button",className:"flex-1",onClick:a=>{a.stopPropagation(),s()},children:l}),e("button",{type:"button",className:"flex-1",onClick:a=>{a.stopPropagation(),i()},children:r})]})]})})}export{x as ConfirmDeleteModal,m as EmptyState,d as LoadingSpinner};
|
package/dist/PageState.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/PageState.tsx"],
|
|
4
|
+
"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/**\nThe shared spinner. `label` is announced, so it should say what is loading.\n*/\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/**\nThe shared centered empty message, with an optional icon above it.\n*/\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 /**\n The full question, naming what will be deleted.\n */\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"],
|
|
5
|
+
"mappings": "kDACA,OAAS,cAAAA,MAAkB,kBAiB3B,SAASC,EAAe,CAAE,MAAAC,EAAQ,eAAU,EAAsB,CAChE,OACEC,EAAA,MAAA,CAAK,UAAU,4CAA4C,KAAK,SAAQ,aAAaD,EAAK,SACxFC,EAAA,MAAA,CAAK,UAAU,gGAAgG,CAAA,CAAG,CAAA,CAGxH,CAKA,SAASC,EAAW,CAAE,KAAAC,EAAM,QAAAC,CAAO,EAA4C,CAC7E,OACEC,EAAA,MAAA,CAAK,UAAU,2DAA0D,SAAA,CACtEF,GAAQF,EAAA,MAAA,CAAK,UAAU,2BAA0B,SAAEE,CAAI,CAAA,EACvDC,CAAO,CAAA,CAAA,CAGd,CAiBA,SAASE,EAAmB,CAC1B,QAAAF,EACA,aAAAG,EACA,YAAAC,EACA,UAAAC,EACA,UAAAC,EACA,SAAAC,CAAQ,EAWT,CACC,OACEV,EAACH,EAAU,CAAC,QAASa,EAAU,WAAW,OAAO,UAAWF,EAAS,SACnEJ,EAAA,MAAA,CAAK,UAAU,MAAK,SAAA,CAClBJ,EAAA,IAAA,CAAG,UAAU,8DAA6D,SAAEG,CAAO,CAAA,EACnFC,EAAA,MAAA,CAAK,UAAU,aAAY,SAAA,CACzBJ,EAAA,SAAA,CACE,KAAK,SACL,UAAU,SACV,QAAUW,GAAS,CACjBA,EAAM,gBAAe,EACrBD,EAAQ,CACV,EAAC,SAEAH,CAAW,CAAA,EAEdP,EAAA,SAAA,CACE,KAAK,SACL,UAAU,SACV,QAAUW,GAAS,CACjBA,EAAM,gBAAe,EACrBF,EAAS,CACX,EAAC,SAEAH,CAAY,CAAA,CACN,CAAA,CAAA,CACL,CAAA,CAAA,CACF,CAAA,CAGZ",
|
|
6
|
+
"names": ["ModalShell", "LoadingSpinner", "label", "_jsx", "EmptyState", "icon", "message", "_jsxs", "ConfirmDeleteModal", "confirmLabel", "cancelLabel", "ariaLabel", "onConfirm", "onCancel", "event"]
|
|
7
|
+
}
|