newspack-components 4.7.0 → 4.8.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 (251) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/DEVELOPMENT.md +42 -21
  3. package/dist/cjs/_mixins.scss +13 -0
  4. package/dist/cjs/_variables.scss +12 -0
  5. package/dist/cjs/action-card/index.js +18 -10
  6. package/dist/cjs/action-card/index.test.js +91 -0
  7. package/dist/cjs/action-card/style.scss +2 -40
  8. package/dist/cjs/button/index.js +8 -3
  9. package/dist/cjs/button/index.test.js +61 -5
  10. package/dist/cjs/card/core-card.js +0 -2
  11. package/dist/cjs/card/style-core.scss +7 -5
  12. package/dist/cjs/card-feature/index.js +75 -61
  13. package/dist/cjs/card-feature/index.test.js +396 -54
  14. package/dist/cjs/card-feature/style.scss +20 -31
  15. package/dist/cjs/card-form/index.js +5 -5
  16. package/dist/cjs/card-sortable-list/index.js +5 -3
  17. package/dist/cjs/card-sortable-list/index.test.js +50 -0
  18. package/dist/cjs/collapsible-group/context.js +19 -0
  19. package/dist/cjs/collapsible-group/index.js +24 -0
  20. package/dist/cjs/collapsible-group/index.test.js +215 -0
  21. package/dist/cjs/collapsible-group/item.js +61 -0
  22. package/dist/cjs/collapsible-group/root.js +62 -0
  23. package/dist/cjs/collapsible-group/style.scss +47 -0
  24. package/dist/cjs/collapsible-group/types.js +5 -0
  25. package/dist/cjs/empty-state/actions.js +45 -0
  26. package/dist/cjs/empty-state/context.js +41 -0
  27. package/dist/cjs/empty-state/header.js +66 -0
  28. package/dist/cjs/empty-state/index.js +31 -0
  29. package/dist/cjs/empty-state/index.test.js +303 -0
  30. package/dist/cjs/empty-state/root.js +56 -0
  31. package/dist/cjs/empty-state/style.scss +51 -0
  32. package/dist/cjs/empty-state/types.js +5 -0
  33. package/dist/cjs/index.js +34 -20
  34. package/dist/cjs/info-button/index.js +59 -43
  35. package/dist/cjs/info-button/index.test.js +199 -0
  36. package/dist/cjs/info-button/style.scss +41 -9
  37. package/dist/cjs/modal/style.scss +12 -12
  38. package/dist/cjs/newspack-icon/style.scss +4 -4
  39. package/dist/cjs/notice/style.scss +3 -3
  40. package/dist/cjs/page/style.scss +16 -16
  41. package/dist/cjs/plugin-installer/index.js +5 -9
  42. package/dist/cjs/plugin-installer/style.scss +3 -14
  43. package/dist/cjs/section-header/index.js +31 -18
  44. package/dist/cjs/section-header/index.test.js +40 -0
  45. package/dist/cjs/section-header/style.scss +22 -6
  46. package/dist/cjs/settings/DateRangeSetting.js +309 -0
  47. package/dist/cjs/settings/SettingsSection.js +19 -5
  48. package/dist/cjs/settings/SettingsSection.test.js +49 -0
  49. package/dist/cjs/settings/index.js +3 -1
  50. package/dist/cjs/settings/style.scss +40 -7
  51. package/dist/cjs/stat-card/body.js +41 -0
  52. package/dist/cjs/stat-card/constants.js +11 -0
  53. package/dist/cjs/stat-card/context.js +54 -0
  54. package/dist/cjs/stat-card/delta.js +91 -0
  55. package/dist/cjs/stat-card/footer.js +72 -0
  56. package/dist/cjs/stat-card/index.js +47 -0
  57. package/dist/cjs/stat-card/index.test.js +938 -0
  58. package/dist/cjs/stat-card/label.js +66 -0
  59. package/dist/cjs/stat-card/root.js +69 -0
  60. package/dist/cjs/stat-card/secondary.js +38 -0
  61. package/dist/cjs/stat-card/style.scss +89 -0
  62. package/dist/cjs/stat-card/types.js +5 -0
  63. package/dist/cjs/stat-card/value.js +78 -0
  64. package/dist/cjs/status-indicator/index.js +66 -0
  65. package/dist/cjs/status-indicator/index.test.js +101 -0
  66. package/dist/cjs/status-indicator/statuses.js +39 -0
  67. package/dist/cjs/status-indicator/style.scss +9 -0
  68. package/dist/cjs/status-indicator/types.js +5 -0
  69. package/dist/cjs/style.scss +9 -9
  70. package/dist/cjs/tabbed-navigation/style.scss +6 -4
  71. package/dist/cjs/types.js +5 -0
  72. package/dist/cjs/web-preview/style.scss +11 -11
  73. package/dist/cjs/with-wizard/style.scss +10 -10
  74. package/dist/cjs/with-wizard-screen/style.scss +9 -9
  75. package/dist/cjs/wizard/index.js +33 -4
  76. package/dist/cjs/wizard/store/index.js +23 -1
  77. package/dist/esm/_mixins.scss +13 -0
  78. package/dist/esm/_variables.scss +12 -0
  79. package/dist/esm/action-card/index.js +18 -10
  80. package/dist/esm/action-card/index.test.js +89 -0
  81. package/dist/esm/action-card/style.scss +2 -40
  82. package/dist/esm/button/index.js +9 -4
  83. package/dist/esm/button/index.test.js +63 -5
  84. package/dist/esm/card/core-card.js +0 -2
  85. package/dist/esm/card/style-core.scss +7 -5
  86. package/dist/esm/card-feature/index.js +78 -62
  87. package/dist/esm/card-feature/index.test.js +397 -55
  88. package/dist/esm/card-feature/style.scss +20 -31
  89. package/dist/esm/card-form/index.js +5 -5
  90. package/dist/esm/card-sortable-list/index.js +6 -4
  91. package/dist/esm/card-sortable-list/index.test.js +46 -0
  92. package/dist/esm/collapsible-group/context.js +13 -0
  93. package/dist/esm/collapsible-group/index.js +17 -0
  94. package/dist/esm/collapsible-group/index.test.js +215 -0
  95. package/dist/esm/collapsible-group/item.js +53 -0
  96. package/dist/esm/collapsible-group/root.js +54 -0
  97. package/dist/esm/collapsible-group/style.scss +47 -0
  98. package/dist/esm/collapsible-group/types.js +1 -0
  99. package/dist/esm/empty-state/actions.js +37 -0
  100. package/dist/esm/empty-state/context.js +35 -0
  101. package/dist/esm/empty-state/header.js +58 -0
  102. package/dist/esm/empty-state/index.js +23 -0
  103. package/dist/esm/empty-state/index.test.js +299 -0
  104. package/dist/esm/empty-state/root.js +56 -0
  105. package/dist/esm/empty-state/style.scss +51 -0
  106. package/dist/esm/empty-state/types.js +1 -0
  107. package/dist/esm/index.js +4 -2
  108. package/dist/esm/info-button/index.js +54 -43
  109. package/dist/esm/info-button/index.test.js +195 -0
  110. package/dist/esm/info-button/style.scss +41 -9
  111. package/dist/esm/modal/style.scss +12 -12
  112. package/dist/esm/newspack-icon/style.scss +4 -4
  113. package/dist/esm/notice/style.scss +3 -3
  114. package/dist/esm/page/style.scss +16 -16
  115. package/dist/esm/plugin-installer/index.js +5 -9
  116. package/dist/esm/plugin-installer/style.scss +3 -14
  117. package/dist/esm/section-header/index.js +27 -14
  118. package/dist/esm/section-header/index.test.js +36 -0
  119. package/dist/esm/section-header/style.scss +22 -6
  120. package/dist/esm/settings/DateRangeSetting.js +304 -0
  121. package/dist/esm/settings/SettingsSection.js +16 -3
  122. package/dist/esm/settings/SettingsSection.test.js +45 -0
  123. package/dist/esm/settings/index.js +3 -1
  124. package/dist/esm/settings/style.scss +40 -7
  125. package/dist/esm/stat-card/body.js +36 -0
  126. package/dist/esm/stat-card/constants.js +5 -0
  127. package/dist/esm/stat-card/context.js +48 -0
  128. package/dist/esm/stat-card/delta.js +86 -0
  129. package/dist/esm/stat-card/footer.js +67 -0
  130. package/dist/esm/stat-card/index.js +33 -0
  131. package/dist/esm/stat-card/index.test.js +939 -0
  132. package/dist/esm/stat-card/label.js +61 -0
  133. package/dist/esm/stat-card/root.js +64 -0
  134. package/dist/esm/stat-card/secondary.js +33 -0
  135. package/dist/esm/stat-card/style.scss +89 -0
  136. package/dist/esm/stat-card/types.js +1 -0
  137. package/dist/esm/stat-card/value.js +73 -0
  138. package/dist/esm/status-indicator/index.js +52 -0
  139. package/dist/esm/status-indicator/index.test.js +96 -0
  140. package/dist/esm/status-indicator/statuses.js +33 -0
  141. package/dist/esm/status-indicator/style.scss +9 -0
  142. package/dist/esm/status-indicator/types.js +1 -0
  143. package/dist/esm/style.scss +9 -9
  144. package/dist/esm/tabbed-navigation/style.scss +6 -4
  145. package/dist/esm/types.js +1 -0
  146. package/dist/esm/web-preview/style.scss +11 -11
  147. package/dist/esm/with-wizard/style.scss +10 -10
  148. package/dist/esm/with-wizard-screen/style.scss +9 -9
  149. package/dist/esm/wizard/index.js +38 -7
  150. package/dist/esm/wizard/store/index.js +23 -1
  151. package/package.json +1 -1
  152. package/src/_mixins.scss +13 -0
  153. package/src/_variables.scss +12 -0
  154. package/src/action-card/action-card.d.ts +3 -2
  155. package/src/action-card/index.js +12 -12
  156. package/src/action-card/index.test.js +56 -0
  157. package/src/action-card/style.scss +2 -40
  158. package/src/button/index.test.js +52 -5
  159. package/src/button/index.tsx +9 -4
  160. package/src/card/core-card.js +0 -2
  161. package/src/card/style-core.scss +7 -5
  162. package/src/card-feature/README.md +68 -27
  163. package/src/card-feature/index.test.js +242 -27
  164. package/src/card-feature/index.tsx +77 -67
  165. package/src/card-feature/style.scss +20 -31
  166. package/src/card-form/README.md +10 -10
  167. package/src/card-form/index.tsx +4 -8
  168. package/src/card-sortable-list/README.md +4 -5
  169. package/src/card-sortable-list/index.test.js +29 -0
  170. package/src/card-sortable-list/index.tsx +7 -4
  171. package/src/collapsible-group/README.md +50 -0
  172. package/src/collapsible-group/context.ts +13 -0
  173. package/src/collapsible-group/index.test.js +168 -0
  174. package/src/collapsible-group/index.tsx +17 -0
  175. package/src/collapsible-group/item.tsx +42 -0
  176. package/src/collapsible-group/root.tsx +42 -0
  177. package/src/collapsible-group/style.scss +47 -0
  178. package/src/collapsible-group/types.ts +22 -0
  179. package/src/drawer/README.md +2 -2
  180. package/src/empty-state/README.md +165 -0
  181. package/src/empty-state/actions.tsx +37 -0
  182. package/src/empty-state/context.ts +40 -0
  183. package/src/empty-state/header.tsx +48 -0
  184. package/src/empty-state/index.test.js +247 -0
  185. package/src/empty-state/index.tsx +22 -0
  186. package/src/empty-state/root.tsx +39 -0
  187. package/src/empty-state/style.scss +51 -0
  188. package/src/empty-state/types.ts +33 -0
  189. package/src/index.js +4 -2
  190. package/src/info-button/README.md +115 -0
  191. package/src/info-button/index.test.js +163 -0
  192. package/src/info-button/index.tsx +64 -0
  193. package/src/info-button/style.scss +41 -9
  194. package/src/modal/style.scss +12 -12
  195. package/src/newspack-icon/style.scss +4 -4
  196. package/src/notice/style.scss +3 -3
  197. package/src/page/style.scss +16 -16
  198. package/src/plugin-installer/index.js +3 -9
  199. package/src/plugin-installer/style.scss +3 -14
  200. package/src/section-header/index.js +27 -14
  201. package/src/section-header/index.test.js +28 -0
  202. package/src/section-header/style.scss +22 -6
  203. package/src/settings/DateRangeSetting.js +266 -0
  204. package/src/settings/SettingsSection.js +24 -4
  205. package/src/settings/SettingsSection.test.js +45 -0
  206. package/src/settings/index.js +2 -0
  207. package/src/settings/style.scss +40 -7
  208. package/src/stat-card/README.md +434 -0
  209. package/src/stat-card/body.tsx +28 -0
  210. package/src/stat-card/constants.ts +5 -0
  211. package/src/stat-card/context.ts +53 -0
  212. package/src/stat-card/delta.tsx +88 -0
  213. package/src/stat-card/footer.tsx +68 -0
  214. package/src/stat-card/index.test.js +818 -0
  215. package/src/stat-card/index.tsx +48 -0
  216. package/src/stat-card/label.tsx +61 -0
  217. package/src/stat-card/root.tsx +40 -0
  218. package/src/stat-card/secondary.tsx +27 -0
  219. package/src/stat-card/style.scss +89 -0
  220. package/src/stat-card/types.ts +84 -0
  221. package/src/stat-card/value.tsx +72 -0
  222. package/src/status-indicator/README.md +123 -0
  223. package/src/status-indicator/index.test.js +70 -0
  224. package/src/status-indicator/index.tsx +39 -0
  225. package/src/status-indicator/statuses.ts +35 -0
  226. package/src/status-indicator/style.scss +9 -0
  227. package/src/status-indicator/types.ts +28 -0
  228. package/src/style.scss +9 -9
  229. package/src/tabbed-navigation/style.scss +6 -4
  230. package/src/types.ts +25 -0
  231. package/src/web-preview/style.scss +11 -11
  232. package/src/with-wizard/style.scss +10 -10
  233. package/src/with-wizard-screen/style.scss +9 -9
  234. package/src/wizard/index.js +49 -7
  235. package/src/wizard/store/index.js +26 -1
  236. package/dist/cjs/accordion/index.js +0 -72
  237. package/dist/cjs/accordion/index.test.js +0 -80
  238. package/dist/cjs/accordion/style.scss +0 -35
  239. package/dist/cjs/badge/index.js +0 -32
  240. package/dist/cjs/badge/style.scss +0 -36
  241. package/dist/esm/accordion/index.js +0 -63
  242. package/dist/esm/accordion/index.test.js +0 -79
  243. package/dist/esm/accordion/style.scss +0 -35
  244. package/dist/esm/badge/index.js +0 -24
  245. package/dist/esm/badge/style.scss +0 -36
  246. package/src/accordion/index.js +0 -46
  247. package/src/accordion/index.test.js +0 -62
  248. package/src/accordion/style.scss +0 -35
  249. package/src/badge/index.tsx +0 -26
  250. package/src/badge/style.scss +0 -36
  251. package/src/info-button/index.js +0 -38
@@ -14,7 +14,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
14
14
  var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
15
15
  var _element = require("@wordpress/element");
16
16
  var _i18n = require("@wordpress/i18n");
17
- var _icons = require("@wordpress/icons");
17
+ var _ui = require("@wordpress/ui");
18
18
  var _ = require("../");
19
19
  require("./style.scss");
20
20
  var _classnames = _interopRequireDefault(require("classnames"));
@@ -256,14 +256,10 @@ var PluginInstaller = /*#__PURE__*/function (_Component) {
256
256
  })]
257
257
  });
258
258
  } else if (Status === 'active') {
259
- actionText = /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
260
- className: "newspack-plugin-installer__status",
261
- children: [(0, _i18n.__)('Installed', 'newspack-plugin'), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
262
- className: "newspack-checkbox-icon newspack-checkbox-icon--checked",
263
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
264
- icon: _icons.check
265
- })
266
- })]
259
+ // Installed is a state, not an action, so the slot takes a badge.
260
+ actionText = /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Badge, {
261
+ intent: "stable",
262
+ children: (0, _i18n.__)('Installed', 'newspack-plugin')
267
263
  });
268
264
  }
269
265
  var classes = (0, _classnames["default"])('newspack-action-card__plugin-installer', _this2.classForInstallationStatus(installationStatus));
@@ -2,8 +2,6 @@
2
2
  * Plugin Installer
3
3
  */
4
4
 
5
- @use "~@wordpress/base-styles/colors" as wp-colors;
6
-
7
5
  .newspack-card {
8
6
  .newspack-plugin-installer__status {
9
7
  align-items: center;
@@ -35,25 +33,16 @@
35
33
  }
36
34
 
37
35
  &.newspack-plugin-installer__status-active {
38
- box-shadow: inset 4px 0 0 wp-colors.$alert-green;
39
-
40
- .newspack-plugin-installer__checkbox {
41
- background: wp-colors.$alert-green;
42
- box-shadow: none;
43
- }
44
-
45
- svg {
46
- fill: white;
47
- }
36
+ box-shadow: inset 4px 0 0 var( --wpds-color-stroke-surface-success-strong, #008030 );
48
37
  }
49
38
 
50
39
  &.newspack-plugin-installer__status-error {
51
- box-shadow: inset 4px 0 0 wp-colors.$alert-red;
40
+ box-shadow: inset 4px 0 0 var( --wpds-color-stroke-surface-error-strong, #cc1818 );
52
41
  }
53
42
 
54
43
  &.newspack-plugin-installer__status-installing,
55
44
  &.newspack-plugin-installer__status-none {
56
- box-shadow: inset 4px 0 0 wp-colors.$gray-100;
45
+ box-shadow: inset 4px 0 0 var( --wpds-color-stroke-surface-neutral-weak, #f0f0f0 );
57
46
  }
58
47
 
59
48
  // Is Small
@@ -9,7 +9,9 @@ var _i18n = require("@wordpress/i18n");
9
9
  var _element = require("@wordpress/element");
10
10
  var _components = require("@wordpress/components");
11
11
  var _icons = require("@wordpress/icons");
12
- var _ = require("..");
12
+ var _ui = require("@wordpress/ui");
13
+ var _button = _interopRequireDefault(require("../button"));
14
+ var _grid = _interopRequireDefault(require("../grid"));
13
15
  require("./style.scss");
14
16
  var _classnames = _interopRequireDefault(require("classnames"));
15
17
  var _jsxRuntime = require("react/jsx-runtime");
@@ -36,17 +38,19 @@ var _jsxRuntime = require("react/jsx-runtime");
36
38
  *
37
39
  * @typedef {Object} SectionHeaderProps
38
40
  * @property {string} [backNav=''] - URL to navigate back to.
39
- * @property {string|string[]} [badge] - Badge to display in the header.
40
- * @property {string} [badgeLevel] - Badge level, e.g., 'success', 'info', 'warning', 'error'.
41
+ * @property {Object[]} [badges] - Badges to display beside the title, each `{ label, intent }`.
41
42
  * @property {boolean} [centered=false] - Indicates if the header is centered.
42
- * @property {?string} [className=null] - Additional CSS class name.
43
+ * @property {?string} [className=null] - Additional CSS class name, applied to the outer container.
43
44
  * @property {string|Function|*} [description] - Description of the section.
44
45
  * @property {number} [heading=2] - HTML heading level, e.g., 1 for h1, 2 for h2, etc.
45
46
  * @property {string|Function|*} [icon] - Icon to display in the header.
46
47
  * @property {boolean} [isWhite=false] - Indicates if the header should use a white theme.
48
+ * @property {Object[]} [menu] - Overflow menu items.
47
49
  * @property {boolean} [noMargin=false] - Indicates if the header should have no margin.
48
50
  * @property {boolean} [pageHeader=false] - Indicates if the header is used as a page header.
49
- * @property {string} [size='default'] - Size variant, either 'default' or 'small'. Scales the title, and the icon with it, independently of `pageHeader`.
51
+ * @property {Object} [primaryAction] - Primary button, `{ label, href, action }`.
52
+ * @property {Object} [secondaryAction] - Secondary link, `{ label, href, action }`.
53
+ * @property {string} [size='default'] - Size variant: 'small', 'default', or 'hidden' to drop the title and description while the back nav stays visible.
50
54
  * @property {string} title - The title of the section.
51
55
  * @property {?string} [id=null] - Optional ID for the header element.
52
56
  * @property {?string|Function|*} [children=null] - Optional children to display in the header.
@@ -104,28 +108,34 @@ var _jsxRuntime = require("react/jsx-runtime");
104
108
  }, 250);
105
109
  }
106
110
  }, []);
107
- var classes = (0, _classnames["default"])('newspack-section-header', centered && 'newspack-section-header--is-centered', isWhite && 'newspack-section-header--is-white', noMargin && 'newspack-section-header--no-margin', pageHeader && 'newspack-section-header--page-header', size === 'small' && 'newspack-section-header--small');
111
+ var classes = (0, _classnames["default"])('newspack-section-header', centered && 'newspack-section-header--is-centered', isWhite && 'newspack-section-header--is-white', noMargin && 'newspack-section-header--no-margin', pageHeader && 'newspack-section-header--page-header', size === 'small' && 'newspack-section-header--small', size === 'hidden' && 'newspack-section-header--hidden');
108
112
 
109
113
  // The breadcrumb `Page` owns the single page `<h1>`, so a `pageHeader` section
110
114
  // is a secondary heading: its level follows `heading` (default 2). `pageHeader`
111
115
  // controls only the enlarged, centered styling — not the tag. Pass `heading={ 1 }`
112
116
  // on a headerless screen that needs the section header to be the page's h1.
113
117
  var HeadingTag = "h".concat(heading);
118
+ // `hidden` drops the title rather than announcing a level no reader can see.
119
+ var hiddenText = size === 'hidden' ? 'newspack-section-header__hidden-text' : undefined;
114
120
  var titleContent = null;
121
+ var renderBadge = function renderBadge(badge, i) {
122
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Badge, {
123
+ className: "newspack-section-header__badge",
124
+ intent: badge.intent || 'none',
125
+ children: badge.label
126
+ }, i);
127
+ };
115
128
  if (typeof title === 'string') {
116
129
  titleContent = /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
117
130
  className: "newspack-section-header__title-container",
118
131
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(HeadingTag, {
119
- className: "newspack-section-header__title",
120
- children: [title, badges !== null && badges !== void 0 && badges.length ? badges.map(function (badge, i) {
121
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Badge, {
122
- text: badge.label,
123
- level: badge.level || 'default'
124
- }, i);
125
- }) : null]
132
+ className: (0, _classnames["default"])('newspack-section-header__title', hiddenText),
133
+ children: [title, (badges || []).filter(function (badge) {
134
+ return badge === null || badge === void 0 ? void 0 : badge.label;
135
+ }).map(renderBadge)]
126
136
  }), secondaryAction && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
127
137
  className: "newspack-section-header__secondary-action",
128
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
138
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_button["default"], {
129
139
  variant: "link",
130
140
  href: secondaryAction.href,
131
141
  onClick: secondaryAction.action,
@@ -151,7 +161,7 @@ var _jsxRuntime = require("react/jsx-runtime");
151
161
  });
152
162
  } else if (typeof title === 'function') {
153
163
  titleContent = /*#__PURE__*/(0, _jsxRuntime.jsx)(HeadingTag, {
154
- className: "newspack-section-header__title",
164
+ className: (0, _classnames["default"])('newspack-section-header__title', hiddenText),
155
165
  children: title()
156
166
  });
157
167
  }
@@ -159,7 +169,7 @@ var _jsxRuntime = require("react/jsx-runtime");
159
169
  id: id,
160
170
  className: (0, _classnames["default"])('newspack-section-header__container', backNav && 'newspack-section-header--has-back-nav', primaryAction && 'newspack-section-header--has-primary-action', className),
161
171
  ref: ref,
162
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Grid, {
172
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_grid["default"], {
163
173
  columns: 1,
164
174
  gutter: 8,
165
175
  className: classes,
@@ -178,7 +188,7 @@ var _jsxRuntime = require("react/jsx-runtime");
178
188
  className: "newspack-section-header__back-nav",
179
189
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Tooltip, {
180
190
  text: (0, _i18n.__)('Go back', 'newspack-plugin'),
181
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
191
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_button["default"], {
182
192
  href: backNav,
183
193
  icon: _icons.chevronLeft,
184
194
  variant: "tertiary"
@@ -186,10 +196,13 @@ var _jsxRuntime = require("react/jsx-runtime");
186
196
  })
187
197
  }), titleContent]
188
198
  }) : titleContent, description && typeof description === 'string' && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
199
+ className: hiddenText,
189
200
  children: description
190
201
  }), typeof description === 'function' && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
202
+ className: hiddenText,
191
203
  children: description()
192
204
  }), description && typeof description !== 'string' && typeof description !== 'function' && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
205
+ className: hiddenText,
193
206
  children: description
194
207
  }), children && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
195
208
  className: "newspack-section-header__children",
@@ -197,7 +210,7 @@ var _jsxRuntime = require("react/jsx-runtime");
197
210
  })]
198
211
  }), primaryAction && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
199
212
  className: "newspack-section-header__primary-action",
200
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
213
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_button["default"], {
201
214
  href: primaryAction.href,
202
215
  variant: "primary",
203
216
  onClick: primaryAction.action,
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _icons = require("@wordpress/icons");
5
+ var _react = require("@testing-library/react");
6
+ var _ = _interopRequireDefault(require("."));
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ /**
9
+ * WordPress dependencies
10
+ */
11
+
12
+ /**
13
+ * External dependencies
14
+ */
15
+
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+
20
+ describe('SectionHeader size', function () {
21
+ it('renders a 48px icon and no small modifier by default', function () {
22
+ var _render = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
23
+ title: "Get started",
24
+ icon: _icons.envelope
25
+ })),
26
+ container = _render.container;
27
+ expect(container.querySelector('.newspack-section-header--small')).not.toBeInTheDocument();
28
+ expect(container.querySelector('.newspack-section-header__icon svg')).toHaveAttribute('width', '48');
29
+ });
30
+ it('renders a 24px icon and the small modifier at size="small"', function () {
31
+ var _render2 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
32
+ title: "Get started",
33
+ icon: _icons.envelope,
34
+ size: "small"
35
+ })),
36
+ container = _render2.container;
37
+ expect(container.querySelector('.newspack-section-header--small')).toBeInTheDocument();
38
+ expect(container.querySelector('.newspack-section-header__icon svg')).toHaveAttribute('width', '24');
39
+ });
40
+ });
@@ -2,10 +2,10 @@
2
2
  * Section Header
3
3
  */
4
4
 
5
+ @use "~@wordpress/base-styles/breakpoints" as wp-breakpoints;
5
6
  @use "~@wordpress/base-styles/colors" as wp-colors;
6
7
  @use "~@wordpress/base-styles/variables" as wp-vars;
7
8
  @use "~@wordpress/base-styles/mixins" as wp-mixins;
8
- @use "../../../colors/colors.module" as colors;
9
9
 
10
10
  .newspack-section-header {
11
11
  flex: 1;
@@ -22,6 +22,9 @@
22
22
  &:has(> .newspack-section-header--no-margin) {
23
23
  margin-top: 0;
24
24
  }
25
+ &:has(> .newspack-section-header--hidden) {
26
+ margin-block: 0;
27
+ }
25
28
  &.newspack-section-header--has-primary-action {
26
29
  display: flex;
27
30
  flex-direction: column;
@@ -32,7 +35,7 @@
32
35
  }
33
36
  }
34
37
  &.newspack-section-header--has-back-nav {
35
- @media (min-width: 782px) {
38
+ @include wp-mixins.break-wide {
36
39
  .newspack-section-header__title-container,
37
40
  p {
38
41
  max-width: calc(50% - 16px);
@@ -42,7 +45,10 @@
42
45
  }
43
46
 
44
47
  &__back-nav {
45
- @media (min-width: 1280px) {
48
+ @media (max-width: #{wp-breakpoints.$break-wide - 1px}) {
49
+ display: none;
50
+ }
51
+ @include wp-mixins.break-wide {
46
52
  left: 0;
47
53
  position: absolute;
48
54
  top: 50%;
@@ -101,6 +107,18 @@
101
107
  }
102
108
  }
103
109
 
110
+ &#{&}--hidden {
111
+ .newspack-section-header__hidden-text {
112
+ display: none;
113
+ }
114
+
115
+ .newspack-section-header__back-nav {
116
+ @include wp-mixins.break-wide {
117
+ transform: translate(calc(-100% - 8px), calc(-50% + 12px));
118
+ }
119
+ }
120
+ }
121
+
104
122
  &__icon {
105
123
  background-color: var(--wp-admin-theme-color-lighter-10);
106
124
  border-radius: 100%;
@@ -125,9 +143,7 @@
125
143
  display: flex;
126
144
  gap: 8px;
127
145
 
128
- .newspack-section-header__menu,
129
- .newspack-section-header__secondary-action,
130
- .newspack-badge {
146
+ .newspack-section-header__secondary-action {
131
147
  margin-top: 8px;
132
148
  }
133
149
  }
@@ -0,0 +1,309 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
+ var _element = require("@wordpress/element");
13
+ var _i18n = require("@wordpress/i18n");
14
+ var _ = require("../");
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
+ var _excluded = ["start", "end", "onChange", "label"];
17
+ /**
18
+ * WordPress dependencies.
19
+ */
20
+ /**
21
+ * Internal dependencies.
22
+ */
23
+ /**
24
+ * A bound is stored as { type: 'absolute', date } or { type: 'relative', days },
25
+ * where days is negative for the past and positive for the future. The UI splits
26
+ * the relative case in two so a publisher never has to type a minus sign.
27
+ */
28
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
29
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
30
+ var BOUND_TYPES = [{
31
+ label: (0, _i18n.__)('Any', 'newspack-plugin'),
32
+ value: ''
33
+ }, {
34
+ label: (0, _i18n.__)('Date', 'newspack-plugin'),
35
+ value: 'absolute'
36
+ }, {
37
+ label: (0, _i18n.__)('Days ago', 'newspack-plugin'),
38
+ value: 'past'
39
+ }, {
40
+ label: (0, _i18n.__)('Days from now', 'newspack-plugin'),
41
+ value: 'future'
42
+ }];
43
+
44
+ // Upper magnitude for a relative bound: ~273 years, far inside Date's range,
45
+ // and it keeps the resolved year four digits so the matcher's lexicographic
46
+ // compare stays valid. Import and REST bypass this input, so the matcher still
47
+ // fails closed on larger offsets — this just turns a wild typo into
48
+ // browser-level validation instead of a segment that matches nobody.
49
+ var MAX_RELATIVE_DAYS = 100000;
50
+
51
+ // Today as YYYY-MM-DD in local time. toISOString() converts to UTC and would give
52
+ // the wrong day for anyone west of Greenwich.
53
+ var today = function today() {
54
+ var date = new Date();
55
+ var month = String(date.getMonth() + 1).padStart(2, '0');
56
+ var day = String(date.getDate()).padStart(2, '0');
57
+ return "".concat(date.getFullYear(), "-").concat(month, "-").concat(day);
58
+ };
59
+
60
+ // Zero days is the same day either way, and normalizes to "Days ago".
61
+ var boundTypeOf = function boundTypeOf(bound) {
62
+ if (!bound || !bound.type) {
63
+ return '';
64
+ }
65
+ if ('absolute' === bound.type) {
66
+ return 'absolute';
67
+ }
68
+ return bound.days > 0 ? 'future' : 'past';
69
+ };
70
+ var boundValueOf = function boundValueOf(bound) {
71
+ if (!bound) {
72
+ return '';
73
+ }
74
+ return 'absolute' === bound.type ? bound.date || '' : String(Math.abs(bound.days || 0));
75
+ };
76
+
77
+ // `seed` is set only when the publisher picks a bound type, so a newly chosen
78
+ // bound starts on a usable value instead of being half-filled. It must stay off
79
+ // for edits to the value itself: a date input reports '' both when cleared and
80
+ // transiently while its value is being retyped, and substituting today() there
81
+ // would silently move a saved window out from under the publisher.
82
+ var makeBound = function makeBound(type, rawValue) {
83
+ var seed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
84
+ if ('absolute' === type) {
85
+ var date = rawValue || (seed ? today() : '');
86
+ // An absolute bound with no date is not a bound: emitted and saved, it
87
+ // would reach the matcher as a bound it can only reject, silently
88
+ // shrinking the segment to nobody. The row itself stays open — the
89
+ // control falls back to the chosen bound type while the bound is absent.
90
+ return date ? {
91
+ type: 'absolute',
92
+ date: date
93
+ } : undefined;
94
+ }
95
+ // A cleared magnitude mirrors a cleared date: no bound at all, not a
96
+ // zero-day bound — { days: 0 } would quietly move the window's edge to
97
+ // today and snap the emptied input back to '0' mid-retype. An explicit
98
+ // '0' is falsy-but-present, so the check is on emptiness, not truthiness.
99
+ var raw = '' === rawValue && seed ? '0' : rawValue;
100
+ if ('' === raw) {
101
+ return undefined;
102
+ }
103
+ // Number() rather than parseInt(): a number input accepts scientific
104
+ // notation, and parseInt( '1e2' ) reads it as 1 instead of 100.
105
+ var days = Math.abs(Math.trunc(Number(raw)) || 0);
106
+ return {
107
+ type: 'relative',
108
+ days: 'future' === type ? days : -days
109
+ };
110
+ };
111
+ var DateRangeBound = function DateRangeBound(_ref) {
112
+ var label = _ref.label,
113
+ testId = _ref.testId,
114
+ bound = _ref.bound,
115
+ _onChange = _ref.onChange;
116
+ // The bound type is normally derived from the stored value, but a zero-magnitude
117
+ // relative bound (`days: 0`) is the same day whether the publisher chose "ago" or
118
+ // "from now" — the sign can't tell them apart. `chosenType` records the direction
119
+ // to fall back on while the bound stays ambiguous, and starts out `null` — no
120
+ // direction known yet — since the bound this control receives can arrive
121
+ // asynchronously (e.g. an existing segment fetched after first mount).
122
+ var _useState = (0, _element.useState)(null),
123
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
124
+ chosenType = _useState2[0],
125
+ setChosenType = _useState2[1];
126
+ var derivedType = boundTypeOf(bound);
127
+ var isAmbiguous = 'relative' === (bound === null || bound === void 0 ? void 0 : bound.type) && 0 === bound.days;
128
+
129
+ // Keep chosenType in step with any unambiguous bound — freshly chosen by the
130
+ // publisher in this control, or loaded from storage — so the direction survives
131
+ // if the value is later cleared down to an ambiguous zero. A bound of '' (no
132
+ // bound at all, e.g. before an async load resolves) doesn't establish a
133
+ // direction; only a real, unambiguous one does.
134
+ (0, _element.useEffect)(function () {
135
+ if ('' !== derivedType && !isAmbiguous) {
136
+ setChosenType(derivedType);
137
+ }
138
+ }, [derivedType, isAmbiguous]);
139
+
140
+ // Also fall back while there is no bound at all: a cleared date emits no
141
+ // bound (see makeBound), and deriving from the absent value would collapse
142
+ // the row to "Any" mid-edit instead of leaving the empty input for retyping.
143
+ var type = null !== chosenType && (isAmbiguous || !bound) ? chosenType : derivedType;
144
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
145
+ className: "newspack-settings__date-range-bound",
146
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.SelectControl, {
147
+ label: label
148
+ // Without this the select renders at 32px while the sibling input is
149
+ // 40px, so the two boxes in a row don't match.
150
+ ,
151
+ __next40pxDefaultSize: true,
152
+ value: type,
153
+ options: BOUND_TYPES,
154
+ onChange: function onChange(nextType) {
155
+ setChosenType(nextType);
156
+ _onChange(nextType ? makeBound(nextType, '', true) : undefined);
157
+ }
158
+ }), '' !== type && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.TextControl, {
159
+ "data-testid": testId
160
+ // The visible label sits on the sibling select, so without one here
161
+ // the input has no accessible name at all. Composed with the row
162
+ // label so the two bound rows' inputs stay distinguishable — two
163
+ // bare "Days" spin buttons announce identically.
164
+ ,
165
+ label: 'absolute' === type ?
166
+ // translators: %s: the bound row label (From/To).
167
+ (0, _i18n.sprintf)((0, _i18n.__)('%s date', 'newspack-plugin'), label) :
168
+ // translators: %s: the bound row label (From/To).
169
+ (0, _i18n.sprintf)((0, _i18n.__)('%s days', 'newspack-plugin'), label),
170
+ hideLabelFromVision: true,
171
+ type: 'absolute' === type ? 'date' : 'number',
172
+ min: 'absolute' === type ? undefined : 0,
173
+ max: 'absolute' === type ? undefined : MAX_RELATIVE_DAYS,
174
+ value: boundValueOf(bound),
175
+ onChange: function onChange(nextValue) {
176
+ return _onChange(makeBound(type, nextValue));
177
+ }
178
+ })]
179
+ });
180
+ };
181
+
182
+ /**
183
+ * Rolling windows offered as one-click presets. Each is the trailing window
184
+ * ending today, i.e. `start: -N days`, `end: today` — the same shape the custom
185
+ * rows produce, so a preset is a shortcut rather than a separate stored format.
186
+ */
187
+ var PRESET_DAYS = [7, 30, 365];
188
+ var PRESETS = [{
189
+ label: (0, _i18n.__)('Any', 'newspack-plugin'),
190
+ value: ''
191
+ }].concat((0, _toConsumableArray2["default"])(PRESET_DAYS.map(function (days) {
192
+ return {
193
+ label: (0, _i18n.sprintf)((0, _i18n._n)('Last %d day', 'Last %d days', days, 'newspack-plugin'), days),
194
+ value: String(days)
195
+ };
196
+ })), [{
197
+ label: (0, _i18n.__)('Custom', 'newspack-plugin'),
198
+ value: 'custom'
199
+ }]);
200
+
201
+ /**
202
+ * Which preset a stored range corresponds to.
203
+ *
204
+ * @param {*} start The start bound.
205
+ * @param {*} end The end bound.
206
+ * @return {string} A PRESETS value: '' when unbounded, the day count when the
207
+ * range is exactly one of the presets, otherwise 'custom'.
208
+ */
209
+ var presetOf = function presetOf(start, end) {
210
+ if (!start && !end) {
211
+ return '';
212
+ }
213
+ if (start && end && 'relative' === start.type && 'relative' === end.type && 0 === end.days && start.days < 0 && PRESET_DAYS.includes(Math.abs(start.days))) {
214
+ return String(Math.abs(start.days));
215
+ }
216
+ return 'custom';
217
+ };
218
+ var DateRangeSetting = function DateRangeSetting(_ref2) {
219
+ var start = _ref2.start,
220
+ end = _ref2.end,
221
+ onChange = _ref2.onChange,
222
+ label = _ref2.label,
223
+ props = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
224
+ var derivedPreset = presetOf(start, end);
225
+ // A range that matches a preset is indistinguishable from the same range built
226
+ // by hand, and an empty one is indistinguishable from "Custom, nothing filled
227
+ // in yet" — so a deliberate Custom choice has to be remembered rather than
228
+ // re-derived. Starts null: nothing chosen yet, so the stored value decides.
229
+ var _useState3 = (0, _element.useState)(null),
230
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
231
+ chosenPreset = _useState4[0],
232
+ setChosenPreset = _useState4[1];
233
+
234
+ // Custom explains any range, so it is never overridden by what the value looks
235
+ // like. Every other selection stays in step with a range that arrived from
236
+ // storage or changed elsewhere.
237
+ (0, _element.useEffect)(function () {
238
+ setChosenPreset(function (chosen) {
239
+ return 'custom' === chosen ? chosen : derivedPreset;
240
+ });
241
+ }, [derivedPreset]);
242
+ var preset = null === chosenPreset ? derivedPreset : chosenPreset;
243
+
244
+ // Both keys are always emitted: the consumer merges the value into the stored
245
+ // criterion, so omitting one would leave a stale bound behind. An empty range
246
+ // emits nothing at all, which drops the criterion — an empty `{}` would reach
247
+ // the matcher as "no bounds to check" and match every reader with a date.
248
+ var changeRange = function changeRange(nextStart, nextEnd) {
249
+ return onChange(nextStart || nextEnd ? {
250
+ start: nextStart,
251
+ end: nextEnd
252
+ } : undefined);
253
+ };
254
+ var changePreset = function changePreset(next) {
255
+ setChosenPreset(next);
256
+ if ('custom' === next) {
257
+ // Keep the current range so the rows open on what the preset meant.
258
+ return;
259
+ }
260
+ if ('' === next) {
261
+ onChange(undefined);
262
+ return;
263
+ }
264
+ changeRange({
265
+ type: 'relative',
266
+ days: -Number(next)
267
+ }, {
268
+ type: 'relative',
269
+ days: 0
270
+ });
271
+ };
272
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({}, props), {}, {
273
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
274
+ className: "newspack-settings__date-range-preset",
275
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.SelectControl
276
+ // The criterion's own name is the visible heading of the section
277
+ // this renders into, so a visible label here would just repeat it —
278
+ // but the heading is a bare span with no label association, so the
279
+ // consumer-passed name is what keeps several date criteria's preset
280
+ // selectors distinguishable to a screen reader.
281
+ , {
282
+ label: label || (0, _i18n.__)('Date range', 'newspack-plugin'),
283
+ hideLabelFromVision: true,
284
+ __next40pxDefaultSize: true,
285
+ "data-testid": "date-range-preset",
286
+ value: preset,
287
+ options: PRESETS,
288
+ onChange: changePreset
289
+ })
290
+ }), 'custom' === preset && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_element.Fragment, {
291
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(DateRangeBound, {
292
+ label: (0, _i18n.__)('From', 'newspack-plugin'),
293
+ testId: "date-range-start-value",
294
+ bound: start,
295
+ onChange: function onChange(nextStart) {
296
+ return changeRange(nextStart, end);
297
+ }
298
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(DateRangeBound, {
299
+ label: (0, _i18n.__)('To', 'newspack-plugin'),
300
+ testId: "date-range-end-value",
301
+ bound: end,
302
+ onChange: function onChange(nextEnd) {
303
+ return changeRange(start, nextEnd);
304
+ }
305
+ })]
306
+ })]
307
+ }));
308
+ };
309
+ var _default = exports["default"] = DateRangeSetting;
@@ -1,11 +1,19 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports["default"] = void 0;
7
- var _ = require("../");
8
+ var _i18n = require("@wordpress/i18n");
9
+ var _ui = require("@wordpress/ui");
10
+ var _grid = _interopRequireDefault(require("../grid"));
11
+ var _infoButton = _interopRequireDefault(require("../info-button"));
8
12
  var _jsxRuntime = require("react/jsx-runtime");
13
+ /**
14
+ * WordPress dependencies.
15
+ */
16
+
9
17
  /**
10
18
  * Internal dependencies.
11
19
  */
@@ -14,16 +22,22 @@ var SettingSection = function SettingSection(_ref) {
14
22
  var title = _ref.title,
15
23
  description = _ref.description,
16
24
  children = _ref.children;
17
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Grid, {
25
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_grid["default"], {
18
26
  columns: 1,
19
27
  gutter: 8,
20
28
  className: "newspack-settings__section",
21
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
29
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_ui.Stack, {
30
+ direction: "row",
31
+ align: "flex-start",
32
+ gap: "xs",
22
33
  className: "newspack-settings__section__title",
23
34
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
24
35
  children: title
25
- }), description && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.InfoButton, {
26
- text: description
36
+ }), description && /*#__PURE__*/(0, _jsxRuntime.jsx)(_infoButton["default"], {
37
+ description: description,
38
+ triggerLabel: typeof title === 'string' ? (0, _i18n.sprintf)(
39
+ // translators: %s is the name of the setting being explained.
40
+ (0, _i18n.__)('More information about %s', 'newspack-plugin'), title) : (0, _i18n.__)('More information', 'newspack-plugin')
27
41
  })]
28
42
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
29
43
  className: "newspack-settings__section__content",