newspack-components 4.2.0 → 4.3.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 (131) hide show
  1. package/dist/cjs/action-card/index.js +21 -12
  2. package/dist/cjs/action-card/style.scss +25 -2
  3. package/dist/cjs/autocomplete-tokenfield/index.js +2 -2
  4. package/dist/cjs/autocomplete-with-latest-posts/index.js +289 -0
  5. package/dist/cjs/autocomplete-with-latest-posts/style.scss +150 -0
  6. package/dist/cjs/badge/index.js +32 -0
  7. package/dist/cjs/badge/style.scss +36 -0
  8. package/dist/cjs/button/index.js +2 -0
  9. package/dist/cjs/card/core-card.js +141 -0
  10. package/dist/cjs/card/index.js +33 -0
  11. package/dist/cjs/card/style-core.scss +227 -0
  12. package/dist/cjs/card/style.scss +2 -2
  13. package/dist/cjs/card-settings-group/index.js +49 -0
  14. package/dist/cjs/card-settings-group/style.scss +33 -0
  15. package/dist/cjs/card-sortable-list/index.js +390 -0
  16. package/dist/cjs/card-sortable-list/style.scss +48 -0
  17. package/dist/cjs/confirm-dialog/index.js +59 -0
  18. package/dist/cjs/divider/index.js +42 -0
  19. package/dist/cjs/divider/style.scss +51 -0
  20. package/dist/cjs/form-token-field/style.scss +0 -5
  21. package/dist/cjs/grid/index.js +2 -1
  22. package/dist/cjs/grid/style.scss +63 -9
  23. package/dist/cjs/index.js +42 -0
  24. package/dist/cjs/modal/index.js +11 -4
  25. package/dist/cjs/modal/style.scss +43 -13
  26. package/dist/cjs/newspack-icon/style.scss +5 -3
  27. package/dist/cjs/section-header/index.js +76 -17
  28. package/dist/cjs/section-header/style.scss +109 -4
  29. package/dist/cjs/style.scss +2 -0
  30. package/dist/cjs/waiting/index.js +3 -1
  31. package/dist/cjs/waiting/style.scss +4 -0
  32. package/dist/cjs/web-preview/index.js +98 -39
  33. package/dist/cjs/web-preview/style.scss +20 -53
  34. package/dist/cjs/with-wizard/index.js +1 -1
  35. package/dist/cjs/with-wizard/style.scss +24 -6
  36. package/dist/cjs/with-wizard-screen/style.scss +39 -10
  37. package/dist/cjs/wizard/components/WizardSnackbar.js +70 -0
  38. package/dist/cjs/wizard/components/style.scss +48 -0
  39. package/dist/cjs/wizard/index.js +97 -16
  40. package/dist/cjs/wizard/store/index.js +46 -0
  41. package/dist/esm/action-card/index.js +21 -12
  42. package/dist/esm/action-card/style.scss +25 -2
  43. package/dist/esm/autocomplete-tokenfield/index.js +2 -2
  44. package/dist/esm/autocomplete-with-latest-posts/index.js +281 -0
  45. package/dist/esm/autocomplete-with-latest-posts/style.scss +150 -0
  46. package/dist/esm/badge/index.js +24 -0
  47. package/dist/esm/badge/style.scss +36 -0
  48. package/dist/esm/button/index.js +2 -0
  49. package/dist/esm/card/core-card.js +133 -0
  50. package/dist/esm/card/index.js +33 -0
  51. package/dist/esm/card/style-core.scss +227 -0
  52. package/dist/esm/card/style.scss +2 -2
  53. package/dist/esm/card-settings-group/index.js +42 -0
  54. package/dist/esm/card-settings-group/style.scss +33 -0
  55. package/dist/esm/card-sortable-list/index.js +381 -0
  56. package/dist/esm/card-sortable-list/style.scss +48 -0
  57. package/dist/esm/confirm-dialog/index.js +49 -0
  58. package/dist/esm/divider/index.js +34 -0
  59. package/dist/esm/divider/style.scss +51 -0
  60. package/dist/esm/form-token-field/style.scss +0 -5
  61. package/dist/esm/grid/index.js +2 -1
  62. package/dist/esm/grid/style.scss +63 -9
  63. package/dist/esm/index.js +6 -0
  64. package/dist/esm/modal/index.js +11 -4
  65. package/dist/esm/modal/style.scss +43 -13
  66. package/dist/esm/newspack-icon/style.scss +5 -3
  67. package/dist/esm/section-header/index.js +75 -18
  68. package/dist/esm/section-header/style.scss +109 -4
  69. package/dist/esm/style.scss +2 -0
  70. package/dist/esm/waiting/index.js +3 -1
  71. package/dist/esm/waiting/style.scss +4 -0
  72. package/dist/esm/web-preview/index.js +101 -42
  73. package/dist/esm/web-preview/style.scss +20 -53
  74. package/dist/esm/with-wizard/index.js +1 -1
  75. package/dist/esm/with-wizard/style.scss +24 -6
  76. package/dist/esm/with-wizard-screen/style.scss +39 -10
  77. package/dist/esm/wizard/components/WizardSnackbar.js +64 -0
  78. package/dist/esm/wizard/components/style.scss +48 -0
  79. package/dist/esm/wizard/index.js +101 -20
  80. package/dist/esm/wizard/store/index.js +46 -0
  81. package/package.json +5 -6
  82. package/shared/author-context.js +26 -0
  83. package/shared/hooks/use-coauthors.js +220 -0
  84. package/shared/hooks/use-coauthors.test.js +624 -0
  85. package/shared/hooks/use-custom-byline.js +47 -0
  86. package/shared/hooks/use-custom-byline.test.js +133 -0
  87. package/shared/scss/_mixins.scss +46 -0
  88. package/src/action-card/action-card.d.ts +7 -3
  89. package/src/action-card/index.js +24 -11
  90. package/src/action-card/style.scss +25 -2
  91. package/src/autocomplete-tokenfield/index.js +2 -2
  92. package/src/autocomplete-with-latest-posts/index.js +290 -0
  93. package/src/autocomplete-with-latest-posts/style.scss +150 -0
  94. package/src/badge/index.tsx +24 -0
  95. package/src/badge/style.scss +36 -0
  96. package/src/button/index.tsx +3 -2
  97. package/src/card/core-card.js +147 -0
  98. package/src/card/index.js +39 -1
  99. package/src/card/style-core.scss +227 -0
  100. package/src/card/style.scss +2 -2
  101. package/src/card-settings-group/README.md +43 -0
  102. package/src/card-settings-group/index.tsx +53 -0
  103. package/src/card-settings-group/style.scss +33 -0
  104. package/src/card-sortable-list/README.md +51 -0
  105. package/src/card-sortable-list/index.tsx +412 -0
  106. package/src/card-sortable-list/style.scss +48 -0
  107. package/src/confirm-dialog/index.tsx +64 -0
  108. package/src/divider/README.md +25 -0
  109. package/src/divider/index.js +31 -0
  110. package/src/divider/style.scss +51 -0
  111. package/src/form-token-field/style.scss +0 -5
  112. package/src/grid/index.tsx +2 -1
  113. package/src/grid/style.scss +63 -9
  114. package/src/index.js +6 -0
  115. package/src/modal/index.js +12 -3
  116. package/src/modal/style.scss +43 -13
  117. package/src/newspack-icon/style.scss +5 -3
  118. package/src/section-header/index.js +72 -13
  119. package/src/section-header/style.scss +109 -4
  120. package/src/style.scss +2 -0
  121. package/src/waiting/index.js +2 -1
  122. package/src/waiting/style.scss +4 -0
  123. package/src/web-preview/index.js +90 -35
  124. package/src/web-preview/style.scss +20 -53
  125. package/src/with-wizard/index.js +1 -1
  126. package/src/with-wizard/style.scss +24 -6
  127. package/src/with-wizard-screen/style.scss +39 -10
  128. package/src/wizard/components/WizardSnackbar.js +58 -0
  129. package/src/wizard/components/style.scss +48 -0
  130. package/src/wizard/index.js +108 -14
  131. package/src/wizard/store/index.js +26 -0
@@ -3,21 +3,58 @@
3
3
  */
4
4
 
5
5
  @use "~@wordpress/base-styles/colors" as wp-colors;
6
+ @use "../../../colors/colors.module" as colors;
6
7
 
7
8
  .newspack-section-header {
9
+ flex: 1;
8
10
  margin: 64px 0 32px;
9
11
 
10
- &__container:not(:first-child) {
11
- margin-top: 48px;
12
+ &__container {
13
+ position: relative;
14
+ &:not(:first-child) {
15
+ margin-top: 48px;
16
+ }
17
+ &.newspack-section-header--has-primary-action {
18
+ display: flex;
19
+ flex-direction: column;
20
+ gap: 32px;
21
+ @media (min-width: 782px) {
22
+ align-items: flex-start;
23
+ flex-direction: row;
24
+ }
25
+ }
26
+ &.newspack-section-header--has-back-nav {
27
+ --back-nav-button-size: 36px;
28
+ margin-left: calc(var(--back-nav-button-size) + 8px);
29
+ @media (min-width: 782px) {
30
+ margin-left: 0;
31
+ }
32
+ }
33
+ }
34
+
35
+ &__back-nav {
36
+ left: calc((var(--back-nav-button-size) + 8px) * -1);
37
+ position: absolute;
38
+ top: calc(50% - (var(--back-nav-button-size) / 2));
39
+ a,
40
+ button {
41
+ color: inherit !important;
42
+ }
12
43
  }
13
44
 
14
- &--no-margin,
15
45
  h1,
16
46
  h2,
17
47
  h3,
18
48
  h4,
19
49
  h5,
20
50
  h6 {
51
+ align-items: center;
52
+ display: flex;
53
+ gap: 8px;
54
+ margin: 0 !important;
55
+ }
56
+
57
+ &--no-margin {
21
58
  margin: 0 !important;
22
59
  }
23
60
 
@@ -25,7 +62,7 @@
25
62
  text-align: center;
26
63
  }
27
64
 
28
- &:not( #{&}--no-margin ) + *:not( #{&} ) {
65
+ &:not( #{&}--no-margin ) + *:not( #{&} ):not(.newspack-wizard__section-header):not(.newspack-section-header__primary-action) {
29
66
  margin-top: -16px !important;
30
67
  }
31
68
 
@@ -39,7 +76,75 @@
39
76
  color: wp-colors.$gray-700;
40
77
  }
41
78
 
79
+ &__title-container {
80
+ align-items: baseline;
81
+ display: flex;
82
+ gap: 8px;
83
+
84
+ .newspack-badge {
85
+ transform: translateY(-4px);
86
+ }
87
+ }
88
+
89
+ &__primary-action {
90
+ @media (min-width: 782px) {
91
+ display: flex;
92
+ flex: 1;
93
+ justify-content: flex-end;
94
+ }
95
+ }
96
+
97
+ &__secondary-action {
98
+ display: flex;
99
+ margin-left: 8px;
100
+ }
101
+
102
+ &__children {
103
+ margin-top: 32px;
104
+ width: 100%;
105
+ .newspack-button-card:not(.grouped) {
106
+ margin-bottom: 0;
107
+ & + .newspack-button-card:not(.grouped) {
108
+ margin-top: 16px;
109
+ }
110
+ }
111
+ }
112
+
42
113
  .newspack-wizard__content &:first-child {
43
114
  margin-top: 32px;
44
115
  }
116
+ &.newspack-section-header--page-header {
117
+ display: flex;
118
+ flex-direction: column;
119
+ align-items: center;
120
+ justify-content: center;
121
+ margin-left: auto;
122
+ margin-right: auto;
123
+ > h1,
124
+ > h2,
125
+ > h3,
126
+ > h4,
127
+ > h5,
128
+ > h6,
129
+ > p {
130
+ text-align: center;
131
+ }
132
+ .newspack-section-header__icon {
133
+ background-color: var(--wp-admin-theme-color-lighter-10);
134
+ border-radius: 100%;
135
+ display: grid;
136
+ height: 80px;
137
+ margin-bottom: 8px !important;
138
+ width: 80px;
139
+ place-items: center;
140
+ svg {
141
+ fill: var(--wp-admin-theme-color);
142
+ }
143
+ }
144
+ h1 {
145
+ font-size: 1.25rem;
146
+ font-weight: 500;
147
+ line-height: 1.5;
148
+ }
149
+ }
45
150
  }
package/src/style.scss CHANGED
@@ -9,6 +9,8 @@
9
9
  --wp-admin-theme-color-darker-10--rgb: #{colors.$primary-700--rgb};
10
10
  --wp-admin-theme-color-darker-20: #{colors.$primary-800};
11
11
  --wp-admin-theme-color-darker-20--rgb: #{colors.$primary-800--rgb};
12
+ --wp-admin-theme-color-lighter-10: #{colors.$primary-000};
13
+ --wp-admin-theme-color-lighter-10--rgb: #{colors.$primary-000--rgb};
12
14
  }
13
15
 
14
16
  // Buttons Card
@@ -23,11 +23,12 @@ class Waiting extends Component {
23
23
  * Render
24
24
  */
25
25
  render() {
26
- const { className, isRight, isLeft, isCenter, ...otherProps } = this.props;
26
+ const { className, isRight, isLeft, isCenter, noMargin, ...otherProps } = this.props;
27
27
  const classes = classnames( 'newspack-waiting', className, {
28
28
  'is-right': isRight,
29
29
  'is-left': isLeft,
30
30
  'is-center': isCenter,
31
+ 'no-margin': noMargin,
31
32
  } );
32
33
  return <Spinner className={ classes } { ...otherProps } />;
33
34
  }
@@ -24,4 +24,8 @@
24
24
  &.is-center {
25
25
  margin: auto;
26
26
  }
27
+
28
+ &.no-margin {
29
+ margin: 0;
30
+ }
27
31
  }
@@ -3,8 +3,8 @@
3
3
  */
4
4
  import { Component, createRef, Fragment, createPortal } from '@wordpress/element';
5
5
  import { __ } from '@wordpress/i18n';
6
- import { closeSmall, desktop, mobile, tablet } from '@wordpress/icons';
7
- import { Button, ButtonGroup } from '@wordpress/components';
6
+ import { close, desktop, mobile, tablet, check } from '@wordpress/icons';
7
+ import { Button, DropdownMenu, MenuItem } from '@wordpress/components';
8
8
 
9
9
  /**
10
10
  * Internal dependencies.
@@ -48,21 +48,55 @@ class WebPreview extends Component {
48
48
  }
49
49
 
50
50
  /**
51
- * Add or remove applicable body classes
51
+ * Add or remove applicable body classes and keyboard event listeners
52
52
  */
53
- componentDidUpdate() {
53
+ componentDidUpdate( prevProps, prevState ) {
54
54
  if ( this.state.isPreviewVisible === true ) {
55
55
  document.body.classList.add( 'newspack-web-preview--open' );
56
+ if ( prevState.isPreviewVisible === false ) {
57
+ // Add event listener when modal opens
58
+ document.addEventListener( 'keydown', this.handleKeyDown );
59
+ }
56
60
  } else {
57
61
  document.body.classList.remove( 'newspack-web-preview--open' );
62
+ if ( prevState.isPreviewVisible === true ) {
63
+ // Remove event listener when modal closes
64
+ document.removeEventListener( 'keydown', this.handleKeyDown );
65
+ }
58
66
  }
59
67
  }
60
68
 
69
+ /**
70
+ * Clean up event listeners on unmount
71
+ */
72
+ componentWillUnmount() {
73
+ document.removeEventListener( 'keydown', this.handleKeyDown );
74
+ document.body.classList.remove( 'newspack-web-preview--open' );
75
+ }
76
+
77
+ /**
78
+ * Handle keyboard events
79
+ */
80
+ handleKeyDown = event => {
81
+ if ( event.key === 'Escape' && this.state.isPreviewVisible ) {
82
+ this.closePreview();
83
+ }
84
+ };
85
+
86
+ /**
87
+ * Close the preview modal
88
+ */
89
+ closePreview = () => {
90
+ const { onClose = () => {} } = this.props;
91
+ onClose();
92
+ this.setState( { isPreviewVisible: false, loaded: false } );
93
+ };
94
+
61
95
  /**
62
96
  * Create JSX for the modal
63
97
  */
64
98
  getWebPreviewModal = () => {
65
- const { beforeLoad = () => {}, onClose = () => {}, url } = this.props;
99
+ const { beforeLoad = () => {}, url, title } = this.props;
66
100
  const { device, loaded, isPreviewVisible } = this.state;
67
101
 
68
102
  if ( ! this.modalDOMElement || ! isPreviewVisible ) {
@@ -70,42 +104,63 @@ class WebPreview extends Component {
70
104
  }
71
105
 
72
106
  const classes = classnames( 'newspack-web-preview', device, loaded && 'is-loaded' );
107
+ let icon = mobile;
108
+ if ( device === 'desktop' ) {
109
+ icon = desktop;
110
+ } else if ( device === 'tablet' ) {
111
+ icon = tablet;
112
+ }
73
113
  beforeLoad();
74
114
  return createPortal(
75
115
  <div className={ classes }>
76
116
  <div className="newspack-web-preview__interior">
77
117
  <div className="newspack-web-preview__toolbar">
78
- <div className="newspack-web-preview__toolbar-left">
79
- <ButtonGroup>
80
- <Button
81
- onClick={ () => this.setState( { device: 'desktop' } ) }
82
- variant={ 'desktop' === device && 'primary' }
83
- icon={ desktop }
84
- label={ __( 'Preview Desktop Size', 'newspack-plugin' ) }
85
- />
86
- <Button
87
- onClick={ () => this.setState( { device: 'tablet' } ) }
88
- variant={ 'tablet' === device && 'primary' }
89
- icon={ tablet }
90
- label={ __( 'Preview Tablet Size', 'newspack-plugin' ) }
91
- />
92
- <Button
93
- onClick={ () => this.setState( { device: 'phone' } ) }
94
- variant={ 'phone' === device && 'primary' }
95
- icon={ mobile }
96
- label={ __( 'Preview Phone Size', 'newspack-plugin' ) }
97
- />
98
- </ButtonGroup>
99
- </div>
118
+ { title && (
119
+ <div className="newspack-web-preview__toolbar-left">
120
+ <h3>{ title }</h3>
121
+ </div>
122
+ ) }
100
123
  <div className="newspack-web-preview__toolbar-right">
101
- <Button
102
- onClick={ () => {
103
- onClose();
104
- this.setState( { isPreviewVisible: false, loaded: false } );
105
- } }
106
- icon={ closeSmall }
107
- label={ __( 'Close Preview', 'newspack-plugin' ) }
108
- />
124
+ <DropdownMenu icon={ icon } label={ __( 'Preview Size', 'newspack-plugin' ) }>
125
+ { ( { onClose: onDropdownClose } ) => (
126
+ <>
127
+ <MenuItem
128
+ icon={ device === 'desktop' ? check : null }
129
+ role="menuitemradio"
130
+ isSelected={ device === 'desktop' }
131
+ onClick={ () => {
132
+ this.setState( { device: 'desktop' } );
133
+ onDropdownClose();
134
+ } }
135
+ >
136
+ { __( 'Desktop', 'newspack-plugin' ) }
137
+ </MenuItem>
138
+ <MenuItem
139
+ icon={ device === 'tablet' ? check : null }
140
+ role="menuitemradio"
141
+ isSelected={ device === 'tablet' }
142
+ onClick={ () => {
143
+ this.setState( { device: 'tablet' } );
144
+ onDropdownClose();
145
+ } }
146
+ >
147
+ { __( 'Tablet', 'newspack-plugin' ) }
148
+ </MenuItem>
149
+ <MenuItem
150
+ icon={ device === 'phone' ? check : null }
151
+ role="menuitemradio"
152
+ isSelected={ device === 'phone' }
153
+ onClick={ () => {
154
+ this.setState( { device: 'phone' } );
155
+ onDropdownClose();
156
+ } }
157
+ >
158
+ { __( 'Phone', 'newspack-plugin' ) }
159
+ </MenuItem>
160
+ </>
161
+ ) }
162
+ </DropdownMenu>
163
+ <Button onClick={ this.closePreview } icon={ close } label={ __( 'Close Preview', 'newspack-plugin' ) } />
109
164
  </div>
110
165
  </div>
111
166
  <div className="newspack-web-preview__content">
@@ -13,8 +13,10 @@
13
13
  --wp-admin-theme-color-darker-10--rgb: #{colors.$primary-700--rgb};
14
14
  --wp-admin-theme-color-darker-20: #{colors.$primary-800};
15
15
  --wp-admin-theme-color-darker-20--rgb: #{colors.$primary-800--rgb};
16
+ --wp-admin-theme-color-lighter-10: #{colors.$primary-000};
17
+ --wp-admin-theme-color-lighter-10--rgb: #{colors.$primary-000--rgb};
16
18
 
17
- background: #{colors.$neutral-700};
19
+ background: color-mix(in srgb, colors.$neutral-1000, transparent 65%);
18
20
  box-sizing: border-box;
19
21
  height: 100%;
20
22
  left: 0;
@@ -27,11 +29,11 @@
27
29
  z-index: 99999;
28
30
 
29
31
  &.phone iframe {
30
- max-width: 380px;
32
+ max-width: 360px;
31
33
  }
32
34
 
33
35
  &.tablet iframe {
34
- max-width: 768px;
36
+ max-width: 780px;
35
37
  }
36
38
 
37
39
  &.is-loaded iframe {
@@ -46,7 +48,7 @@
46
48
  animation: appear-animation 125ms ease-in-out;
47
49
  animation-fill-mode: forwards;
48
50
  background: white;
49
- border-radius: 2px;
51
+ border-radius: 8px;
50
52
  overflow: hidden;
51
53
  height: 100%;
52
54
  width: 100%;
@@ -54,19 +56,18 @@
54
56
 
55
57
  &__content {
56
58
  background: wp-colors.$gray-100;
57
- height: calc(100% - 49px);
59
+ height: calc(100% - 72px);
58
60
  -webkit-overflow-scrolling: touch;
59
61
  overflow-x: hidden;
60
62
  width: 100%;
61
63
 
62
64
  iframe {
63
- background: #fff;
65
+ background: white;
64
66
  display: block;
65
67
  height: 100%;
66
68
  margin: 0 auto;
67
69
  max-width: 100%;
68
70
  opacity: 0;
69
- outline: 1px solid wp-colors.$gray-300;
70
71
  padding: 0;
71
72
  pointer-events: all;
72
73
  transition: max-width 125ms ease-in-out, opacity 250ms ease-in-out;
@@ -85,62 +86,28 @@
85
86
  }
86
87
 
87
88
  &__toolbar {
89
+ align-items: center;
88
90
  border-bottom: 1px solid wp-colors.$gray-300;
89
91
  display: flex;
90
- padding: 6px;
92
+ gap: 16px;
93
+ justify-content: space-between;
94
+ min-height: 71px;
95
+ padding: 12px 24px;
91
96
 
92
97
  &-left {
93
- flex: 0 0 auto;
98
+ display: flex;
94
99
 
95
- .newspack-button-group {
96
- display: flex;
100
+ h3 {
97
101
  margin: 0;
98
102
  }
99
-
100
- .newspack-button {
101
- display: none;
102
- padding: 0 !important;
103
-
104
- &.is-selected {
105
- background: var(--wp-admin-theme-color);
106
- color: white;
107
-
108
- &:active,
109
- &:focus,
110
- &:hover {
111
- box-shadow: none !important;
112
- color: white;
113
- outline: none;
114
- }
115
-
116
- &:focus {
117
- box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color), inset 0 0 0 3px white !important;
118
- }
119
- }
120
-
121
- @media screen and ( min-width: 528px ) {
122
- &.is-phone,
123
- &.is-tablet {
124
- display: flex;
125
- }
126
- }
127
-
128
- @media screen and ( min-width: 816px ) {
129
- &.is-desktop {
130
- display: flex;
131
- }
132
- }
133
- }
134
103
  }
135
104
 
136
105
  &-right {
137
- display: flex;
138
- flex: 1;
139
- justify-content: flex-end;
140
- }
141
-
142
- .newspack-button {
143
- border-radius: 0 !important;
106
+ display: grid;
107
+ gap: 8px;
108
+ grid-template-columns: repeat(2, 1fr);
109
+ justify-self: end;
110
+ margin-left: auto;
144
111
  }
145
112
  }
146
113
  }
@@ -279,7 +279,7 @@ export default function withWizard( WrappedComponent, requiredPlugins ) {
279
279
  return (
280
280
  message &&
281
281
  callback && (
282
- <Modal isNarrow hideTitle={ ! title } title={ title } onRequestClose={ () => this.setState( { confirmation: null } ) }>
282
+ <Modal size="small" hideTitle={ ! title } title={ title } onRequestClose={ () => this.setState( { confirmation: null } ) }>
283
283
  <p>{ message }</p>
284
284
  <Card buttonsCard noBorder className="justify-end">
285
285
  <Button variant="secondary" onClick={ () => this.setState( { confirmation: null } ) }>
@@ -3,11 +3,21 @@
3
3
  */
4
4
 
5
5
  @use "~@wordpress/base-styles/colors" as wp-colors;
6
+ @use "../../../colors/colors.module" as colors;
6
7
 
7
8
  // Styling for full-page-react Wizards (ignoring admin-header-only wizards).
8
9
  body.newspack-wizard-page:not(.newspack-admin-header) {
9
-
10
- background: white;
10
+ --wp-admin-theme-color: #{colors.$primary-600};
11
+ --wp-admin-theme-color--rgb: #{colors.$primary-600--rgb};
12
+ --wp-admin-theme-color-darker-10: #{colors.$primary-700};
13
+ --wp-admin-theme-color-darker-10--rgb: #{colors.$primary-700--rgb};
14
+ --wp-admin-theme-color-darker-20: #{colors.$primary-800};
15
+ --wp-admin-theme-color-darker-20--rgb: #{colors.$primary-800--rgb};
16
+ --wp-admin-theme-color-lighter-10: #{colors.$primary-000};
17
+ --wp-admin-theme-color-lighter-10--rgb: #{colors.$primary-000--rgb};
18
+ --wp-components-color-accent: #{colors.$primary-600};
19
+
20
+ background: #{wp-colors.$white};
11
21
 
12
22
  // Reset Padding
13
23
  #wpcontent {
@@ -18,6 +28,14 @@ body.newspack-wizard-page:not(.newspack-admin-header) {
18
28
  padding-bottom: 220px;
19
29
  min-height: 100vh;
20
30
 
31
+ @media screen and ( min-width: 600px ) {
32
+ min-height: calc(100vh - 46px);
33
+ }
34
+
35
+ @media screen and ( min-width: 783px ) {
36
+ min-height: calc(100vh - 32px);
37
+ }
38
+
21
39
  // For admin notices directly ">" at top of page above the Wizard header.
22
40
  // PHP code should hide these notices, but just incase add this style.
23
41
  > .notice {
@@ -29,8 +47,8 @@ body.newspack-wizard-page:not(.newspack-admin-header) {
29
47
  padding-bottom: 202px;
30
48
  }
31
49
 
32
- @media screen and ( min-width: 1128px ) {
33
- padding-bottom: 168px;
50
+ @media screen and ( min-width: 1054px ) {
51
+ padding-bottom: 136px;
34
52
  }
35
53
  }
36
54
  }
@@ -134,7 +152,7 @@ svg {
134
152
  0 96px 0 0 wp-colors.$gray-700;
135
153
  height: 24px;
136
154
  margin: 68px auto 0;
137
- max-width: 1040px;
155
+ max-width: 1006px;
138
156
  width: calc(100% - ( 32px * 2 ));
139
157
 
140
158
  @media screen and ( min-width: 744px ) {
@@ -250,7 +268,7 @@ svg {
250
268
  0 96px 0 0 wp-colors.$gray-700;
251
269
  height: 24px;
252
270
  margin: 0 auto;
253
- max-width: 1040px;
271
+ max-width: 1006px;
254
272
  width: 100%;
255
273
 
256
274
  @media screen and ( min-width: 744px ) {
@@ -13,6 +13,8 @@
13
13
  --wp-admin-theme-color-darker-10--rgb: #{colors.$primary-700--rgb};
14
14
  --wp-admin-theme-color-darker-20: #{colors.$primary-800};
15
15
  --wp-admin-theme-color-darker-20--rgb: #{colors.$primary-800--rgb};
16
+ --wp-admin-theme-color-lighter-10: #{colors.$primary-000};
17
+ --wp-admin-theme-color-lighter-10--rgb: #{colors.$primary-000--rgb};
16
18
 
17
19
  color: wp-colors.$gray-900;
18
20
 
@@ -44,12 +46,39 @@
44
46
  }
45
47
 
46
48
  &__header {
49
+ align-items: center;
47
50
  background: white;
51
+ border-bottom: 1px solid wp-colors.$gray-300;
52
+ display: flex;
53
+ .newspack-wizard__fixed-header & {
54
+ position: sticky;
55
+ top: 0;
56
+ width: 100%;
57
+ z-index: 1000;
58
+ .admin-bar & {
59
+ @media only screen and ( min-width: 601px ) {
60
+ top: 46px;
61
+ }
62
+ @media only screen and ( min-width: 782px ) {
63
+ top: 32px;
64
+ }
65
+ }
66
+ }
67
+ &__inner {
68
+ flex: 1;
69
+ }
70
+ &__actions {
71
+ align-items: center;
72
+ display: flex;
73
+ flex: 1 1 auto;
74
+ gap: 8px;
75
+ justify-content: flex-end;
76
+ padding: 0 24px 0 0;
77
+ }
48
78
  }
49
79
 
50
80
  &__title {
51
81
  align-items: center;
52
- border-bottom: 1px solid wp-colors.$gray-300;
53
82
  display: flex;
54
83
 
55
84
  h2 {
@@ -62,7 +91,7 @@
62
91
  display: flex;
63
92
  padding: 0 24px;
64
93
 
65
- span {
94
+ > span {
66
95
  color: wp-colors.$gray-700;
67
96
  display: none;
68
97
  margin-left: 8px;
@@ -119,14 +148,14 @@
119
148
  }
120
149
  }
121
150
 
151
+ &__section-header {
152
+ margin-bottom: 32px;
153
+ }
154
+
122
155
  &__content {
123
156
  margin: 0 auto;
124
- max-width: 1208px;
125
- padding: 0 16px;
126
-
127
- @media screen and ( min-width: 744px ) {
128
- padding: 40px 84px;
129
- }
157
+ max-width: calc(calc(var(--newspack-wizard-section-space) * 2) + var(--newspack-wizard-section-width));
158
+ padding: calc(var(--newspack-wizard-section-space) * 2) var(--newspack-wizard-section-space) 0;
130
159
 
131
160
  // Typography
132
161
 
@@ -141,11 +170,11 @@
141
170
 
142
171
  // Thematic Break
143
172
 
144
- hr {
173
+ hr:not(.newspack-divider) {
145
174
  background: wp-colors.$gray-300;
146
175
  border: 0;
147
176
  height: 1px;
148
- margin: 48px 0;
177
+ margin: 32px 0;
149
178
 
150
179
  @media screen and ( min-width: 744px ) {
151
180
  margin: 64px 0;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Snackbar.
3
+ */
4
+
5
+ /**
6
+ * WordPress dependencies.
7
+ */
8
+ import { Snackbar as BaseComponent } from '@wordpress/components';
9
+ import { useDispatch } from '@wordpress/data';
10
+
11
+ /**
12
+ * Internal dependencies.
13
+ */
14
+ import { WIZARD_STORE_NAMESPACE } from '../store';
15
+ import './style.scss';
16
+
17
+ /**
18
+ * External dependencies.
19
+ */
20
+ import classnames from 'classnames';
21
+
22
+ /**
23
+ * WizardSnackbar component.
24
+ *
25
+ * @param {Object} props - The component props.
26
+ * @param {Object[]} props.actions - The actions to display in the snackbar.
27
+ * @param {JSX.Element} props.children - The component children.
28
+ * @param {Object} props.props - The component props. See: https://wordpress.github.io/gutenberg/?path=/docs/components-snackbar--docs
29
+ * @param {string} props.position - The snackbar position.
30
+ * @param {string} props.type - The snackbar type: 'info', 'success', 'warning', or 'error'.
31
+ * @return {JSX.Element} The component.
32
+ */
33
+ const WizardSnackbar = ( { children, position = 'bottom-left', type = 'info', actions = [], ...props } ) => {
34
+ const className = classnames(
35
+ 'newspack-wizard__snackbar',
36
+ props.className,
37
+ `newspack-wizard__snackbar--${ position }`,
38
+ `newspack-wizard__snackbar--${ type }`
39
+ );
40
+ const { removeNotice, resetNotices } = useDispatch( WIZARD_STORE_NAMESPACE );
41
+ const onRemove = () => {
42
+ if ( props.onRemove ) {
43
+ props.onRemove();
44
+ }
45
+ if ( props.id ) {
46
+ removeNotice( props.id );
47
+ } else {
48
+ resetNotices();
49
+ }
50
+ };
51
+ return (
52
+ <BaseComponent className={ className } { ...props } onRemove={ onRemove } actions={ actions }>
53
+ { children }
54
+ </BaseComponent>
55
+ );
56
+ };
57
+
58
+ export default WizardSnackbar;