newspack-components 2.0.3 → 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/copy-styles.js +1 -1
- package/dist/cjs/accordion/index.js +46 -0
- package/dist/cjs/accordion/style.scss +27 -0
- package/dist/cjs/action-card/index.js +72 -40
- package/dist/cjs/action-card/style.scss +143 -41
- package/dist/cjs/autocomplete-tokenfield/index.js +13 -41
- package/dist/cjs/autocomplete-tokenfield/style.scss +6 -6
- package/dist/cjs/autocomplete-with-suggestions/index.js +33 -53
- package/dist/cjs/autocomplete-with-suggestions/style.scss +27 -27
- package/dist/cjs/button/index.js +1 -20
- package/dist/cjs/button/style.scss +3 -344
- package/dist/cjs/button-card/index.js +11 -15
- package/dist/cjs/button-card/style.scss +65 -35
- package/dist/cjs/card/index.js +4 -9
- package/dist/cjs/card/style.scss +47 -63
- package/dist/cjs/category-autocomplete/index.js +66 -47
- package/dist/cjs/category-autocomplete/style.scss +20 -24
- package/dist/cjs/color-picker/index.js +16 -48
- package/dist/cjs/color-picker/style.scss +20 -163
- 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 +14 -45
- 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 +24 -22
- package/dist/cjs/footer/style.scss +13 -14
- package/dist/cjs/form-token-field/index.js +3 -11
- package/dist/cjs/form-token-field/style.scss +9 -105
- package/dist/cjs/global-notices/index.js +3 -9
- package/dist/cjs/grid/index.js +1 -8
- package/dist/cjs/grid/style.scss +19 -6
- package/dist/cjs/handoff/index.js +15 -24
- 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 +22 -20
- package/dist/cjs/image-upload/index.test.js +0 -5
- package/dist/cjs/image-upload/style.scss +12 -17
- package/dist/cjs/index.js +31 -93
- 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 -12
- package/dist/cjs/modal/style.scss +20 -132
- package/dist/cjs/newspack-icon/index.js +5 -11
- package/dist/cjs/newspack-icon/style.scss +17 -2
- 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 -16
- package/dist/cjs/notice/style.scss +60 -19
- package/dist/cjs/patrons-logo/index.js +3 -11
- package/dist/cjs/plugin-installer/index.js +37 -37
- package/dist/cjs/plugin-installer/style.scss +5 -5
- package/dist/cjs/plugin-settings/SettingsSection.js +71 -59
- package/dist/cjs/plugin-settings/index.js +71 -50
- package/dist/cjs/plugin-settings/style.scss +7 -0
- package/dist/cjs/plugin-toggle/index.js +60 -32
- package/dist/cjs/plugin-toggle/style.scss +2 -2
- package/dist/cjs/popover/index.js +1 -11
- package/dist/cjs/popover/style.scss +20 -17
- 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 +10 -11
- package/dist/cjs/section-header/index.js +47 -19
- package/dist/cjs/section-header/style.scss +22 -1
- package/dist/cjs/select-control/ButtonGroupControl.js +11 -20
- package/dist/cjs/select-control/GroupedSelectControl.js +42 -45
- package/dist/cjs/select-control/index.js +6 -14
- package/dist/cjs/select-control/style.scss +47 -88
- package/dist/cjs/settings/MinMaxSetting.js +6 -8
- package/dist/cjs/settings/SettingsCard.js +9 -8
- package/dist/cjs/settings/SettingsSection.js +5 -8
- package/dist/cjs/settings/index.js +0 -6
- package/dist/cjs/settings/style.scss +32 -4
- 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 +15 -18
- package/dist/cjs/style-card/style.scss +19 -18
- package/dist/cjs/style.scss +43 -0
- package/dist/cjs/tabbed-navigation/index.js +27 -31
- package/dist/cjs/tabbed-navigation/style.scss +58 -37
- package/dist/cjs/text-control/index.js +6 -19
- package/dist/cjs/text-control/style.scss +0 -126
- package/dist/cjs/utils/index.js +10 -5
- package/dist/cjs/waiting/index.js +9 -33
- package/dist/cjs/waiting/style.scss +9 -20
- package/dist/cjs/web-preview/index.js +30 -57
- package/dist/cjs/web-preview/style.scss +41 -34
- package/dist/cjs/with-wizard/index.js +55 -33
- package/dist/cjs/with-wizard/style.scss +77 -124
- package/dist/cjs/with-wizard-screen/index.js +28 -38
- package/dist/cjs/with-wizard-screen/style.scss +75 -125
- package/dist/cjs/wizard/components/WizardError.js +74 -0
- package/dist/cjs/wizard/index.js +131 -0
- package/dist/cjs/wizard/store/index.js +165 -0
- package/dist/cjs/wizard/store/utils.js +26 -0
- 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 +75 -37
- package/dist/esm/action-card/style.scss +143 -41
- package/dist/esm/autocomplete-tokenfield/index.js +14 -37
- package/dist/esm/autocomplete-tokenfield/style.scss +6 -6
- package/dist/esm/autocomplete-with-suggestions/index.js +31 -43
- package/dist/esm/autocomplete-with-suggestions/style.scss +27 -27
- package/dist/esm/button/index.js +2 -14
- package/dist/esm/button/style.scss +3 -344
- package/dist/esm/button-card/index.js +12 -11
- package/dist/esm/button-card/style.scss +65 -35
- package/dist/esm/card/index.js +5 -6
- package/dist/esm/card/style.scss +47 -63
- package/dist/esm/category-autocomplete/index.js +68 -41
- package/dist/esm/category-autocomplete/style.scss +20 -24
- package/dist/esm/color-picker/index.js +17 -38
- package/dist/esm/color-picker/style.scss +20 -163
- 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 +14 -45
- 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 +22 -16
- package/dist/esm/footer/style.scss +13 -14
- package/dist/esm/form-token-field/index.js +4 -7
- package/dist/esm/form-token-field/style.scss +9 -105
- package/dist/esm/global-notices/index.js +3 -7
- package/dist/esm/grid/index.js +2 -5
- package/dist/esm/grid/style.scss +19 -6
- package/dist/esm/handoff/index.js +10 -21
- 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 +18 -17
- package/dist/esm/image-upload/style.scss +12 -17
- package/dist/esm/index.js +7 -8
- 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 -8
- package/dist/esm/modal/style.scss +20 -132
- package/dist/esm/newspack-icon/index.js +6 -7
- package/dist/esm/newspack-icon/style.scss +17 -2
- package/dist/esm/newspack-logo/index.js +2 -5
- package/dist/esm/newspack-logo/style.scss +3 -3
- package/dist/esm/notice/index.js +11 -10
- package/dist/esm/notice/style.scss +60 -19
- package/dist/esm/patrons-logo/index.js +3 -5
- package/dist/esm/plugin-installer/index.js +37 -40
- package/dist/esm/plugin-installer/style.scss +5 -5
- package/dist/esm/plugin-settings/SettingsSection.js +71 -56
- package/dist/esm/plugin-settings/index.js +70 -52
- package/dist/esm/plugin-settings/style.scss +7 -0
- package/dist/esm/plugin-toggle/index.js +59 -34
- package/dist/esm/plugin-toggle/style.scss +2 -2
- package/dist/esm/popover/index.js +3 -6
- package/dist/esm/popover/style.scss +20 -17
- 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 +10 -11
- package/dist/esm/section-header/index.js +47 -16
- package/dist/esm/section-header/style.scss +22 -1
- package/dist/esm/select-control/ButtonGroupControl.js +12 -14
- package/dist/esm/select-control/GroupedSelectControl.js +38 -36
- package/dist/esm/select-control/index.js +7 -8
- package/dist/esm/select-control/style.scss +47 -88
- package/dist/esm/settings/MinMaxSetting.js +4 -5
- package/dist/esm/settings/SettingsCard.js +9 -5
- package/dist/esm/settings/SettingsSection.js +5 -7
- package/dist/esm/settings/style.scss +32 -4
- 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 +13 -13
- package/dist/esm/style-card/style.scss +19 -18
- package/dist/esm/style.scss +43 -0
- package/dist/esm/tabbed-navigation/index.js +30 -28
- package/dist/esm/tabbed-navigation/style.scss +58 -37
- package/dist/esm/text-control/index.js +2 -12
- package/dist/esm/text-control/style.scss +0 -126
- package/dist/esm/utils/index.js +9 -3
- package/dist/esm/waiting/index.js +11 -27
- package/dist/esm/waiting/style.scss +9 -20
- package/dist/esm/web-preview/index.js +21 -49
- package/dist/esm/web-preview/style.scss +41 -34
- package/dist/esm/with-wizard/index.js +53 -36
- package/dist/esm/with-wizard/style.scss +77 -124
- package/dist/esm/with-wizard-screen/index.js +26 -32
- package/dist/esm/with-wizard-screen/style.scss +75 -125
- package/dist/esm/wizard/components/WizardError.js +69 -0
- package/dist/esm/wizard/index.js +126 -0
- package/dist/esm/wizard/store/index.js +155 -0
- package/dist/esm/wizard/store/utils.js +17 -0
- package/dist/esm/wizard/style.scss +148 -0
- package/package.json +4 -4
- package/src/accordion/index.js +32 -0
- package/src/accordion/style.scss +27 -0
- package/src/action-card/index.js +70 -25
- package/src/action-card/style.scss +143 -41
- package/src/autocomplete-tokenfield/index.js +1 -1
- package/src/autocomplete-tokenfield/style.scss +6 -6
- package/src/autocomplete-with-suggestions/index.js +4 -2
- package/src/autocomplete-with-suggestions/style.scss +27 -27
- package/src/button/index.js +2 -9
- package/src/button/style.scss +3 -344
- package/src/button-card/index.js +19 -5
- package/src/button-card/style.scss +65 -35
- package/src/card/index.js +4 -0
- package/src/card/style.scss +47 -63
- package/src/category-autocomplete/index.js +53 -18
- package/src/category-autocomplete/style.scss +20 -24
- package/src/color-picker/index.js +16 -22
- package/src/color-picker/style.scss +20 -163
- package/src/consts.js +2 -1
- package/src/custom-select-control/style.scss +14 -45
- package/src/date-range-picker/style.scss +12 -12
- package/src/footer/index.js +20 -9
- package/src/footer/style.scss +13 -14
- package/src/form-token-field/index.js +3 -8
- package/src/form-token-field/style.scss +9 -105
- package/src/global-notices/index.js +1 -1
- package/src/grid/style.scss +19 -6
- package/src/handoff/index.js +10 -15
- 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 +12 -17
- package/src/index.js +7 -7
- package/src/info-button/style.scss +1 -3
- package/src/modal/index.js +2 -5
- package/src/modal/style.scss +20 -132
- package/src/newspack-icon/index.js +7 -2
- package/src/newspack-icon/style.scss +17 -2
- package/src/newspack-logo/style.scss +3 -3
- package/src/notice/index.js +9 -1
- package/src/notice/style.scss +60 -19
- package/src/plugin-installer/index.js +17 -4
- package/src/plugin-installer/style.scss +5 -5
- package/src/plugin-settings/SettingsSection.js +59 -27
- package/src/plugin-settings/index.js +29 -8
- package/src/plugin-settings/style.scss +7 -0
- package/src/plugin-toggle/index.js +37 -12
- package/src/plugin-toggle/style.scss +2 -2
- package/src/popover/style.scss +20 -17
- 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 +10 -11
- package/src/section-header/index.js +41 -5
- package/src/section-header/style.scss +22 -1
- package/src/select-control/ButtonGroupControl.js +15 -5
- package/src/select-control/GroupedSelectControl.js +28 -25
- package/src/select-control/index.js +6 -3
- package/src/select-control/style.scss +47 -88
- package/src/settings/MinMaxSetting.js +2 -1
- package/src/settings/SettingsCard.js +9 -7
- package/src/settings/SettingsSection.js +4 -4
- package/src/settings/style.scss +32 -4
- 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 +16 -27
- package/src/style-card/style.scss +19 -18
- package/src/style.scss +43 -0
- package/src/tabbed-navigation/index.js +20 -24
- package/src/tabbed-navigation/style.scss +58 -37
- package/src/text-control/index.js +1 -2
- package/src/text-control/style.scss +0 -126
- package/src/utils/index.js +9 -0
- package/src/waiting/index.js +7 -18
- package/src/waiting/style.scss +9 -20
- package/src/web-preview/index.js +13 -34
- package/src/web-preview/style.scss +41 -34
- package/src/with-wizard/index.js +7 -5
- package/src/with-wizard/style.scss +77 -124
- package/src/with-wizard-screen/index.js +17 -17
- package/src/with-wizard-screen/style.scss +75 -125
- package/src/wizard/components/WizardError.js +57 -0
- package/src/wizard/index.js +145 -0
- package/src/wizard/store/index.js +132 -0
- package/src/wizard/store/utils.js +16 -0
- package/dist/cjs/wizard-pagination/index.js +0 -71
- package/dist/cjs/wizard-pagination/style.scss +0 -74
- package/dist/esm/wizard-pagination/index.js +0 -57
- package/dist/esm/wizard-pagination/style.scss +0 -74
- package/src/button-group/index.js +0 -35
- package/src/button-group/style.scss +0 -73
- package/src/checkbox-control/index.js +0 -38
- package/src/checkbox-control/style.scss +0 -78
- package/src/preview-box/index.js +0 -18
- package/src/preview-box/style.scss +0 -18
- package/src/textarea-control/index.js +0 -32
- package/src/textarea-control/style.scss +0 -76
- package/src/toggle-control/index.js +0 -38
- package/src/toggle-control/style.scss +0 -74
- package/src/toggle-group/index.js +0 -43
- package/src/toggle-group/style.scss +0 -28
- package/src/wizard-pagination/index.js +0 -59
- package/src/wizard-pagination/style.scss +0 -74
|
@@ -2,65 +2,106 @@
|
|
|
2
2
|
* Notice
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
@
|
|
6
|
-
@
|
|
5
|
+
@use 'sass:color';
|
|
6
|
+
@use '~@wordpress/base-styles/colors' as wp-colors;
|
|
7
|
+
@use '../../../shared/scss/colors';
|
|
7
8
|
|
|
8
9
|
.newspack-notice {
|
|
9
|
-
align-items:
|
|
10
|
-
background:
|
|
11
|
-
|
|
12
|
-
color: $gray-900;
|
|
10
|
+
align-items: center;
|
|
11
|
+
background: wp-colors.$gray-100;
|
|
12
|
+
color: wp-colors.$gray-900;
|
|
13
13
|
display: flex;
|
|
14
|
-
font-size: 14px;
|
|
15
14
|
justify-content: flex-start;
|
|
16
|
-
line-height: 24px;
|
|
17
15
|
margin: 32px 0;
|
|
18
16
|
padding: 6px 8px;
|
|
19
17
|
|
|
20
18
|
> svg {
|
|
21
19
|
display: block;
|
|
22
|
-
fill:
|
|
20
|
+
fill: wp-colors.$gray-900;
|
|
23
21
|
flex: 0 0 24px;
|
|
24
22
|
margin-right: 4px;
|
|
25
23
|
}
|
|
26
24
|
|
|
25
|
+
&__is-debug {
|
|
26
|
+
background: colors.$primary-700;
|
|
27
|
+
border-radius: 2px;
|
|
28
|
+
bottom: 16px;
|
|
29
|
+
box-shadow: 0 0 8px 4px rgba( black, 0.08 );
|
|
30
|
+
color: white;
|
|
31
|
+
font-weight: bold;
|
|
32
|
+
margin: 0 16px;
|
|
33
|
+
position: fixed;
|
|
34
|
+
text-transform: uppercase;
|
|
35
|
+
z-index: 9997;
|
|
36
|
+
|
|
37
|
+
> svg {
|
|
38
|
+
fill: white;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
27
42
|
&__is-error {
|
|
28
|
-
background:
|
|
43
|
+
background: color.adjust( wp-colors.$alert-red, $lightness: 51% );
|
|
29
44
|
|
|
30
45
|
> svg {
|
|
31
|
-
fill:
|
|
46
|
+
fill: wp-colors.$alert-red;
|
|
32
47
|
transform: rotate( 180deg );
|
|
33
48
|
}
|
|
34
49
|
}
|
|
35
50
|
|
|
51
|
+
&__is-handoff {
|
|
52
|
+
background: color.adjust( wp-colors.$alert-yellow, $lightness: 30% );
|
|
53
|
+
margin-top: 0;
|
|
54
|
+
position: sticky;
|
|
55
|
+
top: 46px;
|
|
56
|
+
z-index: 100;
|
|
57
|
+
|
|
58
|
+
@media ( min-width: 782px ) {
|
|
59
|
+
top: 32px;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
36
63
|
&__is-help {
|
|
37
|
-
background:
|
|
64
|
+
background: colors.$primary-050;
|
|
38
65
|
|
|
39
66
|
> svg {
|
|
40
|
-
fill:
|
|
67
|
+
fill: colors.$primary-500;
|
|
41
68
|
}
|
|
42
69
|
}
|
|
43
70
|
|
|
44
71
|
&__is-success {
|
|
45
|
-
background:
|
|
72
|
+
background: color.adjust( wp-colors.$alert-green, $lightness: 42% );
|
|
46
73
|
|
|
47
74
|
> svg {
|
|
48
|
-
fill:
|
|
75
|
+
fill: wp-colors.$alert-green;
|
|
49
76
|
}
|
|
50
77
|
}
|
|
51
78
|
|
|
52
79
|
&__is-warning {
|
|
53
|
-
background:
|
|
80
|
+
background: color.adjust( wp-colors.$alert-yellow, $lightness: 30% );
|
|
54
81
|
|
|
55
82
|
> svg {
|
|
56
|
-
fill:
|
|
83
|
+
fill: wp-colors.$alert-yellow;
|
|
57
84
|
transform: rotate( 180deg );
|
|
58
85
|
}
|
|
59
86
|
}
|
|
60
87
|
|
|
61
|
-
&__content {
|
|
88
|
+
& &__content {
|
|
62
89
|
> div > * {
|
|
63
|
-
margin: 0;
|
|
90
|
+
margin: 0 !important;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
a {
|
|
94
|
+
color: inherit;
|
|
95
|
+
|
|
96
|
+
&:active,
|
|
97
|
+
&:focus,
|
|
98
|
+
&:hover {
|
|
99
|
+
color: inherit;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&:focus {
|
|
103
|
+
box-shadow: 0 0 0 var( --wp-admin-border-width-focus ) currentcolor;
|
|
104
|
+
}
|
|
64
105
|
}
|
|
65
106
|
}
|
|
66
107
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress.com and Google News Initiative Logos.
|
|
5
4
|
*/
|
|
@@ -13,11 +12,12 @@ import { __ as alias__ } from '@wordpress/i18n';
|
|
|
13
12
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
14
13
|
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
15
14
|
const __ = alias__;
|
|
16
|
-
|
|
17
15
|
class PatronsLogo extends Component {
|
|
18
16
|
constructor() {
|
|
19
17
|
super(...arguments);
|
|
20
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Render.
|
|
20
|
+
*/
|
|
21
21
|
_defineProperty(this, "render", () => {
|
|
22
22
|
return _jsxs(SVG, {
|
|
23
23
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -72,7 +72,5 @@ class PatronsLogo extends Component {
|
|
|
72
72
|
});
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
|
|
76
75
|
}
|
|
77
|
-
|
|
78
76
|
export default PatronsLogo;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Plugin Installer
|
|
5
4
|
*/
|
|
@@ -12,35 +11,33 @@ import { Component } from '@wordpress/element';
|
|
|
12
11
|
import { __ as alias__ } from '@wordpress/i18n';
|
|
13
12
|
const __ = alias__;
|
|
14
13
|
import { Icon, check } from '@wordpress/icons';
|
|
14
|
+
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies.
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
18
|
import { ActionCard, Button, Waiting } from '../';
|
|
20
19
|
import './style.scss';
|
|
21
20
|
const PLUGIN_STATE_NONE = 0;
|
|
22
21
|
const PLUGIN_STATE_ACTIVE = 1;
|
|
23
22
|
const PLUGIN_STATE_INSTALLING = 2;
|
|
24
23
|
const PLUGIN_STATE_ERROR = 3;
|
|
24
|
+
|
|
25
25
|
/**
|
|
26
26
|
* External dependencies.
|
|
27
27
|
*/
|
|
28
|
-
|
|
29
28
|
import classnames from 'classnames';
|
|
29
|
+
|
|
30
30
|
/**
|
|
31
31
|
* Plugin installer.
|
|
32
32
|
*/
|
|
33
|
-
|
|
34
33
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
35
34
|
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
36
|
-
|
|
35
|
+
import { Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
37
36
|
class PluginInstaller extends Component {
|
|
38
37
|
constructor() {
|
|
39
38
|
var _this;
|
|
40
|
-
|
|
41
39
|
super(...arguments);
|
|
42
40
|
_this = this;
|
|
43
|
-
|
|
44
41
|
_defineProperty(this, "componentDidMount", () => {
|
|
45
42
|
const {
|
|
46
43
|
plugins
|
|
@@ -51,7 +48,6 @@ class PluginInstaller extends Component {
|
|
|
51
48
|
}
|
|
52
49
|
});
|
|
53
50
|
});
|
|
54
|
-
|
|
55
51
|
_defineProperty(this, "componentDidUpdate", prevProps => {
|
|
56
52
|
const {
|
|
57
53
|
autoInstall,
|
|
@@ -60,16 +56,13 @@ class PluginInstaller extends Component {
|
|
|
60
56
|
const {
|
|
61
57
|
installationInitialized
|
|
62
58
|
} = this.state;
|
|
63
|
-
|
|
64
59
|
if (plugins !== prevProps.plugins) {
|
|
65
60
|
this.retrievePluginInfo(plugins);
|
|
66
61
|
}
|
|
67
|
-
|
|
68
62
|
if (autoInstall && !installationInitialized) {
|
|
69
63
|
this.installAllPlugins();
|
|
70
64
|
}
|
|
71
65
|
});
|
|
72
|
-
|
|
73
66
|
_defineProperty(this, "retrievePluginInfo", plugins => {
|
|
74
67
|
return new Promise(resolve => {
|
|
75
68
|
apiFetch({
|
|
@@ -79,8 +72,8 @@ class PluginInstaller extends Component {
|
|
|
79
72
|
if (plugins.indexOf(slug) === -1) {
|
|
80
73
|
return result;
|
|
81
74
|
}
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
result[slug] = {
|
|
76
|
+
...response[slug],
|
|
84
77
|
installationStatus: response[slug].Status === 'active' ? PLUGIN_STATE_ACTIVE : PLUGIN_STATE_NONE
|
|
85
78
|
};
|
|
86
79
|
return result;
|
|
@@ -89,7 +82,6 @@ class PluginInstaller extends Component {
|
|
|
89
82
|
});
|
|
90
83
|
});
|
|
91
84
|
});
|
|
92
|
-
|
|
93
85
|
_defineProperty(this, "installAllPlugins", () => {
|
|
94
86
|
const {
|
|
95
87
|
pluginInfo
|
|
@@ -100,7 +92,6 @@ class PluginInstaller extends Component {
|
|
|
100
92
|
const promises = Object.keys(pluginInfo).filter(slug => 'active' !== pluginInfo[slug].Status).map(slug => () => this.installPlugin(slug));
|
|
101
93
|
promises.reduce((promise, action) => promise.then(result => action().then(Array.prototype.concat.bind(result))), Promise.resolve([]));
|
|
102
94
|
});
|
|
103
|
-
|
|
104
95
|
_defineProperty(this, "installPlugin", slug => {
|
|
105
96
|
this.setInstallationStatus(slug, PLUGIN_STATE_INSTALLING);
|
|
106
97
|
const params = {
|
|
@@ -112,8 +103,10 @@ class PluginInstaller extends Component {
|
|
|
112
103
|
pluginInfo
|
|
113
104
|
} = this.state;
|
|
114
105
|
this.props.onInstalled(slug);
|
|
115
|
-
this.updatePluginInfo({
|
|
116
|
-
|
|
106
|
+
this.updatePluginInfo({
|
|
107
|
+
...pluginInfo,
|
|
108
|
+
[slug]: {
|
|
109
|
+
...response,
|
|
117
110
|
installationStatus: PLUGIN_STATE_ACTIVE
|
|
118
111
|
}
|
|
119
112
|
});
|
|
@@ -121,32 +114,32 @@ class PluginInstaller extends Component {
|
|
|
121
114
|
this.setInstallationStatus(slug, PLUGIN_STATE_ERROR, error.message);
|
|
122
115
|
});
|
|
123
116
|
});
|
|
124
|
-
|
|
125
117
|
_defineProperty(this, "setChecked", (slug, checked) => {
|
|
126
118
|
const {
|
|
127
119
|
pluginInfo
|
|
128
120
|
} = this.state;
|
|
129
|
-
this.updatePluginInfo({
|
|
130
|
-
|
|
121
|
+
this.updatePluginInfo({
|
|
122
|
+
...pluginInfo,
|
|
123
|
+
[slug]: {
|
|
124
|
+
...pluginInfo[slug],
|
|
131
125
|
checked
|
|
132
126
|
}
|
|
133
127
|
});
|
|
134
128
|
});
|
|
135
|
-
|
|
136
129
|
_defineProperty(this, "setInstallationStatus", function (slug, installationStatus) {
|
|
137
130
|
let notification = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
138
131
|
const {
|
|
139
132
|
pluginInfo
|
|
140
133
|
} = _this.state;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
[slug]: {
|
|
134
|
+
_this.updatePluginInfo({
|
|
135
|
+
...pluginInfo,
|
|
136
|
+
[slug]: {
|
|
137
|
+
...pluginInfo[slug],
|
|
144
138
|
installationStatus,
|
|
145
139
|
notification
|
|
146
140
|
}
|
|
147
141
|
});
|
|
148
142
|
});
|
|
149
|
-
|
|
150
143
|
_defineProperty(this, "updatePluginInfo", pluginInfo => {
|
|
151
144
|
return new Promise(resolve => {
|
|
152
145
|
const {
|
|
@@ -166,29 +159,23 @@ class PluginInstaller extends Component {
|
|
|
166
159
|
});
|
|
167
160
|
});
|
|
168
161
|
});
|
|
169
|
-
|
|
170
162
|
_defineProperty(this, "classForInstallationStatus", status => {
|
|
171
163
|
switch (status) {
|
|
172
164
|
case PLUGIN_STATE_ACTIVE:
|
|
173
165
|
return 'newspack-plugin-installer__status-active';
|
|
174
|
-
|
|
175
166
|
case PLUGIN_STATE_INSTALLING:
|
|
176
167
|
return 'newspack-plugin-installer__status-installing';
|
|
177
|
-
|
|
178
168
|
case PLUGIN_STATE_ERROR:
|
|
179
169
|
return 'newspack-plugin-installer__status-error';
|
|
180
|
-
|
|
181
170
|
default:
|
|
182
171
|
return 'newspack-plugin-installer__status-none';
|
|
183
172
|
}
|
|
184
173
|
});
|
|
185
|
-
|
|
186
174
|
this.state = {
|
|
187
175
|
pluginInfo: {},
|
|
188
176
|
installationInitialized: false
|
|
189
177
|
};
|
|
190
178
|
}
|
|
191
|
-
|
|
192
179
|
/**
|
|
193
180
|
* Render.
|
|
194
181
|
*/
|
|
@@ -201,22 +188,26 @@ class PluginInstaller extends Component {
|
|
|
201
188
|
const {
|
|
202
189
|
pluginInfo
|
|
203
190
|
} = this.state;
|
|
204
|
-
const
|
|
191
|
+
const {
|
|
192
|
+
is_atomic: isAtomic
|
|
193
|
+
} = window;
|
|
194
|
+
const slugs = Object.keys(pluginInfo);
|
|
205
195
|
|
|
196
|
+
// Store all plugin status info for installer button text value based on current status.
|
|
206
197
|
const currentPluginStatuses = [];
|
|
207
198
|
slugs.forEach(slug => {
|
|
208
199
|
const plugin = pluginInfo[slug];
|
|
209
200
|
currentPluginStatuses.push(plugin.Status);
|
|
210
|
-
});
|
|
201
|
+
});
|
|
211
202
|
|
|
203
|
+
// Make sure plugin status falls in either one of these, to handle button text.
|
|
212
204
|
const pluginInstalled = currentStatus => currentStatus === 'active' || currentStatus === 'inactive';
|
|
213
|
-
|
|
214
205
|
const buttonText = currentPluginStatuses.every(pluginInstalled) ? __('Activate', 'newspack') : __('Install', 'newspack');
|
|
215
206
|
const needsInstall = slugs.some(slug => {
|
|
216
207
|
const plugin = pluginInfo[slug];
|
|
217
208
|
return plugin.Status !== 'active' && plugin.installationStatus === PLUGIN_STATE_NONE;
|
|
218
209
|
});
|
|
219
|
-
return _jsxs(
|
|
210
|
+
return _jsxs(_Fragment, {
|
|
220
211
|
children: [(!pluginInfo || !Object.keys(pluginInfo).length) && _jsxs("div", {
|
|
221
212
|
className: "newspack-plugin-installer_is-waiting",
|
|
222
213
|
children: [_jsx(Waiting, {
|
|
@@ -227,16 +218,24 @@ class PluginInstaller extends Component {
|
|
|
227
218
|
const {
|
|
228
219
|
Name,
|
|
229
220
|
Description,
|
|
221
|
+
Download,
|
|
230
222
|
Status,
|
|
231
223
|
installationStatus,
|
|
232
224
|
notification
|
|
233
225
|
} = plugin;
|
|
234
226
|
const isWaiting = installationStatus === PLUGIN_STATE_INSTALLING;
|
|
235
227
|
const isButton = !isWaiting && Status !== 'active';
|
|
228
|
+
const installable = Download || pluginInstalled(Status);
|
|
236
229
|
let actionText;
|
|
237
|
-
|
|
238
230
|
if (installationStatus === PLUGIN_STATE_INSTALLING) {
|
|
239
|
-
actionText = __('Installing…');
|
|
231
|
+
actionText = 'inactive' === Status ? __('Activating…') : __('Installing…');
|
|
232
|
+
} else if (!installable) {
|
|
233
|
+
actionText = _jsxs("span", {
|
|
234
|
+
className: "newspack-plugin-installer__status",
|
|
235
|
+
children: [isAtomic ? __('Contact Newspack support to install', 'newspack') : __('Plugin must be installed manually', 'newspack'), _jsx("span", {
|
|
236
|
+
className: "newspack-checkbox-icon"
|
|
237
|
+
})]
|
|
238
|
+
});
|
|
240
239
|
} else if (Status === 'uninstalled') {
|
|
241
240
|
actionText = _jsxs("span", {
|
|
242
241
|
className: "newspack-plugin-installer__status",
|
|
@@ -262,12 +261,12 @@ class PluginInstaller extends Component {
|
|
|
262
261
|
})]
|
|
263
262
|
});
|
|
264
263
|
}
|
|
265
|
-
|
|
266
264
|
const classes = classnames('newspack-action-card__plugin-installer', this.classForInstallationStatus(installationStatus));
|
|
267
265
|
const onClick = isButton ? () => this.installPlugin(slug) : null;
|
|
268
266
|
return _jsx(ActionCard, {
|
|
269
267
|
title: Name,
|
|
270
268
|
description: Description,
|
|
269
|
+
disabled: !installable,
|
|
271
270
|
actionText: actionText,
|
|
272
271
|
isSmall: isSmall,
|
|
273
272
|
isWaiting: isWaiting,
|
|
@@ -288,9 +287,7 @@ class PluginInstaller extends Component {
|
|
|
288
287
|
})]
|
|
289
288
|
});
|
|
290
289
|
}
|
|
291
|
-
|
|
292
290
|
}
|
|
293
|
-
|
|
294
291
|
PluginInstaller.defaultProps = {
|
|
295
292
|
onStatus: () => {},
|
|
296
293
|
onInstalled: () => {}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Plugin Installer
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
@
|
|
5
|
+
@use '~@wordpress/base-styles/colors' as wp-colors;
|
|
6
6
|
|
|
7
7
|
.newspack-card {
|
|
8
8
|
.newspack-plugin-installer__status {
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
&.newspack-plugin-installer__status-active {
|
|
38
|
-
box-shadow: inset 4px 0 0
|
|
38
|
+
box-shadow: inset 4px 0 0 wp-colors.$alert-green;
|
|
39
39
|
|
|
40
40
|
.newspack-plugin-installer__checkbox {
|
|
41
|
-
background:
|
|
41
|
+
background: wp-colors.$alert-green;
|
|
42
42
|
box-shadow: none;
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
&.newspack-plugin-installer__status-error {
|
|
51
|
-
box-shadow: inset 4px 0 0
|
|
51
|
+
box-shadow: inset 4px 0 0 wp-colors.$alert-red;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
&.newspack-plugin-installer__status-installing,
|
|
55
55
|
&.newspack-plugin-installer__status-none {
|
|
56
|
-
box-shadow: inset 4px 0 0
|
|
56
|
+
box-shadow: inset 4px 0 0 wp-colors.$gray-100;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
// Is Small
|
|
@@ -5,32 +5,34 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* WordPress dependencies
|
|
7
7
|
*/
|
|
8
|
-
import { Fragment } from '@wordpress/element';
|
|
8
|
+
import { Fragment, useState } from '@wordpress/element';
|
|
9
|
+
import { applyFilters } from '@wordpress/hooks';
|
|
9
10
|
import { __ as alias__ } from '@wordpress/i18n';
|
|
11
|
+
const __ = alias__;
|
|
12
|
+
import { CheckboxControl } from '@wordpress/components';
|
|
13
|
+
|
|
10
14
|
/**
|
|
11
15
|
* Internal dependencies
|
|
12
16
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import { ActionCard, Grid, Button, TextControl, CheckboxControl, SelectControl } from '../';
|
|
17
|
+
import { ActionCard, Button, Grid, Notice, SelectControl, TextControl } from '../';
|
|
18
|
+
import './style.scss';
|
|
16
19
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
17
20
|
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
18
|
-
|
|
21
|
+
const isSelectControl = setting => {
|
|
22
|
+
return Array.isArray(setting.options) && setting.options.length;
|
|
23
|
+
};
|
|
19
24
|
const getControlComponent = setting => {
|
|
20
|
-
if (
|
|
25
|
+
if (isSelectControl(setting)) {
|
|
21
26
|
return SelectControl;
|
|
22
27
|
}
|
|
23
|
-
|
|
24
28
|
switch (setting.type) {
|
|
25
29
|
case 'checkbox':
|
|
26
30
|
case 'boolean':
|
|
27
31
|
return CheckboxControl;
|
|
28
|
-
|
|
29
32
|
default:
|
|
30
33
|
return TextControl;
|
|
31
34
|
}
|
|
32
35
|
};
|
|
33
|
-
|
|
34
36
|
const getControlType = setting => {
|
|
35
37
|
switch (setting.type) {
|
|
36
38
|
case 'int':
|
|
@@ -38,18 +40,23 @@ const getControlType = setting => {
|
|
|
38
40
|
case 'float':
|
|
39
41
|
case 'number':
|
|
40
42
|
return 'number';
|
|
41
|
-
|
|
42
43
|
case 'string':
|
|
43
44
|
case 'text':
|
|
44
45
|
return 'text';
|
|
45
|
-
|
|
46
|
+
case 'password':
|
|
47
|
+
return 'password';
|
|
48
|
+
case 'boolean':
|
|
49
|
+
case 'checkbox':
|
|
50
|
+
return 'checkbox';
|
|
46
51
|
default:
|
|
47
52
|
return null;
|
|
48
53
|
}
|
|
49
54
|
};
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
55
|
+
const SettingsSection = props => {
|
|
56
|
+
const [saveDisabled, setSaveDisabled] = useState(true);
|
|
57
|
+
const {
|
|
58
|
+
error,
|
|
59
|
+
sectionKey,
|
|
53
60
|
active,
|
|
54
61
|
title,
|
|
55
62
|
description,
|
|
@@ -57,65 +64,73 @@ const SettingsSection = _ref => {
|
|
|
57
64
|
disabled,
|
|
58
65
|
onChange,
|
|
59
66
|
onUpdate
|
|
60
|
-
} =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
label:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
67
|
+
} = props;
|
|
68
|
+
const getControlProps = setting => ({
|
|
69
|
+
disabled,
|
|
70
|
+
name: `${setting.section}_${setting.key}`,
|
|
71
|
+
type: getControlType(setting),
|
|
72
|
+
label: setting.description,
|
|
73
|
+
help: setting.help || null,
|
|
74
|
+
options: setting.options?.map(option => ({
|
|
75
|
+
value: option.value,
|
|
76
|
+
label: option.name || option.label
|
|
77
|
+
})) || null,
|
|
78
|
+
value: setting.value,
|
|
79
|
+
multiple: isSelectControl(setting) && setting.multiple ? true : null,
|
|
80
|
+
checked: setting.type === 'boolean' ? !!setting.value : null,
|
|
81
|
+
onChange: value => {
|
|
82
|
+
onChange(setting.key, value);
|
|
83
|
+
setSaveDisabled(false);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
const createFilter = function (name) {
|
|
87
|
+
let defaultComponent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
88
|
+
return applyFilters(`newspack.settingSection.${sectionKey}.${name}`, defaultComponent, props);
|
|
81
89
|
};
|
|
82
|
-
|
|
90
|
+
let columns = 2;
|
|
91
|
+
if (fields.length % 3 === 0) {
|
|
92
|
+
columns = 3;
|
|
93
|
+
} else if (fields.length === 1) {
|
|
94
|
+
columns = 1;
|
|
95
|
+
}
|
|
83
96
|
return _jsx(ActionCard, {
|
|
84
97
|
isMedium: true,
|
|
85
98
|
disabled: disabled,
|
|
86
99
|
title: title,
|
|
87
100
|
description: description,
|
|
88
101
|
toggleChecked: active,
|
|
89
|
-
hasGreyHeader:
|
|
102
|
+
hasGreyHeader: active || null === active,
|
|
90
103
|
toggleOnChange: active !== null ? value => onUpdate({
|
|
91
104
|
active: value
|
|
92
105
|
}) : null,
|
|
106
|
+
actionContent: (active || null === active) && createFilter('buttons', _jsx(Button, {
|
|
107
|
+
variant: "primary",
|
|
108
|
+
disabled: disabled || saveDisabled,
|
|
109
|
+
onClick: () => {
|
|
110
|
+
onUpdate();
|
|
111
|
+
setSaveDisabled(true);
|
|
112
|
+
},
|
|
113
|
+
children: __('Save Settings', 'newspack')
|
|
114
|
+
})),
|
|
93
115
|
children: (active || active === null) && _jsxs(Fragment, {
|
|
94
|
-
children: [_jsx(
|
|
95
|
-
|
|
116
|
+
children: [error?.message && _jsx(Notice, {
|
|
117
|
+
noticeText: error.message,
|
|
118
|
+
isError: true
|
|
119
|
+
}), createFilter('beforeControls'), _jsx(Grid, {
|
|
120
|
+
columns: columns,
|
|
96
121
|
gutter: 32,
|
|
97
122
|
children: fields.map(setting => {
|
|
98
123
|
const Control = getControlComponent(setting); // eslint-disable-line @wordpress/no-unused-vars-before-return, no-unused-vars
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}, setting.key)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
margin: '32px 0 0'
|
|
107
|
-
},
|
|
108
|
-
children: _jsx(Button, {
|
|
109
|
-
isPrimary: true,
|
|
110
|
-
disabled: disabled,
|
|
111
|
-
onClick: () => {
|
|
112
|
-
onUpdate();
|
|
113
|
-
},
|
|
114
|
-
children: __('Save settings', 'newspack')
|
|
124
|
+
return applyFilters(`newspack.settingsSection.${sectionKey}.control`, _jsx(Control, {
|
|
125
|
+
...getControlProps(setting)
|
|
126
|
+
}, setting.key), {
|
|
127
|
+
sectionKey,
|
|
128
|
+
setting,
|
|
129
|
+
onChange
|
|
130
|
+
});
|
|
115
131
|
})
|
|
116
132
|
})]
|
|
117
133
|
})
|
|
118
134
|
});
|
|
119
135
|
};
|
|
120
|
-
|
|
121
136
|
export default SettingsSection;
|