@delmaredigital/payload-experiments 0.2.0-rc.7 → 0.3.0-rc.4

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.
Files changed (336) hide show
  1. package/README.md +202 -26
  2. package/dist/admin/PreviewLinks.d.ts +2 -1
  3. package/dist/admin/PreviewLinks.js +50 -21
  4. package/dist/admin/TestsNavLink.d.ts +3 -1
  5. package/dist/admin/TestsNavLink.js +2 -2
  6. package/dist/admin/actions/ConfirmDialog.d.ts +7 -4
  7. package/dist/admin/actions/ConfirmDialog.js +37 -82
  8. package/dist/admin/actions/DecideDialog.d.ts +3 -1
  9. package/dist/admin/actions/DecideDialog.js +30 -13
  10. package/dist/admin/actions/MakeContentResult.d.ts +13 -2
  11. package/dist/admin/actions/MakeContentResult.js +115 -16
  12. package/dist/admin/actions/actions.model.d.ts +2 -4
  13. package/dist/admin/actions/actions.model.js +2 -3
  14. package/dist/admin/allocation.model.js +3 -5
  15. package/dist/admin/api.d.ts +10 -4
  16. package/dist/admin/api.js +11 -7
  17. package/dist/admin/armSelect/ArmSelectField.js +14 -22
  18. package/dist/admin/arms/arms.model.d.ts +1 -21
  19. package/dist/admin/arms/arms.model.js +1 -153
  20. package/dist/admin/copy/actions.d.ts +39 -3
  21. package/dist/admin/copy/actions.js +40 -4
  22. package/dist/admin/copy/armSelect.js +5 -5
  23. package/dist/admin/copy/arms.d.ts +1 -6
  24. package/dist/admin/copy/arms.js +1 -16
  25. package/dist/admin/copy/audience.d.ts +2 -1
  26. package/dist/admin/copy/audience.js +3 -2
  27. package/dist/admin/copy/common.d.ts +13 -6
  28. package/dist/admin/copy/common.js +14 -8
  29. package/dist/admin/copy/goals.d.ts +21 -6
  30. package/dist/admin/copy/goals.js +27 -6
  31. package/dist/admin/copy/readiness.d.ts +22 -0
  32. package/dist/admin/copy/readiness.js +21 -0
  33. package/dist/admin/copy/recommendation.d.ts +0 -3
  34. package/dist/admin/copy/recommendation.js +0 -3
  35. package/dist/admin/copy/results.d.ts +43 -2
  36. package/dist/admin/copy/results.js +44 -3
  37. package/dist/admin/copy/review.d.ts +2 -2
  38. package/dist/admin/copy/review.js +2 -2
  39. package/dist/admin/copy/setting.d.ts +2 -0
  40. package/dist/admin/copy/setting.js +2 -0
  41. package/dist/admin/copy/surface.d.ts +7 -5
  42. package/dist/admin/copy/surface.js +9 -5
  43. package/dist/admin/copy/testPage.d.ts +10 -0
  44. package/dist/admin/copy/testPage.js +10 -0
  45. package/dist/admin/format/date.d.ts +2 -0
  46. package/dist/admin/format/date.js +10 -0
  47. package/dist/admin/paths.d.ts +2 -1
  48. package/dist/admin/paths.js +2 -1
  49. package/dist/admin/previewLinks.model.d.ts +4 -2
  50. package/dist/admin/previewLinks.model.js +8 -7
  51. package/dist/admin/results/CiChart.js +11 -21
  52. package/dist/admin/results/DataQualityPanel.d.ts +4 -2
  53. package/dist/admin/results/DataQualityPanel.js +30 -17
  54. package/dist/admin/results/DataTable.d.ts +16 -0
  55. package/dist/admin/results/DataTable.js +152 -0
  56. package/dist/admin/results/StatTile.d.ts +7 -0
  57. package/dist/admin/results/StatTile.js +22 -0
  58. package/dist/admin/results/VerdictHero.d.ts +13 -0
  59. package/dist/admin/results/{VerdictCard.js → VerdictHero.js} +15 -12
  60. package/dist/admin/results/legacy.d.ts +16 -0
  61. package/dist/admin/results/legacy.js +27 -0
  62. package/dist/admin/results/releasePages.model.d.ts +17 -0
  63. package/dist/admin/results/releasePages.model.js +10 -0
  64. package/dist/admin/results/results.css +64 -0
  65. package/dist/admin/results/results.model.d.ts +11 -7
  66. package/dist/admin/results/results.model.js +24 -7
  67. package/dist/admin/results/snapshot.d.ts +14 -0
  68. package/dist/admin/results/snapshot.js +3 -0
  69. package/dist/admin/surface/ResultsRoute.d.ts +1 -1
  70. package/dist/admin/surface/ResultsRoute.js +59 -34
  71. package/dist/admin/surface/SurfaceShell.d.ts +11 -2
  72. package/dist/admin/surface/SurfaceShell.js +49 -14
  73. package/dist/admin/surface/TestsHome.d.ts +6 -1
  74. package/dist/admin/surface/TestsHome.js +182 -114
  75. package/dist/admin/surface/TestsSurface.js +56 -16
  76. package/dist/admin/surface/goals/GoalForm.js +341 -308
  77. package/dist/admin/surface/goals/GoalsList.js +123 -89
  78. package/dist/admin/surface/goals/data.d.ts +8 -2
  79. package/dist/admin/surface/goals/data.js +24 -16
  80. package/dist/admin/surface/goals/goals.css +10 -13
  81. package/dist/admin/surface/home.model.d.ts +8 -8
  82. package/dist/admin/surface/home.model.js +23 -12
  83. package/dist/admin/surface/newTest/NewTest.js +9 -9
  84. package/dist/admin/surface/pageBlock/parts.js +31 -26
  85. package/dist/admin/surface/readiness/ActionDialogs.js +47 -19
  86. package/dist/admin/surface/readiness/Banner.d.ts +3 -0
  87. package/dist/admin/surface/readiness/Banner.js +58 -33
  88. package/dist/admin/surface/readiness/SaveStatus.d.ts +1 -0
  89. package/dist/admin/surface/readiness/SaveStatus.js +6 -3
  90. package/dist/admin/surface/readiness/readiness.model.d.ts +2 -0
  91. package/dist/admin/surface/readiness/readiness.model.js +25 -9
  92. package/dist/admin/surface/readiness/useTransition.d.ts +1 -0
  93. package/dist/admin/surface/readiness/useTransition.js +2 -1
  94. package/dist/admin/surface/results/ReleasePages.d.ts +14 -0
  95. package/dist/admin/surface/results/ReleasePages.js +116 -0
  96. package/dist/admin/surface/results/ResultsBody.d.ts +11 -1
  97. package/dist/admin/surface/results/ResultsBody.js +277 -105
  98. package/dist/admin/surface/results/ResultsHeader.d.ts +10 -0
  99. package/dist/admin/surface/results/ResultsHeader.js +177 -0
  100. package/dist/admin/surface/results/recommendation.model.d.ts +3 -2
  101. package/dist/admin/surface/results/recommendation.model.js +12 -9
  102. package/dist/admin/surface/results/useResults.d.ts +21 -3
  103. package/dist/admin/surface/results/useResults.js +2 -1
  104. package/dist/admin/surface/setting/parts.js +75 -88
  105. package/dist/admin/surface/setting/setting.css +3 -15
  106. package/dist/admin/surface/surface.css +61 -47
  107. package/dist/admin/surface/test/AdvancedSection.js +55 -48
  108. package/dist/admin/surface/test/GoalSection.js +46 -47
  109. package/dist/admin/surface/test/LengthSection.js +46 -34
  110. package/dist/admin/surface/test/Rail.d.ts +4 -0
  111. package/dist/admin/surface/test/Rail.js +83 -0
  112. package/dist/admin/surface/test/ReadinessBar.d.ts +5 -0
  113. package/dist/admin/surface/test/ReadinessBar.js +33 -0
  114. package/dist/admin/surface/test/Section.d.ts +1 -1
  115. package/dist/admin/surface/test/Section.js +36 -16
  116. package/dist/admin/surface/test/TargetingSection.js +168 -142
  117. package/dist/admin/surface/test/TestPage.d.ts +2 -1
  118. package/dist/admin/surface/test/TestPage.js +146 -68
  119. package/dist/admin/surface/test/VersionsSection.js +151 -120
  120. package/dist/admin/surface/test/fields.d.ts +11 -4
  121. package/dist/admin/surface/test/fields.js +84 -85
  122. package/dist/admin/surface/test/jumpToSection.d.ts +3 -0
  123. package/dist/admin/surface/test/jumpToSection.js +10 -0
  124. package/dist/admin/surface/test/pageParts.js +9 -3
  125. package/dist/admin/surface/test/testPage.css +81 -14
  126. package/dist/admin/surface/test/testPage.model.d.ts +2 -3
  127. package/dist/admin/surface/test/testPage.model.js +1 -21
  128. package/dist/admin/surface/useTestDocument.js +12 -5
  129. package/dist/admin/targeting/targeting.model.d.ts +1 -3
  130. package/dist/admin/targeting/targeting.model.js +3 -8
  131. package/dist/admin/theme.css +115 -36
  132. package/dist/admin/theme.d.ts +38 -0
  133. package/dist/admin/theme.js +38 -1
  134. package/dist/admin/useApi.d.ts +17 -2
  135. package/dist/admin/useLayerUsage.js +14 -23
  136. package/dist/admin/views/ExperimentsRootView.js +12 -2
  137. package/dist/admin/views/TestsNavLinkServer.d.ts +2 -0
  138. package/dist/admin/views/TestsNavLinkServer.js +43 -0
  139. package/dist/arms/copy.d.ts +6 -0
  140. package/dist/arms/copy.js +16 -0
  141. package/dist/arms/model.d.ts +23 -0
  142. package/dist/arms/model.js +173 -0
  143. package/dist/collections/experiments/config.js +25 -0
  144. package/dist/collections/experiments/lockHook.js +3 -1
  145. package/dist/collections/identities.js +6 -1
  146. package/dist/collections/metrics.js +7 -0
  147. package/dist/collections/metricsGuards.d.ts +9 -0
  148. package/dist/collections/metricsGuards.js +33 -0
  149. package/dist/contentDone.d.ts +4 -0
  150. package/dist/contentDone.js +5 -0
  151. package/dist/db/appends.d.ts +6 -2
  152. package/dist/db/appends.js +10 -4
  153. package/dist/db/identities.d.ts +8 -7
  154. package/dist/db/identities.js +9 -6
  155. package/dist/db/locks.d.ts +6 -0
  156. package/dist/db/locks.js +13 -1
  157. package/dist/db/metricUsage.d.ts +19 -0
  158. package/dist/db/metricUsage.js +54 -0
  159. package/dist/db/names.d.ts +5 -0
  160. package/dist/db/names.js +5 -0
  161. package/dist/db/pageOccupancy.d.ts +12 -0
  162. package/dist/db/pageOccupancy.js +45 -0
  163. package/dist/db/publishedContent.d.ts +10 -0
  164. package/dist/db/publishedContent.js +43 -0
  165. package/dist/db/results.d.ts +2 -0
  166. package/dist/db/results.js +6 -2
  167. package/dist/db/snapshots.d.ts +18 -6
  168. package/dist/db/snapshots.js +25 -8
  169. package/dist/db/sweep.js +11 -6
  170. package/dist/endpoints/index.js +19 -1
  171. package/dist/endpoints/results.js +5 -0
  172. package/dist/endpoints/sanitizeReadinessDetail.d.ts +1 -0
  173. package/dist/endpoints/sanitizeReadinessDetail.js +2 -0
  174. package/dist/endpoints/summary.js +20 -2
  175. package/dist/endpoints/transitions.d.ts +15 -0
  176. package/dist/endpoints/transitions.js +36 -0
  177. package/dist/errors.d.ts +8 -0
  178. package/dist/errors.js +28 -0
  179. package/dist/exports/adminRsc.d.ts +1 -0
  180. package/dist/exports/adminRsc.js +1 -0
  181. package/dist/exports/index.d.ts +2 -1
  182. package/dist/exports/index.js +1 -0
  183. package/dist/exports/puck.d.ts +2 -1
  184. package/dist/exports/puck.js +1 -1
  185. package/dist/exports/puckEditor.d.ts +4 -1
  186. package/dist/exports/puckEditor.js +3 -1
  187. package/dist/exports/rsc.d.ts +6 -1
  188. package/dist/exports/rsc.js +2 -0
  189. package/dist/hooks/pageGuard.d.ts +5 -0
  190. package/dist/hooks/pageGuard.js +139 -0
  191. package/dist/lib/fetchAllDocs.d.ts +16 -0
  192. package/dist/lib/fetchAllDocs.js +56 -0
  193. package/dist/log.js +6 -3
  194. package/dist/manifest/compile.d.ts +5 -0
  195. package/dist/manifest/compile.js +5 -1
  196. package/dist/options.js +16 -0
  197. package/dist/plugin.js +30 -2
  198. package/dist/puck/ExperimentPicker.js +47 -16
  199. package/dist/puck/ExperimentSlot.d.ts +51 -1
  200. package/dist/puck/ExperimentSlot.js +23 -12
  201. package/dist/puck/copy.d.ts +6 -5
  202. package/dist/puck/copy.js +6 -5
  203. package/dist/puck/editor/CreateExperimentDrawer.js +46 -56
  204. package/dist/puck/editor/ExperimentSlotEditor.d.ts +52 -1
  205. package/dist/puck/editor/ExperimentSlotEditor.js +292 -137
  206. package/dist/puck/editor/ResultsReadout.d.ts +6 -0
  207. package/dist/puck/editor/ResultsReadout.js +99 -0
  208. package/dist/puck/editor/VersionBuilder.d.ts +34 -0
  209. package/dist/puck/editor/VersionBuilder.js +317 -0
  210. package/dist/puck/editor/armWrites.d.ts +7 -0
  211. package/dist/puck/editor/armWrites.js +71 -0
  212. package/dist/puck/editor/armsCache.d.ts +14 -0
  213. package/dist/puck/editor/armsCache.js +78 -0
  214. package/dist/puck/editor/copy.d.ts +33 -1
  215. package/dist/puck/editor/copy.js +45 -8
  216. package/dist/puck/editor/createTest.d.ts +1 -1
  217. package/dist/puck/editor/createTest.js +25 -14
  218. package/dist/puck/editor/editor.chrome.css +121 -0
  219. package/dist/puck/editor/editor.css +288 -204
  220. package/dist/puck/editor/editor.model.d.ts +4 -1
  221. package/dist/puck/editor/editor.model.js +10 -7
  222. package/dist/puck/editor/experimentOutlinePlugin.d.ts +3 -0
  223. package/dist/puck/editor/experimentOutlinePlugin.js +89 -0
  224. package/dist/puck/experimentSlotField.d.ts +2 -0
  225. package/dist/puck/experimentSlotField.js +11 -3
  226. package/dist/puck/hostContext.d.ts +10 -0
  227. package/dist/puck/hostContext.js +12 -0
  228. package/dist/puck/routes.d.ts +12 -0
  229. package/dist/puck/routes.js +11 -0
  230. package/dist/puck/slotConfig.d.ts +1 -1
  231. package/dist/puck/slotConfig.js +2 -2
  232. package/dist/results/aggregate.js +4 -3
  233. package/dist/results/analyse.d.ts +4 -1
  234. package/dist/results/analyse.js +27 -11
  235. package/dist/results/cuped.js +3 -2
  236. package/dist/results/identityCredit.d.ts +15 -7
  237. package/dist/results/identityCredit.js +32 -33
  238. package/dist/results/rolloutUnits.js +2 -1
  239. package/dist/results/snapshot.js +8 -2
  240. package/dist/results/srm.js +2 -1
  241. package/dist/sanitizeReadinessDetail.d.ts +7 -0
  242. package/dist/sanitizeReadinessDetail.js +63 -0
  243. package/dist/server/linkIdentity.d.ts +10 -1
  244. package/dist/server/linkIdentity.js +17 -15
  245. package/dist/server/metadata.d.ts +5 -0
  246. package/dist/server/metadata.js +18 -3
  247. package/dist/server/normaliseContentRelationships.d.ts +7 -0
  248. package/dist/server/normaliseContentRelationships.js +62 -0
  249. package/dist/server/recordContentChange.d.ts +1 -1
  250. package/dist/server/recordContentChange.js +17 -8
  251. package/dist/server/runResults.d.ts +3 -2
  252. package/dist/server/runResults.js +157 -35
  253. package/dist/targeting/values.d.ts +4 -0
  254. package/dist/targeting/values.js +10 -0
  255. package/dist/transitions/addMetric.js +8 -0
  256. package/dist/transitions/archive.js +2 -3
  257. package/dist/transitions/checkStart.d.ts +10 -3
  258. package/dist/transitions/checkStart.js +25 -0
  259. package/dist/transitions/contentFields.d.ts +7 -0
  260. package/dist/transitions/contentFields.js +20 -0
  261. package/dist/transitions/decide.js +22 -2
  262. package/dist/transitions/dismissContentEntry.d.ts +8 -0
  263. package/dist/transitions/dismissContentEntry.js +45 -0
  264. package/dist/transitions/makeContent.d.ts +5 -2
  265. package/dist/transitions/makeContent.js +217 -118
  266. package/dist/transitions/phaseRecord.d.ts +8 -2
  267. package/dist/transitions/placements.d.ts +3 -6
  268. package/dist/transitions/placements.js +12 -1
  269. package/dist/transitions/preflightData.d.ts +9 -1
  270. package/dist/transitions/preflightData.js +138 -20
  271. package/dist/transitions/releasePages.d.ts +8 -0
  272. package/dist/transitions/releasePages.js +26 -0
  273. package/dist/transitions/restoreContentEntry.d.ts +8 -0
  274. package/dist/transitions/restoreContentEntry.js +47 -0
  275. package/dist/transitions/start.js +62 -7
  276. package/dist/types/contracts.d.ts +24 -4
  277. package/dist/types/endpoints.d.ts +34 -3
  278. package/dist/types/index.d.ts +1 -0
  279. package/dist/types/index.js +1 -0
  280. package/dist/types/reasons.d.ts +3 -0
  281. package/dist/types/reasons.js +1 -0
  282. package/dist/types/snapshot.d.ts +6 -1
  283. package/dist/ui/Banner.d.ts +2 -0
  284. package/dist/ui/Banner.js +2 -0
  285. package/dist/ui/Breadcrumb.d.ts +7 -0
  286. package/dist/ui/Breadcrumb.js +25 -0
  287. package/dist/ui/Button.d.ts +15 -0
  288. package/dist/ui/Button.js +32 -0
  289. package/dist/ui/Card.d.ts +12 -0
  290. package/dist/ui/Card.js +40 -0
  291. package/dist/ui/Checkbox.d.ts +2 -0
  292. package/dist/ui/Checkbox.js +2 -0
  293. package/dist/{admin/components → ui}/ChipsInput.d.ts +4 -3
  294. package/dist/{admin/components → ui}/ChipsInput.js +20 -12
  295. package/dist/ui/Dialog.d.ts +13 -0
  296. package/dist/ui/Dialog.js +85 -0
  297. package/dist/ui/EmptyState.d.ts +2 -0
  298. package/dist/ui/EmptyState.js +2 -0
  299. package/dist/ui/Feedback.d.ts +24 -0
  300. package/dist/ui/Feedback.js +40 -0
  301. package/dist/ui/Inputs.d.ts +34 -0
  302. package/dist/ui/Inputs.js +225 -0
  303. package/dist/ui/NumberInput.d.ts +2 -0
  304. package/dist/ui/NumberInput.js +2 -0
  305. package/dist/ui/Range.d.ts +2 -0
  306. package/dist/ui/Range.js +2 -0
  307. package/dist/ui/SearchInput.d.ts +2 -0
  308. package/dist/ui/SearchInput.js +2 -0
  309. package/dist/ui/SectionCard.d.ts +2 -0
  310. package/dist/ui/SectionCard.js +2 -0
  311. package/dist/ui/Select.d.ts +2 -0
  312. package/dist/ui/Select.js +2 -0
  313. package/dist/ui/StatusChip.d.ts +2 -0
  314. package/dist/ui/StatusChip.js +2 -0
  315. package/dist/ui/Tabs.d.ts +16 -0
  316. package/dist/ui/Tabs.js +61 -0
  317. package/dist/ui/TextInput.d.ts +2 -0
  318. package/dist/ui/TextInput.js +2 -0
  319. package/dist/ui/Textarea.d.ts +2 -0
  320. package/dist/ui/Textarea.js +2 -0
  321. package/dist/ui/Toggle.d.ts +2 -0
  322. package/dist/ui/Toggle.js +2 -0
  323. package/dist/ui/accent.d.ts +40 -0
  324. package/dist/ui/accent.js +139 -0
  325. package/dist/ui/index.d.ts +9 -0
  326. package/dist/ui/index.js +9 -0
  327. package/dist/ui/ui.css +92 -0
  328. package/package.json +5 -2
  329. package/dist/admin/components/chipsInput.css +0 -11
  330. package/dist/admin/results/ArmTable.d.ts +0 -8
  331. package/dist/admin/results/ArmTable.js +0 -113
  332. package/dist/admin/results/VerdictCard.d.ts +0 -9
  333. package/dist/admin/surface/goals/GoalsBreadcrumb.d.ts +0 -5
  334. package/dist/admin/surface/goals/GoalsBreadcrumb.js +0 -47
  335. package/dist/admin/surface/test/TestHeader.d.ts +0 -4
  336. package/dist/admin/surface/test/TestHeader.js +0 -70
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import './ui.css';
3
+ export function Breadcrumb({ items }) {
4
+ return /*#__PURE__*/ _jsx("nav", {
5
+ className: "xp-ui-breadcrumb",
6
+ "aria-label": "Breadcrumb",
7
+ children: /*#__PURE__*/ _jsx("ol", {
8
+ children: items.map((item, index)=>/*#__PURE__*/ _jsxs("li", {
9
+ children: [
10
+ index ? /*#__PURE__*/ _jsx("span", {
11
+ "aria-hidden": "true",
12
+ children: "›"
13
+ }) : null,
14
+ index === items.length - 1 ? /*#__PURE__*/ _jsx("span", {
15
+ "aria-current": "page",
16
+ children: item.label
17
+ }) : /*#__PURE__*/ _jsx("a", {
18
+ href: item.href,
19
+ children: item.label
20
+ })
21
+ ]
22
+ }, index))
23
+ })
24
+ });
25
+ }
@@ -0,0 +1,15 @@
1
+ import type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react';
2
+ import './ui.css';
3
+ type Shared = {
4
+ variant?: 'primary' | 'secondary' | 'quiet' | 'link' | 'danger';
5
+ size?: 'md' | 'sm';
6
+ disabled?: boolean;
7
+ busy?: boolean;
8
+ };
9
+ export type ButtonProps = Shared & (ButtonHTMLAttributes<HTMLButtonElement> & {
10
+ href?: never;
11
+ } | AnchorHTMLAttributes<HTMLAnchorElement> & {
12
+ href: string;
13
+ });
14
+ export declare function Button({ variant, size, disabled, busy, className, children, ...props }: ButtonProps): import("react").JSX.Element;
15
+ export {};
@@ -0,0 +1,32 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import './ui.css';
4
+ export function Button({ variant = 'secondary', size = 'md', disabled, busy, className = '', children, ...props }) {
5
+ const classes = `xp-ui-button xp-ui-button--${variant} xp-ui-button--${size} ${className}`;
6
+ const blocked = disabled || busy;
7
+ if (props.href !== undefined) {
8
+ const { href, onClick, ...rest } = props;
9
+ return /*#__PURE__*/ _jsx("a", {
10
+ ...rest,
11
+ className: classes,
12
+ href: blocked ? undefined : href,
13
+ role: blocked ? 'link' : undefined,
14
+ "aria-disabled": blocked || undefined,
15
+ "aria-busy": busy || undefined,
16
+ tabIndex: blocked ? -1 : rest.tabIndex,
17
+ onClick: (event)=>{
18
+ if (blocked) event.preventDefault();
19
+ else onClick?.(event);
20
+ },
21
+ children: children
22
+ });
23
+ }
24
+ return /*#__PURE__*/ _jsx("button", {
25
+ ...props,
26
+ type: props.type ?? 'button',
27
+ className: classes,
28
+ disabled: blocked,
29
+ "aria-busy": busy || undefined,
30
+ children: children
31
+ });
32
+ }
@@ -0,0 +1,12 @@
1
+ import type { HTMLAttributes, ReactNode } from 'react';
2
+ import './ui.css';
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 }: {
5
+ number: number;
6
+ title: string;
7
+ complete?: boolean;
8
+ children: ReactNode;
9
+ id?: string;
10
+ headingId?: string;
11
+ className?: string;
12
+ }): import("react").JSX.Element;
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import './ui.css';
3
+ export function Card({ className = '', ...props }) {
4
+ return /*#__PURE__*/ _jsx("div", {
5
+ ...props,
6
+ className: `xp-ui-card ${className}`
7
+ });
8
+ }
9
+ export function SectionCard({ number, title, complete = false, children, id, headingId, className = '' }) {
10
+ return /*#__PURE__*/ _jsxs("section", {
11
+ id: id,
12
+ "aria-labelledby": headingId,
13
+ className: `xp-ui-card xp-ui-section ${className}`,
14
+ children: [
15
+ /*#__PURE__*/ _jsxs("header", {
16
+ className: "xp-ui-section-head",
17
+ children: [
18
+ /*#__PURE__*/ _jsx("span", {
19
+ className: "xp-ui-section-number",
20
+ children: number
21
+ }),
22
+ /*#__PURE__*/ _jsx("h2", {
23
+ id: headingId,
24
+ tabIndex: -1,
25
+ children: title
26
+ }),
27
+ /*#__PURE__*/ _jsx("span", {
28
+ className: "xp-ui-section-complete",
29
+ "aria-label": complete ? 'Complete' : 'Incomplete',
30
+ children: complete ? '✓' : '○'
31
+ })
32
+ ]
33
+ }),
34
+ /*#__PURE__*/ _jsx("div", {
35
+ className: "xp-ui-section-body",
36
+ children: children
37
+ })
38
+ ]
39
+ });
40
+ }
@@ -0,0 +1,2 @@
1
+ import './ui.css';
2
+ export { Checkbox, CheckboxList } from './Inputs.js';
@@ -0,0 +1,2 @@
1
+ import './ui.css';
2
+ export { Checkbox, CheckboxList } from './Inputs.js';
@@ -1,12 +1,13 @@
1
- import '../theme.css';
2
- import './chipsInput.css';
1
+ import './ui.css';
3
2
  export interface ChipsInputProps {
4
3
  value: string[];
5
4
  onChange: (value: string[]) => void;
6
5
  label: string;
7
6
  description?: string;
7
+ help?: string;
8
+ error?: string;
8
9
  placeholder?: string;
9
10
  disabled?: boolean;
10
11
  id: string;
11
12
  }
12
- export declare function ChipsInput({ value, onChange, label, description, placeholder, disabled, id }: ChipsInputProps): import("react").JSX.Element;
13
+ export declare function ChipsInput({ value, onChange, label, description, help, error, placeholder, disabled, id }: ChipsInputProps): import("react").JSX.Element;
@@ -1,10 +1,8 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useRef, useState } from 'react';
4
- import { AUDIENCE_COPY } from '../copy/audience.js';
5
- import '../theme.css';
6
- import './chipsInput.css';
7
- export function ChipsInput({ value, onChange, label, description, placeholder, disabled = false, id }) {
4
+ import './ui.css';
5
+ export function ChipsInput({ value, onChange, label, description, help = description, error, placeholder, disabled = false, id }) {
8
6
  const [draft, setDraft] = useState('');
9
7
  const input = useRef(null);
10
8
  const commit = (text)=>{
@@ -24,7 +22,7 @@ export function ChipsInput({ value, onChange, label, description, placeholder, d
24
22
  input.current?.focus();
25
23
  };
26
24
  return /*#__PURE__*/ _jsxs("div", {
27
- className: "xp-chips",
25
+ className: "xp-ui-chips",
28
26
  role: "group",
29
27
  "aria-labelledby": `${id}-label`,
30
28
  "aria-disabled": disabled,
@@ -35,10 +33,10 @@ export function ChipsInput({ value, onChange, label, description, placeholder, d
35
33
  children: label
36
34
  }),
37
35
  /*#__PURE__*/ _jsxs("div", {
38
- className: "xp-chips-control",
36
+ className: `xp-ui-chips-control${error ? ' xp-ui-chips-control--invalid' : ''}`,
39
37
  children: [
40
38
  value.map((item, index)=>/*#__PURE__*/ _jsxs("span", {
41
- className: "xp-chips-item",
39
+ className: "xp-ui-chips-item",
42
40
  children: [
43
41
  /*#__PURE__*/ _jsx("span", {
44
42
  children: item
@@ -46,9 +44,9 @@ export function ChipsInput({ value, onChange, label, description, placeholder, d
46
44
  /*#__PURE__*/ _jsx("button", {
47
45
  type: "button",
48
46
  disabled: disabled,
49
- "aria-label": AUDIENCE_COPY.removeValue(item),
47
+ "aria-label": `Remove ${item}`,
50
48
  onClick: ()=>remove(index),
51
- children: AUDIENCE_COPY.removeSymbol
49
+ children: '×'
52
50
  })
53
51
  ]
54
52
  }, item)),
@@ -59,7 +57,11 @@ export function ChipsInput({ value, onChange, label, description, placeholder, d
59
57
  value: draft,
60
58
  disabled: disabled,
61
59
  placeholder: placeholder,
62
- "aria-describedby": description ? `${id}-description` : undefined,
60
+ "aria-invalid": Boolean(error) || undefined,
61
+ "aria-describedby": [
62
+ help ? `${id}-description` : '',
63
+ error ? `${id}-error` : ''
64
+ ].filter(Boolean).join(' ') || undefined,
63
65
  onChange: (event)=>setDraft(event.target.value),
64
66
  onBlur: ()=>{
65
67
  if (draft.trim()) commit(draft);
@@ -87,9 +89,15 @@ export function ChipsInput({ value, onChange, label, description, placeholder, d
87
89
  })
88
90
  ]
89
91
  }),
90
- description ? /*#__PURE__*/ _jsx("p", {
92
+ help ? /*#__PURE__*/ _jsx("p", {
91
93
  id: `${id}-description`,
92
- children: description
94
+ children: help
95
+ }) : null,
96
+ error ? /*#__PURE__*/ _jsx("p", {
97
+ className: "xp-ui-error",
98
+ id: `${id}-error`,
99
+ role: "alert",
100
+ children: error
93
101
  }) : null
94
102
  ]
95
103
  });
@@ -0,0 +1,13 @@
1
+ import type { ReactNode } from 'react';
2
+ import './ui.css';
3
+ /** Native modal stays in its rendering document, including a Puck canvas iframe.
4
+ * `initialFocus="cancel"` targets the focusable control marked `data-dialog-cancel`.
5
+ */
6
+ export declare function Dialog({ open, title, onClose, children, dismissible, initialFocus }: {
7
+ open: boolean;
8
+ dismissible?: boolean;
9
+ initialFocus?: 'cancel';
10
+ title: string;
11
+ onClose: () => void;
12
+ children: ReactNode;
13
+ }): import("react").JSX.Element;
@@ -0,0 +1,85 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useId, useRef } from 'react';
4
+ import './ui.css';
5
+ function focusable(node) {
6
+ return [
7
+ ...node.querySelectorAll('button, a[href], input, select, textarea, [tabindex]')
8
+ ].filter((el)=>{
9
+ if (el.tabIndex < 0 || el.matches(':disabled, input[type="hidden"]') || el.closest('[hidden], [inert]') || el.getAttribute('aria-disabled') === 'true') return false;
10
+ for(let parent = el; parent && parent !== node; parent = parent.parentElement){
11
+ const style = node.ownerDocument.defaultView?.getComputedStyle(parent);
12
+ if (style?.display === 'none' || style?.visibility === 'hidden' || style?.visibility === 'collapse') return false;
13
+ }
14
+ return true;
15
+ });
16
+ }
17
+ /** Native modal stays in its rendering document, including a Puck canvas iframe.
18
+ * `initialFocus="cancel"` targets the focusable control marked `data-dialog-cancel`.
19
+ */ export function Dialog({ open, title, onClose, children, dismissible = true, initialFocus }) {
20
+ const ref = useRef(null);
21
+ const heading = useId();
22
+ const closeRequested = useRef(false);
23
+ const requestClose = ()=>{
24
+ if (!open || !dismissible || closeRequested.current) return;
25
+ closeRequested.current = true;
26
+ onClose();
27
+ };
28
+ useEffect(()=>{
29
+ const node = ref.current;
30
+ if (!node || !open) return;
31
+ const doc = node.ownerDocument;
32
+ const previous = doc.activeElement;
33
+ closeRequested.current = false;
34
+ node.showModal();
35
+ const elements = focusable(node);
36
+ const preferred = initialFocus === 'cancel' ? elements.find((element)=>element.hasAttribute('data-dialog-cancel')) : undefined;
37
+ (preferred ?? elements[0] ?? node).focus();
38
+ return ()=>{
39
+ node.close();
40
+ if (previous?.isConnected) previous.focus();
41
+ };
42
+ }, [
43
+ open,
44
+ initialFocus
45
+ ]);
46
+ return /*#__PURE__*/ _jsxs("dialog", {
47
+ ref: ref,
48
+ "aria-labelledby": heading,
49
+ className: "xp-ui-dialog",
50
+ tabIndex: -1,
51
+ onCancel: (event)=>{
52
+ event.preventDefault();
53
+ requestClose();
54
+ },
55
+ onKeyDown: (event)=>{
56
+ if (event.defaultPrevented) return;
57
+ if (event.key === 'Escape') {
58
+ event.preventDefault();
59
+ requestClose();
60
+ return;
61
+ }
62
+ if (event.key !== 'Tab') return;
63
+ const node = event.currentTarget;
64
+ const elements = focusable(node);
65
+ const first = elements[0], last = elements.at(-1), active = node.ownerDocument.activeElement;
66
+ if (!first) {
67
+ event.preventDefault();
68
+ node.focus();
69
+ } else if (event.shiftKey && (active === first || active === node)) {
70
+ event.preventDefault();
71
+ last?.focus();
72
+ } else if (!event.shiftKey && (active === last || active === node)) {
73
+ event.preventDefault();
74
+ first.focus();
75
+ }
76
+ },
77
+ children: [
78
+ /*#__PURE__*/ _jsx("h2", {
79
+ id: heading,
80
+ children: title
81
+ }),
82
+ children
83
+ ]
84
+ });
85
+ }
@@ -0,0 +1,2 @@
1
+ import './ui.css';
2
+ export { EmptyState } from './Feedback.js';
@@ -0,0 +1,2 @@
1
+ import './ui.css';
2
+ export { EmptyState } from './Feedback.js';
@@ -0,0 +1,24 @@
1
+ import type { ReactNode } from 'react';
2
+ import './ui.css';
3
+ export declare const statusLabels: {
4
+ readonly draft: "Draft";
5
+ readonly ready: "Ready";
6
+ readonly running: "Running";
7
+ readonly 'needs-attention': "Needs attention";
8
+ readonly decided: "Decided";
9
+ readonly archived: "Archived";
10
+ readonly stopped: "Stopped";
11
+ };
12
+ export type UIStatus = keyof typeof statusLabels;
13
+ export declare function StatusChip({ status }: {
14
+ status: UIStatus;
15
+ }): import("react").JSX.Element;
16
+ export declare function Banner({ tone, children, action }: {
17
+ tone?: 'info' | 'warning' | 'error';
18
+ children: ReactNode;
19
+ action?: ReactNode;
20
+ }): import("react").JSX.Element;
21
+ export declare function EmptyState({ children, action }: {
22
+ children: ReactNode;
23
+ action: ReactNode;
24
+ }): import("react").JSX.Element;
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import './ui.css';
3
+ export const statusLabels = {
4
+ draft: 'Draft',
5
+ ready: 'Ready',
6
+ running: 'Running',
7
+ 'needs-attention': 'Needs attention',
8
+ decided: 'Decided',
9
+ archived: 'Archived',
10
+ stopped: 'Stopped'
11
+ };
12
+ export function StatusChip({ status }) {
13
+ return /*#__PURE__*/ _jsx("span", {
14
+ className: `xp-ui-status xp-ui-status--${status}`,
15
+ children: statusLabels[status]
16
+ });
17
+ }
18
+ export function Banner({ tone = 'info', children, action }) {
19
+ return /*#__PURE__*/ _jsxs("div", {
20
+ className: `xp-ui-banner xp-ui-banner--${tone}`,
21
+ role: tone === 'error' ? 'alert' : 'status',
22
+ children: [
23
+ /*#__PURE__*/ _jsx("p", {
24
+ children: children
25
+ }),
26
+ action
27
+ ]
28
+ });
29
+ }
30
+ export function EmptyState({ children, action }) {
31
+ return /*#__PURE__*/ _jsxs("div", {
32
+ className: "xp-ui-empty",
33
+ children: [
34
+ /*#__PURE__*/ _jsx("p", {
35
+ children: children
36
+ }),
37
+ action
38
+ ]
39
+ });
40
+ }
@@ -0,0 +1,34 @@
1
+ import type { InputHTMLAttributes, SelectHTMLAttributes, TextareaHTMLAttributes, ReactNode } from 'react';
2
+ import './ui.css';
3
+ export interface FieldProps {
4
+ id: string;
5
+ label: string;
6
+ help?: string;
7
+ error?: string;
8
+ }
9
+ export type TextInputProps = FieldProps & Omit<InputHTMLAttributes<HTMLInputElement>, 'id'>;
10
+ export declare function TextInput({ label, help, error, className, ...props }: TextInputProps): import("react").JSX.Element;
11
+ export declare function NumberInput(props: TextInputProps): import("react").JSX.Element;
12
+ export declare function SearchInput(props: TextInputProps): import("react").JSX.Element;
13
+ export type SelectProps = FieldProps & {
14
+ labelAction?: ReactNode;
15
+ } & Omit<SelectHTMLAttributes<HTMLSelectElement>, 'id'>;
16
+ export declare function Select({ label, labelAction, help, error, className, ...props }: SelectProps): import("react").JSX.Element;
17
+ export declare function Toggle({ label, help, error, className, ...props }: Omit<TextInputProps, 'type'>): import("react").JSX.Element;
18
+ export type TextareaProps = FieldProps & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'>;
19
+ export declare function Textarea({ label, help, error, className, ...props }: TextareaProps): import("react").JSX.Element;
20
+ export declare function Checkbox({ label, help, error, className, ...props }: Omit<TextInputProps, 'type'>): import("react").JSX.Element;
21
+ export interface CheckboxListProps extends FieldProps {
22
+ children?: ReactNode;
23
+ value: readonly string[];
24
+ options: readonly {
25
+ value: string;
26
+ label: string;
27
+ disabled?: boolean;
28
+ }[];
29
+ onChange: (value: string[]) => void;
30
+ disabled?: boolean;
31
+ 'aria-describedby'?: string;
32
+ }
33
+ export declare function CheckboxList({ value, options, onChange, disabled, children, ...field }: CheckboxListProps): import("react").JSX.Element;
34
+ export declare function Range({ label, help, error, className, ...props }: Omit<TextInputProps, 'type'>): import("react").JSX.Element;
@@ -0,0 +1,225 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import './ui.css';
4
+ function described(props, extra) {
5
+ return [
6
+ extra,
7
+ props.help ? `${props.id}-help` : '',
8
+ props.error ? `${props.id}-error` : ''
9
+ ].filter(Boolean).join(' ') || undefined;
10
+ }
11
+ function Field({ id, label, labelAction, help, error, children }) {
12
+ return /*#__PURE__*/ _jsxs("div", {
13
+ className: "xp-ui-field",
14
+ children: [
15
+ labelAction ? /*#__PURE__*/ _jsxs("div", {
16
+ className: "xp-ui-field-label",
17
+ children: [
18
+ /*#__PURE__*/ _jsx("label", {
19
+ htmlFor: id,
20
+ children: label
21
+ }),
22
+ labelAction
23
+ ]
24
+ }) : /*#__PURE__*/ _jsx("label", {
25
+ htmlFor: id,
26
+ children: label
27
+ }),
28
+ children,
29
+ help ? /*#__PURE__*/ _jsx("p", {
30
+ className: "xp-ui-help",
31
+ id: `${id}-help`,
32
+ children: help
33
+ }) : null,
34
+ error ? /*#__PURE__*/ _jsx("p", {
35
+ className: "xp-ui-error",
36
+ id: `${id}-error`,
37
+ role: "alert",
38
+ children: error
39
+ }) : null
40
+ ]
41
+ });
42
+ }
43
+ export function TextInput({ label, help, error, className = '', ...props }) {
44
+ const field = {
45
+ id: props.id,
46
+ label,
47
+ help,
48
+ error
49
+ };
50
+ return /*#__PURE__*/ _jsx(Field, {
51
+ ...field,
52
+ children: /*#__PURE__*/ _jsx("input", {
53
+ ...props,
54
+ className: `xp-ui-input ${className}`,
55
+ "aria-invalid": Boolean(error) || undefined,
56
+ "aria-describedby": described(field, props['aria-describedby'])
57
+ })
58
+ });
59
+ }
60
+ export function NumberInput(props) {
61
+ return /*#__PURE__*/ _jsx(TextInput, {
62
+ ...props,
63
+ type: "number",
64
+ className: `xp-ui-input--number ${props.className ?? ''}`
65
+ });
66
+ }
67
+ export function SearchInput(props) {
68
+ return /*#__PURE__*/ _jsx(TextInput, {
69
+ ...props,
70
+ type: "search"
71
+ });
72
+ }
73
+ export function Select({ label, labelAction, help, error, className = '', ...props }) {
74
+ const field = {
75
+ id: props.id,
76
+ label,
77
+ help,
78
+ error
79
+ };
80
+ return /*#__PURE__*/ _jsx(Field, {
81
+ ...field,
82
+ labelAction: labelAction,
83
+ children: /*#__PURE__*/ _jsx("select", {
84
+ ...props,
85
+ className: `xp-ui-input xp-ui-select ${className}`,
86
+ "aria-invalid": Boolean(error) || undefined,
87
+ "aria-describedby": described(field, props['aria-describedby'])
88
+ })
89
+ });
90
+ }
91
+ export function Toggle({ label, help, error, className = '', ...props }) {
92
+ const field = {
93
+ id: props.id,
94
+ label,
95
+ help,
96
+ error
97
+ };
98
+ return /*#__PURE__*/ _jsx(Field, {
99
+ ...field,
100
+ children: /*#__PURE__*/ _jsx("input", {
101
+ ...props,
102
+ type: "checkbox",
103
+ role: "switch",
104
+ className: `xp-ui-toggle ${className}`,
105
+ "aria-invalid": Boolean(error) || undefined,
106
+ "aria-describedby": described(field, props['aria-describedby']),
107
+ onKeyDown: (event)=>{
108
+ props.onKeyDown?.(event);
109
+ if (event.key === ' ' && !event.defaultPrevented && !props.disabled) {
110
+ event.preventDefault();
111
+ event.currentTarget.click();
112
+ }
113
+ }
114
+ })
115
+ });
116
+ }
117
+ export function Textarea({ label, help, error, className = '', ...props }) {
118
+ const field = {
119
+ id: props.id,
120
+ label,
121
+ help,
122
+ error
123
+ };
124
+ return /*#__PURE__*/ _jsx(Field, {
125
+ ...field,
126
+ children: /*#__PURE__*/ _jsx("textarea", {
127
+ ...props,
128
+ className: `xp-ui-input xp-ui-textarea ${className}`,
129
+ "aria-invalid": Boolean(error) || undefined,
130
+ "aria-describedby": described(field, props['aria-describedby'])
131
+ })
132
+ });
133
+ }
134
+ export function Checkbox({ label, help, error, className = '', ...props }) {
135
+ const field = {
136
+ id: props.id,
137
+ label,
138
+ help,
139
+ error
140
+ };
141
+ return /*#__PURE__*/ _jsxs("div", {
142
+ className: "xp-ui-field",
143
+ children: [
144
+ /*#__PURE__*/ _jsxs("label", {
145
+ className: "xp-ui-checkbox-label",
146
+ htmlFor: props.id,
147
+ children: [
148
+ /*#__PURE__*/ _jsx("input", {
149
+ ...props,
150
+ type: "checkbox",
151
+ className: `xp-ui-checkbox ${className}`,
152
+ "aria-invalid": Boolean(error) || props['aria-invalid'] || undefined,
153
+ "aria-describedby": described(field, props['aria-describedby'])
154
+ }),
155
+ label
156
+ ]
157
+ }),
158
+ help ? /*#__PURE__*/ _jsx("p", {
159
+ className: "xp-ui-help",
160
+ id: `${props.id}-help`,
161
+ children: help
162
+ }) : null,
163
+ error ? /*#__PURE__*/ _jsx("p", {
164
+ className: "xp-ui-error",
165
+ id: `${props.id}-error`,
166
+ role: "alert",
167
+ children: error
168
+ }) : null
169
+ ]
170
+ });
171
+ }
172
+ export function CheckboxList({ value, options, onChange, disabled, children, ...field }) {
173
+ return /*#__PURE__*/ _jsxs("fieldset", {
174
+ id: field.id,
175
+ className: "xp-ui-field xp-ui-checkbox-list",
176
+ disabled: disabled,
177
+ "aria-invalid": Boolean(field.error) || undefined,
178
+ "aria-describedby": described(field, field['aria-describedby']),
179
+ children: [
180
+ /*#__PURE__*/ _jsx("legend", {
181
+ children: field.label
182
+ }),
183
+ children,
184
+ options.map((option, index)=>/*#__PURE__*/ _jsx(Checkbox, {
185
+ id: `${field.id}-${index}`,
186
+ label: option.label,
187
+ checked: value.includes(option.value),
188
+ disabled: disabled || option.disabled,
189
+ onChange: (event)=>onChange(event.target.checked ? [
190
+ ...value,
191
+ option.value
192
+ ] : value.filter((item)=>item !== option.value))
193
+ }, option.value)),
194
+ field.help ? /*#__PURE__*/ _jsx("p", {
195
+ className: "xp-ui-help",
196
+ id: `${field.id}-help`,
197
+ children: field.help
198
+ }) : null,
199
+ field.error ? /*#__PURE__*/ _jsx("p", {
200
+ className: "xp-ui-error",
201
+ id: `${field.id}-error`,
202
+ role: "alert",
203
+ children: field.error
204
+ }) : null
205
+ ]
206
+ });
207
+ }
208
+ export function Range({ label, help, error, className = '', ...props }) {
209
+ const field = {
210
+ id: props.id,
211
+ label,
212
+ help,
213
+ error
214
+ };
215
+ return /*#__PURE__*/ _jsx(Field, {
216
+ ...field,
217
+ children: /*#__PURE__*/ _jsx("input", {
218
+ ...props,
219
+ type: "range",
220
+ className: `xp-ui-range ${className}`,
221
+ "aria-invalid": Boolean(error) || undefined,
222
+ "aria-describedby": described(field, props['aria-describedby'])
223
+ })
224
+ });
225
+ }
@@ -0,0 +1,2 @@
1
+ import './ui.css';
2
+ export { NumberInput } from './Inputs.js';