newspack-components 3.0.0-alpha.1 → 3.0.0-alpha.2

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 (278) hide show
  1. package/babel.config.js +25 -0
  2. package/copy-styles.js +2 -10
  3. package/dist/accordion/index.js +50 -0
  4. package/dist/accordion/style.scss +31 -0
  5. package/dist/{cjs/action-card → action-card}/index.js +38 -41
  6. package/dist/{cjs/action-card → action-card}/style.scss +9 -9
  7. package/dist/{cjs/autocomplete-tokenfield → autocomplete-tokenfield}/index.js +19 -18
  8. package/dist/{esm/autocomplete-tokenfield → autocomplete-tokenfield}/style.scss +3 -3
  9. package/dist/{cjs/autocomplete-with-suggestions → autocomplete-with-suggestions}/index.js +29 -29
  10. package/dist/{cjs/autocomplete-with-suggestions → autocomplete-with-suggestions}/style.scss +8 -8
  11. package/dist/button/index.js +51 -0
  12. package/dist/button/index.tsx +48 -0
  13. package/dist/{cjs/button → button}/style.scss +1 -1
  14. package/dist/{cjs/button-card → button-card}/index.js +8 -8
  15. package/dist/{cjs/button-card → button-card}/style.scss +19 -13
  16. package/dist/{cjs/card → card}/index.js +3 -3
  17. package/dist/{esm/card → card}/style.scss +1 -1
  18. package/dist/{cjs/category-autocomplete → category-autocomplete}/index.js +50 -48
  19. package/dist/{cjs/category-autocomplete → category-autocomplete}/style.scss +2 -2
  20. package/dist/{cjs/color-picker → color-picker}/index.js +7 -7
  21. package/dist/{cjs/color-picker → color-picker}/style.scss +3 -3
  22. package/dist/{cjs/custom-select-control → custom-select-control}/index.js +3 -3
  23. package/dist/{esm/custom-select-control → custom-select-control}/style.scss +11 -10
  24. package/dist/date-range-picker/index.js +39 -0
  25. package/dist/date-range-picker/style.scss +148 -0
  26. package/dist/{cjs/footer → footer}/index.js +19 -17
  27. package/dist/{cjs/footer → footer}/style.scss +1 -1
  28. package/dist/{cjs/form-token-field → form-token-field}/index.js +5 -5
  29. package/dist/{esm/form-token-field → form-token-field}/style.scss +1 -1
  30. package/dist/{cjs/global-notices → global-notices}/index.js +3 -3
  31. package/dist/grid/index.js +44 -0
  32. package/dist/grid/index.tsx +34 -0
  33. package/dist/{esm/grid → grid}/style.scss +9 -9
  34. package/dist/{cjs/handoff → handoff}/index.js +72 -69
  35. package/dist/{cjs/handoff-message → handoff-message}/index.js +5 -3
  36. package/dist/hooks/index.js +29 -0
  37. package/dist/hooks/index.ts +15 -0
  38. package/dist/{cjs/hooks → hooks}/useObjectState.js +1 -1
  39. package/dist/{cjs/hooks → hooks}/useObjectState.test.js +9 -9
  40. package/dist/hooks/usePrompt.js +47 -0
  41. package/dist/hooks/usePrompt.ts +46 -0
  42. package/dist/image-upload/index.js +148 -0
  43. package/dist/{cjs/image-upload → image-upload}/index.test.js +13 -6
  44. package/dist/{cjs/image-upload → image-upload}/style.scss +5 -5
  45. package/dist/{cjs/index.js → index.js} +15 -1
  46. package/dist/{cjs/info-button → info-button}/index.js +5 -5
  47. package/dist/{cjs/modal → modal}/index.js +3 -3
  48. package/dist/{cjs/modal → modal}/style.scss +5 -5
  49. package/dist/{cjs/newspack-icon → newspack-icon}/index.js +4 -4
  50. package/dist/{cjs/newspack-icon → newspack-icon}/style.scss +1 -1
  51. package/dist/{cjs/newspack-logo → newspack-logo}/index.js +4 -4
  52. package/dist/{cjs/newspack-logo → newspack-logo}/style.scss +1 -1
  53. package/dist/{cjs/notice → notice}/index.js +11 -8
  54. package/dist/{cjs/notice → notice}/style.scss +11 -11
  55. package/dist/patrons-logo/index.js +77 -0
  56. package/dist/plugin-installer/index.js +297 -0
  57. package/dist/{esm/plugin-installer → plugin-installer}/style.scss +1 -1
  58. package/dist/{cjs/plugin-settings → plugin-settings}/SettingsSection.js +11 -9
  59. package/dist/plugin-settings/index.js +228 -0
  60. package/dist/{cjs/plugin-settings → plugin-settings}/style.scss +1 -1
  61. package/dist/plugin-toggle/README.md +53 -0
  62. package/dist/plugin-toggle/index.js +222 -0
  63. package/dist/{esm/plugin-toggle → plugin-toggle}/style.scss +1 -1
  64. package/dist/{cjs/popover → popover}/index.js +3 -3
  65. package/dist/{esm/popover → popover}/style.scss +7 -7
  66. package/dist/{cjs/position-control → position-control}/index.js +24 -22
  67. package/dist/{cjs/position-control → position-control}/style.scss +8 -8
  68. package/dist/{cjs/progress-bar → progress-bar}/index.js +8 -8
  69. package/dist/{cjs/progress-bar → progress-bar}/index.test.js +12 -11
  70. package/dist/{esm/progress-bar → progress-bar}/style.scss +2 -2
  71. package/dist/proxied-imports/router.js +15 -0
  72. package/dist/{cjs/radio-control → radio-control}/index.js +3 -3
  73. package/dist/{esm/radio-control → radio-control}/style.scss +3 -3
  74. package/dist/{cjs/section-header → section-header}/index.js +8 -8
  75. package/dist/{cjs/section-header → section-header}/style.scss +1 -1
  76. package/dist/{cjs/select-control → select-control}/ButtonGroupControl.js +7 -7
  77. package/dist/{cjs/select-control → select-control}/GroupedSelectControl.js +15 -14
  78. package/dist/{cjs/select-control → select-control}/index.js +6 -6
  79. package/dist/{esm/select-control → select-control}/style.scss +4 -4
  80. package/dist/{cjs/settings → settings}/MinMaxSetting.js +12 -11
  81. package/dist/{cjs/settings → settings}/SettingsCard.js +4 -4
  82. package/dist/{cjs/settings → settings}/SettingsSection.js +6 -6
  83. package/dist/{cjs/settings → settings}/index.js +1 -1
  84. package/dist/{cjs/settings → settings}/style.scss +1 -1
  85. package/dist/{cjs/sortable-newsletter-list-control → sortable-newsletter-list-control}/index.js +25 -24
  86. package/dist/{cjs/steps-list → steps-list}/index.js +4 -4
  87. package/dist/{esm/steps-list → steps-list}/style.scss +2 -2
  88. package/dist/{cjs/steps-list-item → steps-list-item}/index.js +5 -5
  89. package/dist/{cjs/steps-list-item → steps-list-item}/style.scss +5 -5
  90. package/dist/{cjs/style-card → style-card}/index.js +20 -17
  91. package/dist/{cjs/style-card → style-card}/style.scss +4 -4
  92. package/dist/{esm/style.scss → style.scss} +1 -1
  93. package/dist/{cjs/tabbed-navigation → tabbed-navigation}/index.js +7 -7
  94. package/dist/{cjs/tabbed-navigation → tabbed-navigation}/style.scss +4 -4
  95. package/dist/text-control/index.js +76 -0
  96. package/dist/text-control/index.tsx +71 -0
  97. package/dist/{cjs/utils → utils}/index.js +2 -2
  98. package/dist/{cjs/waiting → waiting}/index.js +3 -3
  99. package/dist/web-preview/index.js +191 -0
  100. package/dist/{esm/web-preview → web-preview}/style.scss +5 -5
  101. package/dist/with-wizard/index.js +328 -0
  102. package/dist/{cjs/with-wizard → with-wizard}/style.scss +44 -22
  103. package/dist/{cjs/with-wizard-screen → with-wizard-screen}/index.js +24 -23
  104. package/dist/{esm/with-wizard-screen → with-wizard-screen}/style.scss +7 -7
  105. package/dist/{cjs/wizard → wizard}/components/WizardError.js +10 -9
  106. package/dist/{cjs/wizard → wizard}/index.js +30 -27
  107. package/dist/{cjs/wizard → wizard}/store/index.js +1 -1
  108. package/package.json +18 -15
  109. package/shared/scss/_mixins.scss +2 -2
  110. package/src/accordion/index.js +35 -0
  111. package/src/accordion/style.scss +31 -0
  112. package/src/action-card/style.scss +9 -9
  113. package/src/autocomplete-tokenfield/style.scss +3 -3
  114. package/src/autocomplete-with-suggestions/index.js +46 -44
  115. package/src/autocomplete-with-suggestions/style.scss +8 -8
  116. package/src/button/style.scss +1 -1
  117. package/src/button-card/style.scss +19 -13
  118. package/src/card/style.scss +1 -1
  119. package/src/category-autocomplete/style.scss +2 -2
  120. package/src/color-picker/style.scss +3 -3
  121. package/src/custom-select-control/style.scss +11 -10
  122. package/src/date-range-picker/index.js +31 -0
  123. package/src/date-range-picker/style.scss +148 -0
  124. package/src/footer/style.scss +1 -1
  125. package/src/form-token-field/style.scss +1 -1
  126. package/src/grid/style.scss +9 -9
  127. package/src/handoff-message/index.js +3 -1
  128. package/src/image-upload/index.js +1 -1
  129. package/src/image-upload/index.test.js +6 -1
  130. package/src/image-upload/style.scss +5 -5
  131. package/src/index.js +2 -0
  132. package/src/modal/style.scss +5 -5
  133. package/src/newspack-icon/style.scss +1 -1
  134. package/src/newspack-logo/style.scss +1 -1
  135. package/src/notice/style.scss +11 -11
  136. package/src/plugin-installer/style.scss +1 -1
  137. package/src/plugin-settings/style.scss +1 -1
  138. package/src/plugin-toggle/index.js +6 -7
  139. package/src/plugin-toggle/style.scss +1 -1
  140. package/src/popover/style.scss +7 -7
  141. package/src/position-control/index.js +62 -63
  142. package/src/position-control/style.scss +8 -8
  143. package/src/progress-bar/style.scss +2 -2
  144. package/src/radio-control/style.scss +3 -3
  145. package/src/section-header/style.scss +1 -1
  146. package/src/select-control/style.scss +4 -4
  147. package/src/settings/style.scss +1 -1
  148. package/src/steps-list/style.scss +2 -2
  149. package/src/steps-list-item/style.scss +5 -5
  150. package/src/style-card/style.scss +4 -4
  151. package/src/style.scss +1 -1
  152. package/src/tabbed-navigation/index.js +1 -1
  153. package/src/tabbed-navigation/style.scss +4 -4
  154. package/src/web-preview/style.scss +5 -5
  155. package/src/with-wizard/style.scss +44 -22
  156. package/src/with-wizard-screen/style.scss +7 -7
  157. package/dist/cjs/autocomplete-tokenfield/style.scss +0 -49
  158. package/dist/cjs/button/index.js +0 -56
  159. package/dist/cjs/card/style.scss +0 -168
  160. package/dist/cjs/custom-select-control/style.scss +0 -92
  161. package/dist/cjs/form-token-field/style.scss +0 -37
  162. package/dist/cjs/grid/index.js +0 -37
  163. package/dist/cjs/grid/style.scss +0 -166
  164. package/dist/cjs/hooks/index.js +0 -25
  165. package/dist/cjs/hooks/usePrompt.js +0 -49
  166. package/dist/cjs/image-upload/index.js +0 -143
  167. package/dist/cjs/patrons-logo/index.js +0 -81
  168. package/dist/cjs/plugin-installer/index.js +0 -295
  169. package/dist/cjs/plugin-installer/style.scss +0 -72
  170. package/dist/cjs/plugin-settings/index.js +0 -221
  171. package/dist/cjs/plugin-toggle/index.js +0 -218
  172. package/dist/cjs/plugin-toggle/style.scss +0 -20
  173. package/dist/cjs/popover/style.scss +0 -161
  174. package/dist/cjs/progress-bar/style.scss +0 -42
  175. package/dist/cjs/proxied-imports/router.js +0 -14
  176. package/dist/cjs/radio-control/style.scss +0 -92
  177. package/dist/cjs/select-control/style.scss +0 -108
  178. package/dist/cjs/steps-list/style.scss +0 -11
  179. package/dist/cjs/style.scss +0 -55
  180. package/dist/cjs/text-control/index.js +0 -61
  181. package/dist/cjs/web-preview/index.js +0 -188
  182. package/dist/cjs/web-preview/style.scss +0 -155
  183. package/dist/cjs/with-wizard/index.js +0 -317
  184. package/dist/cjs/with-wizard-screen/style.scss +0 -160
  185. package/dist/esm/action-card/index.js +0 -221
  186. package/dist/esm/action-card/style.scss +0 -483
  187. package/dist/esm/autocomplete-tokenfield/index.js +0 -260
  188. package/dist/esm/autocomplete-with-suggestions/index.js +0 -276
  189. package/dist/esm/autocomplete-with-suggestions/style.scss +0 -163
  190. package/dist/esm/button/index.js +0 -48
  191. package/dist/esm/button/style.scss +0 -11
  192. package/dist/esm/button-card/index.js +0 -64
  193. package/dist/esm/button-card/style.scss +0 -174
  194. package/dist/esm/card/index.js +0 -43
  195. package/dist/esm/category-autocomplete/index.js +0 -181
  196. package/dist/esm/category-autocomplete/style.scss +0 -34
  197. package/dist/esm/color-picker/index.js +0 -59
  198. package/dist/esm/color-picker/style.scss +0 -37
  199. package/dist/esm/consts.js +0 -1
  200. package/dist/esm/custom-select-control/index.js +0 -37
  201. package/dist/esm/footer/index.js +0 -100
  202. package/dist/esm/footer/style.scss +0 -82
  203. package/dist/esm/form-token-field/index.js +0 -49
  204. package/dist/esm/global-notices/index.js +0 -30
  205. package/dist/esm/grid/index.js +0 -29
  206. package/dist/esm/handoff/index.js +0 -176
  207. package/dist/esm/handoff-message/index.js +0 -45
  208. package/dist/esm/hooks/index.js +0 -17
  209. package/dist/esm/hooks/useObjectState.js +0 -30
  210. package/dist/esm/hooks/useObjectState.test.js +0 -82
  211. package/dist/esm/hooks/useOnClickOutside.js +0 -31
  212. package/dist/esm/hooks/usePrompt.js +0 -40
  213. package/dist/esm/image-upload/index.js +0 -139
  214. package/dist/esm/image-upload/index.test.js +0 -28
  215. package/dist/esm/image-upload/style.scss +0 -103
  216. package/dist/esm/index.js +0 -45
  217. package/dist/esm/info-button/index.js +0 -42
  218. package/dist/esm/info-button/style.scss +0 -18
  219. package/dist/esm/modal/index.js +0 -39
  220. package/dist/esm/modal/style.scss +0 -56
  221. package/dist/esm/newspack-icon/index.js +0 -50
  222. package/dist/esm/newspack-icon/style.scss +0 -26
  223. package/dist/esm/newspack-logo/index.js +0 -46
  224. package/dist/esm/newspack-logo/style.scss +0 -30
  225. package/dist/esm/notice/index.js +0 -66
  226. package/dist/esm/notice/style.scss +0 -111
  227. package/dist/esm/patrons-logo/index.js +0 -75
  228. package/dist/esm/plugin-installer/index.js +0 -290
  229. package/dist/esm/plugin-settings/SettingsSection.js +0 -134
  230. package/dist/esm/plugin-settings/index.js +0 -216
  231. package/dist/esm/plugin-settings/style.scss +0 -7
  232. package/dist/esm/plugin-toggle/index.js +0 -213
  233. package/dist/esm/popover/index.js +0 -41
  234. package/dist/esm/position-control/index.js +0 -107
  235. package/dist/esm/position-control/style.scss +0 -66
  236. package/dist/esm/progress-bar/index.js +0 -68
  237. package/dist/esm/progress-bar/index.test.js +0 -109
  238. package/dist/esm/proxied-imports/router.js +0 -8
  239. package/dist/esm/radio-control/index.js +0 -37
  240. package/dist/esm/section-header/index.js +0 -67
  241. package/dist/esm/section-header/style.scss +0 -45
  242. package/dist/esm/select-control/ButtonGroupControl.js +0 -53
  243. package/dist/esm/select-control/GroupedSelectControl.js +0 -79
  244. package/dist/esm/select-control/index.js +0 -51
  245. package/dist/esm/settings/MinMaxSetting.js +0 -54
  246. package/dist/esm/settings/SettingsCard.js +0 -38
  247. package/dist/esm/settings/SettingsSection.js +0 -26
  248. package/dist/esm/settings/index.js +0 -9
  249. package/dist/esm/settings/style.scss +0 -119
  250. package/dist/esm/sortable-newsletter-list-control/index.js +0 -128
  251. package/dist/esm/sortable-newsletter-list-control/style.scss +0 -45
  252. package/dist/esm/steps-list/index.js +0 -43
  253. package/dist/esm/steps-list-item/index.js +0 -47
  254. package/dist/esm/steps-list-item/style.scss +0 -47
  255. package/dist/esm/style-card/index.js +0 -75
  256. package/dist/esm/style-card/style.scss +0 -94
  257. package/dist/esm/tabbed-navigation/index.js +0 -53
  258. package/dist/esm/tabbed-navigation/style.scss +0 -86
  259. package/dist/esm/text-control/index.js +0 -57
  260. package/dist/esm/text-control/style.scss +0 -32
  261. package/dist/esm/utils/index.js +0 -29
  262. package/dist/esm/waiting/index.js +0 -44
  263. package/dist/esm/waiting/style.scss +0 -27
  264. package/dist/esm/web-preview/index.js +0 -183
  265. package/dist/esm/with-wizard/index.js +0 -311
  266. package/dist/esm/with-wizard/style.scss +0 -260
  267. package/dist/esm/with-wizard-screen/index.js +0 -110
  268. package/dist/esm/wizard/components/WizardError.js +0 -67
  269. package/dist/esm/wizard/index.js +0 -120
  270. package/dist/esm/wizard/store/index.js +0 -155
  271. package/dist/esm/wizard/store/utils.js +0 -14
  272. /package/dist/{cjs/consts.js → consts.js} +0 -0
  273. /package/dist/{cjs/hooks → hooks}/useOnClickOutside.js +0 -0
  274. /package/dist/{cjs/info-button → info-button}/style.scss +0 -0
  275. /package/dist/{cjs/sortable-newsletter-list-control → sortable-newsletter-list-control}/style.scss +0 -0
  276. /package/dist/{cjs/text-control → text-control}/style.scss +0 -0
  277. /package/dist/{cjs/waiting → waiting}/style.scss +0 -0
  278. /package/dist/{cjs/wizard → wizard}/store/utils.js +0 -0
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -16,17 +15,21 @@ var _router = _interopRequireDefault(require("../proxied-imports/router"));
16
15
  var _store = _interopRequireWildcard(require("./store"));
17
16
  var _utils = require("./store/utils");
18
17
  var _WizardError = _interopRequireDefault(require("./components/WizardError"));
19
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
18
+ var _jsxRuntime = require("react/jsx-runtime");
19
+ 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); }
20
+ 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; }
20
21
  /**
21
22
  * External dependencies.
22
23
  */
24
+
23
25
  /**
24
26
  * WordPress dependencies.
25
27
  */
26
- const __ = _i18n.__;
28
+
27
29
  /**
28
30
  * Internal dependencies
29
31
  */
32
+
30
33
  (0, _store.default)();
31
34
  const {
32
35
  HashRouter,
@@ -53,10 +56,10 @@ const Wizard = ({
53
56
  let displayedSections = sections.filter(section => !section.isHidden);
54
57
  const [pluginRequirementsSatisfied, setPluginRequirementsSatisfied] = (0, _element.useState)(requiredPlugins.length === 0);
55
58
  if (!pluginRequirementsSatisfied) {
56
- headerText = requiredPlugins.length > 1 ? __('Required plugins', 'newspack-plugin') : __('Required plugin', 'newspack-plugin');
59
+ headerText = requiredPlugins.length > 1 ? (0, _i18n.__)('Required plugins', 'newspack-plugin') : (0, _i18n.__)('Required plugin', 'newspack-plugin');
57
60
  displayedSections = [{
58
61
  path: '/',
59
- render: () => (0, _jsxRuntime.jsx)(_.PluginInstaller, {
62
+ render: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_.PluginInstaller, {
60
63
  plugins: requiredPlugins,
61
64
  onStatus: ({
62
65
  complete
@@ -64,59 +67,59 @@ const Wizard = ({
64
67
  })
65
68
  }];
66
69
  }
67
- return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
68
- children: [(0, _jsxRuntime.jsx)("div", {
70
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
71
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
69
72
  className: (0, _classnames.default)(isLoading ? 'newspack-wizard__is-loading' : 'newspack-wizard__is-loaded', {
70
73
  'newspack-wizard__is-loading-quiet': isQuietLoading
71
74
  }),
72
- children: (0, _jsxRuntime.jsxs)(HashRouter, {
75
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(HashRouter, {
73
76
  hashType: "slash",
74
- children: [newspack_aux_data.is_debug_mode && (0, _jsxRuntime.jsx)(_.Notice, {
77
+ children: [newspack_aux_data.is_debug_mode && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Notice, {
75
78
  debugMode: true
76
- }), (0, _jsxRuntime.jsx)("div", {
79
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
77
80
  className: "bg-white",
78
- children: (0, _jsxRuntime.jsx)("div", {
81
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
79
82
  className: "newspack-wizard__header__inner",
80
- children: (0, _jsxRuntime.jsxs)("div", {
83
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
81
84
  className: "newspack-wizard__title",
82
- children: [(0, _jsxRuntime.jsx)(_.Button, {
85
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
83
86
  isLink: true,
84
87
  href: newspack_urls.dashboard,
85
- label: __('Return to Dashboard', 'newspack-plugin'),
88
+ label: (0, _i18n.__)('Return to Dashboard', 'newspack-plugin'),
86
89
  showTooltip: true,
87
90
  icon: _icons.category,
88
91
  iconSize: 36,
89
- children: (0, _jsxRuntime.jsx)(_.NewspackIcon, {
92
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.NewspackIcon, {
90
93
  size: 36
91
94
  })
92
- }), (0, _jsxRuntime.jsxs)("div", {
93
- children: [headerText && (0, _jsxRuntime.jsx)("h2", {
95
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
96
+ children: [headerText && /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
94
97
  children: headerText
95
- }), subHeaderText && (0, _jsxRuntime.jsx)("span", {
98
+ }), subHeaderText && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
96
99
  children: subHeaderText
97
100
  })]
98
101
  })]
99
102
  })
100
103
  })
101
- }), displayedSections.length > 1 && (0, _jsxRuntime.jsx)(_.TabbedNavigation, {
104
+ }), displayedSections.length > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.TabbedNavigation, {
102
105
  items: displayedSections,
103
- children: (0, _jsxRuntime.jsx)(_WizardError.default, {})
104
- }), (0, _jsxRuntime.jsx)(_.HandoffMessage, {}), (0, _jsxRuntime.jsxs)(Switch, {
106
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_WizardError.default, {})
107
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.HandoffMessage, {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(Switch, {
105
108
  children: [displayedSections.map((section, index) => {
106
109
  const SectionComponent = section.render;
107
- return (0, _jsxRuntime.jsx)(Route, {
110
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Route, {
108
111
  path: section.path,
109
- children: (0, _jsxRuntime.jsxs)("div", {
112
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
110
113
  className: (0, _classnames.default)('newspack-wizard newspack-wizard__content', className),
111
- children: ['function' === typeof renderAboveSections ? renderAboveSections() : null, (0, _jsxRuntime.jsx)(SectionComponent, {})]
114
+ children: ['function' === typeof renderAboveSections ? renderAboveSections() : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(SectionComponent, {})]
112
115
  })
113
116
  }, index);
114
- }), (0, _jsxRuntime.jsx)(Redirect, {
117
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Redirect, {
115
118
  to: displayedSections[0].path
116
119
  })]
117
120
  })]
118
121
  })
119
- }), !isLoading && (0, _jsxRuntime.jsx)(_.Footer, {
122
+ }), !isLoading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Footer, {
120
123
  simple: hasSimpleFooter
121
124
  })]
122
125
  });
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newspack-components",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-alpha.2",
4
4
  "description": "Newspack design system components",
5
5
  "author": "Automattic",
6
6
  "license": "GPL-2.0-or-later",
@@ -16,29 +16,32 @@
16
16
  "repository": {
17
17
  "type": "git",
18
18
  "url": "https://github.com/Automattic/newspack-plugin.git",
19
- "directory": "assets/src/components"
19
+ "directory": "src/components"
20
20
  },
21
- "main": "dist/esm/index.js",
21
+ "main": "dist/index.js",
22
22
  "publishConfig": {
23
23
  "access": "public"
24
24
  },
25
25
  "dependencies": {
26
- "@wordpress/base-styles": "^5.1.0",
27
- "@wordpress/components": "^28.1.0",
28
- "@wordpress/element": "^6.1.0",
29
- "@wordpress/i18n": "^5.1.0",
30
- "@wordpress/icons": "^10.1.0",
26
+ "@wordpress/base-styles": "^5.0.0",
27
+ "@wordpress/components": "^28.0.0",
28
+ "@wordpress/element": "^6.0.0",
29
+ "@wordpress/i18n": "^5.0.0",
30
+ "@wordpress/icons": "^10.0.0",
31
31
  "classnames": "^2.3.1",
32
32
  "lodash": "^4.17.21",
33
+ "moment-range": "^3.1.1",
33
34
  "qs": "^6.10.1",
34
- "react-router-dom": "^5.3.0"
35
+ "react-daterange-picker": "^2.0.1",
36
+ "react-router-dom": "^5.3.4"
35
37
  },
36
38
  "devDependencies": {
37
- "@automattic/calypso-build": "^10.0.0",
38
- "@babel/cli": "^7.15.0",
39
- "@babel/core": "^7.15.0",
40
- "@types/wordpress__components": "^23.0.11",
41
- "recursive-copy": "^2.0.13"
39
+ "@babel/cli": "^7.24.0",
40
+ "@babel/core": "^7.24.0",
41
+ "@babel/preset-env": "^7.24.7",
42
+ "@babel/preset-react": "^7.24.7",
43
+ "@babel/preset-typescript": "^7.24.7",
44
+ "recursive-copy": "^2.0.0"
42
45
  },
43
46
  "babel": {
44
47
  "ignore": [
@@ -46,7 +49,7 @@
46
49
  ]
47
50
  },
48
51
  "scripts": {
49
- "prepublishOnly": "transpile && node copy-styles.js",
52
+ "prepublishOnly": "npx babel src --out-dir dist && node copy-styles.js",
50
53
  "postpublish": "rm -r dist && rm -r shared"
51
54
  }
52
55
  }
@@ -1,7 +1,7 @@
1
1
  @mixin visuallyHidden {
2
2
  border: 0;
3
- clip: rect( 1px, 1px, 1px, 1px );
4
- clip-path: inset( 50% );
3
+ clip: rect(1px, 1px, 1px, 1px);
4
+ clip-path: inset(50%);
5
5
  width: 1px;
6
6
  height: 1px;
7
7
  margin: -1px;
@@ -0,0 +1,35 @@
1
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
2
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
3
+
4
+ /**
5
+ * WordPress dependencies
6
+ */
7
+ import { useState } from '@wordpress/element';
8
+ import { Icon, chevronRight } from '@wordpress/icons';
9
+
10
+ /**
11
+ * External dependencies
12
+ */
13
+ import classNames from 'classnames';
14
+
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+ import './style.scss';
19
+
20
+ const Accordion = ( { children, title } ) => {
21
+ const [ isOpen, setIsOpen ] = useState( false );
22
+ return (
23
+ <details
24
+ className={ classNames( 'newspack-accordion', { 'newspack-accordion--is-open': isOpen } ) }
25
+ >
26
+ <summary onClick={ () => setIsOpen( ! isOpen ) }>
27
+ { title }
28
+ <Icon className="newspack-accordion__icon" icon={ chevronRight } size={ 24 } />
29
+ </summary>
30
+ <div className="newspack-accordion__content">{ children }</div>
31
+ </details>
32
+ );
33
+ };
34
+
35
+ export default Accordion;
@@ -0,0 +1,31 @@
1
+ @use "~@wordpress/base-styles/colors" as wp-colors;
2
+
3
+ .newspack-accordion {
4
+ border: 1px solid wp-colors.$gray-300;
5
+
6
+ &__icon {
7
+ transition: transform 200ms ease-out;
8
+ transform: rotate(90deg);
9
+ }
10
+
11
+ &--is-open {
12
+ .newspack-accordion {
13
+ &__icon {
14
+ transform: rotate(-90deg);
15
+ }
16
+ }
17
+ }
18
+ summary {
19
+ padding: 16px 32px;
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: space-between;
23
+ cursor: pointer;
24
+ font-size: 14px;
25
+ font-weight: bold;
26
+ }
27
+
28
+ &__content {
29
+ padding: 16px 32px;
30
+ }
31
+ }
@@ -2,8 +2,8 @@
2
2
  * Action Card
3
3
  */
4
4
 
5
- @use 'sass:color';
6
- @use '~@wordpress/base-styles/colors' as wp-colors;
5
+ @use "sass:color";
6
+ @use "~@wordpress/base-styles/colors" as wp-colors;
7
7
 
8
8
  .newspack-card.newspack-action-card {
9
9
  padding: 0;
@@ -15,7 +15,7 @@
15
15
  transition: box-shadow 125ms ease-in-out;
16
16
 
17
17
  &:hover {
18
- box-shadow: 0 4px 8px rgba( black, 0.08 );
18
+ box-shadow: 0 4px 8px rgba(black, 0.08);
19
19
  }
20
20
  }
21
21
 
@@ -34,7 +34,7 @@
34
34
  }
35
35
 
36
36
  &.newspack-card__is-primary {
37
- box-shadow: inset 4px 0 0 var( --wp-admin-theme-color );
37
+ box-shadow: inset 4px 0 0 var(--wp-admin-theme-color);
38
38
  }
39
39
 
40
40
  &.newspack-card__is-secondary {
@@ -181,12 +181,12 @@
181
181
  }
182
182
 
183
183
  .newspack-action-card__region-top {
184
- background-color: rgba( black, 0.025 );
184
+ background-color: rgba(black, 0.025);
185
185
  }
186
186
 
187
187
  .newspack-action-card__region-center {
188
188
  p {
189
- color: color.adjust( wp-colors.$gray-700, $lightness: -0.75% );
189
+ color: color.adjust(wp-colors.$gray-700, $lightness: -0.75%);
190
190
  }
191
191
  }
192
192
  }
@@ -209,7 +209,7 @@
209
209
  border-left-width: 1px;
210
210
  border-bottom-width: 1px;
211
211
  border-radius: 0 0 0 2px;
212
- content: '';
212
+ content: "";
213
213
  display: block;
214
214
  position: absolute;
215
215
  inset: -17px 100% 50% -28px;
@@ -219,7 +219,7 @@
219
219
  // Typography
220
220
 
221
221
  h2,
222
- p:not( [class*='components-base-control'] ) {
222
+ p:not([class*="components-base-control"]) {
223
223
  margin: 0;
224
224
  max-width: 100%;
225
225
  width: 100%;
@@ -242,7 +242,7 @@
242
242
  &:active,
243
243
  &:focus,
244
244
  &:hover {
245
- color: var( --wp-admin-theme-color );
245
+ color: var(--wp-admin-theme-color);
246
246
  }
247
247
  }
248
248
  }
@@ -2,7 +2,7 @@
2
2
  * Autocomplete Token Field
3
3
  */
4
4
 
5
- @use '~@wordpress/base-styles/colors' as wp-colors;
5
+ @use "~@wordpress/base-styles/colors" as wp-colors;
6
6
 
7
7
  .newspack-autocomplete-tokenfield {
8
8
  .components-spinner {
@@ -43,7 +43,7 @@
43
43
  padding-left: 0;
44
44
  }
45
45
 
46
- .components-button:focus:not( :disabled ) {
47
- box-shadow: inset 0 0 0 var( --wp-admin-border-width-focus ) var( --wp-admin-theme-color );
46
+ .components-button:focus:not(:disabled) {
47
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
48
48
  }
49
49
  }
@@ -81,24 +81,24 @@ const AutocompleteWithSuggestions = ( {
81
81
  const handleFetchSaved = fetchSavedPosts
82
82
  ? fetchSavedPosts
83
83
  : async ( postIds = [], searchSlug = null ) => {
84
- const postTypeSlug = searchSlug || postTypeToSearch;
85
- const endpoint =
84
+ const postTypeSlug = searchSlug || postTypeToSearch;
85
+ const endpoint =
86
86
  'post' === postTypeSlug || 'page' === postTypeSlug
87
87
  ? postTypeSlug + 's' // Default post type endpoints are plural.
88
88
  : postTypeSlug; // Custom post type endpoints are singular.
89
- const posts = await apiFetch( {
90
- path: addQueryArgs( '/wp/v2/' + endpoint, {
91
- per_page: 100,
92
- include: postIds.join( ',' ),
93
- _fields: 'id,title',
94
- } ),
95
- } );
89
+ const posts = await apiFetch( {
90
+ path: addQueryArgs( '/wp/v2/' + endpoint, {
91
+ per_page: 100,
92
+ include: postIds.join( ',' ),
93
+ _fields: 'id,title',
94
+ } ),
95
+ } );
96
96
 
97
- return posts.map( post => ( {
98
- value: parseInt( post.id ),
99
- label: decodeEntities( post.title ) || __( '(no title)', 'newspack-plugin' ),
100
- } ) );
101
- };
97
+ return posts.map( post => ( {
98
+ value: parseInt( post.id ),
99
+ label: decodeEntities( post.title ) || __( '(no title)', 'newspack-plugin' ),
100
+ } ) );
101
+ };
102
102
 
103
103
  /**
104
104
  * If passed a `fetchSuggestions` prop, use that, otherwise, build it based on the selected post type.
@@ -106,36 +106,36 @@ const AutocompleteWithSuggestions = ( {
106
106
  const handleFetchSuggestions = fetchSuggestions
107
107
  ? fetchSuggestions
108
108
  : async ( search = null, offset = 0, searchSlug = null ) => {
109
- const postTypeSlug = searchSlug || postTypeToSearch;
110
- const endpoint =
109
+ const postTypeSlug = searchSlug || postTypeToSearch;
110
+ const endpoint =
111
111
  'post' === postTypeSlug || 'page' === postTypeSlug
112
112
  ? postTypeSlug + 's' // Default post type endpoints are plural.
113
113
  : postTypeSlug; // Custom post type endpoints are singular.
114
- const response = await apiFetch( {
115
- parse: false,
116
- path: addQueryArgs( '/wp/v2/' + endpoint, {
117
- search,
118
- offset,
119
- per_page: suggestionsToFetch,
120
- _fields: 'id,title',
121
- } ),
122
- } );
114
+ const response = await apiFetch( {
115
+ parse: false,
116
+ path: addQueryArgs( '/wp/v2/' + endpoint, {
117
+ search,
118
+ offset,
119
+ per_page: suggestionsToFetch,
120
+ _fields: 'id,title',
121
+ } ),
122
+ } );
123
123
 
124
- const total = parseInt( response.headers.get( 'x-wp-total' ) || 0 );
125
- const posts = await response.json();
124
+ const total = parseInt( response.headers.get( 'x-wp-total' ) || 0 );
125
+ const posts = await response.json();
126
126
 
127
- setMaxSuggestions( total );
127
+ setMaxSuggestions( total );
128
128
 
129
- // Format suggestions for FormTokenField display.
130
- return posts.reduce( ( acc, post ) => {
131
- acc.push( {
132
- value: parseInt( post.id ),
133
- label: decodeEntities( post?.title.rendered ) || __( '(no title)', 'newspack-plugin' ),
134
- } );
129
+ // Format suggestions for FormTokenField display.
130
+ return posts.reduce( ( acc, post ) => {
131
+ acc.push( {
132
+ value: parseInt( post.id ),
133
+ label: decodeEntities( post?.title.rendered ) || __( '(no title)', 'newspack-plugin' ),
134
+ } );
135
135
 
136
- return acc;
137
- }, [] );
138
- };
136
+ return acc;
137
+ }, [] );
138
+ };
139
139
 
140
140
  /**
141
141
  * Intercept onChange callback so we can decide whether to allow multiple selections.
@@ -176,13 +176,15 @@ const AutocompleteWithSuggestions = ( {
176
176
  const selections = selectedPost ? [ ...selectedItems, selectedPost ] : selectedItems;
177
177
  const selectedMessage = multiSelect
178
178
  ? sprintf(
179
- // Translators: %1: the length of selections. %2: the selection leabel.
180
- __( '%1$s %2$s selected', 'newspack-plugin' ),
181
- selections.length,
182
- selections.length > 1 ? postTypeLabelPlural : postTypeLabel
183
- )
184
- : // Translators: %s: The label for the selection.
185
- sprintf( __( 'Selected %s', 'newspack-plugin' ), postTypeLabel );
179
+ // Translators: %1: the length of selections. %2: the selection leabel.
180
+ __( '%1$s %2$s selected', 'newspack-plugin' ),
181
+ selections.length,
182
+ selections.length > 1 ? postTypeLabelPlural : postTypeLabel
183
+ ) : sprintf(
184
+ // Translators: %s: The label for the selection.
185
+ __( 'Selected %s', 'newspack-plugin' ),
186
+ postTypeLabel
187
+ );
186
188
 
187
189
  return (
188
190
  <div className="newspack-autocomplete-with-suggestions__selected-items">
@@ -2,7 +2,7 @@
2
2
  * Styles for AutocompleteWithSuggestions component.
3
3
  */
4
4
 
5
- @use '~@wordpress/base-styles/colors' as wp-colors;
5
+ @use "~@wordpress/base-styles/colors" as wp-colors;
6
6
 
7
7
  .newspack-autocomplete-with-suggestions {
8
8
  width: 100%;
@@ -97,7 +97,7 @@
97
97
  padding-right: 8px;
98
98
 
99
99
  &::after {
100
- content: '✕';
100
+ content: "✕";
101
101
  margin-left: 8px;
102
102
  }
103
103
 
@@ -126,10 +126,10 @@
126
126
  text-decoration: none;
127
127
  width: 100%;
128
128
 
129
- &:active:not( :disabled ),
130
- &:hover:not( :disabled ) {
129
+ &:active:not(:disabled),
130
+ &:hover:not(:disabled) {
131
131
  background: wp-colors.$gray-900;
132
- background: var( --wp-admin-theme-color );
132
+ background: var(--wp-admin-theme-color);
133
133
  color: white;
134
134
  }
135
135
  }
@@ -149,14 +149,14 @@
149
149
  .components-button {
150
150
  line-height: normal;
151
151
 
152
- &:focus:not( :disabled ) {
152
+ &:focus:not(:disabled) {
153
153
  border-radius: 0;
154
154
  box-shadow: inset 0 0 0 1.5px wp-colors.$gray-900;
155
- box-shadow: inset 0 0 0 var( --wp-admin-border-width-focus ) var( --wp-admin-theme-color );
155
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
156
156
  }
157
157
 
158
158
  &.is-secondary {
159
- width: calc( 100% - 16px );
159
+ width: calc(100% - 16px);
160
160
  }
161
161
  }
162
162
  }
@@ -4,7 +4,7 @@
4
4
 
5
5
  .components-button {
6
6
  &.is-destructive {
7
- &:hover:not( :disabled ) {
7
+ &:hover:not(:disabled) {
8
8
  box-shadow: none;
9
9
  }
10
10
  }
@@ -2,40 +2,44 @@
2
2
  * Button Card
3
3
  */
4
4
 
5
- @use '~@wordpress/base-styles/colors' as wp-colors;
5
+ @use "~@wordpress/base-styles/colors" as wp-colors;
6
6
 
7
7
  .newspack-button-card {
8
8
  background: white;
9
9
  border-radius: 2px;
10
10
  border: 1px solid wp-colors.$gray-300;
11
- box-shadow: inset 0 0 0 var( --wp-admin-border-width-focus ) transparent;
11
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) transparent;
12
12
  cursor: pointer;
13
13
  display: block;
14
14
  margin: 32px 0;
15
15
  padding: 32px;
16
16
  position: relative;
17
17
  text-decoration: none;
18
- transition: background-color 125ms ease-in-out, border-color 125ms ease-in-out,
18
+ transition:
19
+ background-color 125ms ease-in-out,
20
+ border-color 125ms ease-in-out,
19
21
  box-shadow 125ms ease-in-out;
20
22
 
21
23
  &:focus,
22
24
  &.is-pressed {
23
25
  background: white;
24
- border-color: var( --wp-admin-theme-color );
25
- box-shadow: inset 0 0 0 1px var( --wp-admin-theme-color ) !important;
26
+ border-color: var(--wp-admin-theme-color);
27
+ box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color) !important;
26
28
  outline: none !important;
27
29
  z-index: 1;
28
30
  }
29
31
 
30
32
  &.is-pressed:focus-visible {
31
- box-shadow: inset 0 0 0 1px var( --wp-admin-theme-color ), 0 0 0 1px white,
32
- 0 0 0 var( --wp-admin-border-width-focus ) var( --wp-admin-theme-color ) !important;
33
+ box-shadow:
34
+ inset 0 0 0 1px var(--wp-admin-theme-color),
35
+ 0 0 0 1px white,
36
+ 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color) !important;
33
37
  }
34
38
 
35
39
  &:active,
36
40
  &:hover {
37
- border-color: var( --wp-admin-theme-color );
38
- color: var( --wp-admin-theme-color );
41
+ border-color: var(--wp-admin-theme-color);
42
+ color: var(--wp-admin-theme-color);
39
43
  text-decoration: none;
40
44
  z-index: 1;
41
45
 
@@ -63,7 +67,7 @@
63
67
  &.grouped {
64
68
  border-radius: 0;
65
69
 
66
- & + &:not( .br--top ) {
70
+ & + &:not(.br--top) {
67
71
  margin-top: -33px;
68
72
  }
69
73
 
@@ -95,7 +99,7 @@
95
99
  }
96
100
 
97
101
  svg {
98
- fill: var( --wp-admin-theme-color );
102
+ fill: var(--wp-admin-theme-color);
99
103
  transition: fill 125ms ease-in-out;
100
104
  }
101
105
  }
@@ -161,8 +165,10 @@
161
165
  }
162
166
 
163
167
  &.is-pressed:focus-visible {
164
- box-shadow: inset 0 0 0 1px wp-colors.$alert-red, 0 0 0 1px white,
165
- 0 0 0 var( --wp-admin-border-width-focus ) wp-colors.$alert-red !important;
168
+ box-shadow:
169
+ inset 0 0 0 1px wp-colors.$alert-red,
170
+ 0 0 0 1px white,
171
+ 0 0 0 var(--wp-admin-border-width-focus) wp-colors.$alert-red !important;
166
172
  }
167
173
 
168
174
  &:active,
@@ -2,7 +2,7 @@
2
2
  * Card
3
3
  */
4
4
 
5
- @use '~@wordpress/base-styles/colors' as wp-colors;
5
+ @use "~@wordpress/base-styles/colors" as wp-colors;
6
6
 
7
7
  .newspack-card {
8
8
  border-radius: 2px;
@@ -19,10 +19,10 @@
19
19
  &__suggestions-spinner {
20
20
  position: absolute;
21
21
  right: 1px;
22
- top: calc( 1.4em + 8px );
22
+ top: calc(1.4em + 8px);
23
23
  z-index: 2;
24
24
 
25
- [class*='--label-hidden'] + & {
25
+ [class*="--label-hidden"] + & {
26
26
  top: 0;
27
27
  }
28
28