@wordpress/components 19.5.0 → 19.6.1-next.a55ed9455a.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 +21 -5
- package/build/alignment-matrix-control/utils.js +1 -1
- package/build/alignment-matrix-control/utils.js.map +1 -1
- package/build/angle-picker-control/angle-circle.js +1 -1
- package/build/angle-picker-control/angle-circle.js.map +1 -1
- package/build/animation/index.js +0 -6
- package/build/animation/index.js.map +1 -1
- package/build/autocomplete/get-default-use-items.js +3 -3
- package/build/autocomplete/get-default-use-items.js.map +1 -1
- package/build/base-field/hook.js +1 -1
- package/build/base-field/hook.js.map +1 -1
- package/build/box-control/icon.js +1 -1
- package/build/box-control/icon.js.map +1 -1
- package/build/box-control/index.js +4 -4
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/utils.js +12 -8
- package/build/box-control/utils.js.map +1 -1
- package/build/button/index.js +5 -5
- package/build/button/index.js.map +1 -1
- package/build/button/index.native.js +7 -7
- package/build/button/index.native.js.map +1 -1
- package/build/color-picker/color-display.js +1 -1
- package/build/color-picker/color-display.js.map +1 -1
- package/build/color-picker/styles.js +8 -8
- package/build/color-picker/styles.js.map +1 -1
- package/build/combobox-control/index.js +1 -1
- package/build/combobox-control/index.js.map +1 -1
- package/build/confirm-dialog/component.js +4 -2
- package/build/confirm-dialog/component.js.map +1 -1
- package/build/date-time/time.js +7 -4
- package/build/date-time/time.js.map +1 -1
- package/build/divider/component.js +5 -4
- package/build/divider/component.js.map +1 -1
- package/build/draggable/index.js +3 -3
- package/build/draggable/index.js.map +1 -1
- package/build/focal-point-picker/index.native.js +7 -7
- package/build/focal-point-picker/index.native.js.map +1 -1
- package/build/focal-point-picker/tooltip/index.native.js +1 -1
- package/build/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build/font-size-picker/index.js +1 -1
- package/build/font-size-picker/index.js.map +1 -1
- package/build/form-token-field/index.js +6 -6
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/suggestions-list.js +2 -2
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/heading/component.js +6 -5
- package/build/heading/component.js.map +1 -1
- package/build/heading/hook.js +1 -1
- package/build/heading/hook.js.map +1 -1
- package/build/higher-order/with-notices/index.js +1 -1
- package/build/higher-order/with-notices/index.js.map +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/index.native.js.map +1 -1
- package/build/input-control/input-base.js +1 -1
- package/build/input-control/input-base.js.map +1 -1
- package/build/input-control/input-field.js +12 -10
- package/build/input-control/input-field.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +25 -25
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/isolated-event-container/index.js +1 -1
- package/build/isolated-event-container/index.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-context.native.js +4 -4
- package/build/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build/mobile/bottom-sheet/cell.native.js +1 -1
- package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/index.native.js +11 -11
- package/build/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/link-cell.native.js +1 -1
- package/build/mobile/bottom-sheet/link-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js +1 -1
- package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/nav-bar/back-button.native.js +1 -1
- package/build/mobile/bottom-sheet/nav-bar/back-button.native.js.map +1 -1
- package/build/mobile/global-styles-context/utils.native.js +10 -10
- package/build/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build/mobile/gradient/index.native.js +2 -2
- package/build/mobile/gradient/index.native.js.map +1 -1
- package/build/mobile/html-text-input/container.ios.js +3 -3
- package/build/mobile/html-text-input/container.ios.js.map +1 -1
- package/build/mobile/html-text-input/index.native.js +1 -1
- package/build/mobile/html-text-input/index.native.js.map +1 -1
- package/build/mobile/image/index.native.js +1 -1
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.android.js +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.ios.js +2 -2
- package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build/mobile/link-picker/index.native.js +3 -3
- package/build/mobile/link-picker/index.native.js.map +1 -1
- package/build/mobile/link-picker/link-picker-results.native.js +8 -8
- package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build/mobile/link-settings/image-link-destinations-screen.native.js +2 -2
- package/build/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
- package/build/mobile/link-settings/index.native.js +1 -1
- package/build/mobile/link-settings/index.native.js.map +1 -1
- package/build/modal/aria-helper.js +1 -1
- package/build/modal/aria-helper.js.map +1 -1
- package/build/modal/index.js +2 -2
- package/build/modal/index.js.map +1 -1
- package/build/navigable-container/container.js +2 -2
- package/build/navigable-container/container.js.map +1 -1
- package/build/navigable-container/tabbable.js +1 -1
- package/build/navigable-container/tabbable.js.map +1 -1
- package/build/navigation/item/index.js +1 -1
- package/build/navigation/item/index.js.map +1 -1
- package/build/navigation/menu/index.js +1 -1
- package/build/navigation/menu/index.js.map +1 -1
- package/build/navigator/navigator-provider/component.js +2 -2
- package/build/navigator/navigator-provider/component.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +1 -1
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/number-control/index.js +1 -1
- package/build/number-control/index.js.map +1 -1
- package/build/panel/body.js +2 -2
- package/build/panel/body.js.map +1 -1
- package/build/popover/index.js +3 -3
- package/build/popover/index.js.map +1 -1
- package/build/popover/utils.js +6 -6
- package/build/popover/utils.js.map +1 -1
- package/build/radio-group/index.js +1 -1
- package/build/radio-group/index.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/sandbox/index.js +5 -5
- package/build/sandbox/index.js.map +1 -1
- package/build/sandbox/index.native.js +1 -1
- package/build/sandbox/index.native.js.map +1 -1
- package/build/select-control/index.js +1 -1
- package/build/select-control/index.js.map +1 -1
- package/build/select-control/styles/select-control-styles.js +5 -5
- package/build/select-control/styles/select-control-styles.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot.js +1 -1
- package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build/slot-fill/fill.js +1 -1
- package/build/slot-fill/fill.js.map +1 -1
- package/build/slot-fill/provider.js +1 -1
- package/build/slot-fill/provider.js.map +1 -1
- package/build/snackbar/index.js +1 -1
- package/build/snackbar/index.js.map +1 -1
- package/build/snackbar/list.js +1 -1
- package/build/snackbar/list.js.map +1 -1
- package/build/style-provider/index.js +2 -2
- package/build/style-provider/index.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +2 -2
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option/styles.js +8 -8
- package/build/toggle-group-control/toggle-group-control-option/styles.js.map +1 -1
- package/build/toolbar/index.js +1 -1
- package/build/toolbar/index.js.map +1 -1
- package/build/tooltip/index.js +3 -3
- package/build/tooltip/index.js.map +1 -1
- package/build/tooltip/index.native.js +7 -7
- package/build/tooltip/index.native.js.map +1 -1
- package/build/truncate/utils.js +1 -1
- package/build/truncate/utils.js.map +1 -1
- package/build/ui/context/context-connect.js +8 -15
- package/build/ui/context/context-connect.js.map +1 -1
- package/build/ui/context/context-system-provider.js +2 -2
- package/build/ui/context/context-system-provider.js.map +1 -1
- package/build/ui/context/index.js.map +1 -1
- package/build/ui/utils/colors.js +2 -2
- package/build/ui/utils/colors.js.map +1 -1
- package/build/ui/utils/space.js +2 -2
- package/build/ui/utils/space.js.map +1 -1
- package/build/unit-control/index.js +38 -29
- package/build/unit-control/index.js.map +1 -1
- package/build/unit-control/index.native.js +4 -2
- package/build/unit-control/index.native.js.map +1 -1
- package/build/unit-control/unit-select-control.js +1 -1
- package/build/unit-control/unit-select-control.js.map +1 -1
- package/build/unit-control/utils.js +96 -104
- package/build/unit-control/utils.js.map +1 -1
- package/build/utils/breakpoint-values.js +1 -1
- package/build/utils/breakpoint-values.js.map +1 -1
- package/build/utils/colors-values.js +1 -1
- package/build/utils/colors-values.js.map +1 -1
- package/build-module/alignment-matrix-control/utils.js +1 -1
- package/build-module/alignment-matrix-control/utils.js.map +1 -1
- package/build-module/angle-picker-control/angle-circle.js +1 -1
- package/build-module/angle-picker-control/angle-circle.js.map +1 -1
- package/build-module/animation/index.js +1 -1
- package/build-module/animation/index.js.map +1 -1
- package/build-module/autocomplete/get-default-use-items.js +3 -3
- package/build-module/autocomplete/get-default-use-items.js.map +1 -1
- package/build-module/base-field/hook.js +1 -1
- package/build-module/base-field/hook.js.map +1 -1
- package/build-module/box-control/icon.js +1 -1
- package/build-module/box-control/icon.js.map +1 -1
- package/build-module/box-control/index.js +5 -5
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/utils.js +13 -9
- package/build-module/box-control/utils.js.map +1 -1
- package/build-module/button/index.js +5 -5
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/index.native.js +7 -7
- package/build-module/button/index.native.js.map +1 -1
- package/build-module/color-picker/color-display.js +1 -1
- package/build-module/color-picker/color-display.js.map +1 -1
- package/build-module/color-picker/styles.js +8 -8
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/combobox-control/index.js +1 -1
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/confirm-dialog/component.js +4 -5
- package/build-module/confirm-dialog/component.js.map +1 -1
- package/build-module/date-time/time.js +7 -4
- package/build-module/date-time/time.js.map +1 -1
- package/build-module/divider/component.js +3 -3
- package/build-module/divider/component.js.map +1 -1
- package/build-module/draggable/index.js +3 -3
- package/build-module/draggable/index.js.map +1 -1
- package/build-module/focal-point-picker/index.native.js +7 -7
- package/build-module/focal-point-picker/index.native.js.map +1 -1
- package/build-module/focal-point-picker/tooltip/index.native.js +1 -1
- package/build-module/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build-module/font-size-picker/index.js +1 -1
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/form-token-field/index.js +6 -6
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/suggestions-list.js +2 -2
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/heading/component.js +4 -4
- package/build-module/heading/component.js.map +1 -1
- package/build-module/heading/hook.js +1 -1
- package/build-module/heading/hook.js.map +1 -1
- package/build-module/higher-order/with-notices/index.js +1 -1
- package/build-module/higher-order/with-notices/index.js.map +1 -1
- package/build-module/index.js +4 -4
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +4 -4
- package/build-module/index.native.js.map +1 -1
- package/build-module/input-control/input-base.js +1 -1
- package/build-module/input-control/input-base.js.map +1 -1
- package/build-module/input-control/input-field.js +13 -10
- package/build-module/input-control/input-field.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +25 -25
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/isolated-event-container/index.js +1 -1
- package/build-module/isolated-event-container/index.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-context.native.js +4 -4
- package/build-module/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/index.native.js +11 -11
- package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/link-cell.native.js +1 -1
- package/build-module/mobile/bottom-sheet/link-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js +1 -1
- package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/back-button.native.js +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/back-button.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js +10 -10
- package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build-module/mobile/gradient/index.native.js +2 -2
- package/build-module/mobile/gradient/index.native.js.map +1 -1
- package/build-module/mobile/html-text-input/container.ios.js +3 -3
- package/build-module/mobile/html-text-input/container.ios.js.map +1 -1
- package/build-module/mobile/html-text-input/index.native.js +1 -1
- package/build-module/mobile/html-text-input/index.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +1 -1
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js +1 -1
- 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 +2 -2
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build-module/mobile/link-picker/index.native.js +3 -3
- package/build-module/mobile/link-picker/index.native.js.map +1 -1
- package/build-module/mobile/link-picker/link-picker-results.native.js +8 -8
- package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build-module/mobile/link-settings/image-link-destinations-screen.native.js +2 -2
- package/build-module/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
- package/build-module/mobile/link-settings/index.native.js +1 -1
- package/build-module/mobile/link-settings/index.native.js.map +1 -1
- package/build-module/modal/aria-helper.js +1 -1
- package/build-module/modal/aria-helper.js.map +1 -1
- package/build-module/modal/index.js +2 -2
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigable-container/container.js +2 -2
- package/build-module/navigable-container/container.js.map +1 -1
- package/build-module/navigable-container/tabbable.js +1 -1
- package/build-module/navigable-container/tabbable.js.map +1 -1
- package/build-module/navigation/item/index.js +1 -1
- package/build-module/navigation/item/index.js.map +1 -1
- package/build-module/navigation/menu/index.js +1 -1
- package/build-module/navigation/menu/index.js.map +1 -1
- package/build-module/navigator/navigator-provider/component.js +2 -2
- package/build-module/navigator/navigator-provider/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +1 -1
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/number-control/index.js +1 -1
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/panel/body.js +2 -2
- package/build-module/panel/body.js.map +1 -1
- package/build-module/popover/index.js +3 -3
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/utils.js +6 -6
- package/build-module/popover/utils.js.map +1 -1
- package/build-module/radio-group/index.js +1 -1
- package/build-module/radio-group/index.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +29 -29
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/sandbox/index.js +5 -5
- package/build-module/sandbox/index.js.map +1 -1
- package/build-module/sandbox/index.native.js +1 -1
- package/build-module/sandbox/index.native.js.map +1 -1
- package/build-module/select-control/index.js +1 -1
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/select-control/styles/select-control-styles.js +5 -5
- package/build-module/select-control/styles/select-control-styles.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/slot.js +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build-module/slot-fill/fill.js +1 -1
- package/build-module/slot-fill/fill.js.map +1 -1
- package/build-module/slot-fill/provider.js +1 -1
- package/build-module/slot-fill/provider.js.map +1 -1
- package/build-module/snackbar/index.js +1 -1
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/snackbar/list.js +1 -1
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/style-provider/index.js +2 -2
- package/build-module/style-provider/index.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +2 -2
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option/styles.js +8 -8
- package/build-module/toggle-group-control/toggle-group-control-option/styles.js.map +1 -1
- package/build-module/toolbar/index.js +1 -1
- package/build-module/toolbar/index.js.map +1 -1
- package/build-module/tooltip/index.js +3 -3
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tooltip/index.native.js +7 -7
- package/build-module/tooltip/index.native.js.map +1 -1
- package/build-module/truncate/utils.js +1 -1
- package/build-module/truncate/utils.js.map +1 -1
- package/build-module/ui/context/context-connect.js +9 -16
- package/build-module/ui/context/context-connect.js.map +1 -1
- package/build-module/ui/context/context-system-provider.js +2 -2
- package/build-module/ui/context/context-system-provider.js.map +1 -1
- package/build-module/ui/context/index.js.map +1 -1
- package/build-module/ui/utils/colors.js +2 -2
- package/build-module/ui/utils/colors.js.map +1 -1
- package/build-module/ui/utils/space.js +2 -2
- package/build-module/ui/utils/space.js.map +1 -1
- package/build-module/unit-control/index.js +39 -30
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/unit-control/index.native.js +5 -3
- package/build-module/unit-control/index.native.js.map +1 -1
- package/build-module/unit-control/unit-select-control.js +1 -1
- package/build-module/unit-control/unit-select-control.js.map +1 -1
- package/build-module/unit-control/utils.js +92 -100
- package/build-module/unit-control/utils.js.map +1 -1
- package/build-module/utils/breakpoint-values.js +1 -1
- package/build-module/utils/breakpoint-values.js.map +1 -1
- package/build-module/utils/colors-values.js +1 -1
- package/build-module/utils/colors-values.js.map +1 -1
- package/build-style/style-rtl.css +8 -0
- package/build-style/style.css +8 -0
- package/build-types/base-field/hook.d.ts +2 -1
- package/build-types/base-field/hook.d.ts.map +1 -1
- package/build-types/card/card/hook.d.ts +2 -1
- package/build-types/card/card/hook.d.ts.map +1 -1
- package/build-types/card/card-body/hook.d.ts +2 -1
- package/build-types/card/card-body/hook.d.ts.map +1 -1
- package/build-types/card/card-divider/hook.d.ts +2 -2
- package/build-types/card/card-footer/hook.d.ts +2 -1
- package/build-types/card/card-footer/hook.d.ts.map +1 -1
- package/build-types/card/card-header/hook.d.ts +2 -1
- package/build-types/card/card-header/hook.d.ts.map +1 -1
- package/build-types/card/card-media/hook.d.ts +2 -1
- package/build-types/card/card-media/hook.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +2 -2
- package/build-types/confirm-dialog/component.d.ts +8 -0
- package/build-types/confirm-dialog/component.d.ts.map +1 -1
- package/build-types/confirm-dialog/types.d.ts +2 -0
- package/build-types/confirm-dialog/types.d.ts.map +1 -1
- package/build-types/divider/component.d.ts +2 -2
- package/build-types/divider/component.d.ts.map +1 -1
- package/build-types/divider/stories/index.d.ts +10 -0
- package/build-types/divider/stories/index.d.ts.map +1 -0
- package/build-types/divider/types.d.ts +1 -1
- package/build-types/divider/types.d.ts.map +1 -1
- package/build-types/elevation/hook.d.ts +2 -1
- package/build-types/elevation/hook.d.ts.map +1 -1
- package/build-types/flex/flex/hook.d.ts +2 -1
- package/build-types/flex/flex/hook.d.ts.map +1 -1
- package/build-types/flex/flex-block/hook.d.ts +2 -1
- package/build-types/flex/flex-block/hook.d.ts.map +1 -1
- package/build-types/flex/flex-item/hook.d.ts +2 -1
- package/build-types/flex/flex-item/hook.d.ts.map +1 -1
- package/build-types/flyout/flyout/hook.d.ts +2 -1
- package/build-types/flyout/flyout/hook.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +2 -1
- package/build-types/grid/hook.d.ts.map +1 -1
- package/build-types/h-stack/hook.d.ts +3 -2
- package/build-types/h-stack/hook.d.ts.map +1 -1
- package/build-types/heading/component.d.ts +3 -3
- package/build-types/heading/component.d.ts.map +1 -1
- package/build-types/heading/hook.d.ts +2 -1
- package/build-types/heading/hook.d.ts.map +1 -1
- package/build-types/heading/stories/index.d.ts +12 -0
- package/build-types/heading/stories/index.d.ts.map +1 -0
- package/build-types/input-control/index.d.ts +1 -1
- package/build-types/input-control/index.d.ts.map +1 -1
- package/build-types/input-control/input-field.d.ts +1 -1
- package/build-types/input-control/input-field.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/item-group/item/hook.d.ts +2 -1
- package/build-types/item-group/item/hook.d.ts.map +1 -1
- package/build-types/item-group/item-group/hook.d.ts +2 -1
- package/build-types/item-group/item-group/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +2 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +2 -1
- package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
- package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
- package/build-types/scrollable/hook.d.ts +2 -1
- package/build-types/scrollable/hook.d.ts.map +1 -1
- package/build-types/select-control/index.d.ts +1 -1
- 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/spacer/hook.d.ts +2 -1
- package/build-types/spacer/hook.d.ts.map +1 -1
- package/build-types/surface/hook.d.ts +2 -1
- package/build-types/surface/hook.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +2 -1
- package/build-types/text/hook.d.ts.map +1 -1
- package/build-types/text/types.d.ts +1 -2
- package/build-types/text/types.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option/styles.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +2 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +2 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +2 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +2 -1
- package/build-types/truncate/hook.d.ts.map +1 -1
- package/build-types/ui/context/context-connect.d.ts +18 -16
- package/build-types/ui/context/context-connect.d.ts.map +1 -1
- package/build-types/ui/context/index.d.ts +4 -4
- package/build-types/ui/context/index.d.ts.map +1 -1
- package/build-types/ui/context/wordpress-component.d.ts +1 -0
- package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
- package/build-types/ui/control-group/hook.d.ts +2 -1
- package/build-types/ui/control-group/hook.d.ts.map +1 -1
- package/build-types/ui/control-label/hook.d.ts +2 -1
- package/build-types/ui/control-label/hook.d.ts.map +1 -1
- package/build-types/ui/form-group/use-form-group.d.ts +6 -4
- package/build-types/ui/form-group/use-form-group.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +3 -3
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/types.d.ts +4 -6
- package/build-types/unit-control/types.d.ts.map +1 -1
- package/build-types/unit-control/utils.d.ts +47 -38
- package/build-types/unit-control/utils.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +2 -1
- package/build-types/v-stack/hook.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/alignment-matrix-control/utils.js +1 -1
- package/src/angle-picker-control/angle-circle.js +1 -1
- package/src/animation/index.js +0 -1
- package/src/autocomplete/get-default-use-items.js +3 -3
- package/src/base-field/hook.js +1 -1
- package/src/box-control/icon.js +1 -1
- package/src/box-control/index.js +5 -5
- package/src/box-control/test/index.js +27 -7
- package/src/box-control/utils.js +13 -9
- package/src/button/index.js +5 -5
- package/src/button/index.native.js +7 -7
- package/src/button/style.scss +1 -0
- package/src/color-palette/style.scss +1 -0
- package/src/color-picker/color-display.tsx +1 -1
- package/src/color-picker/styles.ts +1 -1
- package/src/color-picker/test/index.js +1 -1
- package/src/combobox-control/index.js +1 -1
- package/src/combobox-control/style.scss +1 -0
- package/src/confirm-dialog/README.md +56 -45
- package/src/confirm-dialog/component.tsx +4 -2
- package/src/confirm-dialog/stories/index.js +19 -0
- package/src/confirm-dialog/test/index.js +28 -0
- package/src/confirm-dialog/types.ts +2 -0
- package/src/date-time/style.scss +4 -0
- package/src/date-time/time.js +16 -5
- package/src/dimension-control/test/index.test.js +1 -1
- package/src/disabled/test/index.js +1 -1
- package/src/divider/component.tsx +3 -3
- package/src/divider/stories/index.tsx +70 -0
- package/src/divider/types.ts +3 -1
- package/src/draggable/index.js +3 -3
- package/src/draggable/stories/index.js +1 -1
- package/src/flyout/flyout/README.md +1 -1
- package/src/flyout/test/index.js +1 -1
- package/src/focal-point-picker/index.native.js +7 -7
- package/src/focal-point-picker/tooltip/index.native.js +1 -1
- package/src/font-size-picker/README.md +1 -2
- package/src/font-size-picker/index.js +1 -1
- package/src/font-size-picker/stories/index.js +87 -108
- package/src/form-token-field/index.js +6 -6
- package/src/form-token-field/style.scss +1 -0
- package/src/form-token-field/suggestions-list.js +2 -2
- package/src/form-token-field/test/index.js +6 -6
- package/src/heading/component.tsx +4 -4
- package/src/heading/hook.ts +1 -1
- package/src/heading/stories/index.tsx +37 -0
- package/src/higher-order/with-filters/test/index.js +1 -1
- package/src/higher-order/with-focus-outside/test/index.js +1 -1
- package/src/higher-order/with-notices/index.js +1 -1
- package/src/higher-order/with-notices/test/index.js +3 -3
- package/src/index.js +4 -4
- package/src/index.native.js +4 -4
- package/src/input-control/input-base.tsx +1 -1
- package/src/input-control/input-field.tsx +12 -9
- package/src/input-control/styles/input-control-styles.tsx +1 -0
- package/src/input-control/test/index.js +4 -4
- package/src/isolated-event-container/index.js +1 -1
- package/src/item-group/test/index.js +0 -1
- package/src/mobile/bottom-sheet/bottom-sheet-context.native.js +4 -4
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -1
- package/src/mobile/bottom-sheet/cell.native.js +1 -1
- package/src/mobile/bottom-sheet/index.native.js +11 -11
- package/src/mobile/bottom-sheet/link-cell.native.js +1 -1
- package/src/mobile/bottom-sheet/link-suggestion-item-cell.native.js +1 -1
- package/src/mobile/bottom-sheet/nav-bar/back-button.native.js +1 -1
- package/src/mobile/global-styles-context/utils.native.js +10 -10
- package/src/mobile/gradient/index.native.js +2 -2
- package/src/mobile/html-text-input/container.ios.js +3 -3
- package/src/mobile/html-text-input/index.native.js +1 -1
- package/src/mobile/html-text-input/test/index.native.js +14 -14
- package/src/mobile/image/index.native.js +1 -1
- package/src/mobile/keyboard-aware-flat-list/index.android.js +1 -1
- package/src/mobile/keyboard-aware-flat-list/index.ios.js +2 -2
- package/src/mobile/link-picker/index.native.js +3 -3
- package/src/mobile/link-picker/link-picker-results.native.js +8 -8
- package/src/mobile/link-settings/image-link-destinations-screen.native.js +2 -2
- package/src/mobile/link-settings/index.native.js +1 -2
- package/src/mobile/link-settings/test/edit.native.js +15 -15
- package/src/modal/aria-helper.js +1 -1
- package/src/modal/index.js +2 -2
- package/src/navigable-container/container.js +2 -2
- package/src/navigable-container/tabbable.js +1 -1
- package/src/navigable-container/test/menu.js +5 -5
- package/src/navigable-container/test/tabbable.js +2 -2
- package/src/navigation/item/index.js +1 -1
- package/src/navigation/menu/index.js +1 -1
- package/src/navigation/stories/controlled-state.js +2 -2
- package/src/navigator/navigator-provider/component.tsx +1 -1
- package/src/navigator/navigator-screen/component.tsx +2 -2
- package/src/navigator/test/index.js +18 -19
- package/src/navigator/types.ts +1 -1
- package/src/number-control/index.js +1 -1
- package/src/panel/body.js +2 -2
- package/src/popover/index.js +3 -3
- package/src/popover/utils.js +6 -6
- package/src/radio-group/index.js +1 -1
- package/src/range-control/stories/index.js +1 -1
- package/src/range-control/styles/range-control-styles.js +1 -1
- package/src/range-control/test/index.js +2 -2
- package/src/sandbox/index.js +5 -5
- package/src/sandbox/index.native.js +1 -1
- package/src/select-control/index.tsx +1 -1
- package/src/select-control/styles/select-control-styles.ts +1 -0
- package/src/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
- package/src/slot-fill/bubbles-virtually/slot.js +1 -2
- package/src/slot-fill/fill.js +1 -1
- package/src/slot-fill/provider.js +1 -1
- package/src/snackbar/index.js +1 -1
- package/src/snackbar/list.js +1 -1
- package/src/style-provider/index.js +2 -2
- package/src/tab-panel/test/index.js +1 -1
- package/src/text/test/index.js +2 -2
- package/src/text/types.ts +6 -8
- package/src/text-highlight/test/index.js +4 -4
- package/src/toggle-control/test/index.js +3 -3
- package/src/toggle-group-control/test/__snapshots__/index.js.snap +1 -0
- package/src/toggle-group-control/toggle-group-control/component.tsx +2 -2
- package/src/toggle-group-control/toggle-group-control-option/styles.ts +1 -0
- package/src/toolbar/index.js +1 -1
- package/src/toolbar-group/test/index.js +2 -2
- package/src/tooltip/index.js +3 -3
- package/src/tooltip/index.native.js +7 -7
- package/src/tooltip/test/index.js +2 -2
- package/src/tooltip/test/index.native.js +2 -2
- package/src/tree-grid/test/__snapshots__/index.js.snap +1 -1
- package/src/tree-grid/test/index.js +71 -39
- package/src/truncate/utils.js +1 -1
- package/src/ui/context/{context-connect.js → context-connect.ts} +27 -16
- package/src/ui/context/context-system-provider.js +2 -2
- package/src/ui/context/{index.js → index.ts} +0 -0
- package/src/ui/context/wordpress-component.ts +1 -0
- package/src/ui/tooltip/test/index.js +4 -4
- package/src/ui/utils/colors.js +2 -2
- package/src/ui/utils/space.ts +2 -2
- package/src/unit-control/README.md +1 -1
- package/src/unit-control/index.native.js +5 -3
- package/src/unit-control/index.tsx +64 -35
- package/src/unit-control/test/index.js +102 -3
- package/src/unit-control/test/utils.js +56 -15
- package/src/unit-control/types.ts +5 -8
- package/src/unit-control/unit-select-control.tsx +1 -1
- package/src/unit-control/utils.ts +128 -125
- package/src/utils/breakpoint-values.js +1 -1
- package/src/utils/colors-values.js +1 -1
- package/src/utils/hooks/test/use-controlled-state.js +1 -1
- package/src/utils/hooks/test/use-controlled-value.js +3 -3
- package/src/utils/hooks/test/use-latest-ref.js +1 -1
- package/src/utils/test/math.js +2 -2
- package/src/utils/test/rtl.js +12 -12
- package/tsconfig.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/src/divider/stories/index.js +0 -64
- package/src/heading/stories/index.js +0 -24
|
@@ -13,6 +13,8 @@ import { forwardRef } from '@wordpress/element';
|
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
15
|
import TreeGrid from '../';
|
|
16
|
+
import TreeGridRow from '../row';
|
|
17
|
+
import TreeGridCell from '../cell';
|
|
16
18
|
|
|
17
19
|
const TestButton = forwardRef( ( { ...props }, ref ) => (
|
|
18
20
|
<button { ...props } ref={ ref }></button>
|
|
@@ -46,9 +48,9 @@ describe( 'TreeGrid', () => {
|
|
|
46
48
|
it( 'renders a table, tbody and any child elements', () => {
|
|
47
49
|
const { container } = render(
|
|
48
50
|
<TreeGrid>
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
</
|
|
51
|
+
<TreeGridRow level={ 1 } positionInSet={ 1 } setSize={ 1 }>
|
|
52
|
+
<TreeGridCell withoutGridItem>Test</TreeGridCell>
|
|
53
|
+
</TreeGridRow>
|
|
52
54
|
</TreeGrid>
|
|
53
55
|
);
|
|
54
56
|
|
|
@@ -62,21 +64,36 @@ describe( 'TreeGrid', () => {
|
|
|
62
64
|
|
|
63
65
|
render(
|
|
64
66
|
<TreeGrid onExpandRow={ onExpandRow }>
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
+
<TreeGridRow
|
|
68
|
+
level={ 1 }
|
|
69
|
+
positionInSet={ 1 }
|
|
70
|
+
setSize={ 3 }
|
|
71
|
+
isExpanded={ true }
|
|
72
|
+
>
|
|
73
|
+
<TreeGridCell withoutGridItem>
|
|
67
74
|
<TestButton>Row 1</TestButton>
|
|
68
|
-
</
|
|
69
|
-
</
|
|
70
|
-
<
|
|
71
|
-
|
|
75
|
+
</TreeGridCell>
|
|
76
|
+
</TreeGridRow>
|
|
77
|
+
<TreeGridRow
|
|
78
|
+
level={ 1 }
|
|
79
|
+
positionInSet={ 2 }
|
|
80
|
+
setSize={ 3 }
|
|
81
|
+
isExpanded={ false }
|
|
82
|
+
>
|
|
83
|
+
<TreeGridCell withoutGridItem>
|
|
72
84
|
<TestButton>Row 2</TestButton>
|
|
73
|
-
</
|
|
74
|
-
</
|
|
75
|
-
<
|
|
76
|
-
|
|
85
|
+
</TreeGridCell>
|
|
86
|
+
</TreeGridRow>
|
|
87
|
+
<TreeGridRow
|
|
88
|
+
level={ 1 }
|
|
89
|
+
positionInSet={ 3 }
|
|
90
|
+
setSize={ 3 }
|
|
91
|
+
isExpanded={ true }
|
|
92
|
+
>
|
|
93
|
+
<TreeGridCell withoutGridItem>
|
|
77
94
|
<TestButton>Row 3</TestButton>
|
|
78
|
-
</
|
|
79
|
-
</
|
|
95
|
+
</TreeGridCell>
|
|
96
|
+
</TreeGridRow>
|
|
80
97
|
</TreeGrid>
|
|
81
98
|
);
|
|
82
99
|
|
|
@@ -99,21 +116,36 @@ describe( 'TreeGrid', () => {
|
|
|
99
116
|
|
|
100
117
|
render(
|
|
101
118
|
<TreeGrid onCollapseRow={ onCollapseRow }>
|
|
102
|
-
<
|
|
103
|
-
|
|
119
|
+
<TreeGridRow
|
|
120
|
+
level={ 1 }
|
|
121
|
+
positionInSet={ 1 }
|
|
122
|
+
setSize={ 3 }
|
|
123
|
+
isExpanded={ false }
|
|
124
|
+
>
|
|
125
|
+
<TreeGridCell withoutGridItem>
|
|
104
126
|
<TestButton>Row 1</TestButton>
|
|
105
|
-
</
|
|
106
|
-
</
|
|
107
|
-
<
|
|
108
|
-
|
|
127
|
+
</TreeGridCell>
|
|
128
|
+
</TreeGridRow>
|
|
129
|
+
<TreeGridRow
|
|
130
|
+
level={ 1 }
|
|
131
|
+
positionInSet={ 2 }
|
|
132
|
+
setSize={ 3 }
|
|
133
|
+
isExpanded={ true }
|
|
134
|
+
>
|
|
135
|
+
<TreeGridCell withoutGridItem>
|
|
109
136
|
<TestButton>Row 2</TestButton>
|
|
110
|
-
</
|
|
111
|
-
</
|
|
112
|
-
<
|
|
113
|
-
|
|
137
|
+
</TreeGridCell>
|
|
138
|
+
</TreeGridRow>
|
|
139
|
+
<TreeGridRow
|
|
140
|
+
level={ 1 }
|
|
141
|
+
positionInSet={ 3 }
|
|
142
|
+
setSize={ 3 }
|
|
143
|
+
isExpanded={ false }
|
|
144
|
+
>
|
|
145
|
+
<TreeGridCell withoutGridItem>
|
|
114
146
|
<TestButton>Row 3</TestButton>
|
|
115
|
-
</
|
|
116
|
-
</
|
|
147
|
+
</TreeGridCell>
|
|
148
|
+
</TreeGridRow>
|
|
117
149
|
</TreeGrid>
|
|
118
150
|
);
|
|
119
151
|
|
|
@@ -133,21 +165,21 @@ describe( 'TreeGrid', () => {
|
|
|
133
165
|
describe( 'onFocusRow', () => {
|
|
134
166
|
const TestTree = ( { onFocusRow } ) => (
|
|
135
167
|
<TreeGrid onFocusRow={ onFocusRow }>
|
|
136
|
-
<
|
|
137
|
-
<
|
|
168
|
+
<TreeGridRow level={ 1 } positionInSet={ 1 } setSize={ 3 }>
|
|
169
|
+
<TreeGridCell withoutGridItem>
|
|
138
170
|
<TestButton>Row 1</TestButton>
|
|
139
|
-
</
|
|
140
|
-
</
|
|
141
|
-
<
|
|
142
|
-
<
|
|
171
|
+
</TreeGridCell>
|
|
172
|
+
</TreeGridRow>
|
|
173
|
+
<TreeGridRow level={ 1 } positionInSet={ 2 } setSize={ 3 }>
|
|
174
|
+
<TreeGridCell withoutGridItem>
|
|
143
175
|
<TestButton>Row 2</TestButton>
|
|
144
|
-
</
|
|
145
|
-
</
|
|
146
|
-
<
|
|
147
|
-
<
|
|
176
|
+
</TreeGridCell>
|
|
177
|
+
</TreeGridRow>
|
|
178
|
+
<TreeGridRow level={ 1 } positionInSet={ 3 } setSize={ 3 }>
|
|
179
|
+
<TreeGridCell withoutGridItem>
|
|
148
180
|
<TestButton>Row 3</TestButton>
|
|
149
|
-
</
|
|
150
|
-
</
|
|
181
|
+
</TreeGridCell>
|
|
182
|
+
</TreeGridRow>
|
|
151
183
|
</TreeGrid>
|
|
152
184
|
);
|
|
153
185
|
|
package/src/truncate/utils.js
CHANGED
|
@@ -34,7 +34,7 @@ export function truncateMiddle( word, headLength, tailLength, ellipsis ) {
|
|
|
34
34
|
const wordLength = word.length;
|
|
35
35
|
// Setting default values
|
|
36
36
|
// eslint-disable-next-line no-bitwise
|
|
37
|
-
const frontLength = ~~headLength; //
|
|
37
|
+
const frontLength = ~~headLength; // Will cast to integer
|
|
38
38
|
// eslint-disable-next-line no-bitwise
|
|
39
39
|
const backLength = ~~tailLength;
|
|
40
40
|
/* istanbul ignore next */
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { uniq } from 'lodash';
|
|
5
|
+
import type { ForwardedRef, ReactChild, ReactNode } from 'react';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* WordPress dependencies
|
|
@@ -14,8 +15,13 @@ import warn from '@wordpress/warning';
|
|
|
14
15
|
*/
|
|
15
16
|
import { CONNECT_STATIC_NAMESPACE } from './constants';
|
|
16
17
|
import { getStyledClassNameFromKey } from './get-styled-class-name-from-key';
|
|
18
|
+
import type { WordPressComponentFromProps } from '.';
|
|
19
|
+
|
|
20
|
+
type ContextConnectOptions = {
|
|
21
|
+
/** Defaults to `false`. */
|
|
22
|
+
memo?: boolean;
|
|
23
|
+
};
|
|
17
24
|
|
|
18
|
-
/* eslint-disable jsdoc/valid-types */
|
|
19
25
|
/**
|
|
20
26
|
* Forwards ref (React.ForwardRef) and "Connects" (or registers) a component
|
|
21
27
|
* within the Context system under a specified namespace.
|
|
@@ -24,15 +30,16 @@ import { getStyledClassNameFromKey } from './get-styled-class-name-from-key';
|
|
|
24
30
|
* The hope is that we can improve render performance by removing functional
|
|
25
31
|
* component wrappers.
|
|
26
32
|
*
|
|
27
|
-
* @
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @
|
|
31
|
-
* @param {boolean} [options.memo=false]
|
|
32
|
-
* @return {import('./wordpress-component').WordPressComponentFromProps<P>} The connected WordPressComponent
|
|
33
|
+
* @param Component The component to register into the Context system.
|
|
34
|
+
* @param namespace The namespace to register the component under.
|
|
35
|
+
* @param options
|
|
36
|
+
* @return The connected WordPressComponent
|
|
33
37
|
*/
|
|
34
|
-
export function contextConnect
|
|
35
|
-
|
|
38
|
+
export function contextConnect< P >(
|
|
39
|
+
Component: ( props: P, ref: ForwardedRef< any > ) => JSX.Element | null,
|
|
40
|
+
namespace: string,
|
|
41
|
+
options: ContextConnectOptions = {}
|
|
42
|
+
): WordPressComponentFromProps< P > {
|
|
36
43
|
const { memo: memoProp = false } = options;
|
|
37
44
|
|
|
38
45
|
let WrappedComponent = forwardRef( Component );
|
|
@@ -75,10 +82,12 @@ export function contextConnect( Component, namespace, options = {} ) {
|
|
|
75
82
|
/**
|
|
76
83
|
* Attempts to retrieve the connected namespace from a component.
|
|
77
84
|
*
|
|
78
|
-
* @param
|
|
79
|
-
* @return
|
|
85
|
+
* @param Component The component to retrieve a namespace from.
|
|
86
|
+
* @return The connected namespaces.
|
|
80
87
|
*/
|
|
81
|
-
export function getConnectNamespace(
|
|
88
|
+
export function getConnectNamespace(
|
|
89
|
+
Component: ReactChild | undefined | {}
|
|
90
|
+
): string[] {
|
|
82
91
|
if ( ! Component ) return [];
|
|
83
92
|
|
|
84
93
|
let namespaces = [];
|
|
@@ -101,11 +110,13 @@ export function getConnectNamespace( Component ) {
|
|
|
101
110
|
/**
|
|
102
111
|
* Checks to see if a component is connected within the Context system.
|
|
103
112
|
*
|
|
104
|
-
* @param
|
|
105
|
-
* @param
|
|
106
|
-
* @return {boolean} The result.
|
|
113
|
+
* @param Component The component to retrieve a namespace from.
|
|
114
|
+
* @param match The namespace to check.
|
|
107
115
|
*/
|
|
108
|
-
export function hasConnectNamespace(
|
|
116
|
+
export function hasConnectNamespace(
|
|
117
|
+
Component: ReactNode,
|
|
118
|
+
match: string[] | string
|
|
119
|
+
): boolean {
|
|
109
120
|
if ( ! Component ) return false;
|
|
110
121
|
|
|
111
122
|
if ( typeof match === 'string' ) {
|
|
@@ -54,9 +54,9 @@ function useContextSystemBridge( { value } ) {
|
|
|
54
54
|
|
|
55
55
|
useUpdateEffect( () => {
|
|
56
56
|
if (
|
|
57
|
-
//
|
|
57
|
+
// Objects are equivalent.
|
|
58
58
|
isEqual( valueRef.current, value ) &&
|
|
59
|
-
//
|
|
59
|
+
// But not the same reference.
|
|
60
60
|
valueRef.current !== value
|
|
61
61
|
) {
|
|
62
62
|
warn( `Please memoize your context: ${ JSON.stringify( value ) }` );
|
|
File without changes
|
|
@@ -18,6 +18,7 @@ export type WordPressComponentProps<
|
|
|
18
18
|
Omit< React.ComponentPropsWithRef< T >, 'as' | keyof P | 'children' > &
|
|
19
19
|
( IsPolymorphic extends true
|
|
20
20
|
? {
|
|
21
|
+
/** The HTML element or React component to render the component as. */
|
|
21
22
|
as?: T | keyof JSX.IntrinsicElements;
|
|
22
23
|
}
|
|
23
24
|
: {} );
|
|
@@ -41,11 +41,11 @@ describe( 'props', () => {
|
|
|
41
41
|
const invisibleTooltipTrigger = screen.getByText(
|
|
42
42
|
invisibleTooltipTriggerContent
|
|
43
43
|
);
|
|
44
|
-
// The invisible tooltip should not render
|
|
44
|
+
// The invisible tooltip should not render.
|
|
45
45
|
expect( tooltips ).toHaveLength( 1 );
|
|
46
|
-
// Assert that the rendered tooltip is indeed the base tooltip
|
|
46
|
+
// Assert that the rendered tooltip is indeed the base tooltip.
|
|
47
47
|
expect( tooltips[ 0 ].id ).toBe( baseTooltipId );
|
|
48
|
-
// But the invisible tooltip's trigger still should have rendered
|
|
48
|
+
// But the invisible tooltip's trigger still should have rendered.
|
|
49
49
|
expect( invisibleTooltipTrigger ).not.toBeUndefined();
|
|
50
50
|
} );
|
|
51
51
|
|
|
@@ -71,7 +71,7 @@ describe( 'props', () => {
|
|
|
71
71
|
</Tooltip>
|
|
72
72
|
);
|
|
73
73
|
const tooltips = screen.getAllByRole( /tooltip/ );
|
|
74
|
-
//
|
|
74
|
+
// Assert only the base tooltip rendered.
|
|
75
75
|
expect( tooltips ).toHaveLength( 1 );
|
|
76
76
|
expect( tooltips[ 0 ].id ).toBe( baseTooltipId );
|
|
77
77
|
} );
|
package/src/ui/utils/colors.js
CHANGED
|
@@ -61,9 +61,9 @@ function _getComputedBackgroundColor( backgroundColor ) {
|
|
|
61
61
|
if ( ! el ) return '';
|
|
62
62
|
|
|
63
63
|
el.style.background = backgroundColor;
|
|
64
|
-
// Grab the style
|
|
64
|
+
// Grab the style.
|
|
65
65
|
const computedColor = window?.getComputedStyle( el ).background;
|
|
66
|
-
// Reset
|
|
66
|
+
// Reset.
|
|
67
67
|
el.style.background = '';
|
|
68
68
|
|
|
69
69
|
return computedColor || '';
|
package/src/ui/utils/space.ts
CHANGED
|
@@ -21,14 +21,14 @@ export function space( value?: SpaceInput ): string | undefined {
|
|
|
21
21
|
return undefined;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
//
|
|
24
|
+
// Handle empty strings, if it's the number 0 this still works.
|
|
25
25
|
if ( ! value ) {
|
|
26
26
|
return '0';
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
const asInt = typeof value === 'number' ? value : Number( value );
|
|
30
30
|
|
|
31
|
-
//
|
|
31
|
+
// Test if the input has a unit, was NaN, or was one of the named CSS values (like `auto`), in which case just use that value.
|
|
32
32
|
if (
|
|
33
33
|
( typeof window !== 'undefined' &&
|
|
34
34
|
window.CSS?.supports?.( 'margin', value.toString() ) ) ||
|
|
@@ -16,7 +16,7 @@ import RangeCell from '../mobile/bottom-sheet/range-cell';
|
|
|
16
16
|
import StepperCell from '../mobile/bottom-sheet/stepper-cell';
|
|
17
17
|
import Picker from '../mobile/picker';
|
|
18
18
|
import styles from './style.scss';
|
|
19
|
-
import { CSS_UNITS, hasUnits,
|
|
19
|
+
import { CSS_UNITS, hasUnits, getAccessibleLabelForUnit } from './utils';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* WordPress dependencies
|
|
@@ -116,6 +116,8 @@ function UnitControl( {
|
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
const renderUnitPicker = useCallback( () => {
|
|
119
|
+
// Keeping for legacy reasons, although `false` should not be a valid
|
|
120
|
+
// value for the `units` prop anymore.
|
|
119
121
|
if ( units === false ) {
|
|
120
122
|
return null;
|
|
121
123
|
}
|
|
@@ -164,7 +166,7 @@ function UnitControl( {
|
|
|
164
166
|
shouldDisplayTextInput
|
|
165
167
|
decimalNum={ decimalNum }
|
|
166
168
|
openUnitPicker={ onPickerPresent }
|
|
167
|
-
unitLabel={
|
|
169
|
+
unitLabel={ getAccessibleLabelForUnit( unit ) }
|
|
168
170
|
{ ...props }
|
|
169
171
|
>
|
|
170
172
|
{ renderUnitPicker() }
|
|
@@ -182,7 +184,7 @@ function UnitControl( {
|
|
|
182
184
|
separatorType={ separatorType }
|
|
183
185
|
decimalNum={ decimalNum }
|
|
184
186
|
openUnitPicker={ onPickerPresent }
|
|
185
|
-
unitLabel={
|
|
187
|
+
unitLabel={ getAccessibleLabelForUnit( unit ) }
|
|
186
188
|
{ ...props }
|
|
187
189
|
>
|
|
188
190
|
{ renderUnitPicker() }
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
KeyboardEvent,
|
|
7
7
|
ForwardedRef,
|
|
8
8
|
SyntheticEvent,
|
|
9
|
+
ChangeEvent,
|
|
9
10
|
} from 'react';
|
|
10
11
|
import { noop, omit } from 'lodash';
|
|
11
12
|
import classnames from 'classnames';
|
|
@@ -13,7 +14,7 @@ import classnames from 'classnames';
|
|
|
13
14
|
/**
|
|
14
15
|
* WordPress dependencies
|
|
15
16
|
*/
|
|
16
|
-
import { forwardRef, useMemo, useRef } from '@wordpress/element';
|
|
17
|
+
import { forwardRef, useMemo, useRef, useEffect } from '@wordpress/element';
|
|
17
18
|
import { __ } from '@wordpress/i18n';
|
|
18
19
|
import { ENTER } from '@wordpress/keycodes';
|
|
19
20
|
|
|
@@ -27,9 +28,9 @@ import { Root, ValueInput } from './styles/unit-control-styles';
|
|
|
27
28
|
import UnitSelectControl from './unit-select-control';
|
|
28
29
|
import {
|
|
29
30
|
CSS_UNITS,
|
|
30
|
-
|
|
31
|
+
getParsedQuantityAndUnit,
|
|
31
32
|
getUnitsWithCurrentUnit,
|
|
32
|
-
|
|
33
|
+
getValidParsedQuantityAndUnit,
|
|
33
34
|
} from './utils';
|
|
34
35
|
import { useControlledState } from '../utils/hooks';
|
|
35
36
|
import type { UnitControlProps, UnitControlOnChangeCallback } from './types';
|
|
@@ -57,29 +58,46 @@ function UnitControl(
|
|
|
57
58
|
}: WordPressComponentProps< UnitControlProps, 'input', false >,
|
|
58
59
|
forwardedRef: ForwardedRef< any >
|
|
59
60
|
) {
|
|
61
|
+
// The `value` prop, in theory, should not be `null`, but the following line
|
|
62
|
+
// ensures it fallback to `undefined` in case a consumer of `UnitControl`
|
|
63
|
+
// still passes `null` as a `value`.
|
|
64
|
+
const nonNullValueProp = valueProp ?? undefined;
|
|
60
65
|
const units = useMemo(
|
|
61
|
-
() => getUnitsWithCurrentUnit(
|
|
62
|
-
[
|
|
66
|
+
() => getUnitsWithCurrentUnit( nonNullValueProp, unitProp, unitsProp ),
|
|
67
|
+
[ nonNullValueProp, unitProp, unitsProp ]
|
|
63
68
|
);
|
|
64
|
-
const [
|
|
69
|
+
const [ parsedQuantity, parsedUnit ] = getParsedQuantityAndUnit(
|
|
70
|
+
nonNullValueProp,
|
|
71
|
+
unitProp,
|
|
72
|
+
units
|
|
73
|
+
);
|
|
74
|
+
|
|
65
75
|
const [ unit, setUnit ] = useControlledState< string | undefined >(
|
|
66
76
|
unitProp,
|
|
67
77
|
{
|
|
68
|
-
initial:
|
|
78
|
+
initial: parsedUnit,
|
|
69
79
|
fallback: '',
|
|
70
80
|
}
|
|
71
81
|
);
|
|
72
82
|
|
|
73
|
-
|
|
74
|
-
|
|
83
|
+
useEffect( () => {
|
|
84
|
+
setUnit( parsedUnit );
|
|
85
|
+
}, [ parsedUnit ] );
|
|
86
|
+
|
|
87
|
+
// Stores parsed value for hand-off in state reducer.
|
|
88
|
+
const refParsedQuantity = useRef< number | undefined >( undefined );
|
|
75
89
|
|
|
76
90
|
const classes = classnames( 'components-unit-control', className );
|
|
77
91
|
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
changeProps
|
|
92
|
+
const handleOnQuantityChange = (
|
|
93
|
+
nextQuantityValue: number | string | undefined,
|
|
94
|
+
changeProps: { event: ChangeEvent< HTMLInputElement > }
|
|
81
95
|
) => {
|
|
82
|
-
if (
|
|
96
|
+
if (
|
|
97
|
+
nextQuantityValue === '' ||
|
|
98
|
+
typeof nextQuantityValue === 'undefined' ||
|
|
99
|
+
nextQuantityValue === null
|
|
100
|
+
) {
|
|
83
101
|
onChange( '', changeProps );
|
|
84
102
|
return;
|
|
85
103
|
}
|
|
@@ -88,53 +106,64 @@ function UnitControl(
|
|
|
88
106
|
* Customizing the onChange callback.
|
|
89
107
|
* This allows as to broadcast a combined value+unit to onChange.
|
|
90
108
|
*/
|
|
91
|
-
|
|
109
|
+
const onChangeValue = getValidParsedQuantityAndUnit(
|
|
110
|
+
nextQuantityValue,
|
|
111
|
+
units,
|
|
112
|
+
parsedQuantity,
|
|
113
|
+
unit
|
|
114
|
+
).join( '' );
|
|
92
115
|
|
|
93
|
-
onChange(
|
|
116
|
+
onChange( onChangeValue, changeProps );
|
|
94
117
|
};
|
|
95
118
|
|
|
96
119
|
const handleOnUnitChange: UnitControlOnChangeCallback = (
|
|
97
|
-
|
|
120
|
+
nextUnitValue,
|
|
98
121
|
changeProps
|
|
99
122
|
) => {
|
|
100
123
|
const { data } = changeProps;
|
|
101
124
|
|
|
102
|
-
let nextValue = `${
|
|
125
|
+
let nextValue = `${ parsedQuantity ?? '' }${ nextUnitValue }`;
|
|
103
126
|
|
|
104
127
|
if ( isResetValueOnUnitChange && data?.default !== undefined ) {
|
|
105
|
-
nextValue = `${ data.default }${
|
|
128
|
+
nextValue = `${ data.default }${ nextUnitValue }`;
|
|
106
129
|
}
|
|
107
130
|
|
|
108
131
|
onChange( nextValue, changeProps );
|
|
109
|
-
onUnitChange(
|
|
132
|
+
onUnitChange( nextUnitValue, changeProps );
|
|
110
133
|
|
|
111
|
-
setUnit(
|
|
134
|
+
setUnit( nextUnitValue );
|
|
112
135
|
};
|
|
113
136
|
|
|
114
137
|
const mayUpdateUnit = ( event: SyntheticEvent< HTMLInputElement > ) => {
|
|
115
138
|
if ( ! isNaN( Number( event.currentTarget.value ) ) ) {
|
|
116
|
-
|
|
139
|
+
refParsedQuantity.current = undefined;
|
|
117
140
|
return;
|
|
118
141
|
}
|
|
119
|
-
const [
|
|
142
|
+
const [
|
|
143
|
+
validParsedQuantity,
|
|
144
|
+
validParsedUnit,
|
|
145
|
+
] = getValidParsedQuantityAndUnit(
|
|
120
146
|
event.currentTarget.value,
|
|
121
147
|
units,
|
|
122
|
-
|
|
148
|
+
parsedQuantity,
|
|
123
149
|
unit
|
|
124
150
|
);
|
|
125
151
|
|
|
126
|
-
|
|
152
|
+
refParsedQuantity.current = validParsedQuantity;
|
|
127
153
|
|
|
128
|
-
if ( isPressEnterToChange &&
|
|
154
|
+
if ( isPressEnterToChange && validParsedUnit !== unit ) {
|
|
129
155
|
const data = Array.isArray( units )
|
|
130
|
-
? units.find( ( option ) => option.value ===
|
|
156
|
+
? units.find( ( option ) => option.value === validParsedUnit )
|
|
131
157
|
: undefined;
|
|
132
158
|
const changeProps = { event, data };
|
|
133
159
|
|
|
134
|
-
onChange(
|
|
135
|
-
|
|
160
|
+
onChange(
|
|
161
|
+
`${ validParsedQuantity ?? '' }${ validParsedUnit }`,
|
|
162
|
+
changeProps
|
|
163
|
+
);
|
|
164
|
+
onUnitChange( validParsedUnit, changeProps );
|
|
136
165
|
|
|
137
|
-
setUnit(
|
|
166
|
+
setUnit( validParsedUnit );
|
|
138
167
|
}
|
|
139
168
|
};
|
|
140
169
|
|
|
@@ -163,9 +192,9 @@ function UnitControl(
|
|
|
163
192
|
* then use that result to update the state.
|
|
164
193
|
*/
|
|
165
194
|
if ( action.type === inputControlActionTypes.COMMIT ) {
|
|
166
|
-
if (
|
|
167
|
-
state.value =
|
|
168
|
-
|
|
195
|
+
if ( refParsedQuantity.current !== undefined ) {
|
|
196
|
+
state.value = ( refParsedQuantity.current ?? '' ).toString();
|
|
197
|
+
refParsedQuantity.current = undefined;
|
|
169
198
|
}
|
|
170
199
|
}
|
|
171
200
|
|
|
@@ -209,11 +238,11 @@ function UnitControl(
|
|
|
209
238
|
label={ label }
|
|
210
239
|
onBlur={ handleOnBlur }
|
|
211
240
|
onKeyDown={ handleOnKeyDown }
|
|
212
|
-
onChange={
|
|
241
|
+
onChange={ handleOnQuantityChange }
|
|
213
242
|
ref={ forwardedRef }
|
|
214
243
|
size={ size }
|
|
215
244
|
suffix={ inputSuffix }
|
|
216
|
-
value={
|
|
245
|
+
value={ parsedQuantity ?? '' }
|
|
217
246
|
step={ step }
|
|
218
247
|
__unstableStateReducer={ composeStateReducers(
|
|
219
248
|
unitControlStateReducer,
|
|
@@ -242,5 +271,5 @@ function UnitControl(
|
|
|
242
271
|
*/
|
|
243
272
|
const ForwardedUnitControl = forwardRef( UnitControl );
|
|
244
273
|
|
|
245
|
-
export {
|
|
274
|
+
export { parseQuantityAndUnitFromRawValue, useCustomUnits } from './utils';
|
|
246
275
|
export default ForwardedUnitControl;
|