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
@@ -0,0 +1,318 @@
1
+ .block {
2
+ all: unset;
3
+ box-sizing: border-box;
4
+ font-family: var(--font-family-body);
5
+ }
6
+
7
+ .blockWithDisplayRevert {
8
+ composes: block;
9
+ display: revert;
10
+ }
11
+
12
+ .interactiveElement {
13
+ transition-duration: 200ms;
14
+ transition-property: background-color, border-color, boxShadow, color;
15
+ transition-timing-function: ease-out;
16
+ }
17
+
18
+ .root {
19
+ composes: block;
20
+ background-color: var(--grey2);
21
+ display: flex;
22
+ flex-direction: column;
23
+ min-width: 0;
24
+ padding: 16px;
25
+ padding-bottom: 0px;
26
+ /* stylelint-disable-next-line declaration-property-value-allowed-list -- Accounts for the 1 px right border of the `PageLayoutPane` component. */
27
+ padding-right: calc(16px - 1px);
28
+ }
29
+
30
+ .logo {
31
+ composes: blockWithDisplayRevert;
32
+ height: 32px;
33
+ margin-bottom: 32px;
34
+ width: 32px;
35
+ }
36
+
37
+ .repository {
38
+ composes: block;
39
+ display: flex;
40
+ justify-content: space-between;
41
+ margin-bottom: 16px;
42
+ }
43
+
44
+ .repositoryInfo {
45
+ flex: 1;
46
+ min-width: 0;
47
+ }
48
+
49
+ .repositoryName {
50
+ composes: blockWithDisplayRevert;
51
+ color: var(--grey12);
52
+ font-size: calc(18rem / 16);
53
+ font-weight: 500;
54
+ line-height: calc(32rem / 16);
55
+ overflow: hidden;
56
+ text-overflow: ellipsis;
57
+ white-space: nowrap;
58
+ }
59
+
60
+ .repositoryDomain {
61
+ composes: blockWithDisplayRevert;
62
+ color: var(--grey11);
63
+ font-size: calc(12rem / 16);
64
+ line-height: calc(16rem / 16);
65
+ overflow: hidden;
66
+ text-overflow: ellipsis;
67
+ white-space: nowrap;
68
+ }
69
+
70
+ .repositoryLinkIcon {
71
+ composes: block interactiveElement;
72
+ align-items: center;
73
+ background-color: var(--grey2);
74
+ border-color: transparent;
75
+ border-radius: 6px;
76
+ border-style: solid;
77
+ border-width: 1px;
78
+ color: var(--grey11);
79
+ cursor: pointer;
80
+ display: flex;
81
+ height: 32px;
82
+ justify-content: center;
83
+ width: 32px;
84
+ &:hover {
85
+ background-color: var(--grey4);
86
+ border-color: var(--grey7);
87
+ }
88
+ &:focus-visible {
89
+ background-color: var(--grey2);
90
+ border-color: var(--purple8);
91
+ }
92
+ &:focus {
93
+ border-color: var(--purple10);
94
+ box-shadow: var(--box-shadow-purple-focus);
95
+ }
96
+ }
97
+
98
+ .list {
99
+ composes: blockWithDisplayRevert;
100
+ list-style-type: none;
101
+ &:last-child {
102
+ margin-bottom: 16px;
103
+ }
104
+ }
105
+
106
+ .listBottom {
107
+ margin-top: auto;
108
+ padding-top: 48px;
109
+ }
110
+
111
+ .listItem {
112
+ composes: blockWithDisplayRevert;
113
+ margin-top: 8px;
114
+ &:first-child {
115
+ margin-top: 0px;
116
+ }
117
+ }
118
+
119
+ .listTitle {
120
+ composes: blockWithDisplayRevert;
121
+ color: var(--grey11);
122
+ font-size: calc(12rem / 16);
123
+ font-weight: 600;
124
+ line-height: calc(16rem / 16);
125
+ margin-bottom: 8px;
126
+ margin-top: 16px;
127
+ }
128
+
129
+ .separator {
130
+ margin-top: 8px;
131
+ }
132
+
133
+ .link {
134
+ composes: block interactiveElement;
135
+ align-items: center;
136
+ border-radius: 6px;
137
+ border-style: solid;
138
+ border-width: 1px;
139
+ cursor: pointer;
140
+ display: flex;
141
+ font-size: calc(14rem / 16);
142
+ gap: 8px;
143
+ height: 48px;
144
+ line-height: calc(24rem / 16);
145
+ padding: 8px;
146
+ padding-right: 16px;
147
+ &:focus {
148
+ box-shadow: var(--box-shadow-purple-focus);
149
+ }
150
+ /* Not Active & Default */
151
+ &:not([data-active="true"]) {
152
+ border-color: transparent;
153
+ background-color: var(--grey2);
154
+ color: var(--grey12);
155
+ }
156
+ /* Parent list item is open */
157
+ [data-state="open"] > &,
158
+ [data-state="open"] > &:hover {
159
+ border-color: var(--purple10);
160
+ box-shadow: var(--box-shadow-purple-focus);
161
+ }
162
+ /* Not Active & Hover */
163
+ &:not([data-active="true"]):hover {
164
+ border-color: var(--grey7);
165
+ background-color: var(--grey4);
166
+ }
167
+ /* Not Active & Focus */
168
+ &:not([data-active="true"]):focus {
169
+ border-color: var(--purple10);
170
+ }
171
+ /* Active & Default */
172
+ &[data-active="true"] {
173
+ background-color: var(--purple3);
174
+ border-color: var(--purple10);
175
+ color: var(--purple10);
176
+ }
177
+ /* Active & Hover */
178
+ &[data-active="true"]:hover {
179
+ background-color: var(--grey1);
180
+ }
181
+ }
182
+
183
+ .linkIcon {
184
+ composes: blockWithDisplayRevert;
185
+ /* Not Active */
186
+ .link:not([data-active="true"]) & {
187
+ color: var(--grey11);
188
+ }
189
+ /* Active */
190
+ .link[data-active="true"] & {
191
+ color: var(--purple10);
192
+ }
193
+ }
194
+
195
+ .linkContent {
196
+ composes: block;
197
+ display: flex;
198
+ justify-content: space-between;
199
+ width: 100%;
200
+ }
201
+
202
+ .linkText {
203
+ composes: blockWithDisplayRevert;
204
+ align-self: baseline;
205
+ }
206
+
207
+ .rightElementPill {
208
+ composes: block;
209
+ align-items: center;
210
+ align-self: center;
211
+ /* stylelint-disable-next-line declaration-property-value-allowed-list -- The component has a border radius of 32 px in Figma. */
212
+ border-radius: 32px;
213
+ border-style: solid;
214
+ border-width: 1px;
215
+ display: flex;
216
+ font-size: calc(12rem / 16);
217
+ font-weight: 500;
218
+ height: 20px;
219
+ justify-content: center;
220
+ line-height: calc(16rem / 16);
221
+ min-width: 20px;
222
+ padding-block: 0px;
223
+ padding-inline: 4px;
224
+ /* Not Active */
225
+ .link:not([data-active="true"]) & {
226
+ background-color: var(--purple9);
227
+ border-color: var(--purple10);
228
+ color: var(--purple3);
229
+ }
230
+ /* Active */
231
+ .link[data-active="true"] & {
232
+ border-color: transparent;
233
+ color: var(--grey11);
234
+ }
235
+ }
236
+
237
+ .rightElementText {
238
+ composes: blockWithDisplayRevert;
239
+ align-self: baseline;
240
+ color: var(--grey11);
241
+ font-size: calc(12rem / 16);
242
+ line-height: calc(16rem / 16);
243
+ max-width: 82px;
244
+ overflow: hidden;
245
+ text-overflow: ellipsis;
246
+ white-space: nowrap;
247
+ }
248
+
249
+ .updateInfo {
250
+ composes: blockWithDisplayRevert;
251
+ background-color: var(--grey3);
252
+ border-radius: 6px;
253
+ margin-top: 32px;
254
+ padding: 16px;
255
+ }
256
+
257
+ .updateInfoTitle {
258
+ composes: blockWithDisplayRevert;
259
+ color: var(--grey12);
260
+ font-size: calc(12rem / 16);
261
+ font-weight: 600;
262
+ line-height: calc(20rem / 16);
263
+ }
264
+
265
+ .updateInfoText {
266
+ composes: blockWithDisplayRevert;
267
+ color: var(--grey11);
268
+ font-size: calc(12rem / 16);
269
+ line-height: calc(20rem / 16);
270
+ }
271
+
272
+ .updateInfoLink {
273
+ composes: block interactiveElement;
274
+ align-items: center;
275
+ background-color: var(--grey1);
276
+ border-color: var(--grey6);
277
+ border-radius: 6px;
278
+ border-style: solid;
279
+ border-width: 1px;
280
+ color: var(--grey12);
281
+ cursor: pointer;
282
+ display: flex;
283
+ flex-direction: row;
284
+ font-size: calc(14rem / 16);
285
+ font-weight: 600;
286
+ justify-content: center;
287
+ line-height: calc(24rem / 16);
288
+ margin-top: 16px;
289
+ padding-block: 4px;
290
+ padding-inline: 16px;
291
+ width: 100%;
292
+ &:hover {
293
+ background-color: var(--grey3);
294
+ border-color: var(--grey7);
295
+ }
296
+ &:focus {
297
+ border-color: var(--purple10);
298
+ box-shadow: var(--box-shadow-purple-focus);
299
+ }
300
+ }
301
+
302
+ @media screen and (max-width: 767px) {
303
+ .repository {
304
+ align-self: center;
305
+ padding-bottom: 16px;
306
+ }
307
+
308
+ .repositoryInfo,
309
+ .listTitle,
310
+ .linkContent,
311
+ .updateInfo {
312
+ display: none;
313
+ }
314
+
315
+ .link {
316
+ padding-right: 8px;
317
+ }
318
+ }
@@ -0,0 +1,29 @@
1
+ declare const styles: {
2
+ readonly "block": string;
3
+ readonly "blockWithDisplayRevert": string;
4
+ readonly "interactiveElement": string;
5
+ readonly "link": string;
6
+ readonly "linkContent": string;
7
+ readonly "linkIcon": string;
8
+ readonly "linkText": string;
9
+ readonly "list": string;
10
+ readonly "listBottom": string;
11
+ readonly "listItem": string;
12
+ readonly "listTitle": string;
13
+ readonly "logo": string;
14
+ readonly "repository": string;
15
+ readonly "repositoryDomain": string;
16
+ readonly "repositoryInfo": string;
17
+ readonly "repositoryLinkIcon": string;
18
+ readonly "repositoryName": string;
19
+ readonly "rightElementPill": string;
20
+ readonly "rightElementText": string;
21
+ readonly "root": string;
22
+ readonly "separator": string;
23
+ readonly "updateInfo": string;
24
+ readonly "updateInfoLink": string;
25
+ readonly "updateInfoText": string;
26
+ readonly "updateInfoTitle": string;
27
+ };
28
+ export = styles;
29
+
@@ -3,6 +3,7 @@ import type { Meta, StoryObj } from "@storybook/react";
3
3
  import { RadarIcon } from "@src/icons/RadarIcon";
4
4
  import { LightningIcon } from "@src/icons/Lightning";
5
5
 
6
+ import { PageLayout, PageLayoutPane } from "../PageLayout";
6
7
  import {
7
8
  SideNav,
8
9
  SideNavList,
@@ -21,6 +22,15 @@ type Story = StoryObj<typeof meta>;
21
22
  const meta = {
22
23
  component: SideNav,
23
24
  argTypes: { children: { control: { disable: true } } },
25
+ decorators: [
26
+ (Story) => (
27
+ <PageLayout>
28
+ <PageLayoutPane>
29
+ <Story />
30
+ </PageLayoutPane>
31
+ </PageLayout>
32
+ ),
33
+ ],
24
34
  parameters: {
25
35
  docs: { story: { height: 256, inline: false } },
26
36
  layout: "fullscreen",
@@ -157,6 +167,5 @@ export const Default = {
157
167
  </SideNavList>
158
168
  </>
159
169
  ),
160
- style: { minHeight: "100vh", width: "320px" },
161
170
  },
162
171
  } satisfies Story;
@@ -1,28 +1,25 @@
1
+ import { useMediaQuery } from "@prismicio/editor-support/React";
2
+ import { Tooltip, breakpoints } from "@prismicio/editor-ui";
3
+ import { clsx } from "clsx";
4
+ import type { UrlObject } from "node:url";
1
5
  import {
2
- HTMLAttributes,
3
- type CSSProperties,
6
+ forwardRef,
4
7
  type FC,
8
+ type HTMLAttributes,
5
9
  type LiHTMLAttributes,
6
10
  type MouseEvent,
7
11
  type PropsWithChildren,
8
12
  type ReactNode,
9
13
  type SVGProps,
10
- createElement,
11
- forwardRef,
12
14
  } from "react";
13
- import clsx from "clsx";
14
- import type { UrlObject } from "node:url";
15
15
 
16
- import LogoIcon from "@src/icons/LogoIcon";
16
+ import { LogoIcon } from "@src/icons/LogoIcon";
17
17
  import OpenIcon from "@src/icons/OpenIcon";
18
18
 
19
19
  import { Divider } from "../Divider";
20
+ import styles from "./SideNav.module.css";
20
21
 
21
- import * as styles from "./SideNav.css";
22
-
23
- type SideNavProps = PropsWithChildren<{ style?: CSSProperties }>;
24
-
25
- export const SideNav: FC<SideNavProps> = (props) => (
22
+ export const SideNav: FC<PropsWithChildren> = (props) => (
26
23
  <nav {...props} className={styles.root} />
27
24
  );
28
25
 
@@ -49,14 +46,16 @@ export const SideNavRepository: FC<SideNavRepositoryProps> = ({
49
46
  <h2 className={styles.repositoryDomain}>{repositoryDomain}</h2>
50
47
  </div>
51
48
 
52
- <a
53
- className={styles.repositoryLinkIcon}
54
- href={href}
55
- target="_blank"
56
- title="Open Prismic repository"
57
- >
58
- <OpenIcon />
59
- </a>
49
+ <Tooltip content="Open Prismic repository" side="right">
50
+ <a
51
+ className={styles.repositoryLinkIcon}
52
+ data-testid="prismic-repository-link"
53
+ href={href}
54
+ target="_blank"
55
+ >
56
+ <OpenIcon />
57
+ </a>
58
+ </Tooltip>
60
59
  </div>
61
60
  );
62
61
  };
@@ -116,20 +115,22 @@ export const SideNavLink: FC<SideNavLinkProps> = ({
116
115
  RightElement,
117
116
  Icon,
118
117
  active,
119
- component = "a",
118
+ component: Comp = "a",
120
119
  ...otherProps
121
- }) =>
122
- createElement(
123
- component,
124
- { ...otherProps, ...{ className: styles.link, "data-active": active } },
125
- <>
126
- <Icon className={styles.linkIcon} />
127
- <div className={styles.linkContent}>
128
- <span className={styles.linkText}>{title}</span>
129
- {RightElement}
130
- </div>
131
- </>,
120
+ }) => {
121
+ const isSmall = useMediaQuery(breakpoints.small);
122
+ return (
123
+ <Tooltip content={title} side="right" visible={isSmall}>
124
+ <Comp {...otherProps} className={styles.link} data-active={active}>
125
+ <Icon className={styles.linkIcon} />
126
+ <div className={styles.linkContent}>
127
+ <span className={styles.linkText}>{title}</span>
128
+ {RightElement}
129
+ </div>
130
+ </Comp>
131
+ </Tooltip>
132
132
  );
133
+ };
133
134
 
134
135
  type RightElementProps = PropsWithChildren<
135
136
  {
@@ -164,7 +165,7 @@ type UpdateInfoProps = {
164
165
  export const UpdateInfo: FC<UpdateInfoProps> = ({
165
166
  href,
166
167
  onClick,
167
- component = "a",
168
+ component: Comp = "a",
168
169
  }) => (
169
170
  <div className={styles.updateInfo}>
170
171
  <h3 className={styles.updateInfoTitle}>Updates Available</h3>
@@ -176,11 +177,9 @@ export const UpdateInfo: FC<UpdateInfoProps> = ({
176
177
  {
177
178
  // TODO(DT-1942): This should be a Button with a link component for
178
179
  // accessibility
179
- createElement(
180
- component,
181
- { ...{ className: styles.updateInfoLink, onClick }, href },
182
- "Learn more",
183
- )
184
180
  }
181
+ <Comp className={styles.updateInfoLink} href={href} onClick={onClick}>
182
+ Learn more
183
+ </Comp>
185
184
  </div>
186
185
  );
@@ -0,0 +1,59 @@
1
+ .logo {
2
+ display: block;
3
+ height: 40px;
4
+ margin-left: 4px;
5
+ width: 40px;
6
+ &[aria-haspopup="menu"]:not([data-disabled]) {
7
+ cursor: pointer;
8
+ }
9
+ }
10
+
11
+ .environmentDotBase {
12
+ border-radius: 50%;
13
+ flex-shrink: 0;
14
+ height: 10px;
15
+ width: 10px;
16
+ }
17
+
18
+ .environmentDot-prod {
19
+ composes: environmentDotBase;
20
+ background-color: var(--purple10);
21
+ }
22
+
23
+ .environmentDot-stage {
24
+ composes: environmentDotBase;
25
+ background-color: var(--indigo10);
26
+ }
27
+
28
+ .environmentDot-dev {
29
+ composes: environmentDotBase;
30
+ background-color: var(--amber10);
31
+ }
32
+
33
+ .menuItemEnvironmentDot {
34
+ margin-left: 2px;
35
+ margin-right: 2px;
36
+ }
37
+
38
+ .activeEnvironmentDot {
39
+ bottom: 0;
40
+ outline-color: var(--grey2);
41
+ outline-style: solid;
42
+ outline-width: 3px;
43
+ position: absolute;
44
+ right: 0;
45
+ transform: translate(50%, 50%);
46
+ }
47
+
48
+ .activeEnvironmentName {
49
+ font-weight: 500;
50
+ line-height: 1.25rem;
51
+ overflow: hidden;
52
+ text-overflow: ellipsis;
53
+ white-space: nowrap;
54
+ }
55
+
56
+ .loginIcon {
57
+ height: 24px;
58
+ width: 24px;
59
+ }
@@ -0,0 +1,13 @@
1
+ declare const styles: {
2
+ readonly "activeEnvironmentDot": string;
3
+ readonly "activeEnvironmentName": string;
4
+ readonly "environmentDot-dev": string;
5
+ readonly "environmentDot-prod": string;
6
+ readonly "environmentDot-stage": string;
7
+ readonly "environmentDotBase": string;
8
+ readonly "loginIcon": string;
9
+ readonly "logo": string;
10
+ readonly "menuItemEnvironmentDot": string;
11
+ };
12
+ export = styles;
13
+