newspack-components 2.1.0 → 2.2.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 (293) hide show
  1. package/dist/cjs/accordion/index.js +46 -0
  2. package/dist/cjs/accordion/style.scss +27 -0
  3. package/dist/cjs/action-card/index.js +48 -25
  4. package/dist/cjs/action-card/style.scss +100 -23
  5. package/dist/cjs/autocomplete-tokenfield/index.js +13 -41
  6. package/dist/cjs/autocomplete-tokenfield/style.scss +2 -2
  7. package/dist/cjs/autocomplete-with-suggestions/index.js +30 -51
  8. package/dist/cjs/autocomplete-with-suggestions/style.scss +16 -15
  9. package/dist/cjs/button/index.js +5 -13
  10. package/dist/cjs/button-card/index.js +1 -10
  11. package/dist/cjs/button-card/style.scss +13 -13
  12. package/dist/cjs/button-group/index.js +57 -0
  13. package/dist/cjs/button-group/style.scss +73 -0
  14. package/dist/cjs/card/index.js +1 -8
  15. package/dist/cjs/card/style.scss +25 -8
  16. package/dist/cjs/category-autocomplete/index.js +18 -38
  17. package/dist/cjs/category-autocomplete/style.scss +0 -2
  18. package/dist/cjs/checkbox-control/index.js +63 -0
  19. package/dist/cjs/checkbox-control/style.scss +78 -0
  20. package/dist/cjs/color-picker/index.js +1 -15
  21. package/dist/cjs/color-picker/style.scss +0 -3
  22. package/dist/cjs/consts.js +5 -3
  23. package/dist/cjs/custom-select-control/index.js +1 -9
  24. package/dist/cjs/custom-select-control/style.scss +6 -7
  25. package/dist/cjs/date-range-picker/index.js +1 -10
  26. package/dist/cjs/date-range-picker/style.scss +12 -12
  27. package/dist/cjs/footer/index.js +5 -17
  28. package/dist/cjs/footer/style.scss +5 -5
  29. package/dist/cjs/form-token-field/index.js +1 -9
  30. package/dist/cjs/form-token-field/style.scss +2 -3
  31. package/dist/cjs/global-notices/index.js +1 -8
  32. package/dist/cjs/grid/index.js +1 -8
  33. package/dist/cjs/grid/style.scss +5 -5
  34. package/dist/cjs/handoff/index.js +8 -17
  35. package/dist/cjs/handoff-message/index.js +50 -0
  36. package/dist/cjs/hooks/index.js +1 -7
  37. package/dist/cjs/hooks/useObjectState.js +7 -13
  38. package/dist/cjs/hooks/useObjectState.test.js +0 -14
  39. package/dist/cjs/hooks/useOnClickOutside.js +3 -6
  40. package/dist/cjs/hooks/usePrompt.js +1 -13
  41. package/dist/cjs/image-upload/index.js +21 -19
  42. package/dist/cjs/image-upload/index.test.js +0 -5
  43. package/dist/cjs/image-upload/style.scss +5 -9
  44. package/dist/cjs/index.js +28 -44
  45. package/dist/cjs/info-button/index.js +3 -11
  46. package/dist/cjs/info-button/style.scss +1 -3
  47. package/dist/cjs/modal/index.js +1 -9
  48. package/dist/cjs/modal/style.scss +8 -8
  49. package/dist/cjs/newspack-icon/index.js +1 -9
  50. package/dist/cjs/newspack-icon/style.scss +4 -4
  51. package/dist/cjs/newspack-logo/index.js +1 -9
  52. package/dist/cjs/newspack-logo/style.scss +3 -3
  53. package/dist/cjs/notice/index.js +8 -15
  54. package/dist/cjs/notice/style.scss +28 -15
  55. package/dist/cjs/patrons-logo/index.js +3 -11
  56. package/dist/cjs/plugin-installer/index.js +36 -36
  57. package/dist/cjs/plugin-installer/style.scss +5 -5
  58. package/dist/cjs/plugin-settings/SettingsSection.js +9 -28
  59. package/dist/cjs/plugin-settings/index.js +39 -22
  60. package/dist/cjs/plugin-toggle/index.js +40 -33
  61. package/dist/cjs/plugin-toggle/style.scss +2 -2
  62. package/dist/cjs/popover/index.js +1 -11
  63. package/dist/cjs/popover/style.scss +19 -16
  64. package/dist/cjs/position-control/index.js +113 -0
  65. package/dist/cjs/position-control/style.scss +66 -0
  66. package/dist/cjs/preview-box/index.js +36 -0
  67. package/dist/cjs/preview-box/style.scss +18 -0
  68. package/dist/cjs/progress-bar/index.js +2 -9
  69. package/dist/cjs/progress-bar/index.test.js +2 -7
  70. package/dist/cjs/progress-bar/style.scss +4 -4
  71. package/dist/cjs/proxied-imports/router.js +0 -3
  72. package/dist/cjs/radio-control/index.js +1 -11
  73. package/dist/cjs/radio-control/style.scss +9 -9
  74. package/dist/cjs/section-header/index.js +44 -29
  75. package/dist/cjs/section-header/style.scss +2 -2
  76. package/dist/cjs/select-control/ButtonGroupControl.js +4 -13
  77. package/dist/cjs/select-control/GroupedSelectControl.js +9 -15
  78. package/dist/cjs/select-control/index.js +5 -12
  79. package/dist/cjs/select-control/style.scss +2 -2
  80. package/dist/cjs/settings/MinMaxSetting.js +3 -7
  81. package/dist/cjs/settings/SettingsCard.js +3 -7
  82. package/dist/cjs/settings/SettingsSection.js +1 -4
  83. package/dist/cjs/settings/index.js +0 -6
  84. package/dist/cjs/settings/style.scss +1 -1
  85. package/dist/cjs/steps-list/index.js +52 -0
  86. package/dist/cjs/steps-list/style.scss +11 -0
  87. package/dist/cjs/steps-list-item/index.js +56 -0
  88. package/dist/cjs/steps-list-item/style.scss +47 -0
  89. package/dist/cjs/style-card/index.js +6 -13
  90. package/dist/cjs/style-card/style.scss +9 -12
  91. package/dist/cjs/style.scss +5 -6
  92. package/dist/cjs/tabbed-navigation/index.js +19 -16
  93. package/dist/cjs/tabbed-navigation/style.scss +3 -4
  94. package/dist/cjs/text-control/index.js +6 -16
  95. package/dist/cjs/textarea-control/index.js +54 -0
  96. package/dist/cjs/textarea-control/style.scss +76 -0
  97. package/dist/cjs/toggle-control/index.js +58 -0
  98. package/dist/cjs/toggle-control/style.scss +74 -0
  99. package/dist/cjs/toggle-group/index.js +71 -0
  100. package/dist/cjs/toggle-group/style.scss +28 -0
  101. package/dist/cjs/utils/index.js +10 -5
  102. package/dist/cjs/waiting/index.js +1 -9
  103. package/dist/cjs/web-preview/index.js +13 -28
  104. package/dist/cjs/web-preview/style.scss +14 -14
  105. package/dist/cjs/with-wizard/index.js +51 -31
  106. package/dist/cjs/with-wizard/style.scss +35 -37
  107. package/dist/cjs/with-wizard-screen/index.js +11 -17
  108. package/dist/cjs/with-wizard-screen/style.scss +14 -17
  109. package/dist/cjs/wizard/components/WizardError.js +3 -15
  110. package/dist/cjs/wizard/index.js +10 -24
  111. package/dist/cjs/wizard/store/index.js +42 -55
  112. package/dist/cjs/wizard/store/utils.js +1 -6
  113. package/dist/cjs/wizard/style.scss +148 -0
  114. package/dist/esm/accordion/index.js +38 -0
  115. package/dist/esm/accordion/style.scss +27 -0
  116. package/dist/esm/action-card/index.js +50 -21
  117. package/dist/esm/action-card/style.scss +100 -23
  118. package/dist/esm/autocomplete-tokenfield/index.js +14 -37
  119. package/dist/esm/autocomplete-tokenfield/style.scss +2 -2
  120. package/dist/esm/autocomplete-with-suggestions/index.js +28 -41
  121. package/dist/esm/autocomplete-with-suggestions/style.scss +16 -15
  122. package/dist/esm/button/index.js +5 -7
  123. package/dist/esm/button-card/index.js +2 -5
  124. package/dist/esm/button-card/style.scss +13 -13
  125. package/dist/esm/button-group/index.js +43 -0
  126. package/dist/esm/button-group/style.scss +73 -0
  127. package/dist/esm/card/index.js +2 -5
  128. package/dist/esm/card/style.scss +25 -8
  129. package/dist/esm/category-autocomplete/index.js +17 -30
  130. package/dist/esm/category-autocomplete/style.scss +0 -2
  131. package/dist/esm/checkbox-control/index.js +49 -0
  132. package/dist/esm/checkbox-control/style.scss +78 -0
  133. package/dist/esm/color-picker/index.js +2 -4
  134. package/dist/esm/color-picker/style.scss +0 -3
  135. package/dist/esm/consts.js +3 -2
  136. package/dist/esm/custom-select-control/index.js +2 -5
  137. package/dist/esm/custom-select-control/style.scss +6 -7
  138. package/dist/esm/date-range-picker/index.js +1 -3
  139. package/dist/esm/date-range-picker/style.scss +12 -12
  140. package/dist/esm/footer/index.js +3 -11
  141. package/dist/esm/footer/style.scss +5 -5
  142. package/dist/esm/form-token-field/index.js +2 -5
  143. package/dist/esm/form-token-field/style.scss +2 -3
  144. package/dist/esm/global-notices/index.js +1 -6
  145. package/dist/esm/grid/index.js +2 -5
  146. package/dist/esm/grid/style.scss +5 -5
  147. package/dist/esm/handoff/index.js +3 -14
  148. package/dist/esm/handoff-message/index.js +45 -0
  149. package/dist/esm/hooks/index.js +0 -2
  150. package/dist/esm/hooks/useObjectState.js +3 -8
  151. package/dist/esm/hooks/useObjectState.test.js +0 -3
  152. package/dist/esm/hooks/useOnClickOutside.js +2 -5
  153. package/dist/esm/hooks/usePrompt.js +1 -8
  154. package/dist/esm/image-upload/index.js +17 -16
  155. package/dist/esm/image-upload/style.scss +5 -9
  156. package/dist/esm/index.js +4 -0
  157. package/dist/esm/info-button/index.js +4 -6
  158. package/dist/esm/info-button/style.scss +1 -3
  159. package/dist/esm/modal/index.js +2 -5
  160. package/dist/esm/modal/style.scss +8 -8
  161. package/dist/esm/newspack-icon/index.js +2 -5
  162. package/dist/esm/newspack-icon/style.scss +4 -4
  163. package/dist/esm/newspack-logo/index.js +2 -5
  164. package/dist/esm/newspack-logo/style.scss +3 -3
  165. package/dist/esm/notice/index.js +4 -8
  166. package/dist/esm/notice/style.scss +28 -15
  167. package/dist/esm/patrons-logo/index.js +3 -5
  168. package/dist/esm/plugin-installer/index.js +35 -39
  169. package/dist/esm/plugin-installer/style.scss +5 -5
  170. package/dist/esm/plugin-settings/SettingsSection.js +8 -21
  171. package/dist/esm/plugin-settings/index.js +38 -24
  172. package/dist/esm/plugin-toggle/index.js +39 -36
  173. package/dist/esm/plugin-toggle/style.scss +2 -2
  174. package/dist/esm/popover/index.js +3 -6
  175. package/dist/esm/popover/style.scss +19 -16
  176. package/dist/esm/position-control/index.js +109 -0
  177. package/dist/esm/position-control/style.scss +66 -0
  178. package/dist/esm/preview-box/index.js +30 -0
  179. package/dist/esm/preview-box/style.scss +18 -0
  180. package/dist/esm/progress-bar/index.js +2 -7
  181. package/dist/esm/progress-bar/index.test.js +2 -1
  182. package/dist/esm/progress-bar/style.scss +4 -4
  183. package/dist/esm/proxied-imports/router.js +1 -0
  184. package/dist/esm/radio-control/index.js +3 -6
  185. package/dist/esm/radio-control/style.scss +9 -9
  186. package/dist/esm/section-header/index.js +44 -25
  187. package/dist/esm/section-header/style.scss +2 -2
  188. package/dist/esm/select-control/ButtonGroupControl.js +5 -7
  189. package/dist/esm/select-control/GroupedSelectControl.js +5 -6
  190. package/dist/esm/select-control/index.js +6 -6
  191. package/dist/esm/select-control/style.scss +2 -2
  192. package/dist/esm/settings/MinMaxSetting.js +1 -3
  193. package/dist/esm/settings/SettingsCard.js +3 -4
  194. package/dist/esm/settings/SettingsSection.js +0 -2
  195. package/dist/esm/settings/style.scss +1 -1
  196. package/dist/esm/steps-list/index.js +43 -0
  197. package/dist/esm/steps-list/style.scss +11 -0
  198. package/dist/esm/steps-list-item/index.js +48 -0
  199. package/dist/esm/steps-list-item/style.scss +47 -0
  200. package/dist/esm/style-card/index.js +2 -5
  201. package/dist/esm/style-card/style.scss +9 -12
  202. package/dist/esm/style.scss +5 -6
  203. package/dist/esm/tabbed-navigation/index.js +20 -10
  204. package/dist/esm/tabbed-navigation/style.scss +3 -4
  205. package/dist/esm/text-control/index.js +2 -9
  206. package/dist/esm/textarea-control/index.js +40 -0
  207. package/dist/esm/textarea-control/style.scss +76 -0
  208. package/dist/esm/toggle-control/index.js +44 -0
  209. package/dist/esm/toggle-control/style.scss +74 -0
  210. package/dist/esm/toggle-group/index.js +58 -0
  211. package/dist/esm/toggle-group/style.scss +28 -0
  212. package/dist/esm/utils/index.js +9 -3
  213. package/dist/esm/waiting/index.js +2 -5
  214. package/dist/esm/web-preview/index.js +9 -24
  215. package/dist/esm/web-preview/style.scss +14 -14
  216. package/dist/esm/with-wizard/index.js +49 -34
  217. package/dist/esm/with-wizard/style.scss +35 -37
  218. package/dist/esm/with-wizard-screen/index.js +9 -11
  219. package/dist/esm/with-wizard-screen/style.scss +14 -17
  220. package/dist/esm/wizard/components/WizardError.js +1 -10
  221. package/dist/esm/wizard/index.js +10 -12
  222. package/dist/esm/wizard/store/index.js +40 -46
  223. package/dist/esm/wizard/store/utils.js +1 -1
  224. package/dist/esm/wizard/style.scss +148 -0
  225. package/package.json +4 -4
  226. package/shared/scss/_colors.scss +0 -15
  227. package/src/accordion/index.js +32 -0
  228. package/src/accordion/style.scss +27 -0
  229. package/src/action-card/index.js +43 -8
  230. package/src/action-card/style.scss +100 -23
  231. package/src/autocomplete-tokenfield/index.js +1 -1
  232. package/src/autocomplete-tokenfield/style.scss +2 -2
  233. package/src/autocomplete-with-suggestions/style.scss +16 -15
  234. package/src/button-card/style.scss +13 -13
  235. package/src/card/style.scss +25 -8
  236. package/src/category-autocomplete/index.js +3 -1
  237. package/src/category-autocomplete/style.scss +0 -2
  238. package/src/color-picker/style.scss +0 -3
  239. package/src/consts.js +2 -1
  240. package/src/custom-select-control/style.scss +6 -7
  241. package/src/date-range-picker/style.scss +12 -12
  242. package/src/footer/index.js +2 -2
  243. package/src/footer/style.scss +5 -5
  244. package/src/form-token-field/index.js +2 -7
  245. package/src/form-token-field/style.scss +2 -3
  246. package/src/grid/style.scss +5 -5
  247. package/src/handoff/index.js +3 -8
  248. package/src/handoff-message/index.js +39 -0
  249. package/src/hooks/useObjectState.js +2 -1
  250. package/src/image-upload/index.js +9 -3
  251. package/src/image-upload/style.scss +5 -9
  252. package/src/index.js +4 -0
  253. package/src/info-button/style.scss +1 -3
  254. package/src/modal/style.scss +8 -8
  255. package/src/newspack-icon/style.scss +4 -4
  256. package/src/newspack-logo/style.scss +3 -3
  257. package/src/notice/index.js +2 -0
  258. package/src/notice/style.scss +28 -15
  259. package/src/plugin-installer/index.js +15 -2
  260. package/src/plugin-installer/style.scss +5 -5
  261. package/src/plugin-settings/SettingsSection.js +7 -13
  262. package/src/plugin-settings/index.js +7 -2
  263. package/src/plugin-toggle/index.js +2 -3
  264. package/src/plugin-toggle/style.scss +2 -2
  265. package/src/popover/style.scss +19 -16
  266. package/src/position-control/index.js +122 -0
  267. package/src/position-control/style.scss +66 -0
  268. package/src/progress-bar/style.scss +4 -4
  269. package/src/radio-control/style.scss +9 -9
  270. package/src/section-header/index.js +32 -15
  271. package/src/section-header/style.scss +2 -2
  272. package/src/select-control/ButtonGroupControl.js +3 -0
  273. package/src/select-control/GroupedSelectControl.js +2 -1
  274. package/src/select-control/index.js +6 -2
  275. package/src/select-control/style.scss +2 -2
  276. package/src/settings/style.scss +1 -1
  277. package/src/steps-list/index.js +39 -0
  278. package/src/steps-list/style.scss +11 -0
  279. package/src/steps-list-item/index.js +40 -0
  280. package/src/steps-list-item/style.scss +47 -0
  281. package/src/style-card/index.js +2 -11
  282. package/src/style-card/style.scss +9 -12
  283. package/src/style.scss +5 -6
  284. package/src/tabbed-navigation/index.js +12 -4
  285. package/src/tabbed-navigation/style.scss +3 -4
  286. package/src/utils/index.js +9 -0
  287. package/src/web-preview/index.js +1 -1
  288. package/src/web-preview/style.scss +14 -14
  289. package/src/with-wizard/style.scss +35 -37
  290. package/src/with-wizard-screen/index.js +4 -1
  291. package/src/with-wizard-screen/style.scss +14 -17
  292. package/src/wizard/index.js +15 -3
  293. package/src/wizard/store/index.js +8 -2
@@ -2,8 +2,8 @@
2
2
  * With Wizard
3
3
  */
4
4
 
5
- @import '~@wordpress/base-styles/colors';
6
- @import '../../../shared/scss/colors';
5
+ @use '~@wordpress/base-styles/colors' as wp-colors;
6
+ @use '../../../shared/scss/colors';
7
7
 
8
8
  // Reset Padding of the Admin Page
9
9
 
@@ -32,11 +32,11 @@ body[class*='admin_page_newspack-'] {
32
32
 
33
33
  svg {
34
34
  &.newspack--error {
35
- fill: $alert-red;
35
+ fill: wp-colors.$alert-red;
36
36
  transform: rotate( 180deg );
37
37
  }
38
38
  &.newspack--success {
39
- fill: $alert-green;
39
+ fill: wp-colors.$alert-green;
40
40
  }
41
41
  }
42
42
 
@@ -44,12 +44,12 @@ svg {
44
44
 
45
45
  .newspack-wizard__blue {
46
46
  #wpwrap {
47
- background: $primary-500;
47
+ background: colors.$primary-500;
48
48
  }
49
49
 
50
50
  .newspack-footer {
51
- background: $primary-500;
52
- border-color: $primary-500;
51
+ background: colors.$primary-500;
52
+ border-color: colors.$primary-500;
53
53
  justify-content: center;
54
54
 
55
55
  &__logo {
@@ -76,12 +76,9 @@ svg {
76
76
 
77
77
  .newspack-wizard__is-loading {
78
78
  background: white;
79
- bottom: 0;
80
79
  cursor: wait;
81
- left: 0;
80
+ inset: 0;
82
81
  position: absolute;
83
- right: 0;
84
- top: 0;
85
82
 
86
83
  > * {
87
84
  display: none !important;
@@ -95,38 +92,39 @@ svg {
95
92
  }
96
93
 
97
94
  &::before {
98
- background: $primary-500;
99
- box-shadow: 24px 0 0 white, 69px 0 0 -15px $gray-900, 99px 0 0 -15px $gray-900,
100
- 129px 0 0 -15px $gray-900, 159px 0 0 -15px $gray-900, 189px 0 0 -15px $gray-900;
95
+ background: colors.$primary-500;
96
+ box-shadow: 24px 0 0 white, 69px 0 0 -15px wp-colors.$gray-900,
97
+ 99px 0 0 -15px wp-colors.$gray-900, 129px 0 0 -15px wp-colors.$gray-900,
98
+ 159px 0 0 -15px wp-colors.$gray-900, 189px 0 0 -15px wp-colors.$gray-900;
101
99
  height: 60px;
102
100
  width: 60px;
103
101
  }
104
102
 
105
103
  &::after {
106
- background: $gray-900;
107
- box-shadow: inset -40vw 0 0 0 white, 0 64px 0 0 $gray-700, 40vw 96px 0 0 white,
108
- 0 96px 0 0 $gray-700;
104
+ background: wp-colors.$gray-900;
105
+ box-shadow: inset -40vw 0 0 0 white, 0 64px 0 0 wp-colors.$gray-700, 40vw 96px 0 0 white,
106
+ 0 96px 0 0 wp-colors.$gray-700;
109
107
  height: 24px;
110
108
  margin: 68px auto 0;
111
109
  max-width: 1040px;
112
110
  width: calc( 100% - ( 32px * 2 ) );
113
111
 
114
112
  @media screen and ( min-width: 744px ) {
115
- box-shadow: inset -400px 0 0 0 white, 0 64px 0 0 $gray-700, 200px 96px 0 0 white,
116
- 0 96px 0 0 $gray-700;
113
+ box-shadow: inset -400px 0 0 0 white, 0 64px 0 0 wp-colors.$gray-700, 200px 96px 0 0 white,
114
+ 0 96px 0 0 wp-colors.$gray-700;
117
115
  width: calc( 100% - ( 64px * 2 ) );
118
116
  }
119
117
 
120
118
  @media screen and ( min-width: 1224px ) {
121
- box-shadow: inset -600px 0 0 0 white, 0 64px 0 0 $gray-700, 512px 96px 0 0 white,
122
- 0 96px 0 0 $gray-700;
119
+ box-shadow: inset -600px 0 0 0 white, 0 64px 0 0 wp-colors.$gray-700, 512px 96px 0 0 white,
120
+ 0 96px 0 0 wp-colors.$gray-700;
123
121
  width: calc( 100% - ( 64px * 2 ) );
124
122
  }
125
123
  }
126
124
 
127
125
  // Blue Screen
128
126
  .newspack-wizard__blue & {
129
- background: $primary-500;
127
+ background: colors.$primary-500;
130
128
 
131
129
  &::before {
132
130
  animation: loading-quiet 1.25s ease-in-out infinite;
@@ -182,7 +180,7 @@ svg {
182
180
 
183
181
  &::before {
184
182
  animation: loading-quiet 1.25s ease-in-out infinite;
185
- background: $primary-500;
183
+ background: colors.$primary-500;
186
184
  height: 8px;
187
185
  right: 100%;
188
186
  z-index: 9999;
@@ -210,42 +208,42 @@ svg {
210
208
  animation: loading 2s ease-in-out infinite;
211
209
  content: '';
212
210
  display: block;
213
- background: $gray-900;
214
- box-shadow: inset -40vw 0 0 0 white, 0 64px 0 0 $gray-700, 40vw 96px 0 0 white,
215
- 0 96px 0 0 $gray-700;
211
+ background: wp-colors.$gray-900;
212
+ box-shadow: inset -40vw 0 0 0 white, 0 64px 0 0 wp-colors.$gray-700, 40vw 96px 0 0 white,
213
+ 0 96px 0 0 wp-colors.$gray-700;
216
214
  height: 24px;
217
215
  margin: 0 auto;
218
216
  max-width: 1040px;
219
217
  width: 100%;
220
218
 
221
219
  @media screen and ( min-width: 744px ) {
222
- box-shadow: inset -400px 0 0 0 white, 0 64px 0 0 $gray-700, 200px 96px 0 0 white,
223
- 0 96px 0 0 $gray-700;
220
+ box-shadow: inset -400px 0 0 0 white, 0 64px 0 0 wp-colors.$gray-700, 200px 96px 0 0 white,
221
+ 0 96px 0 0 wp-colors.$gray-700;
224
222
  }
225
223
 
226
224
  @media screen and ( min-width: 1224px ) {
227
- box-shadow: inset -600px 0 0 0 white, 0 64px 0 0 $gray-700, 520px 96px 0 0 white,
228
- 0 96px 0 0 $gray-700;
225
+ box-shadow: inset -600px 0 0 0 white, 0 64px 0 0 wp-colors.$gray-700, 520px 96px 0 0 white,
226
+ 0 96px 0 0 wp-colors.$gray-700;
229
227
  }
230
228
  }
231
229
  }
232
230
 
233
231
  @keyframes loading {
234
- from {
235
- opacity: 100%;
232
+ 0% {
233
+ opacity: 1;
236
234
  }
237
235
 
238
236
  50% {
239
- opacity: 10%;
237
+ opacity: 0.1;
240
238
  }
241
239
 
242
- to {
243
- opacity: 100%;
240
+ 100% {
241
+ opacity: 1;
244
242
  }
245
243
  }
246
244
 
247
245
  @keyframes loading-quiet {
248
- from {
246
+ 0% {
249
247
  left: 0;
250
248
  right: 100%;
251
249
  }
@@ -255,7 +253,7 @@ svg {
255
253
  right: 0;
256
254
  }
257
255
 
258
- to {
256
+ 100% {
259
257
  left: 100%;
260
258
  right: 0;
261
259
  }
@@ -4,22 +4,22 @@
4
4
  import { __ as alias__ } from '@wordpress/i18n';
5
5
  const __ = alias__;
6
6
  import { category } from '@wordpress/icons';
7
+
7
8
  /**
8
9
  * Internal dependencies
9
10
  */
10
-
11
- import { Button, Handoff, NewspackIcon, Notice, TabbedNavigation } from '../';
11
+ import { Button, Handoff, NewspackIcon, Notice, HandoffMessage, TabbedNavigation } from '../';
12
12
  import { buttonProps } from '../../../shared/js/';
13
13
  import './style.scss';
14
+
14
15
  /**
15
16
  * External dependencies
16
17
  */
17
-
18
18
  import classnames from 'classnames';
19
+
19
20
  /**
20
21
  * Higher-Order Component to provide plugin management and error handling to Newspack Wizards.
21
22
  */
22
-
23
23
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
24
24
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
25
25
  import { Fragment as _Fragment } from "@emotion/react/jsx-runtime";
@@ -27,7 +27,6 @@ export default function withWizardScreen(WrappedComponent) {
27
27
  let {
28
28
  hidePrimaryButton
29
29
  } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
30
-
31
30
  const WrappedWithWizardScreen = props => {
32
31
  const {
33
32
  className,
@@ -47,7 +46,6 @@ export default function withWizardScreen(WrappedComponent) {
47
46
  const SecondaryCTAComponent = retrievedSecondaryButtonProps.plugin ? Handoff : Button;
48
47
  const shouldRenderPrimaryButton = buttonText && buttonAction;
49
48
  const shouldRenderSecondaryButton = secondaryButtonText && secondaryButtonAction;
50
-
51
49
  const renderPrimaryButton = function () {
52
50
  let overridingProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
53
51
  return retrievedButtonProps.plugin ? _jsx(Handoff, {
@@ -58,7 +56,8 @@ export default function withWizardScreen(WrappedComponent) {
58
56
  }) : _jsx(Button, {
59
57
  isPrimary: !buttonDisabled,
60
58
  isSecondary: !!buttonDisabled,
61
- disabled: buttonDisabled // Allow overridingProps to set children.
59
+ disabled: buttonDisabled
60
+ // Allow overridingProps to set children.
62
61
  // eslint-disable-next-line react/no-children-prop
63
62
  ,
64
63
  children: buttonText,
@@ -66,7 +65,6 @@ export default function withWizardScreen(WrappedComponent) {
66
65
  ...overridingProps
67
66
  });
68
67
  };
69
-
70
68
  return _jsxs(_Fragment, {
71
69
  children: [newspack_aux_data.is_debug_mode && _jsx(Notice, {
72
70
  debugMode: true
@@ -98,9 +96,10 @@ export default function withWizardScreen(WrappedComponent) {
98
96
  }), tabbedNavigation && _jsx(TabbedNavigation, {
99
97
  disableUpcoming: disableUpcomingInTabbedNavigation,
100
98
  items: tabbedNavigation.filter(item => !item.isHiddenInNav)
101
- }), _jsxs("div", {
99
+ }), _jsx(HandoffMessage, {}), _jsxs("div", {
102
100
  className: classnames('newspack-wizard newspack-wizard__content', className),
103
- children: [typeof renderAboveContent === 'function' ? renderAboveContent() : null, _jsx(WrappedComponent, { ...props,
101
+ children: [typeof renderAboveContent === 'function' ? renderAboveContent() : null, _jsx(WrappedComponent, {
102
+ ...props,
104
103
  renderPrimaryButton: renderPrimaryButton
105
104
  }), (shouldRenderPrimaryButton || shouldRenderSecondaryButton) && _jsxs("div", {
106
105
  className: "newspack-buttons-card",
@@ -113,6 +112,5 @@ export default function withWizardScreen(WrappedComponent) {
113
112
  })]
114
113
  });
115
114
  };
116
-
117
115
  return WrappedWithWizardScreen;
118
116
  }
@@ -2,19 +2,19 @@
2
2
  * With Wizard Screen
3
3
  */
4
4
 
5
- @import '~@wordpress/base-styles/colors';
6
- @import '../../../shared/scss/colors';
5
+ @use '~@wordpress/base-styles/colors' as wp-colors;
6
+ @use '../../../shared/scss/colors';
7
7
 
8
8
  .newspack-wizard {
9
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};
10
+ --wp-admin-theme-color: #{colors.$primary-500};
11
+ --wp-admin-theme-color--rgb: #{colors.$primary-500--rgb};
12
+ --wp-admin-theme-color-darker-10: #{colors.$primary-600};
13
+ --wp-admin-theme-color-darker-10--rgb: #{colors.$primary-600--rgb};
14
+ --wp-admin-theme-color-darker-20: #{colors.$primary-700};
15
+ --wp-admin-theme-color-darker-20--rgb: #{colors.$primary-700--rgb};
16
16
 
17
- color: $gray-900;
17
+ color: wp-colors.$gray-900;
18
18
 
19
19
  // Headings
20
20
  h1,
@@ -49,7 +49,7 @@
49
49
 
50
50
  &__title {
51
51
  align-items: center;
52
- border-bottom: 1px solid $gray-300;
52
+ border-bottom: 1px solid wp-colors.$gray-300;
53
53
  display: flex;
54
54
 
55
55
  h2 {
@@ -63,7 +63,7 @@
63
63
  padding: 0 24px;
64
64
 
65
65
  span {
66
- color: $gray-700;
66
+ color: wp-colors.$gray-700;
67
67
  display: none;
68
68
  margin-left: 8px;
69
69
 
@@ -83,7 +83,7 @@
83
83
  }
84
84
 
85
85
  &:not( .newspack-icon ) {
86
- background: $primary-500;
86
+ background: colors.$primary-500;
87
87
  left: 50%;
88
88
  margin: -28px 0 0 -28px !important;
89
89
  opacity: 0;
@@ -110,13 +110,10 @@
110
110
  &::before {
111
111
  border: 2px solid white;
112
112
  border-radius: 2px;
113
- bottom: 5px;
114
113
  content: '';
115
114
  display: block;
116
- left: 6px;
115
+ inset: 6px 6px 5px;
117
116
  position: absolute;
118
- right: 6px;
119
- top: 6px;
120
117
  }
121
118
  }
122
119
  }
@@ -145,7 +142,7 @@
145
142
  // Thematic Break
146
143
 
147
144
  hr {
148
- background: $gray-300;
145
+ background: wp-colors.$gray-300;
149
146
  border: 0;
150
147
  height: 1px;
151
148
  margin: 48px 0;
@@ -4,15 +4,14 @@
4
4
  import { __ as alias__ } from '@wordpress/i18n';
5
5
  const __ = alias__;
6
6
  import { useSelect } from '@wordpress/data';
7
+
7
8
  /**
8
9
  * Internal dependencies.
9
10
  */
10
-
11
11
  import { Button, Card, Modal, Notice } from '../..';
12
12
  import { WIZARD_STORE_NAMESPACE } from '../store';
13
13
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
14
14
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
15
-
16
15
  const parseError = _ref => {
17
16
  let {
18
17
  data,
@@ -20,31 +19,25 @@ const parseError = _ref => {
20
19
  code
21
20
  } = _ref;
22
21
  let level = 'fatal';
23
-
24
22
  if (!!data && 'level' in data) {
25
23
  level = data.level;
26
24
  } else if ('rest_invalid_param' === code) {
27
25
  level = 'notice';
28
26
  }
29
-
30
27
  return {
31
28
  message,
32
29
  level
33
30
  };
34
31
  };
35
-
36
32
  const WizardError = () => {
37
33
  const error = useSelect(select => select(WIZARD_STORE_NAMESPACE).getError());
38
-
39
34
  if (!error) {
40
35
  return null;
41
36
  }
42
-
43
37
  const {
44
38
  level,
45
39
  message
46
40
  } = parseError(error);
47
-
48
41
  if ('fatal' === level) {
49
42
  const fallbackURL = typeof newspack_urls !== 'undefined' && newspack_urls.dashboard;
50
43
  return _jsxs(Modal, {
@@ -66,7 +59,6 @@ const WizardError = () => {
66
59
  })]
67
60
  });
68
61
  }
69
-
70
62
  return _jsx(Notice, {
71
63
  isError: true,
72
64
  className: "newspack-wizard__above-header",
@@ -74,5 +66,4 @@ const WizardError = () => {
74
66
  rawHTML: true
75
67
  });
76
68
  };
77
-
78
69
  export default WizardError;
@@ -2,20 +2,20 @@
2
2
  * External dependencies.
3
3
  */
4
4
  import classnames from 'classnames';
5
+
5
6
  /**
6
7
  * WordPress dependencies.
7
8
  */
8
-
9
9
  import { useSelect } from '@wordpress/data';
10
10
  import { useState } from '@wordpress/element';
11
11
  import { __ as alias__ } from '@wordpress/i18n';
12
12
  const __ = alias__;
13
13
  import { category } from '@wordpress/icons';
14
+
14
15
  /**
15
16
  * Internal dependencies
16
17
  */
17
-
18
- import { Footer, Notice, Button, NewspackIcon, TabbedNavigation, PluginInstaller } from '../';
18
+ import { Footer, Notice, Button, NewspackIcon, TabbedNavigation, PluginInstaller, HandoffMessage } from '../';
19
19
  import Router from '../proxied-imports/router';
20
20
  import registerStore, { WIZARD_STORE_NAMESPACE } from './store';
21
21
  import { useWizardData } from './store/utils';
@@ -30,7 +30,6 @@ const {
30
30
  Route,
31
31
  Switch
32
32
  } = Router;
33
-
34
33
  const Wizard = _ref => {
35
34
  let {
36
35
  sections = [],
@@ -43,13 +42,13 @@ const Wizard = _ref => {
43
42
  requiredPlugins = []
44
43
  } = _ref;
45
44
  const isLoading = useSelect(select => select(WIZARD_STORE_NAMESPACE).isLoading());
46
- const isQuietLoading = useSelect(select => select(WIZARD_STORE_NAMESPACE).isQuietLoading()); // Trigger initial data fetch. Some sections might not use the wizard data,
47
- // but for consistency, fetching is triggered regardless of the section.
45
+ const isQuietLoading = useSelect(select => select(WIZARD_STORE_NAMESPACE).isQuietLoading());
48
46
 
47
+ // Trigger initial data fetch. Some sections might not use the wizard data,
48
+ // but for consistency, fetching is triggered regardless of the section.
49
49
  useSelect(select => select(WIZARD_STORE_NAMESPACE).getWizardAPIData(apiSlug));
50
50
  let displayedSections = sections.filter(section => !section.isHidden);
51
51
  const [pluginRequirementsSatisfied, setPluginRequirementsSatisfied] = useState(requiredPlugins.length === 0);
52
-
53
52
  if (!pluginRequirementsSatisfied) {
54
53
  headerText = requiredPlugins.length > 1 ? __('Required plugins', 'newspack') : __('Required plugin', 'newspack');
55
54
  displayedSections = [{
@@ -65,9 +64,8 @@ const Wizard = _ref => {
65
64
  })
66
65
  }];
67
66
  }
68
-
69
67
  return _jsxs(_Fragment, {
70
- children: [_jsx(WizardError, {}), _jsx("div", {
68
+ children: [_jsx("div", {
71
69
  className: classnames(isLoading ? 'newspack-wizard__is-loading' : 'newspack-wizard__is-loaded', {
72
70
  'newspack-wizard__is-loading-quiet': isQuietLoading
73
71
  }),
@@ -101,8 +99,9 @@ const Wizard = _ref => {
101
99
  })
102
100
  })
103
101
  }), displayedSections.length > 1 && _jsx(TabbedNavigation, {
104
- items: displayedSections
105
- }), _jsxs(Switch, {
102
+ items: displayedSections,
103
+ children: _jsx(WizardError, {})
104
+ }), _jsx(HandoffMessage, {}), _jsxs(Switch, {
106
105
  children: [displayedSections.map((section, index) => {
107
106
  const SectionComponent = section.render;
108
107
  return _jsx(Route, {
@@ -122,7 +121,6 @@ const Wizard = _ref => {
122
121
  })]
123
122
  });
124
123
  };
125
-
126
124
  Wizard.useWizardData = useWizardData;
127
125
  Wizard.STORE_NAMESPACE = WIZARD_STORE_NAMESPACE;
128
126
  export default Wizard;
@@ -1,11 +1,13 @@
1
1
  /**
2
2
  * External dependencies.
3
3
  */
4
- import { set, get, isEmpty } from 'lodash';
4
+ import set from 'lodash/set';
5
+ import get from 'lodash/get';
6
+ import isEmpty from 'lodash/isEmpty';
7
+
5
8
  /**
6
9
  * WordPress dependencies.
7
10
  */
8
-
9
11
  import apiFetch from '@wordpress/api-fetch';
10
12
  import { createReduxStore, register, dispatch, select } from '@wordpress/data';
11
13
  import { createAction } from './utils.js';
@@ -16,55 +18,50 @@ const DEFAULT_STATE = {
16
18
  apiData: {},
17
19
  error: null
18
20
  };
21
+
19
22
  /**
20
23
  * wordpress/data does not trigger a component re-render
21
24
  * on deep state change (via lodash's set function)
22
25
  * unless the state was cloned first.
23
26
  */
24
-
25
27
  const clone = objectToClone => JSON.parse(JSON.stringify(objectToClone));
26
-
27
28
  const reducer = function () {
28
29
  let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_STATE;
29
30
  let {
30
31
  type,
31
32
  payload = {}
32
33
  } = arguments.length > 1 ? arguments[1] : undefined;
33
-
34
34
  switch (type) {
35
35
  case 'START_LOADING_DATA':
36
36
  if (payload.isQuietLoading) {
37
- return { ...state,
37
+ return {
38
+ ...state,
38
39
  isQuietLoading: true
39
40
  };
40
41
  }
41
-
42
- return { ...state,
42
+ return {
43
+ ...state,
43
44
  isLoading: true
44
45
  };
45
-
46
46
  case 'FINISH_LOADING_DATA':
47
- return { ...state,
47
+ return {
48
+ ...state,
48
49
  isLoading: false,
49
50
  isQuietLoading: false
50
51
  };
51
-
52
52
  case 'SET_API_DATA':
53
53
  return set(clone(state), ['apiData', payload.slug], payload.data);
54
-
55
54
  case 'UPDATE_WIZARD_SETTINGS':
56
55
  return set(clone(state), ['apiData', payload.slug, ...payload.path], payload.value);
57
-
58
56
  case 'SET_ERROR':
59
- return { ...state,
57
+ return {
58
+ ...state,
60
59
  error: payload
61
60
  };
62
-
63
61
  default:
64
62
  return state;
65
63
  }
66
64
  };
67
-
68
65
  const actions = {
69
66
  // Regular actions.
70
67
  startLoadingData: createAction('START_LOADING_DATA'),
@@ -73,47 +70,43 @@ const actions = {
73
70
  setAPIDataForWizard: createAction('SET_API_DATA'),
74
71
  updateWizardSettings: createAction('UPDATE_WIZARD_SETTINGS'),
75
72
  setError: createAction('SET_ERROR'),
76
-
77
73
  // Async actions. These will not show up in Redux devtools.
78
- *saveWizardSettings(_ref) {
74
+ saveWizardSettings(_ref) {
79
75
  let {
80
76
  slug,
81
77
  section = '',
82
78
  payloadPath = false,
83
79
  updatePayload = null
84
80
  } = _ref;
85
-
86
- // Optionally data can be updated before saving - an immediate update case
87
- // (without an explicit "save" action).
88
- if (updatePayload) {
89
- yield actions.updateWizardSettings({
90
- slug,
91
- ...updatePayload
92
- });
93
- }
94
-
95
- const wizardState = select(WIZARD_STORE_NAMESPACE).getWizardAPIData(slug);
96
- const updatedData = yield actions.fetchFromAPI({
97
- path: `/newspack/v1/wizard/${slug}/${section}`,
98
- method: 'POST',
99
- data: payloadPath ? get(wizardState, payloadPath) : wizardState,
100
- isQuietFetch: true
101
- });
102
-
103
- if (!isEmpty(updatedData)) {
104
- return actions.setAPIDataForWizard({
105
- slug,
106
- data: updatedData
81
+ return function* () {
82
+ // Optionally data can be updated before saving - an immediate update case
83
+ // (without an explicit "save" action).
84
+ if (updatePayload) {
85
+ yield actions.updateWizardSettings({
86
+ slug,
87
+ ...updatePayload
88
+ });
89
+ }
90
+ const wizardState = select(WIZARD_STORE_NAMESPACE).getWizardAPIData(slug);
91
+ const updatedData = yield actions.fetchFromAPI({
92
+ path: `/newspack/v1/wizard/${slug}/${section}`,
93
+ method: 'POST',
94
+ data: payloadPath ? get(wizardState, payloadPath) : wizardState,
95
+ isQuietFetch: true
107
96
  });
108
- }
97
+ if (!isEmpty(updatedData) && !updatedData.error) {
98
+ return actions.setAPIDataForWizard({
99
+ slug,
100
+ data: updatedData
101
+ });
102
+ }
103
+ }();
109
104
  },
110
-
111
105
  *wizardApiFetch(fetchConfig) {
112
106
  // Just a proxy to fetchFromAPI, but it has to be a generator.
113
107
  const result = yield actions.fetchFromAPI(fetchConfig);
114
108
  return result;
115
109
  }
116
-
117
110
  };
118
111
  const selectors = {
119
112
  isLoading: state => state.isLoading,
@@ -130,7 +123,10 @@ const store = createReduxStore(WIZARD_STORE_NAMESPACE, {
130
123
  dispatch(WIZARD_STORE_NAMESPACE).startLoadingData({
131
124
  isQuietLoading: Boolean(action.payload.isQuietFetch)
132
125
  });
133
- return apiFetch(action.payload).catch(error => {
126
+ return apiFetch(action.payload).then(data => {
127
+ dispatch(WIZARD_STORE_NAMESPACE).setError(null);
128
+ return data;
129
+ }).catch(error => {
134
130
  dispatch(WIZARD_STORE_NAMESPACE).setError(error);
135
131
  return {
136
132
  error
@@ -152,10 +148,8 @@ const store = createReduxStore(WIZARD_STORE_NAMESPACE, {
152
148
  data
153
149
  });
154
150
  }
155
-
156
151
  return actions.finishLoadingData();
157
152
  }
158
-
159
153
  }
160
154
  });
161
155
  export default (() => register(store));
@@ -2,10 +2,10 @@
2
2
  * WordPress dependencies.
3
3
  */
4
4
  import { useSelect } from '@wordpress/data';
5
+
5
6
  /**
6
7
  * Internal dependencies
7
8
  */
8
-
9
9
  import { WIZARD_STORE_NAMESPACE } from '.';
10
10
  export const createAction = type => payload => ({
11
11
  type,