@wordpress/components 35.0.0 → 35.0.1
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 +20 -1
- package/build/alignment-matrix-control/cell.cjs +1 -1
- package/build/alignment-matrix-control/cell.cjs.map +2 -2
- package/build/alignment-matrix-control/index.cjs +1 -1
- package/build/alignment-matrix-control/index.cjs.map +2 -2
- package/build/color-palette/index.cjs +3 -0
- package/build/color-palette/index.cjs.map +2 -2
- package/build/custom-gradient-picker/gradient-bar/index.cjs.map +2 -2
- package/build/draggable/index.cjs +1 -1
- package/build/draggable/index.cjs.map +2 -2
- package/build/navigable-container/container.cjs +15 -21
- package/build/navigable-container/container.cjs.map +2 -2
- package/build/unit-control/utils.cjs +33 -35
- package/build/unit-control/utils.cjs.map +2 -2
- package/build-module/alignment-matrix-control/cell.mjs +1 -1
- package/build-module/alignment-matrix-control/cell.mjs.map +2 -2
- package/build-module/alignment-matrix-control/index.mjs +1 -1
- package/build-module/alignment-matrix-control/index.mjs.map +2 -2
- package/build-module/color-palette/index.mjs +3 -0
- package/build-module/color-palette/index.mjs.map +2 -2
- package/build-module/custom-gradient-picker/gradient-bar/index.mjs.map +2 -2
- package/build-module/draggable/index.mjs +1 -1
- package/build-module/draggable/index.mjs.map +2 -2
- package/build-module/navigable-container/container.mjs +16 -22
- package/build-module/navigable-container/container.mjs.map +2 -2
- package/build-module/unit-control/utils.mjs +33 -35
- package/build-module/unit-control/utils.mjs.map +2 -2
- package/build-style/style-rtl.css +41 -10
- package/build-style/style.css +41 -10
- package/build-types/card/context.d.ts +3 -0
- package/build-types/card/context.d.ts.map +1 -0
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
- package/build-types/date-time/date/index.d.ts +23 -0
- package/build-types/date-time/date/index.d.ts.map +1 -0
- package/build-types/date-time/date/styles.d.ts +45 -0
- package/build-types/date-time/date/styles.d.ts.map +1 -0
- package/build-types/date-time/date/test/index.d.ts +2 -0
- package/build-types/date-time/date/test/index.d.ts.map +1 -0
- package/build-types/date-time/date/test/use-lilius.d.ts +2 -0
- package/build-types/date-time/date/test/use-lilius.d.ts.map +1 -0
- package/build-types/date-time/date/use-lilius/index.d.ts +169 -0
- package/build-types/date-time/date/use-lilius/index.d.ts.map +1 -0
- package/build-types/date-time/time/index.d.ts +27 -0
- package/build-types/date-time/time/index.d.ts.map +1 -0
- package/build-types/date-time/time/styles.d.ts +93 -0
- package/build-types/date-time/time/styles.d.ts.map +1 -0
- package/build-types/date-time/time/test/index.d.ts +2 -0
- package/build-types/date-time/time/test/index.d.ts.map +1 -0
- package/build-types/date-time/time/time-input/index.d.ts +4 -0
- package/build-types/date-time/time/time-input/index.d.ts.map +1 -0
- package/build-types/date-time/time/time-input/test/index.d.ts +2 -0
- package/build-types/date-time/time/time-input/test/index.d.ts.map +1 -0
- package/build-types/date-time/time/timezone.d.ts +7 -0
- package/build-types/date-time/time/timezone.d.ts.map +1 -0
- package/build-types/navigable-container/container.d.ts.map +1 -1
- package/build-types/navigation/back-button/index.d.ts +7 -0
- package/build-types/navigation/back-button/index.d.ts.map +1 -0
- package/build-types/navigation/constants.d.ts +3 -0
- package/build-types/navigation/constants.d.ts.map +1 -0
- package/build-types/navigation/context.d.ts +4 -0
- package/build-types/navigation/context.d.ts.map +1 -0
- package/build-types/navigation/group/context.d.ts +7 -0
- package/build-types/navigation/group/context.d.ts.map +1 -0
- package/build-types/navigation/group/index.d.ts +7 -0
- package/build-types/navigation/group/index.d.ts.map +1 -0
- package/build-types/navigation/index.d.ts +46 -0
- package/build-types/navigation/index.d.ts.map +1 -0
- package/build-types/navigation/item/base-content.d.ts +3 -0
- package/build-types/navigation/item/base-content.d.ts.map +1 -0
- package/build-types/navigation/item/base.d.ts +3 -0
- package/build-types/navigation/item/base.d.ts.map +1 -0
- package/build-types/navigation/item/index.d.ts +7 -0
- package/build-types/navigation/item/index.d.ts.map +1 -0
- package/build-types/navigation/item/use-navigation-tree-item.d.ts +3 -0
- package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +1 -0
- package/build-types/navigation/menu/context.d.ts +7 -0
- package/build-types/navigation/menu/context.d.ts.map +1 -0
- package/build-types/navigation/menu/index.d.ts +7 -0
- package/build-types/navigation/menu/index.d.ts.map +1 -0
- package/build-types/navigation/menu/menu-title-search.d.ts +3 -0
- package/build-types/navigation/menu/menu-title-search.d.ts.map +1 -0
- package/build-types/navigation/menu/menu-title.d.ts +3 -0
- package/build-types/navigation/menu/menu-title.d.ts.map +1 -0
- package/build-types/navigation/menu/search-no-results-found.d.ts +3 -0
- package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -0
- package/build-types/navigation/menu/use-navigation-tree-menu.d.ts +3 -0
- package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +1 -0
- package/build-types/navigation/stories/index.story.d.ts +23 -0
- package/build-types/navigation/stories/index.story.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/controlled-state.d.ts +7 -0
- package/build-types/navigation/stories/utils/controlled-state.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/default.d.ts +10 -0
- package/build-types/navigation/stories/utils/default.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/group.d.ts +10 -0
- package/build-types/navigation/stories/utils/group.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts +10 -0
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/more-examples.d.ts +10 -0
- package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/search.d.ts +10 -0
- package/build-types/navigation/stories/utils/search.d.ts.map +1 -0
- package/build-types/navigation/styles/navigation-styles.d.ts +55 -0
- package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -0
- package/build-types/navigation/test/index.d.ts +2 -0
- package/build-types/navigation/test/index.d.ts.map +1 -0
- package/build-types/navigation/types.d.ts +266 -0
- package/build-types/navigation/types.d.ts.map +1 -0
- package/build-types/navigation/use-create-navigation-tree.d.ts +15 -0
- package/build-types/navigation/use-create-navigation-tree.d.ts.map +1 -0
- package/build-types/navigation/use-navigation-tree-nodes.d.ts +10 -0
- package/build-types/navigation/use-navigation-tree-nodes.d.ts.map +1 -0
- package/build-types/navigation/utils.d.ts +3 -0
- package/build-types/navigation/utils.d.ts.map +1 -0
- package/build-types/unit-control/utils.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/combobox-control.d.ts +2 -2
- package/build-types/visually-hidden/test/index.d.ts +2 -0
- package/build-types/visually-hidden/test/index.d.ts.map +1 -0
- package/package.json +34 -32
- package/src/card/card/README.md +4 -4
- package/src/checkbox-control/README.md +1 -1
- package/src/clipboard-button/README.md +4 -4
- package/src/color-palette/index.tsx +5 -0
- package/src/color-palette/test/index.tsx +30 -0
- package/src/combobox-control/README.md +1 -1
- package/src/confirm-dialog/README.md +1 -1
- package/src/custom-gradient-picker/gradient-bar/index.tsx +1 -1
- package/src/flex/flex/README.md +1 -1
- package/src/navigable-container/container.tsx +22 -30
- package/src/popover/README.md +1 -1
- package/src/scrollable/README.md +1 -1
- package/src/tooltip/style.scss +1 -1
- package/src/unit-control/utils.ts +33 -52
- package/build/mobile/image/constants.cjs +0 -34
- package/build/mobile/image/constants.cjs.map +0 -7
- package/build-module/mobile/image/constants.mjs +0 -9
- package/build-module/mobile/image/constants.mjs.map +0 -7
- package/src/autocomplete/autocompleter-ui.native.js +0 -211
- package/src/autocomplete/background-view.android.js +0 -25
- package/src/autocomplete/background-view.ios.js +0 -23
- package/src/autocomplete/style.android.scss +0 -7
- package/src/autocomplete/style.native.scss +0 -74
- package/src/base-control/index.native.js +0 -14
- package/src/button/index.native.js +0 -236
- package/src/button/style.native.scss +0 -9
- package/src/color-control/index.native.js +0 -24
- package/src/color-indicator/index.native.js +0 -80
- package/src/color-indicator/style.native.scss +0 -51
- package/src/color-palette/index.native.js +0 -360
- package/src/color-palette/style.native.scss +0 -49
- package/src/color-picker/hsv-color-picker.native.js +0 -88
- package/src/color-picker/hue-picker.native.js +0 -198
- package/src/color-picker/index.native.js +0 -215
- package/src/color-picker/saturation-picker.native.js +0 -167
- package/src/color-picker/style.native.scss +0 -87
- package/src/custom-gradient-picker/index.native.js +0 -110
- package/src/custom-gradient-picker/style.native.scss +0 -3
- package/src/dashicon/index.native.js +0 -18
- package/src/disabled/index.native.js +0 -10
- package/src/draggable/index.native.js +0 -234
- package/src/draggable/style.native.scss +0 -3
- package/src/draggable/test/index.native.js +0 -138
- package/src/dropdown/index.native.js +0 -59
- package/src/dropdown-menu/index.native.js +0 -152
- package/src/external-link/index.native.js +0 -25
- package/src/focal-point-picker/focal-point.native.js +0 -30
- package/src/focal-point-picker/index.native.js +0 -281
- package/src/focal-point-picker/tooltip/index.native.js +0 -144
- package/src/focal-point-picker/tooltip/style.native.scss +0 -42
- package/src/font-size-picker/index.native.js +0 -190
- package/src/font-size-picker/style.native.scss +0 -6
- package/src/footer-message-control/index.native.js +0 -14
- package/src/higher-order/with-focus-outside/index.native.js +0 -38
- package/src/index.native.js +0 -134
- package/src/keyboard-shortcuts/index.native.js +0 -2
- package/src/mobile/README.md +0 -3
- package/src/mobile/autocompletion-items.native.js +0 -11
- package/src/mobile/badge/README.md +0 -31
- package/src/mobile/badge/index.native.js +0 -27
- package/src/mobile/badge/style.scss +0 -18
- package/src/mobile/bottom-sheet/borderStyles.android.scss +0 -8
- package/src/mobile/bottom-sheet/borderStyles.ios.scss +0 -9
- package/src/mobile/bottom-sheet/bottom-sheet-context.native.js +0 -40
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/README.md +0 -101
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/bottom-sheet-navigation-context.native.js +0 -16
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +0 -193
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +0 -146
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/styles.native.scss +0 -11
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +0 -197
- package/src/mobile/bottom-sheet/button.native.js +0 -19
- package/src/mobile/bottom-sheet/cell.native.js +0 -464
- package/src/mobile/bottom-sheet/cellStyles.android.scss +0 -15
- package/src/mobile/bottom-sheet/cellStyles.ios.scss +0 -19
- package/src/mobile/bottom-sheet/chevron-back.native.js +0 -18
- package/src/mobile/bottom-sheet/color-cell.native.js +0 -35
- package/src/mobile/bottom-sheet/cycle-picker-cell.native.js +0 -31
- package/src/mobile/bottom-sheet/footer-message-cell.native.js +0 -23
- package/src/mobile/bottom-sheet/footer-message-link/README.md +0 -37
- package/src/mobile/bottom-sheet/footer-message-link/footer-message-link.native.js +0 -26
- package/src/mobile/bottom-sheet/footer-message-link/styles.native.scss +0 -7
- package/src/mobile/bottom-sheet/index.native.js +0 -646
- package/src/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -125
- package/src/mobile/bottom-sheet/link-cell.native.js +0 -35
- package/src/mobile/bottom-sheet/link-suggestion-item-cell.native.js +0 -92
- package/src/mobile/bottom-sheet/link-suggestion-styles.native.scss +0 -27
- package/src/mobile/bottom-sheet/lock-icon/index.native.js +0 -19
- package/src/mobile/bottom-sheet/lock-icon/styles.native.scss +0 -8
- package/src/mobile/bottom-sheet/nav-bar/README.md +0 -63
- package/src/mobile/bottom-sheet/nav-bar/action-button.native.js +0 -30
- package/src/mobile/bottom-sheet/nav-bar/apply-button.native.js +0 -53
- package/src/mobile/bottom-sheet/nav-bar/back-button.native.js +0 -94
- package/src/mobile/bottom-sheet/nav-bar/heading.native.js +0 -33
- package/src/mobile/bottom-sheet/nav-bar/index.native.js +0 -23
- package/src/mobile/bottom-sheet/nav-bar/styles.native.scss +0 -69
- package/src/mobile/bottom-sheet/picker-cell.native.js +0 -40
- package/src/mobile/bottom-sheet/radio-cell.native.js +0 -39
- package/src/mobile/bottom-sheet/range-cell.native.js +0 -274
- package/src/mobile/bottom-sheet/range-cell.native.scss +0 -40
- package/src/mobile/bottom-sheet/range-text-input.native.js +0 -248
- package/src/mobile/bottom-sheet/ripple.native.js +0 -83
- package/src/mobile/bottom-sheet/ripple.native.scss +0 -11
- package/src/mobile/bottom-sheet/stepper-cell/index.native.js +0 -264
- package/src/mobile/bottom-sheet/stepper-cell/stepper.android.js +0 -78
- package/src/mobile/bottom-sheet/stepper-cell/stepper.ios.js +0 -64
- package/src/mobile/bottom-sheet/stepper-cell/style.native.scss +0 -89
- package/src/mobile/bottom-sheet/styles.native.scss +0 -333
- package/src/mobile/bottom-sheet/sub-sheet/README.md +0 -90
- package/src/mobile/bottom-sheet/sub-sheet/index.native.js +0 -49
- package/src/mobile/bottom-sheet/switch-cell.native.js +0 -75
- package/src/mobile/bottom-sheet/test/index.native.js +0 -24
- package/src/mobile/bottom-sheet/test/range-cell.native.js +0 -73
- package/src/mobile/bottom-sheet-select-control/README.md +0 -97
- package/src/mobile/bottom-sheet-select-control/index.native.js +0 -124
- package/src/mobile/bottom-sheet-select-control/style.native.scss +0 -3
- package/src/mobile/bottom-sheet-text-control/README.md +0 -98
- package/src/mobile/bottom-sheet-text-control/index.native.js +0 -104
- package/src/mobile/bottom-sheet-text-control/styles.scss +0 -25
- package/src/mobile/clipboard/index.native.js +0 -18
- package/src/mobile/color-settings/gradient-picker-screen.native.js +0 -37
- package/src/mobile/color-settings/index.native.js +0 -88
- package/src/mobile/color-settings/palette.screen.native.js +0 -232
- package/src/mobile/color-settings/picker-screen.native.js +0 -60
- package/src/mobile/color-settings/style.native.scss +0 -62
- package/src/mobile/color-settings/utils.native.js +0 -36
- package/src/mobile/cycle-select-control/README.md +0 -3
- package/src/mobile/cycle-select-control/index.native.js +0 -39
- package/src/mobile/dashicons/index.native.js +0 -22
- package/src/mobile/focal-point-settings-panel/index.native.js +0 -84
- package/src/mobile/focal-point-settings-panel/styles.native.scss +0 -3
- package/src/mobile/gradient/index.native.js +0 -188
- package/src/mobile/gradient/style.native.scss +0 -8
- package/src/mobile/gradient/test/index.native.js +0 -114
- package/src/mobile/gridicons/index.native.js +0 -39
- package/src/mobile/html-text-input/index.native.js +0 -169
- package/src/mobile/html-text-input/style.android.scss +0 -8
- package/src/mobile/html-text-input/style.ios.scss +0 -10
- package/src/mobile/html-text-input/style.scss +0 -45
- package/src/mobile/html-text-input/test/__snapshots__/index.native.js.snap +0 -48
- package/src/mobile/html-text-input/test/index.native.js +0 -118
- package/src/mobile/image/constants.js +0 -1
- package/src/mobile/image/icon-customize.native.js +0 -10
- package/src/mobile/image/icon-retry.native.js +0 -11
- package/src/mobile/image/image-editing-button.native.js +0 -63
- package/src/mobile/image/index.native.js +0 -401
- package/src/mobile/image/style.native.scss +0 -179
- package/src/mobile/image/utils/index.native.js +0 -58
- package/src/mobile/keyboard-avoiding-view/index.android.js +0 -8
- package/src/mobile/keyboard-avoiding-view/index.ios.js +0 -143
- package/src/mobile/keyboard-avoiding-view/styles.native.scss +0 -9
- package/src/mobile/keyboard-aware-flat-list/index.android.js +0 -81
- package/src/mobile/keyboard-aware-flat-list/index.ios.js +0 -147
- package/src/mobile/keyboard-aware-flat-list/shared.native.js +0 -26
- package/src/mobile/keyboard-aware-flat-list/styles.native.scss +0 -8
- package/src/mobile/keyboard-aware-flat-list/test/use-keyboard-offset.native.js +0 -203
- package/src/mobile/keyboard-aware-flat-list/test/use-scroll-to-section.native.js +0 -142
- package/src/mobile/keyboard-aware-flat-list/test/use-scroll.native.js +0 -71
- package/src/mobile/keyboard-aware-flat-list/test/use-text-input-caret-position.native.js +0 -82
- package/src/mobile/keyboard-aware-flat-list/test/use-text-input-offset.native.js +0 -147
- package/src/mobile/keyboard-aware-flat-list/use-keyboard-offset.native.js +0 -87
- package/src/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js +0 -41
- package/src/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js +0 -100
- package/src/mobile/keyboard-aware-flat-list/use-scroll.native.js +0 -100
- package/src/mobile/keyboard-aware-flat-list/use-text-input-caret-position.native.js +0 -36
- package/src/mobile/keyboard-aware-flat-list/use-text-input-offset.native.js +0 -54
- package/src/mobile/layout-animation/index.native.js +0 -16
- package/src/mobile/link-picker/index.native.js +0 -160
- package/src/mobile/link-picker/link-picker-results.native.js +0 -129
- package/src/mobile/link-picker/link-picker-screen.native.js +0 -60
- package/src/mobile/link-picker/styles.native.scss +0 -45
- package/src/mobile/link-picker/test/performance/index.native.js +0 -35
- package/src/mobile/link-settings/index.native.js +0 -332
- package/src/mobile/link-settings/link-rel.native.js +0 -10
- package/src/mobile/link-settings/link-settings-navigation.native.js +0 -50
- package/src/mobile/link-settings/link-settings-screen.native.js +0 -44
- package/src/mobile/link-settings/style.native.scss +0 -4
- package/src/mobile/link-settings/test/edit.native.js +0 -325
- package/src/mobile/link-settings/test/link-settings-navigation.native.js +0 -94
- package/src/mobile/media-edit/index.native.js +0 -125
- package/src/mobile/picker/index.android.js +0 -104
- package/src/mobile/picker/index.ios.js +0 -96
- package/src/mobile/picker/styles.native.scss +0 -29
- package/src/mobile/segmented-control/index.native.js +0 -186
- package/src/mobile/segmented-control/style.native.scss +0 -99
- package/src/mobile/utils/alignments.native.js +0 -78
- package/src/mobile/utils/get-px-from-css-unit.native.js +0 -329
- package/src/mobile/utils/index.native.js +0 -12
- package/src/mobile/utils/test/get-px-from-css-unit.native.js +0 -172
- package/src/mobile/utils/test/index.native.js +0 -134
- package/src/mobile/utils/use-is-floating-keyboard.native.js +0 -31
- package/src/mobile/utils/use-unit-converter-to-mobile.native.js +0 -90
- package/src/notice/index.native.js +0 -123
- package/src/notice/list.native.js +0 -55
- package/src/notice/style.native.scss +0 -60
- package/src/panel/actions.native.js +0 -46
- package/src/panel/actions.native.scss +0 -12
- package/src/panel/body.native.js +0 -29
- package/src/panel/body.native.scss +0 -11
- package/src/panel/bottom-separator-cover.native.js +0 -27
- package/src/panel/bottom-separator-cover.native.scss +0 -9
- package/src/private-apis.native.js +0 -13
- package/src/query-controls/index.native.js +0 -103
- package/src/radio-control/index.native.js +0 -24
- package/src/range-control/index.native.js +0 -73
- package/src/resizable-box/index.native.js +0 -32
- package/src/resizable-box/style.native.scss +0 -14
- package/src/sandbox/index.native.js +0 -392
- package/src/sandbox/style.native.scss +0 -7
- package/src/search-control/index.native.js +0 -274
- package/src/search-control/platform-style.android.scss +0 -57
- package/src/search-control/platform-style.ios.scss +0 -43
- package/src/search-control/style.native.scss +0 -63
- package/src/select-control/index.native.js +0 -41
- package/src/slot-fill/index.native.js +0 -25
- package/src/spinner/index.native.js +0 -22
- package/src/spinner/style.native.scss +0 -4
- package/src/style-provider/index.native.js +0 -3
- package/src/text/index.native.js +0 -13
- package/src/text/styles/emotion-css.native.js +0 -6
- package/src/text/styles/font-family.native.js +0 -1
- package/src/text/styles/text-mixins.native.js +0 -163
- package/src/text-control/index.native.js +0 -41
- package/src/textarea-control/index.native.js +0 -26
- package/src/toggle-control/index.native.js +0 -31
- package/src/toolbar/toolbar/style.native.scss +0 -11
- package/src/toolbar/toolbar/toolbar-container.native.js +0 -8
- package/src/toolbar/toolbar-button/toolbar-button-container.native.js +0 -8
- package/src/toolbar/toolbar-group/style.native.scss +0 -10
- package/src/toolbar/toolbar-group/toolbar-group-collapsed.native.js +0 -36
- package/src/toolbar/toolbar-group/toolbar-group-container.native.js +0 -26
- package/src/toolbar/toolbar-item/index.native.js +0 -17
- package/src/tooltip/index.native.js +0 -292
- package/src/tooltip/style.native.scss +0 -39
- package/src/tooltip/test/index.native.js +0 -98
- package/src/unit-control/index.native.js +0 -202
- package/src/unit-control/style.native.scss +0 -19
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { View, Text, TouchableWithoutFeedback } from 'react-native';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { __ } from '@wordpress/i18n';
|
|
10
|
-
import { useState, useContext } from '@wordpress/element';
|
|
11
|
-
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
12
|
-
import { useRoute, useNavigation } from '@react-navigation/native';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
import ColorPalette from '../../color-palette';
|
|
18
|
-
import ColorIndicator from '../../color-indicator';
|
|
19
|
-
import NavBar from '../bottom-sheet/nav-bar';
|
|
20
|
-
import SegmentedControls from '../segmented-control';
|
|
21
|
-
import { colorsUtils } from './utils';
|
|
22
|
-
import PanelBody from '../../panel/body';
|
|
23
|
-
import { BottomSheetContext } from '../bottom-sheet/bottom-sheet-context';
|
|
24
|
-
import ColorControl from '../../color-control';
|
|
25
|
-
|
|
26
|
-
import styles from './style.scss';
|
|
27
|
-
|
|
28
|
-
const HIT_SLOP = { top: 8, bottom: 8, left: 8, right: 8 };
|
|
29
|
-
|
|
30
|
-
const PaletteScreen = () => {
|
|
31
|
-
const route = useRoute();
|
|
32
|
-
const navigation = useNavigation();
|
|
33
|
-
const { shouldEnableBottomSheetScroll } = useContext( BottomSheetContext );
|
|
34
|
-
const {
|
|
35
|
-
label,
|
|
36
|
-
onColorChange,
|
|
37
|
-
onGradientChange,
|
|
38
|
-
onColorCleared,
|
|
39
|
-
colorValue,
|
|
40
|
-
defaultSettings,
|
|
41
|
-
hideNavigation = false,
|
|
42
|
-
} = route.params || {};
|
|
43
|
-
const { segments, isGradient } = colorsUtils;
|
|
44
|
-
const [ currentValue, setCurrentValue ] = useState( colorValue );
|
|
45
|
-
const isGradientColor = isGradient( currentValue );
|
|
46
|
-
const selectedSegmentIndex = isGradientColor ? 1 : 0;
|
|
47
|
-
|
|
48
|
-
const [ currentSegment, setCurrentSegment ] = useState(
|
|
49
|
-
segments[ selectedSegmentIndex ]
|
|
50
|
-
);
|
|
51
|
-
const isGradientSegment = currentSegment === colorsUtils.segments[ 1 ];
|
|
52
|
-
const currentSegmentColors = ! isGradientSegment
|
|
53
|
-
? defaultSettings.colors
|
|
54
|
-
: defaultSettings.gradients;
|
|
55
|
-
const allAvailableColors = defaultSettings?.allAvailableColors || [];
|
|
56
|
-
const allAvailableGradients = currentSegmentColors
|
|
57
|
-
.flatMap( ( { gradients } ) => gradients )
|
|
58
|
-
.filter( Boolean );
|
|
59
|
-
|
|
60
|
-
const horizontalSeparatorStyle = usePreferredColorSchemeStyle(
|
|
61
|
-
styles.horizontalSeparator,
|
|
62
|
-
styles.horizontalSeparatorDark
|
|
63
|
-
);
|
|
64
|
-
const clearButtonStyle = usePreferredColorSchemeStyle(
|
|
65
|
-
styles.clearButton,
|
|
66
|
-
styles.clearButtonDark
|
|
67
|
-
);
|
|
68
|
-
const selectedColorTextStyle = usePreferredColorSchemeStyle(
|
|
69
|
-
styles.colorText,
|
|
70
|
-
styles.colorTextDark
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
const isSolidSegment = currentSegment === segments[ 0 ];
|
|
74
|
-
const isCustomGadientShown = ! isSolidSegment && isGradientColor;
|
|
75
|
-
|
|
76
|
-
const setColor = ( color ) => {
|
|
77
|
-
setCurrentValue( color );
|
|
78
|
-
if ( isSolidSegment && onColorChange && onGradientChange ) {
|
|
79
|
-
onColorChange( color );
|
|
80
|
-
} else if ( isSolidSegment && onColorChange ) {
|
|
81
|
-
onColorChange( color );
|
|
82
|
-
} else if ( ! isSolidSegment && onGradientChange ) {
|
|
83
|
-
onGradientChange( color );
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
function onClear() {
|
|
88
|
-
setCurrentValue( undefined );
|
|
89
|
-
|
|
90
|
-
if ( onColorCleared ) {
|
|
91
|
-
onColorCleared();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function onCustomPress() {
|
|
96
|
-
if ( isSolidSegment ) {
|
|
97
|
-
navigation.navigate( colorsUtils.screens.picker, {
|
|
98
|
-
currentValue,
|
|
99
|
-
setColor,
|
|
100
|
-
} );
|
|
101
|
-
} else {
|
|
102
|
-
navigation.navigate( colorsUtils.screens.gradientPicker, {
|
|
103
|
-
setColor,
|
|
104
|
-
isGradientColor,
|
|
105
|
-
currentValue,
|
|
106
|
-
} );
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function getClearButton() {
|
|
111
|
-
return (
|
|
112
|
-
<TouchableWithoutFeedback
|
|
113
|
-
accessibilityLabel={ __( 'Clear selected color' ) }
|
|
114
|
-
onPress={ onClear }
|
|
115
|
-
hitSlop={ HIT_SLOP }
|
|
116
|
-
>
|
|
117
|
-
<View style={ styles.clearButtonContainer }>
|
|
118
|
-
<Text style={ clearButtonStyle }>{ __( 'Reset' ) }</Text>
|
|
119
|
-
</View>
|
|
120
|
-
</TouchableWithoutFeedback>
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function getFooter() {
|
|
125
|
-
if ( onGradientChange ) {
|
|
126
|
-
return (
|
|
127
|
-
<SegmentedControls
|
|
128
|
-
segments={ segments }
|
|
129
|
-
segmentHandler={ setCurrentSegment }
|
|
130
|
-
selectedIndex={ segments.indexOf( currentSegment ) }
|
|
131
|
-
addonLeft={
|
|
132
|
-
currentValue && (
|
|
133
|
-
<ColorIndicator
|
|
134
|
-
color={ currentValue }
|
|
135
|
-
style={ styles.colorIndicator }
|
|
136
|
-
/>
|
|
137
|
-
)
|
|
138
|
-
}
|
|
139
|
-
addonRight={ currentValue && getClearButton() }
|
|
140
|
-
/>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
return (
|
|
144
|
-
<View style={ styles.footer }>
|
|
145
|
-
<View style={ styles.flex }>
|
|
146
|
-
{ currentValue && (
|
|
147
|
-
<ColorIndicator
|
|
148
|
-
color={ currentValue }
|
|
149
|
-
style={ styles.colorIndicator }
|
|
150
|
-
/>
|
|
151
|
-
) }
|
|
152
|
-
</View>
|
|
153
|
-
{ currentValue ? (
|
|
154
|
-
<Text
|
|
155
|
-
style={ selectedColorTextStyle }
|
|
156
|
-
maxFontSizeMultiplier={ 2 }
|
|
157
|
-
selectable
|
|
158
|
-
>
|
|
159
|
-
{ currentValue.toUpperCase() }
|
|
160
|
-
</Text>
|
|
161
|
-
) : (
|
|
162
|
-
<Text
|
|
163
|
-
style={ styles.selectColorText }
|
|
164
|
-
maxFontSizeMultiplier={ 2 }
|
|
165
|
-
>
|
|
166
|
-
{ __( 'Select a color above' ) }
|
|
167
|
-
</Text>
|
|
168
|
-
) }
|
|
169
|
-
<View style={ styles.flex }>
|
|
170
|
-
{ currentValue && getClearButton() }
|
|
171
|
-
</View>
|
|
172
|
-
</View>
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
return (
|
|
176
|
-
<View>
|
|
177
|
-
{ ! hideNavigation && (
|
|
178
|
-
<NavBar>
|
|
179
|
-
<NavBar.BackButton onPress={ navigation.goBack } />
|
|
180
|
-
<NavBar.Heading>{ label } </NavBar.Heading>
|
|
181
|
-
</NavBar>
|
|
182
|
-
) }
|
|
183
|
-
|
|
184
|
-
<View style={ styles.colorPalettes }>
|
|
185
|
-
{ currentSegmentColors.map( ( palette, paletteKey ) => {
|
|
186
|
-
const paletteSettings = {
|
|
187
|
-
colors: palette.colors,
|
|
188
|
-
gradients: palette.gradients,
|
|
189
|
-
allColors: allAvailableColors,
|
|
190
|
-
allGradients: allAvailableGradients,
|
|
191
|
-
};
|
|
192
|
-
// Limit to show the custom indicator to the first available palette
|
|
193
|
-
const enableCustomColor = paletteKey === 0;
|
|
194
|
-
|
|
195
|
-
return (
|
|
196
|
-
<ColorPalette
|
|
197
|
-
enableCustomColor={ enableCustomColor }
|
|
198
|
-
label={ palette.name }
|
|
199
|
-
key={ paletteKey }
|
|
200
|
-
setColor={ setColor }
|
|
201
|
-
activeColor={ currentValue }
|
|
202
|
-
isGradientColor={ isGradientColor }
|
|
203
|
-
currentSegment={ currentSegment }
|
|
204
|
-
onCustomPress={ onCustomPress }
|
|
205
|
-
shouldEnableBottomSheetScroll={
|
|
206
|
-
shouldEnableBottomSheetScroll
|
|
207
|
-
}
|
|
208
|
-
defaultSettings={ paletteSettings }
|
|
209
|
-
/>
|
|
210
|
-
);
|
|
211
|
-
} ) }
|
|
212
|
-
</View>
|
|
213
|
-
|
|
214
|
-
{ isCustomGadientShown && (
|
|
215
|
-
<>
|
|
216
|
-
<View style={ horizontalSeparatorStyle } />
|
|
217
|
-
<PanelBody>
|
|
218
|
-
<ColorControl
|
|
219
|
-
label={ __( 'Customize Gradient' ) }
|
|
220
|
-
onPress={ onCustomPress }
|
|
221
|
-
withColorIndicator={ false }
|
|
222
|
-
/>
|
|
223
|
-
</PanelBody>
|
|
224
|
-
</>
|
|
225
|
-
) }
|
|
226
|
-
<View style={ horizontalSeparatorStyle } />
|
|
227
|
-
{ getFooter() }
|
|
228
|
-
</View>
|
|
229
|
-
);
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
export default PaletteScreen;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useRoute, useNavigation } from '@react-navigation/native';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useContext, useMemo } from '@wordpress/element';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { ColorPicker } from '../../color-picker';
|
|
15
|
-
import { BottomSheetContext } from '../bottom-sheet/bottom-sheet-context';
|
|
16
|
-
|
|
17
|
-
const PickerScreen = () => {
|
|
18
|
-
const route = useRoute();
|
|
19
|
-
const navigation = useNavigation();
|
|
20
|
-
const {
|
|
21
|
-
onShouldEnableInnerHandling,
|
|
22
|
-
shouldEnableBottomSheetMaxHeight,
|
|
23
|
-
onHandleClosingBottomSheet,
|
|
24
|
-
isBottomSheetContentScrolling,
|
|
25
|
-
shouldEnableBottomSheetScroll,
|
|
26
|
-
onHandleHardwareButtonPress,
|
|
27
|
-
} = useContext( BottomSheetContext );
|
|
28
|
-
const { setColor, currentValue, isGradientColor } = route.params;
|
|
29
|
-
return useMemo( () => {
|
|
30
|
-
return (
|
|
31
|
-
<ColorPicker
|
|
32
|
-
onShouldEnableInnerHandling={ onShouldEnableInnerHandling }
|
|
33
|
-
shouldEnableBottomSheetMaxHeight={
|
|
34
|
-
shouldEnableBottomSheetMaxHeight
|
|
35
|
-
}
|
|
36
|
-
setColor={ setColor }
|
|
37
|
-
activeColor={ currentValue }
|
|
38
|
-
isGradientColor={ isGradientColor }
|
|
39
|
-
onNavigationBack={ navigation.goBack }
|
|
40
|
-
onHandleClosingBottomSheet={ onHandleClosingBottomSheet }
|
|
41
|
-
isBottomSheetContentScrolling={ isBottomSheetContentScrolling }
|
|
42
|
-
shouldEnableBottomSheetScroll={ shouldEnableBottomSheetScroll }
|
|
43
|
-
onHandleHardwareButtonPress={ onHandleHardwareButtonPress }
|
|
44
|
-
/>
|
|
45
|
-
);
|
|
46
|
-
// See https://github.com/WordPress/gutenberg/pull/41166
|
|
47
|
-
}, [
|
|
48
|
-
setColor,
|
|
49
|
-
currentValue,
|
|
50
|
-
isGradientColor,
|
|
51
|
-
onShouldEnableInnerHandling,
|
|
52
|
-
shouldEnableBottomSheetMaxHeight,
|
|
53
|
-
onHandleClosingBottomSheet,
|
|
54
|
-
isBottomSheetContentScrolling,
|
|
55
|
-
shouldEnableBottomSheetScroll,
|
|
56
|
-
onHandleHardwareButtonPress,
|
|
57
|
-
] );
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export default PickerScreen;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
.horizontalSeparator {
|
|
3
|
-
border-bottom-width: $border-width;
|
|
4
|
-
border-color: $light-gray-400;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.horizontalSeparatorDark {
|
|
8
|
-
border-color: $gray-70;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.footer {
|
|
12
|
-
flex-direction: row;
|
|
13
|
-
justify-content: center;
|
|
14
|
-
align-items: center;
|
|
15
|
-
align-content: center;
|
|
16
|
-
padding: 12px $grid-unit-20;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.colorPalettes {
|
|
20
|
-
padding: $grid-unit-10 0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.colorIndicator {
|
|
24
|
-
width: 24px;
|
|
25
|
-
height: 24px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.selectColorText {
|
|
29
|
-
text-align: center;
|
|
30
|
-
color: $gray;
|
|
31
|
-
font-size: 16px;
|
|
32
|
-
flex: 2;
|
|
33
|
-
line-height: 24px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.colorText {
|
|
37
|
-
font-family: $default-monospace-font;
|
|
38
|
-
color: $light-primary;
|
|
39
|
-
font-size: 16px;
|
|
40
|
-
font-weight: 400;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.colorTextDark {
|
|
44
|
-
color: $dark-primary;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.flex {
|
|
48
|
-
flex: 1;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.clearButtonContainer {
|
|
52
|
-
align-self: flex-end;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.clearButton {
|
|
56
|
-
color: $blue-50;
|
|
57
|
-
font-size: 17px;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.clearButtonDark {
|
|
61
|
-
color: $blue-30;
|
|
62
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
|
|
6
|
-
const gradients = {
|
|
7
|
-
linear: 'linear-gradient',
|
|
8
|
-
radial: 'radial-gradient',
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const gradientOptions = [
|
|
12
|
-
{ label: __( 'Linear' ), value: gradients.linear },
|
|
13
|
-
{ label: __( 'Radial' ), value: gradients.radial },
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
const getGradientType = ( color ) => {
|
|
17
|
-
if ( color?.includes( gradients.radial ) ) {
|
|
18
|
-
return gradients.radial;
|
|
19
|
-
} else if ( color?.includes( gradients.linear ) ) {
|
|
20
|
-
return gradients.linear;
|
|
21
|
-
}
|
|
22
|
-
return false;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const colorsUtils = {
|
|
26
|
-
screens: {
|
|
27
|
-
gradientPicker: 'GradientPicker',
|
|
28
|
-
picker: 'Picker',
|
|
29
|
-
palette: 'Palette',
|
|
30
|
-
},
|
|
31
|
-
segments: [ __( 'Color' ), __( 'Gradient' ) ],
|
|
32
|
-
gradients,
|
|
33
|
-
gradientOptions,
|
|
34
|
-
getGradientType,
|
|
35
|
-
isGradient: ( color ) => !! getGradientType( color ),
|
|
36
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { memo } from '@wordpress/element';
|
|
5
|
-
/**
|
|
6
|
-
* Internal dependencies
|
|
7
|
-
*/
|
|
8
|
-
import CyclePickerCell from '../bottom-sheet/cycle-picker-cell';
|
|
9
|
-
|
|
10
|
-
function CycleSelectControl( {
|
|
11
|
-
help,
|
|
12
|
-
instanceId,
|
|
13
|
-
label,
|
|
14
|
-
multiple = false,
|
|
15
|
-
onChange,
|
|
16
|
-
options = [],
|
|
17
|
-
className,
|
|
18
|
-
hideLabelFromVision,
|
|
19
|
-
...props
|
|
20
|
-
} ) {
|
|
21
|
-
const id = `inspector-select-control-${ instanceId }`;
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<CyclePickerCell
|
|
25
|
-
label={ label }
|
|
26
|
-
hideLabelFromVision={ hideLabelFromVision }
|
|
27
|
-
id={ id }
|
|
28
|
-
help={ help }
|
|
29
|
-
className={ className }
|
|
30
|
-
onChangeValue={ onChange }
|
|
31
|
-
aria-describedby={ !! help ? `${ id }__help` : undefined }
|
|
32
|
-
multiple={ multiple }
|
|
33
|
-
options={ options }
|
|
34
|
-
{ ...props }
|
|
35
|
-
/>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default memo( CycleSelectControl );
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { SVG, Path } from '@wordpress/primitives';
|
|
5
|
-
|
|
6
|
-
const fromPathData24x24 = ( pathData ) => (
|
|
7
|
-
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
8
|
-
<Path d={ pathData } />
|
|
9
|
-
</SVG>
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
export const facebook = fromPathData24x24(
|
|
13
|
-
'M20 3H4c-.6 0-1 .4-1 1v16c0 .5.4 1 1 1h8.6v-7h-2.3v-2.7h2.3v-2c0-2.3 1.4-3.6 3.5-3.6 1 0 1.8.1 2.1.1v2.4h-1.4c-1.1 0-1.3.5-1.3 1.3v1.7h2.7l-.4 2.8h-2.3v7H20c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1z'
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
export const instagram = fromPathData24x24(
|
|
17
|
-
'M12 4.622c2.403 0 2.688.01 3.637.052.877.04 1.354.187 1.67.31.42.163.72.358 1.036.673.315.315.51.615.673 1.035.123.317.27.794.31 1.67.043.95.052 1.235.052 3.638s-.01 2.688-.052 3.637c-.04.877-.187 1.354-.31 1.67-.163.42-.358.72-.673 1.036-.315.315-.615.51-1.035.673-.317.123-.794.27-1.67.31-.95.043-1.234.052-3.638.052s-2.688-.01-3.637-.052c-.877-.04-1.354-.187-1.67-.31-.42-.163-.72-.358-1.036-.673-.315-.315-.51-.615-.673-1.035-.123-.317-.27-.794-.31-1.67-.043-.95-.052-1.235-.052-3.638s.01-2.688.052-3.637c.04-.877.187-1.354.31-1.67.163-.42.358-.72.673-1.036.315-.315.615-.51 1.035-.673.317-.123.794-.27 1.67-.31.95-.043 1.235-.052 3.638-.052M12 3c-2.444 0-2.75.01-3.71.054s-1.613.196-2.185.418c-.592.23-1.094.538-1.594 1.04-.5.5-.807 1-1.037 1.593-.223.572-.375 1.226-.42 2.184C3.01 9.25 3 9.555 3 12s.01 2.75.054 3.71.196 1.613.418 2.186c.23.592.538 1.094 1.038 1.594s1.002.808 1.594 1.038c.572.222 1.227.375 2.185.418.96.044 1.266.054 3.71.054s2.75-.01 3.71-.054 1.613-.196 2.186-.418c.592-.23 1.094-.538 1.594-1.038s.808-1.002 1.038-1.594c.222-.572.375-1.227.418-2.185.044-.96.054-1.266.054-3.71s-.01-2.75-.054-3.71-.196-1.613-.418-2.186c-.23-.592-.538-1.094-1.038-1.594s-1.002-.808-1.594-1.038c-.572-.222-1.227-.375-2.185-.418C14.75 3.01 14.445 3 12 3zm0 4.378c-2.552 0-4.622 2.07-4.622 4.622s2.07 4.622 4.622 4.622 4.622-2.07 4.622-4.622S14.552 7.378 12 7.378zM12 15c-1.657 0-3-1.343-3-3s1.343-3 3-3 3 1.343 3 3-1.343 3-3 3zm4.804-8.884c-.596 0-1.08.484-1.08 1.08s.484 1.08 1.08 1.08c.596 0 1.08-.484 1.08-1.08s-.483-1.08-1.08-1.08z'
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
export const empty = (
|
|
21
|
-
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" />
|
|
22
|
-
);
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { SafeAreaView } from 'react-native';
|
|
5
|
-
import { useRoute, useNavigation } from '@react-navigation/native';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import { memo, useContext, useState, useCallback } from '@wordpress/element';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
import NavBar from '../bottom-sheet/nav-bar';
|
|
17
|
-
import styles from './styles.scss';
|
|
18
|
-
import { BottomSheetContext } from '../bottom-sheet/bottom-sheet-context';
|
|
19
|
-
import FocalPointPicker from '../../focal-point-picker';
|
|
20
|
-
|
|
21
|
-
const FocalPointSettingsPanelMemo = memo(
|
|
22
|
-
( {
|
|
23
|
-
focalPoint,
|
|
24
|
-
onFocalPointChange,
|
|
25
|
-
shouldEnableBottomSheetScroll,
|
|
26
|
-
url,
|
|
27
|
-
} ) => {
|
|
28
|
-
const navigation = useNavigation();
|
|
29
|
-
|
|
30
|
-
function onButtonPress( action ) {
|
|
31
|
-
navigation.goBack();
|
|
32
|
-
if ( action === 'apply' ) {
|
|
33
|
-
onFocalPointChange( draftFocalPoint );
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const [ draftFocalPoint, setDraftFocalPoint ] = useState( focalPoint );
|
|
38
|
-
function setPosition( coordinates ) {
|
|
39
|
-
setDraftFocalPoint( ( prevState ) => ( {
|
|
40
|
-
...prevState,
|
|
41
|
-
...coordinates,
|
|
42
|
-
} ) );
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<SafeAreaView style={ styles.safearea }>
|
|
47
|
-
<NavBar>
|
|
48
|
-
<NavBar.DismissButton
|
|
49
|
-
onPress={ () => onButtonPress( 'cancel' ) }
|
|
50
|
-
/>
|
|
51
|
-
<NavBar.Heading>
|
|
52
|
-
{ __( 'Edit focal point' ) }
|
|
53
|
-
</NavBar.Heading>
|
|
54
|
-
<NavBar.ApplyButton
|
|
55
|
-
onPress={ () => onButtonPress( 'apply' ) }
|
|
56
|
-
/>
|
|
57
|
-
</NavBar>
|
|
58
|
-
<FocalPointPicker
|
|
59
|
-
focalPoint={ draftFocalPoint }
|
|
60
|
-
onChange={ useCallback( setPosition, [] ) }
|
|
61
|
-
shouldEnableBottomSheetScroll={
|
|
62
|
-
shouldEnableBottomSheetScroll
|
|
63
|
-
}
|
|
64
|
-
url={ url }
|
|
65
|
-
/>
|
|
66
|
-
</SafeAreaView>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
function FocalPointSettingsPanel( props ) {
|
|
72
|
-
const route = useRoute();
|
|
73
|
-
const { shouldEnableBottomSheetScroll } = useContext( BottomSheetContext );
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<FocalPointSettingsPanelMemo
|
|
77
|
-
shouldEnableBottomSheetScroll={ shouldEnableBottomSheetScroll }
|
|
78
|
-
{ ...props }
|
|
79
|
-
{ ...route.params }
|
|
80
|
-
/>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export default FocalPointSettingsPanel;
|