newspack-components 2.0.3 → 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 (248) hide show
  1. package/copy-styles.js +1 -1
  2. package/dist/cjs/action-card/index.js +29 -20
  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 +60 -30
  11. package/dist/cjs/card/index.js +3 -1
  12. package/dist/cjs/card/style.scss +29 -62
  13. package/dist/cjs/category-autocomplete/index.js +52 -13
  14. package/dist/cjs/category-autocomplete/style.scss +20 -22
  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/style.scss +14 -1
  24. package/dist/cjs/handoff/index.js +7 -7
  25. package/dist/cjs/image-upload/index.js +1 -1
  26. package/dist/cjs/image-upload/style.scss +10 -11
  27. package/dist/cjs/index.js +7 -53
  28. package/dist/cjs/modal/index.js +0 -3
  29. package/dist/cjs/modal/style.scss +19 -131
  30. package/dist/cjs/newspack-icon/index.js +4 -2
  31. package/dist/cjs/newspack-icon/style.scss +15 -0
  32. package/dist/cjs/notice/index.js +8 -9
  33. package/dist/cjs/notice/style.scss +38 -10
  34. package/dist/cjs/plugin-installer/index.js +1 -1
  35. package/dist/cjs/plugin-settings/SettingsSection.js +74 -43
  36. package/dist/cjs/plugin-settings/index.js +34 -30
  37. package/dist/cjs/plugin-settings/style.scss +7 -0
  38. package/dist/cjs/plugin-toggle/index.js +22 -1
  39. package/dist/cjs/popover/style.scss +2 -2
  40. package/dist/cjs/radio-control/style.scss +1 -2
  41. package/dist/cjs/section-header/index.js +18 -5
  42. package/dist/cjs/section-header/style.scss +22 -1
  43. package/dist/cjs/select-control/ButtonGroupControl.js +8 -8
  44. package/dist/cjs/select-control/GroupedSelectControl.js +33 -30
  45. package/dist/cjs/select-control/index.js +1 -2
  46. package/dist/cjs/select-control/style.scss +46 -87
  47. package/dist/cjs/settings/MinMaxSetting.js +4 -2
  48. package/dist/cjs/settings/SettingsCard.js +6 -1
  49. package/dist/cjs/settings/SettingsSection.js +4 -4
  50. package/dist/cjs/settings/style.scss +32 -4
  51. package/dist/cjs/style-card/index.js +10 -6
  52. package/dist/cjs/style-card/style.scss +12 -8
  53. package/dist/cjs/style.scss +44 -0
  54. package/dist/cjs/tabbed-navigation/index.js +13 -20
  55. package/dist/cjs/tabbed-navigation/style.scss +56 -34
  56. package/dist/cjs/text-control/index.js +0 -3
  57. package/dist/cjs/text-control/style.scss +0 -126
  58. package/dist/cjs/waiting/index.js +9 -25
  59. package/dist/cjs/waiting/style.scss +9 -20
  60. package/dist/cjs/web-preview/index.js +18 -30
  61. package/dist/cjs/web-preview/style.scss +33 -26
  62. package/dist/cjs/with-wizard/index.js +4 -2
  63. package/dist/cjs/with-wizard/style.scss +44 -89
  64. package/dist/cjs/with-wizard-screen/index.js +17 -21
  65. package/dist/cjs/with-wizard-screen/style.scss +74 -121
  66. package/dist/cjs/wizard/components/WizardError.js +86 -0
  67. package/dist/cjs/wizard/index.js +145 -0
  68. package/dist/cjs/wizard/store/index.js +178 -0
  69. package/dist/cjs/wizard/store/utils.js +31 -0
  70. package/dist/esm/action-card/index.js +30 -21
  71. package/dist/esm/action-card/style.scss +52 -27
  72. package/dist/esm/autocomplete-tokenfield/style.scss +4 -4
  73. package/dist/esm/autocomplete-with-suggestions/index.js +3 -2
  74. package/dist/esm/autocomplete-with-suggestions/style.scss +19 -20
  75. package/dist/esm/button/index.js +2 -12
  76. package/dist/esm/button/style.scss +3 -344
  77. package/dist/esm/button-card/index.js +10 -6
  78. package/dist/esm/button-card/style.scss +60 -30
  79. package/dist/esm/card/index.js +3 -1
  80. package/dist/esm/card/style.scss +29 -62
  81. package/dist/esm/category-autocomplete/index.js +54 -14
  82. package/dist/esm/category-autocomplete/style.scss +20 -22
  83. package/dist/esm/color-picker/index.js +15 -34
  84. package/dist/esm/color-picker/style.scss +20 -160
  85. package/dist/esm/custom-select-control/style.scss +12 -42
  86. package/dist/esm/footer/index.js +21 -7
  87. package/dist/esm/footer/style.scss +9 -10
  88. package/dist/esm/form-token-field/index.js +2 -2
  89. package/dist/esm/form-token-field/style.scss +8 -103
  90. package/dist/esm/global-notices/index.js +2 -1
  91. package/dist/esm/grid/style.scss +14 -1
  92. package/dist/esm/handoff/index.js +7 -7
  93. package/dist/esm/image-upload/index.js +1 -1
  94. package/dist/esm/image-upload/style.scss +10 -11
  95. package/dist/esm/index.js +3 -8
  96. package/dist/esm/modal/index.js +0 -3
  97. package/dist/esm/modal/style.scss +19 -131
  98. package/dist/esm/newspack-icon/index.js +4 -2
  99. package/dist/esm/newspack-icon/style.scss +15 -0
  100. package/dist/esm/notice/index.js +8 -3
  101. package/dist/esm/notice/style.scss +38 -10
  102. package/dist/esm/plugin-installer/index.js +2 -1
  103. package/dist/esm/plugin-settings/SettingsSection.js +72 -44
  104. package/dist/esm/plugin-settings/index.js +34 -30
  105. package/dist/esm/plugin-settings/style.scss +7 -0
  106. package/dist/esm/plugin-toggle/index.js +23 -1
  107. package/dist/esm/popover/style.scss +2 -2
  108. package/dist/esm/radio-control/style.scss +1 -2
  109. package/dist/esm/section-header/index.js +17 -5
  110. package/dist/esm/section-header/style.scss +22 -1
  111. package/dist/esm/select-control/ButtonGroupControl.js +8 -8
  112. package/dist/esm/select-control/GroupedSelectControl.js +33 -30
  113. package/dist/esm/select-control/index.js +1 -2
  114. package/dist/esm/select-control/style.scss +46 -87
  115. package/dist/esm/settings/MinMaxSetting.js +3 -2
  116. package/dist/esm/settings/SettingsCard.js +6 -1
  117. package/dist/esm/settings/SettingsSection.js +5 -5
  118. package/dist/esm/settings/style.scss +32 -4
  119. package/dist/esm/style-card/index.js +11 -8
  120. package/dist/esm/style-card/style.scss +12 -8
  121. package/dist/esm/style.scss +44 -0
  122. package/dist/esm/tabbed-navigation/index.js +14 -22
  123. package/dist/esm/tabbed-navigation/style.scss +56 -34
  124. package/dist/esm/text-control/index.js +0 -3
  125. package/dist/esm/text-control/style.scss +0 -126
  126. package/dist/esm/waiting/index.js +9 -22
  127. package/dist/esm/waiting/style.scss +9 -20
  128. package/dist/esm/web-preview/index.js +12 -25
  129. package/dist/esm/web-preview/style.scss +33 -26
  130. package/dist/esm/with-wizard/index.js +4 -2
  131. package/dist/esm/with-wizard/style.scss +44 -89
  132. package/dist/esm/with-wizard-screen/index.js +18 -22
  133. package/dist/esm/with-wizard-screen/style.scss +74 -121
  134. package/dist/esm/wizard/components/WizardError.js +78 -0
  135. package/dist/esm/wizard/index.js +128 -0
  136. package/dist/esm/wizard/store/index.js +161 -0
  137. package/dist/esm/wizard/store/utils.js +17 -0
  138. package/package.json +1 -1
  139. package/shared/scss/_colors.scss +15 -0
  140. package/src/action-card/index.js +28 -18
  141. package/src/action-card/style.scss +52 -27
  142. package/src/autocomplete-tokenfield/style.scss +4 -4
  143. package/src/autocomplete-with-suggestions/index.js +4 -2
  144. package/src/autocomplete-with-suggestions/style.scss +19 -20
  145. package/src/button/index.js +2 -9
  146. package/src/button/style.scss +3 -344
  147. package/src/button-card/index.js +19 -5
  148. package/src/button-card/style.scss +60 -30
  149. package/src/card/index.js +4 -0
  150. package/src/card/style.scss +29 -62
  151. package/src/category-autocomplete/index.js +51 -18
  152. package/src/category-autocomplete/style.scss +20 -22
  153. package/src/color-picker/index.js +16 -22
  154. package/src/color-picker/style.scss +20 -160
  155. package/src/custom-select-control/style.scss +12 -42
  156. package/src/footer/index.js +19 -8
  157. package/src/footer/style.scss +9 -10
  158. package/src/form-token-field/index.js +1 -1
  159. package/src/form-token-field/style.scss +8 -103
  160. package/src/global-notices/index.js +1 -1
  161. package/src/grid/style.scss +14 -1
  162. package/src/handoff/index.js +7 -7
  163. package/src/image-upload/style.scss +10 -11
  164. package/src/index.js +3 -7
  165. package/src/modal/index.js +2 -5
  166. package/src/modal/style.scss +19 -131
  167. package/src/newspack-icon/index.js +7 -2
  168. package/src/newspack-icon/style.scss +15 -0
  169. package/src/notice/index.js +7 -1
  170. package/src/notice/style.scss +38 -10
  171. package/src/plugin-installer/index.js +2 -2
  172. package/src/plugin-settings/SettingsSection.js +64 -26
  173. package/src/plugin-settings/index.js +23 -7
  174. package/src/plugin-settings/style.scss +7 -0
  175. package/src/plugin-toggle/index.js +35 -9
  176. package/src/popover/style.scss +2 -2
  177. package/src/radio-control/style.scss +1 -2
  178. package/src/section-header/index.js +25 -6
  179. package/src/section-header/style.scss +22 -1
  180. package/src/select-control/ButtonGroupControl.js +13 -6
  181. package/src/select-control/GroupedSelectControl.js +26 -24
  182. package/src/select-control/index.js +1 -2
  183. package/src/select-control/style.scss +46 -87
  184. package/src/settings/MinMaxSetting.js +2 -1
  185. package/src/settings/SettingsCard.js +9 -7
  186. package/src/settings/SettingsSection.js +4 -4
  187. package/src/settings/style.scss +32 -4
  188. package/src/style-card/index.js +14 -16
  189. package/src/style-card/style.scss +12 -8
  190. package/src/style.scss +44 -0
  191. package/src/tabbed-navigation/index.js +12 -24
  192. package/src/tabbed-navigation/style.scss +56 -34
  193. package/src/text-control/index.js +1 -2
  194. package/src/text-control/style.scss +0 -126
  195. package/src/waiting/index.js +7 -18
  196. package/src/waiting/style.scss +9 -20
  197. package/src/web-preview/index.js +12 -33
  198. package/src/web-preview/style.scss +33 -26
  199. package/src/with-wizard/index.js +7 -5
  200. package/src/with-wizard/style.scss +44 -89
  201. package/src/with-wizard-screen/index.js +14 -17
  202. package/src/with-wizard-screen/style.scss +74 -121
  203. package/src/wizard/components/WizardError.js +57 -0
  204. package/src/wizard/index.js +133 -0
  205. package/src/wizard/store/index.js +126 -0
  206. package/src/wizard/store/utils.js +16 -0
  207. package/dist/cjs/button-group/index.js +0 -57
  208. package/dist/cjs/button-group/style.scss +0 -73
  209. package/dist/cjs/checkbox-control/index.js +0 -63
  210. package/dist/cjs/checkbox-control/style.scss +0 -78
  211. package/dist/cjs/preview-box/index.js +0 -36
  212. package/dist/cjs/preview-box/style.scss +0 -18
  213. package/dist/cjs/textarea-control/index.js +0 -54
  214. package/dist/cjs/textarea-control/style.scss +0 -76
  215. package/dist/cjs/toggle-control/index.js +0 -58
  216. package/dist/cjs/toggle-control/style.scss +0 -74
  217. package/dist/cjs/toggle-group/index.js +0 -71
  218. package/dist/cjs/toggle-group/style.scss +0 -28
  219. package/dist/cjs/wizard-pagination/index.js +0 -71
  220. package/dist/cjs/wizard-pagination/style.scss +0 -74
  221. package/dist/esm/button-group/index.js +0 -43
  222. package/dist/esm/button-group/style.scss +0 -73
  223. package/dist/esm/checkbox-control/index.js +0 -49
  224. package/dist/esm/checkbox-control/style.scss +0 -78
  225. package/dist/esm/preview-box/index.js +0 -30
  226. package/dist/esm/preview-box/style.scss +0 -18
  227. package/dist/esm/textarea-control/index.js +0 -40
  228. package/dist/esm/textarea-control/style.scss +0 -76
  229. package/dist/esm/toggle-control/index.js +0 -44
  230. package/dist/esm/toggle-control/style.scss +0 -74
  231. package/dist/esm/toggle-group/index.js +0 -58
  232. package/dist/esm/toggle-group/style.scss +0 -28
  233. package/dist/esm/wizard-pagination/index.js +0 -57
  234. package/dist/esm/wizard-pagination/style.scss +0 -74
  235. package/src/button-group/index.js +0 -35
  236. package/src/button-group/style.scss +0 -73
  237. package/src/checkbox-control/index.js +0 -38
  238. package/src/checkbox-control/style.scss +0 -78
  239. package/src/preview-box/index.js +0 -18
  240. package/src/preview-box/style.scss +0 -18
  241. package/src/textarea-control/index.js +0 -32
  242. package/src/textarea-control/style.scss +0 -76
  243. package/src/toggle-control/index.js +0 -38
  244. package/src/toggle-control/style.scss +0 -74
  245. package/src/toggle-group/index.js +0 -43
  246. package/src/toggle-group/style.scss +0 -28
  247. package/src/wizard-pagination/index.js +0 -59
  248. package/src/wizard-pagination/style.scss +0 -74
@@ -15,14 +15,19 @@ const SettingsCard = _ref => {
15
15
  className,
16
16
  columns,
17
17
  gutter,
18
+ noBorder,
19
+ rowGap,
18
20
  ...props
19
21
  } = _ref;
22
+ const classes = classnames('newspack-settings__card', noBorder && 'newspack-settings__no-border', className);
20
23
  return _jsx(ActionCard, { ...props,
21
- className: classnames(className, 'newspack-settings__card'),
24
+ className: classes,
22
25
  notificationLevel: "info",
26
+ noBorder: noBorder,
23
27
  children: _jsx(Grid, {
24
28
  columns: columns,
25
29
  gutter: gutter,
30
+ rowGap: rowGap,
26
31
  children: children
27
32
  })
28
33
  });
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Internal dependencies.
3
3
  */
4
- import { Card, InfoButton } from '../';
4
+ import { Grid, InfoButton } from '../';
5
5
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
6
6
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
7
7
 
@@ -11,13 +11,13 @@ const SettingSection = _ref => {
11
11
  description,
12
12
  children
13
13
  } = _ref;
14
- return _jsxs(Card, {
15
- isSmall: true,
16
- noBorder: true,
14
+ return _jsxs(Grid, {
15
+ columns: 1,
16
+ gutter: 8,
17
17
  className: "newspack-settings__section",
18
18
  children: [_jsxs("div", {
19
19
  className: "newspack-settings__section__title",
20
- children: [_jsx("h3", {
20
+ children: [_jsx("span", {
21
21
  children: title
22
22
  }), description && _jsx(InfoButton, {
23
23
  text: description
@@ -28,11 +28,12 @@
28
28
 
29
29
  .newspack-settings__section {
30
30
  &__title {
31
+ align-items: center;
31
32
  display: flex;
32
33
  margin: 0;
33
34
 
34
- h3 {
35
- margin: 0;
35
+ span {
36
+ line-height: 24px;
36
37
  }
37
38
  }
38
39
  &__content {
@@ -42,7 +43,7 @@
42
43
  align-items: center;
43
44
  justify-content: space-between;
44
45
  flex-wrap: wrap;
45
- > * {
46
+ > *:not( [class*='help'] ):not( [class*='label'] ) {
46
47
  margin: 0;
47
48
  }
48
49
  }
@@ -58,8 +59,10 @@
58
59
  }
59
60
  }
60
61
  .newspack-settings__min-max {
62
+ gap: 8px;
63
+
61
64
  .newspack-checkbox-control {
62
- flex: 0 0 64px;
65
+ flex: 0 0 auto;
63
66
  }
64
67
 
65
68
  .newspack-text-control {
@@ -75,4 +78,29 @@
75
78
  }
76
79
  }
77
80
  }
81
+
82
+ &__no-border {
83
+ &.newspack-card.newspack-action-card {
84
+ border: 0;
85
+
86
+ .newspack-action-card__region-top,
87
+ .newspack-action-card__region-children {
88
+ padding-left: 0;
89
+ padding-right: 0;
90
+ padding-top: 0;
91
+ }
92
+
93
+ .newspack-action-card__region-children {
94
+ padding-bottom: 0;
95
+ }
96
+
97
+ .newspack-action-card__notification {
98
+ padding-bottom: 16px;
99
+ }
100
+
101
+ & + & {
102
+ margin-top: 64px;
103
+ }
104
+ }
105
+ }
78
106
  }
@@ -7,12 +7,13 @@
7
7
  */
8
8
  import { Component } from '@wordpress/element';
9
9
  import { __ as alias__ } from '@wordpress/i18n';
10
+ const __ = alias__;
11
+ import { Button } from '@wordpress/components';
10
12
  /**
11
13
  * Internal dependencies
12
14
  */
13
15
 
14
- const __ = alias__;
15
- import { Button, WebPreview } from '../';
16
+ import { WebPreview } from '../';
16
17
  import './style.scss';
17
18
  /**
18
19
  * External dependencies
@@ -51,21 +52,23 @@ class StyleCard extends Component {
51
52
  alt: cardTitle + ' ' + __('Thumbnail', 'newspack')
52
53
  }), _jsxs("div", {
53
54
  className: "newspack-style-card__actions",
54
- children: [!isActive && _jsx(Button, {
55
- isLink: true,
55
+ children: [isActive ? _jsx("span", {
56
+ className: "newspack-style-card__actions__badge",
57
+ children: __('Selected', 'newspack')
58
+ }) : _jsx(Button, {
59
+ variant: "link",
56
60
  onClick: onClick,
57
- "aria-label": ariaLabel ? ariaLabel : __('Activate', 'newspack') + ' ' + cardTitle,
61
+ "aria-label": ariaLabel ? ariaLabel : __('Select', 'newspack') + ' ' + cardTitle,
58
62
  tabIndex: "0",
59
- children: __('Activate', 'newspack')
63
+ children: __('Select', 'newspack')
60
64
  }), url && _jsx(WebPreview, {
61
65
  url: url,
62
66
  label: __('View Demo', 'newspack'),
63
- isLink: true
67
+ variant: "link"
64
68
  })]
65
69
  })]
66
70
  }), cardTitle && _jsx("div", {
67
71
  className: "newspack-style-card__title",
68
- title: isActive ? __('Active', 'newspack') : null,
69
72
  children: cardTitle
70
73
  })]
71
74
  });
@@ -11,9 +11,7 @@
11
11
 
12
12
  // Title
13
13
  &__title {
14
- color: $gray-900;
15
- font-weight: bold;
16
- margin: 16px 0 0;
14
+ margin: 1em 0 0;
17
15
  text-align: center;
18
16
 
19
17
  .newspack-style-card__is-active & {
@@ -24,7 +22,7 @@
24
22
  // Image
25
23
  &__image {
26
24
  border: 1px solid $gray-300;
27
- border-radius: 3px;
25
+ border-radius: 2px;
28
26
  overflow: hidden;
29
27
  position: relative;
30
28
 
@@ -32,7 +30,7 @@
32
30
  &:focus,
33
31
  &:focus-within {
34
32
  .newspack-style-card__actions,
35
- .newspack-style-card__actions .newspack-button {
33
+ .newspack-style-card__actions > * {
36
34
  opacity: 1;
37
35
  }
38
36
  }
@@ -51,7 +49,7 @@
51
49
 
52
50
  .newspack-style-card__is-active & {
53
51
  border-color: $primary-500;
54
- box-shadow: inset 0 0 0 2px $primary-500;
52
+ box-shadow: inset 0 0 0 1px $primary-500;
55
53
 
56
54
  img {
57
55
  position: relative;
@@ -80,14 +78,20 @@
80
78
  display: none;
81
79
  }
82
80
 
83
- .newspack-button {
81
+ &__badge,
82
+ .components-button {
84
83
  margin: 4px;
85
84
  opacity: 0;
86
85
  transition: opacity 125ms ease-in-out;
87
86
  }
88
87
 
88
+ &__badge {
89
+ color: var( --wp-admin-theme-color );
90
+ font-weight: bold;
91
+ }
92
+
89
93
  .newspack-style-card__is-active & {
90
- box-shadow: inset 0 0 0 2px $primary-500;
94
+ box-shadow: inset 0 0 0 1px $primary-500;
91
95
  }
92
96
  }
93
97
  }
@@ -0,0 +1,44 @@
1
+ @import '~@wordpress/base-styles/colors';
2
+ @import '../../shared/scss/colors';
3
+
4
+ // Buttons Card
5
+
6
+ .newspack-buttons-card {
7
+ display: flex;
8
+ flex-direction: row-reverse;
9
+ gap: 16px;
10
+ justify-content: flex-start;
11
+ align-items: center;
12
+ margin: 64px 0 32px;
13
+
14
+ &:empty {
15
+ display: none;
16
+ }
17
+ }
18
+
19
+ // Checkbox Icon
20
+
21
+ .newspack-checkbox-icon {
22
+ background: white;
23
+ border-radius: 50%;
24
+ box-shadow: inset 0 0 0 1px $gray-300;
25
+ display: block;
26
+ height: 24px;
27
+ width: 24px;
28
+
29
+ svg {
30
+ fill: $gray-700;
31
+ }
32
+
33
+ &--checked {
34
+ background: $alert-green;
35
+ box-shadow: none;
36
+
37
+ svg {
38
+ fill: white;
39
+ }
40
+ }
41
+ &--pending {
42
+ background: $alert-yellow;
43
+ }
44
+ }
@@ -1,11 +1,8 @@
1
- /**
2
- * Tabbed Navigation
3
- */
4
-
5
1
  /**
6
2
  * External dependencies.
7
3
  */
8
- import classNames from 'classnames';
4
+ import classnames from 'classnames';
5
+ import { findIndex } from 'lodash';
9
6
  import Router from '../proxied-imports/router';
10
7
  /**
11
8
  * Internal dependencies.
@@ -17,36 +14,31 @@ const {
17
14
  NavLink,
18
15
  useHistory
19
16
  } = Router;
20
- /**
21
- * Tabbed navigation.
22
- */
23
17
 
24
18
  const TabbedNavigation = _ref => {
25
19
  let {
26
20
  items,
27
- className
21
+ className,
22
+ disableUpcoming
28
23
  } = _ref;
29
- const classes = classNames('newspack-tabbed-navigation', className);
30
24
  const {
31
- location: {
32
- pathname
33
- }
34
- } = useHistory(); // eslint-disable-next-line no-unused-vars
35
-
36
- const [_, firstPathPart] = pathname.split('/');
25
+ location
26
+ } = useHistory();
27
+ const currentIndex = findIndex(items, ['path', location.pathname]);
37
28
  return _jsx("div", {
38
- className: classes,
29
+ className: classnames('newspack-tabbed-navigation', className),
39
30
  children: _jsx("ul", {
40
- children: items.map((item, key) => _jsx("li", {
31
+ children: items.map((item, index) => _jsx("li", {
41
32
  children: _jsx(NavLink, {
42
33
  to: item.path,
43
- exact: item.exact,
44
- className: classNames({
45
- selected: item.path === '/' ? pathname === item.path : firstPathPart === item.path.replace(/\//g, '')
34
+ exact: true,
35
+ activeClassName: 'selected',
36
+ className: classnames({
37
+ disabled: disableUpcoming && index > currentIndex
46
38
  }),
47
39
  children: item.label
48
40
  })
49
- }, key))
41
+ }, index))
50
42
  })
51
43
  });
52
44
  };
@@ -6,12 +6,23 @@
6
6
  @import '../../../shared/scss/colors';
7
7
 
8
8
  .newspack-tabbed-navigation {
9
+ background: white;
10
+ width: 100%;
11
+
12
+ @media only screen and ( min-width: 600px ) {
13
+ position: sticky;
14
+ top: 46px;
15
+ z-index: 3;
16
+ }
17
+
18
+ @media only screen and ( min-width: 783px ) {
19
+ top: 32px;
20
+ }
21
+
9
22
  ul {
10
23
  box-shadow: 0 -1px 0 inset $gray-300;
11
24
  display: flex;
12
25
  flex-wrap: wrap;
13
- font-size: 14px;
14
- line-height: 24px;
15
26
  margin: 0;
16
27
  }
17
28
 
@@ -22,43 +33,54 @@
22
33
  @media screen and ( min-width: 600px ) {
23
34
  width: auto;
24
35
  }
25
- }
26
36
 
27
- a {
28
- border-bottom: 4px solid transparent;
29
- color: $gray-900;
30
- display: block;
31
- font-weight: bold;
32
- padding: 12px 16px 8px;
33
- text-decoration: none;
34
-
35
- &:active,
36
- &:focus,
37
- &:hover {
38
- color: $primary-500;
39
- outline: none;
40
- }
37
+ a {
38
+ align-items: center;
39
+ color: $gray-900;
40
+ display: flex;
41
+ font-weight: bold;
42
+ height: 48px;
43
+ padding: 12px 15px;
44
+ text-decoration: none;
41
45
 
42
- &:focus {
43
- box-shadow: none;
44
- }
46
+ @media screen and ( min-width: 600px ) {
47
+ border-bottom: 4px solid transparent;
48
+ padding-bottom: 8px;
49
+ }
45
50
 
46
- &:focus-visible {
47
- outline: 3px solid;
48
- outline-offset: -3px;
49
- }
51
+ &:active,
52
+ &:focus,
53
+ &:hover {
54
+ color: var( --wp-admin-theme-color );
55
+ outline: none;
56
+ }
50
57
 
51
- &.selected {
52
- border-bottom-width: 0;
53
- border-left: 4px solid $primary-500;
54
- padding-bottom: 12px;
58
+ &:focus {
59
+ box-shadow: none;
60
+ }
55
61
 
56
- @media screen and ( min-width: 600px ) {
57
- border-bottom-width: 4px;
58
- border-color: $primary-500;
59
- border-left-width: 0;
60
- padding-bottom: 8px;
61
- padding-left: 16px;
62
+ &:focus-visible {
63
+ outline: 2px solid;
64
+ outline-offset: -2px;
65
+ }
66
+
67
+ &.selected {
68
+ box-shadow: inset 0 0 0 2px white, inset 0 0 0 4px var( --wp-admin-theme-color );
69
+
70
+ @media screen and ( min-width: 600px ) {
71
+ border-color: var( --wp-admin-theme-color );
72
+ box-shadow: none;
73
+ }
74
+ }
75
+
76
+ &.disabled {
77
+ cursor: not-allowed;
78
+ opacity: 0.3;
79
+ pointer-events: none;
80
+
81
+ &:hover {
82
+ color: inherit;
83
+ }
62
84
  }
63
85
  }
64
86
  }
@@ -45,14 +45,11 @@ class TextControl extends Component {
45
45
  const {
46
46
  className,
47
47
  required,
48
- isSmall,
49
48
  isWide,
50
49
  withMargin = true,
51
50
  ...otherProps
52
51
  } = this.props;
53
52
  const classes = classNames('newspack-text-control', {
54
- 'newspack-text-control--small': isSmall
55
- }, {
56
53
  'newspack-text-control--wide': isWide
57
54
  }, {
58
55
  'newspack-text-control--with-margin': withMargin
@@ -2,13 +2,7 @@
2
2
  * Text Control
3
3
  */
4
4
 
5
- @import '../../../shared/scss/colors';
6
- @import '~@wordpress/base-styles/colors';
7
-
8
5
  .newspack-text-control {
9
- color: $gray-700;
10
- font-size: 14px;
11
- line-height: 24px;
12
6
  &--with-margin {
13
7
  margin: 32px 0;
14
8
  }
@@ -26,80 +20,6 @@
26
20
  > * {
27
21
  margin: 0;
28
22
  }
29
-
30
- & + & {
31
- margin-bottom: 32px;
32
- margin-top: -16px;
33
- }
34
-
35
- + .newspack-select-control,
36
- + .newspack-textarea-control {
37
- margin-bottom: 32px;
38
- margin-top: -16px;
39
- }
40
- }
41
-
42
- label {
43
- color: $gray-900;
44
- font-size: 14px;
45
- font-weight: bold;
46
- line-height: 24px;
47
- margin: 0;
48
-
49
- &[data-required-text] {
50
- &::after {
51
- content: attr( data-required-text );
52
- padding-left: 0.25em;
53
- font-weight: normal;
54
- color: $gray-700;
55
- }
56
- }
57
- }
58
-
59
- input[type='date'],
60
- input[type='datetime-local'],
61
- input[type='datetime'],
62
- input[type='email'],
63
- input[type='month'],
64
- input[type='number'],
65
- input[type='password'],
66
- input[type='search'],
67
- input[type='tel'],
68
- input[type='text'],
69
- input[type='time'],
70
- input[type='url'],
71
- input[type='week'] {
72
- background: white;
73
- border: 1px solid $gray-300;
74
- border-radius: 3px;
75
- box-shadow: none;
76
- color: inherit;
77
- font-size: 16px;
78
- line-height: inherit;
79
- margin: 0;
80
- min-height: 48px;
81
- padding: 11px 8px;
82
- transition: border-color 125ms ease-in-out, box-shadow 125ms ease-in-out;
83
- width: 100%;
84
-
85
- @media screen and ( min-width: 768px ) {
86
- font-size: 14px;
87
- }
88
-
89
- &::placeholder {
90
- opacity: 0.5;
91
- }
92
- &:focus {
93
- border-color: $primary-500;
94
- box-shadow: inset 0 0 0 2px $primary-500;
95
- }
96
-
97
- &:disabled,
98
- &.disabled {
99
- background: $gray-100;
100
- color: $gray-600;
101
- cursor: not-allowed;
102
- }
103
23
  }
104
24
 
105
25
  // Code
@@ -109,50 +29,4 @@
109
29
  font-family: Consolas, monaco, monospace;
110
30
  }
111
31
  }
112
-
113
- // Small
114
-
115
- &--small {
116
- input[type='date'],
117
- input[type='datetime-local'],
118
- input[type='datetime'],
119
- input[type='email'],
120
- input[type='month'],
121
- input[type='number'],
122
- input[type='password'],
123
- input[type='search'],
124
- input[type='tel'],
125
- input[type='text'],
126
- input[type='time'],
127
- input[type='url'],
128
- input[type='week'] {
129
- min-height: 36px;
130
- padding-bottom: 5px;
131
- padding-top: 5px;
132
- }
133
- }
134
-
135
- // Multiple Text Controls
136
-
137
- & + & {
138
- margin-bottom: 32px;
139
- margin-top: -16px;
140
- }
141
-
142
- // Multiple Controls
143
-
144
- + .newspack-select-control,
145
- + .newspack-textarea-control {
146
- margin-bottom: 32px;
147
- margin-top: -16px;
148
- }
149
-
150
- // Reset
151
-
152
- .components-base-control__field,
153
- .components-base-control__label,
154
- .components-base-control__help {
155
- display: block;
156
- margin: 0;
157
- }
158
32
  }
@@ -6,8 +6,7 @@
6
6
  * WordPress dependencies.
7
7
  */
8
8
  import { Component } from '@wordpress/element';
9
- import { Path, SVG } from '@wordpress/components';
10
- import { Icon } from '@wordpress/icons';
9
+ import { Spinner } from '@wordpress/components';
11
10
  /**
12
11
  * Internal dependencies.
13
12
  */
@@ -19,17 +18,6 @@ import './style.scss';
19
18
 
20
19
  import classnames from 'classnames';
21
20
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
22
- export const icon = _jsx(SVG, {
23
- xmlns: "http://www.w3.org/2000/svg",
24
- width: "24",
25
- height: "24",
26
- viewBox: "0 0 24 24",
27
- children: _jsx(Path, {
28
- clipRule: "evenodd",
29
- d: "M12 4h-.033a7.975 7.975 0 00-5.636 2.322L5.138 5.129l-.353 3.889 3.889-.354-1.282-1.281A6.48 6.48 0 0112 5.5a6.48 6.48 0 014.63 1.904 6.469 6.469 0 011.848 3.747l1.487-.195a7.969 7.969 0 00-2.275-4.613A7.975 7.975 0 0012.033 4H12zm-6.478 8.85l-1.487.194a7.969 7.969 0 002.275 4.613A7.975 7.975 0 0012 20a7.975 7.975 0 005.669-2.322l1.193 1.193.353-3.889-3.889.354 1.282 1.281A6.48 6.48 0 0112 18.5a6.48 6.48 0 01-4.63-1.904 6.469 6.469 0 01-1.848-3.747z",
30
- fillRule: "evenodd"
31
- })
32
- });
33
21
 
34
22
  class Waiting extends Component {
35
23
  /**
@@ -41,17 +29,16 @@ class Waiting extends Component {
41
29
  isRight,
42
30
  isLeft,
43
31
  isCenter,
44
- size
32
+ ...otherProps
45
33
  } = this.props;
46
- const classes = classnames('newspack-is-waiting', className, {
47
- 'newspack-is-waiting__is-right': isRight,
48
- 'newspack-is-waiting__is-left': isLeft,
49
- 'newspack-is-waiting__is-center': isCenter
34
+ const classes = classnames('newspack-waiting', className, {
35
+ 'is-right': isRight,
36
+ 'is-left': isLeft,
37
+ 'is-center': isCenter
50
38
  });
51
- return _jsx(Icon, {
52
- icon: icon,
53
- size: size,
54
- className: classes
39
+ return _jsx(Spinner, {
40
+ className: classes,
41
+ ...otherProps
55
42
  });
56
43
  }
57
44
 
@@ -2,37 +2,26 @@
2
2
  * Waiting
3
3
  */
4
4
 
5
- .newspack-is-waiting {
6
- animation: newspack-is-waiting__animation 1s infinite linear;
7
- display: block;
8
- fill: currentColor;
9
- flex: 0 0 24px;
5
+ .newspack-waiting.components-spinner {
6
+ flex: 0 0 auto;
7
+ margin: 0;
10
8
 
11
- &.newspack-is-waiting__is-left {
12
- margin-right: 4px;
9
+ &.is-left {
10
+ margin-right: 8px;
13
11
  }
14
12
 
15
- &.newspack-is-waiting__is-right {
16
- margin-right: 4px;
13
+ &.is-right {
14
+ margin-right: 8px;
17
15
  order: -1;
18
16
 
19
17
  @media screen and ( min-width: 744px ) {
20
- margin-left: 4px;
18
+ margin-left: 8px;
21
19
  margin-right: 0;
22
20
  order: 1;
23
21
  }
24
22
  }
25
23
 
26
- &.newspack-is-waiting__is-center {
24
+ &.is-center {
27
25
  margin: auto;
28
26
  }
29
27
  }
30
-
31
- @keyframes newspack-is-waiting__animation {
32
- from {
33
- transform: rotate( 360deg );
34
- }
35
- to {
36
- transform: rotate( 0deg );
37
- }
38
- }