newspack-components 2.2.1 → 3.0.0-alpha.2
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/babel.config.js +25 -0
- package/copy-styles.js +2 -10
- package/dist/{cjs/accordion → accordion}/index.js +17 -13
- package/dist/{cjs/accordion → accordion}/style.scss +7 -3
- package/dist/{cjs/action-card → action-card}/index.js +39 -43
- package/dist/{esm/action-card → action-card}/style.scss +9 -9
- package/dist/{cjs/autocomplete-tokenfield → autocomplete-tokenfield}/index.js +67 -29
- package/dist/{esm/autocomplete-tokenfield → autocomplete-tokenfield}/style.scss +14 -8
- package/dist/{cjs/autocomplete-with-suggestions → autocomplete-with-suggestions}/index.js +61 -73
- package/dist/{esm/autocomplete-with-suggestions → autocomplete-with-suggestions}/style.scss +9 -17
- package/dist/button/index.js +51 -0
- package/{src/button/index.js → dist/button/index.tsx} +12 -5
- package/dist/{cjs/button → button}/style.scss +1 -1
- package/dist/{cjs/button-card → button-card}/index.js +9 -10
- package/dist/{cjs/button-card → button-card}/style.scss +19 -13
- package/dist/{cjs/card → card}/index.js +4 -5
- package/dist/{esm/card → card}/style.scss +1 -1
- package/dist/{cjs/category-autocomplete → category-autocomplete}/index.js +51 -53
- package/dist/{esm/category-autocomplete → category-autocomplete}/style.scss +2 -2
- package/dist/{cjs/color-picker → color-picker}/index.js +14 -16
- package/dist/{cjs/color-picker → color-picker}/style.scss +3 -3
- package/dist/consts.js +7 -0
- package/dist/{cjs/custom-select-control → custom-select-control}/index.js +4 -5
- package/dist/{cjs/custom-select-control → custom-select-control}/style.scss +11 -10
- package/dist/{cjs/date-range-picker → date-range-picker}/index.js +9 -11
- package/dist/{cjs/date-range-picker → date-range-picker}/style.scss +6 -6
- package/dist/{cjs/footer → footer}/index.js +33 -36
- package/dist/{cjs/footer → footer}/style.scss +1 -1
- package/dist/{cjs/form-token-field → form-token-field}/index.js +6 -7
- package/dist/{esm/form-token-field → form-token-field}/style.scss +1 -1
- package/dist/{cjs/global-notices → global-notices}/index.js +4 -5
- package/dist/grid/index.js +44 -0
- package/dist/grid/index.tsx +34 -0
- package/dist/{cjs/grid → grid}/style.scss +9 -9
- package/dist/{cjs/handoff → handoff}/index.js +73 -71
- package/dist/{cjs/handoff-message → handoff-message}/index.js +5 -3
- package/dist/hooks/index.js +29 -0
- package/{src/hooks/index.js → dist/hooks/index.ts} +1 -1
- package/dist/{cjs/hooks → hooks}/useObjectState.js +2 -3
- package/dist/{cjs/hooks → hooks}/useObjectState.test.js +9 -9
- package/dist/{cjs/hooks → hooks}/useOnClickOutside.js +1 -2
- package/dist/hooks/usePrompt.js +47 -0
- package/{src/hooks/usePrompt.js → dist/hooks/usePrompt.ts} +4 -8
- package/dist/image-upload/index.js +148 -0
- package/dist/{cjs/image-upload → image-upload}/index.test.js +13 -6
- package/dist/{esm/image-upload → image-upload}/style.scss +5 -5
- package/dist/{cjs/index.js → index.js} +1 -1
- package/dist/{cjs/info-button → info-button}/index.js +6 -7
- package/dist/{cjs/modal → modal}/index.js +4 -5
- package/dist/{esm/modal → modal}/style.scss +5 -5
- package/dist/{cjs/newspack-icon → newspack-icon}/index.js +5 -6
- package/dist/{cjs/newspack-icon → newspack-icon}/style.scss +1 -1
- package/dist/{cjs/newspack-logo → newspack-logo}/index.js +5 -6
- package/dist/{cjs/newspack-logo → newspack-logo}/style.scss +1 -1
- package/dist/{cjs/notice → notice}/index.js +12 -10
- package/dist/{cjs/notice → notice}/style.scss +11 -11
- package/dist/patrons-logo/index.js +77 -0
- package/dist/plugin-installer/index.js +297 -0
- package/dist/{cjs/plugin-installer → plugin-installer}/style.scss +1 -1
- package/dist/{cjs/plugin-settings → plugin-settings}/SettingsSection.js +13 -13
- package/dist/plugin-settings/index.js +228 -0
- package/dist/{cjs/plugin-settings → plugin-settings}/style.scss +1 -1
- package/dist/plugin-toggle/README.md +53 -0
- package/dist/plugin-toggle/index.js +222 -0
- package/dist/{esm/plugin-toggle → plugin-toggle}/style.scss +1 -1
- package/dist/{cjs/popover → popover}/index.js +4 -5
- package/dist/{cjs/popover → popover}/style.scss +7 -7
- package/dist/{cjs/position-control → position-control}/index.js +33 -32
- package/dist/{cjs/position-control → position-control}/style.scss +8 -8
- package/dist/{cjs/progress-bar → progress-bar}/index.js +9 -10
- package/dist/{cjs/progress-bar → progress-bar}/index.test.js +16 -16
- package/dist/{cjs/progress-bar → progress-bar}/style.scss +2 -2
- package/dist/proxied-imports/router.js +15 -0
- package/dist/{cjs/radio-control → radio-control}/index.js +4 -5
- package/dist/{cjs/radio-control → radio-control}/style.scss +3 -3
- package/dist/{cjs/section-header → section-header}/index.js +20 -21
- package/dist/{esm/section-header → section-header}/style.scss +5 -1
- package/dist/{cjs/select-control → select-control}/ButtonGroupControl.js +17 -19
- package/dist/{cjs/select-control → select-control}/GroupedSelectControl.js +32 -35
- package/dist/{cjs/select-control → select-control}/index.js +7 -8
- package/dist/{cjs/select-control → select-control}/style.scss +4 -4
- package/dist/settings/MinMaxSetting.js +60 -0
- package/dist/{cjs/settings → settings}/SettingsCard.js +14 -16
- package/dist/settings/SettingsSection.js +33 -0
- package/dist/{cjs/settings → settings}/index.js +3 -4
- package/dist/{cjs/settings → settings}/style.scss +15 -2
- package/dist/sortable-newsletter-list-control/index.js +135 -0
- package/dist/sortable-newsletter-list-control/style.scss +45 -0
- package/dist/{cjs/steps-list → steps-list}/index.js +5 -6
- package/dist/{esm/steps-list → steps-list}/style.scss +2 -2
- package/dist/{cjs/steps-list-item → steps-list-item}/index.js +6 -7
- package/dist/{cjs/steps-list-item → steps-list-item}/style.scss +5 -5
- package/dist/{cjs/style-card → style-card}/index.js +21 -19
- package/dist/{esm/style-card → style-card}/style.scss +4 -4
- package/dist/{esm/style.scss → style.scss} +14 -2
- package/dist/{cjs/tabbed-navigation → tabbed-navigation}/index.js +16 -19
- package/dist/{cjs/tabbed-navigation → tabbed-navigation}/style.scss +4 -4
- package/dist/text-control/index.js +76 -0
- package/dist/text-control/index.tsx +71 -0
- package/dist/utils/index.js +36 -0
- package/dist/{cjs/waiting → waiting}/index.js +4 -5
- package/dist/web-preview/index.js +191 -0
- package/dist/{cjs/web-preview → web-preview}/style.scss +5 -5
- package/dist/with-wizard/index.js +328 -0
- package/dist/{esm/with-wizard → with-wizard}/style.scss +44 -22
- package/dist/{cjs/with-wizard-screen → with-wizard-screen}/index.js +40 -43
- package/dist/{esm/with-wizard-screen → with-wizard-screen}/style.scss +7 -7
- package/dist/{cjs/wizard → wizard}/components/WizardError.js +16 -17
- package/dist/{cjs/wizard → wizard}/index.js +44 -46
- package/dist/{cjs/wizard → wizard}/store/index.js +37 -38
- package/dist/{cjs/wizard → wizard}/store/utils.js +1 -4
- package/package.json +16 -14
- package/shared/scss/_mixins.scss +2 -2
- package/src/accordion/index.js +4 -1
- package/src/accordion/style.scss +7 -3
- package/src/action-card/style.scss +9 -9
- package/src/autocomplete-tokenfield/index.js +48 -15
- package/src/autocomplete-tokenfield/style.scss +14 -8
- package/src/autocomplete-with-suggestions/index.js +59 -62
- package/src/autocomplete-with-suggestions/style.scss +9 -17
- package/src/button/index.tsx +48 -0
- package/src/button/style.scss +1 -1
- package/src/button-card/style.scss +19 -13
- package/src/card/style.scss +1 -1
- package/src/category-autocomplete/style.scss +2 -2
- package/src/color-picker/style.scss +3 -3
- package/src/consts.js +0 -2
- package/src/custom-select-control/style.scss +11 -10
- package/src/date-range-picker/style.scss +6 -6
- package/src/footer/index.js +7 -7
- package/src/footer/style.scss +1 -1
- package/src/form-token-field/style.scss +1 -1
- package/src/grid/index.tsx +34 -0
- package/src/grid/style.scss +9 -9
- package/src/handoff/index.js +7 -6
- package/src/handoff-message/index.js +3 -1
- package/src/hooks/index.ts +15 -0
- package/src/hooks/usePrompt.ts +46 -0
- package/src/image-upload/index.js +5 -5
- package/src/image-upload/index.test.js +6 -1
- package/src/image-upload/style.scss +5 -5
- package/src/modal/style.scss +5 -5
- package/src/newspack-icon/style.scss +1 -1
- package/src/newspack-logo/style.scss +1 -1
- package/src/notice/index.js +1 -1
- package/src/notice/style.scss +11 -11
- package/src/patrons-logo/index.js +4 -1
- package/src/plugin-installer/index.js +7 -7
- package/src/plugin-installer/style.scss +1 -1
- package/src/plugin-settings/index.js +1 -1
- package/src/plugin-settings/style.scss +1 -1
- package/src/plugin-toggle/index.js +13 -12
- package/src/plugin-toggle/style.scss +1 -1
- package/src/popover/style.scss +7 -7
- package/src/position-control/index.js +63 -64
- package/src/position-control/style.scss +8 -8
- package/src/progress-bar/style.scss +2 -2
- package/src/radio-control/style.scss +3 -3
- package/src/section-header/index.js +3 -3
- package/src/section-header/style.scss +5 -1
- package/src/select-control/GroupedSelectControl.js +1 -1
- package/src/select-control/style.scss +4 -4
- package/src/settings/MinMaxSetting.js +8 -6
- package/src/settings/style.scss +15 -2
- package/src/sortable-newsletter-list-control/index.js +137 -0
- package/src/sortable-newsletter-list-control/style.scss +45 -0
- package/src/steps-list/style.scss +2 -2
- package/src/steps-list-item/style.scss +5 -5
- package/src/style-card/index.js +11 -5
- package/src/style-card/style.scss +4 -4
- package/src/style.scss +14 -2
- package/src/tabbed-navigation/style.scss +4 -4
- package/src/text-control/index.tsx +65 -0
- package/src/web-preview/index.js +6 -6
- package/src/web-preview/style.scss +5 -5
- package/src/with-wizard/index.js +4 -4
- package/src/with-wizard/style.scss +44 -22
- package/src/with-wizard-screen/index.js +1 -1
- package/src/with-wizard-screen/style.scss +7 -7
- package/src/wizard/components/WizardError.js +1 -1
- package/src/wizard/index.js +3 -3
- package/src/wizard/store/index.js +9 -2
- package/dist/cjs/action-card/style.scss +0 -483
- package/dist/cjs/autocomplete-tokenfield/style.scss +0 -43
- package/dist/cjs/autocomplete-with-suggestions/style.scss +0 -171
- package/dist/cjs/button/index.js +0 -57
- package/dist/cjs/card/style.scss +0 -168
- package/dist/cjs/category-autocomplete/style.scss +0 -34
- package/dist/cjs/consts.js +0 -12
- package/dist/cjs/form-token-field/style.scss +0 -37
- package/dist/cjs/grid/index.js +0 -54
- package/dist/cjs/hooks/index.js +0 -26
- package/dist/cjs/hooks/usePrompt.js +0 -52
- package/dist/cjs/image-upload/index.js +0 -144
- package/dist/cjs/image-upload/style.scss +0 -103
- package/dist/cjs/modal/style.scss +0 -56
- package/dist/cjs/patrons-logo/index.js +0 -82
- package/dist/cjs/plugin-installer/index.js +0 -299
- package/dist/cjs/plugin-settings/index.js +0 -222
- package/dist/cjs/plugin-toggle/index.js +0 -222
- package/dist/cjs/plugin-toggle/style.scss +0 -20
- package/dist/cjs/proxied-imports/router.js +0 -15
- package/dist/cjs/section-header/style.scss +0 -41
- package/dist/cjs/settings/MinMaxSetting.js +0 -57
- package/dist/cjs/settings/SettingsSection.js +0 -37
- package/dist/cjs/steps-list/style.scss +0 -11
- package/dist/cjs/style-card/style.scss +0 -94
- package/dist/cjs/style.scss +0 -43
- package/dist/cjs/text-control/index.js +0 -71
- package/dist/cjs/utils/index.js +0 -40
- package/dist/cjs/web-preview/index.js +0 -189
- package/dist/cjs/with-wizard/index.js +0 -318
- package/dist/cjs/with-wizard/style.scss +0 -260
- package/dist/cjs/with-wizard-screen/style.scss +0 -160
- package/dist/esm/accordion/index.js +0 -38
- package/dist/esm/accordion/style.scss +0 -27
- package/dist/esm/action-card/index.js +0 -222
- package/dist/esm/autocomplete-tokenfield/index.js +0 -223
- package/dist/esm/autocomplete-with-suggestions/index.js +0 -289
- package/dist/esm/button/index.js +0 -48
- package/dist/esm/button/style.scss +0 -11
- package/dist/esm/button-card/index.js +0 -65
- package/dist/esm/button-card/style.scss +0 -174
- package/dist/esm/card/index.js +0 -43
- package/dist/esm/category-autocomplete/index.js +0 -185
- package/dist/esm/color-picker/index.js +0 -61
- package/dist/esm/color-picker/style.scss +0 -37
- package/dist/esm/consts.js +0 -3
- package/dist/esm/custom-select-control/index.js +0 -37
- package/dist/esm/custom-select-control/style.scss +0 -92
- package/dist/esm/date-range-picker/index.js +0 -32
- package/dist/esm/date-range-picker/style.scss +0 -148
- package/dist/esm/footer/index.js +0 -105
- package/dist/esm/footer/style.scss +0 -82
- package/dist/esm/form-token-field/index.js +0 -50
- package/dist/esm/global-notices/index.js +0 -30
- package/dist/esm/grid/index.js +0 -45
- package/dist/esm/grid/style.scss +0 -166
- package/dist/esm/handoff/index.js +0 -177
- package/dist/esm/handoff-message/index.js +0 -45
- package/dist/esm/hooks/index.js +0 -17
- package/dist/esm/hooks/useObjectState.js +0 -31
- package/dist/esm/hooks/useObjectState.test.js +0 -83
- package/dist/esm/hooks/useOnClickOutside.js +0 -31
- package/dist/esm/hooks/usePrompt.js +0 -43
- package/dist/esm/image-upload/index.js +0 -141
- package/dist/esm/image-upload/index.test.js +0 -28
- package/dist/esm/index.js +0 -47
- package/dist/esm/info-button/index.js +0 -42
- package/dist/esm/info-button/style.scss +0 -18
- package/dist/esm/modal/index.js +0 -39
- package/dist/esm/newspack-icon/index.js +0 -50
- package/dist/esm/newspack-icon/style.scss +0 -26
- package/dist/esm/newspack-logo/index.js +0 -46
- package/dist/esm/newspack-logo/style.scss +0 -30
- package/dist/esm/notice/index.js +0 -67
- package/dist/esm/notice/style.scss +0 -111
- package/dist/esm/patrons-logo/index.js +0 -76
- package/dist/esm/plugin-installer/index.js +0 -295
- package/dist/esm/plugin-installer/style.scss +0 -72
- package/dist/esm/plugin-settings/SettingsSection.js +0 -136
- package/dist/esm/plugin-settings/index.js +0 -217
- package/dist/esm/plugin-settings/style.scss +0 -7
- package/dist/esm/plugin-toggle/index.js +0 -217
- package/dist/esm/popover/index.js +0 -41
- package/dist/esm/popover/style.scss +0 -161
- package/dist/esm/position-control/index.js +0 -109
- package/dist/esm/position-control/style.scss +0 -66
- package/dist/esm/progress-bar/index.js +0 -69
- package/dist/esm/progress-bar/index.test.js +0 -110
- package/dist/esm/progress-bar/style.scss +0 -42
- package/dist/esm/proxied-imports/router.js +0 -8
- package/dist/esm/radio-control/index.js +0 -37
- package/dist/esm/radio-control/style.scss +0 -92
- package/dist/esm/section-header/index.js +0 -68
- package/dist/esm/select-control/ButtonGroupControl.js +0 -54
- package/dist/esm/select-control/GroupedSelectControl.js +0 -84
- package/dist/esm/select-control/index.js +0 -51
- package/dist/esm/select-control/style.scss +0 -108
- package/dist/esm/settings/MinMaxSetting.js +0 -53
- package/dist/esm/settings/SettingsCard.js +0 -39
- package/dist/esm/settings/SettingsSection.js +0 -30
- package/dist/esm/settings/index.js +0 -9
- package/dist/esm/settings/style.scss +0 -106
- package/dist/esm/steps-list/index.js +0 -43
- package/dist/esm/steps-list-item/index.js +0 -48
- package/dist/esm/steps-list-item/style.scss +0 -47
- package/dist/esm/style-card/index.js +0 -76
- package/dist/esm/tabbed-navigation/index.js +0 -56
- package/dist/esm/tabbed-navigation/style.scss +0 -86
- package/dist/esm/text-control/index.js +0 -66
- package/dist/esm/text-control/style.scss +0 -32
- package/dist/esm/utils/index.js +0 -32
- package/dist/esm/waiting/index.js +0 -44
- package/dist/esm/waiting/style.scss +0 -27
- package/dist/esm/web-preview/index.js +0 -184
- package/dist/esm/web-preview/style.scss +0 -155
- package/dist/esm/with-wizard/index.js +0 -313
- package/dist/esm/with-wizard-screen/index.js +0 -116
- package/dist/esm/wizard/components/WizardError.js +0 -69
- package/dist/esm/wizard/index.js +0 -126
- package/dist/esm/wizard/store/index.js +0 -155
- package/dist/esm/wizard/store/utils.js +0 -17
- package/src/grid/index.js +0 -44
- package/src/text-control/index.js +0 -56
- /package/dist/{cjs/info-button → info-button}/style.scss +0 -0
- /package/dist/{cjs/text-control → text-control}/style.scss +0 -0
- /package/dist/{cjs/waiting → waiting}/style.scss +0 -0
|
@@ -0,0 +1,222 @@
|
|
|
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 _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
|
|
9
|
+
var _element = require("@wordpress/element");
|
|
10
|
+
var _i18n = require("@wordpress/i18n");
|
|
11
|
+
var _ = require("../");
|
|
12
|
+
require("./style.scss");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
/**
|
|
15
|
+
* WordPress dependencies.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Plugin toggle group component.
|
|
24
|
+
*/class PluginToggle extends _element.Component {
|
|
25
|
+
state = {
|
|
26
|
+
pluginInfo: {}
|
|
27
|
+
};
|
|
28
|
+
componentDidMount = () => {
|
|
29
|
+
this.retrievePluginInfo();
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Retrieve complete data about Newspack plugins.
|
|
34
|
+
*/
|
|
35
|
+
retrievePluginInfo = () => {
|
|
36
|
+
return new Promise(() => {
|
|
37
|
+
(0, _apiFetch.default)({
|
|
38
|
+
path: '/newspack/v1/plugins/'
|
|
39
|
+
}).then(pluginInfo => this.setState({
|
|
40
|
+
pluginInfo
|
|
41
|
+
}));
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Install/activate or remove a plugin.
|
|
47
|
+
*/
|
|
48
|
+
managePlugin = (plugin, value) => {
|
|
49
|
+
const {
|
|
50
|
+
plugins
|
|
51
|
+
} = this.props;
|
|
52
|
+
const {
|
|
53
|
+
pluginInfo
|
|
54
|
+
} = this.state;
|
|
55
|
+
const action = value ? 'configure' : 'deactivate';
|
|
56
|
+
const params = {
|
|
57
|
+
path: `/newspack/v1/plugins/${plugin}/${action}/`,
|
|
58
|
+
method: 'post'
|
|
59
|
+
};
|
|
60
|
+
this.setState({
|
|
61
|
+
pluginInfo: {
|
|
62
|
+
...pluginInfo,
|
|
63
|
+
[plugin]: {
|
|
64
|
+
...pluginInfo[plugin],
|
|
65
|
+
inFlight: action
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}, () => {
|
|
69
|
+
(0, _apiFetch.default)(params).then(response => {
|
|
70
|
+
const {
|
|
71
|
+
shouldRefreshAfterUpdate
|
|
72
|
+
} = plugins[plugin];
|
|
73
|
+
this.setState(({
|
|
74
|
+
pluginInfo: currentPluginInfo
|
|
75
|
+
}) => ({
|
|
76
|
+
pluginInfo: {
|
|
77
|
+
...currentPluginInfo,
|
|
78
|
+
[plugin]: response
|
|
79
|
+
}
|
|
80
|
+
}), () => shouldRefreshAfterUpdate && location.reload());
|
|
81
|
+
}).catch(e => {
|
|
82
|
+
this.setState({
|
|
83
|
+
pluginInfo: {
|
|
84
|
+
...pluginInfo,
|
|
85
|
+
[plugin]: {
|
|
86
|
+
...pluginInfo[plugin],
|
|
87
|
+
error: e.message || (0, _i18n.__)('There was an error managing this plugin.', 'newspack-plugin')
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Render.
|
|
97
|
+
*/
|
|
98
|
+
render() {
|
|
99
|
+
const {
|
|
100
|
+
plugins
|
|
101
|
+
} = this.props;
|
|
102
|
+
const {
|
|
103
|
+
pluginInfo
|
|
104
|
+
} = this.state;
|
|
105
|
+
return this.prepareDataForRender(plugins, pluginInfo).map((plugin, index) => {
|
|
106
|
+
const {
|
|
107
|
+
name,
|
|
108
|
+
description,
|
|
109
|
+
href,
|
|
110
|
+
slug,
|
|
111
|
+
editPath
|
|
112
|
+
} = plugin;
|
|
113
|
+
const pluginStatus = this.isPluginInstalledAndActive(plugin);
|
|
114
|
+
const handoff = !href && pluginStatus && editPath ? slug : null;
|
|
115
|
+
const error = this.errorForPlugin(plugin);
|
|
116
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_.ActionCard, {
|
|
117
|
+
className: this.classNameForPlugin(plugin),
|
|
118
|
+
title: name,
|
|
119
|
+
description: description,
|
|
120
|
+
actionText: this.actionTextForPlugin(plugin),
|
|
121
|
+
handoff: handoff,
|
|
122
|
+
href: href,
|
|
123
|
+
toggle: true,
|
|
124
|
+
toggleChecked: this.isPluginInstalledAndActive(plugin),
|
|
125
|
+
toggleOnChange: value => this.managePlugin(slug, value),
|
|
126
|
+
notification: error,
|
|
127
|
+
notificationHTML: error,
|
|
128
|
+
notificationLevel: "error"
|
|
129
|
+
}, index);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Prepare plugins data for render. Change all keys to camelCase, merge API-fetched data with prop.
|
|
135
|
+
*/
|
|
136
|
+
prepareDataForRender = (pluginsFromProps, pluginsFromAPI) => Object.keys(pluginsFromProps).map(pluginSlug => pluginsFromAPI[pluginSlug] ? Object.keys(pluginsFromAPI[pluginSlug]).reduce((accumulator, key) => ({
|
|
137
|
+
...accumulator,
|
|
138
|
+
[key.charAt(0).toLowerCase() + key.slice(1)]: pluginsFromAPI[pluginSlug][key]
|
|
139
|
+
}), {}) : {}).map(plugin => Object.assign(plugin, pluginsFromProps[plugin.slug]));
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Generate a classname for the ActionCard based on plugin state. Applies 'in-flight' class if an API is underway and 'loading' if the plugin data is not yet available.
|
|
143
|
+
*/
|
|
144
|
+
classNameForPlugin = plugin => {
|
|
145
|
+
const {
|
|
146
|
+
status,
|
|
147
|
+
inFlight
|
|
148
|
+
} = plugin;
|
|
149
|
+
if (inFlight) {
|
|
150
|
+
return 'in-flight';
|
|
151
|
+
}
|
|
152
|
+
if (!status) {
|
|
153
|
+
return 'loading';
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Generate the ActionCard action text for a plugin.
|
|
159
|
+
*/
|
|
160
|
+
actionTextForPlugin = plugin => {
|
|
161
|
+
const {
|
|
162
|
+
actionText,
|
|
163
|
+
editPath,
|
|
164
|
+
href,
|
|
165
|
+
inFlight,
|
|
166
|
+
name
|
|
167
|
+
} = plugin;
|
|
168
|
+
// Show spinner when plugin data is unavailable, or when an API call is in flight.
|
|
169
|
+
if ('configure' === inFlight) {
|
|
170
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_element.Fragment, {
|
|
171
|
+
children: [(0, _i18n.__)('Installing…', 'newspack-plugin'), " ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Waiting, {
|
|
172
|
+
isRight: true
|
|
173
|
+
})]
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
if ('deactivate' === inFlight) {
|
|
177
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_element.Fragment, {
|
|
178
|
+
children: [(0, _i18n.__)('Deactivating…', 'newspack-plugin'), " ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Waiting, {
|
|
179
|
+
isRight: true
|
|
180
|
+
})]
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
if (!name) {
|
|
184
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_element.Fragment, {
|
|
185
|
+
children: [(0, _i18n.__)('Loading…', 'newspack-plugin'), " ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Waiting, {
|
|
186
|
+
isRight: true
|
|
187
|
+
})]
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
// No action button at all if the plugin isn't installed and active.
|
|
191
|
+
if (!this.isPluginInstalledAndActive(plugin)) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
if (href || editPath) {
|
|
195
|
+
return actionText ? actionText : (0, _i18n.__)('Configure', 'newspack-plugin');
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Get error message for this plugin.
|
|
201
|
+
*/
|
|
202
|
+
errorForPlugin = plugin => {
|
|
203
|
+
const {
|
|
204
|
+
slug
|
|
205
|
+
} = plugin;
|
|
206
|
+
const {
|
|
207
|
+
pluginInfo
|
|
208
|
+
} = this.state;
|
|
209
|
+
return pluginInfo[slug]?.error || null;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Get installation/activation status for a plugin.
|
|
214
|
+
*/
|
|
215
|
+
isPluginInstalledAndActive = plugin => {
|
|
216
|
+
const {
|
|
217
|
+
status
|
|
218
|
+
} = plugin;
|
|
219
|
+
return status === 'active';
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
var _default = exports.default = PluginToggle;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -9,7 +9,7 @@ var _components = require("@wordpress/components");
|
|
|
9
9
|
var _element = require("@wordpress/element");
|
|
10
10
|
require("./style.scss");
|
|
11
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
-
var _jsxRuntime = require("
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
/**
|
|
14
14
|
* WordPress dependencies
|
|
15
15
|
*/
|
|
@@ -35,7 +35,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
|
35
35
|
...otherProps
|
|
36
36
|
} = this.props;
|
|
37
37
|
const classes = (0, _classnames.default)('newspack-popover', padding && 'newspack-popover__padding-' + padding, className);
|
|
38
|
-
return (0, _jsxRuntime.jsx)(_components.Popover, {
|
|
38
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Popover, {
|
|
39
39
|
className: classes,
|
|
40
40
|
...otherProps
|
|
41
41
|
});
|
|
@@ -44,5 +44,4 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
|
44
44
|
Popover.defaultProps = {
|
|
45
45
|
padding: false
|
|
46
46
|
};
|
|
47
|
-
var _default = Popover;
|
|
48
|
-
exports.default = _default;
|
|
47
|
+
var _default = exports.default = Popover;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Popover
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
@use
|
|
6
|
-
@use
|
|
5
|
+
@use "../../../shared/scss/colors";
|
|
6
|
+
@use "~@wordpress/base-styles/colors" as wp-colors;
|
|
7
7
|
|
|
8
8
|
.newspack-popover {
|
|
9
9
|
.components-popover__content {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
&:focus:not(
|
|
26
|
+
&:focus:not(:disabled) {
|
|
27
27
|
box-shadow: inset 0 0 0 2px colors.$primary-500;
|
|
28
28
|
position: relative;
|
|
29
29
|
z-index: 1;
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
padding: 6px 8px;
|
|
35
35
|
text-decoration: none;
|
|
36
36
|
|
|
37
|
-
&:not(
|
|
37
|
+
&:not(.is-destructive) {
|
|
38
38
|
color: wp-colors.$gray-700;
|
|
39
39
|
|
|
40
40
|
&:active,
|
|
41
41
|
&:active:enabled,
|
|
42
42
|
&:focus,
|
|
43
43
|
&:focus:enabled &:hover,
|
|
44
|
-
&:not(
|
|
44
|
+
&:not(:disabled, [aria-disabled="true"], .is-default):hover {
|
|
45
45
|
color: colors.$primary-500;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
&.is-destructive:not(
|
|
55
|
+
&.is-destructive:not(:focus) {
|
|
56
56
|
box-shadow: none !important;
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
&:not(
|
|
134
|
+
&:not(.is-without-arrow)::before {
|
|
135
135
|
border-color: wp-colors.$gray-300;
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -9,91 +9,92 @@ var _i18n = require("@wordpress/i18n");
|
|
|
9
9
|
var _components = require("@wordpress/components");
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
require("./style.scss");
|
|
12
|
-
var _jsxRuntime = require("
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
/**
|
|
14
14
|
* WordPress dependencies
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
/**
|
|
18
18
|
* External dependencies
|
|
19
19
|
*/
|
|
20
|
+
|
|
20
21
|
/**
|
|
21
22
|
* Internal dependencies
|
|
22
23
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
|
|
25
|
+
function PositionControl({
|
|
26
|
+
allowedPositions,
|
|
27
|
+
value,
|
|
28
|
+
label,
|
|
29
|
+
help,
|
|
30
|
+
onChange,
|
|
31
|
+
size,
|
|
32
|
+
...props
|
|
33
|
+
}) {
|
|
33
34
|
/**
|
|
34
35
|
* Set layout options
|
|
35
36
|
*/
|
|
36
37
|
const options = size === 'full-width' ? [{
|
|
37
38
|
value: 'top',
|
|
38
39
|
/* translators: Overlay Position */
|
|
39
|
-
label: __('Top', 'newspack')
|
|
40
|
+
label: (0, _i18n.__)('Top', 'newspack-plugin')
|
|
40
41
|
}, {
|
|
41
42
|
value: 'center',
|
|
42
43
|
/* translators: Overlay Position */
|
|
43
|
-
label: __('Center', 'newspack')
|
|
44
|
+
label: (0, _i18n.__)('Center', 'newspack-plugin')
|
|
44
45
|
}, {
|
|
45
46
|
value: 'bottom',
|
|
46
47
|
/* translators: Overlay Position */
|
|
47
|
-
label: __('Bottom', 'newspack')
|
|
48
|
+
label: (0, _i18n.__)('Bottom', 'newspack-plugin')
|
|
48
49
|
}] : [{
|
|
49
50
|
value: 'top_left',
|
|
50
51
|
/* translators: Overlay Position */
|
|
51
|
-
label: __('Top Left', 'newspack')
|
|
52
|
+
label: (0, _i18n.__)('Top Left', 'newspack-plugin')
|
|
52
53
|
}, {
|
|
53
54
|
value: 'top',
|
|
54
55
|
/* translators: Overlay Position */
|
|
55
|
-
label: __('Top Center', 'newspack')
|
|
56
|
+
label: (0, _i18n.__)('Top Center', 'newspack-plugin')
|
|
56
57
|
}, {
|
|
57
58
|
value: 'top_right',
|
|
58
59
|
/* translators: Overlay Position */
|
|
59
|
-
label: __('Top Right', 'newspack')
|
|
60
|
+
label: (0, _i18n.__)('Top Right', 'newspack-plugin')
|
|
60
61
|
}, {
|
|
61
62
|
value: 'center_left',
|
|
62
63
|
/* translators: Overlay Position */
|
|
63
|
-
label: __('Center Left', 'newspack')
|
|
64
|
+
label: (0, _i18n.__)('Center Left', 'newspack-plugin')
|
|
64
65
|
}, {
|
|
65
66
|
value: 'center',
|
|
66
67
|
/* translators: Overlay Position */
|
|
67
|
-
label: __('Center', 'newspack')
|
|
68
|
+
label: (0, _i18n.__)('Center', 'newspack-plugin')
|
|
68
69
|
}, {
|
|
69
70
|
value: 'center_right',
|
|
70
71
|
/* translators: Overlay Position */
|
|
71
|
-
label: __('Center Right', 'newspack')
|
|
72
|
+
label: (0, _i18n.__)('Center Right', 'newspack-plugin')
|
|
72
73
|
}, {
|
|
73
74
|
value: 'bottom_left',
|
|
74
75
|
/* translators: Overlay Position */
|
|
75
|
-
label: __('Bottom Left', 'newspack')
|
|
76
|
+
label: (0, _i18n.__)('Bottom Left', 'newspack-plugin')
|
|
76
77
|
}, {
|
|
77
78
|
value: 'bottom',
|
|
78
79
|
/* translators: Overlay Position */
|
|
79
|
-
label: __('Bottom Center', 'newspack')
|
|
80
|
+
label: (0, _i18n.__)('Bottom Center', 'newspack-plugin')
|
|
80
81
|
}, {
|
|
81
82
|
value: 'bottom_right',
|
|
82
83
|
/* translators: Overlay Position */
|
|
83
|
-
label: __('Bottom Right', 'newspack')
|
|
84
|
+
label: (0, _i18n.__)('Bottom Right', 'newspack-plugin')
|
|
84
85
|
}];
|
|
85
|
-
return (0, _jsxRuntime.jsxs)("div", {
|
|
86
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
86
87
|
className: (0, _classnames.default)('newspack-position-placement-control', 'size-' + size),
|
|
87
|
-
children: [(0, _jsxRuntime.jsx)("p", {
|
|
88
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
88
89
|
className: "components-base-control__label",
|
|
89
90
|
children: label
|
|
90
|
-
}), (0, _jsxRuntime.jsx)(_components.ButtonGroup, {
|
|
91
|
-
"aria-label": __('Select Position', 'newspack'),
|
|
91
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ButtonGroup, {
|
|
92
|
+
"aria-label": (0, _i18n.__)('Select Position', 'newspack-plugin'),
|
|
92
93
|
...props,
|
|
93
94
|
children: options.map((option, index) => {
|
|
94
|
-
return (0, _jsxRuntime.jsx)("div", {
|
|
95
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
95
96
|
className: option.value === value ? 'is-selected' : null,
|
|
96
|
-
children: (0, _jsxRuntime.jsx)(_components.Button, {
|
|
97
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
97
98
|
isSmall: true,
|
|
98
99
|
title: option.label,
|
|
99
100
|
"aria-label": option.label,
|
|
@@ -105,7 +106,7 @@ function PositionControl(_ref) {
|
|
|
105
106
|
})
|
|
106
107
|
}, `newspack-position-placement-item-${index}`);
|
|
107
108
|
})
|
|
108
|
-
}), (0, _jsxRuntime.jsx)("p", {
|
|
109
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
109
110
|
className: "components-base-control__help",
|
|
110
111
|
children: help
|
|
111
112
|
})]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@use
|
|
1
|
+
@use "~@wordpress/base-styles/colors" as wp-colors;
|
|
2
2
|
|
|
3
3
|
.newspack-position-placement-control {
|
|
4
4
|
margin-bottom: 1em;
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
.components-button-group {
|
|
12
12
|
display: grid;
|
|
13
|
-
grid-template-columns: repeat(
|
|
14
|
-
grid-template-rows: repeat(
|
|
13
|
+
grid-template-columns: repeat(3, 1fr);
|
|
14
|
+
grid-template-rows: repeat(3, 1fr);
|
|
15
15
|
|
|
16
16
|
div {
|
|
17
17
|
padding: 1px;
|
|
@@ -24,19 +24,19 @@
|
|
|
24
24
|
width: 100%;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
div:nth-of-type(
|
|
27
|
+
div:nth-of-type(1) .components-button {
|
|
28
28
|
border-radius: 4px 0 0 !important;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
div:nth-of-type(
|
|
31
|
+
div:nth-of-type(3) .components-button {
|
|
32
32
|
border-radius: 0 4px 0 0 !important;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
div:nth-last-of-type(
|
|
35
|
+
div:nth-last-of-type(1) .components-button {
|
|
36
36
|
border-radius: 0 0 4px !important;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
div:nth-last-of-type(
|
|
39
|
+
div:nth-last-of-type(3) .components-button {
|
|
40
40
|
border-radius: 0 0 0 4px !important;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
border-radius: 4px 4px 0 0 !important;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
div:nth-of-type(
|
|
51
|
+
div:nth-of-type(2) .components-button {
|
|
52
52
|
border-radius: 0 !important;
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _element = require("@wordpress/element");
|
|
8
8
|
require("./style.scss");
|
|
9
|
-
var _jsxRuntime = require("
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
/**
|
|
11
11
|
* Progress Bar
|
|
12
12
|
*/
|
|
@@ -49,21 +49,21 @@ class ProgressBar extends _element.Component {
|
|
|
49
49
|
const barStyle = {
|
|
50
50
|
width: this.getCompletionPercentage(cleanCompleted, cleanTotal) + '%'
|
|
51
51
|
};
|
|
52
|
-
return (0, _jsxRuntime.jsxs)("div", {
|
|
52
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
53
53
|
className: "newspack-progress-bar",
|
|
54
|
-
children: [(label || displayFraction) && (0, _jsxRuntime.jsxs)("div", {
|
|
54
|
+
children: [(label || displayFraction) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
55
55
|
className: "newspack-progress-bar__headings",
|
|
56
|
-
children: [label && (0, _jsxRuntime.jsx)("h2", {
|
|
56
|
+
children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
57
57
|
children: label
|
|
58
|
-
}), displayFraction && (0, _jsxRuntime.jsx)("p", {
|
|
58
|
+
}), displayFraction && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
59
59
|
className: "is-dark",
|
|
60
|
-
children: (0, _jsxRuntime.jsxs)("strong", {
|
|
60
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("strong", {
|
|
61
61
|
children: [cleanCompleted, "/", cleanTotal]
|
|
62
62
|
})
|
|
63
63
|
})]
|
|
64
|
-
}), (0, _jsxRuntime.jsx)("div", {
|
|
64
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
65
65
|
className: "newspack-progress-bar__container",
|
|
66
|
-
children: (0, _jsxRuntime.jsx)("div", {
|
|
66
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
67
67
|
className: "newspack-progress-bar__bar",
|
|
68
68
|
style: barStyle,
|
|
69
69
|
"data-testid": "progress-bar-indicator"
|
|
@@ -72,5 +72,4 @@ class ProgressBar extends _element.Component {
|
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
var _default = ProgressBar;
|
|
76
|
-
exports.default = _default;
|
|
75
|
+
var _default = exports.default = ProgressBar;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
4
|
-
var _react =
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
5
5
|
var _react2 = require("@testing-library/react");
|
|
6
6
|
var _ = _interopRequireDefault(require("./"));
|
|
7
|
-
var _jsxRuntime = require("
|
|
8
|
-
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
9
10
|
describe('ProgressBar', () => {
|
|
10
11
|
it('should render a progress indicator', () => {
|
|
11
12
|
const {
|
|
12
13
|
getByTestId
|
|
13
|
-
} = (0, _react2.render)((0, _jsxRuntime.jsx)(_.default, {
|
|
14
|
+
} = (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
14
15
|
completed: "1",
|
|
15
16
|
total: "2"
|
|
16
17
|
}));
|
|
@@ -21,7 +22,7 @@ describe('ProgressBar', () => {
|
|
|
21
22
|
const label = 'test label';
|
|
22
23
|
const {
|
|
23
24
|
getByText
|
|
24
|
-
} = (0, _react2.render)((0, _jsxRuntime.jsx)(_.default, {
|
|
25
|
+
} = (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
25
26
|
completed: "1",
|
|
26
27
|
total: "2",
|
|
27
28
|
label: label
|
|
@@ -31,7 +32,7 @@ describe('ProgressBar', () => {
|
|
|
31
32
|
it('should render progress as a fraction', () => {
|
|
32
33
|
const {
|
|
33
34
|
getByText
|
|
34
|
-
} = (0, _react2.render)((0, _jsxRuntime.jsx)(_.default, {
|
|
35
|
+
} = (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
35
36
|
completed: "1",
|
|
36
37
|
total: "2",
|
|
37
38
|
displayFraction: true
|
|
@@ -42,7 +43,7 @@ describe('ProgressBar', () => {
|
|
|
42
43
|
const label = 'test label';
|
|
43
44
|
const {
|
|
44
45
|
getByText
|
|
45
|
-
} = (0, _react2.render)((0, _jsxRuntime.jsx)(_.default, {
|
|
46
|
+
} = (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
46
47
|
completed: "1",
|
|
47
48
|
total: "2",
|
|
48
49
|
label: label,
|
|
@@ -70,15 +71,14 @@ describe('ProgressBar', () => {
|
|
|
70
71
|
total: 3
|
|
71
72
|
},
|
|
72
73
|
expectedWidth: 100
|
|
73
|
-
}].forEach(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
} = _ref;
|
|
74
|
+
}].forEach(({
|
|
75
|
+
props,
|
|
76
|
+
expectedWidth
|
|
77
|
+
}) => {
|
|
78
78
|
it(`with expected progress of ${expectedWidth}`, () => {
|
|
79
79
|
const {
|
|
80
80
|
getByTestId
|
|
81
|
-
} = (0, _react2.render)((0,
|
|
81
|
+
} = (0, _react2.render)( /*#__PURE__*/(0, _react.createElement)(_.default, {
|
|
82
82
|
...props,
|
|
83
83
|
key: expectedWidth
|
|
84
84
|
}));
|
|
@@ -90,7 +90,7 @@ describe('ProgressBar', () => {
|
|
|
90
90
|
const {
|
|
91
91
|
getByText,
|
|
92
92
|
getByTestId
|
|
93
|
-
} = (0, _react2.render)((0, _jsxRuntime.jsx)(_.default, {
|
|
93
|
+
} = (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
94
94
|
completed: "cats",
|
|
95
95
|
total: "dogs",
|
|
96
96
|
displayFraction: true
|
|
@@ -102,7 +102,7 @@ describe('ProgressBar', () => {
|
|
|
102
102
|
const {
|
|
103
103
|
getByText,
|
|
104
104
|
getByTestId
|
|
105
|
-
} = (0, _react2.render)((0, _jsxRuntime.jsx)(_.default, {
|
|
105
|
+
} = (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
106
106
|
completed: "3",
|
|
107
107
|
total: "-1",
|
|
108
108
|
displayFraction: true
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var ReactRouterDOM = _interopRequireWildcard(require("react-router-dom"));
|
|
8
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
|
+
/**
|
|
11
|
+
* A proxy for react-router-dom.
|
|
12
|
+
* Ensures that both components and the plugin use the same instance of
|
|
13
|
+
* React Router, even if there are node_modules in components.
|
|
14
|
+
*/
|
|
15
|
+
var _default = exports.default = ReactRouterDOM;
|