slice-machine-ui 2.3.1-beta.6 → 2.3.1-beta.8

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 (49) hide show
  1. package/out/404.html +1 -1
  2. package/out/_next/static/{BYX3lrf2WNCjipk8J_g8B → 4OywHdm4ktJ4KP6dpPtdt}/_buildManifest.js +1 -1
  3. package/out/_next/static/chunks/{18539003-059b491c0b76757a.js → 18539003-8429c4c48ccee432.js} +15 -15
  4. package/out/_next/static/chunks/448-04106caae9b8c06f.js +1 -0
  5. package/out/_next/static/chunks/574-05cd6a55733bfa63.js +1 -0
  6. package/out/_next/static/chunks/{802-72ceb03e414202ee.js → 802-0be9bb20fc0d40d4.js} +1 -1
  7. package/out/_next/static/chunks/pages/{_app-d1a873a080e65564.js → _app-917a74cd103f816b.js} +64 -64
  8. package/out/_next/static/chunks/pages/{changelog-cbafb05b25714889.js → changelog-40f8a853383eb4e7.js} +1 -1
  9. package/out/_next/static/chunks/pages/{changes-5b897a4267b76a20.js → changes-b8bf02c66be6ae1f.js} +1 -1
  10. package/out/_next/static/chunks/pages/{labs-445e30efa64531d0.js → labs-8c10ebf645f94206.js} +1 -1
  11. package/out/_next/static/chunks/pages/{settings-0c5d282867dc559a.js → settings-450b9f78216aa406.js} +1 -1
  12. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-ce1390f846a94d24.js +1 -0
  13. package/out/_next/static/chunks/pages/{slices-cc1865f601dca9df.js → slices-e13ad016b19446e7.js} +1 -1
  14. package/out/_next/static/css/df83243fff0d6412.css +1 -0
  15. package/out/changelog.html +1 -1
  16. package/out/changes.html +1 -1
  17. package/out/custom-types/[customTypeId].html +1 -1
  18. package/out/custom-types.html +1 -1
  19. package/out/index.html +1 -1
  20. package/out/labs.html +1 -1
  21. package/out/page-types/[pageTypeId].html +1 -1
  22. package/out/settings.html +1 -1
  23. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  24. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  25. package/out/slices.html +1 -1
  26. package/package.json +7 -6
  27. package/src/features/builder/AddFieldDropdown.tsx +5 -1
  28. package/src/features/onboarding/OnboardingGuide/OnboardingGuide.module.css +21 -0
  29. package/src/features/onboarding/OnboardingGuide/OnboardingGuide.module.css.d.ts +8 -0
  30. package/src/features/onboarding/OnboardingGuide/OnboardingGuide.tsx +90 -0
  31. package/src/features/onboarding/OnboardingGuide/index.ts +1 -0
  32. package/src/features/onboarding/OnboardingProgressStepper.tsx +3 -1
  33. package/src/features/onboarding/OnboardingProvider.tsx +10 -1
  34. package/src/features/onboarding/OnboardingStepDialog/OnboardingStepDialog.tsx +8 -5
  35. package/src/features/settings/git/GitRepositoryConnectDialog.tsx +19 -15
  36. package/src/features/settings/git/GitRepositoryDisconnectDialog.tsx +14 -12
  37. package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewSliceDialog.tsx +13 -10
  38. package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx +15 -10
  39. package/src/features/slices/convertLegacySlice/ConvertLegacySliceMergeWithIdenticalDialog.tsx +13 -10
  40. package/src/legacy/components/ChangesItems/DevCollaborationExperiment.tsx +12 -9
  41. package/src/legacy/components/DeleteVariationModal/index.tsx +14 -11
  42. package/src/legacy/components/Forms/RenameVariationModal/RenameVariationModal.tsx +13 -10
  43. package/src/legacy/lib/builders/SliceBuilder/FieldZones/index.tsx +8 -8
  44. package/out/_next/static/chunks/448-183e650f05037eef.js +0 -1
  45. package/out/_next/static/chunks/574-1a2168b3d4479624.js +0 -1
  46. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-628fd7717e5e7678.js +0 -1
  47. package/out/_next/static/css/fbc38696c23ee168.css +0 -1
  48. package/src/features/onboarding/OnboardingGuide.tsx +0 -55
  49. /package/out/_next/static/{BYX3lrf2WNCjipk8J_g8B → 4OywHdm4ktJ4KP6dpPtdt}/_ssgManifest.js +0 -0
@@ -0,0 +1,21 @@
1
+ .container {
2
+ overflow: hidden;
3
+ position: relative;
4
+ }
5
+
6
+ .confettiCannon {
7
+ position: absolute;
8
+ bottom: 0;
9
+ left: 0;
10
+ }
11
+
12
+ .visible {
13
+ opacity: 1;
14
+ }
15
+
16
+ .invisible {
17
+ opacity: 0;
18
+ /* A delay of 2s gives room for a 3s confetti animation to happen and then
19
+ fade out while the it's ending */
20
+ transition: opacity 500ms linear 2s;
21
+ }
@@ -0,0 +1,8 @@
1
+ declare const styles: {
2
+ readonly "confettiCannon": string;
3
+ readonly "container": string;
4
+ readonly "invisible": string;
5
+ readonly "visible": string;
6
+ };
7
+ export = styles;
8
+
@@ -0,0 +1,90 @@
1
+ import {
2
+ Card,
3
+ CardContent,
4
+ ProgressBar,
5
+ Text,
6
+ useMediaQuery,
7
+ } from "@prismicio/editor-ui";
8
+ import { confetti as fireConfetti, ConfettiConfig } from "dom-confetti";
9
+ import { useRef, useState } from "react";
10
+
11
+ import { OnboardingProgressStepper } from "@/features/onboarding/OnboardingProgressStepper";
12
+ import {
13
+ OnboardingProvider,
14
+ useOnboardingContext,
15
+ } from "@/features/onboarding/OnboardingProvider";
16
+ import { useOnboardingExperiment } from "@/features/onboarding/useOnboardingExperiment";
17
+
18
+ import styles from "./OnboardingGuide.module.css";
19
+
20
+ const OnboardingGuideCard = () => {
21
+ const { steps, completedStepCount, isComplete } = useOnboardingContext();
22
+ const isVisible = useMediaQuery({ min: "medium" });
23
+
24
+ if (!isVisible) return null;
25
+
26
+ return (
27
+ <div className={isComplete ? styles.invisible : styles.visible}>
28
+ <Card color="grey2" variant="outlined" paddingBlock={16}>
29
+ <CardContent>
30
+ <div>
31
+ <Text variant="bold" color="grey12">
32
+ Build a page in {steps.length} steps
33
+ </Text>
34
+ <Text color="grey11" variant="small">
35
+ Render a live page with content coming from Prismic
36
+ </Text>
37
+ </div>
38
+ <ProgressBar
39
+ value={completedStepCount}
40
+ max={steps.length}
41
+ displayLabel
42
+ getValueLabel={(value, max) => `${value}/${max}`}
43
+ />
44
+ <OnboardingProgressStepper />
45
+ </CardContent>
46
+ </Card>
47
+ </div>
48
+ );
49
+ };
50
+
51
+ const confettiConfig: ConfettiConfig = {
52
+ colors: ["#8E44EC", "#E8C7FF", "#59B5F8", "#C3EEFE"],
53
+ elementCount: 300,
54
+ width: "8px",
55
+ height: "8px",
56
+ stagger: 0.2,
57
+ startVelocity: 35,
58
+ spread: 90,
59
+ duration: 3000,
60
+ };
61
+
62
+ const OnboardingGuideContent = () => {
63
+ const [isVisible, setVisible] = useState(true);
64
+ const confettiCannonRef = useRef<HTMLDivElement>(null);
65
+
66
+ const onComplete = () => {
67
+ const { current: confettiCannon } = confettiCannonRef;
68
+ if (confettiCannon) fireConfetti(confettiCannon, confettiConfig);
69
+ setTimeout(() => setVisible(false), confettiConfig.duration);
70
+ };
71
+
72
+ if (!isVisible) return null;
73
+
74
+ return (
75
+ <OnboardingProvider onComplete={onComplete}>
76
+ <div className={styles.container}>
77
+ <OnboardingGuideCard />
78
+ <div ref={confettiCannonRef} className={styles.confettiCannon} />
79
+ </div>
80
+ </OnboardingProvider>
81
+ );
82
+ };
83
+
84
+ export const OnboardingGuide = () => {
85
+ const { eligible } = useOnboardingExperiment();
86
+
87
+ if (!eligible) return null;
88
+
89
+ return <OnboardingGuideContent />;
90
+ };
@@ -0,0 +1 @@
1
+ export { OnboardingGuide } from "./OnboardingGuide";
@@ -18,7 +18,8 @@ import type { OnboardingStep } from "@/features/onboarding/types";
18
18
  const EndCtaIcon = () => <Icon name="playCircle" size="small" color="grey11" />;
19
19
 
20
20
  export const OnboardingProgressStepper = () => {
21
- const { completedStepCount, steps, isStepComplete } = useOnboardingContext();
21
+ const { completedStepCount, steps, isStepComplete, isComplete } =
22
+ useOnboardingContext();
22
23
 
23
24
  const [isListOpen, setListOpen] = useState(false);
24
25
  const [isDialogOpen, setDialogOpen] = useState(false);
@@ -44,6 +45,7 @@ export const OnboardingProgressStepper = () => {
44
45
  <DropdownMenu open={isListOpen} onOpenChange={setListOpen}>
45
46
  <DropdownMenuTrigger>
46
47
  <Button
48
+ disabled={isComplete}
47
49
  color="grey"
48
50
  sx={{ width: "100%" }}
49
51
  renderEndIcon={EndCtaIcon}
@@ -32,7 +32,15 @@ const getInitialState = (): OnboardingStepStatuses => {
32
32
  ) as OnboardingStepStatuses;
33
33
  };
34
34
 
35
- export const OnboardingProvider = ({ children }: { children: ReactNode }) => {
35
+ type OnboardingProviderProps = {
36
+ children: ReactNode;
37
+ onComplete?: () => void;
38
+ };
39
+
40
+ export const OnboardingProvider = ({
41
+ children,
42
+ onComplete,
43
+ }: OnboardingProviderProps) => {
36
44
  const [stepStatus, setStepStatus] = usePersistedState(
37
45
  "onboardingSteps",
38
46
  getInitialState(),
@@ -52,6 +60,7 @@ export const OnboardingProvider = ({ children }: { children: ReactNode }) => {
52
60
  });
53
61
  }
54
62
  if (Object.values(nextState).every(Boolean)) {
63
+ onComplete?.();
55
64
  void telemetry.track({ event: "onboarding:completed" });
56
65
  }
57
66
  };
@@ -1,6 +1,8 @@
1
1
  import {
2
2
  Dialog,
3
+ DialogActionButton,
3
4
  DialogActions,
5
+ DialogCancelButton,
4
6
  DialogContent,
5
7
  DialogHeader,
6
8
  } from "@prismicio/editor-ui";
@@ -50,11 +52,12 @@ export const OnboardingStepDialog = ({
50
52
  <DialogHeader title="Onboarding" />
51
53
  <DialogContent>
52
54
  <OnboardingStepDialogContent step={step} />
53
- <DialogActions
54
- ok={{ text: ctaOkText, onClick: markAsDone }}
55
- cancel={{ text: "Close" }}
56
- size="medium"
57
- />
55
+ <DialogActions>
56
+ <DialogCancelButton size="medium">Close</DialogCancelButton>
57
+ <DialogActionButton size="medium" onClick={markAsDone}>
58
+ {ctaOkText}
59
+ </DialogActionButton>
60
+ </DialogActions>
58
61
  </DialogContent>
59
62
  </Dialog>
60
63
  );
@@ -1,7 +1,10 @@
1
1
  import {
2
2
  Box,
3
3
  Dialog,
4
+ DialogActionButton,
5
+ DialogActionLink,
4
6
  DialogActions,
7
+ DialogCancelButton,
5
8
  DialogContent,
6
9
  DialogHeader,
7
10
  FormInput,
@@ -67,21 +70,22 @@ export const GitRepositoryConnectDialog: FC<
67
70
  Required to sync models from {providerConfig.name} to Prismic.
68
71
  </Text>
69
72
  </Box>
70
- <DialogActions
71
- cancel={{ text: "Cancel" }}
72
- link={
73
- <Text href={new URL("/settings/apps", repositoryUrl).href}>
74
- Create a Prismic Write API token
75
- </Text>
76
- }
77
- ok={{
78
- disabled: !formikProps.isValid,
79
- loading: formikProps.isSubmitting,
80
- onClick: () => void formikProps.submitForm(),
81
- text: "Save Token",
82
- }}
83
- size="medium"
84
- />
73
+ <DialogActions>
74
+ <DialogActionLink
75
+ href={new URL("/settings/apps", repositoryUrl).href}
76
+ >
77
+ Create a Prismic Write API token
78
+ </DialogActionLink>
79
+ <DialogCancelButton size="medium" />
80
+ <DialogActionButton
81
+ disabled={!formikProps.isValid}
82
+ loading={formikProps.isSubmitting}
83
+ onClick={() => void formikProps.submitForm()}
84
+ size="medium"
85
+ >
86
+ Save Token
87
+ </DialogActionButton>
88
+ </DialogActions>
85
89
  </form>
86
90
  )}
87
91
  </Formik>
@@ -1,7 +1,9 @@
1
1
  import {
2
2
  Box,
3
3
  Dialog,
4
+ DialogActionButton,
4
5
  DialogActions,
6
+ DialogCancelButton,
5
7
  DialogContent,
6
8
  DialogHeader,
7
9
  Text,
@@ -32,13 +34,13 @@ export const GitRepositoryDisconnectDialog: FC<
32
34
  </Text>
33
35
  </Box>
34
36
  </DialogContent>
35
- <DialogActions
36
- asFooter
37
- cancel={{ text: "Cancel" }}
38
- ok={{
39
- color: "tomato",
40
- loading,
41
- onClick: () => {
37
+ <DialogActions>
38
+ <DialogCancelButton size="medium" />
39
+ <DialogActionButton
40
+ size="medium"
41
+ color="tomato"
42
+ loading={loading}
43
+ onClick={() => {
42
44
  void (async () => {
43
45
  setLoading(true);
44
46
  try {
@@ -50,11 +52,11 @@ export const GitRepositoryDisconnectDialog: FC<
50
52
  }
51
53
  setLoading(false);
52
54
  })();
53
- },
54
- text: "Disconnect",
55
- }}
56
- size="medium"
57
- />
55
+ }}
56
+ >
57
+ Disconnect
58
+ </DialogActionButton>
59
+ </DialogActions>
58
60
  </Dialog>
59
61
  );
60
62
  };
@@ -1,7 +1,9 @@
1
1
  import {
2
2
  Box,
3
3
  Dialog,
4
+ DialogActionButton,
4
5
  DialogActions,
6
+ DialogCancelButton,
5
7
  DialogContent,
6
8
  DialogHeader,
7
9
  FormInput,
@@ -132,16 +134,17 @@ export const ConvertLegacySliceAsNewSliceDialog: FC<DialogProps> = ({
132
134
  </Text>
133
135
  </Box>
134
136
  </ScrollArea>
135
- <DialogActions
136
- ok={{
137
- text: "Upgrade",
138
- onClick: () => void formik.submitForm(),
139
- loading: isLoading,
140
- disabled: !formik.isValid,
141
- }}
142
- cancel={{ text: "Cancel" }}
143
- size="medium"
144
- />
137
+ <DialogActions>
138
+ <DialogCancelButton size="medium" />
139
+ <DialogActionButton
140
+ size="medium"
141
+ loading={isLoading}
142
+ disabled={!formik.isValid}
143
+ onClick={() => void formik.submitForm()}
144
+ >
145
+ Upgrade
146
+ </DialogActionButton>
147
+ </DialogActions>
145
148
  </Box>
146
149
  </form>
147
150
  );
@@ -1,7 +1,9 @@
1
1
  import {
2
2
  Box,
3
3
  Dialog,
4
+ DialogActionButton,
4
5
  DialogActions,
6
+ DialogCancelButton,
5
7
  DialogContent,
6
8
  DialogHeader,
7
9
  FormInput,
@@ -169,16 +171,19 @@ export const ConvertLegacySliceAsNewVariationDialog: FC<DialogProps> = ({
169
171
  />
170
172
  </Box>
171
173
  </ScrollArea>
172
- <DialogActions
173
- ok={{
174
- text: "Convert",
175
- onClick: () => void formik.submitForm(),
176
- loading: isLoading,
177
- disabled: !formik.isValid,
178
- }}
179
- cancel={{ text: "Cancel" }}
180
- size="medium"
181
- />
174
+ <DialogActions>
175
+ <DialogCancelButton size="medium" />
176
+ <DialogActionButton
177
+ size="medium"
178
+ loading={isLoading}
179
+ onClick={() => {
180
+ void formik.submitForm();
181
+ }}
182
+ disabled={!formik.isValid}
183
+ >
184
+ Convert
185
+ </DialogActionButton>
186
+ </DialogActions>
182
187
  </Box>
183
188
  </form>
184
189
  );
@@ -1,7 +1,9 @@
1
1
  import {
2
2
  Box,
3
3
  Dialog,
4
+ DialogActionButton,
4
5
  DialogActions,
6
+ DialogCancelButton,
5
7
  DialogContent,
6
8
  DialogHeader,
7
9
  ScrollArea,
@@ -85,16 +87,17 @@ export const ConvertLegacySliceMergeWithIdenticalDialog: FC<DialogProps> = ({
85
87
  </Text>
86
88
  </Box>
87
89
  </ScrollArea>
88
- <DialogActions
89
- ok={{
90
- text: "Merge",
91
- onClick: () => void formik.submitForm(),
92
- loading: isLoading,
93
- disabled: !formik.isValid,
94
- }}
95
- cancel={{ text: "Cancel" }}
96
- size="medium"
97
- />
90
+ <DialogActions>
91
+ <DialogCancelButton size="medium" />
92
+ <DialogActionButton
93
+ size="medium"
94
+ loading={isLoading}
95
+ disabled={!formik.isValid}
96
+ onClick={() => void formik.submitForm()}
97
+ >
98
+ Merge
99
+ </DialogActionButton>
100
+ </DialogActions>
98
101
  </Box>
99
102
  </form>
100
103
  );
@@ -2,7 +2,9 @@ import {
2
2
  Box,
3
3
  Button,
4
4
  Dialog,
5
+ DialogActionButton,
5
6
  DialogActions,
7
+ DialogCancelButton,
6
8
  DialogContent,
7
9
  DialogHeader,
8
10
  Text,
@@ -87,20 +89,21 @@ export function DevCollaborationExperiment() {
87
89
  <Box flexDirection="column" padding={16}>
88
90
  <Text>{payload.dialogDescription}</Text>
89
91
  </Box>
90
- <DialogActions
91
- cancel={{ text: "Cancel" }}
92
- ok={{
93
- text: payload.dialogButtonLabel,
94
- onClick: () => {
92
+ <DialogActions>
93
+ <DialogCancelButton size="medium" />
94
+ <DialogActionButton
95
+ size="medium"
96
+ onClick={() => {
95
97
  void telemetry.track({
96
98
  event: "dev-collab:join-beta-clicked",
97
99
  });
98
100
  window.open(payload.dialogButtonLink, "_blank");
99
101
  setIsExperimentDialogOpen(false);
100
- },
101
- }}
102
- size="medium"
103
- />
102
+ }}
103
+ >
104
+ {payload.dialogButtonLabel}
105
+ </DialogActionButton>
106
+ </DialogActions>
104
107
  </Box>
105
108
  </DialogContent>
106
109
  </Dialog>
@@ -1,7 +1,9 @@
1
1
  import {
2
2
  Box,
3
3
  Dialog,
4
+ DialogActionButton,
4
5
  DialogActions,
6
+ DialogCancelButton,
5
7
  DialogContent,
6
8
  DialogHeader,
7
9
  Text,
@@ -49,11 +51,12 @@ export const DeleteVariationModal: FC<DeleteVariationModalProps> = ({
49
51
  <Bold>not</Bold> affect your documents until you <Bold>edit</Bold>{" "}
50
52
  them manually.
51
53
  </Text>
52
- <DialogActions
53
- ok={{
54
- text: "Delete",
55
- color: "tomato",
56
- onClick: () => {
54
+ <DialogActions>
55
+ <DialogCancelButton size="medium" />
56
+ <DialogActionButton
57
+ size="medium"
58
+ color="tomato"
59
+ onClick={() => {
57
60
  if (!variation) return;
58
61
  void (async () => {
59
62
  setIsDeleting(true);
@@ -69,12 +72,12 @@ export const DeleteVariationModal: FC<DeleteVariationModalProps> = ({
69
72
  setIsDeleting(false);
70
73
  onClose();
71
74
  })();
72
- },
73
- loading: isDeleting,
74
- }}
75
- cancel={{ text: "Cancel" }}
76
- size="medium"
77
- />
75
+ }}
76
+ loading={isDeleting}
77
+ >
78
+ Delete
79
+ </DialogActionButton>
80
+ </DialogActions>
78
81
  </Box>
79
82
  </DialogContent>
80
83
  </Dialog>
@@ -1,7 +1,9 @@
1
1
  import {
2
2
  Box,
3
3
  Dialog,
4
+ DialogActionButton,
4
5
  DialogActions,
6
+ DialogCancelButton,
5
7
  DialogContent,
6
8
  DialogHeader,
7
9
  FormInput,
@@ -98,16 +100,17 @@ export const RenameVariationModal: FC<RenameVariationModalProps> = ({
98
100
  />
99
101
  </Box>
100
102
  </Box>
101
- <DialogActions
102
- ok={{
103
- text: "Rename",
104
- onClick: () => void formik.submitForm(),
105
- loading: isRenaming,
106
- disabled: !formik.isValid,
107
- }}
108
- cancel={{ text: "Cancel" }}
109
- size="medium"
110
- />
103
+ <DialogActions>
104
+ <DialogCancelButton size="medium" />
105
+ <DialogActionButton
106
+ size="medium"
107
+ onClick={() => void formik.submitForm()}
108
+ loading={isRenaming}
109
+ disabled={!formik.isValid}
110
+ >
111
+ Rename
112
+ </DialogActionButton>
113
+ </DialogActions>
111
114
  </form>
112
115
  )}
113
116
  </Formik>
@@ -1,7 +1,9 @@
1
1
  import {
2
2
  Box,
3
3
  Dialog,
4
+ DialogActionButton,
4
5
  DialogActions,
6
+ DialogCancelButton,
5
7
  DialogContent,
6
8
  DialogHeader,
7
9
  } from "@prismicio/editor-ui";
@@ -286,14 +288,12 @@ const FieldZones: FC = () => {
286
288
  </>
287
289
  )}
288
290
  </Box>
289
- <DialogActions
290
- ok={{
291
- text: "Delete",
292
- color: "tomato",
293
- onClick: () => onDeleteRepeatableZone(),
294
- }}
295
- cancel={{ text: "Cancel" }}
296
- />
291
+ <DialogActions>
292
+ <DialogCancelButton />
293
+ <DialogActionButton color="tomato" onClick={onDeleteRepeatableZone}>
294
+ Delete
295
+ </DialogActionButton>
296
+ </DialogActions>
297
297
  </DialogContent>
298
298
  </Dialog>
299
299
  </List>