newspack-components 2.2.1 → 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/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/date-range-picker/index.js +0 -41
- package/dist/cjs/date-range-picker/style.scss +0 -148
- package/dist/esm/accordion/index.js +0 -38
- package/dist/esm/accordion/style.scss +0 -27
- package/dist/esm/date-range-picker/index.js +0 -32
- package/dist/esm/date-range-picker/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
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
&__content {
|
|
40
|
-
> div
|
|
40
|
+
> div,
|
|
41
|
+
.newspack-settings__min-max {
|
|
41
42
|
margin: 0;
|
|
42
43
|
display: flex;
|
|
43
44
|
align-items: center;
|
|
@@ -47,6 +48,18 @@
|
|
|
47
48
|
margin: 0;
|
|
48
49
|
}
|
|
49
50
|
}
|
|
51
|
+
.newspack-autocomplete-tokenfield,
|
|
52
|
+
.newspack-settings__min-max {
|
|
53
|
+
width: 100%;
|
|
54
|
+
}
|
|
55
|
+
.newspack-autocomplete-tokenfield {
|
|
56
|
+
display: block;
|
|
57
|
+
margin: 0;
|
|
58
|
+
|
|
59
|
+
label:empty {
|
|
60
|
+
display: none;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
50
63
|
.newspack-text-control,
|
|
51
64
|
.newspack-checkbox-control {
|
|
52
65
|
margin: 0 !important;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Icon, chevronUp, chevronDown, trash } from '@wordpress/icons';
|
|
5
|
+
import { Notice } from '@wordpress/components';
|
|
6
|
+
import { __ as alias__ } from '@wordpress/i18n';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
const __ = alias__;
|
|
12
|
+
import ActionCard from '../action-card';
|
|
13
|
+
import Button from '../button';
|
|
14
|
+
import './style.scss';
|
|
15
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
16
|
+
export default function SortableNewsletterListControl({
|
|
17
|
+
lists,
|
|
18
|
+
selected = [],
|
|
19
|
+
onChange = () => {}
|
|
20
|
+
}) {
|
|
21
|
+
if (!Array.isArray(lists) && lists.errors) {
|
|
22
|
+
return _jsx(Notice, {
|
|
23
|
+
status: "error",
|
|
24
|
+
isDismissible: false,
|
|
25
|
+
children: Object.values(lists.errors).join(', ')
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
const getList = id => lists.find(list => list.id === id);
|
|
29
|
+
const getAvailableLists = () => {
|
|
30
|
+
return lists.filter(list => list.active && !selected.find(({
|
|
31
|
+
id
|
|
32
|
+
}) => id === list.id));
|
|
33
|
+
};
|
|
34
|
+
return _jsxs("div", {
|
|
35
|
+
className: "newspack__newsletter-list-control",
|
|
36
|
+
children: [_jsx("div", {
|
|
37
|
+
className: "newspack__newsletter-list-control__selected",
|
|
38
|
+
children: selected.map(selectedList => {
|
|
39
|
+
const list = getList(selectedList.id);
|
|
40
|
+
if (!list) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return _jsx(ActionCard, {
|
|
44
|
+
title: list.name,
|
|
45
|
+
description: () => _jsxs(_Fragment, {
|
|
46
|
+
children: [_jsx("input", {
|
|
47
|
+
type: "checkbox",
|
|
48
|
+
checked: selectedList.checked,
|
|
49
|
+
onChange: () => {
|
|
50
|
+
const index = selected.findIndex(({
|
|
51
|
+
id
|
|
52
|
+
}) => id === selectedList.id);
|
|
53
|
+
const newSelected = [...selected];
|
|
54
|
+
newSelected[index].checked = !newSelected[index].checked;
|
|
55
|
+
onChange(newSelected);
|
|
56
|
+
}
|
|
57
|
+
}), __('Checked by default', 'newspack-plugin')]
|
|
58
|
+
}),
|
|
59
|
+
isSmall: true,
|
|
60
|
+
actionText: _jsx(_Fragment, {
|
|
61
|
+
children: _jsx(Button, {
|
|
62
|
+
onClick: () => onChange(selected.filter(({
|
|
63
|
+
id
|
|
64
|
+
}) => id !== selectedList.id)),
|
|
65
|
+
label: __('Remove', 'newspack-plugin'),
|
|
66
|
+
icon: trash
|
|
67
|
+
})
|
|
68
|
+
}),
|
|
69
|
+
children: selected.length > 1 && _jsxs("span", {
|
|
70
|
+
className: "newspack__newsletter-list-control__sort-handle",
|
|
71
|
+
children: [_jsx("button", {
|
|
72
|
+
onClick: () => {
|
|
73
|
+
const index = selected.findIndex(({
|
|
74
|
+
id
|
|
75
|
+
}) => id === selectedList.id);
|
|
76
|
+
if (index === 0) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const newSelected = [...selected];
|
|
80
|
+
newSelected.splice(index, 1);
|
|
81
|
+
newSelected.splice(index - 1, 0, selectedList);
|
|
82
|
+
onChange(newSelected);
|
|
83
|
+
},
|
|
84
|
+
className: selected.findIndex(({
|
|
85
|
+
id
|
|
86
|
+
}) => id === selectedList.id) === 0 ? 'disabled' : '',
|
|
87
|
+
children: _jsx(Icon, {
|
|
88
|
+
icon: chevronUp
|
|
89
|
+
})
|
|
90
|
+
}), _jsx("button", {
|
|
91
|
+
onClick: () => {
|
|
92
|
+
const index = selected.findIndex(({
|
|
93
|
+
id
|
|
94
|
+
}) => id === selectedList.id);
|
|
95
|
+
const newSelected = [...selected];
|
|
96
|
+
newSelected.splice(index, 1);
|
|
97
|
+
newSelected.splice(index + 1, 0, selectedList);
|
|
98
|
+
onChange(newSelected);
|
|
99
|
+
},
|
|
100
|
+
className: selected.findIndex(({
|
|
101
|
+
id
|
|
102
|
+
}) => id === selectedList.id) === selected.length - 1 ? 'disabled' : '',
|
|
103
|
+
children: _jsx(Icon, {
|
|
104
|
+
icon: chevronDown
|
|
105
|
+
})
|
|
106
|
+
})]
|
|
107
|
+
})
|
|
108
|
+
}, `selected-${selectedList.id}`);
|
|
109
|
+
})
|
|
110
|
+
}), getAvailableLists().length > 0 && _jsxs("p", {
|
|
111
|
+
className: "newspack__newsletter-list-control__lists",
|
|
112
|
+
children: [selected.length > 0 ? _jsx("strong", {
|
|
113
|
+
children: __('Add more lists:', 'newspack-plugin')
|
|
114
|
+
}) : _jsx("strong", {
|
|
115
|
+
children: __('Select lists:', 'newspack-plugin')
|
|
116
|
+
}), ' ', getAvailableLists().map(list => {
|
|
117
|
+
return _jsx(Button, {
|
|
118
|
+
variant: "secondary",
|
|
119
|
+
onClick: () => onChange([...selected, {
|
|
120
|
+
id: list.id,
|
|
121
|
+
checked: true
|
|
122
|
+
}]),
|
|
123
|
+
children: list.name
|
|
124
|
+
}, list.id);
|
|
125
|
+
})]
|
|
126
|
+
})]
|
|
127
|
+
});
|
|
128
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.newspack__newsletter-list-control {
|
|
2
|
+
&__selected {
|
|
3
|
+
.newspack-card {
|
|
4
|
+
display: flex;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
min-height: 40px;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
.newspack-action-card__region {
|
|
9
|
+
align-items: center;
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
.newspack-action-card__region-top {
|
|
15
|
+
flex: 1;
|
|
16
|
+
order: 2;
|
|
17
|
+
}
|
|
18
|
+
.newspack-action-card__region-children {
|
|
19
|
+
padding: 12px;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
&__sort-handle {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
align-items: center;
|
|
28
|
+
button {
|
|
29
|
+
background: transparent;
|
|
30
|
+
border: none;
|
|
31
|
+
margin: 0;
|
|
32
|
+
padding: 0;
|
|
33
|
+
height: 20px;
|
|
34
|
+
&.disabled {
|
|
35
|
+
cursor: default;
|
|
36
|
+
opacity: 0.3;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
&__lists {
|
|
41
|
+
button {
|
|
42
|
+
margin-right: 0.5rem;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -16,8 +16,7 @@ import './style.scss';
|
|
|
16
16
|
* External dependencies.
|
|
17
17
|
*/
|
|
18
18
|
import classnames from 'classnames';
|
|
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 StepsListItem extends Component {
|
|
22
21
|
/**
|
|
23
22
|
* Render
|
|
@@ -20,8 +20,7 @@ import './style.scss';
|
|
|
20
20
|
* External dependencies
|
|
21
21
|
*/
|
|
22
22
|
import classnames from 'classnames';
|
|
23
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
24
|
-
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
25
24
|
class StyleCard extends Component {
|
|
26
25
|
/**
|
|
27
26
|
* Render.
|
|
@@ -48,21 +47,21 @@ class StyleCard extends Component {
|
|
|
48
47
|
dangerouslySetInnerHTML: image
|
|
49
48
|
}) : _jsx("img", {
|
|
50
49
|
src: image,
|
|
51
|
-
alt: cardTitle + ' ' + __('Thumbnail', 'newspack')
|
|
50
|
+
alt: cardTitle + ' ' + __('Thumbnail', 'newspack-plugin')
|
|
52
51
|
}), _jsxs("div", {
|
|
53
52
|
className: "newspack-style-card__actions",
|
|
54
53
|
children: [isActive ? _jsx("span", {
|
|
55
54
|
className: "newspack-style-card__actions__badge",
|
|
56
|
-
children: __('Selected', 'newspack')
|
|
55
|
+
children: __('Selected', 'newspack-plugin')
|
|
57
56
|
}) : _jsx(Button, {
|
|
58
57
|
variant: "link",
|
|
59
58
|
onClick: onClick,
|
|
60
|
-
"aria-label": ariaLabel ? ariaLabel : __('Select', 'newspack') + ' ' + cardTitle,
|
|
59
|
+
"aria-label": ariaLabel ? ariaLabel : __('Select', 'newspack-plugin') + ' ' + cardTitle,
|
|
61
60
|
tabIndex: "0",
|
|
62
|
-
children: __('Select', 'newspack')
|
|
61
|
+
children: __('Select', 'newspack-plugin')
|
|
63
62
|
}), url && _jsx(WebPreview, {
|
|
64
63
|
url: url,
|
|
65
|
-
label: __('View Demo', 'newspack'),
|
|
64
|
+
label: __('View Demo', 'newspack-plugin'),
|
|
66
65
|
variant: "link"
|
|
67
66
|
})]
|
|
68
67
|
})]
|
package/dist/esm/style.scss
CHANGED
|
@@ -15,8 +15,20 @@
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
//
|
|
18
|
+
// Checkboxes
|
|
19
|
+
.newspack-checkbox-control {
|
|
20
|
+
margin-top: 0 !important;
|
|
21
|
+
.components-checkbox-control__label {
|
|
22
|
+
font-weight: 600;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.components-base-control__help {
|
|
26
|
+
margin-left: 32px;
|
|
27
|
+
margin-top: 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
19
30
|
|
|
31
|
+
// Checkbox Icon
|
|
20
32
|
.newspack-checkbox-icon {
|
|
21
33
|
background: white;
|
|
22
34
|
border-radius: 50%;
|
|
@@ -9,19 +9,17 @@ import Router from '../proxied-imports/router';
|
|
|
9
9
|
* Internal dependencies.
|
|
10
10
|
*/
|
|
11
11
|
import './style.scss';
|
|
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 {
|
|
15
14
|
NavLink,
|
|
16
15
|
useHistory
|
|
17
16
|
} = Router;
|
|
18
|
-
const TabbedNavigation =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} = _ref;
|
|
17
|
+
const TabbedNavigation = ({
|
|
18
|
+
items,
|
|
19
|
+
className,
|
|
20
|
+
disableUpcoming,
|
|
21
|
+
children = null
|
|
22
|
+
}) => {
|
|
25
23
|
const displayedItems = items.filter(item => !item.isHiddenInTabbedNavigation);
|
|
26
24
|
const {
|
|
27
25
|
location
|
|
@@ -33,14 +31,13 @@ const TabbedNavigation = _ref => {
|
|
|
33
31
|
children: displayedItems.map((item, index) => _jsx("li", {
|
|
34
32
|
children: _jsx(NavLink, {
|
|
35
33
|
to: item.path,
|
|
36
|
-
isActive: (match,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} = _ref2;
|
|
34
|
+
isActive: (match, {
|
|
35
|
+
pathname
|
|
36
|
+
}) => {
|
|
40
37
|
if (item.activeTabPaths) {
|
|
41
38
|
return item.activeTabPaths.includes(pathname);
|
|
42
39
|
}
|
|
43
|
-
return
|
|
40
|
+
return pathname === item.path;
|
|
44
41
|
},
|
|
45
42
|
exact: true,
|
|
46
43
|
activeClassName: 'selected',
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* WordPress dependencies
|
|
7
7
|
*/
|
|
8
8
|
import { TextControl as BaseComponent } from '@wordpress/components';
|
|
9
|
-
import {
|
|
9
|
+
import { useEffect, useRef } from '@wordpress/element';
|
|
10
10
|
import { __ as alias__ } from '@wordpress/i18n';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -20,47 +20,38 @@ import './style.scss';
|
|
|
20
20
|
*/
|
|
21
21
|
import classNames from 'classnames';
|
|
22
22
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
const TextControl = ({
|
|
24
|
+
className = '',
|
|
25
|
+
required = false,
|
|
26
|
+
isWide = false,
|
|
27
|
+
withMargin = true,
|
|
28
|
+
...otherProps
|
|
29
|
+
}) => {
|
|
30
|
+
const wrapperRef = useRef(null);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (wrapperRef.current === null) {
|
|
33
|
+
return;
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
'newspack-text-control--wide': isWide
|
|
49
|
-
}, {
|
|
50
|
-
'newspack-text-control--with-margin': withMargin
|
|
51
|
-
}, className);
|
|
52
|
-
return required ? _jsx("div", {
|
|
53
|
-
ref: this.wrapperRef,
|
|
54
|
-
className: "newspack-text-control--required",
|
|
55
|
-
children: _jsx(BaseComponent, {
|
|
56
|
-
className: classes,
|
|
57
|
-
required: required,
|
|
58
|
-
...otherProps
|
|
59
|
-
})
|
|
60
|
-
}) : _jsx(BaseComponent, {
|
|
35
|
+
const labelEl = wrapperRef.current.querySelector('label');
|
|
36
|
+
if (labelEl) {
|
|
37
|
+
labelEl.setAttribute('data-required-text', __('(required)', 'newspack-plugin'));
|
|
38
|
+
}
|
|
39
|
+
}, [wrapperRef.current]);
|
|
40
|
+
const classes = classNames('newspack-text-control', {
|
|
41
|
+
'newspack-text-control--wide': isWide,
|
|
42
|
+
'newspack-text-control--with-margin': withMargin
|
|
43
|
+
}, className);
|
|
44
|
+
return required ? _jsx("div", {
|
|
45
|
+
ref: wrapperRef,
|
|
46
|
+
className: "newspack-text-control--required",
|
|
47
|
+
children: _jsx(BaseComponent, {
|
|
61
48
|
className: classes,
|
|
49
|
+
required: required,
|
|
62
50
|
...otherProps
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
|
|
51
|
+
})
|
|
52
|
+
}) : _jsx(BaseComponent, {
|
|
53
|
+
className: classes,
|
|
54
|
+
...otherProps
|
|
55
|
+
});
|
|
56
|
+
};
|
|
66
57
|
export default TextControl;
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -3,22 +3,19 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { ENTER } from '@wordpress/keycodes';
|
|
5
5
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
6
|
-
const InteractiveDiv =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
style
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
...props
|
|
20
|
-
});
|
|
21
|
-
};
|
|
6
|
+
const InteractiveDiv = ({
|
|
7
|
+
style = {},
|
|
8
|
+
...props
|
|
9
|
+
}) => _jsx("div", {
|
|
10
|
+
tabIndex: "0",
|
|
11
|
+
role: "button",
|
|
12
|
+
onKeyDown: event => ENTER === event.keyCode && props.onClick(),
|
|
13
|
+
style: {
|
|
14
|
+
cursor: 'pointer',
|
|
15
|
+
...style
|
|
16
|
+
},
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
22
19
|
const confirmAction = message => {
|
|
23
20
|
// eslint-disable-next-line no-alert
|
|
24
21
|
if (confirm(message)) {
|
|
@@ -18,8 +18,7 @@ import './style.scss';
|
|
|
18
18
|
* External dependencies.
|
|
19
19
|
*/
|
|
20
20
|
import classnames from 'classnames';
|
|
21
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
22
|
-
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
23
22
|
const PORTAL_PARENT_ID = 'newspack-components-web-preview-wrapper';
|
|
24
23
|
|
|
25
24
|
/**
|
|
@@ -67,21 +66,21 @@ class WebPreview extends Component {
|
|
|
67
66
|
}),
|
|
68
67
|
variant: 'desktop' === device && 'primary',
|
|
69
68
|
icon: desktop,
|
|
70
|
-
label: __('Preview Desktop Size', 'newspack')
|
|
69
|
+
label: __('Preview Desktop Size', 'newspack-plugin')
|
|
71
70
|
}), _jsx(Button, {
|
|
72
71
|
onClick: () => this.setState({
|
|
73
72
|
device: 'tablet'
|
|
74
73
|
}),
|
|
75
74
|
variant: 'tablet' === device && 'primary',
|
|
76
75
|
icon: tablet,
|
|
77
|
-
label: __('Preview Tablet Size', 'newspack')
|
|
76
|
+
label: __('Preview Tablet Size', 'newspack-plugin')
|
|
78
77
|
}), _jsx(Button, {
|
|
79
78
|
onClick: () => this.setState({
|
|
80
79
|
device: 'phone'
|
|
81
80
|
}),
|
|
82
81
|
variant: 'phone' === device && 'primary',
|
|
83
82
|
icon: mobile,
|
|
84
|
-
label: __('Preview Phone Size', 'newspack')
|
|
83
|
+
label: __('Preview Phone Size', 'newspack-plugin')
|
|
85
84
|
})]
|
|
86
85
|
})
|
|
87
86
|
}), _jsx("div", {
|
|
@@ -95,7 +94,7 @@ class WebPreview extends Component {
|
|
|
95
94
|
});
|
|
96
95
|
},
|
|
97
96
|
icon: closeSmall,
|
|
98
|
-
label: __('Close Preview', 'newspack')
|
|
97
|
+
label: __('Close Preview', 'newspack-plugin')
|
|
99
98
|
})
|
|
100
99
|
})]
|
|
101
100
|
}), _jsxs("div", {
|
|
@@ -104,7 +103,7 @@ class WebPreview extends Component {
|
|
|
104
103
|
className: "newspack-web-preview__is-waiting",
|
|
105
104
|
children: [_jsx(Waiting, {
|
|
106
105
|
isLeft: true
|
|
107
|
-
}), __('Loading…', 'newspack')]
|
|
106
|
+
}), __('Loading…', 'newspack-plugin')]
|
|
108
107
|
}), _jsx("iframe", {
|
|
109
108
|
ref: this.iframeRef,
|
|
110
109
|
title: "web-preview",
|
|
@@ -178,7 +177,7 @@ class WebPreview extends Component {
|
|
|
178
177
|
}
|
|
179
178
|
WebPreview.defaultProps = {
|
|
180
179
|
url: '//newspack.com',
|
|
181
|
-
label: __('Preview', 'newspack'),
|
|
180
|
+
label: __('Preview', 'newspack-plugin'),
|
|
182
181
|
onLoad: () => {}
|
|
183
182
|
};
|
|
184
183
|
export default WebPreview;
|
|
@@ -15,8 +15,7 @@ import { Button, Card, Modal, NewspackIcon, Notice, PluginInstaller } from '../'
|
|
|
15
15
|
import Router from '../proxied-imports/router';
|
|
16
16
|
import Footer from '../footer';
|
|
17
17
|
import './style.scss';
|
|
18
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
19
|
-
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
20
19
|
const {
|
|
21
20
|
Redirect,
|
|
22
21
|
Route
|
|
@@ -115,7 +114,7 @@ export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
115
114
|
children: _jsx(Button, {
|
|
116
115
|
isPrimary: true,
|
|
117
116
|
href: fallbackURL,
|
|
118
|
-
children: __('Return to Dashboard', 'newspack')
|
|
117
|
+
children: __('Return to Dashboard', 'newspack-plugin')
|
|
119
118
|
})
|
|
120
119
|
})]
|
|
121
120
|
});
|
|
@@ -146,10 +145,9 @@ export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
146
145
|
/**
|
|
147
146
|
* Called when plugin installation is complete. Updates state and calls onWizardReady on the wrapped component.
|
|
148
147
|
*/
|
|
149
|
-
_defineProperty(this, "pluginInstallationStatus",
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
} = _ref;
|
|
148
|
+
_defineProperty(this, "pluginInstallationStatus", ({
|
|
149
|
+
complete
|
|
150
|
+
}) => {
|
|
153
151
|
if (this.state.loading) {
|
|
154
152
|
this.doneLoading();
|
|
155
153
|
}
|
|
@@ -235,7 +233,7 @@ export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
235
233
|
children: [_jsx(Button, {
|
|
236
234
|
isLink: true,
|
|
237
235
|
href: newspack_urls.dashboard,
|
|
238
|
-
label: __('Return to Dashboard', 'newspack'),
|
|
236
|
+
label: __('Return to Dashboard', 'newspack-plugin'),
|
|
239
237
|
showTooltip: true,
|
|
240
238
|
icon: home,
|
|
241
239
|
iconSize: 36,
|
|
@@ -244,7 +242,7 @@ export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
244
242
|
})
|
|
245
243
|
}), _jsx("div", {
|
|
246
244
|
children: _jsx("h2", {
|
|
247
|
-
children: requiredPlugins.length > 1 ? __('Required plugins', 'newspack') : __('Required plugin', 'newspack')
|
|
245
|
+
children: requiredPlugins.length > 1 ? __('Required plugins', 'newspack-plugin') : __('Required plugin', 'newspack-plugin')
|
|
248
246
|
})
|
|
249
247
|
})]
|
|
250
248
|
})
|
|
@@ -20,13 +20,10 @@ import classnames from 'classnames';
|
|
|
20
20
|
/**
|
|
21
21
|
* Higher-Order Component to provide plugin management and error handling to Newspack Wizards.
|
|
22
22
|
*/
|
|
23
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
let {
|
|
28
|
-
hidePrimaryButton
|
|
29
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
24
|
+
export default function withWizardScreen(WrappedComponent, {
|
|
25
|
+
hidePrimaryButton
|
|
26
|
+
} = {}) {
|
|
30
27
|
const WrappedWithWizardScreen = props => {
|
|
31
28
|
const {
|
|
32
29
|
className,
|
|
@@ -46,25 +43,22 @@ export default function withWizardScreen(WrappedComponent) {
|
|
|
46
43
|
const SecondaryCTAComponent = retrievedSecondaryButtonProps.plugin ? Handoff : Button;
|
|
47
44
|
const shouldRenderPrimaryButton = buttonText && buttonAction;
|
|
48
45
|
const shouldRenderSecondaryButton = secondaryButtonText && secondaryButtonAction;
|
|
49
|
-
const renderPrimaryButton =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
...overridingProps
|
|
66
|
-
});
|
|
67
|
-
};
|
|
46
|
+
const renderPrimaryButton = (overridingProps = {}) => retrievedButtonProps.plugin ? _jsx(Handoff, {
|
|
47
|
+
isPrimary: true,
|
|
48
|
+
...retrievedButtonProps,
|
|
49
|
+
...overridingProps,
|
|
50
|
+
children: buttonText
|
|
51
|
+
}) : _jsx(Button, {
|
|
52
|
+
isPrimary: !buttonDisabled,
|
|
53
|
+
isSecondary: !!buttonDisabled,
|
|
54
|
+
disabled: buttonDisabled
|
|
55
|
+
// Allow overridingProps to set children.
|
|
56
|
+
// eslint-disable-next-line react/no-children-prop
|
|
57
|
+
,
|
|
58
|
+
children: buttonText,
|
|
59
|
+
...retrievedButtonProps,
|
|
60
|
+
...overridingProps
|
|
61
|
+
});
|
|
68
62
|
return _jsxs(_Fragment, {
|
|
69
63
|
children: [newspack_aux_data.is_debug_mode && _jsx(Notice, {
|
|
70
64
|
debugMode: true
|
|
@@ -77,7 +71,7 @@ export default function withWizardScreen(WrappedComponent) {
|
|
|
77
71
|
children: [_jsx(Button, {
|
|
78
72
|
isLink: true,
|
|
79
73
|
href: newspack_urls.dashboard,
|
|
80
|
-
label: __('Return to Dashboard', 'newspack'),
|
|
74
|
+
label: __('Return to Dashboard', 'newspack-plugin'),
|
|
81
75
|
showTooltip: true,
|
|
82
76
|
icon: category,
|
|
83
77
|
iconSize: 36,
|
|
@@ -10,14 +10,12 @@ import { useSelect } from '@wordpress/data';
|
|
|
10
10
|
*/
|
|
11
11
|
import { Button, Card, Modal, Notice } from '../..';
|
|
12
12
|
import { WIZARD_STORE_NAMESPACE } from '../store';
|
|
13
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
code
|
|
20
|
-
} = _ref;
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
14
|
+
const parseError = ({
|
|
15
|
+
data,
|
|
16
|
+
message,
|
|
17
|
+
code
|
|
18
|
+
}) => {
|
|
21
19
|
let level = 'fatal';
|
|
22
20
|
if (!!data && 'level' in data) {
|
|
23
21
|
level = data.level;
|
|
@@ -54,7 +52,7 @@ const WizardError = () => {
|
|
|
54
52
|
children: _jsx(Button, {
|
|
55
53
|
isPrimary: true,
|
|
56
54
|
href: fallbackURL,
|
|
57
|
-
children: __('Return to Dashboard', 'newspack')
|
|
55
|
+
children: __('Return to Dashboard', 'newspack-plugin')
|
|
58
56
|
})
|
|
59
57
|
})]
|
|
60
58
|
});
|