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
@@ -6,13 +6,13 @@
6
6
  * WordPress dependencies
7
7
  */
8
8
  import { Component } from '@wordpress/element';
9
- import { ExternalLink } from '@wordpress/components';
9
+ import { ExternalLink, ToggleControl } from '@wordpress/components';
10
10
  import { Icon, check } from '@wordpress/icons';
11
11
 
12
12
  /**
13
13
  * Internal dependencies
14
14
  */
15
- import { Button, Card, Handoff, Notice, ToggleControl, Waiting } from '../';
15
+ import { Button, Card, Grid, Handoff, Notice, Waiting } from '../';
16
16
  import './style.scss';
17
17
 
18
18
  /**
@@ -43,10 +43,13 @@ class ActionCard extends Component {
43
43
  notification,
44
44
  notificationLevel,
45
45
  notificationHTML,
46
+ actionContent,
46
47
  actionText,
47
48
  secondaryActionText,
49
+ secondaryDestructive,
48
50
  image,
49
51
  imageLink,
52
+ indent,
50
53
  isSmall,
51
54
  isMedium,
52
55
  simple,
@@ -57,6 +60,7 @@ class ActionCard extends Component {
57
60
  toggleChecked,
58
61
  toggleOnChange,
59
62
  hasGreyHeader,
63
+ isPending,
60
64
  } = this.props;
61
65
  const hasChildren = notification || children;
62
66
  const classes = classnames(
@@ -64,6 +68,7 @@ class ActionCard extends Component {
64
68
  simple && 'newspack-card--is-clickable',
65
69
  hasGreyHeader && 'newspack-card--has-grey-header',
66
70
  hasChildren && 'newspack-card--has-children',
71
+ indent && 'newspack-card--indent',
67
72
  isSmall && 'is-small',
68
73
  isMedium && 'is-medium',
69
74
  className
@@ -101,7 +106,8 @@ class ActionCard extends Component {
101
106
  className={ classnames(
102
107
  'newspack-checkbox-icon',
103
108
  'is-primary',
104
- 'checked' === checkbox && 'newspack-checkbox-icon--checked'
109
+ 'checked' === checkbox && 'newspack-checkbox-icon--checked',
110
+ isPending && 'newspack-checkbox-icon--pending'
105
111
  ) }
106
112
  >
107
113
  { 'checked' === checkbox && <Icon icon={ check } /> }
@@ -109,25 +115,30 @@ class ActionCard extends Component {
109
115
  </div>
110
116
  ) }
111
117
  <div className="newspack-action-card__region newspack-action-card__region-center">
112
- <h2>
113
- <span className="newspack-action-card__title" { ...titleProps }>
114
- { titleLink ? <a href={ titleLink }>{ title }</a> : title }
115
- </span>
116
- { badges?.length &&
117
- badges.map( ( badgeText, i ) => (
118
- <span key={ `badge-${ i }` } className="newspack-action-card__badge">
119
- { badgeText }
120
- </span>
121
- ) ) }
122
- </h2>
123
- <p>
124
- { typeof description === 'string' && description }
125
- { typeof description === 'function' && description() }
126
- </p>
118
+ <Grid columns={ 1 } gutter={ 8 } noMargin>
119
+ <h2>
120
+ <span className="newspack-action-card__title" { ...titleProps }>
121
+ { titleLink ? <a href={ titleLink }>{ title }</a> : title }
122
+ </span>
123
+ { badges?.length &&
124
+ badges.map( ( badgeText, i ) => (
125
+ <span key={ `badge-${ i }` } className="newspack-action-card__badge">
126
+ { badgeText }
127
+ </span>
128
+ ) ) }
129
+ </h2>
130
+ { description && (
131
+ <p>
132
+ { typeof description === 'string' && description }
133
+ { typeof description === 'function' && description() }
134
+ </p>
135
+ ) }
136
+ </Grid>
127
137
  </div>
128
- { ( actionText || isDisplayingSecondaryAction ) && (
138
+ { ( actionText || isDisplayingSecondaryAction || actionContent ) && (
129
139
  <div className="newspack-action-card__region newspack-action-card__region-right">
130
140
  { /* eslint-disable no-nested-ternary */ }
141
+ { actionContent && actionContent }
131
142
  { actionText &&
132
143
  ( handoff ? (
133
144
  <Handoff plugin={ handoff } editLink={ editLink } compact isLink>
@@ -158,6 +169,7 @@ class ActionCard extends Component {
158
169
  isLink
159
170
  onClick={ onSecondaryActionClick }
160
171
  className="newspack-action-card__secondary_button"
172
+ isDestructive={ secondaryDestructive }
161
173
  >
162
174
  { secondaryActionText }
163
175
  </Button>
@@ -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
  }
@@ -190,7 +190,7 @@ const AutocompleteWithSuggestions = ( {
190
190
  { selectedMessage }
191
191
  { 1 < selections.length && _x( ' – ', 'separator character', 'newspack' ) }
192
192
  { 1 < selections.length && (
193
- <Button onClick={ () => onChange( [] ) } isLink>
193
+ <Button onClick={ () => onChange( [] ) } isLink isDestructive>
194
194
  { __( 'Clear all', 'newspack' ) }
195
195
  </Button>
196
196
  ) }
@@ -241,7 +241,9 @@ const AutocompleteWithSuggestions = ( {
241
241
  if ( multiSelect ) {
242
242
  const selections = selectedPost ? [ ...selectedItems, selectedPost ] : [ ...selectedItems ];
243
243
  const isSelected = !! selections.find(
244
- _selection => parseInt( _selection.value ) === parseInt( suggestion.value )
244
+ _selection =>
245
+ parseInt( _selection.value ) === parseInt( suggestion.value ) &&
246
+ _selection.label === suggestion.label
245
247
  );
246
248
  return (
247
249
  <CheckboxControl
@@ -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 {
@@ -14,19 +14,12 @@ import { useState } from '@wordpress/element';
14
14
  import Router from '../proxied-imports/router';
15
15
  import './style.scss';
16
16
 
17
- /**
18
- * External dependencies
19
- */
20
- import classnames from 'classnames';
21
-
22
17
  const { useHistory } = Router;
23
18
 
24
- const Button = ( { className, isQuaternary, href, onClick, ...otherProps } ) => {
19
+ const Button = ( { href, onClick, ...otherProps } ) => {
25
20
  const history = useHistory();
26
21
  const [ isAwaitingOnClick, setIsAwaitingOnClick ] = useState( false );
27
22
 
28
- const classes = classnames( 'newspack-button', isQuaternary && 'is-quaternary', className );
29
-
30
23
  // If both onClick and href are present, await the onClick action an then redirect.
31
24
  if ( href && onClick ) {
32
25
  otherProps.onClick = async () => {
@@ -42,7 +35,7 @@ const Button = ( { className, isQuaternary, href, onClick, ...otherProps } ) =>
42
35
  if ( isAwaitingOnClick ) {
43
36
  otherProps.disabled = true;
44
37
  }
45
- return <BaseComponent className={ classes } { ...otherProps } />;
38
+ return <BaseComponent { ...otherProps } />;
46
39
  };
47
40
 
48
41
  export default Button;