@eifi1/ui-kit 0.48.2 → 0.50.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 +34 -16
- package/dist/admin/admin-action-confirm.js +1 -1
- package/dist/admin/admin-action-confirm.js.map +1 -1
- package/dist/admin/invitations-panel.js +5 -1
- package/dist/admin/invitations-panel.js.map +1 -1
- package/dist/admin/user-roster.d.ts +24 -12
- package/dist/admin/user-roster.js +21 -6
- package/dist/admin/user-roster.js.map +1 -1
- package/dist/auth/accept-invitation.js +2 -2
- package/dist/auth/accept-invitation.js.map +1 -1
- package/dist/auth/not-found-page.js +1 -1
- package/dist/auth/not-found-page.js.map +1 -1
- package/dist/auth/reset-password-form.js +2 -2
- package/dist/auth/reset-password-form.js.map +1 -1
- package/dist/auth/verify-email.d.ts +9 -1
- package/dist/auth/verify-email.js +5 -3
- package/dist/auth/verify-email.js.map +1 -1
- package/dist/billing/plan-card.js +2 -2
- package/dist/billing/plan-card.js.map +1 -1
- package/dist/components/amount-input.d.ts +2 -1
- package/dist/components/amount-input.js +3 -2
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/autocomplete.js +1 -0
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/breadcrumbs.d.ts +19 -1
- package/dist/components/breadcrumbs.js +11 -4
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/button-look.d.ts +37 -7
- package/dist/components/button-look.js +33 -6
- package/dist/components/button-look.js.map +1 -1
- package/dist/components/button.d.ts +4 -1
- package/dist/components/button.js +2 -2
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar-heatmap.js +2 -1
- package/dist/components/calendar-heatmap.js.map +1 -1
- package/dist/components/chart-edge.d.ts +10 -0
- package/dist/components/chart-edge.js +57 -0
- package/dist/components/chart-edge.js.map +1 -0
- package/dist/components/chart.js +2 -1
- package/dist/components/chart.js.map +1 -1
- package/dist/components/chip.d.ts +8 -1
- package/dist/components/chip.js +4 -1
- package/dist/components/chip.js.map +1 -1
- package/dist/components/combobox-core.js +1 -0
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/combobox-suggestions.js +1 -0
- package/dist/components/combobox-suggestions.js.map +1 -1
- package/dist/components/confirm-context.d.ts +5 -0
- package/dist/components/confirm-context.js +7 -0
- package/dist/components/confirm-context.js.map +1 -0
- package/dist/components/confirm-dialog.js +3 -3
- package/dist/components/confirm-dialog.js.map +1 -1
- package/dist/components/currency-select.d.ts +28 -2
- package/dist/components/currency-select.js +56 -10
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/danger-confirm.d.ts +2 -2
- package/dist/components/danger-confirm.js +1 -1
- package/dist/components/danger-confirm.js.map +1 -1
- package/dist/components/data-table-fit.js +21 -3
- package/dist/components/data-table-fit.js.map +1 -1
- package/dist/components/data-table-mobile.d.ts +58 -3
- package/dist/components/data-table-mobile.js +147 -16
- package/dist/components/data-table-mobile.js.map +1 -1
- package/dist/components/data-table-row-actions.d.ts +2 -1
- package/dist/components/data-table-row-actions.js +7 -0
- package/dist/components/data-table-row-actions.js.map +1 -1
- package/dist/components/data-table-row.d.ts +1 -1
- package/dist/components/data-table-row.js.map +1 -1
- package/dist/components/data-table.d.ts +34 -1
- package/dist/components/data-table.js +37 -10
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/dropdown.js +1 -0
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/error-boundary.js +2 -2
- package/dist/components/error-boundary.js.map +1 -1
- package/dist/components/floating-panel.d.ts +36 -13
- package/dist/components/floating-panel.js +27 -7
- package/dist/components/floating-panel.js.map +1 -1
- package/dist/components/form-actions.d.ts +1 -1
- package/dist/components/form-actions.js +1 -1
- package/dist/components/form-actions.js.map +1 -1
- package/dist/components/full-bleed-dialog.js +1 -0
- package/dist/components/full-bleed-dialog.js.map +1 -1
- package/dist/components/icon-button.d.ts +11 -0
- package/dist/components/icon-button.js +7 -5
- package/dist/components/icon-button.js.map +1 -1
- package/dist/components/modal.js +1 -0
- package/dist/components/modal.js.map +1 -1
- package/dist/components/nav-pills.d.ts +8 -1
- package/dist/components/nav-pills.js +61 -38
- package/dist/components/nav-pills.js.map +1 -1
- package/dist/components/number-input.d.ts +2 -1
- package/dist/components/number-input.js +6 -2
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numpad-sheet.js +2 -0
- package/dist/components/numpad-sheet.js.map +1 -1
- package/dist/components/page-header-context.d.ts +8 -0
- package/dist/components/page-header-context.js +7 -0
- package/dist/components/page-header-context.js.map +1 -0
- package/dist/components/page-header.d.ts +14 -2
- package/dist/components/page-header.js +10 -1
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/picker-sheet.js +2 -0
- package/dist/components/picker-sheet.js.map +1 -1
- package/dist/components/pie-chart.js +2 -1
- package/dist/components/pie-chart.js.map +1 -1
- package/dist/components/popover.js +1 -0
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress-bar.js +5 -4
- package/dist/components/progress-bar.js.map +1 -1
- package/dist/components/reauth-dialog.js +1 -1
- package/dist/components/reauth-dialog.js.map +1 -1
- package/dist/components/row-actions-labels.js +3 -1
- package/dist/components/row-actions-labels.js.map +1 -1
- package/dist/components/row-actions.d.ts +43 -9
- package/dist/components/row-actions.js +78 -15
- package/dist/components/row-actions.js.map +1 -1
- package/dist/components/section-nav.d.ts +37 -0
- package/dist/components/section-nav.js +33 -0
- package/dist/components/section-nav.js.map +1 -0
- package/dist/components/series-chart.js +8 -3
- package/dist/components/series-chart.js.map +1 -1
- package/dist/components/share-card.js +1 -1
- package/dist/components/share-card.js.map +1 -1
- package/dist/components/signature-pad.js +1 -1
- package/dist/components/signature-pad.js.map +1 -1
- package/dist/components/sparkline.js +2 -1
- package/dist/components/sparkline.js.map +1 -1
- package/dist/components/stat-tile.js +14 -7
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/components/status-dot.d.ts +5 -1
- package/dist/components/status-dot.js +4 -1
- package/dist/components/status-dot.js.map +1 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/translation-review-editor.js +2 -2
- package/dist/components/translation-review-editor.js.map +1 -1
- package/dist/components/translation-review.js +2 -2
- package/dist/components/translation-review.js.map +1 -1
- package/dist/components/treemap.d.ts +5 -2
- package/dist/components/treemap.js +26 -6
- package/dist/components/treemap.js.map +1 -1
- package/dist/components/use-table-state.js +37 -6
- package/dist/components/use-table-state.js.map +1 -1
- package/dist/data-table.js.map +1 -1
- package/dist/demo/demo-banner.js +1 -1
- package/dist/demo/demo-banner.js.map +1 -1
- package/dist/demo/demo-ended.js +1 -1
- package/dist/demo/demo-ended.js.map +1 -1
- package/dist/demo/demo-start.js +1 -1
- package/dist/demo/demo-start.js.map +1 -1
- package/dist/eslint/index.js +1 -1
- package/dist/feedback/feedback-inbox.js +1 -1
- package/dist/feedback/feedback-inbox.js.map +1 -1
- package/dist/hooks/use-dismiss.d.ts +9 -1
- package/dist/hooks/use-dismiss.js +25 -5
- package/dist/hooks/use-dismiss.js.map +1 -1
- package/dist/hooks/use-document-title.d.ts +14 -0
- package/dist/hooks/use-document-title.js +22 -0
- package/dist/hooks/use-document-title.js.map +1 -0
- package/dist/i18n/defaults.js +2 -0
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.js +20 -3
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +34 -1
- package/dist/i18n/kit-labels.js +43 -2
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/locales/en.js +22 -3
- package/dist/i18n/locales/en.js.map +3 -3
- package/dist/i18n/locales/es.js +20 -3
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.js +20 -3
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.js +20 -3
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.js +20 -3
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.js +20 -3
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.js +3 -0
- package/dist/i18n/review.js.map +1 -1
- package/dist/i18n/shared-labels.js +1 -0
- package/dist/i18n/shared-labels.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/landing/landing-actions.js +2 -2
- package/dist/landing/landing-actions.js.map +1 -1
- package/dist/landing/public-header.js +2 -2
- package/dist/landing/public-header.js.map +1 -1
- package/dist/lib/clipboard-minus.d.ts +27 -0
- package/dist/lib/clipboard-minus.js +63 -0
- package/dist/lib/clipboard-minus.js.map +1 -0
- package/dist/lib/data-attributes.d.ts +11 -0
- package/dist/lib/data-attributes.js +10 -0
- package/dist/lib/data-attributes.js.map +1 -0
- package/dist/lib/document-title.d.ts +17 -0
- package/dist/lib/document-title.js +29 -0
- package/dist/lib/document-title.js.map +1 -0
- package/dist/lib/float-clearance.js +8 -2
- package/dist/lib/float-clearance.js.map +1 -1
- package/dist/lib/format.d.ts +36 -10
- package/dist/lib/format.js +57 -11
- package/dist/lib/format.js.map +1 -1
- package/dist/lib/minus.d.ts +32 -0
- package/dist/lib/minus.js +14 -0
- package/dist/lib/minus.js.map +1 -0
- package/dist/lib/status-tone.d.ts +30 -0
- package/dist/lib/status-tone.js +17 -0
- package/dist/lib/status-tone.js.map +1 -0
- package/dist/settings/settings-layout.js +3 -2
- package/dist/settings/settings-layout.js.map +1 -1
- package/dist/shell/account-menu-language.d.ts +1 -1
- package/dist/shell/account-menu-language.js +9 -1
- package/dist/shell/account-menu-language.js.map +1 -1
- package/dist/shell/app-shell-labels.js +2 -1
- package/dist/shell/app-shell-labels.js.map +1 -1
- package/dist/shell/app-shell.d.ts +58 -16
- package/dist/shell/app-shell.js +151 -43
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/language-code.d.ts +3 -0
- package/dist/shell/language-code.js +8 -0
- package/dist/shell/language-code.js.map +1 -0
- package/dist/shell/topbar-controls.d.ts +14 -6
- package/dist/shell/topbar-controls.js +14 -17
- package/dist/shell/topbar-controls.js.map +1 -1
- package/dist/testing/css-variables.generated.d.ts +1 -1
- package/dist/testing/css-variables.generated.js +1 -1
- package/dist/testing/css-variables.generated.js.map +1 -1
- package/dist/testing/react.d.ts +25 -0
- package/dist/testing/react.js +19 -0
- package/dist/testing/react.js.map +1 -0
- package/dist/theme/chart-palette.d.ts +82 -15
- package/dist/theme/chart-palette.js +51 -24
- package/dist/theme/chart-palette.js.map +1 -1
- package/dist/theme/palette-presets.d.ts +9 -0
- package/dist/theme/palette-presets.js +77 -62
- package/dist/theme/palette-presets.js.map +1 -1
- package/dist/tour/tour-dock.d.ts +42 -0
- package/dist/tour/tour-dock.js +80 -0
- package/dist/tour/tour-dock.js.map +1 -0
- package/dist/tour/tour-gates.d.ts +71 -0
- package/dist/tour/tour-gates.js +114 -0
- package/dist/tour/tour-gates.js.map +1 -0
- package/dist/tour/tour-guide-button.d.ts +27 -0
- package/dist/tour/tour-guide-button.js +45 -0
- package/dist/tour/tour-guide-button.js.map +1 -0
- package/dist/tour/tour-guide-labels.d.ts +8 -0
- package/dist/tour/tour-guide-labels.js +9 -0
- package/dist/tour/tour-guide-labels.js.map +1 -0
- package/dist/tour/tour-labels.js +9 -1
- package/dist/tour/tour-labels.js.map +1 -1
- package/dist/tour/tour.d.ts +133 -9
- package/dist/tour/tour.js +594 -70
- package/dist/tour/tour.js.map +1 -1
- package/dist/tour/use-tour-url-sync.d.ts +5 -2
- package/dist/tour/use-tour-url-sync.js +7 -1
- package/dist/tour/use-tour-url-sync.js.map +1 -1
- package/dist/tour.d.ts +2 -0
- package/dist/tour.js +3 -0
- package/dist/tour.js.map +1 -1
- package/dist/wizard/stepper-nav.d.ts +1 -1
- package/dist/wizard/stepper-nav.js +18 -5
- package/dist/wizard/stepper-nav.js.map +1 -1
- package/dist/wizard/types.d.ts +11 -0
- package/dist/wizard/types.js.map +1 -1
- package/dist/wizard/use-wizard.js +11 -5
- package/dist/wizard/use-wizard.js.map +1 -1
- package/package.json +9 -1
- package/src/admin/admin-action-confirm.tsx +1 -1
- package/src/admin/invitations-panel.tsx +7 -3
- package/src/admin/user-roster.tsx +41 -14
- package/src/auth/accept-invitation.tsx +3 -3
- package/src/auth/not-found-page.tsx +1 -1
- package/src/auth/reset-password-form.tsx +3 -3
- package/src/auth/verify-email.tsx +13 -3
- package/src/billing/plan-card.tsx +2 -2
- package/src/components/amount-input.tsx +5 -4
- package/src/components/autocomplete.tsx +2 -0
- package/src/components/breadcrumbs.tsx +32 -4
- package/src/components/button-look.ts +86 -15
- package/src/components/button.tsx +6 -3
- package/src/components/calendar-heatmap.tsx +2 -1
- package/src/components/chart-edge.ts +73 -0
- package/src/components/chart.tsx +3 -1
- package/src/components/chip.tsx +10 -1
- package/src/components/combobox-core.tsx +2 -0
- package/src/components/combobox-suggestions.tsx +2 -0
- package/src/components/confirm-context.ts +7 -0
- package/src/components/confirm-dialog.tsx +3 -3
- package/src/components/currency-select.tsx +95 -6
- package/src/components/danger-confirm.tsx +3 -3
- package/src/components/data-table-fit.ts +41 -6
- package/src/components/data-table-mobile.tsx +259 -17
- package/src/components/data-table-row-actions.tsx +9 -1
- package/src/components/data-table-row.tsx +3 -0
- package/src/components/data-table.tsx +91 -19
- package/src/components/dropdown.tsx +2 -0
- package/src/components/error-boundary.tsx +2 -2
- package/src/components/floating-panel.tsx +67 -16
- package/src/components/form-actions.tsx +2 -2
- package/src/components/full-bleed-dialog.tsx +3 -0
- package/src/components/icon-button.tsx +21 -8
- package/src/components/modal.tsx +3 -0
- package/src/components/nav-pills.tsx +29 -2
- package/src/components/number-input.tsx +8 -3
- package/src/components/numpad-sheet.tsx +4 -0
- package/src/components/page-header-context.ts +8 -0
- package/src/components/page-header.tsx +34 -2
- package/src/components/picker-sheet.tsx +4 -0
- package/src/components/pie-chart.tsx +2 -1
- package/src/components/popover.tsx +2 -0
- package/src/components/progress-bar.tsx +6 -3
- package/src/components/reauth-dialog.tsx +1 -1
- package/src/components/row-actions-labels.ts +2 -0
- package/src/components/row-actions.tsx +154 -33
- package/src/components/section-nav.tsx +65 -0
- package/src/components/series-chart.tsx +12 -3
- package/src/components/share-card.tsx +1 -1
- package/src/components/signature-pad.tsx +1 -1
- package/src/components/sparkline.tsx +2 -1
- package/src/components/stat-tile.tsx +19 -7
- package/src/components/status-dot.tsx +7 -1
- package/src/components/tooltip.tsx +3 -1
- package/src/components/translation-review-editor.tsx +2 -2
- package/src/components/translation-review.tsx +2 -2
- package/src/components/treemap.tsx +34 -8
- package/src/components/use-table-state.ts +63 -8
- package/src/data-table.ts +3 -3
- package/src/demo/demo-banner.tsx +1 -1
- package/src/demo/demo-ended.tsx +1 -1
- package/src/demo/demo-start.tsx +1 -1
- package/src/feedback/feedback-inbox.tsx +1 -1
- package/src/hooks/use-dismiss.ts +43 -4
- package/src/hooks/use-document-title.ts +31 -0
- package/src/i18n/defaults.ts +2 -0
- package/src/i18n/german.ts +17 -0
- package/src/i18n/kit-labels.tsx +79 -1
- package/src/i18n/locales/es.ts +17 -0
- package/src/i18n/locales/fr.ts +17 -0
- package/src/i18n/locales/hu.ts +17 -0
- package/src/i18n/locales/it.ts +17 -0
- package/src/i18n/locales/zh.ts +17 -0
- package/src/i18n/review.ts +3 -0
- package/src/i18n/shared-labels.ts +1 -0
- package/src/index.ts +13 -0
- package/src/landing/landing-actions.tsx +2 -2
- package/src/landing/public-header.tsx +2 -2
- package/src/lib/clipboard-minus.ts +94 -0
- package/src/lib/data-attributes.ts +14 -0
- package/src/lib/document-title.ts +41 -0
- package/src/lib/float-clearance.ts +19 -3
- package/src/lib/format.ts +117 -30
- package/src/lib/minus.ts +50 -0
- package/src/lib/status-tone.ts +43 -0
- package/src/settings/settings-layout.tsx +3 -2
- package/src/shell/account-menu-language.tsx +14 -2
- package/src/shell/app-shell-labels.ts +1 -0
- package/src/shell/app-shell.tsx +291 -68
- package/src/shell/language-code.ts +5 -0
- package/src/shell/topbar-controls.tsx +35 -15
- package/src/testing/css-variables.generated.ts +6 -6
- package/src/testing/react.ts +59 -0
- package/src/theme/chart-palette.ts +102 -20
- package/src/theme/palette-presets.ts +121 -84
- package/src/tour/tour-dock.ts +132 -0
- package/src/tour/tour-gates.ts +195 -0
- package/src/tour/tour-guide-button.tsx +64 -0
- package/src/tour/tour-guide-labels.ts +15 -0
- package/src/tour/tour-labels.ts +8 -0
- package/src/tour/tour.tsx +949 -86
- package/src/tour/use-tour-url-sync.ts +14 -4
- package/src/tour.ts +3 -0
- package/src/wizard/stepper-nav.tsx +27 -7
- package/src/wizard/types.ts +12 -0
- package/src/wizard/use-wizard.ts +16 -9
- package/tokens.css +28 -18
|
@@ -2,7 +2,8 @@ import { createContext, useContext, useEffect, useLayoutEffect, useRef, useState
|
|
|
2
2
|
import * as ReactRouter from "react-router";
|
|
3
3
|
import { useLocation, useNavigate, type Navigator } from "react-router";
|
|
4
4
|
import { useSearchParamsState } from "../hooks/use-search-param-state";
|
|
5
|
-
import { useTourOptional } from "./tour";
|
|
5
|
+
import { useTourOptional, type TourStart } from "./tour";
|
|
6
|
+
import { devWarnings } from "./tour-gates";
|
|
6
7
|
|
|
7
8
|
/* ── useTourUrlSync ─────────────────────────────────────────────────────────── */
|
|
8
9
|
|
|
@@ -11,9 +12,11 @@ export interface UseTourUrlSyncOptions {
|
|
|
11
12
|
* Start the tour `id` at `startIndex` (0-based) — the app's launcher, which builds the
|
|
12
13
|
* steps, awaits its own `prepare()` and passes `onFinish` (the completion, the points
|
|
13
14
|
* toast) to `useTour().start`. An unknown id should do nothing. May return a promise:
|
|
14
|
-
* the parameters are kept until it settles.
|
|
15
|
+
* the parameters are kept until it settles. Under a `TourProvider` the third argument is
|
|
16
|
+
* that provider's `start` (0.50, as `TourProvider launch` gets it), so one launcher serves
|
|
17
|
+
* both. Without a provider it is a `start` that does nothing (a development build warns).
|
|
15
18
|
*/
|
|
16
|
-
launch: (id: string, options: { startIndex: number }) => void | Promise<unknown>;
|
|
19
|
+
launch: (id: string, options: { startIndex: number }, start: TourStart) => void | Promise<unknown>;
|
|
17
20
|
/**
|
|
18
21
|
* Are the facts a tour's steps are built from loaded yet (keksdose's `ready`: the
|
|
19
22
|
* caches a branching tour reads)? A deep link waits for it, keeping its parameters, so
|
|
@@ -120,9 +123,11 @@ export function useTourUrlSync({ launch, ready = true, stepAliases = [] }: UseTo
|
|
|
120
123
|
const aliases = stepAliases.join("\n");
|
|
121
124
|
|
|
122
125
|
const launchRef = useRef(launch);
|
|
126
|
+
const startRef = useRef<TourStart>(engine?.start ?? noProviderStart);
|
|
123
127
|
const activeIdRef = useRef(activeId);
|
|
124
128
|
useLayoutEffect(() => {
|
|
125
129
|
launchRef.current = launch;
|
|
130
|
+
startRef.current = engine?.start ?? noProviderStart;
|
|
126
131
|
activeIdRef.current = active ? activeId : null;
|
|
127
132
|
});
|
|
128
133
|
/** The `tour` value last seen in the URL: a tour starts when it CHANGES to an id. */
|
|
@@ -148,7 +153,7 @@ export function useTourUrlSync({ launch, ready = true, stepAliases = [] }: UseTo
|
|
|
148
153
|
pendingRef.current = null;
|
|
149
154
|
launchingRef.current = true;
|
|
150
155
|
void Promise.resolve()
|
|
151
|
-
.then(() => launchRef.current(pending.id, { startIndex: pending.startIndex }))
|
|
156
|
+
.then(() => launchRef.current(pending.id, { startIndex: pending.startIndex }, startRef.current))
|
|
152
157
|
.catch(() => undefined)
|
|
153
158
|
.finally(() => {
|
|
154
159
|
launchingRef.current = false;
|
|
@@ -183,6 +188,11 @@ export function useTourUrlSync({ launch, ready = true, stepAliases = [] }: UseTo
|
|
|
183
188
|
}, [active, activeId, index, pathname, search, hash, settled, aliases]);
|
|
184
189
|
}
|
|
185
190
|
|
|
191
|
+
/** `start` for a launcher run with no `TourProvider` above `useTourUrlSync`. */
|
|
192
|
+
const noProviderStart: TourStart = () => {
|
|
193
|
+
if (devWarnings()) console.warn("[ui-kit] useTourUrlSync: the launcher's start needs a TourProvider above it.");
|
|
194
|
+
};
|
|
195
|
+
|
|
186
196
|
/* ── useTourCatalogueUrlState ───────────────────────────────────────────────── */
|
|
187
197
|
|
|
188
198
|
/** The catalogue's state filter. */
|
package/src/tour.ts
CHANGED
|
@@ -16,3 +16,6 @@ export { signOutTourProgress } from "./tour/use-tour-progress";
|
|
|
16
16
|
export type { TourProgressAccount, TourProgressAdopt, TourProgressBody } from "./tour/use-tour-progress";
|
|
17
17
|
export { useTourUrlSync, useTourCatalogueUrlState } from "./tour/use-tour-url-sync";
|
|
18
18
|
export type { UseTourUrlSyncOptions, TourCatalogueFilter, TourStateFilter } from "./tour/use-tour-url-sync";
|
|
19
|
+
// 0.50.0: guided form tours (docs/tours-harmonization.md §11) — "Guide me" inside a form.
|
|
20
|
+
export { TourGuideButton, DEFAULT_TOUR_GUIDE_LABELS } from "./tour/tour-guide-button";
|
|
21
|
+
export type { TourGuideButtonProps, TourGuideLabels } from "./tour/tour-guide-button";
|
|
@@ -10,8 +10,9 @@ import { alertFrameClass } from "../components/alert-banner";
|
|
|
10
10
|
import { WizardContextProvider } from "./wizard-context";
|
|
11
11
|
import { DEFAULT_WIZARD_LABELS } from "./types";
|
|
12
12
|
import { useKitLabels, type LabelOverride } from "../i18n/kit-labels";
|
|
13
|
-
import type { UseWizardReturn, WizardLabels } from "./types";
|
|
13
|
+
import type { UseWizardReturn, WizardFinishResult, WizardLabels } from "./types";
|
|
14
14
|
import type { CommitScope } from "../components/write-lock";
|
|
15
|
+
import { useTourGateRelease } from "../tour/tour-gates";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* The chrome around a wizard: the step indicator, the step content, and the
|
|
@@ -42,7 +43,7 @@ export function StepperNav<TData extends Record<string, unknown>>({
|
|
|
42
43
|
description,
|
|
43
44
|
className,
|
|
44
45
|
labels,
|
|
45
|
-
finishVariant = "
|
|
46
|
+
finishVariant = "accent",
|
|
46
47
|
finishDisabled = false,
|
|
47
48
|
finishCommit,
|
|
48
49
|
finishDisabledReason,
|
|
@@ -56,7 +57,7 @@ export function StepperNav<TData extends Record<string, unknown>>({
|
|
|
56
57
|
className?: string;
|
|
57
58
|
labels?: LabelOverride<WizardLabels>;
|
|
58
59
|
/** The Finish button's variant — `"danger"` for a destructive commit (an import
|
|
59
|
-
* that replaces what is there). Default `"
|
|
60
|
+
* that replaces what is there). Default `"accent"`. Next keeps `"accent"`. */
|
|
60
61
|
finishVariant?: ButtonVariant;
|
|
61
62
|
/** Disable Finish for a reason of the app's own, on top of the kit's gates
|
|
62
63
|
* (`canFinish`, submitting, validating). */
|
|
@@ -152,6 +153,25 @@ export function StepperNav<TData extends Record<string, unknown>>({
|
|
|
152
153
|
// (empty data after a reload) from firing an empty submit.
|
|
153
154
|
const canFinish = wizard.canFinish;
|
|
154
155
|
|
|
156
|
+
// A running tour's `awaitGate` steps (0.50, docs/tours-harmonization.md §11.9): Next
|
|
157
|
+
// releases "wizard-next" when the wizard moved and refuses it when a validator kept it
|
|
158
|
+
// in place; Finish releases "wizard-finish" once `onComplete` resolved and refuses it,
|
|
159
|
+
// with the error's message, when it threw. No-ops without a TourProvider or a tour.
|
|
160
|
+
const tourGates = useTourGateRelease();
|
|
161
|
+
// `useWizard`'s goNext/finish resolve their outcome at run time (see their types); a
|
|
162
|
+
// wizard object built some other way resolves nothing, and nothing is signalled.
|
|
163
|
+
const goNext = async () => {
|
|
164
|
+
const moved = (await wizard.goNext()) as unknown as boolean | undefined;
|
|
165
|
+
if (moved === true) tourGates.release("wizard-next");
|
|
166
|
+
else if (moved === false) tourGates.refuse("wizard-next");
|
|
167
|
+
};
|
|
168
|
+
const finish = async () => {
|
|
169
|
+
const result = (await wizard.finish()) as unknown as WizardFinishResult | undefined;
|
|
170
|
+
if (!result) return;
|
|
171
|
+
if (result.ok) tourGates.release("wizard-finish");
|
|
172
|
+
else tourGates.refuse("wizard-finish", result.error);
|
|
173
|
+
};
|
|
174
|
+
|
|
155
175
|
// Pending while the step's validators run (an async server check): a spinner and
|
|
156
176
|
// `aria-busy`, and disabled — the hook's own re-entry guard still refuses a second
|
|
157
177
|
// press, this just stops it looking like the first one did nothing.
|
|
@@ -165,7 +185,7 @@ export function StepperNav<TData extends Record<string, unknown>>({
|
|
|
165
185
|
<Button
|
|
166
186
|
variant={finishVariant}
|
|
167
187
|
data-tour="wizard-finish"
|
|
168
|
-
onClick={
|
|
188
|
+
onClick={() => void finish()}
|
|
169
189
|
// The kit Button's lock: a reason (its own or, with `commit`, the provider's)
|
|
170
190
|
// wins over `disabled` and keeps the button reachable, saying why.
|
|
171
191
|
commit={finishCommit}
|
|
@@ -183,16 +203,16 @@ export function StepperNav<TData extends Record<string, unknown>>({
|
|
|
183
203
|
// The last step after a commit. Nothing to finish; Done only when the app gave
|
|
184
204
|
// an `onDone` — otherwise the step carries its own way out.
|
|
185
205
|
forwardButton = wizard.canDone ? (
|
|
186
|
-
<Button variant="
|
|
206
|
+
<Button variant="accent" data-tour="wizard-done" onClick={wizard.done} disabled={doneDisabled}>
|
|
187
207
|
{stepNextLabel ?? l.done ?? DEFAULT_WIZARD_LABELS.done}
|
|
188
208
|
</Button>
|
|
189
209
|
) : null;
|
|
190
210
|
} else {
|
|
191
211
|
forwardButton = (
|
|
192
212
|
<Button
|
|
193
|
-
variant="
|
|
213
|
+
variant="accent"
|
|
194
214
|
data-tour="wizard-next"
|
|
195
|
-
onClick={
|
|
215
|
+
onClick={() => void goNext()}
|
|
196
216
|
disabled={wizard.nextBlocked || pending}
|
|
197
217
|
aria-busy={pending || undefined}
|
|
198
218
|
>
|
package/src/wizard/types.ts
CHANGED
|
@@ -119,6 +119,13 @@ export interface UseWizardOptions<TData extends Record<string, unknown>> {
|
|
|
119
119
|
|
|
120
120
|
export type StepStatus = "upcoming" | "active" | "completed" | "skipped";
|
|
121
121
|
|
|
122
|
+
|
|
123
|
+
/** What `finish` resolves to at run time (0.50): whether the commit went through, and the
|
|
124
|
+
* error's message when `onComplete` threw. `undefined` when there was nothing to run. */
|
|
125
|
+
export interface WizardFinishResult {
|
|
126
|
+
ok: boolean;
|
|
127
|
+
error?: string;
|
|
128
|
+
}
|
|
122
129
|
export interface UseWizardReturn<TData extends Record<string, unknown>> {
|
|
123
130
|
// Navigation
|
|
124
131
|
currentStepIndex: number;
|
|
@@ -146,12 +153,17 @@ export interface UseWizardReturn<TData extends Record<string, unknown>> {
|
|
|
146
153
|
/** Whether the indicator may jump to `index` — a completed/skipped/active step on
|
|
147
154
|
* the right side of any commit. `goToStep` refuses anything this rejects. */
|
|
148
155
|
canGoToStep: (index: number) => boolean;
|
|
156
|
+
/** Validates the step and moves on. (0.50: at run time it resolves `true` when it
|
|
157
|
+
* moved, `false` when a validator kept it in place — what StepperNav tells a running
|
|
158
|
+
* tour, docs/tours-harmonization.md §11.9. The declared type stays `Promise<void>`.) */
|
|
149
159
|
goNext: () => Promise<void>;
|
|
150
160
|
/** One step back — or, on the first step, `onExit`. Refused while submitting. */
|
|
151
161
|
goBack: () => void;
|
|
152
162
|
goToStep: (index: number) => void;
|
|
153
163
|
skip: () => void;
|
|
154
164
|
cancel: () => void;
|
|
165
|
+
/** Validates and commits (`onComplete`). (0.50: at run time it resolves `{ ok, error? }`
|
|
166
|
+
* — see {@link WizardFinishResult}; the declared type stays `Promise<void>`.) */
|
|
155
167
|
finish: () => Promise<void>;
|
|
156
168
|
/** Leave after the post-commit steps: drops the URL param, then calls `onDone`. */
|
|
157
169
|
done: () => void;
|
package/src/wizard/use-wizard.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { useKitLabels } from "../i18n/kit-labels";
|
|
|
20
20
|
import { DEFAULT_WIZARD_LABELS } from "./types";
|
|
21
21
|
import { toast } from "../components/toast";
|
|
22
22
|
import type {
|
|
23
|
+
WizardFinishResult,
|
|
23
24
|
FieldErrors,
|
|
24
25
|
StepStatus,
|
|
25
26
|
UseWizardOptions,
|
|
@@ -341,8 +342,8 @@ export function useWizard<TData extends Record<string, unknown>>(
|
|
|
341
342
|
*/
|
|
342
343
|
const advancingRef = useRef(false);
|
|
343
344
|
|
|
344
|
-
const goNext = useCallback(async () => {
|
|
345
|
-
if (advancingRef.current) return;
|
|
345
|
+
const goNext = useCallback(async (): Promise<boolean | undefined> => {
|
|
346
|
+
if (advancingRef.current) return undefined;
|
|
346
347
|
advancingRef.current = true;
|
|
347
348
|
const from = state.currentStepIndex;
|
|
348
349
|
// Pending state for the chrome (spinner, aria-busy). The ref above is still what
|
|
@@ -351,7 +352,9 @@ export function useWizard<TData extends Record<string, unknown>>(
|
|
|
351
352
|
try {
|
|
352
353
|
if (await runStepValidators()) {
|
|
353
354
|
dispatch({ type: "GO_NEXT", from });
|
|
355
|
+
return true;
|
|
354
356
|
}
|
|
357
|
+
return false;
|
|
355
358
|
} finally {
|
|
356
359
|
dispatch({ type: "SET_VALIDATING", value: false });
|
|
357
360
|
advancingRef.current = false;
|
|
@@ -431,16 +434,16 @@ export function useWizard<TData extends Record<string, unknown>>(
|
|
|
431
434
|
dispatch({ type: "SET_FIELD_ERRORS", errors: {} });
|
|
432
435
|
}, []);
|
|
433
436
|
|
|
434
|
-
const finish = useCallback(async () => {
|
|
435
|
-
if (!onComplete || !canFinish) return;
|
|
437
|
+
const finish = useCallback(async (): Promise<WizardFinishResult | undefined> => {
|
|
438
|
+
if (!onComplete || !canFinish) return undefined;
|
|
436
439
|
// A commit with steps after it happens once: those steps exist because the
|
|
437
440
|
// data has been written. (A last-step commit keeps its old behaviour — the app
|
|
438
441
|
// may retry Finish after `onComplete` resolved, as it always could.)
|
|
439
|
-
if (commitStepIndex < steps.length - 1 && state.committedStepIndex !== null) return;
|
|
442
|
+
if (commitStepIndex < steps.length - 1 && state.committedStepIndex !== null) return undefined;
|
|
440
443
|
// The same re-entry guard as `goNext`: a double-click on Finish would otherwise
|
|
441
444
|
// validate twice and call `onComplete` twice — `isSubmitting` is only set once
|
|
442
445
|
// validation has passed, too late to stop the second click.
|
|
443
|
-
if (advancingRef.current) return;
|
|
446
|
+
if (advancingRef.current) return undefined;
|
|
444
447
|
advancingRef.current = true;
|
|
445
448
|
const from = state.currentStepIndex;
|
|
446
449
|
try {
|
|
@@ -454,16 +457,18 @@ export function useWizard<TData extends Record<string, unknown>>(
|
|
|
454
457
|
} finally {
|
|
455
458
|
dispatch({ type: "SET_VALIDATING", value: false });
|
|
456
459
|
}
|
|
457
|
-
if (!valid) return;
|
|
460
|
+
if (!valid) return { ok: false };
|
|
458
461
|
submittingRef.current = true;
|
|
459
462
|
dispatch({ type: "SET_SUBMITTING", value: true });
|
|
460
463
|
dispatch({ type: "SET_ERROR", error: null });
|
|
461
464
|
try {
|
|
462
465
|
await onComplete(state.data);
|
|
463
466
|
dispatch({ type: "COMMITTED", from });
|
|
467
|
+
return { ok: true };
|
|
464
468
|
} catch (err) {
|
|
465
469
|
const message = err instanceof Error && err.message ? err.message : genericError;
|
|
466
470
|
dispatch({ type: "SET_ERROR", error: message });
|
|
471
|
+
return { ok: false, error: err instanceof Error && err.message ? err.message : undefined };
|
|
467
472
|
} finally {
|
|
468
473
|
submittingRef.current = false;
|
|
469
474
|
dispatch({ type: "SET_SUBMITTING", value: false });
|
|
@@ -507,12 +512,14 @@ export function useWizard<TData extends Record<string, unknown>>(
|
|
|
507
512
|
canCancel,
|
|
508
513
|
canDone,
|
|
509
514
|
canGoToStep,
|
|
510
|
-
|
|
515
|
+
// Their outcomes are what StepperNav tells a running tour (0.50); the declared types stay
|
|
516
|
+
// `Promise<void>`, so an app's `let p: Promise<void> = wizard.goNext()` still compiles.
|
|
517
|
+
goNext: goNext as () => Promise<void>,
|
|
511
518
|
goBack,
|
|
512
519
|
goToStep,
|
|
513
520
|
skip,
|
|
514
521
|
cancel,
|
|
515
|
-
finish
|
|
522
|
+
finish: finish as () => Promise<void>,
|
|
516
523
|
done,
|
|
517
524
|
registerStepValidate,
|
|
518
525
|
nextBlocked,
|
package/tokens.css
CHANGED
|
@@ -264,15 +264,23 @@ html[data-text-size="xlarge"] {
|
|
|
264
264
|
--status-pending: #1d4ed8; /* blue-700 — in flight */
|
|
265
265
|
--status-edited: #bf6800; /* solved — dirty, not yet saved */
|
|
266
266
|
--status-error: #b91c1c; /* red-700 — the save failed */
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
--chart-
|
|
274
|
-
--chart-
|
|
275
|
-
--chart-
|
|
267
|
+
/* Chart ramp: anyplot's eight "Imprint" hues (0.49, https://anyplot.ai/palette), the
|
|
268
|
+
SAME in both themes — a hue under 3:1 on the ground gets a 1px ink edge
|
|
269
|
+
(`chartEdge`) rather than a different colour. `--chart-9` repeats slot 1, where
|
|
270
|
+
`paletteFor(8)` lands. Only the two inks below change with the theme:
|
|
271
|
+
`--chart-ink` for totals, baselines and edges; `--chart-muted` for an "other" /
|
|
272
|
+
rest / disabled slice and confidence bands (`CHART_ROLES`). */
|
|
273
|
+
--chart-1: #009e73;
|
|
274
|
+
--chart-2: #c475fd;
|
|
275
|
+
--chart-3: #4467a3;
|
|
276
|
+
--chart-4: #bd8233;
|
|
277
|
+
--chart-5: #ae3030;
|
|
278
|
+
--chart-6: #2abccd;
|
|
279
|
+
--chart-7: #954477;
|
|
280
|
+
--chart-8: #99b314;
|
|
281
|
+
--chart-9: #009e73;
|
|
282
|
+
--chart-ink: #1a1a17;
|
|
283
|
+
--chart-muted: #6b6a63;
|
|
276
284
|
}
|
|
277
285
|
|
|
278
286
|
.dark {
|
|
@@ -306,15 +314,17 @@ html[data-text-size="xlarge"] {
|
|
|
306
314
|
--status-pending: #7dd3fc; /* sky-300 */
|
|
307
315
|
--status-edited: #fbbf24; /* amber-400 */
|
|
308
316
|
--status-error: #fca5a5; /* red-300 */
|
|
309
|
-
--chart-1: #
|
|
310
|
-
--chart-2: #
|
|
311
|
-
--chart-3: #
|
|
312
|
-
--chart-4: #
|
|
313
|
-
--chart-5: #
|
|
314
|
-
--chart-6: #
|
|
315
|
-
--chart-7: #
|
|
316
|
-
--chart-8: #
|
|
317
|
-
--chart-9: #
|
|
317
|
+
--chart-1: #009e73;
|
|
318
|
+
--chart-2: #c475fd;
|
|
319
|
+
--chart-3: #4467a3;
|
|
320
|
+
--chart-4: #bd8233;
|
|
321
|
+
--chart-5: #ae3030;
|
|
322
|
+
--chart-6: #2abccd;
|
|
323
|
+
--chart-7: #954477;
|
|
324
|
+
--chart-8: #99b314;
|
|
325
|
+
--chart-9: #009e73;
|
|
326
|
+
--chart-ink: #f0efe8;
|
|
327
|
+
--chart-muted: #a8a79f;
|
|
318
328
|
}
|
|
319
329
|
|
|
320
330
|
/* ── Derived surface / text roles ───────────────────────────────────────────
|