@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
|
@@ -8,7 +8,7 @@ import { View } from '../../view';
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @param {import('../../ui/context').WordPressComponentProps<import('../types').FlexProps, 'div'>} props
|
|
11
|
-
* @param {import('react').
|
|
11
|
+
* @param {import('react').ForwardedRef<any>} forwardedRef
|
|
12
12
|
*/
|
|
13
13
|
function Flex( props, forwardedRef ) {
|
|
14
14
|
const { children, isColumn, ...otherProps } = useFlex( props );
|
|
@@ -7,7 +7,7 @@ import { useFlexBlock } from './hook';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @param {import('../../ui/context').WordPressComponentProps<import('../types').FlexBlockProps, 'div'>} props
|
|
10
|
-
* @param {import('react').
|
|
10
|
+
* @param {import('react').ForwardedRef<any>} forwardedRef
|
|
11
11
|
*/
|
|
12
12
|
function FlexBlock( props, forwardedRef ) {
|
|
13
13
|
const flexBlockProps = useFlexBlock( props );
|
|
@@ -7,7 +7,7 @@ import { useFlexItem } from './hook';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @param {import('../../ui/context').WordPressComponentProps<import('../types').FlexItemProps, 'div'>} props
|
|
10
|
-
* @param {import('react').
|
|
10
|
+
* @param {import('react').ForwardedRef<any>} forwardedRef
|
|
11
11
|
*/
|
|
12
12
|
function FlexItem( props, forwardedRef ) {
|
|
13
13
|
const flexItemProps = useFlexItem( props );
|
|
@@ -22,7 +22,7 @@ import { useFlyout } from './hook';
|
|
|
22
22
|
/**
|
|
23
23
|
*
|
|
24
24
|
* @param {import('../../ui/context').WordPressComponentProps<import('../types').Props, 'div', false>} props
|
|
25
|
-
* @param {import('react').
|
|
25
|
+
* @param {import('react').ForwardedRef<any>} forwardedRef
|
|
26
26
|
*/
|
|
27
27
|
function Flyout( props, forwardedRef ) {
|
|
28
28
|
const {
|
|
@@ -8,7 +8,7 @@ import { contextConnect, useContextSystem } from '../../ui/context';
|
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
10
10
|
* @param {import('../../ui/context').WordPressComponentProps<import('../types').ContentProps, 'div', false>} props
|
|
11
|
-
* @param {import('react').
|
|
11
|
+
* @param {import('react').ForwardedRef<any>} forwardedRef forwardedRef
|
|
12
12
|
*/
|
|
13
13
|
function FlyoutContent( props, forwardedRef ) {
|
|
14
14
|
const {
|
|
@@ -94,3 +94,10 @@ Callback which is called at the end of drag operations.
|
|
|
94
94
|
- Required: No
|
|
95
95
|
|
|
96
96
|
Callback which is called at the start of drag operations.
|
|
97
|
+
|
|
98
|
+
### `resolvePoint`
|
|
99
|
+
|
|
100
|
+
- Type: `Function`
|
|
101
|
+
- Required: No
|
|
102
|
+
|
|
103
|
+
Function which is called before internal updates to the value state. It receives the upcoming value and may return a modified one.
|
|
@@ -49,8 +49,9 @@ export class FocalPointPicker extends Component {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
this.onChangeAtControls = ( value ) => {
|
|
52
|
-
this.updateValue( value )
|
|
53
|
-
|
|
52
|
+
this.updateValue( value, () => {
|
|
53
|
+
this.props.onChange( this.state.percentages );
|
|
54
|
+
} );
|
|
54
55
|
};
|
|
55
56
|
|
|
56
57
|
this.updateBounds = this.updateBounds.bind( this );
|
|
@@ -128,15 +129,18 @@ export class FocalPointPicker extends Component {
|
|
|
128
129
|
}
|
|
129
130
|
return bounds;
|
|
130
131
|
}
|
|
131
|
-
updateValue( nextValue = {} ) {
|
|
132
|
-
const
|
|
132
|
+
updateValue( nextValue = {}, callback ) {
|
|
133
|
+
const resolvedValue =
|
|
134
|
+
this.props.resolvePoint?.( nextValue ) ?? nextValue;
|
|
135
|
+
|
|
136
|
+
const { x, y } = resolvedValue;
|
|
133
137
|
|
|
134
138
|
const nextPercentage = {
|
|
135
139
|
x: parseFloat( x ).toFixed( 2 ),
|
|
136
140
|
y: parseFloat( y ).toFixed( 2 ),
|
|
137
141
|
};
|
|
138
142
|
|
|
139
|
-
this.setState( { percentages: nextPercentage } );
|
|
143
|
+
this.setState( { percentages: nextPercentage }, callback );
|
|
140
144
|
}
|
|
141
145
|
updateBounds() {
|
|
142
146
|
this.setState( {
|
|
@@ -180,8 +184,9 @@ export class FocalPointPicker extends Component {
|
|
|
180
184
|
|
|
181
185
|
next[ axis ] = roundClamp( value, 0, 1, step );
|
|
182
186
|
|
|
183
|
-
this.updateValue( next )
|
|
184
|
-
|
|
187
|
+
this.updateValue( next, () => {
|
|
188
|
+
this.props.onChange( this.state.percentages );
|
|
189
|
+
} );
|
|
185
190
|
}
|
|
186
191
|
doDrag( event ) {
|
|
187
192
|
// Prevents text-selection when dragging.
|
|
@@ -44,3 +44,33 @@ export const video = () => {
|
|
|
44
44
|
|
|
45
45
|
return <Example url={ url } />;
|
|
46
46
|
};
|
|
47
|
+
|
|
48
|
+
export const snapping = () => {
|
|
49
|
+
const snapValues = {
|
|
50
|
+
x: [ 0, 0.33, 0.66, 1 ],
|
|
51
|
+
y: [ 0, 0.33, 0.66, 1 ],
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const threshold = 0.05;
|
|
55
|
+
|
|
56
|
+
const maybeSnapFocalPoint = ( value ) => {
|
|
57
|
+
let x = parseFloat( value.x );
|
|
58
|
+
let y = parseFloat( value.y );
|
|
59
|
+
|
|
60
|
+
snapValues.x.forEach( ( snapValue ) => {
|
|
61
|
+
if ( snapValue - threshold < x && x < snapValue + threshold ) {
|
|
62
|
+
x = snapValue;
|
|
63
|
+
}
|
|
64
|
+
} );
|
|
65
|
+
|
|
66
|
+
snapValues.y.forEach( ( snapValue ) => {
|
|
67
|
+
if ( snapValue - threshold < y && y < snapValue + threshold ) {
|
|
68
|
+
y = snapValue;
|
|
69
|
+
}
|
|
70
|
+
} );
|
|
71
|
+
|
|
72
|
+
return { x, y };
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return <Example resolvePoint={ maybeSnapFocalPoint } />;
|
|
76
|
+
};
|
|
@@ -62,6 +62,34 @@ describe( 'FocalPointPicker', () => {
|
|
|
62
62
|
} );
|
|
63
63
|
} );
|
|
64
64
|
|
|
65
|
+
describe( 'resolvePoint handling', () => {
|
|
66
|
+
it( 'should allow value altering', async () => {
|
|
67
|
+
const spyChange = jest.fn();
|
|
68
|
+
const spy = jest.fn();
|
|
69
|
+
const { getByRole } = render(
|
|
70
|
+
<Picker
|
|
71
|
+
value={ { x: 0.25, y: 0.25 } }
|
|
72
|
+
onChange={ spyChange }
|
|
73
|
+
resolvePoint={ () => {
|
|
74
|
+
spy();
|
|
75
|
+
return { x: 0.91, y: 0.42 };
|
|
76
|
+
} }
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
// Click and press arrow up
|
|
80
|
+
const dragArea = getByRole( 'button' );
|
|
81
|
+
act( () => {
|
|
82
|
+
fireEvent.mouseDown( dragArea );
|
|
83
|
+
fireEvent.keyDown( dragArea, { charCode: 0, keyCode: 38 } );
|
|
84
|
+
} );
|
|
85
|
+
expect( spy ).toHaveBeenCalled();
|
|
86
|
+
expect( spyChange ).toHaveBeenCalledWith( {
|
|
87
|
+
x: '0.91',
|
|
88
|
+
y: '0.42',
|
|
89
|
+
} );
|
|
90
|
+
} );
|
|
91
|
+
} );
|
|
92
|
+
|
|
65
93
|
describe( 'controllability', () => {
|
|
66
94
|
it( 'should update value from props', () => {
|
|
67
95
|
const { rerender, getByRole } = render(
|
|
@@ -71,5 +99,21 @@ describe( 'FocalPointPicker', () => {
|
|
|
71
99
|
rerender( <Picker value={ { x: 0.93, y: 0.5 } } /> );
|
|
72
100
|
expect( xInput.value ).toBe( '93' );
|
|
73
101
|
} );
|
|
102
|
+
it( 'call onChange with the expected values', async () => {
|
|
103
|
+
const spyChange = jest.fn();
|
|
104
|
+
const { getByRole } = render(
|
|
105
|
+
<Picker value={ { x: 0.14, y: 0.62 } } onChange={ spyChange } />
|
|
106
|
+
);
|
|
107
|
+
// Click and press arrow up
|
|
108
|
+
const dragArea = getByRole( 'button' );
|
|
109
|
+
act( () => {
|
|
110
|
+
fireEvent.mouseDown( dragArea );
|
|
111
|
+
fireEvent.keyDown( dragArea, { charCode: 0, keyCode: 38 } );
|
|
112
|
+
} );
|
|
113
|
+
expect( spyChange ).toHaveBeenCalledWith( {
|
|
114
|
+
x: '0.14',
|
|
115
|
+
y: '0.61',
|
|
116
|
+
} );
|
|
117
|
+
} );
|
|
74
118
|
} );
|
|
75
119
|
} );
|
|
@@ -8,7 +8,7 @@ import { FormFileUpload } from '@wordpress/components';
|
|
|
8
8
|
const MyFormFileUpload = () => (
|
|
9
9
|
<FormFileUpload
|
|
10
10
|
accept="image/*"
|
|
11
|
-
onChange={ () => console.log(
|
|
11
|
+
onChange={ ( event ) => console.log( event.target.files ) }
|
|
12
12
|
>
|
|
13
13
|
Upload
|
|
14
14
|
</FormFileUpload>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { upload as uploadIcon } from '@wordpress/icons';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import FormFileUpload from '../';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: 'Components/FormFileUpload',
|
|
13
|
+
component: FormFileUpload,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const Default = FormFileUpload.bind( {} );
|
|
17
|
+
Default.args = {
|
|
18
|
+
accept: '',
|
|
19
|
+
children: 'Select file',
|
|
20
|
+
multiple: false,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const RestrictFileTypes = FormFileUpload.bind( {} );
|
|
24
|
+
RestrictFileTypes.args = {
|
|
25
|
+
...Default.args,
|
|
26
|
+
accept: 'image/*',
|
|
27
|
+
children: 'Select image',
|
|
28
|
+
multiple: false,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const AllowMultipleFiles = FormFileUpload.bind( {} );
|
|
32
|
+
AllowMultipleFiles.args = {
|
|
33
|
+
...Default.args,
|
|
34
|
+
children: 'Select files',
|
|
35
|
+
multiple: true,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const WithIcon = FormFileUpload.bind( {} );
|
|
39
|
+
WithIcon.args = {
|
|
40
|
+
...Default.args,
|
|
41
|
+
children: 'Upload',
|
|
42
|
+
icon: uploadIcon,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const WithCustomRender = FormFileUpload.bind( {} );
|
|
46
|
+
WithCustomRender.args = {
|
|
47
|
+
...Default.args,
|
|
48
|
+
render: ( { openFileDialog } ) => (
|
|
49
|
+
<button onClick={ openFileDialog }>Custom Upload Button</button>
|
|
50
|
+
),
|
|
51
|
+
};
|
package/src/grid/component.js
CHANGED
|
@@ -7,7 +7,7 @@ import useGrid 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 Grid( props, forwardedRef ) {
|
|
13
13
|
const gridProps = useGrid( props );
|
package/src/h-stack/component.js
CHANGED
|
@@ -7,7 +7,7 @@ import { useHStack } 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 HStack( props, forwardedRef ) {
|
|
13
13
|
const hStackProps = useHStack( 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
|
|
@@ -12,7 +12,7 @@ import { useHeading, HeadingProps } from './hook';
|
|
|
12
12
|
|
|
13
13
|
function Heading(
|
|
14
14
|
props: WordPressComponentProps< HeadingProps, 'h1' >,
|
|
15
|
-
forwardedRef:
|
|
15
|
+
forwardedRef: ForwardedRef< any >
|
|
16
16
|
) {
|
|
17
17
|
const headerProps = useHeading( props );
|
|
18
18
|
|
package/src/index.js
CHANGED
|
@@ -100,6 +100,8 @@ export { default as __experimentalNavigationMenu } from './navigation/menu';
|
|
|
100
100
|
export {
|
|
101
101
|
NavigatorProvider as __experimentalNavigatorProvider,
|
|
102
102
|
NavigatorScreen as __experimentalNavigatorScreen,
|
|
103
|
+
NavigatorButton as __experimentalNavigatorButton,
|
|
104
|
+
NavigatorBackButton as __experimentalNavigatorBackButton,
|
|
103
105
|
useNavigator as __experimentalUseNavigator,
|
|
104
106
|
} from './navigator';
|
|
105
107
|
export { default as Notice } from './notice';
|
package/src/index.native.js
CHANGED
|
@@ -134,4 +134,8 @@ export {
|
|
|
134
134
|
withGlobalStyles,
|
|
135
135
|
getMergedGlobalStyles,
|
|
136
136
|
} from './mobile/global-styles-context';
|
|
137
|
-
export {
|
|
137
|
+
export {
|
|
138
|
+
getGlobalStyles,
|
|
139
|
+
getColorsAndGradients,
|
|
140
|
+
useMobileGlobalStylesColors,
|
|
141
|
+
} from './mobile/global-styles-context/utils';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { noop } from 'lodash';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
-
import type {
|
|
6
|
+
import type { ForwardedRef } from 'react';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* WordPress dependencies
|
|
@@ -45,7 +45,7 @@ export function InputControl(
|
|
|
45
45
|
value,
|
|
46
46
|
...props
|
|
47
47
|
}: InputControlProps,
|
|
48
|
-
ref:
|
|
48
|
+
ref: ForwardedRef< HTMLInputElement >
|
|
49
49
|
) {
|
|
50
50
|
const [ isFocused, setIsFocused ] = useState( false );
|
|
51
51
|
|
|
@@ -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
|
|
@@ -66,7 +66,7 @@ export function InputBase(
|
|
|
66
66
|
suffix,
|
|
67
67
|
...props
|
|
68
68
|
}: InputBaseProps,
|
|
69
|
-
ref:
|
|
69
|
+
ref: ForwardedRef< HTMLDivElement >
|
|
70
70
|
) {
|
|
71
71
|
const id = useUniqueId( idProp );
|
|
72
72
|
const hideLabel = hideLabelFromVision || ! label;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { noop } from 'lodash';
|
|
5
|
-
import { useDrag } from '
|
|
5
|
+
import { useDrag } from '@use-gesture/react';
|
|
6
6
|
import type {
|
|
7
7
|
SyntheticEvent,
|
|
8
8
|
ChangeEvent,
|
|
9
9
|
KeyboardEvent,
|
|
10
10
|
PointerEvent,
|
|
11
11
|
FocusEvent,
|
|
12
|
-
|
|
12
|
+
ForwardedRef,
|
|
13
13
|
MouseEvent,
|
|
14
14
|
} from 'react';
|
|
15
15
|
|
|
@@ -53,7 +53,7 @@ function InputField(
|
|
|
53
53
|
type,
|
|
54
54
|
...props
|
|
55
55
|
}: WordPressComponentProps< InputFieldProps, 'input', false >,
|
|
56
|
-
ref:
|
|
56
|
+
ref: ForwardedRef< HTMLInputElement >
|
|
57
57
|
) {
|
|
58
58
|
const {
|
|
59
59
|
// State
|
|
@@ -168,9 +168,6 @@ function InputField(
|
|
|
168
168
|
const dragGestureProps = useDrag< PointerEvent< HTMLInputElement > >(
|
|
169
169
|
( dragProps ) => {
|
|
170
170
|
const { distance, dragging, event } = dragProps;
|
|
171
|
-
// The event is persisted to prevent errors in components using this
|
|
172
|
-
// to check if a modifier key was held while dragging.
|
|
173
|
-
event.persist();
|
|
174
171
|
|
|
175
172
|
if ( ! distance ) return;
|
|
176
173
|
event.stopPropagation();
|
|
@@ -196,6 +193,7 @@ function InputField(
|
|
|
196
193
|
{
|
|
197
194
|
threshold: dragThreshold,
|
|
198
195
|
enabled: isDragEnabled,
|
|
196
|
+
pointer: { capture: false },
|
|
199
197
|
}
|
|
200
198
|
);
|
|
201
199
|
|
|
@@ -50,6 +50,9 @@ export const composeStateReducers = (
|
|
|
50
50
|
): StateReducer => {
|
|
51
51
|
return ( ...args ) => {
|
|
52
52
|
return fns.reduceRight( ( state, fn ) => {
|
|
53
|
+
// TODO: Assess whether this can be replaced with a more standard `compose` implementation
|
|
54
|
+
// like wp.data.compose() (aka lodash flowRight) or Redux compose().
|
|
55
|
+
// The current implementation only works by functions mutating the original state object.
|
|
53
56
|
const fnState = fn( ...args );
|
|
54
57
|
return isEmpty( fnState ) ? state : { ...state, ...fnState };
|
|
55
58
|
}, {} as InputState );
|
|
@@ -14,7 +14,7 @@ import { useState } from '@wordpress/element';
|
|
|
14
14
|
import InputControl from '../';
|
|
15
15
|
|
|
16
16
|
export default {
|
|
17
|
-
title: 'Components/InputControl',
|
|
17
|
+
title: 'Components (Experimental)/InputControl',
|
|
18
18
|
component: InputControl,
|
|
19
19
|
parameters: {
|
|
20
20
|
knobs: { disable: false },
|
|
@@ -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
|
|
@@ -13,7 +13,7 @@ import { View } from '../../view';
|
|
|
13
13
|
|
|
14
14
|
function Item(
|
|
15
15
|
props: WordPressComponentProps< ItemProps, 'div' >,
|
|
16
|
-
forwardedRef:
|
|
16
|
+
forwardedRef: ForwardedRef< any >
|
|
17
17
|
) {
|
|
18
18
|
const { role, wrapperClassName, ...otherProps } = useItem( props );
|
|
19
19
|
|
|
@@ -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
|
|
@@ -14,7 +14,7 @@ import type { ItemGroupProps } from '../types';
|
|
|
14
14
|
|
|
15
15
|
function ItemGroup(
|
|
16
16
|
props: WordPressComponentProps< ItemGroupProps, 'div' >,
|
|
17
|
-
forwardedRef:
|
|
17
|
+
forwardedRef: ForwardedRef< any >
|
|
18
18
|
) {
|
|
19
19
|
const {
|
|
20
20
|
isBordered,
|
|
@@ -128,7 +128,16 @@ const BottomSheetNavigationScreen = ( {
|
|
|
128
128
|
</TouchableHighlight>
|
|
129
129
|
</ScrollView>
|
|
130
130
|
);
|
|
131
|
-
}, [
|
|
131
|
+
}, [
|
|
132
|
+
children,
|
|
133
|
+
isFocused,
|
|
134
|
+
safeAreaBottomInset,
|
|
135
|
+
listProps,
|
|
136
|
+
name,
|
|
137
|
+
isScrollable,
|
|
138
|
+
isNested,
|
|
139
|
+
onLayout,
|
|
140
|
+
] );
|
|
132
141
|
};
|
|
133
142
|
|
|
134
143
|
export default BottomSheetNavigationScreen;
|
|
@@ -13,8 +13,10 @@ import {
|
|
|
13
13
|
ColorControl,
|
|
14
14
|
PanelBody,
|
|
15
15
|
BottomSheetContext,
|
|
16
|
+
useMobileGlobalStylesColors,
|
|
16
17
|
} from '@wordpress/components';
|
|
17
18
|
import { useRoute, useNavigation } from '@react-navigation/native';
|
|
19
|
+
|
|
18
20
|
/**
|
|
19
21
|
* Internal dependencies
|
|
20
22
|
*/
|
|
@@ -27,6 +29,7 @@ import { colorsUtils } from './utils';
|
|
|
27
29
|
import styles from './style.scss';
|
|
28
30
|
|
|
29
31
|
const HIT_SLOP = { top: 8, bottom: 8, left: 8, right: 8 };
|
|
32
|
+
const THEME_PALETTE_NAME = 'Theme';
|
|
30
33
|
|
|
31
34
|
const PaletteScreen = () => {
|
|
32
35
|
const route = useRoute();
|
|
@@ -45,10 +48,15 @@ const PaletteScreen = () => {
|
|
|
45
48
|
const [ currentValue, setCurrentValue ] = useState( colorValue );
|
|
46
49
|
const isGradientColor = isGradient( currentValue );
|
|
47
50
|
const selectedSegmentIndex = isGradientColor ? 1 : 0;
|
|
51
|
+
const allAvailableColors = useMobileGlobalStylesColors();
|
|
48
52
|
|
|
49
53
|
const [ currentSegment, setCurrentSegment ] = useState(
|
|
50
54
|
segments[ selectedSegmentIndex ]
|
|
51
55
|
);
|
|
56
|
+
const isGradientSegment = currentSegment === colorsUtils.segments[ 1 ];
|
|
57
|
+
const currentSegmentColors = ! isGradientSegment
|
|
58
|
+
? defaultSettings.colors
|
|
59
|
+
: defaultSettings.gradients;
|
|
52
60
|
|
|
53
61
|
const horizontalSeparatorStyle = usePreferredColorSchemeStyle(
|
|
54
62
|
styles.horizontalSeparator,
|
|
@@ -176,15 +184,37 @@ const PaletteScreen = () => {
|
|
|
176
184
|
<NavBar.Heading>{ label } </NavBar.Heading>
|
|
177
185
|
</NavBar>
|
|
178
186
|
) }
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
|
|
188
|
+
<View style={ styles.colorPalettes }>
|
|
189
|
+
{ currentSegmentColors.map( ( palette, paletteKey ) => {
|
|
190
|
+
const paletteSettings = {
|
|
191
|
+
colors: palette.colors,
|
|
192
|
+
gradients: palette.gradients,
|
|
193
|
+
allColors: allAvailableColors,
|
|
194
|
+
};
|
|
195
|
+
const enableCustomColor =
|
|
196
|
+
! isGradientSegment &&
|
|
197
|
+
palette.name === THEME_PALETTE_NAME;
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<ColorPalette
|
|
201
|
+
enableCustomColor={ enableCustomColor }
|
|
202
|
+
label={ palette.name }
|
|
203
|
+
key={ paletteKey }
|
|
204
|
+
setColor={ setColor }
|
|
205
|
+
activeColor={ currentValue }
|
|
206
|
+
isGradientColor={ isGradientColor }
|
|
207
|
+
currentSegment={ currentSegment }
|
|
208
|
+
onCustomPress={ onCustomPress }
|
|
209
|
+
shouldEnableBottomSheetScroll={
|
|
210
|
+
shouldEnableBottomSheetScroll
|
|
211
|
+
}
|
|
212
|
+
defaultSettings={ paletteSettings }
|
|
213
|
+
/>
|
|
214
|
+
);
|
|
215
|
+
} ) }
|
|
216
|
+
</View>
|
|
217
|
+
|
|
188
218
|
{ isCustomGadientShown && (
|
|
189
219
|
<>
|
|
190
220
|
<View style={ horizontalSeparatorStyle } />
|
|
@@ -20,6 +20,11 @@ export const GLOBAL_STYLES_PALETTE = [
|
|
|
20
20
|
color: '#D1D1E4',
|
|
21
21
|
name: 'Purple',
|
|
22
22
|
},
|
|
23
|
+
{
|
|
24
|
+
color: '#cf1594',
|
|
25
|
+
name: 'Color 2 ',
|
|
26
|
+
slug: 'custom-color-2',
|
|
27
|
+
},
|
|
23
28
|
];
|
|
24
29
|
|
|
25
30
|
export const GLOBAL_STYLES_GRADIENTS = {
|
|
@@ -91,6 +96,11 @@ export const DEFAULT_GLOBAL_STYLES = {
|
|
|
91
96
|
fontSize: 'var(--wp--preset--font-size--normal)',
|
|
92
97
|
},
|
|
93
98
|
},
|
|
99
|
+
'core/separator': {
|
|
100
|
+
color: {
|
|
101
|
+
text: 'var:preset|color|custom-color-2',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
94
104
|
},
|
|
95
105
|
};
|
|
96
106
|
|
|
@@ -132,6 +142,11 @@ export const PARSED_GLOBAL_STYLES = {
|
|
|
132
142
|
fontSize: '18px',
|
|
133
143
|
},
|
|
134
144
|
},
|
|
145
|
+
'core/separator': {
|
|
146
|
+
color: {
|
|
147
|
+
text: '#cf1594',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
135
150
|
},
|
|
136
151
|
};
|
|
137
152
|
|
|
@@ -172,6 +187,18 @@ export const RAW_FEATURES = {
|
|
|
172
187
|
name: 'Purple',
|
|
173
188
|
},
|
|
174
189
|
],
|
|
190
|
+
custom: [
|
|
191
|
+
{
|
|
192
|
+
color: '#1bf5c1',
|
|
193
|
+
name: 'Color 1 ',
|
|
194
|
+
slug: 'custom-color-1',
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
color: '#cf1594',
|
|
198
|
+
name: 'Color 2 ',
|
|
199
|
+
slug: 'custom-color-2',
|
|
200
|
+
},
|
|
201
|
+
],
|
|
175
202
|
},
|
|
176
203
|
gradients: {
|
|
177
204
|
default: [
|
|
@@ -125,14 +125,14 @@ describe( 'getGlobalStyles', () => {
|
|
|
125
125
|
|
|
126
126
|
expect( globalStyles ).toEqual(
|
|
127
127
|
expect.objectContaining( {
|
|
128
|
-
colors: RAW_FEATURES.color,
|
|
129
|
-
gradients,
|
|
130
128
|
__experimentalFeatures: {
|
|
131
129
|
color: {
|
|
132
130
|
palette: RAW_FEATURES.color.palette,
|
|
133
131
|
gradients,
|
|
134
132
|
text: true,
|
|
135
133
|
background: true,
|
|
134
|
+
defaultPalette: true,
|
|
135
|
+
defaultGradients: true,
|
|
136
136
|
},
|
|
137
137
|
typography: {
|
|
138
138
|
fontSizes: RAW_FEATURES.typography.fontSizes,
|