@wordpress/components 27.4.0 → 27.5.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 +27 -1
- package/build/alignment-matrix-control/index.js +3 -1
- package/build/alignment-matrix-control/index.js.map +1 -1
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +8 -8
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build/alignment-matrix-control/utils.js +6 -2
- package/build/alignment-matrix-control/utils.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +3 -1
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/index.js +21 -7
- package/build/autocomplete/index.js.map +1 -1
- package/build/checkbox-control/index.js +9 -2
- package/build/checkbox-control/index.js.map +1 -1
- package/build/color-picker/hex-input.js +3 -1
- package/build/color-picker/hex-input.js.map +1 -1
- package/build/color-picker/hue-picker.native.js +6 -2
- package/build/color-picker/hue-picker.native.js.map +1 -1
- package/build/color-picker/index.native.js +9 -3
- package/build/color-picker/index.native.js.map +1 -1
- package/build/color-picker/saturation-picker.native.js +6 -2
- package/build/color-picker/saturation-picker.native.js.map +1 -1
- package/build/color-picker/use-deprecated-props.js +9 -3
- package/build/color-picker/use-deprecated-props.js.map +1 -1
- package/build/context/context-connect.js +6 -2
- package/build/context/context-connect.js.map +1 -1
- package/build/custom-select-control-v2/legacy-component/index.js +3 -1
- package/build/custom-select-control-v2/legacy-component/index.js.map +1 -1
- package/build/drop-zone/index.js +72 -64
- package/build/drop-zone/index.js.map +1 -1
- package/build/dropdown/styles.js +5 -3
- package/build/dropdown/styles.js.map +1 -1
- package/build/duotone-picker/utils.js +3 -1
- package/build/duotone-picker/utils.js.map +1 -1
- package/build/elevation/hook.js +5 -6
- package/build/elevation/hook.js.map +1 -1
- package/build/focal-point-picker/controls.js +3 -1
- package/build/focal-point-picker/controls.js.map +1 -1
- package/build/focal-point-picker/index.js +21 -7
- package/build/focal-point-picker/index.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-picker-style.js +12 -12
- package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build/focal-point-picker/tooltip/index.native.js +3 -8
- package/build/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build/focal-point-picker/utils.js +3 -1
- package/build/focal-point-picker/utils.js.map +1 -1
- package/build/font-size-picker/index.js +3 -2
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/types.js.map +1 -1
- package/build/input-control/input-field.js +3 -1
- package/build/input-control/input-field.js.map +1 -1
- package/build/input-control/label.js +3 -1
- package/build/input-control/label.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +31 -23
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/input-control/utils.js +8 -4
- package/build/input-control/utils.js.map +1 -1
- package/build/item-group/item/hook.js +0 -4
- package/build/item-group/item/hook.js.map +1 -1
- package/build/mobile/gradient/index.native.js +3 -1
- package/build/mobile/gradient/index.native.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.android.js +9 -3
- package/build/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.ios.js +15 -13
- package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/shared.native.js +33 -0
- package/build/mobile/keyboard-aware-flat-list/shared.native.js.map +1 -0
- package/build/modal/aria-helper.js +9 -3
- package/build/modal/aria-helper.js.map +1 -1
- package/build/modal/index.js +6 -2
- package/build/modal/index.js.map +1 -1
- package/build/navigation/styles/navigation-styles.js +12 -12
- package/build/navigation/styles/navigation-styles.js.map +1 -1
- package/build/panel/body.js +3 -1
- package/build/panel/body.js.map +1 -1
- package/build/popover/index.js +3 -1
- package/build/popover/index.js.map +1 -1
- package/build/popover/overlay-middlewares.js +3 -1
- package/build/popover/overlay-middlewares.js.map +1 -1
- package/build/query-controls/author-select.js +3 -1
- package/build/query-controls/author-select.js.map +1 -1
- package/build/range-control/rail.js +1 -1
- package/build/range-control/rail.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +29 -29
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/resizable-box/resize-tooltip/index.js +3 -1
- package/build/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/label.js +3 -1
- package/build/resizable-box/resize-tooltip/label.js.map +1 -1
- package/build/resizable-box/resize-tooltip/utils.js +12 -4
- package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build/select-control/index.js +3 -1
- package/build/select-control/index.js.map +1 -1
- package/build/select-control/styles/select-control-styles.js +8 -6
- package/build/select-control/styles/select-control-styles.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-context.js +3 -3
- package/build/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +3 -3
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/use-slot-fills.js +2 -2
- package/build/slot-fill/bubbles-virtually/use-slot-fills.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/use-slot.js +2 -2
- package/build/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
- package/build/slot-fill/types.js.map +1 -1
- package/build/text/get-line-height.js +6 -2
- package/build/text/get-line-height.js.map +1 -1
- package/build/text/utils.js +6 -2
- package/build/text/utils.js.map +1 -1
- package/build/theme/color-algorithms.js +6 -2
- package/build/theme/color-algorithms.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/component.js +3 -1
- package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js +9 -9
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build/tree-grid/roving-tab-index-item.js +3 -1
- package/build/tree-grid/roving-tab-index-item.js.map +1 -1
- package/build/unit-control/index.js +3 -1
- package/build/unit-control/index.js.map +1 -1
- package/build/utils/colors.js +21 -7
- package/build/utils/colors.js.map +1 -1
- package/build/utils/font-size.js +3 -1
- package/build/utils/font-size.js.map +1 -1
- package/build/utils/get-valid-children.js +3 -1
- package/build/utils/get-valid-children.js.map +1 -1
- package/build/utils/input/base.js +2 -3
- package/build/utils/input/base.js.map +1 -1
- package/build/utils/strings.js +11 -57
- package/build/utils/strings.js.map +1 -1
- package/build/utils/use-responsive-value.js +3 -1
- package/build/utils/use-responsive-value.js.map +1 -1
- package/build/view/component.js +26 -8
- package/build/view/component.js.map +1 -1
- package/build-module/alignment-matrix-control/index.js +3 -1
- package/build-module/alignment-matrix-control/index.js.map +1 -1
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -9
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build-module/alignment-matrix-control/utils.js +6 -2
- package/build-module/alignment-matrix-control/utils.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +3 -1
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/index.js +21 -7
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/checkbox-control/index.js +9 -2
- package/build-module/checkbox-control/index.js.map +1 -1
- package/build-module/color-picker/hex-input.js +3 -1
- package/build-module/color-picker/hex-input.js.map +1 -1
- package/build-module/color-picker/hue-picker.native.js +6 -2
- package/build-module/color-picker/hue-picker.native.js.map +1 -1
- package/build-module/color-picker/index.native.js +9 -3
- package/build-module/color-picker/index.native.js.map +1 -1
- package/build-module/color-picker/saturation-picker.native.js +6 -2
- package/build-module/color-picker/saturation-picker.native.js.map +1 -1
- package/build-module/color-picker/use-deprecated-props.js +9 -3
- package/build-module/color-picker/use-deprecated-props.js.map +1 -1
- package/build-module/context/context-connect.js +6 -2
- package/build-module/context/context-connect.js.map +1 -1
- package/build-module/custom-select-control-v2/legacy-component/index.js +3 -1
- package/build-module/custom-select-control-v2/legacy-component/index.js.map +1 -1
- package/build-module/drop-zone/index.js +72 -64
- package/build-module/drop-zone/index.js.map +1 -1
- package/build-module/dropdown/styles.js +5 -3
- package/build-module/dropdown/styles.js.map +1 -1
- package/build-module/duotone-picker/utils.js +3 -1
- package/build-module/duotone-picker/utils.js.map +1 -1
- package/build-module/elevation/hook.js +6 -7
- package/build-module/elevation/hook.js.map +1 -1
- package/build-module/focal-point-picker/controls.js +3 -1
- package/build-module/focal-point-picker/controls.js.map +1 -1
- package/build-module/focal-point-picker/index.js +21 -7
- package/build-module/focal-point-picker/index.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js +13 -13
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build-module/focal-point-picker/tooltip/index.native.js +3 -8
- package/build-module/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build-module/focal-point-picker/utils.js +3 -1
- package/build-module/focal-point-picker/utils.js.map +1 -1
- package/build-module/font-size-picker/index.js +3 -2
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/types.js.map +1 -1
- package/build-module/input-control/input-field.js +3 -1
- package/build-module/input-control/input-field.js.map +1 -1
- package/build-module/input-control/label.js +3 -1
- package/build-module/input-control/label.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +31 -23
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/input-control/utils.js +8 -4
- package/build-module/input-control/utils.js.map +1 -1
- package/build-module/item-group/item/hook.js +0 -4
- package/build-module/item-group/item/hook.js.map +1 -1
- package/build-module/mobile/gradient/index.native.js +3 -1
- package/build-module/mobile/gradient/index.native.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js +9 -3
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js +16 -15
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/shared.native.js +27 -0
- package/build-module/mobile/keyboard-aware-flat-list/shared.native.js.map +1 -0
- package/build-module/modal/aria-helper.js +9 -3
- package/build-module/modal/aria-helper.js.map +1 -1
- package/build-module/modal/index.js +6 -2
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigation/styles/navigation-styles.js +13 -13
- package/build-module/navigation/styles/navigation-styles.js.map +1 -1
- package/build-module/panel/body.js +3 -1
- package/build-module/panel/body.js.map +1 -1
- package/build-module/popover/index.js +3 -1
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/overlay-middlewares.js +3 -1
- package/build-module/popover/overlay-middlewares.js.map +1 -1
- package/build-module/query-controls/author-select.js +3 -1
- package/build-module/query-controls/author-select.js.map +1 -1
- package/build-module/range-control/rail.js +1 -1
- package/build-module/range-control/rail.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +30 -30
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/index.js +3 -1
- package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/label.js +3 -1
- package/build-module/resizable-box/resize-tooltip/label.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/utils.js +12 -4
- package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build-module/select-control/index.js +3 -1
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/select-control/styles/select-control-styles.js +8 -6
- package/build-module/select-control/styles/select-control-styles.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js +2 -1
- 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 +1 -1
- 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 +1 -1
- package/build-module/slot-fill/bubbles-virtually/use-slot-fills.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/use-slot.js +1 -1
- package/build-module/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
- package/build-module/slot-fill/types.js.map +1 -1
- package/build-module/text/get-line-height.js +6 -2
- package/build-module/text/get-line-height.js.map +1 -1
- package/build-module/text/utils.js +6 -2
- package/build-module/text/utils.js.map +1 -1
- package/build-module/theme/color-algorithms.js +6 -2
- package/build-module/theme/color-algorithms.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +3 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +10 -10
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build-module/tree-grid/roving-tab-index-item.js +3 -1
- package/build-module/tree-grid/roving-tab-index-item.js.map +1 -1
- package/build-module/unit-control/index.js +3 -1
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/utils/colors.js +21 -7
- package/build-module/utils/colors.js.map +1 -1
- package/build-module/utils/font-size.js +3 -1
- package/build-module/utils/font-size.js.map +1 -1
- package/build-module/utils/get-valid-children.js +3 -1
- package/build-module/utils/get-valid-children.js.map +1 -1
- package/build-module/utils/input/base.js +2 -3
- package/build-module/utils/input/base.js.map +1 -1
- package/build-module/utils/strings.js +12 -57
- package/build-module/utils/strings.js.map +1 -1
- package/build-module/utils/use-responsive-value.js +3 -1
- package/build-module/utils/use-responsive-value.js.map +1 -1
- package/build-module/view/component.js +26 -8
- package/build-module/view/component.js.map +1 -1
- package/build-style/style-rtl.css +39 -36
- package/build-style/style.css +39 -36
- package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/utils.d.ts.map +1 -1
- package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +4 -4
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +4 -4
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +4 -4
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +4 -4
- package/build-types/border-control/border-control/hook.d.ts +4 -4
- package/build-types/border-control/border-control-dropdown/hook.d.ts +4 -4
- package/build-types/box-control/stories/index.story.d.ts +24 -24
- package/build-types/card/card/hook.d.ts +4 -4
- package/build-types/card/card-body/hook.d.ts +4 -4
- package/build-types/card/card-divider/hook.d.ts +4 -4
- package/build-types/card/card-footer/hook.d.ts +4 -4
- package/build-types/card/card-header/hook.d.ts +4 -4
- package/build-types/card/card-media/hook.d.ts +4 -4
- package/build-types/checkbox-control/index.d.ts.map +1 -1
- package/build-types/color-picker/hex-input.d.ts.map +1 -1
- package/build-types/color-picker/use-deprecated-props.d.ts.map +1 -1
- package/build-types/context/context-connect.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/legacy-component/index.d.ts.map +1 -1
- package/build-types/drop-zone/index.d.ts.map +1 -1
- package/build-types/dropdown/styles.d.ts.map +1 -1
- package/build-types/duotone-picker/utils.d.ts.map +1 -1
- package/build-types/elevation/hook.d.ts +4 -4
- package/build-types/elevation/hook.d.ts.map +1 -1
- package/build-types/flex/flex/hook.d.ts +4 -4
- package/build-types/flex/flex-block/hook.d.ts +4 -4
- package/build-types/flex/flex-item/hook.d.ts +4 -4
- package/build-types/focal-point-picker/controls.d.ts.map +1 -1
- package/build-types/focal-point-picker/index.d.ts.map +1 -1
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -1
- package/build-types/focal-point-picker/utils.d.ts.map +1 -1
- package/build-types/font-size-picker/index.d.ts.map +1 -1
- package/build-types/font-size-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/font-size-picker/types.d.ts +2 -0
- package/build-types/font-size-picker/types.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +4 -4
- package/build-types/h-stack/hook.d.ts +4 -4
- package/build-types/heading/hook.d.ts +4 -4
- package/build-types/input-control/input-field.d.ts.map +1 -1
- package/build-types/input-control/label.d.ts.map +1 -1
- package/build-types/input-control/stories/index.story.d.ts +2 -1
- package/build-types/input-control/stories/index.story.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/input-control/utils.d.ts.map +1 -1
- package/build-types/item-group/item/hook.d.ts +5 -5
- package/build-types/item-group/item/hook.d.ts.map +1 -1
- package/build-types/item-group/item-group/hook.d.ts +4 -4
- package/build-types/modal/aria-helper.d.ts.map +1 -1
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +4 -4
- package/build-types/navigator/navigator-button/hook.d.ts +4 -4
- package/build-types/palette-edit/styles.d.ts +749 -10
- package/build-types/palette-edit/styles.d.ts.map +1 -1
- package/build-types/panel/body.d.ts.map +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/overlay-middlewares.d.ts.map +1 -1
- package/build-types/popover/stories/index.story.d.ts.map +1 -1
- package/build-types/query-controls/author-select.d.ts.map +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/label.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
- package/build-types/scrollable/hook.d.ts +4 -4
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- 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.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts.map +1 -1
- package/build-types/slot-fill/types.d.ts +2 -2
- package/build-types/slot-fill/types.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +4 -4
- package/build-types/surface/hook.d.ts +4 -4
- package/build-types/text/get-line-height.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +4 -4
- package/build-types/text/utils.d.ts.map +1 -1
- package/build-types/text-control/index.d.ts +1 -1
- package/build-types/theme/color-algorithms.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +4 -4
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +4 -4
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +4 -4
- package/build-types/tree-grid/roving-tab-index-item.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +4 -4
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/utils/colors.d.ts.map +1 -1
- package/build-types/utils/font-size.d.ts.map +1 -1
- package/build-types/utils/get-valid-children.d.ts.map +1 -1
- package/build-types/utils/input/base.d.ts.map +1 -1
- package/build-types/utils/strings.d.ts.map +1 -1
- package/build-types/utils/use-responsive-value.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +4 -4
- package/build-types/view/component.d.ts +253 -7
- package/build-types/view/component.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/alignment-matrix-control/index.tsx +3 -1
- package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.ts +4 -3
- package/src/alignment-matrix-control/utils.tsx +6 -2
- package/src/autocomplete/autocompleter-ui.tsx +3 -1
- package/src/autocomplete/index.tsx +21 -7
- package/src/autocomplete/style.scss +10 -4
- package/src/box-control/test/index.tsx +22 -0
- package/src/card/test/__snapshots__/index.tsx.snap +44 -47
- package/src/checkbox-control/index.tsx +44 -35
- package/src/checkbox-control/style.scss +12 -1
- package/src/checkbox-control/test/__snapshots__/index.tsx.snap +27 -26
- package/src/checkbox-control/test/index.tsx +5 -0
- package/src/color-picker/hex-input.tsx +3 -1
- package/src/color-picker/hue-picker.native.js +6 -2
- package/src/color-picker/index.native.js +9 -3
- package/src/color-picker/saturation-picker.native.js +6 -2
- package/src/color-picker/use-deprecated-props.ts +9 -3
- package/src/context/context-connect.ts +6 -2
- package/src/custom-select-control-v2/README.md +0 -4
- package/src/custom-select-control-v2/legacy-component/index.tsx +3 -1
- package/src/custom-select-control-v2/stories/default.story.tsx +1 -1
- package/src/custom-select-control-v2/stories/legacy.story.tsx +1 -1
- package/src/drop-zone/index.tsx +66 -66
- package/src/dropdown/styles.ts +3 -1
- package/src/duotone-picker/utils.ts +3 -1
- package/src/elevation/hook.ts +6 -3
- package/src/elevation/test/__snapshots__/index.tsx.snap +18 -24
- package/src/flex/test/__snapshots__/index.tsx.snap +4 -4
- package/src/focal-point-picker/controls.tsx +3 -1
- package/src/focal-point-picker/index.tsx +20 -7
- package/src/focal-point-picker/styles/focal-point-picker-style.ts +4 -3
- package/src/focal-point-picker/tooltip/index.native.js +1 -7
- package/src/focal-point-picker/utils.ts +3 -1
- package/src/font-size-picker/README.md +1 -0
- package/src/font-size-picker/index.tsx +4 -2
- package/src/font-size-picker/stories/index.story.tsx +0 -1
- package/src/font-size-picker/types.ts +2 -0
- package/src/higher-order/navigate-regions/style.scss +3 -3
- package/src/input-control/input-field.tsx +3 -1
- package/src/input-control/label.tsx +3 -1
- package/src/input-control/stories/index.story.tsx +31 -1
- package/src/input-control/styles/input-control-styles.tsx +12 -4
- package/src/input-control/test/index.js +8 -4
- package/src/input-control/utils.ts +3 -2
- package/src/item-group/item/hook.ts +1 -10
- package/src/item-group/test/__snapshots__/index.js.snap +16 -16
- package/src/mobile/gradient/index.native.js +3 -1
- package/src/mobile/keyboard-aware-flat-list/index.android.js +11 -2
- package/src/mobile/keyboard-aware-flat-list/index.ios.js +30 -19
- package/src/mobile/keyboard-aware-flat-list/shared.native.js +26 -0
- package/src/mobile/keyboard-aware-flat-list/styles.native.scss +8 -0
- package/src/modal/aria-helper.ts +8 -3
- package/src/modal/index.tsx +6 -2
- package/src/modal/test/index.tsx +11 -4
- package/src/navigation/styles/navigation-styles.tsx +4 -3
- package/src/panel/body.tsx +3 -1
- package/src/panel/style.scss +1 -0
- package/src/placeholder/style.scss +12 -34
- package/src/popover/index.tsx +2 -1
- package/src/popover/overlay-middlewares.tsx +3 -1
- package/src/popover/stories/index.story.tsx +0 -2
- package/src/query-controls/author-select.tsx +3 -1
- package/src/range-control/rail.tsx +1 -1
- package/src/range-control/styles/range-control-styles.ts +5 -3
- package/src/resizable-box/resize-tooltip/index.tsx +3 -1
- package/src/resizable-box/resize-tooltip/label.tsx +3 -1
- package/src/resizable-box/resize-tooltip/utils.ts +12 -4
- package/src/select-control/index.tsx +3 -1
- package/src/select-control/styles/select-control-styles.ts +3 -1
- package/src/slot-fill/bubbles-virtually/slot-fill-context.ts +2 -1
- package/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx +1 -1
- package/src/slot-fill/bubbles-virtually/use-slot-fills.ts +1 -1
- package/src/slot-fill/bubbles-virtually/use-slot.ts +1 -1
- package/src/slot-fill/types.ts +2 -2
- package/src/surface/test/__snapshots__/index.tsx.snap +10 -10
- package/src/text/get-line-height.ts +6 -2
- package/src/text/utils.ts +6 -2
- package/src/theme/color-algorithms.ts +6 -2
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +18 -24
- package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +3 -1
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +7 -6
- package/src/toolbar/toolbar/style.scss +2 -2
- package/src/tree-grid/roving-tab-index-item.tsx +3 -1
- package/src/unit-control/index.tsx +5 -1
- package/src/utils/colors.js +21 -7
- package/src/utils/font-size.ts +3 -1
- package/src/utils/get-valid-children.ts +3 -1
- package/src/utils/input/base.js +4 -3
- package/src/utils/strings.ts +11 -59
- package/src/utils/test/strings.js +62 -0
- package/src/utils/use-responsive-value.ts +2 -1
- package/src/view/component.tsx +18 -11
- package/tsconfig.json +1 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/slot-fill/bubbles-virtually/observable-map.js +0 -68
- package/build/slot-fill/bubbles-virtually/observable-map.js.map +0 -1
- package/build/view/types.js +0 -6
- package/build/view/types.js.map +0 -1
- package/build-module/slot-fill/bubbles-virtually/observable-map.js +0 -60
- package/build-module/slot-fill/bubbles-virtually/observable-map.js.map +0 -1
- package/build-module/view/types.js +0 -2
- package/build-module/view/types.js.map +0 -1
- package/build-types/slot-fill/bubbles-virtually/observable-map.d.ts +0 -19
- package/build-types/slot-fill/bubbles-virtually/observable-map.d.ts.map +0 -1
- package/build-types/view/types.d.ts +0 -8
- package/build-types/view/types.d.ts.map +0 -1
- package/src/slot-fill/bubbles-virtually/observable-map.ts +0 -79
- package/src/slot-fill/test/observable-map.js +0 -83
- package/src/utils/hooks/stories/use-cx.js +0 -157
- package/src/view/types.ts +0 -6
|
@@ -54,7 +54,7 @@ function Tooltip( { children, onPress, style, visible } ) {
|
|
|
54
54
|
);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
function Label( { align, text, xOffset, yOffset } ) {
|
|
57
|
+
function Label( { align = 'center', text, xOffset = 0, yOffset = 0 } ) {
|
|
58
58
|
const animationValue = useRef( new Animated.Value( 0 ) ).current;
|
|
59
59
|
const [ dimensions, setDimensions ] = useState( null );
|
|
60
60
|
const visible = useContext( TooltipContext );
|
|
@@ -139,12 +139,6 @@ function Label( { align, text, xOffset, yOffset } ) {
|
|
|
139
139
|
);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
Label.defaultProps = {
|
|
143
|
-
align: 'center',
|
|
144
|
-
xOffset: 0,
|
|
145
|
-
yOffset: 0,
|
|
146
|
-
};
|
|
147
|
-
|
|
148
142
|
Tooltip.Label = Label;
|
|
149
143
|
|
|
150
144
|
export default Tooltip;
|
|
@@ -34,7 +34,9 @@ export function getExtension( filename = '' ): string {
|
|
|
34
34
|
* @return Whether the file is a video.
|
|
35
35
|
*/
|
|
36
36
|
export function isVideoType( filename: string = '' ): boolean {
|
|
37
|
-
if ( ! filename )
|
|
37
|
+
if ( ! filename ) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
38
40
|
return (
|
|
39
41
|
filename.startsWith( 'data:video/' ) ||
|
|
40
42
|
VIDEO_EXTENSIONS.includes( getExtension( filename ) )
|
|
@@ -36,6 +36,8 @@ import FontSizePickerSelect from './font-size-picker-select';
|
|
|
36
36
|
import FontSizePickerToggleGroup from './font-size-picker-toggle-group';
|
|
37
37
|
import { T_SHIRT_NAMES } from './constants';
|
|
38
38
|
|
|
39
|
+
const DEFAULT_UNITS = [ 'px', 'em', 'rem' ];
|
|
40
|
+
|
|
39
41
|
const UnforwardedFontSizePicker = (
|
|
40
42
|
props: FontSizePickerProps,
|
|
41
43
|
ref: ForwardedRef< any >
|
|
@@ -47,14 +49,14 @@ const UnforwardedFontSizePicker = (
|
|
|
47
49
|
disableCustomFontSizes = false,
|
|
48
50
|
onChange,
|
|
49
51
|
size = 'default',
|
|
50
|
-
units: unitsProp,
|
|
52
|
+
units: unitsProp = DEFAULT_UNITS,
|
|
51
53
|
value,
|
|
52
54
|
withSlider = false,
|
|
53
55
|
withReset = true,
|
|
54
56
|
} = props;
|
|
55
57
|
|
|
56
58
|
const units = useCustomUnits( {
|
|
57
|
-
availableUnits: unitsProp
|
|
59
|
+
availableUnits: unitsProp,
|
|
58
60
|
} );
|
|
59
61
|
|
|
60
62
|
const shouldUseSelectControl = fontSizes.length > 5;
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
|
|
30
30
|
// Header top bar when Distraction free mode is on.
|
|
31
31
|
&.is-distraction-free .interface-interface-skeleton__header .edit-post-header,
|
|
32
|
-
.interface-interface-skeleton__sidebar .
|
|
33
|
-
.interface-interface-skeleton__actions .
|
|
34
|
-
.interface-interface-skeleton__actions .
|
|
32
|
+
.interface-interface-skeleton__sidebar .editor-layout__toggle-sidebar-panel,
|
|
33
|
+
.interface-interface-skeleton__actions .editor-layout__toggle-publish-panel,
|
|
34
|
+
.interface-interface-skeleton__actions .editor-layout__toggle-entities-saved-states-panel,
|
|
35
35
|
.editor-post-publish-panel {
|
|
36
36
|
outline: 4px solid $components-color-accent;
|
|
37
37
|
outline-offset: -4px;
|
|
@@ -15,7 +15,9 @@ export default function Label( {
|
|
|
15
15
|
htmlFor,
|
|
16
16
|
...props
|
|
17
17
|
}: WordPressComponentProps< InputControlLabelProps, 'label', false > ) {
|
|
18
|
-
if ( ! children )
|
|
18
|
+
if ( ! children ) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
19
21
|
|
|
20
22
|
if ( hideLabelFromVision ) {
|
|
21
23
|
return (
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import type { Meta, StoryFn } from '@storybook/react';
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* WordPress dependencies
|
|
7
|
+
*/
|
|
8
|
+
import { seen, unseen } from '@wordpress/icons';
|
|
9
|
+
import { useState } from '@wordpress/element';
|
|
6
10
|
/**
|
|
7
11
|
* Internal dependencies
|
|
8
12
|
*/
|
|
9
13
|
import InputControl from '..';
|
|
10
14
|
import { InputControlPrefixWrapper } from '../input-prefix-wrapper';
|
|
11
15
|
import { InputControlSuffixWrapper } from '../input-suffix-wrapper';
|
|
16
|
+
import Button from '../../button';
|
|
12
17
|
|
|
13
18
|
const meta: Meta< typeof InputControl > = {
|
|
14
19
|
title: 'Components (Experimental)/InputControl',
|
|
@@ -82,3 +87,28 @@ WithEdgeLabel.args = {
|
|
|
82
87
|
__unstableInputWidth: '20em',
|
|
83
88
|
labelPosition: 'edge',
|
|
84
89
|
};
|
|
90
|
+
|
|
91
|
+
export const ShowPassword: StoryFn< typeof InputControl > = ( args ) => {
|
|
92
|
+
const [ visible, setVisible ] = useState( false );
|
|
93
|
+
return (
|
|
94
|
+
<InputControl
|
|
95
|
+
type={ visible ? 'text' : 'password' }
|
|
96
|
+
label="Password"
|
|
97
|
+
suffix={
|
|
98
|
+
<InputControlSuffixWrapper>
|
|
99
|
+
<div style={ { display: 'flex' } }>
|
|
100
|
+
<Button
|
|
101
|
+
size="small"
|
|
102
|
+
icon={ visible ? unseen : seen }
|
|
103
|
+
onClick={ () => setVisible( ( value ) => ! value ) }
|
|
104
|
+
label={
|
|
105
|
+
visible ? 'Hide password' : 'Show password'
|
|
106
|
+
}
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
</InputControlSuffixWrapper>
|
|
110
|
+
}
|
|
111
|
+
{ ...args }
|
|
112
|
+
/>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
@@ -107,9 +107,13 @@ const containerWidthStyles = ( {
|
|
|
107
107
|
__unstableInputWidth,
|
|
108
108
|
labelPosition,
|
|
109
109
|
}: ContainerProps ) => {
|
|
110
|
-
if ( ! __unstableInputWidth )
|
|
110
|
+
if ( ! __unstableInputWidth ) {
|
|
111
|
+
return css( { width: '100%' } );
|
|
112
|
+
}
|
|
111
113
|
|
|
112
|
-
if ( labelPosition === 'side' )
|
|
114
|
+
if ( labelPosition === 'side' ) {
|
|
115
|
+
return '';
|
|
116
|
+
}
|
|
113
117
|
|
|
114
118
|
if ( labelPosition === 'edge' ) {
|
|
115
119
|
return css( {
|
|
@@ -143,7 +147,9 @@ type InputProps = {
|
|
|
143
147
|
};
|
|
144
148
|
|
|
145
149
|
const disabledStyles = ( { disabled }: InputProps ) => {
|
|
146
|
-
if ( ! disabled )
|
|
150
|
+
if ( ! disabled ) {
|
|
151
|
+
return '';
|
|
152
|
+
}
|
|
147
153
|
|
|
148
154
|
return css( {
|
|
149
155
|
color: COLORS.ui.textDisabled,
|
|
@@ -161,7 +167,9 @@ export const fontSizeStyles = ( { inputSize: size }: InputProps ) => {
|
|
|
161
167
|
const fontSize = sizes[ size as Size ] || sizes.default;
|
|
162
168
|
const fontSizeMobile = '16px';
|
|
163
169
|
|
|
164
|
-
if ( ! fontSize )
|
|
170
|
+
if ( ! fontSize ) {
|
|
171
|
+
return '';
|
|
172
|
+
}
|
|
165
173
|
|
|
166
174
|
return css`
|
|
167
175
|
font-size: ${ fontSizeMobile };
|
|
@@ -112,10 +112,13 @@ describe( 'InputControl', () => {
|
|
|
112
112
|
const onKeyDown = ( { key } ) => {
|
|
113
113
|
heldKeySet.add( key );
|
|
114
114
|
if ( key === 'Escape' ) {
|
|
115
|
-
if ( heldKeySet.has( 'Meta' ) )
|
|
116
|
-
|
|
115
|
+
if ( heldKeySet.has( 'Meta' ) ) {
|
|
116
|
+
setState( 'qux' );
|
|
117
|
+
} else if ( heldKeySet.has( 'Alt' ) ) {
|
|
117
118
|
setState( undefined );
|
|
118
|
-
else
|
|
119
|
+
} else {
|
|
120
|
+
setState( '' );
|
|
121
|
+
}
|
|
119
122
|
}
|
|
120
123
|
};
|
|
121
124
|
const onKeyUp = ( { key } ) => heldKeySet.delete( key );
|
|
@@ -204,8 +207,9 @@ describe( 'InputControl', () => {
|
|
|
204
207
|
if (
|
|
205
208
|
action.type === 'COMMIT' &&
|
|
206
209
|
action.payload.event.type === 'blur'
|
|
207
|
-
)
|
|
210
|
+
) {
|
|
208
211
|
value = value.replace( /\bnow\b/, 'meow' );
|
|
212
|
+
}
|
|
209
213
|
|
|
210
214
|
return { ...state, value };
|
|
211
215
|
} }
|
|
@@ -86,10 +86,11 @@ export function useDraft( props: {
|
|
|
86
86
|
useLayoutEffect( () => {
|
|
87
87
|
const { current: previousValue } = refPreviousValue;
|
|
88
88
|
refPreviousValue.current = props.value;
|
|
89
|
-
if ( draft.value !== undefined && ! draft.isStale )
|
|
89
|
+
if ( draft.value !== undefined && ! draft.isStale ) {
|
|
90
90
|
setDraft( { ...draft, isStale: true } );
|
|
91
|
-
else if ( draft.isStale && props.value !== previousValue )
|
|
91
|
+
} else if ( draft.isStale && props.value !== previousValue ) {
|
|
92
92
|
setDraft( {} );
|
|
93
|
+
}
|
|
93
94
|
}, [ props.value, draft ] );
|
|
94
95
|
|
|
95
96
|
const onChange: InputChangeCallback = ( nextValue, extra ) => {
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { ElementType } from 'react';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -32,11 +27,7 @@ export function useItem( props: WordPressComponentProps< ItemProps, 'div' > ) {
|
|
|
32
27
|
|
|
33
28
|
const size = sizeProp || contextSize;
|
|
34
29
|
|
|
35
|
-
const as =
|
|
36
|
-
asProp ||
|
|
37
|
-
( ( typeof onClick !== 'undefined'
|
|
38
|
-
? 'button'
|
|
39
|
-
: 'div' ) as ElementType );
|
|
30
|
+
const as = asProp || ( typeof onClick !== 'undefined' ? 'button' : 'div' );
|
|
40
31
|
|
|
41
32
|
const cx = useCx();
|
|
42
33
|
|
|
@@ -11,8 +11,8 @@ Snapshot Diff:
|
|
|
11
11
|
role="listitem"
|
|
12
12
|
>
|
|
13
13
|
<div
|
|
14
|
-
- class="components-item css-
|
|
15
|
-
+ class="components-item css-
|
|
14
|
+
- class="components-item css-au4yox-PolymorphicDiv-medium-item-spacedAround e19lxcc00"
|
|
15
|
+
+ class="components-item css-1h3jinl-PolymorphicDiv-large-item-spacedAround e19lxcc00"
|
|
16
16
|
data-wp-c16t="true"
|
|
17
17
|
data-wp-component="Item"
|
|
18
18
|
>
|
|
@@ -24,8 +24,8 @@ Snapshot Diff:
|
|
|
24
24
|
role="listitem"
|
|
25
25
|
>
|
|
26
26
|
<div
|
|
27
|
-
- class="components-item css-
|
|
28
|
-
+ class="components-item css-
|
|
27
|
+
- class="components-item css-au4yox-PolymorphicDiv-medium-item-spacedAround e19lxcc00"
|
|
28
|
+
+ class="components-item css-1h3jinl-PolymorphicDiv-large-item-spacedAround e19lxcc00"
|
|
29
29
|
data-wp-c16t="true"
|
|
30
30
|
data-wp-component="Item"
|
|
31
31
|
>
|
|
@@ -44,8 +44,8 @@ Snapshot Diff:
|
|
|
44
44
|
role="listitem"
|
|
45
45
|
>
|
|
46
46
|
<div
|
|
47
|
-
- class="components-item css-
|
|
48
|
-
+ class="components-item css-
|
|
47
|
+
- class="components-item css-tpom78-PolymorphicDiv-medium-item e19lxcc00"
|
|
48
|
+
+ class="components-item css-vss65r-PolymorphicDiv-large-item e19lxcc00"
|
|
49
49
|
data-wp-c16t="true"
|
|
50
50
|
data-wp-component="Item"
|
|
51
51
|
>
|
|
@@ -114,8 +114,8 @@ Snapshot Diff:
|
|
|
114
114
|
@@ -1,18 +1,18 @@
|
|
115
115
|
<div>
|
|
116
116
|
<div
|
|
117
|
-
- class="components-item-group css-
|
|
118
|
-
+ class="components-item-group css-
|
|
117
|
+
- class="components-item-group css-1iattls-PolymorphicDiv-rounded e19lxcc00"
|
|
118
|
+
+ class="components-item-group css-zgfros-PolymorphicDiv-separated-rounded e19lxcc00"
|
|
119
119
|
data-wp-c16t="true"
|
|
120
120
|
data-wp-component="ItemGroup"
|
|
121
121
|
role="list"
|
|
@@ -125,8 +125,8 @@ Snapshot Diff:
|
|
|
125
125
|
role="listitem"
|
|
126
126
|
>
|
|
127
127
|
<div
|
|
128
|
-
- class="components-item css-
|
|
129
|
-
+ class="components-item css-
|
|
128
|
+
- class="components-item css-au4yox-PolymorphicDiv-medium-item-spacedAround e19lxcc00"
|
|
129
|
+
+ class="components-item css-tpom78-PolymorphicDiv-medium-item e19lxcc00"
|
|
130
130
|
data-wp-c16t="true"
|
|
131
131
|
data-wp-component="Item"
|
|
132
132
|
>
|
|
@@ -142,8 +142,8 @@ Snapshot Diff:
|
|
|
142
142
|
@@ -1,18 +1,18 @@
|
|
143
143
|
<div>
|
|
144
144
|
<div
|
|
145
|
-
- class="components-item-group css-
|
|
146
|
-
+ class="components-item-group css-
|
|
145
|
+
- class="components-item-group css-1iattls-PolymorphicDiv-rounded e19lxcc00"
|
|
146
|
+
+ class="components-item-group css-1ibn92o-PolymorphicDiv-bordered-rounded e19lxcc00"
|
|
147
147
|
data-wp-c16t="true"
|
|
148
148
|
data-wp-component="ItemGroup"
|
|
149
149
|
role="list"
|
|
@@ -153,8 +153,8 @@ Snapshot Diff:
|
|
|
153
153
|
role="listitem"
|
|
154
154
|
>
|
|
155
155
|
<div
|
|
156
|
-
- class="components-item css-
|
|
157
|
-
+ class="components-item css-
|
|
156
|
+
- class="components-item css-au4yox-PolymorphicDiv-medium-item-spacedAround e19lxcc00"
|
|
157
|
+
+ class="components-item css-tpom78-PolymorphicDiv-medium-item e19lxcc00"
|
|
158
158
|
data-wp-c16t="true"
|
|
159
159
|
data-wp-component="Item"
|
|
160
160
|
>
|
|
@@ -170,8 +170,8 @@ Snapshot Diff:
|
|
|
170
170
|
@@ -1,8 +1,8 @@
|
|
171
171
|
<div>
|
|
172
172
|
<div
|
|
173
|
-
- class="components-item-group css-
|
|
174
|
-
+ class="components-item-group css-
|
|
173
|
+
- class="components-item-group css-1iattls-PolymorphicDiv-rounded e19lxcc00"
|
|
174
|
+
+ class="components-item-group css-161q9d5-PolymorphicDiv e19lxcc00"
|
|
175
175
|
data-wp-c16t="true"
|
|
176
176
|
data-wp-component="ItemGroup"
|
|
177
177
|
role="list"
|
|
@@ -51,7 +51,9 @@ export function getGradientAngle( gradientValue ) {
|
|
|
51
51
|
}
|
|
52
52
|
} else if ( angleType === 'angle' ) {
|
|
53
53
|
return parseFloat( angle );
|
|
54
|
-
} else
|
|
54
|
+
} else {
|
|
55
|
+
return 4 * angleBase;
|
|
56
|
+
}
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
export function getGradientColorGroup( gradientValue ) {
|
|
@@ -18,8 +18,10 @@ import {
|
|
|
18
18
|
*/
|
|
19
19
|
import useScroll from './use-scroll';
|
|
20
20
|
import KeyboardAvoidingView from '../keyboard-avoiding-view';
|
|
21
|
+
import { OPTIMIZATION_ITEMS_THRESHOLD, OPTIMIZATION_PROPS } from './shared';
|
|
21
22
|
|
|
22
23
|
const AnimatedFlatList = Animated.createAnimatedComponent( FlatList );
|
|
24
|
+
const EMPTY_OBJECT = {};
|
|
23
25
|
|
|
24
26
|
export const KeyboardAwareFlatList = ( { onScroll, ...props }, ref ) => {
|
|
25
27
|
const { extraScrollHeight, scrollEnabled, shouldPreventAutomaticScroll } =
|
|
@@ -41,8 +43,6 @@ export const KeyboardAwareFlatList = ( { onScroll, ...props }, ref ) => {
|
|
|
41
43
|
|
|
42
44
|
const getFlatListRef = useCallback(
|
|
43
45
|
( flatListRef ) => {
|
|
44
|
-
// On Android, we get the ref of the associated scroll
|
|
45
|
-
// view to the FlatList.
|
|
46
46
|
scrollViewRef.current = flatListRef?.getNativeScrollRef();
|
|
47
47
|
},
|
|
48
48
|
[ scrollViewRef ]
|
|
@@ -57,12 +57,21 @@ export const KeyboardAwareFlatList = ( { onScroll, ...props }, ref ) => {
|
|
|
57
57
|
};
|
|
58
58
|
} );
|
|
59
59
|
|
|
60
|
+
const optimizationProps =
|
|
61
|
+
props.data?.length > OPTIMIZATION_ITEMS_THRESHOLD
|
|
62
|
+
? OPTIMIZATION_PROPS
|
|
63
|
+
: EMPTY_OBJECT;
|
|
64
|
+
|
|
60
65
|
return (
|
|
61
66
|
<KeyboardAvoidingView style={ { flex: 1 } }>
|
|
62
67
|
<AnimatedFlatList
|
|
63
68
|
ref={ getFlatListRef }
|
|
64
69
|
onScroll={ scrollHandler }
|
|
65
70
|
onContentSizeChange={ onContentSizeChange }
|
|
71
|
+
// Disable clipping to fix focus losing.
|
|
72
|
+
// See https://github.com/wordpress-mobile/gutenberg-mobile/pull/741#issuecomment-472746541
|
|
73
|
+
removeClippedSubviews={ false }
|
|
74
|
+
{ ...optimizationProps }
|
|
66
75
|
{ ...props }
|
|
67
76
|
/>
|
|
68
77
|
</KeyboardAvoidingView>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
import { ScrollView, FlatList } from 'react-native';
|
|
4
|
+
import { FlatList, View } from 'react-native';
|
|
6
5
|
import Animated from 'react-native-reanimated';
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -22,9 +21,12 @@ import { useThrottle } from '@wordpress/compose';
|
|
|
22
21
|
import useScroll from './use-scroll';
|
|
23
22
|
import useTextInputOffset from './use-text-input-offset';
|
|
24
23
|
import useTextInputCaretPosition from './use-text-input-caret-position';
|
|
24
|
+
import { OPTIMIZATION_ITEMS_THRESHOLD, OPTIMIZATION_PROPS } from './shared';
|
|
25
|
+
import styles from './styles.scss';
|
|
25
26
|
|
|
26
27
|
const DEFAULT_FONT_SIZE = 16;
|
|
27
|
-
const
|
|
28
|
+
const AnimatedFlatList = Animated.createAnimatedComponent( FlatList );
|
|
29
|
+
const EMPTY_OBJECT = {};
|
|
28
30
|
|
|
29
31
|
/** @typedef {import('@wordpress/element').RefObject} RefObject */
|
|
30
32
|
/**
|
|
@@ -35,7 +37,6 @@ const AnimatedScrollView = Animated.createAnimatedComponent( ScrollView );
|
|
|
35
37
|
* @param {number} props.extraScrollHeight Extra scroll height for the content.
|
|
36
38
|
* @param {Function} props.onScroll Function to be called when the list is scrolled.
|
|
37
39
|
* @param {boolean} props.scrollEnabled Whether the list can be scrolled.
|
|
38
|
-
* @param {Object} props.scrollViewStyle Additional style for the ScrollView component.
|
|
39
40
|
* @param {boolean} props.shouldPreventAutomaticScroll Whether to prevent scrolling when there's a Keyboard offset set.
|
|
40
41
|
* @param {Object} props... Other props to pass to the FlatList component.
|
|
41
42
|
* @param {RefObject} ref
|
|
@@ -46,7 +47,6 @@ export const KeyboardAwareFlatList = (
|
|
|
46
47
|
extraScrollHeight,
|
|
47
48
|
onScroll,
|
|
48
49
|
scrollEnabled,
|
|
49
|
-
scrollViewStyle,
|
|
50
50
|
shouldPreventAutomaticScroll,
|
|
51
51
|
...props
|
|
52
52
|
},
|
|
@@ -105,7 +105,12 @@ export const KeyboardAwareFlatList = (
|
|
|
105
105
|
// extra padding at the bottom.
|
|
106
106
|
const contentInset = { bottom: keyboardOffset };
|
|
107
107
|
|
|
108
|
-
const
|
|
108
|
+
const getFlatListRef = useCallback(
|
|
109
|
+
( flatListRef ) => {
|
|
110
|
+
scrollViewRef.current = flatListRef?.getNativeScrollRef();
|
|
111
|
+
},
|
|
112
|
+
[ scrollViewRef ]
|
|
113
|
+
);
|
|
109
114
|
|
|
110
115
|
useImperativeHandle( ref, () => {
|
|
111
116
|
return {
|
|
@@ -116,20 +121,26 @@ export const KeyboardAwareFlatList = (
|
|
|
116
121
|
};
|
|
117
122
|
} );
|
|
118
123
|
|
|
124
|
+
const optimizationProps =
|
|
125
|
+
props.data?.length > OPTIMIZATION_ITEMS_THRESHOLD
|
|
126
|
+
? OPTIMIZATION_PROPS
|
|
127
|
+
: EMPTY_OBJECT;
|
|
128
|
+
|
|
119
129
|
return (
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
<View style={ styles.list__container }>
|
|
131
|
+
<AnimatedFlatList
|
|
132
|
+
ref={ getFlatListRef }
|
|
133
|
+
automaticallyAdjustContentInsets={ false }
|
|
134
|
+
contentInset={ contentInset }
|
|
135
|
+
keyboardShouldPersistTaps="handled"
|
|
136
|
+
onContentSizeChange={ onContentSizeChange }
|
|
137
|
+
onScroll={ scrollHandler }
|
|
138
|
+
scrollEventThrottle={ 16 }
|
|
139
|
+
style={ styles.list__content }
|
|
140
|
+
{ ...optimizationProps }
|
|
141
|
+
{ ...props }
|
|
142
|
+
/>
|
|
143
|
+
</View>
|
|
133
144
|
);
|
|
134
145
|
};
|
|
135
146
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optimization properties for FlatList.
|
|
3
|
+
* @typedef {Object} OptimizationProps
|
|
4
|
+
* @property {number} maxToRenderPerBatch - Controls the amount of items rendered per batch during scrolling.
|
|
5
|
+
* Increasing this number reduces visual blank areas but may affect responsiveness.
|
|
6
|
+
* Default: 10
|
|
7
|
+
* @property {number} windowSize - Measurement unit representing viewport height.
|
|
8
|
+
* Default: 21 (10 viewports above, 10 below, and 1 in between).
|
|
9
|
+
* Larger values reduce chances of seeing blank spaces while scrolling but increase memory consumption.
|
|
10
|
+
* Smaller values save memory but increase chances of seeing blank areas.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Threshold for applying optimization settings.
|
|
15
|
+
* @type {number}
|
|
16
|
+
*/
|
|
17
|
+
export const OPTIMIZATION_ITEMS_THRESHOLD = 30;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Optimization properties for FlatList.
|
|
21
|
+
* @type {OptimizationProps}
|
|
22
|
+
*/
|
|
23
|
+
export const OPTIMIZATION_PROPS = {
|
|
24
|
+
maxToRenderPerBatch: 15,
|
|
25
|
+
windowSize: 17,
|
|
26
|
+
};
|
package/src/modal/aria-helper.ts
CHANGED
|
@@ -25,7 +25,9 @@ export function modalize( modalElement?: HTMLDivElement ) {
|
|
|
25
25
|
const hiddenElements: Element[] = [];
|
|
26
26
|
hiddenElementsByDepth.push( hiddenElements );
|
|
27
27
|
for ( const element of elements ) {
|
|
28
|
-
if ( element === modalElement )
|
|
28
|
+
if ( element === modalElement ) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
29
31
|
|
|
30
32
|
if ( elementShouldBeHidden( element ) ) {
|
|
31
33
|
element.setAttribute( 'aria-hidden', 'true' );
|
|
@@ -56,8 +58,11 @@ export function elementShouldBeHidden( element: Element ) {
|
|
|
56
58
|
*/
|
|
57
59
|
export function unmodalize() {
|
|
58
60
|
const hiddenElements = hiddenElementsByDepth.pop();
|
|
59
|
-
if ( ! hiddenElements )
|
|
61
|
+
if ( ! hiddenElements ) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
60
64
|
|
|
61
|
-
for ( const element of hiddenElements )
|
|
65
|
+
for ( const element of hiddenElements ) {
|
|
62
66
|
element.removeAttribute( 'aria-hidden' );
|
|
67
|
+
}
|
|
63
68
|
}
|
package/src/modal/index.tsx
CHANGED
|
@@ -154,7 +154,9 @@ function UnforwardedModal(
|
|
|
154
154
|
useEffect( () => {
|
|
155
155
|
dismissers.push( refOnRequestClose );
|
|
156
156
|
const [ first, second ] = dismissers;
|
|
157
|
-
if ( second )
|
|
157
|
+
if ( second ) {
|
|
158
|
+
first?.current?.();
|
|
159
|
+
}
|
|
158
160
|
|
|
159
161
|
const nested = nestedDismissers.current;
|
|
160
162
|
return () => {
|
|
@@ -243,7 +245,9 @@ function UnforwardedModal(
|
|
|
243
245
|
onPointerUp: ( { target, button } ) => {
|
|
244
246
|
const isSameTarget = target === pressTarget;
|
|
245
247
|
pressTarget = null;
|
|
246
|
-
if ( button === 0 && isSameTarget )
|
|
248
|
+
if ( button === 0 && isSameTarget ) {
|
|
249
|
+
onRequestClose();
|
|
250
|
+
}
|
|
247
251
|
},
|
|
248
252
|
};
|
|
249
253
|
|
package/src/modal/test/index.tsx
CHANGED
|
@@ -178,7 +178,9 @@ describe( 'Modal', () => {
|
|
|
178
178
|
{ isShown && (
|
|
179
179
|
<Modal
|
|
180
180
|
onKeyDown={ ( { key } ) => {
|
|
181
|
-
if ( key === 'o' )
|
|
181
|
+
if ( key === 'o' ) {
|
|
182
|
+
setIsShown( false );
|
|
183
|
+
}
|
|
182
184
|
} }
|
|
183
185
|
onRequestClose={ noop }
|
|
184
186
|
>
|
|
@@ -402,12 +404,17 @@ describe( 'Modal', () => {
|
|
|
402
404
|
metaKey,
|
|
403
405
|
} ) => {
|
|
404
406
|
if ( key === 'a' ) {
|
|
405
|
-
if ( metaKey )
|
|
407
|
+
if ( metaKey ) {
|
|
408
|
+
return setIsA1Shown( ( v ) => ! v );
|
|
409
|
+
}
|
|
406
410
|
return setIsAShown( ( v ) => ! v );
|
|
407
411
|
}
|
|
408
|
-
if ( key === 'b' )
|
|
409
|
-
|
|
412
|
+
if ( key === 'b' ) {
|
|
413
|
+
return setIsBShown( ( v ) => ! v );
|
|
414
|
+
}
|
|
415
|
+
if ( key === 'c' ) {
|
|
410
416
|
return setIsClassOverriden( ( v ) => ! v );
|
|
417
|
+
}
|
|
411
418
|
};
|
|
412
419
|
document.addEventListener( 'keydown', toggles );
|
|
413
420
|
return () =>
|
|
@@ -15,7 +15,7 @@ import { COLORS } from '../../utils/colors-values';
|
|
|
15
15
|
import Button from '../../button';
|
|
16
16
|
import { Text } from '../../text';
|
|
17
17
|
import { Heading } from '../../heading';
|
|
18
|
-
import {
|
|
18
|
+
import { rtl } from '../../utils';
|
|
19
19
|
import { space } from '../../utils/space';
|
|
20
20
|
|
|
21
21
|
export const NavigationUI = styled.div`
|
|
@@ -173,7 +173,6 @@ export const ItemBadgeUI = styled.span`
|
|
|
173
173
|
display: inline-flex;
|
|
174
174
|
padding: ${ space( 1 ) } ${ space( 3 ) };
|
|
175
175
|
border-radius: 2px;
|
|
176
|
-
animation: fade-in 250ms ease-out;
|
|
177
176
|
|
|
178
177
|
@keyframes fade-in {
|
|
179
178
|
from {
|
|
@@ -184,7 +183,9 @@ export const ItemBadgeUI = styled.span`
|
|
|
184
183
|
}
|
|
185
184
|
}
|
|
186
185
|
|
|
187
|
-
|
|
186
|
+
@media not ( prefers-reduced-motion ) {
|
|
187
|
+
animation: fade-in 250ms ease-out;
|
|
188
|
+
}
|
|
188
189
|
`;
|
|
189
190
|
|
|
190
191
|
export const ItemTitleUI = styled( Text )`
|