newspack-components 4.1.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.
- package/colors/colors.module.scss +1 -1
- package/dist/cjs/action-card/index.js +21 -12
- package/dist/cjs/action-card/style.scss +32 -14
- package/dist/cjs/autocomplete-tokenfield/index.js +2 -2
- package/dist/cjs/autocomplete-with-latest-posts/index.js +289 -0
- package/dist/cjs/autocomplete-with-latest-posts/style.scss +150 -0
- package/dist/cjs/badge/index.js +32 -0
- package/dist/cjs/badge/style.scss +36 -0
- package/dist/cjs/button/index.js +2 -0
- package/dist/cjs/card/core-card.js +141 -0
- package/dist/cjs/card/index.js +33 -0
- package/dist/cjs/card/style-core.scss +227 -0
- package/dist/cjs/card/style.scss +2 -2
- package/dist/cjs/card-settings-group/index.js +49 -0
- package/dist/cjs/card-settings-group/style.scss +33 -0
- package/dist/cjs/card-sortable-list/index.js +390 -0
- package/dist/cjs/card-sortable-list/style.scss +48 -0
- package/dist/cjs/confirm-dialog/index.js +59 -0
- package/dist/cjs/divider/index.js +42 -0
- package/dist/cjs/divider/style.scss +51 -0
- package/dist/cjs/form-token-field/style.scss +0 -5
- package/dist/cjs/grid/index.js +2 -1
- package/dist/cjs/grid/style.scss +63 -9
- package/dist/cjs/index.js +42 -0
- package/dist/cjs/modal/index.js +11 -4
- package/dist/cjs/modal/style.scss +43 -13
- package/dist/cjs/newspack-icon/style.scss +5 -3
- package/dist/cjs/popover/style.scss +1 -1
- package/dist/cjs/section-header/index.js +76 -17
- package/dist/cjs/section-header/style.scss +109 -4
- package/dist/cjs/style.scss +2 -0
- package/dist/cjs/waiting/index.js +3 -1
- package/dist/cjs/waiting/style.scss +4 -0
- package/dist/cjs/web-preview/index.js +98 -39
- package/dist/cjs/web-preview/style.scss +20 -53
- package/dist/cjs/with-wizard/index.js +1 -1
- package/dist/cjs/with-wizard/style.scss +24 -6
- package/dist/cjs/with-wizard-screen/style.scss +39 -10
- package/dist/cjs/wizard/components/WizardSnackbar.js +70 -0
- package/dist/cjs/wizard/components/style.scss +48 -0
- package/dist/cjs/wizard/index.js +97 -16
- package/dist/cjs/wizard/store/index.js +46 -0
- package/dist/esm/action-card/index.js +21 -12
- package/dist/esm/action-card/style.scss +32 -14
- package/dist/esm/autocomplete-tokenfield/index.js +2 -2
- package/dist/esm/autocomplete-with-latest-posts/index.js +281 -0
- package/dist/esm/autocomplete-with-latest-posts/style.scss +150 -0
- package/dist/esm/badge/index.js +24 -0
- package/dist/esm/badge/style.scss +36 -0
- package/dist/esm/button/index.js +2 -0
- package/dist/esm/card/core-card.js +133 -0
- package/dist/esm/card/index.js +33 -0
- package/dist/esm/card/style-core.scss +227 -0
- package/dist/esm/card/style.scss +2 -2
- package/dist/esm/card-settings-group/index.js +42 -0
- package/dist/esm/card-settings-group/style.scss +33 -0
- package/dist/esm/card-sortable-list/index.js +381 -0
- package/dist/esm/card-sortable-list/style.scss +48 -0
- package/dist/esm/confirm-dialog/index.js +49 -0
- package/dist/esm/divider/index.js +34 -0
- package/dist/esm/divider/style.scss +51 -0
- package/dist/esm/form-token-field/style.scss +0 -5
- package/dist/esm/grid/index.js +2 -1
- package/dist/esm/grid/style.scss +63 -9
- package/dist/esm/index.js +6 -0
- package/dist/esm/modal/index.js +11 -4
- package/dist/esm/modal/style.scss +43 -13
- package/dist/esm/newspack-icon/style.scss +5 -3
- package/dist/esm/popover/style.scss +1 -1
- package/dist/esm/section-header/index.js +75 -18
- package/dist/esm/section-header/style.scss +109 -4
- package/dist/esm/style.scss +2 -0
- package/dist/esm/waiting/index.js +3 -1
- package/dist/esm/waiting/style.scss +4 -0
- package/dist/esm/web-preview/index.js +101 -42
- package/dist/esm/web-preview/style.scss +20 -53
- package/dist/esm/with-wizard/index.js +1 -1
- package/dist/esm/with-wizard/style.scss +24 -6
- package/dist/esm/with-wizard-screen/style.scss +39 -10
- package/dist/esm/wizard/components/WizardSnackbar.js +64 -0
- package/dist/esm/wizard/components/style.scss +48 -0
- package/dist/esm/wizard/index.js +101 -20
- package/dist/esm/wizard/store/index.js +46 -0
- package/package.json +5 -6
- package/shared/author-context.js +26 -0
- package/shared/hooks/use-coauthors.js +220 -0
- package/shared/hooks/use-coauthors.test.js +624 -0
- package/shared/hooks/use-custom-byline.js +47 -0
- package/shared/hooks/use-custom-byline.test.js +133 -0
- package/shared/scss/_mixins.scss +46 -0
- package/src/action-card/action-card.d.ts +7 -3
- package/src/action-card/index.js +24 -11
- package/src/action-card/style.scss +32 -14
- package/src/autocomplete-tokenfield/index.js +2 -2
- package/src/autocomplete-with-latest-posts/index.js +290 -0
- package/src/autocomplete-with-latest-posts/style.scss +150 -0
- package/src/badge/index.tsx +24 -0
- package/src/badge/style.scss +36 -0
- package/src/button/index.tsx +3 -2
- package/src/card/core-card.js +147 -0
- package/src/card/index.js +39 -1
- package/src/card/style-core.scss +227 -0
- package/src/card/style.scss +2 -2
- package/src/card-settings-group/README.md +43 -0
- package/src/card-settings-group/index.tsx +53 -0
- package/src/card-settings-group/style.scss +33 -0
- package/src/card-sortable-list/README.md +51 -0
- package/src/card-sortable-list/index.tsx +412 -0
- package/src/card-sortable-list/style.scss +48 -0
- package/src/confirm-dialog/index.tsx +64 -0
- package/src/divider/README.md +25 -0
- package/src/divider/index.js +31 -0
- package/src/divider/style.scss +51 -0
- package/src/form-token-field/style.scss +0 -5
- package/src/grid/index.tsx +2 -1
- package/src/grid/style.scss +63 -9
- package/src/index.js +6 -0
- package/src/modal/index.js +12 -3
- package/src/modal/style.scss +43 -13
- package/src/newspack-icon/style.scss +5 -3
- package/src/popover/style.scss +1 -1
- package/src/section-header/index.js +72 -13
- package/src/section-header/style.scss +109 -4
- package/src/style.scss +2 -0
- package/src/waiting/index.js +2 -1
- package/src/waiting/style.scss +4 -0
- package/src/web-preview/index.js +90 -35
- package/src/web-preview/style.scss +20 -53
- package/src/with-wizard/index.js +1 -1
- package/src/with-wizard/style.scss +24 -6
- package/src/with-wizard-screen/style.scss +39 -10
- package/src/wizard/components/WizardSnackbar.js +58 -0
- package/src/wizard/components/style.scss +48 -0
- package/src/wizard/index.js +108 -14
- package/src/wizard/store/index.js +26 -0
package/dist/cjs/grid/index.js
CHANGED
|
@@ -22,13 +22,14 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
22
22
|
|
|
23
23
|
const Grid = ({
|
|
24
24
|
className = '',
|
|
25
|
+
borders = false,
|
|
25
26
|
columns = 2,
|
|
26
27
|
gutter = 32,
|
|
27
28
|
noMargin = false,
|
|
28
29
|
rowGap = 0,
|
|
29
30
|
...otherProps
|
|
30
31
|
}) => {
|
|
31
|
-
const classes = (0, _classnames.default)('newspack-grid', noMargin && 'newspack-grid--no-margin', columns && 'newspack-grid__columns-' + columns, gutter && 'newspack-grid__gutter-' + gutter, rowGap && 'newspack-grid__row-gap-' + rowGap, className);
|
|
32
|
+
const classes = (0, _classnames.default)('newspack-grid', borders && 'newspack-grid__borders', noMargin && 'newspack-grid--no-margin', columns && 'newspack-grid__columns-' + columns, gutter && 'newspack-grid__gutter-' + gutter, rowGap && 'newspack-grid__row-gap-' + rowGap, className);
|
|
32
33
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
33
34
|
className: classes,
|
|
34
35
|
...otherProps
|
package/dist/cjs/grid/style.scss
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
// No Margin
|
|
15
15
|
&--no-margin {
|
|
16
|
-
margin: 0;
|
|
16
|
+
margin: 0 !important;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
// Gutter 0
|
|
@@ -41,6 +41,11 @@
|
|
|
41
41
|
grid-gap: 32px;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
// Gutter 64
|
|
45
|
+
&__gutter-64 {
|
|
46
|
+
grid-gap: 64px;
|
|
47
|
+
}
|
|
48
|
+
|
|
44
49
|
// Row Gap 0
|
|
45
50
|
&__row-gap-0 {
|
|
46
51
|
grid-row-gap: 0;
|
|
@@ -61,11 +66,6 @@
|
|
|
61
66
|
grid-row-gap: 32px;
|
|
62
67
|
}
|
|
63
68
|
|
|
64
|
-
// Gutter 64
|
|
65
|
-
&__gutter-64 {
|
|
66
|
-
grid-gap: 64px;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
69
|
// Columns 6
|
|
70
70
|
&__columns-6 {
|
|
71
71
|
grid-template-columns: repeat(2, 1fr);
|
|
@@ -77,6 +77,14 @@
|
|
|
77
77
|
&__columns-3,
|
|
78
78
|
&__columns-4 {
|
|
79
79
|
grid-template-columns: repeat(2, 1fr);
|
|
80
|
+
|
|
81
|
+
> [start] {
|
|
82
|
+
grid-column-start: 1;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
> [end] {
|
|
86
|
+
grid-column-end: -1;
|
|
87
|
+
}
|
|
80
88
|
}
|
|
81
89
|
|
|
82
90
|
&__columns-6 {
|
|
@@ -84,8 +92,8 @@
|
|
|
84
92
|
}
|
|
85
93
|
}
|
|
86
94
|
|
|
87
|
-
// Media Queries -
|
|
88
|
-
@media screen and ( min-width:
|
|
95
|
+
// Media Queries - 1054px
|
|
96
|
+
@media screen and ( min-width: 1054px ) {
|
|
89
97
|
// Columns 3
|
|
90
98
|
&__columns-3 {
|
|
91
99
|
grid-template-columns: repeat(3, 1fr);
|
|
@@ -94,6 +102,14 @@
|
|
|
94
102
|
// Columns 4
|
|
95
103
|
&__columns-4 {
|
|
96
104
|
grid-template-columns: repeat(4, 1fr);
|
|
105
|
+
|
|
106
|
+
> [start="2"] {
|
|
107
|
+
grid-column-start: 2;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
> [end="4"] {
|
|
111
|
+
grid-column-end: 4;
|
|
112
|
+
}
|
|
97
113
|
}
|
|
98
114
|
|
|
99
115
|
// Columns 6
|
|
@@ -116,6 +132,44 @@
|
|
|
116
132
|
> * {
|
|
117
133
|
margin-bottom: 0 !important;
|
|
118
134
|
margin-top: 0 !important;
|
|
135
|
+
> h1:first-child,
|
|
136
|
+
> h2:first-child,
|
|
137
|
+
> h3:first-child,
|
|
138
|
+
> h4:first-child,
|
|
139
|
+
> h5:first-child,
|
|
140
|
+
> h6:first-child {
|
|
141
|
+
margin-top: 0;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Borders
|
|
146
|
+
&__borders {
|
|
147
|
+
grid-gap: 0 !important;
|
|
148
|
+
> * {
|
|
149
|
+
border-bottom: 1px solid wp-colors.$gray-300;
|
|
150
|
+
&:last-child {
|
|
151
|
+
border-bottom: none;
|
|
152
|
+
}
|
|
153
|
+
@media screen and ( min-width: 744px ) {
|
|
154
|
+
border-bottom: none;
|
|
155
|
+
border-right: 1px solid wp-colors.$gray-300;
|
|
156
|
+
&:last-child {
|
|
157
|
+
border-right: none;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
&.newspack-grid__gutter-8 > * {
|
|
162
|
+
padding: 8px;
|
|
163
|
+
}
|
|
164
|
+
&.newspack-grid__gutter-16 > * {
|
|
165
|
+
padding: 16px;
|
|
166
|
+
}
|
|
167
|
+
&.newspack-grid__gutter-32 > * {
|
|
168
|
+
padding: 32px;
|
|
169
|
+
}
|
|
170
|
+
&.newspack-grid__gutter-64 > * {
|
|
171
|
+
padding: 64px;
|
|
172
|
+
}
|
|
119
173
|
}
|
|
120
174
|
|
|
121
175
|
.components-base-control {
|
|
@@ -163,4 +217,4 @@
|
|
|
163
217
|
&__tbody + &__tbody {
|
|
164
218
|
margin-top: -32px;
|
|
165
219
|
}
|
|
166
|
-
}
|
|
220
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -22,12 +22,24 @@ Object.defineProperty(exports, "AutocompleteTokenField", {
|
|
|
22
22
|
return _autocompleteTokenfield.default;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
+
Object.defineProperty(exports, "AutocompleteWithLatestPosts", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _autocompleteWithLatestPosts.default;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
25
31
|
Object.defineProperty(exports, "AutocompleteWithSuggestions", {
|
|
26
32
|
enumerable: true,
|
|
27
33
|
get: function () {
|
|
28
34
|
return _autocompleteWithSuggestions.default;
|
|
29
35
|
}
|
|
30
36
|
});
|
|
37
|
+
Object.defineProperty(exports, "Badge", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return _badge.default;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
31
43
|
Object.defineProperty(exports, "BoxContrast", {
|
|
32
44
|
enumerable: true,
|
|
33
45
|
get: function () {
|
|
@@ -52,6 +64,18 @@ Object.defineProperty(exports, "Card", {
|
|
|
52
64
|
return _card.default;
|
|
53
65
|
}
|
|
54
66
|
});
|
|
67
|
+
Object.defineProperty(exports, "CardSettingsGroup", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () {
|
|
70
|
+
return _cardSettingsGroup.default;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
Object.defineProperty(exports, "CardSortableList", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return _cardSortableList.default;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
55
79
|
Object.defineProperty(exports, "CategoryAutocomplete", {
|
|
56
80
|
enumerable: true,
|
|
57
81
|
get: function () {
|
|
@@ -64,12 +88,24 @@ Object.defineProperty(exports, "ColorPicker", {
|
|
|
64
88
|
return _colorPicker.default;
|
|
65
89
|
}
|
|
66
90
|
});
|
|
91
|
+
Object.defineProperty(exports, "ConfirmDialog", {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function () {
|
|
94
|
+
return _confirmDialog.default;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
67
97
|
Object.defineProperty(exports, "CustomSelectControl", {
|
|
68
98
|
enumerable: true,
|
|
69
99
|
get: function () {
|
|
70
100
|
return _customSelectControl.default;
|
|
71
101
|
}
|
|
72
102
|
});
|
|
103
|
+
Object.defineProperty(exports, "Divider", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function () {
|
|
106
|
+
return _divider.default;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
73
109
|
Object.defineProperty(exports, "Footer", {
|
|
74
110
|
enumerable: true,
|
|
75
111
|
get: function () {
|
|
@@ -272,13 +308,19 @@ var _accordion = _interopRequireDefault(require("./accordion"));
|
|
|
272
308
|
var _actionCard = _interopRequireDefault(require("./action-card"));
|
|
273
309
|
var _autocompleteTokenfield = _interopRequireDefault(require("./autocomplete-tokenfield"));
|
|
274
310
|
var _autocompleteWithSuggestions = _interopRequireDefault(require("./autocomplete-with-suggestions"));
|
|
311
|
+
var _autocompleteWithLatestPosts = _interopRequireDefault(require("./autocomplete-with-latest-posts"));
|
|
312
|
+
var _badge = _interopRequireDefault(require("./badge"));
|
|
275
313
|
var _button = _interopRequireDefault(require("./button"));
|
|
276
314
|
var _buttonCard = _interopRequireDefault(require("./button-card"));
|
|
277
315
|
var _boxContrast = _interopRequireDefault(require("./box-contrast"));
|
|
278
316
|
var _card = _interopRequireDefault(require("./card"));
|
|
317
|
+
var _cardSettingsGroup = _interopRequireDefault(require("./card-settings-group"));
|
|
318
|
+
var _cardSortableList = _interopRequireDefault(require("./card-sortable-list"));
|
|
279
319
|
var _categoryAutocomplete = _interopRequireDefault(require("./category-autocomplete"));
|
|
280
320
|
var _colorPicker = _interopRequireDefault(require("./color-picker"));
|
|
321
|
+
var _confirmDialog = _interopRequireDefault(require("./confirm-dialog"));
|
|
281
322
|
var _customSelectControl = _interopRequireDefault(require("./custom-select-control"));
|
|
323
|
+
var _divider = _interopRequireDefault(require("./divider"));
|
|
282
324
|
var _formTokenField = _interopRequireDefault(require("./form-token-field"));
|
|
283
325
|
var _footer = _interopRequireDefault(require("./footer"));
|
|
284
326
|
var _handoff = _interopRequireDefault(require("./handoff"));
|
package/dist/cjs/modal/index.js
CHANGED
|
@@ -26,16 +26,23 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
26
26
|
* External dependencies.
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
+
const sizeClassMap = {
|
|
30
|
+
small: 'newspack-modal--size-small',
|
|
31
|
+
medium: 'newspack-modal--size-medium',
|
|
32
|
+
large: 'newspack-modal--size-large',
|
|
33
|
+
'x-large': 'newspack-modal--size-x-large',
|
|
34
|
+
full: 'newspack-modal--size-full'
|
|
35
|
+
};
|
|
36
|
+
const getSizeClassName = size => sizeClassMap[size] || sizeClassMap.medium;
|
|
29
37
|
function Modal({
|
|
30
38
|
className,
|
|
31
|
-
|
|
32
|
-
isNarrow,
|
|
39
|
+
size = 'medium',
|
|
33
40
|
hideTitle,
|
|
34
41
|
...otherProps
|
|
35
42
|
}, ref) {
|
|
36
|
-
const classes = (0, _classnames.default)('newspack-modal',
|
|
43
|
+
const classes = (0, _classnames.default)('newspack-modal', hideTitle && 'newspack-modal--hide-title',
|
|
37
44
|
// Note: also hides the X close button.
|
|
38
|
-
className);
|
|
45
|
+
getSizeClassName(size), className);
|
|
39
46
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Modal, {
|
|
40
47
|
className: classes,
|
|
41
48
|
...otherProps,
|
|
@@ -12,20 +12,37 @@
|
|
|
12
12
|
--wp-admin-theme-color-darker-10--rgb: #{colors.$primary-700--rgb};
|
|
13
13
|
--wp-admin-theme-color-darker-20: #{colors.$primary-800};
|
|
14
14
|
--wp-admin-theme-color-darker-20--rgb: #{colors.$primary-800--rgb};
|
|
15
|
+
--wp-admin-theme-color-lighter-10: #{colors.$primary-000};
|
|
16
|
+
--wp-admin-theme-color-lighter-10--rgb: #{colors.$primary-000--rgb};
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
border-radius: 8px;
|
|
19
|
+
margin: auto;
|
|
20
|
+
max-height: calc(100% - 64px);
|
|
21
|
+
max-width: 512px;
|
|
22
|
+
width: calc(100% - 64px);
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
&--size-small {
|
|
25
|
+
max-width: 384px;
|
|
26
|
+
|
|
27
|
+
&.newspack-modal--hide-title {
|
|
28
|
+
max-width: 350px;
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
31
|
|
|
26
|
-
&--
|
|
27
|
-
max-width:
|
|
28
|
-
|
|
32
|
+
&--size-medium {
|
|
33
|
+
max-width: 512px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&--size-large {
|
|
37
|
+
max-width: 840px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&--size-x-large {
|
|
41
|
+
max-width: calc(var(--newspack-wizard-section-width) + 64px)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&--size-full {
|
|
45
|
+
max-width: 100%;
|
|
29
46
|
}
|
|
30
47
|
|
|
31
48
|
&--hide-title {
|
|
@@ -39,8 +56,15 @@
|
|
|
39
56
|
}
|
|
40
57
|
}
|
|
41
58
|
|
|
42
|
-
|
|
43
|
-
|
|
59
|
+
&--destructive {
|
|
60
|
+
.components-button.is-primary {
|
|
61
|
+
background-color: colors.$error-500;
|
|
62
|
+
color: colors.$neutral-000;
|
|
63
|
+
&:hover,
|
|
64
|
+
&:focus {
|
|
65
|
+
background-color: colors.$error-600;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
44
68
|
}
|
|
45
69
|
|
|
46
70
|
// Links
|
|
@@ -60,8 +84,14 @@
|
|
|
60
84
|
}
|
|
61
85
|
|
|
62
86
|
.components-modal__content {
|
|
63
|
-
>
|
|
64
|
-
|
|
87
|
+
> * {
|
|
88
|
+
&:first-child {
|
|
89
|
+
margin-top: 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&:last-child {
|
|
93
|
+
margin-bottom: 0;
|
|
94
|
+
}
|
|
65
95
|
}
|
|
66
96
|
}
|
|
67
97
|
}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
+
@use '../../../colors/colors.module.scss' as colors;
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Newspack Icon
|
|
3
5
|
*/
|
|
4
6
|
|
|
5
7
|
.newspack-icon {
|
|
6
|
-
background:
|
|
8
|
+
background: colors.$primary-600;
|
|
7
9
|
fill: white;
|
|
8
10
|
padding: 12px;
|
|
9
11
|
|
|
10
12
|
&--white {
|
|
11
13
|
background: white;
|
|
12
|
-
fill:
|
|
14
|
+
fill: colors.$primary-600;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
&--simple {
|
|
16
18
|
background: none;
|
|
17
|
-
fill:
|
|
19
|
+
fill: colors.$primary-600;
|
|
18
20
|
padding: 0;
|
|
19
21
|
}
|
|
20
22
|
|
|
@@ -5,7 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _i18n = require("@wordpress/i18n");
|
|
8
9
|
var _element = require("@wordpress/element");
|
|
10
|
+
var _components = require("@wordpress/components");
|
|
11
|
+
var _icons = require("@wordpress/icons");
|
|
9
12
|
var _ = require("..");
|
|
10
13
|
require("./style.scss");
|
|
11
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
@@ -18,6 +21,8 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
18
21
|
* WordPress dependencies
|
|
19
22
|
*/
|
|
20
23
|
|
|
24
|
+
// eslint-disable-line @wordpress/no-unsafe-wp-apis
|
|
25
|
+
|
|
21
26
|
/**
|
|
22
27
|
* Internal dependencies
|
|
23
28
|
*/
|
|
@@ -30,14 +35,20 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
30
35
|
* Represents a section header component.
|
|
31
36
|
*
|
|
32
37
|
* @typedef {Object} SectionHeaderProps
|
|
33
|
-
* @property {
|
|
34
|
-
* @property {
|
|
35
|
-
* @property {string
|
|
36
|
-
* @property {
|
|
37
|
-
* @property {
|
|
38
|
-
* @property {
|
|
39
|
-
* @property {
|
|
40
|
-
* @property {
|
|
38
|
+
* @property {string} [backNav=''] - URL to navigate back to.
|
|
39
|
+
* @property {string|string[]} [badge] - Badge to display in the header.
|
|
40
|
+
* @property {string} [badgeLevel] - Badge level, e.g., 'success', 'info', 'warning', 'error'.
|
|
41
|
+
* @property {boolean} [centered=false] - Indicates if the header is centered.
|
|
42
|
+
* @property {?string} [className=null] - Additional CSS class name.
|
|
43
|
+
* @property {string|Function|*} [description] - Description of the section.
|
|
44
|
+
* @property {number} [heading=2] - HTML heading level, e.g., 1 for h1, 2 for h2, etc.
|
|
45
|
+
* @property {string|Function|*} [icon] - Icon to display in the header.
|
|
46
|
+
* @property {boolean} [isWhite=false] - Indicates if the header should use a white theme.
|
|
47
|
+
* @property {boolean} [noMargin=false] - Indicates if the header should have no margin.
|
|
48
|
+
* @property {boolean} [pageHeader=false] - Indicates if the header is used as a page header.
|
|
49
|
+
* @property {string} title - The title of the section.
|
|
50
|
+
* @property {?string} [id=null] - Optional ID for the header element.
|
|
51
|
+
* @property {?string|Function|*} [children=null] - Optional children to display in the header.
|
|
41
52
|
*/
|
|
42
53
|
|
|
43
54
|
/**
|
|
@@ -45,14 +56,21 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
45
56
|
*
|
|
46
57
|
* @param {SectionHeaderProps} props - The properties for the section header.
|
|
47
58
|
*/const SectionHeader = ({
|
|
59
|
+
backNav = '',
|
|
60
|
+
badges,
|
|
48
61
|
centered = false,
|
|
49
62
|
className = null,
|
|
50
63
|
description = '',
|
|
51
64
|
heading = 2,
|
|
65
|
+
icon = null,
|
|
52
66
|
isWhite = false,
|
|
53
67
|
noMargin = false,
|
|
68
|
+
pageHeader = false,
|
|
54
69
|
title,
|
|
55
|
-
id = null
|
|
70
|
+
id = null,
|
|
71
|
+
primaryAction,
|
|
72
|
+
secondaryAction,
|
|
73
|
+
children = null
|
|
56
74
|
}) => {
|
|
57
75
|
// If id is in the URL as a scrollTo param, scroll to it on render.
|
|
58
76
|
const ref = (0, _element.useRef)();
|
|
@@ -68,18 +86,48 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
68
86
|
}), 250);
|
|
69
87
|
}
|
|
70
88
|
}, []);
|
|
71
|
-
const classes = (0, _classnames.default)('newspack-section-header', centered && 'newspack-section-header--is-centered', isWhite && 'newspack-section-header--is-white', noMargin && 'newspack-section-header--no-margin',
|
|
72
|
-
const HeadingTag = `h${heading}`;
|
|
73
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
89
|
+
const classes = (0, _classnames.default)('newspack-section-header', centered && 'newspack-section-header--is-centered', isWhite && 'newspack-section-header--is-white', noMargin && 'newspack-section-header--no-margin', pageHeader && 'newspack-section-header--page-header');
|
|
90
|
+
const HeadingTag = pageHeader ? 'h1' : `h${heading}`;
|
|
91
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
74
92
|
id: id,
|
|
75
|
-
className:
|
|
93
|
+
className: (0, _classnames.default)('newspack-section-header__container', backNav && 'newspack-section-header--has-back-nav', primaryAction && 'newspack-section-header--has-primary-action', className),
|
|
76
94
|
ref: ref,
|
|
77
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Grid, {
|
|
95
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Grid, {
|
|
78
96
|
columns: 1,
|
|
79
97
|
gutter: 8,
|
|
80
98
|
className: classes,
|
|
81
|
-
children: [
|
|
82
|
-
|
|
99
|
+
children: [icon && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
100
|
+
className: "newspack-section-header__icon",
|
|
101
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
|
|
102
|
+
icon: icon,
|
|
103
|
+
size: 48
|
|
104
|
+
})
|
|
105
|
+
}), backNav && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
106
|
+
className: "newspack-section-header__back-nav",
|
|
107
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Tooltip, {
|
|
108
|
+
text: (0, _i18n.__)('Go back', 'newspack-plugin'),
|
|
109
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
|
|
110
|
+
href: backNav,
|
|
111
|
+
icon: _icons.chevronLeft,
|
|
112
|
+
variant: "tertiary"
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
}), typeof title === 'string' && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
116
|
+
className: "newspack-section-header__title-container",
|
|
117
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(HeadingTag, {
|
|
118
|
+
children: title
|
|
119
|
+
}), badges?.length ? badges.map((badge, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Badge, {
|
|
120
|
+
text: badge.label,
|
|
121
|
+
level: badge.level || 'default'
|
|
122
|
+
}, i)) : null, secondaryAction && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
123
|
+
className: "newspack-section-header__secondary-action",
|
|
124
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
|
|
125
|
+
variant: "link",
|
|
126
|
+
href: secondaryAction.href,
|
|
127
|
+
onClick: secondaryAction.action,
|
|
128
|
+
children: secondaryAction.label
|
|
129
|
+
})
|
|
130
|
+
})]
|
|
83
131
|
}), typeof title === 'function' && /*#__PURE__*/(0, _jsxRuntime.jsx)(HeadingTag, {
|
|
84
132
|
children: title()
|
|
85
133
|
}), description && typeof description === 'string' && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
@@ -88,8 +136,19 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
88
136
|
children: description()
|
|
89
137
|
}), description && typeof description !== 'string' && typeof description !== 'function' && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
90
138
|
children: description
|
|
139
|
+
}), children && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
140
|
+
className: "newspack-section-header__children",
|
|
141
|
+
children: children
|
|
91
142
|
})]
|
|
92
|
-
})
|
|
143
|
+
}), primaryAction && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
144
|
+
className: "newspack-section-header__primary-action",
|
|
145
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
|
|
146
|
+
href: primaryAction.href,
|
|
147
|
+
variant: "primary",
|
|
148
|
+
onClick: primaryAction.action,
|
|
149
|
+
children: primaryAction.label
|
|
150
|
+
})
|
|
151
|
+
})]
|
|
93
152
|
});
|
|
94
153
|
};
|
|
95
154
|
var _default = exports.default = SectionHeader;
|
|
@@ -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
|
|
11
|
-
|
|
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/dist/cjs/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
|
|
@@ -36,12 +36,14 @@ class Waiting extends _element.Component {
|
|
|
36
36
|
isRight,
|
|
37
37
|
isLeft,
|
|
38
38
|
isCenter,
|
|
39
|
+
noMargin,
|
|
39
40
|
...otherProps
|
|
40
41
|
} = this.props;
|
|
41
42
|
const classes = (0, _classnames.default)('newspack-waiting', className, {
|
|
42
43
|
'is-right': isRight,
|
|
43
44
|
'is-left': isLeft,
|
|
44
|
-
'is-center': isCenter
|
|
45
|
+
'is-center': isCenter,
|
|
46
|
+
'no-margin': noMargin
|
|
45
47
|
});
|
|
46
48
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {
|
|
47
49
|
className: classes,
|