newspack-components 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/copy-styles.js +1 -1
  2. package/dist/cjs/action-card/index.js +32 -22
  3. package/dist/cjs/action-card/style.scss +52 -27
  4. package/dist/cjs/autocomplete-tokenfield/style.scss +4 -4
  5. package/dist/cjs/autocomplete-with-suggestions/index.js +3 -2
  6. package/dist/cjs/autocomplete-with-suggestions/style.scss +19 -20
  7. package/dist/cjs/button/index.js +2 -13
  8. package/dist/cjs/button/style.scss +3 -344
  9. package/dist/cjs/button-card/index.js +11 -6
  10. package/dist/cjs/button-card/style.scss +69 -35
  11. package/dist/cjs/card/index.js +3 -1
  12. package/dist/cjs/card/style.scss +34 -61
  13. package/dist/cjs/category-autocomplete/index.js +52 -13
  14. package/dist/cjs/category-autocomplete/style.scss +19 -15
  15. package/dist/cjs/color-picker/index.js +17 -35
  16. package/dist/cjs/color-picker/style.scss +20 -160
  17. package/dist/cjs/custom-select-control/style.scss +12 -42
  18. package/dist/cjs/footer/index.js +21 -7
  19. package/dist/cjs/footer/style.scss +9 -10
  20. package/dist/cjs/form-token-field/index.js +2 -2
  21. package/dist/cjs/form-token-field/style.scss +8 -103
  22. package/dist/cjs/global-notices/index.js +2 -1
  23. package/dist/cjs/grid/index.js +1 -1
  24. package/dist/cjs/grid/style.scss +29 -1
  25. package/dist/cjs/handoff/index.js +7 -7
  26. package/dist/cjs/image-upload/index.js +1 -1
  27. package/dist/cjs/image-upload/style.scss +10 -11
  28. package/dist/cjs/index.js +7 -53
  29. package/dist/cjs/modal/index.js +0 -3
  30. package/dist/cjs/modal/style.scss +19 -131
  31. package/dist/cjs/newspack-icon/index.js +4 -2
  32. package/dist/cjs/newspack-icon/style.scss +15 -0
  33. package/dist/cjs/notice/index.js +8 -9
  34. package/dist/cjs/notice/style.scss +38 -10
  35. package/dist/cjs/plugin-installer/index.js +4 -2
  36. package/dist/cjs/plugin-settings/SettingsSection.js +76 -45
  37. package/dist/cjs/plugin-settings/index.js +49 -34
  38. package/dist/cjs/plugin-settings/style.scss +7 -0
  39. package/dist/cjs/plugin-toggle/index.js +22 -1
  40. package/dist/cjs/popover/style.scss +2 -2
  41. package/dist/cjs/radio-control/style.scss +1 -2
  42. package/dist/cjs/section-header/index.js +18 -5
  43. package/dist/cjs/section-header/style.scss +26 -1
  44. package/dist/cjs/select-control/ButtonGroupControl.js +8 -8
  45. package/dist/cjs/select-control/GroupedSelectControl.js +33 -30
  46. package/dist/cjs/select-control/index.js +1 -2
  47. package/dist/cjs/select-control/style.scss +46 -87
  48. package/dist/cjs/settings/MinMaxSetting.js +4 -2
  49. package/dist/cjs/settings/SettingsCard.js +6 -1
  50. package/dist/cjs/settings/SettingsSection.js +4 -4
  51. package/dist/cjs/settings/style.scss +32 -4
  52. package/dist/cjs/style-card/index.js +10 -6
  53. package/dist/cjs/style-card/style.scss +12 -8
  54. package/dist/cjs/style.scss +44 -0
  55. package/dist/cjs/tabbed-navigation/index.js +13 -20
  56. package/dist/cjs/tabbed-navigation/style.scss +56 -34
  57. package/dist/cjs/text-control/index.js +0 -3
  58. package/dist/cjs/text-control/style.scss +0 -126
  59. package/dist/cjs/waiting/index.js +9 -25
  60. package/dist/cjs/waiting/style.scss +9 -20
  61. package/dist/cjs/web-preview/index.js +18 -30
  62. package/dist/cjs/web-preview/style.scss +33 -26
  63. package/dist/cjs/with-wizard/index.js +4 -2
  64. package/dist/cjs/with-wizard/style.scss +77 -89
  65. package/dist/cjs/with-wizard-screen/index.js +17 -21
  66. package/dist/cjs/with-wizard-screen/style.scss +74 -121
  67. package/dist/cjs/wizard/components/WizardError.js +86 -0
  68. package/dist/cjs/wizard/index.js +145 -0
  69. package/dist/cjs/wizard/store/index.js +178 -0
  70. package/dist/cjs/wizard/store/utils.js +31 -0
  71. package/dist/esm/action-card/index.js +33 -23
  72. package/dist/esm/action-card/style.scss +52 -27
  73. package/dist/esm/autocomplete-tokenfield/style.scss +4 -4
  74. package/dist/esm/autocomplete-with-suggestions/index.js +3 -2
  75. package/dist/esm/autocomplete-with-suggestions/style.scss +19 -20
  76. package/dist/esm/button/index.js +2 -12
  77. package/dist/esm/button/style.scss +3 -344
  78. package/dist/esm/button-card/index.js +10 -6
  79. package/dist/esm/button-card/style.scss +69 -35
  80. package/dist/esm/card/index.js +3 -1
  81. package/dist/esm/card/style.scss +34 -61
  82. package/dist/esm/category-autocomplete/index.js +54 -14
  83. package/dist/esm/category-autocomplete/style.scss +19 -15
  84. package/dist/esm/color-picker/index.js +15 -34
  85. package/dist/esm/color-picker/style.scss +20 -160
  86. package/dist/esm/custom-select-control/style.scss +12 -42
  87. package/dist/esm/footer/index.js +21 -7
  88. package/dist/esm/footer/style.scss +9 -10
  89. package/dist/esm/form-token-field/index.js +2 -2
  90. package/dist/esm/form-token-field/style.scss +8 -103
  91. package/dist/esm/global-notices/index.js +2 -1
  92. package/dist/esm/grid/index.js +1 -1
  93. package/dist/esm/grid/style.scss +29 -1
  94. package/dist/esm/handoff/index.js +7 -7
  95. package/dist/esm/image-upload/index.js +1 -1
  96. package/dist/esm/image-upload/style.scss +10 -11
  97. package/dist/esm/index.js +3 -8
  98. package/dist/esm/modal/index.js +0 -3
  99. package/dist/esm/modal/style.scss +19 -131
  100. package/dist/esm/newspack-icon/index.js +4 -2
  101. package/dist/esm/newspack-icon/style.scss +15 -0
  102. package/dist/esm/notice/index.js +8 -3
  103. package/dist/esm/notice/style.scss +38 -10
  104. package/dist/esm/plugin-installer/index.js +5 -2
  105. package/dist/esm/plugin-settings/SettingsSection.js +74 -46
  106. package/dist/esm/plugin-settings/index.js +48 -34
  107. package/dist/esm/plugin-settings/style.scss +7 -0
  108. package/dist/esm/plugin-toggle/index.js +23 -1
  109. package/dist/esm/popover/style.scss +2 -2
  110. package/dist/esm/radio-control/style.scss +1 -2
  111. package/dist/esm/section-header/index.js +17 -5
  112. package/dist/esm/section-header/style.scss +26 -1
  113. package/dist/esm/select-control/ButtonGroupControl.js +8 -8
  114. package/dist/esm/select-control/GroupedSelectControl.js +33 -30
  115. package/dist/esm/select-control/index.js +1 -2
  116. package/dist/esm/select-control/style.scss +46 -87
  117. package/dist/esm/settings/MinMaxSetting.js +3 -2
  118. package/dist/esm/settings/SettingsCard.js +6 -1
  119. package/dist/esm/settings/SettingsSection.js +5 -5
  120. package/dist/esm/settings/style.scss +32 -4
  121. package/dist/esm/style-card/index.js +11 -8
  122. package/dist/esm/style-card/style.scss +12 -8
  123. package/dist/esm/style.scss +44 -0
  124. package/dist/esm/tabbed-navigation/index.js +14 -22
  125. package/dist/esm/tabbed-navigation/style.scss +56 -34
  126. package/dist/esm/text-control/index.js +0 -3
  127. package/dist/esm/text-control/style.scss +0 -126
  128. package/dist/esm/waiting/index.js +9 -22
  129. package/dist/esm/waiting/style.scss +9 -20
  130. package/dist/esm/web-preview/index.js +12 -25
  131. package/dist/esm/web-preview/style.scss +33 -26
  132. package/dist/esm/with-wizard/index.js +4 -2
  133. package/dist/esm/with-wizard/style.scss +77 -89
  134. package/dist/esm/with-wizard-screen/index.js +18 -22
  135. package/dist/esm/with-wizard-screen/style.scss +74 -121
  136. package/dist/esm/wizard/components/WizardError.js +78 -0
  137. package/dist/esm/wizard/index.js +128 -0
  138. package/dist/esm/wizard/store/index.js +161 -0
  139. package/dist/esm/wizard/store/utils.js +17 -0
  140. package/package.json +2 -1
  141. package/shared/scss/_colors.scss +15 -0
  142. package/src/action-card/index.js +31 -19
  143. package/src/action-card/style.scss +52 -27
  144. package/src/autocomplete-tokenfield/style.scss +4 -4
  145. package/src/autocomplete-with-suggestions/index.js +4 -2
  146. package/src/autocomplete-with-suggestions/style.scss +19 -20
  147. package/src/button/index.js +2 -9
  148. package/src/button/style.scss +3 -344
  149. package/src/button-card/index.js +19 -5
  150. package/src/button-card/style.scss +69 -35
  151. package/src/card/index.js +4 -0
  152. package/src/card/style.scss +34 -61
  153. package/src/category-autocomplete/index.js +51 -18
  154. package/src/category-autocomplete/style.scss +19 -15
  155. package/src/color-picker/index.js +16 -22
  156. package/src/color-picker/style.scss +20 -160
  157. package/src/custom-select-control/style.scss +12 -42
  158. package/src/footer/index.js +19 -8
  159. package/src/footer/style.scss +9 -10
  160. package/src/form-token-field/index.js +1 -1
  161. package/src/form-token-field/style.scss +8 -103
  162. package/src/global-notices/index.js +1 -1
  163. package/src/grid/index.js +1 -1
  164. package/src/grid/style.scss +29 -1
  165. package/src/handoff/index.js +7 -7
  166. package/src/image-upload/style.scss +10 -11
  167. package/src/index.js +3 -7
  168. package/src/modal/index.js +2 -5
  169. package/src/modal/style.scss +19 -131
  170. package/src/newspack-icon/index.js +7 -2
  171. package/src/newspack-icon/style.scss +15 -0
  172. package/src/notice/index.js +7 -1
  173. package/src/notice/style.scss +38 -10
  174. package/src/plugin-installer/index.js +4 -2
  175. package/src/plugin-settings/SettingsSection.js +65 -27
  176. package/src/plugin-settings/index.js +45 -18
  177. package/src/plugin-settings/style.scss +7 -0
  178. package/src/plugin-toggle/index.js +35 -9
  179. package/src/popover/style.scss +2 -2
  180. package/src/radio-control/style.scss +1 -2
  181. package/src/section-header/index.js +25 -6
  182. package/src/section-header/style.scss +26 -1
  183. package/src/select-control/ButtonGroupControl.js +13 -6
  184. package/src/select-control/GroupedSelectControl.js +26 -24
  185. package/src/select-control/index.js +1 -2
  186. package/src/select-control/style.scss +46 -87
  187. package/src/settings/MinMaxSetting.js +2 -1
  188. package/src/settings/SettingsCard.js +9 -7
  189. package/src/settings/SettingsSection.js +4 -4
  190. package/src/settings/style.scss +32 -4
  191. package/src/style-card/index.js +14 -16
  192. package/src/style-card/style.scss +12 -8
  193. package/src/style.scss +44 -0
  194. package/src/tabbed-navigation/index.js +12 -24
  195. package/src/tabbed-navigation/style.scss +56 -34
  196. package/src/text-control/index.js +1 -2
  197. package/src/text-control/style.scss +0 -126
  198. package/src/waiting/index.js +7 -18
  199. package/src/waiting/style.scss +9 -20
  200. package/src/web-preview/index.js +12 -33
  201. package/src/web-preview/style.scss +33 -26
  202. package/src/with-wizard/index.js +7 -5
  203. package/src/with-wizard/style.scss +77 -89
  204. package/src/with-wizard-screen/index.js +14 -17
  205. package/src/with-wizard-screen/style.scss +74 -121
  206. package/src/wizard/components/WizardError.js +57 -0
  207. package/src/wizard/index.js +133 -0
  208. package/src/wizard/store/index.js +126 -0
  209. package/src/wizard/store/utils.js +16 -0
  210. package/dist/cjs/button-group/index.js +0 -57
  211. package/dist/cjs/button-group/style.scss +0 -68
  212. package/dist/cjs/checkbox-control/index.js +0 -63
  213. package/dist/cjs/checkbox-control/style.scss +0 -78
  214. package/dist/cjs/preview-box/index.js +0 -36
  215. package/dist/cjs/preview-box/style.scss +0 -18
  216. package/dist/cjs/textarea-control/index.js +0 -54
  217. package/dist/cjs/textarea-control/style.scss +0 -76
  218. package/dist/cjs/toggle-control/index.js +0 -58
  219. package/dist/cjs/toggle-control/style.scss +0 -74
  220. package/dist/cjs/toggle-group/index.js +0 -71
  221. package/dist/cjs/toggle-group/style.scss +0 -28
  222. package/dist/cjs/wizard-pagination/index.js +0 -71
  223. package/dist/cjs/wizard-pagination/style.scss +0 -74
  224. package/dist/esm/button-group/index.js +0 -43
  225. package/dist/esm/button-group/style.scss +0 -68
  226. package/dist/esm/checkbox-control/index.js +0 -49
  227. package/dist/esm/checkbox-control/style.scss +0 -78
  228. package/dist/esm/preview-box/index.js +0 -30
  229. package/dist/esm/preview-box/style.scss +0 -18
  230. package/dist/esm/textarea-control/index.js +0 -40
  231. package/dist/esm/textarea-control/style.scss +0 -76
  232. package/dist/esm/toggle-control/index.js +0 -44
  233. package/dist/esm/toggle-control/style.scss +0 -74
  234. package/dist/esm/toggle-group/index.js +0 -58
  235. package/dist/esm/toggle-group/style.scss +0 -28
  236. package/dist/esm/wizard-pagination/index.js +0 -57
  237. package/dist/esm/wizard-pagination/style.scss +0 -74
  238. package/src/button-group/index.js +0 -35
  239. package/src/button-group/style.scss +0 -68
  240. package/src/checkbox-control/index.js +0 -38
  241. package/src/checkbox-control/style.scss +0 -78
  242. package/src/preview-box/index.js +0 -18
  243. package/src/preview-box/style.scss +0 -18
  244. package/src/textarea-control/index.js +0 -32
  245. package/src/textarea-control/style.scss +0 -76
  246. package/src/toggle-control/index.js +0 -38
  247. package/src/toggle-control/style.scss +0 -74
  248. package/src/toggle-group/index.js +0 -43
  249. package/src/toggle-group/style.scss +0 -28
  250. package/src/wizard-pagination/index.js +0 -59
  251. package/src/wizard-pagination/style.scss +0 -74
@@ -8,13 +8,13 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
8
  * WordPress dependencies
9
9
  */
10
10
  import { Component } from '@wordpress/element';
11
- import { ExternalLink } from '@wordpress/components';
11
+ import { ExternalLink, ToggleControl } from '@wordpress/components';
12
12
  import { Icon, check } from '@wordpress/icons';
13
13
  /**
14
14
  * Internal dependencies
15
15
  */
16
16
 
17
- import { Button, Card, Handoff, Notice, ToggleControl, Waiting } from '../';
17
+ import { Button, Card, Grid, Handoff, Notice, Waiting } from '../';
18
18
  import './style.scss';
19
19
  /**
20
20
  * External dependencies
@@ -53,10 +53,13 @@ class ActionCard extends Component {
53
53
  notification,
54
54
  notificationLevel,
55
55
  notificationHTML,
56
+ actionContent,
56
57
  actionText,
57
58
  secondaryActionText,
59
+ secondaryDestructive,
58
60
  image,
59
61
  imageLink,
62
+ indent,
60
63
  isSmall,
61
64
  isMedium,
62
65
  simple,
@@ -66,10 +69,11 @@ class ActionCard extends Component {
66
69
  titleLink,
67
70
  toggleChecked,
68
71
  toggleOnChange,
69
- hasGreyHeader
72
+ hasGreyHeader,
73
+ isPending
70
74
  } = this.props;
71
75
  const hasChildren = notification || children;
72
- const classes = classnames('newspack-action-card', simple && 'newspack-card--is-clickable', hasGreyHeader && 'newspack-card--has-grey-header', hasChildren && 'newspack-card--has-children', isSmall && 'is-small', isMedium && 'is-medium', className);
76
+ const classes = classnames('newspack-action-card', simple && 'newspack-card--is-clickable', hasGreyHeader && 'newspack-card--has-grey-header', hasChildren && 'newspack-card--has-children', indent && 'newspack-card--indent', isSmall && 'is-small', isMedium && 'is-medium', className);
73
77
  const titleProps = toggleOnChange && !titleLink && !disabled ? {
74
78
  onClick: () => toggleOnChange(!toggleChecked),
75
79
  tabIndex: '0'
@@ -98,31 +102,36 @@ class ActionCard extends Component {
98
102
  }), checkbox && !toggleOnChange && _jsx("div", {
99
103
  className: "newspack-action-card__region newspack-action-card__region-left",
100
104
  children: _jsx("span", {
101
- className: classnames('newspack-checkbox-icon', 'is-primary', 'checked' === checkbox && 'newspack-checkbox-icon--checked'),
105
+ className: classnames('newspack-checkbox-icon', 'is-primary', 'checked' === checkbox && 'newspack-checkbox-icon--checked', isPending && 'newspack-checkbox-icon--pending'),
102
106
  children: 'checked' === checkbox && _jsx(Icon, {
103
107
  icon: check
104
108
  })
105
109
  })
106
- }), _jsxs("div", {
110
+ }), _jsx("div", {
107
111
  className: "newspack-action-card__region newspack-action-card__region-center",
108
- children: [_jsxs("h2", {
109
- children: [_jsx("span", {
110
- className: "newspack-action-card__title",
111
- ...titleProps,
112
- children: titleLink ? _jsx("a", {
113
- href: titleLink,
114
- children: title
115
- }) : title
116
- }), (badges === null || badges === void 0 ? void 0 : badges.length) && badges.map((badgeText, i) => _jsx("span", {
117
- className: "newspack-action-card__badge",
118
- children: badgeText
119
- }, `badge-${i}`))]
120
- }), _jsxs("p", {
121
- children: [typeof description === 'string' && description, typeof description === 'function' && description()]
122
- })]
123
- }), (actionText || isDisplayingSecondaryAction) && _jsxs("div", {
112
+ children: _jsxs(Grid, {
113
+ columns: 1,
114
+ gutter: 8,
115
+ noMargin: true,
116
+ children: [_jsxs("h2", {
117
+ children: [_jsx("span", {
118
+ className: "newspack-action-card__title",
119
+ ...titleProps,
120
+ children: titleLink ? _jsx("a", {
121
+ href: titleLink,
122
+ children: title
123
+ }) : title
124
+ }), badges?.length && badges.map((badgeText, i) => _jsx("span", {
125
+ className: "newspack-action-card__badge",
126
+ children: badgeText
127
+ }, `badge-${i}`))]
128
+ }), description && _jsxs("p", {
129
+ children: [typeof description === 'string' && description, typeof description === 'function' && description()]
130
+ })]
131
+ })
132
+ }), (actionText || isDisplayingSecondaryAction || actionContent) && _jsxs("div", {
124
133
  className: "newspack-action-card__region newspack-action-card__region-right",
125
- children: [actionText && (handoff ? _jsx(Handoff, {
134
+ children: [actionContent && actionContent, actionText && (handoff ? _jsx(Handoff, {
126
135
  plugin: handoff,
127
136
  editLink: editLink,
128
137
  compact: true,
@@ -147,6 +156,7 @@ class ActionCard extends Component {
147
156
  isLink: true,
148
157
  onClick: onSecondaryActionClick,
149
158
  className: "newspack-action-card__secondary_button",
159
+ isDestructive: secondaryDestructive,
150
160
  children: secondaryActionText
151
161
  })]
152
162
  })]
@@ -3,7 +3,6 @@
3
3
  */
4
4
 
5
5
  @import '~@wordpress/base-styles/colors';
6
- @import '../../../shared/scss/colors';
7
6
 
8
7
  .newspack-card.newspack-action-card {
9
8
  padding: 0;
@@ -34,7 +33,7 @@
34
33
  }
35
34
 
36
35
  &.newspack-card__is-primary {
37
- box-shadow: inset 4px 0 0 $primary-500;
36
+ box-shadow: inset 4px 0 0 var( --wp-admin-theme-color );
38
37
  }
39
38
 
40
39
  &.newspack-card__is-secondary {
@@ -150,20 +149,49 @@
150
149
 
151
150
  &.newspack-card--has-grey-header {
152
151
  overflow: hidden;
152
+
153
153
  &.newspack-card--has-children {
154
154
  .newspack-action-card__region-top {
155
155
  border-bottom: 1px solid $gray-300;
156
156
  }
157
157
  }
158
+
158
159
  .newspack-action-card__region-top {
159
- background-color: $gray-100;
160
+ background-color: rgba( black, 0.025 );
161
+ }
162
+
163
+ .newspack-action-card__region-center {
164
+ p {
165
+ color: darken( $gray-700, 0.75% );
166
+ }
167
+ }
168
+ }
169
+
170
+ // Indent
171
+
172
+ &.newspack-card--indent {
173
+ margin-left: 56px;
174
+ position: relative;
175
+
176
+ &::before {
177
+ border: 0 solid $gray-300;
178
+ border-left-width: 1px;
179
+ border-bottom-width: 1px;
180
+ border-radius: 0 0 0 2px;
181
+ bottom: 50%;
182
+ content: '';
183
+ display: block;
184
+ left: -28px;
185
+ position: absolute;
186
+ right: 100%;
187
+ top: -17px;
160
188
  }
161
189
  }
162
190
 
163
191
  // Typography
164
192
 
165
193
  h2,
166
- p {
194
+ p:not( [class*='components-base-control'] ) {
167
195
  margin: 0;
168
196
  max-width: 100%;
169
197
  width: 100%;
@@ -186,7 +214,7 @@
186
214
  &:active,
187
215
  &:focus,
188
216
  &:hover {
189
- color: $primary-500;
217
+ color: var( --wp-admin-theme-color );
190
218
  }
191
219
  }
192
220
  }
@@ -270,6 +298,14 @@
270
298
  align-items: flex-start;
271
299
  flex: 1 1 auto;
272
300
  flex-wrap: wrap;
301
+
302
+ .newspack-grid {
303
+ width: 100%;
304
+ }
305
+
306
+ p {
307
+ color: $gray-700;
308
+ }
273
309
  }
274
310
 
275
311
  .newspack-action-card__region-right {
@@ -289,6 +325,10 @@
289
325
  > * {
290
326
  text-align: inherit;
291
327
  }
328
+
329
+ .newspack-action-card__secondary_button {
330
+ margin-top: 8px;
331
+ }
292
332
  }
293
333
 
294
334
  // Waiting
@@ -326,34 +366,19 @@
326
366
  margin: 0;
327
367
  }
328
368
 
329
- // Buttons
330
-
331
- .newspack-button {
332
- &.newspack-action-card__secondary_button {
333
- &.is-link {
334
- color: $alert-red;
335
-
336
- &:active,
337
- &:focus,
338
- &:hover {
339
- color: darken( $alert-red, 20% );
340
- }
341
- }
342
- }
343
- }
344
-
345
369
  // Badge
346
370
 
347
371
  .newspack-action-card__badge {
348
- border: 1px solid $gray-300;
349
- border-radius: 12px;
372
+ background: $gray-100;
373
+ border-radius: 2px;
374
+ color: $gray-900;
350
375
  display: block;
351
376
  flex: 0 0 auto;
352
- font-size: 12px;
377
+ font-size: 10px;
353
378
  font-weight: bold;
354
- line-height: 16px;
355
- margin: 3px 8px 3px 0;
356
- padding: 0 8px;
379
+ line-height: 1.4;
380
+ margin: 0 8px 0 0;
381
+ padding: 2px 8px;
357
382
  text-transform: uppercase;
358
383
 
359
384
  + .newspack-action-card__badge {
@@ -2,16 +2,16 @@
2
2
  * Autocomplete Token Field
3
3
  */
4
4
 
5
- @import '../../../shared/scss/colors';
6
5
  @import '~@wordpress/base-styles/colors';
7
6
 
8
7
  .newspack-autocomplete-tokenfield {
9
8
  position: relative;
10
9
 
11
10
  .components-spinner {
11
+ margin: 8px;
12
12
  position: absolute;
13
- right: 1rem;
14
- top: 1rem;
13
+ right: 0;
14
+ top: calc( 1.4em + 8px );
15
15
  }
16
16
 
17
17
  /* Workaround for hard-coded help text in FormTokenField. */
@@ -38,6 +38,6 @@
38
38
  }
39
39
 
40
40
  .components-button:focus:not( :disabled ) {
41
- box-shadow: inset 0 0 0 2px $primary-500;
41
+ box-shadow: inset 0 0 0 var( --wp-admin-border-width-focus ) var( --wp-admin-theme-color );
42
42
  }
43
43
  }
@@ -144,7 +144,7 @@ const AutocompleteWithSuggestions = _ref => {
144
144
  return posts.reduce((acc, post) => {
145
145
  acc.push({
146
146
  value: parseInt(post.id),
147
- label: decodeEntities(post === null || post === void 0 ? void 0 : post.title.rendered) || __('(no title)', 'newspack')
147
+ label: decodeEntities(post?.title.rendered) || __('(no title)', 'newspack')
148
148
  });
149
149
  return acc;
150
150
  }, []);
@@ -197,6 +197,7 @@ const AutocompleteWithSuggestions = _ref => {
197
197
  children: [selectedMessage, 1 < selections.length && _x(' – ', 'separator character', 'newspack'), 1 < selections.length && _jsx(Button, {
198
198
  onClick: () => onChange([]),
199
199
  isLink: true,
200
+ isDestructive: true,
200
201
  children: __('Clear all', 'newspack')
201
202
  })]
202
203
  }), selections.map(selection => _jsx(Button, {
@@ -234,7 +235,7 @@ const AutocompleteWithSuggestions = _ref => {
234
235
  const renderSuggestion = suggestion => {
235
236
  if (multiSelect) {
236
237
  const selections = selectedPost ? [...selectedItems, selectedPost] : [...selectedItems];
237
- const isSelected = !!selections.find(_selection => parseInt(_selection.value) === parseInt(suggestion.value));
238
+ const isSelected = !!selections.find(_selection => parseInt(_selection.value) === parseInt(suggestion.value) && _selection.label === suggestion.label);
238
239
  return _jsx(CheckboxControl, {
239
240
  checked: isSelected,
240
241
  onChange: () => handleOnChange([suggestion]),
@@ -2,7 +2,6 @@
2
2
  * Styles for AutocompleteWithSuggestions component.
3
3
  */
4
4
 
5
- @import '../../../shared/scss/colors';
6
5
  @import '~@wordpress/base-styles/colors';
7
6
 
8
7
  .newspack-autocomplete-with-suggestions {
@@ -18,8 +17,9 @@
18
17
  }
19
18
 
20
19
  .components-spinner {
20
+ margin: 8px;
21
21
  right: 0;
22
- top: 2em;
22
+ top: calc( 1.4em + 8px );
23
23
  }
24
24
 
25
25
  .components-select-control__input {
@@ -27,7 +27,7 @@
27
27
  }
28
28
 
29
29
  .components-input-control__backdrop {
30
- border-color: $gray-900 !important;
30
+ border-color: $gray-700 !important;
31
31
  }
32
32
 
33
33
  .newspack-autocomplete-with-suggestions__label,
@@ -39,7 +39,7 @@
39
39
 
40
40
  &__suggestions-spinner {
41
41
  background: $gray-100;
42
- border: 1px solid $gray-900;
42
+ border: 1px solid $gray-700;
43
43
  border-radius: 2px;
44
44
  cursor: progress;
45
45
  margin: 16px 0;
@@ -49,6 +49,7 @@
49
49
  display: block;
50
50
  margin: 0 auto;
51
51
  position: relative;
52
+ right: auto;
52
53
  top: 0;
53
54
  }
54
55
  }
@@ -59,11 +60,11 @@
59
60
 
60
61
  .components-form-token-field {
61
62
  &__input-container {
62
- border-color: $gray-900;
63
+ border-color: $gray-700;
63
64
  }
64
65
 
65
66
  &__suggestions-list {
66
- border-top-color: $gray-900;
67
+ border-top-color: $gray-700;
67
68
  margin: 4px -4px -2px;
68
69
  }
69
70
 
@@ -74,32 +75,30 @@
74
75
 
75
76
  p.newspack-autocomplete-with-suggestions__label {
76
77
  font-size: inherit;
77
- margin-bottom: 4px;
78
+ margin: 0 0 8px;
78
79
  }
79
80
 
80
81
  &__selected-items {
81
- border-bottom: 1px solid $gray-300;
82
+ border-bottom: 1px solid $gray-700;
83
+ display: flex;
84
+ flex-wrap: wrap;
85
+ gap: 8px;
82
86
  margin-bottom: 16px;
83
87
  padding-bottom: 12px;
84
88
 
85
- .newspack-autocomplete-with-suggestions__label {
86
- font-weight: bold;
87
-
88
- .components-button.is-link {
89
- color: $alert-red;
90
- font-weight: normal;
91
- }
89
+ p.newspack-autocomplete-with-suggestions__label {
90
+ flex: 0 0 100%;
91
+ margin: 0;
92
92
  }
93
93
  }
94
94
 
95
95
  &__selected-item-button.components-button.is-tertiary {
96
96
  background-color: $gray-300;
97
97
  border-radius: 2px;
98
- color: #1e1e1e;
98
+ color: $gray-900;
99
99
  font-size: 13px;
100
100
  height: auto;
101
- margin-bottom: 4px;
102
- margin-right: 4px;
101
+ margin: 0;
103
102
  padding-left: 8px;
104
103
  padding-right: 8px;
105
104
 
@@ -117,7 +116,7 @@
117
116
  &__search-suggestions,
118
117
  &__search-suggestions-multiselect {
119
118
  border-radius: 2px;
120
- border: 1px solid $gray-900;
119
+ border: 1px solid $gray-700;
121
120
  max-height: 178px;
122
121
  overflow-x: visible;
123
122
  overflow-y: auto;
@@ -151,7 +150,7 @@
151
150
 
152
151
  &__search-suggestions {
153
152
  border-radius: 2px;
154
- border: 1px solid $gray-900;
153
+ border: 1px solid $gray-700;
155
154
  padding: 0;
156
155
 
157
156
  .components-button {
@@ -13,11 +13,6 @@ import { useState } from '@wordpress/element';
13
13
 
14
14
  import Router from '../proxied-imports/router';
15
15
  import './style.scss';
16
- /**
17
- * External dependencies
18
- */
19
-
20
- import classnames from 'classnames';
21
16
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
22
17
  const {
23
18
  useHistory
@@ -25,15 +20,12 @@ const {
25
20
 
26
21
  const Button = _ref => {
27
22
  let {
28
- className,
29
- isQuaternary,
30
23
  href,
31
24
  onClick,
32
25
  ...otherProps
33
26
  } = _ref;
34
27
  const history = useHistory();
35
- const [isAwaitingOnClick, setIsAwaitingOnClick] = useState(false);
36
- const classes = classnames('newspack-button', isQuaternary && 'is-quaternary', className); // If both onClick and href are present, await the onClick action an then redirect.
28
+ const [isAwaitingOnClick, setIsAwaitingOnClick] = useState(false); // If both onClick and href are present, await the onClick action an then redirect.
37
29
 
38
30
  if (href && onClick) {
39
31
  otherProps.onClick = async () => {
@@ -51,9 +43,7 @@ const Button = _ref => {
51
43
  otherProps.disabled = true;
52
44
  }
53
45
 
54
- return _jsx(BaseComponent, {
55
- className: classes,
56
- ...otherProps
46
+ return _jsx(BaseComponent, { ...otherProps
57
47
  });
58
48
  };
59
49