newspack-components 4.7.0 → 4.8.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/CHANGELOG.md +20 -0
- package/DEVELOPMENT.md +42 -21
- package/dist/cjs/_mixins.scss +13 -0
- package/dist/cjs/_variables.scss +12 -0
- package/dist/cjs/action-card/index.js +18 -10
- package/dist/cjs/action-card/index.test.js +91 -0
- package/dist/cjs/action-card/style.scss +2 -40
- package/dist/cjs/button/index.js +8 -3
- package/dist/cjs/button/index.test.js +61 -5
- package/dist/cjs/card/core-card.js +0 -2
- package/dist/cjs/card/style-core.scss +7 -5
- package/dist/cjs/card-feature/index.js +75 -61
- package/dist/cjs/card-feature/index.test.js +396 -54
- package/dist/cjs/card-feature/style.scss +20 -31
- package/dist/cjs/card-form/index.js +5 -5
- package/dist/cjs/card-sortable-list/index.js +5 -3
- package/dist/cjs/card-sortable-list/index.test.js +50 -0
- package/dist/cjs/collapsible-group/context.js +19 -0
- package/dist/cjs/collapsible-group/index.js +24 -0
- package/dist/cjs/collapsible-group/index.test.js +215 -0
- package/dist/cjs/collapsible-group/item.js +61 -0
- package/dist/cjs/collapsible-group/root.js +62 -0
- package/dist/cjs/collapsible-group/style.scss +47 -0
- package/dist/cjs/collapsible-group/types.js +5 -0
- package/dist/cjs/empty-state/actions.js +45 -0
- package/dist/cjs/empty-state/context.js +41 -0
- package/dist/cjs/empty-state/header.js +66 -0
- package/dist/cjs/empty-state/index.js +31 -0
- package/dist/cjs/empty-state/index.test.js +303 -0
- package/dist/cjs/empty-state/root.js +56 -0
- package/dist/cjs/empty-state/style.scss +51 -0
- package/dist/cjs/empty-state/types.js +5 -0
- package/dist/cjs/index.js +34 -20
- package/dist/cjs/info-button/index.js +59 -43
- package/dist/cjs/info-button/index.test.js +199 -0
- package/dist/cjs/info-button/style.scss +41 -9
- package/dist/cjs/modal/style.scss +12 -12
- package/dist/cjs/newspack-icon/style.scss +4 -4
- package/dist/cjs/notice/style.scss +3 -3
- package/dist/cjs/page/style.scss +16 -16
- package/dist/cjs/plugin-installer/index.js +5 -9
- package/dist/cjs/plugin-installer/style.scss +3 -14
- package/dist/cjs/section-header/index.js +31 -18
- package/dist/cjs/section-header/index.test.js +40 -0
- package/dist/cjs/section-header/style.scss +22 -6
- package/dist/cjs/settings/DateRangeSetting.js +309 -0
- package/dist/cjs/settings/SettingsSection.js +19 -5
- package/dist/cjs/settings/SettingsSection.test.js +49 -0
- package/dist/cjs/settings/index.js +3 -1
- package/dist/cjs/settings/style.scss +40 -7
- package/dist/cjs/stat-card/body.js +41 -0
- package/dist/cjs/stat-card/constants.js +11 -0
- package/dist/cjs/stat-card/context.js +54 -0
- package/dist/cjs/stat-card/delta.js +91 -0
- package/dist/cjs/stat-card/footer.js +72 -0
- package/dist/cjs/stat-card/index.js +47 -0
- package/dist/cjs/stat-card/index.test.js +938 -0
- package/dist/cjs/stat-card/label.js +66 -0
- package/dist/cjs/stat-card/root.js +69 -0
- package/dist/cjs/stat-card/secondary.js +38 -0
- package/dist/cjs/stat-card/style.scss +89 -0
- package/dist/cjs/stat-card/types.js +5 -0
- package/dist/cjs/stat-card/value.js +78 -0
- package/dist/cjs/status-indicator/index.js +66 -0
- package/dist/cjs/status-indicator/index.test.js +101 -0
- package/dist/cjs/status-indicator/statuses.js +39 -0
- package/dist/cjs/status-indicator/style.scss +9 -0
- package/dist/cjs/status-indicator/types.js +5 -0
- package/dist/cjs/style.scss +9 -9
- package/dist/cjs/tabbed-navigation/style.scss +6 -4
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/web-preview/style.scss +11 -11
- package/dist/cjs/with-wizard/style.scss +10 -10
- package/dist/cjs/with-wizard-screen/style.scss +9 -9
- package/dist/cjs/wizard/index.js +33 -4
- package/dist/cjs/wizard/store/index.js +23 -1
- package/dist/esm/_mixins.scss +13 -0
- package/dist/esm/_variables.scss +12 -0
- package/dist/esm/action-card/index.js +18 -10
- package/dist/esm/action-card/index.test.js +89 -0
- package/dist/esm/action-card/style.scss +2 -40
- package/dist/esm/button/index.js +9 -4
- package/dist/esm/button/index.test.js +63 -5
- package/dist/esm/card/core-card.js +0 -2
- package/dist/esm/card/style-core.scss +7 -5
- package/dist/esm/card-feature/index.js +78 -62
- package/dist/esm/card-feature/index.test.js +397 -55
- package/dist/esm/card-feature/style.scss +20 -31
- package/dist/esm/card-form/index.js +5 -5
- package/dist/esm/card-sortable-list/index.js +6 -4
- package/dist/esm/card-sortable-list/index.test.js +46 -0
- package/dist/esm/collapsible-group/context.js +13 -0
- package/dist/esm/collapsible-group/index.js +17 -0
- package/dist/esm/collapsible-group/index.test.js +215 -0
- package/dist/esm/collapsible-group/item.js +53 -0
- package/dist/esm/collapsible-group/root.js +54 -0
- package/dist/esm/collapsible-group/style.scss +47 -0
- package/dist/esm/collapsible-group/types.js +1 -0
- package/dist/esm/empty-state/actions.js +37 -0
- package/dist/esm/empty-state/context.js +35 -0
- package/dist/esm/empty-state/header.js +58 -0
- package/dist/esm/empty-state/index.js +23 -0
- package/dist/esm/empty-state/index.test.js +299 -0
- package/dist/esm/empty-state/root.js +56 -0
- package/dist/esm/empty-state/style.scss +51 -0
- package/dist/esm/empty-state/types.js +1 -0
- package/dist/esm/index.js +4 -2
- package/dist/esm/info-button/index.js +54 -43
- package/dist/esm/info-button/index.test.js +195 -0
- package/dist/esm/info-button/style.scss +41 -9
- package/dist/esm/modal/style.scss +12 -12
- package/dist/esm/newspack-icon/style.scss +4 -4
- package/dist/esm/notice/style.scss +3 -3
- package/dist/esm/page/style.scss +16 -16
- package/dist/esm/plugin-installer/index.js +5 -9
- package/dist/esm/plugin-installer/style.scss +3 -14
- package/dist/esm/section-header/index.js +27 -14
- package/dist/esm/section-header/index.test.js +36 -0
- package/dist/esm/section-header/style.scss +22 -6
- package/dist/esm/settings/DateRangeSetting.js +304 -0
- package/dist/esm/settings/SettingsSection.js +16 -3
- package/dist/esm/settings/SettingsSection.test.js +45 -0
- package/dist/esm/settings/index.js +3 -1
- package/dist/esm/settings/style.scss +40 -7
- package/dist/esm/stat-card/body.js +36 -0
- package/dist/esm/stat-card/constants.js +5 -0
- package/dist/esm/stat-card/context.js +48 -0
- package/dist/esm/stat-card/delta.js +86 -0
- package/dist/esm/stat-card/footer.js +67 -0
- package/dist/esm/stat-card/index.js +33 -0
- package/dist/esm/stat-card/index.test.js +939 -0
- package/dist/esm/stat-card/label.js +61 -0
- package/dist/esm/stat-card/root.js +64 -0
- package/dist/esm/stat-card/secondary.js +33 -0
- package/dist/esm/stat-card/style.scss +89 -0
- package/dist/esm/stat-card/types.js +1 -0
- package/dist/esm/stat-card/value.js +73 -0
- package/dist/esm/status-indicator/index.js +52 -0
- package/dist/esm/status-indicator/index.test.js +96 -0
- package/dist/esm/status-indicator/statuses.js +33 -0
- package/dist/esm/status-indicator/style.scss +9 -0
- package/dist/esm/status-indicator/types.js +1 -0
- package/dist/esm/style.scss +9 -9
- package/dist/esm/tabbed-navigation/style.scss +6 -4
- package/dist/esm/types.js +1 -0
- package/dist/esm/web-preview/style.scss +11 -11
- package/dist/esm/with-wizard/style.scss +10 -10
- package/dist/esm/with-wizard-screen/style.scss +9 -9
- package/dist/esm/wizard/index.js +38 -7
- package/dist/esm/wizard/store/index.js +23 -1
- package/package.json +1 -1
- package/src/_mixins.scss +13 -0
- package/src/_variables.scss +12 -0
- package/src/action-card/action-card.d.ts +3 -2
- package/src/action-card/index.js +12 -12
- package/src/action-card/index.test.js +56 -0
- package/src/action-card/style.scss +2 -40
- package/src/button/index.test.js +52 -5
- package/src/button/index.tsx +9 -4
- package/src/card/core-card.js +0 -2
- package/src/card/style-core.scss +7 -5
- package/src/card-feature/README.md +68 -27
- package/src/card-feature/index.test.js +242 -27
- package/src/card-feature/index.tsx +77 -67
- package/src/card-feature/style.scss +20 -31
- package/src/card-form/README.md +10 -10
- package/src/card-form/index.tsx +4 -8
- package/src/card-sortable-list/README.md +4 -5
- package/src/card-sortable-list/index.test.js +29 -0
- package/src/card-sortable-list/index.tsx +7 -4
- package/src/collapsible-group/README.md +50 -0
- package/src/collapsible-group/context.ts +13 -0
- package/src/collapsible-group/index.test.js +168 -0
- package/src/collapsible-group/index.tsx +17 -0
- package/src/collapsible-group/item.tsx +42 -0
- package/src/collapsible-group/root.tsx +42 -0
- package/src/collapsible-group/style.scss +47 -0
- package/src/collapsible-group/types.ts +22 -0
- package/src/drawer/README.md +2 -2
- package/src/empty-state/README.md +165 -0
- package/src/empty-state/actions.tsx +37 -0
- package/src/empty-state/context.ts +40 -0
- package/src/empty-state/header.tsx +48 -0
- package/src/empty-state/index.test.js +247 -0
- package/src/empty-state/index.tsx +22 -0
- package/src/empty-state/root.tsx +39 -0
- package/src/empty-state/style.scss +51 -0
- package/src/empty-state/types.ts +33 -0
- package/src/index.js +4 -2
- package/src/info-button/README.md +115 -0
- package/src/info-button/index.test.js +163 -0
- package/src/info-button/index.tsx +64 -0
- package/src/info-button/style.scss +41 -9
- package/src/modal/style.scss +12 -12
- package/src/newspack-icon/style.scss +4 -4
- package/src/notice/style.scss +3 -3
- package/src/page/style.scss +16 -16
- package/src/plugin-installer/index.js +3 -9
- package/src/plugin-installer/style.scss +3 -14
- package/src/section-header/index.js +27 -14
- package/src/section-header/index.test.js +28 -0
- package/src/section-header/style.scss +22 -6
- package/src/settings/DateRangeSetting.js +266 -0
- package/src/settings/SettingsSection.js +24 -4
- package/src/settings/SettingsSection.test.js +45 -0
- package/src/settings/index.js +2 -0
- package/src/settings/style.scss +40 -7
- package/src/stat-card/README.md +434 -0
- package/src/stat-card/body.tsx +28 -0
- package/src/stat-card/constants.ts +5 -0
- package/src/stat-card/context.ts +53 -0
- package/src/stat-card/delta.tsx +88 -0
- package/src/stat-card/footer.tsx +68 -0
- package/src/stat-card/index.test.js +818 -0
- package/src/stat-card/index.tsx +48 -0
- package/src/stat-card/label.tsx +61 -0
- package/src/stat-card/root.tsx +40 -0
- package/src/stat-card/secondary.tsx +27 -0
- package/src/stat-card/style.scss +89 -0
- package/src/stat-card/types.ts +84 -0
- package/src/stat-card/value.tsx +72 -0
- package/src/status-indicator/README.md +123 -0
- package/src/status-indicator/index.test.js +70 -0
- package/src/status-indicator/index.tsx +39 -0
- package/src/status-indicator/statuses.ts +35 -0
- package/src/status-indicator/style.scss +9 -0
- package/src/status-indicator/types.ts +28 -0
- package/src/style.scss +9 -9
- package/src/tabbed-navigation/style.scss +6 -4
- package/src/types.ts +25 -0
- package/src/web-preview/style.scss +11 -11
- package/src/with-wizard/style.scss +10 -10
- package/src/with-wizard-screen/style.scss +9 -9
- package/src/wizard/index.js +49 -7
- package/src/wizard/store/index.js +26 -1
- package/dist/cjs/accordion/index.js +0 -72
- package/dist/cjs/accordion/index.test.js +0 -80
- package/dist/cjs/accordion/style.scss +0 -35
- package/dist/cjs/badge/index.js +0 -32
- package/dist/cjs/badge/style.scss +0 -36
- package/dist/esm/accordion/index.js +0 -63
- package/dist/esm/accordion/index.test.js +0 -79
- package/dist/esm/accordion/style.scss +0 -35
- package/dist/esm/badge/index.js +0 -24
- package/dist/esm/badge/style.scss +0 -36
- package/src/accordion/index.js +0 -46
- package/src/accordion/index.test.js +0 -62
- package/src/accordion/style.scss +0 -35
- package/src/badge/index.tsx +0 -26
- package/src/badge/style.scss +0 -36
- package/src/info-button/index.js +0 -38
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["suffix", "heading", "className", "children"];
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies.
|
|
8
|
+
*/
|
|
9
|
+
import { forwardRef, useEffect } from '@wordpress/element';
|
|
10
|
+
import { Stack } from '@wordpress/ui';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* External dependencies.
|
|
14
|
+
*/
|
|
15
|
+
import classnames from 'classnames';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Internal dependencies.
|
|
19
|
+
*/
|
|
20
|
+
import { useStatCardContext } from './context';
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
var headings = {
|
|
23
|
+
2: 'h2',
|
|
24
|
+
3: 'h3',
|
|
25
|
+
4: 'h4',
|
|
26
|
+
5: 'h5',
|
|
27
|
+
6: 'h6'
|
|
28
|
+
};
|
|
29
|
+
var Label = forwardRef(function Label(_ref, ref) {
|
|
30
|
+
var suffix = _ref.suffix,
|
|
31
|
+
heading = _ref.heading,
|
|
32
|
+
className = _ref.className,
|
|
33
|
+
children = _ref.children,
|
|
34
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
35
|
+
var context = useStatCardContext();
|
|
36
|
+
var level = heading !== null && heading !== void 0 ? heading : context.heading;
|
|
37
|
+
// Consumers are largely untyped JS, where an out-of-range level would
|
|
38
|
+
// otherwise render an <h7>, which carries no heading role at all.
|
|
39
|
+
var Heading = headings[level] || headings[3];
|
|
40
|
+
useEffect(function () {
|
|
41
|
+
if ('production' === process.env.NODE_ENV || headings[level]) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// eslint-disable-next-line no-console
|
|
45
|
+
console.warn("StatCard: unknown heading level \"".concat(level, "\", falling back to 3. Set `heading` on StatCard.Root or StatCard.Label to one of ").concat(Object.keys(headings).join(', '), "."));
|
|
46
|
+
}, [level]);
|
|
47
|
+
return /*#__PURE__*/_jsxs(Stack, _objectSpread(_objectSpread({
|
|
48
|
+
ref: ref,
|
|
49
|
+
direction: "row",
|
|
50
|
+
align: "flex-start",
|
|
51
|
+
justify: "space-between",
|
|
52
|
+
gap: "sm",
|
|
53
|
+
className: classnames('newspack-stat-card__label', className)
|
|
54
|
+
}, props), {}, {
|
|
55
|
+
children: [/*#__PURE__*/_jsx(Heading, {
|
|
56
|
+
className: "newspack-stat-card__label-text",
|
|
57
|
+
children: children
|
|
58
|
+
}), suffix]
|
|
59
|
+
}));
|
|
60
|
+
});
|
|
61
|
+
export default Label;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["heading", "labels", "className", "children"];
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies.
|
|
8
|
+
*/
|
|
9
|
+
import { forwardRef, useMemo } from '@wordpress/element';
|
|
10
|
+
// Aliased: this package exports a different `Card` of its own.
|
|
11
|
+
import { Card as UICard, Stack } from '@wordpress/ui';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* External dependencies.
|
|
15
|
+
*/
|
|
16
|
+
import classnames from 'classnames';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies.
|
|
20
|
+
*/
|
|
21
|
+
import { resolveStatCardLabels, StatCardContext } from './context';
|
|
22
|
+
import './style.scss';
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
var Root = forwardRef(function Root(_ref, ref) {
|
|
25
|
+
var _ref$heading = _ref.heading,
|
|
26
|
+
heading = _ref$heading === void 0 ? 3 : _ref$heading,
|
|
27
|
+
labels = _ref.labels,
|
|
28
|
+
className = _ref.className,
|
|
29
|
+
children = _ref.children,
|
|
30
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
31
|
+
// Keyed on the strings rather than the object: a caller writing `labels` inline
|
|
32
|
+
// hands over a fresh object each render, which would defeat the memo entirely.
|
|
33
|
+
var _ref2 = labels !== null && labels !== void 0 ? labels : {},
|
|
34
|
+
notApplicable = _ref2.notApplicable,
|
|
35
|
+
up = _ref2.up,
|
|
36
|
+
down = _ref2.down;
|
|
37
|
+
var context = useMemo(function () {
|
|
38
|
+
return {
|
|
39
|
+
heading: heading,
|
|
40
|
+
labels: resolveStatCardLabels({
|
|
41
|
+
notApplicable: notApplicable,
|
|
42
|
+
up: up,
|
|
43
|
+
down: down
|
|
44
|
+
})
|
|
45
|
+
};
|
|
46
|
+
}, [heading, notApplicable, up, down]);
|
|
47
|
+
return /*#__PURE__*/_jsx(StatCardContext.Provider, {
|
|
48
|
+
value: context,
|
|
49
|
+
children: /*#__PURE__*/_jsx(UICard.Root, _objectSpread(_objectSpread({
|
|
50
|
+
ref: ref,
|
|
51
|
+
className: classnames('newspack-stat-card', className)
|
|
52
|
+
}, props), {}, {
|
|
53
|
+
children: /*#__PURE__*/_jsx(UICard.Content, {
|
|
54
|
+
render: /*#__PURE__*/_jsx(Stack, {
|
|
55
|
+
direction: "column",
|
|
56
|
+
gap: "sm"
|
|
57
|
+
}),
|
|
58
|
+
className: "newspack-stat-card__content",
|
|
59
|
+
children: children
|
|
60
|
+
})
|
|
61
|
+
}))
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
export default Root;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className", "children"];
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies.
|
|
8
|
+
*/
|
|
9
|
+
import { forwardRef } from '@wordpress/element';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* External dependencies.
|
|
13
|
+
*/
|
|
14
|
+
import classnames from 'classnames';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies.
|
|
18
|
+
*/
|
|
19
|
+
import { useStatCardContext } from './context';
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
var Secondary = forwardRef(function Secondary(_ref, ref) {
|
|
22
|
+
var className = _ref.className,
|
|
23
|
+
children = _ref.children,
|
|
24
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
+
useStatCardContext();
|
|
26
|
+
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
27
|
+
ref: ref,
|
|
28
|
+
className: classnames('newspack-stat-card__secondary', className)
|
|
29
|
+
}, props), {}, {
|
|
30
|
+
children: children
|
|
31
|
+
}));
|
|
32
|
+
});
|
|
33
|
+
export default Secondary;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
@use "~@wordpress/base-styles/colors" as wp-colors;
|
|
2
|
+
@use "~@wordpress/base-styles/variables" as wp-vars;
|
|
3
|
+
@use "~@wordpress/base-styles/mixins" as wp-mixins;
|
|
4
|
+
@use "../../../colors/colors.module" as colors;
|
|
5
|
+
@use "../variables" as np-vars;
|
|
6
|
+
|
|
7
|
+
$stat-card-min-height: wp-vars.$grid-unit * 21;
|
|
8
|
+
|
|
9
|
+
.newspack-stat-card {
|
|
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
|
+
|
|
19
|
+
container-type: inline-size;
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
min-height: $stat-card-min-height;
|
|
23
|
+
|
|
24
|
+
&__content {
|
|
25
|
+
flex: 1;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&__label .newspack-info-button {
|
|
29
|
+
margin-block: calc((#{wp-vars.$font-line-height-small} - #{wp-vars.$button-size-small}) / 2);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__label-text {
|
|
33
|
+
@include wp-mixins.heading-large();
|
|
34
|
+
color: wp-colors.$gray-900;
|
|
35
|
+
margin: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&__body {
|
|
39
|
+
flex: 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&__value {
|
|
43
|
+
color: var(--wp-admin-theme-color);
|
|
44
|
+
font-size: np-vars.$font-size-3x-large;
|
|
45
|
+
font-size: clamp(#{wp-vars.$font-size-x-large}, 14cqi, #{np-vars.$font-size-3x-large});
|
|
46
|
+
font-variant-numeric: tabular-nums;
|
|
47
|
+
font-weight: wp-vars.$font-weight-medium;
|
|
48
|
+
line-height: np-vars.$font-line-height-3x-large;
|
|
49
|
+
|
|
50
|
+
&--text {
|
|
51
|
+
font-size: wp-vars.$font-size-x-large;
|
|
52
|
+
line-height: wp-vars.$font-line-height-x-large;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&__delta {
|
|
57
|
+
@include wp-mixins.heading-medium();
|
|
58
|
+
color: wp-colors.$gray-700;
|
|
59
|
+
|
|
60
|
+
&--positive {
|
|
61
|
+
color: colors.$success-600;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&--negative {
|
|
65
|
+
color: colors.$error-600;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&__action,
|
|
70
|
+
&__action.components-button {
|
|
71
|
+
font-size: wp-vars.$helptext-font-size;
|
|
72
|
+
line-height: wp-vars.$font-line-height-x-small;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&__secondary {
|
|
76
|
+
@include wp-mixins.heading-medium();
|
|
77
|
+
color: var(--wp-admin-theme-color);
|
|
78
|
+
margin: 0;
|
|
79
|
+
text-wrap: balance;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&__description {
|
|
83
|
+
color: wp-colors.$gray-700;
|
|
84
|
+
font-size: wp-vars.$helptext-font-size;
|
|
85
|
+
line-height: wp-vars.$font-line-height-x-small;
|
|
86
|
+
margin: 0;
|
|
87
|
+
text-wrap: balance;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["value", "valueLabel", "variant", "suffix", "className"];
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies.
|
|
8
|
+
*/
|
|
9
|
+
import { forwardRef, useEffect } from '@wordpress/element';
|
|
10
|
+
import { Stack, VisuallyHidden } from '@wordpress/ui';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* External dependencies.
|
|
14
|
+
*/
|
|
15
|
+
import classnames from 'classnames';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Internal dependencies.
|
|
19
|
+
*/
|
|
20
|
+
import { STAT_CARD_NULL_GLYPH } from './constants';
|
|
21
|
+
import { useStatCardContext } from './context';
|
|
22
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
+
var variants = ['figure', 'text'];
|
|
24
|
+
var Value = forwardRef(function Value(_ref, ref) {
|
|
25
|
+
var value = _ref.value,
|
|
26
|
+
valueLabel = _ref.valueLabel,
|
|
27
|
+
_ref$variant = _ref.variant,
|
|
28
|
+
variant = _ref$variant === void 0 ? 'figure' : _ref$variant,
|
|
29
|
+
suffix = _ref.suffix,
|
|
30
|
+
className = _ref.className,
|
|
31
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
var _useStatCardContext = useStatCardContext(),
|
|
33
|
+
labels = _useStatCardContext.labels;
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
if ('production' === process.env.NODE_ENV || variants.includes(variant)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
// eslint-disable-next-line no-console
|
|
39
|
+
console.warn("StatCard.Value: unknown variant \"".concat(variant, "\", falling back to figure. Use one of ").concat(variants.join(', '), "."));
|
|
40
|
+
}, [variant]);
|
|
41
|
+
|
|
42
|
+
// A blank string is a missing figure too, and an empty hero would read as one
|
|
43
|
+
// that never loaded. A zero is a figure, so it stays out of this.
|
|
44
|
+
var isNull = null === value || undefined === value || 'string' === typeof value && '' === value.trim();
|
|
45
|
+
var shown = isNull ? STAT_CARD_NULL_GLYPH : value;
|
|
46
|
+
// Trimmed, and `||` not `??`: a blank label is a missing one, and the glyph must never be left unnamed.
|
|
47
|
+
var spoken = (valueLabel === null || valueLabel === void 0 ? void 0 : valueLabel.trim()) || (isNull ? labels.notApplicable : undefined);
|
|
48
|
+
var figure = /*#__PURE__*/_jsx("span", _objectSpread(_objectSpread({
|
|
49
|
+
ref: ref,
|
|
50
|
+
className: classnames('newspack-stat-card__value', 'text' === variant && 'newspack-stat-card__value--text', className)
|
|
51
|
+
}, props), {}, {
|
|
52
|
+
children: spoken ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
53
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
54
|
+
"aria-hidden": "true",
|
|
55
|
+
children: shown
|
|
56
|
+
}), /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
57
|
+
render: /*#__PURE__*/_jsx("span", {}),
|
|
58
|
+
children: spoken
|
|
59
|
+
})]
|
|
60
|
+
}) : shown
|
|
61
|
+
}));
|
|
62
|
+
if (!suffix) {
|
|
63
|
+
return figure;
|
|
64
|
+
}
|
|
65
|
+
return /*#__PURE__*/_jsxs(Stack, {
|
|
66
|
+
direction: "row",
|
|
67
|
+
align: "baseline",
|
|
68
|
+
gap: "sm",
|
|
69
|
+
className: "newspack-stat-card__figure",
|
|
70
|
+
children: [figure, suffix]
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
export default Value;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["status", "icon", "className", "children"];
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
/**
|
|
7
|
+
* StatusIndicator
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* WordPress dependencies.
|
|
12
|
+
*/
|
|
13
|
+
import { Icon } from '@wordpress/components';
|
|
14
|
+
import { forwardRef } from '@wordpress/element';
|
|
15
|
+
import { Stack } from '@wordpress/ui';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* External dependencies.
|
|
19
|
+
*/
|
|
20
|
+
import classnames from 'classnames';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Internal dependencies.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { statusGlyph } from './statuses';
|
|
27
|
+
import './style.scss';
|
|
28
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
|
+
var StatusIndicator = forwardRef(function StatusIndicator(_ref, ref) {
|
|
30
|
+
var status = _ref.status,
|
|
31
|
+
icon = _ref.icon,
|
|
32
|
+
className = _ref.className,
|
|
33
|
+
children = _ref.children,
|
|
34
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
35
|
+
return /*#__PURE__*/_jsxs(Stack, _objectSpread(_objectSpread({
|
|
36
|
+
ref: ref,
|
|
37
|
+
direction: "row",
|
|
38
|
+
align: "center",
|
|
39
|
+
gap: "sm",
|
|
40
|
+
className: classnames('newspack-status-indicator', className)
|
|
41
|
+
}, props), {}, {
|
|
42
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
43
|
+
className: "newspack-status-indicator__icon",
|
|
44
|
+
icon: status ? statusGlyph(status) : icon,
|
|
45
|
+
size: 24
|
|
46
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
47
|
+
children: children
|
|
48
|
+
})]
|
|
49
|
+
}));
|
|
50
|
+
});
|
|
51
|
+
export { statusGlyph, STATUS_NAMES } from './statuses';
|
|
52
|
+
export default StatusIndicator;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { render, screen } from '@testing-library/react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { drafts, gift, published } from '@wordpress/icons';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import StatusIndicator, { statusGlyph, STATUS_NAMES } from '.';
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
describe('StatusIndicator', function () {
|
|
18
|
+
it('renders the glyph alongside the label', function () {
|
|
19
|
+
var _render = render(/*#__PURE__*/_jsx(StatusIndicator, {
|
|
20
|
+
status: "active",
|
|
21
|
+
children: "Active"
|
|
22
|
+
})),
|
|
23
|
+
container = _render.container;
|
|
24
|
+
expect(screen.getByText('Active')).toBeInTheDocument();
|
|
25
|
+
expect(container.querySelector('svg.newspack-status-indicator__icon')).toBeInTheDocument();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// The trim is what makes the 8px gap measure 8px, so it is styled through a
|
|
29
|
+
// class rather than left to the consumer.
|
|
30
|
+
it('carries the class the icon trim is scoped to', function () {
|
|
31
|
+
var _render2 = render(/*#__PURE__*/_jsx(StatusIndicator, {
|
|
32
|
+
status: "active",
|
|
33
|
+
children: "Active"
|
|
34
|
+
})),
|
|
35
|
+
container = _render2.container;
|
|
36
|
+
expect(container.querySelector('.newspack-status-indicator')).toBeInTheDocument();
|
|
37
|
+
expect(container.querySelector('.newspack-status-indicator__icon')).toBeInTheDocument();
|
|
38
|
+
});
|
|
39
|
+
it('draws a named status the way the vocabulary says', function () {
|
|
40
|
+
var _render3 = render(/*#__PURE__*/_jsx(StatusIndicator, {
|
|
41
|
+
status: "draft",
|
|
42
|
+
children: "Draft"
|
|
43
|
+
})),
|
|
44
|
+
named = _render3.container;
|
|
45
|
+
var _render4 = render(/*#__PURE__*/_jsx(StatusIndicator, {
|
|
46
|
+
icon: drafts,
|
|
47
|
+
children: "Draft"
|
|
48
|
+
})),
|
|
49
|
+
given = _render4.container;
|
|
50
|
+
expect(named.querySelector('svg').innerHTML).toBe(given.querySelector('svg').innerHTML);
|
|
51
|
+
});
|
|
52
|
+
it('draws the glyph it is given when there is no name for it', function () {
|
|
53
|
+
var _render5 = render(/*#__PURE__*/_jsx(StatusIndicator, {
|
|
54
|
+
icon: gift,
|
|
55
|
+
children: "Free"
|
|
56
|
+
})),
|
|
57
|
+
free = _render5.container;
|
|
58
|
+
var _render6 = render(/*#__PURE__*/_jsx(StatusIndicator, {
|
|
59
|
+
icon: published,
|
|
60
|
+
children: "Active"
|
|
61
|
+
})),
|
|
62
|
+
active = _render6.container;
|
|
63
|
+
expect(free.querySelector('svg').innerHTML).not.toBe(active.querySelector('svg').innerHTML);
|
|
64
|
+
});
|
|
65
|
+
it('keeps the consumer class and passes the rest through', function () {
|
|
66
|
+
var _render7 = render(/*#__PURE__*/_jsx(StatusIndicator, {
|
|
67
|
+
className: "custom",
|
|
68
|
+
"data-testid": "status",
|
|
69
|
+
status: "active",
|
|
70
|
+
children: "Active"
|
|
71
|
+
})),
|
|
72
|
+
container = _render7.container;
|
|
73
|
+
var root = container.querySelector('.newspack-status-indicator');
|
|
74
|
+
expect(root).toHaveClass('custom');
|
|
75
|
+
expect(root).toHaveAttribute('data-testid', 'status');
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
describe('statusGlyph', function () {
|
|
79
|
+
it('draws every name in the vocabulary', function () {
|
|
80
|
+
STATUS_NAMES.forEach(function (name) {
|
|
81
|
+
return expect(statusGlyph(name)).toBeTruthy();
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Pinning the complete list is what lets a column assert its own distinctness:
|
|
86
|
+
// any pair not named here reads apart.
|
|
87
|
+
it('shares a mark only where two names mean the same to a reader', function () {
|
|
88
|
+
var byGlyph = new Map();
|
|
89
|
+
STATUS_NAMES.forEach(function (name) {
|
|
90
|
+
return byGlyph.set(statusGlyph(name), [].concat(_toConsumableArray(byGlyph.get(statusGlyph(name)) || []), [name]));
|
|
91
|
+
});
|
|
92
|
+
expect(_toConsumableArray(byGlyph.values()).filter(function (names) {
|
|
93
|
+
return names.length > 1;
|
|
94
|
+
})).toEqual([['active', 'done'], ['cancelled', 'ended']]);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies.
|
|
3
|
+
*/
|
|
4
|
+
import { caution, drafts, error, notAllowed, pending, published, scheduled, trash, update, lock } from '@wordpress/icons';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The glyph for each status a list can report.
|
|
8
|
+
*
|
|
9
|
+
* Two names may resolve to the same glyph where they read differently at the call
|
|
10
|
+
* site but mean the same to a reader: a sent newsletter is finished rather than
|
|
11
|
+
* live, and an ad that expired was not cancelled. Splitting them leaves room to
|
|
12
|
+
* draw them apart later without touching a consumer, and it means the rule a
|
|
13
|
+
* Status column keeps is about glyphs rather than names. `statusGlyph` is
|
|
14
|
+
* exported so a column's own test can assert it.
|
|
15
|
+
*/
|
|
16
|
+
var STATUS_GLYPHS = {
|
|
17
|
+
active: published,
|
|
18
|
+
done: published,
|
|
19
|
+
scheduled: scheduled,
|
|
20
|
+
draft: drafts,
|
|
21
|
+
pending: pending,
|
|
22
|
+
attention: caution,
|
|
23
|
+
error: error,
|
|
24
|
+
progress: update,
|
|
25
|
+
cancelled: notAllowed,
|
|
26
|
+
ended: notAllowed,
|
|
27
|
+
"private": lock,
|
|
28
|
+
trash: trash
|
|
29
|
+
};
|
|
30
|
+
export var statusGlyph = function statusGlyph(status) {
|
|
31
|
+
return STATUS_GLYPHS[status];
|
|
32
|
+
};
|
|
33
|
+
export var STATUS_NAMES = Object.freeze(Object.keys(STATUS_GLYPHS));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/esm/style.scss
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
@use "~@wordpress/base-styles/colors" as wp-colors;
|
|
2
|
-
@use "../../colors/colors.module" as colors;
|
|
2
|
+
@use "../../colors/colors.module" as np-colors;
|
|
3
3
|
|
|
4
4
|
:root {
|
|
5
5
|
// WP Admin
|
|
6
|
-
--wp-admin-theme-color: #{colors.$primary-600};
|
|
7
|
-
--wp-admin-theme-color--rgb: #{colors.$primary-600--rgb};
|
|
8
|
-
--wp-admin-theme-color-darker-10: #{colors.$primary-700};
|
|
9
|
-
--wp-admin-theme-color-darker-10--rgb: #{colors.$primary-700--rgb};
|
|
10
|
-
--wp-admin-theme-color-darker-20: #{colors.$primary-800};
|
|
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};
|
|
6
|
+
--wp-admin-theme-color: #{np-colors.$primary-600};
|
|
7
|
+
--wp-admin-theme-color--rgb: #{np-colors.$primary-600--rgb};
|
|
8
|
+
--wp-admin-theme-color-darker-10: #{np-colors.$primary-700};
|
|
9
|
+
--wp-admin-theme-color-darker-10--rgb: #{np-colors.$primary-700--rgb};
|
|
10
|
+
--wp-admin-theme-color-darker-20: #{np-colors.$primary-800};
|
|
11
|
+
--wp-admin-theme-color-darker-20--rgb: #{np-colors.$primary-800--rgb};
|
|
12
|
+
--wp-admin-theme-color-lighter-10: #{np-colors.$primary-000};
|
|
13
|
+
--wp-admin-theme-color-lighter-10--rgb: #{np-colors.$primary-000--rgb};
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
// Buttons Card
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Tabbed Navigation
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
@use "../../../colors/colors.module" as colors;
|
|
5
|
+
@use "../../../colors/colors.module" as np-colors;
|
|
6
|
+
@use "../mixins" as mixins;
|
|
6
7
|
@use "~@wordpress/base-styles/colors" as wp-colors;
|
|
7
8
|
@use "~@wordpress/base-styles/variables" as wp-vars;
|
|
8
9
|
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
width: 100%;
|
|
19
20
|
|
|
20
21
|
/* stylelint-disable-next-line plugin-wpds/no-setting-wpds-custom-properties -- deliberate Newspack brand override of the indicator token. */
|
|
21
|
-
--wpds-color-stroke-interactive-neutral-strong: #{colors.$primary-600};
|
|
22
|
+
--wpds-color-stroke-interactive-neutral-strong: #{np-colors.$primary-600};
|
|
22
23
|
|
|
23
24
|
a[role="tab"] {
|
|
24
25
|
text-decoration: none;
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
|
|
54
55
|
&[data-disabled],
|
|
55
56
|
&[aria-disabled="true"] {
|
|
57
|
+
/* stylelint-disable-next-line plugin-wpds/no-unknown-ds-tokens -- the plugin's token list lags the prebuilt design-tokens.css names. */
|
|
56
58
|
color: var( --wpds-color-foreground-interactive-neutral-disabled, #{wp-colors.$gray-600} );
|
|
57
59
|
pointer-events: none;
|
|
58
60
|
}
|
|
@@ -91,12 +93,12 @@
|
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
&:focus-visible {
|
|
94
|
-
|
|
96
|
+
@include mixins.wpds-focus-ring;
|
|
95
97
|
outline-offset: calc( var( --wpds-dimension-padding-md, #{wp-vars.$grid-unit-15} ) * -1 );
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
&[aria-current="page"] {
|
|
99
|
-
box-shadow: inset 0 calc( var( --wpds-border-width-focus, #{wp-vars.$border-width-focus-fallback} ) * -1 ) 0 var( --wpds-color-stroke-interactive-neutral-strong, #{colors.$primary-600} );
|
|
101
|
+
box-shadow: inset 0 calc( var( --wpds-border-width-focus, #{wp-vars.$border-width-focus-fallback} ) * -1 ) 0 var( --wpds-color-stroke-interactive-neutral-strong, #{np-colors.$primary-600} );
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
@use "~@wordpress/base-styles/colors" as wp-colors;
|
|
6
|
-
@use "../../../colors/colors.module" as colors;
|
|
6
|
+
@use "../../../colors/colors.module" as np-colors;
|
|
7
7
|
|
|
8
8
|
.newspack-web-preview {
|
|
9
9
|
// Color
|
|
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
|
-
|
|
19
|
-
background: color-mix(in srgb, colors.$neutral-1000, transparent 65%);
|
|
10
|
+
--wp-admin-theme-color: #{np-colors.$primary-600};
|
|
11
|
+
--wp-admin-theme-color--rgb: #{np-colors.$primary-600--rgb};
|
|
12
|
+
--wp-admin-theme-color-darker-10: #{np-colors.$primary-700};
|
|
13
|
+
--wp-admin-theme-color-darker-10--rgb: #{np-colors.$primary-700--rgb};
|
|
14
|
+
--wp-admin-theme-color-darker-20: #{np-colors.$primary-800};
|
|
15
|
+
--wp-admin-theme-color-darker-20--rgb: #{np-colors.$primary-800--rgb};
|
|
16
|
+
--wp-admin-theme-color-lighter-10: #{np-colors.$primary-000};
|
|
17
|
+
--wp-admin-theme-color-lighter-10--rgb: #{np-colors.$primary-000--rgb};
|
|
18
|
+
|
|
19
|
+
background: color-mix(in srgb, np-colors.$neutral-1000, transparent 65%);
|
|
20
20
|
box-sizing: border-box;
|
|
21
21
|
height: 100%;
|
|
22
22
|
left: 0;
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
@use "~@wordpress/base-styles/colors" as wp-colors;
|
|
6
|
-
@use "../../../colors/colors.module" as colors;
|
|
6
|
+
@use "../../../colors/colors.module" as np-colors;
|
|
7
7
|
|
|
8
8
|
// Styling for full-page-react Wizards (ignoring admin-header-only wizards).
|
|
9
9
|
body.newspack-wizard-page:not(.newspack-admin-header) {
|
|
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};
|
|
10
|
+
--wp-admin-theme-color: #{np-colors.$primary-600};
|
|
11
|
+
--wp-admin-theme-color--rgb: #{np-colors.$primary-600--rgb};
|
|
12
|
+
--wp-admin-theme-color-darker-10: #{np-colors.$primary-700};
|
|
13
|
+
--wp-admin-theme-color-darker-10--rgb: #{np-colors.$primary-700--rgb};
|
|
14
|
+
--wp-admin-theme-color-darker-20: #{np-colors.$primary-800};
|
|
15
|
+
--wp-admin-theme-color-darker-20--rgb: #{np-colors.$primary-800--rgb};
|
|
16
|
+
--wp-admin-theme-color-lighter-10: #{np-colors.$primary-000};
|
|
17
|
+
--wp-admin-theme-color-lighter-10--rgb: #{np-colors.$primary-000--rgb};
|
|
18
|
+
--wp-components-color-accent: #{np-colors.$primary-600};
|
|
19
19
|
|
|
20
20
|
background: #{wp-colors.$white};
|
|
21
21
|
|