@wordpress/components 19.4.0 → 19.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 +16 -1
- package/CONTRIBUTING.md +69 -2
- package/build/box-control/unit-control.js +2 -2
- package/build/box-control/unit-control.js.map +1 -1
- package/build/card/card/component.js +2 -2
- package/build/card/card/component.js.map +1 -1
- package/build/card/card-body/component.js +1 -1
- package/build/card/card-body/component.js.map +1 -1
- package/build/card/card-divider/component.js +1 -1
- package/build/card/card-divider/component.js.map +1 -1
- package/build/card/card-footer/component.js +1 -1
- package/build/card/card-footer/component.js.map +1 -1
- package/build/card/card-header/component.js +1 -1
- package/build/card/card-header/component.js.map +1 -1
- package/build/card/card-media/component.js +1 -1
- package/build/card/card-media/component.js.map +1 -1
- package/build/color-palette/index.native.js +35 -30
- package/build/color-palette/index.native.js.map +1 -1
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/hex-input.js +6 -9
- package/build/color-picker/hex-input.js.map +1 -1
- package/build/confirm-dialog/component.js.map +1 -1
- package/build/divider/component.js.map +1 -1
- package/build/elevation/component.js +1 -1
- package/build/elevation/component.js.map +1 -1
- package/build/flex/flex/component.js +1 -1
- package/build/flex/flex/component.js.map +1 -1
- package/build/flex/flex-block/component.js +1 -1
- package/build/flex/flex-block/component.js.map +1 -1
- package/build/flex/flex-item/component.js +1 -1
- package/build/flex/flex-item/component.js.map +1 -1
- package/build/flyout/flyout/component.js +1 -1
- package/build/flyout/flyout/component.js.map +1 -1
- package/build/flyout/flyout-content/component.js +1 -1
- package/build/flyout/flyout-content/component.js.map +1 -1
- package/build/focal-point-picker/index.js +18 -12
- package/build/focal-point-picker/index.js.map +1 -1
- package/build/font-size-picker/index.js +0 -1
- package/build/font-size-picker/index.js.map +1 -1
- package/build/grid/component.js +1 -1
- package/build/grid/component.js.map +1 -1
- package/build/h-stack/component.js +1 -1
- package/build/h-stack/component.js.map +1 -1
- package/build/heading/component.js.map +1 -1
- package/build/index.js +12 -0
- package/build/index.js.map +1 -1
- package/build/index.native.js +15 -1
- package/build/index.native.js.map +1 -1
- package/build/input-control/index.js.map +1 -1
- package/build/input-control/input-base.js.map +1 -1
- package/build/input-control/input-field.js +7 -7
- package/build/input-control/input-field.js.map +1 -1
- package/build/input-control/reducer/reducer.js +3 -0
- package/build/input-control/reducer/reducer.js.map +1 -1
- package/build/item-group/item/component.js.map +1 -1
- package/build/item-group/item-group/component.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build/mobile/color-settings/palette.screen.native.js +26 -9
- package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build/mobile/global-styles-context/utils.native.js +63 -9
- package/build/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build/mobile/inserter-button/index.native.js +3 -3
- package/build/mobile/inserter-button/index.native.js.map +1 -1
- package/build/mobile/inserter-button/sparkles.js +25 -0
- package/build/mobile/inserter-button/sparkles.js.map +1 -0
- package/build/navigator/index.js +16 -0
- package/build/navigator/index.js.map +1 -1
- package/build/navigator/navigator-back-button/component.js +72 -0
- package/build/navigator/navigator-back-button/component.js.map +1 -0
- package/build/navigator/navigator-back-button/hook.js +49 -0
- package/build/navigator/navigator-back-button/hook.js.map +1 -0
- package/build/navigator/navigator-back-button/index.js +16 -0
- package/build/navigator/navigator-back-button/index.js.map +1 -0
- package/build/navigator/navigator-button/component.js +71 -0
- package/build/navigator/navigator-button/component.js.map +1 -0
- package/build/navigator/navigator-button/hook.js +59 -0
- package/build/navigator/navigator-button/hook.js.map +1 -0
- package/build/navigator/navigator-button/index.js +16 -0
- package/build/navigator/navigator-button/index.js.map +1 -0
- package/build/navigator/navigator-provider/component.js +11 -21
- package/build/navigator/navigator-provider/component.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +14 -22
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/resizable-box/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/label.js.map +1 -1
- package/build/scrollable/component.js +1 -1
- package/build/scrollable/component.js.map +1 -1
- package/build/select-control/index.js.map +1 -1
- package/build/spacer/component.js.map +1 -1
- package/build/surface/component.js +1 -1
- package/build/surface/component.js.map +1 -1
- package/build/text/component.js +1 -1
- package/build/text/component.js.map +1 -1
- package/build/text-control/index.js +2 -2
- package/build/text-control/index.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
- package/build/tools-panel/tools-panel/component.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/tools-panel/tools-panel-item/component.js.map +1 -1
- package/build/tree-grid/index.js +50 -6
- package/build/tree-grid/index.js.map +1 -1
- package/build/truncate/component.js +1 -1
- package/build/truncate/component.js.map +1 -1
- package/build/ui/control-group/component.js +1 -1
- package/build/ui/control-group/component.js.map +1 -1
- package/build/ui/control-label/component.js +1 -1
- package/build/ui/control-label/component.js.map +1 -1
- package/build/ui/form-group/form-group.js +1 -1
- package/build/ui/form-group/form-group.js.map +1 -1
- package/build/ui/shortcut/component.js.map +1 -1
- package/build/ui/spinner/component.js +1 -1
- package/build/ui/spinner/component.js.map +1 -1
- package/build/ui/tooltip/component.js +1 -1
- package/build/ui/tooltip/component.js.map +1 -1
- package/build/ui/tooltip/content.js +1 -1
- package/build/ui/tooltip/content.js.map +1 -1
- package/build/unit-control/index.js.map +1 -1
- package/build/v-stack/component.js +1 -1
- package/build/v-stack/component.js.map +1 -1
- package/build/visually-hidden/component.js +1 -1
- package/build/visually-hidden/component.js.map +1 -1
- package/build/z-stack/component.js.map +1 -1
- package/build-module/box-control/unit-control.js +1 -1
- package/build-module/box-control/unit-control.js.map +1 -1
- package/build-module/card/card/component.js +2 -2
- package/build-module/card/card/component.js.map +1 -1
- package/build-module/card/card-body/component.js +1 -1
- package/build-module/card/card-body/component.js.map +1 -1
- package/build-module/card/card-divider/component.js +1 -1
- package/build-module/card/card-divider/component.js.map +1 -1
- package/build-module/card/card-footer/component.js +1 -1
- package/build-module/card/card-footer/component.js.map +1 -1
- package/build-module/card/card-header/component.js +1 -1
- package/build-module/card/card-header/component.js.map +1 -1
- package/build-module/card/card-media/component.js +1 -1
- package/build-module/card/card-media/component.js.map +1 -1
- package/build-module/color-palette/index.native.js +36 -31
- package/build-module/color-palette/index.native.js.map +1 -1
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/hex-input.js +6 -9
- package/build-module/color-picker/hex-input.js.map +1 -1
- package/build-module/confirm-dialog/component.js.map +1 -1
- package/build-module/divider/component.js.map +1 -1
- package/build-module/elevation/component.js +1 -1
- package/build-module/elevation/component.js.map +1 -1
- package/build-module/flex/flex/component.js +1 -1
- package/build-module/flex/flex/component.js.map +1 -1
- package/build-module/flex/flex-block/component.js +1 -1
- package/build-module/flex/flex-block/component.js.map +1 -1
- package/build-module/flex/flex-item/component.js +1 -1
- package/build-module/flex/flex-item/component.js.map +1 -1
- package/build-module/flyout/flyout/component.js +1 -1
- package/build-module/flyout/flyout/component.js.map +1 -1
- package/build-module/flyout/flyout-content/component.js +1 -1
- package/build-module/flyout/flyout-content/component.js.map +1 -1
- package/build-module/focal-point-picker/index.js +18 -12
- package/build-module/focal-point-picker/index.js.map +1 -1
- package/build-module/font-size-picker/index.js +0 -1
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/grid/component.js +1 -1
- package/build-module/grid/component.js.map +1 -1
- package/build-module/h-stack/component.js +1 -1
- package/build-module/h-stack/component.js.map +1 -1
- package/build-module/heading/component.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +1 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/input-control/index.js.map +1 -1
- package/build-module/input-control/input-base.js.map +1 -1
- package/build-module/input-control/input-field.js +6 -6
- package/build-module/input-control/input-field.js.map +1 -1
- package/build-module/input-control/reducer/reducer.js +3 -0
- package/build-module/input-control/reducer/reducer.js.map +1 -1
- package/build-module/item-group/item/component.js.map +1 -1
- package/build-module/item-group/item-group/component.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build-module/mobile/color-settings/palette.screen.native.js +27 -10
- package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js +60 -10
- package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build-module/mobile/inserter-button/index.native.js +1 -1
- package/build-module/mobile/inserter-button/index.native.js.map +1 -1
- package/build-module/mobile/inserter-button/sparkles.js +16 -0
- package/build-module/mobile/inserter-button/sparkles.js.map +1 -0
- package/build-module/navigator/index.js +2 -0
- package/build-module/navigator/index.js.map +1 -1
- package/build-module/navigator/navigator-back-button/component.js +59 -0
- package/build-module/navigator/navigator-back-button/component.js.map +1 -0
- package/build-module/navigator/navigator-back-button/hook.js +36 -0
- package/build-module/navigator/navigator-back-button/hook.js.map +1 -0
- package/build-module/navigator/navigator-back-button/index.js +2 -0
- package/build-module/navigator/navigator-back-button/index.js.map +1 -0
- package/build-module/navigator/navigator-button/component.js +58 -0
- package/build-module/navigator/navigator-button/component.js.map +1 -0
- package/build-module/navigator/navigator-button/hook.js +46 -0
- package/build-module/navigator/navigator-button/hook.js.map +1 -0
- package/build-module/navigator/navigator-button/index.js +2 -0
- package/build-module/navigator/navigator-button/index.js.map +1 -0
- package/build-module/navigator/navigator-provider/component.js +11 -21
- package/build-module/navigator/navigator-provider/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +13 -22
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/resizable-box/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/label.js.map +1 -1
- package/build-module/scrollable/component.js +1 -1
- package/build-module/scrollable/component.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/spacer/component.js.map +1 -1
- package/build-module/surface/component.js +1 -1
- package/build-module/surface/component.js.map +1 -1
- package/build-module/text/component.js +1 -1
- package/build-module/text/component.js.map +1 -1
- package/build-module/text-control/index.js +2 -2
- package/build-module/text-control/index.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-item/component.js.map +1 -1
- package/build-module/tree-grid/index.js +51 -7
- package/build-module/tree-grid/index.js.map +1 -1
- package/build-module/truncate/component.js +1 -1
- package/build-module/truncate/component.js.map +1 -1
- package/build-module/ui/control-group/component.js +1 -1
- package/build-module/ui/control-group/component.js.map +1 -1
- package/build-module/ui/control-label/component.js +1 -1
- package/build-module/ui/control-label/component.js.map +1 -1
- package/build-module/ui/form-group/form-group.js +1 -1
- package/build-module/ui/form-group/form-group.js.map +1 -1
- package/build-module/ui/shortcut/component.js.map +1 -1
- package/build-module/ui/spinner/component.js +1 -1
- package/build-module/ui/spinner/component.js.map +1 -1
- package/build-module/ui/tooltip/component.js +1 -1
- package/build-module/ui/tooltip/component.js.map +1 -1
- package/build-module/ui/tooltip/content.js +1 -1
- package/build-module/ui/tooltip/content.js.map +1 -1
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/v-stack/component.js +1 -1
- package/build-module/v-stack/component.js.map +1 -1
- package/build-module/visually-hidden/component.js +1 -1
- package/build-module/visually-hidden/component.js.map +1 -1
- package/build-module/z-stack/component.js.map +1 -1
- package/build-types/card/card-divider/hook.d.ts +0 -1
- package/build-types/card/card-divider/hook.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +2 -4
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/confirm-dialog/component.d.ts +2 -6
- package/build-types/confirm-dialog/component.d.ts.map +1 -1
- package/build-types/flyout/flyout/hook.d.ts +0 -1
- package/build-types/flyout/flyout/hook.d.ts.map +1 -1
- package/build-types/input-control/index.d.ts +3 -3
- package/build-types/input-control/index.d.ts.map +1 -1
- package/build-types/input-control/input-base.d.ts +2 -2
- package/build-types/input-control/input-base.d.ts.map +1 -1
- package/build-types/input-control/input-field.d.ts +1 -3
- package/build-types/input-control/input-field.d.ts.map +1 -1
- package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
- package/build-types/input-control/types.d.ts +1 -1
- package/build-types/input-control/types.d.ts.map +1 -1
- package/build-types/navigator/index.d.ts +2 -0
- package/build-types/navigator/index.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/component.d.ts +38 -0
- package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -0
- package/build-types/navigator/navigator-back-button/hook.d.ts +282 -0
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -0
- package/build-types/navigator/navigator-back-button/index.d.ts +2 -0
- package/build-types/navigator/navigator-back-button/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-button/component.d.ts +37 -0
- package/build-types/navigator/navigator-button/component.d.ts.map +1 -0
- package/build-types/navigator/navigator-button/hook.d.ts +282 -0
- package/build-types/navigator/navigator-button/hook.d.ts.map +1 -0
- package/build-types/navigator/navigator-button/index.d.ts +2 -0
- package/build-types/navigator/navigator-button/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-provider/component.d.ts +10 -20
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts +10 -20
- package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
- package/build-types/navigator/types.d.ts +21 -0
- package/build-types/navigator/types.d.ts.map +1 -1
- package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
- package/build-types/resizable-box/index.d.ts +2 -2
- package/build-types/resizable-box/index.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
- package/build-types/select-control/index.d.ts +1 -3
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/ui/context/wordpress-component.d.ts +2 -6
- package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +1 -3
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/z-stack/component.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/alignment-matrix-control/README.md +4 -0
- package/src/alignment-matrix-control/stories/index.js +1 -1
- package/src/base-control/stories/index.js +65 -22
- package/src/box-control/stories/index.js +4 -1
- package/src/box-control/unit-control.js +1 -1
- package/src/card/card/component.js +1 -1
- package/src/card/card-body/component.js +1 -1
- package/src/card/card-divider/component.js +1 -1
- package/src/card/card-footer/component.js +1 -1
- package/src/card/card-header/component.js +1 -1
- package/src/card/card-media/component.js +1 -1
- package/src/color-palette/index.native.js +92 -75
- package/src/color-palette/style.native.scss +10 -5
- package/src/color-picker/component.tsx +2 -2
- package/src/color-picker/hex-input.tsx +9 -9
- package/src/confirm-dialog/component.tsx +2 -2
- package/src/divider/component.tsx +2 -2
- package/src/elevation/component.js +1 -1
- package/src/flex/flex/component.js +1 -1
- package/src/flex/flex-block/component.js +1 -1
- package/src/flex/flex-item/component.js +1 -1
- package/src/flyout/flyout/component.js +1 -1
- package/src/flyout/flyout-content/component.js +1 -1
- package/src/focal-point-picker/README.md +7 -0
- package/src/focal-point-picker/index.js +12 -7
- package/src/focal-point-picker/stories/index.js +30 -0
- package/src/focal-point-picker/test/index.js +44 -0
- package/src/font-size-picker/index.js +0 -1
- package/src/form-file-upload/README.md +1 -1
- package/src/form-file-upload/stories/index.js +51 -0
- package/src/grid/component.js +1 -1
- package/src/h-stack/component.js +1 -1
- package/src/heading/component.tsx +2 -2
- package/src/index.js +2 -0
- package/src/index.native.js +5 -1
- package/src/input-control/index.tsx +2 -2
- package/src/input-control/input-base.tsx +2 -2
- package/src/input-control/input-field.tsx +4 -6
- package/src/input-control/reducer/reducer.ts +3 -0
- package/src/input-control/stories/index.js +1 -1
- package/src/input-control/types.ts +1 -1
- package/src/item-group/item/component.tsx +2 -2
- package/src/item-group/item-group/component.tsx +2 -2
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +10 -1
- package/src/mobile/color-settings/palette.screen.native.js +39 -9
- package/src/mobile/color-settings/style.native.scss +4 -0
- package/src/mobile/global-styles-context/test/fixtures/theme.native.js +27 -0
- package/src/mobile/global-styles-context/test/utils.native.js +2 -2
- package/src/mobile/global-styles-context/utils.native.js +75 -6
- package/src/mobile/inserter-button/index.native.js +1 -2
- package/src/mobile/inserter-button/sparkles.js +15 -0
- package/src/navigation/stories/index.js +1 -1
- package/src/navigator/index.ts +2 -0
- package/src/navigator/navigator-back-button/README.md +31 -0
- package/src/navigator/navigator-back-button/component.tsx +62 -0
- package/src/navigator/navigator-back-button/hook.ts +40 -0
- package/src/navigator/navigator-back-button/index.ts +1 -0
- package/src/navigator/navigator-button/README.md +38 -0
- package/src/navigator/navigator-button/component.tsx +61 -0
- package/src/navigator/navigator-button/hook.ts +55 -0
- package/src/navigator/navigator-button/index.ts +1 -0
- package/src/navigator/navigator-provider/README.md +20 -33
- package/src/navigator/navigator-provider/component.tsx +12 -22
- package/src/navigator/navigator-screen/README.md +1 -1
- package/src/navigator/navigator-screen/component.tsx +14 -23
- package/src/navigator/stories/index.js +24 -37
- package/src/navigator/test/index.js +89 -34
- package/src/navigator/types.ts +26 -0
- package/src/number-control/stories/index.js +1 -1
- package/src/radio/stories/index.js +1 -1
- package/src/radio-group/stories/index.js +4 -1
- package/src/resizable-box/index.tsx +2 -2
- package/src/resizable-box/resize-tooltip/index.tsx +2 -2
- package/src/resizable-box/resize-tooltip/label.tsx +2 -2
- package/src/scrollable/component.js +1 -1
- package/src/select-control/index.tsx +2 -3
- package/src/spacer/component.tsx +2 -2
- package/src/surface/component.js +1 -1
- package/src/text/component.js +1 -1
- package/src/text-control/index.js +2 -2
- package/src/toggle-group-control/stories/index.js +1 -1
- package/src/toggle-group-control/toggle-group-control/component.tsx +2 -2
- package/src/toggle-group-control/toggle-group-control-option/component.tsx +2 -2
- package/src/tools-panel/stories/index.js +0 -1
- package/src/tools-panel/tools-panel/component.tsx +2 -2
- package/src/tools-panel/tools-panel-header/component.tsx +2 -2
- package/src/tools-panel/tools-panel-item/component.tsx +2 -2
- package/src/tree-grid/README.md +24 -1
- package/src/tree-grid/index.js +66 -7
- package/src/tree-grid/stories/index.js +4 -1
- package/src/tree-grid/test/__snapshots__/index.js.snap +1 -14
- package/src/tree-grid/test/index.js +226 -7
- package/src/truncate/component.js +1 -1
- package/src/ui/context/wordpress-component.ts +2 -2
- package/src/ui/control-group/component.js +1 -1
- package/src/ui/control-label/component.js +1 -1
- package/src/ui/form-group/form-group.js +1 -1
- package/src/ui/shortcut/component.tsx +2 -2
- package/src/ui/spinner/component.js +1 -1
- package/src/ui/tooltip/component.js +1 -1
- package/src/ui/tooltip/content.js +1 -1
- package/src/unit-control/index.tsx +2 -2
- package/src/unit-control/stories/index.js +1 -1
- package/src/v-stack/component.js +1 -1
- package/src/visually-hidden/component.js +1 -1
- package/src/z-stack/component.tsx +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/src/tools-panel/stories/typography-panel.js +0 -215
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { ForwardedRef } from 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -15,7 +15,7 @@ import type { ToolsPanelProps } from '../types';
|
|
|
15
15
|
|
|
16
16
|
const ToolsPanel = (
|
|
17
17
|
props: WordPressComponentProps< ToolsPanelProps, 'div' >,
|
|
18
|
-
forwardedRef:
|
|
18
|
+
forwardedRef: ForwardedRef< any >
|
|
19
19
|
) => {
|
|
20
20
|
const {
|
|
21
21
|
children,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { ForwardedRef } from 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -114,7 +114,7 @@ const OptionalControlsGroup = ( {
|
|
|
114
114
|
|
|
115
115
|
const ToolsPanelHeader = (
|
|
116
116
|
props: WordPressComponentProps< ToolsPanelHeaderProps, 'h2' >,
|
|
117
|
-
forwardedRef:
|
|
117
|
+
forwardedRef: ForwardedRef< any >
|
|
118
118
|
) => {
|
|
119
119
|
const {
|
|
120
120
|
areAllOptionalControlsHidden,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { ForwardedRef } from 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -15,7 +15,7 @@ import type { ToolsPanelItemProps } from '../types';
|
|
|
15
15
|
// prevents props being applied to HTML elements that would make them invalid.
|
|
16
16
|
const ToolsPanelItem = (
|
|
17
17
|
props: WordPressComponentProps< ToolsPanelItemProps, 'div' >,
|
|
18
|
-
forwardedRef:
|
|
18
|
+
forwardedRef: ForwardedRef< any >
|
|
19
19
|
) => {
|
|
20
20
|
const {
|
|
21
21
|
children,
|
package/src/tree-grid/README.md
CHANGED
|
@@ -108,10 +108,33 @@ function TreeMenu() {
|
|
|
108
108
|
|
|
109
109
|
##### Props
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
Aside from the documented callback functions, any props specified will be passed to the `table` element rendered by `TreeGrid`.
|
|
112
112
|
|
|
113
113
|
`TreeGrid` should always have children.
|
|
114
114
|
|
|
115
|
+
###### onFocusRow( event: Event, startRow: HTMLElement, destinationRow: HTMLElement )
|
|
116
|
+
|
|
117
|
+
Callback that fires when focus is shifted from one row to another via the UP and DOWN keys.
|
|
118
|
+
The callback is passed the event, the start row element that the focus was on originally, and
|
|
119
|
+
the destination row element after the focus has moved.
|
|
120
|
+
|
|
121
|
+
- Type: `Function`
|
|
122
|
+
- Required: No
|
|
123
|
+
|
|
124
|
+
###### onCollapseRow( row: HTMLElement )
|
|
125
|
+
|
|
126
|
+
A callback that passes in the row element to be collapsed.
|
|
127
|
+
|
|
128
|
+
- Type: `Function`
|
|
129
|
+
- Required: No
|
|
130
|
+
|
|
131
|
+
###### onExpandRow( row: HTMLElement )
|
|
132
|
+
|
|
133
|
+
A callback that passes in the row element to be expanded.
|
|
134
|
+
|
|
135
|
+
- Type: `Function`
|
|
136
|
+
- Required: No
|
|
137
|
+
|
|
115
138
|
#### TreeGridRow
|
|
116
139
|
|
|
117
140
|
##### Props
|
package/src/tree-grid/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { includes } from 'lodash';
|
|
|
8
8
|
*/
|
|
9
9
|
import { focus } from '@wordpress/dom';
|
|
10
10
|
import { forwardRef, useCallback } from '@wordpress/element';
|
|
11
|
-
import { UP, DOWN, LEFT, RIGHT } from '@wordpress/keycodes';
|
|
11
|
+
import { UP, DOWN, LEFT, RIGHT, HOME, END } from '@wordpress/keycodes';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
@@ -45,22 +45,30 @@ function getRowFocusables( rowElement ) {
|
|
|
45
45
|
* @param {WPElement} props.children Children to be rendered.
|
|
46
46
|
* @param {Function} props.onExpandRow Callback to fire when row is expanded.
|
|
47
47
|
* @param {Function} props.onCollapseRow Callback to fire when row is collapsed.
|
|
48
|
+
* @param {Function} props.onFocusRow Callback to fire when moving focus to a different row.
|
|
48
49
|
* @param {Object} ref A ref to the underlying DOM table element.
|
|
49
50
|
*/
|
|
50
51
|
function TreeGrid(
|
|
51
|
-
{
|
|
52
|
+
{
|
|
53
|
+
children,
|
|
54
|
+
onExpandRow = () => {},
|
|
55
|
+
onCollapseRow = () => {},
|
|
56
|
+
onFocusRow = () => {},
|
|
57
|
+
...props
|
|
58
|
+
},
|
|
52
59
|
ref
|
|
53
60
|
) {
|
|
54
61
|
const onKeyDown = useCallback(
|
|
55
62
|
( event ) => {
|
|
56
|
-
const { keyCode, metaKey, ctrlKey, altKey
|
|
63
|
+
const { keyCode, metaKey, ctrlKey, altKey } = event;
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
|
|
65
|
+
// The shift key is intentionally absent from the following list,
|
|
66
|
+
// to enable shift + up/down to select items from the list.
|
|
67
|
+
const hasModifierKeyPressed = metaKey || ctrlKey || altKey;
|
|
60
68
|
|
|
61
69
|
if (
|
|
62
70
|
hasModifierKeyPressed ||
|
|
63
|
-
! includes( [ UP, DOWN, LEFT, RIGHT ], keyCode )
|
|
71
|
+
! includes( [ UP, DOWN, LEFT, RIGHT, HOME, END ], keyCode )
|
|
64
72
|
) {
|
|
65
73
|
return;
|
|
66
74
|
}
|
|
@@ -216,12 +224,63 @@ function TreeGrid(
|
|
|
216
224
|
);
|
|
217
225
|
focusablesInNextRow[ nextIndex ].focus();
|
|
218
226
|
|
|
227
|
+
// Let consumers know the row that was originally focused,
|
|
228
|
+
// and the row that is now in focus.
|
|
229
|
+
onFocusRow( event, activeRow, rows[ nextRowIndex ] );
|
|
230
|
+
|
|
231
|
+
// Prevent key use for anything else. This ensures Voiceover
|
|
232
|
+
// doesn't try to handle key navigation.
|
|
233
|
+
event.preventDefault();
|
|
234
|
+
} else if ( includes( [ HOME, END ], keyCode ) ) {
|
|
235
|
+
// Calculate the rowIndex of the next row.
|
|
236
|
+
const rows = Array.from(
|
|
237
|
+
treeGridElement.querySelectorAll( '[role="row"]' )
|
|
238
|
+
);
|
|
239
|
+
const currentRowIndex = rows.indexOf( activeRow );
|
|
240
|
+
let nextRowIndex;
|
|
241
|
+
|
|
242
|
+
if ( keyCode === HOME ) {
|
|
243
|
+
nextRowIndex = 0;
|
|
244
|
+
} else {
|
|
245
|
+
nextRowIndex = rows.length - 1;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Focus is either at the top or bottom edge of the grid. Do nothing.
|
|
249
|
+
if ( nextRowIndex === currentRowIndex ) {
|
|
250
|
+
// Prevent key use for anything else. For example, Voiceover
|
|
251
|
+
// will start navigating horizontally when reaching the vertical
|
|
252
|
+
// bounds of a table.
|
|
253
|
+
event.preventDefault();
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Get the focusables in the next row.
|
|
258
|
+
const focusablesInNextRow = getRowFocusables(
|
|
259
|
+
rows[ nextRowIndex ]
|
|
260
|
+
);
|
|
261
|
+
|
|
262
|
+
// If for some reason there are no focusables in the next row, do nothing.
|
|
263
|
+
if ( ! focusablesInNextRow || ! focusablesInNextRow.length ) {
|
|
264
|
+
// Prevent key use for anything else. For example, Voiceover
|
|
265
|
+
// will still focus text when using arrow keys, while this
|
|
266
|
+
// component should limit navigation to focusables.
|
|
267
|
+
event.preventDefault();
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// Try to focus the element in the next row that's at a similar column to the activeElement.
|
|
272
|
+
const nextIndex = Math.min(
|
|
273
|
+
currentColumnIndex,
|
|
274
|
+
focusablesInNextRow.length - 1
|
|
275
|
+
);
|
|
276
|
+
focusablesInNextRow[ nextIndex ].focus();
|
|
277
|
+
|
|
219
278
|
// Prevent key use for anything else. This ensures Voiceover
|
|
220
279
|
// doesn't try to handle key navigation.
|
|
221
280
|
event.preventDefault();
|
|
222
281
|
}
|
|
223
282
|
},
|
|
224
|
-
[ onExpandRow, onCollapseRow ]
|
|
283
|
+
[ onExpandRow, onCollapseRow, onFocusRow ]
|
|
225
284
|
);
|
|
226
285
|
|
|
227
286
|
/* Disable reason: A treegrid is implemented using a table element. */
|
|
@@ -9,7 +9,10 @@ import { Fragment } from '@wordpress/element';
|
|
|
9
9
|
import TreeGrid, { TreeGridRow, TreeGridCell } from '../';
|
|
10
10
|
import { Button } from '../../';
|
|
11
11
|
|
|
12
|
-
export default {
|
|
12
|
+
export default {
|
|
13
|
+
title: 'Components (Experimental)/TreeGrid',
|
|
14
|
+
component: TreeGrid,
|
|
15
|
+
};
|
|
13
16
|
|
|
14
17
|
const groceries = [
|
|
15
18
|
{
|
|
@@ -1,16 +1,3 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`TreeGrid renders a table, tbody and any child elements 1`] = `
|
|
4
|
-
<table
|
|
5
|
-
onKeyDown={[Function]}
|
|
6
|
-
role="treegrid"
|
|
7
|
-
>
|
|
8
|
-
<tbody>
|
|
9
|
-
<tr>
|
|
10
|
-
<td>
|
|
11
|
-
Test
|
|
12
|
-
</td>
|
|
13
|
-
</tr>
|
|
14
|
-
</tbody>
|
|
15
|
-
</table>
|
|
16
|
-
`;
|
|
3
|
+
exports[`TreeGrid simple rendering renders a table, tbody and any child elements 1`] = `"<table role=\\"treegrid\\"><tbody><tr><td>Test</td></tr></tbody></table>"`;
|
|
@@ -1,23 +1,242 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { LEFT, RIGHT, UP, DOWN } from '@wordpress/keycodes';
|
|
10
|
+
import { forwardRef } from '@wordpress/element';
|
|
5
11
|
|
|
6
12
|
/**
|
|
7
13
|
* Internal dependencies
|
|
8
14
|
*/
|
|
9
15
|
import TreeGrid from '../';
|
|
10
16
|
|
|
17
|
+
const TestButton = forwardRef( ( { ...props }, ref ) => (
|
|
18
|
+
<button { ...props } ref={ ref }></button>
|
|
19
|
+
) );
|
|
20
|
+
|
|
11
21
|
describe( 'TreeGrid', () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
const originalGetClientRects = window.Element.prototype.getClientRects;
|
|
23
|
+
|
|
24
|
+
// `getClientRects` needs to be mocked so that `isVisible` from the `@wordpress/dom`
|
|
25
|
+
// `focusable` module can pass, in a JSDOM env where the DOM elements have no width/height.
|
|
26
|
+
const mockedGetClientRects = jest.fn( () => [
|
|
27
|
+
{
|
|
28
|
+
x: 0,
|
|
29
|
+
y: 0,
|
|
30
|
+
width: 100,
|
|
31
|
+
height: 100,
|
|
32
|
+
},
|
|
33
|
+
] );
|
|
34
|
+
|
|
35
|
+
beforeAll( () => {
|
|
36
|
+
window.Element.prototype.getClientRects = jest.fn(
|
|
37
|
+
mockedGetClientRects
|
|
38
|
+
);
|
|
39
|
+
} );
|
|
40
|
+
|
|
41
|
+
afterAll( () => {
|
|
42
|
+
window.Element.prototype.getClientRects = originalGetClientRects;
|
|
43
|
+
} );
|
|
44
|
+
|
|
45
|
+
describe( 'simple rendering', () => {
|
|
46
|
+
it( 'renders a table, tbody and any child elements', () => {
|
|
47
|
+
const { container } = render(
|
|
48
|
+
<TreeGrid>
|
|
49
|
+
<tr>
|
|
50
|
+
<td>Test</td>
|
|
51
|
+
</tr>
|
|
52
|
+
</TreeGrid>
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
expect( container.innerHTML ).toMatchSnapshot();
|
|
56
|
+
} );
|
|
57
|
+
} );
|
|
58
|
+
|
|
59
|
+
describe( 'onExpandRow', () => {
|
|
60
|
+
it( 'should call onExpandRow when pressing Right Arrow on a collapsed row', () => {
|
|
61
|
+
const onExpandRow = jest.fn();
|
|
62
|
+
|
|
63
|
+
render(
|
|
64
|
+
<TreeGrid onExpandRow={ onExpandRow }>
|
|
65
|
+
<tr role="row" aria-expanded="true">
|
|
66
|
+
<td>
|
|
67
|
+
<TestButton>Row 1</TestButton>
|
|
68
|
+
</td>
|
|
69
|
+
</tr>
|
|
70
|
+
<tr role="row" aria-expanded="false">
|
|
71
|
+
<td>
|
|
72
|
+
<TestButton>Row 2</TestButton>
|
|
73
|
+
</td>
|
|
74
|
+
</tr>
|
|
75
|
+
<tr role="row" aria-expanded="true">
|
|
76
|
+
<td>
|
|
77
|
+
<TestButton>Row 3</TestButton>
|
|
78
|
+
</td>
|
|
79
|
+
</tr>
|
|
80
|
+
</TreeGrid>
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
screen.getByText( 'Row 2' ).focus();
|
|
84
|
+
const row2Element = screen.getByText( 'Row 2' ).closest( 'tr' );
|
|
85
|
+
|
|
86
|
+
fireEvent.keyDown( screen.getByText( 'Row 2' ), {
|
|
87
|
+
key: 'ArrowRight',
|
|
88
|
+
keyCode: RIGHT,
|
|
89
|
+
currentTarget: row2Element,
|
|
90
|
+
} );
|
|
91
|
+
|
|
92
|
+
expect( onExpandRow ).toHaveBeenCalledWith( row2Element );
|
|
93
|
+
} );
|
|
94
|
+
} );
|
|
95
|
+
|
|
96
|
+
describe( 'onCollapseRow', () => {
|
|
97
|
+
it( 'should call onCollapseRow when pressing Left Arrow on an expanded row', () => {
|
|
98
|
+
const onCollapseRow = jest.fn();
|
|
99
|
+
|
|
100
|
+
render(
|
|
101
|
+
<TreeGrid onCollapseRow={ onCollapseRow }>
|
|
102
|
+
<tr role="row" aria-expanded="false">
|
|
103
|
+
<td>
|
|
104
|
+
<TestButton>Row 1</TestButton>
|
|
105
|
+
</td>
|
|
106
|
+
</tr>
|
|
107
|
+
<tr role="row" aria-expanded="true">
|
|
108
|
+
<td>
|
|
109
|
+
<TestButton>Row 2</TestButton>
|
|
110
|
+
</td>
|
|
111
|
+
</tr>
|
|
112
|
+
<tr role="row" aria-expanded="false">
|
|
113
|
+
<td>
|
|
114
|
+
<TestButton>Row 3</TestButton>
|
|
115
|
+
</td>
|
|
116
|
+
</tr>
|
|
117
|
+
</TreeGrid>
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
screen.getByText( 'Row 2' ).focus();
|
|
121
|
+
const row2Element = screen.getByText( 'Row 2' ).closest( 'tr' );
|
|
122
|
+
|
|
123
|
+
fireEvent.keyDown( screen.getByText( 'Row 2' ), {
|
|
124
|
+
key: 'ArrowLeft',
|
|
125
|
+
keyCode: LEFT,
|
|
126
|
+
currentTarget: row2Element,
|
|
127
|
+
} );
|
|
128
|
+
|
|
129
|
+
expect( onCollapseRow ).toHaveBeenCalledWith( row2Element );
|
|
130
|
+
} );
|
|
131
|
+
} );
|
|
132
|
+
|
|
133
|
+
describe( 'onFocusRow', () => {
|
|
134
|
+
const TestTree = ( { onFocusRow } ) => (
|
|
135
|
+
<TreeGrid onFocusRow={ onFocusRow }>
|
|
136
|
+
<tr role="row" aria-expanded="false">
|
|
137
|
+
<td>
|
|
138
|
+
<TestButton>Row 1</TestButton>
|
|
139
|
+
</td>
|
|
140
|
+
</tr>
|
|
141
|
+
<tr role="row" aria-expanded="true">
|
|
142
|
+
<td>
|
|
143
|
+
<TestButton>Row 2</TestButton>
|
|
144
|
+
</td>
|
|
145
|
+
</tr>
|
|
146
|
+
<tr role="row" aria-expanded="false">
|
|
147
|
+
<td>
|
|
148
|
+
<TestButton>Row 3</TestButton>
|
|
149
|
+
</td>
|
|
17
150
|
</tr>
|
|
18
151
|
</TreeGrid>
|
|
19
152
|
);
|
|
20
153
|
|
|
21
|
-
|
|
154
|
+
it( 'should call onFocusRow with event, start and end nodes when pressing Down Arrow', () => {
|
|
155
|
+
const onFocusRow = jest.fn();
|
|
156
|
+
render( <TestTree onFocusRow={ onFocusRow } /> );
|
|
157
|
+
|
|
158
|
+
screen.getByText( 'Row 2' ).focus();
|
|
159
|
+
|
|
160
|
+
const row2Element = screen.getByText( 'Row 2' ).closest( 'tr' );
|
|
161
|
+
const row3Element = screen.getByText( 'Row 3' ).closest( 'tr' );
|
|
162
|
+
|
|
163
|
+
fireEvent.keyDown( screen.getByText( 'Row 2' ), {
|
|
164
|
+
key: 'ArrowDown',
|
|
165
|
+
keyCode: DOWN,
|
|
166
|
+
currentTarget: row2Element,
|
|
167
|
+
} );
|
|
168
|
+
|
|
169
|
+
expect( onFocusRow ).toHaveBeenCalledWith(
|
|
170
|
+
expect.objectContaining( { key: 'ArrowDown', keyCode: DOWN } ),
|
|
171
|
+
row2Element,
|
|
172
|
+
row3Element
|
|
173
|
+
);
|
|
174
|
+
} );
|
|
175
|
+
|
|
176
|
+
it( 'should call onFocusRow with event, start and end nodes when pressing Up Arrow', () => {
|
|
177
|
+
const onFocusRow = jest.fn();
|
|
178
|
+
render( <TestTree onFocusRow={ onFocusRow } /> );
|
|
179
|
+
|
|
180
|
+
screen.getByText( 'Row 2' ).focus();
|
|
181
|
+
|
|
182
|
+
const row2Element = screen.getByText( 'Row 2' ).closest( 'tr' );
|
|
183
|
+
const row1Element = screen.getByText( 'Row 1' ).closest( 'tr' );
|
|
184
|
+
|
|
185
|
+
fireEvent.keyDown( screen.getByText( 'Row 2' ), {
|
|
186
|
+
key: 'ArrowUp',
|
|
187
|
+
keyCode: UP,
|
|
188
|
+
currentTarget: row2Element,
|
|
189
|
+
} );
|
|
190
|
+
|
|
191
|
+
expect( onFocusRow ).toHaveBeenCalledWith(
|
|
192
|
+
expect.objectContaining( { key: 'ArrowUp', keyCode: UP } ),
|
|
193
|
+
row2Element,
|
|
194
|
+
row1Element
|
|
195
|
+
);
|
|
196
|
+
} );
|
|
197
|
+
|
|
198
|
+
it( 'should call onFocusRow when shift key is held', () => {
|
|
199
|
+
const onFocusRow = jest.fn();
|
|
200
|
+
render( <TestTree onFocusRow={ onFocusRow } /> );
|
|
201
|
+
|
|
202
|
+
screen.getByText( 'Row 2' ).focus();
|
|
203
|
+
|
|
204
|
+
const row2Element = screen.getByText( 'Row 2' ).closest( 'tr' );
|
|
205
|
+
const row1Element = screen.getByText( 'Row 1' ).closest( 'tr' );
|
|
206
|
+
|
|
207
|
+
fireEvent.keyDown( screen.getByText( 'Row 2' ), {
|
|
208
|
+
key: 'ArrowUp',
|
|
209
|
+
keyCode: UP,
|
|
210
|
+
currentTarget: row2Element,
|
|
211
|
+
shiftKey: true,
|
|
212
|
+
} );
|
|
213
|
+
|
|
214
|
+
expect( onFocusRow ).toHaveBeenLastCalledWith(
|
|
215
|
+
expect.objectContaining( {
|
|
216
|
+
key: 'ArrowUp',
|
|
217
|
+
keyCode: UP,
|
|
218
|
+
shiftKey: true,
|
|
219
|
+
} ),
|
|
220
|
+
row2Element,
|
|
221
|
+
row1Element
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
fireEvent.keyDown( screen.getByText( 'Row 1' ), {
|
|
225
|
+
key: 'ArrowDown',
|
|
226
|
+
keyCode: DOWN,
|
|
227
|
+
currentTarget: row1Element,
|
|
228
|
+
shiftKey: true,
|
|
229
|
+
} );
|
|
230
|
+
|
|
231
|
+
expect( onFocusRow ).toHaveBeenLastCalledWith(
|
|
232
|
+
expect.objectContaining( {
|
|
233
|
+
key: 'ArrowDown',
|
|
234
|
+
keyCode: DOWN,
|
|
235
|
+
shiftKey: true,
|
|
236
|
+
} ),
|
|
237
|
+
row1Element,
|
|
238
|
+
row2Element
|
|
239
|
+
);
|
|
240
|
+
} );
|
|
22
241
|
} );
|
|
23
242
|
} );
|
|
@@ -7,7 +7,7 @@ import useTruncate from './hook';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props
|
|
10
|
-
* @param {import('react').
|
|
10
|
+
* @param {import('react').ForwardedRef<any>} forwardedRef
|
|
11
11
|
*/
|
|
12
12
|
function Truncate( props, forwardedRef ) {
|
|
13
13
|
const truncateProps = useTruncate( props );
|
|
@@ -20,7 +20,7 @@ export type WordPressComponentProps<
|
|
|
20
20
|
? {
|
|
21
21
|
as?: T | keyof JSX.IntrinsicElements;
|
|
22
22
|
}
|
|
23
|
-
: {
|
|
23
|
+
: {} );
|
|
24
24
|
|
|
25
25
|
export type WordPressComponent<
|
|
26
26
|
T extends React.ElementType,
|
|
@@ -29,7 +29,7 @@ export type WordPressComponent<
|
|
|
29
29
|
> = {
|
|
30
30
|
< TT extends React.ElementType >(
|
|
31
31
|
props: WordPressComponentProps< O, TT, IsPolymorphic > &
|
|
32
|
-
( IsPolymorphic extends true ? { as: TT } : {
|
|
32
|
+
( IsPolymorphic extends true ? { as: TT } : {} )
|
|
33
33
|
): JSX.Element | null;
|
|
34
34
|
(
|
|
35
35
|
props: WordPressComponentProps< O, T, IsPolymorphic >
|
|
@@ -12,7 +12,7 @@ import { contextConnect } from '../context';
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @param {import('../context').WordPressComponentProps<import('./types').Props, 'div'>} props
|
|
15
|
-
* @param {import('react').
|
|
15
|
+
* @param {import('react').ForwardedRef<any>} forwardedRef
|
|
16
16
|
*/
|
|
17
17
|
function ControlGroup( props, forwardedRef ) {
|
|
18
18
|
const {
|
|
@@ -7,7 +7,7 @@ import { useControlLabel } from './hook';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @param {import('../context').WordPressComponentProps<import('./types').Props, 'label', false>} props
|
|
10
|
-
* @param {import('react').
|
|
10
|
+
* @param {import('react').ForwardedRef<any>} forwardedRef
|
|
11
11
|
*/
|
|
12
12
|
function ControlLabel( props, forwardedRef ) {
|
|
13
13
|
const controlLabelProps = useControlLabel( props );
|
|
@@ -9,7 +9,7 @@ import { useFormGroup } from './use-form-group';
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @param {import('../context').WordPressComponentProps<import('./types').FormGroupProps, 'div'>} props
|
|
12
|
-
* @param {import('react').
|
|
12
|
+
* @param {import('react').ForwardedRef<any>} forwardedRef
|
|
13
13
|
*/
|
|
14
14
|
function FormGroup( props, forwardedRef ) {
|
|
15
15
|
const { contentProps, horizontal, ...otherProps } = useFormGroup( props );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { ForwardedRef } from 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -25,7 +25,7 @@ export interface Props {
|
|
|
25
25
|
|
|
26
26
|
function Shortcut(
|
|
27
27
|
props: WordPressComponentProps< Props, 'span' >,
|
|
28
|
-
forwardedRef:
|
|
28
|
+
forwardedRef: ForwardedRef< any >
|
|
29
29
|
): JSX.Element | null {
|
|
30
30
|
const {
|
|
31
31
|
as: asProp = 'span',
|
|
@@ -17,7 +17,7 @@ import { COLORS } from '../../utils/colors-values';
|
|
|
17
17
|
/**
|
|
18
18
|
*
|
|
19
19
|
* @param {import('../context').WordPressComponentProps<Props, 'div'>} props
|
|
20
|
-
* @param {import('react').
|
|
20
|
+
* @param {import('react').ForwardedRef<any>} forwardedRef
|
|
21
21
|
*/
|
|
22
22
|
function Spinner( props, forwardedRef ) {
|
|
23
23
|
const {
|
|
@@ -19,7 +19,7 @@ import { TooltipShortcut } from './styles';
|
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @param {import('../context').WordPressComponentProps<import('./types').Props, 'div'>} props
|
|
22
|
-
* @param {import('react').
|
|
22
|
+
* @param {import('react').ForwardedRef<any>} forwardedRef
|
|
23
23
|
*/
|
|
24
24
|
function Tooltip( props, forwardedRef ) {
|
|
25
25
|
const {
|
|
@@ -18,7 +18,7 @@ const { TooltipPopoverView } = styles;
|
|
|
18
18
|
/**
|
|
19
19
|
*
|
|
20
20
|
* @param {import('../context').WordPressComponentProps<import('./types').ContentProps, 'div'>} props
|
|
21
|
-
* @param {import('react').
|
|
21
|
+
* @param {import('react').ForwardedRef<any>} forwardedRef
|
|
22
22
|
*/
|
|
23
23
|
function TooltipContent( props, forwardedRef ) {
|
|
24
24
|
const { children, className, ...otherProps } = useContextSystem(
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type {
|
|
5
5
|
FocusEventHandler,
|
|
6
6
|
KeyboardEvent,
|
|
7
|
-
|
|
7
|
+
ForwardedRef,
|
|
8
8
|
SyntheticEvent,
|
|
9
9
|
} from 'react';
|
|
10
10
|
import { noop, omit } from 'lodash';
|
|
@@ -55,7 +55,7 @@ function UnitControl(
|
|
|
55
55
|
value: valueProp,
|
|
56
56
|
...props
|
|
57
57
|
}: WordPressComponentProps< UnitControlProps, 'input', false >,
|
|
58
|
-
forwardedRef:
|
|
58
|
+
forwardedRef: ForwardedRef< any >
|
|
59
59
|
) {
|
|
60
60
|
const units = useMemo(
|
|
61
61
|
() => getUnitsWithCurrentUnit( valueProp, unitProp, unitsProp ),
|
package/src/v-stack/component.js
CHANGED
|
@@ -7,7 +7,7 @@ import { useVStack } from './hook';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
|
|
10
|
-
* @param {import('react').
|
|
10
|
+
* @param {import('react').ForwardedRef<any>} forwardedRef
|
|
11
11
|
*/
|
|
12
12
|
function VStack( props, forwardedRef ) {
|
|
13
13
|
const vStackProps = useVStack( props );
|
|
@@ -7,7 +7,7 @@ import { View } from '../view';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @param {import('../ui/context').WordPressComponentProps<{ children: import('react').ReactNode }, 'div'>} props
|
|
10
|
-
* @param {import('react').
|
|
10
|
+
* @param {import('react').ForwardedRef<any>} forwardedRef
|
|
11
11
|
*/
|
|
12
12
|
function VisuallyHidden( props, forwardedRef ) {
|
|
13
13
|
const { style: styleProp, ...contextProps } = useContextSystem(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { ForwardedRef, ReactNode } from 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -43,7 +43,7 @@ export interface ZStackProps {
|
|
|
43
43
|
|
|
44
44
|
function ZStack(
|
|
45
45
|
props: WordPressComponentProps< ZStackProps, 'div' >,
|
|
46
|
-
forwardedRef:
|
|
46
|
+
forwardedRef: ForwardedRef< any >
|
|
47
47
|
) {
|
|
48
48
|
const {
|
|
49
49
|
children,
|