@wordpress/components 29.1.1 → 29.3.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 +29 -6
- package/CONTRIBUTING.md +4 -4
- package/README.md +1 -1
- package/build/badge/index.js +26 -22
- package/build/badge/index.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/component.js +8 -15
- package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build/box-control/index.js +6 -0
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/linked-button.js +7 -11
- package/build/box-control/linked-button.js.map +1 -1
- package/build/box-control/types.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker-option.js +9 -7
- package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker.js +0 -1
- package/build/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build/color-palette/index.js +1 -6
- package/build/color-palette/index.js.map +1 -1
- package/build/font-size-picker/index.native.js +1 -1
- package/build/font-size-picker/index.native.js.map +1 -1
- package/build/higher-order/with-focus-return/index.js +1 -1
- package/build/higher-order/with-focus-return/index.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +22 -22
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/menu/checkbox-item.js +6 -6
- package/build/menu/checkbox-item.js.map +1 -1
- package/build/menu/context.js +2 -2
- package/build/menu/context.js.map +1 -1
- package/build/menu/group-label.js +4 -4
- package/build/menu/group-label.js.map +1 -1
- package/build/menu/group.js +4 -4
- package/build/menu/group.js.map +1 -1
- package/build/menu/index.js +87 -14
- package/build/menu/index.js.map +1 -1
- package/build/menu/item-help-text.js +4 -4
- package/build/menu/item-help-text.js.map +1 -1
- package/build/menu/item-label.js +4 -4
- package/build/menu/item-label.js.map +1 -1
- package/build/menu/item.js +6 -6
- package/build/menu/item.js.map +1 -1
- package/build/menu/popover.js +5 -5
- package/build/menu/popover.js.map +1 -1
- package/build/menu/radio-item.js +6 -6
- package/build/menu/radio-item.js.map +1 -1
- package/build/menu/separator.js +4 -4
- package/build/menu/separator.js.map +1 -1
- package/build/menu/styles.js +41 -41
- package/build/menu/styles.js.map +1 -1
- package/build/menu/submenu-trigger-item.js +5 -5
- package/build/menu/submenu-trigger-item.js.map +1 -1
- package/build/menu/trigger-button.js +3 -3
- package/build/menu/trigger-button.js.map +1 -1
- package/build/menu/types.js.map +1 -1
- package/build/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
- package/build/mobile/bottom-sheet/nav-bar/action-button.native.js.map +1 -1
- package/build/mobile/utils/get-px-from-css-unit.native.js +3 -3
- package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build/notice/types.js.map +1 -1
- package/build/search-control/index.js +1 -1
- package/build/search-control/index.js.map +1 -1
- package/build/text/hook.js +8 -6
- package/build/text/hook.js.map +1 -1
- package/build/text/utils.js +1 -1
- package/build/text/utils.js.map +1 -1
- package/build-module/badge/index.js +28 -22
- package/build-module/badge/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/component.js +8 -15
- package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build-module/box-control/index.js +6 -0
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/linked-button.js +7 -11
- package/build-module/box-control/linked-button.js.map +1 -1
- package/build-module/box-control/types.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker-option.js +9 -7
- package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker.js +0 -1
- package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build-module/color-palette/index.js +1 -6
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/font-size-picker/index.native.js +1 -1
- package/build-module/font-size-picker/index.native.js.map +1 -1
- package/build-module/higher-order/with-focus-return/index.js +1 -1
- package/build-module/higher-order/with-focus-return/index.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +22 -22
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/menu/checkbox-item.js +6 -6
- package/build-module/menu/checkbox-item.js.map +1 -1
- package/build-module/menu/context.js +1 -1
- package/build-module/menu/context.js.map +1 -1
- package/build-module/menu/group-label.js +4 -4
- package/build-module/menu/group-label.js.map +1 -1
- package/build-module/menu/group.js +4 -4
- package/build-module/menu/group.js.map +1 -1
- package/build-module/menu/index.js +99 -26
- package/build-module/menu/index.js.map +1 -1
- package/build-module/menu/item-help-text.js +4 -4
- package/build-module/menu/item-help-text.js.map +1 -1
- package/build-module/menu/item-label.js +4 -4
- package/build-module/menu/item-label.js.map +1 -1
- package/build-module/menu/item.js +6 -6
- package/build-module/menu/item.js.map +1 -1
- package/build-module/menu/popover.js +5 -5
- package/build-module/menu/popover.js.map +1 -1
- package/build-module/menu/radio-item.js +6 -6
- package/build-module/menu/radio-item.js.map +1 -1
- package/build-module/menu/separator.js +4 -4
- package/build-module/menu/separator.js.map +1 -1
- package/build-module/menu/styles.js +40 -40
- package/build-module/menu/styles.js.map +1 -1
- package/build-module/menu/submenu-trigger-item.js +6 -6
- package/build-module/menu/submenu-trigger-item.js.map +1 -1
- package/build-module/menu/trigger-button.js +3 -3
- package/build-module/menu/trigger-button.js.map +1 -1
- package/build-module/menu/types.js.map +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/action-button.native.js.map +1 -1
- package/build-module/mobile/utils/get-px-from-css-unit.native.js +3 -3
- package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build-module/notice/types.js.map +1 -1
- package/build-module/search-control/index.js +1 -1
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/text/hook.js +8 -6
- package/build-module/text/hook.js.map +1 -1
- package/build-module/text/utils.js +1 -1
- package/build-module/text/utils.js.map +1 -1
- package/build-style/style-rtl.css +89 -170
- package/build-style/style.css +89 -170
- package/build-types/badge/index.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
- package/build-types/box-control/index.d.ts.map +1 -1
- package/build-types/box-control/linked-button.d.ts.map +1 -1
- package/build-types/box-control/stories/index.story.d.ts +7 -2331
- package/build-types/box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/box-control/types.d.ts +15 -3
- package/build-types/box-control/types.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -1
- package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/higher-order/with-focus-return/index.d.ts +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/menu/checkbox-item.d.ts +2 -2
- package/build-types/menu/checkbox-item.d.ts.map +1 -1
- package/build-types/menu/context.d.ts +2 -2
- package/build-types/menu/context.d.ts.map +1 -1
- package/build-types/menu/group-label.d.ts +2 -2
- package/build-types/menu/group-label.d.ts.map +1 -1
- package/build-types/menu/group.d.ts +2 -2
- package/build-types/menu/group.d.ts.map +1 -1
- package/build-types/menu/index.d.ts +84 -12
- package/build-types/menu/index.d.ts.map +1 -1
- package/build-types/menu/item-help-text.d.ts +1 -1
- package/build-types/menu/item-help-text.d.ts.map +1 -1
- package/build-types/menu/item-label.d.ts +1 -1
- package/build-types/menu/item-label.d.ts.map +1 -1
- package/build-types/menu/item.d.ts +2 -2
- package/build-types/menu/item.d.ts.map +1 -1
- package/build-types/menu/popover.d.ts +2 -2
- package/build-types/menu/popover.d.ts.map +1 -1
- package/build-types/menu/radio-item.d.ts +2 -2
- package/build-types/menu/radio-item.d.ts.map +1 -1
- package/build-types/menu/separator.d.ts +2 -2
- package/build-types/menu/separator.d.ts.map +1 -1
- package/build-types/menu/styles.d.ts +15 -15
- package/build-types/menu/styles.d.ts.map +1 -1
- package/build-types/menu/submenu-trigger-item.d.ts +2 -2
- package/build-types/menu/submenu-trigger-item.d.ts.map +1 -1
- package/build-types/menu/trigger-button.d.ts +2 -2
- package/build-types/menu/trigger-button.d.ts.map +1 -1
- package/build-types/menu/types.d.ts +10 -10
- package/build-types/menu/types.d.ts.map +1 -1
- package/build-types/menu-group/stories/index.story.d.ts +1 -1
- package/build-types/notice/types.d.ts +1 -1
- package/build-types/progress-bar/stories/index.story.d.ts +1 -1
- package/build-types/tabs/stories/index.story.d.ts +0 -3
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/text/hook.d.ts.map +1 -1
- package/build-types/text/utils.d.ts +1 -1
- package/package.json +19 -19
- package/src/animate/style.scss +16 -12
- package/src/badge/index.tsx +28 -27
- package/src/border-box-control/border-box-control-linked-button/component.tsx +9 -14
- package/src/border-control/test/index.js +12 -4
- package/src/box-control/index.tsx +9 -0
- package/src/box-control/linked-button.tsx +8 -11
- package/src/box-control/test/index.tsx +9 -2
- package/src/box-control/types.ts +26 -11
- package/src/button/style.scss +15 -12
- package/src/checkbox-control/style.scss +4 -2
- package/src/circular-option-picker/README.md +1 -2
- package/src/circular-option-picker/circular-option-picker-option.tsx +17 -10
- package/src/circular-option-picker/circular-option-picker.tsx +0 -1
- package/src/circular-option-picker/stories/index.story.tsx +0 -1
- package/src/circular-option-picker/style.scss +10 -5
- package/src/color-palette/index.tsx +0 -7
- package/src/color-palette/test/index.tsx +2 -8
- package/src/combobox-control/test/index.tsx +1 -1
- package/src/drop-zone/style.scss +6 -9
- package/src/font-size-picker/index.native.js +1 -1
- package/src/form-toggle/style.scss +17 -10
- package/src/form-token-field/style.scss +9 -4
- package/src/higher-order/navigate-regions/style.scss +2 -2
- package/src/higher-order/with-focus-return/index.tsx +1 -1
- package/src/input-control/styles/input-control-styles.tsx +6 -0
- package/src/menu/README.md +421 -174
- package/src/menu/checkbox-item.tsx +12 -12
- package/src/menu/context.tsx +2 -4
- package/src/menu/docs-manifest.json +62 -0
- package/src/menu/group-label.tsx +7 -7
- package/src/menu/group.tsx +7 -11
- package/src/menu/index.tsx +101 -31
- package/src/menu/item-help-text.tsx +5 -7
- package/src/menu/item-label.tsx +5 -7
- package/src/menu/item.tsx +12 -12
- package/src/menu/popover.tsx +9 -9
- package/src/menu/radio-item.tsx +12 -12
- package/src/menu/separator.tsx +7 -7
- package/src/menu/stories/best-practices.mdx +38 -0
- package/src/menu/stories/index.story.tsx +8 -8
- package/src/menu/styles.ts +24 -24
- package/src/menu/submenu-trigger-item.tsx +9 -9
- package/src/menu/trigger-button.tsx +6 -6
- package/src/menu/types.ts +10 -10
- package/src/menu-group/stories/index.story.tsx +2 -2
- package/src/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
- package/src/mobile/utils/get-px-from-css-unit.native.js +3 -3
- package/src/modal/style.scss +4 -2
- package/src/modal/test/index.tsx +5 -4
- package/src/notice/README.md +3 -3
- package/src/notice/types.ts +1 -1
- package/src/palette-edit/test/index.tsx +1 -1
- package/src/panel/style.scss +14 -6
- package/src/placeholder/style.scss +5 -3
- package/src/progress-bar/stories/index.story.tsx +1 -1
- package/src/resizable-box/style.scss +14 -9
- package/src/search-control/index.tsx +1 -1
- package/src/tab-panel/style.scss +6 -4
- package/src/tabs/stories/index.story.tsx +0 -131
- package/src/text/README.md +1 -1
- package/src/text/hook.ts +3 -2
- package/src/text/stories/index.story.tsx +2 -2
- package/src/text/test/index.tsx +1 -1
- package/src/text/utils.ts +1 -1
- package/src/text-highlight/test/index.tsx +3 -3
- package/src/toolbar/toolbar/style.scss +4 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -20,10 +20,10 @@ import Button from '../../button';
|
|
|
20
20
|
import Modal from '../../modal';
|
|
21
21
|
import { createSlotFill, Provider as SlotFillProvider } from '../../slot-fill';
|
|
22
22
|
import { ContextSystemProvider } from '../../context';
|
|
23
|
-
import type {
|
|
23
|
+
import type { Props } from '../types';
|
|
24
24
|
|
|
25
25
|
const meta: Meta< typeof Menu > = {
|
|
26
|
-
id: 'components-
|
|
26
|
+
id: 'components-menu',
|
|
27
27
|
title: 'Components (Experimental)/Actions/Menu',
|
|
28
28
|
component: Menu,
|
|
29
29
|
subcomponents: {
|
|
@@ -183,7 +183,7 @@ export const WithSubmenu: StoryObj< typeof Menu > = {
|
|
|
183
183
|
};
|
|
184
184
|
|
|
185
185
|
export const WithCheckboxes: StoryObj< typeof Menu > = {
|
|
186
|
-
render: function WithCheckboxes( props:
|
|
186
|
+
render: function WithCheckboxes( props: Props ) {
|
|
187
187
|
const [ isAChecked, setAChecked ] = useState( false );
|
|
188
188
|
const [ isBChecked, setBChecked ] = useState( true );
|
|
189
189
|
const [ multipleCheckboxesValue, setMultipleCheckboxesValue ] =
|
|
@@ -333,7 +333,7 @@ export const WithCheckboxes: StoryObj< typeof Menu > = {
|
|
|
333
333
|
};
|
|
334
334
|
|
|
335
335
|
export const WithRadios: StoryObj< typeof Menu > = {
|
|
336
|
-
render: function WithRadios( props:
|
|
336
|
+
render: function WithRadios( props: Props ) {
|
|
337
337
|
const [ radioValue, setRadioValue ] = useState( 'two' );
|
|
338
338
|
const onRadioChange: React.ComponentProps<
|
|
339
339
|
typeof Menu.RadioItem
|
|
@@ -411,7 +411,7 @@ const modalOnTopOfMenuPopover = css`
|
|
|
411
411
|
`;
|
|
412
412
|
|
|
413
413
|
export const WithModals: StoryObj< typeof Menu > = {
|
|
414
|
-
render: function WithModals( props:
|
|
414
|
+
render: function WithModals( props: Props ) {
|
|
415
415
|
const [ isOuterModalOpen, setOuterModalOpen ] = useState( false );
|
|
416
416
|
const [ isInnerModalOpen, setInnerModalOpen ] = useState( false );
|
|
417
417
|
|
|
@@ -527,7 +527,7 @@ const Fill = ( { children }: { children: React.ReactNode } ) => {
|
|
|
527
527
|
};
|
|
528
528
|
|
|
529
529
|
export const WithSlotFill: StoryObj< typeof Menu > = {
|
|
530
|
-
render: ( props:
|
|
530
|
+
render: ( props: Props ) => {
|
|
531
531
|
return (
|
|
532
532
|
<SlotFillProvider>
|
|
533
533
|
<Menu { ...props }>
|
|
@@ -579,7 +579,7 @@ const toolbarVariantContextValue = {
|
|
|
579
579
|
};
|
|
580
580
|
|
|
581
581
|
export const ToolbarVariant: StoryObj< typeof Menu > = {
|
|
582
|
-
render: ( props:
|
|
582
|
+
render: ( props: Props ) => (
|
|
583
583
|
// TODO: add toolbar
|
|
584
584
|
<ContextSystemProvider value={ toolbarVariantContextValue }>
|
|
585
585
|
<Menu { ...props }>
|
|
@@ -619,7 +619,7 @@ export const ToolbarVariant: StoryObj< typeof Menu > = {
|
|
|
619
619
|
};
|
|
620
620
|
|
|
621
621
|
export const InsideModal: StoryObj< typeof Menu > = {
|
|
622
|
-
render: function InsideModal( props:
|
|
622
|
+
render: function InsideModal( props: Props ) {
|
|
623
623
|
const [ isModalOpen, setModalOpen ] = useState( false );
|
|
624
624
|
return (
|
|
625
625
|
<>
|
package/src/menu/styles.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { COLORS, font, rtl, CONFIG } from '../utils';
|
|
|
12
12
|
import { space } from '../utils/space';
|
|
13
13
|
import Icon from '../icon';
|
|
14
14
|
import { Truncate } from '../truncate';
|
|
15
|
-
import type {
|
|
15
|
+
import type { ContextProps } from './types';
|
|
16
16
|
|
|
17
17
|
const ANIMATION_PARAMS = {
|
|
18
18
|
SCALE_AMOUNT_OUTER: 0.82,
|
|
@@ -42,8 +42,8 @@ const TOOLBAR_VARIANT_BOX_SHADOW = `0 0 0 ${ CONFIG.borderWidth } ${ TOOLBAR_VAR
|
|
|
42
42
|
|
|
43
43
|
const GRID_TEMPLATE_COLS = 'minmax( 0, max-content ) 1fr';
|
|
44
44
|
|
|
45
|
-
export const
|
|
46
|
-
Pick<
|
|
45
|
+
export const PopoverOuterWrapper = styled.div<
|
|
46
|
+
Pick< ContextProps, 'variant' >
|
|
47
47
|
>`
|
|
48
48
|
position: relative;
|
|
49
49
|
|
|
@@ -95,7 +95,7 @@ export const MenuPopoverOuterWrapper = styled.div<
|
|
|
95
95
|
}
|
|
96
96
|
`;
|
|
97
97
|
|
|
98
|
-
export const
|
|
98
|
+
export const PopoverInnerWrapper = styled.div`
|
|
99
99
|
position: relative;
|
|
100
100
|
/* Same as popover component */
|
|
101
101
|
/* TODO: is there a way to read the sass variable? */
|
|
@@ -219,7 +219,7 @@ const baseItem = css`
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
/* When the item is the trigger of an open submenu */
|
|
222
|
-
${
|
|
222
|
+
${ PopoverInnerWrapper }:not(:focus) &:not(:focus)[aria-expanded="true"] {
|
|
223
223
|
background-color: ${ LIGHT_BACKGROUND_COLOR };
|
|
224
224
|
color: ${ COLORS.theme.foreground };
|
|
225
225
|
}
|
|
@@ -229,15 +229,15 @@ const baseItem = css`
|
|
|
229
229
|
}
|
|
230
230
|
`;
|
|
231
231
|
|
|
232
|
-
export const
|
|
232
|
+
export const Item = styled( Ariakit.MenuItem )`
|
|
233
233
|
${ baseItem };
|
|
234
234
|
`;
|
|
235
235
|
|
|
236
|
-
export const
|
|
236
|
+
export const CheckboxItem = styled( Ariakit.MenuItemCheckbox )`
|
|
237
237
|
${ baseItem };
|
|
238
238
|
`;
|
|
239
239
|
|
|
240
|
-
export const
|
|
240
|
+
export const RadioItem = styled( Ariakit.MenuItemRadio )`
|
|
241
241
|
${ baseItem };
|
|
242
242
|
`;
|
|
243
243
|
|
|
@@ -249,14 +249,14 @@ export const ItemPrefixWrapper = styled.span`
|
|
|
249
249
|
* Even when the item is not checked, occupy the same screen space to avoid
|
|
250
250
|
* the space collapside when no items are checked.
|
|
251
251
|
*/
|
|
252
|
-
${
|
|
253
|
-
${
|
|
252
|
+
${ CheckboxItem } > &,
|
|
253
|
+
${ RadioItem } > & {
|
|
254
254
|
/* Same width as the check icons */
|
|
255
255
|
min-width: ${ space( 6 ) };
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
${
|
|
259
|
-
${
|
|
258
|
+
${ CheckboxItem } > &,
|
|
259
|
+
${ RadioItem } > &,
|
|
260
260
|
&:not( :empty ) {
|
|
261
261
|
margin-inline-end: ${ space( 2 ) };
|
|
262
262
|
}
|
|
@@ -278,7 +278,7 @@ export const ItemPrefixWrapper = styled.span`
|
|
|
278
278
|
}
|
|
279
279
|
`;
|
|
280
280
|
|
|
281
|
-
export const
|
|
281
|
+
export const ItemContentWrapper = styled.div`
|
|
282
282
|
/*
|
|
283
283
|
* Always occupy the second column, since the first column
|
|
284
284
|
* is taken by the prefix wrapper (when displayed).
|
|
@@ -293,7 +293,7 @@ export const MenuItemContentWrapper = styled.div`
|
|
|
293
293
|
pointer-events: none;
|
|
294
294
|
`;
|
|
295
295
|
|
|
296
|
-
export const
|
|
296
|
+
export const ItemChildrenWrapper = styled.div`
|
|
297
297
|
flex: 1;
|
|
298
298
|
|
|
299
299
|
display: inline-flex;
|
|
@@ -317,19 +317,19 @@ export const ItemSuffixWrapper = styled.span`
|
|
|
317
317
|
* When the parent menu item is active, except when it's a non-focused/hovered
|
|
318
318
|
* submenu trigger (in that case, color should not be inherited)
|
|
319
319
|
*/
|
|
320
|
-
[data-active-item]:not( [data-focus-visible] ) *:not(${
|
|
320
|
+
[data-active-item]:not( [data-focus-visible] ) *:not(${ PopoverInnerWrapper }) &,
|
|
321
321
|
/* When the parent menu item is disabled */
|
|
322
|
-
[aria-disabled='true'] *:not(${
|
|
322
|
+
[aria-disabled='true'] *:not(${ PopoverInnerWrapper }) & {
|
|
323
323
|
color: inherit;
|
|
324
324
|
}
|
|
325
325
|
`;
|
|
326
326
|
|
|
327
|
-
export const
|
|
327
|
+
export const Group = styled( Ariakit.MenuGroup )`
|
|
328
328
|
/* Ignore this element when calculating the layout. Useful for subgrid */
|
|
329
329
|
display: contents;
|
|
330
330
|
`;
|
|
331
331
|
|
|
332
|
-
export const
|
|
332
|
+
export const GroupLabel = styled( Ariakit.MenuGroupLabel )`
|
|
333
333
|
/* Occupy the width of all grid columns (ie. full width) */
|
|
334
334
|
grid-column: 1 / -1;
|
|
335
335
|
|
|
@@ -338,8 +338,8 @@ export const MenuGroupLabel = styled( Ariakit.MenuGroupLabel )`
|
|
|
338
338
|
padding-inline: ${ ITEM_PADDING_INLINE };
|
|
339
339
|
`;
|
|
340
340
|
|
|
341
|
-
export const
|
|
342
|
-
Pick<
|
|
341
|
+
export const Separator = styled( Ariakit.MenuSeparator )<
|
|
342
|
+
Pick< ContextProps, 'variant' >
|
|
343
343
|
>`
|
|
344
344
|
/* Occupy the width of all grid columns (ie. full width) */
|
|
345
345
|
grid-column: 1 / -1;
|
|
@@ -370,22 +370,22 @@ export const SubmenuChevronIcon = styled( Icon )`
|
|
|
370
370
|
) };
|
|
371
371
|
`;
|
|
372
372
|
|
|
373
|
-
export const
|
|
373
|
+
export const ItemLabel = styled( Truncate )`
|
|
374
374
|
font-size: ${ font( 'default.fontSize' ) };
|
|
375
375
|
line-height: 20px;
|
|
376
376
|
color: inherit;
|
|
377
377
|
`;
|
|
378
378
|
|
|
379
|
-
export const
|
|
379
|
+
export const ItemHelpText = styled( Truncate )`
|
|
380
380
|
font-size: ${ font( 'helpText.fontSize' ) };
|
|
381
381
|
line-height: 16px;
|
|
382
382
|
color: ${ LIGHTER_TEXT_COLOR };
|
|
383
383
|
overflow-wrap: anywhere;
|
|
384
384
|
|
|
385
385
|
[data-active-item]:not( [data-focus-visible] )
|
|
386
|
-
*:not( ${
|
|
386
|
+
*:not( ${ PopoverInnerWrapper } )
|
|
387
387
|
&,
|
|
388
|
-
[aria-disabled='true'] *:not( ${
|
|
388
|
+
[aria-disabled='true'] *:not( ${ PopoverInnerWrapper } ) & {
|
|
389
389
|
color: inherit;
|
|
390
390
|
}
|
|
391
391
|
`;
|
|
@@ -13,16 +13,16 @@ import { chevronRightSmall } from '@wordpress/icons';
|
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
15
|
import type { WordPressComponentProps } from '../context';
|
|
16
|
-
import type {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
16
|
+
import type { ItemProps } from './types';
|
|
17
|
+
import { Context } from './context';
|
|
18
|
+
import { Item } from './item';
|
|
19
19
|
import * as Styled from './styles';
|
|
20
20
|
|
|
21
|
-
export const
|
|
21
|
+
export const SubmenuTriggerItem = forwardRef<
|
|
22
22
|
HTMLDivElement,
|
|
23
|
-
WordPressComponentProps<
|
|
24
|
-
>( function
|
|
25
|
-
const menuContext = useContext(
|
|
23
|
+
WordPressComponentProps< ItemProps, 'div', false >
|
|
24
|
+
>( function SubmenuTriggerItem( { suffix, ...otherProps }, ref ) {
|
|
25
|
+
const menuContext = useContext( Context );
|
|
26
26
|
|
|
27
27
|
if ( ! menuContext?.store.parent ) {
|
|
28
28
|
throw new Error(
|
|
@@ -36,10 +36,10 @@ export const MenuSubmenuTriggerItem = forwardRef<
|
|
|
36
36
|
accessibleWhenDisabled
|
|
37
37
|
store={ menuContext.store }
|
|
38
38
|
render={
|
|
39
|
-
<
|
|
39
|
+
<Item
|
|
40
40
|
{ ...otherProps }
|
|
41
41
|
// The menu item needs to register and be part of the parent menu.
|
|
42
|
-
// Without specifying the store explicitly, the `
|
|
42
|
+
// Without specifying the store explicitly, the `Item` component
|
|
43
43
|
// would otherwise read the store via context and pick up the one from
|
|
44
44
|
// the sub-menu `Menu` component.
|
|
45
45
|
store={ menuContext.store.parent }
|
|
@@ -12,14 +12,14 @@ import { forwardRef, useContext } from '@wordpress/element';
|
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
14
|
import type { WordPressComponentProps } from '../context';
|
|
15
|
-
import type {
|
|
16
|
-
import {
|
|
15
|
+
import type { TriggerButtonProps } from './types';
|
|
16
|
+
import { Context } from './context';
|
|
17
17
|
|
|
18
|
-
export const
|
|
18
|
+
export const TriggerButton = forwardRef<
|
|
19
19
|
HTMLDivElement,
|
|
20
|
-
WordPressComponentProps<
|
|
21
|
-
>( function
|
|
22
|
-
const menuContext = useContext(
|
|
20
|
+
WordPressComponentProps< TriggerButtonProps, 'button', false >
|
|
21
|
+
>( function TriggerButton( { children, disabled = false, ...props }, ref ) {
|
|
22
|
+
const menuContext = useContext( Context );
|
|
23
23
|
|
|
24
24
|
if ( ! menuContext?.store ) {
|
|
25
25
|
throw new Error(
|
package/src/menu/types.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type * as Ariakit from '@ariakit/react';
|
|
5
5
|
|
|
6
|
-
export interface
|
|
6
|
+
export interface ContextProps {
|
|
7
7
|
/**
|
|
8
8
|
* The ariakit store shared across all Menu subcomponents.
|
|
9
9
|
*/
|
|
@@ -14,7 +14,7 @@ export interface MenuContext {
|
|
|
14
14
|
variant?: 'toolbar';
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export interface
|
|
17
|
+
export interface Props {
|
|
18
18
|
/**
|
|
19
19
|
* The elements, which should include one instance of the `Menu.TriggerButton`
|
|
20
20
|
* component and one instance of the `Menu.Popover` component.
|
|
@@ -50,7 +50,7 @@ export interface MenuProps {
|
|
|
50
50
|
placement?: Ariakit.MenuProviderProps[ 'placement' ];
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export interface
|
|
53
|
+
export interface PopoverProps {
|
|
54
54
|
/**
|
|
55
55
|
* The contents of the menu popover, which should include instances of the
|
|
56
56
|
* `Menu.Item`, `Menu.CheckboxItem`, `Menu.RadioItem`, `Menu.Group`, and
|
|
@@ -98,7 +98,7 @@ export interface MenuPopoverProps {
|
|
|
98
98
|
hideOnEscape?: Ariakit.MenuProps[ 'hideOnEscape' ];
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
export interface
|
|
101
|
+
export interface TriggerButtonProps {
|
|
102
102
|
/**
|
|
103
103
|
* The contents of the menu trigger button.
|
|
104
104
|
*/
|
|
@@ -139,7 +139,7 @@ export interface MenuTriggerButtonProps {
|
|
|
139
139
|
accessibleWhenDisabled?: Ariakit.MenuButtonProps[ 'accessibleWhenDisabled' ];
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
export interface
|
|
142
|
+
export interface GroupProps {
|
|
143
143
|
/**
|
|
144
144
|
* The contents of the menu group, which should include one instance of the
|
|
145
145
|
* `Menu.GroupLabel` component and one or more instances of `Menu.Item`,
|
|
@@ -148,7 +148,7 @@ export interface MenuGroupProps {
|
|
|
148
148
|
children: Ariakit.MenuGroupProps[ 'children' ];
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
export interface
|
|
151
|
+
export interface GroupLabelProps {
|
|
152
152
|
/**
|
|
153
153
|
* The contents of the menu group label, which should provide an accessible
|
|
154
154
|
* label for the menu group.
|
|
@@ -156,7 +156,7 @@ export interface MenuGroupLabelProps {
|
|
|
156
156
|
children: Ariakit.MenuGroupLabelProps[ 'children' ];
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
export interface
|
|
159
|
+
export interface ItemProps {
|
|
160
160
|
/**
|
|
161
161
|
* The contents of the menu item, which could include one instance of the
|
|
162
162
|
* `Menu.ItemLabel` component and/or one instance of the `Menu.ItemHelpText`
|
|
@@ -203,7 +203,7 @@ export interface MenuItemProps {
|
|
|
203
203
|
store?: Ariakit.MenuItemProps[ 'store' ];
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
export interface
|
|
206
|
+
export interface CheckboxItemProps {
|
|
207
207
|
/**
|
|
208
208
|
* The contents of the menu item, which could include one instance of the
|
|
209
209
|
* `Menu.ItemLabel` component and/or one instance of the `Menu.ItemHelpText`
|
|
@@ -267,7 +267,7 @@ export interface MenuCheckboxItemProps {
|
|
|
267
267
|
onChange?: Ariakit.MenuItemCheckboxProps[ 'onChange' ];
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
export interface
|
|
270
|
+
export interface RadioItemProps {
|
|
271
271
|
/**
|
|
272
272
|
* The contents of the menu item, which could include one instance of the
|
|
273
273
|
* `Menu.ItemLabel` component and/or one instance of the `Menu.ItemHelpText`
|
|
@@ -330,4 +330,4 @@ export interface MenuRadioItemProps {
|
|
|
330
330
|
onChange?: Ariakit.MenuItemRadioProps[ 'onChange' ];
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
-
export interface
|
|
333
|
+
export interface SeparatorProps {}
|
|
@@ -76,8 +76,8 @@ const MultiGroupsTemplate: StoryFn< typeof MenuGroup > = ( args ) => {
|
|
|
76
76
|
* When other menu items exist above or below a MenuGroup, the group
|
|
77
77
|
* should have a divider line between it and the adjacent item.
|
|
78
78
|
*/
|
|
79
|
-
export const
|
|
80
|
-
|
|
79
|
+
export const WithSeparator = MultiGroupsTemplate.bind( {} );
|
|
80
|
+
WithSeparator.args = {
|
|
81
81
|
...Default.args,
|
|
82
82
|
hideSeparator: false,
|
|
83
83
|
label: 'Editor',
|
|
@@ -8,7 +8,7 @@ import { View, TouchableWithoutFeedback } from 'react-native';
|
|
|
8
8
|
*/
|
|
9
9
|
import styles from './styles.scss';
|
|
10
10
|
|
|
11
|
-
// Action button component is used by both Back and Apply Button
|
|
11
|
+
// Action button component is used by both Back and Apply Button components.
|
|
12
12
|
function ActionButton( {
|
|
13
13
|
onPress,
|
|
14
14
|
accessibilityLabel,
|
|
@@ -71,7 +71,7 @@ function getFunctionUnitValue( functionUnitValue, options ) {
|
|
|
71
71
|
* Take a css function such as min, max, calc, clamp and returns parsedUnit
|
|
72
72
|
*
|
|
73
73
|
* How this works for the nested function is that it first replaces the inner function call.
|
|
74
|
-
* Then it tackles the outer
|
|
74
|
+
* Then it tackles the outer ones.
|
|
75
75
|
* So for example: min( max(25px, 35px), 40px )
|
|
76
76
|
* in the first pass we would replace max(25px, 35px) with 35px.
|
|
77
77
|
* then we would try to evaluate min( 35px, 40px )
|
|
@@ -101,7 +101,7 @@ function parseUnitFunction( cssUnit ) {
|
|
|
101
101
|
/**
|
|
102
102
|
* Return true if we think this is a math expression.
|
|
103
103
|
*
|
|
104
|
-
* @param {string} cssUnit the cssUnit value being
|
|
104
|
+
* @param {string} cssUnit the cssUnit value being evaluated.
|
|
105
105
|
* @return {boolean} Whether the cssUnit is a math expression.
|
|
106
106
|
*/
|
|
107
107
|
function isMathExpression( cssUnit ) {
|
|
@@ -115,7 +115,7 @@ function isMathExpression( cssUnit ) {
|
|
|
115
115
|
/**
|
|
116
116
|
* Evaluates the math expression and return a px value.
|
|
117
117
|
*
|
|
118
|
-
* @param {string} cssUnit the cssUnit value being
|
|
118
|
+
* @param {string} cssUnit the cssUnit value being evaluated.
|
|
119
119
|
* @return {string} return a converfted value to px.
|
|
120
120
|
*/
|
|
121
121
|
function evalMathExpression( cssUnit ) {
|
package/src/modal/style.scss
CHANGED
|
@@ -33,10 +33,12 @@
|
|
|
33
33
|
display: flex;
|
|
34
34
|
// Animate the modal frame/contents appearing on the page.
|
|
35
35
|
animation-name: components-modal__appear-animation;
|
|
36
|
-
animation-duration: var(--modal-frame-animation-duration);
|
|
37
36
|
animation-fill-mode: forwards;
|
|
38
37
|
animation-timing-function: cubic-bezier(0.29, 0, 0, 1);
|
|
39
|
-
|
|
38
|
+
|
|
39
|
+
@media not (prefers-reduced-motion) {
|
|
40
|
+
animation-duration: var(--modal-frame-animation-duration);
|
|
41
|
+
}
|
|
40
42
|
|
|
41
43
|
.components-modal__screen-overlay.is-animating-out & {
|
|
42
44
|
animation-name: components-modal__disappear-animation;
|
package/src/modal/test/index.tsx
CHANGED
|
@@ -398,7 +398,8 @@ describe( 'Modal', () => {
|
|
|
398
398
|
const [ isAShown, setIsAShown ] = useState( false );
|
|
399
399
|
const [ isA1Shown, setIsA1Shown ] = useState( false );
|
|
400
400
|
const [ isBShown, setIsBShown ] = useState( false );
|
|
401
|
-
const [
|
|
401
|
+
const [ isClassOverridden, setIsClassOverridden ] =
|
|
402
|
+
useState( false );
|
|
402
403
|
useEffect( () => {
|
|
403
404
|
const toggles: ( e: KeyboardEvent ) => void = ( {
|
|
404
405
|
key,
|
|
@@ -414,7 +415,7 @@ describe( 'Modal', () => {
|
|
|
414
415
|
return setIsBShown( ( v ) => ! v );
|
|
415
416
|
}
|
|
416
417
|
if ( key === 'c' ) {
|
|
417
|
-
return
|
|
418
|
+
return setIsClassOverridden( ( v ) => ! v );
|
|
418
419
|
}
|
|
419
420
|
};
|
|
420
421
|
document.addEventListener( 'keydown', toggles );
|
|
@@ -426,7 +427,7 @@ describe( 'Modal', () => {
|
|
|
426
427
|
{ isAShown && (
|
|
427
428
|
<Modal
|
|
428
429
|
bodyOpenClassName={
|
|
429
|
-
|
|
430
|
+
isClassOverridden ? overrideClass : 'is-A-open'
|
|
430
431
|
}
|
|
431
432
|
onRequestClose={ () => setIsAShown( false ) }
|
|
432
433
|
>
|
|
@@ -446,7 +447,7 @@ describe( 'Modal', () => {
|
|
|
446
447
|
{ isBShown && (
|
|
447
448
|
<Modal
|
|
448
449
|
bodyOpenClassName={
|
|
449
|
-
|
|
450
|
+
isClassOverridden ? overrideClass : 'is-B-open'
|
|
450
451
|
}
|
|
451
452
|
onRequestClose={ () => setIsBShown( false ) }
|
|
452
453
|
>
|
package/src/notice/README.md
CHANGED
|
@@ -134,9 +134,9 @@ Whether the notice should be dismissible or not
|
|
|
134
134
|
|
|
135
135
|
#### `onDismiss` : `() => void`
|
|
136
136
|
|
|
137
|
-
A deprecated alternative to `onRemove`. This prop is kept for
|
|
137
|
+
A deprecated alternative to `onRemove`. This prop is kept for compatibility reasons but should be avoided.
|
|
138
138
|
|
|
139
|
-
-
|
|
139
|
+
- Required: No
|
|
140
140
|
- Default: `noop`
|
|
141
141
|
|
|
142
142
|
#### `actions`: `Array<NoticeAction>`.
|
|
@@ -154,4 +154,4 @@ The default appearance of an action button is inferred based on whether `url` or
|
|
|
154
154
|
## Related components
|
|
155
155
|
|
|
156
156
|
- To create a more prominent message that requires action, use a Modal.
|
|
157
|
-
- For low priority, non-interruptive
|
|
157
|
+
- For low priority, non-interruptive messages, use Snackbar.
|
package/src/notice/types.ts
CHANGED
package/src/panel/style.scss
CHANGED
|
@@ -62,9 +62,12 @@
|
|
|
62
62
|
font-size: inherit;
|
|
63
63
|
margin-top: 0;
|
|
64
64
|
margin-bottom: 0;
|
|
65
|
-
|
|
66
|
-
@
|
|
65
|
+
|
|
66
|
+
@media not (prefers-reduced-motion) {
|
|
67
|
+
transition: 0.1s background ease-in-out;
|
|
68
|
+
}
|
|
67
69
|
}
|
|
70
|
+
|
|
68
71
|
.components-panel__body.is-opened > .components-panel__body-title {
|
|
69
72
|
margin: -1 * $grid-unit-20;
|
|
70
73
|
margin-bottom: 5px;
|
|
@@ -87,8 +90,11 @@
|
|
|
87
90
|
color: $gray-900;
|
|
88
91
|
border: none;
|
|
89
92
|
box-shadow: none;
|
|
90
|
-
|
|
91
|
-
@
|
|
93
|
+
|
|
94
|
+
@media not (prefers-reduced-motion) {
|
|
95
|
+
transition: 0.1s background ease-in-out;
|
|
96
|
+
}
|
|
97
|
+
|
|
92
98
|
height: auto;
|
|
93
99
|
|
|
94
100
|
&:focus {
|
|
@@ -103,8 +109,10 @@
|
|
|
103
109
|
transform: translateY(-50%);
|
|
104
110
|
color: $gray-900;
|
|
105
111
|
fill: currentColor;
|
|
106
|
-
|
|
107
|
-
@
|
|
112
|
+
|
|
113
|
+
@media not (prefers-reduced-motion) {
|
|
114
|
+
transition: 0.1s color ease-in-out;
|
|
115
|
+
}
|
|
108
116
|
}
|
|
109
117
|
|
|
110
118
|
// mirror the arrow horizontally in RTL languages
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
.block-editor-block-icon {
|
|
49
49
|
margin-right: $grid-unit-05;
|
|
50
50
|
fill: currentColor;
|
|
51
|
-
//
|
|
51
|
+
// Optimize for high contrast modes.
|
|
52
52
|
// See also https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/.
|
|
53
53
|
@media (forced-colors: active) {
|
|
54
54
|
fill: CanvasText;
|
|
@@ -173,8 +173,10 @@
|
|
|
173
173
|
.components-button {
|
|
174
174
|
opacity: 0;
|
|
175
175
|
pointer-events: none;
|
|
176
|
-
|
|
177
|
-
@
|
|
176
|
+
|
|
177
|
+
@media not (prefers-reduced-motion) {
|
|
178
|
+
transition: opacity 0.1s linear;
|
|
179
|
+
}
|
|
178
180
|
}
|
|
179
181
|
|
|
180
182
|
.is-selected > & {
|
|
@@ -43,7 +43,7 @@ const withCustomWidthCustomCSS = `
|
|
|
43
43
|
* You can override the default `width` by passing a custom CSS class via the
|
|
44
44
|
* `className` prop.
|
|
45
45
|
*
|
|
46
|
-
* This example shows a progress bar with an
|
|
46
|
+
* This example shows a progress bar with an overridden `width` of `100%` which
|
|
47
47
|
* makes it fit all available horizontal space of the parent element. The CSS
|
|
48
48
|
* class looks like this:
|
|
49
49
|
*
|
|
@@ -60,9 +60,12 @@ $resize-handler-container-size: $resize-handler-size + ($grid-unit-05 * 2); // M
|
|
|
60
60
|
position: absolute;
|
|
61
61
|
top: calc(50% - 1px);
|
|
62
62
|
right: calc(50% - 1px);
|
|
63
|
-
|
|
64
|
-
@
|
|
65
|
-
|
|
63
|
+
|
|
64
|
+
@media not (prefers-reduced-motion) {
|
|
65
|
+
transition: transform 0.1s ease-in;
|
|
66
|
+
will-change: transform;
|
|
67
|
+
}
|
|
68
|
+
|
|
66
69
|
opacity: 0;
|
|
67
70
|
}
|
|
68
71
|
|
|
@@ -102,18 +105,20 @@ $resize-handler-container-size: $resize-handler-size + ($grid-unit-05 * 2); // M
|
|
|
102
105
|
.components-resizable-box__side-handle.components-resizable-box__handle-bottom:hover::before,
|
|
103
106
|
.components-resizable-box__side-handle.components-resizable-box__handle-top:active::before,
|
|
104
107
|
.components-resizable-box__side-handle.components-resizable-box__handle-bottom:active::before {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
@media not (prefers-reduced-motion) {
|
|
109
|
+
animation: components-resizable-box__top-bottom-animation 0.1s ease-out 0s;
|
|
110
|
+
animation-fill-mode: forwards;
|
|
111
|
+
}
|
|
108
112
|
}
|
|
109
113
|
|
|
110
114
|
.components-resizable-box__side-handle.components-resizable-box__handle-left:hover::before,
|
|
111
115
|
.components-resizable-box__side-handle.components-resizable-box__handle-right:hover::before,
|
|
112
116
|
.components-resizable-box__side-handle.components-resizable-box__handle-left:active::before,
|
|
113
117
|
.components-resizable-box__side-handle.components-resizable-box__handle-right:active::before {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
@media not (prefers-reduced-motion) {
|
|
119
|
+
animation: components-resizable-box__left-right-animation 0.1s ease-out 0s;
|
|
120
|
+
animation-fill-mode: forwards;
|
|
121
|
+
}
|
|
117
122
|
}
|
|
118
123
|
|
|
119
124
|
/* This CSS is shown only to Safari, which has a bug with table-caption making it jumpy.
|
|
@@ -86,7 +86,7 @@ function UnforwardedSearchControl(
|
|
|
86
86
|
() => ( {
|
|
87
87
|
BaseControl: {
|
|
88
88
|
// Overrides the underlying BaseControl `__nextHasNoMarginBottom` via the context system
|
|
89
|
-
// to provide backwards
|
|
89
|
+
// to provide backwards compatible margin for SearchControl.
|
|
90
90
|
// (In a standard InputControl, the BaseControl `__nextHasNoMarginBottom` is always set to true.)
|
|
91
91
|
_overrides: { __nextHasNoMarginBottom },
|
|
92
92
|
__associatedWPComponentName: 'SearchControl',
|
package/src/tab-panel/style.scss
CHANGED
|
@@ -40,8 +40,9 @@
|
|
|
40
40
|
border-radius: 0;
|
|
41
41
|
|
|
42
42
|
// Animation
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
@media not (prefers-reduced-motion) {
|
|
44
|
+
transition: all 0.1s linear;
|
|
45
|
+
}
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
// Active.
|
|
@@ -68,8 +69,9 @@
|
|
|
68
69
|
border-radius: $radius-small;
|
|
69
70
|
|
|
70
71
|
// Animation
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
@media not (prefers-reduced-motion) {
|
|
73
|
+
transition: all 0.1s linear;
|
|
74
|
+
}
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
&:focus-visible::before {
|