newspack-components 2.0.3 → 2.1.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.
- package/copy-styles.js +1 -1
- package/dist/cjs/action-card/index.js +29 -20
- package/dist/cjs/action-card/style.scss +52 -27
- package/dist/cjs/autocomplete-tokenfield/style.scss +4 -4
- package/dist/cjs/autocomplete-with-suggestions/index.js +3 -2
- package/dist/cjs/autocomplete-with-suggestions/style.scss +19 -20
- package/dist/cjs/button/index.js +2 -13
- package/dist/cjs/button/style.scss +3 -344
- package/dist/cjs/button-card/index.js +11 -6
- package/dist/cjs/button-card/style.scss +60 -30
- package/dist/cjs/card/index.js +3 -1
- package/dist/cjs/card/style.scss +29 -62
- package/dist/cjs/category-autocomplete/index.js +52 -13
- package/dist/cjs/category-autocomplete/style.scss +20 -22
- package/dist/cjs/color-picker/index.js +17 -35
- package/dist/cjs/color-picker/style.scss +20 -160
- package/dist/cjs/custom-select-control/style.scss +12 -42
- package/dist/cjs/footer/index.js +21 -7
- package/dist/cjs/footer/style.scss +9 -10
- package/dist/cjs/form-token-field/index.js +2 -2
- package/dist/cjs/form-token-field/style.scss +8 -103
- package/dist/cjs/global-notices/index.js +2 -1
- package/dist/cjs/grid/style.scss +14 -1
- package/dist/cjs/handoff/index.js +7 -7
- package/dist/cjs/image-upload/index.js +1 -1
- package/dist/cjs/image-upload/style.scss +10 -11
- package/dist/cjs/index.js +7 -53
- package/dist/cjs/modal/index.js +0 -3
- package/dist/cjs/modal/style.scss +19 -131
- package/dist/cjs/newspack-icon/index.js +4 -2
- package/dist/cjs/newspack-icon/style.scss +15 -0
- package/dist/cjs/notice/index.js +8 -9
- package/dist/cjs/notice/style.scss +38 -10
- package/dist/cjs/plugin-installer/index.js +1 -1
- package/dist/cjs/plugin-settings/SettingsSection.js +74 -43
- package/dist/cjs/plugin-settings/index.js +34 -30
- package/dist/cjs/plugin-settings/style.scss +7 -0
- package/dist/cjs/plugin-toggle/index.js +22 -1
- package/dist/cjs/popover/style.scss +2 -2
- package/dist/cjs/radio-control/style.scss +1 -2
- package/dist/cjs/section-header/index.js +18 -5
- package/dist/cjs/section-header/style.scss +22 -1
- package/dist/cjs/select-control/ButtonGroupControl.js +8 -8
- package/dist/cjs/select-control/GroupedSelectControl.js +33 -30
- package/dist/cjs/select-control/index.js +1 -2
- package/dist/cjs/select-control/style.scss +46 -87
- package/dist/cjs/settings/MinMaxSetting.js +4 -2
- package/dist/cjs/settings/SettingsCard.js +6 -1
- package/dist/cjs/settings/SettingsSection.js +4 -4
- package/dist/cjs/settings/style.scss +32 -4
- package/dist/cjs/style-card/index.js +10 -6
- package/dist/cjs/style-card/style.scss +12 -8
- package/dist/cjs/style.scss +44 -0
- package/dist/cjs/tabbed-navigation/index.js +13 -20
- package/dist/cjs/tabbed-navigation/style.scss +56 -34
- package/dist/cjs/text-control/index.js +0 -3
- package/dist/cjs/text-control/style.scss +0 -126
- package/dist/cjs/waiting/index.js +9 -25
- package/dist/cjs/waiting/style.scss +9 -20
- package/dist/cjs/web-preview/index.js +18 -30
- package/dist/cjs/web-preview/style.scss +33 -26
- package/dist/cjs/with-wizard/index.js +4 -2
- package/dist/cjs/with-wizard/style.scss +44 -89
- package/dist/cjs/with-wizard-screen/index.js +17 -21
- package/dist/cjs/with-wizard-screen/style.scss +74 -121
- package/dist/cjs/wizard/components/WizardError.js +86 -0
- package/dist/cjs/wizard/index.js +145 -0
- package/dist/cjs/wizard/store/index.js +178 -0
- package/dist/cjs/wizard/store/utils.js +31 -0
- package/dist/esm/action-card/index.js +30 -21
- package/dist/esm/action-card/style.scss +52 -27
- package/dist/esm/autocomplete-tokenfield/style.scss +4 -4
- package/dist/esm/autocomplete-with-suggestions/index.js +3 -2
- package/dist/esm/autocomplete-with-suggestions/style.scss +19 -20
- package/dist/esm/button/index.js +2 -12
- package/dist/esm/button/style.scss +3 -344
- package/dist/esm/button-card/index.js +10 -6
- package/dist/esm/button-card/style.scss +60 -30
- package/dist/esm/card/index.js +3 -1
- package/dist/esm/card/style.scss +29 -62
- package/dist/esm/category-autocomplete/index.js +54 -14
- package/dist/esm/category-autocomplete/style.scss +20 -22
- package/dist/esm/color-picker/index.js +15 -34
- package/dist/esm/color-picker/style.scss +20 -160
- package/dist/esm/custom-select-control/style.scss +12 -42
- package/dist/esm/footer/index.js +21 -7
- package/dist/esm/footer/style.scss +9 -10
- package/dist/esm/form-token-field/index.js +2 -2
- package/dist/esm/form-token-field/style.scss +8 -103
- package/dist/esm/global-notices/index.js +2 -1
- package/dist/esm/grid/style.scss +14 -1
- package/dist/esm/handoff/index.js +7 -7
- package/dist/esm/image-upload/index.js +1 -1
- package/dist/esm/image-upload/style.scss +10 -11
- package/dist/esm/index.js +3 -8
- package/dist/esm/modal/index.js +0 -3
- package/dist/esm/modal/style.scss +19 -131
- package/dist/esm/newspack-icon/index.js +4 -2
- package/dist/esm/newspack-icon/style.scss +15 -0
- package/dist/esm/notice/index.js +8 -3
- package/dist/esm/notice/style.scss +38 -10
- package/dist/esm/plugin-installer/index.js +2 -1
- package/dist/esm/plugin-settings/SettingsSection.js +72 -44
- package/dist/esm/plugin-settings/index.js +34 -30
- package/dist/esm/plugin-settings/style.scss +7 -0
- package/dist/esm/plugin-toggle/index.js +23 -1
- package/dist/esm/popover/style.scss +2 -2
- package/dist/esm/radio-control/style.scss +1 -2
- package/dist/esm/section-header/index.js +17 -5
- package/dist/esm/section-header/style.scss +22 -1
- package/dist/esm/select-control/ButtonGroupControl.js +8 -8
- package/dist/esm/select-control/GroupedSelectControl.js +33 -30
- package/dist/esm/select-control/index.js +1 -2
- package/dist/esm/select-control/style.scss +46 -87
- package/dist/esm/settings/MinMaxSetting.js +3 -2
- package/dist/esm/settings/SettingsCard.js +6 -1
- package/dist/esm/settings/SettingsSection.js +5 -5
- package/dist/esm/settings/style.scss +32 -4
- package/dist/esm/style-card/index.js +11 -8
- package/dist/esm/style-card/style.scss +12 -8
- package/dist/esm/style.scss +44 -0
- package/dist/esm/tabbed-navigation/index.js +14 -22
- package/dist/esm/tabbed-navigation/style.scss +56 -34
- package/dist/esm/text-control/index.js +0 -3
- package/dist/esm/text-control/style.scss +0 -126
- package/dist/esm/waiting/index.js +9 -22
- package/dist/esm/waiting/style.scss +9 -20
- package/dist/esm/web-preview/index.js +12 -25
- package/dist/esm/web-preview/style.scss +33 -26
- package/dist/esm/with-wizard/index.js +4 -2
- package/dist/esm/with-wizard/style.scss +44 -89
- package/dist/esm/with-wizard-screen/index.js +18 -22
- package/dist/esm/with-wizard-screen/style.scss +74 -121
- package/dist/esm/wizard/components/WizardError.js +78 -0
- package/dist/esm/wizard/index.js +128 -0
- package/dist/esm/wizard/store/index.js +161 -0
- package/dist/esm/wizard/store/utils.js +17 -0
- package/package.json +1 -1
- package/shared/scss/_colors.scss +15 -0
- package/src/action-card/index.js +28 -18
- package/src/action-card/style.scss +52 -27
- package/src/autocomplete-tokenfield/style.scss +4 -4
- package/src/autocomplete-with-suggestions/index.js +4 -2
- package/src/autocomplete-with-suggestions/style.scss +19 -20
- package/src/button/index.js +2 -9
- package/src/button/style.scss +3 -344
- package/src/button-card/index.js +19 -5
- package/src/button-card/style.scss +60 -30
- package/src/card/index.js +4 -0
- package/src/card/style.scss +29 -62
- package/src/category-autocomplete/index.js +51 -18
- package/src/category-autocomplete/style.scss +20 -22
- package/src/color-picker/index.js +16 -22
- package/src/color-picker/style.scss +20 -160
- package/src/custom-select-control/style.scss +12 -42
- package/src/footer/index.js +19 -8
- package/src/footer/style.scss +9 -10
- package/src/form-token-field/index.js +1 -1
- package/src/form-token-field/style.scss +8 -103
- package/src/global-notices/index.js +1 -1
- package/src/grid/style.scss +14 -1
- package/src/handoff/index.js +7 -7
- package/src/image-upload/style.scss +10 -11
- package/src/index.js +3 -7
- package/src/modal/index.js +2 -5
- package/src/modal/style.scss +19 -131
- package/src/newspack-icon/index.js +7 -2
- package/src/newspack-icon/style.scss +15 -0
- package/src/notice/index.js +7 -1
- package/src/notice/style.scss +38 -10
- package/src/plugin-installer/index.js +2 -2
- package/src/plugin-settings/SettingsSection.js +64 -26
- package/src/plugin-settings/index.js +23 -7
- package/src/plugin-settings/style.scss +7 -0
- package/src/plugin-toggle/index.js +35 -9
- package/src/popover/style.scss +2 -2
- package/src/radio-control/style.scss +1 -2
- package/src/section-header/index.js +25 -6
- package/src/section-header/style.scss +22 -1
- package/src/select-control/ButtonGroupControl.js +13 -6
- package/src/select-control/GroupedSelectControl.js +26 -24
- package/src/select-control/index.js +1 -2
- package/src/select-control/style.scss +46 -87
- package/src/settings/MinMaxSetting.js +2 -1
- package/src/settings/SettingsCard.js +9 -7
- package/src/settings/SettingsSection.js +4 -4
- package/src/settings/style.scss +32 -4
- package/src/style-card/index.js +14 -16
- package/src/style-card/style.scss +12 -8
- package/src/style.scss +44 -0
- package/src/tabbed-navigation/index.js +12 -24
- package/src/tabbed-navigation/style.scss +56 -34
- package/src/text-control/index.js +1 -2
- package/src/text-control/style.scss +0 -126
- package/src/waiting/index.js +7 -18
- package/src/waiting/style.scss +9 -20
- package/src/web-preview/index.js +12 -33
- package/src/web-preview/style.scss +33 -26
- package/src/with-wizard/index.js +7 -5
- package/src/with-wizard/style.scss +44 -89
- package/src/with-wizard-screen/index.js +14 -17
- package/src/with-wizard-screen/style.scss +74 -121
- package/src/wizard/components/WizardError.js +57 -0
- package/src/wizard/index.js +133 -0
- package/src/wizard/store/index.js +126 -0
- package/src/wizard/store/utils.js +16 -0
- package/dist/cjs/button-group/index.js +0 -57
- package/dist/cjs/button-group/style.scss +0 -73
- package/dist/cjs/checkbox-control/index.js +0 -63
- package/dist/cjs/checkbox-control/style.scss +0 -78
- package/dist/cjs/preview-box/index.js +0 -36
- package/dist/cjs/preview-box/style.scss +0 -18
- package/dist/cjs/textarea-control/index.js +0 -54
- package/dist/cjs/textarea-control/style.scss +0 -76
- package/dist/cjs/toggle-control/index.js +0 -58
- package/dist/cjs/toggle-control/style.scss +0 -74
- package/dist/cjs/toggle-group/index.js +0 -71
- package/dist/cjs/toggle-group/style.scss +0 -28
- package/dist/cjs/wizard-pagination/index.js +0 -71
- package/dist/cjs/wizard-pagination/style.scss +0 -74
- package/dist/esm/button-group/index.js +0 -43
- package/dist/esm/button-group/style.scss +0 -73
- package/dist/esm/checkbox-control/index.js +0 -49
- package/dist/esm/checkbox-control/style.scss +0 -78
- package/dist/esm/preview-box/index.js +0 -30
- package/dist/esm/preview-box/style.scss +0 -18
- package/dist/esm/textarea-control/index.js +0 -40
- package/dist/esm/textarea-control/style.scss +0 -76
- package/dist/esm/toggle-control/index.js +0 -44
- package/dist/esm/toggle-control/style.scss +0 -74
- package/dist/esm/toggle-group/index.js +0 -58
- package/dist/esm/toggle-group/style.scss +0 -28
- package/dist/esm/wizard-pagination/index.js +0 -57
- package/dist/esm/wizard-pagination/style.scss +0 -74
- package/src/button-group/index.js +0 -35
- package/src/button-group/style.scss +0 -73
- package/src/checkbox-control/index.js +0 -38
- package/src/checkbox-control/style.scss +0 -78
- package/src/preview-box/index.js +0 -18
- package/src/preview-box/style.scss +0 -18
- package/src/textarea-control/index.js +0 -32
- package/src/textarea-control/style.scss +0 -76
- package/src/toggle-control/index.js +0 -38
- package/src/toggle-control/style.scss +0 -74
- package/src/toggle-group/index.js +0 -43
- package/src/toggle-group/style.scss +0 -28
- package/src/wizard-pagination/index.js +0 -59
- package/src/wizard-pagination/style.scss +0 -74
|
@@ -40,60 +40,13 @@ svg {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
//
|
|
43
|
+
// Blue Screen
|
|
44
44
|
|
|
45
|
-
.
|
|
45
|
+
.newspack-wizard__blue {
|
|
46
46
|
#wpwrap {
|
|
47
47
|
background: $primary-500;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.newspack-wizard__header {
|
|
51
|
-
display: none;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.newspack-card {
|
|
55
|
-
background: white;
|
|
56
|
-
border: 0;
|
|
57
|
-
margin: 0 auto 32px;
|
|
58
|
-
|
|
59
|
-
@media screen and ( min-width: 584px ) {
|
|
60
|
-
max-width: 520px;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&.loading {
|
|
64
|
-
cursor: wait;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
&__footer {
|
|
68
|
-
align-items: center;
|
|
69
|
-
display: flex;
|
|
70
|
-
flex-wrap: wrap;
|
|
71
|
-
justify-content: space-between;
|
|
72
|
-
|
|
73
|
-
.newspack-checkbox-control {
|
|
74
|
-
margin: 12px 16px 12px 0;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
h1 {
|
|
79
|
-
align-items: center;
|
|
80
|
-
display: flex;
|
|
81
|
-
flex-wrap: wrap;
|
|
82
|
-
|
|
83
|
-
svg {
|
|
84
|
-
margin-right: 8px;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.newspack-logo__wrapper {
|
|
90
|
-
margin-bottom: 32px;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.newspack-buttons-card {
|
|
94
|
-
margin: 0;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
50
|
.newspack-footer {
|
|
98
51
|
background: $primary-500;
|
|
99
52
|
border-color: $primary-500;
|
|
@@ -165,80 +118,82 @@ svg {
|
|
|
165
118
|
}
|
|
166
119
|
|
|
167
120
|
@media screen and ( min-width: 1224px ) {
|
|
168
|
-
box-shadow: inset -600px 0 0 0 white, 0 64px 0 0 $gray-700,
|
|
121
|
+
box-shadow: inset -600px 0 0 0 white, 0 64px 0 0 $gray-700, 512px 96px 0 0 white,
|
|
169
122
|
0 96px 0 0 $gray-700;
|
|
170
123
|
width: calc( 100% - ( 64px * 2 ) );
|
|
171
124
|
}
|
|
172
125
|
}
|
|
173
126
|
|
|
174
|
-
//
|
|
175
|
-
.
|
|
127
|
+
// Blue Screen
|
|
128
|
+
.newspack-wizard__blue & {
|
|
176
129
|
background: $primary-500;
|
|
177
130
|
|
|
178
|
-
&::before,
|
|
179
|
-
&::after {
|
|
180
|
-
left: 50%;
|
|
181
|
-
position: absolute;
|
|
182
|
-
transform: translate( -50% );
|
|
183
|
-
}
|
|
184
|
-
|
|
185
131
|
&::before {
|
|
186
|
-
|
|
132
|
+
animation: loading-quiet 1.25s ease-in-out infinite;
|
|
187
133
|
background: white;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
134
|
+
border-radius: 0;
|
|
135
|
+
box-shadow: 0;
|
|
136
|
+
height: 8px;
|
|
137
|
+
left: 0;
|
|
138
|
+
margin: 0;
|
|
139
|
+
position: absolute;
|
|
140
|
+
right: 100%;
|
|
141
|
+
top: 0;
|
|
142
|
+
width: auto;
|
|
196
143
|
}
|
|
197
144
|
|
|
198
145
|
&::after {
|
|
199
|
-
|
|
200
|
-
margin: 0;
|
|
201
|
-
max-width: 520px;
|
|
202
|
-
top: 156px;
|
|
203
|
-
width: calc( 100% - ( 64px * 2 ) );
|
|
204
|
-
|
|
205
|
-
@media screen and ( min-width: 600px ) {
|
|
206
|
-
box-shadow: inset -260px 0 0 0 white, 0 64px 0 0 $gray-700, 0 96px 0 0 $gray-700;
|
|
207
|
-
}
|
|
146
|
+
display: none;
|
|
208
147
|
}
|
|
209
148
|
}
|
|
210
149
|
|
|
211
150
|
// Quiet
|
|
212
151
|
&-quiet {
|
|
213
|
-
cursor: wait;
|
|
214
152
|
position: relative;
|
|
215
153
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
&::before {
|
|
221
|
-
animation: loading-quiet 1.25s ease-in-out infinite;
|
|
222
|
-
background: $primary-500;
|
|
154
|
+
&::before,
|
|
155
|
+
&::after {
|
|
223
156
|
content: '';
|
|
157
|
+
cursor: wait;
|
|
224
158
|
display: block;
|
|
225
|
-
height: 8px;
|
|
226
159
|
left: 0;
|
|
227
160
|
position: fixed;
|
|
228
|
-
right: 100%;
|
|
229
161
|
top: 46px;
|
|
230
|
-
z-index: 1;
|
|
231
162
|
|
|
232
163
|
@media screen and ( min-width: 783px ) {
|
|
233
164
|
top: 32px;
|
|
234
165
|
margin-left: 160px;
|
|
235
166
|
|
|
236
|
-
body.auto-fold
|
|
167
|
+
body.auto-fold & {
|
|
168
|
+
margin-left: 36px;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@media screen and ( min-width: 961px ) {
|
|
173
|
+
body.auto-fold & {
|
|
174
|
+
margin-left: 160px;
|
|
175
|
+
}
|
|
176
|
+
|
|
237
177
|
body.folded & {
|
|
238
178
|
margin-left: 36px;
|
|
239
179
|
}
|
|
240
180
|
}
|
|
241
181
|
}
|
|
182
|
+
|
|
183
|
+
&::before {
|
|
184
|
+
animation: loading-quiet 1.25s ease-in-out infinite;
|
|
185
|
+
background: $primary-500;
|
|
186
|
+
height: 8px;
|
|
187
|
+
right: 100%;
|
|
188
|
+
z-index: 9999;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
&::after {
|
|
192
|
+
background: rgba( white, 0.7 );
|
|
193
|
+
bottom: 0;
|
|
194
|
+
right: 0;
|
|
195
|
+
z-index: 9998;
|
|
196
|
+
}
|
|
242
197
|
}
|
|
243
198
|
}
|
|
244
199
|
|
|
@@ -7,7 +7,7 @@ import { category } from '@wordpress/icons';
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
|
-
import { Button, Handoff, NewspackIcon, Notice, TabbedNavigation
|
|
10
|
+
import { Button, Handoff, NewspackIcon, Notice, TabbedNavigation } from '../';
|
|
11
11
|
import { buttonProps } from '../../../shared/js/';
|
|
12
12
|
import './style.scss';
|
|
13
13
|
|
|
@@ -31,8 +31,8 @@ export default function withWizardScreen( WrappedComponent, { hidePrimaryButton
|
|
|
31
31
|
tabbedNavigation,
|
|
32
32
|
secondaryButtonText,
|
|
33
33
|
secondaryButtonAction,
|
|
34
|
-
routes,
|
|
35
34
|
renderAboveContent,
|
|
35
|
+
disableUpcomingInTabbedNavigation,
|
|
36
36
|
} = props;
|
|
37
37
|
const retrievedButtonProps = buttonProps( buttonAction );
|
|
38
38
|
const retrievedSecondaryButtonProps = buttonProps( secondaryButtonAction );
|
|
@@ -58,13 +58,7 @@ export default function withWizardScreen( WrappedComponent, { hidePrimaryButton
|
|
|
58
58
|
);
|
|
59
59
|
return (
|
|
60
60
|
<>
|
|
61
|
-
{ newspack_aux_data.is_debug_mode &&
|
|
62
|
-
<Notice
|
|
63
|
-
isWarning
|
|
64
|
-
className="newspack-wizard__above-header"
|
|
65
|
-
noticeText={ __( 'Newspack is in debug mode.', 'newspack' ) }
|
|
66
|
-
/>
|
|
67
|
-
) }
|
|
61
|
+
{ newspack_aux_data.is_debug_mode && <Notice debugMode /> }
|
|
68
62
|
<div className="newspack-wizard__header">
|
|
69
63
|
<div className="newspack-wizard__header__inner">
|
|
70
64
|
<div className="newspack-wizard__title">
|
|
@@ -78,18 +72,21 @@ export default function withWizardScreen( WrappedComponent, { hidePrimaryButton
|
|
|
78
72
|
>
|
|
79
73
|
<NewspackIcon size={ 36 } />
|
|
80
74
|
</Button>
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
<div>
|
|
76
|
+
{ headerText && <h2>{ headerText }</h2> }
|
|
77
|
+
{ subHeaderText && <span>{ subHeaderText }</span> }
|
|
78
|
+
</div>
|
|
83
79
|
</div>
|
|
84
|
-
{ tabbedNavigation && (
|
|
85
|
-
<>
|
|
86
|
-
<TabbedNavigation items={ tabbedNavigation } />
|
|
87
|
-
</>
|
|
88
|
-
) }
|
|
89
80
|
</div>
|
|
90
|
-
{ routes && <WizardPagination routes={ routes } /> }
|
|
91
81
|
</div>
|
|
92
82
|
|
|
83
|
+
{ tabbedNavigation && (
|
|
84
|
+
<TabbedNavigation
|
|
85
|
+
disableUpcoming={ disableUpcomingInTabbedNavigation }
|
|
86
|
+
items={ tabbedNavigation.filter( item => ! item.isHiddenInNav ) }
|
|
87
|
+
/>
|
|
88
|
+
) }
|
|
89
|
+
|
|
93
90
|
<div className={ classnames( 'newspack-wizard newspack-wizard__content', className ) }>
|
|
94
91
|
{ typeof renderAboveContent === 'function' ? renderAboveContent() : null }
|
|
95
92
|
{ <WrappedComponent { ...props } renderPrimaryButton={ renderPrimaryButton } /> }
|
|
@@ -6,6 +6,43 @@
|
|
|
6
6
|
@import '../../../shared/scss/colors';
|
|
7
7
|
|
|
8
8
|
.newspack-wizard {
|
|
9
|
+
// Color
|
|
10
|
+
--wp-admin-theme-color: #{$primary-500};
|
|
11
|
+
--wp-admin-theme-color--rgb: #{$primary-500--rgb};
|
|
12
|
+
--wp-admin-theme-color-darker-10: #{$primary-600};
|
|
13
|
+
--wp-admin-theme-color-darker-10--rgb: #{$primary-600--rgb};
|
|
14
|
+
--wp-admin-theme-color-darker-20: #{$primary-700};
|
|
15
|
+
--wp-admin-theme-color-darker-20--rgb: #{$primary-700--rgb};
|
|
16
|
+
|
|
17
|
+
color: $gray-900;
|
|
18
|
+
|
|
19
|
+
// Headings
|
|
20
|
+
h1,
|
|
21
|
+
h2,
|
|
22
|
+
h3 {
|
|
23
|
+
color: inherit;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
h1 {
|
|
27
|
+
line-height: 1.4;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Links
|
|
31
|
+
a {
|
|
32
|
+
color: var( --wp-admin-theme-color );
|
|
33
|
+
|
|
34
|
+
&:active,
|
|
35
|
+
&:focus,
|
|
36
|
+
&:hover {
|
|
37
|
+
color: var( --wp-admin-theme-color-darker-10 );
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:focus {
|
|
41
|
+
box-shadow: 0 0 0 var( --wp-admin-border-width-focus ) var( --wp-admin-theme-color );
|
|
42
|
+
outline: 3px solid transparent;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
9
46
|
&__header {
|
|
10
47
|
background: white;
|
|
11
48
|
}
|
|
@@ -15,12 +52,25 @@
|
|
|
15
52
|
border-bottom: 1px solid $gray-300;
|
|
16
53
|
display: flex;
|
|
17
54
|
|
|
18
|
-
|
|
19
|
-
color: $gray-900;
|
|
20
|
-
font-size: 21px;
|
|
21
|
-
line-height: 30px;
|
|
55
|
+
h2 {
|
|
22
56
|
margin: 0;
|
|
57
|
+
padding: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
> div {
|
|
61
|
+
align-items: baseline;
|
|
62
|
+
display: flex;
|
|
23
63
|
padding: 0 24px;
|
|
64
|
+
|
|
65
|
+
span {
|
|
66
|
+
color: $gray-700;
|
|
67
|
+
display: none;
|
|
68
|
+
margin-left: 8px;
|
|
69
|
+
|
|
70
|
+
@media screen and ( min-width: 744px ) {
|
|
71
|
+
display: block;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
24
74
|
}
|
|
25
75
|
|
|
26
76
|
svg {
|
|
@@ -35,15 +85,17 @@
|
|
|
35
85
|
&:not( .newspack-icon ) {
|
|
36
86
|
background: $primary-500;
|
|
37
87
|
left: 50%;
|
|
38
|
-
margin: -
|
|
88
|
+
margin: -28px 0 0 -28px !important;
|
|
39
89
|
opacity: 0;
|
|
90
|
+
padding: 10px;
|
|
40
91
|
position: absolute;
|
|
41
92
|
top: 50%;
|
|
42
93
|
transition: opacity 125ms ease-in-out;
|
|
43
94
|
}
|
|
44
95
|
}
|
|
45
96
|
|
|
46
|
-
|
|
97
|
+
.components-button.has-icon {
|
|
98
|
+
padding: 0;
|
|
47
99
|
position: relative;
|
|
48
100
|
|
|
49
101
|
&:hover {
|
|
@@ -51,29 +103,26 @@
|
|
|
51
103
|
opacity: 1;
|
|
52
104
|
}
|
|
53
105
|
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
a:focus-visible {
|
|
57
|
-
outline: none !important;
|
|
58
106
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
107
|
+
&:focus-visible {
|
|
108
|
+
outline: none !important;
|
|
109
|
+
|
|
110
|
+
&::before {
|
|
111
|
+
border: 2px solid white;
|
|
112
|
+
border-radius: 2px;
|
|
113
|
+
bottom: 5px;
|
|
114
|
+
content: '';
|
|
115
|
+
display: block;
|
|
116
|
+
left: 6px;
|
|
117
|
+
position: absolute;
|
|
118
|
+
right: 6px;
|
|
119
|
+
top: 6px;
|
|
120
|
+
}
|
|
69
121
|
}
|
|
70
122
|
}
|
|
71
123
|
}
|
|
72
124
|
|
|
73
125
|
&__content {
|
|
74
|
-
color: $gray-700;
|
|
75
|
-
font-size: 14px;
|
|
76
|
-
line-height: 24px;
|
|
77
126
|
margin: 0 auto;
|
|
78
127
|
max-width: 1208px;
|
|
79
128
|
padding: 0 16px;
|
|
@@ -84,49 +133,13 @@
|
|
|
84
133
|
|
|
85
134
|
// Typography
|
|
86
135
|
|
|
87
|
-
h1,
|
|
88
|
-
h2,
|
|
89
|
-
h3,
|
|
90
|
-
p {
|
|
91
|
-
line-height: 24px;
|
|
92
|
-
margin: 32px 0;
|
|
93
|
-
padding: 0;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
h1 {
|
|
97
|
-
color: $gray-900;
|
|
98
|
-
font-size: 21px;
|
|
99
|
-
font-weight: bold;
|
|
100
|
-
line-height: 32px;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
h2 {
|
|
104
|
-
color: $gray-900;
|
|
105
|
-
font-size: 17px;
|
|
106
|
-
font-weight: bold;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
h3 {
|
|
110
|
-
color: $gray-900;
|
|
111
|
-
font-size: 14px;
|
|
112
|
-
font-weight: bold;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
p {
|
|
116
|
-
font-size: 14px;
|
|
117
|
-
|
|
118
|
-
&.is-dark {
|
|
119
|
-
color: $gray-900;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
136
|
strong {
|
|
124
137
|
font-weight: bold;
|
|
125
138
|
}
|
|
126
139
|
|
|
127
140
|
small {
|
|
128
141
|
font-size: 12px;
|
|
129
|
-
line-height:
|
|
142
|
+
line-height: 1.4;
|
|
130
143
|
}
|
|
131
144
|
|
|
132
145
|
// Thematic Break
|
|
@@ -141,70 +154,10 @@
|
|
|
141
154
|
margin: 64px 0;
|
|
142
155
|
}
|
|
143
156
|
}
|
|
144
|
-
|
|
145
|
-
// Links
|
|
146
|
-
|
|
147
|
-
a {
|
|
148
|
-
color: $primary-500;
|
|
149
|
-
|
|
150
|
-
&:active,
|
|
151
|
-
&:focus,
|
|
152
|
-
&:hover {
|
|
153
|
-
color: $primary-600;
|
|
154
|
-
text-decoration: none;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
&:focus {
|
|
158
|
-
box-shadow: none;
|
|
159
|
-
outline: 2px solid $primary-500;
|
|
160
|
-
outline-offset: 2px;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
157
|
}
|
|
164
158
|
|
|
165
159
|
&__above-header {
|
|
160
|
+
border-radius: 0;
|
|
166
161
|
margin: 0;
|
|
167
162
|
}
|
|
168
163
|
}
|
|
169
|
-
|
|
170
|
-
// Buttons Card
|
|
171
|
-
|
|
172
|
-
.newspack-buttons-card {
|
|
173
|
-
display: flex;
|
|
174
|
-
flex-direction: row-reverse;
|
|
175
|
-
justify-content: flex-start;
|
|
176
|
-
align-items: center;
|
|
177
|
-
margin: 64px 0 32px;
|
|
178
|
-
|
|
179
|
-
&:empty {
|
|
180
|
-
display: none;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.newspack-button {
|
|
184
|
-
margin-left: 16px;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// Checkbox Icon
|
|
189
|
-
|
|
190
|
-
.newspack-checkbox-icon {
|
|
191
|
-
background: white;
|
|
192
|
-
border-radius: 50%;
|
|
193
|
-
box-shadow: inset 0 0 0 1px $gray-300;
|
|
194
|
-
display: block;
|
|
195
|
-
height: 24px;
|
|
196
|
-
width: 24px;
|
|
197
|
-
|
|
198
|
-
svg {
|
|
199
|
-
fill: $gray-700;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
&--checked {
|
|
203
|
-
background: $alert-green;
|
|
204
|
-
box-shadow: none;
|
|
205
|
-
|
|
206
|
-
svg {
|
|
207
|
-
fill: white;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies.
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies.
|
|
9
|
+
*/
|
|
10
|
+
import { Button, Card, Modal, Notice } from '../..';
|
|
11
|
+
import { WIZARD_STORE_NAMESPACE } from '../store';
|
|
12
|
+
|
|
13
|
+
const parseError = ( { data, message, code } ) => {
|
|
14
|
+
let level = 'fatal';
|
|
15
|
+
if ( !! data && 'level' in data ) {
|
|
16
|
+
level = data.level;
|
|
17
|
+
} else if ( 'rest_invalid_param' === code ) {
|
|
18
|
+
level = 'notice';
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
message,
|
|
22
|
+
level,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const WizardError = () => {
|
|
27
|
+
const error = useSelect( select => select( WIZARD_STORE_NAMESPACE ).getError() );
|
|
28
|
+
if ( ! error ) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const { level, message } = parseError( error );
|
|
33
|
+
if ( 'fatal' === level ) {
|
|
34
|
+
const fallbackURL = typeof newspack_urls !== 'undefined' && newspack_urls.dashboard;
|
|
35
|
+
return (
|
|
36
|
+
<Modal
|
|
37
|
+
title={ __( 'Unrecoverable error' ) }
|
|
38
|
+
onRequestClose={ fallbackURL ? () => ( window.location = fallbackURL ) : undefined }
|
|
39
|
+
>
|
|
40
|
+
<Notice noticeText={ message } isError rawHTML />
|
|
41
|
+
{ fallbackURL && (
|
|
42
|
+
<Card buttonsCard noBorder className="justify-end">
|
|
43
|
+
<Button isPrimary href={ fallbackURL }>
|
|
44
|
+
{ __( 'Return to Dashboard', 'newspack' ) }
|
|
45
|
+
</Button>
|
|
46
|
+
</Card>
|
|
47
|
+
) }
|
|
48
|
+
</Modal>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<Notice isError className="newspack-wizard__above-header" noticeText={ message } rawHTML />
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export default WizardError;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies.
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies.
|
|
8
|
+
*/
|
|
9
|
+
import { useSelect } from '@wordpress/data';
|
|
10
|
+
import { useState } from '@wordpress/element';
|
|
11
|
+
import { __ } from '@wordpress/i18n';
|
|
12
|
+
import { category } from '@wordpress/icons';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
import { Footer, Notice, Button, NewspackIcon, TabbedNavigation, PluginInstaller } from '../';
|
|
18
|
+
import Router from '../proxied-imports/router';
|
|
19
|
+
import registerStore, { WIZARD_STORE_NAMESPACE } from './store';
|
|
20
|
+
import { useWizardData } from './store/utils';
|
|
21
|
+
import WizardError from './components/WizardError';
|
|
22
|
+
|
|
23
|
+
registerStore();
|
|
24
|
+
|
|
25
|
+
const { HashRouter, Redirect, Route, Switch } = Router;
|
|
26
|
+
|
|
27
|
+
const Wizard = ( {
|
|
28
|
+
sections = [],
|
|
29
|
+
apiSlug,
|
|
30
|
+
headerText,
|
|
31
|
+
subHeaderText,
|
|
32
|
+
hasSimpleFooter,
|
|
33
|
+
className,
|
|
34
|
+
renderAboveSections,
|
|
35
|
+
requiredPlugins = [],
|
|
36
|
+
} ) => {
|
|
37
|
+
const isLoading = useSelect( select => select( WIZARD_STORE_NAMESPACE ).isLoading() );
|
|
38
|
+
const isQuietLoading = useSelect( select => select( WIZARD_STORE_NAMESPACE ).isQuietLoading() );
|
|
39
|
+
|
|
40
|
+
// Trigger initial data fetch. Some sections might not use the wizard data,
|
|
41
|
+
// but for consistency, fetching is triggered regardless of the section.
|
|
42
|
+
useSelect( select => select( WIZARD_STORE_NAMESPACE ).getWizardAPIData( apiSlug ) );
|
|
43
|
+
|
|
44
|
+
let displayedSections = sections.filter( section => ! section.isHidden );
|
|
45
|
+
|
|
46
|
+
const [ pluginRequirementsSatisfied, setPluginRequirementsSatisfied ] = useState(
|
|
47
|
+
requiredPlugins.length === 0
|
|
48
|
+
);
|
|
49
|
+
if ( ! pluginRequirementsSatisfied ) {
|
|
50
|
+
headerText =
|
|
51
|
+
requiredPlugins.length > 1
|
|
52
|
+
? __( 'Required plugins', 'newspack' )
|
|
53
|
+
: __( 'Required plugin', 'newspack' );
|
|
54
|
+
displayedSections = [
|
|
55
|
+
{
|
|
56
|
+
path: '/',
|
|
57
|
+
render: () => (
|
|
58
|
+
<PluginInstaller
|
|
59
|
+
plugins={ requiredPlugins }
|
|
60
|
+
onStatus={ ( { complete } ) => setPluginRequirementsSatisfied( complete ) }
|
|
61
|
+
/>
|
|
62
|
+
),
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<>
|
|
69
|
+
<WizardError />
|
|
70
|
+
<div
|
|
71
|
+
className={ classnames(
|
|
72
|
+
isLoading ? 'newspack-wizard__is-loading' : 'newspack-wizard__is-loaded',
|
|
73
|
+
{
|
|
74
|
+
'newspack-wizard__is-loading-quiet': isQuietLoading,
|
|
75
|
+
}
|
|
76
|
+
) }
|
|
77
|
+
>
|
|
78
|
+
<HashRouter hashType="slash">
|
|
79
|
+
{ newspack_aux_data.is_debug_mode && <Notice debugMode /> }
|
|
80
|
+
<div className="bg-white">
|
|
81
|
+
<div className="newspack-wizard__header__inner">
|
|
82
|
+
<div className="newspack-wizard__title">
|
|
83
|
+
<Button
|
|
84
|
+
isLink
|
|
85
|
+
href={ newspack_urls.dashboard }
|
|
86
|
+
label={ __( 'Return to Dashboard', 'newspack' ) }
|
|
87
|
+
showTooltip={ true }
|
|
88
|
+
icon={ category }
|
|
89
|
+
iconSize={ 36 }
|
|
90
|
+
>
|
|
91
|
+
<NewspackIcon size={ 36 } />
|
|
92
|
+
</Button>
|
|
93
|
+
<div>
|
|
94
|
+
{ headerText && <h2>{ headerText }</h2> }
|
|
95
|
+
{ subHeaderText && <span>{ subHeaderText }</span> }
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
{ displayedSections.length > 1 && <TabbedNavigation items={ displayedSections } /> }
|
|
102
|
+
|
|
103
|
+
<Switch>
|
|
104
|
+
{ displayedSections.map( ( section, index ) => {
|
|
105
|
+
const SectionComponent = section.render;
|
|
106
|
+
return (
|
|
107
|
+
<Route key={ index } path={ section.path }>
|
|
108
|
+
<div
|
|
109
|
+
className={ classnames(
|
|
110
|
+
'newspack-wizard newspack-wizard__content',
|
|
111
|
+
className
|
|
112
|
+
) }
|
|
113
|
+
>
|
|
114
|
+
{ 'function' === typeof renderAboveSections ? renderAboveSections() : null }
|
|
115
|
+
<SectionComponent />
|
|
116
|
+
</div>
|
|
117
|
+
</Route>
|
|
118
|
+
);
|
|
119
|
+
} ) }
|
|
120
|
+
<Redirect to={ displayedSections[ 0 ].path } />
|
|
121
|
+
</Switch>
|
|
122
|
+
</HashRouter>
|
|
123
|
+
</div>
|
|
124
|
+
{ ! isLoading && <Footer simple={ hasSimpleFooter } /> }
|
|
125
|
+
</>
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
Wizard.useWizardData = useWizardData;
|
|
130
|
+
|
|
131
|
+
Wizard.STORE_NAMESPACE = WIZARD_STORE_NAMESPACE;
|
|
132
|
+
|
|
133
|
+
export default Wizard;
|