slice-machine-ui 1.25.1-beta.4 → 1.25.1-beta.6

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 (65) hide show
  1. package/components/Navigation/ChangesItem.tsx +48 -7
  2. package/components/Navigation/index.test.tsx +1 -1
  3. package/components/Navigation/index.tsx +4 -1
  4. package/out/404.html +1 -1
  5. package/out/_next/static/{6jRG4-M2kPuqHpE210vBe → BgmBc78JMOwL2qPVTvh8F}/_buildManifest.js +1 -1
  6. package/out/_next/static/chunks/{183-4feb6bb3eddbc768.js → 183-ebd633fed7c74545.js} +1 -1
  7. package/out/_next/static/chunks/{727-df23c133f7cbf952.js → 727-2c302be2def92786.js} +1 -1
  8. package/out/_next/static/chunks/{799-9bea9069969f5fe0.js → 799-7b910b896ff60ebe.js} +1 -1
  9. package/out/_next/static/chunks/{904-1a755ebb0f5ee4ac.js → 904-6fec9bac11fa810f.js} +1 -1
  10. package/out/_next/static/chunks/pages/{_app-9e5ae468938cc67a.js → _app-fe38e3feca584fa4.js} +52 -52
  11. package/out/_next/static/chunks/pages/{changelog-57289ca6bc99702b.js → changelog-5c9ac93faf0df06b.js} +1 -1
  12. package/out/_next/static/chunks/pages/changes-3e4989e09fd412a8.js +1 -0
  13. package/out/_next/static/chunks/pages/{labs-49bed0a08da3772c.js → labs-6f5925cd6cdcee9e.js} +1 -1
  14. package/out/_next/static/chunks/pages/{settings-12f209f1d5d42b1c.js → settings-f0620e5b727cda03.js} +1 -1
  15. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/{[variation]-ba6c3e2624f32fcd.js → [variation]-f0052f6f451357a6.js} +1 -1
  16. package/out/_next/static/chunks/pages/{slices-01aa9c2bc7c192be.js → slices-77cff50b1df13579.js} +1 -1
  17. package/out/_next/static/css/{4f1e84c70ef0e169.css → 21654235130d0806.css} +1 -1
  18. package/out/changelog.html +1 -1
  19. package/out/changes.html +1 -1
  20. package/out/custom-types/[customTypeId].html +1 -1
  21. package/out/custom-types.html +1 -1
  22. package/out/index.html +1 -1
  23. package/out/labs.html +1 -1
  24. package/out/page-types/[pageTypeId].html +1 -1
  25. package/out/settings.html +1 -1
  26. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  27. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  28. package/out/slices.html +1 -1
  29. package/package.json +3 -4
  30. package/src/components/BaseHoverCard/BaseHoverCard.tsx +3 -2
  31. package/src/components/BlankSlate/BlankSlate.tsx +1 -1
  32. package/src/components/Divider/Divider.tsx +2 -2
  33. package/src/components/HoverCard/HoverCard.tsx +11 -11
  34. package/src/components/PageLayout/PageLayout.module.css +82 -0
  35. package/src/components/PageLayout/PageLayout.module.css.d.ts +14 -0
  36. package/src/components/PageLayout/PageLayout.stories.tsx +3 -6
  37. package/src/components/PageLayout/PageLayout.tsx +11 -8
  38. package/src/components/SideNav/SideNav.module.css +318 -0
  39. package/src/components/SideNav/SideNav.module.css.d.ts +29 -0
  40. package/src/components/SideNav/SideNav.stories.tsx +10 -1
  41. package/src/components/SideNav/SideNav.tsx +37 -38
  42. package/src/components/SideNav/SideNavEnvironmentSelector.module.css +59 -0
  43. package/src/components/SideNav/SideNavEnvironmentSelector.module.css.d.ts +13 -0
  44. package/src/components/SideNav/SideNavEnvironmentSelector.tsx +97 -66
  45. package/src/components/TextLink/TextLink.tsx +2 -4
  46. package/src/features/changes/PushChangesButton.tsx +1 -1
  47. package/src/features/sync/components/AutoSyncStatusIndicator.module.css +6 -0
  48. package/src/features/sync/components/AutoSyncStatusIndicator.module.css.d.ts +1 -0
  49. package/src/features/sync/components/AutoSyncStatusIndicator.tsx +4 -2
  50. package/src/icons/ChangesIcon.tsx +19 -0
  51. package/src/icons/DatabaseIcon.tsx +1 -0
  52. package/src/icons/FolderIcon.tsx +1 -0
  53. package/src/icons/Lightning.tsx +1 -0
  54. package/src/icons/LogoIcon.tsx +27 -23
  55. package/src/icons/MathPlusIcon.tsx +1 -1
  56. package/src/icons/OpenIcon.tsx +1 -1
  57. package/src/icons/PageStackIcon.tsx +1 -0
  58. package/src/icons/RadarIcon.tsx +1 -0
  59. package/test/__setup__.ts +15 -0
  60. package/test/__testutils__/index.tsx +8 -5
  61. package/out/_next/static/chunks/pages/changes-23829ddb11cac992.js +0 -1
  62. package/src/components/PageLayout/PageLayout.css.ts +0 -69
  63. package/src/components/SideNav/SideNav.css.ts +0 -381
  64. package/src/components/SideNav/SideNavEnvironmentSelector.css.ts +0 -65
  65. /package/out/_next/static/{6jRG4-M2kPuqHpE210vBe → BgmBc78JMOwL2qPVTvh8F}/_ssgManifest.js +0 -0
@@ -1,6 +1,14 @@
1
1
  import { type FC } from "react";
2
2
  import { useRouter } from "next/router";
3
- import { Box, Button, Text } from "@prismicio/editor-ui";
3
+ import { useMediaQuery } from "@prismicio/editor-support/React";
4
+ import {
5
+ Box,
6
+ Button,
7
+ IconButton,
8
+ Text,
9
+ Tooltip,
10
+ breakpoints,
11
+ } from "@prismicio/editor-ui";
4
12
 
5
13
  import {
6
14
  HoverCard,
@@ -13,6 +21,7 @@ import useSliceMachineActions from "@src/modules/useSliceMachineActions";
13
21
  import { useNetwork } from "@src/hooks/useNetwork";
14
22
  import { useAuthStatus } from "@src/hooks/useAuthStatus";
15
23
  import { useUnSyncChanges } from "@src/features/sync/useUnSyncChanges";
24
+ import { ChangesIcon } from "@src/icons/ChangesIcon";
16
25
  import { AuthStatus } from "@src/modules/userContext/types";
17
26
  import { useAutoSync } from "@src/features/sync/AutoSyncProvider";
18
27
  import { AutoSyncStatusIndicator } from "@src/features/sync/components/AutoSyncStatusIndicator";
@@ -22,6 +31,7 @@ export const ChangesItem: FC = () => {
22
31
  const open = useOpenChangesHoverCard();
23
32
  const router = useRouter();
24
33
  const { autoSyncStatus } = useAutoSync();
34
+ const isSmall = useMediaQuery(breakpoints.small);
25
35
 
26
36
  const onClose = () => {
27
37
  setSeenChangesToolTip();
@@ -29,18 +39,42 @@ export const ChangesItem: FC = () => {
29
39
 
30
40
  return (
31
41
  <HoverCard
42
+ align="start"
32
43
  open={open}
33
44
  openDelay={3000}
34
45
  onClose={onClose}
35
46
  side="right"
36
47
  sideOffset={24}
37
- collisionPadding={280}
38
48
  trigger={
39
- <Box padding={{ bottom: 24 }}>
49
+ <Box alignItems={isSmall ? "center" : undefined} flexDirection="column">
40
50
  {autoSyncStatus === "failed" ||
41
51
  autoSyncStatus === "synced" ||
42
52
  autoSyncStatus === "syncing" ? (
43
53
  <AutoSyncStatusIndicator autoSyncStatus={autoSyncStatus} />
54
+ ) : isSmall ? (
55
+ <Tooltip content="Review changes" side="right">
56
+ <Box position="relative">
57
+ {/*
58
+ * TODO(DT-1942): This should be an IconButton with a link
59
+ * component for accessibility
60
+ */}
61
+ <IconButton
62
+ icon={<ChangesIcon />}
63
+ onClick={() => {
64
+ void router.push("/changes");
65
+ }}
66
+ variant="solid"
67
+ />
68
+ <Box
69
+ left="100%"
70
+ position="absolute"
71
+ top={0}
72
+ transform="translate(-50%, -50%)"
73
+ >
74
+ <ChangesCount color="purple" />
75
+ </Box>
76
+ </Box>
77
+ </Tooltip>
44
78
  ) : (
45
79
  // TODO(DT-1942): This should be a Button with a link component for
46
80
  // accessibility
@@ -52,7 +86,8 @@ export const ChangesItem: FC = () => {
52
86
  sx={{ width: "100%" }}
53
87
  >
54
88
  <Box alignItems="center" gap={4}>
55
- <Text variant="bold">Review changes</Text> <ChangesCount />
89
+ <Text variant="bold">Review changes</Text>{" "}
90
+ <ChangesCount color="grey" />
56
91
  </Box>
57
92
  </Button>
58
93
  )}
@@ -70,7 +105,9 @@ export const ChangesItem: FC = () => {
70
105
  );
71
106
  };
72
107
 
73
- export const ChangesCount: FC = () => {
108
+ type ChangesCountProps = { color: "grey" | "purple" };
109
+
110
+ export const ChangesCount: FC<ChangesCountProps> = ({ color }) => {
74
111
  const isOnline = useNetwork();
75
112
  const authStatus = useAuthStatus();
76
113
  const { unSyncedSlices, unSyncedCustomTypes } = useUnSyncChanges();
@@ -91,8 +128,12 @@ export const ChangesCount: FC = () => {
91
128
  const formattedNumberOfChanges = numberOfChanges > 9 ? "+9" : numberOfChanges;
92
129
 
93
130
  return (
94
- <Box padding={{ inline: 6 }} borderRadius={10} backgroundColor="grey5">
95
- <Text color="grey11" variant="small">
131
+ <Box
132
+ padding={{ inline: 6 }}
133
+ borderRadius={10}
134
+ backgroundColor={color === "grey" ? "grey5" : "purple9"}
135
+ >
136
+ <Text color={color === "grey" ? "grey11" : "grey1"} variant="small">
96
137
  {formattedNumberOfChanges}
97
138
  </Text>
98
139
  </Box>
@@ -98,7 +98,7 @@ describe("Side Navigation", () => {
98
98
  renderSideNavigation();
99
99
  expect(await screen.findByText("foo")).toBeVisible();
100
100
  expect(await screen.findByText("foo.prismic.io")).toBeVisible();
101
- const link = await screen.findByTitle("Open Prismic repository");
101
+ const link = screen.getByTestId("prismic-repository-link");
102
102
  expect(link).toHaveAttribute("href", "https://foo.prismic.io");
103
103
  expect(link).toHaveAttribute("target", "_blank");
104
104
  });
@@ -1,3 +1,4 @@
1
+ import { Box } from "@prismicio/editor-ui";
1
2
  import { Suspense, type FC } from "react";
2
3
  import Link from "next/link";
3
4
  import { useRouter } from "next/router";
@@ -65,7 +66,9 @@ const Navigation: FC = () => {
65
66
  href={repositoryUrl}
66
67
  />
67
68
 
68
- <ChangesItem />
69
+ <Box flexDirection="column" padding={{ bottom: 24 }}>
70
+ <ChangesItem />
71
+ </Box>
69
72
 
70
73
  <SideNavList>
71
74
  <SideNavListItem>
package/out/404.html CHANGED
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/4f1e84c70ef0e169.css" as="style"/><link rel="stylesheet" href="/_next/static/css/4f1e84c70ef0e169.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-9e5ae468938cc67a.js" defer=""></script><script src="/_next/static/chunks/pages/_error-69b4f498bafdd188.js" defer=""></script><script src="/_next/static/6jRG4-M2kPuqHpE210vBe/_buildManifest.js" defer=""></script><script src="/_next/static/6jRG4-M2kPuqHpE210vBe/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"6jRG4-M2kPuqHpE210vBe","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/21654235130d0806.css" as="style"/><link rel="stylesheet" href="/_next/static/css/21654235130d0806.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-fe38e3feca584fa4.js" defer=""></script><script src="/_next/static/chunks/pages/_error-69b4f498bafdd188.js" defer=""></script><script src="/_next/static/BgmBc78JMOwL2qPVTvh8F/_buildManifest.js" defer=""></script><script src="/_next/static/BgmBc78JMOwL2qPVTvh8F/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"BgmBc78JMOwL2qPVTvh8F","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
@@ -1 +1 @@
1
- self.__BUILD_MANIFEST=function(s,c,a,e,t,i,b,d,n,f,u,h,l,k,j,p,g,o,r){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[a,j,p,"static/chunks/pages/index-cf93d16e9c63b6db.js"],"/_error":["static/chunks/pages/_error-69b4f498bafdd188.js"],"/changelog":[s,e,"static/chunks/870-0c7a8a9622de78b7.js","static/chunks/pages/changelog-57289ca6bc99702b.js"],"/changes":[s,t,"static/chunks/8eec4907-b712959d9f984b68.js",i,"static/chunks/918-5bb55fb464e34768.js",c,d,"static/css/838fd8bb5a7c32b0.css","static/chunks/pages/changes-23829ddb11cac992.js"],"/custom-types":[a,j,p,"static/chunks/pages/custom-types-3c8e721ec6802127.js"],"/custom-types/[customTypeId]":[s,n,f,u,h,e,b,i,l,g,c,a,k,o,r,"static/chunks/pages/custom-types/[customTypeId]-d1a4a07e6b600fa6.js"],"/labs":["static/chunks/pages/labs-49bed0a08da3772c.js"],"/page-types/[pageTypeId]":[s,n,f,u,h,e,b,i,l,g,c,a,k,o,r,"static/chunks/pages/page-types/[pageTypeId]-a724ff12ef322020.js"],"/settings":["static/css/ca32882a5d2d8d88.css","static/chunks/pages/settings-12f209f1d5d42b1c.js"],"/slices":[s,t,b,c,d,"static/css/f8eb526e10bc2441.css","static/chunks/pages/slices-01aa9c2bc7c192be.js"],"/slices/[lib]/[sliceName]/[variation]":[s,t,n,f,u,h,e,b,i,l,c,k,d,"static/css/b22c0750c14cc089.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-ba6c3e2624f32fcd.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[t,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/18539003-a5a5d48f20a7b261.js","static/chunks/46-d22d7a121254e31d.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-3eb0fdce3228d389.js"],sortedPages:["/","/_app","/_error","/changelog","/changes","/custom-types","/custom-types/[customTypeId]","/labs","/page-types/[pageTypeId]","/settings","/slices","/slices/[lib]/[sliceName]/[variation]","/slices/[lib]/[sliceName]/[variation]/simulator"]}}("static/chunks/59b4e022-7a3b5554b806349f.js","static/chunks/25-792af14760d9df34.js","static/chunks/799-9bea9069969f5fe0.js","static/chunks/183-4feb6bb3eddbc768.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/543-f8766685f7f451e2.js","static/chunks/50-cfc2514205b86001.js","static/chunks/286-e0950c3083c672e8.js","static/chunks/f36c6662-03bb5e9d9aa0b0aa.js","static/chunks/4c744e84-e3161d754618373f.js","static/chunks/065a3ddb-9a38ca0d60f0bf2f.js","static/chunks/1cc2734a-2c5b6c0367fcde86.js","static/chunks/696-b992b9e1ce75777e.js","static/chunks/318-2426f74a0d6c3b89.js","static/chunks/727-df23c133f7cbf952.js","static/css/be1f49e49a5aa7eb.css","static/chunks/210-aee6116139329803.js","static/chunks/904-1a755ebb0f5ee4ac.js","static/css/72465cc1225f28a2.css"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
1
+ self.__BUILD_MANIFEST=function(s,c,a,e,t,i,b,n,f,u,d,h,l,k,j,p,g,o,r){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[a,j,p,"static/chunks/pages/index-cf93d16e9c63b6db.js"],"/_error":["static/chunks/pages/_error-69b4f498bafdd188.js"],"/changelog":[s,e,"static/chunks/870-0c7a8a9622de78b7.js","static/chunks/pages/changelog-5c9ac93faf0df06b.js"],"/changes":[s,t,"static/chunks/8eec4907-b712959d9f984b68.js",i,"static/chunks/918-5bb55fb464e34768.js",c,n,"static/css/838fd8bb5a7c32b0.css","static/chunks/pages/changes-3e4989e09fd412a8.js"],"/custom-types":[a,j,p,"static/chunks/pages/custom-types-3c8e721ec6802127.js"],"/custom-types/[customTypeId]":[s,f,u,d,h,e,b,i,l,g,c,a,k,o,r,"static/chunks/pages/custom-types/[customTypeId]-d1a4a07e6b600fa6.js"],"/labs":["static/chunks/pages/labs-6f5925cd6cdcee9e.js"],"/page-types/[pageTypeId]":[s,f,u,d,h,e,b,i,l,g,c,a,k,o,r,"static/chunks/pages/page-types/[pageTypeId]-a724ff12ef322020.js"],"/settings":["static/css/ca32882a5d2d8d88.css","static/chunks/pages/settings-f0620e5b727cda03.js"],"/slices":[s,t,b,c,n,"static/css/f8eb526e10bc2441.css","static/chunks/pages/slices-77cff50b1df13579.js"],"/slices/[lib]/[sliceName]/[variation]":[s,t,f,u,d,h,e,b,i,l,c,k,n,"static/css/b22c0750c14cc089.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-f0052f6f451357a6.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[t,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/18539003-a5a5d48f20a7b261.js","static/chunks/46-d22d7a121254e31d.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-3eb0fdce3228d389.js"],sortedPages:["/","/_app","/_error","/changelog","/changes","/custom-types","/custom-types/[customTypeId]","/labs","/page-types/[pageTypeId]","/settings","/slices","/slices/[lib]/[sliceName]/[variation]","/slices/[lib]/[sliceName]/[variation]/simulator"]}}("static/chunks/59b4e022-7a3b5554b806349f.js","static/chunks/25-792af14760d9df34.js","static/chunks/799-7b910b896ff60ebe.js","static/chunks/183-ebd633fed7c74545.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/543-f8766685f7f451e2.js","static/chunks/50-cfc2514205b86001.js","static/chunks/286-e0950c3083c672e8.js","static/chunks/f36c6662-03bb5e9d9aa0b0aa.js","static/chunks/4c744e84-e3161d754618373f.js","static/chunks/065a3ddb-9a38ca0d60f0bf2f.js","static/chunks/1cc2734a-2c5b6c0367fcde86.js","static/chunks/696-b992b9e1ce75777e.js","static/chunks/318-2426f74a0d6c3b89.js","static/chunks/727-2c302be2def92786.js","static/css/be1f49e49a5aa7eb.css","static/chunks/210-aee6116139329803.js","static/chunks/904-6fec9bac11fa810f.js","static/css/72465cc1225f28a2.css"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();