newspack-components 2.1.0 → 2.2.0
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/button-group/index.js +57 -0
- package/dist/cjs/button-group/style.scss +73 -0
- 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/checkbox-control/index.js +63 -0
- package/dist/cjs/checkbox-control/style.scss +78 -0
- 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/preview-box/index.js +36 -0
- package/dist/cjs/preview-box/style.scss +18 -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/textarea-control/index.js +54 -0
- package/dist/cjs/textarea-control/style.scss +76 -0
- package/dist/cjs/toggle-control/index.js +58 -0
- package/dist/cjs/toggle-control/style.scss +74 -0
- package/dist/cjs/toggle-group/index.js +71 -0
- package/dist/cjs/toggle-group/style.scss +28 -0
- 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/cjs/wizard/style.scss +148 -0
- 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/button-group/index.js +43 -0
- package/dist/esm/button-group/style.scss +73 -0
- 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/checkbox-control/index.js +49 -0
- package/dist/esm/checkbox-control/style.scss +78 -0
- 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/preview-box/index.js +30 -0
- package/dist/esm/preview-box/style.scss +18 -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/textarea-control/index.js +40 -0
- package/dist/esm/textarea-control/style.scss +76 -0
- package/dist/esm/toggle-control/index.js +44 -0
- package/dist/esm/toggle-control/style.scss +74 -0
- package/dist/esm/toggle-group/index.js +58 -0
- package/dist/esm/toggle-group/style.scss +28 -0
- 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/dist/esm/wizard/style.scss +148 -0
- package/package.json +4 -4
- package/shared/scss/_colors.scss +0 -15
- 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
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ as alias__ } from '@wordpress/i18n';
|
|
5
|
+
const __ = alias__;
|
|
6
|
+
import { ButtonGroup, Button } from '@wordpress/components';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* External dependencies
|
|
10
|
+
*/
|
|
11
|
+
import classnames from 'classnames';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import './style.scss';
|
|
17
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
19
|
+
export default function PositionControl(_ref) {
|
|
20
|
+
let {
|
|
21
|
+
allowedPositions,
|
|
22
|
+
value,
|
|
23
|
+
label,
|
|
24
|
+
help,
|
|
25
|
+
onChange,
|
|
26
|
+
size,
|
|
27
|
+
...props
|
|
28
|
+
} = _ref;
|
|
29
|
+
/**
|
|
30
|
+
* Set layout options
|
|
31
|
+
*/
|
|
32
|
+
const options = size === 'full-width' ? [{
|
|
33
|
+
value: 'top',
|
|
34
|
+
/* translators: Overlay Position */
|
|
35
|
+
label: __('Top', 'newspack')
|
|
36
|
+
}, {
|
|
37
|
+
value: 'center',
|
|
38
|
+
/* translators: Overlay Position */
|
|
39
|
+
label: __('Center', 'newspack')
|
|
40
|
+
}, {
|
|
41
|
+
value: 'bottom',
|
|
42
|
+
/* translators: Overlay Position */
|
|
43
|
+
label: __('Bottom', 'newspack')
|
|
44
|
+
}] : [{
|
|
45
|
+
value: 'top_left',
|
|
46
|
+
/* translators: Overlay Position */
|
|
47
|
+
label: __('Top Left', 'newspack')
|
|
48
|
+
}, {
|
|
49
|
+
value: 'top',
|
|
50
|
+
/* translators: Overlay Position */
|
|
51
|
+
label: __('Top Center', 'newspack')
|
|
52
|
+
}, {
|
|
53
|
+
value: 'top_right',
|
|
54
|
+
/* translators: Overlay Position */
|
|
55
|
+
label: __('Top Right', 'newspack')
|
|
56
|
+
}, {
|
|
57
|
+
value: 'center_left',
|
|
58
|
+
/* translators: Overlay Position */
|
|
59
|
+
label: __('Center Left', 'newspack')
|
|
60
|
+
}, {
|
|
61
|
+
value: 'center',
|
|
62
|
+
/* translators: Overlay Position */
|
|
63
|
+
label: __('Center', 'newspack')
|
|
64
|
+
}, {
|
|
65
|
+
value: 'center_right',
|
|
66
|
+
/* translators: Overlay Position */
|
|
67
|
+
label: __('Center Right', 'newspack')
|
|
68
|
+
}, {
|
|
69
|
+
value: 'bottom_left',
|
|
70
|
+
/* translators: Overlay Position */
|
|
71
|
+
label: __('Bottom Left', 'newspack')
|
|
72
|
+
}, {
|
|
73
|
+
value: 'bottom',
|
|
74
|
+
/* translators: Overlay Position */
|
|
75
|
+
label: __('Bottom Center', 'newspack')
|
|
76
|
+
}, {
|
|
77
|
+
value: 'bottom_right',
|
|
78
|
+
/* translators: Overlay Position */
|
|
79
|
+
label: __('Bottom Right', 'newspack')
|
|
80
|
+
}];
|
|
81
|
+
return _jsxs("div", {
|
|
82
|
+
className: classnames('newspack-position-placement-control', 'size-' + size),
|
|
83
|
+
children: [_jsx("p", {
|
|
84
|
+
className: "components-base-control__label",
|
|
85
|
+
children: label
|
|
86
|
+
}), _jsx(ButtonGroup, {
|
|
87
|
+
"aria-label": __('Select Position', 'newspack'),
|
|
88
|
+
...props,
|
|
89
|
+
children: options.map((option, index) => {
|
|
90
|
+
return _jsx("div", {
|
|
91
|
+
className: option.value === value ? 'is-selected' : null,
|
|
92
|
+
children: _jsx(Button, {
|
|
93
|
+
isSmall: true,
|
|
94
|
+
title: option.label,
|
|
95
|
+
"aria-label": option.label,
|
|
96
|
+
isPrimary: option.value === value,
|
|
97
|
+
onClick: () => {
|
|
98
|
+
onChange(option.value);
|
|
99
|
+
},
|
|
100
|
+
disabled: allowedPositions?.length && !allowedPositions.includes(option.value)
|
|
101
|
+
})
|
|
102
|
+
}, `newspack-position-placement-item-${index}`);
|
|
103
|
+
})
|
|
104
|
+
}), _jsx("p", {
|
|
105
|
+
className: "components-base-control__help",
|
|
106
|
+
children: help
|
|
107
|
+
})]
|
|
108
|
+
});
|
|
109
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ as alias__ } from '@wordpress/i18n';
|
|
5
|
+
/**
|
|
6
|
+
* Internal dependencies
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const __ = alias__;
|
|
10
|
+
import './style.scss';
|
|
11
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
13
|
+
|
|
14
|
+
const PreviewBox = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
children
|
|
17
|
+
} = _ref;
|
|
18
|
+
return _jsxs("div", {
|
|
19
|
+
className: "newspack-preview-box",
|
|
20
|
+
children: [_jsx("div", {
|
|
21
|
+
className: "newspack-preview-box__label",
|
|
22
|
+
children: __('Preview', 'newspack')
|
|
23
|
+
}), _jsx("div", {
|
|
24
|
+
className: "newspack-preview-box__content",
|
|
25
|
+
children: children
|
|
26
|
+
})]
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default PreviewBox;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@import '../../../shared/scss/colors';
|
|
2
|
+
@import '~@wordpress/base-styles/colors';
|
|
3
|
+
|
|
4
|
+
.newspack-preview-box {
|
|
5
|
+
margin: 32px 0;
|
|
6
|
+
|
|
7
|
+
&__label {
|
|
8
|
+
color: $gray-900;
|
|
9
|
+
font-weight: bold;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&__content {
|
|
13
|
+
background: $gray-100;
|
|
14
|
+
border: 1px solid $gray-300;
|
|
15
|
+
border-radius: 3px;
|
|
16
|
+
padding: 11px 8px;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -6,14 +6,13 @@
|
|
|
6
6
|
* WordPress dependencies.
|
|
7
7
|
*/
|
|
8
8
|
import { Component } from '@wordpress/element';
|
|
9
|
+
|
|
9
10
|
/**
|
|
10
11
|
* Internal dependencies.
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
13
|
import './style.scss';
|
|
14
14
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
15
15
|
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
16
|
-
|
|
17
16
|
class ProgressBar extends Component {
|
|
18
17
|
/**
|
|
19
18
|
* Get completion as a percentage.
|
|
@@ -26,14 +25,12 @@ class ProgressBar extends Component {
|
|
|
26
25
|
if (!total) {
|
|
27
26
|
return 100;
|
|
28
27
|
}
|
|
29
|
-
|
|
30
28
|
return Math.max(Math.min(Math.round(completed / total * 100), 100), 0);
|
|
31
29
|
}
|
|
30
|
+
|
|
32
31
|
/**
|
|
33
32
|
* Render.
|
|
34
33
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
34
|
render() {
|
|
38
35
|
const {
|
|
39
36
|
label,
|
|
@@ -68,7 +65,5 @@ class ProgressBar extends Component {
|
|
|
68
65
|
})]
|
|
69
66
|
});
|
|
70
67
|
}
|
|
71
|
-
|
|
72
68
|
}
|
|
73
|
-
|
|
74
69
|
export default ProgressBar;
|
|
@@ -75,7 +75,8 @@ describe('ProgressBar', () => {
|
|
|
75
75
|
it(`with expected progress of ${expectedWidth}`, () => {
|
|
76
76
|
const {
|
|
77
77
|
getByTestId
|
|
78
|
-
} = render(_createElement(ProgressBar, {
|
|
78
|
+
} = render(_createElement(ProgressBar, {
|
|
79
|
+
...props,
|
|
79
80
|
key: expectedWidth
|
|
80
81
|
}));
|
|
81
82
|
expect(getByTestId('progress-bar-indicator')).toHaveAttribute('style', `width: ${expectedWidth}%;`);
|
|
@@ -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
|
}
|
|
@@ -3,22 +3,21 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { RadioControl as BaseComponent } from '@wordpress/components';
|
|
5
5
|
import { Component } from '@wordpress/element';
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* Internal dependencies.
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
10
|
import './style.scss';
|
|
11
|
+
|
|
11
12
|
/**
|
|
12
13
|
* External dependencies.
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
15
|
import classnames from 'classnames';
|
|
16
|
+
|
|
16
17
|
/**
|
|
17
18
|
* Radio Control.
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
20
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
21
|
-
|
|
22
21
|
class RadioControl extends Component {
|
|
23
22
|
/**
|
|
24
23
|
* Render.
|
|
@@ -34,7 +33,5 @@ class RadioControl extends Component {
|
|
|
34
33
|
...otherProps
|
|
35
34
|
});
|
|
36
35
|
}
|
|
37
|
-
|
|
38
36
|
}
|
|
39
|
-
|
|
40
37
|
export default RadioControl;
|
|
@@ -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,48 +2,67 @@
|
|
|
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
|
*/
|
|
8
13
|
import { Grid } from '..';
|
|
9
14
|
import './style.scss';
|
|
15
|
+
|
|
10
16
|
/**
|
|
11
17
|
* External dependencies
|
|
12
18
|
*/
|
|
13
|
-
|
|
14
19
|
import classnames from 'classnames';
|
|
15
20
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
16
21
|
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
17
|
-
|
|
18
22
|
const SectionHeader = _ref => {
|
|
19
23
|
let {
|
|
20
|
-
centered,
|
|
21
|
-
className,
|
|
24
|
+
centered = false,
|
|
25
|
+
className = null,
|
|
22
26
|
description,
|
|
23
|
-
heading,
|
|
24
|
-
isWhite,
|
|
25
|
-
noMargin,
|
|
26
|
-
title
|
|
27
|
+
heading = 2,
|
|
28
|
+
isWhite = false,
|
|
29
|
+
noMargin = false,
|
|
30
|
+
title,
|
|
31
|
+
id = null
|
|
27
32
|
} = _ref;
|
|
33
|
+
// If id is in the URL as a scrollTo param, scroll to it on render.
|
|
34
|
+
const ref = useRef();
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const params = new Proxy(new URLSearchParams(window.location.search), {
|
|
37
|
+
get: (searchParams, prop) => searchParams.get(prop)
|
|
38
|
+
});
|
|
39
|
+
const scrollToId = params.scrollTo;
|
|
40
|
+
if (scrollToId && scrollToId === id) {
|
|
41
|
+
// Let parent scroll action run before running this.
|
|
42
|
+
window.setTimeout(() => ref.current.scrollIntoView({
|
|
43
|
+
behavior: 'smooth'
|
|
44
|
+
}), 250);
|
|
45
|
+
}
|
|
46
|
+
}, []);
|
|
28
47
|
const classes = classnames('newspack-section-header', centered && 'newspack-section-header--is-centered', isWhite && 'newspack-section-header--is-white', noMargin && 'newspack-section-header--no-margin', className);
|
|
29
48
|
const HeadingTag = `h${heading}`;
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
children: title(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
return _jsx("div", {
|
|
50
|
+
id: id,
|
|
51
|
+
ref: ref,
|
|
52
|
+
children: _jsxs(Grid, {
|
|
53
|
+
columns: 1,
|
|
54
|
+
gutter: 8,
|
|
55
|
+
className: classes,
|
|
56
|
+
children: [typeof title === 'string' && _jsx(HeadingTag, {
|
|
57
|
+
children: title
|
|
58
|
+
}), typeof title === 'function' && _jsx(HeadingTag, {
|
|
59
|
+
children: title()
|
|
60
|
+
}), typeof description === 'string' && _jsx("p", {
|
|
61
|
+
children: description
|
|
62
|
+
}), typeof description === 'function' && _jsx("p", {
|
|
63
|
+
children: description()
|
|
64
|
+
})]
|
|
65
|
+
})
|
|
43
66
|
});
|
|
44
67
|
};
|
|
45
|
-
|
|
46
|
-
SectionHeader.defaultProps = {
|
|
47
|
-
heading: 2
|
|
48
|
-
};
|
|
49
68
|
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 {
|
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
+
|
|
5
6
|
/**
|
|
6
7
|
* WordPress dependencies
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
9
|
import { Icon } from '@wordpress/icons';
|
|
10
10
|
import { BaseControl, Button, ButtonGroup } from '@wordpress/components';
|
|
11
|
+
|
|
11
12
|
/**
|
|
12
13
|
* Internal dependencies
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
15
|
import { hooks } from '..';
|
|
16
16
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
17
|
-
|
|
18
17
|
const ButtonGroupControl = _ref => {
|
|
19
18
|
let {
|
|
20
19
|
buttonOptions,
|
|
20
|
+
buttonSmall,
|
|
21
21
|
className,
|
|
22
22
|
hideLabelFromVision,
|
|
23
23
|
label,
|
|
@@ -33,24 +33,22 @@ const ButtonGroupControl = _ref => {
|
|
|
33
33
|
children: _jsx(ButtonGroup, {
|
|
34
34
|
children: buttonOptions.map(option => {
|
|
35
35
|
const isSelected = value === option.value;
|
|
36
|
-
|
|
37
36
|
let Label = () => option.label;
|
|
38
|
-
|
|
39
37
|
if (option.icon) {
|
|
40
38
|
// eslint-disable-next-line react/display-name
|
|
41
39
|
Label = () => _jsx(Icon, {
|
|
42
40
|
icon: option.icon
|
|
43
41
|
});
|
|
44
42
|
}
|
|
45
|
-
|
|
46
43
|
return _jsx(Button, {
|
|
47
44
|
variant: isSelected ? 'primary' : null,
|
|
45
|
+
isPressed: isSelected,
|
|
48
46
|
onClick: () => onChange(option.value),
|
|
47
|
+
isSmall: buttonSmall,
|
|
49
48
|
children: _jsx(Label, {})
|
|
50
49
|
}, option.value);
|
|
51
50
|
})
|
|
52
51
|
})
|
|
53
52
|
});
|
|
54
53
|
};
|
|
55
|
-
|
|
56
54
|
export default ButtonGroupControl;
|
|
@@ -5,21 +5,22 @@ import { BaseControl } from '@wordpress/components';
|
|
|
5
5
|
import { __ as alias__ } from '@wordpress/i18n';
|
|
6
6
|
const __ = alias__;
|
|
7
7
|
import { Icon, chevronDown } from '@wordpress/icons';
|
|
8
|
+
|
|
8
9
|
/**
|
|
9
10
|
* External dependencies
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
12
|
import classnames from 'classnames';
|
|
13
|
-
import
|
|
13
|
+
import find from 'lodash/find';
|
|
14
|
+
import some from 'lodash/some';
|
|
15
|
+
|
|
14
16
|
/**
|
|
15
17
|
* Internal dependencies
|
|
16
18
|
*/
|
|
17
|
-
|
|
18
19
|
import { hooks } from '..';
|
|
20
|
+
|
|
19
21
|
/**
|
|
20
22
|
* SelectControl with optgroup support
|
|
21
23
|
*/
|
|
22
|
-
|
|
23
24
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
24
25
|
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
25
26
|
export default function GroupedSelectControl(_ref) {
|
|
@@ -32,7 +33,6 @@ export default function GroupedSelectControl(_ref) {
|
|
|
32
33
|
hideLabelFromVision,
|
|
33
34
|
...props
|
|
34
35
|
} = _ref;
|
|
35
|
-
|
|
36
36
|
const onChangeValue = event => {
|
|
37
37
|
const {
|
|
38
38
|
value
|
|
@@ -40,7 +40,6 @@ export default function GroupedSelectControl(_ref) {
|
|
|
40
40
|
const optgroup = find(optgroups, group => some(group.options, ['value', value]));
|
|
41
41
|
onChange(value, optgroup);
|
|
42
42
|
};
|
|
43
|
-
|
|
44
43
|
const id = hooks.useUniqueId('group-select');
|
|
45
44
|
return _jsx(BaseControl, {
|
|
46
45
|
label: label,
|
|
@@ -7,20 +7,19 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { SelectControl as BaseComponent } from '@wordpress/components';
|
|
9
9
|
import { Component } from '@wordpress/element';
|
|
10
|
+
|
|
10
11
|
/**
|
|
11
12
|
* External dependencies
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
14
|
import classNames from 'classnames';
|
|
15
|
+
|
|
15
16
|
/**
|
|
16
17
|
* Internal dependencies
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
19
|
import './style.scss';
|
|
20
20
|
import GroupedSelectControl from './GroupedSelectControl';
|
|
21
21
|
import ButtonGroupControl from './ButtonGroupControl';
|
|
22
22
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
23
|
-
|
|
24
23
|
class SelectControl extends Component {
|
|
25
24
|
/**
|
|
26
25
|
* Render.
|
|
@@ -30,6 +29,7 @@ class SelectControl extends Component {
|
|
|
30
29
|
className,
|
|
31
30
|
optgroups,
|
|
32
31
|
buttonOptions,
|
|
32
|
+
buttonSmall,
|
|
33
33
|
...otherProps
|
|
34
34
|
} = this.props;
|
|
35
35
|
const classes = classNames('newspack-select-control', optgroups && 'newspack-grouped-select-control', buttonOptions && 'newspack-buttons-select-control', className);
|
|
@@ -40,12 +40,12 @@ class SelectControl extends Component {
|
|
|
40
40
|
...otherProps
|
|
41
41
|
}) : buttonOptions ? _jsx(ButtonGroupControl, {
|
|
42
42
|
buttonOptions: buttonOptions,
|
|
43
|
+
buttonSmall: buttonSmall,
|
|
44
|
+
...otherProps
|
|
45
|
+
}) : _jsx(BaseComponent, {
|
|
43
46
|
...otherProps
|
|
44
|
-
}) : _jsx(BaseComponent, { ...otherProps
|
|
45
47
|
})
|
|
46
48
|
});
|
|
47
49
|
}
|
|
48
|
-
|
|
49
50
|
}
|
|
50
|
-
|
|
51
51
|
export default SelectControl;
|
|
@@ -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;
|