newspack-components 2.0.1 → 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 +32 -22
- 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 +69 -35
- package/dist/cjs/card/index.js +3 -1
- package/dist/cjs/card/style.scss +34 -61
- package/dist/cjs/category-autocomplete/index.js +52 -13
- package/dist/cjs/category-autocomplete/style.scss +19 -15
- 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/index.js +1 -1
- package/dist/cjs/grid/style.scss +29 -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 +4 -2
- package/dist/cjs/plugin-settings/SettingsSection.js +76 -45
- package/dist/cjs/plugin-settings/index.js +49 -34
- 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 +26 -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 +77 -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 +33 -23
- 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 +69 -35
- package/dist/esm/card/index.js +3 -1
- package/dist/esm/card/style.scss +34 -61
- package/dist/esm/category-autocomplete/index.js +54 -14
- package/dist/esm/category-autocomplete/style.scss +19 -15
- 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/index.js +1 -1
- package/dist/esm/grid/style.scss +29 -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 +5 -2
- package/dist/esm/plugin-settings/SettingsSection.js +74 -46
- package/dist/esm/plugin-settings/index.js +48 -34
- 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 +26 -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 +77 -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 +2 -1
- package/shared/scss/_colors.scss +15 -0
- package/src/action-card/index.js +31 -19
- 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 +69 -35
- package/src/card/index.js +4 -0
- package/src/card/style.scss +34 -61
- package/src/category-autocomplete/index.js +51 -18
- package/src/category-autocomplete/style.scss +19 -15
- 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/index.js +1 -1
- package/src/grid/style.scss +29 -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 +4 -2
- package/src/plugin-settings/SettingsSection.js +65 -27
- package/src/plugin-settings/index.js +45 -18
- 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 +26 -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 +77 -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 -68
- 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 -68
- 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 -68
- 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
package/copy-styles.js
CHANGED
|
@@ -66,10 +66,13 @@ class ActionCard extends _element.Component {
|
|
|
66
66
|
notification,
|
|
67
67
|
notificationLevel,
|
|
68
68
|
notificationHTML,
|
|
69
|
+
actionContent,
|
|
69
70
|
actionText,
|
|
70
71
|
secondaryActionText,
|
|
72
|
+
secondaryDestructive,
|
|
71
73
|
image,
|
|
72
74
|
imageLink,
|
|
75
|
+
indent,
|
|
73
76
|
isSmall,
|
|
74
77
|
isMedium,
|
|
75
78
|
simple,
|
|
@@ -79,10 +82,11 @@ class ActionCard extends _element.Component {
|
|
|
79
82
|
titleLink,
|
|
80
83
|
toggleChecked,
|
|
81
84
|
toggleOnChange,
|
|
82
|
-
hasGreyHeader
|
|
85
|
+
hasGreyHeader,
|
|
86
|
+
isPending
|
|
83
87
|
} = this.props;
|
|
84
88
|
const hasChildren = notification || children;
|
|
85
|
-
const classes = (0, _classnames.default)('newspack-action-card', simple && 'newspack-card--is-clickable', hasGreyHeader && 'newspack-card--has-grey-header', hasChildren && 'newspack-card--has-children', isSmall && 'is-small', isMedium && 'is-medium', className);
|
|
89
|
+
const classes = (0, _classnames.default)('newspack-action-card', simple && 'newspack-card--is-clickable', hasGreyHeader && 'newspack-card--has-grey-header', hasChildren && 'newspack-card--has-children', indent && 'newspack-card--indent', isSmall && 'is-small', isMedium && 'is-medium', className);
|
|
86
90
|
const titleProps = toggleOnChange && !titleLink && !disabled ? {
|
|
87
91
|
onClick: () => toggleOnChange(!toggleChecked),
|
|
88
92
|
tabIndex: '0'
|
|
@@ -95,7 +99,7 @@ class ActionCard extends _element.Component {
|
|
|
95
99
|
onClick: simple && onClick,
|
|
96
100
|
children: [(0, _jsxRuntime.jsxs)("div", {
|
|
97
101
|
className: "newspack-action-card__region newspack-action-card__region-top",
|
|
98
|
-
children: [toggleOnChange && (0, _jsxRuntime.jsx)(
|
|
102
|
+
children: [toggleOnChange && (0, _jsxRuntime.jsx)(_components.ToggleControl, {
|
|
99
103
|
checked: toggleChecked,
|
|
100
104
|
onChange: toggleOnChange,
|
|
101
105
|
disabled: disabled
|
|
@@ -111,31 +115,36 @@ class ActionCard extends _element.Component {
|
|
|
111
115
|
}), checkbox && !toggleOnChange && (0, _jsxRuntime.jsx)("div", {
|
|
112
116
|
className: "newspack-action-card__region newspack-action-card__region-left",
|
|
113
117
|
children: (0, _jsxRuntime.jsx)("span", {
|
|
114
|
-
className: (0, _classnames.default)('newspack-checkbox-icon', 'is-primary', 'checked' === checkbox && 'newspack-checkbox-icon--checked'),
|
|
118
|
+
className: (0, _classnames.default)('newspack-checkbox-icon', 'is-primary', 'checked' === checkbox && 'newspack-checkbox-icon--checked', isPending && 'newspack-checkbox-icon--pending'),
|
|
115
119
|
children: 'checked' === checkbox && (0, _jsxRuntime.jsx)(_icons.Icon, {
|
|
116
120
|
icon: _icons.check
|
|
117
121
|
})
|
|
118
122
|
})
|
|
119
|
-
}), (0, _jsxRuntime.
|
|
123
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
120
124
|
className: "newspack-action-card__region newspack-action-card__region-center",
|
|
121
|
-
children:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
125
|
+
children: (0, _jsxRuntime.jsxs)(_.Grid, {
|
|
126
|
+
columns: 1,
|
|
127
|
+
gutter: 8,
|
|
128
|
+
noMargin: true,
|
|
129
|
+
children: [(0, _jsxRuntime.jsxs)("h2", {
|
|
130
|
+
children: [(0, _jsxRuntime.jsx)("span", {
|
|
131
|
+
className: "newspack-action-card__title",
|
|
132
|
+
...titleProps,
|
|
133
|
+
children: titleLink ? (0, _jsxRuntime.jsx)("a", {
|
|
134
|
+
href: titleLink,
|
|
135
|
+
children: title
|
|
136
|
+
}) : title
|
|
137
|
+
}), badges?.length && badges.map((badgeText, i) => (0, _jsxRuntime.jsx)("span", {
|
|
138
|
+
className: "newspack-action-card__badge",
|
|
139
|
+
children: badgeText
|
|
140
|
+
}, `badge-${i}`))]
|
|
141
|
+
}), description && (0, _jsxRuntime.jsxs)("p", {
|
|
142
|
+
children: [typeof description === 'string' && description, typeof description === 'function' && description()]
|
|
143
|
+
})]
|
|
144
|
+
})
|
|
145
|
+
}), (actionText || isDisplayingSecondaryAction || actionContent) && (0, _jsxRuntime.jsxs)("div", {
|
|
137
146
|
className: "newspack-action-card__region newspack-action-card__region-right",
|
|
138
|
-
children: [actionText && (handoff ? (0, _jsxRuntime.jsx)(_.Handoff, {
|
|
147
|
+
children: [actionContent && actionContent, actionText && (handoff ? (0, _jsxRuntime.jsx)(_.Handoff, {
|
|
139
148
|
plugin: handoff,
|
|
140
149
|
editLink: editLink,
|
|
141
150
|
compact: true,
|
|
@@ -160,6 +169,7 @@ class ActionCard extends _element.Component {
|
|
|
160
169
|
isLink: true,
|
|
161
170
|
onClick: onSecondaryActionClick,
|
|
162
171
|
className: "newspack-action-card__secondary_button",
|
|
172
|
+
isDestructive: secondaryDestructive,
|
|
163
173
|
children: secondaryActionText
|
|
164
174
|
})]
|
|
165
175
|
})]
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
@import '~@wordpress/base-styles/colors';
|
|
6
|
-
@import '../../../shared/scss/colors';
|
|
7
6
|
|
|
8
7
|
.newspack-card.newspack-action-card {
|
|
9
8
|
padding: 0;
|
|
@@ -34,7 +33,7 @@
|
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
&.newspack-card__is-primary {
|
|
37
|
-
box-shadow: inset 4px 0 0
|
|
36
|
+
box-shadow: inset 4px 0 0 var( --wp-admin-theme-color );
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
&.newspack-card__is-secondary {
|
|
@@ -150,20 +149,49 @@
|
|
|
150
149
|
|
|
151
150
|
&.newspack-card--has-grey-header {
|
|
152
151
|
overflow: hidden;
|
|
152
|
+
|
|
153
153
|
&.newspack-card--has-children {
|
|
154
154
|
.newspack-action-card__region-top {
|
|
155
155
|
border-bottom: 1px solid $gray-300;
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
+
|
|
158
159
|
.newspack-action-card__region-top {
|
|
159
|
-
background-color:
|
|
160
|
+
background-color: rgba( black, 0.025 );
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.newspack-action-card__region-center {
|
|
164
|
+
p {
|
|
165
|
+
color: darken( $gray-700, 0.75% );
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Indent
|
|
171
|
+
|
|
172
|
+
&.newspack-card--indent {
|
|
173
|
+
margin-left: 56px;
|
|
174
|
+
position: relative;
|
|
175
|
+
|
|
176
|
+
&::before {
|
|
177
|
+
border: 0 solid $gray-300;
|
|
178
|
+
border-left-width: 1px;
|
|
179
|
+
border-bottom-width: 1px;
|
|
180
|
+
border-radius: 0 0 0 2px;
|
|
181
|
+
bottom: 50%;
|
|
182
|
+
content: '';
|
|
183
|
+
display: block;
|
|
184
|
+
left: -28px;
|
|
185
|
+
position: absolute;
|
|
186
|
+
right: 100%;
|
|
187
|
+
top: -17px;
|
|
160
188
|
}
|
|
161
189
|
}
|
|
162
190
|
|
|
163
191
|
// Typography
|
|
164
192
|
|
|
165
193
|
h2,
|
|
166
|
-
p {
|
|
194
|
+
p:not( [class*='components-base-control'] ) {
|
|
167
195
|
margin: 0;
|
|
168
196
|
max-width: 100%;
|
|
169
197
|
width: 100%;
|
|
@@ -186,7 +214,7 @@
|
|
|
186
214
|
&:active,
|
|
187
215
|
&:focus,
|
|
188
216
|
&:hover {
|
|
189
|
-
color:
|
|
217
|
+
color: var( --wp-admin-theme-color );
|
|
190
218
|
}
|
|
191
219
|
}
|
|
192
220
|
}
|
|
@@ -270,6 +298,14 @@
|
|
|
270
298
|
align-items: flex-start;
|
|
271
299
|
flex: 1 1 auto;
|
|
272
300
|
flex-wrap: wrap;
|
|
301
|
+
|
|
302
|
+
.newspack-grid {
|
|
303
|
+
width: 100%;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
p {
|
|
307
|
+
color: $gray-700;
|
|
308
|
+
}
|
|
273
309
|
}
|
|
274
310
|
|
|
275
311
|
.newspack-action-card__region-right {
|
|
@@ -289,6 +325,10 @@
|
|
|
289
325
|
> * {
|
|
290
326
|
text-align: inherit;
|
|
291
327
|
}
|
|
328
|
+
|
|
329
|
+
.newspack-action-card__secondary_button {
|
|
330
|
+
margin-top: 8px;
|
|
331
|
+
}
|
|
292
332
|
}
|
|
293
333
|
|
|
294
334
|
// Waiting
|
|
@@ -326,34 +366,19 @@
|
|
|
326
366
|
margin: 0;
|
|
327
367
|
}
|
|
328
368
|
|
|
329
|
-
// Buttons
|
|
330
|
-
|
|
331
|
-
.newspack-button {
|
|
332
|
-
&.newspack-action-card__secondary_button {
|
|
333
|
-
&.is-link {
|
|
334
|
-
color: $alert-red;
|
|
335
|
-
|
|
336
|
-
&:active,
|
|
337
|
-
&:focus,
|
|
338
|
-
&:hover {
|
|
339
|
-
color: darken( $alert-red, 20% );
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
369
|
// Badge
|
|
346
370
|
|
|
347
371
|
.newspack-action-card__badge {
|
|
348
|
-
|
|
349
|
-
border-radius:
|
|
372
|
+
background: $gray-100;
|
|
373
|
+
border-radius: 2px;
|
|
374
|
+
color: $gray-900;
|
|
350
375
|
display: block;
|
|
351
376
|
flex: 0 0 auto;
|
|
352
|
-
font-size:
|
|
377
|
+
font-size: 10px;
|
|
353
378
|
font-weight: bold;
|
|
354
|
-
line-height:
|
|
355
|
-
margin:
|
|
356
|
-
padding:
|
|
379
|
+
line-height: 1.4;
|
|
380
|
+
margin: 0 8px 0 0;
|
|
381
|
+
padding: 2px 8px;
|
|
357
382
|
text-transform: uppercase;
|
|
358
383
|
|
|
359
384
|
+ .newspack-action-card__badge {
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
* Autocomplete Token Field
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
@import '../../../shared/scss/colors';
|
|
6
5
|
@import '~@wordpress/base-styles/colors';
|
|
7
6
|
|
|
8
7
|
.newspack-autocomplete-tokenfield {
|
|
9
8
|
position: relative;
|
|
10
9
|
|
|
11
10
|
.components-spinner {
|
|
11
|
+
margin: 8px;
|
|
12
12
|
position: absolute;
|
|
13
|
-
right:
|
|
14
|
-
top:
|
|
13
|
+
right: 0;
|
|
14
|
+
top: calc( 1.4em + 8px );
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/* Workaround for hard-coded help text in FormTokenField. */
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
.components-button:focus:not( :disabled ) {
|
|
41
|
-
box-shadow: inset 0 0 0
|
|
41
|
+
box-shadow: inset 0 0 0 var( --wp-admin-border-width-focus ) var( --wp-admin-theme-color );
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -156,7 +156,7 @@ const AutocompleteWithSuggestions = _ref => {
|
|
|
156
156
|
return posts.reduce((acc, post) => {
|
|
157
157
|
acc.push({
|
|
158
158
|
value: parseInt(post.id),
|
|
159
|
-
label: (0, _htmlEntities.decodeEntities)(post
|
|
159
|
+
label: (0, _htmlEntities.decodeEntities)(post?.title.rendered) || __('(no title)', 'newspack')
|
|
160
160
|
});
|
|
161
161
|
return acc;
|
|
162
162
|
}, []);
|
|
@@ -209,6 +209,7 @@ const AutocompleteWithSuggestions = _ref => {
|
|
|
209
209
|
children: [selectedMessage, 1 < selections.length && _x(' – ', 'separator character', 'newspack'), 1 < selections.length && (0, _jsxRuntime.jsx)(_components.Button, {
|
|
210
210
|
onClick: () => onChange([]),
|
|
211
211
|
isLink: true,
|
|
212
|
+
isDestructive: true,
|
|
212
213
|
children: __('Clear all', 'newspack')
|
|
213
214
|
})]
|
|
214
215
|
}), selections.map(selection => (0, _jsxRuntime.jsx)(_components.Button, {
|
|
@@ -246,7 +247,7 @@ const AutocompleteWithSuggestions = _ref => {
|
|
|
246
247
|
const renderSuggestion = suggestion => {
|
|
247
248
|
if (multiSelect) {
|
|
248
249
|
const selections = selectedPost ? [...selectedItems, selectedPost] : [...selectedItems];
|
|
249
|
-
const isSelected = !!selections.find(_selection => parseInt(_selection.value) === parseInt(suggestion.value));
|
|
250
|
+
const isSelected = !!selections.find(_selection => parseInt(_selection.value) === parseInt(suggestion.value) && _selection.label === suggestion.label);
|
|
250
251
|
return (0, _jsxRuntime.jsx)(_components.CheckboxControl, {
|
|
251
252
|
checked: isSelected,
|
|
252
253
|
onChange: () => handleOnChange([suggestion]),
|
|
@@ -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/dist/cjs/button/index.js
CHANGED
|
@@ -15,8 +15,6 @@ var _router = _interopRequireDefault(require("../proxied-imports/router"));
|
|
|
15
15
|
|
|
16
16
|
require("./style.scss");
|
|
17
17
|
|
|
18
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
|
-
|
|
20
18
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
21
19
|
|
|
22
20
|
/**
|
|
@@ -30,25 +28,18 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
|
30
28
|
/**
|
|
31
29
|
* Internal dependencies
|
|
32
30
|
*/
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* External dependencies
|
|
36
|
-
*/
|
|
37
31
|
const {
|
|
38
32
|
useHistory
|
|
39
33
|
} = _router.default;
|
|
40
34
|
|
|
41
35
|
const Button = _ref => {
|
|
42
36
|
let {
|
|
43
|
-
className,
|
|
44
|
-
isQuaternary,
|
|
45
37
|
href,
|
|
46
38
|
onClick,
|
|
47
39
|
...otherProps
|
|
48
40
|
} = _ref;
|
|
49
41
|
const history = useHistory();
|
|
50
|
-
const [isAwaitingOnClick, setIsAwaitingOnClick] = (0, _element.useState)(false);
|
|
51
|
-
const classes = (0, _classnames.default)('newspack-button', isQuaternary && 'is-quaternary', className); // If both onClick and href are present, await the onClick action an then redirect.
|
|
42
|
+
const [isAwaitingOnClick, setIsAwaitingOnClick] = (0, _element.useState)(false); // If both onClick and href are present, await the onClick action an then redirect.
|
|
52
43
|
|
|
53
44
|
if (href && onClick) {
|
|
54
45
|
otherProps.onClick = async () => {
|
|
@@ -66,9 +57,7 @@ const Button = _ref => {
|
|
|
66
57
|
otherProps.disabled = true;
|
|
67
58
|
}
|
|
68
59
|
|
|
69
|
-
return (0, _jsxRuntime.jsx)(_components.Button, {
|
|
70
|
-
className: classes,
|
|
71
|
-
...otherProps
|
|
60
|
+
return (0, _jsxRuntime.jsx)(_components.Button, { ...otherProps
|
|
72
61
|
});
|
|
73
62
|
};
|
|
74
63
|
|