newspack-components 2.0.3 → 2.1.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/action-card/index.js +29 -20
- package/dist/cjs/action-card/style.scss +52 -27
- package/dist/cjs/autocomplete-tokenfield/style.scss +4 -4
- package/dist/cjs/autocomplete-with-suggestions/index.js +3 -2
- package/dist/cjs/autocomplete-with-suggestions/style.scss +19 -20
- package/dist/cjs/button/index.js +2 -13
- package/dist/cjs/button/style.scss +3 -344
- package/dist/cjs/button-card/index.js +11 -6
- package/dist/cjs/button-card/style.scss +60 -30
- package/dist/cjs/card/index.js +3 -1
- package/dist/cjs/card/style.scss +29 -62
- package/dist/cjs/category-autocomplete/index.js +52 -13
- package/dist/cjs/category-autocomplete/style.scss +20 -22
- package/dist/cjs/color-picker/index.js +17 -35
- package/dist/cjs/color-picker/style.scss +20 -160
- package/dist/cjs/custom-select-control/style.scss +12 -42
- package/dist/cjs/footer/index.js +21 -7
- package/dist/cjs/footer/style.scss +9 -10
- package/dist/cjs/form-token-field/index.js +2 -2
- package/dist/cjs/form-token-field/style.scss +8 -103
- package/dist/cjs/global-notices/index.js +2 -1
- package/dist/cjs/grid/style.scss +14 -1
- package/dist/cjs/handoff/index.js +7 -7
- package/dist/cjs/image-upload/index.js +1 -1
- package/dist/cjs/image-upload/style.scss +10 -11
- package/dist/cjs/index.js +7 -53
- package/dist/cjs/modal/index.js +0 -3
- package/dist/cjs/modal/style.scss +19 -131
- package/dist/cjs/newspack-icon/index.js +4 -2
- package/dist/cjs/newspack-icon/style.scss +15 -0
- package/dist/cjs/notice/index.js +8 -9
- package/dist/cjs/notice/style.scss +38 -10
- package/dist/cjs/plugin-installer/index.js +1 -1
- package/dist/cjs/plugin-settings/SettingsSection.js +74 -43
- package/dist/cjs/plugin-settings/index.js +34 -30
- package/dist/cjs/plugin-settings/style.scss +7 -0
- package/dist/cjs/plugin-toggle/index.js +22 -1
- package/dist/cjs/popover/style.scss +2 -2
- package/dist/cjs/radio-control/style.scss +1 -2
- package/dist/cjs/section-header/index.js +18 -5
- package/dist/cjs/section-header/style.scss +22 -1
- package/dist/cjs/select-control/ButtonGroupControl.js +8 -8
- package/dist/cjs/select-control/GroupedSelectControl.js +33 -30
- package/dist/cjs/select-control/index.js +1 -2
- package/dist/cjs/select-control/style.scss +46 -87
- package/dist/cjs/settings/MinMaxSetting.js +4 -2
- package/dist/cjs/settings/SettingsCard.js +6 -1
- package/dist/cjs/settings/SettingsSection.js +4 -4
- package/dist/cjs/settings/style.scss +32 -4
- package/dist/cjs/style-card/index.js +10 -6
- package/dist/cjs/style-card/style.scss +12 -8
- package/dist/cjs/style.scss +44 -0
- package/dist/cjs/tabbed-navigation/index.js +13 -20
- package/dist/cjs/tabbed-navigation/style.scss +56 -34
- package/dist/cjs/text-control/index.js +0 -3
- package/dist/cjs/text-control/style.scss +0 -126
- package/dist/cjs/waiting/index.js +9 -25
- package/dist/cjs/waiting/style.scss +9 -20
- package/dist/cjs/web-preview/index.js +18 -30
- package/dist/cjs/web-preview/style.scss +33 -26
- package/dist/cjs/with-wizard/index.js +4 -2
- package/dist/cjs/with-wizard/style.scss +44 -89
- package/dist/cjs/with-wizard-screen/index.js +17 -21
- package/dist/cjs/with-wizard-screen/style.scss +74 -121
- package/dist/cjs/wizard/components/WizardError.js +86 -0
- package/dist/cjs/wizard/index.js +145 -0
- package/dist/cjs/wizard/store/index.js +178 -0
- package/dist/cjs/wizard/store/utils.js +31 -0
- package/dist/esm/action-card/index.js +30 -21
- package/dist/esm/action-card/style.scss +52 -27
- package/dist/esm/autocomplete-tokenfield/style.scss +4 -4
- package/dist/esm/autocomplete-with-suggestions/index.js +3 -2
- package/dist/esm/autocomplete-with-suggestions/style.scss +19 -20
- package/dist/esm/button/index.js +2 -12
- package/dist/esm/button/style.scss +3 -344
- package/dist/esm/button-card/index.js +10 -6
- package/dist/esm/button-card/style.scss +60 -30
- package/dist/esm/card/index.js +3 -1
- package/dist/esm/card/style.scss +29 -62
- package/dist/esm/category-autocomplete/index.js +54 -14
- package/dist/esm/category-autocomplete/style.scss +20 -22
- package/dist/esm/color-picker/index.js +15 -34
- package/dist/esm/color-picker/style.scss +20 -160
- package/dist/esm/custom-select-control/style.scss +12 -42
- package/dist/esm/footer/index.js +21 -7
- package/dist/esm/footer/style.scss +9 -10
- package/dist/esm/form-token-field/index.js +2 -2
- package/dist/esm/form-token-field/style.scss +8 -103
- package/dist/esm/global-notices/index.js +2 -1
- package/dist/esm/grid/style.scss +14 -1
- package/dist/esm/handoff/index.js +7 -7
- package/dist/esm/image-upload/index.js +1 -1
- package/dist/esm/image-upload/style.scss +10 -11
- package/dist/esm/index.js +3 -8
- package/dist/esm/modal/index.js +0 -3
- package/dist/esm/modal/style.scss +19 -131
- package/dist/esm/newspack-icon/index.js +4 -2
- package/dist/esm/newspack-icon/style.scss +15 -0
- package/dist/esm/notice/index.js +8 -3
- package/dist/esm/notice/style.scss +38 -10
- package/dist/esm/plugin-installer/index.js +2 -1
- package/dist/esm/plugin-settings/SettingsSection.js +72 -44
- package/dist/esm/plugin-settings/index.js +34 -30
- package/dist/esm/plugin-settings/style.scss +7 -0
- package/dist/esm/plugin-toggle/index.js +23 -1
- package/dist/esm/popover/style.scss +2 -2
- package/dist/esm/radio-control/style.scss +1 -2
- package/dist/esm/section-header/index.js +17 -5
- package/dist/esm/section-header/style.scss +22 -1
- package/dist/esm/select-control/ButtonGroupControl.js +8 -8
- package/dist/esm/select-control/GroupedSelectControl.js +33 -30
- package/dist/esm/select-control/index.js +1 -2
- package/dist/esm/select-control/style.scss +46 -87
- package/dist/esm/settings/MinMaxSetting.js +3 -2
- package/dist/esm/settings/SettingsCard.js +6 -1
- package/dist/esm/settings/SettingsSection.js +5 -5
- package/dist/esm/settings/style.scss +32 -4
- package/dist/esm/style-card/index.js +11 -8
- package/dist/esm/style-card/style.scss +12 -8
- package/dist/esm/style.scss +44 -0
- package/dist/esm/tabbed-navigation/index.js +14 -22
- package/dist/esm/tabbed-navigation/style.scss +56 -34
- package/dist/esm/text-control/index.js +0 -3
- package/dist/esm/text-control/style.scss +0 -126
- package/dist/esm/waiting/index.js +9 -22
- package/dist/esm/waiting/style.scss +9 -20
- package/dist/esm/web-preview/index.js +12 -25
- package/dist/esm/web-preview/style.scss +33 -26
- package/dist/esm/with-wizard/index.js +4 -2
- package/dist/esm/with-wizard/style.scss +44 -89
- package/dist/esm/with-wizard-screen/index.js +18 -22
- package/dist/esm/with-wizard-screen/style.scss +74 -121
- package/dist/esm/wizard/components/WizardError.js +78 -0
- package/dist/esm/wizard/index.js +128 -0
- package/dist/esm/wizard/store/index.js +161 -0
- package/dist/esm/wizard/store/utils.js +17 -0
- package/package.json +1 -1
- package/shared/scss/_colors.scss +15 -0
- package/src/action-card/index.js +28 -18
- package/src/action-card/style.scss +52 -27
- package/src/autocomplete-tokenfield/style.scss +4 -4
- package/src/autocomplete-with-suggestions/index.js +4 -2
- package/src/autocomplete-with-suggestions/style.scss +19 -20
- 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 +60 -30
- package/src/card/index.js +4 -0
- package/src/card/style.scss +29 -62
- package/src/category-autocomplete/index.js +51 -18
- package/src/category-autocomplete/style.scss +20 -22
- package/src/color-picker/index.js +16 -22
- package/src/color-picker/style.scss +20 -160
- package/src/custom-select-control/style.scss +12 -42
- package/src/footer/index.js +19 -8
- package/src/footer/style.scss +9 -10
- package/src/form-token-field/index.js +1 -1
- package/src/form-token-field/style.scss +8 -103
- package/src/global-notices/index.js +1 -1
- package/src/grid/style.scss +14 -1
- package/src/handoff/index.js +7 -7
- package/src/image-upload/style.scss +10 -11
- package/src/index.js +3 -7
- package/src/modal/index.js +2 -5
- package/src/modal/style.scss +19 -131
- package/src/newspack-icon/index.js +7 -2
- package/src/newspack-icon/style.scss +15 -0
- package/src/notice/index.js +7 -1
- package/src/notice/style.scss +38 -10
- package/src/plugin-installer/index.js +2 -2
- package/src/plugin-settings/SettingsSection.js +64 -26
- package/src/plugin-settings/index.js +23 -7
- package/src/plugin-settings/style.scss +7 -0
- package/src/plugin-toggle/index.js +35 -9
- package/src/popover/style.scss +2 -2
- package/src/radio-control/style.scss +1 -2
- package/src/section-header/index.js +25 -6
- package/src/section-header/style.scss +22 -1
- package/src/select-control/ButtonGroupControl.js +13 -6
- package/src/select-control/GroupedSelectControl.js +26 -24
- package/src/select-control/index.js +1 -2
- package/src/select-control/style.scss +46 -87
- 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/style-card/index.js +14 -16
- package/src/style-card/style.scss +12 -8
- package/src/style.scss +44 -0
- package/src/tabbed-navigation/index.js +12 -24
- package/src/tabbed-navigation/style.scss +56 -34
- package/src/text-control/index.js +1 -2
- package/src/text-control/style.scss +0 -126
- package/src/waiting/index.js +7 -18
- package/src/waiting/style.scss +9 -20
- package/src/web-preview/index.js +12 -33
- package/src/web-preview/style.scss +33 -26
- package/src/with-wizard/index.js +7 -5
- package/src/with-wizard/style.scss +44 -89
- package/src/with-wizard-screen/index.js +14 -17
- package/src/with-wizard-screen/style.scss +74 -121
- package/src/wizard/components/WizardError.js +57 -0
- package/src/wizard/index.js +133 -0
- package/src/wizard/store/index.js +126 -0
- package/src/wizard/store/utils.js +16 -0
- package/dist/cjs/button-group/index.js +0 -57
- package/dist/cjs/button-group/style.scss +0 -73
- package/dist/cjs/checkbox-control/index.js +0 -63
- package/dist/cjs/checkbox-control/style.scss +0 -78
- package/dist/cjs/preview-box/index.js +0 -36
- package/dist/cjs/preview-box/style.scss +0 -18
- package/dist/cjs/textarea-control/index.js +0 -54
- package/dist/cjs/textarea-control/style.scss +0 -76
- package/dist/cjs/toggle-control/index.js +0 -58
- package/dist/cjs/toggle-control/style.scss +0 -74
- package/dist/cjs/toggle-group/index.js +0 -71
- package/dist/cjs/toggle-group/style.scss +0 -28
- package/dist/cjs/wizard-pagination/index.js +0 -71
- package/dist/cjs/wizard-pagination/style.scss +0 -74
- package/dist/esm/button-group/index.js +0 -43
- package/dist/esm/button-group/style.scss +0 -73
- package/dist/esm/checkbox-control/index.js +0 -49
- package/dist/esm/checkbox-control/style.scss +0 -78
- package/dist/esm/preview-box/index.js +0 -30
- package/dist/esm/preview-box/style.scss +0 -18
- package/dist/esm/textarea-control/index.js +0 -40
- package/dist/esm/textarea-control/style.scss +0 -76
- package/dist/esm/toggle-control/index.js +0 -44
- package/dist/esm/toggle-control/style.scss +0 -74
- package/dist/esm/toggle-group/index.js +0 -58
- package/dist/esm/toggle-group/style.scss +0 -28
- package/dist/esm/wizard-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
|
@@ -190,7 +190,7 @@ const AutocompleteWithSuggestions = ( {
|
|
|
190
190
|
{ selectedMessage }
|
|
191
191
|
{ 1 < selections.length && _x( ' – ', 'separator character', 'newspack' ) }
|
|
192
192
|
{ 1 < selections.length && (
|
|
193
|
-
<Button onClick={ () => onChange( [] ) } isLink>
|
|
193
|
+
<Button onClick={ () => onChange( [] ) } isLink isDestructive>
|
|
194
194
|
{ __( 'Clear all', 'newspack' ) }
|
|
195
195
|
</Button>
|
|
196
196
|
) }
|
|
@@ -241,7 +241,9 @@ const AutocompleteWithSuggestions = ( {
|
|
|
241
241
|
if ( multiSelect ) {
|
|
242
242
|
const selections = selectedPost ? [ ...selectedItems, selectedPost ] : [ ...selectedItems ];
|
|
243
243
|
const isSelected = !! selections.find(
|
|
244
|
-
_selection =>
|
|
244
|
+
_selection =>
|
|
245
|
+
parseInt( _selection.value ) === parseInt( suggestion.value ) &&
|
|
246
|
+
_selection.label === suggestion.label
|
|
245
247
|
);
|
|
246
248
|
return (
|
|
247
249
|
<CheckboxControl
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Styles for AutocompleteWithSuggestions component.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
@import '../../../shared/scss/colors';
|
|
6
5
|
@import '~@wordpress/base-styles/colors';
|
|
7
6
|
|
|
8
7
|
.newspack-autocomplete-with-suggestions {
|
|
@@ -18,8 +17,9 @@
|
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
.components-spinner {
|
|
20
|
+
margin: 8px;
|
|
21
21
|
right: 0;
|
|
22
|
-
top:
|
|
22
|
+
top: calc( 1.4em + 8px );
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.components-select-control__input {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.components-input-control__backdrop {
|
|
30
|
-
border-color: $gray-
|
|
30
|
+
border-color: $gray-700 !important;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.newspack-autocomplete-with-suggestions__label,
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
&__suggestions-spinner {
|
|
41
41
|
background: $gray-100;
|
|
42
|
-
border: 1px solid $gray-
|
|
42
|
+
border: 1px solid $gray-700;
|
|
43
43
|
border-radius: 2px;
|
|
44
44
|
cursor: progress;
|
|
45
45
|
margin: 16px 0;
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
display: block;
|
|
50
50
|
margin: 0 auto;
|
|
51
51
|
position: relative;
|
|
52
|
+
right: auto;
|
|
52
53
|
top: 0;
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -59,11 +60,11 @@
|
|
|
59
60
|
|
|
60
61
|
.components-form-token-field {
|
|
61
62
|
&__input-container {
|
|
62
|
-
border-color: $gray-
|
|
63
|
+
border-color: $gray-700;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
&__suggestions-list {
|
|
66
|
-
border-top-color: $gray-
|
|
67
|
+
border-top-color: $gray-700;
|
|
67
68
|
margin: 4px -4px -2px;
|
|
68
69
|
}
|
|
69
70
|
|
|
@@ -74,32 +75,30 @@
|
|
|
74
75
|
|
|
75
76
|
p.newspack-autocomplete-with-suggestions__label {
|
|
76
77
|
font-size: inherit;
|
|
77
|
-
margin
|
|
78
|
+
margin: 0 0 8px;
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
&__selected-items {
|
|
81
|
-
border-bottom: 1px solid $gray-
|
|
82
|
+
border-bottom: 1px solid $gray-700;
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-wrap: wrap;
|
|
85
|
+
gap: 8px;
|
|
82
86
|
margin-bottom: 16px;
|
|
83
87
|
padding-bottom: 12px;
|
|
84
88
|
|
|
85
|
-
.newspack-autocomplete-with-suggestions__label {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
.components-button.is-link {
|
|
89
|
-
color: $alert-red;
|
|
90
|
-
font-weight: normal;
|
|
91
|
-
}
|
|
89
|
+
p.newspack-autocomplete-with-suggestions__label {
|
|
90
|
+
flex: 0 0 100%;
|
|
91
|
+
margin: 0;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
&__selected-item-button.components-button.is-tertiary {
|
|
96
96
|
background-color: $gray-300;
|
|
97
97
|
border-radius: 2px;
|
|
98
|
-
color:
|
|
98
|
+
color: $gray-900;
|
|
99
99
|
font-size: 13px;
|
|
100
100
|
height: auto;
|
|
101
|
-
margin
|
|
102
|
-
margin-right: 4px;
|
|
101
|
+
margin: 0;
|
|
103
102
|
padding-left: 8px;
|
|
104
103
|
padding-right: 8px;
|
|
105
104
|
|
|
@@ -117,7 +116,7 @@
|
|
|
117
116
|
&__search-suggestions,
|
|
118
117
|
&__search-suggestions-multiselect {
|
|
119
118
|
border-radius: 2px;
|
|
120
|
-
border: 1px solid $gray-
|
|
119
|
+
border: 1px solid $gray-700;
|
|
121
120
|
max-height: 178px;
|
|
122
121
|
overflow-x: visible;
|
|
123
122
|
overflow-y: auto;
|
|
@@ -151,7 +150,7 @@
|
|
|
151
150
|
|
|
152
151
|
&__search-suggestions {
|
|
153
152
|
border-radius: 2px;
|
|
154
|
-
border: 1px solid $gray-
|
|
153
|
+
border: 1px solid $gray-700;
|
|
155
154
|
padding: 0;
|
|
156
155
|
|
|
157
156
|
.components-button {
|
package/src/button/index.js
CHANGED
|
@@ -14,19 +14,12 @@ import { useState } from '@wordpress/element';
|
|
|
14
14
|
import Router from '../proxied-imports/router';
|
|
15
15
|
import './style.scss';
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* External dependencies
|
|
19
|
-
*/
|
|
20
|
-
import classnames from 'classnames';
|
|
21
|
-
|
|
22
17
|
const { useHistory } = Router;
|
|
23
18
|
|
|
24
|
-
const Button = ( {
|
|
19
|
+
const Button = ( { href, onClick, ...otherProps } ) => {
|
|
25
20
|
const history = useHistory();
|
|
26
21
|
const [ isAwaitingOnClick, setIsAwaitingOnClick ] = useState( false );
|
|
27
22
|
|
|
28
|
-
const classes = classnames( 'newspack-button', isQuaternary && 'is-quaternary', className );
|
|
29
|
-
|
|
30
23
|
// If both onClick and href are present, await the onClick action an then redirect.
|
|
31
24
|
if ( href && onClick ) {
|
|
32
25
|
otherProps.onClick = async () => {
|
|
@@ -42,7 +35,7 @@ const Button = ( { className, isQuaternary, href, onClick, ...otherProps } ) =>
|
|
|
42
35
|
if ( isAwaitingOnClick ) {
|
|
43
36
|
otherProps.disabled = true;
|
|
44
37
|
}
|
|
45
|
-
return <BaseComponent
|
|
38
|
+
return <BaseComponent { ...otherProps } />;
|
|
46
39
|
};
|
|
47
40
|
|
|
48
41
|
export default Button;
|
package/src/button/style.scss
CHANGED
|
@@ -2,351 +2,10 @@
|
|
|
2
2
|
* Button
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@mixin button-style( $background, $border, $text ) {
|
|
9
|
-
background: $background;
|
|
10
|
-
border-color: $border;
|
|
11
|
-
color: $text;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
body[class*='admin-color-'] {
|
|
15
|
-
.newspack-button {
|
|
16
|
-
border-radius: 3px;
|
|
17
|
-
font-size: 14px;
|
|
18
|
-
font-weight: bold;
|
|
19
|
-
height: auto;
|
|
20
|
-
line-height: 24px;
|
|
21
|
-
padding: 11px 24px;
|
|
22
|
-
transition: background 125ms ease-in-out, border-color 125ms ease-in-out,
|
|
23
|
-
box-shadow 125ms ease-in-out, color 125ms ease-in-out;
|
|
24
|
-
|
|
25
|
-
&.is-large {
|
|
26
|
-
font-size: 17px;
|
|
27
|
-
height: auto;
|
|
28
|
-
line-height: 24px;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&.is-small {
|
|
32
|
-
font-size: 14px;
|
|
33
|
-
height: auto;
|
|
34
|
-
line-height: 24px;
|
|
35
|
-
padding: 5px 16px;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
&.icon-only {
|
|
39
|
-
display: inline-flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
height: 36px;
|
|
42
|
-
justify-content: center;
|
|
43
|
-
padding: 0;
|
|
44
|
-
width: 36px;
|
|
45
|
-
|
|
46
|
-
&.size-48 {
|
|
47
|
-
height: 48px;
|
|
48
|
-
width: 48px;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
&:disabled,
|
|
53
|
-
&:disabled:active:enabled,
|
|
54
|
-
&[aria-disabled='true'],
|
|
55
|
-
&[aria-disabled='true']:active:enabled {
|
|
56
|
-
cursor: not-allowed;
|
|
57
|
-
text-shadow: none;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
&:hover,
|
|
61
|
-
&[aria-expended='true'] {
|
|
62
|
-
color: $primary-500;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
&:focus:not( :disabled ) {
|
|
66
|
-
box-shadow: inset 0 0 0 2px $primary-500;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
&.is-button {
|
|
70
|
-
border-radius: 3px;
|
|
71
|
-
font-size: 14px;
|
|
72
|
-
font-weight: bold;
|
|
73
|
-
height: auto;
|
|
74
|
-
line-height: 24px;
|
|
75
|
-
padding: 11px 24px;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
&.is-primary,
|
|
79
|
-
&.is-pressed {
|
|
80
|
-
@include button-style( $primary-500, $primary-600, white );
|
|
81
|
-
border-style: solid;
|
|
82
|
-
border-width: 1px;
|
|
83
|
-
|
|
84
|
-
&:active,
|
|
85
|
-
&:active:enabled,
|
|
86
|
-
&:focus,
|
|
87
|
-
&:focus:enabled,
|
|
88
|
-
&:hover,
|
|
89
|
-
&:not( :disabled ):not( [aria-disabled='true'] ):not( .is-default ):hover {
|
|
90
|
-
@include button-style( $primary-600, $primary-700, white );
|
|
91
|
-
box-shadow: none;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
&:focus,
|
|
95
|
-
&:focus:enabled {
|
|
96
|
-
box-shadow: 0 0 0 1px white, 0 0 0 3px $primary-500;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
&:disabled,
|
|
100
|
-
&:disabled:active:enabled,
|
|
101
|
-
&[aria-disabled='true'],
|
|
102
|
-
&[aria-disabled='true']:active:enabled {
|
|
103
|
-
@include button-style( $primary-500, $primary-600, $primary-300 );
|
|
104
|
-
|
|
105
|
-
&:hover {
|
|
106
|
-
@include button-style( $primary-500, $primary-600, $primary-300 );
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
&.is-large {
|
|
111
|
-
font-size: 17px;
|
|
112
|
-
height: auto;
|
|
113
|
-
line-height: 24px;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
&.is-small {
|
|
117
|
-
font-size: 14px;
|
|
118
|
-
height: auto;
|
|
119
|
-
line-height: 24px;
|
|
120
|
-
padding: 5px 16px;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.newspack-is-waiting {
|
|
124
|
-
fill: white;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
&.is-default,
|
|
129
|
-
&.is-secondary {
|
|
130
|
-
@include button-style( white, $gray-300, $gray-900 );
|
|
131
|
-
border-style: solid;
|
|
132
|
-
border-width: 1px;
|
|
5
|
+
.components-button {
|
|
6
|
+
&.is-destructive {
|
|
7
|
+
&:hover:not( :disabled ) {
|
|
133
8
|
box-shadow: none;
|
|
134
|
-
|
|
135
|
-
&:active,
|
|
136
|
-
&:active:enabled,
|
|
137
|
-
&:focus,
|
|
138
|
-
&:focus:enabled,
|
|
139
|
-
&:hover,
|
|
140
|
-
&:not( :disabled ):not( [aria-disabled='true'] ):not( .is-default ):hover {
|
|
141
|
-
@include button-style( $gray-100, $primary-500, $primary-500 );
|
|
142
|
-
box-shadow: none;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
&:focus,
|
|
146
|
-
&:focus:enabled {
|
|
147
|
-
box-shadow: 0 0 0 1px white, 0 0 0 3px $primary-500;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
&:disabled,
|
|
151
|
-
&:disabled:active:enabled,
|
|
152
|
-
&[aria-disabled='true'],
|
|
153
|
-
&[aria-disabled='true']:active:enabled {
|
|
154
|
-
@include button-style( white, $gray-300, $gray-600 );
|
|
155
|
-
|
|
156
|
-
&:hover {
|
|
157
|
-
@include button-style( white, $gray-300, $gray-600 );
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
&.is-large {
|
|
162
|
-
font-size: 17px;
|
|
163
|
-
height: auto;
|
|
164
|
-
line-height: 24px;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
&.is-small {
|
|
168
|
-
font-size: 14px;
|
|
169
|
-
height: auto;
|
|
170
|
-
line-height: 24px;
|
|
171
|
-
padding: 5px 16px;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
&.is-tertiary {
|
|
176
|
-
@include button-style( $gray-100, $gray-300, $gray-900 );
|
|
177
|
-
border-style: solid;
|
|
178
|
-
border-width: 1px;
|
|
179
|
-
height: auto;
|
|
180
|
-
line-height: 24px;
|
|
181
|
-
padding: 11px 24px;
|
|
182
|
-
|
|
183
|
-
&:active,
|
|
184
|
-
&:active:enabled,
|
|
185
|
-
&:focus,
|
|
186
|
-
&:focus:enabled,
|
|
187
|
-
&:hover,
|
|
188
|
-
&:not( :disabled ):not( [aria-disabled='true'] ):not( .is-default ):hover {
|
|
189
|
-
@include button-style( $gray-200, $gray-600, $gray-900 );
|
|
190
|
-
box-shadow: none;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
&:focus,
|
|
194
|
-
&:focus:enabled {
|
|
195
|
-
box-shadow: 0 0 0 1px white, 0 0 0 3px $primary-500;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
&:disabled,
|
|
199
|
-
&:disabled:active:enabled,
|
|
200
|
-
&[aria-disabled='true'],
|
|
201
|
-
&[aria-disabled='true']:active:enabled {
|
|
202
|
-
@include button-style( $gray-100, $gray-300, $gray-700 );
|
|
203
|
-
|
|
204
|
-
&:hover {
|
|
205
|
-
@include button-style( $gray-100, $gray-300, $gray-700 );
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
&.is-large {
|
|
210
|
-
font-size: 17px;
|
|
211
|
-
height: auto;
|
|
212
|
-
line-height: 24px;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
&.is-small {
|
|
216
|
-
font-size: 14px;
|
|
217
|
-
height: auto;
|
|
218
|
-
line-height: 24px;
|
|
219
|
-
padding: 5px 16px;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
.newspack-is-waiting {
|
|
223
|
-
fill: $gray-700;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
&.is-quaternary {
|
|
228
|
-
@include button-style( transparent, transparent, $gray-900 );
|
|
229
|
-
border-style: solid;
|
|
230
|
-
border-width: 1px;
|
|
231
|
-
color: $gray-900;
|
|
232
|
-
|
|
233
|
-
&:focus,
|
|
234
|
-
&:hover {
|
|
235
|
-
border-color: $gray-200;
|
|
236
|
-
box-shadow: none;
|
|
237
|
-
color: $primary-500;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
&:focus-visible {
|
|
241
|
-
border-color: $primary-500;
|
|
242
|
-
box-shadow: inset 0 0 0 1px $primary-500;
|
|
243
|
-
color: $primary-500;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
&:disabled,
|
|
247
|
-
&:disabled:active:enabled,
|
|
248
|
-
&[aria-disabled='true'],
|
|
249
|
-
&[aria-disabled='true']:active:enabled {
|
|
250
|
-
@include button-style( transparent, transparent, $gray-600 );
|
|
251
|
-
opacity: 1;
|
|
252
|
-
|
|
253
|
-
&:hover {
|
|
254
|
-
@include button-style( transparent, transparent, $gray-600 );
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
&.is-link {
|
|
260
|
-
background: none;
|
|
261
|
-
border: 0;
|
|
262
|
-
border-radius: 0;
|
|
263
|
-
font-weight: normal;
|
|
264
|
-
padding: 0;
|
|
265
|
-
transition: color 125ms ease-in-out, outline 125ms ease-in-out;
|
|
266
|
-
|
|
267
|
-
&:not( .is-destructive ) {
|
|
268
|
-
color: $primary-500;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
&:active,
|
|
272
|
-
&:active:enabled,
|
|
273
|
-
&:focus,
|
|
274
|
-
&:focus:enabled,
|
|
275
|
-
&:hover,
|
|
276
|
-
&:not( :disabled ):not( [aria-disabled='true'] ):not( .is-default ):hover {
|
|
277
|
-
background: transparent;
|
|
278
|
-
color: $primary-600;
|
|
279
|
-
text-decoration: none;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
&:focus,
|
|
283
|
-
&:focus:enabled,
|
|
284
|
-
&.is-destructive:not( :disabled ):hover {
|
|
285
|
-
box-shadow: none;
|
|
286
|
-
outline: none;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
&:focus-visible,
|
|
290
|
-
&:focus-visible:enabled {
|
|
291
|
-
outline: 2px solid $primary-500;
|
|
292
|
-
outline-offset: 2px;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
&.is-small,
|
|
296
|
-
&.is-large {
|
|
297
|
-
padding: 0;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
&.is-destructive {
|
|
302
|
-
&:active,
|
|
303
|
-
&:active:enabled,
|
|
304
|
-
&:focus,
|
|
305
|
-
&:focus:enabled,
|
|
306
|
-
&:hover,
|
|
307
|
-
&:not( :disabled ):not( [aria-disabled='true'] ):not( .is-default ):hover {
|
|
308
|
-
background: $gray-100;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
&:focus,
|
|
312
|
-
&:focus:enabled,
|
|
313
|
-
&:focus:not( :disabled ) {
|
|
314
|
-
box-shadow: inset 0 0 0 1px $alert-red, 0 0 0 1px white, 0 0 0 3px $alert-red;
|
|
315
|
-
color: $alert-red;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
.components-tooltip {
|
|
320
|
-
font-weight: normal;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
// Popover Active
|
|
324
|
-
|
|
325
|
-
&.popover-active {
|
|
326
|
-
border: 1px solid $gray-300;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
// Icon-only
|
|
330
|
-
|
|
331
|
-
&.has-icon:not( .has-text ) {
|
|
332
|
-
align-items: center;
|
|
333
|
-
height: 40px;
|
|
334
|
-
justify-content: center;
|
|
335
|
-
min-width: 40px;
|
|
336
|
-
padding: 0;
|
|
337
|
-
width: 40px;
|
|
338
|
-
|
|
339
|
-
&.is-small {
|
|
340
|
-
height: 36px;
|
|
341
|
-
min-width: 36px;
|
|
342
|
-
width: 36px;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
&.is-large {
|
|
346
|
-
height: 48px;
|
|
347
|
-
min-width: 48px;
|
|
348
|
-
width: 48px;
|
|
349
|
-
}
|
|
350
9
|
}
|
|
351
10
|
}
|
|
352
11
|
}
|
package/src/button-card/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { Icon, chevronRight } from '@wordpress/icons';
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
+
import { Grid } from '../';
|
|
14
15
|
import './style.scss';
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -23,23 +24,36 @@ class ButtonCard extends Component {
|
|
|
23
24
|
* Render
|
|
24
25
|
*/
|
|
25
26
|
render() {
|
|
26
|
-
const {
|
|
27
|
+
const {
|
|
28
|
+
chevron,
|
|
29
|
+
className,
|
|
30
|
+
desc,
|
|
31
|
+
grouped,
|
|
32
|
+
icon,
|
|
33
|
+
isDestructive,
|
|
34
|
+
isPressed,
|
|
35
|
+
isSmall,
|
|
36
|
+
title,
|
|
37
|
+
...otherProps
|
|
38
|
+
} = this.props;
|
|
27
39
|
const classes = classnames(
|
|
28
40
|
'newspack-button-card',
|
|
29
41
|
className,
|
|
30
42
|
chevron && 'has-chevron',
|
|
31
43
|
grouped && 'grouped',
|
|
32
44
|
icon && 'has-icon',
|
|
45
|
+
isDestructive && 'is-destructive',
|
|
46
|
+
isPressed && 'is-pressed',
|
|
33
47
|
isSmall && 'is-small'
|
|
34
48
|
);
|
|
35
49
|
|
|
36
50
|
return (
|
|
37
51
|
<a className={ classes } { ...otherProps }>
|
|
38
52
|
{ icon && <Icon icon={ icon } height={ 48 } width={ 48 } /> }
|
|
39
|
-
<
|
|
40
|
-
{ title && <
|
|
41
|
-
{ desc && <
|
|
42
|
-
</
|
|
53
|
+
<Grid noMargin columns={ 1 } gutter={ 8 }>
|
|
54
|
+
{ title && <h3>{ title }</h3> }
|
|
55
|
+
{ desc && <p>{ desc }</p> }
|
|
56
|
+
</Grid>
|
|
43
57
|
{ chevron && <Icon icon={ chevronRight } height={ 24 } width={ 24 } /> }
|
|
44
58
|
</a>
|
|
45
59
|
);
|