@surfaces-ui/components 0.7.0 → 0.8.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.
@@ -12,7 +12,17 @@ export interface ConfirmDialogProps {
12
12
  cancelLabel?: string;
13
13
  /** For something that takes away or cannot be undone: the button is marked, and Cancel has focus first. */
14
14
  danger?: boolean;
15
- onConfirm(): void;
15
+ /**
16
+ * A word the person must type before the button goes ahead, for something that cannot be undone. Until it is
17
+ * typed the button is marked unavailable; a press then says what is missing and moves to the box.
18
+ */
19
+ typedWord?: string;
20
+ /** Asks why, in a box of its own. `required`: the button waits for it as it waits for the word. */
21
+ reason?: "optional" | "required";
22
+ /** Given what the person wrote as the reason, when `reason` asks for one. */
23
+ onConfirm(answer: {
24
+ reason: string;
25
+ }): void;
16
26
  /** Cancel, Escape, or a press outside the dialog. */
17
27
  onCancel(): void;
18
28
  className?: string;
@@ -22,12 +32,17 @@ export interface ConfirmDialogProps {
22
32
  * inside it and returns where it was, and Escape cancels. Name the button for the action. For something that can be
23
33
  * undone, prefer doing it and offering Undo (`ActionReceipt`). `useConfirm` asks from code and waits for the answer.
24
34
  */
25
- export declare function ConfirmDialog({ open, title, body, confirmLabel, cancelLabel, danger, onConfirm, onCancel, className }: ConfirmDialogProps): import("react").JSX.Element | null;
35
+ export declare function ConfirmDialog({ open, title, body, confirmLabel, cancelLabel, danger, typedWord, reason, onConfirm, onCancel, className }: ConfirmDialogProps): import("react").JSX.Element | null;
26
36
  /** What `useConfirm`'s `confirm` asks. */
27
37
  export type ConfirmRequest = Omit<ConfirmDialogProps, "open" | "onConfirm" | "onCancel">;
28
38
  export interface Confirm {
29
39
  /** Shows the dialog and resolves true if the person goes ahead, false if not. Asking again while one is open answers the first with false. */
30
40
  confirm(request: ConfirmRequest): Promise<boolean>;
41
+ /** As `confirm`, with what the person wrote as the reason (`reason` on the request). */
42
+ ask(request: ConfirmRequest): Promise<{
43
+ confirmed: boolean;
44
+ reason: string;
45
+ }>;
31
46
  /** Render this once, anywhere in the component. */
32
47
  element: ReactNode;
33
48
  }
@@ -6,26 +6,40 @@ import { label as text } from "../locale/locale.js";
6
6
  * inside it and returns where it was, and Escape cancels. Name the button for the action. For something that can be
7
7
  * undone, prefer doing it and offering Undo (`ActionReceipt`). `useConfirm` asks from code and waits for the answer.
8
8
  */
9
- export function ConfirmDialog({ open, title, body, confirmLabel, cancelLabel, danger, onConfirm, onCancel, className }) {
9
+ export function ConfirmDialog({ open, title, body, confirmLabel, cancelLabel, danger, typedWord, reason, onConfirm, onCancel, className }) {
10
10
  const dialog = useRef(null);
11
11
  const cancel = useRef(null);
12
12
  const confirm = useRef(null);
13
13
  const titleId = useId();
14
14
  const bodyId = useId();
15
15
  const answered = useRef(false);
16
+ const wordId = useId();
17
+ const reasonId = useId();
18
+ const errorId = useId();
19
+ const wordBox = useRef(null);
20
+ const reasonBox = useRef(null);
21
+ const [word, setWord] = useState("");
22
+ const [why, setWhy] = useState("");
23
+ const [told, setTold] = useState("");
24
+ const wordMissing = typedWord !== undefined && word.trim().toLowerCase() !== typedWord.toLowerCase();
25
+ const reasonMissing = reason === "required" && why.trim() === "";
16
26
  useEffect(() => {
17
27
  const element = dialog.current;
18
28
  if (!element)
19
29
  return;
20
30
  if (open && !element.open) {
21
31
  answered.current = false;
32
+ setWord("");
33
+ setWhy("");
34
+ setTold("");
22
35
  const back = document.activeElement instanceof HTMLElement ? document.activeElement : null;
23
36
  // A browser without modal dialogs (and jsdom) still shows it, without making the page behind inert.
24
37
  if (typeof element.showModal === "function")
25
38
  element.showModal();
26
39
  else
27
40
  element.setAttribute("open", "");
28
- (danger ? cancel : confirm).current?.focus();
41
+ // Something to fill in comes first: a person starts where they must type. Otherwise Cancel for a dangerous action.
42
+ (reasonBox.current ?? wordBox.current ?? (danger ? cancel : confirm).current)?.focus();
29
43
  return () => {
30
44
  if (element.open)
31
45
  element.close?.();
@@ -38,9 +52,15 @@ export function ConfirmDialog({ open, title, body, confirmLabel, cancelLabel, da
38
52
  const answer = (yes) => {
39
53
  if (answered.current)
40
54
  return;
55
+ if (yes && (wordMissing || reasonMissing)) {
56
+ // Say what is missing and go to it; the dialog stays.
57
+ setTold(wordMissing ? text("confirm.needWord", { word: typedWord ?? "" }) : text("confirm.needReason"));
58
+ (wordMissing ? wordBox : reasonBox).current?.focus();
59
+ return;
60
+ }
41
61
  answered.current = true;
42
62
  if (yes)
43
- onConfirm();
63
+ onConfirm({ reason: why.trim() });
44
64
  else
45
65
  onCancel();
46
66
  };
@@ -50,7 +70,9 @@ export function ConfirmDialog({ open, title, body, confirmLabel, cancelLabel, da
50
70
  // Escape: answer as Cancel, and let React close it.
51
71
  event.preventDefault();
52
72
  answer(false);
53
- }, onMouseDown: (event) => {
73
+ },
74
+ // A browser may close a dialog on Escape without asking first (no `cancel`): that is still an answer of no.
75
+ onClose: () => answer(false), onMouseDown: (event) => {
54
76
  // A press on the backdrop lands on the dialog itself, outside its box.
55
77
  if (event.target === dialog.current) {
56
78
  const box = dialog.current.getBoundingClientRect();
@@ -58,27 +80,31 @@ export function ConfirmDialog({ open, title, body, confirmLabel, cancelLabel, da
58
80
  if (!inside)
59
81
  answer(false);
60
82
  }
61
- }, children: [_jsx("h2", { id: titleId, className: "sf-confirm-title", children: title }), body && (_jsx("div", { id: bodyId, className: "sf-confirm-body", children: body })), _jsxs("div", { className: "sf-confirm-actions", children: [_jsx("button", { ref: cancel, type: "button", className: "sf-button", onClick: () => answer(false), children: cancelLabel ?? text("confirm.cancel") }), _jsx("button", { ref: confirm, type: "button", className: "sf-button", "data-variant": danger ? "danger" : "primary", onClick: () => answer(true), children: confirmLabel ?? text("confirm.confirm") })] })] }));
83
+ }, children: [_jsx("h2", { id: titleId, className: "sf-confirm-title", children: title }), body && (_jsx("div", { id: bodyId, className: "sf-confirm-body", children: body })), (typedWord !== undefined || reason) && (_jsxs("form", { className: "sf-confirm-fields", onSubmit: (event) => {
84
+ event.preventDefault();
85
+ answer(true);
86
+ }, children: [reason && (_jsxs("label", { className: "sf-confirm-field", htmlFor: reasonId, children: [_jsx("span", { children: text(reason === "required" ? "confirm.reasonRequired" : "confirm.reason") }), _jsx("input", { ref: reasonBox, id: reasonId, className: "sf-input", value: why, onChange: (event) => setWhy(event.target.value), "aria-required": reason === "required" || undefined, "aria-invalid": (told !== "" && reasonMissing) || undefined, "aria-describedby": told ? errorId : undefined, autoComplete: "off" })] })), typedWord !== undefined && (_jsxs("label", { className: "sf-confirm-field", htmlFor: wordId, children: [_jsx("span", { children: text("confirm.typeWord", { word: typedWord }) }), _jsx("input", { ref: wordBox, id: wordId, className: "sf-input", value: word, onChange: (event) => setWord(event.target.value), "aria-required": "true", "aria-invalid": (told !== "" && wordMissing) || undefined, "aria-describedby": told ? errorId : undefined, autoComplete: "off", autoCapitalize: "off", spellCheck: false })] })), told && (wordMissing || reasonMissing) && (_jsx("p", { id: errorId, className: "sf-confirm-error", role: "alert", children: told }))] })), _jsxs("div", { className: "sf-confirm-actions", children: [_jsx("button", { ref: cancel, type: "button", className: "sf-button", onClick: () => answer(false), children: cancelLabel ?? text("confirm.cancel") }), _jsx("button", { ref: confirm, type: "button", className: "sf-button", "data-variant": danger ? "danger" : "primary", "aria-disabled": wordMissing || reasonMissing || undefined, onClick: () => answer(true), children: confirmLabel ?? text("confirm.confirm") })] })] }));
62
87
  }
63
88
  /** Asks for confirmation from an event handler: `if (await confirm({ title, body, confirmLabel, danger })) run()`. */
64
89
  export function useConfirm() {
65
90
  const [request, setRequest] = useState();
66
91
  const pending = useRef(undefined);
67
- const settle = useCallback((yes) => {
92
+ const settle = useCallback((yes, reason = "") => {
68
93
  const resolve = pending.current;
69
94
  pending.current = undefined;
70
95
  setRequest(undefined);
71
- resolve?.(yes);
96
+ resolve?.(yes, reason);
72
97
  }, []);
73
98
  useEffect(() => () => pending.current?.(false), []);
74
- const confirm = useCallback((next) => {
99
+ const ask = useCallback((next) => {
75
100
  pending.current?.(false);
76
101
  setRequest(next);
77
102
  return new Promise((resolve) => {
78
- pending.current = resolve;
103
+ pending.current = (confirmed, reason = "") => resolve({ confirmed, reason });
79
104
  });
80
105
  }, []);
81
- const element = request ? _jsx(ConfirmDialog, { ...request, open: true, onConfirm: () => settle(true), onCancel: () => settle(false) }) : null;
82
- return { confirm, element };
106
+ const confirm = useCallback((next) => ask(next).then((answer) => answer.confirmed), [ask]);
107
+ const element = request ? _jsx(ConfirmDialog, { ...request, open: true, onConfirm: (answer) => settle(true, answer.reason), onCancel: () => settle(false) }) : null;
108
+ return { confirm, ask, element };
83
109
  }
84
110
  //# sourceMappingURL=ConfirmDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmDialog.js","sourceRoot":"","sources":["../../src/controls/ConfirmDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxF,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAqBpD;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAsB;IACxI,MAAM,MAAM,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC;IACxB,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC;IACvB,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAE/B,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,IAAI,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AAC;IACnI,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["import { type ReactNode, useCallback, useEffect, useId, useRef, useState } from \"react\";\nimport { label as text } from \"../locale/locale.js\";\n\nexport interface ConfirmDialogProps {\n /** Whether the dialog is showing. */\n open: boolean;\n /** The question, as a heading: \"Turn off 5 accounts?\" */\n title: string;\n /** What will happen, and what cannot be undone. */\n body?: ReactNode;\n /** The button that goes ahead, named for what it does: \"Turn off\", not \"OK\". Defaults to \"Confirm\". */\n confirmLabel?: string;\n /** Defaults to \"Cancel\". */\n cancelLabel?: string;\n /** For something that takes away or cannot be undone: the button is marked, and Cancel has focus first. */\n danger?: boolean;\n onConfirm(): void;\n /** Cancel, Escape, or a press outside the dialog. */\n onCancel(): void;\n className?: string;\n}\n\n/**\n * Asks a person to confirm one action before it runs, as a modal dialog: the page behind cannot be used, focus starts\n * inside it and returns where it was, and Escape cancels. Name the button for the action. For something that can be\n * undone, prefer doing it and offering Undo (`ActionReceipt`). `useConfirm` asks from code and waits for the answer.\n */\nexport function ConfirmDialog({ open, title, body, confirmLabel, cancelLabel, danger, onConfirm, onCancel, className }: ConfirmDialogProps) {\n const dialog = useRef<HTMLDialogElement>(null);\n const cancel = useRef<HTMLButtonElement>(null);\n const confirm = useRef<HTMLButtonElement>(null);\n const titleId = useId();\n const bodyId = useId();\n const answered = useRef(false);\n\n useEffect(() => {\n const element = dialog.current;\n if (!element) return;\n if (open && !element.open) {\n answered.current = false;\n const back = document.activeElement instanceof HTMLElement ? document.activeElement : null;\n // A browser without modal dialogs (and jsdom) still shows it, without making the page behind inert.\n if (typeof element.showModal === \"function\") element.showModal();\n else element.setAttribute(\"open\", \"\");\n (danger ? cancel : confirm).current?.focus();\n return () => {\n if (element.open) element.close?.();\n element.removeAttribute(\"open\");\n back?.focus();\n };\n }\n return undefined;\n }, [open, danger]);\n\n const answer = (yes: boolean) => {\n if (answered.current) return;\n answered.current = true;\n if (yes) onConfirm();\n else onCancel();\n };\n\n if (!open) return null;\n return (\n <dialog\n ref={dialog}\n className={[\"sf-confirm\", className].filter(Boolean).join(\" \")}\n aria-labelledby={titleId}\n aria-describedby={body ? bodyId : undefined}\n onCancel={(event) => {\n // Escape: answer as Cancel, and let React close it.\n event.preventDefault();\n answer(false);\n }}\n onMouseDown={(event) => {\n // A press on the backdrop lands on the dialog itself, outside its box.\n if (event.target === dialog.current) {\n const box = dialog.current.getBoundingClientRect();\n const inside = event.clientX >= box.left && event.clientX <= box.right && event.clientY >= box.top && event.clientY <= box.bottom;\n if (!inside) answer(false);\n }\n }}\n >\n <h2 id={titleId} className=\"sf-confirm-title\">\n {title}\n </h2>\n {body && (\n <div id={bodyId} className=\"sf-confirm-body\">\n {body}\n </div>\n )}\n <div className=\"sf-confirm-actions\">\n <button ref={cancel} type=\"button\" className=\"sf-button\" onClick={() => answer(false)}>\n {cancelLabel ?? text(\"confirm.cancel\")}\n </button>\n <button ref={confirm} type=\"button\" className=\"sf-button\" data-variant={danger ? \"danger\" : \"primary\"} onClick={() => answer(true)}>\n {confirmLabel ?? text(\"confirm.confirm\")}\n </button>\n </div>\n </dialog>\n );\n}\n\n/** What `useConfirm`'s `confirm` asks. */\nexport type ConfirmRequest = Omit<ConfirmDialogProps, \"open\" | \"onConfirm\" | \"onCancel\">;\n\nexport interface Confirm {\n /** Shows the dialog and resolves true if the person goes ahead, false if not. Asking again while one is open answers the first with false. */\n confirm(request: ConfirmRequest): Promise<boolean>;\n /** Render this once, anywhere in the component. */\n element: ReactNode;\n}\n\n/** Asks for confirmation from an event handler: `if (await confirm({ title, body, confirmLabel, danger })) run()`. */\nexport function useConfirm(): Confirm {\n const [request, setRequest] = useState<ConfirmRequest>();\n const pending = useRef<(yes: boolean) => void>(undefined);\n const settle = useCallback((yes: boolean) => {\n const resolve = pending.current;\n pending.current = undefined;\n setRequest(undefined);\n resolve?.(yes);\n }, []);\n useEffect(() => () => pending.current?.(false), []);\n const confirm = useCallback((next: ConfirmRequest) => {\n pending.current?.(false);\n setRequest(next);\n return new Promise<boolean>((resolve) => {\n pending.current = resolve;\n });\n }, []);\n const element = request ? <ConfirmDialog {...request} open onConfirm={() => settle(true)} onCancel={() => settle(false)} /> : null;\n return { confirm, element };\n}\n"]}
1
+ {"version":3,"file":"ConfirmDialog.js","sourceRoot":"","sources":["../../src/controls/ConfirmDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxF,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,MAAM,qBAAqB,CAAC;AA6BpD;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAsB;IAC3J,MAAM,MAAM,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC;IACxB,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC;IACvB,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/B,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC;IACvB,MAAM,QAAQ,GAAG,KAAK,EAAE,CAAC;IACzB,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC;IACxB,MAAM,OAAO,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IACjD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACrC,MA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OAAO,CAAyC,CAAC,OAAO,EAAE,EAAE;YACrE,OAAO,CAAC,OAAO,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,IAAoB,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3G,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,KAAC,aAAa,OAAK,OAAO,EAAE,IAAI,QAAC,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IACxJ,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AACnC,CAAC","sourcesContent":["import { type ReactNode, useCallback, useEffect, useId, useRef, useState } from \"react\";\nimport { label as text } from \"../locale/locale.js\";\n\nexport interface ConfirmDialogProps {\n /** Whether the dialog is showing. */\n open: boolean;\n /** The question, as a heading: \"Turn off 5 accounts?\" */\n title: string;\n /** What will happen, and what cannot be undone. */\n body?: ReactNode;\n /** The button that goes ahead, named for what it does: \"Turn off\", not \"OK\". Defaults to \"Confirm\". */\n confirmLabel?: string;\n /** Defaults to \"Cancel\". */\n cancelLabel?: string;\n /** For something that takes away or cannot be undone: the button is marked, and Cancel has focus first. */\n danger?: boolean;\n /**\n * A word the person must type before the button goes ahead, for something that cannot be undone. Until it is\n * typed the button is marked unavailable; a press then says what is missing and moves to the box.\n */\n typedWord?: string;\n /** Asks why, in a box of its own. `required`: the button waits for it as it waits for the word. */\n reason?: \"optional\" | \"required\";\n /** Given what the person wrote as the reason, when `reason` asks for one. */\n onConfirm(answer: { reason: string }): void;\n /** Cancel, Escape, or a press outside the dialog. */\n onCancel(): void;\n className?: string;\n}\n\n/**\n * Asks a person to confirm one action before it runs, as a modal dialog: the page behind cannot be used, focus starts\n * inside it and returns where it was, and Escape cancels. Name the button for the action. For something that can be\n * undone, prefer doing it and offering Undo (`ActionReceipt`). `useConfirm` asks from code and waits for the answer.\n */\nexport function ConfirmDialog({ open, title, body, confirmLabel, cancelLabel, danger, typedWord, reason, onConfirm, onCancel, className }: ConfirmDialogProps) {\n const dialog = useRef<HTMLDialogElement>(null);\n const cancel = useRef<HTMLButtonElement>(null);\n const confirm = useRef<HTMLButtonElement>(null);\n const titleId = useId();\n const bodyId = useId();\n const answered = useRef(false);\n const wordId = useId();\n const reasonId = useId();\n const errorId = useId();\n const wordBox = useRef<HTMLInputElement>(null);\n const reasonBox = useRef<HTMLInputElement>(null);\n const [word, setWord] = useState(\"\");\n const [why, setWhy] = useState(\"\");\n const [told, setTold] = useState(\"\");\n const wordMissing = typedWord !== undefined && word.trim().toLowerCase() !== typedWord.toLowerCase();\n const reasonMissing = reason === \"required\" && why.trim() === \"\";\n\n useEffect(() => {\n const element = dialog.current;\n if (!element) return;\n if (open && !element.open) {\n answered.current = false;\n setWord(\"\");\n setWhy(\"\");\n setTold(\"\");\n const back = document.activeElement instanceof HTMLElement ? document.activeElement : null;\n // A browser without modal dialogs (and jsdom) still shows it, without making the page behind inert.\n if (typeof element.showModal === \"function\") element.showModal();\n else element.setAttribute(\"open\", \"\");\n // Something to fill in comes first: a person starts where they must type. Otherwise Cancel for a dangerous action.\n (reasonBox.current ?? wordBox.current ?? (danger ? cancel : confirm).current)?.focus();\n return () => {\n if (element.open) element.close?.();\n element.removeAttribute(\"open\");\n back?.focus();\n };\n }\n return undefined;\n }, [open, danger]);\n\n const answer = (yes: boolean) => {\n if (answered.current) return;\n if (yes && (wordMissing || reasonMissing)) {\n // Say what is missing and go to it; the dialog stays.\n setTold(wordMissing ? text(\"confirm.needWord\", { word: typedWord ?? \"\" }) : text(\"confirm.needReason\"));\n (wordMissing ? wordBox : reasonBox).current?.focus();\n return;\n }\n answered.current = true;\n if (yes) onConfirm({ reason: why.trim() });\n else onCancel();\n };\n\n if (!open) return null;\n return (\n <dialog\n ref={dialog}\n className={[\"sf-confirm\", className].filter(Boolean).join(\" \")}\n aria-labelledby={titleId}\n aria-describedby={body ? bodyId : undefined}\n onCancel={(event) => {\n // Escape: answer as Cancel, and let React close it.\n event.preventDefault();\n answer(false);\n }}\n // A browser may close a dialog on Escape without asking first (no `cancel`): that is still an answer of no.\n onClose={() => answer(false)}\n onMouseDown={(event) => {\n // A press on the backdrop lands on the dialog itself, outside its box.\n if (event.target === dialog.current) {\n const box = dialog.current.getBoundingClientRect();\n const inside = event.clientX >= box.left && event.clientX <= box.right && event.clientY >= box.top && event.clientY <= box.bottom;\n if (!inside) answer(false);\n }\n }}\n >\n <h2 id={titleId} className=\"sf-confirm-title\">\n {title}\n </h2>\n {body && (\n <div id={bodyId} className=\"sf-confirm-body\">\n {body}\n </div>\n )}\n {(typedWord !== undefined || reason) && (\n <form\n className=\"sf-confirm-fields\"\n onSubmit={(event) => {\n event.preventDefault();\n answer(true);\n }}\n >\n {reason && (\n <label className=\"sf-confirm-field\" htmlFor={reasonId}>\n <span>{text(reason === \"required\" ? \"confirm.reasonRequired\" : \"confirm.reason\")}</span>\n <input ref={reasonBox} id={reasonId} className=\"sf-input\" value={why} onChange={(event) => setWhy(event.target.value)} aria-required={reason === \"required\" || undefined} aria-invalid={(told !== \"\" && reasonMissing) || undefined} aria-describedby={told ? errorId : undefined} autoComplete=\"off\" />\n </label>\n )}\n {typedWord !== undefined && (\n <label className=\"sf-confirm-field\" htmlFor={wordId}>\n <span>{text(\"confirm.typeWord\", { word: typedWord })}</span>\n <input ref={wordBox} id={wordId} className=\"sf-input\" value={word} onChange={(event) => setWord(event.target.value)} aria-required=\"true\" aria-invalid={(told !== \"\" && wordMissing) || undefined} aria-describedby={told ? errorId : undefined} autoComplete=\"off\" autoCapitalize=\"off\" spellCheck={false} />\n </label>\n )}\n {told && (wordMissing || reasonMissing) && (\n <p id={errorId} className=\"sf-confirm-error\" role=\"alert\">\n {told}\n </p>\n )}\n </form>\n )}\n <div className=\"sf-confirm-actions\">\n <button ref={cancel} type=\"button\" className=\"sf-button\" onClick={() => answer(false)}>\n {cancelLabel ?? text(\"confirm.cancel\")}\n </button>\n <button ref={confirm} type=\"button\" className=\"sf-button\" data-variant={danger ? \"danger\" : \"primary\"} aria-disabled={wordMissing || reasonMissing || undefined} onClick={() => answer(true)}>\n {confirmLabel ?? text(\"confirm.confirm\")}\n </button>\n </div>\n </dialog>\n );\n}\n\n/** What `useConfirm`'s `confirm` asks. */\nexport type ConfirmRequest = Omit<ConfirmDialogProps, \"open\" | \"onConfirm\" | \"onCancel\">;\n\nexport interface Confirm {\n /** Shows the dialog and resolves true if the person goes ahead, false if not. Asking again while one is open answers the first with false. */\n confirm(request: ConfirmRequest): Promise<boolean>;\n /** As `confirm`, with what the person wrote as the reason (`reason` on the request). */\n ask(request: ConfirmRequest): Promise<{ confirmed: boolean; reason: string }>;\n /** Render this once, anywhere in the component. */\n element: ReactNode;\n}\n\n/** Asks for confirmation from an event handler: `if (await confirm({ title, body, confirmLabel, danger })) run()`. */\nexport function useConfirm(): Confirm {\n const [request, setRequest] = useState<ConfirmRequest>();\n const pending = useRef<(yes: boolean, reason?: string) => void>(undefined);\n const settle = useCallback((yes: boolean, reason = \"\") => {\n const resolve = pending.current;\n pending.current = undefined;\n setRequest(undefined);\n resolve?.(yes, reason);\n }, []);\n useEffect(() => () => pending.current?.(false), []);\n const ask = useCallback((next: ConfirmRequest) => {\n pending.current?.(false);\n setRequest(next);\n return new Promise<{ confirmed: boolean; reason: string }>((resolve) => {\n pending.current = (confirmed, reason = \"\") => resolve({ confirmed, reason });\n });\n }, []);\n const confirm = useCallback((next: ConfirmRequest) => ask(next).then((answer) => answer.confirmed), [ask]);\n const element = request ? <ConfirmDialog {...request} open onConfirm={(answer) => settle(true, answer.reason)} onCancel={() => settle(false)} /> : null;\n return { confirm, ask, element };\n}\n"]}
@@ -7,5 +7,7 @@ export interface DataSourceProviderProps {
7
7
  }
8
8
  /** Makes a DataSource available to every data component below it. */
9
9
  export declare function DataSourceProvider({ dataSource, children }: DataSourceProviderProps): import("react").JSX.Element;
10
+ /** The DataSource from the nearest provider or the prop, or nothing: for a component that can do without one (a form for a new record reads nothing). */
11
+ export declare function useOptionalDataSource(override?: DataSource): DataSource | undefined;
10
12
  /** The DataSource from the nearest provider, or the one passed as a prop. */
11
13
  export declare function useDataSource(override?: DataSource): DataSource;
@@ -9,6 +9,11 @@ export function DataSourceProvider({ dataSource, children }) {
9
9
  useProvided("dataSource", dataSource);
10
10
  return _jsx(DataSourceContext.Provider, { value: dataSource, children: children });
11
11
  }
12
+ /** The DataSource from the nearest provider or the prop, or nothing: for a component that can do without one (a form for a new record reads nothing). */
13
+ export function useOptionalDataSource(override) {
14
+ const fromContext = useContext(DataSourceContext);
15
+ return useTraced("DataSource", override ?? fromContext, DATA_SOURCE_TRACE);
16
+ }
12
17
  /** The DataSource from the nearest provider, or the one passed as a prop. */
13
18
  export function useDataSource(override) {
14
19
  const fromContext = useContext(DataSourceContext);
@@ -1 +1 @@
1
- {"version":3,"file":"DataSourceProvider.js","sourceRoot":"","sources":["../../src/data/DataSourceProvider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAkB,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAElE,MAAM,iBAAiB,GAAG,aAAa,CAAyB,SAAS,CAAC,CAAC;AAQ3E,qEAAqE;AACrE,MAAM,UAAU,kBAAkB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAA2B;IAClF,0GAA0G;IAC1G,WAAW,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACtC,OAAO,KAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,UAAU,YAAG,QAAQ,GAA8B,CAAC;AAChG,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,aAAa,CAAC,QAAqB;IACjD,MAAM,WAAW,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAClD,sGAAsG;IACtG,MAAM,UAAU,GAAG,SAAS,CAAC,YAAY,EAAE,QAAQ,IAAI,WAAW,EAAE,iBAAiB,CAAC,CAAC;IACvF,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,+EAA+E,CAAC,CAAC;IAClH,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import type { DataSource } from \"@surfaces-ui/data\";\nimport { DATA_SOURCE_TRACE } from \"@surfaces-ui/trace\";\nimport { useProvided, useTraced } from \"@surfaces-ui/trace/react\";\nimport { type ReactNode, createContext, useContext } from \"react\";\n\nconst DataSourceContext = createContext<DataSource | undefined>(undefined);\n\nexport interface DataSourceProviderProps {\n /** Any implementation: a Connect client, `memoryDataSource`, or your own. */\n dataSource: DataSource;\n children: ReactNode;\n}\n\n/** Makes a DataSource available to every data component below it. */\nexport function DataSourceProvider({ dataSource, children }: DataSourceProviderProps) {\n // With a recorder above (dev tools), it is told which backend the page uses. Nothing happens without one.\n useProvided(\"dataSource\", dataSource);\n return <DataSourceContext.Provider value={dataSource}>{children}</DataSourceContext.Provider>;\n}\n\n/** The DataSource from the nearest provider, or the one passed as a prop. */\nexport function useDataSource(override?: DataSource): DataSource {\n const fromContext = useContext(DataSourceContext);\n // Traced, as a child of the component asking, when a recorder is above; the backend itself otherwise.\n const dataSource = useTraced(\"DataSource\", override ?? fromContext, DATA_SOURCE_TRACE);\n if (!dataSource) throw new Error(\"No DataSource: wrap the component in <DataSourceProvider> or pass dataSource.\");\n return dataSource;\n}\n"]}
1
+ {"version":3,"file":"DataSourceProvider.js","sourceRoot":"","sources":["../../src/data/DataSourceProvider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAkB,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAElE,MAAM,iBAAiB,GAAG,aAAa,CAAyB,SAAS,CAAC,CAAC;AAQ3E,qEAAqE;AACrE,MAAM,UAAU,kBAAkB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAA2B;IAClF,0GAA0G;IAC1G,WAAW,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACtC,OAAO,KAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,UAAU,YAAG,QAAQ,GAA8B,CAAC;AAChG,CAAC;AAED,yJAAyJ;AACzJ,MAAM,UAAU,qBAAqB,CAAC,QAAqB;IACzD,MAAM,WAAW,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAClD,OAAO,SAAS,CAAC,YAAY,EAAE,QAAQ,IAAI,WAAW,EAAE,iBAAiB,CAAC,CAAC;AAC7E,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,aAAa,CAAC,QAAqB;IACjD,MAAM,WAAW,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAClD,sGAAsG;IACtG,MAAM,UAAU,GAAG,SAAS,CAAC,YAAY,EAAE,QAAQ,IAAI,WAAW,EAAE,iBAAiB,CAAC,CAAC;IACvF,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,+EAA+E,CAAC,CAAC;IAClH,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import type { DataSource } from \"@surfaces-ui/data\";\nimport { DATA_SOURCE_TRACE } from \"@surfaces-ui/trace\";\nimport { useProvided, useTraced } from \"@surfaces-ui/trace/react\";\nimport { type ReactNode, createContext, useContext } from \"react\";\n\nconst DataSourceContext = createContext<DataSource | undefined>(undefined);\n\nexport interface DataSourceProviderProps {\n /** Any implementation: a Connect client, `memoryDataSource`, or your own. */\n dataSource: DataSource;\n children: ReactNode;\n}\n\n/** Makes a DataSource available to every data component below it. */\nexport function DataSourceProvider({ dataSource, children }: DataSourceProviderProps) {\n // With a recorder above (dev tools), it is told which backend the page uses. Nothing happens without one.\n useProvided(\"dataSource\", dataSource);\n return <DataSourceContext.Provider value={dataSource}>{children}</DataSourceContext.Provider>;\n}\n\n/** The DataSource from the nearest provider or the prop, or nothing: for a component that can do without one (a form for a new record reads nothing). */\nexport function useOptionalDataSource(override?: DataSource): DataSource | undefined {\n const fromContext = useContext(DataSourceContext);\n return useTraced(\"DataSource\", override ?? fromContext, DATA_SOURCE_TRACE);\n}\n\n/** The DataSource from the nearest provider, or the one passed as a prop. */\nexport function useDataSource(override?: DataSource): DataSource {\n const fromContext = useContext(DataSourceContext);\n // Traced, as a child of the component asking, when a recorder is above; the backend itself otherwise.\n const dataSource = useTraced(\"DataSource\", override ?? fromContext, DATA_SOURCE_TRACE);\n if (!dataSource) throw new Error(\"No DataSource: wrap the component in <DataSourceProvider> or pass dataSource.\");\n return dataSource;\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -51,6 +51,8 @@ export * from "./menu/ContextMenu.js";
51
51
  export * from "./schema/ObjectInfo.js";
52
52
  export { type FilterOp, type FilterSpec, type SortSpec, FILTER_OPS, chosenValues, filterWords, filtersExcept, filtersFromSpec, filtersToSpec, joinRelative, parseFilterSpecs, parseSortSpecs, sinceLabel, sinceStart, sortsFromSpec, sortsToSpec, selectValues, splitRelative, toggleValueFilter, valueFilter } from "@surfaces-ui/data";
53
53
  export * from "./form/Form.js";
54
+ export * from "./record/RecordForm.js";
55
+ export * from "./record/record.js";
54
56
  export * from "./workspace/layout.js";
55
57
  export * from "./workspace/icons.js";
56
58
  export * from "./workspace/Workspace.js";
package/dist/index.js CHANGED
@@ -52,6 +52,8 @@ export * from "./schema/ObjectInfo.js";
52
52
  // The plain filter form lives in @surfaces-ui/data, below every package that uses it.
53
53
  export { FILTER_OPS, chosenValues, filterWords, filtersExcept, filtersFromSpec, filtersToSpec, joinRelative, parseFilterSpecs, parseSortSpecs, sinceLabel, sinceStart, sortsFromSpec, sortsToSpec, selectValues, splitRelative, toggleValueFilter, valueFilter } from "@surfaces-ui/data";
54
54
  export * from "./form/Form.js";
55
+ export * from "./record/RecordForm.js";
56
+ export * from "./record/record.js";
55
57
  export * from "./workspace/layout.js";
56
58
  export * from "./workspace/icons.js";
57
59
  export * from "./workspace/Workspace.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAw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;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAoB,MAAM,uBAAuB,CAAC;AACxE,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC","sourcesContent":["export * from \"./locale/locale.js\";\nexport * from \"./locale/SurfacesText.js\";\nexport * from \"./theme/ThemeProvider.js\";\nexport * from \"./theme/ThemePicker.js\";\nexport * from \"./data/DataSourceProvider.js\";\nexport * from \"./data/format.js\";\nexport * from \"./data/useRowWindow.js\";\nexport * from \"./data/messages.js\";\nexport * from \"./data/DataNotes.js\";\nexport * from \"./grid/DataGrid.js\";\nexport * from \"./chart/Chart.js\";\nexport * from \"./chart/option.js\";\nexport * from \"./editor/SqlEditor.js\";\nexport * from \"./schema/SchemaExplorer.js\";\nexport * from \"./schema/ObjectBrowser.js\";\nexport * from \"./filter/FilterBar.js\";\nexport * from \"./pivot/PivotTable.js\";\nexport * from \"./result/QueryResult.js\";\nexport * from \"./discovery/shared.js\";\nexport * from \"./discovery/DataSearch.js\";\nexport * from \"./discovery/ObjectDetail.js\";\nexport * from \"./discovery/ContextBuilder.js\";\nexport * from \"./discovery/RelationshipGraph.js\";\nexport * from \"./graph/NodeGraph.js\";\nexport * from \"./graph/model.js\";\nexport * from \"./discovery/AskData.js\";\nexport * from \"./model/ModelDiagram.js\";\nexport * from \"./text/Markdown.js\";\nexport * from \"./text/Image.js\";\nexport * from \"./source/SourceList.js\";\nexport * from \"./source/ConnectionBuilder.js\";\nexport * from \"./metric/Metric.js\";\nexport * from \"./rows/RowList.js\";\nexport * from \"./pipeline/Pipeline.js\";\nexport * from \"./panzoom/usePanZoom.js\";\nexport * from \"./data/export.js\";\nexport * from \"./plan/QueryPlan.js\";\nexport * from \"./pipeline/PipelineView.js\";\nexport * from \"./pipeline/DatasetReview.js\";\nexport * from \"./pipeline/IngestWizard.js\";\nexport * from \"./chart/advice.js\";\nexport * from \"./chart/Sparkline.js\";\nexport * from \"./chart/BulletGraph.js\";\nexport * from \"./metric/useMeasure.js\";\nexport * from \"./review/PlanReview.js\";\nexport * from \"./review/PiiReview.js\";\nexport * from \"./review/pii.js\";\nexport * from \"./review/StepFlow.js\";\nexport * from \"./review/ActionReceipt.js\";\nexport * from \"./menu/ContextMenu.js\";\nexport * from \"./schema/ObjectInfo.js\";\n// The plain filter form lives in @surfaces-ui/data, below every package that uses it.\nexport { type FilterOp, type FilterSpec, type SortSpec, FILTER_OPS, chosenValues, filterWords, filtersExcept, filtersFromSpec, filtersToSpec, joinRelative, parseFilterSpecs, parseSortSpecs, sinceLabel, sinceStart, sortsFromSpec, sortsToSpec, selectValues, splitRelative, toggleValueFilter, valueFilter } from \"@surfaces-ui/data\";\nexport * from \"./form/Form.js\";\nexport * from \"./workspace/layout.js\";\nexport * from \"./workspace/icons.js\";\nexport * from \"./workspace/Workspace.js\";\nexport * from \"./workspace/SideNav.js\";\nexport * from \"./workspace/NavBar.js\";\nexport * from \"./site/Site.js\";\nexport * from \"./schema/refs.js\";\nexport * from \"./files/files.js\";\nexport * from \"./files/FileBrowser.js\";\nexport * from \"./filter/QueryFilters.js\";\nexport * from \"./explore/model.js\";\nexport * from \"./explore/Explorer.js\";\nexport * from \"./explore/report.js\";\nexport * from \"./explore/ReportBuilder.js\";\nexport * from \"./explore/semantic.js\";\nexport * from \"./explore/SemanticsProvider.js\";\nexport * from \"./explore/SemanticModelEditor.js\";\nexport * from \"./explore/SemanticRows.js\";\nexport * from \"./explore/ModelLineage.js\";\nexport * from \"./explore/semantic-proposal.js\";\nexport * from \"./controls/ItemControls.js\";\nexport * from \"./controls/context.js\";\nexport * from \"./controls/ResizeHandle.js\";\nexport * from \"./controls/SegmentedControl.js\";\nexport * from \"./controls/ConfirmDialog.js\";\nexport * from \"./controls/StatusBadge.js\";\nexport { LOADER_CHARTS, type LoaderChart } from \"./loading/ChartArt.js\";\nexport * from \"./loading/DraftCard.js\";\nexport * from \"./loading/Loading.js\";\nexport * from \"./feedback/ErrorPage.js\";\nexport * from \"./controls/Combobox.js\";\nexport * from \"./controls/Popover.js\";\nexport * from \"./table/DataTable.js\";\nexport * from \"./table/SelectionBar.js\";\nexport * from \"./table/Pagination.js\";\nexport * from \"./controls/resize.js\";\nexport * from \"./appComponents.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAA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zU,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAoB,MAAM,uBAAuB,CAAC;AACxE,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC","sourcesContent":["export * from \"./locale/locale.js\";\nexport * from \"./locale/SurfacesText.js\";\nexport * from \"./theme/ThemeProvider.js\";\nexport * from \"./theme/ThemePicker.js\";\nexport * from \"./data/DataSourceProvider.js\";\nexport * from \"./data/format.js\";\nexport * from \"./data/useRowWindow.js\";\nexport * from \"./data/messages.js\";\nexport * from \"./data/DataNotes.js\";\nexport * from \"./grid/DataGrid.js\";\nexport * from \"./chart/Chart.js\";\nexport * from \"./chart/option.js\";\nexport * from \"./editor/SqlEditor.js\";\nexport * from \"./schema/SchemaExplorer.js\";\nexport * from \"./schema/ObjectBrowser.js\";\nexport * from \"./filter/FilterBar.js\";\nexport * from \"./pivot/PivotTable.js\";\nexport * from \"./result/QueryResult.js\";\nexport * from \"./discovery/shared.js\";\nexport * from \"./discovery/DataSearch.js\";\nexport * from \"./discovery/ObjectDetail.js\";\nexport * from \"./discovery/ContextBuilder.js\";\nexport * from \"./discovery/RelationshipGraph.js\";\nexport * from \"./graph/NodeGraph.js\";\nexport * from \"./graph/model.js\";\nexport * from \"./discovery/AskData.js\";\nexport * from \"./model/ModelDiagram.js\";\nexport * from \"./text/Markdown.js\";\nexport * from \"./text/Image.js\";\nexport * from \"./source/SourceList.js\";\nexport * from \"./source/ConnectionBuilder.js\";\nexport * from \"./metric/Metric.js\";\nexport * from \"./rows/RowList.js\";\nexport * from \"./pipeline/Pipeline.js\";\nexport * from \"./panzoom/usePanZoom.js\";\nexport * from \"./data/export.js\";\nexport * from \"./plan/QueryPlan.js\";\nexport * from \"./pipeline/PipelineView.js\";\nexport * from \"./pipeline/DatasetReview.js\";\nexport * from \"./pipeline/IngestWizard.js\";\nexport * from \"./chart/advice.js\";\nexport * from \"./chart/Sparkline.js\";\nexport * from \"./chart/BulletGraph.js\";\nexport * from \"./metric/useMeasure.js\";\nexport * from \"./review/PlanReview.js\";\nexport * from \"./review/PiiReview.js\";\nexport * from \"./review/pii.js\";\nexport * from \"./review/StepFlow.js\";\nexport * from \"./review/ActionReceipt.js\";\nexport * from \"./menu/ContextMenu.js\";\nexport * from \"./schema/ObjectInfo.js\";\n// The plain filter form lives in @surfaces-ui/data, below every package that uses it.\nexport { type FilterOp, type FilterSpec, type SortSpec, FILTER_OPS, chosenValues, filterWords, filtersExcept, filtersFromSpec, filtersToSpec, joinRelative, parseFilterSpecs, parseSortSpecs, sinceLabel, sinceStart, sortsFromSpec, sortsToSpec, selectValues, splitRelative, toggleValueFilter, valueFilter } from \"@surfaces-ui/data\";\nexport * from \"./form/Form.js\";\nexport * from \"./record/RecordForm.js\";\nexport * from \"./record/record.js\";\nexport * from \"./workspace/layout.js\";\nexport * from \"./workspace/icons.js\";\nexport * from \"./workspace/Workspace.js\";\nexport * from \"./workspace/SideNav.js\";\nexport * from \"./workspace/NavBar.js\";\nexport * from \"./site/Site.js\";\nexport * from \"./schema/refs.js\";\nexport * from \"./files/files.js\";\nexport * from \"./files/FileBrowser.js\";\nexport * from \"./filter/QueryFilters.js\";\nexport * from \"./explore/model.js\";\nexport * from \"./explore/Explorer.js\";\nexport * from \"./explore/report.js\";\nexport * from \"./explore/ReportBuilder.js\";\nexport * from \"./explore/semantic.js\";\nexport * from \"./explore/SemanticsProvider.js\";\nexport * from \"./explore/SemanticModelEditor.js\";\nexport * from \"./explore/SemanticRows.js\";\nexport * from \"./explore/ModelLineage.js\";\nexport * from \"./explore/semantic-proposal.js\";\nexport * from \"./controls/ItemControls.js\";\nexport * from \"./controls/context.js\";\nexport * from \"./controls/ResizeHandle.js\";\nexport * from \"./controls/SegmentedControl.js\";\nexport * from \"./controls/ConfirmDialog.js\";\nexport * from \"./controls/StatusBadge.js\";\nexport { LOADER_CHARTS, type LoaderChart } from \"./loading/ChartArt.js\";\nexport * from \"./loading/DraftCard.js\";\nexport * from \"./loading/Loading.js\";\nexport * from \"./feedback/ErrorPage.js\";\nexport * from \"./controls/Combobox.js\";\nexport * from \"./controls/Popover.js\";\nexport * from \"./table/DataTable.js\";\nexport * from \"./table/SelectionBar.js\";\nexport * from \"./table/Pagination.js\";\nexport * from \"./controls/resize.js\";\nexport * from \"./appComponents.js\";\n"]}
@@ -236,6 +236,7 @@ export declare const defaultLabels: {
236
236
  readonly "plan.reject": "Reject";
237
237
  readonly "receipt.done": "Done";
238
238
  readonly "receipt.partial": "Partly done";
239
+ readonly "receipt.none": "Nothing changed";
239
240
  readonly "receipt.failed": "Failed";
240
241
  readonly "receipt.ran": "Ran";
241
242
  readonly "receipt.by": "by {who}";
@@ -270,6 +271,46 @@ export declare const defaultLabels: {
270
271
  readonly "pages.next": "Next";
271
272
  readonly "confirm.confirm": "Confirm";
272
273
  readonly "confirm.cancel": "Cancel";
274
+ readonly "confirm.typeWord": "Type “{word}” to go ahead";
275
+ readonly "confirm.reason": "Reason (optional)";
276
+ readonly "confirm.reasonRequired": "Reason (required)";
277
+ readonly "confirm.needWord": "Type “{word}” in the box first. Nothing has run.";
278
+ readonly "confirm.needReason": "Give a reason first. Nothing has run.";
279
+ readonly "run.working": "Working…";
280
+ readonly "run.you": "You";
281
+ readonly "run.reread": "Read it again";
282
+ readonly "run.continue": "Continue";
283
+ readonly "run.leftAlone": "Left alone";
284
+ readonly "run.andMore": "and {count} more";
285
+ readonly "run.changed": "Changed";
286
+ readonly "run.highRisk": "High risk";
287
+ readonly "run.irreversible": "Cannot be undone";
288
+ readonly "run.rows": "Rows it applies to";
289
+ readonly "run.operation": "Operation";
290
+ readonly "run.expires": "Ask again after {time}";
291
+ readonly "record.save": "Save";
292
+ readonly "record.saving": "Saving…";
293
+ readonly "record.saved": "Saved.";
294
+ readonly "record.edit": "Edit";
295
+ readonly "record.cancel": "Cancel";
296
+ readonly "record.unchanged": "Nothing has changed, so nothing was saved.";
297
+ readonly "record.notSaved": "Not saved: {count} fields need attention.";
298
+ readonly "record.notSavedOne": "Not saved: one field needs attention.";
299
+ readonly "record.problems": "There are {count} problems";
300
+ readonly "record.problemsOne": "There is a problem";
301
+ readonly "record.reading": "Reading the record…";
302
+ readonly "record.notFound": "This {label} was not found. It may have been removed.";
303
+ readonly "record.many": "More than one record has this key, so none is shown.";
304
+ readonly "record.unread": "The record could not be read.";
305
+ readonly "record.noOperation": "This form cannot be shown: the operation that saves it is not one this backend has.";
306
+ readonly "record.back": "Go back";
307
+ readonly "record.savedValue": "Saved now: {value}.";
308
+ readonly "record.leaveTitle": "Leave without saving?";
309
+ readonly "record.leaveBody": "Your changes to {what} have not been saved. If you leave, they are lost.";
310
+ readonly "record.leave": "Leave";
311
+ readonly "record.stay": "Stay";
312
+ readonly "record.yes": "Yes";
313
+ readonly "record.no": "No";
273
314
  readonly "combobox.loading": "Looking…";
274
315
  readonly "combobox.none": "Nothing matches.";
275
316
  readonly "combobox.count": "{count} suggestions";
@@ -272,6 +272,7 @@ export const defaultLabels = {
272
272
  // ActionReceipt
273
273
  "receipt.done": "Done",
274
274
  "receipt.partial": "Partly done",
275
+ "receipt.none": "Nothing changed",
275
276
  "receipt.failed": "Failed",
276
277
  "receipt.ran": "Ran",
277
278
  "receipt.by": "by {who}",
@@ -310,6 +311,47 @@ export const defaultLabels = {
310
311
  // ConfirmDialog
311
312
  "confirm.confirm": "Confirm",
312
313
  "confirm.cancel": "Cancel",
314
+ "confirm.typeWord": "Type “{word}” to go ahead",
315
+ "confirm.reason": "Reason (optional)",
316
+ "confirm.reasonRequired": "Reason (required)",
317
+ "confirm.needWord": "Type “{word}” in the box first. Nothing has run.",
318
+ "confirm.needReason": "Give a reason first. Nothing has run.",
319
+ "run.working": "Working…",
320
+ "run.you": "You",
321
+ "run.reread": "Read it again",
322
+ "run.continue": "Continue",
323
+ "run.leftAlone": "Left alone",
324
+ "run.andMore": "and {count} more",
325
+ "run.changed": "Changed",
326
+ "run.highRisk": "High risk",
327
+ "run.irreversible": "Cannot be undone",
328
+ "run.rows": "Rows it applies to",
329
+ "run.operation": "Operation",
330
+ "run.expires": "Ask again after {time}",
331
+ // RecordForm
332
+ "record.save": "Save",
333
+ "record.saving": "Saving…",
334
+ "record.saved": "Saved.",
335
+ "record.edit": "Edit",
336
+ "record.cancel": "Cancel",
337
+ "record.unchanged": "Nothing has changed, so nothing was saved.",
338
+ "record.notSaved": "Not saved: {count} fields need attention.",
339
+ "record.notSavedOne": "Not saved: one field needs attention.",
340
+ "record.problems": "There are {count} problems",
341
+ "record.problemsOne": "There is a problem",
342
+ "record.reading": "Reading the record…",
343
+ "record.notFound": "This {label} was not found. It may have been removed.",
344
+ "record.many": "More than one record has this key, so none is shown.",
345
+ "record.unread": "The record could not be read.",
346
+ "record.noOperation": "This form cannot be shown: the operation that saves it is not one this backend has.",
347
+ "record.back": "Go back",
348
+ "record.savedValue": "Saved now: {value}.",
349
+ "record.leaveTitle": "Leave without saving?",
350
+ "record.leaveBody": "Your changes to {what} have not been saved. If you leave, they are lost.",
351
+ "record.leave": "Leave",
352
+ "record.stay": "Stay",
353
+ "record.yes": "Yes",
354
+ "record.no": "No",
313
355
  // Combobox
314
356
  "combobox.loading": "Looking…",
315
357
  "combobox.none": "Nothing matches.",
@@ -1 +1 @@
1
- {"version":3,"file":"locale.js","sourceRoot":"","sources":["../../src/locale/locale.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,IAAI,OAAO,GAAG,OAAO,CAAC;AACtB,MAAM,OAAO,GAAG,IAAI,GAAG,EAA6B,CAAC;AACrD,MAAM,WAAW,GAAG,IAAI,GAAG,EAA+B,CAAC;AAE3D;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,8EAA8E;IAC9E,OAAO,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC;AAChF,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,SAAS;IACvB,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,wIAAwI;AACxI,MAAM,UAAU,YAAY,CAAC,OAAO,GAA6B,EAAE;IACjE,MAAM,GAAG,GAAG,GAAG,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;IACpD,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,CAAC,M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C,GAAG,IAAI,CAAC;IACrF,CAAC;IACD,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC;AAED,mDAAmD;AACnD,MAAM,UAAU,WAAW;IACzB,MAAM,GAAG,EAAE,GAAG,aAAa,EAAE,CAAC;AAChC,CAAC;AAED,iHAAiH;AACjH,MAAM,UAAU,KAAK,CAAC,GAAa,EAAE,IAAsC;IACzE,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACzB,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1G,CAAC","sourcesContent":["/**\n * The locale every number and date in the components is written in, and the\n * words they show. Both are page-wide: one locale and one set of words per\n * page. A host sets them once, before the components render, with\n * `setLocale` and `setLabels` or the `SurfacesText` component.\n */\n\nlet current = \"en-US\";\nconst formats = new Map<string, Intl.NumberFormat>();\nconst dateFormats = new Map<string, Intl.DateTimeFormat>();\n\n/**\n * Sets the locale (a BCP 47 tag such as \"de-DE\") for every number and date the\n * components write. Platform forms with an underscore (\"en_US\", as iOS and\n * Android write them) are accepted.\n */\nexport function setLocale(locale: string): void {\n // Throws a RangeError on a malformed tag here rather than on the next render.\n current = Intl.getCanonicalLocales(locale.replaceAll(\"_\", \"-\"))[0] ?? \"en-US\";\n}\n\n/** The locale numbers and dates are written in. Defaults to \"en-US\". */\nexport function getLocale(): string {\n return current;\n}\n\n/** A number format in the current locale, kept for reuse. Call it when formatting, not once at load, so a later `setLocale` applies. */\nexport function numberFormat(options: Intl.NumberFormatOptions = {}): Intl.NumberFormat {\n const key = `${current}|${JSON.stringify(options)}`;\n let format = formats.get(key);\n if (!format) {\n format = new Intl.NumberFormat(current, options);\n formats.set(key, format);\n }\n return format;\n}\n\n/** A date and time format in the current locale, kept for reuse. */\nexport function dateFormat(options: Intl.DateTimeFormatOptions = {}): Intl.DateTimeFormat {\n const key = `${current}|${JSON.stringify(options)}`;\n let format = dateFormats.get(key);\n if (!format) {\n format = new Intl.DateTimeFormat(current, options);\n dateFormats.set(key, format);\n }\n return format;\n}\n\n/**\n * Every word the data-display components show, in English. `{name}` marks a\n * value filled in when the words are shown. Replace any of them with\n * `setLabels`, for another language or plainer words.\n */\nexport const defaultLabels = {\n // Cell values\n \"cell.null\": \"null\",\n \"cell.true\": \"true\",\n \"cell.false\": \"false\",\n\n // DataGrid\n \"grid.label\": \"Query result\",\n \"grid.sortAscending\": \"Sort ascending\",\n \"grid.sortDescending\": \"Sort descending\",\n \"grid.clearSorting\": \"Clear sorting\",\n \"grid.moveLeft\": \"Move left\",\n \"grid.moveRight\": \"Move right\",\n \"grid.hideColumn\": \"Hide column\",\n \"grid.showAllColumns\": \"Show all columns\",\n \"grid.showAllColumnsHidden\": \"Show all columns ({count} hidden)\",\n \"grid.resetWidth\": \"Reset width\",\n \"grid.resetWidthHint\": \"Double-click edge\",\n \"grid.resetLayout\": \"Reset column layout\",\n \"grid.copyColumnName\": \"Copy column name\",\n \"grid.sqlCountValues\": \"SQL: count each value\",\n \"grid.sqlRange\": \"SQL: range and missing values\",\n \"grid.copyValue\": \"Copy value\",\n \"grid.copyRowJson\": \"Copy row as JSON\",\n \"grid.filterToValue\": \"Filter to this value\",\n \"grid.leaveValueOut\": \"Leave this value out\",\n \"grid.copied\": \"Copied {what}.\",\n \"grid.copiedCell\": \"the cell\",\n \"grid.copiedRow\": \"the row\",\n \"grid.copiedColumnName\": \"the column name\",\n \"grid.copiedSql\": \"the SQL\",\n \"code.copyFailed\": \"Could not copy: the browser did not allow it. The code is selected, so you can copy it yourself.\",\n \"grid.copyFailed\": \"Could not copy: the browser refused access to the clipboard.\",\n \"grid.movedLeft\": \"Moved {name} left.\",\n \"grid.movedRight\": \"Moved {name} right.\",\n \"grid.moved\": \"Moved {name}.\",\n \"grid.columnMenu\": \"{name} column\",\n \"grid.cellMenu\": \"{name} cell\",\n \"grid.activeCellMenu\": \"Cell\",\n \"grid.failed\": \"Query failed\",\n \"grid.loading\": \"Loading…\",\n \"grid.rows\": \"{count} rows\",\n \"grid.rowsOne\": \"{count} row\",\n \"grid.noRows\": \"No rows match.\",\n \"grid.showHidden\": \"Show {count} hidden columns\",\n \"grid.showHiddenOne\": \"Show {count} hidden column\",\n \"grid.elapsed\": \"{ms} ms\",\n \"grid.asOf\": \"As of {time}\",\n \"grid.runAgain\": \"Run again\",\n \"grid.previous\": \"Previous\",\n \"grid.next\": \"Next\",\n \"grid.page\": \"Page {page} of {pages}\",\n\n // PivotTable\n \"pivot.label\": \"Pivot table\",\n \"pivot.loading\": \"Loading…\",\n \"pivot.choose\": \"Choose rows or columns and a measure.\",\n \"pivot.empty\": \"No rows match.\",\n \"pivot.total\": \"Total\",\n \"pivot.all\": \"All\",\n \"pivot.none\": \"(none)\",\n \"pivot.truncated\": \"This pivot has more than {limit} cells, so some are missing. Add a filter or choose columns with fewer values.\",\n \"pivot.hiddenColumns\": \"Showing the first {shown} of {total} column values.\",\n\n // Chart\n \"chart.empty\": \"No data to chart.\",\n \"chart.missingX\": \"Rows with no {x} are not drawn{detail}.\",\n \"chart.description\": \"{type} chart of {measures} by {x}\",\n \"chart.coloursRepeat\": \"{count} series share {colours} colours, so some repeat. Filter, or split by a column with fewer values.\",\n \"chart.advice\": \"{message} Better: {instead}\",\n \"chart.sampleNote\": \"Showing a random sample of {count} rows.\",\n \"chart.firstNote\": \"Showing the first {count} points.\",\n \"chart.largestNote\": \"Showing the largest {count} points.\",\n\n // RowList\n \"rows.loading\": \"Loading…\",\n \"rows.empty\": \"Nothing to show.\",\n \"rows.more\": \"Show more\",\n \"rows.some\": \"Showing the first {count}.\",\n \"rows.full\": \"Showing the first {count}. Filter to find others.\",\n\n // Metric, Sparkline, BulletGraph\n \"metric.loading\": \"…\",\n \"metric.none\": \"–\",\n \"sparkline.summary\": \"{label}: {now} now, from {first}; low {low}, high {high} over {count} {grain}s.\",\n \"sparkline.empty\": \"{label}: no data.\",\n \"bullet.loading\": \"{label}: loading.\",\n \"bullet.empty\": \"{label}: no data.\",\n \"bullet.reading\": \"{label}: {value}{band}{target}.\",\n \"bullet.targetMet\": \"; target {target}, met\",\n \"bullet.targetNotMet\": \"; target {target}, not met\",\n \"bullet.target\": \"Target {target}\",\n\n // FilterBar\n \"filter.active\": \"Active filters\",\n \"filter.remove\": \"Remove filter {filter}\",\n \"filter.form\": \"Add a filter\",\n \"filter.column\": \"Column\",\n \"filter.comparison\": \"Comparison\",\n \"filter.value\": \"Value\",\n \"filter.typeOrPick\": \"Type or pick a value\",\n \"filter.add\": \"Add filter\",\n \"filter.quickRange\": \"Quick date range\",\n \"filter.quickRangeChoose\": \"Quick range…\",\n \"filter.range7d\": \"Last 7 days\",\n \"filter.range30d\": \"Last 30 days\",\n \"filter.range90d\": \"Last 90 days\",\n \"filter.range12m\": \"Last 12 months\",\n \"filter.rangeMonth\": \"This month\",\n \"filter.rangeYear\": \"This year\",\n \"filter.isEmpty\": \"is empty\",\n \"filter.isNotEmpty\": \"is not empty\",\n \"filter.contains\": \"contains\",\n \"filter.is\": \"is\",\n \"filter.isNot\": \"is not\",\n \"filter.startsWith\": \"starts with\",\n \"filter.endsWith\": \"ends with\",\n \"filter.enterWholeNumber\": \"Enter a whole number.\",\n \"filter.enterNumber\": \"Enter a number.\",\n \"filter.enterTrueFalse\": \"Enter true or false.\",\n \"filter.enterDate\": \"Enter a date like 2026-01-31.\",\n \"filter.enterValue\": \"Enter a value.\",\n\n // QueryResult\n \"result.views\": \"Result view\",\n \"result.tabTable\": \"Table\",\n \"result.tabChart\": \"Chart\",\n \"result.tabPivot\": \"Pivot\",\n \"result.stopExport\": \"Stop export\",\n \"result.downloadCsv\": \"Download CSV\",\n \"result.copySql\": \"Copy SQL\",\n \"result.cancelQuery\": \"Cancel query\",\n \"result.format\": \"Format\",\n \"result.formatColumn\": \"Column to format\",\n \"result.chooseColumn\": \"Choose a column…\",\n \"result.howToShow\": \"How to show {column}\",\n \"result.asItIs\": \"As it is\",\n \"result.formatNumber\": \"Number\",\n \"result.formatCompact\": \"Short number (1.2M)\",\n \"result.formatCurrency\": \"Currency\",\n \"result.formatPercent\": \"Percent\",\n \"result.formatText\": \"Plain text\",\n \"result.formatDate\": \"Date only\",\n \"result.formatDatetime\": \"Date and time\",\n \"result.preparing\": \"Preparing the file…\",\n \"result.rowsSoFar\": \"{count} rows so far…\",\n \"result.saved\": \"Saved {count} rows.\",\n \"result.savedTruncated\": \"Saved {count} rows. The server's row limit was reached, so the file is not the whole result.\",\n \"result.exportStopped\": \"Export stopped.\",\n \"result.sqlCopied\": \"SQL copied.\",\n \"result.copyNotAllowed\": \"Copying is not allowed here.\",\n \"result.sqlSent\": \"SQL sent to the engine\",\n \"result.plan\": \"How the engine will run it\",\n \"result.stored\": \"The query ran once and its result was kept, so sorting, filtering and paging read the kept rows instead of running it again.\",\n \"result.chooseChart\": \"Choose columns to chart.\",\n \"result.choosePivot\": \"Choose what goes in the rows and the values.\",\n \"result.chartType\": \"Type\",\n \"result.slices\": \"Slices\",\n \"result.xAxis\": \"X axis\",\n \"result.yAxis\": \"Y axis\",\n \"result.every\": \"Every\",\n \"result.bins\": \"Bins\",\n \"result.binsEach\": \"each value\",\n \"result.binsAbout\": \"about {count}\",\n \"result.splitBy\": \"Split by\",\n \"result.nothing\": \"nothing\",\n \"result.legend\": \"Legend\",\n \"result.automatic\": \"automatic\",\n \"result.legendHidden\": \"hidden\",\n \"result.stack\": \"Stack\",\n \"result.plotEachRow\": \"Plot each row\",\n \"result.series\": \"Series {number}\",\n \"result.of\": \"of\",\n \"result.drawnAs\": \"Drawn as\",\n \"result.drawnAsChart\": \"chart type ({type})\",\n \"result.scale\": \"Scale\",\n \"result.leftAxis\": \"left axis\",\n \"result.rightAxis\": \"right axis\",\n \"result.removeSeries\": \"Remove series {number}\",\n \"result.remove\": \"Remove\",\n \"result.addSeries\": \"Add series\",\n \"result.rows\": \"Rows\",\n \"result.columns\": \"Columns\",\n \"result.none\": \"none\",\n \"result.datesBy\": \"Dates by\",\n \"result.values\": \"Values\",\n \"result.sum\": \"sum\",\n \"result.avg\": \"average\",\n \"result.median\": \"median\",\n \"result.count\": \"count of rows\",\n \"result.countDistinct\": \"distinct count\",\n \"result.min\": \"minimum\",\n \"result.max\": \"maximum\",\n \"result.stddev\": \"standard deviation\",\n \"result.p90\": \"90th percentile\",\n\n // Form\n \"form.submit\": \"Submit\",\n \"form.choose\": \"Choose…\",\n \"form.required\": \"(required)\",\n \"form.needsAttention\": \"Nothing was sent. {count} fields need attention.\",\n \"form.needsAttentionOne\": \"Nothing was sent. One field needs attention.\",\n \"form.sent\": \"Sent.\",\n \"form.notSaved\": \"The backend did not save it.\",\n \"form.saved\": \"Saved.\",\n \"form.couldNotSend\": \"Could not send: {error}\",\n \"form.sending\": \"Sending…\",\n \"form.connected\": \"Saved by the backend this page is connected to.\",\n \"form.notConnected\": \"Not connected to a backend: what you submit goes only to this page.\",\n\n // StepFlow\n \"flow.done\": \"Done\",\n \"flow.current\": \"In progress\",\n \"flow.waiting\": \"Waiting for you\",\n \"flow.pending\": \"Not started\",\n \"flow.failed\": \"Failed\",\n \"flow.skipped\": \"Skipped\",\n \"flow.count\": \"{done} of {total} done\",\n\n // PlanReview\n \"plan.riskLow\": \"Low risk\",\n \"plan.riskMedium\": \"Check this\",\n \"plan.riskHigh\": \"Changes or removes data\",\n \"plan.proposedBy\": \"Proposed by {who}. Nothing runs until you approve.\",\n \"plan.required\": \"Required\",\n \"plan.affects\": \"Affects: {what}\",\n \"plan.whatItWouldRun\": \"What it would run\",\n \"plan.approved\": \"Approved {count} of {total} steps.\",\n \"plan.rejected\": \"Rejected. Nothing was run.\",\n \"plan.decisionNote\": \" Note: {note}\",\n \"plan.noteLabel\": \"Note for the record (optional)\",\n \"plan.approve\": \"Approve {count} steps\",\n \"plan.approveOne\": \"Approve {count} step\",\n \"plan.reject\": \"Reject\",\n\n // ActionReceipt\n \"receipt.done\": \"Done\",\n \"receipt.partial\": \"Partly done\",\n \"receipt.failed\": \"Failed\",\n \"receipt.ran\": \"Ran\",\n \"receipt.by\": \"by {who}\",\n \"receipt.approved\": \"Approved\",\n \"receipt.noApproval\": \"No one approved this.\",\n \"receipt.whatChanged\": \"What changed\",\n \"receipt.what\": \"What\",\n \"receipt.before\": \"Before\",\n \"receipt.after\": \"After\",\n \"receipt.whatRan\": \"What ran\",\n \"receipt.cannotUndo\": \"This cannot be undone from here.\",\n \"receipt.undoClosed\": \"It could be undone until {time}; that time has passed.\",\n \"receipt.undoUntil\": \"Can be undone until {time}.\",\n \"receipt.undoRequested\": \"Undo requested. You will be asked to confirm it.\",\n\n // DataTable\n \"table.selectPage\": \"Select every row on this page\",\n \"table.selectRow\": \"Select {name}\",\n \"table.empty\": \"Nothing to show.\",\n \"table.loading\": \"Loading…\",\n \"table.rowControls\": \"{name} actions\",\n \"table.actions\": \"Actions\",\n \"table.select\": \"Select\",\n\n // SelectionBar\n \"selection.label\": \"With the selected rows\",\n \"selection.count\": \"{count} selected\",\n \"selection.pageSelected\": \"All {count} on this page are selected.\",\n \"selection.selectAllMatching\": \"Select all {total} that match\",\n \"selection.allMatching\": \"All {total} that match are selected.\",\n \"selection.onlyPage\": \"Only this page\",\n \"selection.clear\": \"Clear\",\n\n // Pagination\n \"pages.label\": \"Pages\",\n \"pages.range\": \"{from}–{to} of {total}\",\n \"pages.previous\": \"Previous\",\n \"pages.next\": \"Next\",\n\n // ConfirmDialog\n \"confirm.confirm\": \"Confirm\",\n \"confirm.cancel\": \"Cancel\",\n\n // Combobox\n \"combobox.loading\": \"Looking…\",\n \"combobox.none\": \"Nothing matches.\",\n \"combobox.count\": \"{count} suggestions\",\n \"combobox.countOne\": \"1 suggestion\",\n\n // ReportBuilder\n \"report.untitled\": \"Untitled\",\n \"report.untitledReport\": \"Untitled report\",\n \"report.title\": \"Report title\",\n \"report.tileTitle\": \"Title of {title}\",\n \"report.tileControls\": \"{title} controls\",\n \"report.mode\": \"Mode\",\n \"report.build\": \"Build\",\n \"report.view\": \"View\",\n \"report.builder\": \"Build a view\",\n \"report.body\": \"Report\",\n \"report.changing\": \"Changing “{title}”.\",\n \"report.leaveAsItWas\": \"Leave it as it was\",\n \"report.leftAsItWas\": \"Left as it was.\",\n \"report.updateView\": \"Update view\",\n \"report.addToReport\": \"Add to report\",\n \"report.maxViews\": \"A report holds at most {max} views.\",\n \"report.needMeasure\": \"Put a metric on “Measure” first: a view needs something to measure.\",\n \"report.emptyBuild\": \"Nothing on the report yet. Make a view above and press “Add to report”; each one you add appears here, and they all follow the same filters.\",\n \"report.emptyView\": \"This report has no views yet. Switch to Build to make one.\",\n} as const;\n\n/** The name of one replaceable word or sentence. A name not in `defaultLabels` is a type error. */\nexport type LabelKey = keyof typeof defaultLabels;\n/** Every label, by name. */\nexport type Labels = Record<LabelKey, string>;\n\nlet labels: Labels = { ...defaultLabels };\n\n/** Replaces some of the words. Names not given keep their current text. */\nexport function setLabels(partial: Partial<Labels>): void {\n const next = { ...labels };\n for (const [key, text] of Object.entries(partial)) {\n if (typeof text === \"string\" && key in defaultLabels) next[key as LabelKey] = text;\n }\n labels = next;\n}\n\n/** Puts every word back to its English default. */\nexport function resetLabels(): void {\n labels = { ...defaultLabels };\n}\n\n/** The text for a label, with each `{name}` replaced by `vars.name`. A name with no value is left as written. */\nexport function label(key: LabelKey, vars?: Record<string, string | number>): string {\n const text = labels[key];\n if (!vars) return text;\n return text.replace(/\\{(\\w+)\\}/g, (whole, name: string) => (name in vars ? String(vars[name]) : whole));\n}\n"]}
1
+ {"version":3,"file":"locale.js","sourceRoot":"","sources":["../../src/locale/locale.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,IAAI,OAAO,GAAG,OAAO,CAAC;AACtB,MAAM,OAAO,GAAG,IAAI,GAAG,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iBAAiB,EAAE,qCAAqC;IACxD,oBAAoB,EAAE,qEAAqE;IAC3F,mBAAmB,EAAE,8IAA8I;IACnK,kBAAkB,EAAE,4DAA4D;CACxE,CAAC;AAOX,IAAI,MAAM,GAAW,EAAE,GAAG,aAAa,EAAE,CAAC;AAE1C,2EAA2E;AAC3E,MAAM,UAAU,SAAS,CAAC,OAAwB;IAChD,MAAM,IAAI,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAClD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,GAAG,IAAI,aAAa;YAAE,IAAI,CAAC,GAAe,CAAC,GAAG,IAAI,CAAC;IACrF,CAAC;IACD,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC;AAED,mDAAmD;AACnD,MAAM,UAAU,WAAW;IACzB,MAAM,GAAG,EAAE,GAAG,aAAa,EAAE,CAAC;AAChC,CAAC;AAED,iHAAiH;AACjH,MAAM,UAAU,KAAK,CAAC,GAAa,EAAE,IAAsC;IACzE,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACzB,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1G,CAAC","sourcesContent":["/**\n * The locale every number and date in the components is written in, and the\n * words they show. Both are page-wide: one locale and one set of words per\n * page. A host sets them once, before the components render, with\n * `setLocale` and `setLabels` or the `SurfacesText` component.\n */\n\nlet current = \"en-US\";\nconst formats = new Map<string, Intl.NumberFormat>();\nconst dateFormats = new Map<string, Intl.DateTimeFormat>();\n\n/**\n * Sets the locale (a BCP 47 tag such as \"de-DE\") for every number and date the\n * components write. Platform forms with an underscore (\"en_US\", as iOS and\n * Android write them) are accepted.\n */\nexport function setLocale(locale: string): void {\n // Throws a RangeError on a malformed tag here rather than on the next render.\n current = Intl.getCanonicalLocales(locale.replaceAll(\"_\", \"-\"))[0] ?? \"en-US\";\n}\n\n/** The locale numbers and dates are written in. Defaults to \"en-US\". */\nexport function getLocale(): string {\n return current;\n}\n\n/** A number format in the current locale, kept for reuse. Call it when formatting, not once at load, so a later `setLocale` applies. */\nexport function numberFormat(options: Intl.NumberFormatOptions = {}): Intl.NumberFormat {\n const key = `${current}|${JSON.stringify(options)}`;\n let format = formats.get(key);\n if (!format) {\n format = new Intl.NumberFormat(current, options);\n formats.set(key, format);\n }\n return format;\n}\n\n/** A date and time format in the current locale, kept for reuse. */\nexport function dateFormat(options: Intl.DateTimeFormatOptions = {}): Intl.DateTimeFormat {\n const key = `${current}|${JSON.stringify(options)}`;\n let format = dateFormats.get(key);\n if (!format) {\n format = new Intl.DateTimeFormat(current, options);\n dateFormats.set(key, format);\n }\n return format;\n}\n\n/**\n * Every word the data-display components show, in English. `{name}` marks a\n * value filled in when the words are shown. Replace any of them with\n * `setLabels`, for another language or plainer words.\n */\nexport const defaultLabels = {\n // Cell values\n \"cell.null\": \"null\",\n \"cell.true\": \"true\",\n \"cell.false\": \"false\",\n\n // DataGrid\n \"grid.label\": \"Query result\",\n \"grid.sortAscending\": \"Sort ascending\",\n \"grid.sortDescending\": \"Sort descending\",\n \"grid.clearSorting\": \"Clear sorting\",\n \"grid.moveLeft\": \"Move left\",\n \"grid.moveRight\": \"Move right\",\n \"grid.hideColumn\": \"Hide column\",\n \"grid.showAllColumns\": \"Show all columns\",\n \"grid.showAllColumnsHidden\": \"Show all columns ({count} hidden)\",\n \"grid.resetWidth\": \"Reset width\",\n \"grid.resetWidthHint\": \"Double-click edge\",\n \"grid.resetLayout\": \"Reset column layout\",\n \"grid.copyColumnName\": \"Copy column name\",\n \"grid.sqlCountValues\": \"SQL: count each value\",\n \"grid.sqlRange\": \"SQL: range and missing values\",\n \"grid.copyValue\": \"Copy value\",\n \"grid.copyRowJson\": \"Copy row as JSON\",\n \"grid.filterToValue\": \"Filter to this value\",\n \"grid.leaveValueOut\": \"Leave this value out\",\n \"grid.copied\": \"Copied {what}.\",\n \"grid.copiedCell\": \"the cell\",\n \"grid.copiedRow\": \"the row\",\n \"grid.copiedColumnName\": \"the column name\",\n \"grid.copiedSql\": \"the SQL\",\n \"code.copyFailed\": \"Could not copy: the browser did not allow it. The code is selected, so you can copy it yourself.\",\n \"grid.copyFailed\": \"Could not copy: the browser refused access to the clipboard.\",\n \"grid.movedLeft\": \"Moved {name} left.\",\n \"grid.movedRight\": \"Moved {name} right.\",\n \"grid.moved\": \"Moved {name}.\",\n \"grid.columnMenu\": \"{name} column\",\n \"grid.cellMenu\": \"{name} cell\",\n \"grid.activeCellMenu\": \"Cell\",\n \"grid.failed\": \"Query failed\",\n \"grid.loading\": \"Loading…\",\n \"grid.rows\": \"{count} rows\",\n \"grid.rowsOne\": \"{count} row\",\n \"grid.noRows\": \"No rows match.\",\n \"grid.showHidden\": \"Show {count} hidden columns\",\n \"grid.showHiddenOne\": \"Show {count} hidden column\",\n \"grid.elapsed\": \"{ms} ms\",\n \"grid.asOf\": \"As of {time}\",\n \"grid.runAgain\": \"Run again\",\n \"grid.previous\": \"Previous\",\n \"grid.next\": \"Next\",\n \"grid.page\": \"Page {page} of {pages}\",\n\n // PivotTable\n \"pivot.label\": \"Pivot table\",\n \"pivot.loading\": \"Loading…\",\n \"pivot.choose\": \"Choose rows or columns and a measure.\",\n \"pivot.empty\": \"No rows match.\",\n \"pivot.total\": \"Total\",\n \"pivot.all\": \"All\",\n \"pivot.none\": \"(none)\",\n \"pivot.truncated\": \"This pivot has more than {limit} cells, so some are missing. Add a filter or choose columns with fewer values.\",\n \"pivot.hiddenColumns\": \"Showing the first {shown} of {total} column values.\",\n\n // Chart\n \"chart.empty\": \"No data to chart.\",\n \"chart.missingX\": \"Rows with no {x} are not drawn{detail}.\",\n \"chart.description\": \"{type} chart of {measures} by {x}\",\n \"chart.coloursRepeat\": \"{count} series share {colours} colours, so some repeat. Filter, or split by a column with fewer values.\",\n \"chart.advice\": \"{message} Better: {instead}\",\n \"chart.sampleNote\": \"Showing a random sample of {count} rows.\",\n \"chart.firstNote\": \"Showing the first {count} points.\",\n \"chart.largestNote\": \"Showing the largest {count} points.\",\n\n // RowList\n \"rows.loading\": \"Loading…\",\n \"rows.empty\": \"Nothing to show.\",\n \"rows.more\": \"Show more\",\n \"rows.some\": \"Showing the first {count}.\",\n \"rows.full\": \"Showing the first {count}. Filter to find others.\",\n\n // Metric, Sparkline, BulletGraph\n \"metric.loading\": \"…\",\n \"metric.none\": \"–\",\n \"sparkline.summary\": \"{label}: {now} now, from {first}; low {low}, high {high} over {count} {grain}s.\",\n \"sparkline.empty\": \"{label}: no data.\",\n \"bullet.loading\": \"{label}: loading.\",\n \"bullet.empty\": \"{label}: no data.\",\n \"bullet.reading\": \"{label}: {value}{band}{target}.\",\n \"bullet.targetMet\": \"; target {target}, met\",\n \"bullet.targetNotMet\": \"; target {target}, not met\",\n \"bullet.target\": \"Target {target}\",\n\n // FilterBar\n \"filter.active\": \"Active filters\",\n \"filter.remove\": \"Remove filter {filter}\",\n \"filter.form\": \"Add a filter\",\n \"filter.column\": \"Column\",\n \"filter.comparison\": \"Comparison\",\n \"filter.value\": \"Value\",\n \"filter.typeOrPick\": \"Type or pick a value\",\n \"filter.add\": \"Add filter\",\n \"filter.quickRange\": \"Quick date range\",\n \"filter.quickRangeChoose\": \"Quick range…\",\n \"filter.range7d\": \"Last 7 days\",\n \"filter.range30d\": \"Last 30 days\",\n \"filter.range90d\": \"Last 90 days\",\n \"filter.range12m\": \"Last 12 months\",\n \"filter.rangeMonth\": \"This month\",\n \"filter.rangeYear\": \"This year\",\n \"filter.isEmpty\": \"is empty\",\n \"filter.isNotEmpty\": \"is not empty\",\n \"filter.contains\": \"contains\",\n \"filter.is\": \"is\",\n \"filter.isNot\": \"is not\",\n \"filter.startsWith\": \"starts with\",\n \"filter.endsWith\": \"ends with\",\n \"filter.enterWholeNumber\": \"Enter a whole number.\",\n \"filter.enterNumber\": \"Enter a number.\",\n \"filter.enterTrueFalse\": \"Enter true or false.\",\n \"filter.enterDate\": \"Enter a date like 2026-01-31.\",\n \"filter.enterValue\": \"Enter a value.\",\n\n // QueryResult\n \"result.views\": \"Result view\",\n \"result.tabTable\": \"Table\",\n \"result.tabChart\": \"Chart\",\n \"result.tabPivot\": \"Pivot\",\n \"result.stopExport\": \"Stop export\",\n \"result.downloadCsv\": \"Download CSV\",\n \"result.copySql\": \"Copy SQL\",\n \"result.cancelQuery\": \"Cancel query\",\n \"result.format\": \"Format\",\n \"result.formatColumn\": \"Column to format\",\n \"result.chooseColumn\": \"Choose a column…\",\n \"result.howToShow\": \"How to show {column}\",\n \"result.asItIs\": \"As it is\",\n \"result.formatNumber\": \"Number\",\n \"result.formatCompact\": \"Short number (1.2M)\",\n \"result.formatCurrency\": \"Currency\",\n \"result.formatPercent\": \"Percent\",\n \"result.formatText\": \"Plain text\",\n \"result.formatDate\": \"Date only\",\n \"result.formatDatetime\": \"Date and time\",\n \"result.preparing\": \"Preparing the file…\",\n \"result.rowsSoFar\": \"{count} rows so far…\",\n \"result.saved\": \"Saved {count} rows.\",\n \"result.savedTruncated\": \"Saved {count} rows. The server's row limit was reached, so the file is not the whole result.\",\n \"result.exportStopped\": \"Export stopped.\",\n \"result.sqlCopied\": \"SQL copied.\",\n \"result.copyNotAllowed\": \"Copying is not allowed here.\",\n \"result.sqlSent\": \"SQL sent to the engine\",\n \"result.plan\": \"How the engine will run it\",\n \"result.stored\": \"The query ran once and its result was kept, so sorting, filtering and paging read the kept rows instead of running it again.\",\n \"result.chooseChart\": \"Choose columns to chart.\",\n \"result.choosePivot\": \"Choose what goes in the rows and the values.\",\n \"result.chartType\": \"Type\",\n \"result.slices\": \"Slices\",\n \"result.xAxis\": \"X axis\",\n \"result.yAxis\": \"Y axis\",\n \"result.every\": \"Every\",\n \"result.bins\": \"Bins\",\n \"result.binsEach\": \"each value\",\n \"result.binsAbout\": \"about {count}\",\n \"result.splitBy\": \"Split by\",\n \"result.nothing\": \"nothing\",\n \"result.legend\": \"Legend\",\n \"result.automatic\": \"automatic\",\n \"result.legendHidden\": \"hidden\",\n \"result.stack\": \"Stack\",\n \"result.plotEachRow\": \"Plot each row\",\n \"result.series\": \"Series {number}\",\n \"result.of\": \"of\",\n \"result.drawnAs\": \"Drawn as\",\n \"result.drawnAsChart\": \"chart type ({type})\",\n \"result.scale\": \"Scale\",\n \"result.leftAxis\": \"left axis\",\n \"result.rightAxis\": \"right axis\",\n \"result.removeSeries\": \"Remove series {number}\",\n \"result.remove\": \"Remove\",\n \"result.addSeries\": \"Add series\",\n \"result.rows\": \"Rows\",\n \"result.columns\": \"Columns\",\n \"result.none\": \"none\",\n \"result.datesBy\": \"Dates by\",\n \"result.values\": \"Values\",\n \"result.sum\": \"sum\",\n \"result.avg\": \"average\",\n \"result.median\": \"median\",\n \"result.count\": \"count of rows\",\n \"result.countDistinct\": \"distinct count\",\n \"result.min\": \"minimum\",\n \"result.max\": \"maximum\",\n \"result.stddev\": \"standard deviation\",\n \"result.p90\": \"90th percentile\",\n\n // Form\n \"form.submit\": \"Submit\",\n \"form.choose\": \"Choose…\",\n \"form.required\": \"(required)\",\n \"form.needsAttention\": \"Nothing was sent. {count} fields need attention.\",\n \"form.needsAttentionOne\": \"Nothing was sent. One field needs attention.\",\n \"form.sent\": \"Sent.\",\n \"form.notSaved\": \"The backend did not save it.\",\n \"form.saved\": \"Saved.\",\n \"form.couldNotSend\": \"Could not send: {error}\",\n \"form.sending\": \"Sending…\",\n \"form.connected\": \"Saved by the backend this page is connected to.\",\n \"form.notConnected\": \"Not connected to a backend: what you submit goes only to this page.\",\n\n // StepFlow\n \"flow.done\": \"Done\",\n \"flow.current\": \"In progress\",\n \"flow.waiting\": \"Waiting for you\",\n \"flow.pending\": \"Not started\",\n \"flow.failed\": \"Failed\",\n \"flow.skipped\": \"Skipped\",\n \"flow.count\": \"{done} of {total} done\",\n\n // PlanReview\n \"plan.riskLow\": \"Low risk\",\n \"plan.riskMedium\": \"Check this\",\n \"plan.riskHigh\": \"Changes or removes data\",\n \"plan.proposedBy\": \"Proposed by {who}. Nothing runs until you approve.\",\n \"plan.required\": \"Required\",\n \"plan.affects\": \"Affects: {what}\",\n \"plan.whatItWouldRun\": \"What it would run\",\n \"plan.approved\": \"Approved {count} of {total} steps.\",\n \"plan.rejected\": \"Rejected. Nothing was run.\",\n \"plan.decisionNote\": \" Note: {note}\",\n \"plan.noteLabel\": \"Note for the record (optional)\",\n \"plan.approve\": \"Approve {count} steps\",\n \"plan.approveOne\": \"Approve {count} step\",\n \"plan.reject\": \"Reject\",\n\n // ActionReceipt\n \"receipt.done\": \"Done\",\n \"receipt.partial\": \"Partly done\",\n \"receipt.none\": \"Nothing changed\",\n \"receipt.failed\": \"Failed\",\n \"receipt.ran\": \"Ran\",\n \"receipt.by\": \"by {who}\",\n \"receipt.approved\": \"Approved\",\n \"receipt.noApproval\": \"No one approved this.\",\n \"receipt.whatChanged\": \"What changed\",\n \"receipt.what\": \"What\",\n \"receipt.before\": \"Before\",\n \"receipt.after\": \"After\",\n \"receipt.whatRan\": \"What ran\",\n \"receipt.cannotUndo\": \"This cannot be undone from here.\",\n \"receipt.undoClosed\": \"It could be undone until {time}; that time has passed.\",\n \"receipt.undoUntil\": \"Can be undone until {time}.\",\n \"receipt.undoRequested\": \"Undo requested. You will be asked to confirm it.\",\n\n // DataTable\n \"table.selectPage\": \"Select every row on this page\",\n \"table.selectRow\": \"Select {name}\",\n \"table.empty\": \"Nothing to show.\",\n \"table.loading\": \"Loading…\",\n \"table.rowControls\": \"{name} actions\",\n \"table.actions\": \"Actions\",\n \"table.select\": \"Select\",\n\n // SelectionBar\n \"selection.label\": \"With the selected rows\",\n \"selection.count\": \"{count} selected\",\n \"selection.pageSelected\": \"All {count} on this page are selected.\",\n \"selection.selectAllMatching\": \"Select all {total} that match\",\n \"selection.allMatching\": \"All {total} that match are selected.\",\n \"selection.onlyPage\": \"Only this page\",\n \"selection.clear\": \"Clear\",\n\n // Pagination\n \"pages.label\": \"Pages\",\n \"pages.range\": \"{from}–{to} of {total}\",\n \"pages.previous\": \"Previous\",\n \"pages.next\": \"Next\",\n\n // ConfirmDialog\n \"confirm.confirm\": \"Confirm\",\n \"confirm.cancel\": \"Cancel\",\n \"confirm.typeWord\": \"Type “{word}” to go ahead\",\n \"confirm.reason\": \"Reason (optional)\",\n \"confirm.reasonRequired\": \"Reason (required)\",\n \"confirm.needWord\": \"Type “{word}” in the box first. Nothing has run.\",\n \"confirm.needReason\": \"Give a reason first. Nothing has run.\",\n \"run.working\": \"Working…\",\n \"run.you\": \"You\",\n \"run.reread\": \"Read it again\",\n \"run.continue\": \"Continue\",\n \"run.leftAlone\": \"Left alone\",\n \"run.andMore\": \"and {count} more\",\n \"run.changed\": \"Changed\",\n \"run.highRisk\": \"High risk\",\n \"run.irreversible\": \"Cannot be undone\",\n \"run.rows\": \"Rows it applies to\",\n \"run.operation\": \"Operation\",\n \"run.expires\": \"Ask again after {time}\",\n\n // RecordForm\n \"record.save\": \"Save\",\n \"record.saving\": \"Saving…\",\n \"record.saved\": \"Saved.\",\n \"record.edit\": \"Edit\",\n \"record.cancel\": \"Cancel\",\n \"record.unchanged\": \"Nothing has changed, so nothing was saved.\",\n \"record.notSaved\": \"Not saved: {count} fields need attention.\",\n \"record.notSavedOne\": \"Not saved: one field needs attention.\",\n \"record.problems\": \"There are {count} problems\",\n \"record.problemsOne\": \"There is a problem\",\n \"record.reading\": \"Reading the record…\",\n \"record.notFound\": \"This {label} was not found. It may have been removed.\",\n \"record.many\": \"More than one record has this key, so none is shown.\",\n \"record.unread\": \"The record could not be read.\",\n \"record.noOperation\": \"This form cannot be shown: the operation that saves it is not one this backend has.\",\n \"record.back\": \"Go back\",\n \"record.savedValue\": \"Saved now: {value}.\",\n \"record.leaveTitle\": \"Leave without saving?\",\n \"record.leaveBody\": \"Your changes to {what} have not been saved. If you leave, they are lost.\",\n \"record.leave\": \"Leave\",\n \"record.stay\": \"Stay\",\n \"record.yes\": \"Yes\",\n \"record.no\": \"No\",\n\n // Combobox\n \"combobox.loading\": \"Looking…\",\n \"combobox.none\": \"Nothing matches.\",\n \"combobox.count\": \"{count} suggestions\",\n \"combobox.countOne\": \"1 suggestion\",\n\n // ReportBuilder\n \"report.untitled\": \"Untitled\",\n \"report.untitledReport\": \"Untitled report\",\n \"report.title\": \"Report title\",\n \"report.tileTitle\": \"Title of {title}\",\n \"report.tileControls\": \"{title} controls\",\n \"report.mode\": \"Mode\",\n \"report.build\": \"Build\",\n \"report.view\": \"View\",\n \"report.builder\": \"Build a view\",\n \"report.body\": \"Report\",\n \"report.changing\": \"Changing “{title}”.\",\n \"report.leaveAsItWas\": \"Leave it as it was\",\n \"report.leftAsItWas\": \"Left as it was.\",\n \"report.updateView\": \"Update view\",\n \"report.addToReport\": \"Add to report\",\n \"report.maxViews\": \"A report holds at most {max} views.\",\n \"report.needMeasure\": \"Put a metric on “Measure” first: a view needs something to measure.\",\n \"report.emptyBuild\": \"Nothing on the report yet. Make a view above and press “Add to report”; each one you add appears here, and they all follow the same filters.\",\n \"report.emptyView\": \"This report has no views yet. Switch to Build to make one.\",\n} as const;\n\n/** The name of one replaceable word or sentence. A name not in `defaultLabels` is a type error. */\nexport type LabelKey = keyof typeof defaultLabels;\n/** Every label, by name. */\nexport type Labels = Record<LabelKey, string>;\n\nlet labels: Labels = { ...defaultLabels };\n\n/** Replaces some of the words. Names not given keep their current text. */\nexport function setLabels(partial: Partial<Labels>): void {\n const next = { ...labels };\n for (const [key, text] of Object.entries(partial)) {\n if (typeof text === \"string\" && key in defaultLabels) next[key as LabelKey] = text;\n }\n labels = next;\n}\n\n/** Puts every word back to its English default. */\nexport function resetLabels(): void {\n labels = { ...defaultLabels };\n}\n\n/** The text for a label, with each `{name}` replaced by `vars.name`. A name with no value is left as written. */\nexport function label(key: LabelKey, vars?: Record<string, string | number>): string {\n const text = labels[key];\n if (!vars) return text;\n return text.replace(/\\{(\\w+)\\}/g, (whole, name: string) => (name in vars ? String(vars[name]) : whole));\n}\n"]}