@eifi1/ui-kit 0.52.0 → 0.53.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/README.md +47 -54
- package/dist/billing/cancel-subscription.d.ts +5 -14
- package/dist/billing/cancel-subscription.js +1 -3
- package/dist/billing/cancel-subscription.js.map +1 -1
- package/dist/billing/plan-card.d.ts +5 -13
- package/dist/billing/plan-card.js +3 -11
- package/dist/billing/plan-card.js.map +1 -1
- package/dist/billing/plan-switch.d.ts +5 -14
- package/dist/billing/plan-switch.js +1 -3
- package/dist/billing/plan-switch.js.map +1 -1
- package/dist/chart.d.ts +3 -14
- package/dist/chart.js +64 -11
- package/dist/chart.js.map +1 -1
- package/dist/components/date-field.d.ts +1 -1
- package/dist/components/date-field.js.map +1 -1
- package/dist/components/date-picker.d.ts +1 -1
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-range-picker.d.ts +4 -17
- package/dist/components/date-range-picker.js +2 -2
- package/dist/components/date-range-picker.js.map +1 -1
- package/dist/components/nav-pills.d.ts +1 -1
- package/dist/components/nav-pills.js.map +1 -1
- package/dist/components/series-chart-axes.d.ts +1 -1
- package/dist/components/series-chart-axes.js.map +1 -1
- package/dist/components/series-chart.d.ts +64 -19
- package/dist/components/series-chart.js +2 -1
- package/dist/components/series-chart.js.map +1 -1
- package/dist/components/treemap-labels.d.ts +6 -1
- package/dist/components/treemap-labels.js +2 -2
- package/dist/components/treemap-labels.js.map +1 -1
- package/dist/components/treemap.d.ts +29 -4
- package/dist/components/treemap.js +22 -9
- package/dist/components/treemap.js.map +1 -1
- package/dist/data-table.d.ts +1 -6
- package/dist/data-table.js +1 -9
- package/dist/data-table.js.map +1 -1
- package/dist/demo/demo-countdown.d.ts +0 -5
- package/dist/demo/demo-countdown.js +0 -4
- package/dist/demo/demo-countdown.js.map +1 -1
- package/dist/eslint/index.js +1 -1
- package/dist/feedback/feedback-mutation.d.ts +11 -23
- package/dist/feedback/feedback-mutation.js +1 -9
- package/dist/feedback/feedback-mutation.js.map +1 -1
- package/dist/feedback/feedback-public-list.d.ts +1 -6
- package/dist/feedback/feedback-public-list.js +1 -2
- package/dist/feedback/feedback-public-list.js.map +1 -1
- package/dist/feedback/feedback-row-detail-labels.js +0 -8
- package/dist/feedback/feedback-row-detail-labels.js.map +1 -1
- package/dist/feedback/feedback-row-detail.d.ts +3 -50
- package/dist/feedback/feedback-row-detail.js +0 -8
- package/dist/feedback/feedback-row-detail.js.map +1 -1
- package/dist/feedback/feedback-status-undo.d.ts +3 -19
- package/dist/feedback/feedback-status-undo.js.map +1 -1
- package/dist/feedback/feedback-thread.d.ts +0 -9
- package/dist/feedback/feedback-thread.js.map +1 -1
- package/dist/feedback.d.ts +6 -40
- package/dist/feedback.js +88 -46
- package/dist/feedback.js.map +1 -1
- package/dist/i18n/defaults.js +0 -4
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.js +2 -19
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +5 -14
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/locales/en.js +2 -30
- package/dist/i18n/locales/en.js.map +3 -3
- package/dist/i18n/locales/es.js +2 -19
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.js +2 -19
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.js +2 -19
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.js +2 -20
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.js +2 -19
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.js +9 -4
- package/dist/i18n/review.js.map +1 -1
- package/dist/i18n/shared-labels.js +0 -1
- package/dist/i18n/shared-labels.js.map +1 -1
- package/dist/index.d.ts +15 -64
- package/dist/index.js +22 -102
- package/dist/index.js.map +1 -1
- package/dist/rhf/fields.d.ts +2 -2
- package/dist/rhf/fields.js.map +1 -1
- package/dist/search/search-index.d.ts +0 -6
- package/dist/search/search-index.js +0 -4
- package/dist/search/search-index.js.map +1 -1
- package/dist/search.d.ts +1 -8
- package/dist/search.js +2 -7
- package/dist/search.js.map +1 -1
- package/dist/shell/account-menu-language.d.ts +7 -21
- package/dist/shell/account-menu-language.js +1 -3
- package/dist/shell/account-menu-language.js.map +1 -1
- package/dist/shell/account-menu-text-size.d.ts +9 -23
- package/dist/shell/account-menu-text-size.js +2 -3
- package/dist/shell/account-menu-text-size.js.map +1 -1
- package/dist/shell/app-shell.d.ts +0 -10
- package/dist/shell/app-shell.js +1 -7
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/company-switcher.d.ts +1 -1
- package/dist/shell/company-switcher.js.map +1 -1
- package/dist/shell/dev-menu.d.ts +1 -1
- package/dist/shell/dev-menu.js.map +1 -1
- package/dist/shell/top-bar-parts-labels.d.ts +1 -1
- package/dist/shell/top-bar-parts-labels.js.map +1 -1
- package/dist/shell.d.ts +7 -29
- package/dist/shell.js +12 -42
- package/dist/shell.js.map +1 -1
- package/dist/sync.d.ts +2 -6
- package/dist/sync.js +2 -15
- package/dist/sync.js.map +1 -1
- package/dist/theme/chart-palette.d.ts +0 -5
- package/dist/theme/chart-palette.js +0 -2
- package/dist/theme/chart-palette.js.map +1 -1
- package/package.json +1 -1
- package/src/billing/cancel-subscription.tsx +5 -16
- package/src/billing/plan-card.tsx +7 -24
- package/src/billing/plan-switch.tsx +5 -16
- package/src/chart.ts +62 -13
- package/src/components/date-field.tsx +1 -1
- package/src/components/date-picker.tsx +0 -1
- package/src/components/date-range-picker.tsx +6 -22
- package/src/components/nav-pills.tsx +1 -1
- package/src/components/series-chart-axes.ts +6 -1
- package/src/components/series-chart.tsx +78 -21
- package/src/components/treemap-labels.ts +11 -3
- package/src/components/treemap.tsx +65 -12
- package/src/data-table.ts +1 -11
- package/src/demo/demo-countdown.ts +3 -8
- package/src/feedback/feedback-mutation.ts +12 -33
- package/src/feedback/feedback-public-list.tsx +1 -7
- package/src/feedback/feedback-row-detail-labels.ts +0 -8
- package/src/feedback/feedback-row-detail.tsx +8 -58
- package/src/feedback/feedback-status-undo.ts +4 -18
- package/src/feedback/feedback-thread.tsx +0 -10
- package/src/feedback.ts +89 -48
- package/src/i18n/defaults.ts +0 -4
- package/src/i18n/german.ts +2 -19
- package/src/i18n/kit-labels.tsx +5 -14
- package/src/i18n/locales/es.ts +2 -19
- package/src/i18n/locales/fr.ts +2 -19
- package/src/i18n/locales/hu.ts +2 -19
- package/src/i18n/locales/it.ts +2 -20
- package/src/i18n/locales/zh.ts +2 -19
- package/src/i18n/review.ts +9 -4
- package/src/i18n/shared-labels.ts +0 -1
- package/src/index.ts +30 -112
- package/src/rhf/fields.tsx +2 -2
- package/src/search/search-index.ts +0 -15
- package/src/search.ts +8 -8
- package/src/shell/account-menu-language.tsx +7 -27
- package/src/shell/account-menu-text-size.tsx +13 -32
- package/src/shell/app-shell.tsx +0 -13
- package/src/shell/company-switcher.tsx +1 -1
- package/src/shell/dev-menu.tsx +1 -1
- package/src/shell/top-bar-parts-labels.ts +1 -1
- package/src/shell.ts +17 -44
- package/src/sync.ts +2 -15
- package/src/theme/chart-palette.ts +0 -2
- package/tokens.css +4 -4
- package/dist/billing/dialog-close.d.ts +0 -29
- package/dist/billing/dialog-close.js +0 -8
- package/dist/billing/dialog-close.js.map +0 -1
- package/dist/components/field-sync-labels.d.ts +0 -3
- package/dist/components/field-sync-labels.js +0 -12
- package/dist/components/field-sync-labels.js.map +0 -1
- package/dist/components/field-sync.d.ts +0 -186
- package/dist/components/field-sync.js +0 -269
- package/dist/components/field-sync.js.map +0 -1
- package/dist/components/section-nav.d.ts +0 -44
- package/dist/components/section-nav.js +0 -33
- package/dist/components/section-nav.js.map +0 -1
- package/dist/components/sign-chip-labels.d.ts +0 -3
- package/dist/components/sign-chip-labels.js +0 -11
- package/dist/components/sign-chip-labels.js.map +0 -1
- package/dist/components/sign-chip.d.ts +0 -77
- package/dist/components/sign-chip.js +0 -47
- package/dist/components/sign-chip.js.map +0 -1
- package/dist/lib/isin.d.ts +0 -38
- package/dist/lib/isin.js +0 -36
- package/dist/lib/isin.js.map +0 -1
- package/dist/shell/role-switcher.d.ts +0 -28
- package/dist/shell/role-switcher.js +0 -31
- package/dist/shell/role-switcher.js.map +0 -1
- package/src/billing/dialog-close.ts +0 -34
- package/src/components/field-sync-labels.ts +0 -14
- package/src/components/field-sync.tsx +0 -504
- package/src/components/section-nav.tsx +0 -72
- package/src/components/sign-chip-labels.ts +0 -13
- package/src/components/sign-chip.tsx +0 -133
- package/src/lib/isin.ts +0 -72
- package/src/shell/role-switcher.tsx +0 -53
package/src/sync.ts
CHANGED
|
@@ -4,13 +4,7 @@
|
|
|
4
4
|
// The only entry point that imports `dexie` — an optional peer for that reason. It never loads
|
|
5
5
|
// `/offline`'s TanStack and idb-keyval peers: the leaf utilities both entries export live in
|
|
6
6
|
// one module of their own (src/offline/local-first.ts). NOT re-exported from the main barrel.
|
|
7
|
-
export {
|
|
8
|
-
createSyncDb,
|
|
9
|
-
rowByPk,
|
|
10
|
-
SYNC_DB_PK_INDEX,
|
|
11
|
-
/** @deprecated 0.52 — `createSyncDb`, which declares them (`extraStores` for an app's own) (API-4); removed in 0.53 */
|
|
12
|
-
SYNC_DB_STORES,
|
|
13
|
-
} from "./sync/db";
|
|
7
|
+
export { createSyncDb, rowByPk, SYNC_DB_PK_INDEX } from "./sync/db";
|
|
14
8
|
export type {
|
|
15
9
|
CreateSyncDbOptions,
|
|
16
10
|
OutboxChange,
|
|
@@ -20,14 +14,7 @@ export type {
|
|
|
20
14
|
SyncedRow,
|
|
21
15
|
SyncMetaEntry,
|
|
22
16
|
} from "./sync/db";
|
|
23
|
-
export {
|
|
24
|
-
createSyncEngine,
|
|
25
|
-
DEFAULT_HOLD_CODES,
|
|
26
|
-
/** @deprecated 0.52 — `createSyncEngine`, whose `backoffMs` defaults to it (API-4); removed in 0.53 */
|
|
27
|
-
DEFAULT_SYNC_BACKOFF_MS,
|
|
28
|
-
releaseSyncEngine,
|
|
29
|
-
syncEngineFor,
|
|
30
|
-
} from "./sync/engine";
|
|
17
|
+
export { createSyncEngine, DEFAULT_HOLD_CODES, releaseSyncEngine, syncEngineFor } from "./sync/engine";
|
|
31
18
|
export type {
|
|
32
19
|
SyncCounts,
|
|
33
20
|
SyncEngine,
|
|
@@ -74,8 +74,6 @@ export const CHART_ROLES = {
|
|
|
74
74
|
outline: "var(--chart-ink)",
|
|
75
75
|
} as const;
|
|
76
76
|
|
|
77
|
-
/** `--chart-ink` per theme, as hex (tokens.css holds the same two). */
|
|
78
|
-
export const CHART_INK_HEX = { light: "#1a1a17", dark: "#f0efe8" } as const;
|
|
79
77
|
/** `--chart-muted` per theme, as hex (tokens.css holds the same two). */
|
|
80
78
|
export const CHART_MUTED_HEX = { light: "#6b6a63", dark: "#a8a79f" } as const;
|
|
81
79
|
|
package/tokens.css
CHANGED
|
@@ -397,13 +397,13 @@ html[data-text-size="xlarge"] {
|
|
|
397
397
|
was: beside red-700 that orange read as a second error colour, and "unsaved" has
|
|
398
398
|
to look like a caution, not an alarm. Light, it is amber-600's hue and chroma at a
|
|
399
399
|
SOLVED lightness (3.1:1 on the worst surface). Below 4.5:1, so it is not a TEXT
|
|
400
|
-
colour:
|
|
400
|
+
colour: a state's words go in `--text-secondary` beside it.
|
|
401
401
|
|
|
402
402
|
GREEN AND RED ARE THE CLASSIC CVD-UNSAFE PAIR, and the rest of this file goes out
|
|
403
403
|
of its way to avoid it — the money trio is teal/amber/violet for exactly this
|
|
404
404
|
reason. They are used here because the states were specified in these colours, so
|
|
405
|
-
|
|
406
|
-
|
|
405
|
+
every state needs its own ICON as well and colour is never the only signal (as
|
|
406
|
+
FieldSyncIndicator, which drew them until 0.53, gave it). Do not drop the icons. */
|
|
407
407
|
--status-synced: #166534; /* green-800 — persisted */
|
|
408
408
|
--status-pending: #1d4ed8; /* blue-700 — in flight */
|
|
409
409
|
--status-edited: #bf6800; /* solved — dirty, not yet saved */
|
|
@@ -871,7 +871,7 @@ html[data-text-size="xlarge"] {
|
|
|
871
871
|
* counts a `[var(--role)]` class, and a `ring-[length:var(--…)]` width, for any token that
|
|
872
872
|
* has a utility here and allows none (`ROLE_BUDGET` 0). What stays `[var()]` has no
|
|
873
873
|
* utility on purpose: the chart colours (lookup tables of `--chart-N`), `--status-*`
|
|
874
|
-
* (
|
|
874
|
+
* (the field-sync four), and the cross-property one-offs (`bg-[var(--border)]` as a
|
|
875
875
|
* divider, `ring-[var(--text-primary)]`) — a utility there would undo the property
|
|
876
876
|
* scoping above. `check:tailwind` asserts one per namespace survives a build, and the
|
|
877
877
|
* README's "Styling" table is generated from this block (`scripts/gen-styling-inventory.mjs`).
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* How the three billing confirms — `CancelSubscriptionConfirm`, `PlanSwitchConfirm`,
|
|
3
|
-
* `GrantWarningConfirm` — are closed in 0.52: `onClose`, as every other kit dialog
|
|
4
|
-
* (CONTRIBUTING §4; refactor audit 2026-10-30, API-5), and for one minor the deprecated
|
|
5
|
-
* `onOpenChange`, called with `false` when there is no `onClose`.
|
|
6
|
-
*
|
|
7
|
-
* 0.52 made `onOpenChange` optional for its deprecation and gave `onClose` beside it as
|
|
8
|
-
* optional too, so a confirm given NEITHER compiled — `<CancelSubscriptionConfirm open
|
|
9
|
-
* periodEnd={…} onConfirm={…} />` — and Back, Escape and the backdrop then called nothing:
|
|
10
|
-
* a dialog nobody could dismiss, where 0.51's compiler had required `onOpenChange` (0.52
|
|
11
|
-
* code review, cancel-subscription.tsx). And the fallback between the two was written
|
|
12
|
-
* three times, once per dialog.
|
|
13
|
-
*
|
|
14
|
-
* @internal Not part of the barrel; each dialog's props type is.
|
|
15
|
-
*/
|
|
16
|
-
/** The two close props as a dialog's own props interface declares them. */
|
|
17
|
-
interface CloseProps {
|
|
18
|
-
onClose?: () => void;
|
|
19
|
-
onOpenChange?: (open: boolean) => void;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* `P` with ONE of its two close props required — `onClose`, or alone the deprecated
|
|
23
|
-
* `onOpenChange`; both may be given, and `onClose` is then the one called. Built from
|
|
24
|
-
* `P`'s own members (`Pick`), so their docs and the deprecation stay the ones `P` writes.
|
|
25
|
-
*/
|
|
26
|
-
export type WithDialogClose<P extends CloseProps> = P & (Required<Pick<P, "onClose">> | Required<Pick<P, "onOpenChange">>);
|
|
27
|
-
/** The dialog's close: `onClose`, else `onOpenChange(false)`. */
|
|
28
|
-
export declare function dialogClose({ onClose, onOpenChange }: CloseProps): () => void;
|
|
29
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/billing/dialog-close.ts"],"sourcesContent":["/**\n * How the three billing confirms — `CancelSubscriptionConfirm`, `PlanSwitchConfirm`,\n * `GrantWarningConfirm` — are closed in 0.52: `onClose`, as every other kit dialog\n * (CONTRIBUTING §4; refactor audit 2026-10-30, API-5), and for one minor the deprecated\n * `onOpenChange`, called with `false` when there is no `onClose`.\n *\n * 0.52 made `onOpenChange` optional for its deprecation and gave `onClose` beside it as\n * optional too, so a confirm given NEITHER compiled — `<CancelSubscriptionConfirm open\n * periodEnd={…} onConfirm={…} />` — and Back, Escape and the backdrop then called nothing:\n * a dialog nobody could dismiss, where 0.51's compiler had required `onOpenChange` (0.52\n * code review, cancel-subscription.tsx). And the fallback between the two was written\n * three times, once per dialog.\n *\n * @internal Not part of the barrel; each dialog's props type is.\n */\n\n/** The two close props as a dialog's own props interface declares them. */\ninterface CloseProps {\n onClose?: () => void;\n onOpenChange?: (open: boolean) => void;\n}\n\n/**\n * `P` with ONE of its two close props required — `onClose`, or alone the deprecated\n * `onOpenChange`; both may be given, and `onClose` is then the one called. Built from\n * `P`'s own members (`Pick`), so their docs and the deprecation stay the ones `P` writes.\n */\nexport type WithDialogClose<P extends CloseProps> = P &\n (Required<Pick<P, \"onClose\">> | Required<Pick<P, \"onOpenChange\">>);\n\n/** The dialog's close: `onClose`, else `onOpenChange(false)`. */\nexport function dialogClose({ onClose, onOpenChange }: CloseProps): () => void {\n return () => (onClose ? onClose() : onOpenChange?.(false));\n}\n"],"mappings":";AA+BO,SAAS,YAAY,EAAE,SAAS,aAAa,GAA2B;AAC7E,SAAO,MAAO,UAAU,QAAQ,IAAI,eAAe,KAAK;AAC1D;","names":[]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
const DEFAULT_FIELD_SYNC_LABELS = {
|
|
3
|
-
synced: "Saved",
|
|
4
|
-
edited: "Unsaved changes",
|
|
5
|
-
pending: "Saving\u2026",
|
|
6
|
-
error: "Could not save",
|
|
7
|
-
retry: "Retry"
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
DEFAULT_FIELD_SYNC_LABELS
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=field-sync-labels.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/field-sync-labels.ts"],"sourcesContent":["// The English words of ./field-sync, in a module with no component code: the English\n// catalogue (src/i18n/defaults.ts) imports them without the component, so `en` loads as one\n// chunk like the other languages (0.34, KS U8). ./field-sync re-exports them.\n\nimport type { FieldSyncLabels } from \"./field-sync\";\n\n/** @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53. */\nexport const DEFAULT_FIELD_SYNC_LABELS: FieldSyncLabels = {\n synced: \"Saved\",\n edited: \"Unsaved changes\",\n pending: \"Saving…\",\n error: \"Could not save\",\n retry: \"Retry\",\n};\n"],"mappings":";AAOO,MAAM,4BAA6C;AAAA,EACxD,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AACT;","names":[]}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import { type LabelOverride } from "../i18n/kit-labels.js";
|
|
3
|
-
import { DEFAULT_FIELD_SYNC_LABELS } from "./field-sync-labels.js";
|
|
4
|
-
/**
|
|
5
|
-
* Sync state for a field backed by a database row.
|
|
6
|
-
*
|
|
7
|
-
* The four states a value can be in between the keyboard and the server:
|
|
8
|
-
*
|
|
9
|
-
* synced the draft equals what was last persisted
|
|
10
|
-
* edited the draft differs and nothing has been sent yet
|
|
11
|
-
* pending a save is in flight
|
|
12
|
-
* error the last save was rejected; `error` carries why
|
|
13
|
-
*
|
|
14
|
-
* `useFieldSync` is the engine and holds no opinion about markup;
|
|
15
|
-
* `FieldSyncIndicator` is the affordance and holds no state. They are separate
|
|
16
|
-
* because the state is useful without the dot — a form can disable its submit
|
|
17
|
-
* button while any field is `pending`, and a router can block navigation while
|
|
18
|
-
* any field is `edited`.
|
|
19
|
-
*
|
|
20
|
-
* Deprecated in 0.52 as a whole, removed in 0.53 (decision 4 of the refactor audit
|
|
21
|
-
* 2026-10-30, MOD-5): no app renders it or calls the hook — 483 lines and a namespace in
|
|
22
|
-
* seven catalogues that only this package's tests and showcase read. An app that wants
|
|
23
|
-
* it keeps a copy of this file.
|
|
24
|
-
*
|
|
25
|
-
* @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53.
|
|
26
|
-
*/
|
|
27
|
-
export type FieldSyncState = "synced" | "edited" | "pending" | "error";
|
|
28
|
-
/** @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53. */
|
|
29
|
-
export interface FieldSyncLabels {
|
|
30
|
-
synced: string;
|
|
31
|
-
edited: string;
|
|
32
|
-
pending: string;
|
|
33
|
-
/** Shown when the failure carries no message of its own. */
|
|
34
|
-
error: string;
|
|
35
|
-
retry: string;
|
|
36
|
-
}
|
|
37
|
-
export { DEFAULT_FIELD_SYNC_LABELS };
|
|
38
|
-
/** @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53. */
|
|
39
|
-
export interface UseFieldSyncOptions<T> {
|
|
40
|
-
/** What the database currently holds. Changing it re-seeds a CLEAN field. */
|
|
41
|
-
value: T;
|
|
42
|
-
/** Persist `next`. Reject — or throw — to put the field in `error`. */
|
|
43
|
-
onSave: (next: T) => Promise<void> | void;
|
|
44
|
-
/**
|
|
45
|
-
* Quiet period before an edit saves itself, in ms. Default `0`: no auto-save at
|
|
46
|
-
* all, so `save()` is the only way to persist — called on blur by `FieldSyncRow`,
|
|
47
|
-
* and on Enter by the caller. Saving after a pause in typing wrote half-finished
|
|
48
|
-
* values to the database whenever somebody stopped to think; pass a positive
|
|
49
|
-
* number only for a field where that is genuinely wanted.
|
|
50
|
-
*/
|
|
51
|
-
debounceMs?: number;
|
|
52
|
-
/** How to tell two values apart. Defaults to `Object.is`. */
|
|
53
|
-
equals?: (a: T, b: T) => boolean;
|
|
54
|
-
/** Called once per rejected save, with whatever `onSave` threw. */
|
|
55
|
-
onError?: (error: Error) => void;
|
|
56
|
-
}
|
|
57
|
-
/** @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53. */
|
|
58
|
-
export interface UseFieldSyncReturn<T> {
|
|
59
|
-
/** The draft — bind this to the input, not the `value` option. */
|
|
60
|
-
value: T;
|
|
61
|
-
setValue: (next: T) => void;
|
|
62
|
-
state: FieldSyncState;
|
|
63
|
-
/** Non-null exactly when `state === "error"`. */
|
|
64
|
-
error: Error | null;
|
|
65
|
-
/** True whenever the draft differs from the last persisted value. */
|
|
66
|
-
dirty: boolean;
|
|
67
|
-
/** Persist now, cancelling any pending debounce. A no-op on a clean field. */
|
|
68
|
-
save: () => void;
|
|
69
|
-
/** Send the current draft again after a failure. */
|
|
70
|
-
retry: () => void;
|
|
71
|
-
/** Throw the draft away and go back to the last persisted value. */
|
|
72
|
-
reset: () => void;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Track one database-backed field: a local draft, a debounced save, and the state
|
|
76
|
-
* of the round trip.
|
|
77
|
-
*
|
|
78
|
-
* Four things this handles that a `useState` + `useEffect` in a page does not:
|
|
79
|
-
*
|
|
80
|
-
* 1. **An edit during a save is never lost.** A save in flight is not cancelled
|
|
81
|
-
* and not raced — when it settles, the draft is compared again and sent once
|
|
82
|
-
* more if it moved. Cancelling instead would drop a keystroke that arrived
|
|
83
|
-
* mid-flight; firing immediately would let two writes land out of order.
|
|
84
|
-
* 2. **The server value is only adopted when the field is clean.** An external
|
|
85
|
-
* refresh that overwrote what somebody was typing would be a data-loss bug, so
|
|
86
|
-
* a dirty draft wins and keeps winning until it is saved or reset.
|
|
87
|
-
* 3. **Nothing is set after unmount.** The save resolves into a component that
|
|
88
|
-
* may be gone — a row scrolled out of a virtualised table, a closed dialog.
|
|
89
|
-
* 4. **`onSave` is read through a ref**, so an inline arrow — which every call
|
|
90
|
-
* site will pass — does not restart the debounce on every render.
|
|
91
|
-
*
|
|
92
|
-
* @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53.
|
|
93
|
-
*/
|
|
94
|
-
export declare function useFieldSync<T>({ value, onSave, debounceMs, equals, onError, }: UseFieldSyncOptions<T>): UseFieldSyncReturn<T>;
|
|
95
|
-
/** @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53. */
|
|
96
|
-
export interface FieldSyncIndicatorProps {
|
|
97
|
-
state: FieldSyncState;
|
|
98
|
-
/** The failure. Its message becomes the tooltip when `state === "error"`. */
|
|
99
|
-
error?: Error | null;
|
|
100
|
-
/** Override any of the five English defaults. */
|
|
101
|
-
labels?: LabelOverride<FieldSyncLabels>;
|
|
102
|
-
/** Render the label beside the icon instead of only in the tooltip. Always on at
|
|
103
|
-
* Large and Extra large (0.32, docs/text-size-harmonization.md §4 "No fact only in a
|
|
104
|
-
* tooltip"): the reader who asked for bigger type gets the words, not a 14 px glyph
|
|
105
|
-
* and a bubble. */
|
|
106
|
-
showLabel?: boolean;
|
|
107
|
-
/** When given, the error state renders a retry button after the icon. */
|
|
108
|
-
onRetry?: () => void;
|
|
109
|
-
className?: string;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* The affordance for {@link useFieldSync}: a coloured icon, and the reason on hover.
|
|
113
|
-
*
|
|
114
|
-
* **Every state has its own icon, and that is not decoration.** The four colours
|
|
115
|
-
* include the green/red pair, which is the one combination this package's palette
|
|
116
|
-
* otherwise refuses (see the note in `tokens.css`) because red-green colour blindness
|
|
117
|
-
* affects roughly one man in twelve. The icon is what carries the meaning for them,
|
|
118
|
-
* and what carries it into a greyscale print or a screenshot. WCAG 1.4.1 is the same
|
|
119
|
-
* requirement stated formally.
|
|
120
|
-
*
|
|
121
|
-
* The state is also announced: the wrapper is a polite live region, so a screen
|
|
122
|
-
* reader hears "Saving…" then "Saved" without the user going looking. `error` is
|
|
123
|
-
* assertive instead — a failed write is worth interrupting for.
|
|
124
|
-
*
|
|
125
|
-
* @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53.
|
|
126
|
-
*/
|
|
127
|
-
export declare function FieldSyncIndicator({ state, error, labels, showLabel, onRetry, className, }: FieldSyncIndicatorProps): import("react").JSX.Element;
|
|
128
|
-
/**
|
|
129
|
-
* The field's own frame, coloured by state — applied from the WRAPPER to whatever
|
|
130
|
-
* native control sits inside it, so {@link FieldSyncRow} works with any of the kit's
|
|
131
|
-
* inputs (and a caller's own) without each one growing a `syncState` prop.
|
|
132
|
-
*
|
|
133
|
-
* Border AND a 1px ring, for the reason {@link FIELD_INVALID} gives: a lone 1px
|
|
134
|
-
* border loses a vertical edge to sub-pixel spread at 125% display scaling. The
|
|
135
|
-
* `:focus` twins are what keep the state visible while the reader is typing —
|
|
136
|
-
* the base field class's `focus:` brand colour is `(0,2,0)` and would otherwise win
|
|
137
|
-
* over a descendant selector exactly when the field is in use.
|
|
138
|
-
*
|
|
139
|
-
* `synced` is green, but {@link FieldSyncRow} paints it only for a moment after a
|
|
140
|
-
* save lands — a form of eight permanently green boxes says nothing the absence of
|
|
141
|
-
* colour does not.
|
|
142
|
-
*
|
|
143
|
-
* Every class is a literal so Tailwind's scanner can see it.
|
|
144
|
-
*
|
|
145
|
-
* @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53.
|
|
146
|
-
*/
|
|
147
|
-
export declare const FIELD_SYNC_FRAME: Record<FieldSyncState, string>;
|
|
148
|
-
/** How long the green "saved" frame and check stay after a save lands, in ms.
|
|
149
|
-
*
|
|
150
|
-
* @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53. */
|
|
151
|
-
export declare const FIELD_SYNC_SAVED_MS = 1500;
|
|
152
|
-
/** @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53. */
|
|
153
|
-
export interface FieldSyncRowProps<T> extends Omit<FieldSyncIndicatorProps, "state" | "error" | "showLabel"> {
|
|
154
|
-
sync: UseFieldSyncReturn<T>;
|
|
155
|
-
children: ReactNode;
|
|
156
|
-
/** Call `sync.save()` when focus leaves the field. Default true — together with the
|
|
157
|
-
* hook's default `debounceMs: 0` this is "save on blur": nothing is written while
|
|
158
|
-
* the reader is still typing, however long they pause. */
|
|
159
|
-
saveOnBlur?: boolean;
|
|
160
|
-
/** How long the saved confirmation shows. Default {@link FIELD_SYNC_SAVED_MS}. */
|
|
161
|
-
savedMs?: number;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* A field wearing its sync state — as its FRAME COLOUR and an ICON AT THE END OF THE
|
|
165
|
-
* FIELD, so the field never changes size (a helper line appearing under it moved
|
|
166
|
-
* everything below it on every save):
|
|
167
|
-
*
|
|
168
|
-
* edited amber frame, pencil — changed, not yet saved
|
|
169
|
-
* pending blue frame, spinning circle — for as long as the save is in flight
|
|
170
|
-
* synced green frame, check — for {@link FIELD_SYNC_SAVED_MS} after a
|
|
171
|
-
* save lands, then an ordinary field again
|
|
172
|
-
* error red frame, alert mark — hover or focus the mark for the reason;
|
|
173
|
-
* click it to retry
|
|
174
|
-
*
|
|
175
|
-
* It saves when focus LEAVES the field (`saveOnBlur`), not after a pause in typing: a
|
|
176
|
-
* database write in the middle of a word is a write nobody asked for. Enter in a
|
|
177
|
-
* single-line field is the caller's to wire to `sync.save`.
|
|
178
|
-
*
|
|
179
|
-
* Colour is never the only signal: every state has its own icon, and the state text is
|
|
180
|
-
* always in the DOM as a live region — polite for the ordinary states, assertive for
|
|
181
|
-
* a failure. The input gets end padding for the icon whether or not one is showing,
|
|
182
|
-
* so the text never reflows when the state changes.
|
|
183
|
-
*
|
|
184
|
-
* @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53.
|
|
185
|
-
*/
|
|
186
|
-
export declare function FieldSyncRow<T>({ sync, children, className, labels, onRetry, saveOnBlur, savedMs, }: FieldSyncRowProps<T>): import("react").JSX.Element;
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
-
import { AlertCircle, Check, Loader2, Pencil, PencilLine } from "lucide-react";
|
|
5
|
-
import { cn } from "../lib/cn.js";
|
|
6
|
-
import { Tooltip } from "./tooltip.js";
|
|
7
|
-
import { FOCUS_RING } from "./focus-ring.js";
|
|
8
|
-
import { useKitLabels } from "../i18n/kit-labels.js";
|
|
9
|
-
import { useLargeText } from "../hooks/use-large-text.js";
|
|
10
|
-
import { DEFAULT_FIELD_SYNC_LABELS } from "./field-sync-labels.js";
|
|
11
|
-
function toError(cause) {
|
|
12
|
-
if (cause instanceof Error) return cause;
|
|
13
|
-
return new Error(typeof cause === "string" ? cause : "", { cause });
|
|
14
|
-
}
|
|
15
|
-
function useFieldSync({
|
|
16
|
-
value,
|
|
17
|
-
onSave,
|
|
18
|
-
debounceMs = 0,
|
|
19
|
-
equals = Object.is,
|
|
20
|
-
onError
|
|
21
|
-
}) {
|
|
22
|
-
const [draft, setDraft] = useState(value);
|
|
23
|
-
const [state, setState] = useState("synced");
|
|
24
|
-
const [error, setError] = useState(null);
|
|
25
|
-
const savedRef = useRef(value);
|
|
26
|
-
const draftRef = useRef(value);
|
|
27
|
-
const inFlightRef = useRef(false);
|
|
28
|
-
const timerRef = useRef(null);
|
|
29
|
-
const mountedRef = useRef(true);
|
|
30
|
-
const onSaveRef = useRef(onSave);
|
|
31
|
-
const onErrorRef = useRef(onError);
|
|
32
|
-
const equalsRef = useRef(equals);
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
onSaveRef.current = onSave;
|
|
35
|
-
onErrorRef.current = onError;
|
|
36
|
-
equalsRef.current = equals;
|
|
37
|
-
});
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
mountedRef.current = true;
|
|
40
|
-
return () => {
|
|
41
|
-
mountedRef.current = false;
|
|
42
|
-
if (timerRef.current) clearTimeout(timerRef.current);
|
|
43
|
-
};
|
|
44
|
-
}, []);
|
|
45
|
-
const flush = useCallback(() => {
|
|
46
|
-
const run = async () => {
|
|
47
|
-
if (inFlightRef.current) return;
|
|
48
|
-
const next = draftRef.current;
|
|
49
|
-
if (equalsRef.current(next, savedRef.current)) return;
|
|
50
|
-
inFlightRef.current = true;
|
|
51
|
-
setState("pending");
|
|
52
|
-
setError(null);
|
|
53
|
-
try {
|
|
54
|
-
await onSaveRef.current(next);
|
|
55
|
-
savedRef.current = next;
|
|
56
|
-
inFlightRef.current = false;
|
|
57
|
-
if (!mountedRef.current) return;
|
|
58
|
-
if (equalsRef.current(draftRef.current, next)) {
|
|
59
|
-
setState("synced");
|
|
60
|
-
} else {
|
|
61
|
-
setState("edited");
|
|
62
|
-
void run();
|
|
63
|
-
}
|
|
64
|
-
} catch (cause) {
|
|
65
|
-
inFlightRef.current = false;
|
|
66
|
-
const err = toError(cause);
|
|
67
|
-
onErrorRef.current?.(err);
|
|
68
|
-
if (!mountedRef.current) return;
|
|
69
|
-
setState("error");
|
|
70
|
-
setError(err);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
return run();
|
|
74
|
-
}, []);
|
|
75
|
-
const setValue = useCallback(
|
|
76
|
-
(next) => {
|
|
77
|
-
draftRef.current = next;
|
|
78
|
-
setDraft(next);
|
|
79
|
-
if (timerRef.current) clearTimeout(timerRef.current);
|
|
80
|
-
if (equalsRef.current(next, savedRef.current)) {
|
|
81
|
-
setState(inFlightRef.current ? "pending" : "synced");
|
|
82
|
-
setError(null);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
setState("edited");
|
|
86
|
-
setError(null);
|
|
87
|
-
if (debounceMs > 0) timerRef.current = setTimeout(() => void flush(), debounceMs);
|
|
88
|
-
},
|
|
89
|
-
[debounceMs, flush]
|
|
90
|
-
);
|
|
91
|
-
const save = useCallback(() => {
|
|
92
|
-
if (timerRef.current) clearTimeout(timerRef.current);
|
|
93
|
-
void flush();
|
|
94
|
-
}, [flush]);
|
|
95
|
-
const retry = save;
|
|
96
|
-
const reset = useCallback(() => {
|
|
97
|
-
if (timerRef.current) clearTimeout(timerRef.current);
|
|
98
|
-
draftRef.current = savedRef.current;
|
|
99
|
-
setDraft(savedRef.current);
|
|
100
|
-
setState(inFlightRef.current ? "pending" : "synced");
|
|
101
|
-
setError(null);
|
|
102
|
-
}, []);
|
|
103
|
-
const dirty = state !== "synced";
|
|
104
|
-
useEffect(() => {
|
|
105
|
-
if (inFlightRef.current) return;
|
|
106
|
-
if (!equalsRef.current(draftRef.current, savedRef.current)) return;
|
|
107
|
-
if (equalsRef.current(value, savedRef.current)) return;
|
|
108
|
-
savedRef.current = value;
|
|
109
|
-
draftRef.current = value;
|
|
110
|
-
setDraft(value);
|
|
111
|
-
setState("synced");
|
|
112
|
-
setError(null);
|
|
113
|
-
}, [value]);
|
|
114
|
-
return { value: draft, setValue, state, error, dirty, save, retry, reset };
|
|
115
|
-
}
|
|
116
|
-
const STATE_STYLE = {
|
|
117
|
-
synced: { color: "var(--status-synced)", Icon: Check },
|
|
118
|
-
edited: { color: "var(--status-edited)", Icon: Pencil },
|
|
119
|
-
pending: { color: "var(--status-pending)", Icon: Loader2 },
|
|
120
|
-
error: { color: "var(--status-error)", Icon: AlertCircle }
|
|
121
|
-
};
|
|
122
|
-
function FieldSyncIndicator({
|
|
123
|
-
state,
|
|
124
|
-
error,
|
|
125
|
-
labels,
|
|
126
|
-
showLabel = false,
|
|
127
|
-
onRetry,
|
|
128
|
-
className
|
|
129
|
-
}) {
|
|
130
|
-
const l = useKitLabels("fieldSync", DEFAULT_FIELD_SYNC_LABELS, labels);
|
|
131
|
-
const large = useLargeText();
|
|
132
|
-
showLabel = showLabel || large;
|
|
133
|
-
const { color, Icon } = STATE_STYLE[state];
|
|
134
|
-
const text = state === "error" ? error?.message?.trim() ? error.message : l.error : l[state];
|
|
135
|
-
return /* @__PURE__ */ jsxs(
|
|
136
|
-
"span",
|
|
137
|
-
{
|
|
138
|
-
className: cn("inline-flex items-center gap-1.5 text-xs text-secondary", className),
|
|
139
|
-
role: state === "error" ? "alert" : "status",
|
|
140
|
-
"aria-live": state === "error" ? "assertive" : "polite",
|
|
141
|
-
children: [
|
|
142
|
-
/* @__PURE__ */ jsx(Tooltip, { label: showLabel ? void 0 : text, redact: state === "error", children: /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
143
|
-
/* @__PURE__ */ jsx(
|
|
144
|
-
Icon,
|
|
145
|
-
{
|
|
146
|
-
"aria-hidden": true,
|
|
147
|
-
style: { color },
|
|
148
|
-
className: cn("size-3.5 shrink-0", state === "pending" && "animate-spin")
|
|
149
|
-
}
|
|
150
|
-
),
|
|
151
|
-
/* @__PURE__ */ jsx("span", { className: showLabel ? void 0 : "sr-only", children: text })
|
|
152
|
-
] }) }),
|
|
153
|
-
state === "error" && onRetry && /* @__PURE__ */ jsx(
|
|
154
|
-
"button",
|
|
155
|
-
{
|
|
156
|
-
type: "button",
|
|
157
|
-
onClick: onRetry,
|
|
158
|
-
className: cn(
|
|
159
|
-
"rounded underline underline-offset-2 hover:no-underline focus-visible:ring-offset-2 focus-visible:ring-offset-surface",
|
|
160
|
-
FOCUS_RING
|
|
161
|
-
),
|
|
162
|
-
style: { color },
|
|
163
|
-
children: l.retry
|
|
164
|
-
}
|
|
165
|
-
)
|
|
166
|
-
]
|
|
167
|
-
}
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
const FIELD_SYNC_FRAME = {
|
|
171
|
-
synced: "[&_:is(input,select,textarea)]:border-[var(--status-synced)] [&_:is(input,select,textarea)]:ring-1 [&_:is(input,select,textarea)]:ring-[var(--status-synced)] [&_:is(input,select,textarea):focus]:border-[var(--status-synced)] [&_:is(input,select,textarea):focus]:ring-[var(--status-synced)]",
|
|
172
|
-
edited: "[&_:is(input,select,textarea)]:border-[var(--status-edited)] [&_:is(input,select,textarea)]:ring-1 [&_:is(input,select,textarea)]:ring-[var(--status-edited)] [&_:is(input,select,textarea):focus]:border-[var(--status-edited)] [&_:is(input,select,textarea):focus]:ring-[var(--status-edited)]",
|
|
173
|
-
pending: "[&_:is(input,select,textarea)]:border-[var(--status-pending)] [&_:is(input,select,textarea)]:ring-1 [&_:is(input,select,textarea)]:ring-[var(--status-pending)] [&_:is(input,select,textarea):focus]:border-[var(--status-pending)] [&_:is(input,select,textarea):focus]:ring-[var(--status-pending)]",
|
|
174
|
-
error: "[&_:is(input,select,textarea)]:border-[var(--status-error)] [&_:is(input,select,textarea)]:ring-1 [&_:is(input,select,textarea)]:ring-[var(--status-error)] [&_:is(input,select,textarea):focus]:border-[var(--status-error)] [&_:is(input,select,textarea):focus]:ring-[var(--status-error)]"
|
|
175
|
-
};
|
|
176
|
-
const FIELD_SYNC_SAVED_MS = 1500;
|
|
177
|
-
function FieldSyncRow({
|
|
178
|
-
sync,
|
|
179
|
-
children,
|
|
180
|
-
className,
|
|
181
|
-
labels,
|
|
182
|
-
onRetry,
|
|
183
|
-
saveOnBlur = true,
|
|
184
|
-
savedMs = FIELD_SYNC_SAVED_MS
|
|
185
|
-
}) {
|
|
186
|
-
const l = useKitLabels("fieldSync", DEFAULT_FIELD_SYNC_LABELS, labels);
|
|
187
|
-
const { state, error } = sync;
|
|
188
|
-
const isError = state === "error";
|
|
189
|
-
const text = isError ? error?.message?.trim() ? error.message : l.error : l[state];
|
|
190
|
-
const retry = onRetry ?? sync.retry;
|
|
191
|
-
const [previous, setPrevious] = useState(state);
|
|
192
|
-
const [justSaved, setJustSaved] = useState(false);
|
|
193
|
-
if (state !== previous) {
|
|
194
|
-
setPrevious(state);
|
|
195
|
-
setJustSaved(state === "synced" && previous === "pending");
|
|
196
|
-
}
|
|
197
|
-
useEffect(() => {
|
|
198
|
-
if (!justSaved) return;
|
|
199
|
-
const t = setTimeout(() => setJustSaved(false), savedMs);
|
|
200
|
-
return () => clearTimeout(t);
|
|
201
|
-
}, [justSaved, savedMs]);
|
|
202
|
-
const shown = state === "synced" ? justSaved ? "synced" : null : state;
|
|
203
|
-
return (
|
|
204
|
-
/* eslint-disable-next-line jsx-a11y/no-static-element-interactions -- not an interaction:
|
|
205
|
-
`onBlur` listens for focus leaving the row's own controls (which are the
|
|
206
|
-
interactive elements) to save; the wrapper itself is never focused. */
|
|
207
|
-
/* @__PURE__ */ jsxs(
|
|
208
|
-
"div",
|
|
209
|
-
{
|
|
210
|
-
"data-field-sync": state,
|
|
211
|
-
className: cn(
|
|
212
|
-
// `relative` for the icon and for the sr-only live region's containing block.
|
|
213
|
-
"relative [&_:is(input,select,textarea)]:pe-9",
|
|
214
|
-
shown && FIELD_SYNC_FRAME[shown],
|
|
215
|
-
className
|
|
216
|
-
),
|
|
217
|
-
onBlur: saveOnBlur ? (e) => {
|
|
218
|
-
if (!e.currentTarget.contains(e.relatedTarget)) sync.save();
|
|
219
|
-
} : void 0,
|
|
220
|
-
children: [
|
|
221
|
-
children,
|
|
222
|
-
/* @__PURE__ */ jsxs("span", { className: "pointer-events-none absolute inset-y-0 end-0 flex items-center pe-3", children: [
|
|
223
|
-
state === "edited" && /* @__PURE__ */ jsx(PencilLine, { "aria-hidden": true, className: "size-4 text-[var(--status-edited)]" }),
|
|
224
|
-
state === "pending" && /* @__PURE__ */ jsx(
|
|
225
|
-
Loader2,
|
|
226
|
-
{
|
|
227
|
-
"aria-hidden": true,
|
|
228
|
-
className: "size-4 animate-spin text-[var(--status-pending)] motion-reduce:animate-none"
|
|
229
|
-
}
|
|
230
|
-
),
|
|
231
|
-
state === "synced" && /* @__PURE__ */ jsx(
|
|
232
|
-
Check,
|
|
233
|
-
{
|
|
234
|
-
"aria-hidden": true,
|
|
235
|
-
className: cn(
|
|
236
|
-
"size-4 text-[var(--status-synced)] transition-opacity duration-500 motion-reduce:transition-none",
|
|
237
|
-
justSaved ? "opacity-100" : "opacity-0"
|
|
238
|
-
)
|
|
239
|
-
}
|
|
240
|
-
),
|
|
241
|
-
isError && /* @__PURE__ */ jsx(Tooltip, { label: text, portal: true, redact: true, children: /* @__PURE__ */ jsx(
|
|
242
|
-
"button",
|
|
243
|
-
{
|
|
244
|
-
type: "button",
|
|
245
|
-
onClick: retry,
|
|
246
|
-
"aria-label": l.retry,
|
|
247
|
-
className: cn(
|
|
248
|
-
"pointer-events-auto flex rounded-full text-[var(--status-error)] focus-visible:ring-offset-2 focus-visible:ring-offset-surface",
|
|
249
|
-
FOCUS_RING
|
|
250
|
-
),
|
|
251
|
-
children: /* @__PURE__ */ jsx(AlertCircle, { "aria-hidden": true, className: "size-4" })
|
|
252
|
-
}
|
|
253
|
-
) })
|
|
254
|
-
] }),
|
|
255
|
-
/* @__PURE__ */ jsx("span", { role: isError ? "alert" : "status", "aria-live": isError ? "assertive" : "polite", className: "sr-only", children: shown === null ? "" : text })
|
|
256
|
-
]
|
|
257
|
-
}
|
|
258
|
-
)
|
|
259
|
-
);
|
|
260
|
-
}
|
|
261
|
-
export {
|
|
262
|
-
DEFAULT_FIELD_SYNC_LABELS,
|
|
263
|
-
FIELD_SYNC_FRAME,
|
|
264
|
-
FIELD_SYNC_SAVED_MS,
|
|
265
|
-
FieldSyncIndicator,
|
|
266
|
-
FieldSyncRow,
|
|
267
|
-
useFieldSync
|
|
268
|
-
};
|
|
269
|
-
//# sourceMappingURL=field-sync.js.map
|