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.
- package/dist/cjs/action-card/index.js +21 -12
- package/dist/cjs/action-card/style.scss +25 -2
- 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/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 +25 -2
- 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/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 +25 -2
- 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/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/button/index.js
CHANGED
|
@@ -27,6 +27,7 @@ const {
|
|
|
27
27
|
} = _router.default;
|
|
28
28
|
const Button = ({
|
|
29
29
|
href,
|
|
30
|
+
loading = undefined,
|
|
30
31
|
onClick,
|
|
31
32
|
...otherProps
|
|
32
33
|
}) => {
|
|
@@ -50,6 +51,7 @@ const Button = ({
|
|
|
50
51
|
}
|
|
51
52
|
// @ts-expect-error - @wordpress/components' Button can only have either href or onClick, not both.
|
|
52
53
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
54
|
+
loading: loading ? true : undefined,
|
|
53
55
|
...otherProps
|
|
54
56
|
});
|
|
55
57
|
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _i18n = require("@wordpress/i18n");
|
|
9
|
+
var _components = require("@wordpress/components");
|
|
10
|
+
var _icons = require("@wordpress/icons");
|
|
11
|
+
require("./style-core.scss");
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
/**
|
|
15
|
+
* Card using WP Core's Card component.
|
|
16
|
+
* https://wordpress.github.io/gutenberg/?path=/docs/components-card--docs
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* WordPress dependencies
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Internal dependencies
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* External dependencies
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
const CoreCard = ({
|
|
32
|
+
actions,
|
|
33
|
+
actionType,
|
|
34
|
+
as,
|
|
35
|
+
buttonsCard,
|
|
36
|
+
className,
|
|
37
|
+
footer,
|
|
38
|
+
header,
|
|
39
|
+
icon,
|
|
40
|
+
iconBackgroundColor,
|
|
41
|
+
isActive,
|
|
42
|
+
isDraggable,
|
|
43
|
+
isFirstTarget,
|
|
44
|
+
isLastTarget,
|
|
45
|
+
isNarrow,
|
|
46
|
+
isSmall,
|
|
47
|
+
dragIndex,
|
|
48
|
+
onDragCallback = () => {},
|
|
49
|
+
onHeaderClick,
|
|
50
|
+
noBorder,
|
|
51
|
+
noMargin,
|
|
52
|
+
children = null,
|
|
53
|
+
...otherProps
|
|
54
|
+
}) => {
|
|
55
|
+
const classes = (0, _classnames.default)('newspack-card--core', className, (buttonsCard || as === 'a') && 'newspack-card--core__buttons-card', isDraggable && 'newspack-card--core__is-draggable', isNarrow && 'newspack-card--core__is-narrow', isSmall && 'newspack-card--core__is-small', icon && 'newspack-card--core__has-icon', iconBackgroundColor && 'newspack-card--core__has-icon-background-color', isActive && 'newspack-card--core__is-active', children && 'newspack-card--core__has-children', noMargin && 'newspack-card--core__no-margin');
|
|
56
|
+
let sizeProps = isSmall ? 'small' : otherProps.size;
|
|
57
|
+
if (buttonsCard || as === 'a') {
|
|
58
|
+
if (!isSmall) {
|
|
59
|
+
sizeProps = 'large';
|
|
60
|
+
}
|
|
61
|
+
if (as !== 'a') {
|
|
62
|
+
otherProps.as = 'a'; // Render as an anchor tag.
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (noBorder) {
|
|
66
|
+
otherProps.isBorderless = true;
|
|
67
|
+
}
|
|
68
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Card, {
|
|
69
|
+
as: as,
|
|
70
|
+
className: classes,
|
|
71
|
+
...otherProps,
|
|
72
|
+
children: [(header || icon) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.CardHeader, {
|
|
73
|
+
as: onHeaderClick ? 'button' : undefined,
|
|
74
|
+
className: (0, _classnames.default)('newspack-card--core__header', isDraggable && 'newspack-card--core__header--is-draggable'),
|
|
75
|
+
size: sizeProps,
|
|
76
|
+
onClick: onHeaderClick,
|
|
77
|
+
children: [isDraggable && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
78
|
+
className: "newspack-card--core__header__draggable-controls",
|
|
79
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
80
|
+
className: "newspack-card--core__header__draggable-controls__drag-handle",
|
|
81
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
|
|
82
|
+
icon: _icons.dragHandle
|
|
83
|
+
})
|
|
84
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
85
|
+
className: "newspack-card--core__header__draggable-controls__move-buttons",
|
|
86
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
87
|
+
icon: _icons.chevronUp,
|
|
88
|
+
onClick: () => onDragCallback(dragIndex, dragIndex - 1),
|
|
89
|
+
disabled: isFirstTarget,
|
|
90
|
+
label: (0, _i18n.__)('Move one position up', 'newspack-plugin'),
|
|
91
|
+
size: "small"
|
|
92
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
93
|
+
icon: _icons.chevronDown,
|
|
94
|
+
onClick: () => onDragCallback(dragIndex, dragIndex + 1),
|
|
95
|
+
disabled: isLastTarget,
|
|
96
|
+
label: (0, _i18n.__)('Move one position down', 'newspack-plugin'),
|
|
97
|
+
size: "small"
|
|
98
|
+
})]
|
|
99
|
+
})]
|
|
100
|
+
}), icon && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
101
|
+
className: "newspack-card--core__icon",
|
|
102
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
|
|
103
|
+
icon: icon,
|
|
104
|
+
height: isSmall ? 24 : 48,
|
|
105
|
+
width: isSmall ? 24 : 48
|
|
106
|
+
})
|
|
107
|
+
}), header && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
108
|
+
className: "newspack-card--core__header-content",
|
|
109
|
+
children: header
|
|
110
|
+
}), !actions?.length > 0 && actionType === 'chevron' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
|
|
111
|
+
className: "newspack-card--core__action",
|
|
112
|
+
icon: _icons.chevronRight,
|
|
113
|
+
height: 24,
|
|
114
|
+
width: 24
|
|
115
|
+
}), !actions?.length > 0 && actionType === 'toggle' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
|
|
116
|
+
className: "newspack-card--core__action",
|
|
117
|
+
label: otherProps.title,
|
|
118
|
+
hideLabelFromVision: true,
|
|
119
|
+
checked: isActive,
|
|
120
|
+
onChange: () => {}
|
|
121
|
+
}), actions?.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownMenu, {
|
|
122
|
+
icon: _icons.moreVertical,
|
|
123
|
+
label: (0, _i18n.__)('More', 'newspack-plugin'),
|
|
124
|
+
children: () => actions.map((action, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
|
|
125
|
+
icon: action.icon,
|
|
126
|
+
onClick: action.action,
|
|
127
|
+
disabled: action.disabled || false,
|
|
128
|
+
isDestructive: action.destructive || false,
|
|
129
|
+
children: action.label
|
|
130
|
+
}, index))
|
|
131
|
+
})]
|
|
132
|
+
}), children && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
133
|
+
className: "newspack-card--core__body",
|
|
134
|
+
children: children
|
|
135
|
+
}), footer && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CardFooter, {
|
|
136
|
+
size: sizeProps,
|
|
137
|
+
children: footer
|
|
138
|
+
})]
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
var _default = exports.default = CoreCard;
|
package/dist/cjs/card/index.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _element = require("@wordpress/element");
|
|
9
|
+
var _coreCard = _interopRequireDefault(require("./core-card"));
|
|
9
10
|
require("./style.scss");
|
|
10
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -39,8 +40,40 @@ class Card extends _element.Component {
|
|
|
39
40
|
isSmall,
|
|
40
41
|
isWhite,
|
|
41
42
|
noBorder,
|
|
43
|
+
// Pass as `true` to render using WP Core's Card component: https://wordpress.github.io/gutenberg/?path=/docs/components-card--docs
|
|
44
|
+
__experimentalCoreCard,
|
|
45
|
+
// Pass props supported by WP Core's Card component in this single prop.
|
|
46
|
+
__experimentalCoreProps = {
|
|
47
|
+
actionType: null,
|
|
48
|
+
// chevron | toggle | button | link | none
|
|
49
|
+
header: null,
|
|
50
|
+
// Pass a React component to render in a CardHeader component.
|
|
51
|
+
icon: null,
|
|
52
|
+
footer: null,
|
|
53
|
+
// Pass a React component to render in a CardFooter component.
|
|
54
|
+
noMargin: false,
|
|
55
|
+
isDraggable: false,
|
|
56
|
+
dragIndex: null,
|
|
57
|
+
onDragCallback: () => {}
|
|
58
|
+
},
|
|
42
59
|
...otherProps
|
|
43
60
|
} = this.props;
|
|
61
|
+
if (__experimentalCoreCard) {
|
|
62
|
+
const props = {
|
|
63
|
+
buttonsCard,
|
|
64
|
+
className,
|
|
65
|
+
isMedium,
|
|
66
|
+
isNarrow,
|
|
67
|
+
isSmall,
|
|
68
|
+
isWhite,
|
|
69
|
+
noBorder,
|
|
70
|
+
...otherProps,
|
|
71
|
+
...__experimentalCoreProps
|
|
72
|
+
};
|
|
73
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_coreCard.default, {
|
|
74
|
+
...props
|
|
75
|
+
});
|
|
76
|
+
}
|
|
44
77
|
const classes = (0, _classnames.default)('newspack-card', className, buttonsCard && 'newspack-card__buttons-card', headerActions && 'newspack-card__header-actions', isMedium && 'newspack-card__is-medium', isNarrow && 'newspack-card__is-narrow', isSmall && 'newspack-card__is-small', isWhite && 'newspack-card__is-white', noBorder && 'newspack-card__no-border');
|
|
45
78
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
46
79
|
className: classes,
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Card using WP Core component
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
@use "~@wordpress/base-styles/colors" as wp-colors;
|
|
6
|
+
@use "../../../colors/colors.module" as colors;
|
|
7
|
+
|
|
8
|
+
.newspack-card--core,
|
|
9
|
+
.newspack-wizard .newspack-card--core {
|
|
10
|
+
background: white;
|
|
11
|
+
position: relative;
|
|
12
|
+
transition: background-color 125ms ease-in-out, box-shadow 125ms ease-in-out, color 125ms ease-in-out;
|
|
13
|
+
svg {
|
|
14
|
+
transition: fill 125ms ease-in-out;
|
|
15
|
+
}
|
|
16
|
+
&__icon {
|
|
17
|
+
border-radius: 50%;
|
|
18
|
+
display: grid;
|
|
19
|
+
height: 48px;
|
|
20
|
+
place-items: center;
|
|
21
|
+
width: 48px;
|
|
22
|
+
svg {
|
|
23
|
+
fill: var(--wp-admin-theme-color);
|
|
24
|
+
height: 40px;
|
|
25
|
+
width: 40px;
|
|
26
|
+
}
|
|
27
|
+
.newspack-card--core__has-icon-background-color & {
|
|
28
|
+
background: var(--wp-admin-theme-color-lighter-10);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
&__is-small {
|
|
32
|
+
h1,
|
|
33
|
+
h2,
|
|
34
|
+
h3,
|
|
35
|
+
h4,
|
|
36
|
+
h5,
|
|
37
|
+
h6 {
|
|
38
|
+
font-size: 14px;
|
|
39
|
+
font-weight: 500;
|
|
40
|
+
}
|
|
41
|
+
.newspack-card--core__icon {
|
|
42
|
+
height: 40px;
|
|
43
|
+
width: 40px;
|
|
44
|
+
svg {
|
|
45
|
+
height: 24px;
|
|
46
|
+
width: 24px;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
&__no-margin .components-card__body {
|
|
51
|
+
padding: 0 !important;
|
|
52
|
+
}
|
|
53
|
+
&__header {
|
|
54
|
+
color: wp-colors.$gray-700;
|
|
55
|
+
column-gap: 16px;
|
|
56
|
+
position: relative;
|
|
57
|
+
.newspack-card--core__action {
|
|
58
|
+
margin: 0;
|
|
59
|
+
label {
|
|
60
|
+
border: 0;
|
|
61
|
+
clip-path: inset(50%);
|
|
62
|
+
height: 1px;
|
|
63
|
+
margin: -1px;
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
padding: 0;
|
|
66
|
+
position: absolute !important;
|
|
67
|
+
width: 1px;
|
|
68
|
+
word-wrap: normal !important;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
.components-dropdown-menu {
|
|
72
|
+
aspect-ratio: 1;
|
|
73
|
+
border-left: 1px solid wp-colors.$gray-200;
|
|
74
|
+
display: grid;
|
|
75
|
+
height: 100%;
|
|
76
|
+
padding: 4px;
|
|
77
|
+
place-items: center;
|
|
78
|
+
position: absolute;
|
|
79
|
+
right: 0;
|
|
80
|
+
top: 0;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
&__header--is-draggable {
|
|
84
|
+
.newspack-card--core__header-content {
|
|
85
|
+
padding-left: 65px;
|
|
86
|
+
}
|
|
87
|
+
.newspack-card--core__header__draggable-controls {
|
|
88
|
+
align-items: center;
|
|
89
|
+
border-right: 1px solid wp-colors.$gray-200;
|
|
90
|
+
display: flex;
|
|
91
|
+
height: 100%;
|
|
92
|
+
justify-content: space-between;
|
|
93
|
+
left: 0;
|
|
94
|
+
padding: 0 8px;
|
|
95
|
+
position: absolute;
|
|
96
|
+
top: 0;
|
|
97
|
+
}
|
|
98
|
+
.newspack-card--core__header__draggable-controls__drag-handle {
|
|
99
|
+
cursor: grab;
|
|
100
|
+
display: grid;
|
|
101
|
+
place-items: center;
|
|
102
|
+
}
|
|
103
|
+
.newspack-card--core__header__draggable-controls__move-buttons {
|
|
104
|
+
display: flex;
|
|
105
|
+
flex-direction: column;
|
|
106
|
+
.components-button.has-icon {
|
|
107
|
+
height: 16px;
|
|
108
|
+
padding: 0;
|
|
109
|
+
width: 100%;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
button.newspack-card--core__header {
|
|
114
|
+
appearance: none;
|
|
115
|
+
background-color: white;
|
|
116
|
+
border: none;
|
|
117
|
+
cursor: pointer;
|
|
118
|
+
text-align: left;
|
|
119
|
+
}
|
|
120
|
+
&__header-content {
|
|
121
|
+
display: grid;
|
|
122
|
+
flex: 1;
|
|
123
|
+
grid-gap: 8px;
|
|
124
|
+
h1,
|
|
125
|
+
h2,
|
|
126
|
+
h3,
|
|
127
|
+
h4,
|
|
128
|
+
h5,
|
|
129
|
+
h6,
|
|
130
|
+
p {
|
|
131
|
+
margin-bottom: 0;
|
|
132
|
+
margin-top: 0;
|
|
133
|
+
transition: color 125ms ease-in-out;
|
|
134
|
+
}
|
|
135
|
+
h1,
|
|
136
|
+
h2,
|
|
137
|
+
h3,
|
|
138
|
+
h4,
|
|
139
|
+
h5,
|
|
140
|
+
h6 {
|
|
141
|
+
align-items: center;
|
|
142
|
+
color: wp-colors.$gray-900;
|
|
143
|
+
font-weight: 500;
|
|
144
|
+
display: flex;
|
|
145
|
+
gap: 8px;
|
|
146
|
+
.newspack-badge {
|
|
147
|
+
font-weight: 400;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
&__is-active {
|
|
152
|
+
border-color: var(--wp-admin-theme-color);
|
|
153
|
+
box-shadow: var(--wp-admin-theme-color) 0 0 0 1px;
|
|
154
|
+
button.newspack-card--core__header {
|
|
155
|
+
background-color: rgba( var(--wp-admin-theme-color--rgb), 0.04 );
|
|
156
|
+
color: var(--wp-admin-theme-color);
|
|
157
|
+
h1,
|
|
158
|
+
h2,
|
|
159
|
+
h3,
|
|
160
|
+
h4,
|
|
161
|
+
h5,
|
|
162
|
+
h6 {
|
|
163
|
+
color: var(--wp-admin-theme-color);
|
|
164
|
+
}
|
|
165
|
+
svg {
|
|
166
|
+
fill: var(--wp-admin-theme-color);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&.newspack-card--core__has-children {
|
|
171
|
+
button.newspack-card--core__header {
|
|
172
|
+
border-bottom-left-radius: 0;
|
|
173
|
+
border-bottom-right-radius: 0;
|
|
174
|
+
}
|
|
175
|
+
.newspack-card--core__body {
|
|
176
|
+
border-top: 1px solid var(--wp-admin-theme-color);
|
|
177
|
+
}
|
|
178
|
+
.components-card__divider {
|
|
179
|
+
background: wp-colors.$gray-100;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
&__buttons-card {
|
|
184
|
+
display: block;
|
|
185
|
+
text-decoration: none;
|
|
186
|
+
&:active,
|
|
187
|
+
&:hover {
|
|
188
|
+
border-color: var(--wp-admin-theme-color);
|
|
189
|
+
box-shadow: var(--wp-admin-theme-color) 0 0 0 1px;
|
|
190
|
+
.newspack-card--core__header {
|
|
191
|
+
color: var(--wp-admin-theme-color);
|
|
192
|
+
h1,
|
|
193
|
+
h2,
|
|
194
|
+
h3,
|
|
195
|
+
h4,
|
|
196
|
+
h5,
|
|
197
|
+
h6 {
|
|
198
|
+
color: var(--wp-admin-theme-color);
|
|
199
|
+
}
|
|
200
|
+
svg {
|
|
201
|
+
fill: var(--wp-admin-theme-color);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
hr.components-card__divider {
|
|
207
|
+
margin: 0;
|
|
208
|
+
}
|
|
209
|
+
&__is-narrow {
|
|
210
|
+
margin-left: auto;
|
|
211
|
+
margin-right: auto;
|
|
212
|
+
@media screen and ( min-width: 608px ) {
|
|
213
|
+
max-width: 576px;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
&__body {
|
|
217
|
+
> div:not(.components-card__body):not(.components-card__media):not(.components-card__divider) {
|
|
218
|
+
padding: 16px 24px;
|
|
219
|
+
.newspack-card--core__is-small & {
|
|
220
|
+
padding: 16px;
|
|
221
|
+
}
|
|
222
|
+
.newspack-card--core__no-margin & {
|
|
223
|
+
padding: 0;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
package/dist/cjs/card/style.scss
CHANGED
|
@@ -133,11 +133,11 @@
|
|
|
133
133
|
|
|
134
134
|
// Thematic Break
|
|
135
135
|
|
|
136
|
-
hr {
|
|
136
|
+
hr:not(.newspack-divider) {
|
|
137
137
|
background: wp-colors.$gray-300;
|
|
138
138
|
border: 0;
|
|
139
139
|
height: 1px;
|
|
140
|
-
margin:
|
|
140
|
+
margin: 32px 0;
|
|
141
141
|
|
|
142
142
|
@media screen and ( min-width: 744px ) {
|
|
143
143
|
margin: 64px 0;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _ = require("../");
|
|
8
|
+
require("./style.scss");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
/**
|
|
11
|
+
* Card - Settings group component.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const CardSettingsGroup = ({
|
|
19
|
+
actionType = 'chevron',
|
|
20
|
+
children,
|
|
21
|
+
icon = null,
|
|
22
|
+
title = '',
|
|
23
|
+
description = '',
|
|
24
|
+
isActive = false,
|
|
25
|
+
onEnable = () => {}
|
|
26
|
+
}) => {
|
|
27
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Card, {
|
|
28
|
+
className: "newspack-card--core--settings-group",
|
|
29
|
+
actionType: actionType,
|
|
30
|
+
isSmall: true,
|
|
31
|
+
__experimentalCoreCard: true,
|
|
32
|
+
__experimentalCoreProps: {
|
|
33
|
+
header: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
34
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
35
|
+
children: title
|
|
36
|
+
}), description && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
37
|
+
children: description
|
|
38
|
+
})]
|
|
39
|
+
}),
|
|
40
|
+
onHeaderClick: onEnable,
|
|
41
|
+
icon,
|
|
42
|
+
iconBackgroundColor: true,
|
|
43
|
+
isActive,
|
|
44
|
+
title
|
|
45
|
+
},
|
|
46
|
+
children: isActive && children
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
var _default = exports.default = CardSettingsGroup;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.newspack-card--core--settings-group {
|
|
2
|
+
.components-card__body {
|
|
3
|
+
> .newspack-notice {
|
|
4
|
+
margin: 16px 0;
|
|
5
|
+
}
|
|
6
|
+
> .components-base-control {
|
|
7
|
+
&:first-child {
|
|
8
|
+
margin-top: 0;
|
|
9
|
+
}
|
|
10
|
+
+ .components-base-control,
|
|
11
|
+
+ .newspack-form-token-field {
|
|
12
|
+
margin-top: 16px;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** ToggleControl switch should appear after the label. */
|
|
17
|
+
> .components-toggle-control {
|
|
18
|
+
.components-h-stack {
|
|
19
|
+
.components-form-toggle {
|
|
20
|
+
order: 2;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
.components-toggle-control__help {
|
|
24
|
+
margin-inline-start: auto;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
.newspack-grid:last-child,
|
|
28
|
+
.components-base-control:last-child,
|
|
29
|
+
p:last-child {
|
|
30
|
+
margin-bottom: 0;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|