newspack-components 3.0.0-alpha.2 → 3.0.0-alpha.3
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/babel.config.cjs.js +26 -0
- package/babel.config.js +1 -0
- package/copy-styles.js +10 -2
- package/dist/esm/accordion/index.js +42 -0
- package/dist/esm/accordion/style.scss +31 -0
- package/dist/esm/action-card/index.js +218 -0
- package/dist/esm/action-card/style.scss +483 -0
- package/dist/esm/autocomplete-tokenfield/index.js +261 -0
- package/dist/esm/autocomplete-tokenfield/style.scss +49 -0
- package/dist/esm/autocomplete-with-suggestions/index.js +274 -0
- package/dist/esm/autocomplete-with-suggestions/style.scss +163 -0
- package/dist/esm/button/style.scss +11 -0
- package/dist/esm/button-card/index.js +64 -0
- package/dist/esm/button-card/style.scss +180 -0
- package/dist/esm/card/index.js +43 -0
- package/dist/esm/card/style.scss +168 -0
- package/dist/esm/category-autocomplete/index.js +183 -0
- package/dist/esm/category-autocomplete/style.scss +34 -0
- package/dist/esm/color-picker/index.js +59 -0
- package/dist/esm/color-picker/style.scss +37 -0
- package/dist/esm/consts.js +1 -0
- package/dist/esm/custom-select-control/index.js +37 -0
- package/dist/esm/custom-select-control/style.scss +93 -0
- package/dist/esm/date-range-picker/index.js +31 -0
- package/dist/esm/date-range-picker/style.scss +148 -0
- package/dist/esm/footer/index.js +99 -0
- package/dist/esm/footer/style.scss +82 -0
- package/dist/esm/form-token-field/index.js +49 -0
- package/dist/esm/form-token-field/style.scss +37 -0
- package/dist/esm/global-notices/index.js +30 -0
- package/dist/esm/grid/style.scss +166 -0
- package/dist/esm/handoff/index.js +175 -0
- package/dist/esm/handoff-message/index.js +47 -0
- package/dist/esm/hooks/useObjectState.js +30 -0
- package/dist/esm/hooks/useObjectState.test.js +82 -0
- package/dist/esm/hooks/useOnClickOutside.js +31 -0
- package/dist/esm/image-upload/index.js +140 -0
- package/dist/esm/image-upload/index.test.js +34 -0
- package/dist/esm/image-upload/style.scss +103 -0
- package/dist/esm/index.js +47 -0
- package/dist/esm/info-button/index.js +42 -0
- package/dist/esm/info-button/style.scss +18 -0
- package/dist/esm/modal/index.js +39 -0
- package/dist/esm/modal/style.scss +56 -0
- package/dist/esm/newspack-icon/index.js +50 -0
- package/dist/esm/newspack-icon/style.scss +26 -0
- package/dist/esm/newspack-logo/index.js +46 -0
- package/dist/esm/newspack-logo/style.scss +30 -0
- package/dist/esm/notice/index.js +65 -0
- package/dist/esm/notice/style.scss +111 -0
- package/dist/esm/patrons-logo/index.js +70 -0
- package/dist/esm/plugin-installer/index.js +289 -0
- package/dist/esm/plugin-installer/style.scss +72 -0
- package/dist/esm/plugin-settings/SettingsSection.js +133 -0
- package/dist/esm/plugin-settings/index.js +220 -0
- package/dist/esm/plugin-settings/style.scss +7 -0
- package/dist/esm/plugin-toggle/index.js +216 -0
- package/dist/esm/plugin-toggle/style.scss +20 -0
- package/dist/esm/popover/index.js +41 -0
- package/dist/esm/popover/style.scss +161 -0
- package/dist/esm/position-control/index.js +106 -0
- package/dist/esm/position-control/style.scss +66 -0
- package/dist/esm/progress-bar/index.js +68 -0
- package/dist/esm/progress-bar/index.test.js +108 -0
- package/dist/esm/progress-bar/style.scss +42 -0
- package/dist/esm/proxied-imports/router.js +8 -0
- package/dist/esm/radio-control/index.js +37 -0
- package/dist/esm/radio-control/style.scss +92 -0
- package/dist/esm/section-header/index.js +67 -0
- package/dist/esm/section-header/style.scss +45 -0
- package/dist/esm/select-control/ButtonGroupControl.js +53 -0
- package/dist/esm/select-control/GroupedSelectControl.js +78 -0
- package/dist/esm/select-control/index.js +51 -0
- package/dist/esm/select-control/style.scss +108 -0
- package/dist/esm/settings/MinMaxSetting.js +53 -0
- package/dist/esm/settings/SettingsCard.js +38 -0
- package/dist/esm/settings/SettingsSection.js +26 -0
- package/dist/esm/settings/index.js +9 -0
- package/dist/esm/settings/style.scss +119 -0
- package/dist/esm/sortable-newsletter-list-control/index.js +127 -0
- package/dist/esm/sortable-newsletter-list-control/style.scss +45 -0
- 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 +47 -0
- package/dist/esm/steps-list-item/style.scss +47 -0
- package/dist/esm/style-card/index.js +74 -0
- package/dist/esm/style-card/style.scss +94 -0
- package/dist/esm/style.scss +55 -0
- package/dist/esm/tabbed-navigation/index.js +53 -0
- package/dist/esm/tabbed-navigation/style.scss +86 -0
- package/dist/esm/text-control/style.scss +32 -0
- package/dist/esm/utils/index.js +29 -0
- package/dist/esm/waiting/index.js +44 -0
- package/dist/esm/waiting/style.scss +27 -0
- package/dist/esm/web-preview/index.js +183 -0
- package/dist/esm/web-preview/style.scss +155 -0
- package/dist/esm/with-wizard/index.js +320 -0
- package/dist/esm/with-wizard/style.scss +282 -0
- package/dist/esm/with-wizard-screen/index.js +109 -0
- package/dist/esm/with-wizard-screen/style.scss +160 -0
- package/dist/esm/wizard/components/WizardError.js +66 -0
- package/dist/esm/wizard/index.js +119 -0
- package/dist/esm/wizard/store/index.js +155 -0
- package/dist/esm/wizard/store/utils.js +14 -0
- package/package.json +7 -4
- package/dist/button/index.js +0 -51
- package/dist/button/index.tsx +0 -48
- package/dist/grid/index.js +0 -44
- package/dist/grid/index.tsx +0 -34
- package/dist/hooks/index.js +0 -29
- package/dist/hooks/index.ts +0 -15
- package/dist/hooks/usePrompt.js +0 -47
- package/dist/hooks/usePrompt.ts +0 -46
- package/dist/plugin-toggle/README.md +0 -53
- package/dist/text-control/index.js +0 -76
- package/dist/text-control/index.tsx +0 -71
- /package/dist/{accordion → cjs/accordion}/index.js +0 -0
- /package/dist/{accordion → cjs/accordion}/style.scss +0 -0
- /package/dist/{action-card → cjs/action-card}/index.js +0 -0
- /package/dist/{action-card → cjs/action-card}/style.scss +0 -0
- /package/dist/{autocomplete-tokenfield → cjs/autocomplete-tokenfield}/index.js +0 -0
- /package/dist/{autocomplete-tokenfield → cjs/autocomplete-tokenfield}/style.scss +0 -0
- /package/dist/{autocomplete-with-suggestions → cjs/autocomplete-with-suggestions}/index.js +0 -0
- /package/dist/{autocomplete-with-suggestions → cjs/autocomplete-with-suggestions}/style.scss +0 -0
- /package/dist/{button → cjs/button}/style.scss +0 -0
- /package/dist/{button-card → cjs/button-card}/index.js +0 -0
- /package/dist/{button-card → cjs/button-card}/style.scss +0 -0
- /package/dist/{card → cjs/card}/index.js +0 -0
- /package/dist/{card → cjs/card}/style.scss +0 -0
- /package/dist/{category-autocomplete → cjs/category-autocomplete}/index.js +0 -0
- /package/dist/{category-autocomplete → cjs/category-autocomplete}/style.scss +0 -0
- /package/dist/{color-picker → cjs/color-picker}/index.js +0 -0
- /package/dist/{color-picker → cjs/color-picker}/style.scss +0 -0
- /package/dist/{consts.js → cjs/consts.js} +0 -0
- /package/dist/{custom-select-control → cjs/custom-select-control}/index.js +0 -0
- /package/dist/{custom-select-control → cjs/custom-select-control}/style.scss +0 -0
- /package/dist/{date-range-picker → cjs/date-range-picker}/index.js +0 -0
- /package/dist/{date-range-picker → cjs/date-range-picker}/style.scss +0 -0
- /package/dist/{footer → cjs/footer}/index.js +0 -0
- /package/dist/{footer → cjs/footer}/style.scss +0 -0
- /package/dist/{form-token-field → cjs/form-token-field}/index.js +0 -0
- /package/dist/{form-token-field → cjs/form-token-field}/style.scss +0 -0
- /package/dist/{global-notices → cjs/global-notices}/index.js +0 -0
- /package/dist/{grid → cjs/grid}/style.scss +0 -0
- /package/dist/{handoff → cjs/handoff}/index.js +0 -0
- /package/dist/{handoff-message → cjs/handoff-message}/index.js +0 -0
- /package/dist/{hooks → cjs/hooks}/useObjectState.js +0 -0
- /package/dist/{hooks → cjs/hooks}/useObjectState.test.js +0 -0
- /package/dist/{hooks → cjs/hooks}/useOnClickOutside.js +0 -0
- /package/dist/{image-upload → cjs/image-upload}/index.js +0 -0
- /package/dist/{image-upload → cjs/image-upload}/index.test.js +0 -0
- /package/dist/{image-upload → cjs/image-upload}/style.scss +0 -0
- /package/dist/{index.js → cjs/index.js} +0 -0
- /package/dist/{info-button → cjs/info-button}/index.js +0 -0
- /package/dist/{info-button → cjs/info-button}/style.scss +0 -0
- /package/dist/{modal → cjs/modal}/index.js +0 -0
- /package/dist/{modal → cjs/modal}/style.scss +0 -0
- /package/dist/{newspack-icon → cjs/newspack-icon}/index.js +0 -0
- /package/dist/{newspack-icon → cjs/newspack-icon}/style.scss +0 -0
- /package/dist/{newspack-logo → cjs/newspack-logo}/index.js +0 -0
- /package/dist/{newspack-logo → cjs/newspack-logo}/style.scss +0 -0
- /package/dist/{notice → cjs/notice}/index.js +0 -0
- /package/dist/{notice → cjs/notice}/style.scss +0 -0
- /package/dist/{patrons-logo → cjs/patrons-logo}/index.js +0 -0
- /package/dist/{plugin-installer → cjs/plugin-installer}/index.js +0 -0
- /package/dist/{plugin-installer → cjs/plugin-installer}/style.scss +0 -0
- /package/dist/{plugin-settings → cjs/plugin-settings}/SettingsSection.js +0 -0
- /package/dist/{plugin-settings → cjs/plugin-settings}/index.js +0 -0
- /package/dist/{plugin-settings → cjs/plugin-settings}/style.scss +0 -0
- /package/dist/{plugin-toggle → cjs/plugin-toggle}/index.js +0 -0
- /package/dist/{plugin-toggle → cjs/plugin-toggle}/style.scss +0 -0
- /package/dist/{popover → cjs/popover}/index.js +0 -0
- /package/dist/{popover → cjs/popover}/style.scss +0 -0
- /package/dist/{position-control → cjs/position-control}/index.js +0 -0
- /package/dist/{position-control → cjs/position-control}/style.scss +0 -0
- /package/dist/{progress-bar → cjs/progress-bar}/index.js +0 -0
- /package/dist/{progress-bar → cjs/progress-bar}/index.test.js +0 -0
- /package/dist/{progress-bar → cjs/progress-bar}/style.scss +0 -0
- /package/dist/{proxied-imports → cjs/proxied-imports}/router.js +0 -0
- /package/dist/{radio-control → cjs/radio-control}/index.js +0 -0
- /package/dist/{radio-control → cjs/radio-control}/style.scss +0 -0
- /package/dist/{section-header → cjs/section-header}/index.js +0 -0
- /package/dist/{section-header → cjs/section-header}/style.scss +0 -0
- /package/dist/{select-control → cjs/select-control}/ButtonGroupControl.js +0 -0
- /package/dist/{select-control → cjs/select-control}/GroupedSelectControl.js +0 -0
- /package/dist/{select-control → cjs/select-control}/index.js +0 -0
- /package/dist/{select-control → cjs/select-control}/style.scss +0 -0
- /package/dist/{settings → cjs/settings}/MinMaxSetting.js +0 -0
- /package/dist/{settings → cjs/settings}/SettingsCard.js +0 -0
- /package/dist/{settings → cjs/settings}/SettingsSection.js +0 -0
- /package/dist/{settings → cjs/settings}/index.js +0 -0
- /package/dist/{settings → cjs/settings}/style.scss +0 -0
- /package/dist/{sortable-newsletter-list-control → cjs/sortable-newsletter-list-control}/index.js +0 -0
- /package/dist/{sortable-newsletter-list-control → cjs/sortable-newsletter-list-control}/style.scss +0 -0
- /package/dist/{steps-list → cjs/steps-list}/index.js +0 -0
- /package/dist/{steps-list → cjs/steps-list}/style.scss +0 -0
- /package/dist/{steps-list-item → cjs/steps-list-item}/index.js +0 -0
- /package/dist/{steps-list-item → cjs/steps-list-item}/style.scss +0 -0
- /package/dist/{style-card → cjs/style-card}/index.js +0 -0
- /package/dist/{style-card → cjs/style-card}/style.scss +0 -0
- /package/dist/{style.scss → cjs/style.scss} +0 -0
- /package/dist/{tabbed-navigation → cjs/tabbed-navigation}/index.js +0 -0
- /package/dist/{tabbed-navigation → cjs/tabbed-navigation}/style.scss +0 -0
- /package/dist/{text-control → cjs/text-control}/style.scss +0 -0
- /package/dist/{utils → cjs/utils}/index.js +0 -0
- /package/dist/{waiting → cjs/waiting}/index.js +0 -0
- /package/dist/{waiting → cjs/waiting}/style.scss +0 -0
- /package/dist/{web-preview → cjs/web-preview}/index.js +0 -0
- /package/dist/{web-preview → cjs/web-preview}/style.scss +0 -0
- /package/dist/{with-wizard → cjs/with-wizard}/index.js +0 -0
- /package/dist/{with-wizard → cjs/with-wizard}/style.scss +0 -0
- /package/dist/{with-wizard-screen → cjs/with-wizard-screen}/index.js +0 -0
- /package/dist/{with-wizard-screen → cjs/with-wizard-screen}/style.scss +0 -0
- /package/dist/{wizard → cjs/wizard}/components/WizardError.js +0 -0
- /package/dist/{wizard → cjs/wizard}/index.js +0 -0
- /package/dist/{wizard → cjs/wizard}/store/index.js +0 -0
- /package/dist/{wizard → cjs/wizard}/store/utils.js +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { BaseControl } from '@wordpress/components';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { Icon, chevronDown } from '@wordpress/icons';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* External dependencies
|
|
10
|
+
*/
|
|
11
|
+
import classnames from 'classnames';
|
|
12
|
+
import find from 'lodash/find';
|
|
13
|
+
import some from 'lodash/some';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
import { hooks } from '..';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* SelectControl with optgroup support
|
|
22
|
+
*/
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
export default function GroupedSelectControl({
|
|
25
|
+
help,
|
|
26
|
+
label,
|
|
27
|
+
onChange,
|
|
28
|
+
optgroups = [],
|
|
29
|
+
className,
|
|
30
|
+
hideLabelFromVision,
|
|
31
|
+
...props
|
|
32
|
+
}) {
|
|
33
|
+
const onChangeValue = event => {
|
|
34
|
+
const {
|
|
35
|
+
value
|
|
36
|
+
} = event.target;
|
|
37
|
+
const optgroup = find(optgroups, group => some(group.options, ['value', value]));
|
|
38
|
+
onChange(value, optgroup);
|
|
39
|
+
};
|
|
40
|
+
const id = hooks.useUniqueId('group-select');
|
|
41
|
+
return /*#__PURE__*/_jsx(BaseControl, {
|
|
42
|
+
label: label,
|
|
43
|
+
hideLabelFromVision: hideLabelFromVision,
|
|
44
|
+
id: id,
|
|
45
|
+
help: help,
|
|
46
|
+
className: classnames(className, 'components-select-control'),
|
|
47
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
48
|
+
className: "relative",
|
|
49
|
+
children: [/*#__PURE__*/_jsxs("select", {
|
|
50
|
+
id: id,
|
|
51
|
+
className: "components-select-control__input",
|
|
52
|
+
onChange: onChangeValue,
|
|
53
|
+
"aria-describedby": !!help ? `${id}__help` : undefined,
|
|
54
|
+
...props,
|
|
55
|
+
children: [/*#__PURE__*/_jsx("option", {
|
|
56
|
+
value: "",
|
|
57
|
+
children: __('-- Select --', 'newspack-plugin')
|
|
58
|
+
}), optgroups.map(({
|
|
59
|
+
label: optgroupLabel,
|
|
60
|
+
options
|
|
61
|
+
}, optgroupIndex) => /*#__PURE__*/_jsx("optgroup", {
|
|
62
|
+
label: optgroupLabel,
|
|
63
|
+
children: options.map((option, optionIndex) => /*#__PURE__*/_jsx("option", {
|
|
64
|
+
value: option.value,
|
|
65
|
+
disabled: option.disabled,
|
|
66
|
+
children: option.label
|
|
67
|
+
}, `${option.label}-${option.value}-${optionIndex}`))
|
|
68
|
+
}, optgroupIndex))]
|
|
69
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
70
|
+
className: "components-select-control__arrow-wrapper",
|
|
71
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
72
|
+
icon: chevronDown,
|
|
73
|
+
size: 18
|
|
74
|
+
})
|
|
75
|
+
})]
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Select Control
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* WordPress dependencies
|
|
7
|
+
*/
|
|
8
|
+
import { SelectControl as BaseComponent } from '@wordpress/components';
|
|
9
|
+
import { Component } from '@wordpress/element';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* External dependencies
|
|
13
|
+
*/
|
|
14
|
+
import classNames from 'classnames';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
import './style.scss';
|
|
20
|
+
import GroupedSelectControl from './GroupedSelectControl';
|
|
21
|
+
import ButtonGroupControl from './ButtonGroupControl';
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
class SelectControl extends Component {
|
|
24
|
+
/**
|
|
25
|
+
* Render.
|
|
26
|
+
*/
|
|
27
|
+
render() {
|
|
28
|
+
const {
|
|
29
|
+
className,
|
|
30
|
+
optgroups,
|
|
31
|
+
buttonOptions,
|
|
32
|
+
buttonSmall,
|
|
33
|
+
...otherProps
|
|
34
|
+
} = this.props;
|
|
35
|
+
const classes = classNames('newspack-select-control', optgroups && 'newspack-grouped-select-control', buttonOptions && 'newspack-buttons-select-control', className);
|
|
36
|
+
return /*#__PURE__*/_jsx("div", {
|
|
37
|
+
className: classes,
|
|
38
|
+
children: optgroups ? /*#__PURE__*/_jsx(GroupedSelectControl, {
|
|
39
|
+
optgroups: optgroups,
|
|
40
|
+
...otherProps
|
|
41
|
+
}) : buttonOptions ? /*#__PURE__*/_jsx(ButtonGroupControl, {
|
|
42
|
+
buttonOptions: buttonOptions,
|
|
43
|
+
buttonSmall: buttonSmall,
|
|
44
|
+
...otherProps
|
|
45
|
+
}) : /*#__PURE__*/_jsx(BaseComponent, {
|
|
46
|
+
...otherProps
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export default SelectControl;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Select Control
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
@use "~@wordpress/base-styles/colors" as wp-colors;
|
|
6
|
+
|
|
7
|
+
.components-select-control {
|
|
8
|
+
&__input {
|
|
9
|
+
max-width: 100% !important;
|
|
10
|
+
|
|
11
|
+
&[multiple] {
|
|
12
|
+
height: auto !important;
|
|
13
|
+
min-height: 70px !important;
|
|
14
|
+
padding: 0 !important;
|
|
15
|
+
|
|
16
|
+
+ .components-input-control__suffix {
|
|
17
|
+
display: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
option {
|
|
21
|
+
min-height: 1.4em;
|
|
22
|
+
padding: 8px;
|
|
23
|
+
|
|
24
|
+
&:checked {
|
|
25
|
+
background: var(--wp-admin-theme-color);
|
|
26
|
+
color: white;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.components-base-control__field {
|
|
33
|
+
width: 100%;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.components-input-control__label {
|
|
37
|
+
line-height: inherit;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Grouped
|
|
42
|
+
|
|
43
|
+
.newspack-grouped-select-control {
|
|
44
|
+
position: relative;
|
|
45
|
+
|
|
46
|
+
.components-select-control {
|
|
47
|
+
&__input {
|
|
48
|
+
appearance: none;
|
|
49
|
+
background: transparent;
|
|
50
|
+
border: 1px solid wp-colors.$gray-700;
|
|
51
|
+
border-radius: 2px;
|
|
52
|
+
box-shadow: none !important;
|
|
53
|
+
box-sizing: border-box;
|
|
54
|
+
display: block;
|
|
55
|
+
font-size: inherit;
|
|
56
|
+
margin: 0;
|
|
57
|
+
max-width: 100%;
|
|
58
|
+
outline: none;
|
|
59
|
+
padding: 0 24px 0 7px;
|
|
60
|
+
width: 100%;
|
|
61
|
+
|
|
62
|
+
&:hover {
|
|
63
|
+
color: inherit;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:focus {
|
|
67
|
+
border-color: var(--wp-admin-theme-color-darker-10) !important;
|
|
68
|
+
box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color-darker-10) !important;
|
|
69
|
+
color: inherit;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&__arrow-wrapper {
|
|
74
|
+
align-items: center;
|
|
75
|
+
display: flex;
|
|
76
|
+
height: 24px;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
margin-top: -12px;
|
|
79
|
+
position: absolute;
|
|
80
|
+
right: 1px;
|
|
81
|
+
top: 50%;
|
|
82
|
+
width: 24px;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Buttons
|
|
88
|
+
|
|
89
|
+
.newspack-buttons-select-control {
|
|
90
|
+
.components-base-control__label {
|
|
91
|
+
display: inline-flex;
|
|
92
|
+
margin-bottom: 8px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.components-button-group {
|
|
96
|
+
display: flex;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&.icon-only {
|
|
100
|
+
.components-button {
|
|
101
|
+
align-items: center;
|
|
102
|
+
height: 36px;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
padding: 0 !important;
|
|
105
|
+
width: 36px;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies.
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { CheckboxControl } from '@wordpress/components';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies.
|
|
9
|
+
*/
|
|
10
|
+
import { TextControl } from '../';
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
const MinMaxSetting = ({
|
|
13
|
+
min,
|
|
14
|
+
max,
|
|
15
|
+
onChangeMin,
|
|
16
|
+
onChangeMax,
|
|
17
|
+
minPlaceholder,
|
|
18
|
+
maxPlaceholder,
|
|
19
|
+
...props
|
|
20
|
+
}) => {
|
|
21
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
22
|
+
...props,
|
|
23
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
24
|
+
className: "newspack-settings__min-max",
|
|
25
|
+
children: [/*#__PURE__*/_jsx(CheckboxControl, {
|
|
26
|
+
checked: min > 0,
|
|
27
|
+
onChange: value => onChangeMin(value ? 1 : 0),
|
|
28
|
+
label: __('Min', 'newspack-plugin')
|
|
29
|
+
}), /*#__PURE__*/_jsx(TextControl, {
|
|
30
|
+
"data-testid": "min",
|
|
31
|
+
type: "number",
|
|
32
|
+
value: min,
|
|
33
|
+
placeholder: minPlaceholder,
|
|
34
|
+
onChange: value => onChangeMin(value > 0 ? value : 0)
|
|
35
|
+
})]
|
|
36
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
37
|
+
className: "newspack-settings__min-max",
|
|
38
|
+
"data-testid": "max",
|
|
39
|
+
children: [/*#__PURE__*/_jsx(CheckboxControl, {
|
|
40
|
+
checked: max > 0,
|
|
41
|
+
onChange: value => onChangeMax(value ? min || 1 : 0),
|
|
42
|
+
label: __('Max', 'newspack-plugin')
|
|
43
|
+
}), /*#__PURE__*/_jsx(TextControl, {
|
|
44
|
+
"data-testid": "max",
|
|
45
|
+
type: "number",
|
|
46
|
+
value: max,
|
|
47
|
+
placeholder: maxPlaceholder,
|
|
48
|
+
onChange: value => onChangeMax(value > 0 ? value : 0)
|
|
49
|
+
})]
|
|
50
|
+
})]
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
export default MinMaxSetting;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies.
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies.
|
|
8
|
+
*/
|
|
9
|
+
import { Grid, ActionCard } from '../';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
const SettingsCard = ({
|
|
12
|
+
children,
|
|
13
|
+
className,
|
|
14
|
+
columns,
|
|
15
|
+
gutter,
|
|
16
|
+
noBorder,
|
|
17
|
+
rowGap,
|
|
18
|
+
...props
|
|
19
|
+
}) => {
|
|
20
|
+
const classes = classnames('newspack-settings__card', noBorder && 'newspack-settings__no-border', className);
|
|
21
|
+
return /*#__PURE__*/_jsx(ActionCard, {
|
|
22
|
+
...props,
|
|
23
|
+
className: classes,
|
|
24
|
+
notificationLevel: "info",
|
|
25
|
+
noBorder: noBorder,
|
|
26
|
+
children: /*#__PURE__*/_jsx(Grid, {
|
|
27
|
+
columns: columns,
|
|
28
|
+
gutter: gutter,
|
|
29
|
+
rowGap: rowGap,
|
|
30
|
+
children: children
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
SettingsCard.defaultProps = {
|
|
35
|
+
columns: 3,
|
|
36
|
+
gutter: 32
|
|
37
|
+
};
|
|
38
|
+
export default SettingsCard;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies.
|
|
3
|
+
*/
|
|
4
|
+
import { Grid, InfoButton } from '../';
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
const SettingSection = ({
|
|
7
|
+
title,
|
|
8
|
+
description,
|
|
9
|
+
children
|
|
10
|
+
}) => /*#__PURE__*/_jsxs(Grid, {
|
|
11
|
+
columns: 1,
|
|
12
|
+
gutter: 8,
|
|
13
|
+
className: "newspack-settings__section",
|
|
14
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
15
|
+
className: "newspack-settings__section__title",
|
|
16
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
17
|
+
children: title
|
|
18
|
+
}), description && /*#__PURE__*/_jsx(InfoButton, {
|
|
19
|
+
text: description
|
|
20
|
+
})]
|
|
21
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
22
|
+
className: "newspack-settings__section__content",
|
|
23
|
+
children: children
|
|
24
|
+
})]
|
|
25
|
+
});
|
|
26
|
+
export default SettingSection;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
.newspack-settings {
|
|
2
|
+
&__card {
|
|
3
|
+
&.newspack-card.newspack-action-card {
|
|
4
|
+
.newspack-action-card__region-top {
|
|
5
|
+
padding: 32px 32px 16px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.newspack-action-card__region-children {
|
|
9
|
+
padding: 0 32px 32px;
|
|
10
|
+
|
|
11
|
+
> .newspack-grid {
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.newspack-action-card__notification {
|
|
17
|
+
padding-bottom: 16px;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.newspack-form-token-field {
|
|
22
|
+
margin: 0;
|
|
23
|
+
|
|
24
|
+
.components-form-token-field {
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.newspack-settings__section {
|
|
30
|
+
&__title {
|
|
31
|
+
align-items: center;
|
|
32
|
+
display: flex;
|
|
33
|
+
margin: 0;
|
|
34
|
+
|
|
35
|
+
span {
|
|
36
|
+
line-height: 24px;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
&__content {
|
|
40
|
+
> div,
|
|
41
|
+
.newspack-settings__min-max {
|
|
42
|
+
margin: 0;
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: space-between;
|
|
46
|
+
flex-wrap: wrap;
|
|
47
|
+
> *:not([class*="help"], [class*="label"]) {
|
|
48
|
+
margin: 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
.newspack-autocomplete-tokenfield,
|
|
52
|
+
.newspack-settings__min-max {
|
|
53
|
+
width: 100%;
|
|
54
|
+
}
|
|
55
|
+
.newspack-autocomplete-tokenfield {
|
|
56
|
+
display: block;
|
|
57
|
+
margin: 0;
|
|
58
|
+
|
|
59
|
+
label:empty {
|
|
60
|
+
display: none;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
.newspack-text-control,
|
|
64
|
+
.newspack-checkbox-control {
|
|
65
|
+
margin: 0 !important;
|
|
66
|
+
}
|
|
67
|
+
.newspack-select-control {
|
|
68
|
+
.components-base-control {
|
|
69
|
+
width: 100%;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
.newspack-settings__min-max {
|
|
75
|
+
gap: 8px;
|
|
76
|
+
|
|
77
|
+
.newspack-checkbox-control {
|
|
78
|
+
flex: 0 0 auto;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.newspack-text-control {
|
|
82
|
+
flex: 1 1 auto;
|
|
83
|
+
|
|
84
|
+
.components-text-control__input {
|
|
85
|
+
text-align: right;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
+ .newspack-settings__min-max {
|
|
90
|
+
margin-top: 16px !important;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&__no-border {
|
|
96
|
+
&.newspack-card.newspack-action-card {
|
|
97
|
+
border: 0;
|
|
98
|
+
|
|
99
|
+
.newspack-action-card__region-top,
|
|
100
|
+
.newspack-action-card__region-children {
|
|
101
|
+
padding-left: 0;
|
|
102
|
+
padding-right: 0;
|
|
103
|
+
padding-top: 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.newspack-action-card__region-children {
|
|
107
|
+
padding-bottom: 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.newspack-action-card__notification {
|
|
111
|
+
padding-bottom: 16px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
& + & {
|
|
115
|
+
margin-top: 64px;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Icon, chevronUp, chevronDown, trash } from '@wordpress/icons';
|
|
5
|
+
import { Notice } from '@wordpress/components';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import ActionCard from '../action-card';
|
|
12
|
+
import Button from '../button';
|
|
13
|
+
import './style.scss';
|
|
14
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
export default function SortableNewsletterListControl({
|
|
16
|
+
lists,
|
|
17
|
+
selected = [],
|
|
18
|
+
onChange = () => {}
|
|
19
|
+
}) {
|
|
20
|
+
if (!Array.isArray(lists) && lists.errors) {
|
|
21
|
+
return /*#__PURE__*/_jsx(Notice, {
|
|
22
|
+
status: "error",
|
|
23
|
+
isDismissible: false,
|
|
24
|
+
children: Object.values(lists.errors).join(', ')
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
const getList = id => lists.find(list => list.id === id);
|
|
28
|
+
const getAvailableLists = () => {
|
|
29
|
+
return lists.filter(list => list.active && !selected.find(({
|
|
30
|
+
id
|
|
31
|
+
}) => id === list.id));
|
|
32
|
+
};
|
|
33
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
34
|
+
className: "newspack__newsletter-list-control",
|
|
35
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
36
|
+
className: "newspack__newsletter-list-control__selected",
|
|
37
|
+
children: selected.map(selectedList => {
|
|
38
|
+
const list = getList(selectedList.id);
|
|
39
|
+
if (!list) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return /*#__PURE__*/_jsx(ActionCard, {
|
|
43
|
+
title: list.name,
|
|
44
|
+
description: () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
45
|
+
children: [/*#__PURE__*/_jsx("input", {
|
|
46
|
+
type: "checkbox",
|
|
47
|
+
checked: selectedList.checked,
|
|
48
|
+
onChange: () => {
|
|
49
|
+
const index = selected.findIndex(({
|
|
50
|
+
id
|
|
51
|
+
}) => id === selectedList.id);
|
|
52
|
+
const newSelected = [...selected];
|
|
53
|
+
newSelected[index].checked = !newSelected[index].checked;
|
|
54
|
+
onChange(newSelected);
|
|
55
|
+
}
|
|
56
|
+
}), __('Checked by default', 'newspack-plugin')]
|
|
57
|
+
}),
|
|
58
|
+
isSmall: true,
|
|
59
|
+
actionText: /*#__PURE__*/_jsx(_Fragment, {
|
|
60
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
61
|
+
onClick: () => onChange(selected.filter(({
|
|
62
|
+
id
|
|
63
|
+
}) => id !== selectedList.id)),
|
|
64
|
+
label: __('Remove', 'newspack-plugin'),
|
|
65
|
+
icon: trash
|
|
66
|
+
})
|
|
67
|
+
}),
|
|
68
|
+
children: selected.length > 1 && /*#__PURE__*/_jsxs("span", {
|
|
69
|
+
className: "newspack__newsletter-list-control__sort-handle",
|
|
70
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
71
|
+
onClick: () => {
|
|
72
|
+
const index = selected.findIndex(({
|
|
73
|
+
id
|
|
74
|
+
}) => id === selectedList.id);
|
|
75
|
+
if (index === 0) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const newSelected = [...selected];
|
|
79
|
+
newSelected.splice(index, 1);
|
|
80
|
+
newSelected.splice(index - 1, 0, selectedList);
|
|
81
|
+
onChange(newSelected);
|
|
82
|
+
},
|
|
83
|
+
className: selected.findIndex(({
|
|
84
|
+
id
|
|
85
|
+
}) => id === selectedList.id) === 0 ? 'disabled' : '',
|
|
86
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
87
|
+
icon: chevronUp
|
|
88
|
+
})
|
|
89
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
90
|
+
onClick: () => {
|
|
91
|
+
const index = selected.findIndex(({
|
|
92
|
+
id
|
|
93
|
+
}) => id === selectedList.id);
|
|
94
|
+
const newSelected = [...selected];
|
|
95
|
+
newSelected.splice(index, 1);
|
|
96
|
+
newSelected.splice(index + 1, 0, selectedList);
|
|
97
|
+
onChange(newSelected);
|
|
98
|
+
},
|
|
99
|
+
className: selected.findIndex(({
|
|
100
|
+
id
|
|
101
|
+
}) => id === selectedList.id) === selected.length - 1 ? 'disabled' : '',
|
|
102
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
103
|
+
icon: chevronDown
|
|
104
|
+
})
|
|
105
|
+
})]
|
|
106
|
+
})
|
|
107
|
+
}, `selected-${selectedList.id}`);
|
|
108
|
+
})
|
|
109
|
+
}), getAvailableLists().length > 0 && /*#__PURE__*/_jsxs("p", {
|
|
110
|
+
className: "newspack__newsletter-list-control__lists",
|
|
111
|
+
children: [selected.length > 0 ? /*#__PURE__*/_jsx("strong", {
|
|
112
|
+
children: __('Add more lists:', 'newspack-plugin')
|
|
113
|
+
}) : /*#__PURE__*/_jsx("strong", {
|
|
114
|
+
children: __('Select lists:', 'newspack-plugin')
|
|
115
|
+
}), ' ', getAvailableLists().map(list => {
|
|
116
|
+
return /*#__PURE__*/_jsx(Button, {
|
|
117
|
+
variant: "secondary",
|
|
118
|
+
onClick: () => onChange([...selected, {
|
|
119
|
+
id: list.id,
|
|
120
|
+
checked: true
|
|
121
|
+
}]),
|
|
122
|
+
children: list.name
|
|
123
|
+
}, list.id);
|
|
124
|
+
})]
|
|
125
|
+
})]
|
|
126
|
+
});
|
|
127
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.newspack__newsletter-list-control {
|
|
2
|
+
&__selected {
|
|
3
|
+
.newspack-card {
|
|
4
|
+
display: flex;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
min-height: 40px;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
.newspack-action-card__region {
|
|
9
|
+
align-items: center;
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
.newspack-action-card__region-top {
|
|
15
|
+
flex: 1;
|
|
16
|
+
order: 2;
|
|
17
|
+
}
|
|
18
|
+
.newspack-action-card__region-children {
|
|
19
|
+
padding: 12px;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
&__sort-handle {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
align-items: center;
|
|
28
|
+
button {
|
|
29
|
+
background: transparent;
|
|
30
|
+
border: none;
|
|
31
|
+
margin: 0;
|
|
32
|
+
padding: 0;
|
|
33
|
+
height: 20px;
|
|
34
|
+
&.disabled {
|
|
35
|
+
cursor: default;
|
|
36
|
+
opacity: 0.3;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
&__lists {
|
|
41
|
+
button {
|
|
42
|
+
margin-right: 0.5rem;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
class StepsList extends Component {
|
|
22
|
+
/**
|
|
23
|
+
* Render
|
|
24
|
+
*/
|
|
25
|
+
render() {
|
|
26
|
+
const {
|
|
27
|
+
className,
|
|
28
|
+
stepsListItems,
|
|
29
|
+
narrowList,
|
|
30
|
+
style = {}
|
|
31
|
+
} = this.props;
|
|
32
|
+
const classes = classnames('steps-list', className, narrowList && 'steps-list__narrow-list');
|
|
33
|
+
return /*#__PURE__*/_jsx("div", {
|
|
34
|
+
className: classes,
|
|
35
|
+
style: style,
|
|
36
|
+
children: stepsListItems.map((listItem, index) => /*#__PURE__*/_jsx(StepsListItem, {
|
|
37
|
+
listItemCount: index + 1,
|
|
38
|
+
listItemText: listItem
|
|
39
|
+
}, index))
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export default StepsList;
|