@wordpress/components 21.1.0 → 21.2.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 +31 -0
- package/build/border-box-control/utils.js +42 -2
- package/build/border-box-control/utils.js.map +1 -1
- package/build/combobox-control/index.js +0 -1
- package/build/combobox-control/index.js.map +1 -1
- package/build/custom-select-control/index.js +4 -2
- package/build/custom-select-control/index.js.map +1 -1
- package/build/draggable/index.js +3 -6
- package/build/draggable/index.js.map +1 -1
- package/build/font-size-picker/index.js +46 -55
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/styles.js +73 -0
- package/build/font-size-picker/styles.js.map +1 -0
- package/build/font-size-picker/types.js +6 -0
- package/build/font-size-picker/types.js.map +1 -0
- package/build/font-size-picker/utils.js +17 -15
- package/build/font-size-picker/utils.js.map +1 -1
- package/build/form-token-field/token-input.js +20 -1
- package/build/form-token-field/token-input.js.map +1 -1
- package/build/index.js +12 -0
- package/build/index.js.map +1 -1
- package/build/menu-item/index.js +4 -3
- package/build/menu-item/index.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +10 -3
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +12 -3
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build/mobile/bottom-sheet/sub-sheet/index.native.js +4 -1
- package/build/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
- package/build/mobile/color-settings/index.native.js +3 -1
- package/build/mobile/color-settings/index.native.js.map +1 -1
- package/build/mobile/color-settings/picker-screen.native.js +3 -1
- package/build/mobile/color-settings/picker-screen.native.js.map +1 -1
- package/build/mobile/image/index.native.js +3 -1
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/keyboard-avoiding-view/index.ios.js +3 -1
- package/build/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
- package/build/mobile/link-picker/index.native.js +3 -1
- package/build/mobile/link-picker/index.native.js.map +1 -1
- package/build/mobile/link-picker/link-picker-results.native.js +3 -1
- package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build/mobile/link-picker/link-picker-screen.native.js +3 -1
- package/build/mobile/link-picker/link-picker-screen.native.js.map +1 -1
- package/build/mobile/link-settings/index.native.js +24 -6
- package/build/mobile/link-settings/index.native.js.map +1 -1
- package/build/mobile/link-settings/link-settings-screen.native.js +3 -1
- package/build/mobile/link-settings/link-settings-screen.native.js.map +1 -1
- package/build/mobile/segmented-control/index.native.js +6 -2
- package/build/mobile/segmented-control/index.native.js.map +1 -1
- package/build/mobile/utils/use-unit-converter-to-mobile.native.js +6 -2
- package/build/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +8 -1
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/notice/index.native.js +15 -19
- package/build/notice/index.native.js.map +1 -1
- package/build/notice/list.native.js +2 -3
- package/build/notice/list.native.js.map +1 -1
- package/build/palette-edit/index.js +1 -1
- package/build/palette-edit/index.js.map +1 -1
- package/build/popover/index.js +29 -32
- package/build/popover/index.js.map +1 -1
- package/build/popover/limit-shift.js +145 -0
- package/build/popover/limit-shift.js.map +1 -0
- package/build/popover/utils.js +55 -15
- package/build/popover/utils.js.map +1 -1
- package/build/resizable-box/resize-tooltip/utils.js +12 -14
- package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build/sandbox/index.js +13 -8
- package/build/sandbox/index.js.map +1 -1
- package/build/sandbox/index.native.js +3 -1
- package/build/sandbox/index.native.js.map +1 -1
- package/build/search-control/index.native.js +6 -2
- package/build/search-control/index.native.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-context.js +8 -2
- package/build/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +31 -41
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/use-slot-fills.js +39 -0
- package/build/slot-fill/bubbles-virtually/use-slot-fills.js.map +1 -0
- package/build/slot-fill/bubbles-virtually/use-slot.js +13 -4
- package/build/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
- package/build/slot-fill/index.js +8 -0
- package/build/slot-fill/index.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js +8 -8
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build/tools-panel/styles.js +27 -12
- package/build/tools-panel/styles.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js +19 -6
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/tools-panel/tools-panel-header/hook.js +4 -0
- package/build/tools-panel/tools-panel-header/hook.js.map +1 -1
- package/build-module/border-box-control/utils.js +36 -1
- package/build-module/border-box-control/utils.js.map +1 -1
- package/build-module/combobox-control/index.js +0 -1
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/custom-select-control/index.js +2 -1
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/draggable/index.js +2 -5
- package/build-module/draggable/index.js.map +1 -1
- package/build-module/font-size-picker/index.js +45 -53
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/styles.js +62 -0
- package/build-module/font-size-picker/styles.js.map +1 -0
- package/build-module/font-size-picker/types.js +2 -0
- package/build-module/font-size-picker/types.js.map +1 -0
- package/build-module/font-size-picker/utils.js +21 -15
- package/build-module/font-size-picker/utils.js.map +1 -1
- package/build-module/form-token-field/token-input.js +21 -2
- package/build-module/form-token-field/token-input.js.map +1 -1
- package/build-module/index.js +2 -2
- package/build-module/index.js.map +1 -1
- package/build-module/menu-item/index.js +4 -3
- package/build-module/menu-item/index.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +10 -3
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +12 -3
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js +4 -1
- package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
- package/build-module/mobile/color-settings/index.native.js +3 -1
- package/build-module/mobile/color-settings/index.native.js.map +1 -1
- package/build-module/mobile/color-settings/picker-screen.native.js +3 -1
- package/build-module/mobile/color-settings/picker-screen.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +3 -1
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/keyboard-avoiding-view/index.ios.js +3 -1
- package/build-module/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
- package/build-module/mobile/link-picker/index.native.js +3 -1
- package/build-module/mobile/link-picker/index.native.js.map +1 -1
- package/build-module/mobile/link-picker/link-picker-results.native.js +3 -1
- package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build-module/mobile/link-picker/link-picker-screen.native.js +3 -1
- package/build-module/mobile/link-picker/link-picker-screen.native.js.map +1 -1
- package/build-module/mobile/link-settings/index.native.js +24 -6
- package/build-module/mobile/link-settings/index.native.js.map +1 -1
- package/build-module/mobile/link-settings/link-settings-screen.native.js +3 -1
- package/build-module/mobile/link-settings/link-settings-screen.native.js.map +1 -1
- package/build-module/mobile/segmented-control/index.native.js +6 -2
- package/build-module/mobile/segmented-control/index.native.js.map +1 -1
- package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js +6 -2
- package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +8 -1
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/notice/index.native.js +16 -21
- package/build-module/notice/index.native.js.map +1 -1
- package/build-module/notice/list.native.js +3 -3
- package/build-module/notice/list.native.js.map +1 -1
- package/build-module/palette-edit/index.js +1 -1
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/popover/index.js +31 -35
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/limit-shift.js +136 -0
- package/build-module/popover/limit-shift.js.map +1 -0
- package/build-module/popover/utils.js +55 -15
- package/build-module/popover/utils.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/utils.js +13 -15
- package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build-module/sandbox/index.js +13 -8
- package/build-module/sandbox/index.js.map +1 -1
- package/build-module/sandbox/index.native.js +3 -1
- package/build-module/sandbox/index.native.js.map +1 -1
- package/build-module/search-control/index.native.js +6 -2
- package/build-module/search-control/index.native.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js +7 -2
- package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +30 -42
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/use-slot-fills.js +27 -0
- package/build-module/slot-fill/bubbles-virtually/use-slot-fills.js.map +1 -0
- package/build-module/slot-fill/bubbles-virtually/use-slot.js +13 -5
- package/build-module/slot-fill/bubbles-virtually/use-slot.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/toggle-group-control/toggle-group-control-option-base/styles.js +7 -7
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build-module/tools-panel/styles.js +23 -12
- package/build-module/tools-panel/styles.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +19 -7
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/hook.js +4 -0
- package/build-module/tools-panel/tools-panel-header/hook.js.map +1 -1
- package/build-style/style-rtl.css +14 -100
- package/build-style/style.css +14 -100
- package/build-types/border-box-control/utils.d.ts +1 -3
- package/build-types/border-box-control/utils.d.ts.map +1 -1
- package/build-types/custom-select-control/index.d.ts +13 -0
- package/build-types/custom-select-control/index.d.ts.map +1 -0
- package/build-types/custom-select-control/styles.d.ts +9 -0
- package/build-types/custom-select-control/styles.d.ts.map +1 -0
- package/build-types/draggable/index.d.ts.map +1 -1
- package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
- package/build-types/focal-point-picker/styles/focal-point-style.d.ts +3 -3
- package/build-types/font-size-picker/index.d.ts +5 -0
- package/build-types/font-size-picker/index.d.ts.map +1 -0
- package/build-types/font-size-picker/stories/e2e/index.d.ts +16 -0
- package/build-types/font-size-picker/stories/e2e/index.d.ts.map +1 -0
- package/build-types/font-size-picker/stories/index.d.ts +31 -0
- package/build-types/font-size-picker/stories/index.d.ts.map +1 -0
- package/build-types/font-size-picker/styles.d.ts +27 -0
- package/build-types/font-size-picker/styles.d.ts.map +1 -0
- package/build-types/font-size-picker/test/index.d.ts +2 -0
- package/build-types/font-size-picker/test/index.d.ts.map +1 -0
- package/build-types/font-size-picker/test/utils.d.ts +2 -0
- package/build-types/font-size-picker/test/utils.d.ts.map +1 -0
- package/build-types/font-size-picker/types.d.ts +93 -0
- package/build-types/font-size-picker/types.d.ts.map +1 -0
- package/build-types/font-size-picker/utils.d.ts +41 -0
- package/build-types/font-size-picker/utils.d.ts.map +1 -0
- package/build-types/form-token-field/token-input.d.ts.map +1 -1
- package/build-types/menu-item/index.d.ts.map +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/limit-shift.d.ts +87 -0
- package/build-types/popover/limit-shift.d.ts.map +1 -0
- package/build-types/popover/test/index.d.ts +2 -0
- package/build-types/popover/test/index.d.ts.map +1 -0
- package/build-types/popover/types.d.ts +1 -1
- package/build-types/popover/types.d.ts.map +1 -1
- package/build-types/popover/utils.d.ts.map +1 -1
- package/build-types/range-control/types.d.ts +0 -32
- package/build-types/range-control/types.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts +2 -2
- package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/use-slot-fills.d.ts +2 -0
- package/build-types/slot-fill/bubbles-virtually/use-slot-fills.d.ts.map +1 -0
- package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts.map +1 -1
- package/build-types/slot-fill/index.d.ts +1 -0
- package/build-types/slot-fill/index.d.ts.map +1 -1
- package/build-types/spinner/index.d.ts +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
- package/build-types/tools-panel/styles.d.ts +6 -0
- package/build-types/tools-panel/styles.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +1 -0
- package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
- package/build-types/tools-panel/types.d.ts +1 -0
- package/build-types/tools-panel/types.d.ts.map +1 -1
- package/package.json +19 -18
- package/src/alignment-matrix-control/test/index.js +17 -62
- package/src/border-box-control/test/utils.js +48 -0
- package/src/border-box-control/utils.ts +44 -1
- package/src/combobox-control/index.js +0 -5
- package/src/custom-select-control/index.js +2 -1
- package/src/draggable/index.js +2 -5
- package/src/font-size-picker/{index.js → index.tsx} +113 -79
- package/src/font-size-picker/stories/e2e/{index.js → index.tsx} +13 -4
- package/src/font-size-picker/stories/{index.js → index.tsx} +42 -36
- package/src/font-size-picker/styles.ts +44 -0
- package/src/font-size-picker/test/{index.js → index.tsx} +1 -1
- package/src/font-size-picker/test/{utils.js → utils.ts} +6 -2
- package/src/font-size-picker/types.ts +98 -0
- package/src/font-size-picker/{utils.js → utils.ts} +51 -27
- package/src/form-token-field/test/index.tsx +22 -1
- package/src/form-token-field/token-input.tsx +25 -3
- package/src/index.js +2 -1
- package/src/menu-item/README.md +7 -0
- package/src/menu-item/index.js +11 -5
- package/src/menu-item/style.scss +1 -0
- package/src/menu-item/test/index.js +36 -0
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +9 -0
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +11 -0
- package/src/mobile/bottom-sheet/sub-sheet/index.native.js +3 -0
- package/src/mobile/color-settings/index.native.js +3 -0
- package/src/mobile/color-settings/picker-screen.native.js +3 -0
- package/src/mobile/image/index.native.js +3 -0
- package/src/mobile/keyboard-avoiding-view/index.ios.js +3 -0
- package/src/mobile/link-picker/index.native.js +3 -0
- package/src/mobile/link-picker/link-picker-results.native.js +3 -0
- package/src/mobile/link-picker/link-picker-screen.native.js +3 -0
- package/src/mobile/link-settings/index.native.js +18 -0
- package/src/mobile/link-settings/link-settings-screen.native.js +3 -0
- package/src/mobile/segmented-control/index.native.js +6 -0
- package/src/mobile/utils/use-unit-converter-to-mobile.native.js +6 -0
- package/src/navigator/navigator-screen/component.tsx +8 -1
- package/src/navigator/test/index.js +119 -54
- package/src/notice/index.native.js +17 -20
- package/src/notice/list.native.js +7 -3
- package/src/palette-edit/index.js +1 -1
- package/src/placeholder/style.scss +3 -3
- package/src/popover/index.tsx +26 -42
- package/src/popover/limit-shift.ts +205 -0
- package/src/popover/test/index.tsx +230 -0
- package/src/popover/types.ts +1 -0
- package/src/popover/utils.ts +58 -16
- package/src/range-control/types.ts +0 -33
- package/src/resizable-box/resize-tooltip/utils.ts +13 -13
- package/src/sandbox/index.js +13 -7
- package/src/sandbox/index.native.js +3 -0
- package/src/search-control/index.native.js +6 -0
- package/src/slot-fill/bubbles-virtually/slot-fill-context.js +6 -2
- package/src/slot-fill/bubbles-virtually/slot-fill-provider.js +51 -58
- package/src/slot-fill/bubbles-virtually/use-slot-fills.js +24 -0
- package/src/slot-fill/bubbles-virtually/use-slot.js +11 -6
- package/src/slot-fill/index.js +1 -0
- package/src/style.scss +0 -1
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +1 -0
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +9 -7
- package/src/tools-panel/stories/index.js +27 -0
- package/src/tools-panel/styles.ts +28 -1
- package/src/tools-panel/tools-panel-header/component.tsx +12 -5
- package/src/tools-panel/tools-panel-header/hook.ts +5 -0
- package/src/tools-panel/types.ts +1 -0
- package/tsconfig.json +0 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/src/font-size-picker/style.scss +0 -78
- package/src/popover/test/__snapshots__/index.js.snap +0 -34
- package/src/popover/test/index.js +0 -164
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
export type FontSizePickerProps = {
|
|
7
|
+
/**
|
|
8
|
+
* If `true`, it will not be possible to choose a custom fontSize. The user
|
|
9
|
+
* will be forced to pick one of the pre-defined sizes passed in fontSizes.
|
|
10
|
+
*
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
disableCustomFontSizes?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* If no value exists, this prop defines the starting position for the font
|
|
16
|
+
* size picker slider. Only relevant if `withSlider` is `true`.
|
|
17
|
+
*/
|
|
18
|
+
fallbackFontSize?: number;
|
|
19
|
+
/**
|
|
20
|
+
* An array of font size objects. The object should contain properties size,
|
|
21
|
+
* name, and slug.
|
|
22
|
+
*/
|
|
23
|
+
fontSizes?: FontSize[];
|
|
24
|
+
/**
|
|
25
|
+
* A function that receives the new font size value.
|
|
26
|
+
* If onChange is called without any parameter, it should reset the value,
|
|
27
|
+
* attending to what reset means in that context, e.g., set the font size to
|
|
28
|
+
* undefined or set the font size a starting value.
|
|
29
|
+
*/
|
|
30
|
+
onChange?: ( value: number | string | undefined ) => void;
|
|
31
|
+
/**
|
|
32
|
+
* The current font size value.
|
|
33
|
+
*/
|
|
34
|
+
value?: number | string;
|
|
35
|
+
/**
|
|
36
|
+
* If `true`, the UI will contain a slider, instead of a numeric text input
|
|
37
|
+
* field. If `false`, no slider will be present.
|
|
38
|
+
*
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
withSlider?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* If `true`, a reset button will be displayed alongside the input field
|
|
44
|
+
* when a custom font size is active. Has no effect when
|
|
45
|
+
* `disableCustomFontSizes` or `withSlider` is `true`.
|
|
46
|
+
*
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
withReset?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Start opting into the new margin-free styles that will become the default
|
|
52
|
+
* in a future version, currently scheduled to be WordPress 6.4. (The prop
|
|
53
|
+
* can be safely removed once this happens.)
|
|
54
|
+
*
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
__nextHasNoMarginBottom?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Size of the control.
|
|
60
|
+
*
|
|
61
|
+
* @default default
|
|
62
|
+
*/
|
|
63
|
+
size?: 'default' | '__unstable-large';
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type FontSize = {
|
|
67
|
+
/**
|
|
68
|
+
* The property `size` contains a number with the font size value, in `px` or
|
|
69
|
+
* a string specifying the font size CSS property that should be used eg:
|
|
70
|
+
* "13px", "1em", or "clamp(12px, 5vw, 100px)".
|
|
71
|
+
*/
|
|
72
|
+
size: number | string;
|
|
73
|
+
/**
|
|
74
|
+
* The `name` property includes a label for that font size e.g.: `Small`.
|
|
75
|
+
*/
|
|
76
|
+
name?: string;
|
|
77
|
+
/**
|
|
78
|
+
* The `slug` property is a string with a unique identifier for the font
|
|
79
|
+
* size. Used for the class generation process.
|
|
80
|
+
*/
|
|
81
|
+
slug: string;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export type FontSizeOption = Omit< FontSize, 'size' > &
|
|
85
|
+
Partial< Pick< FontSize, 'size' > >;
|
|
86
|
+
|
|
87
|
+
export type FontSizeSelectOption = Pick< FontSizeOption, 'size' > & {
|
|
88
|
+
key: string;
|
|
89
|
+
name?: string;
|
|
90
|
+
__experimentalHint: ReactNode;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export type FontSizeToggleGroupOption = {
|
|
94
|
+
key: string;
|
|
95
|
+
value: number | string;
|
|
96
|
+
label: string;
|
|
97
|
+
name: string;
|
|
98
|
+
};
|
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import type {
|
|
10
|
+
FontSize,
|
|
11
|
+
FontSizeOption,
|
|
12
|
+
FontSizeSelectOption,
|
|
13
|
+
FontSizeToggleGroupOption,
|
|
14
|
+
FontSizePickerProps,
|
|
15
|
+
} from './types';
|
|
16
|
+
|
|
6
17
|
const DEFAULT_FONT_SIZE = 'default';
|
|
7
18
|
const DEFAULT_FONT_SIZE_OPTION = {
|
|
8
19
|
slug: DEFAULT_FONT_SIZE,
|
|
@@ -36,13 +47,18 @@ const FONT_SIZES_ALIASES = [
|
|
|
36
47
|
* Helper util to split a font size to its numeric value
|
|
37
48
|
* and its `unit`, if exists.
|
|
38
49
|
*
|
|
39
|
-
* @param
|
|
40
|
-
* @return
|
|
50
|
+
* @param size Font size.
|
|
51
|
+
* @return An array with the numeric value and the unit if exists.
|
|
41
52
|
*/
|
|
42
|
-
export function splitValueAndUnitFromSize(
|
|
43
|
-
|
|
53
|
+
export function splitValueAndUnitFromSize(
|
|
54
|
+
size: NonNullable< FontSizePickerProps[ 'value' ] >
|
|
55
|
+
) {
|
|
56
|
+
const [ numericValue, unit ] = `${ size }`.match( /[\d\.]+|\D+/g ) ?? [];
|
|
44
57
|
|
|
45
|
-
if (
|
|
58
|
+
if (
|
|
59
|
+
! isNaN( parseFloat( numericValue ) ) &&
|
|
60
|
+
isFinite( Number( numericValue ) )
|
|
61
|
+
) {
|
|
46
62
|
return [ numericValue, unit ];
|
|
47
63
|
}
|
|
48
64
|
|
|
@@ -53,28 +69,30 @@ export function splitValueAndUnitFromSize( size ) {
|
|
|
53
69
|
* Some themes use css vars for their font sizes, so until we
|
|
54
70
|
* have the way of calculating them don't display them.
|
|
55
71
|
*
|
|
56
|
-
* @param
|
|
57
|
-
* @return
|
|
72
|
+
* @param value The value that is checked.
|
|
73
|
+
* @return Whether the value is a simple css value.
|
|
58
74
|
*/
|
|
59
|
-
export function isSimpleCssValue(
|
|
75
|
+
export function isSimpleCssValue(
|
|
76
|
+
value: NonNullable< FontSizePickerProps[ 'value' ] >
|
|
77
|
+
) {
|
|
60
78
|
const sizeRegex = /^[\d\.]+(px|em|rem|vw|vh|%)?$/i;
|
|
61
|
-
return sizeRegex.test( value );
|
|
79
|
+
return sizeRegex.test( String( value ) );
|
|
62
80
|
}
|
|
63
81
|
|
|
64
82
|
/**
|
|
65
83
|
* Return font size options in the proper format depending
|
|
66
84
|
* on the currently used control (select, toggle group).
|
|
67
85
|
*
|
|
68
|
-
* @param
|
|
69
|
-
* @param
|
|
70
|
-
* @param
|
|
71
|
-
* @return
|
|
86
|
+
* @param useSelectControl Whether to use a select control.
|
|
87
|
+
* @param optionsArray Array of available font sizes objects.
|
|
88
|
+
* @param disableCustomFontSizes Flag that indicates if custom font sizes are disabled.
|
|
89
|
+
* @return Array of font sizes in proper format for the used control.
|
|
72
90
|
*/
|
|
73
91
|
export function getFontSizeOptions(
|
|
74
|
-
useSelectControl,
|
|
75
|
-
optionsArray,
|
|
76
|
-
disableCustomFontSizes
|
|
77
|
-
) {
|
|
92
|
+
useSelectControl: boolean,
|
|
93
|
+
optionsArray: FontSize[],
|
|
94
|
+
disableCustomFontSizes: boolean
|
|
95
|
+
): FontSizeSelectOption[] | FontSizeToggleGroupOption[] | null {
|
|
78
96
|
if ( disableCustomFontSizes && ! optionsArray.length ) {
|
|
79
97
|
return null;
|
|
80
98
|
}
|
|
@@ -83,8 +101,11 @@ export function getFontSizeOptions(
|
|
|
83
101
|
: getToggleGroupOptions( optionsArray );
|
|
84
102
|
}
|
|
85
103
|
|
|
86
|
-
function getSelectOptions(
|
|
87
|
-
|
|
104
|
+
function getSelectOptions(
|
|
105
|
+
optionsArray: FontSize[],
|
|
106
|
+
disableCustomFontSizes: boolean
|
|
107
|
+
): FontSizeSelectOption[] {
|
|
108
|
+
const options: FontSizeOption[] = [
|
|
88
109
|
DEFAULT_FONT_SIZE_OPTION,
|
|
89
110
|
...optionsArray,
|
|
90
111
|
...( disableCustomFontSizes ? [] : [ CUSTOM_FONT_SIZE_OPTION ] ),
|
|
@@ -94,21 +115,21 @@ function getSelectOptions( optionsArray, disableCustomFontSizes ) {
|
|
|
94
115
|
name,
|
|
95
116
|
size,
|
|
96
117
|
__experimentalHint:
|
|
97
|
-
size && isSimpleCssValue( size ) && parseFloat( size ),
|
|
118
|
+
size && isSimpleCssValue( size ) && parseFloat( String( size ) ),
|
|
98
119
|
} ) );
|
|
99
120
|
}
|
|
100
121
|
|
|
101
122
|
/**
|
|
102
123
|
* Build options for the toggle group options.
|
|
103
124
|
*
|
|
104
|
-
* @param
|
|
105
|
-
* @param
|
|
106
|
-
* @return
|
|
125
|
+
* @param optionsArray An array of font size options.
|
|
126
|
+
* @param labelAliases An array of alternative labels.
|
|
127
|
+
* @return Remapped optionsArray.
|
|
107
128
|
*/
|
|
108
129
|
export function getToggleGroupOptions(
|
|
109
|
-
optionsArray,
|
|
110
|
-
labelAliases = FONT_SIZES_ALIASES
|
|
111
|
-
) {
|
|
130
|
+
optionsArray: FontSize[],
|
|
131
|
+
labelAliases: string[] = FONT_SIZES_ALIASES
|
|
132
|
+
): FontSizeToggleGroupOption[] {
|
|
112
133
|
return optionsArray.map( ( { slug, size, name }, index ) => {
|
|
113
134
|
return {
|
|
114
135
|
key: slug,
|
|
@@ -119,7 +140,10 @@ export function getToggleGroupOptions(
|
|
|
119
140
|
} );
|
|
120
141
|
}
|
|
121
142
|
|
|
122
|
-
export function getSelectedOption(
|
|
143
|
+
export function getSelectedOption(
|
|
144
|
+
fontSizes: FontSize[],
|
|
145
|
+
value: FontSizePickerProps[ 'value' ]
|
|
146
|
+
): FontSizeOption {
|
|
123
147
|
if ( ! value ) {
|
|
124
148
|
return DEFAULT_FONT_SIZE_OPTION;
|
|
125
149
|
}
|
|
@@ -2057,7 +2057,12 @@ describe( 'FormTokenField', () => {
|
|
|
2057
2057
|
|
|
2058
2058
|
const suggestions = [ 'Pine', 'Pistachio', 'Sage' ];
|
|
2059
2059
|
|
|
2060
|
-
render(
|
|
2060
|
+
render(
|
|
2061
|
+
<>
|
|
2062
|
+
<FormTokenFieldWithState suggestions={ suggestions } />
|
|
2063
|
+
<button>Click me</button>
|
|
2064
|
+
</>
|
|
2065
|
+
);
|
|
2061
2066
|
|
|
2062
2067
|
// No suggestions visible
|
|
2063
2068
|
const input = screen.getByRole( 'combobox' );
|
|
@@ -2093,6 +2098,22 @@ describe( 'FormTokenField', () => {
|
|
|
2093
2098
|
pineSuggestion.id
|
|
2094
2099
|
);
|
|
2095
2100
|
|
|
2101
|
+
// Blur the input and make sure that the `aria-activedescendant`
|
|
2102
|
+
// is removed
|
|
2103
|
+
const button = screen.getByRole( 'button', { name: 'Click me' } );
|
|
2104
|
+
|
|
2105
|
+
await user.click( button );
|
|
2106
|
+
|
|
2107
|
+
expect( input ).not.toHaveAttribute( 'aria-activedescendant' );
|
|
2108
|
+
|
|
2109
|
+
// Focus the input again, `aria-activedescendant` should be added back.
|
|
2110
|
+
await user.click( input );
|
|
2111
|
+
|
|
2112
|
+
expect( input ).toHaveAttribute(
|
|
2113
|
+
'aria-activedescendant',
|
|
2114
|
+
pineSuggestion.id
|
|
2115
|
+
);
|
|
2116
|
+
|
|
2096
2117
|
// Add the suggestion, which hides the list
|
|
2097
2118
|
await user.keyboard( '[Enter]' );
|
|
2098
2119
|
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import type { ChangeEvent, ForwardedRef } from 'react';
|
|
5
|
+
import type { ChangeEvent, ForwardedRef, FocusEventHandler } from 'react';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
|
-
import { forwardRef } from '@wordpress/element';
|
|
10
|
+
import { forwardRef, useState } from '@wordpress/element';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
@@ -26,9 +26,13 @@ export function UnForwardedTokenInput(
|
|
|
26
26
|
selectedSuggestionIndex,
|
|
27
27
|
className,
|
|
28
28
|
onChange,
|
|
29
|
+
onFocus,
|
|
30
|
+
onBlur,
|
|
29
31
|
...restProps
|
|
30
32
|
} = props;
|
|
31
33
|
|
|
34
|
+
const [ hasFocus, setHasFocus ] = useState( false );
|
|
35
|
+
|
|
32
36
|
const size = value ? value.length + 1 : 0;
|
|
33
37
|
|
|
34
38
|
const onChangeHandler = ( event: ChangeEvent< HTMLInputElement > ) => {
|
|
@@ -39,6 +43,18 @@ export function UnForwardedTokenInput(
|
|
|
39
43
|
}
|
|
40
44
|
};
|
|
41
45
|
|
|
46
|
+
const onFocusHandler: FocusEventHandler< HTMLInputElement > = ( e ) => {
|
|
47
|
+
setHasFocus( true );
|
|
48
|
+
onFocus?.( e );
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const onBlurHandler: React.FocusEventHandler< HTMLInputElement > = (
|
|
52
|
+
e
|
|
53
|
+
) => {
|
|
54
|
+
setHasFocus( false );
|
|
55
|
+
onBlur?.( e );
|
|
56
|
+
};
|
|
57
|
+
|
|
42
58
|
return (
|
|
43
59
|
<input
|
|
44
60
|
ref={ ref }
|
|
@@ -47,6 +63,8 @@ export function UnForwardedTokenInput(
|
|
|
47
63
|
{ ...restProps }
|
|
48
64
|
value={ value || '' }
|
|
49
65
|
onChange={ onChangeHandler }
|
|
66
|
+
onFocus={ onFocusHandler }
|
|
67
|
+
onBlur={ onBlurHandler }
|
|
50
68
|
size={ size }
|
|
51
69
|
className={ classnames(
|
|
52
70
|
className,
|
|
@@ -62,7 +80,11 @@ export function UnForwardedTokenInput(
|
|
|
62
80
|
: undefined
|
|
63
81
|
}
|
|
64
82
|
aria-activedescendant={
|
|
65
|
-
|
|
83
|
+
// Only add the `aria-activedescendant` attribute when:
|
|
84
|
+
// - the user is actively interacting with the input (`hasFocus`)
|
|
85
|
+
// - there is a selected suggestion (`selectedSuggestionIndex !== -1`)
|
|
86
|
+
// - the list of suggestions are rendered in the DOM (`isExpanded`)
|
|
87
|
+
hasFocus && selectedSuggestionIndex !== -1 && isExpanded
|
|
66
88
|
? `components-form-token-suggestions-${ instanceId }-${ selectedSuggestionIndex }`
|
|
67
89
|
: undefined
|
|
68
90
|
}
|
package/src/index.js
CHANGED
|
@@ -16,7 +16,7 @@ export {
|
|
|
16
16
|
default as Animate,
|
|
17
17
|
getAnimateClassName as __unstableGetAnimateClassName,
|
|
18
18
|
} from './animate';
|
|
19
|
-
export { __unstableMotion } from './animation';
|
|
19
|
+
export { __unstableMotion, __unstableAnimatePresence } from './animation';
|
|
20
20
|
export { default as AnglePickerControl } from './angle-picker-control';
|
|
21
21
|
export {
|
|
22
22
|
default as Autocomplete,
|
|
@@ -188,6 +188,7 @@ export {
|
|
|
188
188
|
Fill,
|
|
189
189
|
Provider as SlotFillProvider,
|
|
190
190
|
useSlot as __experimentalUseSlot,
|
|
191
|
+
useSlotFills as __experimentalUseSlotFills,
|
|
191
192
|
} from './slot-fill';
|
|
192
193
|
export { default as __experimentalStyleProvider } from './style-provider';
|
|
193
194
|
export { ZStack as __experimentalZStack } from './z-stack';
|
package/src/menu-item/README.md
CHANGED
|
@@ -79,3 +79,10 @@ If shortcut is a string, it is expecting the display text. If shortcut is an obj
|
|
|
79
79
|
- Default: `'menuitem'`
|
|
80
80
|
|
|
81
81
|
[Aria Spec](https://www.w3.org/TR/wai-aria-1.1/#aria-checked). If you need to have selectable menu items use menuitemradio for single select, and menuitemcheckbox for multiselect.
|
|
82
|
+
|
|
83
|
+
### `suffix`
|
|
84
|
+
|
|
85
|
+
- Type: `WPElement`
|
|
86
|
+
- Required: No
|
|
87
|
+
|
|
88
|
+
Allows for markup other than icons or shortcuts to be added to the menu item.
|
package/src/menu-item/index.js
CHANGED
|
@@ -26,6 +26,7 @@ export function MenuItem( props, ref ) {
|
|
|
26
26
|
shortcut,
|
|
27
27
|
isSelected,
|
|
28
28
|
role = 'menuitem',
|
|
29
|
+
suffix,
|
|
29
30
|
...buttonProps
|
|
30
31
|
} = props;
|
|
31
32
|
|
|
@@ -63,11 +64,16 @@ export function MenuItem( props, ref ) {
|
|
|
63
64
|
{ ...buttonProps }
|
|
64
65
|
>
|
|
65
66
|
<span className="components-menu-item__item">{ children }</span>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
{ ! suffix && (
|
|
68
|
+
<Shortcut
|
|
69
|
+
className="components-menu-item__shortcut"
|
|
70
|
+
shortcut={ shortcut }
|
|
71
|
+
/>
|
|
72
|
+
) }
|
|
73
|
+
{ ! suffix && icon && iconPosition === 'right' && (
|
|
74
|
+
<Icon icon={ icon } />
|
|
75
|
+
) }
|
|
76
|
+
{ suffix }
|
|
71
77
|
</Button>
|
|
72
78
|
);
|
|
73
79
|
}
|
package/src/menu-item/style.scss
CHANGED
|
@@ -107,4 +107,40 @@ describe( 'MenuItem', () => {
|
|
|
107
107
|
expect( checkboxMenuItem ).toBeChecked();
|
|
108
108
|
expect( checkboxMenuItem ).toHaveAttribute( 'aria-checked', 'true' );
|
|
109
109
|
} );
|
|
110
|
+
|
|
111
|
+
it( 'should not render shortcut or right icon if suffix provided', () => {
|
|
112
|
+
render(
|
|
113
|
+
<MenuItem
|
|
114
|
+
icon={ <span>Icon</span> }
|
|
115
|
+
iconPosition="right"
|
|
116
|
+
role="menuitemcheckbox"
|
|
117
|
+
shortcut="Shortcut"
|
|
118
|
+
suffix="Suffix"
|
|
119
|
+
>
|
|
120
|
+
My item
|
|
121
|
+
</MenuItem>
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
expect( screen.getByText( 'Suffix' ) ).toBeInTheDocument();
|
|
125
|
+
expect( screen.queryByText( 'Shortcut' ) ).not.toBeInTheDocument();
|
|
126
|
+
expect( screen.queryByText( 'Icon' ) ).not.toBeInTheDocument();
|
|
127
|
+
} );
|
|
128
|
+
|
|
129
|
+
it( 'should render left icon despite suffix being provided', () => {
|
|
130
|
+
render(
|
|
131
|
+
<MenuItem
|
|
132
|
+
icon={ <span>Icon</span> }
|
|
133
|
+
iconPosition="left"
|
|
134
|
+
role="menuitemcheckbox"
|
|
135
|
+
shortcut="Shortcut"
|
|
136
|
+
suffix="Suffix"
|
|
137
|
+
>
|
|
138
|
+
My item
|
|
139
|
+
</MenuItem>
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
expect( screen.getByText( 'Icon' ) ).toBeInTheDocument();
|
|
143
|
+
expect( screen.getByText( 'Suffix' ) ).toBeInTheDocument();
|
|
144
|
+
expect( screen.queryByText( 'Shortcut' ) ).not.toBeInTheDocument();
|
|
145
|
+
} );
|
|
110
146
|
} );
|
|
@@ -112,6 +112,9 @@ function BottomSheetNavigationContainer( {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
|
+
// Disable reason: deferring this refactor to the native team.
|
|
116
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
117
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
115
118
|
[ currentHeight ]
|
|
116
119
|
);
|
|
117
120
|
|
|
@@ -133,6 +136,9 @@ function BottomSheetNavigationContainer( {
|
|
|
133
136
|
/>
|
|
134
137
|
);
|
|
135
138
|
} );
|
|
139
|
+
// Disable reason: deferring this refactor to the native team.
|
|
140
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
141
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
136
142
|
}, [ children ] );
|
|
137
143
|
|
|
138
144
|
return useMemo( () => {
|
|
@@ -158,6 +164,9 @@ function BottomSheetNavigationContainer( {
|
|
|
158
164
|
</BottomSheetNavigationProvider>
|
|
159
165
|
</View>
|
|
160
166
|
);
|
|
167
|
+
// Disable reason: deferring this refactor to the native team.
|
|
168
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
169
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
161
170
|
}, [ currentHeight, _theme ] );
|
|
162
171
|
}
|
|
163
172
|
|
|
@@ -41,6 +41,9 @@ const BottomSheetNavigationScreen = ( {
|
|
|
41
41
|
|
|
42
42
|
const { setHeight } = useContext( BottomSheetNavigationContext );
|
|
43
43
|
|
|
44
|
+
// Disable reason: deferring this refactor to the native team.
|
|
45
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
46
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44
47
|
const setHeightDebounce = useCallback( debounce( setHeight, 10 ), [
|
|
45
48
|
setHeight,
|
|
46
49
|
] );
|
|
@@ -70,6 +73,8 @@ const BottomSheetNavigationScreen = ( {
|
|
|
70
73
|
*
|
|
71
74
|
* Related: https://github.com/WordPress/gutenberg/pull/36328#discussion_r768897546
|
|
72
75
|
*/
|
|
76
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
77
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
73
78
|
}, [] )
|
|
74
79
|
);
|
|
75
80
|
|
|
@@ -83,6 +88,9 @@ const BottomSheetNavigationScreen = ( {
|
|
|
83
88
|
setHeight( heightRef.current.maxHeight );
|
|
84
89
|
}
|
|
85
90
|
return () => {};
|
|
91
|
+
// Disable reason: deferring this refactor to the native team.
|
|
92
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
93
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
86
94
|
}, [ setHeight ] )
|
|
87
95
|
);
|
|
88
96
|
|
|
@@ -127,6 +135,9 @@ const BottomSheetNavigationScreen = ( {
|
|
|
127
135
|
</TouchableHighlight>
|
|
128
136
|
</ScrollView>
|
|
129
137
|
);
|
|
138
|
+
// Disable reason: deferring this refactor to the native team.
|
|
139
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
140
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
130
141
|
}, [
|
|
131
142
|
children,
|
|
132
143
|
isFocused,
|
|
@@ -23,6 +23,9 @@ const BottomSheetSubSheet = ( {
|
|
|
23
23
|
if ( showSheet ) {
|
|
24
24
|
setIsFullScreen( isFullScreen );
|
|
25
25
|
}
|
|
26
|
+
// Disable reason: deferring this refactor to the native team.
|
|
27
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
28
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
29
|
}, [ showSheet, isFullScreen ] );
|
|
27
30
|
|
|
28
31
|
return (
|
|
@@ -34,6 +34,9 @@ const ColorSettingsMemo = memo(
|
|
|
34
34
|
useEffect( () => {
|
|
35
35
|
shouldEnableBottomSheetMaxHeight( true );
|
|
36
36
|
onHandleClosingBottomSheet( null );
|
|
37
|
+
// Disable reason: deferring this refactor to the native team.
|
|
38
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
39
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37
40
|
}, [] );
|
|
38
41
|
return (
|
|
39
42
|
<BottomSheet.NavigationContainer>
|
|
@@ -43,6 +43,9 @@ const PickerScreen = () => {
|
|
|
43
43
|
onHandleHardwareButtonPress={ onHandleHardwareButtonPress }
|
|
44
44
|
/>
|
|
45
45
|
);
|
|
46
|
+
// Disable reason: deferring this refactor to the native team.
|
|
47
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
48
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
49
|
}, [
|
|
47
50
|
setColor,
|
|
48
51
|
currentValue,
|
|
@@ -82,6 +82,9 @@ const ImageComponent = ( {
|
|
|
82
82
|
} );
|
|
83
83
|
}
|
|
84
84
|
return () => ( isCurrent = false );
|
|
85
|
+
// Disable reason: deferring this refactor to the native team.
|
|
86
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
87
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
85
88
|
}, [ url ] );
|
|
86
89
|
|
|
87
90
|
const onContainerLayout = ( event ) => {
|
|
@@ -69,6 +69,9 @@ export const KeyboardAvoidingView = ( {
|
|
|
69
69
|
keyboardShowSubscription.remove();
|
|
70
70
|
keyboardHideSubscription.remove();
|
|
71
71
|
};
|
|
72
|
+
// Disable reason: deferring this refactor to the native team.
|
|
73
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
74
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
72
75
|
}, [] );
|
|
73
76
|
|
|
74
77
|
function onSafeAreaInsetsUpdate( { safeAreaInsets } ) {
|
|
@@ -91,6 +91,9 @@ export const LinkPicker = ( {
|
|
|
91
91
|
getURLFromClipboard()
|
|
92
92
|
.then( ( url ) => setValue( { value, clipboardUrl: url } ) )
|
|
93
93
|
.catch( () => setValue( { value, clipboardUrl: '' } ) );
|
|
94
|
+
// Disable reason: deferring this refactor to the native team.
|
|
95
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
96
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
94
97
|
}, [] );
|
|
95
98
|
|
|
96
99
|
// TODO: Localize the accessibility label.
|
|
@@ -86,6 +86,9 @@ export default function LinkPickerResults( {
|
|
|
86
86
|
setHasAllSuggestions( false );
|
|
87
87
|
setLinks( [ directEntry ] );
|
|
88
88
|
fetchMoreSuggestions( { query, links: [ directEntry ] } );
|
|
89
|
+
// Disable reason: deferring this refactor to the native team.
|
|
90
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
91
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
89
92
|
}, [ query ] );
|
|
90
93
|
|
|
91
94
|
const onEndReached = () => fetchMoreSuggestions( { query, links } );
|
|
@@ -53,6 +53,9 @@ const LinkPickerScreen = ( { returnScreenName } ) => {
|
|
|
53
53
|
onCancel={ onCancel }
|
|
54
54
|
/>
|
|
55
55
|
);
|
|
56
|
+
// Disable reason: deferring this refactor to the native team.
|
|
57
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
58
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
56
59
|
}, [ inputValue ] );
|
|
57
60
|
};
|
|
58
61
|
|
|
@@ -101,6 +101,9 @@ function LinkSettings( {
|
|
|
101
101
|
if ( onHandleClosingBottomSheet ) {
|
|
102
102
|
onHandleClosingBottomSheet( onCloseSettingsSheet );
|
|
103
103
|
}
|
|
104
|
+
// Disable reason: deferring this refactor to the native team.
|
|
105
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
106
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
104
107
|
}, [ urlInputValue, labelInputValue, linkRelInputValue ] );
|
|
105
108
|
|
|
106
109
|
useEffect( () => {
|
|
@@ -112,6 +115,9 @@ function LinkSettings( {
|
|
|
112
115
|
if ( url !== urlInputValue ) {
|
|
113
116
|
setUrlInputValue( url || '' );
|
|
114
117
|
}
|
|
118
|
+
// Disable reason: deferring this refactor to the native team.
|
|
119
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
120
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
115
121
|
}, [ url ] );
|
|
116
122
|
|
|
117
123
|
useEffect( () => {
|
|
@@ -135,6 +141,9 @@ function LinkSettings( {
|
|
|
135
141
|
if ( prevEditorSidebarOpened && ! editorSidebarOpened ) {
|
|
136
142
|
onSetAttributes();
|
|
137
143
|
}
|
|
144
|
+
// Disable reason: deferring this refactor to the native team.
|
|
145
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
146
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
138
147
|
}, [ editorSidebarOpened, isVisible ] );
|
|
139
148
|
|
|
140
149
|
useEffect( () => {
|
|
@@ -147,6 +156,9 @@ function LinkSettings( {
|
|
|
147
156
|
url: prependHTTP( urlValue ),
|
|
148
157
|
} );
|
|
149
158
|
}
|
|
159
|
+
// Disable reason: deferring this refactor to the native team.
|
|
160
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
161
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
150
162
|
}, [ urlValue ] );
|
|
151
163
|
|
|
152
164
|
const onChangeURL = useCallback(
|
|
@@ -176,6 +188,9 @@ function LinkSettings( {
|
|
|
176
188
|
rel: linkRelInputValue,
|
|
177
189
|
} );
|
|
178
190
|
}
|
|
191
|
+
// Disable reason: deferring this refactor to the native team.
|
|
192
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
193
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
179
194
|
}, [ urlInputValue, labelInputValue, linkRelInputValue, setAttributes ] );
|
|
180
195
|
|
|
181
196
|
const onCloseSettingsSheet = useCallback( () => {
|
|
@@ -208,6 +223,9 @@ function LinkSettings( {
|
|
|
208
223
|
rel: updatedRel,
|
|
209
224
|
} );
|
|
210
225
|
},
|
|
226
|
+
// Disable reason: deferring this refactor to the native team.
|
|
227
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
228
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
211
229
|
[ linkRelInputValue ]
|
|
212
230
|
);
|
|
213
231
|
|
|
@@ -37,6 +37,9 @@ const LinkSettingsScreen = ( props ) => {
|
|
|
37
37
|
urlValue={ inputValue }
|
|
38
38
|
/>
|
|
39
39
|
);
|
|
40
|
+
// Disable reason: deferring this refactor to the native team.
|
|
41
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
42
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40
43
|
}, [ props, inputValue, navigation, route ] );
|
|
41
44
|
};
|
|
42
45
|
|