newspack-components 3.1.0 → 4.0.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 (191) hide show
  1. package/colors/colors.module.scss +277 -0
  2. package/copy-styles.js +8 -1
  3. package/dist/cjs/action-card/action-card.d.js +5 -0
  4. package/dist/cjs/action-card/index.js +282 -187
  5. package/dist/cjs/action-card/style.scss +142 -44
  6. package/dist/cjs/autocomplete-tokenfield/index.js +6 -2
  7. package/dist/cjs/box-contrast/index.js +49 -0
  8. package/dist/cjs/button/index.js +1 -1
  9. package/dist/cjs/button-props/button-props.js +41 -0
  10. package/dist/cjs/button-props/index.js +13 -0
  11. package/dist/cjs/color-picker/index.js +11 -0
  12. package/dist/cjs/custom-select-control/style.scss +7 -12
  13. package/dist/cjs/footer/index.js +17 -24
  14. package/dist/cjs/footer/style.scss +0 -36
  15. package/dist/cjs/handoff-message/index.js +0 -3
  16. package/dist/cjs/hooks/useObjectState.js +9 -0
  17. package/dist/cjs/hooks/useObjectState.test.js +5 -5
  18. package/dist/cjs/index.js +7 -21
  19. package/dist/cjs/modal/index.js +4 -1
  20. package/dist/cjs/modal/style.scss +18 -7
  21. package/dist/cjs/newspack-icon/index.js +2 -2
  22. package/dist/cjs/newspack-icon/style.scss +3 -5
  23. package/dist/cjs/notice/index.js +1 -2
  24. package/dist/cjs/notice/style.scss +11 -9
  25. package/dist/cjs/plugin-installer/index.js +3 -3
  26. package/dist/cjs/plugin-settings/SettingsSection.js +2 -0
  27. package/dist/cjs/plugin-settings/index.js +4 -1
  28. package/dist/cjs/plugin-toggle/index.js +2 -0
  29. package/dist/cjs/popover/style.scss +5 -6
  30. package/dist/cjs/progress-bar/index.test.js +1 -2
  31. package/dist/cjs/progress-bar/style.scss +1 -2
  32. package/dist/cjs/proxied-imports/router.js +1 -2
  33. package/dist/cjs/radio-control/style.scss +4 -10
  34. package/dist/cjs/section-header/index.js +21 -1
  35. package/dist/cjs/select-control/ButtonGroupControl.js +2 -0
  36. package/dist/cjs/settings/SettingsCard.js +2 -6
  37. package/dist/cjs/sortable-newsletter-list-control/index.js +7 -5
  38. package/dist/cjs/sortable-newsletter-list-control/style.scss +11 -1
  39. package/dist/cjs/steps-list/style.scss +0 -3
  40. package/dist/cjs/steps-list-item/style.scss +1 -2
  41. package/dist/cjs/style-card/index.js +1 -0
  42. package/dist/cjs/style-card/style.scss +4 -5
  43. package/dist/cjs/style.scss +15 -0
  44. package/dist/cjs/tabbed-navigation/index.js +17 -7
  45. package/dist/cjs/tabbed-navigation/style.scss +2 -6
  46. package/dist/cjs/utils/color.js +35 -0
  47. package/dist/cjs/web-preview/style.scss +11 -11
  48. package/dist/cjs/with-wizard/index.js +80 -3
  49. package/dist/cjs/with-wizard/style.scss +34 -13
  50. package/dist/cjs/with-wizard-screen/index.js +3 -3
  51. package/dist/cjs/with-wizard-screen/style.scss +9 -9
  52. package/dist/cjs/wizard/index.js +38 -13
  53. package/dist/cjs/wizard/store/index.js +13 -5
  54. package/dist/cjs/wizard/store/utils.js +3 -1
  55. package/dist/esm/action-card/action-card.d.js +1 -0
  56. package/dist/esm/action-card/index.js +286 -189
  57. package/dist/esm/action-card/style.scss +142 -44
  58. package/dist/esm/autocomplete-tokenfield/index.js +6 -2
  59. package/dist/esm/box-contrast/index.js +44 -0
  60. package/dist/esm/button/index.js +1 -1
  61. package/dist/esm/button-props/button-props.js +34 -0
  62. package/dist/esm/button-props/index.js +1 -0
  63. package/dist/esm/color-picker/index.js +11 -0
  64. package/dist/esm/custom-select-control/style.scss +7 -12
  65. package/dist/esm/footer/index.js +18 -25
  66. package/dist/esm/footer/style.scss +0 -36
  67. package/dist/esm/handoff-message/index.js +0 -3
  68. package/dist/esm/hooks/useObjectState.js +10 -0
  69. package/dist/esm/hooks/useObjectState.test.js +6 -6
  70. package/dist/esm/index.js +1 -3
  71. package/dist/esm/modal/index.js +4 -1
  72. package/dist/esm/modal/style.scss +18 -7
  73. package/dist/esm/newspack-icon/index.js +2 -2
  74. package/dist/esm/newspack-icon/style.scss +3 -5
  75. package/dist/esm/notice/index.js +1 -2
  76. package/dist/esm/notice/style.scss +11 -9
  77. package/dist/esm/plugin-installer/index.js +3 -3
  78. package/dist/esm/plugin-settings/SettingsSection.js +2 -0
  79. package/dist/esm/plugin-settings/index.js +4 -1
  80. package/dist/esm/plugin-toggle/index.js +2 -0
  81. package/dist/esm/popover/style.scss +5 -6
  82. package/dist/esm/progress-bar/style.scss +1 -2
  83. package/dist/esm/radio-control/style.scss +4 -10
  84. package/dist/esm/section-header/index.js +22 -0
  85. package/dist/esm/select-control/ButtonGroupControl.js +2 -0
  86. package/dist/esm/settings/SettingsCard.js +2 -6
  87. package/dist/esm/sortable-newsletter-list-control/index.js +8 -6
  88. package/dist/esm/sortable-newsletter-list-control/style.scss +11 -1
  89. package/dist/esm/steps-list/style.scss +0 -3
  90. package/dist/esm/steps-list-item/style.scss +1 -2
  91. package/dist/esm/style-card/index.js +1 -0
  92. package/dist/esm/style-card/style.scss +4 -5
  93. package/dist/esm/style.scss +15 -0
  94. package/dist/esm/tabbed-navigation/index.js +17 -7
  95. package/dist/esm/tabbed-navigation/style.scss +2 -6
  96. package/dist/esm/utils/color.js +29 -0
  97. package/dist/esm/web-preview/style.scss +11 -11
  98. package/dist/esm/with-wizard/index.js +81 -4
  99. package/dist/esm/with-wizard/style.scss +34 -13
  100. package/dist/esm/with-wizard-screen/index.js +1 -1
  101. package/dist/esm/with-wizard-screen/style.scss +9 -9
  102. package/dist/esm/wizard/index.js +39 -13
  103. package/dist/esm/wizard/store/index.js +13 -5
  104. package/dist/esm/wizard/store/utils.js +3 -1
  105. package/package.json +1 -1
  106. package/src/accordion/index.js +1 -3
  107. package/src/action-card/action-card.d.ts +40 -0
  108. package/src/action-card/index.js +284 -202
  109. package/src/action-card/style.scss +142 -44
  110. package/src/autocomplete-tokenfield/index.js +3 -2
  111. package/src/autocomplete-with-suggestions/index.js +52 -63
  112. package/src/box-contrast/index.tsx +44 -0
  113. package/src/button/index.tsx +1 -1
  114. package/src/button-card/index.js +1 -12
  115. package/src/card/index.js +1 -11
  116. package/src/category-autocomplete/index.js +4 -19
  117. package/src/color-picker/index.js +11 -7
  118. package/src/custom-select-control/style.scss +7 -12
  119. package/src/footer/index.js +6 -18
  120. package/src/footer/style.scss +0 -36
  121. package/src/form-token-field/index.js +1 -2
  122. package/src/grid/index.tsx +1 -8
  123. package/src/handoff/index.js +4 -11
  124. package/src/handoff-message/index.js +0 -3
  125. package/src/hooks/useObjectState.js +10 -2
  126. package/src/hooks/useObjectState.test.js +14 -14
  127. package/src/image-upload/index.js +3 -23
  128. package/src/index.js +1 -3
  129. package/src/modal/index.js +2 -2
  130. package/src/modal/style.scss +18 -7
  131. package/src/newspack-icon/index.js +3 -14
  132. package/src/newspack-icon/style.scss +3 -5
  133. package/src/notice/index.js +0 -2
  134. package/src/notice/style.scss +11 -9
  135. package/src/plugin-installer/index.js +8 -17
  136. package/src/plugin-settings/SettingsSection.js +3 -7
  137. package/src/plugin-settings/index.js +7 -14
  138. package/src/plugin-toggle/README.md +3 -3
  139. package/src/plugin-toggle/index.js +10 -13
  140. package/src/popover/index.js +1 -5
  141. package/src/popover/style.scss +5 -6
  142. package/src/position-control/index.js +65 -75
  143. package/src/progress-bar/index.js +2 -9
  144. package/src/progress-bar/index.test.js +4 -13
  145. package/src/progress-bar/style.scss +1 -2
  146. package/src/radio-control/style.scss +4 -10
  147. package/src/section-header/index.js +20 -0
  148. package/src/select-control/ButtonGroupControl.js +2 -9
  149. package/src/select-control/GroupedSelectControl.js +1 -9
  150. package/src/select-control/index.js +1 -5
  151. package/src/settings/MinMaxSetting.js +2 -14
  152. package/src/settings/SettingsCard.js +2 -11
  153. package/src/sortable-newsletter-list-control/index.js +10 -26
  154. package/src/sortable-newsletter-list-control/style.scss +11 -1
  155. package/src/steps-list/style.scss +0 -3
  156. package/src/steps-list-item/index.js +1 -4
  157. package/src/steps-list-item/style.scss +1 -2
  158. package/src/style-card/index.js +6 -21
  159. package/src/style-card/style.scss +4 -5
  160. package/src/style.scss +15 -0
  161. package/src/tabbed-navigation/index.js +19 -7
  162. package/src/tabbed-navigation/style.scss +2 -6
  163. package/src/text-control/index.tsx +2 -12
  164. package/src/utils/color.ts +32 -0
  165. package/src/web-preview/style.scss +11 -11
  166. package/src/with-wizard/index.js +67 -16
  167. package/src/with-wizard/style.scss +34 -13
  168. package/src/with-wizard-screen/index.js +1 -1
  169. package/src/with-wizard-screen/style.scss +9 -9
  170. package/src/wizard/components/WizardError.js +2 -7
  171. package/src/wizard/index.js +64 -62
  172. package/src/wizard/store/index.js +8 -10
  173. package/src/wizard/store/utils.js +3 -4
  174. package/dist/cjs/date-range-picker/index.js +0 -39
  175. package/dist/cjs/date-range-picker/style.scss +0 -148
  176. package/dist/cjs/newspack-logo/index.js +0 -54
  177. package/dist/cjs/newspack-logo/style.scss +0 -30
  178. package/dist/cjs/patrons-logo/index.js +0 -77
  179. package/dist/esm/date-range-picker/index.js +0 -31
  180. package/dist/esm/date-range-picker/style.scss +0 -148
  181. package/dist/esm/newspack-logo/index.js +0 -46
  182. package/dist/esm/newspack-logo/style.scss +0 -30
  183. package/dist/esm/patrons-logo/index.js +0 -70
  184. package/shared/scss/_colors.scss +0 -27
  185. package/src/date-range-picker/index.js +0 -31
  186. package/src/date-range-picker/style.scss +0 -148
  187. package/src/newspack-logo/index.js +0 -45
  188. package/src/newspack-logo/style.scss +0 -30
  189. package/src/patrons-logo/index.js +0 -76
  190. /package/{shared/js → src/button-props}/button-props.js +0 -0
  191. /package/{shared/js → src/button-props}/index.js +0 -0
@@ -54,27 +54,27 @@ describe('useObjectState', () => {
54
54
  });
55
55
  it('updates arrays', () => {
56
56
  expect(getState()).toStrictEqual(INIT_STATE);
57
- _react2.screen.getByText('Remove widgets').click();
57
+ (0, _react2.act)(() => _react2.screen.getByText('Remove widgets').click());
58
58
  expect(getState()).toMatchObject({
59
59
  widgets: []
60
60
  });
61
- _react2.screen.getByText('Add widget').click();
61
+ (0, _react2.act)(() => _react2.screen.getByText('Add widget').click());
62
62
  expect(getState()).toMatchObject({
63
63
  widgets: [1]
64
64
  });
65
65
  });
66
66
  it('updates a simple value', () => {
67
- _react2.fireEvent.change(_react2.screen.getByPlaceholderText('name'), {
67
+ (0, _react2.act)(() => _react2.fireEvent.change(_react2.screen.getByPlaceholderText('name'), {
68
68
  target: {
69
69
  value: 'Ramon'
70
70
  }
71
- });
71
+ }));
72
72
  expect(getState()).toMatchObject({
73
73
  name: 'Ramon'
74
74
  });
75
75
  });
76
76
  it('updates a nested object', () => {
77
- _react2.screen.getByText('Nested update').click();
77
+ (0, _react2.act)(() => _react2.screen.getByText('Nested update').click());
78
78
  expect(getState()).toMatchObject({
79
79
  attributes: {
80
80
  bar: 2,
package/dist/cjs/index.js CHANGED
@@ -28,6 +28,12 @@ Object.defineProperty(exports, "AutocompleteWithSuggestions", {
28
28
  return _autocompleteWithSuggestions.default;
29
29
  }
30
30
  });
31
+ Object.defineProperty(exports, "BoxContrast", {
32
+ enumerable: true,
33
+ get: function () {
34
+ return _boxContrast.default;
35
+ }
36
+ });
31
37
  Object.defineProperty(exports, "Button", {
32
38
  enumerable: true,
33
39
  get: function () {
@@ -64,12 +70,6 @@ Object.defineProperty(exports, "CustomSelectControl", {
64
70
  return _customSelectControl.default;
65
71
  }
66
72
  });
67
- Object.defineProperty(exports, "DateRangePicker", {
68
- enumerable: true,
69
- get: function () {
70
- return _dateRangePicker.default;
71
- }
72
- });
73
73
  Object.defineProperty(exports, "Footer", {
74
74
  enumerable: true,
75
75
  get: function () {
@@ -130,24 +130,12 @@ Object.defineProperty(exports, "NewspackIcon", {
130
130
  return _newspackIcon.default;
131
131
  }
132
132
  });
133
- Object.defineProperty(exports, "NewspackLogo", {
134
- enumerable: true,
135
- get: function () {
136
- return _newspackLogo.default;
137
- }
138
- });
139
133
  Object.defineProperty(exports, "Notice", {
140
134
  enumerable: true,
141
135
  get: function () {
142
136
  return _notice.default;
143
137
  }
144
138
  });
145
- Object.defineProperty(exports, "PatronsLogo", {
146
- enumerable: true,
147
- get: function () {
148
- return _patronsLogo.default;
149
- }
150
- });
151
139
  Object.defineProperty(exports, "PluginInstaller", {
152
140
  enumerable: true,
153
141
  get: function () {
@@ -286,6 +274,7 @@ var _autocompleteTokenfield = _interopRequireDefault(require("./autocomplete-tok
286
274
  var _autocompleteWithSuggestions = _interopRequireDefault(require("./autocomplete-with-suggestions"));
287
275
  var _button = _interopRequireDefault(require("./button"));
288
276
  var _buttonCard = _interopRequireDefault(require("./button-card"));
277
+ var _boxContrast = _interopRequireDefault(require("./box-contrast"));
289
278
  var _card = _interopRequireDefault(require("./card"));
290
279
  var _categoryAutocomplete = _interopRequireDefault(require("./category-autocomplete"));
291
280
  var _colorPicker = _interopRequireDefault(require("./color-picker"));
@@ -300,9 +289,7 @@ var _globalNotices = _interopRequireDefault(require("./global-notices"));
300
289
  var _grid = _interopRequireDefault(require("./grid"));
301
290
  var _modal = _interopRequireDefault(require("./modal"));
302
291
  var _newspackIcon = _interopRequireDefault(require("./newspack-icon"));
303
- var _newspackLogo = _interopRequireDefault(require("./newspack-logo"));
304
292
  var _notice = _interopRequireDefault(require("./notice"));
305
- var _patronsLogo = _interopRequireDefault(require("./patrons-logo"));
306
293
  var _pluginInstaller = _interopRequireDefault(require("./plugin-installer"));
307
294
  var _pluginSettings = _interopRequireDefault(require("./plugin-settings"));
308
295
  var _pluginToggle = _interopRequireDefault(require("./plugin-toggle"));
@@ -311,7 +298,6 @@ var _progressBar = _interopRequireDefault(require("./progress-bar"));
311
298
  var _radioControl = _interopRequireDefault(require("./radio-control"));
312
299
  var _sectionHeader = _interopRequireDefault(require("./section-header"));
313
300
  var _selectControl = _interopRequireDefault(require("./select-control"));
314
- var _dateRangePicker = _interopRequireDefault(require("./date-range-picker"));
315
301
  var _settings = _interopRequireDefault(require("./settings"));
316
302
  var _stepsList = _interopRequireDefault(require("./steps-list"));
317
303
  var _stepsListItem = _interopRequireDefault(require("./steps-list-item"));
@@ -30,9 +30,12 @@ function Modal({
30
30
  className,
31
31
  isWide,
32
32
  isNarrow,
33
+ hideTitle,
33
34
  ...otherProps
34
35
  }, ref) {
35
- const classes = (0, _classnames.default)('newspack-modal', isWide && 'newspack-modal--wide', isNarrow && 'newspack-modal--narrow', className);
36
+ const classes = (0, _classnames.default)('newspack-modal', isWide && 'newspack-modal--wide', isNarrow && 'newspack-modal--narrow', hideTitle && 'newspack-modal--hide-title',
37
+ // Note: also hides the X close button.
38
+ className);
36
39
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Modal, {
37
40
  className: classes,
38
41
  ...otherProps,
@@ -2,16 +2,16 @@
2
2
  * Modal
3
3
  */
4
4
 
5
- @use "../../../shared/scss/colors";
5
+ @use "../../../colors/colors.module" as colors;
6
6
 
7
7
  .newspack-modal {
8
8
  // Color
9
- --wp-admin-theme-color: #{colors.$primary-500};
10
- --wp-admin-theme-color--rgb: #{colors.$primary-500--rgb};
11
- --wp-admin-theme-color-darker-10: #{colors.$primary-600};
12
- --wp-admin-theme-color-darker-10--rgb: #{colors.$primary-600--rgb};
13
- --wp-admin-theme-color-darker-20: #{colors.$primary-700};
14
- --wp-admin-theme-color-darker-20--rgb: #{colors.$primary-700--rgb};
9
+ --wp-admin-theme-color: #{colors.$primary-600};
10
+ --wp-admin-theme-color--rgb: #{colors.$primary-600--rgb};
11
+ --wp-admin-theme-color-darker-10: #{colors.$primary-700};
12
+ --wp-admin-theme-color-darker-10--rgb: #{colors.$primary-700--rgb};
13
+ --wp-admin-theme-color-darker-20: #{colors.$primary-800};
14
+ --wp-admin-theme-color-darker-20--rgb: #{colors.$primary-800--rgb};
15
15
 
16
16
  @media screen and ( min-width: 744px ) {
17
17
  max-width: 680px;
@@ -28,6 +28,17 @@
28
28
  width: 360px;
29
29
  }
30
30
 
31
+ &--hide-title {
32
+ .components-modal__header {
33
+ display: none;
34
+ }
35
+
36
+ .components-modal__content {
37
+ margin-top: 0;
38
+ padding-top: 32px;
39
+ }
40
+ }
41
+
31
42
  @media screen and ( min-width: 960px ) {
32
43
  max-height: calc(100% - 128px);
33
44
  }
@@ -42,12 +42,12 @@ class NewspackIcon extends _element.Component {
42
42
  xmlns: "http://www.w3.org/2000/svg",
43
43
  height: size,
44
44
  width: size,
45
- viewBox: "0 0 32 32",
45
+ viewBox: "0 0 24 24",
46
46
  className: classes,
47
47
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Path, {
48
48
  fillRule: "evenodd",
49
49
  clipRule: "evenodd",
50
- d: "M32 16c0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16S7.164 0 16 0s16 7.164 16 16zm-10.732.622h1.72v-1.124h-2.823l1.103 1.124zm-3.249-3.31h4.97v-1.124h-6.072l1.102 1.124zm-3.248-3.31h8.217V8.877h-9.32l1.103 1.125zM9.01 8.877l13.977 14.246h-4.66l-5.866-5.98v5.98h-3.45V8.877z"
50
+ d: "M24 12C24 18.6271 18.6271 24 12 24C5.37213 24 0 18.6271 0 12C0 5.3729 5.3729 0 12 0C18.6271 0 24 5.3729 24 12ZM17.4545 17.4546L6.54545 6.54545V17.4545H8.72727V11.8182L14.3636 17.4546H17.4545ZM11.2727 8.18182H17.4545V6.54545H9.63636L11.2727 8.18182ZM17.4545 11.2727H14.3636L12.7273 9.63636H17.4545V11.2727ZM17.4545 12.7273V14.3636L15.8182 12.7273H17.4545Z"
51
51
  })
52
52
  });
53
53
  }
@@ -2,21 +2,19 @@
2
2
  * Newspack Icon
3
3
  */
4
4
 
5
- @use "../../../shared/scss/colors";
6
-
7
5
  .newspack-icon {
8
- background: colors.$primary-500;
6
+ background: var(--wp-admin-theme-color);
9
7
  fill: white;
10
8
  padding: 12px;
11
9
 
12
10
  &--white {
13
11
  background: white;
14
- fill: colors.$primary-500;
12
+ fill: var(--wp-admin-theme-color);
15
13
  }
16
14
 
17
15
  &--simple {
18
16
  background: none;
19
- fill: colors.$primary-500;
17
+ fill: var(--wp-admin-theme-color);
20
18
  padding: 0;
21
19
  }
22
20
 
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _element = require("@wordpress/element");
9
9
  var _icons = require("@wordpress/icons");
10
- var _i18n = require("@wordpress/i18n");
11
10
  require("./style.scss");
12
11
  var _classnames = _interopRequireDefault(require("classnames"));
13
12
  var _jsxRuntime = require("react/jsx-runtime");
@@ -65,7 +64,7 @@ class Notice extends _element.Component {
65
64
  className: "newspack-notice__content",
66
65
  children: [rawHTML ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_element.RawHTML, {
67
66
  children: noticeText
68
- }) : noticeText, debugMode && (0, _i18n.__)('Debug Mode', 'newspack-plugin'), children || null]
67
+ }) : noticeText, children || null]
69
68
  })]
70
69
  });
71
70
  }
@@ -4,7 +4,7 @@
4
4
 
5
5
  @use "sass:color";
6
6
  @use "~@wordpress/base-styles/colors" as wp-colors;
7
- @use "../../../shared/scss/colors";
7
+ @use "../../../colors/colors.module" as colors;
8
8
 
9
9
  .newspack-notice {
10
10
  align-items: center;
@@ -13,7 +13,7 @@
13
13
  display: flex;
14
14
  justify-content: flex-start;
15
15
  margin: 32px 0;
16
- padding: 6px 8px;
16
+ padding: 8px 12px;
17
17
 
18
18
  > svg {
19
19
  display: block;
@@ -23,24 +23,26 @@
23
23
  }
24
24
 
25
25
  &__is-debug {
26
- background: colors.$primary-700;
27
- border-radius: 2px;
26
+ background: colors.$primary-600;
27
+ border-radius: 50%;
28
28
  bottom: 16px;
29
29
  box-shadow: 0 0 8px 4px rgba(black, 0.08);
30
30
  color: white;
31
31
  font-weight: bold;
32
32
  margin: 0 16px;
33
+ padding: 6px;
33
34
  position: fixed;
34
35
  text-transform: uppercase;
35
36
  z-index: 9997;
36
37
 
37
38
  > svg {
38
39
  fill: white;
40
+ margin: 0;
39
41
  }
40
42
  }
41
43
 
42
44
  &__is-error {
43
- background: color.adjust(wp-colors.$alert-red, $lightness: 51%);
45
+ background: color.adjust(wp-colors.$alert-red, $lightness: 35%);
44
46
 
45
47
  > svg {
46
48
  fill: wp-colors.$alert-red;
@@ -49,7 +51,7 @@
49
51
  }
50
52
 
51
53
  &__is-handoff {
52
- background: color.adjust(wp-colors.$alert-yellow, $lightness: 30%);
54
+ background: color.adjust(wp-colors.$alert-yellow, $lightness: 35%);
53
55
  margin-top: 0;
54
56
  position: sticky;
55
57
  top: 46px;
@@ -64,12 +66,12 @@
64
66
  background: colors.$primary-050;
65
67
 
66
68
  > svg {
67
- fill: colors.$primary-500;
69
+ fill: var(--wp-admin-theme-color);
68
70
  }
69
71
  }
70
72
 
71
73
  &__is-success {
72
- background: color.adjust(wp-colors.$alert-green, $lightness: 42%);
74
+ background: color.adjust(wp-colors.$alert-green, $lightness: 45%);
73
75
 
74
76
  > svg {
75
77
  fill: wp-colors.$alert-green;
@@ -77,7 +79,7 @@
77
79
  }
78
80
 
79
81
  &__is-warning {
80
- background: color.adjust(wp-colors.$alert-yellow, $lightness: 30%);
82
+ background: color.adjust(wp-colors.$alert-yellow, $lightness: 35%);
81
83
 
82
84
  > svg {
83
85
  fill: wp-colors.$alert-yellow;
@@ -191,8 +191,8 @@ class PluginInstaller extends _element.Component {
191
191
  pluginInfo
192
192
  } = this.state;
193
193
  const {
194
- is_atomic: isAtomic
195
- } = window;
194
+ is_managed: isManaged
195
+ } = window.newspack_aux_data || {};
196
196
  const slugs = Object.keys(pluginInfo);
197
197
 
198
198
  // Store all plugin status info for installer button text value based on current status.
@@ -234,7 +234,7 @@ class PluginInstaller extends _element.Component {
234
234
  } else if (!installable) {
235
235
  actionText = /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
236
236
  className: "newspack-plugin-installer__status",
237
- children: [isAtomic ? (0, _i18n.__)('Contact Newspack support to install', 'newspack-plugin') : (0, _i18n.__)('Plugin must be installed manually', 'newspack-plugin'), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
237
+ children: [isManaged ? (0, _i18n.__)('Contact Newspack support to install', 'newspack-plugin') : (0, _i18n.__)('Plugin must be installed manually', 'newspack-plugin'), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
238
238
  className: "newspack-checkbox-icon"
239
239
  })]
240
240
  });
@@ -58,6 +58,7 @@ const getControlType = setting => {
58
58
  }
59
59
  };
60
60
  const SettingsSection = props => {
61
+ var _props$id;
61
62
  const [saveDisabled, setSaveDisabled] = (0, _element.useState)(true);
62
63
  const {
63
64
  error,
@@ -98,6 +99,7 @@ const SettingsSection = props => {
98
99
  columns = 1;
99
100
  }
100
101
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_.ActionCard, {
102
+ id: (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : null,
101
103
  isMedium: true,
102
104
  disabled: disabled,
103
105
  title: title,
@@ -188,7 +188,8 @@ class PluginSettings extends _element.Component {
188
188
  title,
189
189
  description,
190
190
  hasGreyHeader,
191
- children
191
+ children,
192
+ titleLevel = 1
192
193
  } = this.props;
193
194
  const {
194
195
  settings,
@@ -198,6 +199,7 @@ class PluginSettings extends _element.Component {
198
199
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_element.Fragment, {
199
200
  children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.SectionHeader, {
200
201
  title: title,
202
+ heading: titleLevel,
201
203
  description: description
202
204
  }), error && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Notice, {
203
205
  isError: true,
@@ -208,6 +210,7 @@ class PluginSettings extends _element.Component {
208
210
  }),
209
211
  children: [Object.keys(settings).map(sectionKey => /*#__PURE__*/(0, _jsxRuntime.jsx)(_SettingsSection.default, {
210
212
  disabled: inFlight,
213
+ id: `plugin-settings-${sectionKey}`,
211
214
  sectionKey: sectionKey,
212
215
  title: this.getSectionTitle(sectionKey),
213
216
  description: this.getSectionDescription(sectionKey),
@@ -103,6 +103,7 @@ var _jsxRuntime = require("react/jsx-runtime");
103
103
  pluginInfo
104
104
  } = this.state;
105
105
  return this.prepareDataForRender(plugins, pluginInfo).map((plugin, index) => {
106
+ var _plugin$onClick;
106
107
  const {
107
108
  name,
108
109
  description,
@@ -119,6 +120,7 @@ var _jsxRuntime = require("react/jsx-runtime");
119
120
  description: description,
120
121
  actionText: this.actionTextForPlugin(plugin),
121
122
  handoff: handoff,
123
+ onClick: (_plugin$onClick = plugin.onClick) !== null && _plugin$onClick !== void 0 ? _plugin$onClick : null,
122
124
  href: href,
123
125
  toggle: true,
124
126
  toggleChecked: this.isPluginInstalledAndActive(plugin),
@@ -2,7 +2,6 @@
2
2
  * Popover
3
3
  */
4
4
 
5
- @use "../../../shared/scss/colors";
6
5
  @use "~@wordpress/base-styles/colors" as wp-colors;
7
6
 
8
7
  .newspack-popover {
@@ -16,7 +15,7 @@
16
15
  padding: 6px 8px;
17
16
 
18
17
  &:hover {
19
- color: colors.$primary-500;
18
+ color: var(--wp-admin-theme-color);
20
19
 
21
20
  .components-menu-items__item-icon {
22
21
  fill: currentcolor;
@@ -24,7 +23,7 @@
24
23
  }
25
24
 
26
25
  &:focus:not(:disabled) {
27
- box-shadow: inset 0 0 0 2px colors.$primary-500;
26
+ box-shadow: inset 0 0 0 2px var(--wp-admin-theme-color);
28
27
  position: relative;
29
28
  z-index: 1;
30
29
  }
@@ -42,7 +41,7 @@
42
41
  &:focus,
43
42
  &:focus:enabled &:hover,
44
43
  &:not(:disabled, [aria-disabled="true"], .is-default):hover {
45
- color: colors.$primary-500;
44
+ color: var(--wp-admin-theme-color);
46
45
  }
47
46
  }
48
47
 
@@ -89,8 +88,8 @@
89
88
  min-height: 36px;
90
89
 
91
90
  &:focus ~ div.components-input-control__backdrop {
92
- border-color: colors.$primary-500;
93
- box-shadow: inset 0 0 0 1px colors.$primary-500;
91
+ border-color: var(--wp-admin-theme-color);
92
+ box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color);
94
93
  }
95
94
  }
96
95
 
@@ -5,8 +5,7 @@ var _react = _interopRequireWildcard(require("react"));
5
5
  var _react2 = require("@testing-library/react");
6
6
  var _ = _interopRequireDefault(require("./"));
7
7
  var _jsxRuntime = require("react/jsx-runtime");
8
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
8
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
9
  describe('ProgressBar', () => {
11
10
  it('should render a progress indicator', () => {
12
11
  const {
@@ -2,7 +2,6 @@
2
2
  * Progress Bar
3
3
  */
4
4
 
5
- @use "../../../shared/scss/colors";
6
5
  @use "~@wordpress/base-styles/colors" as wp-colors;
7
6
 
8
7
  .newspack-progress-bar {
@@ -35,7 +34,7 @@
35
34
  }
36
35
 
37
36
  &__bar {
38
- background-color: colors.$primary-500;
37
+ background-color: var(--wp-admin-theme-color);
39
38
  height: 8px;
40
39
  transition: width 125ms ease-in-out;
41
40
  }
@@ -5,8 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var ReactRouterDOM = _interopRequireWildcard(require("react-router-dom"));
8
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
8
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
9
  /**
11
10
  * A proxy for react-router-dom.
12
11
  * Ensures that both components and the plugin use the same instance of
@@ -2,7 +2,6 @@
2
2
  * Radio Control
3
3
  */
4
4
 
5
- @use "../../../shared/scss/colors";
6
5
  @use "~@wordpress/base-styles/colors" as wp-colors;
7
6
 
8
7
  .newspack-radio-control {
@@ -24,7 +23,6 @@
24
23
  }
25
24
 
26
25
  // Options
27
-
28
26
  .components-radio-control__option {
29
27
  align-items: center;
30
28
  display: flex;
@@ -40,7 +38,6 @@
40
38
  }
41
39
 
42
40
  // Radio
43
-
44
41
  input[type="radio"] {
45
42
  height: 24px;
46
43
  width: 24px;
@@ -55,8 +52,8 @@
55
52
  }
56
53
 
57
54
  &:checked {
58
- background-color: colors.$primary-500;
59
- border-color: colors.$primary-500;
55
+ background-color: var(--wp-admin-theme-color);
56
+ border-color: var(--wp-admin-theme-color);
60
57
 
61
58
  &::before {
62
59
  border: none;
@@ -64,20 +61,18 @@
64
61
  }
65
62
 
66
63
  &:focus {
67
- border-color: colors.$primary-500;
68
- box-shadow: 0 0 0 2px white, 0 0 0 3.5px colors.$primary-500;
64
+ border-color: var(--wp-admin-theme-color);
65
+ box-shadow: 0 0 0 2px white, 0 0 0 3.5px var(--wp-admin-theme-color);
69
66
  }
70
67
  }
71
68
 
72
69
  // Multiple Radio Controls
73
-
74
70
  & + & {
75
71
  margin-bottom: 32px;
76
72
  margin-top: -16px;
77
73
  }
78
74
 
79
75
  // Multiple Controls
80
-
81
76
  + .newspack-select-control,
82
77
  + .newspack-text-control {
83
78
  margin-bottom: 32px;
@@ -85,7 +80,6 @@
85
80
  }
86
81
 
87
82
  // Reset
88
-
89
83
  .components-base-control__field,
90
84
  .components-base-control__label,
91
85
  .components-base-control__help {
@@ -26,7 +26,25 @@ var _jsxRuntime = require("react/jsx-runtime");
26
26
  * External dependencies
27
27
  */
28
28
 
29
- const SectionHeader = ({
29
+ /**
30
+ * Represents a section header component.
31
+ *
32
+ * @typedef {Object} SectionHeaderProps
33
+ * @property {boolean} [centered=false] - Indicates if the header is centered.
34
+ * @property {?string} [className=null] - Additional CSS class name.
35
+ * @property {string|Function|*} [description] - Description of the section.
36
+ * @property {number} [heading=2] - HTML heading level, e.g., 1 for h1, 2 for h2, etc.
37
+ * @property {boolean} [isWhite=false] - Indicates if the header should use a white theme.
38
+ * @property {boolean} [noMargin=false] - Indicates if the header should have no margin.
39
+ * @property {string} title - The title of the section.
40
+ * @property {?string} [id=null] - Optional ID for the header element.
41
+ */
42
+
43
+ /**
44
+ * Creates a section header.
45
+ *
46
+ * @param {SectionHeaderProps} props - The properties for the section header.
47
+ */const SectionHeader = ({
30
48
  centered = false,
31
49
  className = null,
32
50
  description = '',
@@ -68,6 +86,8 @@ const SectionHeader = ({
68
86
  children: description
69
87
  }), typeof description === 'function' && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
70
88
  children: description()
89
+ }), description && typeof description !== 'string' && typeof description !== 'function' && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
90
+ children: description
71
91
  })]
72
92
  })
73
93
  });
@@ -26,6 +26,7 @@ const ButtonGroupControl = ({
26
26
  buttonOptions,
27
27
  buttonSmall,
28
28
  className,
29
+ help,
29
30
  hideLabelFromVision,
30
31
  label,
31
32
  onChange,
@@ -34,6 +35,7 @@ const ButtonGroupControl = ({
34
35
  const id = _.hooks.useUniqueId('button-group');
35
36
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.BaseControl, {
36
37
  label: label,
38
+ help: help,
37
39
  hideLabelFromVision: hideLabelFromVision,
38
40
  id: id.current,
39
41
  className: (0, _classnames.default)(className, 'components-select-control'),
@@ -19,8 +19,8 @@ var _jsxRuntime = require("react/jsx-runtime");
19
19
  const SettingsCard = ({
20
20
  children,
21
21
  className,
22
- columns,
23
- gutter,
22
+ columns = 3,
23
+ gutter = 32,
24
24
  noBorder,
25
25
  rowGap,
26
26
  ...props
@@ -39,8 +39,4 @@ const SettingsCard = ({
39
39
  })
40
40
  });
41
41
  };
42
- SettingsCard.defaultProps = {
43
- columns: 3,
44
- gutter: 32
45
- };
46
42
  var _default = exports.default = SettingsCard;
@@ -49,9 +49,9 @@ function SortableNewsletterListControl({
49
49
  }
50
50
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_actionCard.default, {
51
51
  title: list.name,
52
- description: () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
53
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
54
- type: "checkbox",
52
+ description: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
53
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CheckboxControl, {
54
+ label: (0, _i18n.__)('Checked by default', 'newspack-plugin'),
55
55
  checked: selectedList.checked,
56
56
  onChange: () => {
57
57
  const index = selected.findIndex(({
@@ -61,16 +61,18 @@ function SortableNewsletterListControl({
61
61
  newSelected[index].checked = !newSelected[index].checked;
62
62
  onChange(newSelected);
63
63
  }
64
- }), (0, _i18n.__)('Checked by default', 'newspack-plugin')]
64
+ })
65
65
  }),
66
66
  isSmall: true,
67
+ hasWhiteHeader: true,
67
68
  actionText: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
68
69
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
69
70
  onClick: () => onChange(selected.filter(({
70
71
  id
71
72
  }) => id !== selectedList.id)),
72
73
  label: (0, _i18n.__)('Remove', 'newspack-plugin'),
73
- icon: _icons.trash
74
+ icon: _icons.trash,
75
+ isDestructive: true
74
76
  })
75
77
  }),
76
78
  children: selected.length > 1 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {