@wordpress/components 26.0.4 → 27.1.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/.stylelintrc.js +2 -2
- package/CHANGELOG.md +45 -0
- package/CONTRIBUTING.md +72 -0
- package/build/autocomplete/index.js +3 -8
- package/build/autocomplete/index.js.map +1 -1
- package/build/base-control/index.native.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/button/index.js +2 -2
- package/build/button/index.js.map +1 -1
- package/build/button/index.native.js.map +1 -1
- package/build/color-picker/component.js +10 -1
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/styles.js +8 -9
- package/build/color-picker/styles.js.map +1 -1
- package/build/combobox-control/index.js +4 -9
- package/build/combobox-control/index.js.map +1 -1
- package/build/confirm-dialog/component.js.map +1 -1
- package/build/custom-select-control/index.js +2 -15
- package/build/custom-select-control/index.js.map +1 -1
- package/build/custom-select-control-v2/custom-select-item.js +32 -0
- package/build/custom-select-control-v2/custom-select-item.js.map +1 -0
- package/build/custom-select-control-v2/custom-select.js +91 -0
- package/build/custom-select-control-v2/custom-select.js.map +1 -0
- package/build/custom-select-control-v2/default-component/index.js +41 -0
- package/build/custom-select-control-v2/default-component/index.js.map +1 -0
- package/build/custom-select-control-v2/index.js +13 -82
- package/build/custom-select-control-v2/index.js.map +1 -1
- package/build/custom-select-control-v2/legacy-component/index.js +123 -0
- package/build/custom-select-control-v2/legacy-component/index.js.map +1 -0
- package/build/custom-select-control-v2/styles.js +73 -50
- package/build/custom-select-control-v2/styles.js.map +1 -1
- package/build/custom-select-control-v2/types.js.map +1 -1
- package/build/draggable/index.native.js +2 -2
- package/build/draggable/index.native.js.map +1 -1
- package/build/dropdown-menu/index.native.js.map +1 -1
- package/build/flex/flex/hook.js +1 -1
- package/build/flex/flex/hook.js.map +1 -1
- package/build/font-size-picker/font-size-picker-select.js +0 -1
- package/build/font-size-picker/font-size-picker-select.js.map +1 -1
- package/build/font-size-picker/index.native.js.map +1 -1
- package/build/form-token-field/index.js +3 -8
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/suggestions-list.js +5 -12
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/h-stack/hook.js +6 -1
- package/build/h-stack/hook.js.map +1 -1
- package/build/mobile/bottom-sheet/button.native.js.map +1 -1
- package/build/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/range-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
- package/build/mobile/gradient/index.native.js.map +1 -1
- package/build/mobile/image/index.native.js +4 -13
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js +1 -1
- package/build/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js.map +1 -1
- package/build/mobile/media-edit/index.native.js.map +1 -1
- package/build/modal/index.js +2 -10
- package/build/modal/index.js.map +1 -1
- package/build/palette-edit/index.js.map +1 -1
- package/build/progress-bar/styles.js +5 -5
- package/build/progress-bar/styles.js.map +1 -1
- package/build/query-controls/index.native.js.map +1 -1
- package/build/range-control/index.js.map +1 -1
- package/build/search-control/index.native.js.map +1 -1
- package/build/snackbar/index.js +3 -2
- package/build/snackbar/index.js.map +1 -1
- package/build/snackbar/list.js +2 -1
- package/build/snackbar/list.js.map +1 -1
- package/build/snackbar/types.js.map +1 -1
- package/build/tabs/index.js +7 -7
- package/build/tabs/index.js.map +1 -1
- package/build/tabs/types.js.map +1 -1
- package/build/utils/hooks/index.js +0 -7
- package/build/utils/hooks/index.js.map +1 -1
- package/build/utils/with-ignore-ime-events.js +34 -0
- package/build/utils/with-ignore-ime-events.js.map +1 -0
- package/build-module/autocomplete/index.js +3 -8
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/base-control/index.native.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/button/index.js +2 -2
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/index.native.js.map +1 -1
- package/build-module/color-picker/component.js +11 -2
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/styles.js +8 -9
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/combobox-control/index.js +4 -9
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/confirm-dialog/component.js.map +1 -1
- package/build-module/custom-select-control/index.js +2 -15
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/custom-select-control-v2/custom-select-item.js +26 -0
- package/build-module/custom-select-control-v2/custom-select-item.js.map +1 -0
- package/build-module/custom-select-control-v2/custom-select.js +82 -0
- package/build-module/custom-select-control-v2/custom-select.js.map +1 -0
- package/build-module/custom-select-control-v2/default-component/index.js +30 -0
- package/build-module/custom-select-control-v2/default-component/index.js.map +1 -0
- package/build-module/custom-select-control-v2/index.js +2 -74
- package/build-module/custom-select-control-v2/index.js.map +1 -1
- package/build-module/custom-select-control-v2/legacy-component/index.js +111 -0
- package/build-module/custom-select-control-v2/legacy-component/index.js.map +1 -0
- package/build-module/custom-select-control-v2/styles.js +73 -42
- package/build-module/custom-select-control-v2/styles.js.map +1 -1
- package/build-module/custom-select-control-v2/types.js.map +1 -1
- package/build-module/draggable/index.native.js +2 -2
- package/build-module/draggable/index.native.js.map +1 -1
- package/build-module/dropdown-menu/index.native.js.map +1 -1
- package/build-module/flex/flex/hook.js +1 -1
- package/build-module/flex/flex/hook.js.map +1 -1
- package/build-module/font-size-picker/font-size-picker-select.js +0 -1
- package/build-module/font-size-picker/font-size-picker-select.js.map +1 -1
- package/build-module/font-size-picker/index.native.js.map +1 -1
- package/build-module/form-token-field/index.js +3 -8
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/suggestions-list.js +5 -12
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/h-stack/hook.js +6 -1
- package/build-module/h-stack/hook.js.map +1 -1
- package/build-module/mobile/bottom-sheet/button.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/range-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
- package/build-module/mobile/gradient/index.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +6 -15
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js.map +1 -1
- package/build-module/mobile/media-edit/index.native.js.map +1 -1
- package/build-module/modal/index.js +3 -10
- package/build-module/modal/index.js.map +1 -1
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/progress-bar/styles.js +5 -5
- package/build-module/progress-bar/styles.js.map +1 -1
- package/build-module/query-controls/index.native.js.map +1 -1
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/search-control/index.native.js.map +1 -1
- package/build-module/snackbar/index.js +3 -2
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/snackbar/list.js +2 -1
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/snackbar/types.js.map +1 -1
- package/build-module/tabs/index.js +7 -7
- package/build-module/tabs/index.js.map +1 -1
- package/build-module/tabs/types.js.map +1 -1
- package/build-module/utils/hooks/index.js +0 -1
- package/build-module/utils/hooks/index.js.map +1 -1
- package/build-module/utils/with-ignore-ime-events.js +28 -0
- package/build-module/utils/with-ignore-ime-events.js.map +1 -0
- package/build-style/style-rtl.css +10 -2
- package/build-style/style.css +10 -2
- package/build-types/alignment-matrix-control/stories/index.story.d.ts +1 -1
- package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
- package/build-types/animate/stories/index.story.d.ts +7 -7
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/base-control/stories/index.story.d.ts +1 -1
- package/build-types/border-box-control/stories/index.story.d.ts +1 -1
- package/build-types/border-control/stories/index.story.d.ts +6 -6
- package/build-types/box-control/stories/index.story.d.ts +6 -6
- package/build-types/button/stories/e2e/index.story.d.ts +1 -1
- package/build-types/button/stories/index.story.d.ts +7 -7
- package/build-types/card/stories/index.story.d.ts +2 -2
- package/build-types/circular-option-picker/stories/index.story.d.ts +5 -5
- package/build-types/color-palette/stories/index.story.d.ts +3 -3
- package/build-types/color-picker/component.d.ts.map +1 -1
- package/build-types/color-picker/stories/index.story.d.ts +1 -1
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/combobox-control/index.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.story.d.ts +2 -2
- package/build-types/confirm-dialog/stories/index.story.d.ts +2 -2
- package/build-types/custom-gradient-picker/stories/index.story.d.ts +1 -1
- package/build-types/custom-select-control/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/custom-select-item.d.ts +9 -0
- package/build-types/custom-select-control-v2/custom-select-item.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/custom-select.d.ts +6 -0
- package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/default-component/index.d.ts +6 -0
- package/build-types/custom-select-control-v2/default-component/index.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/index.d.ts +5 -6
- package/build-types/custom-select-control-v2/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/legacy-component/index.d.ts +5 -0
- package/build-types/custom-select-control-v2/legacy-component/index.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/legacy-component/test/index.d.ts +2 -0
- package/build-types/custom-select-control-v2/legacy-component/test/index.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/stories/default.story.d.ts +30 -0
- package/build-types/custom-select-control-v2/stories/default.story.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/stories/legacy.story.d.ts +12 -0
- package/build-types/custom-select-control-v2/stories/legacy.story.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/styles.d.ts +31 -6
- package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/types.d.ts +136 -14
- package/build-types/custom-select-control-v2/types.d.ts.map +1 -1
- package/build-types/dimension-control/stories/index.story.d.ts +2 -2
- package/build-types/drop-zone/stories/index.story.d.ts +1 -1
- package/build-types/dropdown/stories/index.story.d.ts +3 -3
- package/build-types/dropdown-menu/stories/index.story.d.ts +2 -2
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +1 -1
- package/build-types/duotone-picker/stories/duotone-picker.story.d.ts +1 -1
- package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts +3 -3
- package/build-types/flex/flex/hook.d.ts +2 -3
- package/build-types/flex/flex/hook.d.ts.map +1 -1
- package/build-types/focal-point-picker/stories/index.story.d.ts +4 -4
- package/build-types/font-size-picker/font-size-picker-select.d.ts.map +1 -1
- package/build-types/form-file-upload/stories/index.story.d.ts +5 -5
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
- package/build-types/gradient-picker/stories/index.story.d.ts +3 -3
- package/build-types/guide/stories/index.story.d.ts +1 -1
- package/build-types/h-stack/hook.d.ts +2 -4
- package/build-types/h-stack/hook.d.ts.map +1 -1
- package/build-types/icon/stories/index.story.d.ts +4 -4
- package/build-types/input-control/stories/index.story.d.ts +6 -6
- package/build-types/keyboard-shortcuts/stories/index.story.d.ts +1 -1
- package/build-types/menu-group/stories/index.story.d.ts +1 -1
- package/build-types/menu-item/stories/index.story.d.ts +4 -4
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/navigation/stories/index.story.d.ts +6 -6
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -1
- package/build-types/notice/stories/index.story.d.ts +4 -4
- package/build-types/number-control/stories/index.story.d.ts +1 -1
- package/build-types/palette-edit/stories/index.story.d.ts +2 -2
- package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
- package/build-types/query-controls/stories/index.story.d.ts +1 -1
- package/build-types/radio-group/stories/index.story.d.ts.map +1 -1
- package/build-types/resizable-box/stories/index.story.d.ts +2 -2
- package/build-types/responsive-wrapper/stories/index.story.d.ts +1 -1
- package/build-types/sandbox/stories/index.story.d.ts +1 -1
- package/build-types/search-control/stories/index.story.d.ts +2 -2
- package/build-types/select-control/stories/index.story.d.ts +2 -2
- package/build-types/shortcut/stories/index.story.d.ts +1 -1
- package/build-types/snackbar/index.d.ts +5 -2
- package/build-types/snackbar/index.d.ts.map +1 -1
- package/build-types/snackbar/list.d.ts.map +1 -1
- package/build-types/snackbar/test/index.d.ts +2 -0
- package/build-types/snackbar/test/index.d.ts.map +1 -0
- package/build-types/snackbar/test/list.d.ts +2 -0
- package/build-types/snackbar/test/list.d.ts.map +1 -0
- package/build-types/snackbar/types.d.ts +18 -2
- package/build-types/snackbar/types.d.ts.map +1 -1
- package/build-types/tab-panel/stories/index.story.d.ts +4 -4
- package/build-types/tabs/index.d.ts +1 -1
- package/build-types/tabs/stories/index.story.d.ts +9 -9
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/types.d.ts +1 -1
- package/build-types/text/stories/index.story.d.ts +3 -3
- package/build-types/theme/stories/index.story.d.ts +1 -1
- package/build-types/theme/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-control/stories/index.story.d.ts +2 -2
- package/build-types/toolbar/stories/index.story.d.ts +3 -3
- package/build-types/tooltip/stories/index.story.d.ts +1 -1
- package/build-types/tree-grid/stories/index.story.d.ts +1 -1
- package/build-types/tree-select/stories/index.story.d.ts +1 -1
- package/build-types/utils/hooks/index.d.ts +0 -1
- package/build-types/utils/with-ignore-ime-events.d.ts +15 -0
- package/build-types/utils/with-ignore-ime-events.d.ts.map +1 -0
- package/build-types/v-stack/hook.d.ts +2 -4
- package/build-types/v-stack/hook.d.ts.map +1 -1
- package/build-types/v-stack/stories/index.story.d.ts +1 -1
- package/package.json +19 -20
- package/src/alignment-matrix-control/test/index.tsx +3 -1
- package/src/autocomplete/index.tsx +3 -10
- package/src/base-control/index.native.js +1 -1
- package/src/base-control/test/index.tsx +1 -1
- package/src/border-box-control/border-box-control/component.tsx +1 -1
- package/src/border-box-control/border-box-control-split-controls/component.tsx +4 -4
- package/src/border-control/border-control-dropdown/component.tsx +1 -1
- package/src/button/index.native.js +1 -1
- package/src/button/index.tsx +1 -1
- package/src/button/style.scss +1 -3
- package/src/circular-option-picker/test/index.tsx +6 -5
- package/src/color-picker/component.tsx +22 -11
- package/src/color-picker/styles.ts +1 -15
- package/src/combobox-control/index.tsx +33 -41
- package/src/combobox-control/test/index.tsx +1 -1
- package/src/composite/legacy/test/index.tsx +18 -2
- package/src/confirm-dialog/component.tsx +1 -1
- package/src/confirm-dialog/test/index.tsx +5 -21
- package/src/custom-select-control/README.md +0 -10
- package/src/custom-select-control/index.js +3 -22
- package/src/custom-select-control/stories/index.story.js +0 -1
- package/src/custom-select-control/test/index.js +17 -17
- package/src/custom-select-control-v2/README.md +97 -7
- package/src/custom-select-control-v2/custom-select-item.tsx +29 -0
- package/src/custom-select-control-v2/custom-select.tsx +122 -0
- package/src/custom-select-control-v2/default-component/index.tsx +27 -0
- package/src/custom-select-control-v2/index.tsx +2 -102
- package/src/custom-select-control-v2/legacy-component/index.tsx +133 -0
- package/src/custom-select-control-v2/legacy-component/test/index.tsx +457 -0
- package/src/custom-select-control-v2/stories/{index.story.tsx → default.story.tsx} +27 -33
- package/src/custom-select-control-v2/stories/legacy.story.tsx +87 -0
- package/src/custom-select-control-v2/styles.ts +82 -38
- package/src/custom-select-control-v2/test/index.tsx +207 -17
- package/src/custom-select-control-v2/types.ts +147 -20
- package/src/disabled/test/index.tsx +1 -1
- package/src/draggable/index.native.js +2 -2
- package/src/draggable/test/index.native.js +6 -2
- package/src/dropdown-menu/index.native.js +2 -2
- package/src/dropdown-menu-v2/stories/index.story.tsx +1 -0
- package/src/dropdown-menu-v2/test/index.tsx +4 -1
- package/src/flex/flex/hook.ts +1 -1
- package/src/font-size-picker/font-size-picker-select.tsx +0 -1
- package/src/font-size-picker/index.native.js +2 -2
- package/src/form-token-field/index.tsx +4 -11
- package/src/form-token-field/suggestions-list.tsx +5 -17
- package/src/h-stack/hook.tsx +2 -1
- package/src/h-stack/test/index.tsx +10 -0
- package/src/item-group/test/index.js +2 -2
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +10 -15
- package/src/mobile/bottom-sheet/button.native.js +1 -5
- package/src/mobile/bottom-sheet/index.native.js +2 -2
- package/src/mobile/bottom-sheet/range-cell.native.js +1 -1
- package/src/mobile/bottom-sheet/stepper-cell/index.native.js +2 -2
- package/src/mobile/bottom-sheet-select-control/index.native.js +1 -1
- package/src/mobile/bottom-sheet-text-control/index.native.js +1 -1
- package/src/mobile/gradient/index.native.js +1 -1
- package/src/mobile/image/index.native.js +8 -23
- package/src/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js +1 -1
- package/src/mobile/media-edit/index.native.js +1 -1
- package/src/modal/index.tsx +2 -12
- package/src/modal/style.scss +1 -0
- package/src/modal/test/index.tsx +1 -1
- package/src/navigation/stories/utils/hide-if-empty.tsx +2 -6
- package/src/palette-edit/index.tsx +2 -2
- package/src/popover/test/index.tsx +1 -4
- package/src/progress-bar/stories/index.story.tsx +1 -0
- package/src/progress-bar/styles.ts +2 -2
- package/src/query-controls/index.native.js +2 -2
- package/src/radio-group/stories/index.story.tsx +1 -0
- package/src/range-control/index.tsx +3 -3
- package/src/range-control/test/index.tsx +2 -2
- package/src/search-control/index.native.js +1 -1
- package/src/snackbar/index.tsx +5 -2
- package/src/snackbar/list.tsx +6 -1
- package/src/snackbar/stories/list.story.tsx +0 -3
- package/src/snackbar/test/index.tsx +267 -0
- package/src/snackbar/test/list.tsx +46 -0
- package/src/snackbar/types.ts +31 -3
- package/src/tab-panel/test/index.tsx +8 -1
- package/src/tabs/README.md +18 -18
- package/src/tabs/index.tsx +7 -7
- package/src/tabs/stories/index.story.tsx +2 -1
- package/src/tabs/test/index.tsx +66 -36
- package/src/tabs/types.ts +1 -1
- package/src/theme/stories/index.story.tsx +1 -0
- package/src/toggle-group-control/test/index.tsx +5 -1
- package/src/toolbar/toolbar-group/style.scss +1 -0
- package/src/tools-panel/stories/index.story.tsx +8 -8
- package/src/tools-panel/test/index.tsx +10 -28
- package/src/tooltip/style.scss +2 -1
- package/src/tooltip/test/index.native.js +3 -3
- package/src/tooltip/test/index.tsx +5 -0
- package/src/tree-grid/test/index.tsx +1 -1
- package/src/utils/hooks/index.js +0 -1
- package/src/utils/with-ignore-ime-events.ts +32 -0
- package/src/v-stack/test/index.tsx +10 -0
- package/tsconfig.json +0 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/custom-select-control/styles.js +0 -27
- package/build/custom-select-control/styles.js.map +0 -1
- package/build/utils/hooks/use-latest-ref.js +0 -33
- package/build/utils/hooks/use-latest-ref.js.map +0 -1
- package/build-module/custom-select-control/styles.js +0 -18
- package/build-module/custom-select-control/styles.js.map +0 -1
- package/build-module/utils/hooks/use-latest-ref.js +0 -27
- package/build-module/utils/hooks/use-latest-ref.js.map +0 -1
- package/build-types/custom-select-control/styles.d.ts +0 -11
- package/build-types/custom-select-control/styles.d.ts.map +0 -1
- package/build-types/custom-select-control-v2/stories/index.story.d.ts +0 -20
- package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +0 -1
- package/build-types/utils/hooks/use-latest-ref.d.ts +0 -15
- package/build-types/utils/hooks/use-latest-ref.d.ts.map +0 -1
- package/src/custom-select-control/styles.ts +0 -28
- package/src/utils/hooks/test/use-latest-ref.js +0 -119
- package/src/utils/hooks/use-latest-ref.ts +0 -29
|
@@ -28,10 +28,12 @@ const TouchEventType = {
|
|
|
28
28
|
// For testing, we mock the "requestAnimationFrame" so it calls the callback passed instantly.
|
|
29
29
|
let requestAnimationFrameCopy;
|
|
30
30
|
beforeEach( () => {
|
|
31
|
+
jest.useFakeTimers();
|
|
31
32
|
requestAnimationFrameCopy = global.requestAnimationFrame;
|
|
32
33
|
global.requestAnimationFrame = ( callback ) => callback();
|
|
33
34
|
} );
|
|
34
35
|
afterEach( () => {
|
|
36
|
+
jest.useRealTimers();
|
|
35
37
|
global.requestAnimationFrame = requestAnimationFrameCopy;
|
|
36
38
|
} );
|
|
37
39
|
|
|
@@ -43,7 +45,7 @@ describe( 'Draggable', () => {
|
|
|
43
45
|
<Draggable>
|
|
44
46
|
<DraggableTrigger
|
|
45
47
|
id={ triggerId }
|
|
46
|
-
enabled
|
|
48
|
+
enabled
|
|
47
49
|
minDuration={ 500 }
|
|
48
50
|
onLongPress={ onLongPress }
|
|
49
51
|
testID="draggableTrigger"
|
|
@@ -58,6 +60,7 @@ describe( 'Draggable', () => {
|
|
|
58
60
|
{ oldState: State.BEGAN, state: State.ACTIVE },
|
|
59
61
|
{ state: State.ACTIVE },
|
|
60
62
|
] );
|
|
63
|
+
jest.runOnlyPendingTimers();
|
|
61
64
|
|
|
62
65
|
expect( onLongPress ).toHaveBeenCalledTimes( 1 );
|
|
63
66
|
expect( onLongPress ).toHaveBeenCalledWith( triggerId );
|
|
@@ -93,6 +96,7 @@ describe( 'Draggable', () => {
|
|
|
93
96
|
{ oldState: State.BEGAN, state: State.ACTIVE },
|
|
94
97
|
{ state: State.ACTIVE },
|
|
95
98
|
] );
|
|
99
|
+
jest.runOnlyPendingTimers();
|
|
96
100
|
fireGestureHandler( draggable, [
|
|
97
101
|
// TOUCHES_DOWN event is only received on ACTIVE state, so we have to fire it manually.
|
|
98
102
|
{ oldState: State.BEGAN, state: State.ACTIVE },
|
|
@@ -112,7 +116,7 @@ describe( 'Draggable', () => {
|
|
|
112
116
|
] );
|
|
113
117
|
// TODO(jest-console): Fix the warning and remove the expect below.
|
|
114
118
|
expect( console ).toHaveWarnedWith(
|
|
115
|
-
'[Reanimated]
|
|
119
|
+
'[Reanimated] setGestureState() cannot be used with Jest.'
|
|
116
120
|
);
|
|
117
121
|
|
|
118
122
|
expect( onDragStart ).toHaveBeenCalledTimes( 1 );
|
|
@@ -108,7 +108,7 @@ function DropdownMenu( {
|
|
|
108
108
|
renderContent={ ( { isOpen, onClose, ...props } ) => {
|
|
109
109
|
return (
|
|
110
110
|
<BottomSheet
|
|
111
|
-
hideHeader
|
|
111
|
+
hideHeader
|
|
112
112
|
isVisible={ isOpen }
|
|
113
113
|
onClose={ onClose }
|
|
114
114
|
>
|
|
@@ -135,7 +135,7 @@ function DropdownMenu( {
|
|
|
135
135
|
} }
|
|
136
136
|
editable={ false }
|
|
137
137
|
icon={ control.icon }
|
|
138
|
-
leftAlign
|
|
138
|
+
leftAlign
|
|
139
139
|
isSelected={ control.isActive }
|
|
140
140
|
separatorType={
|
|
141
141
|
Platform.OS === 'android'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { render, screen, waitFor } from '@testing-library/react';
|
|
5
|
-
import { press, click, hover, type } from '@ariakit/test';
|
|
5
|
+
import { press, click, hover, sleep, type } from '@ariakit/test';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
@@ -123,6 +123,7 @@ describe( 'DropdownMenu', () => {
|
|
|
123
123
|
} );
|
|
124
124
|
|
|
125
125
|
// Move focus on the toggle
|
|
126
|
+
await sleep();
|
|
126
127
|
await press.Tab();
|
|
127
128
|
|
|
128
129
|
expect( toggleButton ).toHaveFocus();
|
|
@@ -153,6 +154,7 @@ describe( 'DropdownMenu', () => {
|
|
|
153
154
|
} );
|
|
154
155
|
|
|
155
156
|
// Move focus on the toggle
|
|
157
|
+
await sleep();
|
|
156
158
|
await press.Tab();
|
|
157
159
|
|
|
158
160
|
expect( toggleButton ).toHaveFocus();
|
|
@@ -908,6 +910,7 @@ describe( 'DropdownMenu', () => {
|
|
|
908
910
|
|
|
909
911
|
// The outer button can be focused by pressing tab. Doing so will cause
|
|
910
912
|
// the DropdownMenu to close.
|
|
913
|
+
await sleep();
|
|
911
914
|
await press.Tab();
|
|
912
915
|
expect( outerButton ).toBeInTheDocument();
|
|
913
916
|
expect( screen.queryByRole( 'menu' ) ).not.toBeInTheDocument();
|
package/src/flex/flex/hook.ts
CHANGED
|
@@ -22,7 +22,7 @@ import type { FlexProps } from '../types';
|
|
|
22
22
|
|
|
23
23
|
function useDeprecatedProps(
|
|
24
24
|
props: WordPressComponentProps< FlexProps, 'div' >
|
|
25
|
-
):
|
|
25
|
+
): Omit< typeof props, 'isReversed' > {
|
|
26
26
|
const { isReversed, ...otherProps } = props;
|
|
27
27
|
|
|
28
28
|
if ( typeof isReversed !== 'undefined' ) {
|
|
@@ -69,7 +69,6 @@ const FontSizePickerSelect = ( props: FontSizePickerSelectProps ) => {
|
|
|
69
69
|
return (
|
|
70
70
|
<CustomSelectControl
|
|
71
71
|
__next40pxDefaultSize={ __next40pxDefaultSize }
|
|
72
|
-
__nextUnconstrainedWidth
|
|
73
72
|
className="components-font-size-picker__select"
|
|
74
73
|
label={ __( 'Font size' ) }
|
|
75
74
|
hideLabelFromVision
|
|
@@ -111,7 +111,7 @@ function FontSizePicker( {
|
|
|
111
111
|
separatorType="none"
|
|
112
112
|
label={ __( 'Default' ) }
|
|
113
113
|
onPress={ onChangeValue( undefined ) }
|
|
114
|
-
leftAlign
|
|
114
|
+
leftAlign
|
|
115
115
|
key={ 'default' }
|
|
116
116
|
accessibilityRole={ 'button' }
|
|
117
117
|
accessibilityLabel={ __( 'Selected: Default' ) }
|
|
@@ -137,7 +137,7 @@ function FontSizePicker( {
|
|
|
137
137
|
label={ item.name }
|
|
138
138
|
subLabel={ item.sizePx }
|
|
139
139
|
onPress={ onChangeValue( item.sizePx ) }
|
|
140
|
-
leftAlign
|
|
140
|
+
leftAlign
|
|
141
141
|
key={ index }
|
|
142
142
|
accessibilityRole={ 'button' }
|
|
143
143
|
accessibilityLabel={
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
} from '../base-control/styles/base-control-styles';
|
|
29
29
|
import { Spacer } from '../spacer';
|
|
30
30
|
import { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';
|
|
31
|
+
import { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';
|
|
31
32
|
|
|
32
33
|
const identity = ( value: string ) => value;
|
|
33
34
|
|
|
@@ -194,15 +195,7 @@ export function FormTokenField( props: FormTokenFieldProps ) {
|
|
|
194
195
|
function onKeyDown( event: KeyboardEvent ) {
|
|
195
196
|
let preventDefault = false;
|
|
196
197
|
|
|
197
|
-
if (
|
|
198
|
-
event.defaultPrevented ||
|
|
199
|
-
// Ignore keydowns from IMEs
|
|
200
|
-
event.nativeEvent.isComposing ||
|
|
201
|
-
// Workaround for Mac Safari where the final Enter/Backspace of an IME composition
|
|
202
|
-
// is `isComposing=false`, even though it's technically still part of the composition.
|
|
203
|
-
// These can only be detected by keyCode.
|
|
204
|
-
event.keyCode === 229
|
|
205
|
-
) {
|
|
198
|
+
if ( event.defaultPrevented ) {
|
|
206
199
|
return;
|
|
207
200
|
}
|
|
208
201
|
switch ( event.key ) {
|
|
@@ -689,7 +682,7 @@ export function FormTokenField( props: FormTokenFieldProps ) {
|
|
|
689
682
|
|
|
690
683
|
if ( ! disabled ) {
|
|
691
684
|
tokenFieldProps = Object.assign( {}, tokenFieldProps, {
|
|
692
|
-
onKeyDown,
|
|
685
|
+
onKeyDown: withIgnoreIMEEvents( onKeyDown ),
|
|
693
686
|
onKeyPress,
|
|
694
687
|
onFocus: onFocusHandler,
|
|
695
688
|
} );
|
|
@@ -718,7 +711,7 @@ export function FormTokenField( props: FormTokenFieldProps ) {
|
|
|
718
711
|
justify="flex-start"
|
|
719
712
|
align="center"
|
|
720
713
|
gap={ 1 }
|
|
721
|
-
wrap
|
|
714
|
+
wrap
|
|
722
715
|
__next40pxDefaultSize={ __next40pxDefaultSize }
|
|
723
716
|
hasTokens={ !! value.length }
|
|
724
717
|
>
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import scrollView from 'dom-scroll-into-view';
|
|
5
4
|
import classnames from 'classnames';
|
|
6
5
|
import type { MouseEventHandler, ReactNode } from 'react';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* WordPress dependencies
|
|
10
9
|
*/
|
|
11
|
-
import { useState } from '@wordpress/element';
|
|
12
10
|
import { useRefEffect } from '@wordpress/compose';
|
|
13
11
|
|
|
14
12
|
/**
|
|
@@ -32,8 +30,6 @@ export function SuggestionsList< T extends string | { value: string } >( {
|
|
|
32
30
|
instanceId,
|
|
33
31
|
__experimentalRenderItem,
|
|
34
32
|
}: SuggestionsListProps< T > ) {
|
|
35
|
-
const [ scrollingIntoView, setScrollingIntoView ] = useState( false );
|
|
36
|
-
|
|
37
33
|
const listRef = useRefEffect< HTMLUListElement >(
|
|
38
34
|
( listNode ) => {
|
|
39
35
|
// only have to worry about scrolling selected suggestion into view
|
|
@@ -44,16 +40,10 @@ export function SuggestionsList< T extends string | { value: string } >( {
|
|
|
44
40
|
scrollIntoView &&
|
|
45
41
|
listNode.children[ selectedIndex ]
|
|
46
42
|
) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
onlyScrollIfNeeded: true,
|
|
53
|
-
}
|
|
54
|
-
);
|
|
55
|
-
rafId = requestAnimationFrame( () => {
|
|
56
|
-
setScrollingIntoView( false );
|
|
43
|
+
listNode.children[ selectedIndex ].scrollIntoView( {
|
|
44
|
+
behavior: 'instant',
|
|
45
|
+
block: 'nearest',
|
|
46
|
+
inline: 'nearest',
|
|
57
47
|
} );
|
|
58
48
|
}
|
|
59
49
|
|
|
@@ -68,9 +58,7 @@ export function SuggestionsList< T extends string | { value: string } >( {
|
|
|
68
58
|
|
|
69
59
|
const handleHover = ( suggestion: T ) => {
|
|
70
60
|
return () => {
|
|
71
|
-
|
|
72
|
-
onHover?.( suggestion );
|
|
73
|
-
}
|
|
61
|
+
onHover?.( suggestion );
|
|
74
62
|
};
|
|
75
63
|
};
|
|
76
64
|
|
package/src/h-stack/hook.tsx
CHANGED
|
@@ -47,7 +47,8 @@ export function useHStack( props: WordPressComponentProps< Props, 'div' > ) {
|
|
|
47
47
|
gap: spacing,
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
// Omit `isColumn` because it's not used in HStack.
|
|
51
|
+
const { isColumn, ...flexProps } = useFlex( propsForFlex );
|
|
51
52
|
|
|
52
53
|
return flexProps;
|
|
53
54
|
}
|
|
@@ -39,4 +39,14 @@ describe( 'props', () => {
|
|
|
39
39
|
);
|
|
40
40
|
expect( container ).toMatchSnapshot();
|
|
41
41
|
} );
|
|
42
|
+
|
|
43
|
+
test( 'should not pass through invalid props to the `as` component', () => {
|
|
44
|
+
const AsComponent = ( props: JSX.IntrinsicElements[ 'div' ] ) => {
|
|
45
|
+
return <div { ...props } />;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
render( <HStack as={ AsComponent }>foobar</HStack> );
|
|
49
|
+
|
|
50
|
+
expect( console ).not.toHaveErrored();
|
|
51
|
+
} );
|
|
42
52
|
} );
|
|
@@ -29,7 +29,7 @@ describe( 'ItemGroup', () => {
|
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
const { container: withBorders } = render(
|
|
32
|
-
<ItemGroup isBordered
|
|
32
|
+
<ItemGroup isBordered>
|
|
33
33
|
<Item>Code is poetry</Item>
|
|
34
34
|
</ItemGroup>
|
|
35
35
|
);
|
|
@@ -63,7 +63,7 @@ describe( 'ItemGroup', () => {
|
|
|
63
63
|
);
|
|
64
64
|
|
|
65
65
|
const { container: separatedItems } = render(
|
|
66
|
-
<ItemGroup isSeparated
|
|
66
|
+
<ItemGroup isSeparated>
|
|
67
67
|
<Item>Code is poetry</Item>
|
|
68
68
|
</ItemGroup>
|
|
69
69
|
);
|
|
@@ -2,12 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { Text } from 'react-native';
|
|
5
|
-
import {
|
|
6
|
-
render,
|
|
7
|
-
fireEvent,
|
|
8
|
-
withReanimatedTimer,
|
|
9
|
-
advanceAnimationByTime,
|
|
10
|
-
} from 'test/helpers';
|
|
5
|
+
import { act, render, fireEvent, withReanimatedTimer } from 'test/helpers';
|
|
11
6
|
import { useNavigation } from '@react-navigation/native';
|
|
12
7
|
|
|
13
8
|
/**
|
|
@@ -63,7 +58,7 @@ it( 'animates height transitioning from non-full-screen to non-full-screen', asy
|
|
|
63
58
|
screen.getByTestId( 'navigation-screen-test-screen-1' ),
|
|
64
59
|
screen1Layout
|
|
65
60
|
);
|
|
66
|
-
|
|
61
|
+
act( () => jest.advanceTimersByTime( 1 ) );
|
|
67
62
|
expect( navigationContainer ).toHaveAnimatedStyle( screen1Layout );
|
|
68
63
|
|
|
69
64
|
// Navigate to screen 2
|
|
@@ -75,7 +70,7 @@ it( 'animates height transitioning from non-full-screen to non-full-screen', asy
|
|
|
75
70
|
);
|
|
76
71
|
// The animation takes 300 ms, so we wait that time plus 1 ms
|
|
77
72
|
// to the completion.
|
|
78
|
-
|
|
73
|
+
act( () => jest.advanceTimersByTime( 301 ) );
|
|
79
74
|
expect( navigationContainer ).toHaveAnimatedStyle( screen2Layout );
|
|
80
75
|
} ) );
|
|
81
76
|
|
|
@@ -105,14 +100,14 @@ it( 'animates height transitioning from non-full-screen to full-screen', async (
|
|
|
105
100
|
screen.getByTestId( 'navigation-screen-test-screen-1' ),
|
|
106
101
|
screen1Layout
|
|
107
102
|
);
|
|
108
|
-
|
|
103
|
+
act( () => jest.advanceTimersByTime( 1 ) );
|
|
109
104
|
expect( navigationContainer ).toHaveAnimatedStyle( screen1Layout );
|
|
110
105
|
|
|
111
106
|
// Navigate to screen 2
|
|
112
107
|
fireEvent.press( screen.getByText( /test-screen-1/ ) );
|
|
113
108
|
// The animation takes 300 ms, so we wait that time plus 1 ms
|
|
114
109
|
// to the completion.
|
|
115
|
-
|
|
110
|
+
act( () => jest.advanceTimersByTime( 301 ) );
|
|
116
111
|
expect( navigationContainer ).toHaveAnimatedStyle( {
|
|
117
112
|
height: WINDOW_HEIGHT,
|
|
118
113
|
} );
|
|
@@ -144,14 +139,14 @@ it( 'animates height transitioning from full-screen to non-full-screen', async (
|
|
|
144
139
|
screen.getByTestId( 'navigation-screen-test-screen-1' ),
|
|
145
140
|
screen1Layout
|
|
146
141
|
);
|
|
147
|
-
|
|
142
|
+
act( () => jest.advanceTimersByTime( 1 ) );
|
|
148
143
|
expect( navigationContainer ).toHaveAnimatedStyle( screen1Layout );
|
|
149
144
|
|
|
150
145
|
// Navigate to screen 2
|
|
151
146
|
fireEvent.press( screen.getByText( /test-screen-1/ ) );
|
|
152
147
|
// The animation takes 300 ms, so we wait that time plus 1 ms
|
|
153
148
|
// to the completion.
|
|
154
|
-
|
|
149
|
+
act( () => jest.advanceTimersByTime( 301 ) );
|
|
155
150
|
expect( navigationContainer ).toHaveAnimatedStyle( {
|
|
156
151
|
height: WINDOW_HEIGHT,
|
|
157
152
|
} );
|
|
@@ -160,7 +155,7 @@ it( 'animates height transitioning from full-screen to non-full-screen', async (
|
|
|
160
155
|
fireEvent.press( await screen.findByText( /test-screen-2/ ) );
|
|
161
156
|
// The animation takes 300 ms, so we wait that time plus 1 ms
|
|
162
157
|
// to the completion.
|
|
163
|
-
|
|
158
|
+
act( () => jest.advanceTimersByTime( 301 ) );
|
|
164
159
|
expect( navigationContainer ).toHaveAnimatedStyle( screen1Layout );
|
|
165
160
|
} ) );
|
|
166
161
|
|
|
@@ -187,7 +182,7 @@ it( 'does not animate height transitioning from full-screen to full-screen', asy
|
|
|
187
182
|
|
|
188
183
|
// First height value should be set without animation, but we need
|
|
189
184
|
// to wait for a frame to let animated styles be updated.
|
|
190
|
-
|
|
185
|
+
act( () => jest.advanceTimersByTime( 1 ) );
|
|
191
186
|
expect( navigationContainer ).toHaveAnimatedStyle( {
|
|
192
187
|
height: WINDOW_HEIGHT,
|
|
193
188
|
} );
|
|
@@ -195,7 +190,7 @@ it( 'does not animate height transitioning from full-screen to full-screen', asy
|
|
|
195
190
|
// Navigate to screen 2
|
|
196
191
|
fireEvent.press( screen.getByText( /test-screen-1/ ) );
|
|
197
192
|
// We wait some milliseconds to check if height has changed.
|
|
198
|
-
|
|
193
|
+
act( () => jest.advanceTimersByTime( 10 ) );
|
|
199
194
|
expect( navigationContainer ).toHaveAnimatedStyle( {
|
|
200
195
|
height: WINDOW_HEIGHT,
|
|
201
196
|
} );
|
|
@@ -9,11 +9,7 @@ import { TouchableOpacity, View, Text } from 'react-native';
|
|
|
9
9
|
import styles from './styles.scss';
|
|
10
10
|
|
|
11
11
|
const BottomSheetButton = ( { onPress, disabled, text, color } ) => (
|
|
12
|
-
<TouchableOpacity
|
|
13
|
-
accessible={ true }
|
|
14
|
-
onPress={ onPress }
|
|
15
|
-
disabled={ disabled }
|
|
16
|
-
>
|
|
12
|
+
<TouchableOpacity accessible onPress={ onPress } disabled={ disabled }>
|
|
17
13
|
<View style={ { flexDirection: 'row', justifyContent: 'center' } }>
|
|
18
14
|
<Text style={ { ...styles.buttonText, color } }>{ text }</Text>
|
|
19
15
|
</View>
|
|
@@ -540,8 +540,8 @@ class BottomSheet extends Component {
|
|
|
540
540
|
}
|
|
541
541
|
onAccessibilityEscape={ this.onCloseBottomSheet }
|
|
542
542
|
testID="bottom-sheet"
|
|
543
|
-
hardwareAccelerated
|
|
544
|
-
useNativeDriverForBackdrop
|
|
543
|
+
hardwareAccelerated
|
|
544
|
+
useNativeDriverForBackdrop
|
|
545
545
|
{ ...rest }
|
|
546
546
|
>
|
|
547
547
|
<KeyboardAvoidingView
|
|
@@ -174,7 +174,7 @@ class BottomSheetStepperCell extends Component {
|
|
|
174
174
|
|
|
175
175
|
return (
|
|
176
176
|
<View
|
|
177
|
-
accessible
|
|
177
|
+
accessible
|
|
178
178
|
accessibilityRole="adjustable"
|
|
179
179
|
accessibilityLabel={ accessibilityLabel }
|
|
180
180
|
accessibilityHint={ getAccessibilityHint() }
|
|
@@ -214,7 +214,7 @@ class BottomSheetStepperCell extends Component {
|
|
|
214
214
|
icon={ icon }
|
|
215
215
|
label={ label }
|
|
216
216
|
labelStyle={ labelStyle }
|
|
217
|
-
leftAlign
|
|
217
|
+
leftAlign
|
|
218
218
|
separatorType={ separatorType }
|
|
219
219
|
disabled={ disabled }
|
|
220
220
|
>
|
|
@@ -82,7 +82,7 @@ const BottomSheetTextControl = ( {
|
|
|
82
82
|
label={ label }
|
|
83
83
|
onChangeText={ ( text ) => onChange( text ) }
|
|
84
84
|
defaultValue={ initialValue }
|
|
85
|
-
multiline
|
|
85
|
+
multiline
|
|
86
86
|
placeholder={ placeholder }
|
|
87
87
|
placeholderTextColor={ '#87a6bc' }
|
|
88
88
|
style={ textEditorStyle }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { Image as RNImage, Text, View } from 'react-native';
|
|
5
5
|
import FastImage from 'react-native-fast-image';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -11,7 +11,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
11
11
|
import { Icon } from '@wordpress/components';
|
|
12
12
|
import { image, offline } from '@wordpress/icons';
|
|
13
13
|
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
14
|
-
import { useEffect, useState,
|
|
14
|
+
import { useEffect, useState, Platform } from '@wordpress/element';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Internal dependencies
|
|
@@ -218,19 +218,8 @@ const ImageComponent = ( {
|
|
|
218
218
|
focalPoint && styles.focalPointContainer,
|
|
219
219
|
];
|
|
220
220
|
|
|
221
|
-
const opacityValue = useRef( new Animated.Value( 1 ) ).current;
|
|
222
|
-
|
|
223
|
-
useEffect( () => {
|
|
224
|
-
Animated.timing( opacityValue, {
|
|
225
|
-
toValue: isUploadInProgress ? 0.3 : 1,
|
|
226
|
-
duration: 100,
|
|
227
|
-
useNativeDriver: true,
|
|
228
|
-
} ).start();
|
|
229
|
-
}, [ isUploadInProgress, opacityValue ] );
|
|
230
|
-
|
|
231
221
|
const imageStyles = [
|
|
232
222
|
{
|
|
233
|
-
opacity: opacityValue,
|
|
234
223
|
height: containerSize?.height,
|
|
235
224
|
},
|
|
236
225
|
! resizeMode && {
|
|
@@ -300,13 +289,9 @@ const ImageComponent = ( {
|
|
|
300
289
|
key={ url }
|
|
301
290
|
style={ imageContainerStyles }
|
|
302
291
|
>
|
|
303
|
-
{ isSelected &&
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
isUploadInProgress ||
|
|
307
|
-
isUploadFailed ||
|
|
308
|
-
isUploadPaused
|
|
309
|
-
) && <View style={ imageSelectedStyles } /> }
|
|
292
|
+
{ isSelected && highlightSelected && (
|
|
293
|
+
<View style={ imageSelectedStyles } />
|
|
294
|
+
) }
|
|
310
295
|
|
|
311
296
|
{ ! imageData ? (
|
|
312
297
|
<View style={ placeholderStyles }>
|
|
@@ -319,7 +304,7 @@ const ImageComponent = ( {
|
|
|
319
304
|
{ Platform.isAndroid && (
|
|
320
305
|
<>
|
|
321
306
|
{ networkImageLoaded && networkURL && (
|
|
322
|
-
<
|
|
307
|
+
<Image
|
|
323
308
|
style={ imageStyles }
|
|
324
309
|
fadeDuration={ 0 }
|
|
325
310
|
source={ { uri: networkURL } }
|
|
@@ -331,7 +316,7 @@ const ImageComponent = ( {
|
|
|
331
316
|
/>
|
|
332
317
|
) }
|
|
333
318
|
{ ! networkImageLoaded && ! networkURL && (
|
|
334
|
-
<
|
|
319
|
+
<Image
|
|
335
320
|
style={ imageStyles }
|
|
336
321
|
fadeDuration={ 0 }
|
|
337
322
|
source={ { uri: localURL } }
|
|
@@ -345,7 +330,7 @@ const ImageComponent = ( {
|
|
|
345
330
|
) }
|
|
346
331
|
{ Platform.isIOS && (
|
|
347
332
|
<>
|
|
348
|
-
<
|
|
333
|
+
<Image
|
|
349
334
|
style={ imageStyles }
|
|
350
335
|
source={ {
|
|
351
336
|
uri:
|
|
@@ -103,7 +103,7 @@ export class MediaEdit extends Component {
|
|
|
103
103
|
hideCancelButton
|
|
104
104
|
ref={ ( instance ) => ( this.picker = instance ) }
|
|
105
105
|
options={ this.getMediaOptionsItems() }
|
|
106
|
-
leftAlign
|
|
106
|
+
leftAlign
|
|
107
107
|
onChange={ this.onPickerSelect }
|
|
108
108
|
// translators: %s: block title e.g: "Paragraph".
|
|
109
109
|
title={ __( 'Media options' ) }
|
package/src/modal/index.tsx
CHANGED
|
@@ -41,6 +41,7 @@ import * as ariaHelper from './aria-helper';
|
|
|
41
41
|
import Button from '../button';
|
|
42
42
|
import StyleProvider from '../style-provider';
|
|
43
43
|
import type { ModalProps } from './types';
|
|
44
|
+
import { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';
|
|
44
45
|
|
|
45
46
|
// Used to track and dismiss the prior modal when another opens unless nested.
|
|
46
47
|
const ModalContext = createContext<
|
|
@@ -196,17 +197,6 @@ function UnforwardedModal(
|
|
|
196
197
|
}, [ isContentScrollable, childrenContainerRef ] );
|
|
197
198
|
|
|
198
199
|
function handleEscapeKeyDown( event: KeyboardEvent< HTMLDivElement > ) {
|
|
199
|
-
if (
|
|
200
|
-
// Ignore keydowns from IMEs
|
|
201
|
-
event.nativeEvent.isComposing ||
|
|
202
|
-
// Workaround for Mac Safari where the final Enter/Backspace of an IME composition
|
|
203
|
-
// is `isComposing=false`, even though it's technically still part of the composition.
|
|
204
|
-
// These can only be detected by keyCode.
|
|
205
|
-
event.keyCode === 229
|
|
206
|
-
) {
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
200
|
if (
|
|
211
201
|
shouldCloseOnEsc &&
|
|
212
202
|
( event.code === 'Escape' || event.key === 'Escape' ) &&
|
|
@@ -265,7 +255,7 @@ function UnforwardedModal(
|
|
|
265
255
|
'components-modal__screen-overlay',
|
|
266
256
|
overlayClassName
|
|
267
257
|
) }
|
|
268
|
-
onKeyDown={ handleEscapeKeyDown }
|
|
258
|
+
onKeyDown={ withIgnoreIMEEvents( handleEscapeKeyDown ) }
|
|
269
259
|
{ ...( shouldCloseOnClickOutside ? overlayPressHandlers : {} ) }
|
|
270
260
|
>
|
|
271
261
|
<StyleProvider document={ document }>
|
package/src/modal/style.scss
CHANGED
package/src/modal/test/index.tsx
CHANGED
|
@@ -335,7 +335,7 @@ describe( 'Modal', () => {
|
|
|
335
335
|
it( 'should focus the Modal dialog when `true` passed as value for `focusOnMount` prop', async () => {
|
|
336
336
|
const user = userEvent.setup();
|
|
337
337
|
|
|
338
|
-
render( <FocusMountDemo focusOnMount
|
|
338
|
+
render( <FocusMountDemo focusOnMount /> );
|
|
339
339
|
|
|
340
340
|
const opener = screen.getByRole( 'button', {
|
|
341
341
|
name: 'Toggle Modal',
|
|
@@ -42,11 +42,7 @@ export const HideIfEmptyStory: StoryFn< typeof Navigation > = ( {
|
|
|
42
42
|
/>
|
|
43
43
|
</NavigationMenu>
|
|
44
44
|
|
|
45
|
-
<NavigationMenu
|
|
46
|
-
menu="root-sub-1"
|
|
47
|
-
parentMenu="root"
|
|
48
|
-
isEmpty={ true }
|
|
49
|
-
/>
|
|
45
|
+
<NavigationMenu menu="root-sub-1" parentMenu="root" isEmpty />
|
|
50
46
|
<NavigationMenu
|
|
51
47
|
menu="root-sub-2"
|
|
52
48
|
parentMenu="root"
|
|
@@ -57,7 +53,7 @@ export const HideIfEmptyStory: StoryFn< typeof Navigation > = ( {
|
|
|
57
53
|
<NavigationMenu
|
|
58
54
|
menu="root-sub-1-sub-1"
|
|
59
55
|
parentMenu="root-sub-1"
|
|
60
|
-
isEmpty
|
|
56
|
+
isEmpty
|
|
61
57
|
/>
|
|
62
58
|
</Navigation>
|
|
63
59
|
|
|
@@ -592,14 +592,14 @@ export function PaletteEdit( {
|
|
|
592
592
|
gradients={ gradients }
|
|
593
593
|
onChange={ onSelectPaletteItem }
|
|
594
594
|
clearable={ false }
|
|
595
|
-
disableCustomGradients
|
|
595
|
+
disableCustomGradients
|
|
596
596
|
/>
|
|
597
597
|
) : (
|
|
598
598
|
<ColorPalette
|
|
599
599
|
colors={ colors }
|
|
600
600
|
onChange={ onSelectPaletteItem }
|
|
601
601
|
clearable={ false }
|
|
602
|
-
disableCustomColors
|
|
602
|
+
disableCustomColors
|
|
603
603
|
/>
|
|
604
604
|
) ) }
|
|
605
605
|
</>
|