newspack-components 2.0.3 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. package/copy-styles.js +1 -1
  2. package/dist/cjs/action-card/index.js +29 -20
  3. package/dist/cjs/action-card/style.scss +52 -27
  4. package/dist/cjs/autocomplete-tokenfield/style.scss +4 -4
  5. package/dist/cjs/autocomplete-with-suggestions/index.js +3 -2
  6. package/dist/cjs/autocomplete-with-suggestions/style.scss +19 -20
  7. package/dist/cjs/button/index.js +2 -13
  8. package/dist/cjs/button/style.scss +3 -344
  9. package/dist/cjs/button-card/index.js +11 -6
  10. package/dist/cjs/button-card/style.scss +60 -30
  11. package/dist/cjs/card/index.js +3 -1
  12. package/dist/cjs/card/style.scss +29 -62
  13. package/dist/cjs/category-autocomplete/index.js +52 -13
  14. package/dist/cjs/category-autocomplete/style.scss +20 -22
  15. package/dist/cjs/color-picker/index.js +17 -35
  16. package/dist/cjs/color-picker/style.scss +20 -160
  17. package/dist/cjs/custom-select-control/style.scss +12 -42
  18. package/dist/cjs/footer/index.js +21 -7
  19. package/dist/cjs/footer/style.scss +9 -10
  20. package/dist/cjs/form-token-field/index.js +2 -2
  21. package/dist/cjs/form-token-field/style.scss +8 -103
  22. package/dist/cjs/global-notices/index.js +2 -1
  23. package/dist/cjs/grid/style.scss +14 -1
  24. package/dist/cjs/handoff/index.js +7 -7
  25. package/dist/cjs/image-upload/index.js +1 -1
  26. package/dist/cjs/image-upload/style.scss +10 -11
  27. package/dist/cjs/index.js +7 -53
  28. package/dist/cjs/modal/index.js +0 -3
  29. package/dist/cjs/modal/style.scss +19 -131
  30. package/dist/cjs/newspack-icon/index.js +4 -2
  31. package/dist/cjs/newspack-icon/style.scss +15 -0
  32. package/dist/cjs/notice/index.js +8 -9
  33. package/dist/cjs/notice/style.scss +38 -10
  34. package/dist/cjs/plugin-installer/index.js +1 -1
  35. package/dist/cjs/plugin-settings/SettingsSection.js +74 -43
  36. package/dist/cjs/plugin-settings/index.js +34 -30
  37. package/dist/cjs/plugin-settings/style.scss +7 -0
  38. package/dist/cjs/plugin-toggle/index.js +22 -1
  39. package/dist/cjs/popover/style.scss +2 -2
  40. package/dist/cjs/radio-control/style.scss +1 -2
  41. package/dist/cjs/section-header/index.js +18 -5
  42. package/dist/cjs/section-header/style.scss +22 -1
  43. package/dist/cjs/select-control/ButtonGroupControl.js +8 -8
  44. package/dist/cjs/select-control/GroupedSelectControl.js +33 -30
  45. package/dist/cjs/select-control/index.js +1 -2
  46. package/dist/cjs/select-control/style.scss +46 -87
  47. package/dist/cjs/settings/MinMaxSetting.js +4 -2
  48. package/dist/cjs/settings/SettingsCard.js +6 -1
  49. package/dist/cjs/settings/SettingsSection.js +4 -4
  50. package/dist/cjs/settings/style.scss +32 -4
  51. package/dist/cjs/style-card/index.js +10 -6
  52. package/dist/cjs/style-card/style.scss +12 -8
  53. package/dist/cjs/style.scss +44 -0
  54. package/dist/cjs/tabbed-navigation/index.js +13 -20
  55. package/dist/cjs/tabbed-navigation/style.scss +56 -34
  56. package/dist/cjs/text-control/index.js +0 -3
  57. package/dist/cjs/text-control/style.scss +0 -126
  58. package/dist/cjs/waiting/index.js +9 -25
  59. package/dist/cjs/waiting/style.scss +9 -20
  60. package/dist/cjs/web-preview/index.js +18 -30
  61. package/dist/cjs/web-preview/style.scss +33 -26
  62. package/dist/cjs/with-wizard/index.js +4 -2
  63. package/dist/cjs/with-wizard/style.scss +44 -89
  64. package/dist/cjs/with-wizard-screen/index.js +17 -21
  65. package/dist/cjs/with-wizard-screen/style.scss +74 -121
  66. package/dist/cjs/wizard/components/WizardError.js +86 -0
  67. package/dist/cjs/wizard/index.js +145 -0
  68. package/dist/cjs/wizard/store/index.js +178 -0
  69. package/dist/cjs/wizard/store/utils.js +31 -0
  70. package/dist/esm/action-card/index.js +30 -21
  71. package/dist/esm/action-card/style.scss +52 -27
  72. package/dist/esm/autocomplete-tokenfield/style.scss +4 -4
  73. package/dist/esm/autocomplete-with-suggestions/index.js +3 -2
  74. package/dist/esm/autocomplete-with-suggestions/style.scss +19 -20
  75. package/dist/esm/button/index.js +2 -12
  76. package/dist/esm/button/style.scss +3 -344
  77. package/dist/esm/button-card/index.js +10 -6
  78. package/dist/esm/button-card/style.scss +60 -30
  79. package/dist/esm/card/index.js +3 -1
  80. package/dist/esm/card/style.scss +29 -62
  81. package/dist/esm/category-autocomplete/index.js +54 -14
  82. package/dist/esm/category-autocomplete/style.scss +20 -22
  83. package/dist/esm/color-picker/index.js +15 -34
  84. package/dist/esm/color-picker/style.scss +20 -160
  85. package/dist/esm/custom-select-control/style.scss +12 -42
  86. package/dist/esm/footer/index.js +21 -7
  87. package/dist/esm/footer/style.scss +9 -10
  88. package/dist/esm/form-token-field/index.js +2 -2
  89. package/dist/esm/form-token-field/style.scss +8 -103
  90. package/dist/esm/global-notices/index.js +2 -1
  91. package/dist/esm/grid/style.scss +14 -1
  92. package/dist/esm/handoff/index.js +7 -7
  93. package/dist/esm/image-upload/index.js +1 -1
  94. package/dist/esm/image-upload/style.scss +10 -11
  95. package/dist/esm/index.js +3 -8
  96. package/dist/esm/modal/index.js +0 -3
  97. package/dist/esm/modal/style.scss +19 -131
  98. package/dist/esm/newspack-icon/index.js +4 -2
  99. package/dist/esm/newspack-icon/style.scss +15 -0
  100. package/dist/esm/notice/index.js +8 -3
  101. package/dist/esm/notice/style.scss +38 -10
  102. package/dist/esm/plugin-installer/index.js +2 -1
  103. package/dist/esm/plugin-settings/SettingsSection.js +72 -44
  104. package/dist/esm/plugin-settings/index.js +34 -30
  105. package/dist/esm/plugin-settings/style.scss +7 -0
  106. package/dist/esm/plugin-toggle/index.js +23 -1
  107. package/dist/esm/popover/style.scss +2 -2
  108. package/dist/esm/radio-control/style.scss +1 -2
  109. package/dist/esm/section-header/index.js +17 -5
  110. package/dist/esm/section-header/style.scss +22 -1
  111. package/dist/esm/select-control/ButtonGroupControl.js +8 -8
  112. package/dist/esm/select-control/GroupedSelectControl.js +33 -30
  113. package/dist/esm/select-control/index.js +1 -2
  114. package/dist/esm/select-control/style.scss +46 -87
  115. package/dist/esm/settings/MinMaxSetting.js +3 -2
  116. package/dist/esm/settings/SettingsCard.js +6 -1
  117. package/dist/esm/settings/SettingsSection.js +5 -5
  118. package/dist/esm/settings/style.scss +32 -4
  119. package/dist/esm/style-card/index.js +11 -8
  120. package/dist/esm/style-card/style.scss +12 -8
  121. package/dist/esm/style.scss +44 -0
  122. package/dist/esm/tabbed-navigation/index.js +14 -22
  123. package/dist/esm/tabbed-navigation/style.scss +56 -34
  124. package/dist/esm/text-control/index.js +0 -3
  125. package/dist/esm/text-control/style.scss +0 -126
  126. package/dist/esm/waiting/index.js +9 -22
  127. package/dist/esm/waiting/style.scss +9 -20
  128. package/dist/esm/web-preview/index.js +12 -25
  129. package/dist/esm/web-preview/style.scss +33 -26
  130. package/dist/esm/with-wizard/index.js +4 -2
  131. package/dist/esm/with-wizard/style.scss +44 -89
  132. package/dist/esm/with-wizard-screen/index.js +18 -22
  133. package/dist/esm/with-wizard-screen/style.scss +74 -121
  134. package/dist/esm/wizard/components/WizardError.js +78 -0
  135. package/dist/esm/wizard/index.js +128 -0
  136. package/dist/esm/wizard/store/index.js +161 -0
  137. package/dist/esm/wizard/store/utils.js +17 -0
  138. package/package.json +1 -1
  139. package/shared/scss/_colors.scss +15 -0
  140. package/src/action-card/index.js +28 -18
  141. package/src/action-card/style.scss +52 -27
  142. package/src/autocomplete-tokenfield/style.scss +4 -4
  143. package/src/autocomplete-with-suggestions/index.js +4 -2
  144. package/src/autocomplete-with-suggestions/style.scss +19 -20
  145. package/src/button/index.js +2 -9
  146. package/src/button/style.scss +3 -344
  147. package/src/button-card/index.js +19 -5
  148. package/src/button-card/style.scss +60 -30
  149. package/src/card/index.js +4 -0
  150. package/src/card/style.scss +29 -62
  151. package/src/category-autocomplete/index.js +51 -18
  152. package/src/category-autocomplete/style.scss +20 -22
  153. package/src/color-picker/index.js +16 -22
  154. package/src/color-picker/style.scss +20 -160
  155. package/src/custom-select-control/style.scss +12 -42
  156. package/src/footer/index.js +19 -8
  157. package/src/footer/style.scss +9 -10
  158. package/src/form-token-field/index.js +1 -1
  159. package/src/form-token-field/style.scss +8 -103
  160. package/src/global-notices/index.js +1 -1
  161. package/src/grid/style.scss +14 -1
  162. package/src/handoff/index.js +7 -7
  163. package/src/image-upload/style.scss +10 -11
  164. package/src/index.js +3 -7
  165. package/src/modal/index.js +2 -5
  166. package/src/modal/style.scss +19 -131
  167. package/src/newspack-icon/index.js +7 -2
  168. package/src/newspack-icon/style.scss +15 -0
  169. package/src/notice/index.js +7 -1
  170. package/src/notice/style.scss +38 -10
  171. package/src/plugin-installer/index.js +2 -2
  172. package/src/plugin-settings/SettingsSection.js +64 -26
  173. package/src/plugin-settings/index.js +23 -7
  174. package/src/plugin-settings/style.scss +7 -0
  175. package/src/plugin-toggle/index.js +35 -9
  176. package/src/popover/style.scss +2 -2
  177. package/src/radio-control/style.scss +1 -2
  178. package/src/section-header/index.js +25 -6
  179. package/src/section-header/style.scss +22 -1
  180. package/src/select-control/ButtonGroupControl.js +13 -6
  181. package/src/select-control/GroupedSelectControl.js +26 -24
  182. package/src/select-control/index.js +1 -2
  183. package/src/select-control/style.scss +46 -87
  184. package/src/settings/MinMaxSetting.js +2 -1
  185. package/src/settings/SettingsCard.js +9 -7
  186. package/src/settings/SettingsSection.js +4 -4
  187. package/src/settings/style.scss +32 -4
  188. package/src/style-card/index.js +14 -16
  189. package/src/style-card/style.scss +12 -8
  190. package/src/style.scss +44 -0
  191. package/src/tabbed-navigation/index.js +12 -24
  192. package/src/tabbed-navigation/style.scss +56 -34
  193. package/src/text-control/index.js +1 -2
  194. package/src/text-control/style.scss +0 -126
  195. package/src/waiting/index.js +7 -18
  196. package/src/waiting/style.scss +9 -20
  197. package/src/web-preview/index.js +12 -33
  198. package/src/web-preview/style.scss +33 -26
  199. package/src/with-wizard/index.js +7 -5
  200. package/src/with-wizard/style.scss +44 -89
  201. package/src/with-wizard-screen/index.js +14 -17
  202. package/src/with-wizard-screen/style.scss +74 -121
  203. package/src/wizard/components/WizardError.js +57 -0
  204. package/src/wizard/index.js +133 -0
  205. package/src/wizard/store/index.js +126 -0
  206. package/src/wizard/store/utils.js +16 -0
  207. package/dist/cjs/button-group/index.js +0 -57
  208. package/dist/cjs/button-group/style.scss +0 -73
  209. package/dist/cjs/checkbox-control/index.js +0 -63
  210. package/dist/cjs/checkbox-control/style.scss +0 -78
  211. package/dist/cjs/preview-box/index.js +0 -36
  212. package/dist/cjs/preview-box/style.scss +0 -18
  213. package/dist/cjs/textarea-control/index.js +0 -54
  214. package/dist/cjs/textarea-control/style.scss +0 -76
  215. package/dist/cjs/toggle-control/index.js +0 -58
  216. package/dist/cjs/toggle-control/style.scss +0 -74
  217. package/dist/cjs/toggle-group/index.js +0 -71
  218. package/dist/cjs/toggle-group/style.scss +0 -28
  219. package/dist/cjs/wizard-pagination/index.js +0 -71
  220. package/dist/cjs/wizard-pagination/style.scss +0 -74
  221. package/dist/esm/button-group/index.js +0 -43
  222. package/dist/esm/button-group/style.scss +0 -73
  223. package/dist/esm/checkbox-control/index.js +0 -49
  224. package/dist/esm/checkbox-control/style.scss +0 -78
  225. package/dist/esm/preview-box/index.js +0 -30
  226. package/dist/esm/preview-box/style.scss +0 -18
  227. package/dist/esm/textarea-control/index.js +0 -40
  228. package/dist/esm/textarea-control/style.scss +0 -76
  229. package/dist/esm/toggle-control/index.js +0 -44
  230. package/dist/esm/toggle-control/style.scss +0 -74
  231. package/dist/esm/toggle-group/index.js +0 -58
  232. package/dist/esm/toggle-group/style.scss +0 -28
  233. package/dist/esm/wizard-pagination/index.js +0 -57
  234. package/dist/esm/wizard-pagination/style.scss +0 -74
  235. package/src/button-group/index.js +0 -35
  236. package/src/button-group/style.scss +0 -73
  237. package/src/checkbox-control/index.js +0 -38
  238. package/src/checkbox-control/style.scss +0 -78
  239. package/src/preview-box/index.js +0 -18
  240. package/src/preview-box/style.scss +0 -18
  241. package/src/textarea-control/index.js +0 -32
  242. package/src/textarea-control/style.scss +0 -76
  243. package/src/toggle-control/index.js +0 -38
  244. package/src/toggle-control/style.scss +0 -74
  245. package/src/toggle-group/index.js +0 -43
  246. package/src/toggle-group/style.scss +0 -28
  247. package/src/wizard-pagination/index.js +0 -59
  248. package/src/wizard-pagination/style.scss +0 -74
@@ -27,18 +27,24 @@ class PluginSettings extends Component {
27
27
 
28
28
  _defineProperty(this, "fetchSettings", () => {
29
29
  const {
30
- pluginSlug
30
+ afterFetch,
31
+ pluginSlug,
32
+ isWizard
31
33
  } = this.props;
32
34
  this.setState({
33
35
  inFlight: true
34
36
  });
35
37
  apiFetch({
36
- path: `/${pluginSlug}/v1/settings`
38
+ path: isWizard ? `/newspack/v1/wizard/${pluginSlug}/settings` : `/${pluginSlug}/v1/settings`
37
39
  }).then(settings => {
38
40
  this.setState({
39
41
  settings,
40
42
  error: null
41
43
  });
44
+
45
+ if ('function' === typeof afterFetch) {
46
+ afterFetch(settings);
47
+ }
42
48
  }).catch(error => {
43
49
  this.setState({
44
50
  error
@@ -51,12 +57,10 @@ class PluginSettings extends Component {
51
57
  });
52
58
 
53
59
  _defineProperty(this, "getSettingsValues", sectionKey => {
54
- var _this$state$settings$;
55
-
56
- return ((_this$state$settings$ = this.state.settings[sectionKey]) === null || _this$state$settings$ === void 0 ? void 0 : _this$state$settings$.reduce((map, setting) => {
60
+ return this.state.settings[sectionKey]?.reduce((map, setting) => {
57
61
  map[setting.key] = setting.value;
58
62
  return map;
59
- }, {})) || {};
63
+ }, {}) || {};
60
64
  });
61
65
 
62
66
  _defineProperty(this, "handleSettingChange", sectionKey => (key, value) => {
@@ -75,13 +79,15 @@ class PluginSettings extends Component {
75
79
 
76
80
  _defineProperty(this, "handleSectionUpdate", sectionKey => data => {
77
81
  const {
78
- pluginSlug
82
+ afterUpdate,
83
+ pluginSlug,
84
+ isWizard
79
85
  } = this.props;
80
86
  this.setState({
81
87
  inFlight: true
82
88
  });
83
89
  apiFetch({
84
- path: `/${pluginSlug}/v1/settings`,
90
+ path: isWizard ? `/newspack/v1/wizard/${pluginSlug}/settings` : `/${pluginSlug}/v1/settings`,
85
91
  method: 'POST',
86
92
  data: {
87
93
  section: sectionKey,
@@ -92,6 +98,10 @@ class PluginSettings extends Component {
92
98
  settings,
93
99
  error: null
94
100
  });
101
+
102
+ if ('function' === typeof afterUpdate) {
103
+ afterUpdate(settings);
104
+ }
95
105
  }).catch(error => {
96
106
  this.setState({
97
107
  error
@@ -104,30 +114,22 @@ class PluginSettings extends Component {
104
114
  });
105
115
 
106
116
  _defineProperty(this, "getSectionInfo", sectionKey => {
107
- var _this$state$settings$2;
108
-
109
- return (_this$state$settings$2 = this.state.settings[sectionKey]) === null || _this$state$settings$2 === void 0 ? void 0 : _this$state$settings$2.find(setting => !setting.key || setting.key === 'active');
117
+ return this.state.settings[sectionKey]?.find(setting => !setting.key || setting.key === 'active');
110
118
  });
111
119
 
112
120
  _defineProperty(this, "getSectionTitle", sectionKey => {
113
- var _this$getSectionInfo;
114
-
115
- return (_this$getSectionInfo = this.getSectionInfo(sectionKey)) === null || _this$getSectionInfo === void 0 ? void 0 : _this$getSectionInfo.description;
121
+ return this.getSectionInfo(sectionKey)?.description;
116
122
  });
117
123
 
118
124
  _defineProperty(this, "getSectionDescription", sectionKey => {
119
- var _this$getSectionInfo2;
120
-
121
- return (_this$getSectionInfo2 = this.getSectionInfo(sectionKey)) === null || _this$getSectionInfo2 === void 0 ? void 0 : _this$getSectionInfo2.help;
125
+ return this.getSectionInfo(sectionKey)?.help;
122
126
  });
123
127
 
124
128
  _defineProperty(this, "isSectionActive", sectionKey => {
125
- var _settings$sectionKey;
126
-
127
129
  const {
128
130
  settings
129
131
  } = this.state;
130
- const activation = (_settings$sectionKey = settings[sectionKey]) === null || _settings$sectionKey === void 0 ? void 0 : _settings$sectionKey.find(setting => setting.key === 'active');
132
+ const activation = settings[sectionKey]?.find(setting => setting.key === 'active');
131
133
 
132
134
  if (!activation) {
133
135
  return null;
@@ -137,9 +139,7 @@ class PluginSettings extends Component {
137
139
  });
138
140
 
139
141
  _defineProperty(this, "getSectionFields", sectionKey => {
140
- var _this$state$settings$3;
141
-
142
- return (_this$state$settings$3 = this.state.settings[sectionKey]) === null || _this$state$settings$3 === void 0 ? void 0 : _this$state$settings$3.filter(setting => setting.key && setting.key !== 'active');
142
+ return this.state.settings[sectionKey]?.filter(setting => setting.key && setting.key !== 'active');
143
143
  });
144
144
 
145
145
  this.state = {
@@ -159,7 +159,9 @@ class PluginSettings extends Component {
159
159
  render() {
160
160
  const {
161
161
  title,
162
- description
162
+ description,
163
+ hasGreyHeader,
164
+ children
163
165
  } = this.props;
164
166
  const {
165
167
  settings,
@@ -167,25 +169,27 @@ class PluginSettings extends Component {
167
169
  error
168
170
  } = this.state;
169
171
  return _jsxs(Fragment, {
170
- children: [_jsx(SectionHeader, {
172
+ children: [title && _jsx(SectionHeader, {
171
173
  title: title,
172
174
  description: description
173
175
  }), error && _jsx(Notice, {
174
176
  isError: true,
175
177
  noticeText: error.message
176
- }), _jsx("div", {
177
- className: classnames({
178
+ }), _jsxs("div", {
179
+ className: classnames('newspack-plugin-settings', {
178
180
  'newspack-wizard-section__is-loading': inFlight && !Object.keys(settings).length
179
181
  }),
180
- children: Object.keys(settings).map(sectionKey => _jsx(SettingsSection, {
182
+ children: [Object.keys(settings).map(sectionKey => _jsx(SettingsSection, {
181
183
  disabled: inFlight,
184
+ sectionKey: sectionKey,
182
185
  title: this.getSectionTitle(sectionKey),
183
186
  description: this.getSectionDescription(sectionKey),
184
187
  active: this.isSectionActive(sectionKey),
185
188
  fields: this.getSectionFields(sectionKey),
186
189
  onChange: this.handleSettingChange(sectionKey),
187
- onUpdate: this.handleSectionUpdate(sectionKey)
188
- }, sectionKey))
190
+ onUpdate: this.handleSectionUpdate(sectionKey),
191
+ hasGreyHeader: hasGreyHeader
192
+ }, sectionKey)), children]
189
193
  })]
190
194
  });
191
195
  }
@@ -0,0 +1,7 @@
1
+ .newspack-card:not( .newspack-settings__no-border ) {
2
+ .newspack-action-card__region-children {
3
+ > .newspack-grid {
4
+ margin: 32px 0 0 !important;
5
+ }
6
+ }
7
+ }
@@ -75,6 +75,14 @@ class PluginToggle extends Component {
75
75
  }
76
76
  };
77
77
  }, () => shouldRefreshAfterUpdate && location.reload());
78
+ }).catch(e => {
79
+ this.setState({
80
+ pluginInfo: { ...pluginInfo,
81
+ [plugin]: { ...pluginInfo[plugin],
82
+ error: e.message || __('There was an error managing this plugin.', 'newspack')
83
+ }
84
+ }
85
+ });
78
86
  });
79
87
  });
80
88
  });
@@ -141,6 +149,16 @@ class PluginToggle extends Component {
141
149
  }
142
150
  });
143
151
 
152
+ _defineProperty(this, "errorForPlugin", plugin => {
153
+ const {
154
+ slug
155
+ } = plugin;
156
+ const {
157
+ pluginInfo
158
+ } = this.state;
159
+ return pluginInfo[slug]?.error || null;
160
+ });
161
+
144
162
  _defineProperty(this, "isPluginInstalledAndActive", plugin => {
145
163
  const {
146
164
  status
@@ -169,6 +187,7 @@ class PluginToggle extends Component {
169
187
  } = plugin;
170
188
  const pluginStatus = this.isPluginInstalledAndActive(plugin);
171
189
  const handoff = !href && pluginStatus && editPath ? slug : null;
190
+ const error = this.errorForPlugin(plugin);
172
191
  return _jsx(ActionCard, {
173
192
  className: this.classNameForPlugin(plugin),
174
193
  title: name,
@@ -178,7 +197,10 @@ class PluginToggle extends Component {
178
197
  href: href,
179
198
  toggle: true,
180
199
  toggleChecked: this.isPluginInstalledAndActive(plugin),
181
- toggleOnChange: value => this.managePlugin(slug, value)
200
+ toggleOnChange: value => this.managePlugin(slug, value),
201
+ notification: error,
202
+ notificationHTML: error,
203
+ notificationLevel: "error"
182
204
  }, index);
183
205
  });
184
206
  }
@@ -8,7 +8,7 @@
8
8
  .newspack-popover {
9
9
  .components-popover__content {
10
10
  border: 1px solid $gray-300;
11
- border-radius: 3px;
11
+ border-radius: 2px;
12
12
  box-shadow: 0 4px 8px rgba( black, 0.08 );
13
13
  min-width: 238px;
14
14
 
@@ -31,7 +31,7 @@
31
31
  }
32
32
 
33
33
  &.is-link {
34
- border-radius: 3px;
34
+ border-radius: 2px;
35
35
  padding: 6px 8px;
36
36
  text-decoration: none;
37
37
 
@@ -76,8 +76,7 @@
76
76
  // Multiple Controls
77
77
 
78
78
  + .newspack-select-control,
79
- + .newspack-text-control,
80
- + .newspack-textarea-control {
79
+ + .newspack-text-control {
81
80
  margin-bottom: 32px;
82
81
  margin-top: -16px;
83
82
  }
@@ -5,6 +5,7 @@
5
5
  /**
6
6
  * Internal dependencies
7
7
  */
8
+ import { Grid } from '..';
8
9
  import './style.scss';
9
10
  /**
10
11
  * External dependencies
@@ -16,22 +17,33 @@ import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
16
17
 
17
18
  const SectionHeader = _ref => {
18
19
  let {
20
+ centered,
19
21
  className,
20
22
  description,
23
+ heading,
24
+ isWhite,
21
25
  noMargin,
22
26
  title
23
27
  } = _ref;
24
- const classes = classnames('newspack-section-header', noMargin && 'newspack-section-header--no-margin', className);
25
- return _jsxs("div", {
28
+ 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
+ const HeadingTag = `h${heading}`;
30
+ return _jsxs(Grid, {
31
+ columns: 1,
32
+ gutter: 8,
26
33
  className: classes,
27
- children: [_jsx("h2", {
34
+ children: [typeof title === 'string' && _jsx(HeadingTag, {
28
35
  children: title
29
- }), typeof description === 'string' && _jsx("span", {
36
+ }), typeof title === 'function' && _jsx(HeadingTag, {
37
+ children: title()
38
+ }), typeof description === 'string' && _jsx("p", {
30
39
  children: description
31
- }), typeof description === 'function' && _jsx("span", {
40
+ }), typeof description === 'function' && _jsx("p", {
32
41
  children: description()
33
42
  })]
34
43
  });
35
44
  };
36
45
 
46
+ SectionHeader.defaultProps = {
47
+ heading: 2
48
+ };
37
49
  export default SectionHeader;
@@ -2,18 +2,39 @@
2
2
  * Section Header
3
3
  */
4
4
 
5
+ @import '~@wordpress/base-styles/colors';
6
+
5
7
  .newspack-section-header {
6
8
  margin: 64px 0 32px;
7
9
 
8
10
  &--no-margin,
9
- h2 {
11
+ h1,
12
+ h2,
13
+ h3,
14
+ h4,
15
+ h5,
16
+ h6 {
10
17
  margin: 0 !important;
11
18
  }
12
19
 
20
+ &--is-centered {
21
+ text-align: center;
22
+ }
23
+
13
24
  &:not( #{&}--no-margin ) + *:not( #{&} ) {
14
25
  margin-top: -16px !important;
15
26
  }
16
27
 
28
+ &#{&}--is-white {
29
+ > * {
30
+ color: white;
31
+ }
32
+ }
33
+
34
+ p {
35
+ color: $gray-700;
36
+ }
37
+
17
38
  .newspack-wizard__content &:first-child {
18
39
  margin-top: 32px;
19
40
  }
@@ -7,29 +7,30 @@ import classnames from 'classnames';
7
7
  */
8
8
 
9
9
  import { Icon } from '@wordpress/icons';
10
- import { BaseControl } from '@wordpress/components';
10
+ import { BaseControl, Button, ButtonGroup } from '@wordpress/components';
11
11
  /**
12
12
  * Internal dependencies
13
13
  */
14
14
 
15
- import { Button, ButtonGroup, hooks } from '..';
15
+ import { hooks } from '..';
16
16
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
17
17
 
18
18
  const ButtonGroupControl = _ref => {
19
19
  let {
20
20
  buttonOptions,
21
- onChange,
22
- value,
21
+ className,
22
+ hideLabelFromVision,
23
23
  label,
24
- className
24
+ onChange,
25
+ value
25
26
  } = _ref;
26
27
  const id = hooks.useUniqueId('button-group');
27
28
  return _jsx(BaseControl, {
28
29
  label: label,
30
+ hideLabelFromVision: hideLabelFromVision,
29
31
  id: id.current,
30
32
  className: classnames(className, 'components-select-control'),
31
33
  children: _jsx(ButtonGroup, {
32
- noMargin: true,
33
34
  children: buttonOptions.map(option => {
34
35
  const isSelected = value === option.value;
35
36
 
@@ -43,8 +44,7 @@ const ButtonGroupControl = _ref => {
43
44
  }
44
45
 
45
46
  return _jsx(Button, {
46
- isSecondary: !isSelected,
47
- isPressed: isSelected,
47
+ variant: isSelected ? 'primary' : null,
48
48
  onClick: () => onChange(option.value),
49
49
  children: _jsx(Label, {})
50
50
  }, option.value);
@@ -42,41 +42,44 @@ export default function GroupedSelectControl(_ref) {
42
42
  };
43
43
 
44
44
  const id = hooks.useUniqueId('group-select');
45
- return _jsxs(BaseControl, {
45
+ return _jsx(BaseControl, {
46
46
  label: label,
47
47
  hideLabelFromVision: hideLabelFromVision,
48
48
  id: id,
49
49
  help: help,
50
50
  className: classnames(className, 'components-select-control'),
51
- children: [_jsxs("select", {
52
- id: id,
53
- className: "components-select-control__input",
54
- onChange: onChangeValue,
55
- "aria-describedby": !!help ? `${id}__help` : undefined,
56
- ...props,
57
- children: [_jsx("option", {
58
- value: "",
59
- children: __('-- Select --', 'newspack')
60
- }), optgroups.map((_ref2, optgroupIndex) => {
61
- let {
62
- label: optgroupLabel,
63
- options
64
- } = _ref2;
65
- return _jsx("optgroup", {
66
- label: optgroupLabel,
67
- children: options.map((option, optionIndex) => _jsx("option", {
68
- value: option.value,
69
- disabled: option.disabled,
70
- children: option.label
71
- }, `${option.label}-${option.value}-${optionIndex}`))
72
- }, optgroupIndex);
51
+ children: _jsxs("div", {
52
+ className: "relative",
53
+ children: [_jsxs("select", {
54
+ id: id,
55
+ className: "components-select-control__input",
56
+ onChange: onChangeValue,
57
+ "aria-describedby": !!help ? `${id}__help` : undefined,
58
+ ...props,
59
+ children: [_jsx("option", {
60
+ value: "",
61
+ children: __('-- Select --', 'newspack')
62
+ }), optgroups.map((_ref2, optgroupIndex) => {
63
+ let {
64
+ label: optgroupLabel,
65
+ options
66
+ } = _ref2;
67
+ return _jsx("optgroup", {
68
+ label: optgroupLabel,
69
+ children: options.map((option, optionIndex) => _jsx("option", {
70
+ value: option.value,
71
+ disabled: option.disabled,
72
+ children: option.label
73
+ }, `${option.label}-${option.value}-${optionIndex}`))
74
+ }, optgroupIndex);
75
+ })]
76
+ }), _jsx("div", {
77
+ className: "components-select-control__arrow-wrapper",
78
+ children: _jsx(Icon, {
79
+ icon: chevronDown,
80
+ size: 18
81
+ })
73
82
  })]
74
- }), _jsx("div", {
75
- className: "components-select-control__arrow-wrapper",
76
- children: _jsx(Icon, {
77
- icon: chevronDown,
78
- size: 18
79
- })
80
- })]
83
+ })
81
84
  });
82
85
  }
@@ -30,10 +30,9 @@ class SelectControl extends Component {
30
30
  className,
31
31
  optgroups,
32
32
  buttonOptions,
33
- isSmall,
34
33
  ...otherProps
35
34
  } = this.props;
36
- const classes = classNames('newspack-select-control', optgroups && 'newspack-grouped-select-control', buttonOptions && 'newspack-buttons-select-control', isSmall && 'newspack-select-control--small', className);
35
+ const classes = classNames('newspack-select-control', optgroups && 'newspack-grouped-select-control', buttonOptions && 'newspack-buttons-select-control', className);
37
36
  return _jsx("div", {
38
37
  className: classes,
39
38
  children: optgroups ? _jsx(GroupedSelectControl, {
@@ -2,92 +2,39 @@
2
2
  * Select Control
3
3
  */
4
4
 
5
- @import '../../../shared/scss/colors';
6
5
  @import '~@wordpress/base-styles/colors';
7
6
 
8
- .newspack-select-control {
9
- color: $gray-700;
10
- font-size: 14px;
11
- line-height: 24px;
12
- margin: 32px 0;
7
+ .components-select-control {
8
+ &__input {
9
+ max-width: 100% !important;
13
10
 
14
- .components-base-control__field {
15
- margin: 0;
16
- }
17
- .components-input-control__label,
18
- .components-base-control__label {
19
- color: $gray-900 !important;
20
- display: flex;
21
- font-size: 14px;
22
- font-weight: bold;
23
- line-height: 24px;
24
- padding-bottom: 0 !important;
25
- margin-bottom: 0;
26
- }
27
-
28
- .components-select-control {
29
- border-radius: 3px;
30
- font-size: 14px;
31
- line-height: 24px;
32
-
33
- div.components-input-control__backdrop {
34
- border-color: $gray-300;
35
- }
36
-
37
- select.components-select-control__input {
38
- color: $gray-700;
39
- border-color: $gray-300;
40
- font-size: 16px;
41
- height: 48px;
42
- line-height: 24px;
43
- max-width: 100%;
44
- min-height: 48px;
11
+ &[multiple] {
12
+ height: auto !important;
13
+ min-height: 70px !important;
14
+ padding: 0 !important;
45
15
 
46
- @media screen and ( min-width: 600px ) {
47
- font-size: 16px;
16
+ + .components-input-control__suffix {
17
+ display: none;
48
18
  }
49
19
 
50
- @media screen and ( min-width: 768px ) {
51
- font-size: 14px;
52
- }
20
+ option {
21
+ min-height: 1.4em;
22
+ padding: 8px;
53
23
 
54
- &:focus ~ div.components-input-control__backdrop {
55
- border-color: $primary-500;
56
- box-shadow: inset 0 0 0 2px $primary-500;
24
+ &:checked {
25
+ background: var( --wp-admin-theme-color );
26
+ color: white;
27
+ }
57
28
  }
58
29
  }
59
30
  }
60
31
 
61
- // Help
62
-
63
- .components-base-control__help {
64
- margin-top: 0;
65
- font-style: italic;
66
- }
67
-
68
- // Small
69
-
70
- &--small {
71
- .components-select-control select.components-select-control__input {
72
- height: 36px;
73
- min-height: 36px;
74
- }
75
- }
76
-
77
- // Multiple Select Controls
78
-
79
- & + & {
80
- margin-bottom: 32px;
81
- margin-top: -16px;
32
+ .components-base-control__field {
33
+ width: 100%;
82
34
  }
83
35
 
84
- // Multiple Controls
85
-
86
- + .newspack-category-autocomplete,
87
- + .newspack-text-control,
88
- + .newspack-textarea-control {
89
- margin-bottom: 32px;
90
- margin-top: -16px;
36
+ .components-input-control__label {
37
+ line-height: inherit;
91
38
  }
92
39
  }
93
40
 
@@ -100,29 +47,38 @@
100
47
  &__input {
101
48
  appearance: none;
102
49
  background: transparent;
103
- border-radius: 3px;
50
+ border: 1px solid $gray-700;
51
+ border-radius: 2px;
104
52
  box-shadow: none !important;
105
53
  box-sizing: border-box;
106
54
  display: block;
55
+ font-size: inherit;
107
56
  margin: 0;
57
+ max-width: 100%;
108
58
  outline: none;
109
59
  padding: 0 24px 0 7px;
110
60
  width: 100%;
111
61
 
62
+ &:hover {
63
+ color: inherit;
64
+ }
65
+
112
66
  &:focus {
113
- border-color: $primary-500 !important;
114
- box-shadow: inset 0 0 0 2px $primary-500 !important;
67
+ border-color: var( --wp-admin-theme-color-darker-10 ) !important;
68
+ box-shadow: inset 0 0 0 1px var( --wp-admin-theme-color-darker-10 ) !important;
69
+ color: inherit;
115
70
  }
116
71
  }
117
72
 
118
73
  &__arrow-wrapper {
119
74
  align-items: center;
120
- bottom: 0;
121
75
  display: flex;
122
- height: 48px;
76
+ height: 24px;
123
77
  justify-content: center;
78
+ margin-top: -12px;
124
79
  position: absolute;
125
80
  right: 1px;
81
+ top: 50%;
126
82
  width: 24px;
127
83
  }
128
84
  }
@@ -131,19 +87,22 @@
131
87
  // Buttons
132
88
 
133
89
  .newspack-buttons-select-control {
134
- &.icon-only {
135
- .newspack-button-group {
136
- display: flex;
137
- }
90
+ .components-base-control__label {
91
+ display: inline-flex;
92
+ margin-bottom: 8px;
93
+ }
138
94
 
139
- .newspack-button {
95
+ .components-button-group {
96
+ display: flex;
97
+ }
98
+
99
+ &.icon-only {
100
+ .components-button {
140
101
  align-items: center;
141
- display: flex;
142
- font-size: 17px;
143
- height: 48px;
102
+ height: 36px;
144
103
  justify-content: center;
145
104
  padding: 0 !important;
146
- width: 48px;
105
+ width: 36px;
147
106
  }
148
107
  }
149
108
  }
@@ -2,12 +2,13 @@
2
2
  * WordPress dependencies.
3
3
  */
4
4
  import { __ as alias__ } from '@wordpress/i18n';
5
+ const __ = alias__;
6
+ import { CheckboxControl } from '@wordpress/components';
5
7
  /**
6
8
  * Internal dependencies.
7
9
  */
8
10
 
9
- const __ = alias__;
10
- import { CheckboxControl, TextControl } from '../';
11
+ import { TextControl } from '../';
11
12
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
13
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
13
14
  import { Fragment as _Fragment } from "@emotion/react/jsx-runtime";