@wordpress/components 25.1.1 → 25.1.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 +5 -0
- package/build/button/index.js +13 -4
- package/build/button/index.js.map +1 -1
- package/build/confirm-dialog/component.js +9 -1
- package/build/confirm-dialog/component.js.map +1 -1
- package/build/font-size-picker/index.js +5 -3
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/styles.js +19 -26
- package/build/font-size-picker/styles.js.map +1 -1
- package/build/item-group/styles.js +10 -10
- package/build/item-group/styles.js.map +1 -1
- package/build/number-control/index.js +8 -4
- package/build/number-control/index.js.map +1 -1
- package/build/number-control/styles/number-control-styles.js +9 -15
- package/build/number-control/styles/number-control-styles.js.map +1 -1
- package/build/select-control/index.js +2 -1
- package/build/select-control/index.js.map +1 -1
- package/build/z-stack/component.js +5 -3
- package/build/z-stack/component.js.map +1 -1
- package/build/z-stack/styles.js +23 -42
- package/build/z-stack/styles.js.map +1 -1
- package/build-module/button/index.js +13 -4
- package/build-module/button/index.js.map +1 -1
- package/build-module/confirm-dialog/component.js +10 -2
- package/build-module/confirm-dialog/component.js.map +1 -1
- package/build-module/font-size-picker/index.js +5 -4
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/styles.js +17 -23
- package/build-module/font-size-picker/styles.js.map +1 -1
- package/build-module/item-group/styles.js +10 -10
- package/build-module/item-group/styles.js.map +1 -1
- package/build-module/number-control/index.js +8 -5
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/number-control/styles/number-control-styles.js +7 -14
- package/build-module/number-control/styles/number-control-styles.js.map +1 -1
- package/build-module/select-control/index.js +2 -1
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/z-stack/component.js +5 -3
- package/build-module/z-stack/component.js.map +1 -1
- package/build-module/z-stack/styles.js +22 -44
- package/build-module/z-stack/styles.js.map +1 -1
- package/build-style/style-rtl.css +8 -7
- package/build-style/style.css +8 -7
- package/build-types/button/deprecated.d.ts +6 -6
- package/build-types/button/index.d.ts.map +1 -1
- package/build-types/button/types.d.ts +16 -9
- package/build-types/button/types.d.ts.map +1 -1
- package/build-types/confirm-dialog/component.d.ts.map +1 -1
- package/build-types/font-size-picker/index.d.ts.map +1 -1
- package/build-types/font-size-picker/styles.d.ts +0 -6
- package/build-types/font-size-picker/styles.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/component.d.ts +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +1 -1
- package/build-types/navigator/navigator-button/component.d.ts +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +1 -1
- package/build-types/navigator/navigator-to-parent-button/component.d.ts +1 -1
- package/build-types/number-control/index.d.ts.map +1 -1
- package/build-types/number-control/styles/number-control-styles.d.ts +5 -3
- package/build-types/number-control/styles/number-control-styles.d.ts.map +1 -1
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/types.d.ts +6 -0
- package/build-types/select-control/types.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-button/index.d.ts +6 -6
- package/build-types/z-stack/component.d.ts.map +1 -1
- package/build-types/z-stack/stories/index.d.ts.map +1 -1
- package/build-types/z-stack/styles.d.ts +5 -4
- package/build-types/z-stack/styles.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/button/README.md +15 -0
- package/src/button/index.tsx +11 -4
- package/src/button/style.scss +13 -12
- package/src/button/test/index.tsx +13 -0
- package/src/button/types.ts +17 -9
- package/src/confirm-dialog/component.tsx +12 -2
- package/src/confirm-dialog/stories/index.js +8 -15
- package/src/confirm-dialog/test/index.js +42 -0
- package/src/font-size-picker/index.tsx +9 -5
- package/src/font-size-picker/styles.ts +0 -10
- package/src/item-group/styles.ts +1 -1
- package/src/number-control/index.tsx +6 -3
- package/src/number-control/styles/number-control-styles.ts +8 -16
- package/src/select-control/index.tsx +1 -0
- package/src/select-control/types.ts +6 -0
- package/src/z-stack/component.tsx +4 -2
- package/src/z-stack/stories/index.tsx +6 -13
- package/src/z-stack/styles.ts +23 -24
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -23,7 +23,6 @@ import type React from 'react';
|
|
|
23
23
|
*/
|
|
24
24
|
export declare const ToolbarButton: React.ForwardRefExoticComponent<ToolbarButtonProps & Omit<Pick<{
|
|
25
25
|
__next40pxDefaultSize?: boolean | undefined;
|
|
26
|
-
__next32pxSmallSize?: boolean | undefined;
|
|
27
26
|
children?: React.ReactNode;
|
|
28
27
|
describedBy?: string | undefined;
|
|
29
28
|
focus?: boolean | undefined;
|
|
@@ -40,6 +39,7 @@ export declare const ToolbarButton: React.ForwardRefExoticComponent<ToolbarButto
|
|
|
40
39
|
ariaLabel: string;
|
|
41
40
|
} | undefined;
|
|
42
41
|
showTooltip?: boolean | undefined;
|
|
42
|
+
size?: "default" | "small" | "compact" | undefined;
|
|
43
43
|
text?: string | undefined;
|
|
44
44
|
tooltipPosition?: ("bottom" | "top" | "middle") | "bottom left" | "bottom right" | "bottom center" | "top left" | "top right" | "top center" | "middle left" | "middle right" | "middle center" | "bottom left left" | "bottom left right" | "bottom left bottom" | "bottom left top" | "bottom right left" | "bottom right right" | "bottom right bottom" | "bottom right top" | "bottom center left" | "bottom center right" | "bottom center bottom" | "bottom center top" | "top left left" | "top left right" | "top left bottom" | "top left top" | "top right left" | "top right right" | "top right bottom" | "top right top" | "top center left" | "top center right" | "top center bottom" | "top center top" | "middle left left" | "middle left right" | "middle left bottom" | "middle left top" | "middle right left" | "middle right right" | "middle right bottom" | "middle right top" | "middle center left" | "middle center right" | "middle center bottom" | "middle center top" | undefined;
|
|
45
45
|
variant?: "link" | "primary" | "secondary" | "tertiary" | undefined;
|
|
@@ -48,7 +48,6 @@ export declare const ToolbarButton: React.ForwardRefExoticComponent<ToolbarButto
|
|
|
48
48
|
disabled?: boolean | undefined;
|
|
49
49
|
} & Omit<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>>, "disabled" | "as" | keyof {
|
|
50
50
|
__next40pxDefaultSize?: boolean | undefined;
|
|
51
|
-
__next32pxSmallSize?: boolean | undefined;
|
|
52
51
|
children?: React.ReactNode;
|
|
53
52
|
describedBy?: string | undefined;
|
|
54
53
|
focus?: boolean | undefined;
|
|
@@ -65,13 +64,13 @@ export declare const ToolbarButton: React.ForwardRefExoticComponent<ToolbarButto
|
|
|
65
64
|
ariaLabel: string;
|
|
66
65
|
} | undefined;
|
|
67
66
|
showTooltip?: boolean | undefined;
|
|
67
|
+
size?: "default" | "small" | "compact" | undefined;
|
|
68
68
|
text?: string | undefined;
|
|
69
69
|
tooltipPosition?: ("bottom" | "top" | "middle") | "bottom left" | "bottom right" | "bottom center" | "top left" | "top right" | "top center" | "middle left" | "middle right" | "middle center" | "bottom left left" | "bottom left right" | "bottom left bottom" | "bottom left top" | "bottom right left" | "bottom right right" | "bottom right bottom" | "bottom right top" | "bottom center left" | "bottom center right" | "bottom center bottom" | "bottom center top" | "top left left" | "top left right" | "top left bottom" | "top left top" | "top right left" | "top right right" | "top right bottom" | "top right top" | "top center left" | "top center right" | "top center bottom" | "top center top" | "middle left left" | "middle left right" | "middle left bottom" | "middle left top" | "middle right left" | "middle right right" | "middle right bottom" | "middle right top" | "middle center left" | "middle center right" | "middle center bottom" | "middle center top" | undefined;
|
|
70
70
|
variant?: "link" | "primary" | "secondary" | "tertiary" | undefined;
|
|
71
71
|
__experimentalIsFocusable?: boolean | undefined;
|
|
72
72
|
}> & React.RefAttributes<any>, "defaultValue" | "onChange" | "value" | "name" | "color" | "translate" | "hidden" | "style" | "disabled" | "key" | "form" | "slot" | "title" | "type" | "id" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | keyof {
|
|
73
73
|
__next40pxDefaultSize?: boolean | undefined;
|
|
74
|
-
__next32pxSmallSize?: boolean | undefined;
|
|
75
74
|
children?: React.ReactNode;
|
|
76
75
|
describedBy?: string | undefined;
|
|
77
76
|
focus?: boolean | undefined;
|
|
@@ -88,13 +87,13 @@ export declare const ToolbarButton: React.ForwardRefExoticComponent<ToolbarButto
|
|
|
88
87
|
ariaLabel: string;
|
|
89
88
|
} | undefined;
|
|
90
89
|
showTooltip?: boolean | undefined;
|
|
90
|
+
size?: "default" | "small" | "compact" | undefined;
|
|
91
91
|
text?: string | undefined;
|
|
92
92
|
tooltipPosition?: ("bottom" | "top" | "middle") | "bottom left" | "bottom right" | "bottom center" | "top left" | "top right" | "top center" | "middle left" | "middle right" | "middle center" | "bottom left left" | "bottom left right" | "bottom left bottom" | "bottom left top" | "bottom right left" | "bottom right right" | "bottom right bottom" | "bottom right top" | "bottom center left" | "bottom center right" | "bottom center bottom" | "bottom center top" | "top left left" | "top left right" | "top left bottom" | "top left top" | "top right left" | "top right right" | "top right bottom" | "top right top" | "top center left" | "top center right" | "top center bottom" | "top center top" | "middle left left" | "middle left right" | "middle left bottom" | "middle left top" | "middle right left" | "middle right right" | "middle right bottom" | "middle right top" | "middle center left" | "middle center right" | "middle center bottom" | "middle center top" | undefined;
|
|
93
93
|
variant?: "link" | "primary" | "secondary" | "tertiary" | undefined;
|
|
94
94
|
__experimentalIsFocusable?: boolean | undefined;
|
|
95
95
|
}> | Pick<{
|
|
96
96
|
__next40pxDefaultSize?: boolean | undefined;
|
|
97
|
-
__next32pxSmallSize?: boolean | undefined;
|
|
98
97
|
children?: React.ReactNode;
|
|
99
98
|
describedBy?: string | undefined;
|
|
100
99
|
focus?: boolean | undefined;
|
|
@@ -111,6 +110,7 @@ export declare const ToolbarButton: React.ForwardRefExoticComponent<ToolbarButto
|
|
|
111
110
|
ariaLabel: string;
|
|
112
111
|
} | undefined;
|
|
113
112
|
showTooltip?: boolean | undefined;
|
|
113
|
+
size?: "default" | "small" | "compact" | undefined;
|
|
114
114
|
text?: string | undefined;
|
|
115
115
|
tooltipPosition?: ("bottom" | "top" | "middle") | "bottom left" | "bottom right" | "bottom center" | "top left" | "top right" | "top center" | "middle left" | "middle right" | "middle center" | "bottom left left" | "bottom left right" | "bottom left bottom" | "bottom left top" | "bottom right left" | "bottom right right" | "bottom right bottom" | "bottom right top" | "bottom center left" | "bottom center right" | "bottom center bottom" | "bottom center top" | "top left left" | "top left right" | "top left bottom" | "top left top" | "top right left" | "top right right" | "top right bottom" | "top right top" | "top center left" | "top center right" | "top center bottom" | "top center top" | "middle left left" | "middle left right" | "middle left bottom" | "middle left top" | "middle right left" | "middle right right" | "middle right bottom" | "middle right top" | "middle center left" | "middle center right" | "middle center bottom" | "middle center top" | undefined;
|
|
116
116
|
variant?: "link" | "primary" | "secondary" | "tertiary" | undefined;
|
|
@@ -121,7 +121,6 @@ export declare const ToolbarButton: React.ForwardRefExoticComponent<ToolbarButto
|
|
|
121
121
|
target?: string | undefined;
|
|
122
122
|
} & Omit<Pick<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "key" | keyof React.AnchorHTMLAttributes<HTMLAnchorElement>>, "as" | keyof {
|
|
123
123
|
__next40pxDefaultSize?: boolean | undefined;
|
|
124
|
-
__next32pxSmallSize?: boolean | undefined;
|
|
125
124
|
children?: React.ReactNode;
|
|
126
125
|
describedBy?: string | undefined;
|
|
127
126
|
focus?: boolean | undefined;
|
|
@@ -138,6 +137,7 @@ export declare const ToolbarButton: React.ForwardRefExoticComponent<ToolbarButto
|
|
|
138
137
|
ariaLabel: string;
|
|
139
138
|
} | undefined;
|
|
140
139
|
showTooltip?: boolean | undefined;
|
|
140
|
+
size?: "default" | "small" | "compact" | undefined;
|
|
141
141
|
text?: string | undefined;
|
|
142
142
|
tooltipPosition?: ("bottom" | "top" | "middle") | "bottom left" | "bottom right" | "bottom center" | "top left" | "top right" | "top center" | "middle left" | "middle right" | "middle center" | "bottom left left" | "bottom left right" | "bottom left bottom" | "bottom left top" | "bottom right left" | "bottom right right" | "bottom right bottom" | "bottom right top" | "bottom center left" | "bottom center right" | "bottom center bottom" | "bottom center top" | "top left left" | "top left right" | "top left bottom" | "top left top" | "top right left" | "top right right" | "top right bottom" | "top right top" | "top center left" | "top center right" | "top center bottom" | "top center top" | "middle left left" | "middle left right" | "middle left bottom" | "middle left top" | "middle right left" | "middle right right" | "middle right bottom" | "middle right top" | "middle center left" | "middle center right" | "middle center bottom" | "middle center top" | undefined;
|
|
143
143
|
variant?: "link" | "primary" | "secondary" | "tertiary" | undefined;
|
|
@@ -148,7 +148,6 @@ export declare const ToolbarButton: React.ForwardRefExoticComponent<ToolbarButto
|
|
|
148
148
|
target?: string | undefined;
|
|
149
149
|
}> & React.RefAttributes<any>, "defaultValue" | "onChange" | "color" | "translate" | "hidden" | "style" | "key" | "slot" | "title" | "type" | "download" | "id" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "media" | keyof {
|
|
150
150
|
__next40pxDefaultSize?: boolean | undefined;
|
|
151
|
-
__next32pxSmallSize?: boolean | undefined;
|
|
152
151
|
children?: React.ReactNode;
|
|
153
152
|
describedBy?: string | undefined;
|
|
154
153
|
focus?: boolean | undefined;
|
|
@@ -165,6 +164,7 @@ export declare const ToolbarButton: React.ForwardRefExoticComponent<ToolbarButto
|
|
|
165
164
|
ariaLabel: string;
|
|
166
165
|
} | undefined;
|
|
167
166
|
showTooltip?: boolean | undefined;
|
|
167
|
+
size?: "default" | "small" | "compact" | undefined;
|
|
168
168
|
text?: string | undefined;
|
|
169
169
|
tooltipPosition?: ("bottom" | "top" | "middle") | "bottom left" | "bottom right" | "bottom center" | "top left" | "top right" | "top center" | "middle left" | "middle right" | "middle center" | "bottom left left" | "bottom left right" | "bottom left bottom" | "bottom left top" | "bottom right left" | "bottom right right" | "bottom right bottom" | "bottom right top" | "bottom center left" | "bottom center right" | "bottom center bottom" | "bottom center top" | "top left left" | "top left right" | "top left bottom" | "top left top" | "top right left" | "top right right" | "top right bottom" | "top right top" | "top center left" | "top center right" | "top center bottom" | "top center top" | "middle left left" | "middle left right" | "middle left bottom" | "middle left top" | "middle right left" | "middle right right" | "middle right bottom" | "middle right top" | "middle center left" | "middle center right" | "middle center bottom" | "middle center top" | undefined;
|
|
170
170
|
variant?: "link" | "primary" | "secondary" | "tertiary" | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/z-stack/component.tsx"],"names":[],"mappings":";AAgBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/z-stack/component.tsx"],"names":[],"mappings":";AAgBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAkD3C;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,MAAM,2GAAgD,CAAC;AAEpE,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/z-stack/stories/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/z-stack/stories/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOtE,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAE5B,QAAA,MAAM,IAAI,EAAE,aAAa,CAAE,OAAO,MAAM,CAavC,CAAC;AACF,eAAe,IAAI,CAAC;AAsCpB,eAAO,MAAM,OAAO,EAAE,cAAc,CAAE,OAAO,MAAM,CAAwB,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const ZStackChildView: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
theme?: import("@emotion/react").Theme | undefined;
|
|
4
4
|
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
} & {
|
|
6
|
+
offsetAmount: number;
|
|
7
|
+
zIndex: number;
|
|
5
8
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
-
export declare const
|
|
9
|
+
export declare const ZStackView: import("@emotion/styled").StyledComponent<{
|
|
7
10
|
theme?: import("@emotion/react").Theme | undefined;
|
|
8
11
|
as?: import("react").ElementType<any> | undefined;
|
|
9
12
|
} & {
|
|
10
13
|
isLayered: boolean;
|
|
11
|
-
offsetAmount: number;
|
|
12
|
-
zIndex: number;
|
|
13
14
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
14
15
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/z-stack/styles.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/z-stack/styles.ts"],"names":[],"mappings":";AAMA,eAAO,MAAM,eAAe;;;;kBACb,MAAM;YACZ,MAAM;yGAUd,CAAC;AAEF,eAAO,MAAM,UAAU;;;;eACX,OAAO;yGAgBlB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/components",
|
|
3
|
-
"version": "25.1.
|
|
3
|
+
"version": "25.1.2",
|
|
4
4
|
"description": "UI components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@wordpress/hooks": "^3.35.1",
|
|
52
52
|
"@wordpress/html-entities": "^3.35.1",
|
|
53
53
|
"@wordpress/i18n": "^4.35.1",
|
|
54
|
-
"@wordpress/icons": "^9.26.
|
|
54
|
+
"@wordpress/icons": "^9.26.2",
|
|
55
55
|
"@wordpress/is-shallow-equal": "^4.35.1",
|
|
56
56
|
"@wordpress/keycodes": "^3.35.1",
|
|
57
57
|
"@wordpress/primitives": "^3.33.1",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"dom-scroll-into-view": "^1.2.1",
|
|
67
67
|
"downshift": "^6.0.15",
|
|
68
68
|
"fast-deep-equal": "^3.1.3",
|
|
69
|
-
"framer-motion": "
|
|
69
|
+
"framer-motion": "~10.11.6",
|
|
70
70
|
"gradient-parser": "^0.1.5",
|
|
71
71
|
"highlight-words-core": "^1.2.2",
|
|
72
72
|
"is-plain-object": "^5.0.0",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "a00463f06c90ae6705951861eb889e67a52bf448"
|
|
91
91
|
}
|
package/src/button/README.md
CHANGED
|
@@ -198,6 +198,8 @@ Renders a pressed button style.
|
|
|
198
198
|
|
|
199
199
|
Decreases the size of the button.
|
|
200
200
|
|
|
201
|
+
Deprecated in favor of the `size` prop. If both props are defined, the `size` prop will take precedence.
|
|
202
|
+
|
|
201
203
|
- Required: No
|
|
202
204
|
|
|
203
205
|
#### `label`: `string`
|
|
@@ -218,6 +220,19 @@ If provided, renders a [Tooltip](/packages/components/src/tooltip/README.md) com
|
|
|
218
220
|
|
|
219
221
|
- Required: No
|
|
220
222
|
|
|
223
|
+
#### `size`: `'default'` | `'compact'` | `'small'`
|
|
224
|
+
|
|
225
|
+
The size of the button.
|
|
226
|
+
|
|
227
|
+
- `'default'`: For normal text-label buttons, unless it is a toggle button.
|
|
228
|
+
- `'compact'`: For toggle buttons, icon buttons, and buttons when used in context of either.
|
|
229
|
+
- `'small'`: For icon buttons associated with more advanced or auxiliary features.
|
|
230
|
+
|
|
231
|
+
If the deprecated `isSmall` prop is also defined, this prop will take precedence.
|
|
232
|
+
|
|
233
|
+
- Required: No
|
|
234
|
+
- Default: `'default'`
|
|
235
|
+
|
|
221
236
|
#### `target`: `string`
|
|
222
237
|
|
|
223
238
|
If provided with `href`, sets the `target` attribute to the `a`.
|
package/src/button/index.tsx
CHANGED
|
@@ -33,11 +33,18 @@ function useDeprecatedProps( {
|
|
|
33
33
|
isSecondary,
|
|
34
34
|
isTertiary,
|
|
35
35
|
isLink,
|
|
36
|
+
isSmall,
|
|
37
|
+
size,
|
|
36
38
|
variant,
|
|
37
39
|
...otherProps
|
|
38
40
|
}: ButtonProps & DeprecatedButtonProps ): ButtonProps {
|
|
41
|
+
let computedSize = size;
|
|
39
42
|
let computedVariant = variant;
|
|
40
43
|
|
|
44
|
+
if ( isSmall ) {
|
|
45
|
+
computedSize ??= 'small';
|
|
46
|
+
}
|
|
47
|
+
|
|
41
48
|
if ( isPrimary ) {
|
|
42
49
|
computedVariant ??= 'primary';
|
|
43
50
|
}
|
|
@@ -66,6 +73,7 @@ function useDeprecatedProps( {
|
|
|
66
73
|
|
|
67
74
|
return {
|
|
68
75
|
...otherProps,
|
|
76
|
+
size: computedSize,
|
|
69
77
|
variant: computedVariant,
|
|
70
78
|
};
|
|
71
79
|
}
|
|
@@ -76,8 +84,6 @@ export function UnforwardedButton(
|
|
|
76
84
|
) {
|
|
77
85
|
const {
|
|
78
86
|
__next40pxDefaultSize,
|
|
79
|
-
__next32pxSmallSize,
|
|
80
|
-
isSmall,
|
|
81
87
|
isPressed,
|
|
82
88
|
isBusy,
|
|
83
89
|
isDestructive,
|
|
@@ -91,6 +97,7 @@ export function UnforwardedButton(
|
|
|
91
97
|
shortcut,
|
|
92
98
|
label,
|
|
93
99
|
children,
|
|
100
|
+
size = 'default',
|
|
94
101
|
text,
|
|
95
102
|
variant,
|
|
96
103
|
__experimentalIsFocusable: isFocusable,
|
|
@@ -118,10 +125,10 @@ export function UnforwardedButton(
|
|
|
118
125
|
|
|
119
126
|
const classes = classnames( 'components-button', className, {
|
|
120
127
|
'is-next-40px-default-size': __next40pxDefaultSize,
|
|
121
|
-
'is-next-32px-small-size': __next32pxSmallSize,
|
|
122
128
|
'is-secondary': variant === 'secondary',
|
|
123
129
|
'is-primary': variant === 'primary',
|
|
124
|
-
'is-small':
|
|
130
|
+
'is-small': size === 'small',
|
|
131
|
+
'is-compact': size === 'compact',
|
|
125
132
|
'is-tertiary': variant === 'tertiary',
|
|
126
133
|
'is-pressed': isPressed,
|
|
127
134
|
'is-busy': isBusy,
|
package/src/button/style.scss
CHANGED
|
@@ -257,25 +257,26 @@
|
|
|
257
257
|
/* stylelint-enable */
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
+
&.is-compact {
|
|
261
|
+
height: $button-size-compact;
|
|
262
|
+
|
|
263
|
+
&.has-icon:not(.has-text) {
|
|
264
|
+
padding: 0;
|
|
265
|
+
width: $button-size-compact;
|
|
266
|
+
min-width: $button-size-compact;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
260
270
|
&.is-small {
|
|
261
|
-
height: $button-size-small
|
|
271
|
+
height: $button-size-small;
|
|
262
272
|
line-height: 22px;
|
|
263
273
|
padding: 0 8px;
|
|
264
274
|
font-size: 11px;
|
|
265
275
|
|
|
266
276
|
&.has-icon:not(.has-text) {
|
|
267
277
|
padding: 0;
|
|
268
|
-
width: $button-size-small
|
|
269
|
-
min-width: $button-size-small
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
&:not(.is-next-32px-small-size) {
|
|
273
|
-
height: $button-size-small;
|
|
274
|
-
|
|
275
|
-
&.has-icon:not(.has-text) {
|
|
276
|
-
width: $button-size-small;
|
|
277
|
-
min-width: $button-size-small;
|
|
278
|
-
}
|
|
278
|
+
width: $button-size-small;
|
|
279
|
+
min-width: $button-size-small;
|
|
279
280
|
}
|
|
280
281
|
}
|
|
281
282
|
|
|
@@ -402,6 +402,19 @@ describe( 'Button', () => {
|
|
|
402
402
|
);
|
|
403
403
|
expect( console ).toHaveWarned();
|
|
404
404
|
} );
|
|
405
|
+
|
|
406
|
+
it( 'should not break when the legacy isSmall prop is passed', () => {
|
|
407
|
+
render( <Button isSmall /> );
|
|
408
|
+
expect( screen.getByRole( 'button' ) ).toHaveClass( 'is-small' );
|
|
409
|
+
} );
|
|
410
|
+
|
|
411
|
+
it( 'should prioritize the `size` prop over `isSmall`', () => {
|
|
412
|
+
render( <Button size="compact" isSmall /> );
|
|
413
|
+
expect( screen.getByRole( 'button' ) ).not.toHaveClass(
|
|
414
|
+
'is-small'
|
|
415
|
+
);
|
|
416
|
+
expect( screen.getByRole( 'button' ) ).toHaveClass( 'is-compact' );
|
|
417
|
+
} );
|
|
405
418
|
} );
|
|
406
419
|
|
|
407
420
|
describe( 'static typing', () => {
|
package/src/button/types.ts
CHANGED
|
@@ -25,15 +25,6 @@ type BaseButtonProps = {
|
|
|
25
25
|
* @default false
|
|
26
26
|
*/
|
|
27
27
|
__next40pxDefaultSize?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Start opting into the larger `isSmall` button size that will become the
|
|
30
|
-
* default small size in a future version.
|
|
31
|
-
*
|
|
32
|
-
* Only takes effect when the `isSmall` prop is `true`.
|
|
33
|
-
*
|
|
34
|
-
* @default false
|
|
35
|
-
*/
|
|
36
|
-
__next32pxSmallSize?: boolean;
|
|
37
28
|
/**
|
|
38
29
|
* The button's children.
|
|
39
30
|
*/
|
|
@@ -74,8 +65,13 @@ type BaseButtonProps = {
|
|
|
74
65
|
* Renders a pressed button style.
|
|
75
66
|
*/
|
|
76
67
|
isPressed?: boolean;
|
|
68
|
+
// TODO: Deprecate officially (add console warning and move to DeprecatedButtonProps).
|
|
77
69
|
/**
|
|
78
70
|
* Decreases the size of the button.
|
|
71
|
+
*
|
|
72
|
+
* Deprecated in favor of the `size` prop. If both props are defined, the `size` prop will take precedence.
|
|
73
|
+
*
|
|
74
|
+
* @deprecated Use the `'small'` value on the `size` prop instead.
|
|
79
75
|
*/
|
|
80
76
|
isSmall?: boolean;
|
|
81
77
|
/**
|
|
@@ -92,6 +88,18 @@ type BaseButtonProps = {
|
|
|
92
88
|
* If provided, renders a Tooltip component for the button.
|
|
93
89
|
*/
|
|
94
90
|
showTooltip?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* The size of the button.
|
|
93
|
+
*
|
|
94
|
+
* - `'default'`: For normal text-label buttons, unless it is a toggle button.
|
|
95
|
+
* - `'compact'`: For toggle buttons, icon buttons, and buttons when used in context of either.
|
|
96
|
+
* - `'small'`: For icon buttons associated with more advanced or auxiliary features.
|
|
97
|
+
*
|
|
98
|
+
* If the deprecated `isSmall` prop is also defined, this prop will take precedence.
|
|
99
|
+
*
|
|
100
|
+
* @default 'default'
|
|
101
|
+
*/
|
|
102
|
+
size?: 'default' | 'compact' | 'small';
|
|
95
103
|
/**
|
|
96
104
|
* If provided, displays the given text inside the button. If the button contains children elements, the text is displayed before them.
|
|
97
105
|
*/
|
|
@@ -7,7 +7,7 @@ import type { ForwardedRef, KeyboardEvent } from 'react';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { __ } from '@wordpress/i18n';
|
|
10
|
-
import { useCallback, useEffect, useState } from '@wordpress/element';
|
|
10
|
+
import { useCallback, useEffect, useRef, useState } from '@wordpress/element';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
@@ -42,6 +42,8 @@ function ConfirmDialog(
|
|
|
42
42
|
|
|
43
43
|
const cx = useCx();
|
|
44
44
|
const wrapperClassName = cx( styles.wrapper );
|
|
45
|
+
const cancelButtonRef = useRef();
|
|
46
|
+
const confirmButtonRef = useRef();
|
|
45
47
|
|
|
46
48
|
const [ isOpen, setIsOpen ] = useState< boolean >();
|
|
47
49
|
const [ shouldSelfClose, setShouldSelfClose ] = useState< boolean >();
|
|
@@ -69,7 +71,13 @@ function ConfirmDialog(
|
|
|
69
71
|
|
|
70
72
|
const handleEnter = useCallback(
|
|
71
73
|
( event: KeyboardEvent< HTMLDivElement > ) => {
|
|
72
|
-
|
|
74
|
+
// Avoid triggering the 'confirm' action when a button is focused,
|
|
75
|
+
// as this can cause a double submission.
|
|
76
|
+
const isConfirmOrCancelButton =
|
|
77
|
+
event.target === cancelButtonRef.current ||
|
|
78
|
+
event.target === confirmButtonRef.current;
|
|
79
|
+
|
|
80
|
+
if ( ! isConfirmOrCancelButton && event.key === 'Enter' ) {
|
|
73
81
|
handleEvent( onConfirm )( event );
|
|
74
82
|
}
|
|
75
83
|
},
|
|
@@ -96,12 +104,14 @@ function ConfirmDialog(
|
|
|
96
104
|
<Text>{ children }</Text>
|
|
97
105
|
<Flex direction="row" justify="flex-end">
|
|
98
106
|
<Button
|
|
107
|
+
ref={ cancelButtonRef }
|
|
99
108
|
variant="tertiary"
|
|
100
109
|
onClick={ handleEvent( onCancel ) }
|
|
101
110
|
>
|
|
102
111
|
{ cancelLabel }
|
|
103
112
|
</Button>
|
|
104
113
|
<Button
|
|
114
|
+
ref={ confirmButtonRef }
|
|
105
115
|
variant="primary"
|
|
106
116
|
onClick={ handleEvent( onConfirm ) }
|
|
107
117
|
>
|
|
@@ -7,7 +7,6 @@ import { useState } from '@wordpress/element';
|
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import Button from '../../button';
|
|
10
|
-
import { Heading } from '../../heading';
|
|
11
10
|
import { ConfirmDialog } from '..';
|
|
12
11
|
|
|
13
12
|
const meta = {
|
|
@@ -26,12 +25,8 @@ const meta = {
|
|
|
26
25
|
isOpen: {
|
|
27
26
|
control: { type: null },
|
|
28
27
|
},
|
|
29
|
-
onConfirm: {
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
onCancel: {
|
|
33
|
-
control: { type: null },
|
|
34
|
-
},
|
|
28
|
+
onConfirm: { action: 'onConfirm' },
|
|
29
|
+
onCancel: { action: 'onCancel' },
|
|
35
30
|
},
|
|
36
31
|
args: {
|
|
37
32
|
children: 'Would you like to privately publish the post now?',
|
|
@@ -43,19 +38,19 @@ const meta = {
|
|
|
43
38
|
|
|
44
39
|
export default meta;
|
|
45
40
|
|
|
46
|
-
const Template = ( args ) => {
|
|
41
|
+
const Template = ( { onConfirm, onCancel, ...args } ) => {
|
|
47
42
|
const [ isOpen, setIsOpen ] = useState( false );
|
|
48
|
-
const [ confirmVal, setConfirmVal ] = useState( '' );
|
|
49
43
|
|
|
50
|
-
const handleConfirm = () => {
|
|
51
|
-
|
|
44
|
+
const handleConfirm = ( ...confirmArgs ) => {
|
|
45
|
+
onConfirm( ...confirmArgs );
|
|
52
46
|
setIsOpen( false );
|
|
53
47
|
};
|
|
54
48
|
|
|
55
|
-
const handleCancel = () => {
|
|
56
|
-
|
|
49
|
+
const handleCancel = ( ...cancelArgs ) => {
|
|
50
|
+
onCancel( ...cancelArgs );
|
|
57
51
|
setIsOpen( false );
|
|
58
52
|
};
|
|
53
|
+
|
|
59
54
|
return (
|
|
60
55
|
<>
|
|
61
56
|
<Button variant="primary" onClick={ () => setIsOpen( true ) }>
|
|
@@ -70,8 +65,6 @@ const Template = ( args ) => {
|
|
|
70
65
|
>
|
|
71
66
|
{ args.children }
|
|
72
67
|
</ConfirmDialog>
|
|
73
|
-
|
|
74
|
-
<Heading level={ 1 }>{ confirmVal }</Heading>
|
|
75
68
|
</>
|
|
76
69
|
);
|
|
77
70
|
};
|
|
@@ -194,6 +194,48 @@ describe( 'Confirm', () => {
|
|
|
194
194
|
expect( confirmDialog ).not.toBeInTheDocument();
|
|
195
195
|
expect( onConfirm ).toHaveBeenCalled();
|
|
196
196
|
} );
|
|
197
|
+
|
|
198
|
+
it( 'calls only the `onCancel` callback and not the `onConfirm` callback when the cancel button is submitted using the keyboard', async () => {
|
|
199
|
+
const user = userEvent.setup();
|
|
200
|
+
|
|
201
|
+
const onConfirm = jest.fn().mockName( 'onConfirm()' );
|
|
202
|
+
const onCancel = jest.fn().mockName( 'onCancel()' );
|
|
203
|
+
|
|
204
|
+
render(
|
|
205
|
+
<ConfirmDialog
|
|
206
|
+
onConfirm={ onConfirm }
|
|
207
|
+
onCancel={ onCancel }
|
|
208
|
+
>
|
|
209
|
+
Are you sure?
|
|
210
|
+
</ConfirmDialog>
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
await user.keyboard( '[Tab][Enter]' );
|
|
214
|
+
|
|
215
|
+
expect( onConfirm ).not.toHaveBeenCalled();
|
|
216
|
+
expect( onCancel ).toHaveBeenCalledTimes( 1 );
|
|
217
|
+
} );
|
|
218
|
+
|
|
219
|
+
it( 'calls only the `onConfirm` callback when the confirm button is submitted using the keyboard', async () => {
|
|
220
|
+
const user = userEvent.setup();
|
|
221
|
+
|
|
222
|
+
const onConfirm = jest.fn().mockName( 'onConfirm()' );
|
|
223
|
+
const onCancel = jest.fn().mockName( 'onCancel()' );
|
|
224
|
+
|
|
225
|
+
render(
|
|
226
|
+
<ConfirmDialog
|
|
227
|
+
onConfirm={ onConfirm }
|
|
228
|
+
onCancel={ onCancel }
|
|
229
|
+
>
|
|
230
|
+
Are you sure?
|
|
231
|
+
</ConfirmDialog>
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
await user.keyboard( '[Tab][Tab][Enter]' );
|
|
235
|
+
|
|
236
|
+
expect( onConfirm ).toHaveBeenCalledTimes( 1 );
|
|
237
|
+
expect( onCancel ).not.toHaveBeenCalled();
|
|
238
|
+
} );
|
|
197
239
|
} );
|
|
198
240
|
} );
|
|
199
241
|
|
|
@@ -14,6 +14,7 @@ import { useState, useMemo, forwardRef } from '@wordpress/element';
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
|
+
import { Button } from '../button';
|
|
17
18
|
import RangeControl from '../range-control';
|
|
18
19
|
import { Flex, FlexItem } from '../flex';
|
|
19
20
|
import {
|
|
@@ -31,7 +32,6 @@ import {
|
|
|
31
32
|
HeaderLabel,
|
|
32
33
|
HeaderToggle,
|
|
33
34
|
Controls,
|
|
34
|
-
ResetButton,
|
|
35
35
|
} from './styles';
|
|
36
36
|
import { Spacer } from '../spacer';
|
|
37
37
|
import FontSizePickerSelect from './font-size-picker-select';
|
|
@@ -268,17 +268,21 @@ const UnforwardedFontSizePicker = (
|
|
|
268
268
|
) }
|
|
269
269
|
{ withReset && (
|
|
270
270
|
<FlexItem>
|
|
271
|
-
<
|
|
271
|
+
<Button
|
|
272
272
|
disabled={ value === undefined }
|
|
273
273
|
onClick={ () => {
|
|
274
274
|
onChange?.( undefined );
|
|
275
275
|
} }
|
|
276
|
-
isSmall
|
|
277
276
|
variant="secondary"
|
|
278
|
-
|
|
277
|
+
__next40pxDefaultSize
|
|
278
|
+
size={
|
|
279
|
+
size !== '__unstable-large'
|
|
280
|
+
? 'small'
|
|
281
|
+
: 'default'
|
|
282
|
+
}
|
|
279
283
|
>
|
|
280
284
|
{ __( 'Reset' ) }
|
|
281
|
-
</
|
|
285
|
+
</Button>
|
|
282
286
|
</FlexItem>
|
|
283
287
|
) }
|
|
284
288
|
</Flex>
|
|
@@ -11,7 +11,6 @@ import Button from '../button';
|
|
|
11
11
|
import { HStack } from '../h-stack';
|
|
12
12
|
import { space } from '../ui/utils/space';
|
|
13
13
|
import { COLORS } from '../utils';
|
|
14
|
-
import type { FontSizePickerProps } from './types';
|
|
15
14
|
|
|
16
15
|
export const Container = styled.fieldset`
|
|
17
16
|
border: 0;
|
|
@@ -44,12 +43,3 @@ export const Controls = styled.div< {
|
|
|
44
43
|
${ ( props ) =>
|
|
45
44
|
! props.__nextHasNoMarginBottom && `margin-bottom: ${ space( 6 ) };` }
|
|
46
45
|
`;
|
|
47
|
-
|
|
48
|
-
export const ResetButton = styled( Button )< {
|
|
49
|
-
size: FontSizePickerProps[ 'size' ];
|
|
50
|
-
} >`
|
|
51
|
-
&&& {
|
|
52
|
-
height: ${ ( props ) =>
|
|
53
|
-
props.size === '__unstable-large' ? '40px' : '30px' };
|
|
54
|
-
}
|
|
55
|
-
`;
|