@delmaredigital/payload-experiments 0.4.0-rc.1 → 0.4.0-rc.11
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 +284 -772
- package/dist/admin/LayerUsage.js +1 -1
- package/dist/admin/MetricSourceSelect.js +12 -5
- package/dist/admin/PlacementStatus.js +1 -1
- package/dist/admin/TestsDashboardCards.d.ts +1 -0
- package/dist/admin/TestsDashboardCards.js +5 -9
- package/dist/admin/TestsNavLink.d.ts +1 -0
- package/dist/admin/TestsNavLink.js +5 -11
- package/dist/admin/blocks/BlockPanel.d.ts +1 -0
- package/dist/admin/blocks/BlockPanel.js +129 -37
- package/dist/admin/blocks/TestBlockField.js +3 -3
- package/dist/admin/blocks/formApi.d.ts +3 -0
- package/dist/admin/blocks/formApi.js +10 -4
- package/dist/admin/blocks/inject.js +1 -0
- package/dist/admin/blocks/model.d.ts +3 -2
- package/dist/admin/blocks/model.js +10 -6
- package/dist/admin/blocks/statusCache.d.ts +2 -0
- package/dist/admin/blocks/statusCache.js +12 -3
- package/dist/admin/components/RootViewMessage.js +1 -1
- package/dist/admin/copy/blocks.d.ts +21 -1
- package/dist/admin/copy/blocks.js +40 -6
- package/dist/admin/copy/goals.d.ts +21 -9
- package/dist/admin/copy/goals.js +28 -11
- package/dist/admin/copy/newTest.d.ts +7 -7
- package/dist/admin/copy/newTest.js +10 -7
- package/dist/admin/goals/XpGoalField.d.ts +2 -0
- package/dist/admin/goals/XpGoalField.js +156 -114
- package/dist/admin/goals/xpGoalField.css +47 -0
- package/dist/admin/pageCollections.d.ts +1 -0
- package/dist/admin/pageCollections.js +3 -0
- package/dist/admin/paths.d.ts +3 -0
- package/dist/admin/paths.js +3 -0
- package/dist/admin/placementStatus.model.js +1 -1
- package/dist/admin/status.model.js +1 -1
- package/dist/admin/surface/ResultsRoute.d.ts +2 -1
- package/dist/admin/surface/ResultsRoute.js +20 -24
- package/dist/admin/surface/SurfaceShell.d.ts +4 -2
- package/dist/admin/surface/SurfaceShell.js +29 -4
- package/dist/admin/surface/TestRowMenu.d.ts +13 -0
- package/dist/admin/surface/TestRowMenu.js +163 -0
- package/dist/admin/surface/TestsHome.d.ts +5 -3
- package/dist/admin/surface/TestsHome.js +273 -58
- package/dist/admin/surface/TestsSurface.js +8 -7
- package/dist/admin/surface/goals/DeleteGoalDialog.d.ts +7 -0
- package/dist/admin/surface/goals/DeleteGoalDialog.js +42 -0
- package/dist/admin/surface/goals/GoalForm.d.ts +2 -1
- package/dist/admin/surface/goals/GoalForm.js +342 -212
- package/dist/admin/surface/goals/GoalsList.d.ts +1 -1
- package/dist/admin/surface/goals/GoalsList.js +107 -37
- package/dist/admin/surface/goals/data.d.ts +2 -0
- package/dist/admin/surface/goals/data.js +11 -2
- package/dist/admin/surface/goals/goals.css +9 -1
- package/dist/admin/surface/goals/goals.model.d.ts +12 -2
- package/dist/admin/surface/goals/goals.model.js +39 -1
- package/dist/admin/surface/home.model.d.ts +10 -8
- package/dist/admin/surface/home.model.js +27 -22
- package/dist/admin/surface/newTest/NewTest.d.ts +4 -4
- package/dist/admin/surface/newTest/NewTest.js +149 -118
- package/dist/admin/surface/newTest/PageWizard.d.ts +5 -2
- package/dist/admin/surface/newTest/PageWizard.js +115 -80
- package/dist/admin/surface/newTest/newTest.css +28 -9
- package/dist/admin/surface/results/ResultsHeader.d.ts +3 -3
- package/dist/admin/surface/results/ResultsHeader.js +115 -83
- package/dist/admin/surface/surface.css +29 -0
- package/dist/admin/surface/test/TestPage.d.ts +1 -2
- package/dist/admin/surface/test/TestPage.js +44 -152
- package/dist/admin/surface/useXpStepNav.d.ts +11 -0
- package/dist/admin/surface/useXpStepNav.js +14 -0
- package/dist/admin/theme.css +2 -0
- package/dist/admin/views/CollectionListRedirect.d.ts +1 -0
- package/dist/admin/views/CollectionListRedirect.js +1 -1
- package/dist/admin/views/ExperimentsRootView.js +18 -165
- package/dist/admin/views/GoalEditRedirect.d.ts +4 -0
- package/dist/admin/views/GoalEditRedirect.js +14 -0
- package/dist/admin/views/GoalsCollectionListView.d.ts +2 -0
- package/dist/admin/views/GoalsCollectionListView.js +4 -0
- package/dist/admin/views/TestsCollectionListView.d.ts +2 -0
- package/dist/admin/views/TestsCollectionListView.js +4 -0
- package/dist/admin/views/TestsNavLinkServer.d.ts +1 -0
- package/dist/admin/views/TestsNavLinkServer.js +2 -2
- package/dist/admin/views/TestsSurfaceClient.d.ts +3 -0
- package/dist/admin/views/TestsSurfaceClient.js +35 -0
- package/dist/admin/views/buildSurfaceProps.d.ts +8 -0
- package/dist/admin/views/buildSurfaceProps.js +102 -0
- package/dist/admin/views/renderCollectionList.d.ts +2 -0
- package/dist/admin/views/renderCollectionList.js +34 -0
- package/dist/admin/views/renderTestsSurface.d.ts +3 -0
- package/dist/admin/views/renderTestsSurface.js +34 -0
- package/dist/blocks/bindings.js +8 -14
- package/dist/blocks/createExperimentBlock.js +1 -1
- package/dist/blocks/formState.js +2 -2
- package/dist/blocks/placementLanguages.d.ts +7 -0
- package/dist/blocks/placementLanguages.js +27 -0
- package/dist/blocks/placementLocale.d.ts +37 -0
- package/dist/blocks/placementLocale.js +270 -0
- package/dist/collections/experiments/config.js +17 -8
- package/dist/collections/experiments/deleteGuard.js +2 -2
- package/dist/collections/experiments/lockHook.js +21 -2
- package/dist/collections/experiments/pickSlug.js +2 -0
- package/dist/collections/metrics.js +28 -9
- package/dist/collections/metricsGuards.js +2 -0
- package/dist/collections/serialize.js +8 -6
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/db/adapter.d.ts +9 -1
- package/dist/db/adapter.js +77 -1
- package/dist/db/appends.d.ts +13 -0
- package/dist/db/appends.js +49 -0
- package/dist/db/bulkPlacementRemoval.d.ts +30 -0
- package/dist/db/bulkPlacementRemoval.js +111 -0
- package/dist/db/delete.d.ts +1 -1
- package/dist/db/delete.js +2 -4
- package/dist/db/events.d.ts +9 -0
- package/dist/db/events.js +42 -8
- package/dist/db/executor.d.ts +7 -1
- package/dist/db/executor.js +7 -3
- package/dist/db/pageCopies.d.ts +5 -0
- package/dist/db/pageCopies.js +31 -0
- package/dist/db/placements.d.ts +2 -0
- package/dist/db/placements.js +8 -0
- package/dist/db/results.d.ts +5 -1
- package/dist/db/results.js +21 -5
- package/dist/db/snapshots.d.ts +2 -0
- package/dist/endpoints/contentLocale.d.ts +6 -0
- package/dist/endpoints/contentLocale.js +15 -0
- package/dist/endpoints/deleteImpact.d.ts +6 -0
- package/dist/endpoints/deleteImpact.js +207 -0
- package/dist/endpoints/duplicateOriginal.d.ts +38 -0
- package/dist/endpoints/duplicateOriginal.js +407 -0
- package/dist/endpoints/editorSurface.d.ts +3 -0
- package/dist/endpoints/editorSurface.js +31 -0
- package/dist/endpoints/events.js +103 -39
- package/dist/endpoints/index.js +57 -9
- package/dist/endpoints/pages.js +247 -64
- package/dist/endpoints/placementStatus.js +13 -5
- package/dist/endpoints/preflight.d.ts +1 -1
- package/dist/endpoints/preflight.js +17 -2
- package/dist/endpoints/results.d.ts +1 -1
- package/dist/endpoints/results.js +6 -2
- package/dist/endpoints/routeId.d.ts +2 -2
- package/dist/endpoints/routeId.js +11 -5
- package/dist/endpoints/summary.js +46 -12
- package/dist/endpoints/testVersion.d.ts +2 -0
- package/dist/endpoints/testVersion.js +38 -0
- package/dist/endpoints/transitions.js +41 -29
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +8 -0
- package/dist/events/request.d.ts +6 -2
- package/dist/events/request.js +35 -8
- package/dist/events/rows.d.ts +1 -1
- package/dist/events/rows.js +24 -8
- package/dist/events/writable.d.ts +9 -0
- package/dist/events/writable.js +13 -0
- package/dist/exports/adminClient.d.ts +1 -1
- package/dist/exports/adminClient.js +1 -1
- package/dist/exports/adminRsc.d.ts +3 -0
- package/dist/exports/adminRsc.js +3 -0
- package/dist/exports/index.d.ts +1 -1
- package/dist/exports/rsc.d.ts +1 -0
- package/dist/exports/rsc.js +1 -0
- package/dist/fields/xpGoal.js +3 -15
- package/dist/goals/fairness.d.ts +1 -1
- package/dist/goals/fairness.js +44 -35
- package/dist/goals/picker/clickGoalPicker.model.d.ts +8 -1
- package/dist/goals/picker/clickGoalPicker.model.js +20 -2
- package/dist/goals/picker/copy.d.ts +6 -2
- package/dist/goals/picker/copy.js +11 -2
- package/dist/goals/picker/useClickGoalPicker.d.ts +1 -1
- package/dist/goals/picker/useClickGoalPicker.js +4 -2
- package/dist/goals/sourceLabel.d.ts +2 -0
- package/dist/goals/sourceLabel.js +4 -0
- package/dist/goals/validate.d.ts +3 -0
- package/dist/goals/validate.js +15 -0
- package/dist/hooks/blockRemovalRule.d.ts +30 -0
- package/dist/hooks/blockRemovalRule.js +165 -0
- package/dist/hooks/hostHook.js +6 -2
- package/dist/hooks/pageGuard.d.ts +27 -2
- package/dist/hooks/pageGuard.js +213 -45
- package/dist/hooks/puckGoals.d.ts +5 -0
- package/dist/hooks/puckGoals.js +62 -0
- package/dist/hooks/puckNestedTests.d.ts +8 -0
- package/dist/hooks/puckNestedTests.js +36 -0
- package/dist/hooks/trackPageCopies.d.ts +11 -0
- package/dist/hooks/trackPageCopies.js +7 -0
- package/dist/lib/fetchAllDocs.d.ts +1 -1
- package/dist/lib/placementPages.d.ts +10 -0
- package/dist/{admin/previewLinks.model.js → lib/placementPages.js} +10 -5
- package/dist/manifest/compile.d.ts +2 -1
- package/dist/manifest/compile.js +13 -6
- package/dist/onInit.js +36 -0
- package/dist/options.d.ts +2 -0
- package/dist/options.js +23 -2
- package/dist/plugin.js +70 -21
- package/dist/proxy/pageNavigation.d.ts +4 -0
- package/dist/proxy/pageNavigation.js +28 -0
- package/dist/proxy/resolve.js +52 -25
- package/dist/puck/ExperimentPicker.d.ts +2 -1
- package/dist/puck/ExperimentPicker.js +62 -40
- package/dist/puck/ExperimentSlot.js +3 -1
- package/dist/puck/copy.d.ts +5 -1
- package/dist/puck/copy.js +5 -1
- package/dist/puck/editor/ConfigureTestDrawer.d.ts +25 -0
- package/dist/puck/editor/ConfigureTestDrawer.js +150 -0
- package/dist/puck/editor/CreateExperimentDrawer.d.ts +12 -2
- package/dist/puck/editor/CreateExperimentDrawer.js +89 -21
- package/dist/puck/editor/EditorControls.d.ts +14 -0
- package/dist/puck/editor/EditorControls.js +99 -0
- package/dist/puck/editor/ExperimentSlotEditor.d.ts +2 -1
- package/dist/puck/editor/ExperimentSlotEditor.js +1007 -182
- package/dist/puck/editor/LeftoverVersions.d.ts +15 -0
- package/dist/puck/editor/LeftoverVersions.js +79 -0
- package/dist/puck/editor/PlacementNotice.d.ts +8 -0
- package/dist/puck/editor/PlacementNotice.js +22 -0
- package/dist/puck/editor/QuickTestActions.d.ts +6 -0
- package/dist/puck/editor/QuickTestActions.js +72 -0
- package/dist/puck/editor/ResultsReadout.d.ts +4 -1
- package/dist/puck/editor/ResultsReadout.js +35 -19
- package/dist/puck/editor/VersionBuilder.d.ts +67 -12
- package/dist/puck/editor/VersionBuilder.js +560 -231
- package/dist/puck/editor/armWrites.d.ts +11 -2
- package/dist/puck/editor/armWrites.js +43 -4
- package/dist/puck/editor/armsCache.d.ts +3 -1
- package/dist/puck/editor/armsCache.js +20 -4
- package/dist/puck/editor/blockClipboard.d.ts +16 -0
- package/dist/puck/editor/blockClipboard.js +20 -0
- package/dist/puck/editor/cloneSlot.d.ts +2 -0
- package/dist/puck/editor/cloneSlot.js +7 -0
- package/dist/puck/editor/copy.d.ts +65 -20
- package/dist/puck/editor/copy.js +73 -21
- package/dist/puck/editor/createTest.d.ts +3 -0
- package/dist/puck/editor/createTest.js +33 -0
- package/dist/puck/editor/editor.chrome.css +200 -20
- package/dist/puck/editor/editor.css +338 -25
- package/dist/puck/editor/editor.model.d.ts +17 -1
- package/dist/puck/editor/editor.model.js +61 -4
- package/dist/puck/editor/editorSurface.d.ts +10 -0
- package/dist/puck/editor/editorSurface.js +65 -0
- package/dist/puck/editor/experimentOutlinePlugin.js +96 -28
- package/dist/puck/editor/localPlacements.d.ts +5 -0
- package/dist/puck/editor/localPlacements.js +43 -0
- package/dist/puck/editor/outlineVersion.d.ts +5 -0
- package/dist/puck/editor/outlineVersion.js +36 -0
- package/dist/puck/editor/placementsCache.d.ts +60 -0
- package/dist/puck/editor/placementsCache.js +263 -0
- package/dist/puck/editor/sidebar.d.ts +8 -0
- package/dist/puck/editor/sidebar.js +74 -0
- package/dist/puck/editor/usePageSaveReadiness.d.ts +6 -0
- package/dist/puck/editor/usePageSaveReadiness.js +31 -0
- package/dist/puck/editor/usePlacementNotice.d.ts +3 -0
- package/dist/puck/editor/usePlacementNotice.js +15 -0
- package/dist/puck/editor/xpGoalPuckEditorField.js +105 -86
- package/dist/puck/experimentSlotField.d.ts +3 -0
- package/dist/puck/experimentSlotField.js +15 -4
- package/dist/puck/experimentSlug.d.ts +2 -0
- package/dist/puck/experimentSlug.js +3 -0
- package/dist/puck/nestedTestCopy.d.ts +8 -0
- package/dist/puck/nestedTestCopy.js +22 -0
- package/dist/puck/nestedTests.d.ts +17 -0
- package/dist/puck/nestedTests.js +30 -0
- package/dist/puck/slotConfig.d.ts +2 -2
- package/dist/puck/slotConfig.js +18 -5
- package/dist/puck/visibility.d.ts +20 -0
- package/dist/puck/visibility.js +81 -0
- package/dist/results/aggregate.d.ts +6 -3
- package/dist/results/aggregate.js +9 -9
- package/dist/results/analyse.d.ts +2 -0
- package/dist/results/analyse.js +2 -2
- package/dist/results/health.d.ts +8 -0
- package/dist/results/health.js +28 -0
- package/dist/results/identityCredit.d.ts +1 -0
- package/dist/results/identityCredit.js +4 -1
- package/dist/results/verdict.d.ts +1 -1
- package/dist/results/verdict.js +9 -7
- package/dist/runtime/cookie.d.ts +10 -2
- package/dist/runtime/cookie.js +38 -6
- package/dist/runtime/cookieOptions.d.ts +6 -0
- package/dist/runtime/cookieOptions.js +14 -0
- package/dist/runtime/proxyRuntime.d.ts +1 -0
- package/dist/runtime/proxyRuntime.js +18 -8
- package/dist/runtime/signing.d.ts +1 -0
- package/dist/runtime/signing.js +5 -0
- package/dist/sanitizeReadinessDetail.d.ts +2 -2
- package/dist/sanitizeReadinessDetail.js +22 -2
- package/dist/server/getAssignments.js +11 -10
- package/dist/server/recordContentChange.d.ts +1 -1
- package/dist/server/recordContentChange.js +48 -22
- package/dist/server/resolveExperimentBlocks.js +2 -4
- package/dist/server/resolveExperimentData.js +8 -8
- package/dist/server/runResults.js +54 -15
- package/dist/server/startExperiment.d.ts +20 -0
- package/dist/server/startExperiment.js +70 -0
- package/dist/server/trackConversion.js +10 -13
- package/dist/{admin → testSurface}/PreviewLinks.d.ts +2 -1
- package/dist/{admin → testSurface}/PreviewLinks.js +9 -5
- package/dist/testSurface/actions/DecideDialog.d.ts +17 -0
- package/dist/testSurface/actions/DecideDialog.js +222 -0
- package/dist/testSurface/actions/LifecycleAction.d.ts +17 -0
- package/dist/testSurface/actions/LifecycleAction.js +107 -0
- package/dist/{admin → testSurface}/actions/MakeContentResult.d.ts +4 -3
- package/dist/{admin → testSurface}/actions/MakeContentResult.js +10 -2
- package/dist/{admin → testSurface}/actions/actions.model.d.ts +13 -5
- package/dist/testSurface/actions/actions.model.js +123 -0
- package/dist/{admin → testSurface}/actions/decide.model.d.ts +1 -0
- package/dist/{admin → testSurface}/actions/decide.model.js +1 -0
- package/dist/{admin → testSurface}/allocation.model.js +6 -3
- package/dist/{admin → testSurface}/api.d.ts +20 -7
- package/dist/{admin → testSurface}/api.js +72 -22
- package/dist/testSurface/contentLocaleURL.d.ts +2 -0
- package/dist/testSurface/contentLocaleURL.js +3 -0
- package/dist/{admin → testSurface}/copy/actions.d.ts +37 -14
- package/dist/{admin → testSurface}/copy/actions.js +40 -17
- package/dist/{admin → testSurface}/copy/advanced.d.ts +10 -0
- package/dist/{admin → testSurface}/copy/advanced.js +10 -0
- package/dist/{admin → testSurface}/copy/arms.d.ts +1 -1
- package/dist/{admin → testSurface}/copy/arms.js +1 -1
- package/dist/{admin → testSurface}/copy/audience.d.ts +4 -3
- package/dist/{admin → testSurface}/copy/audience.js +5 -4
- package/dist/{admin → testSurface}/copy/common.d.ts +15 -6
- package/dist/{admin → testSurface}/copy/common.js +20 -10
- package/dist/testSurface/copy/languages.d.ts +12 -0
- package/dist/testSurface/copy/languages.js +8 -0
- package/dist/{admin → testSurface}/copy/metrics.d.ts +7 -0
- package/dist/testSurface/copy/metrics.js +18 -0
- package/dist/testSurface/copy/pages.d.ts +84 -0
- package/dist/testSurface/copy/pages.js +90 -0
- package/dist/{admin → testSurface}/copy/readiness.d.ts +40 -6
- package/dist/{admin → testSurface}/copy/readiness.js +54 -9
- package/dist/{admin → testSurface}/copy/recommendation.d.ts +4 -4
- package/dist/{admin → testSurface}/copy/recommendation.js +4 -4
- package/dist/{admin → testSurface}/copy/results.d.ts +19 -12
- package/dist/{admin → testSurface}/copy/results.js +21 -12
- package/dist/testSurface/copy/review.d.ts +20 -0
- package/dist/testSurface/copy/review.js +21 -0
- package/dist/{admin → testSurface}/copy/setting.d.ts +1 -2
- package/dist/{admin → testSurface}/copy/setting.js +1 -2
- package/dist/{admin → testSurface}/copy/surface.d.ts +11 -2
- package/dist/{admin → testSurface}/copy/surface.js +14 -11
- package/dist/{admin → testSurface}/copy/testPage.d.ts +61 -12
- package/dist/testSurface/copy/testPage.js +168 -0
- package/dist/testSurface/format/adminURL.d.ts +7 -0
- package/dist/testSurface/format/adminURL.js +9 -0
- package/dist/{admin → testSurface}/format/date.d.ts +1 -0
- package/dist/testSurface/format/date.js +21 -0
- package/dist/{admin → testSurface}/labels.d.ts +1 -2
- package/dist/{admin → testSurface}/labels.js +2 -3
- package/dist/{admin → testSurface}/lockedNotice.model.d.ts +2 -0
- package/dist/{admin → testSurface}/lockedNotice.model.js +31 -0
- package/dist/testSurface/placementLabel.d.ts +8 -0
- package/dist/testSurface/placementLabel.js +24 -0
- package/dist/{admin → testSurface}/placements/placementLabels.d.ts +2 -0
- package/dist/{admin → testSurface}/placements/placementLabels.js +3 -2
- package/dist/{admin → testSurface}/previewLinks.model.d.ts +1 -6
- package/dist/testSurface/previewLinks.model.js +4 -0
- package/dist/testSurface/readPreflight.d.ts +13 -0
- package/dist/testSurface/readPreflight.js +44 -0
- package/dist/testSurface/readinessRead.d.ts +53 -0
- package/dist/testSurface/readinessRead.js +50 -0
- package/dist/{admin → testSurface}/results/VerdictHero.d.ts +2 -1
- package/dist/{admin → testSurface}/results/VerdictHero.js +5 -1
- package/dist/testSurface/results/results.css +64 -0
- package/dist/{admin → testSurface}/results/results.model.d.ts +3 -2
- package/dist/{admin → testSurface}/results/results.model.js +16 -11
- package/dist/{admin → testSurface}/surface/contracts.d.ts +17 -3
- package/dist/testSurface/surface/editorPlacement.d.ts +26 -0
- package/dist/testSurface/surface/editorPlacement.js +78 -0
- package/dist/testSurface/surface/pageBlock/pageBlock.model.js +9 -0
- package/dist/testSurface/surface/pageBlock/parts.js +107 -0
- package/dist/testSurface/surface/pagePicker/CopyRoute.d.ts +13 -0
- package/dist/testSurface/surface/pagePicker/CopyRoute.js +273 -0
- package/dist/testSurface/surface/pagePicker/PageCombobox.d.ts +21 -0
- package/dist/testSurface/surface/pagePicker/PageCombobox.js +498 -0
- package/dist/testSurface/surface/pagePicker/pagePicker.css +73 -0
- package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.d.ts +7 -3
- package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.js +17 -2
- package/dist/{admin → testSurface}/surface/readiness/ActionDialogs.d.ts +9 -5
- package/dist/testSurface/surface/readiness/ActionDialogs.js +372 -0
- package/dist/{admin → testSurface}/surface/readiness/Banner.d.ts +4 -3
- package/dist/testSurface/surface/readiness/Banner.js +198 -0
- package/dist/testSurface/surface/readiness/BlockerList.d.ts +11 -0
- package/dist/testSurface/surface/readiness/BlockerList.js +31 -0
- package/dist/testSurface/surface/readiness/SaveStatus.d.ts +13 -0
- package/dist/testSurface/surface/readiness/SaveStatus.js +67 -0
- package/dist/{admin → testSurface}/surface/readiness/parts.js +0 -2
- package/dist/{admin → testSurface}/surface/readiness/readiness.model.d.ts +28 -2
- package/dist/testSurface/surface/readiness/readiness.model.js +377 -0
- package/dist/testSurface/surface/readiness/useTransition.d.ts +16 -0
- package/dist/testSurface/surface/readiness/useTransition.js +141 -0
- package/dist/{admin → testSurface}/surface/results/ReleasePages.d.ts +6 -3
- package/dist/{admin → testSurface}/surface/results/ReleasePages.js +40 -40
- package/dist/{admin → testSurface}/surface/results/ResultsBody.d.ts +11 -4
- package/dist/{admin → testSurface}/surface/results/ResultsBody.js +207 -104
- package/dist/{admin → testSurface}/surface/results/recommendation.model.js +3 -3
- package/dist/{admin → testSurface}/surface/results/useResults.d.ts +26 -8
- package/dist/{admin → testSurface}/surface/results/useResults.js +3 -2
- package/dist/{admin → testSurface}/surface/setting/parts.js +89 -46
- package/dist/testSurface/surface/setting/setting.css +18 -0
- package/dist/{admin → testSurface}/surface/test/AdvancedSection.js +12 -4
- package/dist/testSurface/surface/test/DeleteTest.d.ts +23 -0
- package/dist/testSurface/surface/test/DeleteTest.js +270 -0
- package/dist/testSurface/surface/test/GoalSection.d.ts +4 -0
- package/dist/{admin → testSurface}/surface/test/GoalSection.js +119 -89
- package/dist/testSurface/surface/test/LengthSection.d.ts +2 -0
- package/dist/{admin → testSurface}/surface/test/LengthSection.js +25 -14
- package/dist/{admin → testSurface}/surface/test/PageHoldout.d.ts +1 -1
- package/dist/{admin → testSurface}/surface/test/PageHoldout.js +11 -8
- package/dist/{admin → testSurface}/surface/test/Rail.js +7 -4
- package/dist/{admin → testSurface}/surface/test/ReadinessBar.d.ts +2 -1
- package/dist/{admin → testSurface}/surface/test/ReadinessBar.js +4 -11
- package/dist/{admin → testSurface}/surface/test/Section.d.ts +3 -1
- package/dist/testSurface/surface/test/Section.js +88 -0
- package/dist/{admin → testSurface}/surface/test/TargetingSection.js +87 -12
- package/dist/testSurface/surface/test/TestSurface.d.ts +19 -0
- package/dist/testSurface/surface/test/TestSurface.js +265 -0
- package/dist/testSurface/surface/test/VersionsSection.d.ts +5 -0
- package/dist/testSurface/surface/test/VersionsSection.js +301 -0
- package/dist/{admin → testSurface}/surface/test/fields.d.ts +33 -9
- package/dist/testSurface/surface/test/fields.js +300 -0
- package/dist/{admin → testSurface}/surface/test/pageParts.js +30 -44
- package/dist/testSurface/surface/test/testPage.css +111 -0
- package/dist/{admin → testSurface}/surface/test/testPage.model.d.ts +1 -0
- package/dist/{admin → testSurface}/surface/test/testPage.model.js +6 -0
- package/dist/{admin → testSurface}/surface/testDocument.model.d.ts +3 -0
- package/dist/{admin → testSurface}/surface/testDocument.model.js +4 -1
- package/dist/testSurface/surface/useTestDocument.d.ts +60 -0
- package/dist/testSurface/surface/useTestDocument.js +782 -0
- package/dist/testSurface/surface/watchTestDocument.d.ts +15 -0
- package/dist/testSurface/surface/watchTestDocument.js +181 -0
- package/dist/testSurface/surfaceUrls.d.ts +8 -0
- package/dist/testSurface/surfaceUrls.js +23 -0
- package/dist/{admin → testSurface}/useApi.d.ts +21 -5
- package/dist/testSurface/useOnTestReturn.d.ts +2 -0
- package/dist/testSurface/useOnTestReturn.js +27 -0
- package/dist/testSurface/useReadinessPolling.d.ts +3 -0
- package/dist/testSurface/useReadinessPolling.js +26 -0
- package/dist/transitions/addMetric.d.ts +2 -5
- package/dist/transitions/addMetric.js +5 -1
- package/dist/transitions/allocate.d.ts +2 -2
- package/dist/transitions/allocate.js +3 -1
- package/dist/transitions/archive.d.ts +1 -1
- package/dist/transitions/archive.js +3 -2
- package/dist/transitions/checkStart.d.ts +6 -1
- package/dist/transitions/checkStart.js +133 -17
- package/dist/transitions/contentFields.js +9 -5
- package/dist/transitions/decide.d.ts +1 -1
- package/dist/transitions/decide.js +6 -3
- package/dist/transitions/deleteExperiment.d.ts +2 -2
- package/dist/transitions/deleteExperiment.js +17 -7
- package/dist/transitions/kernel.d.ts +4 -0
- package/dist/transitions/kernel.js +9 -4
- package/dist/transitions/makeContent.d.ts +2 -1
- package/dist/transitions/makeContent.js +41 -17
- package/dist/transitions/nestedPlacementNames.d.ts +5 -0
- package/dist/transitions/nestedPlacementNames.js +32 -0
- package/dist/transitions/pageAddress.d.ts +6 -0
- package/dist/transitions/pageAddress.js +71 -0
- package/dist/transitions/pageVersions.js +3 -1
- package/dist/transitions/phaseRecord.d.ts +2 -0
- package/dist/transitions/phaseRecord.js +5 -0
- package/dist/transitions/placementInteractions.d.ts +3 -3
- package/dist/transitions/placementInteractions.js +16 -12
- package/dist/transitions/placements.d.ts +54 -8
- package/dist/transitions/placements.js +304 -81
- package/dist/transitions/preflightData.d.ts +5 -3
- package/dist/transitions/preflightData.js +137 -40
- package/dist/transitions/releaseHoldout.d.ts +2 -1
- package/dist/transitions/releaseHoldout.js +3 -1
- package/dist/transitions/releasePages.d.ts +2 -1
- package/dist/transitions/releasePages.js +3 -1
- package/dist/transitions/resolveCaps.d.ts +2 -4
- package/dist/transitions/start.d.ts +6 -8
- package/dist/transitions/start.js +72 -35
- package/dist/transitions/startReads.d.ts +7 -0
- package/dist/transitions/startReads.js +28 -0
- package/dist/transitions/stop.d.ts +2 -1
- package/dist/transitions/stop.js +3 -2
- package/dist/types/contracts.d.ts +15 -3
- package/dist/types/endpoints.d.ts +121 -17
- package/dist/types/puck.d.ts +1 -0
- package/dist/types/runtime.d.ts +15 -9
- package/dist/types/snapshot.d.ts +2 -0
- package/dist/types/surface.d.ts +9 -9
- package/dist/ui/Button.js +2 -2
- package/dist/ui/Card.d.ts +2 -1
- package/dist/ui/Card.js +4 -4
- package/dist/ui/ChipsInput.d.ts +8 -1
- package/dist/ui/ChipsInput.js +17 -4
- package/dist/ui/Dialog.d.ts +24 -2
- package/dist/ui/Dialog.js +141 -6
- package/dist/ui/Drawer.d.ts +10 -0
- package/dist/ui/Drawer.js +29 -0
- package/dist/ui/Inputs.d.ts +4 -3
- package/dist/ui/Inputs.js +6 -4
- package/dist/ui/SelectControl.d.ts +33 -0
- package/dist/ui/SelectControl.js +504 -0
- package/dist/ui/Tabs.d.ts +4 -4
- package/dist/ui/Tabs.js +35 -32
- package/dist/ui/ui.css +50 -5
- package/package.json +3 -2
- package/dist/admin/actions/ConfirmDialog.d.ts +0 -19
- package/dist/admin/actions/ConfirmDialog.js +0 -149
- package/dist/admin/actions/DecideDialog.d.ts +0 -10
- package/dist/admin/actions/DecideDialog.js +0 -190
- package/dist/admin/actions/actions.model.js +0 -70
- package/dist/admin/copy/metrics.js +0 -9
- package/dist/admin/copy/pages.d.ts +0 -26
- package/dist/admin/copy/pages.js +0 -26
- package/dist/admin/copy/review.d.ts +0 -17
- package/dist/admin/copy/review.js +0 -17
- package/dist/admin/copy/testPage.js +0 -104
- package/dist/admin/format/date.js +0 -10
- package/dist/admin/results/results.css +0 -64
- package/dist/admin/styles.css +0 -10
- package/dist/admin/styles.d.ts +0 -2
- package/dist/admin/styles.js +0 -3
- package/dist/admin/surface/pageBlock/pageBlock.model.js +0 -8
- package/dist/admin/surface/pageBlock/parts.js +0 -69
- package/dist/admin/surface/pagePicker/CopyRoute.d.ts +0 -6
- package/dist/admin/surface/pagePicker/CopyRoute.js +0 -53
- package/dist/admin/surface/pagePicker/PagePicker.d.ts +0 -10
- package/dist/admin/surface/pagePicker/PagePicker.js +0 -172
- package/dist/admin/surface/readiness/ActionDialogs.js +0 -337
- package/dist/admin/surface/readiness/Banner.js +0 -190
- package/dist/admin/surface/readiness/SaveStatus.d.ts +0 -5
- package/dist/admin/surface/readiness/SaveStatus.js +0 -53
- package/dist/admin/surface/readiness/readiness.model.js +0 -205
- package/dist/admin/surface/readiness/useTransition.d.ts +0 -11
- package/dist/admin/surface/readiness/useTransition.js +0 -35
- package/dist/admin/surface/setting/setting.css +0 -17
- package/dist/admin/surface/test/GoalSection.d.ts +0 -2
- package/dist/admin/surface/test/LengthSection.d.ts +0 -2
- package/dist/admin/surface/test/Section.js +0 -47
- package/dist/admin/surface/test/VersionsSection.d.ts +0 -4
- package/dist/admin/surface/test/VersionsSection.js +0 -247
- package/dist/admin/surface/test/fields.js +0 -216
- package/dist/admin/surface/test/testPage.css +0 -97
- package/dist/admin/surface/useTestDocument.d.ts +0 -32
- package/dist/admin/surface/useTestDocument.js +0 -415
- /package/dist/{admin → testSurface}/allocation.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/arms.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/arms.model.js +0 -0
- /package/dist/{admin → testSurface}/arms/pageTarget.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/pageTarget.model.js +0 -0
- /package/dist/{admin → testSurface}/arms/params.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/params.model.js +0 -0
- /package/dist/{admin → testSurface}/metricSource.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/metricSource.model.js +0 -0
- /package/dist/{admin → testSurface}/placements/placementLabels.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/placements/placementLabels.model.js +0 -0
- /package/dist/{admin → testSurface}/placements/usePlacementLabels.d.ts +0 -0
- /package/dist/{admin → testSurface}/placements/usePlacementLabels.js +0 -0
- /package/dist/{admin → testSurface}/reload.d.ts +0 -0
- /package/dist/{admin → testSurface}/reload.js +0 -0
- /package/dist/{admin → testSurface}/results/CappedCell.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/CappedCell.js +0 -0
- /package/dist/{admin → testSurface}/results/CiChart.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/CiChart.js +0 -0
- /package/dist/{admin → testSurface}/results/DataQualityPanel.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/DataQualityPanel.js +0 -0
- /package/dist/{admin → testSurface}/results/DataTable.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/DataTable.js +0 -0
- /package/dist/{admin → testSurface}/results/StatTile.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/StatTile.js +0 -0
- /package/dist/{admin → testSurface}/results/chart.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/chart.model.js +0 -0
- /package/dist/{admin → testSurface}/results/format.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/format.js +0 -0
- /package/dist/{admin → testSurface}/results/legacy.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/legacy.js +0 -0
- /package/dist/{admin → testSurface}/results/releasePages.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/releasePages.model.js +0 -0
- /package/dist/{admin → testSurface}/results/snapshot.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/snapshot.js +0 -0
- /package/dist/{admin → testSurface}/review/review.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/review/review.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/contracts.js +0 -0
- /package/dist/{admin → testSurface}/surface/pageBlock/pageBlock.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/pageBlock/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/results/recommendation.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/setting.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/setting.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/AdvancedSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/Rail.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/TargetingSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/jumpToSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/jumpToSection.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/pageParts.d.ts +0 -0
- /package/dist/{admin → testSurface}/targeting/targeting.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/targeting/targeting.model.js +0 -0
- /package/dist/{admin → testSurface}/theme.d.ts +0 -0
- /package/dist/{admin → testSurface}/theme.js +0 -0
- /package/dist/{admin → testSurface}/useApi.js +0 -0
package/dist/types/surface.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import type { DocId } from './contracts.js';
|
|
2
1
|
import type { SerializedAttributeKeys, SerializedFlagPoint, SerializedMetricSource } from './admin.js';
|
|
3
2
|
export type TestsRoute = 'home' | 'new' | 'test' | 'results' | 'goals' | 'goalNew' | 'goal';
|
|
3
|
+
export type BlockPageCollection = {
|
|
4
|
+
slug: string;
|
|
5
|
+
label: string;
|
|
6
|
+
editors: Array<'puck' | 'blocks'>;
|
|
7
|
+
};
|
|
4
8
|
export interface TestsSurfaceProps {
|
|
5
9
|
route: TestsRoute;
|
|
6
10
|
id?: string;
|
|
7
11
|
returnToTest?: string;
|
|
8
12
|
adminRoute: string;
|
|
9
13
|
apiRoute: string;
|
|
14
|
+
contentLanguageLabels?: string[];
|
|
15
|
+
contentLocale?: string;
|
|
10
16
|
collectionTitles?: Record<string, string>;
|
|
11
17
|
userId?: string | number;
|
|
12
18
|
userCollection?: string;
|
|
13
19
|
isAdmin: boolean;
|
|
14
|
-
|
|
15
|
-
collection: string;
|
|
16
|
-
collectionLabel: string;
|
|
17
|
-
id: DocId;
|
|
18
|
-
title: string;
|
|
19
|
-
editorUrl: string;
|
|
20
|
-
editor: 'puck' | 'blocks';
|
|
21
|
-
}>;
|
|
20
|
+
blockPageCollections?: BlockPageCollection[];
|
|
22
21
|
pageCollections?: Array<{
|
|
23
22
|
slug: string;
|
|
24
23
|
label: string;
|
|
25
24
|
contentChecks: boolean;
|
|
25
|
+
copyEnabled?: true;
|
|
26
26
|
copyHint?: string;
|
|
27
27
|
copyUrl?: string;
|
|
28
28
|
copyLabel?: string;
|
package/dist/ui/Button.js
CHANGED
|
@@ -12,7 +12,7 @@ export function Button({ variant = 'secondary', size = 'md', disabled, busy, cla
|
|
|
12
12
|
href: blocked ? undefined : href,
|
|
13
13
|
role: blocked ? 'link' : undefined,
|
|
14
14
|
"aria-disabled": blocked || undefined,
|
|
15
|
-
"aria-busy": busy || undefined,
|
|
15
|
+
"aria-busy": busy || props['aria-busy'] || undefined,
|
|
16
16
|
tabIndex: blocked ? -1 : rest.tabIndex,
|
|
17
17
|
onClick: (event)=>{
|
|
18
18
|
if (blocked) event.preventDefault();
|
|
@@ -26,7 +26,7 @@ export function Button({ variant = 'secondary', size = 'md', disabled, busy, cla
|
|
|
26
26
|
type: props.type ?? 'button',
|
|
27
27
|
className: classes,
|
|
28
28
|
disabled: blocked,
|
|
29
|
-
"aria-busy": busy || undefined,
|
|
29
|
+
"aria-busy": busy || props['aria-busy'] || undefined,
|
|
30
30
|
children: children
|
|
31
31
|
});
|
|
32
32
|
}
|
package/dist/ui/Card.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import './ui.css';
|
|
3
3
|
export declare function Card({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
4
|
-
export declare function SectionCard({ number, title, complete, children, id, headingId, className }: {
|
|
4
|
+
export declare function SectionCard({ number, title, complete, blocked, children, id, headingId, className }: {
|
|
5
5
|
number: number;
|
|
6
6
|
title: string;
|
|
7
7
|
complete?: boolean;
|
|
8
|
+
blocked?: boolean;
|
|
8
9
|
children: ReactNode;
|
|
9
10
|
id?: string;
|
|
10
11
|
headingId?: string;
|
package/dist/ui/Card.js
CHANGED
|
@@ -6,11 +6,11 @@ export function Card({ className = '', ...props }) {
|
|
|
6
6
|
className: `xp-ui-card ${className}`
|
|
7
7
|
});
|
|
8
8
|
}
|
|
9
|
-
export function SectionCard({ number, title, complete = false, children, id, headingId, className = '' }) {
|
|
9
|
+
export function SectionCard({ number, title, complete = false, blocked = false, children, id, headingId, className = '' }) {
|
|
10
10
|
return /*#__PURE__*/ _jsxs("section", {
|
|
11
11
|
id: id,
|
|
12
12
|
"aria-labelledby": headingId,
|
|
13
|
-
className: `xp-ui-card xp-ui-section ${className}`,
|
|
13
|
+
className: `xp-ui-card xp-ui-section ${blocked ? 'xp-ui-section--blocked' : complete ? 'xp-ui-section--complete' : ''} ${className}`,
|
|
14
14
|
children: [
|
|
15
15
|
/*#__PURE__*/ _jsxs("header", {
|
|
16
16
|
className: "xp-ui-section-head",
|
|
@@ -26,8 +26,8 @@ export function SectionCard({ number, title, complete = false, children, id, hea
|
|
|
26
26
|
}),
|
|
27
27
|
/*#__PURE__*/ _jsx("span", {
|
|
28
28
|
className: "xp-ui-section-complete",
|
|
29
|
-
"aria-label": complete ? 'Complete' : 'Incomplete',
|
|
30
|
-
children: complete ? '✓' : '○'
|
|
29
|
+
"aria-label": blocked ? 'Needs attention' : complete ? 'Complete' : 'Incomplete',
|
|
30
|
+
children: blocked ? '!' : complete ? '✓' : '○'
|
|
31
31
|
})
|
|
32
32
|
]
|
|
33
33
|
}),
|
package/dist/ui/ChipsInput.d.ts
CHANGED
|
@@ -9,5 +9,12 @@ export interface ChipsInputProps {
|
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
id: string;
|
|
12
|
+
draft?: {
|
|
13
|
+
value: string;
|
|
14
|
+
change: (value: string) => void;
|
|
15
|
+
submit: (value: string) => void;
|
|
16
|
+
discard: () => void;
|
|
17
|
+
describedBy?: string;
|
|
18
|
+
};
|
|
12
19
|
}
|
|
13
|
-
export declare function ChipsInput({ value, onChange, label, description, help, error, placeholder, disabled, id }: ChipsInputProps): import("react").JSX.Element;
|
|
20
|
+
export declare function ChipsInput({ value, onChange, label, description, help, error, placeholder, disabled, id, draft: managedDraft }: ChipsInputProps): import("react").JSX.Element;
|
package/dist/ui/ChipsInput.js
CHANGED
|
@@ -2,11 +2,17 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useRef, useState } from 'react';
|
|
4
4
|
import './ui.css';
|
|
5
|
-
export function ChipsInput({ value, onChange, label, description, help = description, error, placeholder, disabled = false, id }) {
|
|
6
|
-
const [
|
|
5
|
+
export function ChipsInput({ value, onChange, label, description, help = description, error, placeholder, disabled = false, id, draft: managedDraft }) {
|
|
6
|
+
const [localDraft, setLocalDraft] = useState('');
|
|
7
|
+
const draft = managedDraft?.value ?? localDraft;
|
|
8
|
+
const setDraft = managedDraft?.change ?? setLocalDraft;
|
|
7
9
|
const input = useRef(null);
|
|
8
10
|
const commit = (text)=>{
|
|
9
11
|
if (disabled) return;
|
|
12
|
+
if (managedDraft) {
|
|
13
|
+
managedDraft.submit(text);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
10
16
|
const next = [
|
|
11
17
|
...new Set([
|
|
12
18
|
...value,
|
|
@@ -60,13 +66,20 @@ export function ChipsInput({ value, onChange, label, description, help = descrip
|
|
|
60
66
|
"aria-invalid": Boolean(error) || undefined,
|
|
61
67
|
"aria-describedby": [
|
|
62
68
|
help ? `${id}-description` : '',
|
|
63
|
-
error ? `${id}-error` : ''
|
|
69
|
+
error ? `${id}-error` : '',
|
|
70
|
+
managedDraft?.describedBy
|
|
64
71
|
].filter(Boolean).join(' ') || undefined,
|
|
65
72
|
onChange: (event)=>setDraft(event.target.value),
|
|
66
73
|
onBlur: ()=>{
|
|
67
74
|
if (draft.trim()) commit(draft);
|
|
68
75
|
},
|
|
69
76
|
onKeyDown: (event)=>{
|
|
77
|
+
if (event.key === 'Escape' && managedDraft && draft) {
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
event.stopPropagation();
|
|
80
|
+
managedDraft.discard();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
70
83
|
if (disabled || event.nativeEvent.isComposing) return;
|
|
71
84
|
if (event.key === 'Enter' || event.key === ',') {
|
|
72
85
|
event.preventDefault();
|
|
@@ -78,7 +91,7 @@ export function ChipsInput({ value, onChange, label, description, help = descrip
|
|
|
78
91
|
}
|
|
79
92
|
},
|
|
80
93
|
onPaste: (event)=>{
|
|
81
|
-
if (disabled) return;
|
|
94
|
+
if (disabled || managedDraft) return;
|
|
82
95
|
const pasted = event.clipboardData.getData('text');
|
|
83
96
|
if (!pasted.includes(',')) return;
|
|
84
97
|
event.preventDefault();
|
package/dist/ui/Dialog.d.ts
CHANGED
|
@@ -3,11 +3,33 @@ import './ui.css';
|
|
|
3
3
|
/** Native modal stays in its rendering document, including a Puck canvas iframe.
|
|
4
4
|
* `initialFocus="cancel"` targets the focusable control marked `data-dialog-cancel`.
|
|
5
5
|
*/
|
|
6
|
-
export declare function Dialog({ open, title, onClose, children, dismissible, initialFocus }: {
|
|
6
|
+
export declare function Dialog({ open, title, descriptionId, onClose, children, dismissible, initialFocus, className, headerActions, closeOnBackdrop }: {
|
|
7
7
|
open: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
headerActions?: ReactNode;
|
|
10
|
+
closeOnBackdrop?: boolean;
|
|
8
11
|
dismissible?: boolean;
|
|
9
12
|
initialFocus?: 'cancel';
|
|
10
13
|
title: string;
|
|
11
|
-
|
|
14
|
+
descriptionId?: string;
|
|
15
|
+
onClose: () => void | false;
|
|
12
16
|
children: ReactNode;
|
|
13
17
|
}): import("react").JSX.Element;
|
|
18
|
+
export declare function ConfirmDialog({ open, title, description, children, error, busy, busyLabel, cancelLabel, onClose, confirm, secondaryAction }: {
|
|
19
|
+
open?: boolean;
|
|
20
|
+
title: string;
|
|
21
|
+
description?: ReactNode;
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
error?: string | null;
|
|
24
|
+
busy?: boolean;
|
|
25
|
+
busyLabel?: string;
|
|
26
|
+
cancelLabel: string;
|
|
27
|
+
onClose: () => void;
|
|
28
|
+
secondaryAction?: ReactNode;
|
|
29
|
+
confirm?: {
|
|
30
|
+
label: string;
|
|
31
|
+
onClick: () => void | Promise<void>;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
destructive?: boolean;
|
|
34
|
+
};
|
|
35
|
+
}): import("react").JSX.Element;
|
package/dist/ui/Dialog.js
CHANGED
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useId, useRef } from 'react';
|
|
4
|
+
import { Button } from './Button.js';
|
|
4
5
|
import './ui.css';
|
|
6
|
+
const modalBackgrounds = new WeakMap();
|
|
7
|
+
function inertBackground(dialog) {
|
|
8
|
+
const elements = [
|
|
9
|
+
...dialog.ownerDocument.querySelectorAll('[data-dialog-background]')
|
|
10
|
+
].filter((element)=>!element.contains(dialog));
|
|
11
|
+
for (const element of elements){
|
|
12
|
+
const state = modalBackgrounds.get(element) ?? {
|
|
13
|
+
dialogs: 0,
|
|
14
|
+
wasInert: element.hasAttribute('inert')
|
|
15
|
+
};
|
|
16
|
+
state.dialogs++;
|
|
17
|
+
modalBackgrounds.set(element, state);
|
|
18
|
+
element.setAttribute('inert', '');
|
|
19
|
+
}
|
|
20
|
+
return ()=>{
|
|
21
|
+
for (const element of elements){
|
|
22
|
+
const state = modalBackgrounds.get(element);
|
|
23
|
+
if (--state.dialogs > 0) continue;
|
|
24
|
+
if (!state.wasInert) element.removeAttribute('inert');
|
|
25
|
+
modalBackgrounds.delete(element);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
5
29
|
function focusable(node) {
|
|
6
30
|
return [
|
|
7
31
|
...node.querySelectorAll('button, a[href], input, select, textarea, [tabindex]')
|
|
@@ -16,28 +40,57 @@ function focusable(node) {
|
|
|
16
40
|
}
|
|
17
41
|
/** Native modal stays in its rendering document, including a Puck canvas iframe.
|
|
18
42
|
* `initialFocus="cancel"` targets the focusable control marked `data-dialog-cancel`.
|
|
19
|
-
*/ export function Dialog({ open, title, onClose, children, dismissible = true, initialFocus }) {
|
|
43
|
+
*/ export function Dialog({ open, title, descriptionId, onClose, children, dismissible = true, initialFocus, className = '', headerActions, closeOnBackdrop = false }) {
|
|
20
44
|
const ref = useRef(null);
|
|
21
45
|
const heading = useId();
|
|
46
|
+
const backdropPress = useRef(false);
|
|
47
|
+
const onBackdrop = (event)=>{
|
|
48
|
+
const node = ref.current;
|
|
49
|
+
if (!node || event.target !== node) return false;
|
|
50
|
+
const rect = node.getBoundingClientRect();
|
|
51
|
+
return event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom;
|
|
52
|
+
};
|
|
22
53
|
const closeRequested = useRef(false);
|
|
23
54
|
const requestClose = ()=>{
|
|
24
55
|
if (!open || !dismissible || closeRequested.current) return;
|
|
25
|
-
closeRequested.current = true;
|
|
26
|
-
onClose();
|
|
56
|
+
if (onClose() !== false) closeRequested.current = true;
|
|
27
57
|
};
|
|
28
58
|
useEffect(()=>{
|
|
29
59
|
const node = ref.current;
|
|
30
60
|
if (!node || !open) return;
|
|
31
61
|
const doc = node.ownerDocument;
|
|
32
62
|
const previous = doc.activeElement;
|
|
63
|
+
const scope = previous?.closest('[data-dialog-focus-scope]');
|
|
33
64
|
closeRequested.current = false;
|
|
65
|
+
// Observe before overlay portals stop pointerdown during ancestor capture.
|
|
66
|
+
const down = (event)=>{
|
|
67
|
+
backdropPress.current = onBackdrop(event);
|
|
68
|
+
};
|
|
69
|
+
const up = (event)=>{
|
|
70
|
+
if (!onBackdrop(event)) backdropPress.current = false;
|
|
71
|
+
};
|
|
72
|
+
const cancel = ()=>{
|
|
73
|
+
backdropPress.current = false;
|
|
74
|
+
};
|
|
75
|
+
doc.addEventListener('pointerdown', down, true);
|
|
76
|
+
doc.addEventListener('pointerup', up, true);
|
|
77
|
+
doc.addEventListener('pointercancel', cancel, true);
|
|
34
78
|
node.showModal();
|
|
79
|
+
const restoreBackground = inertBackground(node);
|
|
35
80
|
const elements = focusable(node);
|
|
36
81
|
const preferred = initialFocus === 'cancel' ? elements.find((element)=>element.hasAttribute('data-dialog-cancel')) : undefined;
|
|
37
82
|
(preferred ?? elements[0] ?? node).focus();
|
|
38
83
|
return ()=>{
|
|
84
|
+
doc.removeEventListener('pointerdown', down, true);
|
|
85
|
+
doc.removeEventListener('pointerup', up, true);
|
|
86
|
+
doc.removeEventListener('pointercancel', cancel, true);
|
|
87
|
+
restoreBackground();
|
|
39
88
|
node.close();
|
|
40
89
|
if (previous?.isConnected) previous.focus();
|
|
90
|
+
if (doc.activeElement === doc.body && scope?.isConnected) {
|
|
91
|
+
const fallback = scope.querySelector('[data-dialog-focus-fallback]') ?? scope;
|
|
92
|
+
fallback.focus();
|
|
93
|
+
}
|
|
41
94
|
};
|
|
42
95
|
}, [
|
|
43
96
|
open,
|
|
@@ -46,12 +99,19 @@ function focusable(node) {
|
|
|
46
99
|
return /*#__PURE__*/ _jsxs("dialog", {
|
|
47
100
|
ref: ref,
|
|
48
101
|
"aria-labelledby": heading,
|
|
49
|
-
|
|
102
|
+
"aria-describedby": descriptionId,
|
|
103
|
+
className: `xp-ui-dialog ${className}`,
|
|
50
104
|
tabIndex: -1,
|
|
51
105
|
onCancel: (event)=>{
|
|
106
|
+
if (event.target !== event.currentTarget) return;
|
|
52
107
|
event.preventDefault();
|
|
53
108
|
requestClose();
|
|
54
109
|
},
|
|
110
|
+
onClick: (event)=>{
|
|
111
|
+
const startedOnBackdrop = backdropPress.current;
|
|
112
|
+
backdropPress.current = false;
|
|
113
|
+
if (closeOnBackdrop && startedOnBackdrop && onBackdrop(event)) requestClose();
|
|
114
|
+
},
|
|
55
115
|
onKeyDown: (event)=>{
|
|
56
116
|
if (event.defaultPrevented) return;
|
|
57
117
|
if (event.key === 'Escape') {
|
|
@@ -75,7 +135,16 @@ function focusable(node) {
|
|
|
75
135
|
}
|
|
76
136
|
},
|
|
77
137
|
children: [
|
|
78
|
-
/*#__PURE__*/
|
|
138
|
+
headerActions ? /*#__PURE__*/ _jsxs("header", {
|
|
139
|
+
className: "xp-ui-dialog-header",
|
|
140
|
+
children: [
|
|
141
|
+
/*#__PURE__*/ _jsx("h2", {
|
|
142
|
+
id: heading,
|
|
143
|
+
children: title
|
|
144
|
+
}),
|
|
145
|
+
headerActions
|
|
146
|
+
]
|
|
147
|
+
}) : /*#__PURE__*/ _jsx("h2", {
|
|
79
148
|
id: heading,
|
|
80
149
|
children: title
|
|
81
150
|
}),
|
|
@@ -83,3 +152,69 @@ function focusable(node) {
|
|
|
83
152
|
]
|
|
84
153
|
});
|
|
85
154
|
}
|
|
155
|
+
export function ConfirmDialog({ open = true, title, description, children, error, busy = false, busyLabel, cancelLabel, onClose, confirm, secondaryAction }) {
|
|
156
|
+
const pending = useRef(false);
|
|
157
|
+
const descriptionId = useId();
|
|
158
|
+
function close() {
|
|
159
|
+
if (busy) return false;
|
|
160
|
+
onClose();
|
|
161
|
+
}
|
|
162
|
+
async function submit() {
|
|
163
|
+
if (!confirm || confirm.disabled || busy || pending.current) return;
|
|
164
|
+
pending.current = true;
|
|
165
|
+
try {
|
|
166
|
+
await confirm.onClick();
|
|
167
|
+
} finally{
|
|
168
|
+
pending.current = false;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return /*#__PURE__*/ _jsx(Dialog, {
|
|
172
|
+
open: open,
|
|
173
|
+
title: title,
|
|
174
|
+
descriptionId: open && description ? descriptionId : undefined,
|
|
175
|
+
initialFocus: "cancel",
|
|
176
|
+
dismissible: !busy,
|
|
177
|
+
onClose: close,
|
|
178
|
+
children: open ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
179
|
+
children: [
|
|
180
|
+
description ? typeof description === 'string' ? /*#__PURE__*/ _jsx("p", {
|
|
181
|
+
id: descriptionId,
|
|
182
|
+
children: description
|
|
183
|
+
}) : /*#__PURE__*/ _jsx("div", {
|
|
184
|
+
id: descriptionId,
|
|
185
|
+
children: description
|
|
186
|
+
}) : null,
|
|
187
|
+
children,
|
|
188
|
+
busy && busyLabel ? /*#__PURE__*/ _jsx("p", {
|
|
189
|
+
role: "status",
|
|
190
|
+
children: busyLabel
|
|
191
|
+
}) : null,
|
|
192
|
+
error ? /*#__PURE__*/ _jsx("p", {
|
|
193
|
+
role: "alert",
|
|
194
|
+
className: "xp-ui-error",
|
|
195
|
+
children: error
|
|
196
|
+
}) : null,
|
|
197
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
198
|
+
className: "xp-ui-button-group xp-ui-confirm-actions",
|
|
199
|
+
children: [
|
|
200
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
201
|
+
"data-dialog-cancel": true,
|
|
202
|
+
"aria-disabled": busy || undefined,
|
|
203
|
+
onClick: close,
|
|
204
|
+
children: cancelLabel
|
|
205
|
+
}),
|
|
206
|
+
secondaryAction,
|
|
207
|
+
confirm ? /*#__PURE__*/ _jsx(Button, {
|
|
208
|
+
variant: confirm.destructive ? 'danger' : 'primary',
|
|
209
|
+
disabled: confirm.disabled && !busy,
|
|
210
|
+
"aria-busy": busy || undefined,
|
|
211
|
+
"aria-disabled": busy || confirm.disabled || undefined,
|
|
212
|
+
onClick: ()=>void submit(),
|
|
213
|
+
children: confirm.label
|
|
214
|
+
}) : null
|
|
215
|
+
]
|
|
216
|
+
})
|
|
217
|
+
]
|
|
218
|
+
}) : null
|
|
219
|
+
});
|
|
220
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import './ui.css';
|
|
3
|
+
/** Native modal drawer: focus trap/restoration and Escape come from Dialog. */
|
|
4
|
+
export declare function Drawer({ title, closeLabel, onClose, children, actions }: {
|
|
5
|
+
title: string;
|
|
6
|
+
closeLabel: string;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
actions?: ReactNode;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from './Button.js';
|
|
4
|
+
import { Dialog } from './Dialog.js';
|
|
5
|
+
import './ui.css';
|
|
6
|
+
/** Native modal drawer: focus trap/restoration and Escape come from Dialog. */ export function Drawer({ title, closeLabel, onClose, children, actions }) {
|
|
7
|
+
return /*#__PURE__*/ _jsx(Dialog, {
|
|
8
|
+
open: true,
|
|
9
|
+
title: title,
|
|
10
|
+
onClose: onClose,
|
|
11
|
+
closeOnBackdrop: true,
|
|
12
|
+
className: "xp-ui-drawer",
|
|
13
|
+
headerActions: /*#__PURE__*/ _jsxs("div", {
|
|
14
|
+
className: "xp-ui-button-group",
|
|
15
|
+
children: [
|
|
16
|
+
actions,
|
|
17
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
18
|
+
variant: "quiet",
|
|
19
|
+
onClick: onClose,
|
|
20
|
+
children: closeLabel
|
|
21
|
+
})
|
|
22
|
+
]
|
|
23
|
+
}),
|
|
24
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
25
|
+
className: "xp-ui-drawer-body",
|
|
26
|
+
children: children
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
}
|
package/dist/ui/Inputs.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { InputHTMLAttributes,
|
|
1
|
+
import type { InputHTMLAttributes, TextareaHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import type { SelectControlProps } from './SelectControl.js';
|
|
2
3
|
import './ui.css';
|
|
3
4
|
export interface FieldProps {
|
|
4
5
|
id: string;
|
|
@@ -12,8 +13,8 @@ export declare function NumberInput(props: TextInputProps): import("react").JSX.
|
|
|
12
13
|
export declare function SearchInput(props: TextInputProps): import("react").JSX.Element;
|
|
13
14
|
export type SelectProps = FieldProps & {
|
|
14
15
|
labelAction?: ReactNode;
|
|
15
|
-
} & Omit<
|
|
16
|
-
export declare function Select({ label, labelAction, help, error,
|
|
16
|
+
} & Omit<SelectControlProps, 'id'>;
|
|
17
|
+
export declare function Select({ label, labelAction, help, error, ...props }: SelectProps): import("react").JSX.Element;
|
|
17
18
|
export declare function Toggle({ label, help, error, className, ...props }: Omit<TextInputProps, 'type'>): import("react").JSX.Element;
|
|
18
19
|
export type TextareaProps = FieldProps & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'>;
|
|
19
20
|
export declare function Textarea({ label, help, error, className, ...props }: TextareaProps): import("react").JSX.Element;
|
package/dist/ui/Inputs.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { SelectControl } from './SelectControl.js';
|
|
3
4
|
import './ui.css';
|
|
4
5
|
function described(props, extra) {
|
|
5
6
|
return [
|
|
@@ -16,12 +17,14 @@ function Field({ id, label, labelAction, help, error, children }) {
|
|
|
16
17
|
className: "xp-ui-field-label",
|
|
17
18
|
children: [
|
|
18
19
|
/*#__PURE__*/ _jsx("label", {
|
|
20
|
+
id: `${id}-label`,
|
|
19
21
|
htmlFor: id,
|
|
20
22
|
children: label
|
|
21
23
|
}),
|
|
22
24
|
labelAction
|
|
23
25
|
]
|
|
24
26
|
}) : /*#__PURE__*/ _jsx("label", {
|
|
27
|
+
id: `${id}-label`,
|
|
25
28
|
htmlFor: id,
|
|
26
29
|
children: label
|
|
27
30
|
}),
|
|
@@ -70,7 +73,7 @@ export function SearchInput(props) {
|
|
|
70
73
|
type: "search"
|
|
71
74
|
});
|
|
72
75
|
}
|
|
73
|
-
export function Select({ label, labelAction, help, error,
|
|
76
|
+
export function Select({ label, labelAction, help, error, ...props }) {
|
|
74
77
|
const field = {
|
|
75
78
|
id: props.id,
|
|
76
79
|
label,
|
|
@@ -80,10 +83,9 @@ export function Select({ label, labelAction, help, error, className = '', ...pro
|
|
|
80
83
|
return /*#__PURE__*/ _jsx(Field, {
|
|
81
84
|
...field,
|
|
82
85
|
labelAction: labelAction,
|
|
83
|
-
children: /*#__PURE__*/ _jsx(
|
|
86
|
+
children: /*#__PURE__*/ _jsx(SelectControl, {
|
|
84
87
|
...props,
|
|
85
|
-
|
|
86
|
-
"aria-invalid": Boolean(error) || undefined,
|
|
88
|
+
"aria-invalid": Boolean(error) || props['aria-invalid'] || undefined,
|
|
87
89
|
"aria-describedby": described(field, props['aria-describedby'])
|
|
88
90
|
})
|
|
89
91
|
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface SelectOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
group?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SelectChange {
|
|
9
|
+
target: {
|
|
10
|
+
value: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
};
|
|
13
|
+
currentTarget: {
|
|
14
|
+
value: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface SelectControlProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'value' | 'defaultValue' | 'children'> {
|
|
19
|
+
id: string;
|
|
20
|
+
value?: string | number | readonly string[];
|
|
21
|
+
defaultValue?: string | number | readonly string[];
|
|
22
|
+
options?: readonly SelectOption[];
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
onChange?: (event: SelectChange) => void;
|
|
25
|
+
name?: string;
|
|
26
|
+
form?: string;
|
|
27
|
+
required?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/** Select-only combobox: DOM focus stays on the button while active-descendant
|
|
30
|
+
* focus explores the list. The manual popover lives in the trigger's document
|
|
31
|
+
* and inherits its theme; the browser's top layer escapes scroll/iframe drawers.
|
|
32
|
+
*/
|
|
33
|
+
export declare function SelectControl({ id, value, defaultValue, options: supplied, children, onChange, name, form, required, disabled, className, onKeyDown, onBlur, ...props }: SelectControlProps): import("react").JSX.Element;
|