@wordpress/components 28.7.0 → 28.8.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/CHANGELOG.md +45 -0
- 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/composite/context.js +1 -1
- package/build/composite/context.js.map +1 -1
- package/build/composite/group-label.js +1 -1
- package/build/composite/group-label.js.map +1 -1
- package/build/composite/group.js +1 -1
- package/build/composite/group.js.map +1 -1
- package/build/composite/hover.js +1 -1
- package/build/composite/hover.js.map +1 -1
- package/build/composite/index.js +17 -26
- package/build/composite/index.js.map +1 -1
- package/build/composite/item.js +1 -1
- package/build/composite/item.js.map +1 -1
- package/build/composite/legacy/index.js +59 -8
- package/build/composite/legacy/index.js.map +1 -1
- package/build/composite/row.js +1 -1
- package/build/composite/row.js.map +1 -1
- package/build/composite/typeahead.js +1 -1
- package/build/composite/typeahead.js.map +1 -1
- package/build/composite/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/date-time/date/index.js +1 -1
- package/build/date-time/date/index.js.map +1 -1
- package/build/date-time/date/styles.js +35 -24
- package/build/date-time/date/styles.js.map +1 -1
- package/build/date-time/date/use-lilius/index.js +163 -0
- package/build/date-time/date/use-lilius/index.js.map +1 -0
- package/build/dropdown-menu-v2/styles.js +17 -17
- package/build/dropdown-menu-v2/styles.js.map +1 -1
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/modal/index.js +27 -12
- 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/navigator/navigator-screen/component.js +5 -0
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/private-apis.js +0 -9
- package/build/private-apis.js.map +1 -1
- 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/slot-fill/index.js +1 -0
- package/build/slot-fill/index.js.map +1 -1
- package/build/tabs/styles.js +3 -3
- package/build/tabs/styles.js.map +1 -1
- package/build/tabs/tablist.js +5 -4
- package/build/tabs/tablist.js.map +1 -1
- package/build/utils/config-values.js +4 -5
- package/build/utils/config-values.js.map +1 -1
- package/build/utils/element-rect.js +73 -105
- package/build/utils/element-rect.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/composite/context.js +1 -1
- package/build-module/composite/context.js.map +1 -1
- package/build-module/composite/group-label.js +1 -1
- package/build-module/composite/group-label.js.map +1 -1
- package/build-module/composite/group.js +1 -1
- package/build-module/composite/group.js.map +1 -1
- package/build-module/composite/hover.js +1 -1
- package/build-module/composite/hover.js.map +1 -1
- package/build-module/composite/index.js +17 -26
- package/build-module/composite/index.js.map +1 -1
- package/build-module/composite/item.js +1 -1
- package/build-module/composite/item.js.map +1 -1
- package/build-module/composite/legacy/index.js +56 -8
- package/build-module/composite/legacy/index.js.map +1 -1
- package/build-module/composite/row.js +1 -1
- package/build-module/composite/row.js.map +1 -1
- package/build-module/composite/typeahead.js +1 -1
- package/build-module/composite/typeahead.js.map +1 -1
- package/build-module/composite/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/date-time/date/index.js +1 -2
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/date-time/date/styles.js +31 -24
- package/build-module/date-time/date/styles.js.map +1 -1
- package/build-module/date-time/date/use-lilius/index.js +158 -0
- package/build-module/date-time/date/use-lilius/index.js.map +1 -0
- package/build-module/dropdown-menu-v2/styles.js +17 -17
- package/build-module/dropdown-menu-v2/styles.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/modal/index.js +29 -12
- 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/navigator/navigator-screen/component.js +4 -0
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/private-apis.js +0 -9
- package/build-module/private-apis.js.map +1 -1
- 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/slot-fill/index.js +1 -0
- package/build-module/slot-fill/index.js.map +1 -1
- package/build-module/tabs/styles.js +3 -3
- package/build-module/tabs/styles.js.map +1 -1
- package/build-module/tabs/tablist.js +5 -4
- package/build-module/tabs/tablist.js.map +1 -1
- package/build-module/utils/config-values.js +4 -5
- package/build-module/utils/config-values.js.map +1 -1
- package/build-module/utils/element-rect.js +74 -105
- package/build-module/utils/element-rect.js.map +1 -1
- package/build-style/style-rtl.css +51 -10
- package/build-style/style.css +51 -10
- 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/composite/context.d.ts.map +1 -1
- package/build-types/composite/index.d.ts +36 -24
- package/build-types/composite/index.d.ts.map +1 -1
- package/build-types/composite/legacy/index.d.ts +25 -2
- package/build-types/composite/legacy/index.d.ts.map +1 -1
- package/build-types/composite/legacy/stories/index.story.d.ts.map +1 -1
- package/build-types/composite/stories/index.story.d.ts +9 -9
- package/build-types/composite/stories/index.story.d.ts.map +1 -1
- package/build-types/composite/types.d.ts +11 -10
- package/build-types/composite/types.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
- package/build-types/date-time/date/index.d.ts +0 -3
- package/build-types/date-time/date/index.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts.map +1 -1
- package/build-types/date-time/date/test/use-lilius.d.ts +2 -0
- package/build-types/date-time/date/test/use-lilius.d.ts.map +1 -0
- package/build-types/date-time/date/use-lilius/index.d.ts +169 -0
- package/build-types/date-time/date/use-lilius/index.d.ts.map +1 -0
- package/build-types/index.d.ts +1 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/modal/stories/index.story.d.ts +3 -0
- package/build-types/modal/stories/index.story.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/navigator/navigator-screen/component.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/slot-fill/index.d.ts +3 -0
- package/build-types/slot-fill/index.d.ts.map +1 -1
- package/build-types/tabs/styles.d.ts.map +1 -1
- package/build-types/tabs/tablist.d.ts.map +1 -1
- package/build-types/utils/config-values.d.ts +0 -1
- package/build-types/utils/element-rect.d.ts +32 -74
- package/build-types/utils/element-rect.d.ts.map +1 -1
- package/package.json +19 -20
- 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/composite/README.md +5 -24
- package/src/composite/{context.ts → context.tsx} +1 -2
- package/src/composite/group-label.tsx +1 -1
- package/src/composite/group.tsx +1 -1
- package/src/composite/hover.tsx +1 -1
- package/src/composite/index.tsx +17 -28
- package/src/composite/item.tsx +1 -1
- package/src/composite/legacy/index.tsx +72 -11
- package/src/composite/legacy/stories/index.story.tsx +2 -1
- package/src/composite/legacy/test/index.tsx +57 -1
- package/src/composite/row.tsx +1 -1
- package/src/composite/stories/index.story.tsx +185 -169
- package/src/composite/typeahead.tsx +1 -1
- package/src/composite/types.ts +13 -15
- package/src/custom-select-control-v2/styles.ts +1 -0
- package/src/date-time/date/index.tsx +1 -1
- package/src/date-time/date/styles.ts +31 -11
- package/src/date-time/date/test/use-lilius.ts +417 -0
- package/src/date-time/date/use-lilius/index.ts +394 -0
- package/src/dropdown-menu-v2/styles.ts +1 -1
- package/src/form-toggle/style.scss +1 -0
- package/src/index.ts +1 -0
- package/src/modal/index.tsx +42 -19
- package/src/modal/stories/index.story.tsx +8 -14
- package/src/modal/style.scss +30 -8
- package/src/modal/types.ts +6 -18
- package/src/modal/use-modal-exit-animation.ts +99 -0
- package/src/navigator/navigator-screen/component.tsx +7 -0
- package/src/navigator/test/index.tsx +8 -0
- package/src/popover/style.scss +3 -2
- package/src/private-apis.ts +0 -9
- package/src/range-control/styles/range-control-styles.ts +1 -0
- package/src/resizable-box/style.scss +1 -1
- package/src/select-control/README.md +2 -2
- package/src/slot-fill/index.tsx +1 -0
- package/src/snackbar/style.scss +1 -1
- package/src/tabs/styles.ts +40 -11
- package/src/tabs/tablist.tsx +5 -4
- package/src/tooltip/style.scss +1 -0
- package/src/utils/config-values.js +4 -5
- package/src/utils/element-rect.ts +93 -130
- package/tsconfig.tsbuildinfo +1 -1
- package/build/composite/store.js +0 -54
- package/build/composite/store.js.map +0 -1
- package/build-module/composite/store.js +0 -46
- package/build-module/composite/store.js.map +0 -1
- package/build-types/composite/store.d.ts +0 -25
- package/build-types/composite/store.d.ts.map +0 -1
- package/build-types/composite/stories/utils.d.ts +0 -29
- package/build-types/composite/stories/utils.d.ts.map +0 -1
- package/src/composite/store.ts +0 -46
- package/src/composite/stories/utils.tsx +0 -76
package/src/modal/types.ts
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type {
|
|
5
|
-
AriaRole,
|
|
6
|
-
CSSProperties,
|
|
7
|
-
ReactNode,
|
|
8
|
-
KeyboardEventHandler,
|
|
9
|
-
KeyboardEvent,
|
|
10
|
-
SyntheticEvent,
|
|
11
|
-
} from 'react';
|
|
12
|
-
|
|
13
1
|
/**
|
|
14
2
|
* WordPress dependencies
|
|
15
3
|
*/
|
|
@@ -42,7 +30,7 @@ export type ModalProps = {
|
|
|
42
30
|
/**
|
|
43
31
|
* The children elements.
|
|
44
32
|
*/
|
|
45
|
-
children: ReactNode;
|
|
33
|
+
children: React.ReactNode;
|
|
46
34
|
/**
|
|
47
35
|
* If this property is added, it will an additional class name to the modal
|
|
48
36
|
* content `div`.
|
|
@@ -77,7 +65,7 @@ export type ModalProps = {
|
|
|
77
65
|
*
|
|
78
66
|
* @default null
|
|
79
67
|
*/
|
|
80
|
-
headerActions?: ReactNode;
|
|
68
|
+
headerActions?: React.ReactNode;
|
|
81
69
|
|
|
82
70
|
/**
|
|
83
71
|
* If this property is added, an icon will be added before the title.
|
|
@@ -108,12 +96,12 @@ export type ModalProps = {
|
|
|
108
96
|
/**
|
|
109
97
|
* Handle the key down on the modal frame `div`.
|
|
110
98
|
*/
|
|
111
|
-
onKeyDown?: KeyboardEventHandler< HTMLDivElement >;
|
|
99
|
+
onKeyDown?: React.KeyboardEventHandler< HTMLDivElement >;
|
|
112
100
|
/**
|
|
113
101
|
* This function is called to indicate that the modal should be closed.
|
|
114
102
|
*/
|
|
115
103
|
onRequestClose: (
|
|
116
|
-
event?: KeyboardEvent< HTMLDivElement > | SyntheticEvent
|
|
104
|
+
event?: React.KeyboardEvent< HTMLDivElement > | React.SyntheticEvent
|
|
117
105
|
) => void;
|
|
118
106
|
/**
|
|
119
107
|
* If this property is added, it will an additional class name to the modal
|
|
@@ -126,7 +114,7 @@ export type ModalProps = {
|
|
|
126
114
|
*
|
|
127
115
|
* @default 'dialog'
|
|
128
116
|
*/
|
|
129
|
-
role?: AriaRole;
|
|
117
|
+
role?: React.AriaRole;
|
|
130
118
|
/**
|
|
131
119
|
* If this property is added, it will determine whether the modal requests
|
|
132
120
|
* to close when a mouse click occurs outside of the modal content.
|
|
@@ -144,7 +132,7 @@ export type ModalProps = {
|
|
|
144
132
|
/**
|
|
145
133
|
* If this property is added, it will be added to the modal frame `div`.
|
|
146
134
|
*/
|
|
147
|
-
style?: CSSProperties;
|
|
135
|
+
style?: React.CSSProperties;
|
|
148
136
|
/**
|
|
149
137
|
* This property is used as the modal header's title.
|
|
150
138
|
*
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useReducedMotion } from '@wordpress/compose';
|
|
5
|
+
import { useCallback, useRef, useState } from '@wordpress/element';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { CONFIG } from '../utils';
|
|
11
|
+
import warning from '@wordpress/warning';
|
|
12
|
+
|
|
13
|
+
// Animation duration (ms) extracted to JS in order to be used on a setTimeout.
|
|
14
|
+
const FRAME_ANIMATION_DURATION = CONFIG.transitionDuration;
|
|
15
|
+
const FRAME_ANIMATION_DURATION_NUMBER = Number.parseInt(
|
|
16
|
+
CONFIG.transitionDuration
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const EXIT_ANIMATION_NAME = 'components-modal__disappear-animation';
|
|
20
|
+
|
|
21
|
+
export function useModalExitAnimation() {
|
|
22
|
+
const frameRef = useRef< HTMLDivElement >();
|
|
23
|
+
const [ isAnimatingOut, setIsAnimatingOut ] = useState( false );
|
|
24
|
+
const isReducedMotion = useReducedMotion();
|
|
25
|
+
|
|
26
|
+
const closeModal = useCallback(
|
|
27
|
+
() =>
|
|
28
|
+
new Promise< void >( ( closeModalResolve ) => {
|
|
29
|
+
// Grab a "stable" reference of the frame element, since
|
|
30
|
+
// the value held by the react ref might change at runtime.
|
|
31
|
+
const frameEl = frameRef.current;
|
|
32
|
+
|
|
33
|
+
if ( isReducedMotion ) {
|
|
34
|
+
closeModalResolve();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if ( ! frameEl ) {
|
|
39
|
+
warning(
|
|
40
|
+
"wp.components.Modal: the Modal component can't be closed with an exit animation because of a missing reference to the modal frame element."
|
|
41
|
+
);
|
|
42
|
+
closeModalResolve();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let handleAnimationEnd:
|
|
47
|
+
| undefined
|
|
48
|
+
| ( ( e: AnimationEvent ) => void );
|
|
49
|
+
|
|
50
|
+
const startAnimation = () =>
|
|
51
|
+
new Promise< void >( ( animationResolve ) => {
|
|
52
|
+
handleAnimationEnd = ( e: AnimationEvent ) => {
|
|
53
|
+
if ( e.animationName === EXIT_ANIMATION_NAME ) {
|
|
54
|
+
animationResolve();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
frameEl.addEventListener(
|
|
59
|
+
'animationend',
|
|
60
|
+
handleAnimationEnd
|
|
61
|
+
);
|
|
62
|
+
setIsAnimatingOut( true );
|
|
63
|
+
} );
|
|
64
|
+
const animationTimeout = () =>
|
|
65
|
+
new Promise< void >( ( timeoutResolve ) => {
|
|
66
|
+
setTimeout(
|
|
67
|
+
() => timeoutResolve(),
|
|
68
|
+
// Allow an extra 20% of the animation duration for the
|
|
69
|
+
// animationend event to fire, in case the animation frame is
|
|
70
|
+
// slightly delayes by some other events in the event loop.
|
|
71
|
+
FRAME_ANIMATION_DURATION_NUMBER * 1.2
|
|
72
|
+
);
|
|
73
|
+
} );
|
|
74
|
+
|
|
75
|
+
Promise.race( [ startAnimation(), animationTimeout() ] ).then(
|
|
76
|
+
() => {
|
|
77
|
+
if ( handleAnimationEnd ) {
|
|
78
|
+
frameEl.removeEventListener(
|
|
79
|
+
'animationend',
|
|
80
|
+
handleAnimationEnd
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
setIsAnimatingOut( false );
|
|
84
|
+
closeModalResolve();
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
} ),
|
|
88
|
+
[ isReducedMotion ]
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
overlayClassname: isAnimatingOut ? 'is-animating-out' : undefined,
|
|
93
|
+
frameRef,
|
|
94
|
+
frameStyle: {
|
|
95
|
+
'--modal-frame-animation-duration': `${ FRAME_ANIMATION_DURATION }`,
|
|
96
|
+
},
|
|
97
|
+
closeModal,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import { useMergeRefs } from '@wordpress/compose';
|
|
18
18
|
import { isRTL as isRTLFn } from '@wordpress/i18n';
|
|
19
19
|
import { escapeAttribute } from '@wordpress/escape-html';
|
|
20
|
+
import warning from '@wordpress/warning';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Internal dependencies
|
|
@@ -33,6 +34,12 @@ function UnconnectedNavigatorScreen(
|
|
|
33
34
|
props: WordPressComponentProps< NavigatorScreenProps, 'div', false >,
|
|
34
35
|
forwardedRef: ForwardedRef< any >
|
|
35
36
|
) {
|
|
37
|
+
if ( ! /^\//.test( props.path ) ) {
|
|
38
|
+
warning(
|
|
39
|
+
'wp.components.NavigatorScreen: the `path` should follow a URL-like scheme; it should start with and be separated by the `/` character.'
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
36
43
|
const screenId = useId();
|
|
37
44
|
const { children, className, path, ...otherProps } = useContextSystem(
|
|
38
45
|
props,
|
|
@@ -642,6 +642,14 @@ describe( 'Navigator', () => {
|
|
|
642
642
|
).toHaveAttribute( 'id', INVALID_HTML_ATTRIBUTE.escaped );
|
|
643
643
|
} );
|
|
644
644
|
|
|
645
|
+
it( 'should warn if the `path` prop does not follow the required format', () => {
|
|
646
|
+
render( <NavigatorScreen path="not-valid">Test</NavigatorScreen> );
|
|
647
|
+
|
|
648
|
+
expect( console ).toHaveWarnedWith(
|
|
649
|
+
'wp.components.NavigatorScreen: the `path` should follow a URL-like scheme; it should start with and be separated by the `/` character.'
|
|
650
|
+
);
|
|
651
|
+
} );
|
|
652
|
+
|
|
645
653
|
it( 'should match correctly paths with named arguments', async () => {
|
|
646
654
|
const user = userEvent.setup();
|
|
647
655
|
|
package/src/popover/style.scss
CHANGED
|
@@ -22,14 +22,15 @@ $shadow-popover-border-top-only-alternate: 0 #{-$border-width} 0 $gray-900;
|
|
|
22
22
|
|
|
23
23
|
.components-popover__content {
|
|
24
24
|
background: $white;
|
|
25
|
-
box-shadow: $shadow-popover-border-default, $elevation-
|
|
25
|
+
box-shadow: $shadow-popover-border-default, $elevation-medium;
|
|
26
26
|
border-radius: $radius-medium;
|
|
27
27
|
box-sizing: border-box;
|
|
28
28
|
width: min-content;
|
|
29
29
|
|
|
30
|
-
// Alternate treatment for popovers that put them at elevation zero with high contrast.
|
|
30
|
+
// Alternate treatment for popovers that put them at elevation zero with high contrast and smaller radius.
|
|
31
31
|
.is-alternate & {
|
|
32
32
|
box-shadow: $shadow-popover-border-default-alternate;
|
|
33
|
+
border-radius: $radius-small;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
// A style that gives the popover no visible ui.
|
package/src/private-apis.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { Composite } from './composite';
|
|
5
|
-
import { useCompositeStore } from './composite/store';
|
|
6
4
|
import { positionToPlacement as __experimentalPopoverLegacyPositionToPlacement } from './popover/utils';
|
|
7
5
|
import { createPrivateSlotFill } from './slot-fill';
|
|
8
6
|
import { DropdownMenuV2 } from './dropdown-menu-v2';
|
|
@@ -14,13 +12,6 @@ import { lock } from './lock-unlock';
|
|
|
14
12
|
|
|
15
13
|
export const privateApis = {};
|
|
16
14
|
lock( privateApis, {
|
|
17
|
-
CompositeV2: Composite,
|
|
18
|
-
CompositeGroupV2: Composite.Group,
|
|
19
|
-
CompositeItemV2: Composite.Item,
|
|
20
|
-
CompositeRowV2: Composite.Row,
|
|
21
|
-
CompositeTypeaheadV2: Composite.Typeahead,
|
|
22
|
-
CompositeHoverV2: Composite.Hover,
|
|
23
|
-
useCompositeStoreV2: useCompositeStore,
|
|
24
15
|
__experimentalPopoverLegacyPositionToPlacement,
|
|
25
16
|
createPrivateSlotFill,
|
|
26
17
|
ComponentsContext,
|
|
@@ -35,7 +35,7 @@ $resize-handler-container-size: $resize-handler-size + ($grid-unit-05 * 2); // M
|
|
|
35
35
|
top: calc(50% - #{ceil($resize-handler-size * 0.5)});
|
|
36
36
|
right: calc(50% - #{ceil($resize-handler-size * 0.5)});
|
|
37
37
|
|
|
38
|
-
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $components-color-accent;
|
|
38
|
+
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $components-color-accent, $elevation-x-small;
|
|
39
39
|
// Only visible in Windows High Contrast mode.
|
|
40
40
|
outline: 2px solid transparent;
|
|
41
41
|
}
|
|
@@ -103,7 +103,7 @@ Render a user interface to select multiple users from a list.
|
|
|
103
103
|
```jsx
|
|
104
104
|
<SelectControl
|
|
105
105
|
multiple
|
|
106
|
-
label={ __( '
|
|
106
|
+
label={ __( 'User' ) }
|
|
107
107
|
value={ this.state.users } // e.g: value = [ 'a', 'c' ]
|
|
108
108
|
onChange={ ( users ) => {
|
|
109
109
|
this.setState( { users } );
|
|
@@ -126,7 +126,7 @@ const [ item, setItem ] = useState( '' );
|
|
|
126
126
|
// ...
|
|
127
127
|
|
|
128
128
|
<SelectControl
|
|
129
|
-
label={ __( '
|
|
129
|
+
label={ __( 'My dinosaur' ) }
|
|
130
130
|
value={ item } // e.g: value = 'a'
|
|
131
131
|
onChange={ ( selection ) => { setItem( selection ) } }
|
|
132
132
|
__nextHasNoMarginBottom
|
package/src/slot-fill/index.tsx
CHANGED
package/src/snackbar/style.scss
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
background: rgba($black, 0.85); // Emulates #1e1e1e closely.
|
|
5
5
|
backdrop-filter: blur($grid-unit-20) saturate(180%);
|
|
6
6
|
border-radius: $radius-medium;
|
|
7
|
-
box-shadow: $elevation-
|
|
7
|
+
box-shadow: $elevation-small;
|
|
8
8
|
color: $white;
|
|
9
9
|
padding: $grid-unit-15 ($grid-unit-05 * 5);
|
|
10
10
|
width: 100%;
|
package/src/tabs/styles.ts
CHANGED
|
@@ -22,36 +22,65 @@ export const TabListWrapper = styled.div`
|
|
|
22
22
|
text-align: start;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
@media not ( prefers-reduced-motion
|
|
25
|
+
@media not ( prefers-reduced-motion ) {
|
|
26
26
|
&.is-animation-enabled::after {
|
|
27
|
-
transition-property:
|
|
27
|
+
transition-property: transform;
|
|
28
28
|
transition-duration: 0.2s;
|
|
29
29
|
transition-timing-function: ease-out;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
+
--direction-factor: 1;
|
|
33
|
+
--direction-origin-x: left;
|
|
34
|
+
--indicator-start: var( --indicator-left );
|
|
35
|
+
&:dir( rtl ) {
|
|
36
|
+
--direction-factor: -1;
|
|
37
|
+
--direction-origin-x: right;
|
|
38
|
+
--indicator-start: var( --indicator-right );
|
|
39
|
+
}
|
|
32
40
|
&::after {
|
|
33
41
|
content: '';
|
|
34
42
|
position: absolute;
|
|
35
43
|
pointer-events: none;
|
|
44
|
+
transform-origin: var( --direction-origin-x ) top;
|
|
36
45
|
|
|
37
46
|
// Windows high contrast mode.
|
|
38
47
|
outline: 2px solid transparent;
|
|
39
48
|
outline-offset: -1px;
|
|
40
49
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
|
|
51
|
+
/* Using a large value to avoid antialiasing rounding issues
|
|
52
|
+
when scaling in the transform, see: https://stackoverflow.com/a/52159123 */
|
|
53
|
+
--antialiasing-factor: 100;
|
|
54
|
+
&:not( [aria-orientation='vertical'] ) {
|
|
55
|
+
&::after {
|
|
56
|
+
bottom: 0;
|
|
57
|
+
height: 0;
|
|
58
|
+
width: calc( var( --antialiasing-factor ) * 1px );
|
|
59
|
+
transform: translateX(
|
|
60
|
+
calc(
|
|
61
|
+
var( --indicator-start ) * var( --direction-factor ) *
|
|
62
|
+
1px
|
|
63
|
+
)
|
|
64
|
+
)
|
|
65
|
+
scaleX(
|
|
66
|
+
calc(
|
|
67
|
+
var( --indicator-width ) / var( --antialiasing-factor )
|
|
68
|
+
)
|
|
69
|
+
);
|
|
70
|
+
border-bottom: var( --wp-admin-border-width-focus ) solid
|
|
71
|
+
${ COLORS.theme.accent };
|
|
72
|
+
}
|
|
48
73
|
}
|
|
49
74
|
&[aria-orientation='vertical']::after {
|
|
50
75
|
z-index: -1;
|
|
76
|
+
top: 0;
|
|
51
77
|
left: 0;
|
|
52
78
|
width: 100%;
|
|
53
|
-
|
|
54
|
-
|
|
79
|
+
height: calc( var( --antialiasing-factor ) * 1px );
|
|
80
|
+
transform: translateY( calc( var( --indicator-top ) * 1px ) )
|
|
81
|
+
scaleY(
|
|
82
|
+
calc( var( --indicator-height ) / var( --antialiasing-factor ) )
|
|
83
|
+
);
|
|
55
84
|
background-color: ${ COLORS.theme.gray[ 100 ] };
|
|
56
85
|
}
|
|
57
86
|
`;
|
package/src/tabs/tablist.tsx
CHANGED
|
@@ -78,10 +78,11 @@ export const TabList = forwardRef<
|
|
|
78
78
|
onBlur={ onBlur }
|
|
79
79
|
{ ...otherProps }
|
|
80
80
|
style={ {
|
|
81
|
-
'--indicator-
|
|
82
|
-
'--indicator-
|
|
83
|
-
'--indicator-
|
|
84
|
-
'--indicator-
|
|
81
|
+
'--indicator-top': indicatorPosition.top,
|
|
82
|
+
'--indicator-right': indicatorPosition.right,
|
|
83
|
+
'--indicator-left': indicatorPosition.left,
|
|
84
|
+
'--indicator-width': indicatorPosition.width,
|
|
85
|
+
'--indicator-height': indicatorPosition.height,
|
|
85
86
|
...otherProps.style,
|
|
86
87
|
} }
|
|
87
88
|
className={ clsx(
|
package/src/tooltip/style.scss
CHANGED
|
@@ -68,15 +68,14 @@ export default Object.assign( {}, CONTROL_PROPS, TOGGLE_GROUP_CONTROL_PROPS, {
|
|
|
68
68
|
fontWeight: 'normal',
|
|
69
69
|
fontWeightHeading: '600',
|
|
70
70
|
gridBase: '4px',
|
|
71
|
-
cardBorderRadius: '2px',
|
|
72
71
|
cardPaddingXSmall: `${ space( 2 ) }`,
|
|
73
72
|
cardPaddingSmall: `${ space( 4 ) }`,
|
|
74
73
|
cardPaddingMedium: `${ space( 4 ) } ${ space( 6 ) }`,
|
|
75
74
|
cardPaddingLarge: `${ space( 6 ) } ${ space( 8 ) }`,
|
|
76
|
-
elevationXSmall: `0
|
|
77
|
-
elevationSmall: `0
|
|
78
|
-
elevationMedium: `0 0
|
|
79
|
-
elevationLarge: `0
|
|
75
|
+
elevationXSmall: `0 1px 1px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02), 0 3px 3px rgba(0, 0, 0, 0.02), 0 4px 4px rgba(0, 0, 0, 0.01)`,
|
|
76
|
+
elevationSmall: `0 1px 2px rgba(0, 0, 0, 0.05), 0 2px 3px rgba(0, 0, 0, 0.04), 0 6px 6px rgba(0, 0, 0, 0.03), 0 8px 8px rgba(0, 0, 0, 0.02)`,
|
|
77
|
+
elevationMedium: `0 2px 3px rgba(0, 0, 0, 0.05), 0 4px 5px rgba(0, 0, 0, 0.04), 0 12px 12px rgba(0, 0, 0, 0.03), 0 16px 16px rgba(0, 0, 0, 0.02)`,
|
|
78
|
+
elevationLarge: `0 5px 15px rgba(0, 0, 0, 0.08), 0 15px 27px rgba(0, 0, 0, 0.07), 0 30px 36px rgba(0, 0, 0, 0.04), 0 50px 43px rgba(0, 0, 0, 0.02)`,
|
|
80
79
|
surfaceBackgroundColor: COLORS.white,
|
|
81
80
|
surfaceBackgroundSubtleColor: '#F3F3F3',
|
|
82
81
|
surfaceBackgroundTintColor: '#F5F5F5',
|