newspack-components 4.2.0 → 4.3.0

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 (131) hide show
  1. package/dist/cjs/action-card/index.js +21 -12
  2. package/dist/cjs/action-card/style.scss +25 -2
  3. package/dist/cjs/autocomplete-tokenfield/index.js +2 -2
  4. package/dist/cjs/autocomplete-with-latest-posts/index.js +289 -0
  5. package/dist/cjs/autocomplete-with-latest-posts/style.scss +150 -0
  6. package/dist/cjs/badge/index.js +32 -0
  7. package/dist/cjs/badge/style.scss +36 -0
  8. package/dist/cjs/button/index.js +2 -0
  9. package/dist/cjs/card/core-card.js +141 -0
  10. package/dist/cjs/card/index.js +33 -0
  11. package/dist/cjs/card/style-core.scss +227 -0
  12. package/dist/cjs/card/style.scss +2 -2
  13. package/dist/cjs/card-settings-group/index.js +49 -0
  14. package/dist/cjs/card-settings-group/style.scss +33 -0
  15. package/dist/cjs/card-sortable-list/index.js +390 -0
  16. package/dist/cjs/card-sortable-list/style.scss +48 -0
  17. package/dist/cjs/confirm-dialog/index.js +59 -0
  18. package/dist/cjs/divider/index.js +42 -0
  19. package/dist/cjs/divider/style.scss +51 -0
  20. package/dist/cjs/form-token-field/style.scss +0 -5
  21. package/dist/cjs/grid/index.js +2 -1
  22. package/dist/cjs/grid/style.scss +63 -9
  23. package/dist/cjs/index.js +42 -0
  24. package/dist/cjs/modal/index.js +11 -4
  25. package/dist/cjs/modal/style.scss +43 -13
  26. package/dist/cjs/newspack-icon/style.scss +5 -3
  27. package/dist/cjs/section-header/index.js +76 -17
  28. package/dist/cjs/section-header/style.scss +109 -4
  29. package/dist/cjs/style.scss +2 -0
  30. package/dist/cjs/waiting/index.js +3 -1
  31. package/dist/cjs/waiting/style.scss +4 -0
  32. package/dist/cjs/web-preview/index.js +98 -39
  33. package/dist/cjs/web-preview/style.scss +20 -53
  34. package/dist/cjs/with-wizard/index.js +1 -1
  35. package/dist/cjs/with-wizard/style.scss +24 -6
  36. package/dist/cjs/with-wizard-screen/style.scss +39 -10
  37. package/dist/cjs/wizard/components/WizardSnackbar.js +70 -0
  38. package/dist/cjs/wizard/components/style.scss +48 -0
  39. package/dist/cjs/wizard/index.js +97 -16
  40. package/dist/cjs/wizard/store/index.js +46 -0
  41. package/dist/esm/action-card/index.js +21 -12
  42. package/dist/esm/action-card/style.scss +25 -2
  43. package/dist/esm/autocomplete-tokenfield/index.js +2 -2
  44. package/dist/esm/autocomplete-with-latest-posts/index.js +281 -0
  45. package/dist/esm/autocomplete-with-latest-posts/style.scss +150 -0
  46. package/dist/esm/badge/index.js +24 -0
  47. package/dist/esm/badge/style.scss +36 -0
  48. package/dist/esm/button/index.js +2 -0
  49. package/dist/esm/card/core-card.js +133 -0
  50. package/dist/esm/card/index.js +33 -0
  51. package/dist/esm/card/style-core.scss +227 -0
  52. package/dist/esm/card/style.scss +2 -2
  53. package/dist/esm/card-settings-group/index.js +42 -0
  54. package/dist/esm/card-settings-group/style.scss +33 -0
  55. package/dist/esm/card-sortable-list/index.js +381 -0
  56. package/dist/esm/card-sortable-list/style.scss +48 -0
  57. package/dist/esm/confirm-dialog/index.js +49 -0
  58. package/dist/esm/divider/index.js +34 -0
  59. package/dist/esm/divider/style.scss +51 -0
  60. package/dist/esm/form-token-field/style.scss +0 -5
  61. package/dist/esm/grid/index.js +2 -1
  62. package/dist/esm/grid/style.scss +63 -9
  63. package/dist/esm/index.js +6 -0
  64. package/dist/esm/modal/index.js +11 -4
  65. package/dist/esm/modal/style.scss +43 -13
  66. package/dist/esm/newspack-icon/style.scss +5 -3
  67. package/dist/esm/section-header/index.js +75 -18
  68. package/dist/esm/section-header/style.scss +109 -4
  69. package/dist/esm/style.scss +2 -0
  70. package/dist/esm/waiting/index.js +3 -1
  71. package/dist/esm/waiting/style.scss +4 -0
  72. package/dist/esm/web-preview/index.js +101 -42
  73. package/dist/esm/web-preview/style.scss +20 -53
  74. package/dist/esm/with-wizard/index.js +1 -1
  75. package/dist/esm/with-wizard/style.scss +24 -6
  76. package/dist/esm/with-wizard-screen/style.scss +39 -10
  77. package/dist/esm/wizard/components/WizardSnackbar.js +64 -0
  78. package/dist/esm/wizard/components/style.scss +48 -0
  79. package/dist/esm/wizard/index.js +101 -20
  80. package/dist/esm/wizard/store/index.js +46 -0
  81. package/package.json +5 -6
  82. package/shared/author-context.js +26 -0
  83. package/shared/hooks/use-coauthors.js +220 -0
  84. package/shared/hooks/use-coauthors.test.js +624 -0
  85. package/shared/hooks/use-custom-byline.js +47 -0
  86. package/shared/hooks/use-custom-byline.test.js +133 -0
  87. package/shared/scss/_mixins.scss +46 -0
  88. package/src/action-card/action-card.d.ts +7 -3
  89. package/src/action-card/index.js +24 -11
  90. package/src/action-card/style.scss +25 -2
  91. package/src/autocomplete-tokenfield/index.js +2 -2
  92. package/src/autocomplete-with-latest-posts/index.js +290 -0
  93. package/src/autocomplete-with-latest-posts/style.scss +150 -0
  94. package/src/badge/index.tsx +24 -0
  95. package/src/badge/style.scss +36 -0
  96. package/src/button/index.tsx +3 -2
  97. package/src/card/core-card.js +147 -0
  98. package/src/card/index.js +39 -1
  99. package/src/card/style-core.scss +227 -0
  100. package/src/card/style.scss +2 -2
  101. package/src/card-settings-group/README.md +43 -0
  102. package/src/card-settings-group/index.tsx +53 -0
  103. package/src/card-settings-group/style.scss +33 -0
  104. package/src/card-sortable-list/README.md +51 -0
  105. package/src/card-sortable-list/index.tsx +412 -0
  106. package/src/card-sortable-list/style.scss +48 -0
  107. package/src/confirm-dialog/index.tsx +64 -0
  108. package/src/divider/README.md +25 -0
  109. package/src/divider/index.js +31 -0
  110. package/src/divider/style.scss +51 -0
  111. package/src/form-token-field/style.scss +0 -5
  112. package/src/grid/index.tsx +2 -1
  113. package/src/grid/style.scss +63 -9
  114. package/src/index.js +6 -0
  115. package/src/modal/index.js +12 -3
  116. package/src/modal/style.scss +43 -13
  117. package/src/newspack-icon/style.scss +5 -3
  118. package/src/section-header/index.js +72 -13
  119. package/src/section-header/style.scss +109 -4
  120. package/src/style.scss +2 -0
  121. package/src/waiting/index.js +2 -1
  122. package/src/waiting/style.scss +4 -0
  123. package/src/web-preview/index.js +90 -35
  124. package/src/web-preview/style.scss +20 -53
  125. package/src/with-wizard/index.js +1 -1
  126. package/src/with-wizard/style.scss +24 -6
  127. package/src/with-wizard-screen/style.scss +39 -10
  128. package/src/wizard/components/WizardSnackbar.js +58 -0
  129. package/src/wizard/components/style.scss +48 -0
  130. package/src/wizard/index.js +108 -14
  131. package/src/wizard/store/index.js +26 -0
@@ -55,24 +55,63 @@ class WebPreview extends _element.Component {
55
55
  }
56
56
 
57
57
  /**
58
- * Add or remove applicable body classes
58
+ * Add or remove applicable body classes and keyboard event listeners
59
59
  */
60
- componentDidUpdate() {
60
+ componentDidUpdate(prevProps, prevState) {
61
61
  if (this.state.isPreviewVisible === true) {
62
62
  document.body.classList.add('newspack-web-preview--open');
63
+ if (prevState.isPreviewVisible === false) {
64
+ // Add event listener when modal opens
65
+ document.addEventListener('keydown', this.handleKeyDown);
66
+ }
63
67
  } else {
64
68
  document.body.classList.remove('newspack-web-preview--open');
69
+ if (prevState.isPreviewVisible === true) {
70
+ // Remove event listener when modal closes
71
+ document.removeEventListener('keydown', this.handleKeyDown);
72
+ }
65
73
  }
66
74
  }
67
75
 
76
+ /**
77
+ * Clean up event listeners on unmount
78
+ */
79
+ componentWillUnmount() {
80
+ document.removeEventListener('keydown', this.handleKeyDown);
81
+ document.body.classList.remove('newspack-web-preview--open');
82
+ }
83
+
84
+ /**
85
+ * Handle keyboard events
86
+ */
87
+ handleKeyDown = event => {
88
+ if (event.key === 'Escape' && this.state.isPreviewVisible) {
89
+ this.closePreview();
90
+ }
91
+ };
92
+
93
+ /**
94
+ * Close the preview modal
95
+ */
96
+ closePreview = () => {
97
+ const {
98
+ onClose = () => {}
99
+ } = this.props;
100
+ onClose();
101
+ this.setState({
102
+ isPreviewVisible: false,
103
+ loaded: false
104
+ });
105
+ };
106
+
68
107
  /**
69
108
  * Create JSX for the modal
70
109
  */
71
110
  getWebPreviewModal = () => {
72
111
  const {
73
112
  beforeLoad = () => {},
74
- onClose = () => {},
75
- url
113
+ url,
114
+ title
76
115
  } = this.props;
77
116
  const {
78
117
  device,
@@ -83,6 +122,12 @@ class WebPreview extends _element.Component {
83
122
  return null;
84
123
  }
85
124
  const classes = (0, _classnames.default)('newspack-web-preview', device, loaded && 'is-loaded');
125
+ let icon = _icons.mobile;
126
+ if (device === 'desktop') {
127
+ icon = _icons.desktop;
128
+ } else if (device === 'tablet') {
129
+ icon = _icons.tablet;
130
+ }
86
131
  beforeLoad();
87
132
  return (0, _element.createPortal)(/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
88
133
  className: classes,
@@ -90,45 +135,59 @@ class WebPreview extends _element.Component {
90
135
  className: "newspack-web-preview__interior",
91
136
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
92
137
  className: "newspack-web-preview__toolbar",
93
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
138
+ children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
94
139
  className: "newspack-web-preview__toolbar-left",
95
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.ButtonGroup, {
96
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
97
- onClick: () => this.setState({
98
- device: 'desktop'
99
- }),
100
- variant: 'desktop' === device && 'primary',
101
- icon: _icons.desktop,
102
- label: (0, _i18n.__)('Preview Desktop Size', 'newspack-plugin')
103
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
104
- onClick: () => this.setState({
105
- device: 'tablet'
106
- }),
107
- variant: 'tablet' === device && 'primary',
108
- icon: _icons.tablet,
109
- label: (0, _i18n.__)('Preview Tablet Size', 'newspack-plugin')
110
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
111
- onClick: () => this.setState({
112
- device: 'phone'
113
- }),
114
- variant: 'phone' === device && 'primary',
115
- icon: _icons.mobile,
116
- label: (0, _i18n.__)('Preview Phone Size', 'newspack-plugin')
117
- })]
140
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
141
+ children: title
118
142
  })
119
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
143
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
120
144
  className: "newspack-web-preview__toolbar-right",
121
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
122
- onClick: () => {
123
- onClose();
124
- this.setState({
125
- isPreviewVisible: false,
126
- loaded: false
127
- });
128
- },
129
- icon: _icons.closeSmall,
145
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownMenu, {
146
+ icon: icon,
147
+ label: (0, _i18n.__)('Preview Size', 'newspack-plugin'),
148
+ children: ({
149
+ onClose: onDropdownClose
150
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
151
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
152
+ icon: device === 'desktop' ? _icons.check : null,
153
+ role: "menuitemradio",
154
+ isSelected: device === 'desktop',
155
+ onClick: () => {
156
+ this.setState({
157
+ device: 'desktop'
158
+ });
159
+ onDropdownClose();
160
+ },
161
+ children: (0, _i18n.__)('Desktop', 'newspack-plugin')
162
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
163
+ icon: device === 'tablet' ? _icons.check : null,
164
+ role: "menuitemradio",
165
+ isSelected: device === 'tablet',
166
+ onClick: () => {
167
+ this.setState({
168
+ device: 'tablet'
169
+ });
170
+ onDropdownClose();
171
+ },
172
+ children: (0, _i18n.__)('Tablet', 'newspack-plugin')
173
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
174
+ icon: device === 'phone' ? _icons.check : null,
175
+ role: "menuitemradio",
176
+ isSelected: device === 'phone',
177
+ onClick: () => {
178
+ this.setState({
179
+ device: 'phone'
180
+ });
181
+ onDropdownClose();
182
+ },
183
+ children: (0, _i18n.__)('Phone', 'newspack-plugin')
184
+ })]
185
+ })
186
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
187
+ onClick: this.closePreview,
188
+ icon: _icons.close,
130
189
  label: (0, _i18n.__)('Close Preview', 'newspack-plugin')
131
- })
190
+ })]
132
191
  })]
133
192
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
134
193
  className: "newspack-web-preview__content",
@@ -13,8 +13,10 @@
13
13
  --wp-admin-theme-color-darker-10--rgb: #{colors.$primary-700--rgb};
14
14
  --wp-admin-theme-color-darker-20: #{colors.$primary-800};
15
15
  --wp-admin-theme-color-darker-20--rgb: #{colors.$primary-800--rgb};
16
+ --wp-admin-theme-color-lighter-10: #{colors.$primary-000};
17
+ --wp-admin-theme-color-lighter-10--rgb: #{colors.$primary-000--rgb};
16
18
 
17
- background: #{colors.$neutral-700};
19
+ background: color-mix(in srgb, colors.$neutral-1000, transparent 65%);
18
20
  box-sizing: border-box;
19
21
  height: 100%;
20
22
  left: 0;
@@ -27,11 +29,11 @@
27
29
  z-index: 99999;
28
30
 
29
31
  &.phone iframe {
30
- max-width: 380px;
32
+ max-width: 360px;
31
33
  }
32
34
 
33
35
  &.tablet iframe {
34
- max-width: 768px;
36
+ max-width: 780px;
35
37
  }
36
38
 
37
39
  &.is-loaded iframe {
@@ -46,7 +48,7 @@
46
48
  animation: appear-animation 125ms ease-in-out;
47
49
  animation-fill-mode: forwards;
48
50
  background: white;
49
- border-radius: 2px;
51
+ border-radius: 8px;
50
52
  overflow: hidden;
51
53
  height: 100%;
52
54
  width: 100%;
@@ -54,19 +56,18 @@
54
56
 
55
57
  &__content {
56
58
  background: wp-colors.$gray-100;
57
- height: calc(100% - 49px);
59
+ height: calc(100% - 72px);
58
60
  -webkit-overflow-scrolling: touch;
59
61
  overflow-x: hidden;
60
62
  width: 100%;
61
63
 
62
64
  iframe {
63
- background: #fff;
65
+ background: white;
64
66
  display: block;
65
67
  height: 100%;
66
68
  margin: 0 auto;
67
69
  max-width: 100%;
68
70
  opacity: 0;
69
- outline: 1px solid wp-colors.$gray-300;
70
71
  padding: 0;
71
72
  pointer-events: all;
72
73
  transition: max-width 125ms ease-in-out, opacity 250ms ease-in-out;
@@ -85,62 +86,28 @@
85
86
  }
86
87
 
87
88
  &__toolbar {
89
+ align-items: center;
88
90
  border-bottom: 1px solid wp-colors.$gray-300;
89
91
  display: flex;
90
- padding: 6px;
92
+ gap: 16px;
93
+ justify-content: space-between;
94
+ min-height: 71px;
95
+ padding: 12px 24px;
91
96
 
92
97
  &-left {
93
- flex: 0 0 auto;
98
+ display: flex;
94
99
 
95
- .newspack-button-group {
96
- display: flex;
100
+ h3 {
97
101
  margin: 0;
98
102
  }
99
-
100
- .newspack-button {
101
- display: none;
102
- padding: 0 !important;
103
-
104
- &.is-selected {
105
- background: var(--wp-admin-theme-color);
106
- color: white;
107
-
108
- &:active,
109
- &:focus,
110
- &:hover {
111
- box-shadow: none !important;
112
- color: white;
113
- outline: none;
114
- }
115
-
116
- &:focus {
117
- box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color), inset 0 0 0 3px white !important;
118
- }
119
- }
120
-
121
- @media screen and ( min-width: 528px ) {
122
- &.is-phone,
123
- &.is-tablet {
124
- display: flex;
125
- }
126
- }
127
-
128
- @media screen and ( min-width: 816px ) {
129
- &.is-desktop {
130
- display: flex;
131
- }
132
- }
133
- }
134
103
  }
135
104
 
136
105
  &-right {
137
- display: flex;
138
- flex: 1;
139
- justify-content: flex-end;
140
- }
141
-
142
- .newspack-button {
143
- border-radius: 0 !important;
106
+ display: grid;
107
+ gap: 8px;
108
+ grid-template-columns: repeat(2, 1fr);
109
+ justify-self: end;
110
+ margin-left: auto;
144
111
  }
145
112
  }
146
113
  }
@@ -326,7 +326,7 @@ function withWizard(WrappedComponent, requiredPlugins) {
326
326
  callback
327
327
  } = this.state.confirmation;
328
328
  return message && callback && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Modal, {
329
- isNarrow: true,
329
+ size: "small",
330
330
  hideTitle: !title,
331
331
  title: title,
332
332
  onRequestClose: () => this.setState({
@@ -3,11 +3,21 @@
3
3
  */
4
4
 
5
5
  @use "~@wordpress/base-styles/colors" as wp-colors;
6
+ @use "../../../colors/colors.module" as colors;
6
7
 
7
8
  // Styling for full-page-react Wizards (ignoring admin-header-only wizards).
8
9
  body.newspack-wizard-page:not(.newspack-admin-header) {
9
-
10
- background: white;
10
+ --wp-admin-theme-color: #{colors.$primary-600};
11
+ --wp-admin-theme-color--rgb: #{colors.$primary-600--rgb};
12
+ --wp-admin-theme-color-darker-10: #{colors.$primary-700};
13
+ --wp-admin-theme-color-darker-10--rgb: #{colors.$primary-700--rgb};
14
+ --wp-admin-theme-color-darker-20: #{colors.$primary-800};
15
+ --wp-admin-theme-color-darker-20--rgb: #{colors.$primary-800--rgb};
16
+ --wp-admin-theme-color-lighter-10: #{colors.$primary-000};
17
+ --wp-admin-theme-color-lighter-10--rgb: #{colors.$primary-000--rgb};
18
+ --wp-components-color-accent: #{colors.$primary-600};
19
+
20
+ background: #{wp-colors.$white};
11
21
 
12
22
  // Reset Padding
13
23
  #wpcontent {
@@ -18,6 +28,14 @@ body.newspack-wizard-page:not(.newspack-admin-header) {
18
28
  padding-bottom: 220px;
19
29
  min-height: 100vh;
20
30
 
31
+ @media screen and ( min-width: 600px ) {
32
+ min-height: calc(100vh - 46px);
33
+ }
34
+
35
+ @media screen and ( min-width: 783px ) {
36
+ min-height: calc(100vh - 32px);
37
+ }
38
+
21
39
  // For admin notices directly ">" at top of page above the Wizard header.
22
40
  // PHP code should hide these notices, but just incase add this style.
23
41
  > .notice {
@@ -29,8 +47,8 @@ body.newspack-wizard-page:not(.newspack-admin-header) {
29
47
  padding-bottom: 202px;
30
48
  }
31
49
 
32
- @media screen and ( min-width: 1128px ) {
33
- padding-bottom: 168px;
50
+ @media screen and ( min-width: 1054px ) {
51
+ padding-bottom: 136px;
34
52
  }
35
53
  }
36
54
  }
@@ -134,7 +152,7 @@ svg {
134
152
  0 96px 0 0 wp-colors.$gray-700;
135
153
  height: 24px;
136
154
  margin: 68px auto 0;
137
- max-width: 1040px;
155
+ max-width: 1006px;
138
156
  width: calc(100% - ( 32px * 2 ));
139
157
 
140
158
  @media screen and ( min-width: 744px ) {
@@ -250,7 +268,7 @@ svg {
250
268
  0 96px 0 0 wp-colors.$gray-700;
251
269
  height: 24px;
252
270
  margin: 0 auto;
253
- max-width: 1040px;
271
+ max-width: 1006px;
254
272
  width: 100%;
255
273
 
256
274
  @media screen and ( min-width: 744px ) {
@@ -13,6 +13,8 @@
13
13
  --wp-admin-theme-color-darker-10--rgb: #{colors.$primary-700--rgb};
14
14
  --wp-admin-theme-color-darker-20: #{colors.$primary-800};
15
15
  --wp-admin-theme-color-darker-20--rgb: #{colors.$primary-800--rgb};
16
+ --wp-admin-theme-color-lighter-10: #{colors.$primary-000};
17
+ --wp-admin-theme-color-lighter-10--rgb: #{colors.$primary-000--rgb};
16
18
 
17
19
  color: wp-colors.$gray-900;
18
20
 
@@ -44,12 +46,39 @@
44
46
  }
45
47
 
46
48
  &__header {
49
+ align-items: center;
47
50
  background: white;
51
+ border-bottom: 1px solid wp-colors.$gray-300;
52
+ display: flex;
53
+ .newspack-wizard__fixed-header & {
54
+ position: sticky;
55
+ top: 0;
56
+ width: 100%;
57
+ z-index: 1000;
58
+ .admin-bar & {
59
+ @media only screen and ( min-width: 601px ) {
60
+ top: 46px;
61
+ }
62
+ @media only screen and ( min-width: 782px ) {
63
+ top: 32px;
64
+ }
65
+ }
66
+ }
67
+ &__inner {
68
+ flex: 1;
69
+ }
70
+ &__actions {
71
+ align-items: center;
72
+ display: flex;
73
+ flex: 1 1 auto;
74
+ gap: 8px;
75
+ justify-content: flex-end;
76
+ padding: 0 24px 0 0;
77
+ }
48
78
  }
49
79
 
50
80
  &__title {
51
81
  align-items: center;
52
- border-bottom: 1px solid wp-colors.$gray-300;
53
82
  display: flex;
54
83
 
55
84
  h2 {
@@ -62,7 +91,7 @@
62
91
  display: flex;
63
92
  padding: 0 24px;
64
93
 
65
- span {
94
+ > span {
66
95
  color: wp-colors.$gray-700;
67
96
  display: none;
68
97
  margin-left: 8px;
@@ -119,14 +148,14 @@
119
148
  }
120
149
  }
121
150
 
151
+ &__section-header {
152
+ margin-bottom: 32px;
153
+ }
154
+
122
155
  &__content {
123
156
  margin: 0 auto;
124
- max-width: 1208px;
125
- padding: 0 16px;
126
-
127
- @media screen and ( min-width: 744px ) {
128
- padding: 40px 84px;
129
- }
157
+ max-width: calc(calc(var(--newspack-wizard-section-space) * 2) + var(--newspack-wizard-section-width));
158
+ padding: calc(var(--newspack-wizard-section-space) * 2) var(--newspack-wizard-section-space) 0;
130
159
 
131
160
  // Typography
132
161
 
@@ -141,11 +170,11 @@
141
170
 
142
171
  // Thematic Break
143
172
 
144
- hr {
173
+ hr:not(.newspack-divider) {
145
174
  background: wp-colors.$gray-300;
146
175
  border: 0;
147
176
  height: 1px;
148
- margin: 48px 0;
177
+ margin: 32px 0;
149
178
 
150
179
  @media screen and ( min-width: 744px ) {
151
180
  margin: 64px 0;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _components = require("@wordpress/components");
9
+ var _data = require("@wordpress/data");
10
+ var _store = require("../store");
11
+ require("./style.scss");
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ /**
15
+ * Snackbar.
16
+ */
17
+
18
+ /**
19
+ * WordPress dependencies.
20
+ */
21
+
22
+ /**
23
+ * Internal dependencies.
24
+ */
25
+
26
+ /**
27
+ * External dependencies.
28
+ */
29
+
30
+ /**
31
+ * WizardSnackbar component.
32
+ *
33
+ * @param {Object} props - The component props.
34
+ * @param {Object[]} props.actions - The actions to display in the snackbar.
35
+ * @param {JSX.Element} props.children - The component children.
36
+ * @param {Object} props.props - The component props. See: https://wordpress.github.io/gutenberg/?path=/docs/components-snackbar--docs
37
+ * @param {string} props.position - The snackbar position.
38
+ * @param {string} props.type - The snackbar type: 'info', 'success', 'warning', or 'error'.
39
+ * @return {JSX.Element} The component.
40
+ */const WizardSnackbar = ({
41
+ children,
42
+ position = 'bottom-left',
43
+ type = 'info',
44
+ actions = [],
45
+ ...props
46
+ }) => {
47
+ const className = (0, _classnames.default)('newspack-wizard__snackbar', props.className, `newspack-wizard__snackbar--${position}`, `newspack-wizard__snackbar--${type}`);
48
+ const {
49
+ removeNotice,
50
+ resetNotices
51
+ } = (0, _data.useDispatch)(_store.WIZARD_STORE_NAMESPACE);
52
+ const onRemove = () => {
53
+ if (props.onRemove) {
54
+ props.onRemove();
55
+ }
56
+ if (props.id) {
57
+ removeNotice(props.id);
58
+ } else {
59
+ resetNotices();
60
+ }
61
+ };
62
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Snackbar, {
63
+ className: className,
64
+ ...props,
65
+ onRemove: onRemove,
66
+ actions: actions,
67
+ children: children
68
+ });
69
+ };
70
+ var _default = exports.default = WizardSnackbar;
@@ -0,0 +1,48 @@
1
+ .newspack-wizard {
2
+ &__snackbar {
3
+ border-bottom: 2px solid transparent;
4
+ bottom: 16px;
5
+ left: 16px;
6
+ max-width: calc(100vw - 32px);
7
+ position: fixed;
8
+ z-index: 99999;
9
+ &--success {
10
+ border-color: var(--newspack-ui-color-success-60);
11
+ }
12
+ &--error {
13
+ border-color: var(--newspack-ui-color-error-60);
14
+ }
15
+ &--warning {
16
+ border-color: var(--newspack-ui-color-warning-40);
17
+ }
18
+ @media screen and ( min-width: 783px ) {
19
+ left: calc(36px + 16px); /* 36px for admin menu bar */
20
+ }
21
+ @media screen and ( min-width: 960px ) {
22
+ left: calc(160px + 16px); /* 160px for admin menu bar */
23
+ }
24
+ &.newspack-wizard__snackbar--bottom-right,
25
+ &.newspack-wizard__snackbar--top-right {
26
+ left: auto;
27
+ right: calc(16px);
28
+ }
29
+ &.newspack-wizard__snackbar--top-left,
30
+ &.newspack-wizard__snackbar--top-right {
31
+ bottom: auto;
32
+ top: calc(16px + 46px); /* 46px for admin bar */
33
+ @media screen and ( min-width: 783px ) {
34
+ top: calc(16px + 32px); /* 32px for admin bar */
35
+ }
36
+ }
37
+ a,
38
+ .components-button.is-link {
39
+ color: var(--newspack-ui-color-neutral-0);
40
+ cursor: pointer;
41
+ margin-left: 16px;
42
+ &:hover,
43
+ &:focus {
44
+ color: var(--newspack-ui-color-neutral-10);
45
+ }
46
+ }
47
+ }
48
+ }