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
package/src/style-card/index.js
CHANGED
|
@@ -38,25 +38,31 @@ class StyleCard extends Component {
|
|
|
38
38
|
{ imageType === 'html' ? (
|
|
39
39
|
<div dangerouslySetInnerHTML={ image } />
|
|
40
40
|
) : (
|
|
41
|
-
<img src={ image } alt={ cardTitle + ' ' + __( 'Thumbnail', 'newspack' ) } />
|
|
41
|
+
<img src={ image } alt={ cardTitle + ' ' + __( 'Thumbnail', 'newspack-plugin' ) } />
|
|
42
42
|
) }
|
|
43
43
|
<div className="newspack-style-card__actions">
|
|
44
44
|
{ isActive ? (
|
|
45
45
|
<span className="newspack-style-card__actions__badge">
|
|
46
|
-
{ __( 'Selected', 'newspack' ) }
|
|
46
|
+
{ __( 'Selected', 'newspack-plugin' ) }
|
|
47
47
|
</span>
|
|
48
48
|
) : (
|
|
49
49
|
<Button
|
|
50
50
|
variant="link"
|
|
51
51
|
onClick={ onClick }
|
|
52
|
-
aria-label={
|
|
52
|
+
aria-label={
|
|
53
|
+
ariaLabel ? ariaLabel : __( 'Select', 'newspack-plugin' ) + ' ' + cardTitle
|
|
54
|
+
}
|
|
53
55
|
tabIndex="0"
|
|
54
56
|
>
|
|
55
|
-
{ __( 'Select', 'newspack' ) }
|
|
57
|
+
{ __( 'Select', 'newspack-plugin' ) }
|
|
56
58
|
</Button>
|
|
57
59
|
) }
|
|
58
60
|
{ url && (
|
|
59
|
-
<WebPreview
|
|
61
|
+
<WebPreview
|
|
62
|
+
url={ url }
|
|
63
|
+
label={ __( 'View Demo', 'newspack-plugin' ) }
|
|
64
|
+
variant="link"
|
|
65
|
+
/>
|
|
60
66
|
) }
|
|
61
67
|
</div>
|
|
62
68
|
</div>
|
package/src/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%;
|
|
@@ -27,7 +27,7 @@ const TabbedNavigation = ( { items, className, disableUpcoming, children = null
|
|
|
27
27
|
if ( item.activeTabPaths ) {
|
|
28
28
|
return item.activeTabPaths.includes( pathname );
|
|
29
29
|
}
|
|
30
|
-
return
|
|
30
|
+
return pathname === item.path;
|
|
31
31
|
} }
|
|
32
32
|
exact
|
|
33
33
|
activeClassName={ 'selected' }
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text Control
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* WordPress dependencies
|
|
7
|
+
*/
|
|
8
|
+
import { TextControl as BaseComponent } from '@wordpress/components';
|
|
9
|
+
import { useEffect, useRef } from '@wordpress/element';
|
|
10
|
+
import { __ } from '@wordpress/i18n';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import './style.scss';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* External dependencies
|
|
19
|
+
*/
|
|
20
|
+
import classNames from 'classnames';
|
|
21
|
+
|
|
22
|
+
type BaseComponentProps = {
|
|
23
|
+
onChange: ( value: string ) => void;
|
|
24
|
+
value: string | number;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const TextControl = ( {
|
|
28
|
+
className = '',
|
|
29
|
+
required = false,
|
|
30
|
+
isWide = false,
|
|
31
|
+
withMargin = true,
|
|
32
|
+
...otherProps
|
|
33
|
+
} ) => {
|
|
34
|
+
const wrapperRef = useRef< HTMLDivElement >( null );
|
|
35
|
+
useEffect( () => {
|
|
36
|
+
if ( wrapperRef.current === null ) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const labelEl = wrapperRef.current.querySelector( 'label' );
|
|
40
|
+
if ( labelEl ) {
|
|
41
|
+
labelEl.setAttribute( 'data-required-text', __( '(required)', 'newspack-plugin' ) );
|
|
42
|
+
}
|
|
43
|
+
}, [ wrapperRef.current ] );
|
|
44
|
+
const classes = classNames(
|
|
45
|
+
'newspack-text-control',
|
|
46
|
+
{
|
|
47
|
+
'newspack-text-control--wide': isWide,
|
|
48
|
+
'newspack-text-control--with-margin': withMargin,
|
|
49
|
+
},
|
|
50
|
+
className
|
|
51
|
+
);
|
|
52
|
+
return required ? (
|
|
53
|
+
<div ref={ wrapperRef } className="newspack-text-control--required">
|
|
54
|
+
<BaseComponent
|
|
55
|
+
className={ classes }
|
|
56
|
+
required={ required }
|
|
57
|
+
{ ...( otherProps as BaseComponentProps ) }
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
) : (
|
|
61
|
+
<BaseComponent className={ classes } { ...( otherProps as BaseComponentProps ) } />
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default TextControl;
|
package/src/web-preview/index.js
CHANGED
|
@@ -81,19 +81,19 @@ class WebPreview extends Component {
|
|
|
81
81
|
onClick={ () => this.setState( { device: 'desktop' } ) }
|
|
82
82
|
variant={ 'desktop' === device && 'primary' }
|
|
83
83
|
icon={ desktop }
|
|
84
|
-
label={ __( 'Preview Desktop Size', 'newspack' ) }
|
|
84
|
+
label={ __( 'Preview Desktop Size', 'newspack-plugin' ) }
|
|
85
85
|
/>
|
|
86
86
|
<Button
|
|
87
87
|
onClick={ () => this.setState( { device: 'tablet' } ) }
|
|
88
88
|
variant={ 'tablet' === device && 'primary' }
|
|
89
89
|
icon={ tablet }
|
|
90
|
-
label={ __( 'Preview Tablet Size', 'newspack' ) }
|
|
90
|
+
label={ __( 'Preview Tablet Size', 'newspack-plugin' ) }
|
|
91
91
|
/>
|
|
92
92
|
<Button
|
|
93
93
|
onClick={ () => this.setState( { device: 'phone' } ) }
|
|
94
94
|
variant={ 'phone' === device && 'primary' }
|
|
95
95
|
icon={ mobile }
|
|
96
|
-
label={ __( 'Preview Phone Size', 'newspack' ) }
|
|
96
|
+
label={ __( 'Preview Phone Size', 'newspack-plugin' ) }
|
|
97
97
|
/>
|
|
98
98
|
</ButtonGroup>
|
|
99
99
|
</div>
|
|
@@ -104,7 +104,7 @@ class WebPreview extends Component {
|
|
|
104
104
|
this.setState( { isPreviewVisible: false, loaded: false } );
|
|
105
105
|
} }
|
|
106
106
|
icon={ closeSmall }
|
|
107
|
-
label={ __( 'Close Preview', 'newspack' ) }
|
|
107
|
+
label={ __( 'Close Preview', 'newspack-plugin' ) }
|
|
108
108
|
/>
|
|
109
109
|
</div>
|
|
110
110
|
</div>
|
|
@@ -112,7 +112,7 @@ class WebPreview extends Component {
|
|
|
112
112
|
{ ! loaded && (
|
|
113
113
|
<div className="newspack-web-preview__is-waiting">
|
|
114
114
|
<Waiting isLeft />
|
|
115
|
-
{ __( 'Loading…', 'newspack' ) }
|
|
115
|
+
{ __( 'Loading…', 'newspack-plugin' ) }
|
|
116
116
|
</div>
|
|
117
117
|
) }
|
|
118
118
|
<iframe
|
|
@@ -166,7 +166,7 @@ class WebPreview extends Component {
|
|
|
166
166
|
|
|
167
167
|
WebPreview.defaultProps = {
|
|
168
168
|
url: '//newspack.com',
|
|
169
|
-
label: __( 'Preview', 'newspack' ),
|
|
169
|
+
label: __( 'Preview', 'newspack-plugin' ),
|
|
170
170
|
onLoad: () => {},
|
|
171
171
|
};
|
|
172
172
|
|
package/src/with-wizard/index.js
CHANGED
|
@@ -105,7 +105,7 @@ export default function withWizard( WrappedComponent, requiredPlugins ) {
|
|
|
105
105
|
<Notice noticeText={ message } isError rawHTML />
|
|
106
106
|
<Card buttonsCard noBorder className="justify-end">
|
|
107
107
|
<Button isPrimary href={ fallbackURL }>
|
|
108
|
-
{ __( 'Return to Dashboard', 'newspack' ) }
|
|
108
|
+
{ __( 'Return to Dashboard', 'newspack-plugin' ) }
|
|
109
109
|
</Button>
|
|
110
110
|
</Card>
|
|
111
111
|
</Modal>
|
|
@@ -219,7 +219,7 @@ export default function withWizard( WrappedComponent, requiredPlugins ) {
|
|
|
219
219
|
<Button
|
|
220
220
|
isLink
|
|
221
221
|
href={ newspack_urls.dashboard }
|
|
222
|
-
label={ __( 'Return to Dashboard', 'newspack' ) }
|
|
222
|
+
label={ __( 'Return to Dashboard', 'newspack-plugin' ) }
|
|
223
223
|
showTooltip={ true }
|
|
224
224
|
icon={ home }
|
|
225
225
|
iconSize={ 36 }
|
|
@@ -229,8 +229,8 @@ export default function withWizard( WrappedComponent, requiredPlugins ) {
|
|
|
229
229
|
<div>
|
|
230
230
|
<h2>
|
|
231
231
|
{ requiredPlugins.length > 1
|
|
232
|
-
? __( 'Required plugins', 'newspack' )
|
|
233
|
-
: __( 'Required plugin', 'newspack' ) }
|
|
232
|
+
? __( 'Required plugins', 'newspack-plugin' )
|
|
233
|
+
: __( 'Required plugin', 'newspack-plugin' ) }
|
|
234
234
|
</h2>
|
|
235
235
|
</div>
|
|
236
236
|
</div>
|
|
@@ -66,7 +66,7 @@ export default function withWizardScreen( WrappedComponent, { hidePrimaryButton
|
|
|
66
66
|
<Button
|
|
67
67
|
isLink
|
|
68
68
|
href={ newspack_urls.dashboard }
|
|
69
|
-
label={ __( 'Return to Dashboard', 'newspack' ) }
|
|
69
|
+
label={ __( 'Return to Dashboard', 'newspack-plugin' ) }
|
|
70
70
|
showTooltip={ true }
|
|
71
71
|
icon={ category }
|
|
72
72
|
iconSize={ 36 }
|
|
@@ -41,7 +41,7 @@ const WizardError = () => {
|
|
|
41
41
|
{ fallbackURL && (
|
|
42
42
|
<Card buttonsCard noBorder className="justify-end">
|
|
43
43
|
<Button isPrimary href={ fallbackURL }>
|
|
44
|
-
{ __( 'Return to Dashboard', 'newspack' ) }
|
|
44
|
+
{ __( 'Return to Dashboard', 'newspack-plugin' ) }
|
|
45
45
|
</Button>
|
|
46
46
|
</Card>
|
|
47
47
|
) }
|
package/src/wizard/index.js
CHANGED
|
@@ -57,8 +57,8 @@ const Wizard = ( {
|
|
|
57
57
|
if ( ! pluginRequirementsSatisfied ) {
|
|
58
58
|
headerText =
|
|
59
59
|
requiredPlugins.length > 1
|
|
60
|
-
? __( 'Required plugins', 'newspack' )
|
|
61
|
-
: __( 'Required plugin', 'newspack' );
|
|
60
|
+
? __( 'Required plugins', 'newspack-plugin' )
|
|
61
|
+
: __( 'Required plugin', 'newspack-plugin' );
|
|
62
62
|
displayedSections = [
|
|
63
63
|
{
|
|
64
64
|
path: '/',
|
|
@@ -90,7 +90,7 @@ const Wizard = ( {
|
|
|
90
90
|
<Button
|
|
91
91
|
isLink
|
|
92
92
|
href={ newspack_urls.dashboard }
|
|
93
|
-
label={ __( 'Return to Dashboard', 'newspack' ) }
|
|
93
|
+
label={ __( 'Return to Dashboard', 'newspack-plugin' ) }
|
|
94
94
|
showTooltip={ true }
|
|
95
95
|
icon={ category }
|
|
96
96
|
iconSize={ 36 }
|
|
@@ -59,17 +59,24 @@ const actions = {
|
|
|
59
59
|
setError: createAction( 'SET_ERROR' ),
|
|
60
60
|
|
|
61
61
|
// Async actions. These will not show up in Redux devtools.
|
|
62
|
-
*saveWizardSettings( {
|
|
62
|
+
*saveWizardSettings( {
|
|
63
|
+
slug,
|
|
64
|
+
section = '',
|
|
65
|
+
payloadPath = false,
|
|
66
|
+
auxData = {},
|
|
67
|
+
updatePayload = null,
|
|
68
|
+
} ) {
|
|
63
69
|
// Optionally data can be updated before saving - an immediate update case
|
|
64
70
|
// (without an explicit "save" action).
|
|
65
71
|
if ( updatePayload ) {
|
|
66
72
|
yield actions.updateWizardSettings( { slug, ...updatePayload } );
|
|
67
73
|
}
|
|
68
74
|
const wizardState = select( WIZARD_STORE_NAMESPACE ).getWizardAPIData( slug );
|
|
75
|
+
const data = payloadPath ? get( wizardState, payloadPath ) : wizardState;
|
|
69
76
|
const updatedData = yield actions.fetchFromAPI( {
|
|
70
77
|
path: `/newspack/v1/wizard/${ slug }/${ section }`,
|
|
71
78
|
method: 'POST',
|
|
72
|
-
data:
|
|
79
|
+
data: { ...data, ...auxData },
|
|
73
80
|
isQuietFetch: true,
|
|
74
81
|
} );
|
|
75
82
|
if ( ! isEmpty( updatedData ) && ! updatedData.error ) {
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
var _icons = require("@wordpress/icons");
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
require("./style.scss");
|
|
12
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
13
|
-
/**
|
|
14
|
-
* WordPress dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* External dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Internal dependencies
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
const Accordion = _ref => {
|
|
26
|
-
let {
|
|
27
|
-
children,
|
|
28
|
-
title
|
|
29
|
-
} = _ref;
|
|
30
|
-
const [isOpen, setIsOpen] = (0, _element.useState)(false);
|
|
31
|
-
return (0, _jsxRuntime.jsxs)("details", {
|
|
32
|
-
className: (0, _classnames.default)('newspack-accordion', {
|
|
33
|
-
'newspack-accordion--is-open': isOpen
|
|
34
|
-
}),
|
|
35
|
-
children: [(0, _jsxRuntime.jsxs)("summary", {
|
|
36
|
-
onClick: () => setIsOpen(!isOpen),
|
|
37
|
-
children: [title, (0, _jsxRuntime.jsx)(_icons.Icon, {
|
|
38
|
-
className: "newspack-accordion__icon",
|
|
39
|
-
icon: _icons.chevronRight,
|
|
40
|
-
size: 24
|
|
41
|
-
})]
|
|
42
|
-
}), children]
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
var _default = Accordion;
|
|
46
|
-
exports.default = _default;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
@use '~@wordpress/base-styles/colors' as wp-colors;
|
|
2
|
-
|
|
3
|
-
.newspack-accordion {
|
|
4
|
-
border: 1px solid wp-colors.$gray-300;
|
|
5
|
-
|
|
6
|
-
&__icon {
|
|
7
|
-
transition: transform 200ms ease-out;
|
|
8
|
-
transform: rotate( 90deg );
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
&--is-open {
|
|
12
|
-
.newspack-accordion {
|
|
13
|
-
&__icon {
|
|
14
|
-
transform: rotate( -90deg );
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
summary {
|
|
19
|
-
padding: 16px 32px;
|
|
20
|
-
display: flex;
|
|
21
|
-
align-items: center;
|
|
22
|
-
justify-content: space-between;
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
font-size: 14px;
|
|
25
|
-
font-weight: bold;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _components = require("@wordpress/components");
|
|
13
|
-
|
|
14
|
-
require("./style.scss");
|
|
15
|
-
|
|
16
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
-
|
|
18
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* WordPress dependencies.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Internal dependencies
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* External dependencies
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Button Group.
|
|
34
|
-
*/
|
|
35
|
-
class ButtonGroup extends _element.Component {
|
|
36
|
-
/**
|
|
37
|
-
* Render.
|
|
38
|
-
*/
|
|
39
|
-
render() {
|
|
40
|
-
const {
|
|
41
|
-
className,
|
|
42
|
-
noMargin,
|
|
43
|
-
...otherProps
|
|
44
|
-
} = this.props;
|
|
45
|
-
const classes = (0, _classnames.default)('newspack-button-group', {
|
|
46
|
-
'newspack-button-group--no-margin': noMargin
|
|
47
|
-
}, className);
|
|
48
|
-
return (0, _jsxRuntime.jsx)(_components.ButtonGroup, {
|
|
49
|
-
className: classes,
|
|
50
|
-
...otherProps
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
var _default = ButtonGroup;
|
|
57
|
-
exports.default = _default;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Button Group
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
@import '../../../shared/scss/colors';
|
|
6
|
-
@import '~@wordpress/base-styles/colors';
|
|
7
|
-
|
|
8
|
-
.newspack-button-group {
|
|
9
|
-
display: block;
|
|
10
|
-
&:not( .newspack-button-group--no-margin ) {
|
|
11
|
-
margin: 32px 0;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.newspack-button {
|
|
15
|
-
padding: 11px 17px !important;
|
|
16
|
-
&:active,
|
|
17
|
-
&:focus,
|
|
18
|
-
&:hover,
|
|
19
|
-
&.is-pressed {
|
|
20
|
-
position: relative;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
&.is-pressed {
|
|
24
|
-
position: relative;
|
|
25
|
-
z-index: 2;
|
|
26
|
-
background-color: white !important;
|
|
27
|
-
color: $gray-900 !important;
|
|
28
|
-
border: none !important;
|
|
29
|
-
&:focus {
|
|
30
|
-
box-shadow: 0 0 0 1px white, 0 0 0 2px $primary-500 !important;
|
|
31
|
-
}
|
|
32
|
-
&:active,
|
|
33
|
-
&:hover {
|
|
34
|
-
background: $gray-100 !important;
|
|
35
|
-
color: $primary-500 !important;
|
|
36
|
-
}
|
|
37
|
-
&::after {
|
|
38
|
-
content: '';
|
|
39
|
-
position: absolute;
|
|
40
|
-
top: 0;
|
|
41
|
-
left: 0;
|
|
42
|
-
width: calc( 100% - 6px );
|
|
43
|
-
height: calc( 100% - 6px );
|
|
44
|
-
border: 3px solid $primary-500;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
body[class*='admin-color-'] {
|
|
51
|
-
.newspack-button-group {
|
|
52
|
-
.newspack-button {
|
|
53
|
-
border-radius: 0;
|
|
54
|
-
box-shadow: none;
|
|
55
|
-
|
|
56
|
-
&:first-child {
|
|
57
|
-
&,
|
|
58
|
-
&::after {
|
|
59
|
-
border-bottom-left-radius: 3px;
|
|
60
|
-
border-top-left-radius: 3px;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
&:last-child {
|
|
65
|
-
&,
|
|
66
|
-
&::after {
|
|
67
|
-
border-bottom-right-radius: 3px;
|
|
68
|
-
border-top-right-radius: 3px;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _components = require("@wordpress/components");
|
|
13
|
-
|
|
14
|
-
var _ = require("../");
|
|
15
|
-
|
|
16
|
-
require("./style.scss");
|
|
17
|
-
|
|
18
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
|
-
|
|
20
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Checkbox Control
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* WordPress dependencies
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Internal dependencies
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* External dependencies
|
|
36
|
-
*/
|
|
37
|
-
class CheckboxControl extends _element.Component {
|
|
38
|
-
/**
|
|
39
|
-
* Render.
|
|
40
|
-
*/
|
|
41
|
-
render() {
|
|
42
|
-
const {
|
|
43
|
-
className,
|
|
44
|
-
checked,
|
|
45
|
-
tooltip,
|
|
46
|
-
...otherProps
|
|
47
|
-
} = this.props;
|
|
48
|
-
const classes = (0, _classnames.default)('newspack-checkbox-control', className);
|
|
49
|
-
return (0, _jsxRuntime.jsxs)("div", {
|
|
50
|
-
className: classes,
|
|
51
|
-
children: [(0, _jsxRuntime.jsx)(_components.CheckboxControl, {
|
|
52
|
-
checked: Boolean(checked),
|
|
53
|
-
...otherProps
|
|
54
|
-
}), tooltip && (0, _jsxRuntime.jsx)(_.InfoButton, {
|
|
55
|
-
text: tooltip
|
|
56
|
-
})]
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
var _default = CheckboxControl;
|
|
63
|
-
exports.default = _default;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checkbox styles.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
@import '../../../shared/scss/colors';
|
|
6
|
-
@import '~@wordpress/base-styles/colors';
|
|
7
|
-
|
|
8
|
-
.newspack-checkbox-control {
|
|
9
|
-
color: $gray-700;
|
|
10
|
-
display: flex;
|
|
11
|
-
font-size: 14px;
|
|
12
|
-
line-height: 24px;
|
|
13
|
-
margin: 32px 0;
|
|
14
|
-
|
|
15
|
-
label {
|
|
16
|
-
color: inherit;
|
|
17
|
-
font-size: inherit;
|
|
18
|
-
line-height: inherit;
|
|
19
|
-
margin: 0;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.components-checkbox-control__input-container {
|
|
23
|
-
display: block;
|
|
24
|
-
margin: 0;
|
|
25
|
-
margin-right: 8px;
|
|
26
|
-
|
|
27
|
-
@media screen and ( min-width: 600px ) {
|
|
28
|
-
margin-bottom: 2px;
|
|
29
|
-
margin-top: 2px;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.components-checkbox-control__input[type='checkbox'] {
|
|
34
|
-
margin: 0;
|
|
35
|
-
|
|
36
|
-
&:checked {
|
|
37
|
-
background-color: $primary-500;
|
|
38
|
-
border-color: $primary-500;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&:focus {
|
|
42
|
-
border-color: $primary-500;
|
|
43
|
-
box-shadow: 0 0 0 2px white, 0 0 0 3.5px $primary-500;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.components-base-control__help {
|
|
48
|
-
color: inherit;
|
|
49
|
-
font-size: inherit;
|
|
50
|
-
font-style: italic;
|
|
51
|
-
line-height: inherit;
|
|
52
|
-
margin: 0;
|
|
53
|
-
margin-left: 28px;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Multiple Checkbox Controls
|
|
57
|
-
|
|
58
|
-
& + & {
|
|
59
|
-
margin-top: -16px;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Reset
|
|
63
|
-
|
|
64
|
-
.components-base-control {
|
|
65
|
-
font-size: inherit;
|
|
66
|
-
line-height: inherit;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.components-base-control__field {
|
|
70
|
-
display: flex;
|
|
71
|
-
margin: 0;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.components-base-control__label {
|
|
75
|
-
display: block;
|
|
76
|
-
margin: 0;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _reactDaterangePicker = _interopRequireDefault(require("react-daterange-picker"));
|
|
9
|
-
var _moment = _interopRequireDefault(require("moment"));
|
|
10
|
-
var _momentRange = require("moment-range");
|
|
11
|
-
require("react-daterange-picker/dist/css/react-calendar.css");
|
|
12
|
-
require("./style.scss");
|
|
13
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
14
|
-
/**
|
|
15
|
-
* External dependencies.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Internal dependencies.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
const moment = (0, _momentRange.extendMoment)(_moment.default);
|
|
23
|
-
const DateRangePicker = _ref => {
|
|
24
|
-
let {
|
|
25
|
-
start,
|
|
26
|
-
end,
|
|
27
|
-
onChange
|
|
28
|
-
} = _ref;
|
|
29
|
-
return (0, _jsxRuntime.jsx)(_reactDaterangePicker.default, {
|
|
30
|
-
value: moment.range(moment(start), moment(end)),
|
|
31
|
-
firstOfWeek: 1,
|
|
32
|
-
onSelect: range => {
|
|
33
|
-
onChange({
|
|
34
|
-
start: range.start._d,
|
|
35
|
-
end: range.end._d
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
var _default = DateRangePicker;
|
|
41
|
-
exports.default = _default;
|