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

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 (227) hide show
  1. package/babel.config.cjs.js +26 -0
  2. package/babel.config.js +1 -0
  3. package/copy-styles.js +10 -2
  4. package/dist/cjs/button/index.js +56 -0
  5. package/dist/cjs/grid/index.js +37 -0
  6. package/dist/cjs/hooks/index.js +25 -0
  7. package/dist/cjs/hooks/usePrompt.js +49 -0
  8. package/dist/cjs/text-control/index.js +64 -0
  9. package/dist/esm/accordion/index.js +42 -0
  10. package/dist/esm/accordion/style.scss +31 -0
  11. package/dist/esm/action-card/index.js +218 -0
  12. package/dist/esm/action-card/style.scss +483 -0
  13. package/dist/esm/autocomplete-tokenfield/index.js +261 -0
  14. package/dist/esm/autocomplete-tokenfield/style.scss +49 -0
  15. package/dist/esm/autocomplete-with-suggestions/index.js +274 -0
  16. package/dist/esm/autocomplete-with-suggestions/style.scss +163 -0
  17. package/dist/esm/button/index.js +48 -0
  18. package/dist/esm/button/style.scss +11 -0
  19. package/dist/esm/button-card/index.js +64 -0
  20. package/dist/esm/button-card/style.scss +180 -0
  21. package/dist/esm/card/index.js +43 -0
  22. package/dist/esm/card/style.scss +168 -0
  23. package/dist/esm/category-autocomplete/index.js +183 -0
  24. package/dist/esm/category-autocomplete/style.scss +34 -0
  25. package/dist/esm/color-picker/index.js +59 -0
  26. package/dist/esm/color-picker/style.scss +37 -0
  27. package/dist/esm/consts.js +1 -0
  28. package/dist/esm/custom-select-control/index.js +37 -0
  29. package/dist/esm/custom-select-control/style.scss +93 -0
  30. package/dist/esm/date-range-picker/index.js +31 -0
  31. package/dist/esm/date-range-picker/style.scss +148 -0
  32. package/dist/esm/footer/index.js +99 -0
  33. package/dist/esm/footer/style.scss +82 -0
  34. package/dist/esm/form-token-field/index.js +49 -0
  35. package/dist/esm/form-token-field/style.scss +37 -0
  36. package/dist/esm/global-notices/index.js +30 -0
  37. package/dist/esm/grid/index.js +29 -0
  38. package/dist/esm/grid/style.scss +166 -0
  39. package/dist/esm/handoff/index.js +175 -0
  40. package/dist/esm/handoff-message/index.js +47 -0
  41. package/dist/esm/hooks/index.js +17 -0
  42. package/dist/esm/hooks/useObjectState.js +30 -0
  43. package/dist/esm/hooks/useObjectState.test.js +82 -0
  44. package/dist/esm/hooks/useOnClickOutside.js +31 -0
  45. package/dist/esm/hooks/usePrompt.js +40 -0
  46. package/dist/esm/image-upload/index.js +140 -0
  47. package/dist/esm/image-upload/index.test.js +34 -0
  48. package/dist/esm/image-upload/style.scss +103 -0
  49. package/dist/esm/index.js +47 -0
  50. package/dist/esm/info-button/index.js +42 -0
  51. package/dist/esm/info-button/style.scss +18 -0
  52. package/dist/esm/modal/index.js +39 -0
  53. package/dist/esm/modal/style.scss +56 -0
  54. package/dist/esm/newspack-icon/index.js +50 -0
  55. package/dist/esm/newspack-icon/style.scss +26 -0
  56. package/dist/esm/newspack-logo/index.js +46 -0
  57. package/dist/esm/newspack-logo/style.scss +30 -0
  58. package/dist/esm/notice/index.js +65 -0
  59. package/dist/esm/notice/style.scss +111 -0
  60. package/dist/esm/patrons-logo/index.js +70 -0
  61. package/dist/esm/plugin-installer/index.js +289 -0
  62. package/dist/esm/plugin-installer/style.scss +72 -0
  63. package/dist/esm/plugin-settings/SettingsSection.js +133 -0
  64. package/dist/esm/plugin-settings/index.js +220 -0
  65. package/dist/esm/plugin-settings/style.scss +7 -0
  66. package/dist/esm/plugin-toggle/index.js +216 -0
  67. package/dist/esm/plugin-toggle/style.scss +20 -0
  68. package/dist/esm/popover/index.js +41 -0
  69. package/dist/esm/popover/style.scss +161 -0
  70. package/dist/esm/position-control/index.js +106 -0
  71. package/dist/esm/position-control/style.scss +66 -0
  72. package/dist/esm/progress-bar/index.js +68 -0
  73. package/dist/esm/progress-bar/index.test.js +108 -0
  74. package/dist/esm/progress-bar/style.scss +42 -0
  75. package/dist/esm/proxied-imports/router.js +8 -0
  76. package/dist/esm/radio-control/index.js +37 -0
  77. package/dist/esm/radio-control/style.scss +92 -0
  78. package/dist/esm/section-header/index.js +67 -0
  79. package/dist/esm/section-header/style.scss +45 -0
  80. package/dist/esm/select-control/ButtonGroupControl.js +53 -0
  81. package/dist/esm/select-control/GroupedSelectControl.js +78 -0
  82. package/dist/esm/select-control/index.js +51 -0
  83. package/dist/esm/select-control/style.scss +108 -0
  84. package/dist/esm/settings/MinMaxSetting.js +53 -0
  85. package/dist/esm/settings/SettingsCard.js +38 -0
  86. package/dist/esm/settings/SettingsSection.js +26 -0
  87. package/dist/esm/settings/index.js +9 -0
  88. package/dist/esm/settings/style.scss +119 -0
  89. package/dist/esm/sortable-newsletter-list-control/index.js +127 -0
  90. package/dist/esm/sortable-newsletter-list-control/style.scss +45 -0
  91. package/dist/esm/steps-list/index.js +43 -0
  92. package/dist/esm/steps-list/style.scss +11 -0
  93. package/dist/esm/steps-list-item/index.js +47 -0
  94. package/dist/esm/steps-list-item/style.scss +47 -0
  95. package/dist/esm/style-card/index.js +74 -0
  96. package/dist/esm/style-card/style.scss +94 -0
  97. package/dist/esm/style.scss +55 -0
  98. package/dist/esm/tabbed-navigation/index.js +53 -0
  99. package/dist/esm/tabbed-navigation/style.scss +86 -0
  100. package/dist/esm/text-control/index.js +56 -0
  101. package/dist/esm/text-control/style.scss +32 -0
  102. package/dist/esm/utils/index.js +29 -0
  103. package/dist/esm/waiting/index.js +44 -0
  104. package/dist/esm/waiting/style.scss +27 -0
  105. package/dist/esm/web-preview/index.js +183 -0
  106. package/dist/esm/web-preview/style.scss +155 -0
  107. package/dist/esm/with-wizard/index.js +320 -0
  108. package/dist/esm/with-wizard/style.scss +282 -0
  109. package/dist/esm/with-wizard-screen/index.js +109 -0
  110. package/dist/esm/with-wizard-screen/style.scss +160 -0
  111. package/dist/esm/wizard/components/WizardError.js +66 -0
  112. package/dist/esm/wizard/index.js +119 -0
  113. package/dist/esm/wizard/store/index.js +155 -0
  114. package/dist/esm/wizard/store/utils.js +14 -0
  115. package/package.json +8 -4
  116. package/dist/button/index.js +0 -51
  117. package/dist/button/index.tsx +0 -48
  118. package/dist/grid/index.js +0 -44
  119. package/dist/grid/index.tsx +0 -34
  120. package/dist/hooks/index.js +0 -29
  121. package/dist/hooks/index.ts +0 -15
  122. package/dist/hooks/usePrompt.js +0 -47
  123. package/dist/hooks/usePrompt.ts +0 -46
  124. package/dist/plugin-toggle/README.md +0 -53
  125. package/dist/text-control/index.js +0 -76
  126. package/dist/text-control/index.tsx +0 -71
  127. /package/dist/{accordion → cjs/accordion}/index.js +0 -0
  128. /package/dist/{accordion → cjs/accordion}/style.scss +0 -0
  129. /package/dist/{action-card → cjs/action-card}/index.js +0 -0
  130. /package/dist/{action-card → cjs/action-card}/style.scss +0 -0
  131. /package/dist/{autocomplete-tokenfield → cjs/autocomplete-tokenfield}/index.js +0 -0
  132. /package/dist/{autocomplete-tokenfield → cjs/autocomplete-tokenfield}/style.scss +0 -0
  133. /package/dist/{autocomplete-with-suggestions → cjs/autocomplete-with-suggestions}/index.js +0 -0
  134. /package/dist/{autocomplete-with-suggestions → cjs/autocomplete-with-suggestions}/style.scss +0 -0
  135. /package/dist/{button → cjs/button}/style.scss +0 -0
  136. /package/dist/{button-card → cjs/button-card}/index.js +0 -0
  137. /package/dist/{button-card → cjs/button-card}/style.scss +0 -0
  138. /package/dist/{card → cjs/card}/index.js +0 -0
  139. /package/dist/{card → cjs/card}/style.scss +0 -0
  140. /package/dist/{category-autocomplete → cjs/category-autocomplete}/index.js +0 -0
  141. /package/dist/{category-autocomplete → cjs/category-autocomplete}/style.scss +0 -0
  142. /package/dist/{color-picker → cjs/color-picker}/index.js +0 -0
  143. /package/dist/{color-picker → cjs/color-picker}/style.scss +0 -0
  144. /package/dist/{consts.js → cjs/consts.js} +0 -0
  145. /package/dist/{custom-select-control → cjs/custom-select-control}/index.js +0 -0
  146. /package/dist/{custom-select-control → cjs/custom-select-control}/style.scss +0 -0
  147. /package/dist/{date-range-picker → cjs/date-range-picker}/index.js +0 -0
  148. /package/dist/{date-range-picker → cjs/date-range-picker}/style.scss +0 -0
  149. /package/dist/{footer → cjs/footer}/index.js +0 -0
  150. /package/dist/{footer → cjs/footer}/style.scss +0 -0
  151. /package/dist/{form-token-field → cjs/form-token-field}/index.js +0 -0
  152. /package/dist/{form-token-field → cjs/form-token-field}/style.scss +0 -0
  153. /package/dist/{global-notices → cjs/global-notices}/index.js +0 -0
  154. /package/dist/{grid → cjs/grid}/style.scss +0 -0
  155. /package/dist/{handoff → cjs/handoff}/index.js +0 -0
  156. /package/dist/{handoff-message → cjs/handoff-message}/index.js +0 -0
  157. /package/dist/{hooks → cjs/hooks}/useObjectState.js +0 -0
  158. /package/dist/{hooks → cjs/hooks}/useObjectState.test.js +0 -0
  159. /package/dist/{hooks → cjs/hooks}/useOnClickOutside.js +0 -0
  160. /package/dist/{image-upload → cjs/image-upload}/index.js +0 -0
  161. /package/dist/{image-upload → cjs/image-upload}/index.test.js +0 -0
  162. /package/dist/{image-upload → cjs/image-upload}/style.scss +0 -0
  163. /package/dist/{index.js → cjs/index.js} +0 -0
  164. /package/dist/{info-button → cjs/info-button}/index.js +0 -0
  165. /package/dist/{info-button → cjs/info-button}/style.scss +0 -0
  166. /package/dist/{modal → cjs/modal}/index.js +0 -0
  167. /package/dist/{modal → cjs/modal}/style.scss +0 -0
  168. /package/dist/{newspack-icon → cjs/newspack-icon}/index.js +0 -0
  169. /package/dist/{newspack-icon → cjs/newspack-icon}/style.scss +0 -0
  170. /package/dist/{newspack-logo → cjs/newspack-logo}/index.js +0 -0
  171. /package/dist/{newspack-logo → cjs/newspack-logo}/style.scss +0 -0
  172. /package/dist/{notice → cjs/notice}/index.js +0 -0
  173. /package/dist/{notice → cjs/notice}/style.scss +0 -0
  174. /package/dist/{patrons-logo → cjs/patrons-logo}/index.js +0 -0
  175. /package/dist/{plugin-installer → cjs/plugin-installer}/index.js +0 -0
  176. /package/dist/{plugin-installer → cjs/plugin-installer}/style.scss +0 -0
  177. /package/dist/{plugin-settings → cjs/plugin-settings}/SettingsSection.js +0 -0
  178. /package/dist/{plugin-settings → cjs/plugin-settings}/index.js +0 -0
  179. /package/dist/{plugin-settings → cjs/plugin-settings}/style.scss +0 -0
  180. /package/dist/{plugin-toggle → cjs/plugin-toggle}/index.js +0 -0
  181. /package/dist/{plugin-toggle → cjs/plugin-toggle}/style.scss +0 -0
  182. /package/dist/{popover → cjs/popover}/index.js +0 -0
  183. /package/dist/{popover → cjs/popover}/style.scss +0 -0
  184. /package/dist/{position-control → cjs/position-control}/index.js +0 -0
  185. /package/dist/{position-control → cjs/position-control}/style.scss +0 -0
  186. /package/dist/{progress-bar → cjs/progress-bar}/index.js +0 -0
  187. /package/dist/{progress-bar → cjs/progress-bar}/index.test.js +0 -0
  188. /package/dist/{progress-bar → cjs/progress-bar}/style.scss +0 -0
  189. /package/dist/{proxied-imports → cjs/proxied-imports}/router.js +0 -0
  190. /package/dist/{radio-control → cjs/radio-control}/index.js +0 -0
  191. /package/dist/{radio-control → cjs/radio-control}/style.scss +0 -0
  192. /package/dist/{section-header → cjs/section-header}/index.js +0 -0
  193. /package/dist/{section-header → cjs/section-header}/style.scss +0 -0
  194. /package/dist/{select-control → cjs/select-control}/ButtonGroupControl.js +0 -0
  195. /package/dist/{select-control → cjs/select-control}/GroupedSelectControl.js +0 -0
  196. /package/dist/{select-control → cjs/select-control}/index.js +0 -0
  197. /package/dist/{select-control → cjs/select-control}/style.scss +0 -0
  198. /package/dist/{settings → cjs/settings}/MinMaxSetting.js +0 -0
  199. /package/dist/{settings → cjs/settings}/SettingsCard.js +0 -0
  200. /package/dist/{settings → cjs/settings}/SettingsSection.js +0 -0
  201. /package/dist/{settings → cjs/settings}/index.js +0 -0
  202. /package/dist/{settings → cjs/settings}/style.scss +0 -0
  203. /package/dist/{sortable-newsletter-list-control → cjs/sortable-newsletter-list-control}/index.js +0 -0
  204. /package/dist/{sortable-newsletter-list-control → cjs/sortable-newsletter-list-control}/style.scss +0 -0
  205. /package/dist/{steps-list → cjs/steps-list}/index.js +0 -0
  206. /package/dist/{steps-list → cjs/steps-list}/style.scss +0 -0
  207. /package/dist/{steps-list-item → cjs/steps-list-item}/index.js +0 -0
  208. /package/dist/{steps-list-item → cjs/steps-list-item}/style.scss +0 -0
  209. /package/dist/{style-card → cjs/style-card}/index.js +0 -0
  210. /package/dist/{style-card → cjs/style-card}/style.scss +0 -0
  211. /package/dist/{style.scss → cjs/style.scss} +0 -0
  212. /package/dist/{tabbed-navigation → cjs/tabbed-navigation}/index.js +0 -0
  213. /package/dist/{tabbed-navigation → cjs/tabbed-navigation}/style.scss +0 -0
  214. /package/dist/{text-control → cjs/text-control}/style.scss +0 -0
  215. /package/dist/{utils → cjs/utils}/index.js +0 -0
  216. /package/dist/{waiting → cjs/waiting}/index.js +0 -0
  217. /package/dist/{waiting → cjs/waiting}/style.scss +0 -0
  218. /package/dist/{web-preview → cjs/web-preview}/index.js +0 -0
  219. /package/dist/{web-preview → cjs/web-preview}/style.scss +0 -0
  220. /package/dist/{with-wizard → cjs/with-wizard}/index.js +0 -0
  221. /package/dist/{with-wizard → cjs/with-wizard}/style.scss +0 -0
  222. /package/dist/{with-wizard-screen → cjs/with-wizard-screen}/index.js +0 -0
  223. /package/dist/{with-wizard-screen → cjs/with-wizard-screen}/style.scss +0 -0
  224. /package/dist/{wizard → cjs/wizard}/components/WizardError.js +0 -0
  225. /package/dist/{wizard → cjs/wizard}/index.js +0 -0
  226. /package/dist/{wizard → cjs/wizard}/store/index.js +0 -0
  227. /package/dist/{wizard → cjs/wizard}/store/utils.js +0 -0
@@ -0,0 +1,127 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { Icon, chevronUp, chevronDown, trash } from '@wordpress/icons';
5
+ import { Notice } from '@wordpress/components';
6
+ import { __ } from '@wordpress/i18n';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import ActionCard from '../action-card';
12
+ import Button from '../button';
13
+ import './style.scss';
14
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
15
+ export default function SortableNewsletterListControl({
16
+ lists,
17
+ selected = [],
18
+ onChange = () => {}
19
+ }) {
20
+ if (!Array.isArray(lists) && lists.errors) {
21
+ return /*#__PURE__*/_jsx(Notice, {
22
+ status: "error",
23
+ isDismissible: false,
24
+ children: Object.values(lists.errors).join(', ')
25
+ });
26
+ }
27
+ const getList = id => lists.find(list => list.id === id);
28
+ const getAvailableLists = () => {
29
+ return lists.filter(list => list.active && !selected.find(({
30
+ id
31
+ }) => id === list.id));
32
+ };
33
+ return /*#__PURE__*/_jsxs("div", {
34
+ className: "newspack__newsletter-list-control",
35
+ children: [/*#__PURE__*/_jsx("div", {
36
+ className: "newspack__newsletter-list-control__selected",
37
+ children: selected.map(selectedList => {
38
+ const list = getList(selectedList.id);
39
+ if (!list) {
40
+ return null;
41
+ }
42
+ return /*#__PURE__*/_jsx(ActionCard, {
43
+ title: list.name,
44
+ description: () => /*#__PURE__*/_jsxs(_Fragment, {
45
+ children: [/*#__PURE__*/_jsx("input", {
46
+ type: "checkbox",
47
+ checked: selectedList.checked,
48
+ onChange: () => {
49
+ const index = selected.findIndex(({
50
+ id
51
+ }) => id === selectedList.id);
52
+ const newSelected = [...selected];
53
+ newSelected[index].checked = !newSelected[index].checked;
54
+ onChange(newSelected);
55
+ }
56
+ }), __('Checked by default', 'newspack-plugin')]
57
+ }),
58
+ isSmall: true,
59
+ actionText: /*#__PURE__*/_jsx(_Fragment, {
60
+ children: /*#__PURE__*/_jsx(Button, {
61
+ onClick: () => onChange(selected.filter(({
62
+ id
63
+ }) => id !== selectedList.id)),
64
+ label: __('Remove', 'newspack-plugin'),
65
+ icon: trash
66
+ })
67
+ }),
68
+ children: selected.length > 1 && /*#__PURE__*/_jsxs("span", {
69
+ className: "newspack__newsletter-list-control__sort-handle",
70
+ children: [/*#__PURE__*/_jsx("button", {
71
+ onClick: () => {
72
+ const index = selected.findIndex(({
73
+ id
74
+ }) => id === selectedList.id);
75
+ if (index === 0) {
76
+ return;
77
+ }
78
+ const newSelected = [...selected];
79
+ newSelected.splice(index, 1);
80
+ newSelected.splice(index - 1, 0, selectedList);
81
+ onChange(newSelected);
82
+ },
83
+ className: selected.findIndex(({
84
+ id
85
+ }) => id === selectedList.id) === 0 ? 'disabled' : '',
86
+ children: /*#__PURE__*/_jsx(Icon, {
87
+ icon: chevronUp
88
+ })
89
+ }), /*#__PURE__*/_jsx("button", {
90
+ onClick: () => {
91
+ const index = selected.findIndex(({
92
+ id
93
+ }) => id === selectedList.id);
94
+ const newSelected = [...selected];
95
+ newSelected.splice(index, 1);
96
+ newSelected.splice(index + 1, 0, selectedList);
97
+ onChange(newSelected);
98
+ },
99
+ className: selected.findIndex(({
100
+ id
101
+ }) => id === selectedList.id) === selected.length - 1 ? 'disabled' : '',
102
+ children: /*#__PURE__*/_jsx(Icon, {
103
+ icon: chevronDown
104
+ })
105
+ })]
106
+ })
107
+ }, `selected-${selectedList.id}`);
108
+ })
109
+ }), getAvailableLists().length > 0 && /*#__PURE__*/_jsxs("p", {
110
+ className: "newspack__newsletter-list-control__lists",
111
+ children: [selected.length > 0 ? /*#__PURE__*/_jsx("strong", {
112
+ children: __('Add more lists:', 'newspack-plugin')
113
+ }) : /*#__PURE__*/_jsx("strong", {
114
+ children: __('Select lists:', 'newspack-plugin')
115
+ }), ' ', getAvailableLists().map(list => {
116
+ return /*#__PURE__*/_jsx(Button, {
117
+ variant: "secondary",
118
+ onClick: () => onChange([...selected, {
119
+ id: list.id,
120
+ checked: true
121
+ }]),
122
+ children: list.name
123
+ }, list.id);
124
+ })]
125
+ })]
126
+ });
127
+ }
@@ -0,0 +1,45 @@
1
+ .newspack__newsletter-list-control {
2
+ &__selected {
3
+ .newspack-card {
4
+ display: flex;
5
+ justify-content: center;
6
+ min-height: 40px;
7
+ flex-direction: row;
8
+ .newspack-action-card__region {
9
+ align-items: center;
10
+ display: flex;
11
+ justify-content: space-between;
12
+ margin: 0;
13
+ }
14
+ .newspack-action-card__region-top {
15
+ flex: 1;
16
+ order: 2;
17
+ }
18
+ .newspack-action-card__region-children {
19
+ padding: 12px;
20
+ }
21
+ }
22
+ }
23
+ &__sort-handle {
24
+ display: flex;
25
+ flex-direction: column;
26
+ justify-content: center;
27
+ align-items: center;
28
+ button {
29
+ background: transparent;
30
+ border: none;
31
+ margin: 0;
32
+ padding: 0;
33
+ height: 20px;
34
+ &.disabled {
35
+ cursor: default;
36
+ opacity: 0.3;
37
+ }
38
+ }
39
+ }
40
+ &__lists {
41
+ button {
42
+ margin-right: 0.5rem;
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Steps List
3
+ */
4
+
5
+ /**
6
+ * WordPress dependencies.
7
+ */
8
+ import { Component } from '@wordpress/element';
9
+
10
+ /**
11
+ * Internal dependencies.
12
+ */
13
+ import { StepsListItem } from '../';
14
+ import './style.scss';
15
+
16
+ /**
17
+ * External dependencies.
18
+ */
19
+ import classnames from 'classnames';
20
+ import { jsx as _jsx } from "react/jsx-runtime";
21
+ class StepsList extends Component {
22
+ /**
23
+ * Render
24
+ */
25
+ render() {
26
+ const {
27
+ className,
28
+ stepsListItems,
29
+ narrowList,
30
+ style = {}
31
+ } = this.props;
32
+ const classes = classnames('steps-list', className, narrowList && 'steps-list__narrow-list');
33
+ return /*#__PURE__*/_jsx("div", {
34
+ className: classes,
35
+ style: style,
36
+ children: stepsListItems.map((listItem, index) => /*#__PURE__*/_jsx(StepsListItem, {
37
+ listItemCount: index + 1,
38
+ listItemText: listItem
39
+ }, index))
40
+ });
41
+ }
42
+ }
43
+ export default StepsList;
@@ -0,0 +1,11 @@
1
+ @use "../../../shared/scss/colors";
2
+ @use "~@wordpress/base-styles/colors" as wp-colors;
3
+
4
+ .steps-list {
5
+ margin-left: auto;
6
+ margin-right: auto;
7
+
8
+ &__narrow-list {
9
+ max-width: 416px;
10
+ }
11
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Steps List Item
3
+ */
4
+
5
+ /**
6
+ * WordPress dependencies.
7
+ */
8
+ import { Component } from '@wordpress/element';
9
+
10
+ /**
11
+ * Internal dependencies.
12
+ */
13
+ import './style.scss';
14
+
15
+ /**
16
+ * External dependencies.
17
+ */
18
+ import classnames from 'classnames';
19
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
+ class StepsListItem extends Component {
21
+ /**
22
+ * Render
23
+ */
24
+ render() {
25
+ const {
26
+ className,
27
+ listItemCount,
28
+ listItemText,
29
+ style = {}
30
+ } = this.props;
31
+ const classes = classnames('steps-list-item', className);
32
+ return /*#__PURE__*/_jsxs("div", {
33
+ className: classes,
34
+ style: style,
35
+ children: [/*#__PURE__*/_jsx("div", {
36
+ className: "steps-list-item__number",
37
+ children: listItemCount
38
+ }), /*#__PURE__*/_jsx("div", {
39
+ className: "steps-list-item__content",
40
+ dangerouslySetInnerHTML: {
41
+ __html: listItemText
42
+ }
43
+ })]
44
+ });
45
+ }
46
+ }
47
+ export default StepsListItem;
@@ -0,0 +1,47 @@
1
+ @use "../../../shared/scss/colors";
2
+ @use "~@wordpress/base-styles/colors" as wp-colors;
3
+
4
+ .steps-list-item {
5
+ align-items: center;
6
+ display: grid;
7
+ grid-template-columns: 28px auto;
8
+ gap: 24px;
9
+ position: relative;
10
+
11
+ &::before {
12
+ border: 1px solid #f0f0f0;
13
+ bottom: -16px;
14
+ content: "";
15
+ display: block;
16
+ left: 14px;
17
+ position: absolute;
18
+ top: -16px;
19
+ }
20
+
21
+ &:first-child::before {
22
+ top: 50%;
23
+ }
24
+
25
+ &:last-child::before {
26
+ bottom: 50%;
27
+ }
28
+
29
+ + .steps-list-item {
30
+ margin-top: 32px;
31
+ }
32
+
33
+ &__number {
34
+ align-items: center;
35
+ background: #fff;
36
+ border: 1px solid currentcolor;
37
+ border-radius: 100%;
38
+ color: colors.$primary-500;
39
+ display: flex;
40
+ height: 28px;
41
+ justify-content: center;
42
+ outline: 8px solid #fff;
43
+ position: relative;
44
+ width: 28px;
45
+ z-index: 2;
46
+ }
47
+ }
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Style Card
3
+ */
4
+
5
+ /**
6
+ * WordPress dependencies.
7
+ */
8
+ import { Component } from '@wordpress/element';
9
+ import { __ } from '@wordpress/i18n';
10
+ import { Button } from '@wordpress/components';
11
+
12
+ /**
13
+ * Internal dependencies
14
+ */
15
+ import { WebPreview } from '../';
16
+ import './style.scss';
17
+
18
+ /**
19
+ * External dependencies
20
+ */
21
+ import classnames from 'classnames';
22
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
+ class StyleCard extends Component {
24
+ /**
25
+ * Render.
26
+ */
27
+ render() {
28
+ const {
29
+ ariaLabel,
30
+ className,
31
+ cardTitle,
32
+ url,
33
+ image,
34
+ imageType,
35
+ isActive,
36
+ onClick,
37
+ id
38
+ } = this.props;
39
+ const classes = classnames('newspack-style-card', isActive && 'newspack-style-card__is-active', className);
40
+ return /*#__PURE__*/_jsxs("div", {
41
+ className: classes,
42
+ id: id,
43
+ children: [/*#__PURE__*/_jsxs("div", {
44
+ className: "newspack-style-card__image",
45
+ children: [imageType === 'html' ? /*#__PURE__*/_jsx("div", {
46
+ dangerouslySetInnerHTML: image
47
+ }) : /*#__PURE__*/_jsx("img", {
48
+ src: image,
49
+ alt: cardTitle + ' ' + __('Thumbnail', 'newspack-plugin')
50
+ }), /*#__PURE__*/_jsxs("div", {
51
+ className: "newspack-style-card__actions",
52
+ children: [isActive ? /*#__PURE__*/_jsx("span", {
53
+ className: "newspack-style-card__actions__badge",
54
+ children: __('Selected', 'newspack-plugin')
55
+ }) : /*#__PURE__*/_jsx(Button, {
56
+ variant: "link",
57
+ onClick: onClick,
58
+ "aria-label": ariaLabel ? ariaLabel : __('Select', 'newspack-plugin') + ' ' + cardTitle,
59
+ tabIndex: "0",
60
+ children: __('Select', 'newspack-plugin')
61
+ }), url && /*#__PURE__*/_jsx(WebPreview, {
62
+ url: url,
63
+ label: __('View Demo', 'newspack-plugin'),
64
+ variant: "link"
65
+ })]
66
+ })]
67
+ }), cardTitle && /*#__PURE__*/_jsx("div", {
68
+ className: "newspack-style-card__title",
69
+ children: cardTitle
70
+ })]
71
+ });
72
+ }
73
+ }
74
+ export default StyleCard;
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Style Card
3
+ */
4
+
5
+ @use "../../../shared/scss/colors";
6
+ @use "~@wordpress/base-styles/colors" as wp-colors;
7
+
8
+ .newspack-style-card {
9
+ margin: 32px 0;
10
+ width: 100%;
11
+
12
+ // Title
13
+ &__title {
14
+ margin: 1em 0 0;
15
+ text-align: center;
16
+
17
+ .newspack-style-card__is-active & {
18
+ color: colors.$primary-500;
19
+ }
20
+ }
21
+
22
+ // Image
23
+ &__image {
24
+ border: 1px solid wp-colors.$gray-300;
25
+ border-radius: 2px;
26
+ overflow: hidden;
27
+ position: relative;
28
+
29
+ &:hover,
30
+ &:focus,
31
+ &:focus-within {
32
+ .newspack-style-card__actions,
33
+ .newspack-style-card__actions > * {
34
+ opacity: 1;
35
+ }
36
+ }
37
+
38
+ img,
39
+ svg {
40
+ display: block;
41
+ height: auto;
42
+ max-width: 100%;
43
+ }
44
+
45
+ svg {
46
+ fill: wp-colors.$gray-600;
47
+ margin: 8px;
48
+ }
49
+
50
+ .newspack-style-card__is-active & {
51
+ border-color: colors.$primary-500;
52
+ box-shadow: inset 0 0 0 1px colors.$primary-500;
53
+
54
+ img {
55
+ position: relative;
56
+ z-index: -1;
57
+ }
58
+ }
59
+ }
60
+
61
+ // Actions
62
+ &__actions {
63
+ align-items: center;
64
+ background: rgba(white, 0.9);
65
+ display: flex;
66
+ flex-direction: column;
67
+ justify-content: center;
68
+ inset: 0;
69
+ opacity: 0;
70
+ padding: 16px;
71
+ position: absolute;
72
+ transition: opacity 125ms ease-in-out;
73
+
74
+ &:empty {
75
+ display: none;
76
+ }
77
+
78
+ &__badge,
79
+ .components-button {
80
+ margin: 4px;
81
+ opacity: 0;
82
+ transition: opacity 125ms ease-in-out;
83
+ }
84
+
85
+ &__badge {
86
+ color: var(--wp-admin-theme-color);
87
+ font-weight: bold;
88
+ }
89
+
90
+ .newspack-style-card__is-active & {
91
+ box-shadow: inset 0 0 0 1px colors.$primary-500;
92
+ }
93
+ }
94
+ }
@@ -0,0 +1,55 @@
1
+ @use "~@wordpress/base-styles/colors" as wp-colors;
2
+
3
+ // Buttons Card
4
+
5
+ .newspack-buttons-card {
6
+ display: flex;
7
+ flex-direction: row-reverse;
8
+ gap: 16px;
9
+ justify-content: flex-start;
10
+ align-items: center;
11
+ margin: 64px 0 32px;
12
+
13
+ &:empty {
14
+ display: none;
15
+ }
16
+ }
17
+
18
+ // Checkboxes
19
+ .newspack-checkbox-control {
20
+ margin-top: 0 !important;
21
+ .components-checkbox-control__label {
22
+ font-weight: 600;
23
+ }
24
+
25
+ .components-base-control__help {
26
+ margin-left: 32px;
27
+ margin-top: 0;
28
+ }
29
+ }
30
+
31
+ // Checkbox Icon
32
+ .newspack-checkbox-icon {
33
+ background: white;
34
+ border-radius: 50%;
35
+ box-shadow: inset 0 0 0 1px wp-colors.$gray-300;
36
+ display: block;
37
+ height: 24px;
38
+ width: 24px;
39
+
40
+ svg {
41
+ fill: wp-colors.$gray-700;
42
+ }
43
+
44
+ &--checked {
45
+ background: wp-colors.$alert-green;
46
+ box-shadow: none;
47
+
48
+ svg {
49
+ fill: white;
50
+ }
51
+ }
52
+ &--pending {
53
+ background: wp-colors.$alert-yellow;
54
+ }
55
+ }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * External dependencies.
3
+ */
4
+ import classnames from 'classnames';
5
+ import findIndex from 'lodash/findIndex';
6
+ import Router from '../proxied-imports/router';
7
+
8
+ /**
9
+ * Internal dependencies.
10
+ */
11
+ import './style.scss';
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ const {
14
+ NavLink,
15
+ useHistory
16
+ } = Router;
17
+ const TabbedNavigation = ({
18
+ items,
19
+ className,
20
+ disableUpcoming,
21
+ children = null
22
+ }) => {
23
+ const displayedItems = items.filter(item => !item.isHiddenInTabbedNavigation);
24
+ const {
25
+ location
26
+ } = useHistory();
27
+ const currentIndex = findIndex(displayedItems, ['path', location.pathname]);
28
+ return /*#__PURE__*/_jsxs("div", {
29
+ className: classnames('newspack-tabbed-navigation', className),
30
+ children: [/*#__PURE__*/_jsx("ul", {
31
+ children: displayedItems.map((item, index) => /*#__PURE__*/_jsx("li", {
32
+ children: /*#__PURE__*/_jsx(NavLink, {
33
+ to: item.path,
34
+ isActive: (match, {
35
+ pathname
36
+ }) => {
37
+ if (item.activeTabPaths) {
38
+ return item.activeTabPaths.includes(pathname);
39
+ }
40
+ return match;
41
+ },
42
+ exact: true,
43
+ activeClassName: 'selected',
44
+ className: classnames({
45
+ disabled: disableUpcoming && index > currentIndex
46
+ }),
47
+ children: item.label
48
+ })
49
+ }, index))
50
+ }), children]
51
+ });
52
+ };
53
+ export default TabbedNavigation;
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Tabbed Navigation
3
+ */
4
+
5
+ @use "~@wordpress/base-styles/colors" as wp-colors;
6
+
7
+ .newspack-tabbed-navigation {
8
+ background: white;
9
+ width: 100%;
10
+
11
+ @media only screen and ( min-width: 600px ) {
12
+ position: sticky;
13
+ top: 46px;
14
+ z-index: 3;
15
+ }
16
+
17
+ @media only screen and ( min-width: 783px ) {
18
+ top: 32px;
19
+ }
20
+
21
+ ul {
22
+ box-shadow: 0 -1px 0 inset wp-colors.$gray-300;
23
+ display: flex;
24
+ flex-wrap: wrap;
25
+ margin: 0;
26
+ }
27
+
28
+ li {
29
+ margin-bottom: 0;
30
+ width: 100%;
31
+
32
+ @media screen and ( min-width: 600px ) {
33
+ width: auto;
34
+ }
35
+
36
+ a {
37
+ align-items: center;
38
+ color: wp-colors.$gray-900;
39
+ display: flex;
40
+ font-weight: bold;
41
+ height: 48px;
42
+ padding: 12px 15px;
43
+ text-decoration: none;
44
+
45
+ @media screen and ( min-width: 600px ) {
46
+ border-bottom: 4px solid transparent;
47
+ padding-bottom: 8px;
48
+ }
49
+
50
+ &:active,
51
+ &:focus,
52
+ &:hover {
53
+ color: var(--wp-admin-theme-color);
54
+ outline: none;
55
+ }
56
+
57
+ &:focus {
58
+ box-shadow: none;
59
+ }
60
+
61
+ &:focus-visible {
62
+ outline: 2px solid;
63
+ outline-offset: -2px;
64
+ }
65
+
66
+ &.selected {
67
+ box-shadow: inset 0 0 0 2px white, inset 0 0 0 4px var(--wp-admin-theme-color);
68
+
69
+ @media screen and ( min-width: 600px ) {
70
+ border-color: var(--wp-admin-theme-color);
71
+ box-shadow: none;
72
+ }
73
+ }
74
+
75
+ &.disabled {
76
+ cursor: not-allowed;
77
+ opacity: 0.3;
78
+ pointer-events: none;
79
+
80
+ &:hover {
81
+ color: inherit;
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }