newspack-components 4.3.0 → 4.4.0-alpha.1
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 +11 -0
- package/DEVELOPMENT.md +868 -0
- package/colors/colors.module.scss +52 -2
- package/copy-styles.js +3 -2
- package/dist/cjs/accordion/index.js +17 -12
- package/dist/cjs/action-card/index.js +176 -139
- package/dist/cjs/autocomplete-tokenfield/index.js +254 -234
- package/dist/cjs/autocomplete-with-latest-posts/index.js +172 -110
- package/dist/cjs/autocomplete-with-suggestions/index.js +229 -126
- package/dist/cjs/badge/index.js +7 -7
- package/dist/cjs/box-contrast/index.js +19 -15
- package/dist/cjs/button/index.js +41 -26
- package/dist/cjs/button-props/button-props.js +5 -5
- package/dist/cjs/button-props/index.js +2 -2
- package/dist/cjs/card/core-card.js +110 -52
- package/dist/cjs/card/index.js +74 -67
- package/dist/cjs/card/style-core.scss +93 -25
- package/dist/cjs/card/style.scss +2 -2
- package/dist/cjs/card-feature/index.js +141 -0
- package/dist/cjs/card-feature/style.scss +75 -0
- package/dist/cjs/card-form/index.js +144 -0
- package/dist/cjs/card-form/style.scss +20 -0
- package/dist/cjs/card-settings-group/index.js +36 -16
- package/dist/cjs/card-sortable-list/index.js +176 -140
- package/dist/cjs/category-autocomplete/index.js +175 -155
- package/dist/cjs/color-picker/index.js +41 -23
- package/dist/cjs/color-picker/index.test.js +82 -0
- package/dist/cjs/color-picker/style.scss +11 -13
- package/dist/cjs/confirm-dialog/index.js +86 -22
- package/dist/cjs/consts.js +1 -1
- package/dist/cjs/custom-select-control/index.js +39 -28
- package/dist/cjs/dataviews/index.js +38 -0
- package/dist/cjs/dataviews/style.scss +9 -0
- package/dist/cjs/divider/index.js +26 -21
- package/dist/cjs/footer/index.js +36 -30
- package/dist/cjs/form-token-field/index.js +51 -40
- package/dist/cjs/global-notices/index.js +5 -5
- package/dist/cjs/grid/index.js +25 -19
- package/dist/cjs/grid/style.scss +6 -1
- package/dist/cjs/handoff/index.js +204 -156
- package/dist/cjs/handoff-message/index.js +12 -7
- package/dist/cjs/hooks/index.js +10 -8
- package/dist/cjs/hooks/use-confirm-dialog.js +79 -0
- package/dist/cjs/hooks/use-unsaved-changes-dialog.js +144 -0
- package/dist/cjs/hooks/useObjectState.js +21 -12
- package/dist/cjs/hooks/useObjectState.test.js +55 -33
- package/dist/cjs/hooks/useOnClickOutside.js +6 -6
- package/dist/cjs/hooks/usePrompt.js +10 -13
- package/dist/cjs/image-upload/index.js +114 -123
- package/dist/cjs/image-upload/index.test.js +11 -13
- package/dist/cjs/image-upload/style.scss +12 -40
- package/dist/cjs/index.js +136 -104
- package/dist/cjs/info-button/index.js +43 -32
- package/dist/cjs/integration-icons/active-campaign.js +22 -0
- package/dist/cjs/integration-icons/constant-contact.js +28 -0
- package/dist/cjs/integration-icons/fundraise-up.js +25 -0
- package/dist/cjs/integration-icons/index.js +48 -0
- package/dist/cjs/integration-icons/mailchimp.js +19 -0
- package/dist/cjs/integration-icons/salesforce.js +17 -0
- package/dist/cjs/integration-icons/wisepops.js +20 -0
- package/dist/cjs/modal/index.js +22 -19
- package/dist/cjs/modal/style.scss +4 -0
- package/dist/cjs/newspack-icon/index.js +45 -38
- package/dist/cjs/notice/index.js +64 -55
- package/dist/cjs/plugin-installer/index.js +259 -253
- package/dist/cjs/plugin-settings/SettingsSection.js +66 -60
- package/dist/cjs/plugin-settings/index.js +217 -200
- package/dist/cjs/plugin-toggle/index.js +192 -199
- package/dist/cjs/popover/index.js +41 -28
- package/dist/cjs/position-control/index.js +24 -23
- package/dist/cjs/progress-bar/index.js +71 -59
- package/dist/cjs/progress-bar/index.test.js +62 -68
- package/dist/cjs/proxied-imports/router.js +3 -3
- package/dist/cjs/radio-control/index.js +40 -27
- package/dist/cjs/section-header/index.js +103 -58
- package/dist/cjs/section-header/style.scss +31 -11
- package/dist/cjs/select-control/ButtonGroupControl.js +26 -21
- package/dist/cjs/select-control/GroupedSelectControl.js +41 -35
- package/dist/cjs/select-control/index.js +52 -40
- package/dist/cjs/settings/MinMaxSetting.js +30 -20
- package/dist/cjs/settings/SettingsCard.js +20 -17
- package/dist/cjs/settings/SettingsSection.js +22 -21
- package/dist/cjs/settings/index.js +5 -5
- package/dist/cjs/sortable-newsletter-list-control/index.js +78 -57
- package/dist/cjs/steps-list/index.js +44 -34
- package/dist/cjs/steps-list-item/index.js +47 -39
- package/dist/cjs/style-card/index.js +70 -63
- package/dist/cjs/tabbed-navigation/index.js +38 -36
- package/dist/cjs/text-control/index.js +27 -25
- package/dist/cjs/utils/color.js +4 -4
- package/dist/cjs/utils/editor-toolbar-back-button.js +61 -0
- package/dist/cjs/utils/index.js +31 -19
- package/dist/cjs/utils/style.scss +8 -0
- package/dist/cjs/waiting/index.js +48 -37
- package/dist/cjs/web-preview/index.js +217 -211
- package/dist/cjs/with-wizard/index.js +362 -364
- package/dist/cjs/with-wizard/style.scss +4 -54
- package/dist/cjs/with-wizard-screen/index.js +54 -58
- package/dist/cjs/with-wizard-screen/style.scss +41 -3
- package/dist/cjs/wizard/components/WizardError.js +20 -18
- package/dist/cjs/wizard/components/WizardSnackbar.js +26 -23
- package/dist/cjs/wizard/index.js +176 -114
- package/dist/cjs/wizard/store/index.js +171 -123
- package/dist/cjs/wizard/store/utils.js +13 -8
- package/dist/esm/accordion/index.js +14 -9
- package/dist/esm/action-card/index.js +168 -123
- package/dist/esm/autocomplete-tokenfield/index.js +248 -222
- package/dist/esm/autocomplete-with-latest-posts/index.js +169 -103
- package/dist/esm/autocomplete-with-suggestions/index.js +226 -119
- package/dist/esm/badge/index.js +5 -5
- package/dist/esm/box-contrast/index.js +15 -11
- package/dist/esm/button/index.js +39 -21
- package/dist/esm/button-props/button-props.js +1 -1
- package/dist/esm/card/core-card.js +109 -47
- package/dist/esm/card/index.js +69 -54
- package/dist/esm/card/style-core.scss +93 -25
- package/dist/esm/card/style.scss +2 -2
- package/dist/esm/card-feature/index.js +131 -0
- package/dist/esm/card-feature/style.scss +75 -0
- package/dist/esm/card-form/index.js +134 -0
- package/dist/esm/card-form/style.scss +20 -0
- package/dist/esm/card-settings-group/index.js +33 -14
- package/dist/esm/card-sortable-list/index.js +170 -126
- package/dist/esm/category-autocomplete/index.js +168 -140
- package/dist/esm/color-picker/index.js +39 -21
- package/dist/esm/color-picker/index.test.js +78 -0
- package/dist/esm/color-picker/style.scss +11 -13
- package/dist/esm/confirm-dialog/index.js +85 -18
- package/dist/esm/consts.js +1 -1
- package/dist/esm/custom-select-control/index.js +34 -15
- package/dist/esm/dataviews/index.js +34 -0
- package/dist/esm/dataviews/style.scss +9 -0
- package/dist/esm/divider/index.js +24 -16
- package/dist/esm/footer/index.js +34 -28
- package/dist/esm/form-token-field/index.js +46 -27
- package/dist/esm/global-notices/index.js +3 -3
- package/dist/esm/grid/index.js +23 -14
- package/dist/esm/grid/style.scss +6 -1
- package/dist/esm/handoff/index.js +199 -143
- package/dist/esm/handoff-message/index.js +10 -6
- package/dist/esm/hooks/index.js +8 -6
- package/dist/esm/hooks/use-confirm-dialog.js +73 -0
- package/dist/esm/hooks/use-unsaved-changes-dialog.js +136 -0
- package/dist/esm/hooks/useObjectState.js +19 -9
- package/dist/esm/hooks/useObjectState.test.js +54 -32
- package/dist/esm/hooks/useOnClickOutside.js +4 -4
- package/dist/esm/hooks/usePrompt.js +9 -11
- package/dist/esm/image-upload/index.js +110 -111
- package/dist/esm/image-upload/index.test.js +11 -13
- package/dist/esm/image-upload/style.scss +12 -40
- package/dist/esm/index.js +7 -1
- package/dist/esm/info-button/index.js +38 -19
- package/dist/esm/integration-icons/active-campaign.js +16 -0
- package/dist/esm/integration-icons/constant-contact.js +22 -0
- package/dist/esm/integration-icons/fundraise-up.js +19 -0
- package/dist/esm/integration-icons/index.js +6 -0
- package/dist/esm/integration-icons/mailchimp.js +13 -0
- package/dist/esm/integration-icons/salesforce.js +11 -0
- package/dist/esm/integration-icons/wisepops.js +14 -0
- package/dist/esm/modal/index.js +20 -13
- package/dist/esm/modal/style.scss +4 -0
- package/dist/esm/newspack-icon/index.js +40 -25
- package/dist/esm/notice/index.js +59 -42
- package/dist/esm/plugin-installer/index.js +255 -243
- package/dist/esm/plugin-settings/SettingsSection.js +61 -50
- package/dist/esm/plugin-settings/index.js +212 -189
- package/dist/esm/plugin-toggle/index.js +187 -190
- package/dist/esm/popover/index.js +35 -16
- package/dist/esm/position-control/index.js +22 -18
- package/dist/esm/progress-bar/index.js +66 -49
- package/dist/esm/progress-bar/index.test.js +61 -67
- package/dist/esm/radio-control/index.js +34 -15
- package/dist/esm/section-header/index.js +102 -57
- package/dist/esm/section-header/style.scss +31 -11
- package/dist/esm/select-control/ButtonGroupControl.js +23 -18
- package/dist/esm/select-control/GroupedSelectControl.js +38 -30
- package/dist/esm/select-control/index.js +47 -27
- package/dist/esm/settings/MinMaxSetting.js +27 -16
- package/dist/esm/settings/SettingsCard.js +18 -13
- package/dist/esm/settings/SettingsSection.js +20 -19
- package/dist/esm/settings/index.js +3 -3
- package/dist/esm/sortable-newsletter-list-control/index.js +74 -53
- package/dist/esm/steps-list/index.js +39 -21
- package/dist/esm/steps-list-item/index.js +42 -26
- package/dist/esm/style-card/index.js +65 -50
- package/dist/esm/tabbed-navigation/index.js +35 -33
- package/dist/esm/text-control/index.js +25 -19
- package/dist/esm/utils/color.js +4 -4
- package/dist/esm/utils/editor-toolbar-back-button.js +53 -0
- package/dist/esm/utils/index.js +29 -16
- package/dist/esm/utils/style.scss +8 -0
- package/dist/esm/waiting/index.js +43 -24
- package/dist/esm/web-preview/index.js +213 -201
- package/dist/esm/with-wizard/index.js +360 -358
- package/dist/esm/with-wizard/style.scss +4 -54
- package/dist/esm/with-wizard-screen/index.js +48 -46
- package/dist/esm/with-wizard-screen/style.scss +41 -3
- package/dist/esm/wizard/components/WizardError.js +18 -16
- package/dist/esm/wizard/components/WizardSnackbar.js +23 -17
- package/dist/esm/wizard/index.js +171 -103
- package/dist/esm/wizard/store/index.js +169 -116
- package/dist/esm/wizard/store/utils.js +13 -6
- package/package.json +30 -16
- package/release.config.js +1 -0
- package/shared/hooks/use-coauthors.js +195 -27
- package/shared/hooks/use-coauthors.test.js +232 -6
- package/shared/scss/_mixins.scss +13 -5
- package/src/accordion/index.js +8 -7
- package/src/action-card/index.js +15 -1
- package/src/badge/index.tsx +3 -1
- package/src/card/core-card.js +95 -18
- package/src/card/index.js +1 -0
- package/src/card/style-core.scss +93 -25
- package/src/card/style.scss +2 -2
- package/src/card-feature/README.md +188 -0
- package/src/card-feature/index.tsx +186 -0
- package/src/card-feature/style.scss +75 -0
- package/src/card-form/README.md +113 -0
- package/src/card-form/index.tsx +128 -0
- package/src/card-form/style.scss +20 -0
- package/src/card-settings-group/index.tsx +28 -3
- package/src/card-sortable-list/index.tsx +27 -4
- package/src/color-picker/index.js +15 -8
- package/src/color-picker/index.test.js +52 -0
- package/src/color-picker/style.scss +11 -13
- package/src/confirm-dialog/README.md +128 -0
- package/src/confirm-dialog/index.tsx +74 -6
- package/src/dataviews/index.tsx +34 -0
- package/src/dataviews/style.scss +9 -0
- package/src/grid/style.scss +6 -1
- package/src/handoff/README.md +93 -0
- package/src/handoff/index.js +46 -8
- package/src/hooks/index.ts +2 -1
- package/src/hooks/use-confirm-dialog.tsx +80 -0
- package/src/hooks/use-unsaved-changes-dialog.tsx +140 -0
- package/src/image-upload/index.js +10 -15
- package/src/image-upload/style.scss +12 -40
- package/src/index.js +7 -1
- package/src/integration-icons/active-campaign.js +14 -0
- package/src/integration-icons/constant-contact.js +22 -0
- package/src/integration-icons/fundraise-up.js +18 -0
- package/src/integration-icons/index.js +6 -0
- package/src/integration-icons/mailchimp.js +10 -0
- package/src/integration-icons/salesforce.js +10 -0
- package/src/integration-icons/wisepops.js +14 -0
- package/src/modal/style.scss +4 -0
- package/src/plugin-installer/index.js +30 -19
- package/src/section-header/index.js +56 -24
- package/src/section-header/style.scss +31 -11
- package/src/select-control/index.js +4 -0
- package/src/utils/editor-toolbar-back-button.tsx +48 -0
- package/src/utils/index.js +6 -0
- package/src/utils/style.scss +8 -0
- package/src/with-wizard/style.scss +4 -54
- package/src/with-wizard-screen/style.scss +41 -3
- package/src/wizard/index.js +90 -53
- package/src/wizard/store/index.js +2 -2
- package/dist/cjs/button-card/index.js +0 -72
- package/dist/cjs/button-card/style.scss +0 -180
- package/dist/esm/button-card/index.js +0 -64
- package/dist/esm/button-card/style.scss +0 -180
- package/src/button-card/index.js +0 -52
- package/src/button-card/style.scss +0 -180
|
@@ -1,75 +1,87 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
11
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
7
13
|
var _element = require("@wordpress/element");
|
|
8
14
|
require("./style.scss");
|
|
9
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
|
|
16
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
17
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
|
|
11
18
|
* Progress Bar
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
19
|
+
*/ /**
|
|
15
20
|
* WordPress dependencies.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
21
|
+
*/ /**
|
|
19
22
|
* Internal dependencies.
|
|
20
23
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
* @param {number} completed The number of steps completed.
|
|
27
|
-
* @param {number} total The total number of steps.
|
|
28
|
-
* @return {number} completion percentage
|
|
29
|
-
*/
|
|
30
|
-
getCompletionPercentage(completed, total) {
|
|
31
|
-
if (!total) {
|
|
32
|
-
return 100;
|
|
33
|
-
}
|
|
34
|
-
return Math.max(Math.min(Math.round(completed / total * 100), 100), 0);
|
|
24
|
+
var ProgressBar = /*#__PURE__*/function (_Component) {
|
|
25
|
+
function ProgressBar() {
|
|
26
|
+
(0, _classCallCheck2["default"])(this, ProgressBar);
|
|
27
|
+
return _callSuper(this, ProgressBar, arguments);
|
|
35
28
|
}
|
|
29
|
+
(0, _inherits2["default"])(ProgressBar, _Component);
|
|
30
|
+
return (0, _createClass2["default"])(ProgressBar, [{
|
|
31
|
+
key: "getCompletionPercentage",
|
|
32
|
+
value:
|
|
33
|
+
/**
|
|
34
|
+
* Get completion as a percentage.
|
|
35
|
+
*
|
|
36
|
+
* @param {number} completed The number of steps completed.
|
|
37
|
+
* @param {number} total The total number of steps.
|
|
38
|
+
* @return {number} completion percentage
|
|
39
|
+
*/
|
|
40
|
+
function getCompletionPercentage(completed, total) {
|
|
41
|
+
if (!total) {
|
|
42
|
+
return 100;
|
|
43
|
+
}
|
|
44
|
+
return Math.max(Math.min(Math.round(completed / total * 100), 100), 0);
|
|
45
|
+
}
|
|
36
46
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
children: label
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
children:
|
|
47
|
+
/**
|
|
48
|
+
* Render.
|
|
49
|
+
*/
|
|
50
|
+
}, {
|
|
51
|
+
key: "render",
|
|
52
|
+
value: function render() {
|
|
53
|
+
var _this$props = this.props,
|
|
54
|
+
label = _this$props.label,
|
|
55
|
+
completed = _this$props.completed,
|
|
56
|
+
total = _this$props.total,
|
|
57
|
+
displayFraction = _this$props.displayFraction;
|
|
58
|
+
var cleanTotal = Math.max(0, parseInt(total) || 0);
|
|
59
|
+
var cleanCompleted = Math.max(0, Math.min(parseInt(completed) || 0, parseInt(cleanTotal)));
|
|
60
|
+
var barStyle = {
|
|
61
|
+
width: this.getCompletionPercentage(cleanCompleted, cleanTotal) + '%'
|
|
62
|
+
};
|
|
63
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
64
|
+
className: "newspack-progress-bar",
|
|
65
|
+
children: [(label || displayFraction) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
66
|
+
className: "newspack-progress-bar__headings",
|
|
67
|
+
children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
68
|
+
children: label
|
|
69
|
+
}), displayFraction && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
70
|
+
className: "is-dark",
|
|
71
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("strong", {
|
|
72
|
+
children: [cleanCompleted, "/", cleanTotal]
|
|
73
|
+
})
|
|
74
|
+
})]
|
|
75
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
76
|
+
className: "newspack-progress-bar__container",
|
|
77
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
78
|
+
className: "newspack-progress-bar__bar",
|
|
79
|
+
style: barStyle,
|
|
80
|
+
"data-testid": "progress-bar-indicator"
|
|
62
81
|
})
|
|
63
82
|
})]
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"data-testid": "progress-bar-indicator"
|
|
70
|
-
})
|
|
71
|
-
})]
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
var _default = exports.default = ProgressBar;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}]);
|
|
86
|
+
}(_element.Component);
|
|
87
|
+
var _default = exports["default"] = ProgressBar;
|
|
@@ -1,57 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
4
5
|
var _react = _interopRequireWildcard(require("react"));
|
|
5
6
|
var _react2 = require("@testing-library/react");
|
|
6
7
|
var _ = _interopRequireDefault(require("./"));
|
|
7
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
10
|
+
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; }
|
|
11
|
+
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) { (0, _defineProperty2["default"])(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; }
|
|
12
|
+
describe('ProgressBar', function () {
|
|
13
|
+
it('should render a progress indicator', function () {
|
|
14
|
+
var _render = (0, _react2.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
|
|
15
|
+
completed: "1",
|
|
16
|
+
total: "2"
|
|
17
|
+
})),
|
|
18
|
+
getByTestId = _render.getByTestId;
|
|
19
|
+
var indicator = getByTestId('progress-bar-indicator');
|
|
18
20
|
expect(indicator).toHaveAttribute('style', 'width: 50%;');
|
|
19
21
|
});
|
|
20
|
-
it('should render a label', ()
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}));
|
|
22
|
+
it('should render a label', function () {
|
|
23
|
+
var label = 'test label';
|
|
24
|
+
var _render2 = (0, _react2.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
|
|
25
|
+
completed: "1",
|
|
26
|
+
total: "2",
|
|
27
|
+
label: label
|
|
28
|
+
})),
|
|
29
|
+
getByText = _render2.getByText;
|
|
29
30
|
expect(getByText(label)).toBeInTheDocument();
|
|
30
31
|
});
|
|
31
|
-
it('should render progress as a fraction', ()
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}));
|
|
32
|
+
it('should render progress as a fraction', function () {
|
|
33
|
+
var _render3 = (0, _react2.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
|
|
34
|
+
completed: "1",
|
|
35
|
+
total: "2",
|
|
36
|
+
displayFraction: true
|
|
37
|
+
})),
|
|
38
|
+
getByText = _render3.getByText;
|
|
39
39
|
expect(getByText('1/2')).toBeInTheDocument();
|
|
40
40
|
});
|
|
41
|
-
it('should render with both label and fraction', ()
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}));
|
|
41
|
+
it('should render with both label and fraction', function () {
|
|
42
|
+
var label = 'test label';
|
|
43
|
+
var _render4 = (0, _react2.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
|
|
44
|
+
completed: "1",
|
|
45
|
+
total: "2",
|
|
46
|
+
label: label,
|
|
47
|
+
displayFraction: true
|
|
48
|
+
})),
|
|
49
|
+
getByText = _render4.getByText;
|
|
51
50
|
expect(getByText(label)).toBeInTheDocument();
|
|
52
51
|
expect(getByText('1/2')).toBeInTheDocument();
|
|
53
52
|
});
|
|
54
|
-
describe('should calculate progress correctly', ()
|
|
53
|
+
describe('should calculate progress correctly', function () {
|
|
55
54
|
[{
|
|
56
55
|
props: {
|
|
57
56
|
completed: 1,
|
|
@@ -70,42 +69,37 @@ describe('ProgressBar', () => {
|
|
|
70
69
|
total: 3
|
|
71
70
|
},
|
|
72
71
|
expectedWidth: 100
|
|
73
|
-
}].forEach(({
|
|
74
|
-
props,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
key: expectedWidth
|
|
83
|
-
}));
|
|
84
|
-
expect(getByTestId('progress-bar-indicator')).toHaveAttribute('style', `width: ${expectedWidth}%;`);
|
|
72
|
+
}].forEach(function (_ref) {
|
|
73
|
+
var props = _ref.props,
|
|
74
|
+
expectedWidth = _ref.expectedWidth;
|
|
75
|
+
it("with expected progress of ".concat(expectedWidth), function () {
|
|
76
|
+
var _render5 = (0, _react2.render)(/*#__PURE__*/(0, _react.createElement)(_["default"], _objectSpread(_objectSpread({}, props), {}, {
|
|
77
|
+
key: expectedWidth
|
|
78
|
+
}))),
|
|
79
|
+
getByTestId = _render5.getByTestId;
|
|
80
|
+
expect(getByTestId('progress-bar-indicator')).toHaveAttribute('style', "width: ".concat(expectedWidth, "%;"));
|
|
85
81
|
});
|
|
86
82
|
});
|
|
87
83
|
});
|
|
88
|
-
it('should handle non-numeric values in ProgressBar element', ()
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}));
|
|
84
|
+
it('should handle non-numeric values in ProgressBar element', function () {
|
|
85
|
+
var _render6 = (0, _react2.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
|
|
86
|
+
completed: "cats",
|
|
87
|
+
total: "dogs",
|
|
88
|
+
displayFraction: true
|
|
89
|
+
})),
|
|
90
|
+
getByText = _render6.getByText,
|
|
91
|
+
getByTestId = _render6.getByTestId;
|
|
97
92
|
expect(getByText('0/0')).toBeInTheDocument();
|
|
98
93
|
expect(getByTestId('progress-bar-indicator')).toHaveAttribute('style', 'width: 100%;');
|
|
99
94
|
});
|
|
100
|
-
it('should handle non-logical values in ProgressBar element', ()
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}));
|
|
95
|
+
it('should handle non-logical values in ProgressBar element', function () {
|
|
96
|
+
var _render7 = (0, _react2.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
|
|
97
|
+
completed: "3",
|
|
98
|
+
total: "-1",
|
|
99
|
+
displayFraction: true
|
|
100
|
+
})),
|
|
101
|
+
getByText = _render7.getByText,
|
|
102
|
+
getByTestId = _render7.getByTestId;
|
|
109
103
|
expect(getByText('0/0')).toBeInTheDocument();
|
|
110
104
|
expect(getByTestId('progress-bar-indicator')).toHaveAttribute('style', 'width: 100%;');
|
|
111
105
|
});
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = void 0;
|
|
7
7
|
var ReactRouterDOM = _interopRequireWildcard(require("react-router-dom"));
|
|
8
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (
|
|
8
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
9
9
|
/**
|
|
10
10
|
* A proxy for react-router-dom.
|
|
11
11
|
* Ensures that both components and the plugin use the same instance of
|
|
12
12
|
* React Router, even if there are node_modules in components.
|
|
13
13
|
*/
|
|
14
|
-
var _default = exports
|
|
14
|
+
var _default = exports["default"] = ReactRouterDOM;
|
|
@@ -4,40 +4,53 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
8
15
|
var _components = require("@wordpress/components");
|
|
9
16
|
var _element = require("@wordpress/element");
|
|
10
17
|
require("./style.scss");
|
|
11
18
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
|
|
20
|
+
var _excluded = ["className"];
|
|
21
|
+
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; }
|
|
22
|
+
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) { (0, _defineProperty2["default"])(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; }
|
|
23
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
24
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
|
|
14
25
|
* WordPress dependencies.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
26
|
+
*/ /**
|
|
18
27
|
* Internal dependencies.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
28
|
+
*/ /**
|
|
22
29
|
* External dependencies.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
30
|
+
*/ /**
|
|
26
31
|
* Radio Control.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const {
|
|
33
|
-
className,
|
|
34
|
-
...otherProps
|
|
35
|
-
} = this.props;
|
|
36
|
-
const classes = (0, _classnames.default)('newspack-radio-control', className);
|
|
37
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RadioControl, {
|
|
38
|
-
className: classes,
|
|
39
|
-
...otherProps
|
|
40
|
-
});
|
|
32
|
+
*/
|
|
33
|
+
var RadioControl = /*#__PURE__*/function (_Component) {
|
|
34
|
+
function RadioControl() {
|
|
35
|
+
(0, _classCallCheck2["default"])(this, RadioControl);
|
|
36
|
+
return _callSuper(this, RadioControl, arguments);
|
|
41
37
|
}
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
(0, _inherits2["default"])(RadioControl, _Component);
|
|
39
|
+
return (0, _createClass2["default"])(RadioControl, [{
|
|
40
|
+
key: "render",
|
|
41
|
+
value:
|
|
42
|
+
/**
|
|
43
|
+
* Render.
|
|
44
|
+
*/
|
|
45
|
+
function render() {
|
|
46
|
+
var _this$props = this.props,
|
|
47
|
+
className = _this$props.className,
|
|
48
|
+
otherProps = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
|
|
49
|
+
var classes = (0, _classnames["default"])('newspack-radio-control', className);
|
|
50
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RadioControl, _objectSpread({
|
|
51
|
+
className: classes
|
|
52
|
+
}, otherProps));
|
|
53
|
+
}
|
|
54
|
+
}]);
|
|
55
|
+
}(_element.Component);
|
|
56
|
+
var _default = exports["default"] = RadioControl;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports
|
|
7
|
+
exports["default"] = void 0;
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
9
|
var _element = require("@wordpress/element");
|
|
10
10
|
var _components = require("@wordpress/components");
|
|
@@ -55,42 +55,99 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
55
55
|
* Creates a section header.
|
|
56
56
|
*
|
|
57
57
|
* @param {SectionHeaderProps} props - The properties for the section header.
|
|
58
|
-
*/
|
|
59
|
-
backNav =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
58
|
+
*/var SectionHeader = function SectionHeader(_ref) {
|
|
59
|
+
var _ref$backNav = _ref.backNav,
|
|
60
|
+
backNav = _ref$backNav === void 0 ? '' : _ref$backNav,
|
|
61
|
+
badges = _ref.badges,
|
|
62
|
+
_ref$centered = _ref.centered,
|
|
63
|
+
centered = _ref$centered === void 0 ? false : _ref$centered,
|
|
64
|
+
_ref$className = _ref.className,
|
|
65
|
+
className = _ref$className === void 0 ? null : _ref$className,
|
|
66
|
+
_ref$description = _ref.description,
|
|
67
|
+
description = _ref$description === void 0 ? '' : _ref$description,
|
|
68
|
+
_ref$heading = _ref.heading,
|
|
69
|
+
heading = _ref$heading === void 0 ? 2 : _ref$heading,
|
|
70
|
+
_ref$icon = _ref.icon,
|
|
71
|
+
icon = _ref$icon === void 0 ? null : _ref$icon,
|
|
72
|
+
_ref$isWhite = _ref.isWhite,
|
|
73
|
+
isWhite = _ref$isWhite === void 0 ? false : _ref$isWhite,
|
|
74
|
+
_ref$noMargin = _ref.noMargin,
|
|
75
|
+
noMargin = _ref$noMargin === void 0 ? false : _ref$noMargin,
|
|
76
|
+
_ref$pageHeader = _ref.pageHeader,
|
|
77
|
+
pageHeader = _ref$pageHeader === void 0 ? false : _ref$pageHeader,
|
|
78
|
+
title = _ref.title,
|
|
79
|
+
_ref$id = _ref.id,
|
|
80
|
+
id = _ref$id === void 0 ? null : _ref$id,
|
|
81
|
+
menu = _ref.menu,
|
|
82
|
+
primaryAction = _ref.primaryAction,
|
|
83
|
+
secondaryAction = _ref.secondaryAction,
|
|
84
|
+
_ref$children = _ref.children,
|
|
85
|
+
children = _ref$children === void 0 ? null : _ref$children;
|
|
75
86
|
// If id is in the URL as a scrollTo param, scroll to it on render.
|
|
76
|
-
|
|
77
|
-
(0, _element.useEffect)(()
|
|
78
|
-
|
|
79
|
-
get: (searchParams, prop)
|
|
87
|
+
var ref = (0, _element.useRef)();
|
|
88
|
+
(0, _element.useEffect)(function () {
|
|
89
|
+
var params = new Proxy(new URLSearchParams(window.location.search), {
|
|
90
|
+
get: function get(searchParams, prop) {
|
|
91
|
+
return searchParams.get(prop);
|
|
92
|
+
}
|
|
80
93
|
});
|
|
81
|
-
|
|
94
|
+
var scrollToId = params.scrollTo;
|
|
82
95
|
if (scrollToId && scrollToId === id) {
|
|
83
96
|
// Let parent scroll action run before running this.
|
|
84
|
-
window.setTimeout(()
|
|
85
|
-
|
|
86
|
-
|
|
97
|
+
window.setTimeout(function () {
|
|
98
|
+
return ref.current.scrollIntoView({
|
|
99
|
+
behavior: 'smooth'
|
|
100
|
+
});
|
|
101
|
+
}, 250);
|
|
87
102
|
}
|
|
88
103
|
}, []);
|
|
89
|
-
|
|
90
|
-
|
|
104
|
+
var classes = (0, _classnames["default"])('newspack-section-header', centered && 'newspack-section-header--is-centered', isWhite && 'newspack-section-header--is-white', noMargin && 'newspack-section-header--no-margin', pageHeader && 'newspack-section-header--page-header');
|
|
105
|
+
var HeadingTag = pageHeader ? 'h1' : "h".concat(heading);
|
|
106
|
+
var titleContent = null;
|
|
107
|
+
if (typeof title === 'string') {
|
|
108
|
+
titleContent = /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
109
|
+
className: "newspack-section-header__title-container",
|
|
110
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(HeadingTag, {
|
|
111
|
+
children: [title, badges !== null && badges !== void 0 && badges.length ? badges.map(function (badge, i) {
|
|
112
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Badge, {
|
|
113
|
+
text: badge.label,
|
|
114
|
+
level: badge.level || 'default'
|
|
115
|
+
}, i);
|
|
116
|
+
}) : null]
|
|
117
|
+
}), (menu === null || menu === void 0 ? void 0 : menu.length) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownMenu, {
|
|
118
|
+
className: "newspack-section-header__menu",
|
|
119
|
+
icon: _icons.moreVertical,
|
|
120
|
+
label: (0, _i18n.__)('More options', 'newspack-plugin'),
|
|
121
|
+
children: function children() {
|
|
122
|
+
return menu.map(function (item, index) {
|
|
123
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
|
|
124
|
+
icon: item.icon,
|
|
125
|
+
href: item.href,
|
|
126
|
+
onClick: item.action,
|
|
127
|
+
disabled: item.disabled || false,
|
|
128
|
+
isDestructive: item.destructive || false,
|
|
129
|
+
children: item.label
|
|
130
|
+
}, index);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}), secondaryAction && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
134
|
+
className: "newspack-section-header__secondary-action",
|
|
135
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
|
|
136
|
+
variant: "link",
|
|
137
|
+
href: secondaryAction.href,
|
|
138
|
+
onClick: secondaryAction.action,
|
|
139
|
+
children: secondaryAction.label
|
|
140
|
+
})
|
|
141
|
+
})]
|
|
142
|
+
});
|
|
143
|
+
} else if (typeof title === 'function') {
|
|
144
|
+
titleContent = /*#__PURE__*/(0, _jsxRuntime.jsx)(HeadingTag, {
|
|
145
|
+
children: title()
|
|
146
|
+
});
|
|
147
|
+
}
|
|
91
148
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
92
149
|
id: id,
|
|
93
|
-
className: (0, _classnames
|
|
150
|
+
className: (0, _classnames["default"])('newspack-section-header__container', backNav && 'newspack-section-header--has-back-nav', primaryAction && 'newspack-section-header--has-primary-action', className),
|
|
94
151
|
ref: ref,
|
|
95
152
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Grid, {
|
|
96
153
|
columns: 1,
|
|
@@ -102,35 +159,23 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
102
159
|
icon: icon,
|
|
103
160
|
size: 48
|
|
104
161
|
})
|
|
105
|
-
}), backNav
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}), badges?.length ? badges.map((badge, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Badge, {
|
|
120
|
-
text: badge.label,
|
|
121
|
-
level: badge.level || 'default'
|
|
122
|
-
}, i)) : null, secondaryAction && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
123
|
-
className: "newspack-section-header__secondary-action",
|
|
124
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
|
|
125
|
-
variant: "link",
|
|
126
|
-
href: secondaryAction.href,
|
|
127
|
-
onClick: secondaryAction.action,
|
|
128
|
-
children: secondaryAction.label
|
|
162
|
+
}), backNav ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
163
|
+
alignment: "left",
|
|
164
|
+
style: {
|
|
165
|
+
position: 'relative'
|
|
166
|
+
},
|
|
167
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
168
|
+
className: "newspack-section-header__back-nav",
|
|
169
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Tooltip, {
|
|
170
|
+
text: (0, _i18n.__)('Go back', 'newspack-plugin'),
|
|
171
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
|
|
172
|
+
href: backNav,
|
|
173
|
+
icon: _icons.chevronLeft,
|
|
174
|
+
variant: "tertiary"
|
|
175
|
+
})
|
|
129
176
|
})
|
|
130
|
-
})]
|
|
131
|
-
}), typeof
|
|
132
|
-
children: title()
|
|
133
|
-
}), description && typeof description === 'string' && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
177
|
+
}), titleContent]
|
|
178
|
+
}) : titleContent, description && typeof description === 'string' && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
134
179
|
children: description
|
|
135
180
|
}), typeof description === 'function' && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
136
181
|
children: description()
|
|
@@ -151,4 +196,4 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
151
196
|
})]
|
|
152
197
|
});
|
|
153
198
|
};
|
|
154
|
-
var _default = exports
|
|
199
|
+
var _default = exports["default"] = SectionHeader;
|