newspack-components 2.2.0 → 3.0.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/dist/cjs/action-card/index.js +3 -4
- package/dist/cjs/autocomplete-tokenfield/index.js +52 -15
- package/dist/cjs/autocomplete-tokenfield/style.scss +11 -5
- package/dist/cjs/autocomplete-with-suggestions/index.js +45 -57
- package/dist/cjs/autocomplete-with-suggestions/style.scss +1 -9
- package/dist/cjs/button/index.js +8 -9
- package/dist/cjs/button-card/index.js +1 -2
- package/dist/cjs/card/index.js +1 -2
- package/dist/cjs/category-autocomplete/index.js +4 -8
- package/dist/cjs/color-picker/index.js +7 -9
- package/dist/cjs/consts.js +2 -7
- package/dist/cjs/custom-select-control/index.js +1 -2
- package/dist/cjs/footer/index.js +24 -29
- package/dist/cjs/form-token-field/index.js +1 -2
- package/dist/cjs/global-notices/index.js +1 -2
- package/dist/cjs/grid/index.js +14 -31
- package/dist/cjs/handoff/index.js +7 -8
- package/dist/cjs/hooks/index.js +2 -3
- package/dist/cjs/hooks/useObjectState.js +1 -2
- package/dist/cjs/hooks/useOnClickOutside.js +1 -2
- package/dist/cjs/hooks/usePrompt.js +1 -4
- package/dist/cjs/image-upload/index.js +5 -6
- package/dist/cjs/index.js +0 -14
- package/dist/cjs/info-button/index.js +1 -2
- package/dist/cjs/modal/index.js +1 -2
- package/dist/cjs/newspack-icon/index.js +1 -2
- package/dist/cjs/newspack-logo/index.js +1 -2
- package/dist/cjs/notice/index.js +2 -3
- package/dist/cjs/patrons-logo/index.js +4 -5
- package/dist/cjs/plugin-installer/index.js +9 -13
- package/dist/cjs/plugin-settings/SettingsSection.js +2 -4
- package/dist/cjs/plugin-settings/index.js +2 -3
- package/dist/cjs/plugin-toggle/index.js +16 -20
- package/dist/cjs/popover/index.js +1 -2
- package/dist/cjs/position-control/index.js +22 -23
- package/dist/cjs/progress-bar/index.js +1 -2
- package/dist/cjs/progress-bar/index.test.js +4 -5
- package/dist/cjs/proxied-imports/router.js +1 -2
- package/dist/cjs/radio-control/index.js +1 -2
- package/dist/cjs/section-header/index.js +13 -14
- package/dist/cjs/section-header/style.scss +4 -0
- package/dist/cjs/select-control/ButtonGroupControl.js +10 -12
- package/dist/cjs/select-control/GroupedSelectControl.js +21 -25
- package/dist/cjs/select-control/index.js +1 -2
- package/dist/cjs/settings/MinMaxSetting.js +17 -15
- package/dist/cjs/settings/SettingsCard.js +10 -12
- package/dist/cjs/settings/SettingsSection.js +20 -24
- package/dist/cjs/settings/index.js +2 -3
- package/dist/cjs/settings/style.scss +14 -1
- package/dist/cjs/sortable-newsletter-list-control/index.js +134 -0
- package/dist/cjs/sortable-newsletter-list-control/style.scss +45 -0
- package/dist/cjs/steps-list/index.js +1 -2
- package/dist/cjs/steps-list-item/index.js +1 -2
- package/dist/cjs/style-card/index.js +6 -7
- package/dist/cjs/style.scss +13 -1
- package/dist/cjs/tabbed-navigation/index.js +11 -14
- package/dist/cjs/text-control/index.js +32 -42
- package/dist/cjs/utils/index.js +15 -19
- package/dist/cjs/waiting/index.js +1 -2
- package/dist/cjs/web-preview/index.js +7 -8
- package/dist/cjs/with-wizard/index.js +6 -7
- package/dist/cjs/with-wizard-screen/index.js +20 -24
- package/dist/cjs/wizard/components/WizardError.js +7 -9
- package/dist/cjs/wizard/index.js +16 -21
- package/dist/cjs/wizard/store/index.js +36 -37
- package/dist/cjs/wizard/store/utils.js +1 -4
- package/dist/esm/action-card/index.js +3 -4
- package/dist/esm/autocomplete-tokenfield/index.js +52 -15
- package/dist/esm/autocomplete-tokenfield/style.scss +11 -5
- package/dist/esm/autocomplete-with-suggestions/index.js +46 -59
- package/dist/esm/autocomplete-with-suggestions/style.scss +1 -9
- package/dist/esm/button/index.js +7 -7
- package/dist/esm/button-card/index.js +1 -2
- package/dist/esm/category-autocomplete/index.js +4 -8
- package/dist/esm/color-picker/index.js +7 -9
- package/dist/esm/consts.js +0 -2
- package/dist/esm/footer/index.js +24 -29
- package/dist/esm/form-token-field/index.js +1 -2
- package/dist/esm/grid/index.js +13 -29
- package/dist/esm/handoff/index.js +7 -8
- package/dist/esm/hooks/useObjectState.js +1 -2
- package/dist/esm/hooks/useObjectState.test.js +1 -2
- package/dist/esm/hooks/usePrompt.js +1 -4
- package/dist/esm/image-upload/index.js +5 -7
- package/dist/esm/index.js +0 -2
- package/dist/esm/notice/index.js +2 -3
- package/dist/esm/patrons-logo/index.js +4 -5
- package/dist/esm/plugin-installer/index.js +9 -14
- package/dist/esm/plugin-settings/SettingsSection.js +2 -4
- package/dist/esm/plugin-settings/index.js +2 -3
- package/dist/esm/plugin-toggle/index.js +16 -20
- package/dist/esm/position-control/index.js +23 -25
- package/dist/esm/progress-bar/index.js +1 -2
- package/dist/esm/progress-bar/index.test.js +4 -5
- package/dist/esm/section-header/index.js +13 -14
- package/dist/esm/section-header/style.scss +4 -0
- package/dist/esm/select-control/ButtonGroupControl.js +9 -10
- package/dist/esm/select-control/GroupedSelectControl.js +22 -27
- package/dist/esm/settings/MinMaxSetting.js +17 -16
- package/dist/esm/settings/SettingsCard.js +9 -10
- package/dist/esm/settings/SettingsSection.js +20 -24
- package/dist/esm/settings/style.scss +14 -1
- package/dist/esm/sortable-newsletter-list-control/index.js +128 -0
- package/dist/esm/sortable-newsletter-list-control/style.scss +45 -0
- package/dist/esm/steps-list-item/index.js +1 -2
- package/dist/esm/style-card/index.js +6 -7
- package/dist/esm/style.scss +13 -1
- package/dist/esm/tabbed-navigation/index.js +11 -14
- package/dist/esm/text-control/index.js +32 -41
- package/dist/esm/utils/index.js +13 -16
- package/dist/esm/web-preview/index.js +7 -8
- package/dist/esm/with-wizard/index.js +7 -9
- package/dist/esm/with-wizard-screen/index.js +21 -27
- package/dist/esm/wizard/components/WizardError.js +7 -9
- package/dist/esm/wizard/index.js +16 -22
- package/dist/esm/wizard/store/index.js +35 -35
- package/dist/esm/wizard/store/utils.js +1 -4
- package/package.json +7 -8
- package/shared/js/button-props.js +3 -1
- package/shared/scss/_colors.scss +15 -0
- package/shared/scss/_mixins.scss +12 -0
- package/src/autocomplete-tokenfield/index.js +48 -15
- package/src/autocomplete-tokenfield/style.scss +11 -5
- package/src/autocomplete-with-suggestions/index.js +17 -22
- package/src/autocomplete-with-suggestions/style.scss +1 -9
- package/src/button/{index.js → index.tsx} +12 -5
- package/src/consts.js +0 -2
- package/src/footer/index.js +7 -7
- package/src/grid/index.tsx +34 -0
- package/src/handoff/index.js +7 -6
- package/src/hooks/{index.js → index.ts} +1 -1
- package/src/hooks/{usePrompt.js → usePrompt.ts} +4 -8
- package/src/image-upload/index.js +4 -4
- package/src/index.js +0 -2
- package/src/notice/index.js +1 -1
- package/src/patrons-logo/index.js +4 -1
- package/src/plugin-installer/index.js +7 -7
- package/src/plugin-settings/index.js +1 -1
- package/src/plugin-toggle/index.js +7 -5
- package/src/position-control/index.js +13 -13
- package/src/section-header/index.js +3 -3
- package/src/section-header/style.scss +4 -0
- package/src/select-control/GroupedSelectControl.js +1 -1
- package/src/settings/MinMaxSetting.js +8 -6
- package/src/settings/style.scss +14 -1
- package/src/sortable-newsletter-list-control/index.js +137 -0
- package/src/sortable-newsletter-list-control/style.scss +45 -0
- package/src/style-card/index.js +11 -5
- package/src/style.scss +13 -1
- package/src/tabbed-navigation/index.js +1 -1
- package/src/text-control/index.tsx +65 -0
- package/src/web-preview/index.js +6 -6
- package/src/with-wizard/index.js +4 -4
- package/src/with-wizard-screen/index.js +1 -1
- 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/accordion/index.js +0 -46
- package/dist/cjs/accordion/style.scss +0 -27
- package/dist/cjs/button-group/index.js +0 -57
- package/dist/cjs/button-group/style.scss +0 -73
- package/dist/cjs/checkbox-control/index.js +0 -63
- package/dist/cjs/checkbox-control/style.scss +0 -78
- package/dist/cjs/date-range-picker/index.js +0 -41
- package/dist/cjs/date-range-picker/style.scss +0 -148
- package/dist/cjs/preview-box/index.js +0 -36
- package/dist/cjs/preview-box/style.scss +0 -18
- package/dist/cjs/textarea-control/index.js +0 -54
- package/dist/cjs/textarea-control/style.scss +0 -76
- package/dist/cjs/toggle-control/index.js +0 -58
- package/dist/cjs/toggle-control/style.scss +0 -74
- package/dist/cjs/toggle-group/index.js +0 -71
- package/dist/cjs/toggle-group/style.scss +0 -28
- package/dist/cjs/wizard/style.scss +0 -148
- package/dist/esm/accordion/index.js +0 -38
- package/dist/esm/accordion/style.scss +0 -27
- package/dist/esm/button-group/index.js +0 -43
- package/dist/esm/button-group/style.scss +0 -73
- package/dist/esm/checkbox-control/index.js +0 -49
- package/dist/esm/checkbox-control/style.scss +0 -78
- package/dist/esm/date-range-picker/index.js +0 -32
- package/dist/esm/date-range-picker/style.scss +0 -148
- package/dist/esm/preview-box/index.js +0 -30
- package/dist/esm/preview-box/style.scss +0 -18
- package/dist/esm/textarea-control/index.js +0 -40
- package/dist/esm/textarea-control/style.scss +0 -76
- package/dist/esm/toggle-control/index.js +0 -44
- package/dist/esm/toggle-control/style.scss +0 -74
- package/dist/esm/toggle-group/index.js +0 -58
- package/dist/esm/toggle-group/style.scss +0 -28
- package/dist/esm/wizard/style.scss +0 -148
- package/src/accordion/index.js +0 -32
- package/src/accordion/style.scss +0 -27
- package/src/date-range-picker/index.js +0 -31
- package/src/date-range-picker/style.scss +0 -148
- package/src/grid/index.js +0 -44
- package/src/text-control/index.js +0 -56
|
@@ -9,12 +9,11 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
9
9
|
import { Component } from '@wordpress/element';
|
|
10
10
|
import { Path, SVG } from '@wordpress/components';
|
|
11
11
|
import { __ as alias__ } from '@wordpress/i18n';
|
|
12
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
13
|
-
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
14
13
|
const __ = alias__;
|
|
15
14
|
class PatronsLogo extends Component {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...
|
|
15
|
+
constructor(...args) {
|
|
16
|
+
super(...args);
|
|
18
17
|
/**
|
|
19
18
|
* Render.
|
|
20
19
|
*/
|
|
@@ -25,7 +24,7 @@ class PatronsLogo extends Component {
|
|
|
25
24
|
height: "16",
|
|
26
25
|
viewBox: "0 0 438 32",
|
|
27
26
|
className: "patrons-logo",
|
|
28
|
-
"aria-label": __('A project of WordPress.com and the Google News Initiative', 'newspack'),
|
|
27
|
+
"aria-label": __('A project of WordPress.com and the Google News Initiative', 'newspack-plugin'),
|
|
29
28
|
children: [_jsx(Path, {
|
|
30
29
|
fillRule: "evenodd",
|
|
31
30
|
clipRule: "evenodd",
|
|
@@ -30,14 +30,10 @@ import classnames from 'classnames';
|
|
|
30
30
|
/**
|
|
31
31
|
* Plugin installer.
|
|
32
32
|
*/
|
|
33
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
34
|
-
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
35
|
-
import { Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
33
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
36
34
|
class PluginInstaller extends Component {
|
|
37
35
|
constructor() {
|
|
38
|
-
var _this;
|
|
39
36
|
super(...arguments);
|
|
40
|
-
_this = this;
|
|
41
37
|
_defineProperty(this, "componentDidMount", () => {
|
|
42
38
|
const {
|
|
43
39
|
plugins
|
|
@@ -126,12 +122,11 @@ class PluginInstaller extends Component {
|
|
|
126
122
|
}
|
|
127
123
|
});
|
|
128
124
|
});
|
|
129
|
-
_defineProperty(this, "setInstallationStatus",
|
|
130
|
-
let notification = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
125
|
+
_defineProperty(this, "setInstallationStatus", (slug, installationStatus, notification = null) => {
|
|
131
126
|
const {
|
|
132
127
|
pluginInfo
|
|
133
|
-
} =
|
|
134
|
-
|
|
128
|
+
} = this.state;
|
|
129
|
+
this.updatePluginInfo({
|
|
135
130
|
...pluginInfo,
|
|
136
131
|
[slug]: {
|
|
137
132
|
...pluginInfo[slug],
|
|
@@ -202,7 +197,7 @@ class PluginInstaller extends Component {
|
|
|
202
197
|
|
|
203
198
|
// Make sure plugin status falls in either one of these, to handle button text.
|
|
204
199
|
const pluginInstalled = currentStatus => currentStatus === 'active' || currentStatus === 'inactive';
|
|
205
|
-
const buttonText = currentPluginStatuses.every(pluginInstalled) ? __('Activate', 'newspack') : __('Install', 'newspack');
|
|
200
|
+
const buttonText = currentPluginStatuses.every(pluginInstalled) ? __('Activate', 'newspack-plugin') : __('Install', 'newspack-plugin');
|
|
206
201
|
const needsInstall = slugs.some(slug => {
|
|
207
202
|
const plugin = pluginInfo[slug];
|
|
208
203
|
return plugin.Status !== 'active' && plugin.installationStatus === PLUGIN_STATE_NONE;
|
|
@@ -212,7 +207,7 @@ class PluginInstaller extends Component {
|
|
|
212
207
|
className: "newspack-plugin-installer_is-waiting",
|
|
213
208
|
children: [_jsx(Waiting, {
|
|
214
209
|
isLeft: true
|
|
215
|
-
}), __('Retrieving plugin information…')]
|
|
210
|
+
}), __('Retrieving plugin information…', 'newspack-plugin')]
|
|
216
211
|
}), pluginInfo && slugs.length > 0 && slugs.map(slug => {
|
|
217
212
|
const plugin = pluginInfo[slug];
|
|
218
213
|
const {
|
|
@@ -232,7 +227,7 @@ class PluginInstaller extends Component {
|
|
|
232
227
|
} else if (!installable) {
|
|
233
228
|
actionText = _jsxs("span", {
|
|
234
229
|
className: "newspack-plugin-installer__status",
|
|
235
|
-
children: [isAtomic ? __('Contact Newspack support to install', 'newspack') : __('Plugin must be installed manually', 'newspack'), _jsx("span", {
|
|
230
|
+
children: [isAtomic ? __('Contact Newspack support to install', 'newspack-plugin') : __('Plugin must be installed manually', 'newspack-plugin'), _jsx("span", {
|
|
236
231
|
className: "newspack-checkbox-icon"
|
|
237
232
|
})]
|
|
238
233
|
});
|
|
@@ -246,14 +241,14 @@ class PluginInstaller extends Component {
|
|
|
246
241
|
} else if (Status === 'inactive') {
|
|
247
242
|
actionText = _jsxs("span", {
|
|
248
243
|
className: "newspack-plugin-installer__status",
|
|
249
|
-
children: [__('Activate', 'newspack'), _jsx("span", {
|
|
244
|
+
children: [__('Activate', 'newspack-plugin'), _jsx("span", {
|
|
250
245
|
className: "newspack-checkbox-icon"
|
|
251
246
|
})]
|
|
252
247
|
});
|
|
253
248
|
} else if (Status === 'active') {
|
|
254
249
|
actionText = _jsxs("span", {
|
|
255
250
|
className: "newspack-plugin-installer__status",
|
|
256
|
-
children: [__('Installed', 'newspack'), _jsx("span", {
|
|
251
|
+
children: [__('Installed', 'newspack-plugin'), _jsx("span", {
|
|
257
252
|
className: "newspack-checkbox-icon newspack-checkbox-icon--checked",
|
|
258
253
|
children: _jsx(Icon, {
|
|
259
254
|
icon: check
|
|
@@ -16,8 +16,7 @@ import { CheckboxControl } from '@wordpress/components';
|
|
|
16
16
|
*/
|
|
17
17
|
import { ActionCard, Button, Grid, Notice, SelectControl, TextControl } from '../';
|
|
18
18
|
import './style.scss';
|
|
19
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
20
|
-
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
19
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
21
20
|
const isSelectControl = setting => {
|
|
22
21
|
return Array.isArray(setting.options) && setting.options.length;
|
|
23
22
|
};
|
|
@@ -83,8 +82,7 @@ const SettingsSection = props => {
|
|
|
83
82
|
setSaveDisabled(false);
|
|
84
83
|
}
|
|
85
84
|
});
|
|
86
|
-
const createFilter =
|
|
87
|
-
let defaultComponent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
85
|
+
const createFilter = (name, defaultComponent = null) => {
|
|
88
86
|
return applyFilters(`newspack.settingSection.${sectionKey}.${name}`, defaultComponent, props);
|
|
89
87
|
};
|
|
90
88
|
let columns = 2;
|
|
@@ -17,8 +17,7 @@ import { __ as alias__ } from '@wordpress/i18n';
|
|
|
17
17
|
const __ = alias__;
|
|
18
18
|
import { SectionHeader, Notice } from '../';
|
|
19
19
|
import SettingsSection from './SettingsSection';
|
|
20
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
21
|
-
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
20
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
22
21
|
class PluginSettings extends Component {
|
|
23
22
|
constructor() {
|
|
24
23
|
super(...arguments);
|
|
@@ -211,7 +210,7 @@ class PluginSettings extends Component {
|
|
|
211
210
|
}
|
|
212
211
|
}
|
|
213
212
|
PluginSettings.defaultProps = {
|
|
214
|
-
title: __('General Settings', 'newspack')
|
|
213
|
+
title: __('General Settings', 'newspack-plugin')
|
|
215
214
|
};
|
|
216
215
|
PluginSettings.Section = SettingsSection;
|
|
217
216
|
export default PluginSettings;
|
|
@@ -16,11 +16,10 @@ import './style.scss';
|
|
|
16
16
|
/**
|
|
17
17
|
* Plugin toggle group component.
|
|
18
18
|
*/
|
|
19
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
20
|
-
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
19
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
21
20
|
class PluginToggle extends Component {
|
|
22
|
-
constructor() {
|
|
23
|
-
super(...
|
|
21
|
+
constructor(...args) {
|
|
22
|
+
super(...args);
|
|
24
23
|
_defineProperty(this, "state", {
|
|
25
24
|
pluginInfo: {}
|
|
26
25
|
});
|
|
@@ -67,24 +66,21 @@ class PluginToggle extends Component {
|
|
|
67
66
|
const {
|
|
68
67
|
shouldRefreshAfterUpdate
|
|
69
68
|
} = plugins[plugin];
|
|
70
|
-
this.setState(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}, () => shouldRefreshAfterUpdate && location.reload());
|
|
69
|
+
this.setState(({
|
|
70
|
+
pluginInfo: currentPluginInfo
|
|
71
|
+
}) => ({
|
|
72
|
+
pluginInfo: {
|
|
73
|
+
...currentPluginInfo,
|
|
74
|
+
[plugin]: response
|
|
75
|
+
}
|
|
76
|
+
}), () => shouldRefreshAfterUpdate && location.reload());
|
|
81
77
|
}).catch(e => {
|
|
82
78
|
this.setState({
|
|
83
79
|
pluginInfo: {
|
|
84
80
|
...pluginInfo,
|
|
85
81
|
[plugin]: {
|
|
86
82
|
...pluginInfo[plugin],
|
|
87
|
-
error: e.message || __('There was an error managing this plugin.', 'newspack')
|
|
83
|
+
error: e.message || __('There was an error managing this plugin.', 'newspack-plugin')
|
|
88
84
|
}
|
|
89
85
|
}
|
|
90
86
|
});
|
|
@@ -127,21 +123,21 @@ class PluginToggle extends Component {
|
|
|
127
123
|
// Show spinner when plugin data is unavailable, or when an API call is in flight.
|
|
128
124
|
if ('configure' === inFlight) {
|
|
129
125
|
return _jsxs(Fragment, {
|
|
130
|
-
children: [__('Installing…', 'newspack'), " ", _jsx(Waiting, {
|
|
126
|
+
children: [__('Installing…', 'newspack-plugin'), " ", _jsx(Waiting, {
|
|
131
127
|
isRight: true
|
|
132
128
|
})]
|
|
133
129
|
});
|
|
134
130
|
}
|
|
135
131
|
if ('deactivate' === inFlight) {
|
|
136
132
|
return _jsxs(Fragment, {
|
|
137
|
-
children: [__('Deactivating…', 'newspack'), " ", _jsx(Waiting, {
|
|
133
|
+
children: [__('Deactivating…', 'newspack-plugin'), " ", _jsx(Waiting, {
|
|
138
134
|
isRight: true
|
|
139
135
|
})]
|
|
140
136
|
});
|
|
141
137
|
}
|
|
142
138
|
if (!name) {
|
|
143
139
|
return _jsxs(Fragment, {
|
|
144
|
-
children: [__('Loading…', 'newspack'), " ", _jsx(Waiting, {
|
|
140
|
+
children: [__('Loading…', 'newspack-plugin'), " ", _jsx(Waiting, {
|
|
145
141
|
isRight: true
|
|
146
142
|
})]
|
|
147
143
|
});
|
|
@@ -151,7 +147,7 @@ class PluginToggle extends Component {
|
|
|
151
147
|
return null;
|
|
152
148
|
}
|
|
153
149
|
if (href || editPath) {
|
|
154
|
-
return actionText ? actionText : __('Configure', 'newspack');
|
|
150
|
+
return actionText ? actionText : __('Configure', 'newspack-plugin');
|
|
155
151
|
}
|
|
156
152
|
});
|
|
157
153
|
/**
|
|
@@ -14,69 +14,67 @@ import classnames from 'classnames';
|
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
16
|
import './style.scss';
|
|
17
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
...props
|
|
28
|
-
} = _ref;
|
|
17
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
18
|
+
export default function PositionControl({
|
|
19
|
+
allowedPositions,
|
|
20
|
+
value,
|
|
21
|
+
label,
|
|
22
|
+
help,
|
|
23
|
+
onChange,
|
|
24
|
+
size,
|
|
25
|
+
...props
|
|
26
|
+
}) {
|
|
29
27
|
/**
|
|
30
28
|
* Set layout options
|
|
31
29
|
*/
|
|
32
30
|
const options = size === 'full-width' ? [{
|
|
33
31
|
value: 'top',
|
|
34
32
|
/* translators: Overlay Position */
|
|
35
|
-
label: __('Top', 'newspack')
|
|
33
|
+
label: __('Top', 'newspack-plugin')
|
|
36
34
|
}, {
|
|
37
35
|
value: 'center',
|
|
38
36
|
/* translators: Overlay Position */
|
|
39
|
-
label: __('Center', 'newspack')
|
|
37
|
+
label: __('Center', 'newspack-plugin')
|
|
40
38
|
}, {
|
|
41
39
|
value: 'bottom',
|
|
42
40
|
/* translators: Overlay Position */
|
|
43
|
-
label: __('Bottom', 'newspack')
|
|
41
|
+
label: __('Bottom', 'newspack-plugin')
|
|
44
42
|
}] : [{
|
|
45
43
|
value: 'top_left',
|
|
46
44
|
/* translators: Overlay Position */
|
|
47
|
-
label: __('Top Left', 'newspack')
|
|
45
|
+
label: __('Top Left', 'newspack-plugin')
|
|
48
46
|
}, {
|
|
49
47
|
value: 'top',
|
|
50
48
|
/* translators: Overlay Position */
|
|
51
|
-
label: __('Top Center', 'newspack')
|
|
49
|
+
label: __('Top Center', 'newspack-plugin')
|
|
52
50
|
}, {
|
|
53
51
|
value: 'top_right',
|
|
54
52
|
/* translators: Overlay Position */
|
|
55
|
-
label: __('Top Right', 'newspack')
|
|
53
|
+
label: __('Top Right', 'newspack-plugin')
|
|
56
54
|
}, {
|
|
57
55
|
value: 'center_left',
|
|
58
56
|
/* translators: Overlay Position */
|
|
59
|
-
label: __('Center Left', 'newspack')
|
|
57
|
+
label: __('Center Left', 'newspack-plugin')
|
|
60
58
|
}, {
|
|
61
59
|
value: 'center',
|
|
62
60
|
/* translators: Overlay Position */
|
|
63
|
-
label: __('Center', 'newspack')
|
|
61
|
+
label: __('Center', 'newspack-plugin')
|
|
64
62
|
}, {
|
|
65
63
|
value: 'center_right',
|
|
66
64
|
/* translators: Overlay Position */
|
|
67
|
-
label: __('Center Right', 'newspack')
|
|
65
|
+
label: __('Center Right', 'newspack-plugin')
|
|
68
66
|
}, {
|
|
69
67
|
value: 'bottom_left',
|
|
70
68
|
/* translators: Overlay Position */
|
|
71
|
-
label: __('Bottom Left', 'newspack')
|
|
69
|
+
label: __('Bottom Left', 'newspack-plugin')
|
|
72
70
|
}, {
|
|
73
71
|
value: 'bottom',
|
|
74
72
|
/* translators: Overlay Position */
|
|
75
|
-
label: __('Bottom Center', 'newspack')
|
|
73
|
+
label: __('Bottom Center', 'newspack-plugin')
|
|
76
74
|
}, {
|
|
77
75
|
value: 'bottom_right',
|
|
78
76
|
/* translators: Overlay Position */
|
|
79
|
-
label: __('Bottom Right', 'newspack')
|
|
77
|
+
label: __('Bottom Right', 'newspack-plugin')
|
|
80
78
|
}];
|
|
81
79
|
return _jsxs("div", {
|
|
82
80
|
className: classnames('newspack-position-placement-control', 'size-' + size),
|
|
@@ -84,7 +82,7 @@ export default function PositionControl(_ref) {
|
|
|
84
82
|
className: "components-base-control__label",
|
|
85
83
|
children: label
|
|
86
84
|
}), _jsx(ButtonGroup, {
|
|
87
|
-
"aria-label": __('Select Position', 'newspack'),
|
|
85
|
+
"aria-label": __('Select Position', 'newspack-plugin'),
|
|
88
86
|
...props,
|
|
89
87
|
children: options.map((option, index) => {
|
|
90
88
|
return _jsx("div", {
|
|
@@ -11,8 +11,7 @@ import { Component } from '@wordpress/element';
|
|
|
11
11
|
* Internal dependencies.
|
|
12
12
|
*/
|
|
13
13
|
import './style.scss';
|
|
14
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
15
|
-
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
16
15
|
class ProgressBar extends Component {
|
|
17
16
|
/**
|
|
18
17
|
* Get completion as a percentage.
|
|
@@ -67,11 +67,10 @@ describe('ProgressBar', () => {
|
|
|
67
67
|
total: 3
|
|
68
68
|
},
|
|
69
69
|
expectedWidth: 100
|
|
70
|
-
}].forEach(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
} = _ref;
|
|
70
|
+
}].forEach(({
|
|
71
|
+
props,
|
|
72
|
+
expectedWidth
|
|
73
|
+
}) => {
|
|
75
74
|
it(`with expected progress of ${expectedWidth}`, () => {
|
|
76
75
|
const {
|
|
77
76
|
getByTestId
|
|
@@ -17,19 +17,17 @@ import './style.scss';
|
|
|
17
17
|
* External dependencies
|
|
18
18
|
*/
|
|
19
19
|
import classnames from 'classnames';
|
|
20
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
id = null
|
|
32
|
-
} = _ref;
|
|
20
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
21
|
+
const SectionHeader = ({
|
|
22
|
+
centered = false,
|
|
23
|
+
className = null,
|
|
24
|
+
description = '',
|
|
25
|
+
heading = 2,
|
|
26
|
+
isWhite = false,
|
|
27
|
+
noMargin = false,
|
|
28
|
+
title,
|
|
29
|
+
id = null
|
|
30
|
+
}) => {
|
|
33
31
|
// If id is in the URL as a scrollTo param, scroll to it on render.
|
|
34
32
|
const ref = useRef();
|
|
35
33
|
useEffect(() => {
|
|
@@ -48,6 +46,7 @@ const SectionHeader = _ref => {
|
|
|
48
46
|
const HeadingTag = `h${heading}`;
|
|
49
47
|
return _jsx("div", {
|
|
50
48
|
id: id,
|
|
49
|
+
className: "newspack-section-header__container",
|
|
51
50
|
ref: ref,
|
|
52
51
|
children: _jsxs(Grid, {
|
|
53
52
|
columns: 1,
|
|
@@ -57,7 +56,7 @@ const SectionHeader = _ref => {
|
|
|
57
56
|
children: title
|
|
58
57
|
}), typeof title === 'function' && _jsx(HeadingTag, {
|
|
59
58
|
children: title()
|
|
60
|
-
}), typeof description === 'string' && _jsx("p", {
|
|
59
|
+
}), description && typeof description === 'string' && _jsx("p", {
|
|
61
60
|
children: description
|
|
62
61
|
}), typeof description === 'function' && _jsx("p", {
|
|
63
62
|
children: description()
|
|
@@ -14,16 +14,15 @@ import { BaseControl, Button, ButtonGroup } from '@wordpress/components';
|
|
|
14
14
|
*/
|
|
15
15
|
import { hooks } from '..';
|
|
16
16
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
17
|
-
const ButtonGroupControl =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} = _ref;
|
|
17
|
+
const ButtonGroupControl = ({
|
|
18
|
+
buttonOptions,
|
|
19
|
+
buttonSmall,
|
|
20
|
+
className,
|
|
21
|
+
hideLabelFromVision,
|
|
22
|
+
label,
|
|
23
|
+
onChange,
|
|
24
|
+
value
|
|
25
|
+
}) => {
|
|
27
26
|
const id = hooks.useUniqueId('button-group');
|
|
28
27
|
return _jsx(BaseControl, {
|
|
29
28
|
label: label,
|
|
@@ -21,18 +21,16 @@ import { hooks } from '..';
|
|
|
21
21
|
/**
|
|
22
22
|
* SelectControl with optgroup support
|
|
23
23
|
*/
|
|
24
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
...props
|
|
35
|
-
} = _ref;
|
|
24
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
25
|
+
export default function GroupedSelectControl({
|
|
26
|
+
help,
|
|
27
|
+
label,
|
|
28
|
+
onChange,
|
|
29
|
+
optgroups = [],
|
|
30
|
+
className,
|
|
31
|
+
hideLabelFromVision,
|
|
32
|
+
...props
|
|
33
|
+
}) {
|
|
36
34
|
const onChangeValue = event => {
|
|
37
35
|
const {
|
|
38
36
|
value
|
|
@@ -57,21 +55,18 @@ export default function GroupedSelectControl(_ref) {
|
|
|
57
55
|
...props,
|
|
58
56
|
children: [_jsx("option", {
|
|
59
57
|
value: "",
|
|
60
|
-
children: __('-- Select --', 'newspack')
|
|
61
|
-
}), optgroups.map((
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}, `${option.label}-${option.value}-${optionIndex}`))
|
|
73
|
-
}, optgroupIndex);
|
|
74
|
-
})]
|
|
58
|
+
children: __('-- Select --', 'newspack-plugin')
|
|
59
|
+
}), optgroups.map(({
|
|
60
|
+
label: optgroupLabel,
|
|
61
|
+
options
|
|
62
|
+
}, optgroupIndex) => _jsx("optgroup", {
|
|
63
|
+
label: optgroupLabel,
|
|
64
|
+
children: options.map((option, optionIndex) => _jsx("option", {
|
|
65
|
+
value: option.value,
|
|
66
|
+
disabled: option.disabled,
|
|
67
|
+
children: option.label
|
|
68
|
+
}, `${option.label}-${option.value}-${optionIndex}`))
|
|
69
|
+
}, optgroupIndex))]
|
|
75
70
|
}), _jsx("div", {
|
|
76
71
|
className: "components-select-control__arrow-wrapper",
|
|
77
72
|
children: _jsx(Icon, {
|
|
@@ -9,27 +9,26 @@ import { CheckboxControl } from '@wordpress/components';
|
|
|
9
9
|
* Internal dependencies.
|
|
10
10
|
*/
|
|
11
11
|
import { TextControl } from '../';
|
|
12
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return _jsxs(_Fragment, {
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
13
|
+
const MinMaxSetting = ({
|
|
14
|
+
min,
|
|
15
|
+
max,
|
|
16
|
+
onChangeMin,
|
|
17
|
+
onChangeMax,
|
|
18
|
+
minPlaceholder,
|
|
19
|
+
maxPlaceholder,
|
|
20
|
+
...props
|
|
21
|
+
}) => {
|
|
22
|
+
return _jsxs("div", {
|
|
23
|
+
...props,
|
|
25
24
|
children: [_jsxs("div", {
|
|
26
25
|
className: "newspack-settings__min-max",
|
|
27
26
|
children: [_jsx(CheckboxControl, {
|
|
28
27
|
checked: min > 0,
|
|
29
28
|
onChange: value => onChangeMin(value ? 1 : 0),
|
|
30
|
-
label: __('Min', 'newspack')
|
|
29
|
+
label: __('Min', 'newspack-plugin')
|
|
31
30
|
}), _jsx(TextControl, {
|
|
32
|
-
"data-testid": "min
|
|
31
|
+
"data-testid": "min",
|
|
33
32
|
type: "number",
|
|
34
33
|
value: min,
|
|
35
34
|
placeholder: minPlaceholder,
|
|
@@ -37,11 +36,13 @@ const MinMaxSetting = _ref => {
|
|
|
37
36
|
})]
|
|
38
37
|
}), _jsxs("div", {
|
|
39
38
|
className: "newspack-settings__min-max",
|
|
39
|
+
"data-testid": "max",
|
|
40
40
|
children: [_jsx(CheckboxControl, {
|
|
41
41
|
checked: max > 0,
|
|
42
42
|
onChange: value => onChangeMax(value ? min || 1 : 0),
|
|
43
|
-
label: __('Max', 'newspack')
|
|
43
|
+
label: __('Max', 'newspack-plugin')
|
|
44
44
|
}), _jsx(TextControl, {
|
|
45
|
+
"data-testid": "max",
|
|
45
46
|
type: "number",
|
|
46
47
|
value: max,
|
|
47
48
|
placeholder: maxPlaceholder,
|
|
@@ -8,16 +8,15 @@ import classnames from 'classnames';
|
|
|
8
8
|
*/
|
|
9
9
|
import { Grid, ActionCard } from '../';
|
|
10
10
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
11
|
-
const SettingsCard =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} = _ref;
|
|
11
|
+
const SettingsCard = ({
|
|
12
|
+
children,
|
|
13
|
+
className,
|
|
14
|
+
columns,
|
|
15
|
+
gutter,
|
|
16
|
+
noBorder,
|
|
17
|
+
rowGap,
|
|
18
|
+
...props
|
|
19
|
+
}) => {
|
|
21
20
|
const classes = classnames('newspack-settings__card', noBorder && 'newspack-settings__no-border', className);
|
|
22
21
|
return _jsx(ActionCard, {
|
|
23
22
|
...props,
|
|
@@ -2,29 +2,25 @@
|
|
|
2
2
|
* Internal dependencies.
|
|
3
3
|
*/
|
|
4
4
|
import { Grid, InfoButton } from '../';
|
|
5
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
children: title
|
|
21
|
-
}), description && _jsx(InfoButton, {
|
|
22
|
-
text: description
|
|
23
|
-
})]
|
|
24
|
-
}), _jsx("div", {
|
|
25
|
-
className: "newspack-settings__section__content",
|
|
26
|
-
children: children
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
6
|
+
const SettingSection = ({
|
|
7
|
+
title,
|
|
8
|
+
description,
|
|
9
|
+
children
|
|
10
|
+
}) => _jsxs(Grid, {
|
|
11
|
+
columns: 1,
|
|
12
|
+
gutter: 8,
|
|
13
|
+
className: "newspack-settings__section",
|
|
14
|
+
children: [_jsxs("div", {
|
|
15
|
+
className: "newspack-settings__section__title",
|
|
16
|
+
children: [_jsx("span", {
|
|
17
|
+
children: title
|
|
18
|
+
}), description && _jsx(InfoButton, {
|
|
19
|
+
text: description
|
|
27
20
|
})]
|
|
28
|
-
})
|
|
29
|
-
|
|
21
|
+
}), _jsx("div", {
|
|
22
|
+
className: "newspack-settings__section__content",
|
|
23
|
+
children: children
|
|
24
|
+
})]
|
|
25
|
+
});
|
|
30
26
|
export default SettingSection;
|