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
@@ -0,0 +1,25 @@
1
+ module.exports = api => {
2
+ api.cache( true );
3
+ return {
4
+ extends: 'newspack-scripts/config/babel.config.js',
5
+ presets: [
6
+ [
7
+ '@babel/preset-env',
8
+ {
9
+ corejs: 3.6,
10
+ useBuiltIns: 'entry',
11
+ // Exclude transforms that make all code slower, see https://github.com/facebook/create-react-app/pull/5278
12
+ exclude: [ 'transform-typeof-symbol' ],
13
+ },
14
+ ],
15
+ [
16
+ '@babel/preset-react',
17
+ {
18
+ runtime: 'automatic',
19
+ importSource: process.env.IMPORT_SOURCE,
20
+ },
21
+ ],
22
+ [ '@babel/preset-typescript', { allowDeclareFields: true } ],
23
+ ],
24
+ };
25
+ };
package/copy-styles.js CHANGED
@@ -9,8 +9,7 @@ const rcopy = require( 'recursive-copy' );
9
9
  const dir = process.cwd();
10
10
 
11
11
  const inputDir = path.join( dir, 'src' );
12
- const outputDirEsm = path.join( dir, 'dist', 'esm' );
13
- const outputDirCommon = path.join( dir, 'dist', 'cjs' );
12
+ const outputDir = path.join( dir, 'dist' );
14
13
 
15
14
  console.log( 'Copying styles %s', dir );
16
15
 
@@ -21,14 +20,7 @@ const copyOptions = {
21
20
  debug: true,
22
21
  };
23
22
 
24
- rcopy( inputDir, outputDirEsm, copyOptions )
25
- .then( results => {
26
- console.log( 'copied %d files', results.length );
27
- } )
28
- .catch( err => {
29
- console.error( err );
30
- } );
31
- rcopy( inputDir, outputDirCommon, copyOptions )
23
+ rcopy( inputDir, outputDir, copyOptions )
32
24
  .then( results => {
33
25
  console.log( 'copied %d files', results.length );
34
26
  } )
@@ -0,0 +1,50 @@
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 _element = require("@wordpress/element");
9
+ var _icons = require("@wordpress/icons");
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+ require("./style.scss");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
14
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
15
+
16
+ /**
17
+ * WordPress dependencies
18
+ */
19
+
20
+ /**
21
+ * External dependencies
22
+ */
23
+
24
+ /**
25
+ * Internal dependencies
26
+ */
27
+
28
+ const Accordion = ({
29
+ children,
30
+ title
31
+ }) => {
32
+ const [isOpen, setIsOpen] = (0, _element.useState)(false);
33
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("details", {
34
+ className: (0, _classnames.default)('newspack-accordion', {
35
+ 'newspack-accordion--is-open': isOpen
36
+ }),
37
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("summary", {
38
+ onClick: () => setIsOpen(!isOpen),
39
+ children: [title, /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
40
+ className: "newspack-accordion__icon",
41
+ icon: _icons.chevronRight,
42
+ size: 24
43
+ })]
44
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
45
+ className: "newspack-accordion__content",
46
+ children: children
47
+ })]
48
+ });
49
+ };
50
+ var _default = exports.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
+ }
@@ -1,18 +1,17 @@
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
  });
7
7
  exports.default = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
8
  var _element = require("@wordpress/element");
10
9
  var _components = require("@wordpress/components");
11
10
  var _icons = require("@wordpress/icons");
12
11
  var _ = require("../");
13
12
  require("./style.scss");
14
13
  var _classnames = _interopRequireDefault(require("classnames"));
15
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
14
+ var _jsxRuntime = require("react/jsx-runtime");
16
15
  /**
17
16
  * Action Card
18
17
  */
@@ -30,12 +29,10 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
30
29
  */
31
30
 
32
31
  class ActionCard extends _element.Component {
33
- constructor(...args) {
34
- super(...args);
35
- (0, _defineProperty2.default)(this, "state", {
36
- expanded: false
37
- });
38
- }
32
+ state = {
33
+ expanded: false
34
+ };
35
+
39
36
  /**
40
37
  * When the collapse prop is updated to true, collapse the card if already expanded.
41
38
  */
@@ -103,120 +100,120 @@ class ActionCard extends _element.Component {
103
100
  const hasInternalLink = href && href.indexOf('http') !== 0;
104
101
  const isDisplayingSecondaryAction = secondaryActionText && onSecondaryActionClick;
105
102
  const badges = !Array.isArray(badge) && badge ? [badge] : badge;
106
- return (0, _jsxRuntime.jsxs)(_.Card, {
103
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Card, {
107
104
  className: classes,
108
105
  onClick: simple && onClick,
109
- children: [(0, _jsxRuntime.jsxs)("div", {
106
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
110
107
  className: "newspack-action-card__region newspack-action-card__region-top",
111
- children: [toggleOnChange && (0, _jsxRuntime.jsx)(_components.ToggleControl, {
108
+ children: [toggleOnChange && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
112
109
  checked: toggleChecked,
113
110
  onChange: toggleOnChange,
114
111
  disabled: disabled
115
- }), image && !toggleOnChange && (0, _jsxRuntime.jsx)("div", {
112
+ }), image && !toggleOnChange && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
116
113
  className: "newspack-action-card__region newspack-action-card__region-left",
117
- children: (0, _jsxRuntime.jsx)("a", {
114
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
118
115
  href: imageLink,
119
- children: (0, _jsxRuntime.jsx)("div", {
116
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
120
117
  className: "newspack-action-card__image",
121
118
  style: backgroundImageStyles(image)
122
119
  })
123
120
  })
124
- }), checkbox && !toggleOnChange && (0, _jsxRuntime.jsx)("div", {
121
+ }), checkbox && !toggleOnChange && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
125
122
  className: "newspack-action-card__region newspack-action-card__region-left",
126
- children: (0, _jsxRuntime.jsx)("span", {
123
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
127
124
  className: (0, _classnames.default)('newspack-checkbox-icon', 'is-primary', 'checked' === checkbox && 'newspack-checkbox-icon--checked', isPending && 'newspack-checkbox-icon--pending'),
128
- children: 'checked' === checkbox && (0, _jsxRuntime.jsx)(_icons.Icon, {
125
+ children: 'checked' === checkbox && /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
129
126
  icon: _icons.check
130
127
  })
131
128
  })
132
- }), (0, _jsxRuntime.jsx)("div", {
129
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
133
130
  className: "newspack-action-card__region newspack-action-card__region-center",
134
- children: (0, _jsxRuntime.jsxs)(_.Grid, {
131
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Grid, {
135
132
  columns: 1,
136
133
  gutter: 8,
137
134
  noMargin: true,
138
- children: [(0, _jsxRuntime.jsxs)("h2", {
139
- children: [(0, _jsxRuntime.jsxs)("span", {
135
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("h2", {
136
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
140
137
  className: "newspack-action-card__title",
141
138
  ...titleProps,
142
- children: [titleLink && (0, _jsxRuntime.jsx)("a", {
139
+ children: [titleLink && /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
143
140
  href: titleLink,
144
141
  children: title
145
- }), !titleLink && expandable && (0, _jsxRuntime.jsx)(_.Button, {
142
+ }), !titleLink && expandable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
146
143
  isLink: true,
147
144
  onClick: () => this.setState({
148
145
  expanded: !expanded
149
146
  }),
150
147
  children: title
151
148
  }), !titleLink && !expandable && title]
152
- }), badges?.length && badges.map((badgeText, i) => (0, _jsxRuntime.jsx)("span", {
149
+ }), badges?.length && badges.map((badgeText, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
153
150
  className: "newspack-action-card__badge",
154
151
  children: badgeText
155
152
  }, `badge-${i}`))]
156
- }), description && (0, _jsxRuntime.jsxs)("p", {
153
+ }), description && /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
157
154
  children: [typeof description === 'string' && description, typeof description === 'function' && description()]
158
155
  })]
159
156
  })
160
- }), !expandable && (actionText || isDisplayingSecondaryAction || actionContent) && (0, _jsxRuntime.jsxs)("div", {
157
+ }), !expandable && (actionText || isDisplayingSecondaryAction || actionContent) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
161
158
  className: "newspack-action-card__region newspack-action-card__region-right",
162
- children: [actionContent && actionContent, actionText && (handoff ? (0, _jsxRuntime.jsx)(_.Handoff, {
159
+ children: [actionContent && actionContent, actionText && (handoff ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Handoff, {
163
160
  plugin: handoff,
164
161
  editLink: editLink,
165
162
  compact: true,
166
163
  isLink: true,
167
164
  children: actionText
168
- }) : onClick || hasInternalLink ? (0, _jsxRuntime.jsx)(_.Button, {
165
+ }) : onClick || hasInternalLink ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
169
166
  disabled: disabled,
170
167
  isLink: true,
171
168
  href: href,
172
169
  onClick: onClick,
173
170
  className: "newspack-action-card__primary_button",
174
171
  children: actionText
175
- }) : href ? (0, _jsxRuntime.jsx)(_components.ExternalLink, {
172
+ }) : href ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ExternalLink, {
176
173
  href: href,
177
174
  className: "newspack-action-card__primary_button",
178
175
  children: actionText
179
- }) : (0, _jsxRuntime.jsxs)("div", {
176
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
180
177
  className: "newspack-action-card__container",
181
- children: [actionText, isWaiting && (0, _jsxRuntime.jsx)(_.Waiting, {
178
+ children: [actionText, isWaiting && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Waiting, {
182
179
  isRight: true
183
180
  })]
184
- })), isDisplayingSecondaryAction && (0, _jsxRuntime.jsx)(_.Button, {
181
+ })), isDisplayingSecondaryAction && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
185
182
  isLink: true,
186
183
  onClick: onSecondaryActionClick,
187
184
  className: "newspack-action-card__secondary_button",
188
185
  isDestructive: secondaryDestructive,
189
186
  children: secondaryActionText
190
187
  })]
191
- }), expandable && (0, _jsxRuntime.jsx)(_.Button, {
188
+ }), expandable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
192
189
  onClick: () => this.setState({
193
190
  expanded: !expanded
194
191
  }),
195
- children: (0, _jsxRuntime.jsx)(_icons.Icon, {
192
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
196
193
  icon: expanded ? _icons.chevronUp : _icons.chevronDown,
197
194
  height: 24,
198
195
  width: 24
199
196
  })
200
197
  })]
201
- }), notification && (0, _jsxRuntime.jsxs)("div", {
198
+ }), notification && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
202
199
  className: "newspack-action-card__notification newspack-action-card__region-children",
203
- children: ['error' === notificationLevel && (0, _jsxRuntime.jsx)(_.Notice, {
200
+ children: ['error' === notificationLevel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Notice, {
204
201
  noticeText: notification,
205
202
  isError: true,
206
203
  rawHTML: notificationHTML
207
- }), 'info' === notificationLevel && (0, _jsxRuntime.jsx)(_.Notice, {
204
+ }), 'info' === notificationLevel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Notice, {
208
205
  noticeText: notification,
209
206
  rawHTML: notificationHTML
210
- }), 'success' === notificationLevel && (0, _jsxRuntime.jsx)(_.Notice, {
207
+ }), 'success' === notificationLevel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Notice, {
211
208
  noticeText: notification,
212
209
  isSuccess: true,
213
210
  rawHTML: notificationHTML
214
- }), 'warning' === notificationLevel && (0, _jsxRuntime.jsx)(_.Notice, {
211
+ }), 'warning' === notificationLevel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Notice, {
215
212
  noticeText: notification,
216
213
  isWarning: true,
217
214
  rawHTML: notificationHTML
218
215
  })]
219
- }), children && (expandable && expanded || !expandable) && (0, _jsxRuntime.jsx)("div", {
216
+ }), children && (expandable && expanded || !expandable) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
220
217
  className: "newspack-action-card__region-children",
221
218
  children: children
222
219
  })]
@@ -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
  }
@@ -1,16 +1,15 @@
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
  });
7
7
  exports.default = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
8
  var _debounce = _interopRequireDefault(require("lodash/debounce"));
10
9
  var _element = require("@wordpress/element");
11
10
  var _components = require("@wordpress/components");
12
11
  require("./style.scss");
13
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
12
+ var _jsxRuntime = require("react/jsx-runtime");
14
13
  /**
15
14
  * External dependencies
16
15
  */
@@ -28,16 +27,6 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
28
27
  */class AutocompleteTokenField extends _element.Component {
29
28
  constructor(props) {
30
29
  super(props);
31
- /**
32
- * If the component has tokens passed in props, it should fetch info after it mounts.
33
- */
34
- (0, _defineProperty2.default)(this, "isFetchingInfoOnLoad", () => {
35
- const {
36
- tokens,
37
- fetchSavedInfo
38
- } = this.props;
39
- return Boolean(tokens.length && fetchSavedInfo);
40
- });
41
30
  this.state = {
42
31
  suggestions: [],
43
32
  validValues: {},
@@ -45,6 +34,18 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
45
34
  };
46
35
  this.debouncedUpdateSuggestions = (0, _debounce.default)(this.updateSuggestions, 500);
47
36
  }
37
+
38
+ /**
39
+ * If the component has tokens passed in props, it should fetch info after it mounts.
40
+ */
41
+ isFetchingInfoOnLoad = () => {
42
+ const {
43
+ tokens,
44
+ fetchSavedInfo
45
+ } = this.props;
46
+ return Boolean(tokens.length && fetchSavedInfo);
47
+ };
48
+
48
49
  /**
49
50
  * When the component loads, fetch information about the tokens so we can populate
50
51
  * the tokens with the correct labels.
@@ -243,11 +244,11 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
243
244
  if (label) {
244
245
  classNames.push('has-label');
245
246
  }
246
- return (0, _jsxRuntime.jsxs)("div", {
247
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
247
248
  className: "newspack-autocomplete-tokenfield",
248
- children: [(0, _jsxRuntime.jsxs)("div", {
249
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
249
250
  className: classNames.join(' '),
250
- children: [(0, _jsxRuntime.jsx)(_components.FormTokenField, {
251
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FormTokenField, {
251
252
  value: this.getTokens(),
252
253
  suggestions: suggestions.map(suggestion => suggestion.label),
253
254
  onChange: tokens => this.handleOnChange(tokens),
@@ -255,8 +256,8 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
255
256
  label: label,
256
257
  maxLength: maxLength,
257
258
  placeholder: placeholder
258
- }), loading && (0, _jsxRuntime.jsx)(_components.Spinner, {})]
259
- }), help && (0, _jsxRuntime.jsx)("p", {
259
+ }), loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {})]
260
+ }), help && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
260
261
  className: "newspack-autocomplete-tokenfield__help",
261
262
  children: help
262
263
  })]
@@ -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
  }
@@ -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
  });
@@ -13,24 +13,24 @@ var _i18n = require("@wordpress/i18n");
13
13
  var _url = require("@wordpress/url");
14
14
  var _ = require("../");
15
15
  require("./style.scss");
16
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
17
  /**
18
18
  * WordPress dependencies
19
19
  */
20
- const __ = _i18n.__,
21
- _x = _i18n._x;
20
+
22
21
  /**
23
22
  * External dependencies.
24
23
  */
24
+
25
25
  const AutocompleteWithSuggestions = ({
26
26
  fetchSavedPosts = false,
27
27
  // If passed, will use this function to fetch saved data.
28
28
  fetchSuggestions = false,
29
29
  // If passed, will use this function to fetch suggestions data.
30
- help = __('Begin typing search term, click autocomplete result to select.', 'newspack-plugin'),
30
+ help = (0, _i18n.__)('Begin typing search term, click autocomplete result to select.', 'newspack-plugin'),
31
31
  hideHelp = false,
32
32
  // If true, all help text will be hidden.
33
- label = __('Search', 'newspack-plugin'),
33
+ label = (0, _i18n.__)('Search', 'newspack-plugin'),
34
34
  maxItemsToSuggest = 0,
35
35
  // If passed, will be used to determine "load more" state. Necessary if you want "load more" functionality when using a custom `fetchSuggestions` function.
36
36
  multiSelect = false,
@@ -44,9 +44,9 @@ const AutocompleteWithSuggestions = ({
44
44
  label: 'Post'
45
45
  }],
46
46
  // If passed, will render a selector to change the post type queried for suggestions.
47
- postTypeLabel = __('item', 'newspack-plugin'),
47
+ postTypeLabel = (0, _i18n.__)('item', 'newspack-plugin'),
48
48
  // String to describe the data being shown.
49
- postTypeLabelPlural = __('items', 'newspack-plugin'),
49
+ postTypeLabelPlural = (0, _i18n.__)('items', 'newspack-plugin'),
50
50
  // Plural string to describe the data being shown.
51
51
  selectedItems = [],
52
52
  // Array of saved items.
@@ -108,7 +108,7 @@ const AutocompleteWithSuggestions = ({
108
108
  });
109
109
  return posts.map(post => ({
110
110
  value: parseInt(post.id),
111
- label: (0, _htmlEntities.decodeEntities)(post.title) || __('(no title)', 'newspack-plugin')
111
+ label: (0, _htmlEntities.decodeEntities)(post.title) || (0, _i18n.__)('(no title)', 'newspack-plugin')
112
112
  }));
113
113
  };
114
114
 
@@ -136,7 +136,7 @@ const AutocompleteWithSuggestions = ({
136
136
  return posts.reduce((acc, post) => {
137
137
  acc.push({
138
138
  value: parseInt(post.id),
139
- label: (0, _htmlEntities.decodeEntities)(post?.title.rendered) || __('(no title)', 'newspack-plugin')
139
+ label: (0, _htmlEntities.decodeEntities)(post?.title.rendered) || (0, _i18n.__)('(no title)', 'newspack-plugin')
140
140
  });
141
141
  return acc;
142
142
  }, []);
@@ -181,20 +181,20 @@ const AutocompleteWithSuggestions = ({
181
181
  const selections = selectedPost ? [...selectedItems, selectedPost] : selectedItems;
182
182
  const selectedMessage = multiSelect ? (0, _i18n.sprintf)(
183
183
  // Translators: %1: the length of selections. %2: the selection leabel.
184
- __('%1$s %2$s selected', 'newspack-plugin'), selections.length, selections.length > 1 ? postTypeLabelPlural : postTypeLabel) :
184
+ (0, _i18n.__)('%1$s %2$s selected', 'newspack-plugin'), selections.length, selections.length > 1 ? postTypeLabelPlural : postTypeLabel) : (0, _i18n.sprintf)(
185
185
  // Translators: %s: The label for the selection.
186
- (0, _i18n.sprintf)(__('Selected %s', 'newspack-plugin'), postTypeLabel);
187
- return (0, _jsxRuntime.jsxs)("div", {
186
+ (0, _i18n.__)('Selected %s', 'newspack-plugin'), postTypeLabel);
187
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
188
188
  className: "newspack-autocomplete-with-suggestions__selected-items",
189
- children: [(0, _jsxRuntime.jsxs)("p", {
189
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
190
190
  className: "newspack-autocomplete-with-suggestions__label",
191
- children: [selectedMessage, 1 < selections.length && _x(' – ', 'separator character', 'newspack-plugin'), 1 < selections.length && (0, _jsxRuntime.jsx)(_components.Button, {
191
+ children: [selectedMessage, 1 < selections.length && (0, _i18n._x)(' – ', 'separator character', 'newspack-plugin'), 1 < selections.length && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
192
192
  onClick: () => onChange([]),
193
193
  isLink: true,
194
194
  isDestructive: true,
195
- children: __('Clear all', 'newspack-plugin')
195
+ children: (0, _i18n.__)('Clear all', 'newspack-plugin')
196
196
  })]
197
- }), selections.map(selection => (0, _jsxRuntime.jsx)(_components.Button, {
197
+ }), selections.map(selection => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
198
198
  className: "newspack-autocomplete-with-suggestions__selected-item-button",
199
199
  isTertiary: true,
200
200
  onClick: () => onChange(selections.filter(_selection => _selection.value !== selection.value)),
@@ -207,10 +207,10 @@ const AutocompleteWithSuggestions = ({
207
207
  * Render post type select dropdown.
208
208
  */
209
209
  const renderPostTypeSelect = () => {
210
- return (0, _jsxRuntime.jsx)(_components.SelectControl, {
210
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
211
211
  label: (0, _i18n.sprintf)(
212
212
  // Translators: %s: The name of the type.
213
- __('%s type', 'newspack-plugin'), postTypeLabel.charAt(0).toUpperCase() + postTypeLabel.slice(1)),
213
+ (0, _i18n.__)('%s type', 'newspack-plugin'), postTypeLabel.charAt(0).toUpperCase() + postTypeLabel.slice(1)),
214
214
  value: postTypeToSearch,
215
215
  options: postTypes.map(postTypeOption => ({
216
216
  label: postTypeOption.label,
@@ -229,13 +229,13 @@ const AutocompleteWithSuggestions = ({
229
229
  if (multiSelect) {
230
230
  const selections = selectedPost ? [...selectedItems, selectedPost] : [...selectedItems];
231
231
  const isSelected = !!selections.find(_selection => parseInt(_selection.value) === parseInt(suggestion.value) && _selection.label === suggestion.label);
232
- return (0, _jsxRuntime.jsx)(_components.CheckboxControl, {
232
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CheckboxControl, {
233
233
  checked: isSelected,
234
234
  onChange: () => handleOnChange([suggestion]),
235
235
  label: suggestion.label
236
236
  }, suggestion.value);
237
237
  }
238
- return (0, _jsxRuntime.jsx)(_components.Button, {
238
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
239
239
  isLink: true,
240
240
  onClick: () => handleOnChange([suggestion]),
241
241
  children: suggestion.label
@@ -250,24 +250,24 @@ const AutocompleteWithSuggestions = ({
250
250
  return null;
251
251
  }
252
252
  const className = multiSelect ? 'newspack-autocomplete-with-suggestions__search-suggestions-multiselect' : 'newspack-autocomplete-with-suggestions__search-suggestions';
253
- return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
254
- children: [!hideHelp && (0, _jsxRuntime.jsx)("p", {
253
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
254
+ children: [!hideHelp && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
255
255
  className: "newspack-autocomplete-with-suggestions__label",
256
- children: /* Translators: %s: the name of a post type. */(0, _i18n.sprintf)(__('Or, select a recent %s:', 'newspack-plugin'), postTypeLabel)
257
- }), (0, _jsxRuntime.jsxs)("div", {
256
+ children: /* Translators: %s: the name of a post type. */(0, _i18n.sprintf)((0, _i18n.__)('Or, select a recent %s:', 'newspack-plugin'), postTypeLabel)
257
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
258
258
  className: className,
259
- children: [suggestions.map(renderSuggestion), suggestions.length < (maxItemsToSuggest || maxSuggestions) && (0, _jsxRuntime.jsx)(_components.Button, {
259
+ children: [suggestions.map(renderSuggestion), suggestions.length < (maxItemsToSuggest || maxSuggestions) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
260
260
  disabled: isLoadingMore,
261
261
  isSecondary: true,
262
262
  onClick: () => setIsLoadingMore(true),
263
- children: isLoadingMore ? __('Loading…', 'newspack-plugin') : __('Load more', 'newspack-plugin')
263
+ children: isLoadingMore ? (0, _i18n.__)('Loading…', 'newspack-plugin') : (0, _i18n.__)('Load more', 'newspack-plugin')
264
264
  })]
265
265
  })]
266
266
  });
267
267
  };
268
- return (0, _jsxRuntime.jsxs)("div", {
268
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
269
269
  className: classNames.join(' '),
270
- children: [0 < selectedItems.length && renderSelections(), 1 < postTypes.length && renderPostTypeSelect(), (0, _jsxRuntime.jsx)(_.AutocompleteTokenField, {
270
+ children: [0 < selectedItems.length && renderSelections(), 1 < postTypes.length && renderPostTypeSelect(), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.AutocompleteTokenField, {
271
271
  tokens: [],
272
272
  onChange: handleOnChange,
273
273
  fetchSuggestions: async search => handleFetchSuggestions(search, 0, postTypeToSearch),