@wordpress/components 28.8.1-next.5368f64a9.0 → 28.8.2
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/CHANGELOG.md +16 -1
- package/build/box-control/all-input-control.js +1 -2
- package/build/box-control/all-input-control.js.map +1 -1
- package/build/box-control/utils.js +1 -1
- package/build/box-control/utils.js.map +1 -1
- package/build/card/card/component.js +2 -2
- package/build/card/card/component.js.map +1 -1
- package/build/card/styles.js +18 -18
- package/build/card/styles.js.map +1 -1
- package/build/combobox-control/index.js +3 -1
- package/build/combobox-control/index.js.map +1 -1
- package/build/combobox-control/types.js.map +1 -1
- package/build/custom-select-control-v2/styles.js +9 -9
- package/build/custom-select-control-v2/styles.js.map +1 -1
- package/build/dropdown-menu-v2/styles.js +17 -17
- package/build/dropdown-menu-v2/styles.js.map +1 -1
- package/build/modal/index.js +17 -9
- package/build/modal/index.js.map +1 -1
- package/build/modal/types.js.map +1 -1
- package/build/modal/use-modal-exit-animation.js +75 -0
- package/build/modal/use-modal-exit-animation.js.map +1 -0
- package/build/range-control/styles/range-control-styles.js +28 -28
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/tabs/styles.js +3 -3
- package/build/tabs/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js +9 -9
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build/utils/config-values.js +5 -17
- package/build/utils/config-values.js.map +1 -1
- package/build-module/box-control/all-input-control.js +2 -2
- package/build-module/box-control/all-input-control.js.map +1 -1
- package/build-module/box-control/utils.js +1 -1
- package/build-module/box-control/utils.js.map +1 -1
- package/build-module/card/card/component.js +2 -2
- package/build-module/card/card/component.js.map +1 -1
- package/build-module/card/styles.js +18 -18
- package/build-module/card/styles.js.map +1 -1
- package/build-module/combobox-control/index.js +3 -1
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/combobox-control/types.js.map +1 -1
- package/build-module/custom-select-control-v2/styles.js +9 -9
- package/build-module/custom-select-control-v2/styles.js.map +1 -1
- package/build-module/dropdown-menu-v2/styles.js +17 -17
- package/build-module/dropdown-menu-v2/styles.js.map +1 -1
- package/build-module/modal/index.js +18 -9
- package/build-module/modal/index.js.map +1 -1
- package/build-module/modal/types.js.map +1 -1
- package/build-module/modal/use-modal-exit-animation.js +68 -0
- package/build-module/modal/use-modal-exit-animation.js.map +1 -0
- package/build-module/range-control/styles/range-control-styles.js +28 -28
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/tabs/styles.js +3 -3
- package/build-module/tabs/styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +9 -9
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build-module/utils/config-values.js +5 -17
- package/build-module/utils/config-values.js.map +1 -1
- package/build-style/style-rtl.css +51 -6
- package/build-style/style.css +51 -6
- package/build-types/box-control/all-input-control.d.ts.map +1 -1
- package/build-types/box-control/utils.d.ts +1 -1
- package/build-types/box-control/utils.d.ts.map +1 -1
- package/build-types/button-group/stories/index.story.d.ts +2 -2
- package/build-types/button-group/stories/index.story.d.ts.map +1 -1
- package/build-types/combobox-control/index.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.story.d.ts +4 -0
- package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/combobox-control/types.d.ts +4 -0
- package/build-types/combobox-control/types.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/modal/types.d.ts +6 -10
- package/build-types/modal/types.d.ts.map +1 -1
- package/build-types/modal/use-modal-exit-animation.d.ts +9 -0
- package/build-types/modal/use-modal-exit-animation.d.ts.map +1 -0
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/utils/config-values.d.ts +0 -11
- package/package.json +19 -19
- package/src/box-control/README.md +7 -0
- package/src/box-control/all-input-control.tsx +2 -3
- package/src/box-control/utils.ts +1 -1
- package/src/button-group/stories/index.story.tsx +10 -15
- package/src/card/card/component.tsx +1 -1
- package/src/card/styles.ts +1 -1
- package/src/card/test/__snapshots__/index.tsx.snap +54 -54
- package/src/combobox-control/README.md +7 -0
- package/src/combobox-control/index.tsx +2 -0
- package/src/combobox-control/test/index.tsx +40 -0
- package/src/combobox-control/types.ts +4 -0
- package/src/custom-select-control-v2/styles.ts +1 -0
- package/src/dropdown-menu-v2/styles.ts +1 -1
- package/src/form-toggle/style.scss +1 -0
- package/src/modal/index.tsx +27 -13
- package/src/modal/style.scss +30 -3
- package/src/modal/types.ts +6 -18
- package/src/modal/use-modal-exit-animation.ts +99 -0
- package/src/popover/style.scss +3 -2
- package/src/range-control/styles/range-control-styles.ts +1 -0
- package/src/resizable-box/style.scss +1 -1
- package/src/snackbar/style.scss +1 -1
- package/src/tabs/styles.ts +1 -1
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +1 -1
- package/src/tooltip/style.scss +1 -0
- package/src/utils/config-values.js +5 -20
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type { Meta,
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -22,18 +22,13 @@ const meta: Meta< typeof ButtonGroup > = {
|
|
|
22
22
|
};
|
|
23
23
|
export default meta;
|
|
24
24
|
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Button
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</Button>
|
|
35
|
-
</ButtonGroup>
|
|
36
|
-
);
|
|
25
|
+
export const Default: StoryObj< typeof ButtonGroup > = {
|
|
26
|
+
args: {
|
|
27
|
+
children: (
|
|
28
|
+
<>
|
|
29
|
+
<Button variant="primary">Button 1</Button>
|
|
30
|
+
<Button>Button 2</Button>
|
|
31
|
+
</>
|
|
32
|
+
),
|
|
33
|
+
},
|
|
37
34
|
};
|
|
38
|
-
|
|
39
|
-
export const Default: StoryFn< typeof ButtonGroup > = Template.bind( {} );
|
package/src/card/styles.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { COLORS, CONFIG } from '../utils';
|
|
|
12
12
|
// (as opposed to the `border` property), the value of the border radius needs
|
|
13
13
|
// to be adjusted by removing 1px (this is because the `box-shadow` renders
|
|
14
14
|
// as an "outer radius").
|
|
15
|
-
const adjustedBorderRadius = `calc(${ CONFIG.
|
|
15
|
+
const adjustedBorderRadius = `calc(${ CONFIG.radiusLarge } - 1px)`;
|
|
16
16
|
|
|
17
17
|
export const Card = css`
|
|
18
18
|
box-shadow: 0 0 0 1px ${ CONFIG.surfaceBorderColor };
|
|
@@ -8,8 +8,8 @@ Snapshot Diff:
|
|
|
8
8
|
@@ -1,8 +1,8 @@
|
|
9
9
|
<div>
|
|
10
10
|
<div
|
|
11
|
-
- class="components-card__body components-card-body css-
|
|
12
|
-
+ class="components-scrollable components-card__body components-card-body css-
|
|
11
|
+
- class="components-card__body components-card-body css-12jqy32-PolymorphicDiv-Body-borderRadius-medium e19lxcc00"
|
|
12
|
+
+ class="components-scrollable components-card__body components-card-body css-26nv7r-PolymorphicDiv-Scrollable-scrollableScrollbar-scrollY-Body-borderRadius-medium e19lxcc00"
|
|
13
13
|
data-wp-c16t="true"
|
|
14
14
|
data-wp-component="CardBody"
|
|
15
15
|
>
|
|
@@ -25,8 +25,8 @@ Snapshot Diff:
|
|
|
25
25
|
@@ -1,8 +1,8 @@
|
|
26
26
|
<div>
|
|
27
27
|
<div
|
|
28
|
-
- class="components-card__body components-card-body css-
|
|
29
|
-
+ class="components-card__body components-card-body css-
|
|
28
|
+
- class="components-card__body components-card-body css-12jqy32-PolymorphicDiv-Body-borderRadius-medium e19lxcc00"
|
|
29
|
+
+ class="components-card__body components-card-body css-1j7lja1-PolymorphicDiv-Body-borderRadius-medium-shady e19lxcc00"
|
|
30
30
|
data-wp-c16t="true"
|
|
31
31
|
data-wp-component="CardBody"
|
|
32
32
|
>
|
|
@@ -42,8 +42,8 @@ Snapshot Diff:
|
|
|
42
42
|
@@ -1,8 +1,8 @@
|
|
43
43
|
<div>
|
|
44
44
|
<div
|
|
45
|
-
- class="components-flex components-card__footer components-card-footer css-
|
|
46
|
-
+ class="components-flex components-card__footer components-card-footer css-
|
|
45
|
+
- class="components-flex components-card__footer components-card-footer css-19sc0cg-PolymorphicDiv-Flex-base-ItemsRow-Footer-borderRadius-borderColor-medium e19lxcc00"
|
|
46
|
+
+ class="components-flex components-card__footer components-card-footer css-14budie-PolymorphicDiv-Flex-base-ItemsRow-Footer-borderRadius-borderColor-medium-shady e19lxcc00"
|
|
47
47
|
data-wp-c16t="true"
|
|
48
48
|
data-wp-component="CardFooter"
|
|
49
49
|
>
|
|
@@ -59,8 +59,8 @@ Snapshot Diff:
|
|
|
59
59
|
@@ -1,8 +1,8 @@
|
|
60
60
|
<div>
|
|
61
61
|
<div
|
|
62
|
-
- class="components-flex components-card__footer components-card-footer css-
|
|
63
|
-
+ class="components-flex components-card__footer components-card-footer css-
|
|
62
|
+
- class="components-flex components-card__footer components-card-footer css-19sc0cg-PolymorphicDiv-Flex-base-ItemsRow-Footer-borderRadius-borderColor-medium e19lxcc00"
|
|
63
|
+
+ class="components-flex components-card__footer components-card-footer css-2io175-PolymorphicDiv-Flex-base-ItemsRow-Footer-borderRadius-borderColor-medium e19lxcc00"
|
|
64
64
|
data-wp-c16t="true"
|
|
65
65
|
data-wp-component="CardFooter"
|
|
66
66
|
>
|
|
@@ -76,8 +76,8 @@ Snapshot Diff:
|
|
|
76
76
|
@@ -1,8 +1,8 @@
|
|
77
77
|
<div>
|
|
78
78
|
<div
|
|
79
|
-
- class="components-flex components-card__header components-card-header css-
|
|
80
|
-
+ class="components-flex components-card__header components-card-header css-
|
|
79
|
+
- class="components-flex components-card__header components-card-header css-1qwshfy-PolymorphicDiv-Flex-base-ItemsRow-Header-borderRadius-borderColor-medium e19lxcc00"
|
|
80
|
+
+ class="components-flex components-card__header components-card-header css-1bzc8bz-PolymorphicDiv-Flex-base-ItemsRow-Header-borderRadius-borderColor-medium-shady e19lxcc00"
|
|
81
81
|
data-wp-c16t="true"
|
|
82
82
|
data-wp-component="CardHeader"
|
|
83
83
|
>
|
|
@@ -96,16 +96,16 @@ Snapshot Diff:
|
|
|
96
96
|
class="css-76dw7d-PolymorphicDiv-Content e19lxcc00"
|
|
97
97
|
>
|
|
98
98
|
<div
|
|
99
|
-
- class="components-flex components-card__header components-card-header css-
|
|
100
|
-
+ class="components-flex components-card__header components-card-header css-
|
|
99
|
+
- class="components-flex components-card__header components-card-header css-1qwshfy-PolymorphicDiv-Flex-base-ItemsRow-Header-borderRadius-borderColor-medium e19lxcc00"
|
|
100
|
+
+ class="components-flex components-card__header components-card-header css-1t2zg3y-PolymorphicDiv-Flex-base-ItemsRow-Header-borderRadius-borderColor-large e19lxcc00"
|
|
101
101
|
data-wp-c16t="true"
|
|
102
102
|
data-wp-component="CardHeader"
|
|
103
103
|
>
|
|
104
104
|
Header
|
|
105
105
|
</div>
|
|
106
106
|
<div
|
|
107
|
-
- class="components-card__body components-card-body css-
|
|
108
|
-
+ class="components-card__body components-card-body css-
|
|
107
|
+
- class="components-card__body components-card-body css-12jqy32-PolymorphicDiv-Body-borderRadius-medium e19lxcc00"
|
|
108
|
+
+ class="components-card__body components-card-body css-e0vrqx-PolymorphicDiv-Body-borderRadius-large e19lxcc00"
|
|
109
109
|
data-wp-c16t="true"
|
|
110
110
|
data-wp-component="CardBody"
|
|
111
111
|
>
|
|
@@ -122,7 +122,7 @@ Snapshot Diff:
|
|
|
122
122
|
Array [
|
|
123
123
|
Object {
|
|
124
124
|
"background-color": "#fff",
|
|
125
|
-
- "border-radius": "calc(
|
|
125
|
+
- "border-radius": "calc(8px - 1px)",
|
|
126
126
|
"box-shadow": "0 0 0 1px rgba(0, 0, 0, 0.1)",
|
|
127
127
|
"color": "#1e1e1e",
|
|
128
128
|
"outline": "none",
|
|
@@ -141,24 +141,24 @@ Snapshot Diff:
|
|
|
141
141
|
class="css-76dw7d-PolymorphicDiv-Content e19lxcc00"
|
|
142
142
|
>
|
|
143
143
|
<div
|
|
144
|
-
- class="components-flex components-card__header components-card-header css-
|
|
145
|
-
+ class="components-flex components-card__header components-card-header css-
|
|
144
|
+
- class="components-flex components-card__header components-card-header css-ubn8f6-PolymorphicDiv-Flex-base-ItemsRow-Header-borderRadius-borderColor-large-borderless e19lxcc00"
|
|
145
|
+
+ class="components-flex components-card__header components-card-header css-1t1rswf-PolymorphicDiv-Flex-base-ItemsRow-Header-borderRadius-borderColor-small e19lxcc00"
|
|
146
146
|
data-wp-c16t="true"
|
|
147
147
|
data-wp-component="CardHeader"
|
|
148
148
|
>
|
|
149
149
|
Header
|
|
150
150
|
</div>
|
|
151
151
|
<div
|
|
152
|
-
- class="components-card__body components-card-body css-
|
|
153
|
-
+ class="components-card__body components-card-body css-
|
|
152
|
+
- class="components-card__body components-card-body css-e0vrqx-PolymorphicDiv-Body-borderRadius-large e19lxcc00"
|
|
153
|
+
+ class="components-card__body components-card-body css-12jqy32-PolymorphicDiv-Body-borderRadius-medium e19lxcc00"
|
|
154
154
|
data-wp-c16t="true"
|
|
155
155
|
data-wp-component="CardBody"
|
|
156
156
|
>
|
|
157
157
|
Body
|
|
158
158
|
</div>
|
|
159
159
|
<div
|
|
160
|
-
- class="components-flex components-card__footer components-card-footer css-
|
|
161
|
-
+ class="components-flex components-card__footer components-card-footer css-
|
|
160
|
+
- class="components-flex components-card__footer components-card-footer css-167csgt-PolymorphicDiv-Flex-base-ItemsRow-Footer-borderRadius-borderColor-large-borderless e19lxcc00"
|
|
161
|
+
+ class="components-flex components-card__footer components-card-footer css-1kcgqsk-PolymorphicDiv-Flex-base-ItemsRow-Footer-borderRadius-borderColor-xSmallCardPadding e19lxcc00"
|
|
162
162
|
data-wp-c16t="true"
|
|
163
163
|
data-wp-component="CardFooter"
|
|
164
164
|
>
|
|
@@ -174,8 +174,8 @@ Snapshot Diff:
|
|
|
174
174
|
@@ -1,30 +1,30 @@
|
|
175
175
|
<div>
|
|
176
176
|
<div
|
|
177
|
-
- class="components-surface components-card css-
|
|
178
|
-
+ class="components-surface components-card css-
|
|
177
|
+
- class="components-surface components-card css-1hs39fv-PolymorphicDiv-Surface-getBorders-primary-Card-boxShadowless-rounded e19lxcc00"
|
|
178
|
+
+ class="components-surface components-card css-1c6nh8q-PolymorphicDiv-Surface-getBorders-primary-Card-rounded e19lxcc00"
|
|
179
179
|
data-wp-c16t="true"
|
|
180
180
|
data-wp-component="Card"
|
|
181
181
|
>
|
|
@@ -183,24 +183,24 @@ Snapshot Diff:
|
|
|
183
183
|
class="css-76dw7d-PolymorphicDiv-Content e19lxcc00"
|
|
184
184
|
>
|
|
185
185
|
<div
|
|
186
|
-
- class="components-flex components-card__header components-card-header css-
|
|
187
|
-
+ class="components-flex components-card__header components-card-header css-
|
|
186
|
+
- class="components-flex components-card__header components-card-header css-ubn8f6-PolymorphicDiv-Flex-base-ItemsRow-Header-borderRadius-borderColor-large-borderless e19lxcc00"
|
|
187
|
+
+ class="components-flex components-card__header components-card-header css-1t1rswf-PolymorphicDiv-Flex-base-ItemsRow-Header-borderRadius-borderColor-small e19lxcc00"
|
|
188
188
|
data-wp-c16t="true"
|
|
189
189
|
data-wp-component="CardHeader"
|
|
190
190
|
>
|
|
191
191
|
Header
|
|
192
192
|
</div>
|
|
193
193
|
<div
|
|
194
|
-
- class="components-card__body components-card-body css-
|
|
195
|
-
+ class="components-card__body components-card-body css-
|
|
194
|
+
- class="components-card__body components-card-body css-e0vrqx-PolymorphicDiv-Body-borderRadius-large e19lxcc00"
|
|
195
|
+
+ class="components-card__body components-card-body css-hms9n9-PolymorphicDiv-Body-borderRadius-small e19lxcc00"
|
|
196
196
|
data-wp-c16t="true"
|
|
197
197
|
data-wp-component="CardBody"
|
|
198
198
|
>
|
|
199
199
|
Body
|
|
200
200
|
</div>
|
|
201
201
|
<div
|
|
202
|
-
- class="components-flex components-card__footer components-card-footer css-
|
|
203
|
-
+ class="components-flex components-card__footer components-card-footer css-
|
|
202
|
+
- class="components-flex components-card__footer components-card-footer css-167csgt-PolymorphicDiv-Flex-base-ItemsRow-Footer-borderRadius-borderColor-large-borderless e19lxcc00"
|
|
203
|
+
+ class="components-flex components-card__footer components-card-footer css-18yn3ff-PolymorphicDiv-Flex-base-ItemsRow-Footer-borderRadius-borderColor-small e19lxcc00"
|
|
204
204
|
data-wp-c16t="true"
|
|
205
205
|
data-wp-component="CardFooter"
|
|
206
206
|
>
|
|
@@ -215,7 +215,7 @@ exports[`Card Card component should render correctly 1`] = `
|
|
|
215
215
|
position: relative;
|
|
216
216
|
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
217
217
|
outline: none;
|
|
218
|
-
border-radius: calc(
|
|
218
|
+
border-radius: calc(8px - 1px);
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
.emotion-2 {
|
|
@@ -254,13 +254,13 @@ exports[`Card Card component should render correctly 1`] = `
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
.emotion-4:first-of-type {
|
|
257
|
-
border-top-left-radius: calc(
|
|
258
|
-
border-top-right-radius: calc(
|
|
257
|
+
border-top-left-radius: calc(8px - 1px);
|
|
258
|
+
border-top-right-radius: calc(8px - 1px);
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
.emotion-4:last-of-type {
|
|
262
|
-
border-bottom-left-radius: calc(
|
|
263
|
-
border-bottom-right-radius: calc(
|
|
262
|
+
border-bottom-left-radius: calc(8px - 1px);
|
|
263
|
+
border-bottom-right-radius: calc(8px - 1px);
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
.emotion-6 {
|
|
@@ -271,13 +271,13 @@ exports[`Card Card component should render correctly 1`] = `
|
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
.emotion-6:first-of-type {
|
|
274
|
-
border-top-left-radius: calc(
|
|
275
|
-
border-top-right-radius: calc(
|
|
274
|
+
border-top-left-radius: calc(8px - 1px);
|
|
275
|
+
border-top-right-radius: calc(8px - 1px);
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
.emotion-6:last-of-type {
|
|
279
|
-
border-bottom-left-radius: calc(
|
|
280
|
-
border-bottom-right-radius: calc(
|
|
279
|
+
border-bottom-left-radius: calc(8px - 1px);
|
|
280
|
+
border-bottom-right-radius: calc(8px - 1px);
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
.emotion-10 {
|
|
@@ -306,13 +306,13 @@ exports[`Card Card component should render correctly 1`] = `
|
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
.emotion-14:first-of-type {
|
|
309
|
-
border-top-left-radius: calc(
|
|
310
|
-
border-top-right-radius: calc(
|
|
309
|
+
border-top-left-radius: calc(8px - 1px);
|
|
310
|
+
border-top-right-radius: calc(8px - 1px);
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
.emotion-14:last-of-type {
|
|
314
|
-
border-bottom-left-radius: calc(
|
|
315
|
-
border-bottom-right-radius: calc(
|
|
314
|
+
border-bottom-left-radius: calc(8px - 1px);
|
|
315
|
+
border-bottom-right-radius: calc(8px - 1px);
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
.emotion-16 {
|
|
@@ -347,13 +347,13 @@ exports[`Card Card component should render correctly 1`] = `
|
|
|
347
347
|
}
|
|
348
348
|
|
|
349
349
|
.emotion-16:first-of-type {
|
|
350
|
-
border-top-left-radius: calc(
|
|
351
|
-
border-top-right-radius: calc(
|
|
350
|
+
border-top-left-radius: calc(8px - 1px);
|
|
351
|
+
border-top-right-radius: calc(8px - 1px);
|
|
352
352
|
}
|
|
353
353
|
|
|
354
354
|
.emotion-16:last-of-type {
|
|
355
|
-
border-bottom-left-radius: calc(
|
|
356
|
-
border-bottom-right-radius: calc(
|
|
355
|
+
border-bottom-left-radius: calc(8px - 1px);
|
|
356
|
+
border-bottom-right-radius: calc(8px - 1px);
|
|
357
357
|
}
|
|
358
358
|
|
|
359
359
|
.emotion-18 {
|
|
@@ -370,7 +370,7 @@ exports[`Card Card component should render correctly 1`] = `
|
|
|
370
370
|
left: 0;
|
|
371
371
|
right: 0;
|
|
372
372
|
top: 0;
|
|
373
|
-
border-radius:
|
|
373
|
+
border-radius: 8px;
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
@media not ( prefers-reduced-motion ) {
|
|
@@ -469,15 +469,15 @@ Snapshot Diff:
|
|
|
469
469
|
</div>
|
|
470
470
|
<div
|
|
471
471
|
aria-hidden="true"
|
|
472
|
-
- class="components-elevation css-
|
|
473
|
-
+ class="components-elevation css-
|
|
472
|
+
- class="components-elevation css-a91pvj-PolymorphicDiv-Elevation-sx-Base-sx-Base-elevationClassName e19lxcc00"
|
|
473
|
+
+ class="components-elevation css-1q4cuxd-PolymorphicDiv-Elevation-sx-Base-sx-Base-elevationClassName e19lxcc00"
|
|
474
474
|
data-wp-c16t="true"
|
|
475
475
|
data-wp-component="Elevation"
|
|
476
476
|
/>
|
|
477
477
|
<div
|
|
478
478
|
aria-hidden="true"
|
|
479
|
-
- class="components-elevation css-
|
|
480
|
-
+ class="components-elevation css-
|
|
479
|
+
- class="components-elevation css-5u83fl-PolymorphicDiv-Elevation-sx-Base-sx-Base-elevationClassName e19lxcc00"
|
|
480
|
+
+ class="components-elevation css-1q4cuxd-PolymorphicDiv-Elevation-sx-Base-sx-Base-elevationClassName e19lxcc00"
|
|
481
481
|
data-wp-c16t="true"
|
|
482
482
|
data-wp-component="Elevation"
|
|
483
483
|
/>
|
|
@@ -497,7 +497,7 @@ exports[`Card Card component should warn when the isElevated prop is passed 1`]
|
|
|
497
497
|
position: relative;
|
|
498
498
|
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
499
499
|
outline: none;
|
|
500
|
-
border-radius: calc(
|
|
500
|
+
border-radius: calc(8px - 1px);
|
|
501
501
|
}
|
|
502
502
|
|
|
503
503
|
.emotion-2 {
|
|
@@ -518,7 +518,7 @@ exports[`Card Card component should warn when the isElevated prop is passed 1`]
|
|
|
518
518
|
left: 0;
|
|
519
519
|
right: 0;
|
|
520
520
|
top: 0;
|
|
521
|
-
border-radius:
|
|
521
|
+
border-radius: 8px;
|
|
522
522
|
}
|
|
523
523
|
|
|
524
524
|
@media not ( prefers-reduced-motion ) {
|
|
@@ -542,7 +542,7 @@ exports[`Card Card component should warn when the isElevated prop is passed 1`]
|
|
|
542
542
|
left: 0;
|
|
543
543
|
right: 0;
|
|
544
544
|
top: 0;
|
|
545
|
-
border-radius:
|
|
545
|
+
border-radius: 8px;
|
|
546
546
|
}
|
|
547
547
|
|
|
548
548
|
@media not ( prefers-reduced-motion ) {
|
|
@@ -111,6 +111,13 @@ If the control is clicked, the dropdown will expand regardless of this prop.
|
|
|
111
111
|
- Required: No
|
|
112
112
|
- Default: `true`
|
|
113
113
|
|
|
114
|
+
### placeholder
|
|
115
|
+
|
|
116
|
+
If passed, the combobox input will show a placeholder string if no values are present.
|
|
117
|
+
|
|
118
|
+
- Type: `string`
|
|
119
|
+
- Required: No
|
|
120
|
+
|
|
114
121
|
#### __experimentalRenderItem
|
|
115
122
|
|
|
116
123
|
Custom renderer invoked for each option in the suggestion list. The render prop receives as its argument an object containing, under the `item` key, the single option's data (directly from the array of data passed to the `options` prop).
|
|
@@ -129,6 +129,7 @@ function ComboboxControl( props: ComboboxControlProps ) {
|
|
|
129
129
|
},
|
|
130
130
|
__experimentalRenderItem,
|
|
131
131
|
expandOnFocus = true,
|
|
132
|
+
placeholder,
|
|
132
133
|
} = useDeprecated36pxDefaultSizeProp( props );
|
|
133
134
|
|
|
134
135
|
const [ value, setValue ] = useControlledValue( {
|
|
@@ -340,6 +341,7 @@ function ComboboxControl( props: ComboboxControlProps ) {
|
|
|
340
341
|
className="components-combobox-control__input"
|
|
341
342
|
instanceId={ instanceId }
|
|
342
343
|
ref={ inputContainer }
|
|
344
|
+
placeholder={ placeholder }
|
|
343
345
|
value={ isExpanded ? inputValue : currentLabel }
|
|
344
346
|
onFocus={ onFocus }
|
|
345
347
|
onBlur={ onBlur }
|
|
@@ -188,6 +188,46 @@ describe.each( [
|
|
|
188
188
|
expect( input ).toHaveValue( targetOption.label );
|
|
189
189
|
} );
|
|
190
190
|
|
|
191
|
+
it( 'calls onFilterValueChange whenever the textbox changes', async () => {
|
|
192
|
+
const user = userEvent.setup();
|
|
193
|
+
const onFilterValueChangeSpy = jest.fn();
|
|
194
|
+
render(
|
|
195
|
+
<Component
|
|
196
|
+
options={ timezones }
|
|
197
|
+
label={ defaultLabelText }
|
|
198
|
+
onFilterValueChange={ onFilterValueChangeSpy }
|
|
199
|
+
/>
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
const input = getInput( defaultLabelText );
|
|
203
|
+
|
|
204
|
+
await user.type( input, 'a' );
|
|
205
|
+
expect( onFilterValueChangeSpy ).toHaveBeenCalledWith( 'a' );
|
|
206
|
+
} );
|
|
207
|
+
|
|
208
|
+
it( 'clears the textbox value if there is no selected value on blur', async () => {
|
|
209
|
+
const user = userEvent.setup();
|
|
210
|
+
const onFilterValueChangeSpy = jest.fn();
|
|
211
|
+
render(
|
|
212
|
+
<Component
|
|
213
|
+
options={ timezones }
|
|
214
|
+
label={ defaultLabelText }
|
|
215
|
+
onFilterValueChange={ onFilterValueChangeSpy }
|
|
216
|
+
/>
|
|
217
|
+
);
|
|
218
|
+
const input = getInput( defaultLabelText );
|
|
219
|
+
|
|
220
|
+
await user.type( input, 'a' );
|
|
221
|
+
expect( input ).toHaveValue( 'a' );
|
|
222
|
+
|
|
223
|
+
// Blur and focus the input.
|
|
224
|
+
await user.tab();
|
|
225
|
+
await user.click( input );
|
|
226
|
+
|
|
227
|
+
expect( input ).toHaveValue( '' );
|
|
228
|
+
expect( onFilterValueChangeSpy ).toHaveBeenLastCalledWith( '' );
|
|
229
|
+
} );
|
|
230
|
+
|
|
191
231
|
it( 'should select the correct option from a search', async () => {
|
|
192
232
|
const user = await userEvent.setup();
|
|
193
233
|
const targetOption = timezones[ 13 ];
|
|
@@ -120,6 +120,7 @@ export const SelectPopover = styled( Ariakit.SelectPopover )`
|
|
|
120
120
|
background-color: ${ COLORS.theme.background };
|
|
121
121
|
border-radius: ${ CONFIG.radiusSmall };
|
|
122
122
|
border: 1px solid ${ COLORS.theme.foreground };
|
|
123
|
+
box-shadow: ${ CONFIG.elevationMedium };
|
|
123
124
|
|
|
124
125
|
/* z-index(".components-popover") */
|
|
125
126
|
z-index: 1000000;
|
|
@@ -37,7 +37,7 @@ const DIVIDER_COLOR = COLORS.theme.gray[ 200 ];
|
|
|
37
37
|
const LIGHTER_TEXT_COLOR = COLORS.theme.gray[ 700 ];
|
|
38
38
|
const LIGHT_BACKGROUND_COLOR = COLORS.theme.gray[ 100 ];
|
|
39
39
|
const TOOLBAR_VARIANT_BORDER_COLOR = COLORS.theme.foreground;
|
|
40
|
-
const DEFAULT_BOX_SHADOW = `0 0 0 ${ CONFIG.borderWidth } ${ DEFAULT_BORDER_COLOR }, ${ CONFIG.
|
|
40
|
+
const DEFAULT_BOX_SHADOW = `0 0 0 ${ CONFIG.borderWidth } ${ DEFAULT_BORDER_COLOR }, ${ CONFIG.elevationMedium }`;
|
|
41
41
|
const TOOLBAR_VARIANT_BOX_SHADOW = `0 0 0 ${ CONFIG.borderWidth } ${ TOOLBAR_VARIANT_BORDER_COLOR }`;
|
|
42
42
|
|
|
43
43
|
const GRID_TEMPLATE_COLS = 'minmax( 0, max-content ) 1fr';
|
|
@@ -60,6 +60,7 @@ $transition-duration: 0.2s;
|
|
|
60
60
|
$transition-duration background-color ease-out;
|
|
61
61
|
@include reduce-motion("transition");
|
|
62
62
|
background-color: $gray-900;
|
|
63
|
+
box-shadow: $elevation-x-small;
|
|
63
64
|
|
|
64
65
|
// Transparent border acts as a fill in Windows High Contrast Mode.
|
|
65
66
|
border: math.div($toggle-thumb-size, 2) solid transparent;
|
package/src/modal/index.tsx
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import type { ForwardedRef, KeyboardEvent, RefObject, UIEvent } from 'react';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* WordPress dependencies
|
|
@@ -38,10 +37,11 @@ import StyleProvider from '../style-provider';
|
|
|
38
37
|
import type { ModalProps } from './types';
|
|
39
38
|
import { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';
|
|
40
39
|
import { Spacer } from '../spacer';
|
|
40
|
+
import { useModalExitAnimation } from './use-modal-exit-animation';
|
|
41
41
|
|
|
42
42
|
// Used to track and dismiss the prior modal when another opens unless nested.
|
|
43
43
|
type Dismissers = Set<
|
|
44
|
-
RefObject< ModalProps[ 'onRequestClose' ] | undefined >
|
|
44
|
+
React.RefObject< ModalProps[ 'onRequestClose' ] | undefined >
|
|
45
45
|
>;
|
|
46
46
|
const ModalContext = createContext< Dismissers >( new Set() );
|
|
47
47
|
|
|
@@ -50,7 +50,7 @@ const bodyOpenClasses = new Map< string, number >();
|
|
|
50
50
|
|
|
51
51
|
function UnforwardedModal(
|
|
52
52
|
props: ModalProps,
|
|
53
|
-
forwardedRef: ForwardedRef< HTMLDivElement >
|
|
53
|
+
forwardedRef: React.ForwardedRef< HTMLDivElement >
|
|
54
54
|
) {
|
|
55
55
|
const {
|
|
56
56
|
bodyOpenClassName = 'modal-open',
|
|
@@ -70,7 +70,7 @@ function UnforwardedModal(
|
|
|
70
70
|
closeButtonLabel,
|
|
71
71
|
children,
|
|
72
72
|
style,
|
|
73
|
-
overlayClassName,
|
|
73
|
+
overlayClassName: overlayClassnameProp,
|
|
74
74
|
className,
|
|
75
75
|
contentLabel,
|
|
76
76
|
onKeyDown,
|
|
@@ -184,6 +184,9 @@ function UnforwardedModal(
|
|
|
184
184
|
};
|
|
185
185
|
}, [ bodyOpenClassName ] );
|
|
186
186
|
|
|
187
|
+
const { closeModal, frameRef, frameStyle, overlayClassname } =
|
|
188
|
+
useModalExitAnimation();
|
|
189
|
+
|
|
187
190
|
// Calls the isContentScrollable callback when the Modal children container resizes.
|
|
188
191
|
useLayoutEffect( () => {
|
|
189
192
|
if ( ! window.ResizeObserver || ! childrenContainerRef.current ) {
|
|
@@ -200,21 +203,21 @@ function UnforwardedModal(
|
|
|
200
203
|
};
|
|
201
204
|
}, [ isContentScrollable, childrenContainerRef ] );
|
|
202
205
|
|
|
203
|
-
function handleEscapeKeyDown(
|
|
206
|
+
function handleEscapeKeyDown(
|
|
207
|
+
event: React.KeyboardEvent< HTMLDivElement >
|
|
208
|
+
) {
|
|
204
209
|
if (
|
|
205
210
|
shouldCloseOnEsc &&
|
|
206
211
|
( event.code === 'Escape' || event.key === 'Escape' ) &&
|
|
207
212
|
! event.defaultPrevented
|
|
208
213
|
) {
|
|
209
214
|
event.preventDefault();
|
|
210
|
-
|
|
211
|
-
onRequestClose( event );
|
|
212
|
-
}
|
|
215
|
+
closeModal().then( () => onRequestClose( event ) );
|
|
213
216
|
}
|
|
214
217
|
}
|
|
215
218
|
|
|
216
219
|
const onContentContainerScroll = useCallback(
|
|
217
|
-
( e: UIEvent< HTMLDivElement > ) => {
|
|
220
|
+
( e: React.UIEvent< HTMLDivElement > ) => {
|
|
218
221
|
const scrollY = e?.currentTarget?.scrollTop ?? -1;
|
|
219
222
|
|
|
220
223
|
if ( ! hasScrolledContent && scrollY > 0 ) {
|
|
@@ -248,7 +251,7 @@ function UnforwardedModal(
|
|
|
248
251
|
const isSameTarget = target === pressTarget;
|
|
249
252
|
pressTarget = null;
|
|
250
253
|
if ( button === 0 && isSameTarget ) {
|
|
251
|
-
onRequestClose();
|
|
254
|
+
closeModal().then( () => onRequestClose() );
|
|
252
255
|
}
|
|
253
256
|
},
|
|
254
257
|
};
|
|
@@ -259,7 +262,8 @@ function UnforwardedModal(
|
|
|
259
262
|
ref={ useMergeRefs( [ ref, forwardedRef ] ) }
|
|
260
263
|
className={ clsx(
|
|
261
264
|
'components-modal__screen-overlay',
|
|
262
|
-
|
|
265
|
+
overlayClassname,
|
|
266
|
+
overlayClassnameProp
|
|
263
267
|
) }
|
|
264
268
|
onKeyDown={ withIgnoreIMEEvents( handleEscapeKeyDown ) }
|
|
265
269
|
{ ...( shouldCloseOnClickOutside ? overlayPressHandlers : {} ) }
|
|
@@ -271,8 +275,12 @@ function UnforwardedModal(
|
|
|
271
275
|
sizeClass,
|
|
272
276
|
className
|
|
273
277
|
) }
|
|
274
|
-
style={
|
|
278
|
+
style={ {
|
|
279
|
+
...frameStyle,
|
|
280
|
+
...style,
|
|
281
|
+
} }
|
|
275
282
|
ref={ useMergeRefs( [
|
|
283
|
+
frameRef,
|
|
276
284
|
constrainedTabbingRef,
|
|
277
285
|
focusReturnRef,
|
|
278
286
|
focusOnMount !== 'firstContentElement'
|
|
@@ -331,7 +339,13 @@ function UnforwardedModal(
|
|
|
331
339
|
/>
|
|
332
340
|
<Button
|
|
333
341
|
size="small"
|
|
334
|
-
onClick={
|
|
342
|
+
onClick={ (
|
|
343
|
+
event: React.MouseEvent< HTMLButtonElement >
|
|
344
|
+
) =>
|
|
345
|
+
closeModal().then( () =>
|
|
346
|
+
onRequestClose( event )
|
|
347
|
+
)
|
|
348
|
+
}
|
|
335
349
|
icon={ close }
|
|
336
350
|
label={
|
|
337
351
|
closeButtonLabel ||
|
package/src/modal/style.scss
CHANGED
|
@@ -8,8 +8,15 @@
|
|
|
8
8
|
background-color: rgba($black, 0.35);
|
|
9
9
|
z-index: z-index(".components-modal__screen-overlay");
|
|
10
10
|
display: flex;
|
|
11
|
-
// This animates the appearance of the
|
|
12
|
-
@include
|
|
11
|
+
// This animates the appearance of the backdrop.
|
|
12
|
+
@include animation__fade-in();
|
|
13
|
+
|
|
14
|
+
&.is-animating-out {
|
|
15
|
+
// Note: it's important that the fade-out animation doesn't end after the
|
|
16
|
+
// modal frame's disappear animation, because the component will be removed
|
|
17
|
+
// from the DOM when that animation ends.
|
|
18
|
+
@include animation__fade-out($delay: 80ms);
|
|
19
|
+
}
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
// The modal window element.
|
|
@@ -25,10 +32,17 @@
|
|
|
25
32
|
// Have the content element fill the vertical space yet not overflow.
|
|
26
33
|
display: flex;
|
|
27
34
|
// Animate the modal frame/contents appearing on the page.
|
|
28
|
-
animation: components-modal__appear-animation
|
|
35
|
+
animation-name: components-modal__appear-animation;
|
|
36
|
+
animation-duration: var(--modal-frame-animation-duration);
|
|
29
37
|
animation-fill-mode: forwards;
|
|
38
|
+
animation-timing-function: cubic-bezier(0.29, 0, 0, 1);
|
|
30
39
|
@include reduce-motion("animation");
|
|
31
40
|
|
|
41
|
+
.components-modal__screen-overlay.is-animating-out & {
|
|
42
|
+
animation-name: components-modal__disappear-animation;
|
|
43
|
+
animation-timing-function: cubic-bezier(1, 0, 0.2, 1);
|
|
44
|
+
}
|
|
45
|
+
|
|
32
46
|
// Show a centered modal on bigger screens.
|
|
33
47
|
@include break-small() {
|
|
34
48
|
border-radius: $radius-large;
|
|
@@ -88,6 +102,19 @@
|
|
|
88
102
|
}
|
|
89
103
|
}
|
|
90
104
|
|
|
105
|
+
// Note: this animation is also used in the animationend JS event listener.
|
|
106
|
+
// Make sure that the animation name is kept in sync across the two files.
|
|
107
|
+
@keyframes components-modal__disappear-animation {
|
|
108
|
+
from {
|
|
109
|
+
opacity: 1;
|
|
110
|
+
transform: scale(1);
|
|
111
|
+
}
|
|
112
|
+
to {
|
|
113
|
+
opacity: 0;
|
|
114
|
+
transform: scale(0.9);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
91
118
|
// Fix header to the top so it is always there to provide context to the modal
|
|
92
119
|
// if the content needs to be scrolled (for example, on the keyboard shortcuts
|
|
93
120
|
// modal screen).
|