newspack-components 2.1.0 → 2.2.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/accordion/index.js +46 -0
- package/dist/cjs/accordion/style.scss +27 -0
- package/dist/cjs/action-card/index.js +48 -25
- package/dist/cjs/action-card/style.scss +100 -23
- package/dist/cjs/autocomplete-tokenfield/index.js +13 -41
- package/dist/cjs/autocomplete-tokenfield/style.scss +2 -2
- package/dist/cjs/autocomplete-with-suggestions/index.js +30 -51
- package/dist/cjs/autocomplete-with-suggestions/style.scss +16 -15
- package/dist/cjs/button/index.js +5 -13
- package/dist/cjs/button-card/index.js +1 -10
- package/dist/cjs/button-card/style.scss +13 -13
- package/dist/cjs/card/index.js +1 -8
- package/dist/cjs/card/style.scss +25 -8
- package/dist/cjs/category-autocomplete/index.js +18 -38
- package/dist/cjs/category-autocomplete/style.scss +0 -2
- package/dist/cjs/color-picker/index.js +1 -15
- package/dist/cjs/color-picker/style.scss +0 -3
- package/dist/cjs/consts.js +5 -3
- package/dist/cjs/custom-select-control/index.js +1 -9
- package/dist/cjs/custom-select-control/style.scss +6 -7
- package/dist/cjs/date-range-picker/index.js +1 -10
- package/dist/cjs/date-range-picker/style.scss +12 -12
- package/dist/cjs/footer/index.js +5 -17
- package/dist/cjs/footer/style.scss +5 -5
- package/dist/cjs/form-token-field/index.js +1 -9
- package/dist/cjs/form-token-field/style.scss +2 -3
- package/dist/cjs/global-notices/index.js +1 -8
- package/dist/cjs/grid/index.js +1 -8
- package/dist/cjs/grid/style.scss +5 -5
- package/dist/cjs/handoff/index.js +8 -17
- package/dist/cjs/handoff-message/index.js +50 -0
- package/dist/cjs/hooks/index.js +1 -7
- package/dist/cjs/hooks/useObjectState.js +7 -13
- package/dist/cjs/hooks/useObjectState.test.js +0 -14
- package/dist/cjs/hooks/useOnClickOutside.js +3 -6
- package/dist/cjs/hooks/usePrompt.js +1 -13
- package/dist/cjs/image-upload/index.js +21 -19
- package/dist/cjs/image-upload/index.test.js +0 -5
- package/dist/cjs/image-upload/style.scss +5 -9
- package/dist/cjs/index.js +28 -44
- package/dist/cjs/info-button/index.js +3 -11
- package/dist/cjs/info-button/style.scss +1 -3
- package/dist/cjs/modal/index.js +1 -9
- package/dist/cjs/modal/style.scss +8 -8
- package/dist/cjs/newspack-icon/index.js +1 -9
- package/dist/cjs/newspack-icon/style.scss +4 -4
- package/dist/cjs/newspack-logo/index.js +1 -9
- package/dist/cjs/newspack-logo/style.scss +3 -3
- package/dist/cjs/notice/index.js +8 -15
- package/dist/cjs/notice/style.scss +28 -15
- package/dist/cjs/patrons-logo/index.js +3 -11
- package/dist/cjs/plugin-installer/index.js +36 -36
- package/dist/cjs/plugin-installer/style.scss +5 -5
- package/dist/cjs/plugin-settings/SettingsSection.js +9 -28
- package/dist/cjs/plugin-settings/index.js +39 -22
- package/dist/cjs/plugin-toggle/index.js +40 -33
- package/dist/cjs/plugin-toggle/style.scss +2 -2
- package/dist/cjs/popover/index.js +1 -11
- package/dist/cjs/popover/style.scss +19 -16
- package/dist/cjs/position-control/index.js +113 -0
- package/dist/cjs/position-control/style.scss +66 -0
- package/dist/cjs/progress-bar/index.js +2 -9
- package/dist/cjs/progress-bar/index.test.js +2 -7
- package/dist/cjs/progress-bar/style.scss +4 -4
- package/dist/cjs/proxied-imports/router.js +0 -3
- package/dist/cjs/radio-control/index.js +1 -11
- package/dist/cjs/radio-control/style.scss +9 -9
- package/dist/cjs/section-header/index.js +44 -29
- package/dist/cjs/section-header/style.scss +2 -2
- package/dist/cjs/select-control/ButtonGroupControl.js +4 -13
- package/dist/cjs/select-control/GroupedSelectControl.js +9 -15
- package/dist/cjs/select-control/index.js +5 -12
- package/dist/cjs/select-control/style.scss +2 -2
- package/dist/cjs/settings/MinMaxSetting.js +3 -7
- package/dist/cjs/settings/SettingsCard.js +3 -7
- package/dist/cjs/settings/SettingsSection.js +1 -4
- package/dist/cjs/settings/index.js +0 -6
- package/dist/cjs/settings/style.scss +1 -1
- package/dist/cjs/steps-list/index.js +52 -0
- package/dist/cjs/steps-list/style.scss +11 -0
- package/dist/cjs/steps-list-item/index.js +56 -0
- package/dist/cjs/steps-list-item/style.scss +47 -0
- package/dist/cjs/style-card/index.js +6 -13
- package/dist/cjs/style-card/style.scss +9 -12
- package/dist/cjs/style.scss +5 -6
- package/dist/cjs/tabbed-navigation/index.js +19 -16
- package/dist/cjs/tabbed-navigation/style.scss +3 -4
- package/dist/cjs/text-control/index.js +6 -16
- package/dist/cjs/utils/index.js +10 -5
- package/dist/cjs/waiting/index.js +1 -9
- package/dist/cjs/web-preview/index.js +13 -28
- package/dist/cjs/web-preview/style.scss +14 -14
- package/dist/cjs/with-wizard/index.js +51 -31
- package/dist/cjs/with-wizard/style.scss +35 -37
- package/dist/cjs/with-wizard-screen/index.js +11 -17
- package/dist/cjs/with-wizard-screen/style.scss +14 -17
- package/dist/cjs/wizard/components/WizardError.js +3 -15
- package/dist/cjs/wizard/index.js +10 -24
- package/dist/cjs/wizard/store/index.js +42 -55
- package/dist/cjs/wizard/store/utils.js +1 -6
- package/dist/esm/accordion/index.js +38 -0
- package/dist/esm/accordion/style.scss +27 -0
- package/dist/esm/action-card/index.js +50 -21
- package/dist/esm/action-card/style.scss +100 -23
- package/dist/esm/autocomplete-tokenfield/index.js +14 -37
- package/dist/esm/autocomplete-tokenfield/style.scss +2 -2
- package/dist/esm/autocomplete-with-suggestions/index.js +28 -41
- package/dist/esm/autocomplete-with-suggestions/style.scss +16 -15
- package/dist/esm/button/index.js +5 -7
- package/dist/esm/button-card/index.js +2 -5
- package/dist/esm/button-card/style.scss +13 -13
- package/dist/esm/card/index.js +2 -5
- package/dist/esm/card/style.scss +25 -8
- package/dist/esm/category-autocomplete/index.js +17 -30
- package/dist/esm/category-autocomplete/style.scss +0 -2
- package/dist/esm/color-picker/index.js +2 -4
- package/dist/esm/color-picker/style.scss +0 -3
- package/dist/esm/consts.js +3 -2
- package/dist/esm/custom-select-control/index.js +2 -5
- package/dist/esm/custom-select-control/style.scss +6 -7
- package/dist/esm/date-range-picker/index.js +1 -3
- package/dist/esm/date-range-picker/style.scss +12 -12
- package/dist/esm/footer/index.js +3 -11
- package/dist/esm/footer/style.scss +5 -5
- package/dist/esm/form-token-field/index.js +2 -5
- package/dist/esm/form-token-field/style.scss +2 -3
- package/dist/esm/global-notices/index.js +1 -6
- package/dist/esm/grid/index.js +2 -5
- package/dist/esm/grid/style.scss +5 -5
- package/dist/esm/handoff/index.js +3 -14
- package/dist/esm/handoff-message/index.js +45 -0
- package/dist/esm/hooks/index.js +0 -2
- package/dist/esm/hooks/useObjectState.js +3 -8
- package/dist/esm/hooks/useObjectState.test.js +0 -3
- package/dist/esm/hooks/useOnClickOutside.js +2 -5
- package/dist/esm/hooks/usePrompt.js +1 -8
- package/dist/esm/image-upload/index.js +17 -16
- package/dist/esm/image-upload/style.scss +5 -9
- package/dist/esm/index.js +4 -0
- package/dist/esm/info-button/index.js +4 -6
- package/dist/esm/info-button/style.scss +1 -3
- package/dist/esm/modal/index.js +2 -5
- package/dist/esm/modal/style.scss +8 -8
- package/dist/esm/newspack-icon/index.js +2 -5
- package/dist/esm/newspack-icon/style.scss +4 -4
- package/dist/esm/newspack-logo/index.js +2 -5
- package/dist/esm/newspack-logo/style.scss +3 -3
- package/dist/esm/notice/index.js +4 -8
- package/dist/esm/notice/style.scss +28 -15
- package/dist/esm/patrons-logo/index.js +3 -5
- package/dist/esm/plugin-installer/index.js +35 -39
- package/dist/esm/plugin-installer/style.scss +5 -5
- package/dist/esm/plugin-settings/SettingsSection.js +8 -21
- package/dist/esm/plugin-settings/index.js +38 -24
- package/dist/esm/plugin-toggle/index.js +39 -36
- package/dist/esm/plugin-toggle/style.scss +2 -2
- package/dist/esm/popover/index.js +3 -6
- package/dist/esm/popover/style.scss +19 -16
- package/dist/esm/position-control/index.js +109 -0
- package/dist/esm/position-control/style.scss +66 -0
- package/dist/esm/progress-bar/index.js +2 -7
- package/dist/esm/progress-bar/index.test.js +2 -1
- package/dist/esm/progress-bar/style.scss +4 -4
- package/dist/esm/proxied-imports/router.js +1 -0
- package/dist/esm/radio-control/index.js +3 -6
- package/dist/esm/radio-control/style.scss +9 -9
- package/dist/esm/section-header/index.js +44 -25
- package/dist/esm/section-header/style.scss +2 -2
- package/dist/esm/select-control/ButtonGroupControl.js +5 -7
- package/dist/esm/select-control/GroupedSelectControl.js +5 -6
- package/dist/esm/select-control/index.js +6 -6
- package/dist/esm/select-control/style.scss +2 -2
- package/dist/esm/settings/MinMaxSetting.js +1 -3
- package/dist/esm/settings/SettingsCard.js +3 -4
- package/dist/esm/settings/SettingsSection.js +0 -2
- package/dist/esm/settings/style.scss +1 -1
- package/dist/esm/steps-list/index.js +43 -0
- package/dist/esm/steps-list/style.scss +11 -0
- package/dist/esm/steps-list-item/index.js +48 -0
- package/dist/esm/steps-list-item/style.scss +47 -0
- package/dist/esm/style-card/index.js +2 -5
- package/dist/esm/style-card/style.scss +9 -12
- package/dist/esm/style.scss +5 -6
- package/dist/esm/tabbed-navigation/index.js +20 -10
- package/dist/esm/tabbed-navigation/style.scss +3 -4
- package/dist/esm/text-control/index.js +2 -9
- package/dist/esm/utils/index.js +9 -3
- package/dist/esm/waiting/index.js +2 -5
- package/dist/esm/web-preview/index.js +9 -24
- package/dist/esm/web-preview/style.scss +14 -14
- package/dist/esm/with-wizard/index.js +49 -34
- package/dist/esm/with-wizard/style.scss +35 -37
- package/dist/esm/with-wizard-screen/index.js +9 -11
- package/dist/esm/with-wizard-screen/style.scss +14 -17
- package/dist/esm/wizard/components/WizardError.js +1 -10
- package/dist/esm/wizard/index.js +10 -12
- package/dist/esm/wizard/store/index.js +40 -46
- package/dist/esm/wizard/store/utils.js +1 -1
- package/package.json +4 -4
- package/shared/js/button-props.js +3 -1
- package/shared/scss/_mixins.scss +12 -0
- package/src/accordion/index.js +32 -0
- package/src/accordion/style.scss +27 -0
- package/src/action-card/index.js +43 -8
- package/src/action-card/style.scss +100 -23
- package/src/autocomplete-tokenfield/index.js +1 -1
- package/src/autocomplete-tokenfield/style.scss +2 -2
- package/src/autocomplete-with-suggestions/style.scss +16 -15
- package/src/button-card/style.scss +13 -13
- package/src/card/style.scss +25 -8
- package/src/category-autocomplete/index.js +3 -1
- package/src/category-autocomplete/style.scss +0 -2
- package/src/color-picker/style.scss +0 -3
- package/src/consts.js +2 -1
- package/src/custom-select-control/style.scss +6 -7
- package/src/date-range-picker/style.scss +12 -12
- package/src/footer/index.js +2 -2
- package/src/footer/style.scss +5 -5
- package/src/form-token-field/index.js +2 -7
- package/src/form-token-field/style.scss +2 -3
- package/src/grid/style.scss +5 -5
- package/src/handoff/index.js +3 -8
- package/src/handoff-message/index.js +39 -0
- package/src/hooks/useObjectState.js +2 -1
- package/src/image-upload/index.js +9 -3
- package/src/image-upload/style.scss +5 -9
- package/src/index.js +4 -0
- package/src/info-button/style.scss +1 -3
- package/src/modal/style.scss +8 -8
- package/src/newspack-icon/style.scss +4 -4
- package/src/newspack-logo/style.scss +3 -3
- package/src/notice/index.js +2 -0
- package/src/notice/style.scss +28 -15
- package/src/plugin-installer/index.js +15 -2
- package/src/plugin-installer/style.scss +5 -5
- package/src/plugin-settings/SettingsSection.js +7 -13
- package/src/plugin-settings/index.js +7 -2
- package/src/plugin-toggle/index.js +2 -3
- package/src/plugin-toggle/style.scss +2 -2
- package/src/popover/style.scss +19 -16
- package/src/position-control/index.js +122 -0
- package/src/position-control/style.scss +66 -0
- package/src/progress-bar/style.scss +4 -4
- package/src/radio-control/style.scss +9 -9
- package/src/section-header/index.js +32 -15
- package/src/section-header/style.scss +2 -2
- package/src/select-control/ButtonGroupControl.js +3 -0
- package/src/select-control/GroupedSelectControl.js +2 -1
- package/src/select-control/index.js +6 -2
- package/src/select-control/style.scss +2 -2
- package/src/settings/style.scss +1 -1
- package/src/steps-list/index.js +39 -0
- package/src/steps-list/style.scss +11 -0
- package/src/steps-list-item/index.js +40 -0
- package/src/steps-list-item/style.scss +47 -0
- package/src/style-card/index.js +2 -11
- package/src/style-card/style.scss +9 -12
- package/src/style.scss +5 -6
- package/src/tabbed-navigation/index.js +12 -4
- package/src/tabbed-navigation/style.scss +3 -4
- package/src/utils/index.js +9 -0
- package/src/web-preview/index.js +1 -1
- package/src/web-preview/style.scss +14 -14
- package/src/with-wizard/style.scss +35 -37
- package/src/with-wizard-screen/index.js +4 -1
- package/src/with-wizard-screen/style.scss +14 -17
- package/src/wizard/index.js +15 -3
- package/src/wizard/store/index.js +8 -2
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* WordPress dependencies
|
|
7
7
|
*/
|
|
8
|
-
import { Fragment } from '@wordpress/element';
|
|
8
|
+
import { Fragment, useState } from '@wordpress/element';
|
|
9
9
|
import { applyFilters } from '@wordpress/hooks';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
11
|
import { CheckboxControl } from '@wordpress/components';
|
|
@@ -52,17 +52,9 @@ const getControlType = setting => {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
const SettingsSection = props => {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
active,
|
|
59
|
-
title,
|
|
60
|
-
description,
|
|
61
|
-
fields,
|
|
62
|
-
disabled,
|
|
63
|
-
onChange,
|
|
64
|
-
onUpdate,
|
|
65
|
-
} = props;
|
|
55
|
+
const [ saveDisabled, setSaveDisabled ] = useState( true );
|
|
56
|
+
const { error, sectionKey, active, title, description, fields, disabled, onChange, onUpdate } =
|
|
57
|
+
props;
|
|
66
58
|
const getControlProps = setting => ( {
|
|
67
59
|
disabled,
|
|
68
60
|
name: `${ setting.section }_${ setting.key }`,
|
|
@@ -79,6 +71,7 @@ const SettingsSection = props => {
|
|
|
79
71
|
checked: setting.type === 'boolean' ? !! setting.value : null,
|
|
80
72
|
onChange: value => {
|
|
81
73
|
onChange( setting.key, value );
|
|
74
|
+
setSaveDisabled( false );
|
|
82
75
|
},
|
|
83
76
|
} );
|
|
84
77
|
const createFilter = ( name, defaultComponent = null ) => {
|
|
@@ -109,9 +102,10 @@ const SettingsSection = props => {
|
|
|
109
102
|
'buttons',
|
|
110
103
|
<Button
|
|
111
104
|
variant="primary"
|
|
112
|
-
disabled={ disabled }
|
|
105
|
+
disabled={ disabled || saveDisabled }
|
|
113
106
|
onClick={ () => {
|
|
114
107
|
onUpdate();
|
|
108
|
+
setSaveDisabled( true );
|
|
115
109
|
} }
|
|
116
110
|
>
|
|
117
111
|
{ __( 'Save Settings', 'newspack' ) }
|
|
@@ -90,8 +90,13 @@ class PluginSettings extends Component {
|
|
|
90
90
|
},
|
|
91
91
|
} )
|
|
92
92
|
.then( settings => {
|
|
93
|
-
this.setState( {
|
|
94
|
-
|
|
93
|
+
this.setState( {
|
|
94
|
+
settings: {
|
|
95
|
+
...this.state.settings,
|
|
96
|
+
[ sectionKey ]: settings[ sectionKey ],
|
|
97
|
+
},
|
|
98
|
+
error: null,
|
|
99
|
+
} );
|
|
95
100
|
if ( 'function' === typeof afterUpdate ) {
|
|
96
101
|
afterUpdate( settings );
|
|
97
102
|
}
|
|
@@ -117,9 +117,8 @@ class PluginToggle extends Component {
|
|
|
117
117
|
? Object.keys( pluginsFromAPI[ pluginSlug ] ).reduce(
|
|
118
118
|
( accumulator, key ) => ( {
|
|
119
119
|
...accumulator,
|
|
120
|
-
[ key.charAt( 0 ).toLowerCase() + key.slice( 1 ) ]:
|
|
121
|
-
key
|
|
122
|
-
],
|
|
120
|
+
[ key.charAt( 0 ).toLowerCase() + key.slice( 1 ) ]:
|
|
121
|
+
pluginsFromAPI[ pluginSlug ][ key ],
|
|
123
122
|
} ),
|
|
124
123
|
{}
|
|
125
124
|
)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Plugin Toggle
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
@
|
|
5
|
+
@use '~@wordpress/base-styles/colors' as wp-colors;
|
|
6
6
|
|
|
7
7
|
.newspack-action-card {
|
|
8
8
|
&.in-flight,
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
.newspack-action-card__region-right {
|
|
13
13
|
.newspack-button {
|
|
14
|
-
color:
|
|
14
|
+
color: wp-colors.$gray-700;
|
|
15
15
|
pointer-events: none;
|
|
16
16
|
text-decoration: none;
|
|
17
17
|
}
|
package/src/popover/style.scss
CHANGED
|
@@ -2,30 +2,29 @@
|
|
|
2
2
|
* Popover
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
@
|
|
6
|
-
@
|
|
5
|
+
@use '../../../shared/scss/colors';
|
|
6
|
+
@use '~@wordpress/base-styles/colors' as wp-colors;
|
|
7
7
|
|
|
8
8
|
.newspack-popover {
|
|
9
9
|
.components-popover__content {
|
|
10
|
-
border: 1px solid $gray-300;
|
|
11
|
-
border-radius: 2px;
|
|
12
|
-
box-shadow: 0 4px 8px rgba( black, 0.08 );
|
|
13
10
|
min-width: 238px;
|
|
14
11
|
|
|
15
12
|
.newspack-button {
|
|
16
|
-
color:
|
|
13
|
+
color: wp-colors.$gray-700;
|
|
17
14
|
display: flex;
|
|
18
15
|
font-weight: normal;
|
|
19
16
|
padding: 6px 8px;
|
|
20
17
|
|
|
21
18
|
&:hover {
|
|
19
|
+
color: colors.$primary-500;
|
|
20
|
+
|
|
22
21
|
.components-menu-items__item-icon {
|
|
23
|
-
fill:
|
|
22
|
+
fill: currentcolor;
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
&:focus:not( :disabled ) {
|
|
28
|
-
box-shadow: inset 0 0 0 2px
|
|
27
|
+
box-shadow: inset 0 0 0 2px colors.$primary-500;
|
|
29
28
|
position: relative;
|
|
30
29
|
z-index: 1;
|
|
31
30
|
}
|
|
@@ -36,14 +35,14 @@
|
|
|
36
35
|
text-decoration: none;
|
|
37
36
|
|
|
38
37
|
&:not( .is-destructive ) {
|
|
39
|
-
color:
|
|
38
|
+
color: wp-colors.$gray-700;
|
|
40
39
|
|
|
41
40
|
&:active,
|
|
42
41
|
&:active:enabled,
|
|
43
42
|
&:focus,
|
|
44
43
|
&:focus:enabled &:hover,
|
|
45
|
-
&:not( :disabled
|
|
46
|
-
color:
|
|
44
|
+
&:not( :disabled, [aria-disabled='true'], .is-default ):hover {
|
|
45
|
+
color: colors.$primary-500;
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
|
|
@@ -53,8 +52,12 @@
|
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
|
|
55
|
+
&.is-destructive:not( :focus ) {
|
|
56
|
+
box-shadow: none !important;
|
|
57
|
+
}
|
|
58
|
+
|
|
56
59
|
.components-menu-items__item-icon {
|
|
57
|
-
fill:
|
|
60
|
+
fill: wp-colors.$gray-900;
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
.components-menu-item__item {
|
|
@@ -64,7 +67,7 @@
|
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
.components-menu-group__label {
|
|
67
|
-
color:
|
|
70
|
+
color: wp-colors.$gray-900;
|
|
68
71
|
font-size: 12px;
|
|
69
72
|
font-weight: bold;
|
|
70
73
|
line-height: 16px;
|
|
@@ -86,8 +89,8 @@
|
|
|
86
89
|
min-height: 36px;
|
|
87
90
|
|
|
88
91
|
&:focus ~ div.components-input-control__backdrop {
|
|
89
|
-
border-color:
|
|
90
|
-
box-shadow: inset 0 0 0 1px
|
|
92
|
+
border-color: colors.$primary-500;
|
|
93
|
+
box-shadow: inset 0 0 0 1px colors.$primary-500;
|
|
91
94
|
}
|
|
92
95
|
}
|
|
93
96
|
|
|
@@ -129,7 +132,7 @@
|
|
|
129
132
|
}
|
|
130
133
|
|
|
131
134
|
&:not( .is-without-arrow )::before {
|
|
132
|
-
border-color:
|
|
135
|
+
border-color: wp-colors.$gray-300;
|
|
133
136
|
}
|
|
134
137
|
|
|
135
138
|
&.is-from-bottom {
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { ButtonGroup, Button } from '@wordpress/components';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* External dependencies
|
|
9
|
+
*/
|
|
10
|
+
import classnames from 'classnames';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import './style.scss';
|
|
16
|
+
|
|
17
|
+
export default function PositionControl( {
|
|
18
|
+
allowedPositions,
|
|
19
|
+
value,
|
|
20
|
+
label,
|
|
21
|
+
help,
|
|
22
|
+
onChange,
|
|
23
|
+
size,
|
|
24
|
+
...props
|
|
25
|
+
} ) {
|
|
26
|
+
/**
|
|
27
|
+
* Set layout options
|
|
28
|
+
*/
|
|
29
|
+
const options =
|
|
30
|
+
size === 'full-width'
|
|
31
|
+
? [
|
|
32
|
+
{
|
|
33
|
+
value: 'top',
|
|
34
|
+
/* translators: Overlay Position */
|
|
35
|
+
label: __( 'Top', 'newspack' ),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
value: 'center',
|
|
39
|
+
/* translators: Overlay Position */
|
|
40
|
+
label: __( 'Center', 'newspack' ),
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: 'bottom',
|
|
44
|
+
/* translators: Overlay Position */
|
|
45
|
+
label: __( 'Bottom', 'newspack' ),
|
|
46
|
+
},
|
|
47
|
+
]
|
|
48
|
+
: [
|
|
49
|
+
{
|
|
50
|
+
value: 'top_left',
|
|
51
|
+
/* translators: Overlay Position */
|
|
52
|
+
label: __( 'Top Left', 'newspack' ),
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
value: 'top',
|
|
56
|
+
/* translators: Overlay Position */
|
|
57
|
+
label: __( 'Top Center', 'newspack' ),
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
value: 'top_right',
|
|
61
|
+
/* translators: Overlay Position */
|
|
62
|
+
label: __( 'Top Right', 'newspack' ),
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
value: 'center_left',
|
|
66
|
+
/* translators: Overlay Position */
|
|
67
|
+
label: __( 'Center Left', 'newspack' ),
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
value: 'center',
|
|
71
|
+
/* translators: Overlay Position */
|
|
72
|
+
label: __( 'Center', 'newspack' ),
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
value: 'center_right',
|
|
76
|
+
/* translators: Overlay Position */
|
|
77
|
+
label: __( 'Center Right', 'newspack' ),
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
value: 'bottom_left',
|
|
81
|
+
/* translators: Overlay Position */
|
|
82
|
+
label: __( 'Bottom Left', 'newspack' ),
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
value: 'bottom',
|
|
86
|
+
/* translators: Overlay Position */
|
|
87
|
+
label: __( 'Bottom Center', 'newspack' ),
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
value: 'bottom_right',
|
|
91
|
+
/* translators: Overlay Position */
|
|
92
|
+
label: __( 'Bottom Right', 'newspack' ),
|
|
93
|
+
},
|
|
94
|
+
];
|
|
95
|
+
return (
|
|
96
|
+
<div className={ classnames( 'newspack-position-placement-control', 'size-' + size ) }>
|
|
97
|
+
<p className="components-base-control__label">{ label }</p>
|
|
98
|
+
<ButtonGroup aria-label={ __( 'Select Position', 'newspack' ) } { ...props }>
|
|
99
|
+
{ options.map( ( option, index ) => {
|
|
100
|
+
return (
|
|
101
|
+
<div
|
|
102
|
+
key={ `newspack-position-placement-item-${ index }` }
|
|
103
|
+
className={ option.value === value ? 'is-selected' : null }
|
|
104
|
+
>
|
|
105
|
+
<Button
|
|
106
|
+
isSmall
|
|
107
|
+
title={ option.label }
|
|
108
|
+
aria-label={ option.label }
|
|
109
|
+
isPrimary={ option.value === value }
|
|
110
|
+
onClick={ () => {
|
|
111
|
+
onChange( option.value );
|
|
112
|
+
} }
|
|
113
|
+
disabled={ allowedPositions?.length && ! allowedPositions.includes( option.value ) }
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
);
|
|
117
|
+
} ) }
|
|
118
|
+
</ButtonGroup>
|
|
119
|
+
<p className="components-base-control__help">{ help }</p>
|
|
120
|
+
</div>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
@use '~@wordpress/base-styles/colors' as wp-colors;
|
|
2
|
+
|
|
3
|
+
.newspack-position-placement-control {
|
|
4
|
+
margin-bottom: 1em;
|
|
5
|
+
|
|
6
|
+
.components-base-control__label {
|
|
7
|
+
margin-bottom: 8px;
|
|
8
|
+
margin-top: 1em;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.components-button-group {
|
|
12
|
+
display: grid;
|
|
13
|
+
grid-template-columns: repeat( 3, 1fr );
|
|
14
|
+
grid-template-rows: repeat( 3, 1fr );
|
|
15
|
+
|
|
16
|
+
div {
|
|
17
|
+
padding: 1px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.components-button {
|
|
21
|
+
border-radius: 0 !important;
|
|
22
|
+
height: 100%;
|
|
23
|
+
padding: 20px;
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
div:nth-of-type( 1 ) .components-button {
|
|
28
|
+
border-radius: 4px 0 0 !important;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
div:nth-of-type( 3 ) .components-button {
|
|
32
|
+
border-radius: 0 4px 0 0 !important;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
div:nth-last-of-type( 1 ) .components-button {
|
|
36
|
+
border-radius: 0 0 4px !important;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
div:nth-last-of-type( 3 ) .components-button {
|
|
40
|
+
border-radius: 0 0 0 4px !important;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&.size-full-width .components-button-group {
|
|
45
|
+
grid-template-columns: 1fr;
|
|
46
|
+
|
|
47
|
+
div:first-of-type .components-button {
|
|
48
|
+
border-radius: 4px 4px 0 0 !important;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
div:nth-of-type( 2 ) .components-button {
|
|
52
|
+
border-radius: 0 !important;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
div:last-of-type .components-button {
|
|
56
|
+
border-radius: 0 0 4px 4px !important;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.components-base-control__help {
|
|
61
|
+
color: wp-colors.$gray-700;
|
|
62
|
+
font-size: 12px;
|
|
63
|
+
font-style: normal;
|
|
64
|
+
margin-top: 8px;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Progress Bar
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
@
|
|
6
|
-
@
|
|
5
|
+
@use '../../../shared/scss/colors';
|
|
6
|
+
@use '~@wordpress/base-styles/colors' as wp-colors;
|
|
7
7
|
|
|
8
8
|
.newspack-progress-bar {
|
|
9
9
|
margin: 32px 0;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
&__container {
|
|
29
|
-
background-color:
|
|
29
|
+
background-color: wp-colors.$gray-100;
|
|
30
30
|
border-radius: 4px;
|
|
31
31
|
height: 8px;
|
|
32
32
|
overflow: hidden;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
&__bar {
|
|
38
|
-
background-color:
|
|
38
|
+
background-color: colors.$primary-500;
|
|
39
39
|
height: 8px;
|
|
40
40
|
transition: width 125ms ease-in-out;
|
|
41
41
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Radio Control
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
@
|
|
6
|
-
@
|
|
5
|
+
@use '../../../shared/scss/colors';
|
|
6
|
+
@use '~@wordpress/base-styles/colors' as wp-colors;
|
|
7
7
|
|
|
8
8
|
.newspack-radio-control {
|
|
9
|
-
color:
|
|
9
|
+
color: wp-colors.$gray-700;
|
|
10
10
|
font-size: 14px;
|
|
11
11
|
line-height: 24px;
|
|
12
12
|
margin: 32px 0;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.components-base-control__label {
|
|
22
|
-
color:
|
|
22
|
+
color: wp-colors.$gray-900;
|
|
23
23
|
font-weight: bold;
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
.components-radio-control__option {
|
|
29
29
|
align-items: center;
|
|
30
30
|
display: flex;
|
|
31
|
-
margin: 0 0 8px
|
|
31
|
+
margin: 0 0 8px;
|
|
32
32
|
|
|
33
33
|
&:first-of-type {
|
|
34
34
|
margin-top: 8px;
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
&:checked {
|
|
55
|
-
background-color:
|
|
56
|
-
border-color:
|
|
55
|
+
background-color: colors.$primary-500;
|
|
56
|
+
border-color: colors.$primary-500;
|
|
57
57
|
|
|
58
58
|
&::before {
|
|
59
59
|
border: none;
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
&:focus {
|
|
64
|
-
border-color:
|
|
65
|
-
box-shadow: 0 0 0 2px white, 0 0 0 3.5px
|
|
64
|
+
border-color: colors.$primary-500;
|
|
65
|
+
box-shadow: 0 0 0 2px white, 0 0 0 3.5px colors.$primary-500;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
* Section Header
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* WordPress dependencies
|
|
7
|
+
*/
|
|
8
|
+
import { useEffect, useRef } from '@wordpress/element';
|
|
9
|
+
|
|
5
10
|
/**
|
|
6
11
|
* Internal dependencies
|
|
7
12
|
*/
|
|
@@ -14,14 +19,28 @@ import './style.scss';
|
|
|
14
19
|
import classnames from 'classnames';
|
|
15
20
|
|
|
16
21
|
const SectionHeader = ( {
|
|
17
|
-
centered,
|
|
18
|
-
className,
|
|
22
|
+
centered = false,
|
|
23
|
+
className = null,
|
|
19
24
|
description,
|
|
20
|
-
heading,
|
|
21
|
-
isWhite,
|
|
22
|
-
noMargin,
|
|
25
|
+
heading = 2,
|
|
26
|
+
isWhite = false,
|
|
27
|
+
noMargin = false,
|
|
23
28
|
title,
|
|
29
|
+
id = null,
|
|
24
30
|
} ) => {
|
|
31
|
+
// If id is in the URL as a scrollTo param, scroll to it on render.
|
|
32
|
+
const ref = useRef();
|
|
33
|
+
useEffect( () => {
|
|
34
|
+
const params = new Proxy( new URLSearchParams( window.location.search ), {
|
|
35
|
+
get: ( searchParams, prop ) => searchParams.get( prop ),
|
|
36
|
+
} );
|
|
37
|
+
const scrollToId = params.scrollTo;
|
|
38
|
+
if ( scrollToId && scrollToId === id ) {
|
|
39
|
+
// Let parent scroll action run before running this.
|
|
40
|
+
window.setTimeout( () => ref.current.scrollIntoView( { behavior: 'smooth' } ), 250 );
|
|
41
|
+
}
|
|
42
|
+
}, [] );
|
|
43
|
+
|
|
25
44
|
const classes = classnames(
|
|
26
45
|
'newspack-section-header',
|
|
27
46
|
centered && 'newspack-section-header--is-centered',
|
|
@@ -33,17 +52,15 @@ const SectionHeader = ( {
|
|
|
33
52
|
const HeadingTag = `h${ heading }`;
|
|
34
53
|
|
|
35
54
|
return (
|
|
36
|
-
<
|
|
37
|
-
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
55
|
+
<div id={ id } ref={ ref }>
|
|
56
|
+
<Grid columns={ 1 } gutter={ 8 } className={ classes }>
|
|
57
|
+
{ typeof title === 'string' && <HeadingTag>{ title }</HeadingTag> }
|
|
58
|
+
{ typeof title === 'function' && <HeadingTag>{ title() }</HeadingTag> }
|
|
59
|
+
{ typeof description === 'string' && <p>{ description }</p> }
|
|
60
|
+
{ typeof description === 'function' && <p>{ description() }</p> }
|
|
61
|
+
</Grid>
|
|
62
|
+
</div>
|
|
42
63
|
);
|
|
43
64
|
};
|
|
44
65
|
|
|
45
|
-
SectionHeader.defaultProps = {
|
|
46
|
-
heading: 2,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
66
|
export default SectionHeader;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Section Header
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
@
|
|
5
|
+
@use '~@wordpress/base-styles/colors' as wp-colors;
|
|
6
6
|
|
|
7
7
|
.newspack-section-header {
|
|
8
8
|
margin: 64px 0 32px;
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
p {
|
|
35
|
-
color:
|
|
35
|
+
color: wp-colors.$gray-700;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.newspack-wizard__content &:first-child {
|
|
@@ -16,6 +16,7 @@ import { hooks } from '..';
|
|
|
16
16
|
|
|
17
17
|
const ButtonGroupControl = ( {
|
|
18
18
|
buttonOptions,
|
|
19
|
+
buttonSmall,
|
|
19
20
|
className,
|
|
20
21
|
hideLabelFromVision,
|
|
21
22
|
label,
|
|
@@ -42,7 +43,9 @@ const ButtonGroupControl = ( {
|
|
|
42
43
|
<Button
|
|
43
44
|
key={ option.value }
|
|
44
45
|
variant={ isSelected ? 'primary' : null }
|
|
46
|
+
isPressed={ isSelected }
|
|
45
47
|
onClick={ () => onChange( option.value ) }
|
|
48
|
+
isSmall={ buttonSmall }
|
|
46
49
|
>
|
|
47
50
|
<Label />
|
|
48
51
|
</Button>
|
|
@@ -9,7 +9,8 @@ import { Icon, chevronDown } from '@wordpress/icons';
|
|
|
9
9
|
* External dependencies
|
|
10
10
|
*/
|
|
11
11
|
import classnames from 'classnames';
|
|
12
|
-
import
|
|
12
|
+
import find from 'lodash/find';
|
|
13
|
+
import some from 'lodash/some';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Internal dependencies
|
|
@@ -25,7 +25,7 @@ class SelectControl extends Component {
|
|
|
25
25
|
* Render.
|
|
26
26
|
*/
|
|
27
27
|
render() {
|
|
28
|
-
const { className, optgroups, buttonOptions, ...otherProps } = this.props;
|
|
28
|
+
const { className, optgroups, buttonOptions, buttonSmall, ...otherProps } = this.props;
|
|
29
29
|
const classes = classNames(
|
|
30
30
|
'newspack-select-control',
|
|
31
31
|
optgroups && 'newspack-grouped-select-control',
|
|
@@ -38,7 +38,11 @@ class SelectControl extends Component {
|
|
|
38
38
|
{ optgroups ? (
|
|
39
39
|
<GroupedSelectControl optgroups={ optgroups } { ...otherProps } />
|
|
40
40
|
) : buttonOptions ? (
|
|
41
|
-
<ButtonGroupControl
|
|
41
|
+
<ButtonGroupControl
|
|
42
|
+
buttonOptions={ buttonOptions }
|
|
43
|
+
buttonSmall={ buttonSmall }
|
|
44
|
+
{ ...otherProps }
|
|
45
|
+
/>
|
|
42
46
|
) : (
|
|
43
47
|
<BaseComponent { ...otherProps } />
|
|
44
48
|
) }
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Select Control
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
@
|
|
5
|
+
@use '~@wordpress/base-styles/colors' as wp-colors;
|
|
6
6
|
|
|
7
7
|
.components-select-control {
|
|
8
8
|
&__input {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
&__input {
|
|
48
48
|
appearance: none;
|
|
49
49
|
background: transparent;
|
|
50
|
-
border: 1px solid
|
|
50
|
+
border: 1px solid wp-colors.$gray-700;
|
|
51
51
|
border-radius: 2px;
|
|
52
52
|
box-shadow: none !important;
|
|
53
53
|
box-sizing: border-box;
|
package/src/settings/style.scss
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Steps List
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* WordPress dependencies.
|
|
7
|
+
*/
|
|
8
|
+
import { Component } from '@wordpress/element';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies.
|
|
12
|
+
*/
|
|
13
|
+
import { StepsListItem } from '../';
|
|
14
|
+
import './style.scss';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* External dependencies.
|
|
18
|
+
*/
|
|
19
|
+
import classnames from 'classnames';
|
|
20
|
+
|
|
21
|
+
class StepsList extends Component {
|
|
22
|
+
/**
|
|
23
|
+
* Render
|
|
24
|
+
*/
|
|
25
|
+
render() {
|
|
26
|
+
const { className, stepsListItems, narrowList, style = {} } = this.props;
|
|
27
|
+
const classes = classnames( 'steps-list', className, narrowList && 'steps-list__narrow-list' );
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div className={ classes } style={ style }>
|
|
31
|
+
{ stepsListItems.map( ( listItem, index ) => (
|
|
32
|
+
<StepsListItem key={ index } listItemCount={ index + 1 } listItemText={ listItem } />
|
|
33
|
+
) ) }
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default StepsList;
|