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.
Files changed (135) hide show
  1. package/colors/colors.module.scss +1 -1
  2. package/dist/cjs/action-card/index.js +21 -12
  3. package/dist/cjs/action-card/style.scss +32 -14
  4. package/dist/cjs/autocomplete-tokenfield/index.js +2 -2
  5. package/dist/cjs/autocomplete-with-latest-posts/index.js +289 -0
  6. package/dist/cjs/autocomplete-with-latest-posts/style.scss +150 -0
  7. package/dist/cjs/badge/index.js +32 -0
  8. package/dist/cjs/badge/style.scss +36 -0
  9. package/dist/cjs/button/index.js +2 -0
  10. package/dist/cjs/card/core-card.js +141 -0
  11. package/dist/cjs/card/index.js +33 -0
  12. package/dist/cjs/card/style-core.scss +227 -0
  13. package/dist/cjs/card/style.scss +2 -2
  14. package/dist/cjs/card-settings-group/index.js +49 -0
  15. package/dist/cjs/card-settings-group/style.scss +33 -0
  16. package/dist/cjs/card-sortable-list/index.js +390 -0
  17. package/dist/cjs/card-sortable-list/style.scss +48 -0
  18. package/dist/cjs/confirm-dialog/index.js +59 -0
  19. package/dist/cjs/divider/index.js +42 -0
  20. package/dist/cjs/divider/style.scss +51 -0
  21. package/dist/cjs/form-token-field/style.scss +0 -5
  22. package/dist/cjs/grid/index.js +2 -1
  23. package/dist/cjs/grid/style.scss +63 -9
  24. package/dist/cjs/index.js +42 -0
  25. package/dist/cjs/modal/index.js +11 -4
  26. package/dist/cjs/modal/style.scss +43 -13
  27. package/dist/cjs/newspack-icon/style.scss +5 -3
  28. package/dist/cjs/popover/style.scss +1 -1
  29. package/dist/cjs/section-header/index.js +76 -17
  30. package/dist/cjs/section-header/style.scss +109 -4
  31. package/dist/cjs/style.scss +2 -0
  32. package/dist/cjs/waiting/index.js +3 -1
  33. package/dist/cjs/waiting/style.scss +4 -0
  34. package/dist/cjs/web-preview/index.js +98 -39
  35. package/dist/cjs/web-preview/style.scss +20 -53
  36. package/dist/cjs/with-wizard/index.js +1 -1
  37. package/dist/cjs/with-wizard/style.scss +24 -6
  38. package/dist/cjs/with-wizard-screen/style.scss +39 -10
  39. package/dist/cjs/wizard/components/WizardSnackbar.js +70 -0
  40. package/dist/cjs/wizard/components/style.scss +48 -0
  41. package/dist/cjs/wizard/index.js +97 -16
  42. package/dist/cjs/wizard/store/index.js +46 -0
  43. package/dist/esm/action-card/index.js +21 -12
  44. package/dist/esm/action-card/style.scss +32 -14
  45. package/dist/esm/autocomplete-tokenfield/index.js +2 -2
  46. package/dist/esm/autocomplete-with-latest-posts/index.js +281 -0
  47. package/dist/esm/autocomplete-with-latest-posts/style.scss +150 -0
  48. package/dist/esm/badge/index.js +24 -0
  49. package/dist/esm/badge/style.scss +36 -0
  50. package/dist/esm/button/index.js +2 -0
  51. package/dist/esm/card/core-card.js +133 -0
  52. package/dist/esm/card/index.js +33 -0
  53. package/dist/esm/card/style-core.scss +227 -0
  54. package/dist/esm/card/style.scss +2 -2
  55. package/dist/esm/card-settings-group/index.js +42 -0
  56. package/dist/esm/card-settings-group/style.scss +33 -0
  57. package/dist/esm/card-sortable-list/index.js +381 -0
  58. package/dist/esm/card-sortable-list/style.scss +48 -0
  59. package/dist/esm/confirm-dialog/index.js +49 -0
  60. package/dist/esm/divider/index.js +34 -0
  61. package/dist/esm/divider/style.scss +51 -0
  62. package/dist/esm/form-token-field/style.scss +0 -5
  63. package/dist/esm/grid/index.js +2 -1
  64. package/dist/esm/grid/style.scss +63 -9
  65. package/dist/esm/index.js +6 -0
  66. package/dist/esm/modal/index.js +11 -4
  67. package/dist/esm/modal/style.scss +43 -13
  68. package/dist/esm/newspack-icon/style.scss +5 -3
  69. package/dist/esm/popover/style.scss +1 -1
  70. package/dist/esm/section-header/index.js +75 -18
  71. package/dist/esm/section-header/style.scss +109 -4
  72. package/dist/esm/style.scss +2 -0
  73. package/dist/esm/waiting/index.js +3 -1
  74. package/dist/esm/waiting/style.scss +4 -0
  75. package/dist/esm/web-preview/index.js +101 -42
  76. package/dist/esm/web-preview/style.scss +20 -53
  77. package/dist/esm/with-wizard/index.js +1 -1
  78. package/dist/esm/with-wizard/style.scss +24 -6
  79. package/dist/esm/with-wizard-screen/style.scss +39 -10
  80. package/dist/esm/wizard/components/WizardSnackbar.js +64 -0
  81. package/dist/esm/wizard/components/style.scss +48 -0
  82. package/dist/esm/wizard/index.js +101 -20
  83. package/dist/esm/wizard/store/index.js +46 -0
  84. package/package.json +5 -6
  85. package/shared/author-context.js +26 -0
  86. package/shared/hooks/use-coauthors.js +220 -0
  87. package/shared/hooks/use-coauthors.test.js +624 -0
  88. package/shared/hooks/use-custom-byline.js +47 -0
  89. package/shared/hooks/use-custom-byline.test.js +133 -0
  90. package/shared/scss/_mixins.scss +46 -0
  91. package/src/action-card/action-card.d.ts +7 -3
  92. package/src/action-card/index.js +24 -11
  93. package/src/action-card/style.scss +32 -14
  94. package/src/autocomplete-tokenfield/index.js +2 -2
  95. package/src/autocomplete-with-latest-posts/index.js +290 -0
  96. package/src/autocomplete-with-latest-posts/style.scss +150 -0
  97. package/src/badge/index.tsx +24 -0
  98. package/src/badge/style.scss +36 -0
  99. package/src/button/index.tsx +3 -2
  100. package/src/card/core-card.js +147 -0
  101. package/src/card/index.js +39 -1
  102. package/src/card/style-core.scss +227 -0
  103. package/src/card/style.scss +2 -2
  104. package/src/card-settings-group/README.md +43 -0
  105. package/src/card-settings-group/index.tsx +53 -0
  106. package/src/card-settings-group/style.scss +33 -0
  107. package/src/card-sortable-list/README.md +51 -0
  108. package/src/card-sortable-list/index.tsx +412 -0
  109. package/src/card-sortable-list/style.scss +48 -0
  110. package/src/confirm-dialog/index.tsx +64 -0
  111. package/src/divider/README.md +25 -0
  112. package/src/divider/index.js +31 -0
  113. package/src/divider/style.scss +51 -0
  114. package/src/form-token-field/style.scss +0 -5
  115. package/src/grid/index.tsx +2 -1
  116. package/src/grid/style.scss +63 -9
  117. package/src/index.js +6 -0
  118. package/src/modal/index.js +12 -3
  119. package/src/modal/style.scss +43 -13
  120. package/src/newspack-icon/style.scss +5 -3
  121. package/src/popover/style.scss +1 -1
  122. package/src/section-header/index.js +72 -13
  123. package/src/section-header/style.scss +109 -4
  124. package/src/style.scss +2 -0
  125. package/src/waiting/index.js +2 -1
  126. package/src/waiting/style.scss +4 -0
  127. package/src/web-preview/index.js +90 -35
  128. package/src/web-preview/style.scss +20 -53
  129. package/src/with-wizard/index.js +1 -1
  130. package/src/with-wizard/style.scss +24 -6
  131. package/src/with-wizard-screen/style.scss +39 -10
  132. package/src/wizard/components/WizardSnackbar.js +58 -0
  133. package/src/wizard/components/style.scss +48 -0
  134. package/src/wizard/index.js +108 -14
  135. package/src/wizard/store/index.js +26 -0
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Styles for AutocompleteWithLatestPosts component.
3
+ */
4
+
5
+ @use "~@wordpress/base-styles/colors" as wp-colors;
6
+
7
+ .newspack-autocomplete-with-latest-posts {
8
+ display: grid;
9
+ gap: 16px;
10
+ width: 100%;
11
+
12
+ .components-select-control__input {
13
+ max-width: none;
14
+ }
15
+
16
+ .components-input-control__backdrop {
17
+ border-color: wp-colors.$gray-700 !important;
18
+ }
19
+
20
+ .newspack-autocomplete-with-latest-posts__label,
21
+ .components-form-token-field__label,
22
+ .components-input-control__label,
23
+ .components-checkbox-control__label {
24
+ color: wp-colors.$gray-900 !important;
25
+ }
26
+
27
+ .newspack-autocomplete-tokenfield__help {
28
+ font-size: inherit;
29
+ margin-bottom: 8px !important;
30
+ }
31
+
32
+ .components-form-token-field {
33
+ &__input-container {
34
+ border-color: wp-colors.$gray-700;
35
+ }
36
+
37
+ &__suggestion {
38
+ padding: 8px;
39
+ }
40
+ }
41
+
42
+ // Hide the built-in "Separate with commas or the Enter key." help text when hideFormTokenHelp is true
43
+ &.hide-form-token-help .components-form-token-field__help {
44
+ display: none;
45
+ }
46
+
47
+ p.newspack-autocomplete-with-latest-posts__label {
48
+ font-size: inherit;
49
+ margin: 0 0 8px;
50
+ }
51
+
52
+ &__selected-items {
53
+ border-bottom: 1px solid wp-colors.$gray-700;
54
+ display: flex;
55
+ flex-wrap: wrap;
56
+ gap: 8px;
57
+ margin-bottom: 16px;
58
+ padding-bottom: 12px;
59
+
60
+ p.newspack-autocomplete-with-latest-posts__label {
61
+ flex: 0 0 100%;
62
+ margin: 0;
63
+ }
64
+ }
65
+
66
+ &__selected-item-button.components-button.is-tertiary {
67
+ background-color: wp-colors.$gray-300;
68
+ border-radius: 2px;
69
+ color: wp-colors.$gray-900;
70
+ font-size: 13px;
71
+ height: auto;
72
+ margin: 0;
73
+ padding-left: 8px;
74
+ padding-right: 8px;
75
+
76
+ &::after {
77
+ content: "✕";
78
+ margin-left: 8px;
79
+ }
80
+
81
+ &:hover {
82
+ box-shadow: none;
83
+ color: black;
84
+ }
85
+ }
86
+
87
+ &__search-suggestions,
88
+ &__search-suggestions-multiselect {
89
+ max-height: 220px;
90
+ overflow: visible auto;
91
+ margin: 0 -4px;
92
+ padding: 4px 4px 0;
93
+
94
+ .components-button {
95
+ display: block;
96
+ line-height: normal;
97
+ margin: auto;
98
+
99
+ &.is-link {
100
+ color: wp-colors.$gray-900;
101
+ padding: 8px;
102
+ text-decoration: none;
103
+ width: 100%;
104
+
105
+ &:active:not(:disabled),
106
+ &:hover:not(:disabled) {
107
+ background: wp-colors.$gray-900;
108
+ background: var(--wp-admin-theme-color);
109
+ color: white;
110
+ }
111
+ }
112
+ &.is-secondary {
113
+ margin-bottom: 8px;
114
+ margin-top: 8px;
115
+ width: 100%;
116
+ }
117
+ }
118
+ }
119
+
120
+ &__search-suggestions {
121
+ border-radius: 2px;
122
+ border: 1px solid wp-colors.$gray-700;
123
+ padding: 0;
124
+
125
+ .components-button {
126
+ line-height: normal;
127
+
128
+ &:focus:not(:disabled) {
129
+ border-radius: 0;
130
+ box-shadow: inset 0 0 0 1.5px wp-colors.$gray-900;
131
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
132
+ }
133
+
134
+ &.is-secondary {
135
+ width: calc(100% - 16px);
136
+ }
137
+ }
138
+ }
139
+
140
+ // Temp: CSS work-around.
141
+ .newspack-autocomplete-with-suggestions__label {
142
+ font-size: 11px;
143
+ font-weight: 500;
144
+ line-height: 1.4;
145
+ text-transform: uppercase;
146
+ display: block;
147
+ margin: 0 0 8px;
148
+ padding: 0;
149
+ }
150
+ }
@@ -0,0 +1,32 @@
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
+ require("./style.scss");
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+
15
+ /**
16
+ * External dependencies
17
+ */
18
+
19
+ /**
20
+ * Badge component
21
+ */
22
+ const Badge = ({
23
+ text,
24
+ level = 'default'
25
+ }) => {
26
+ const classes = (0, _classnames.default)('newspack-badge', `is-${level}`);
27
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
28
+ className: classes,
29
+ children: text
30
+ });
31
+ };
32
+ var _default = exports.default = Badge;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Badge
3
+ */
4
+
5
+ @use "~@wordpress/base-styles/colors" as wp-colors;
6
+ @use "../../../colors/colors.module" as colors;
7
+
8
+ $badge-colors: (
9
+ "info": colors.$primary-600,
10
+ "warning": wp-colors.$alert-yellow,
11
+ "error": wp-colors.$alert-red,
12
+ "success": wp-colors.$alert-green,
13
+ );
14
+
15
+ .newspack-badge {
16
+ background-color: color-mix(in srgb, wp-colors.$white 90%, var(--base-color));
17
+ border-radius: 2px;
18
+ color: color-mix(in srgb, wp-colors.$black 50%, var(--base-color));
19
+ display: block;
20
+ flex: 0 0 auto;
21
+ font-size: 12px;
22
+ line-height: 1.5;
23
+ padding: 1px 4px;
24
+
25
+ &:where(.is-default) {
26
+ background-color: wp-colors.$gray-100;
27
+ color: wp-colors.$gray-800;
28
+ }
29
+
30
+ // Generate color variants
31
+ @each $type, $color in $badge-colors {
32
+ &.is-#{$type} {
33
+ --base-color: #{$color};
34
+ }
35
+ }
36
+ }
@@ -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;
@@ -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
+ }
@@ -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: 48px 0;
140
+ margin: 32px 0;
141
141
 
142
142
  @media screen and ( min-width: 744px ) {
143
143
  margin: 64px 0;