newspack-components 2.1.0 → 2.2.1

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 (268) 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/card/index.js +1 -8
  13. package/dist/cjs/card/style.scss +25 -8
  14. package/dist/cjs/category-autocomplete/index.js +18 -38
  15. package/dist/cjs/category-autocomplete/style.scss +0 -2
  16. package/dist/cjs/color-picker/index.js +1 -15
  17. package/dist/cjs/color-picker/style.scss +0 -3
  18. package/dist/cjs/consts.js +5 -3
  19. package/dist/cjs/custom-select-control/index.js +1 -9
  20. package/dist/cjs/custom-select-control/style.scss +6 -7
  21. package/dist/cjs/date-range-picker/index.js +1 -10
  22. package/dist/cjs/date-range-picker/style.scss +12 -12
  23. package/dist/cjs/footer/index.js +5 -17
  24. package/dist/cjs/footer/style.scss +5 -5
  25. package/dist/cjs/form-token-field/index.js +1 -9
  26. package/dist/cjs/form-token-field/style.scss +2 -3
  27. package/dist/cjs/global-notices/index.js +1 -8
  28. package/dist/cjs/grid/index.js +1 -8
  29. package/dist/cjs/grid/style.scss +5 -5
  30. package/dist/cjs/handoff/index.js +8 -17
  31. package/dist/cjs/handoff-message/index.js +50 -0
  32. package/dist/cjs/hooks/index.js +1 -7
  33. package/dist/cjs/hooks/useObjectState.js +7 -13
  34. package/dist/cjs/hooks/useObjectState.test.js +0 -14
  35. package/dist/cjs/hooks/useOnClickOutside.js +3 -6
  36. package/dist/cjs/hooks/usePrompt.js +1 -13
  37. package/dist/cjs/image-upload/index.js +21 -19
  38. package/dist/cjs/image-upload/index.test.js +0 -5
  39. package/dist/cjs/image-upload/style.scss +5 -9
  40. package/dist/cjs/index.js +28 -44
  41. package/dist/cjs/info-button/index.js +3 -11
  42. package/dist/cjs/info-button/style.scss +1 -3
  43. package/dist/cjs/modal/index.js +1 -9
  44. package/dist/cjs/modal/style.scss +8 -8
  45. package/dist/cjs/newspack-icon/index.js +1 -9
  46. package/dist/cjs/newspack-icon/style.scss +4 -4
  47. package/dist/cjs/newspack-logo/index.js +1 -9
  48. package/dist/cjs/newspack-logo/style.scss +3 -3
  49. package/dist/cjs/notice/index.js +8 -15
  50. package/dist/cjs/notice/style.scss +28 -15
  51. package/dist/cjs/patrons-logo/index.js +3 -11
  52. package/dist/cjs/plugin-installer/index.js +36 -36
  53. package/dist/cjs/plugin-installer/style.scss +5 -5
  54. package/dist/cjs/plugin-settings/SettingsSection.js +9 -28
  55. package/dist/cjs/plugin-settings/index.js +39 -22
  56. package/dist/cjs/plugin-toggle/index.js +40 -33
  57. package/dist/cjs/plugin-toggle/style.scss +2 -2
  58. package/dist/cjs/popover/index.js +1 -11
  59. package/dist/cjs/popover/style.scss +19 -16
  60. package/dist/cjs/position-control/index.js +113 -0
  61. package/dist/cjs/position-control/style.scss +66 -0
  62. package/dist/cjs/progress-bar/index.js +2 -9
  63. package/dist/cjs/progress-bar/index.test.js +2 -7
  64. package/dist/cjs/progress-bar/style.scss +4 -4
  65. package/dist/cjs/proxied-imports/router.js +0 -3
  66. package/dist/cjs/radio-control/index.js +1 -11
  67. package/dist/cjs/radio-control/style.scss +9 -9
  68. package/dist/cjs/section-header/index.js +44 -29
  69. package/dist/cjs/section-header/style.scss +2 -2
  70. package/dist/cjs/select-control/ButtonGroupControl.js +4 -13
  71. package/dist/cjs/select-control/GroupedSelectControl.js +9 -15
  72. package/dist/cjs/select-control/index.js +5 -12
  73. package/dist/cjs/select-control/style.scss +2 -2
  74. package/dist/cjs/settings/MinMaxSetting.js +3 -7
  75. package/dist/cjs/settings/SettingsCard.js +3 -7
  76. package/dist/cjs/settings/SettingsSection.js +1 -4
  77. package/dist/cjs/settings/index.js +0 -6
  78. package/dist/cjs/settings/style.scss +1 -1
  79. package/dist/cjs/steps-list/index.js +52 -0
  80. package/dist/cjs/steps-list/style.scss +11 -0
  81. package/dist/cjs/steps-list-item/index.js +56 -0
  82. package/dist/cjs/steps-list-item/style.scss +47 -0
  83. package/dist/cjs/style-card/index.js +6 -13
  84. package/dist/cjs/style-card/style.scss +9 -12
  85. package/dist/cjs/style.scss +5 -6
  86. package/dist/cjs/tabbed-navigation/index.js +19 -16
  87. package/dist/cjs/tabbed-navigation/style.scss +3 -4
  88. package/dist/cjs/text-control/index.js +6 -16
  89. package/dist/cjs/utils/index.js +10 -5
  90. package/dist/cjs/waiting/index.js +1 -9
  91. package/dist/cjs/web-preview/index.js +13 -28
  92. package/dist/cjs/web-preview/style.scss +14 -14
  93. package/dist/cjs/with-wizard/index.js +51 -31
  94. package/dist/cjs/with-wizard/style.scss +35 -37
  95. package/dist/cjs/with-wizard-screen/index.js +11 -17
  96. package/dist/cjs/with-wizard-screen/style.scss +14 -17
  97. package/dist/cjs/wizard/components/WizardError.js +3 -15
  98. package/dist/cjs/wizard/index.js +10 -24
  99. package/dist/cjs/wizard/store/index.js +42 -55
  100. package/dist/cjs/wizard/store/utils.js +1 -6
  101. package/dist/esm/accordion/index.js +38 -0
  102. package/dist/esm/accordion/style.scss +27 -0
  103. package/dist/esm/action-card/index.js +50 -21
  104. package/dist/esm/action-card/style.scss +100 -23
  105. package/dist/esm/autocomplete-tokenfield/index.js +14 -37
  106. package/dist/esm/autocomplete-tokenfield/style.scss +2 -2
  107. package/dist/esm/autocomplete-with-suggestions/index.js +28 -41
  108. package/dist/esm/autocomplete-with-suggestions/style.scss +16 -15
  109. package/dist/esm/button/index.js +5 -7
  110. package/dist/esm/button-card/index.js +2 -5
  111. package/dist/esm/button-card/style.scss +13 -13
  112. package/dist/esm/card/index.js +2 -5
  113. package/dist/esm/card/style.scss +25 -8
  114. package/dist/esm/category-autocomplete/index.js +17 -30
  115. package/dist/esm/category-autocomplete/style.scss +0 -2
  116. package/dist/esm/color-picker/index.js +2 -4
  117. package/dist/esm/color-picker/style.scss +0 -3
  118. package/dist/esm/consts.js +3 -2
  119. package/dist/esm/custom-select-control/index.js +2 -5
  120. package/dist/esm/custom-select-control/style.scss +6 -7
  121. package/dist/esm/date-range-picker/index.js +1 -3
  122. package/dist/esm/date-range-picker/style.scss +12 -12
  123. package/dist/esm/footer/index.js +3 -11
  124. package/dist/esm/footer/style.scss +5 -5
  125. package/dist/esm/form-token-field/index.js +2 -5
  126. package/dist/esm/form-token-field/style.scss +2 -3
  127. package/dist/esm/global-notices/index.js +1 -6
  128. package/dist/esm/grid/index.js +2 -5
  129. package/dist/esm/grid/style.scss +5 -5
  130. package/dist/esm/handoff/index.js +3 -14
  131. package/dist/esm/handoff-message/index.js +45 -0
  132. package/dist/esm/hooks/index.js +0 -2
  133. package/dist/esm/hooks/useObjectState.js +3 -8
  134. package/dist/esm/hooks/useObjectState.test.js +0 -3
  135. package/dist/esm/hooks/useOnClickOutside.js +2 -5
  136. package/dist/esm/hooks/usePrompt.js +1 -8
  137. package/dist/esm/image-upload/index.js +17 -16
  138. package/dist/esm/image-upload/style.scss +5 -9
  139. package/dist/esm/index.js +4 -0
  140. package/dist/esm/info-button/index.js +4 -6
  141. package/dist/esm/info-button/style.scss +1 -3
  142. package/dist/esm/modal/index.js +2 -5
  143. package/dist/esm/modal/style.scss +8 -8
  144. package/dist/esm/newspack-icon/index.js +2 -5
  145. package/dist/esm/newspack-icon/style.scss +4 -4
  146. package/dist/esm/newspack-logo/index.js +2 -5
  147. package/dist/esm/newspack-logo/style.scss +3 -3
  148. package/dist/esm/notice/index.js +4 -8
  149. package/dist/esm/notice/style.scss +28 -15
  150. package/dist/esm/patrons-logo/index.js +3 -5
  151. package/dist/esm/plugin-installer/index.js +35 -39
  152. package/dist/esm/plugin-installer/style.scss +5 -5
  153. package/dist/esm/plugin-settings/SettingsSection.js +8 -21
  154. package/dist/esm/plugin-settings/index.js +38 -24
  155. package/dist/esm/plugin-toggle/index.js +39 -36
  156. package/dist/esm/plugin-toggle/style.scss +2 -2
  157. package/dist/esm/popover/index.js +3 -6
  158. package/dist/esm/popover/style.scss +19 -16
  159. package/dist/esm/position-control/index.js +109 -0
  160. package/dist/esm/position-control/style.scss +66 -0
  161. package/dist/esm/progress-bar/index.js +2 -7
  162. package/dist/esm/progress-bar/index.test.js +2 -1
  163. package/dist/esm/progress-bar/style.scss +4 -4
  164. package/dist/esm/proxied-imports/router.js +1 -0
  165. package/dist/esm/radio-control/index.js +3 -6
  166. package/dist/esm/radio-control/style.scss +9 -9
  167. package/dist/esm/section-header/index.js +44 -25
  168. package/dist/esm/section-header/style.scss +2 -2
  169. package/dist/esm/select-control/ButtonGroupControl.js +5 -7
  170. package/dist/esm/select-control/GroupedSelectControl.js +5 -6
  171. package/dist/esm/select-control/index.js +6 -6
  172. package/dist/esm/select-control/style.scss +2 -2
  173. package/dist/esm/settings/MinMaxSetting.js +1 -3
  174. package/dist/esm/settings/SettingsCard.js +3 -4
  175. package/dist/esm/settings/SettingsSection.js +0 -2
  176. package/dist/esm/settings/style.scss +1 -1
  177. package/dist/esm/steps-list/index.js +43 -0
  178. package/dist/esm/steps-list/style.scss +11 -0
  179. package/dist/esm/steps-list-item/index.js +48 -0
  180. package/dist/esm/steps-list-item/style.scss +47 -0
  181. package/dist/esm/style-card/index.js +2 -5
  182. package/dist/esm/style-card/style.scss +9 -12
  183. package/dist/esm/style.scss +5 -6
  184. package/dist/esm/tabbed-navigation/index.js +20 -10
  185. package/dist/esm/tabbed-navigation/style.scss +3 -4
  186. package/dist/esm/text-control/index.js +2 -9
  187. package/dist/esm/utils/index.js +9 -3
  188. package/dist/esm/waiting/index.js +2 -5
  189. package/dist/esm/web-preview/index.js +9 -24
  190. package/dist/esm/web-preview/style.scss +14 -14
  191. package/dist/esm/with-wizard/index.js +49 -34
  192. package/dist/esm/with-wizard/style.scss +35 -37
  193. package/dist/esm/with-wizard-screen/index.js +9 -11
  194. package/dist/esm/with-wizard-screen/style.scss +14 -17
  195. package/dist/esm/wizard/components/WizardError.js +1 -10
  196. package/dist/esm/wizard/index.js +10 -12
  197. package/dist/esm/wizard/store/index.js +40 -46
  198. package/dist/esm/wizard/store/utils.js +1 -1
  199. package/package.json +4 -4
  200. package/shared/js/button-props.js +3 -1
  201. package/shared/scss/_mixins.scss +12 -0
  202. package/src/accordion/index.js +32 -0
  203. package/src/accordion/style.scss +27 -0
  204. package/src/action-card/index.js +43 -8
  205. package/src/action-card/style.scss +100 -23
  206. package/src/autocomplete-tokenfield/index.js +1 -1
  207. package/src/autocomplete-tokenfield/style.scss +2 -2
  208. package/src/autocomplete-with-suggestions/style.scss +16 -15
  209. package/src/button-card/style.scss +13 -13
  210. package/src/card/style.scss +25 -8
  211. package/src/category-autocomplete/index.js +3 -1
  212. package/src/category-autocomplete/style.scss +0 -2
  213. package/src/color-picker/style.scss +0 -3
  214. package/src/consts.js +2 -1
  215. package/src/custom-select-control/style.scss +6 -7
  216. package/src/date-range-picker/style.scss +12 -12
  217. package/src/footer/index.js +2 -2
  218. package/src/footer/style.scss +5 -5
  219. package/src/form-token-field/index.js +2 -7
  220. package/src/form-token-field/style.scss +2 -3
  221. package/src/grid/style.scss +5 -5
  222. package/src/handoff/index.js +3 -8
  223. package/src/handoff-message/index.js +39 -0
  224. package/src/hooks/useObjectState.js +2 -1
  225. package/src/image-upload/index.js +9 -3
  226. package/src/image-upload/style.scss +5 -9
  227. package/src/index.js +4 -0
  228. package/src/info-button/style.scss +1 -3
  229. package/src/modal/style.scss +8 -8
  230. package/src/newspack-icon/style.scss +4 -4
  231. package/src/newspack-logo/style.scss +3 -3
  232. package/src/notice/index.js +2 -0
  233. package/src/notice/style.scss +28 -15
  234. package/src/plugin-installer/index.js +15 -2
  235. package/src/plugin-installer/style.scss +5 -5
  236. package/src/plugin-settings/SettingsSection.js +7 -13
  237. package/src/plugin-settings/index.js +7 -2
  238. package/src/plugin-toggle/index.js +2 -3
  239. package/src/plugin-toggle/style.scss +2 -2
  240. package/src/popover/style.scss +19 -16
  241. package/src/position-control/index.js +122 -0
  242. package/src/position-control/style.scss +66 -0
  243. package/src/progress-bar/style.scss +4 -4
  244. package/src/radio-control/style.scss +9 -9
  245. package/src/section-header/index.js +32 -15
  246. package/src/section-header/style.scss +2 -2
  247. package/src/select-control/ButtonGroupControl.js +3 -0
  248. package/src/select-control/GroupedSelectControl.js +2 -1
  249. package/src/select-control/index.js +6 -2
  250. package/src/select-control/style.scss +2 -2
  251. package/src/settings/style.scss +1 -1
  252. package/src/steps-list/index.js +39 -0
  253. package/src/steps-list/style.scss +11 -0
  254. package/src/steps-list-item/index.js +40 -0
  255. package/src/steps-list-item/style.scss +47 -0
  256. package/src/style-card/index.js +2 -11
  257. package/src/style-card/style.scss +9 -12
  258. package/src/style.scss +5 -6
  259. package/src/tabbed-navigation/index.js +12 -4
  260. package/src/tabbed-navigation/style.scss +3 -4
  261. package/src/utils/index.js +9 -0
  262. package/src/web-preview/index.js +1 -1
  263. package/src/web-preview/style.scss +14 -14
  264. package/src/with-wizard/style.scss +35 -37
  265. package/src/with-wizard-screen/index.js +4 -1
  266. package/src/with-wizard-screen/style.scss +14 -17
  267. package/src/wizard/index.js +15 -3
  268. package/src/wizard/store/index.js +8 -2
@@ -6,14 +6,13 @@
6
6
  * WordPress dependencies.
7
7
  */
8
8
  import { Component } from '@wordpress/element';
9
+
9
10
  /**
10
11
  * Internal dependencies.
11
12
  */
12
-
13
13
  import './style.scss';
14
14
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
15
15
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
16
-
17
16
  class ProgressBar extends Component {
18
17
  /**
19
18
  * Get completion as a percentage.
@@ -26,14 +25,12 @@ class ProgressBar extends Component {
26
25
  if (!total) {
27
26
  return 100;
28
27
  }
29
-
30
28
  return Math.max(Math.min(Math.round(completed / total * 100), 100), 0);
31
29
  }
30
+
32
31
  /**
33
32
  * Render.
34
33
  */
35
-
36
-
37
34
  render() {
38
35
  const {
39
36
  label,
@@ -68,7 +65,5 @@ class ProgressBar extends Component {
68
65
  })]
69
66
  });
70
67
  }
71
-
72
68
  }
73
-
74
69
  export default ProgressBar;
@@ -75,7 +75,8 @@ describe('ProgressBar', () => {
75
75
  it(`with expected progress of ${expectedWidth}`, () => {
76
76
  const {
77
77
  getByTestId
78
- } = render(_createElement(ProgressBar, { ...props,
78
+ } = render(_createElement(ProgressBar, {
79
+ ...props,
79
80
  key: expectedWidth
80
81
  }));
81
82
  expect(getByTestId('progress-bar-indicator')).toHaveAttribute('style', `width: ${expectedWidth}%;`);
@@ -2,8 +2,8 @@
2
2
  * Progress Bar
3
3
  */
4
4
 
5
- @import '../../../shared/scss/colors';
6
- @import '~@wordpress/base-styles/colors';
5
+ @use '../../../shared/scss/colors';
6
+ @use '~@wordpress/base-styles/colors' as wp-colors;
7
7
 
8
8
  .newspack-progress-bar {
9
9
  margin: 32px 0;
@@ -26,7 +26,7 @@
26
26
  }
27
27
 
28
28
  &__container {
29
- background-color: $gray-100;
29
+ background-color: wp-colors.$gray-100;
30
30
  border-radius: 4px;
31
31
  height: 8px;
32
32
  overflow: hidden;
@@ -35,7 +35,7 @@
35
35
  }
36
36
 
37
37
  &__bar {
38
- background-color: $primary-500;
38
+ background-color: colors.$primary-500;
39
39
  height: 8px;
40
40
  transition: width 125ms ease-in-out;
41
41
  }
@@ -3,5 +3,6 @@
3
3
  * Ensures that both components and the plugin use the same instance of
4
4
  * React Router, even if there are node_modules in components.
5
5
  */
6
+
6
7
  import * as ReactRouterDOM from 'react-router-dom';
7
8
  export default ReactRouterDOM;
@@ -3,22 +3,21 @@
3
3
  */
4
4
  import { RadioControl as BaseComponent } from '@wordpress/components';
5
5
  import { Component } from '@wordpress/element';
6
+
6
7
  /**
7
8
  * Internal dependencies.
8
9
  */
9
-
10
10
  import './style.scss';
11
+
11
12
  /**
12
13
  * External dependencies.
13
14
  */
14
-
15
15
  import classnames from 'classnames';
16
+
16
17
  /**
17
18
  * Radio Control.
18
19
  */
19
-
20
20
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
21
-
22
21
  class RadioControl extends Component {
23
22
  /**
24
23
  * Render.
@@ -34,7 +33,5 @@ class RadioControl extends Component {
34
33
  ...otherProps
35
34
  });
36
35
  }
37
-
38
36
  }
39
-
40
37
  export default RadioControl;
@@ -2,11 +2,11 @@
2
2
  * Radio Control
3
3
  */
4
4
 
5
- @import '../../../shared/scss/colors';
6
- @import '~@wordpress/base-styles/colors';
5
+ @use '../../../shared/scss/colors';
6
+ @use '~@wordpress/base-styles/colors' as wp-colors;
7
7
 
8
8
  .newspack-radio-control {
9
- color: $gray-700;
9
+ color: wp-colors.$gray-700;
10
10
  font-size: 14px;
11
11
  line-height: 24px;
12
12
  margin: 32px 0;
@@ -19,7 +19,7 @@
19
19
  }
20
20
 
21
21
  .components-base-control__label {
22
- color: $gray-900;
22
+ color: wp-colors.$gray-900;
23
23
  font-weight: bold;
24
24
  }
25
25
 
@@ -28,7 +28,7 @@
28
28
  .components-radio-control__option {
29
29
  align-items: center;
30
30
  display: flex;
31
- margin: 0 0 8px 0;
31
+ margin: 0 0 8px;
32
32
 
33
33
  &:first-of-type {
34
34
  margin-top: 8px;
@@ -52,8 +52,8 @@
52
52
  }
53
53
 
54
54
  &:checked {
55
- background-color: $primary-500;
56
- border-color: $primary-500;
55
+ background-color: colors.$primary-500;
56
+ border-color: colors.$primary-500;
57
57
 
58
58
  &::before {
59
59
  border: none;
@@ -61,8 +61,8 @@
61
61
  }
62
62
 
63
63
  &:focus {
64
- border-color: $primary-500;
65
- box-shadow: 0 0 0 2px white, 0 0 0 3.5px $primary-500;
64
+ border-color: colors.$primary-500;
65
+ box-shadow: 0 0 0 2px white, 0 0 0 3.5px colors.$primary-500;
66
66
  }
67
67
  }
68
68
 
@@ -2,48 +2,67 @@
2
2
  * Section Header
3
3
  */
4
4
 
5
+ /**
6
+ * WordPress dependencies
7
+ */
8
+ import { useEffect, useRef } from '@wordpress/element';
9
+
5
10
  /**
6
11
  * Internal dependencies
7
12
  */
8
13
  import { Grid } from '..';
9
14
  import './style.scss';
15
+
10
16
  /**
11
17
  * External dependencies
12
18
  */
13
-
14
19
  import classnames from 'classnames';
15
20
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
16
21
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
17
-
18
22
  const SectionHeader = _ref => {
19
23
  let {
20
- centered,
21
- className,
24
+ centered = false,
25
+ className = null,
22
26
  description,
23
- heading,
24
- isWhite,
25
- noMargin,
26
- title
27
+ heading = 2,
28
+ isWhite = false,
29
+ noMargin = false,
30
+ title,
31
+ id = null
27
32
  } = _ref;
33
+ // If id is in the URL as a scrollTo param, scroll to it on render.
34
+ const ref = useRef();
35
+ useEffect(() => {
36
+ const params = new Proxy(new URLSearchParams(window.location.search), {
37
+ get: (searchParams, prop) => searchParams.get(prop)
38
+ });
39
+ const scrollToId = params.scrollTo;
40
+ if (scrollToId && scrollToId === id) {
41
+ // Let parent scroll action run before running this.
42
+ window.setTimeout(() => ref.current.scrollIntoView({
43
+ behavior: 'smooth'
44
+ }), 250);
45
+ }
46
+ }, []);
28
47
  const classes = classnames('newspack-section-header', centered && 'newspack-section-header--is-centered', isWhite && 'newspack-section-header--is-white', noMargin && 'newspack-section-header--no-margin', className);
29
48
  const HeadingTag = `h${heading}`;
30
- return _jsxs(Grid, {
31
- columns: 1,
32
- gutter: 8,
33
- className: classes,
34
- children: [typeof title === 'string' && _jsx(HeadingTag, {
35
- children: title
36
- }), typeof title === 'function' && _jsx(HeadingTag, {
37
- children: title()
38
- }), typeof description === 'string' && _jsx("p", {
39
- children: description
40
- }), typeof description === 'function' && _jsx("p", {
41
- children: description()
42
- })]
49
+ return _jsx("div", {
50
+ id: id,
51
+ ref: ref,
52
+ children: _jsxs(Grid, {
53
+ columns: 1,
54
+ gutter: 8,
55
+ className: classes,
56
+ children: [typeof title === 'string' && _jsx(HeadingTag, {
57
+ children: title
58
+ }), typeof title === 'function' && _jsx(HeadingTag, {
59
+ children: title()
60
+ }), typeof description === 'string' && _jsx("p", {
61
+ children: description
62
+ }), typeof description === 'function' && _jsx("p", {
63
+ children: description()
64
+ })]
65
+ })
43
66
  });
44
67
  };
45
-
46
- SectionHeader.defaultProps = {
47
- heading: 2
48
- };
49
68
  export default SectionHeader;
@@ -2,7 +2,7 @@
2
2
  * Section Header
3
3
  */
4
4
 
5
- @import '~@wordpress/base-styles/colors';
5
+ @use '~@wordpress/base-styles/colors' as wp-colors;
6
6
 
7
7
  .newspack-section-header {
8
8
  margin: 64px 0 32px;
@@ -32,7 +32,7 @@
32
32
  }
33
33
 
34
34
  p {
35
- color: $gray-700;
35
+ color: wp-colors.$gray-700;
36
36
  }
37
37
 
38
38
  .newspack-wizard__content &:first-child {
@@ -2,22 +2,22 @@
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 { Icon } from '@wordpress/icons';
10
10
  import { BaseControl, Button, ButtonGroup } from '@wordpress/components';
11
+
11
12
  /**
12
13
  * Internal dependencies
13
14
  */
14
-
15
15
  import { hooks } from '..';
16
16
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
17
-
18
17
  const ButtonGroupControl = _ref => {
19
18
  let {
20
19
  buttonOptions,
20
+ buttonSmall,
21
21
  className,
22
22
  hideLabelFromVision,
23
23
  label,
@@ -33,24 +33,22 @@ const ButtonGroupControl = _ref => {
33
33
  children: _jsx(ButtonGroup, {
34
34
  children: buttonOptions.map(option => {
35
35
  const isSelected = value === option.value;
36
-
37
36
  let Label = () => option.label;
38
-
39
37
  if (option.icon) {
40
38
  // eslint-disable-next-line react/display-name
41
39
  Label = () => _jsx(Icon, {
42
40
  icon: option.icon
43
41
  });
44
42
  }
45
-
46
43
  return _jsx(Button, {
47
44
  variant: isSelected ? 'primary' : null,
45
+ isPressed: isSelected,
48
46
  onClick: () => onChange(option.value),
47
+ isSmall: buttonSmall,
49
48
  children: _jsx(Label, {})
50
49
  }, option.value);
51
50
  })
52
51
  })
53
52
  });
54
53
  };
55
-
56
54
  export default ButtonGroupControl;
@@ -5,21 +5,22 @@ import { BaseControl } from '@wordpress/components';
5
5
  import { __ as alias__ } from '@wordpress/i18n';
6
6
  const __ = alias__;
7
7
  import { Icon, chevronDown } from '@wordpress/icons';
8
+
8
9
  /**
9
10
  * External dependencies
10
11
  */
11
-
12
12
  import classnames from 'classnames';
13
- import { find, some } from 'lodash';
13
+ import find from 'lodash/find';
14
+ import some from 'lodash/some';
15
+
14
16
  /**
15
17
  * Internal dependencies
16
18
  */
17
-
18
19
  import { hooks } from '..';
20
+
19
21
  /**
20
22
  * SelectControl with optgroup support
21
23
  */
22
-
23
24
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
24
25
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
25
26
  export default function GroupedSelectControl(_ref) {
@@ -32,7 +33,6 @@ export default function GroupedSelectControl(_ref) {
32
33
  hideLabelFromVision,
33
34
  ...props
34
35
  } = _ref;
35
-
36
36
  const onChangeValue = event => {
37
37
  const {
38
38
  value
@@ -40,7 +40,6 @@ export default function GroupedSelectControl(_ref) {
40
40
  const optgroup = find(optgroups, group => some(group.options, ['value', value]));
41
41
  onChange(value, optgroup);
42
42
  };
43
-
44
43
  const id = hooks.useUniqueId('group-select');
45
44
  return _jsx(BaseControl, {
46
45
  label: label,
@@ -7,20 +7,19 @@
7
7
  */
8
8
  import { SelectControl as BaseComponent } from '@wordpress/components';
9
9
  import { Component } from '@wordpress/element';
10
+
10
11
  /**
11
12
  * External dependencies
12
13
  */
13
-
14
14
  import classNames from 'classnames';
15
+
15
16
  /**
16
17
  * Internal dependencies
17
18
  */
18
-
19
19
  import './style.scss';
20
20
  import GroupedSelectControl from './GroupedSelectControl';
21
21
  import ButtonGroupControl from './ButtonGroupControl';
22
22
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
23
-
24
23
  class SelectControl extends Component {
25
24
  /**
26
25
  * Render.
@@ -30,6 +29,7 @@ class SelectControl extends Component {
30
29
  className,
31
30
  optgroups,
32
31
  buttonOptions,
32
+ buttonSmall,
33
33
  ...otherProps
34
34
  } = this.props;
35
35
  const classes = classNames('newspack-select-control', optgroups && 'newspack-grouped-select-control', buttonOptions && 'newspack-buttons-select-control', className);
@@ -40,12 +40,12 @@ class SelectControl extends Component {
40
40
  ...otherProps
41
41
  }) : buttonOptions ? _jsx(ButtonGroupControl, {
42
42
  buttonOptions: buttonOptions,
43
+ buttonSmall: buttonSmall,
44
+ ...otherProps
45
+ }) : _jsx(BaseComponent, {
43
46
  ...otherProps
44
- }) : _jsx(BaseComponent, { ...otherProps
45
47
  })
46
48
  });
47
49
  }
48
-
49
50
  }
50
-
51
51
  export default SelectControl;
@@ -2,7 +2,7 @@
2
2
  * Select Control
3
3
  */
4
4
 
5
- @import '~@wordpress/base-styles/colors';
5
+ @use '~@wordpress/base-styles/colors' as wp-colors;
6
6
 
7
7
  .components-select-control {
8
8
  &__input {
@@ -47,7 +47,7 @@
47
47
  &__input {
48
48
  appearance: none;
49
49
  background: transparent;
50
- border: 1px solid $gray-700;
50
+ border: 1px solid wp-colors.$gray-700;
51
51
  border-radius: 2px;
52
52
  box-shadow: none !important;
53
53
  box-sizing: border-box;
@@ -4,15 +4,14 @@
4
4
  import { __ as alias__ } from '@wordpress/i18n';
5
5
  const __ = alias__;
6
6
  import { CheckboxControl } from '@wordpress/components';
7
+
7
8
  /**
8
9
  * Internal dependencies.
9
10
  */
10
-
11
11
  import { TextControl } from '../';
12
12
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
13
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
14
14
  import { Fragment as _Fragment } from "@emotion/react/jsx-runtime";
15
-
16
15
  const MinMaxSetting = _ref => {
17
16
  let {
18
17
  min,
@@ -51,5 +50,4 @@ const MinMaxSetting = _ref => {
51
50
  })]
52
51
  });
53
52
  };
54
-
55
53
  export default MinMaxSetting;
@@ -2,13 +2,12 @@
2
2
  * External dependencies.
3
3
  */
4
4
  import classnames from 'classnames';
5
+
5
6
  /**
6
7
  * Internal dependencies.
7
8
  */
8
-
9
9
  import { Grid, ActionCard } from '../';
10
10
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
11
-
12
11
  const SettingsCard = _ref => {
13
12
  let {
14
13
  children,
@@ -20,7 +19,8 @@ const SettingsCard = _ref => {
20
19
  ...props
21
20
  } = _ref;
22
21
  const classes = classnames('newspack-settings__card', noBorder && 'newspack-settings__no-border', className);
23
- return _jsx(ActionCard, { ...props,
22
+ return _jsx(ActionCard, {
23
+ ...props,
24
24
  className: classes,
25
25
  notificationLevel: "info",
26
26
  noBorder: noBorder,
@@ -32,7 +32,6 @@ const SettingsCard = _ref => {
32
32
  })
33
33
  });
34
34
  };
35
-
36
35
  SettingsCard.defaultProps = {
37
36
  columns: 3,
38
37
  gutter: 32
@@ -4,7 +4,6 @@
4
4
  import { Grid, InfoButton } from '../';
5
5
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
6
6
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
7
-
8
7
  const SettingSection = _ref => {
9
8
  let {
10
9
  title,
@@ -28,5 +27,4 @@ const SettingSection = _ref => {
28
27
  })]
29
28
  });
30
29
  };
31
-
32
30
  export default SettingSection;
@@ -43,7 +43,7 @@
43
43
  align-items: center;
44
44
  justify-content: space-between;
45
45
  flex-wrap: wrap;
46
- > *:not( [class*='help'] ):not( [class*='label'] ) {
46
+ > *:not( [class*='help'], [class*='label'] ) {
47
47
  margin: 0;
48
48
  }
49
49
  }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Steps List
3
+ */
4
+
5
+ /**
6
+ * WordPress dependencies.
7
+ */
8
+ import { Component } from '@wordpress/element';
9
+
10
+ /**
11
+ * Internal dependencies.
12
+ */
13
+ import { StepsListItem } from '../';
14
+ import './style.scss';
15
+
16
+ /**
17
+ * External dependencies.
18
+ */
19
+ import classnames from 'classnames';
20
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
21
+ class StepsList extends Component {
22
+ /**
23
+ * Render
24
+ */
25
+ render() {
26
+ const {
27
+ className,
28
+ stepsListItems,
29
+ narrowList,
30
+ style = {}
31
+ } = this.props;
32
+ const classes = classnames('steps-list', className, narrowList && 'steps-list__narrow-list');
33
+ return _jsx("div", {
34
+ className: classes,
35
+ style: style,
36
+ children: stepsListItems.map((listItem, index) => _jsx(StepsListItem, {
37
+ listItemCount: index + 1,
38
+ listItemText: listItem
39
+ }, index))
40
+ });
41
+ }
42
+ }
43
+ export default StepsList;
@@ -0,0 +1,11 @@
1
+ @use '../../../shared/scss/colors';
2
+ @use '~@wordpress/base-styles/colors' as wp-colors;
3
+
4
+ .steps-list {
5
+ margin-left: auto;
6
+ margin-right: auto;
7
+
8
+ &__narrow-list {
9
+ max-width: 416px;
10
+ }
11
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Steps List Item
3
+ */
4
+
5
+ /**
6
+ * WordPress dependencies.
7
+ */
8
+ import { Component } from '@wordpress/element';
9
+
10
+ /**
11
+ * Internal dependencies.
12
+ */
13
+ import './style.scss';
14
+
15
+ /**
16
+ * External dependencies.
17
+ */
18
+ import classnames from 'classnames';
19
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
20
+ import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
21
+ class StepsListItem extends Component {
22
+ /**
23
+ * Render
24
+ */
25
+ render() {
26
+ const {
27
+ className,
28
+ listItemCount,
29
+ listItemText,
30
+ style = {}
31
+ } = this.props;
32
+ const classes = classnames('steps-list-item', className);
33
+ return _jsxs("div", {
34
+ className: classes,
35
+ style: style,
36
+ children: [_jsx("div", {
37
+ className: "steps-list-item__number",
38
+ children: listItemCount
39
+ }), _jsx("div", {
40
+ className: "steps-list-item__content",
41
+ dangerouslySetInnerHTML: {
42
+ __html: listItemText
43
+ }
44
+ })]
45
+ });
46
+ }
47
+ }
48
+ export default StepsListItem;
@@ -0,0 +1,47 @@
1
+ @use '../../../shared/scss/colors';
2
+ @use '~@wordpress/base-styles/colors' as wp-colors;
3
+
4
+ .steps-list-item {
5
+ align-items: center;
6
+ display: grid;
7
+ grid-template-columns: 28px auto;
8
+ gap: 24px;
9
+ position: relative;
10
+
11
+ &::before {
12
+ border: 1px solid #F0F0F0;
13
+ bottom: -16px;
14
+ content: '';
15
+ display: block;
16
+ left: 14px;
17
+ position: absolute;
18
+ top: -16px;
19
+ }
20
+
21
+ &:first-child::before {
22
+ top: 50%;
23
+ }
24
+
25
+ &:last-child::before {
26
+ bottom: 50%;
27
+ }
28
+
29
+ + .steps-list-item {
30
+ margin-top: 32px;
31
+ }
32
+
33
+ &__number {
34
+ align-items: center;
35
+ background: #fff;
36
+ border: 1px solid currentcolor;
37
+ border-radius: 100%;
38
+ color: colors.$primary-500;
39
+ display: flex;
40
+ height: 28px;
41
+ justify-content: center;
42
+ outline: 8px solid #fff;
43
+ position: relative;
44
+ width: 28px;
45
+ z-index: 2;
46
+ }
47
+ }