@wordpress/components 34.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 +25 -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/border-control/border-control-dropdown/component.cjs +33 -33
- package/build/border-control/border-control-dropdown/component.cjs.map +3 -3
- 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/disabled/index.cjs +1 -1
- package/build/disabled/index.cjs.map +2 -2
- package/build/draggable/index.cjs +1 -1
- package/build/draggable/index.cjs.map +2 -2
- package/build/higher-order/with-notices/index.cjs +15 -3
- package/build/higher-order/with-notices/index.cjs.map +2 -2
- package/build/input-control/input-base.cjs +34 -31
- package/build/input-control/input-base.cjs.map +2 -2
- package/build/navigable-container/container.cjs +15 -21
- package/build/navigable-container/container.cjs.map +2 -2
- package/build/responsive-wrapper/index.cjs +3 -4
- package/build/responsive-wrapper/index.cjs.map +2 -2
- package/build/tooltip/index.cjs +1 -2
- package/build/tooltip/index.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/border-control/border-control-dropdown/component.mjs +34 -34
- package/build-module/border-control/border-control-dropdown/component.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/disabled/index.mjs +1 -1
- package/build-module/disabled/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/higher-order/with-notices/index.mjs +16 -4
- package/build-module/higher-order/with-notices/index.mjs.map +2 -2
- package/build-module/input-control/input-base.mjs +34 -31
- package/build-module/input-control/input-base.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/responsive-wrapper/index.mjs +3 -4
- package/build-module/responsive-wrapper/index.mjs.map +2 -2
- package/build-module/tooltip/index.mjs +1 -2
- package/build-module/tooltip/index.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/border-box-control/border-box-control/hook.d.ts +10 -24
- package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +12 -26
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +10 -24
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +11 -25
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control/hook.d.ts +10 -24
- package/build-types/border-control/border-control/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts +9 -23
- package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
- package/build-types/box-control/styles/box-control-styles.d.ts +2 -2
- package/build-types/card/card/hook.d.ts +11 -25
- package/build-types/card/card/hook.d.ts.map +1 -1
- package/build-types/card/card-body/hook.d.ts +11 -25
- package/build-types/card/card-body/hook.d.ts.map +1 -1
- package/build-types/card/card-divider/hook.d.ts +12 -26
- package/build-types/card/card-divider/hook.d.ts.map +1 -1
- package/build-types/card/card-footer/hook.d.ts +11 -25
- package/build-types/card/card-footer/hook.d.ts.map +1 -1
- package/build-types/card/card-header/hook.d.ts +11 -25
- package/build-types/card/card-header/hook.d.ts.map +1 -1
- package/build-types/card/card-media/hook.d.ts +11 -25
- package/build-types/card/card-media/hook.d.ts.map +1 -1
- 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/color-picker/styles.d.ts +2 -2
- package/build-types/composite/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/styles.d.ts +12 -4
- package/build-types/custom-select-control-v2/styles.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/date-time/time-picker/styles.d.ts +4 -4
- package/build-types/elevation/hook.d.ts +11 -25
- package/build-types/elevation/hook.d.ts.map +1 -1
- package/build-types/flex/flex/hook.d.ts +11 -25
- package/build-types/flex/flex/hook.d.ts.map +1 -1
- package/build-types/flex/flex-block/hook.d.ts +11 -25
- package/build-types/flex/flex-block/hook.d.ts.map +1 -1
- package/build-types/flex/flex-item/hook.d.ts +11 -25
- package/build-types/flex/flex-item/hook.d.ts.map +1 -1
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
- package/build-types/grid/hook.d.ts +11 -25
- package/build-types/grid/hook.d.ts.map +1 -1
- package/build-types/h-stack/hook.d.ts +11 -25
- package/build-types/h-stack/hook.d.ts.map +1 -1
- package/build-types/heading/hook.d.ts +11 -25
- package/build-types/heading/hook.d.ts.map +1 -1
- package/build-types/higher-order/with-fallback-styles/index.d.ts +3 -1
- package/build-types/higher-order/with-filters/index.d.ts +6 -1
- package/build-types/higher-order/with-filters/index.d.ts.map +1 -1
- package/build-types/higher-order/with-notices/index.d.ts +4 -2
- package/build-types/higher-order/with-notices/index.d.ts.map +1 -1
- package/build-types/input-control/reducer/reducer.d.ts +1 -1
- package/build-types/item-group/item/hook.d.ts +11 -25
- package/build-types/item-group/item/hook.d.ts.map +1 -1
- package/build-types/item-group/item-group/hook.d.ts +11 -25
- package/build-types/item-group/item-group/hook.d.ts.map +1 -1
- package/build-types/menu/stories/index.story.d.ts.map +1 -1
- package/build-types/menu/styles.d.ts +21 -7
- package/build-types/menu/styles.d.ts.map +1 -1
- package/build-types/modal/use-modal-exit-animation.d.ts +1 -1
- 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/navigator/navigator-back-button/hook.d.ts +12 -26
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +12 -26
- package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
- package/build-types/number-control/index.d.ts +1 -1
- package/build-types/number-control/index.d.ts.map +1 -1
- package/build-types/number-control/stories/index.story.d.ts +1 -1
- package/build-types/number-control/stories/index.story.d.ts.map +1 -1
- package/build-types/popover/types.d.ts +2 -2
- package/build-types/popover/types.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
- package/build-types/range-control/types.d.ts +1 -1
- package/build-types/range-control/types.d.ts.map +1 -1
- package/build-types/responsive-wrapper/index.d.ts.map +1 -1
- package/build-types/scrollable/hook.d.ts +11 -25
- package/build-types/scrollable/hook.d.ts.map +1 -1
- package/build-types/snackbar/index.d.ts +2 -2
- package/build-types/snackbar/types.d.ts +2 -2
- package/build-types/snackbar/types.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +11 -25
- package/build-types/spacer/hook.d.ts.map +1 -1
- package/build-types/surface/hook.d.ts +11 -25
- package/build-types/surface/hook.d.ts.map +1 -1
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/styles.d.ts +9 -3
- package/build-types/tabs/styles.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +11 -25
- package/build-types/text/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +11 -25
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +11 -25
- package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +11 -25
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/tooltip/index.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +11 -25
- package/build-types/truncate/hook.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +1 -1
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
- package/build-types/unit-control/utils.d.ts.map +1 -1
- package/build-types/utils/get-node-text.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +11 -25
- package/build-types/v-stack/hook.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/combobox-control.d.ts +2 -2
- package/build-types/validated-form-controls/components/number-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/number-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/range-control.d.ts +1 -1
- package/build-types/validated-form-controls/control-with-error.d.ts +1 -4
- package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
- 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 +37 -35
- package/src/autocomplete/README.md +1 -1
- package/src/border-control/border-control-dropdown/component.tsx +37 -36
- 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/composite/stories/index.story.tsx +1 -0
- package/src/confirm-dialog/README.md +1 -1
- package/src/custom-gradient-picker/gradient-bar/index.tsx +1 -1
- package/src/disabled/index.tsx +1 -1
- package/src/flex/flex/README.md +1 -1
- package/src/form-file-upload/README.md +1 -1
- package/src/h-stack/hook.tsx +1 -1
- package/src/higher-order/with-notices/index.tsx +21 -4
- package/src/higher-order/with-notices/test/index.tsx +18 -0
- package/src/input-control/input-base.tsx +2 -2
- package/src/menu/README.md +7 -7
- package/src/menu/stories/index.story.tsx +1 -0
- package/src/navigable-container/container.tsx +22 -30
- package/src/popover/README.md +1 -1
- package/src/popover/index.tsx +1 -1
- package/src/popover/types.ts +4 -2
- package/src/range-control/types.ts +1 -1
- package/src/responsive-wrapper/index.tsx +3 -7
- package/src/scrollable/README.md +1 -1
- package/src/snackbar/README.md +1 -1
- package/src/snackbar/types.ts +2 -2
- package/src/tabs/README.md +1 -1
- package/src/tabs/stories/index.story.tsx +1 -0
- package/src/tabs/tablist.tsx +1 -1
- package/src/tooltip/index.tsx +1 -7
- package/src/tooltip/style.scss +1 -1
- package/src/tree-grid/test/cell.tsx +1 -0
- package/src/tree-grid/test/roving-tab-index-item.tsx +1 -0
- package/src/tree-select/README.md +1 -1
- package/src/unit-control/utils.ts +33 -52
- package/src/utils/get-node-text.ts +1 -7
- package/src/validated-form-controls/control-with-error.tsx +1 -6
- 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,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render, fireEvent } from 'test/helpers';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { HTMLTextInput } from '..';
|
|
10
|
-
|
|
11
|
-
// Finds the Content TextInput in our HTMLInputView.
|
|
12
|
-
const findContentTextInput = ( screen ) => {
|
|
13
|
-
return screen.getByLabelText( 'html-view-content' );
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
// Finds the Title TextInput in our HTMLInputView.
|
|
17
|
-
const findTitleTextInput = ( screen ) => {
|
|
18
|
-
return screen.getByLabelText( 'html-view-title' );
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const getStylesFromColorScheme = () => {
|
|
22
|
-
return { color: 'white' };
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
describe( 'HTMLTextInput', () => {
|
|
26
|
-
it( 'HTMLTextInput renders and matches snapshot', () => {
|
|
27
|
-
const screen = render(
|
|
28
|
-
<HTMLTextInput
|
|
29
|
-
getStylesFromColorScheme={ getStylesFromColorScheme }
|
|
30
|
-
/>
|
|
31
|
-
);
|
|
32
|
-
expect( screen.toJSON() ).toMatchSnapshot();
|
|
33
|
-
} );
|
|
34
|
-
|
|
35
|
-
it( 'HTMLTextInput updates state on HTML text change', () => {
|
|
36
|
-
const onChange = jest.fn();
|
|
37
|
-
|
|
38
|
-
const screen = render(
|
|
39
|
-
<HTMLTextInput
|
|
40
|
-
onChange={ onChange }
|
|
41
|
-
onPersist={ jest.fn() }
|
|
42
|
-
getStylesFromColorScheme={ getStylesFromColorScheme }
|
|
43
|
-
/>
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
// Simulate user typing text.
|
|
47
|
-
const htmlTextInput = findContentTextInput( screen );
|
|
48
|
-
fireEvent( htmlTextInput, 'changeText', 'text' );
|
|
49
|
-
|
|
50
|
-
// Check if the onChange is called and the state is updated.
|
|
51
|
-
expect( onChange ).toHaveBeenCalledTimes( 1 );
|
|
52
|
-
expect( onChange ).toHaveBeenCalledWith( 'text' );
|
|
53
|
-
|
|
54
|
-
expect( screen.getByDisplayValue( 'text' ) ).toBeDefined();
|
|
55
|
-
} );
|
|
56
|
-
|
|
57
|
-
it( 'HTMLTextInput persists changes in HTML text input on blur', () => {
|
|
58
|
-
const onPersist = jest.fn();
|
|
59
|
-
|
|
60
|
-
const screen = render(
|
|
61
|
-
<HTMLTextInput
|
|
62
|
-
onPersist={ onPersist }
|
|
63
|
-
onChange={ jest.fn() }
|
|
64
|
-
getStylesFromColorScheme={ getStylesFromColorScheme }
|
|
65
|
-
/>
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
// Simulate user typing text.
|
|
69
|
-
const htmlTextInput = findContentTextInput( screen );
|
|
70
|
-
fireEvent( htmlTextInput, 'changeText', 'text' );
|
|
71
|
-
|
|
72
|
-
//Simulate blur event.
|
|
73
|
-
fireEvent( htmlTextInput, 'blur' );
|
|
74
|
-
|
|
75
|
-
// Normally prop.value is updated with the help of withSelect
|
|
76
|
-
// but we don't have it in tests so we just simulate it.
|
|
77
|
-
screen.update(
|
|
78
|
-
<HTMLTextInput
|
|
79
|
-
onPersist={ onPersist }
|
|
80
|
-
onChange={ jest.fn() }
|
|
81
|
-
getStylesFromColorScheme={ getStylesFromColorScheme }
|
|
82
|
-
value="text"
|
|
83
|
-
/>
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
// Check if the onPersist is called and the state is updated.
|
|
87
|
-
expect( onPersist ).toHaveBeenCalledTimes( 1 );
|
|
88
|
-
expect( onPersist ).toHaveBeenCalledWith( 'text' );
|
|
89
|
-
|
|
90
|
-
//Simulate blur event.
|
|
91
|
-
fireEvent( htmlTextInput, 'blur' );
|
|
92
|
-
|
|
93
|
-
// Check that onPersist is not called for non-dirty state.
|
|
94
|
-
expect( onPersist ).toHaveBeenCalledTimes( 1 );
|
|
95
|
-
|
|
96
|
-
// We expect state.value is getting propagated from prop.value.
|
|
97
|
-
expect( screen.getByDisplayValue( 'text' ) ).toBeDefined();
|
|
98
|
-
} );
|
|
99
|
-
|
|
100
|
-
it( 'HTMLTextInput propagates title changes to store', () => {
|
|
101
|
-
const editTitle = jest.fn();
|
|
102
|
-
|
|
103
|
-
const screen = render(
|
|
104
|
-
<HTMLTextInput
|
|
105
|
-
editTitle={ editTitle }
|
|
106
|
-
getStylesFromColorScheme={ getStylesFromColorScheme }
|
|
107
|
-
/>
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
// Simulate user typing text.
|
|
111
|
-
const textInput = findTitleTextInput( screen );
|
|
112
|
-
fireEvent( textInput, 'changeText', 'text' );
|
|
113
|
-
|
|
114
|
-
// Check if the setTitleAction is called.
|
|
115
|
-
expect( editTitle ).toHaveBeenCalledTimes( 1 );
|
|
116
|
-
expect( editTitle ).toHaveBeenCalledWith( 'text' );
|
|
117
|
-
} );
|
|
118
|
-
} );
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const IMAGE_DEFAULT_FOCAL_POINT = { x: 0.5, y: 0.5 };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { SVG, Path } from '@wordpress/primitives';
|
|
5
|
-
|
|
6
|
-
export default (
|
|
7
|
-
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
8
|
-
<Path d="M2 6c0-1.505.78-3.08 2-4 0 .845.69 2 2 2 1.657 0 3 1.343 3 3 0 .386-.08.752-.212 1.09.74.594 1.476 1.19 2.19 1.81L8.9 11.98c-.62-.716-1.214-1.454-1.807-2.192C6.753 9.92 6.387 10 6 10c-2.21 0-4-1.79-4-4zm12.152 6.848l1.34-1.34c.607.304 1.283.492 2.008.492 2.485 0 4.5-2.015 4.5-4.5 0-.725-.188-1.4-.493-2.007L18 9l-2-2 3.507-3.507C18.9 3.188 18.225 3 17.5 3 15.015 3 13 5.015 13 7.5c0 .725.188 1.4.493 2.007L3 20l2 2 6.848-6.848c1.885 1.928 3.874 3.753 5.977 5.45l1.425 1.148 1.5-1.5-1.15-1.425c-1.695-2.103-3.52-4.092-5.448-5.977z" />
|
|
9
|
-
</SVG>
|
|
10
|
-
);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { SVG, Path } from '@wordpress/primitives';
|
|
5
|
-
|
|
6
|
-
export default (
|
|
7
|
-
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
8
|
-
<Path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z" />
|
|
9
|
-
<Path d="M0 0h24v24H0z" fill="none" />
|
|
10
|
-
</SVG>
|
|
11
|
-
);
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { TouchableWithoutFeedback, View, Platform } from 'react-native';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { __ } from '@wordpress/i18n';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { MediaEdit } from '../media-edit';
|
|
15
|
-
import SvgIconCustomize from './icon-customize';
|
|
16
|
-
import styles from './style.scss';
|
|
17
|
-
import Icon from '../../icon';
|
|
18
|
-
|
|
19
|
-
const accessibilityHint =
|
|
20
|
-
Platform.OS === 'ios'
|
|
21
|
-
? __(
|
|
22
|
-
'Double tap to open Action Sheet to edit, replace, or clear the image'
|
|
23
|
-
)
|
|
24
|
-
: __(
|
|
25
|
-
'Double tap to open Bottom Sheet to edit, replace, or clear the image'
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
const ImageEditingButton = ( {
|
|
29
|
-
onSelectMediaUploadOption,
|
|
30
|
-
openMediaOptions,
|
|
31
|
-
pickerOptions,
|
|
32
|
-
url,
|
|
33
|
-
} ) => {
|
|
34
|
-
return (
|
|
35
|
-
<MediaEdit
|
|
36
|
-
onSelect={ onSelectMediaUploadOption }
|
|
37
|
-
source={ { uri: url } }
|
|
38
|
-
openReplaceMediaOptions={ openMediaOptions }
|
|
39
|
-
render={ ( { open, mediaOptions } ) => (
|
|
40
|
-
<TouchableWithoutFeedback
|
|
41
|
-
accessibilityHint={ accessibilityHint }
|
|
42
|
-
accessibilityLabel={ __( 'Edit image' ) }
|
|
43
|
-
accessibilityRole="button"
|
|
44
|
-
onPress={ open }
|
|
45
|
-
>
|
|
46
|
-
<View style={ styles.editContainer }>
|
|
47
|
-
<View style={ styles.edit }>
|
|
48
|
-
{ mediaOptions() }
|
|
49
|
-
<Icon
|
|
50
|
-
size={ 16 }
|
|
51
|
-
icon={ SvgIconCustomize }
|
|
52
|
-
{ ...styles.iconCustomise }
|
|
53
|
-
/>
|
|
54
|
-
</View>
|
|
55
|
-
</View>
|
|
56
|
-
</TouchableWithoutFeedback>
|
|
57
|
-
) }
|
|
58
|
-
pickerOptions={ pickerOptions }
|
|
59
|
-
/>
|
|
60
|
-
);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export default ImageEditingButton;
|
|
@@ -1,401 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { Image as RNImage, Text, View } from 'react-native';
|
|
5
|
-
import FastImage from 'react-native-fast-image';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import { image, offline } from '@wordpress/icons';
|
|
12
|
-
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
13
|
-
import { useEffect, useState, Platform } from '@wordpress/element';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
import { getImageWithFocalPointStyles } from './utils';
|
|
19
|
-
import styles from './style.scss';
|
|
20
|
-
import SvgIconRetry from './icon-retry';
|
|
21
|
-
import ImageEditingButton from './image-editing-button';
|
|
22
|
-
import Icon from '../../icon';
|
|
23
|
-
|
|
24
|
-
const ICON_TYPE = {
|
|
25
|
-
OFFLINE: 'offline',
|
|
26
|
-
PLACEHOLDER: 'placeholder',
|
|
27
|
-
RETRY: 'retry',
|
|
28
|
-
UPLOAD: 'upload',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const ImageComponent = ( {
|
|
32
|
-
align,
|
|
33
|
-
alt,
|
|
34
|
-
editButton = true,
|
|
35
|
-
focalPoint,
|
|
36
|
-
height: imageHeight,
|
|
37
|
-
highlightSelected = true,
|
|
38
|
-
isSelected,
|
|
39
|
-
shouldUseFastImage,
|
|
40
|
-
isUploadFailed,
|
|
41
|
-
isUploadPaused,
|
|
42
|
-
isUploadInProgress,
|
|
43
|
-
mediaPickerOptions,
|
|
44
|
-
onImageDataLoad,
|
|
45
|
-
onSelectMediaUploadOption,
|
|
46
|
-
openMediaOptions,
|
|
47
|
-
resizeMode,
|
|
48
|
-
retryMessage,
|
|
49
|
-
retryIcon,
|
|
50
|
-
url,
|
|
51
|
-
shapeStyle,
|
|
52
|
-
style,
|
|
53
|
-
width: imageWidth,
|
|
54
|
-
} ) => {
|
|
55
|
-
const [ imageData, setImageData ] = useState( null );
|
|
56
|
-
const [ containerSize, setContainerSize ] = useState( null );
|
|
57
|
-
const [ localURL, setLocalURL ] = useState( null );
|
|
58
|
-
const [ networkURL, setNetworkURL ] = useState( null );
|
|
59
|
-
const [ networkImageLoaded, setNetworkImageLoaded ] = useState( false );
|
|
60
|
-
|
|
61
|
-
// Disabled for Android due to https://github.com/WordPress/gutenberg/issues/43149
|
|
62
|
-
const Image =
|
|
63
|
-
! shouldUseFastImage || Platform.isAndroid ? RNImage : FastImage;
|
|
64
|
-
const imageResizeMode =
|
|
65
|
-
! shouldUseFastImage || Platform.isAndroid
|
|
66
|
-
? resizeMode
|
|
67
|
-
: FastImage.resizeMode[ resizeMode ];
|
|
68
|
-
|
|
69
|
-
useEffect( () => {
|
|
70
|
-
let isCurrent = true;
|
|
71
|
-
if ( url ) {
|
|
72
|
-
RNImage.getSize( url, ( imgWidth, imgHeight ) => {
|
|
73
|
-
if ( ! isCurrent ) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const metaData = {
|
|
77
|
-
aspectRatio: imgWidth / imgHeight,
|
|
78
|
-
width: imgWidth,
|
|
79
|
-
height: imgHeight,
|
|
80
|
-
};
|
|
81
|
-
setImageData( metaData );
|
|
82
|
-
if ( onImageDataLoad ) {
|
|
83
|
-
onImageDataLoad( metaData );
|
|
84
|
-
}
|
|
85
|
-
} );
|
|
86
|
-
|
|
87
|
-
if ( url.startsWith( 'file:///' ) ) {
|
|
88
|
-
setLocalURL( url );
|
|
89
|
-
setNetworkURL( null );
|
|
90
|
-
setNetworkImageLoaded( false );
|
|
91
|
-
} else if ( url.startsWith( 'https://' ) ) {
|
|
92
|
-
if ( Platform.isIOS ) {
|
|
93
|
-
setNetworkURL( url );
|
|
94
|
-
} else if ( Platform.isAndroid ) {
|
|
95
|
-
RNImage.prefetch( url ).then(
|
|
96
|
-
() => {
|
|
97
|
-
if ( ! isCurrent ) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
setNetworkURL( url );
|
|
101
|
-
setNetworkImageLoaded( true );
|
|
102
|
-
},
|
|
103
|
-
() => {
|
|
104
|
-
// This callback is called when the image fails to load,
|
|
105
|
-
// but these events are handled by `isUploadFailed`
|
|
106
|
-
// and `isUploadPaused` events instead.
|
|
107
|
-
//
|
|
108
|
-
// Ignoring the error event will persist the local image URI.
|
|
109
|
-
}
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return () => ( isCurrent = false );
|
|
115
|
-
// See https://github.com/WordPress/gutenberg/pull/41166
|
|
116
|
-
}, [ url ] );
|
|
117
|
-
|
|
118
|
-
const onContainerLayout = ( event ) => {
|
|
119
|
-
const { height, width } = event.nativeEvent.layout;
|
|
120
|
-
|
|
121
|
-
if (
|
|
122
|
-
width !== 0 &&
|
|
123
|
-
height !== 0 &&
|
|
124
|
-
( containerSize?.width !== width ||
|
|
125
|
-
containerSize?.height !== height )
|
|
126
|
-
) {
|
|
127
|
-
setContainerSize( { width, height } );
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const getIcon = ( iconType ) => {
|
|
132
|
-
let icon;
|
|
133
|
-
let iconStyle;
|
|
134
|
-
switch ( iconType ) {
|
|
135
|
-
case ICON_TYPE.RETRY:
|
|
136
|
-
icon = retryIcon || SvgIconRetry;
|
|
137
|
-
iconStyle = iconRetryStyles;
|
|
138
|
-
break;
|
|
139
|
-
case ICON_TYPE.OFFLINE:
|
|
140
|
-
icon = offline;
|
|
141
|
-
iconStyle = iconOfflineStyles;
|
|
142
|
-
break;
|
|
143
|
-
case ICON_TYPE.PLACEHOLDER:
|
|
144
|
-
icon = image;
|
|
145
|
-
iconStyle = iconPlaceholderStyles;
|
|
146
|
-
break;
|
|
147
|
-
case ICON_TYPE.UPLOAD:
|
|
148
|
-
icon = image;
|
|
149
|
-
iconStyle = iconUploadStyles;
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
return <Icon icon={ icon } { ...iconStyle } />;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
const iconPlaceholderStyles = usePreferredColorSchemeStyle(
|
|
156
|
-
styles.iconPlaceholder,
|
|
157
|
-
styles.iconPlaceholderDark
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
const iconUploadStyles = usePreferredColorSchemeStyle(
|
|
161
|
-
styles.iconUpload,
|
|
162
|
-
styles.iconUploadDark
|
|
163
|
-
);
|
|
164
|
-
|
|
165
|
-
const iconOfflineStyles = usePreferredColorSchemeStyle(
|
|
166
|
-
styles.iconOffline,
|
|
167
|
-
styles.iconOfflineDark
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
const retryIconStyles = usePreferredColorSchemeStyle(
|
|
171
|
-
styles.retryIcon,
|
|
172
|
-
styles.retryIconDark
|
|
173
|
-
);
|
|
174
|
-
|
|
175
|
-
const iconRetryStyles = usePreferredColorSchemeStyle(
|
|
176
|
-
styles.iconRetry,
|
|
177
|
-
styles.iconRetryDark
|
|
178
|
-
);
|
|
179
|
-
|
|
180
|
-
const retryContainerStyles = usePreferredColorSchemeStyle(
|
|
181
|
-
styles.retryContainer,
|
|
182
|
-
styles.retryContainerDark
|
|
183
|
-
);
|
|
184
|
-
|
|
185
|
-
const uploadFailedTextStyles = usePreferredColorSchemeStyle(
|
|
186
|
-
styles.uploadFailedText,
|
|
187
|
-
styles.uploadFailedTextDark
|
|
188
|
-
);
|
|
189
|
-
|
|
190
|
-
const placeholderStyles = [
|
|
191
|
-
usePreferredColorSchemeStyle(
|
|
192
|
-
styles.imageContainerUpload,
|
|
193
|
-
styles.imageContainerUploadDark
|
|
194
|
-
),
|
|
195
|
-
focalPoint && styles.imageContainerUploadWithFocalpoint,
|
|
196
|
-
imageHeight && { height: imageHeight },
|
|
197
|
-
];
|
|
198
|
-
|
|
199
|
-
const customWidth =
|
|
200
|
-
imageData?.width < containerSize?.width
|
|
201
|
-
? imageData?.width
|
|
202
|
-
: styles.wide?.width;
|
|
203
|
-
|
|
204
|
-
const imageContainerStyles = [
|
|
205
|
-
styles.imageContent,
|
|
206
|
-
{
|
|
207
|
-
width:
|
|
208
|
-
imageWidth === styles.wide?.width ||
|
|
209
|
-
( imageData &&
|
|
210
|
-
imageWidth > 0 &&
|
|
211
|
-
imageWidth < containerSize?.width )
|
|
212
|
-
? imageWidth
|
|
213
|
-
: customWidth,
|
|
214
|
-
},
|
|
215
|
-
resizeMode && { width: styles.wide?.width },
|
|
216
|
-
focalPoint && styles.focalPointContainer,
|
|
217
|
-
];
|
|
218
|
-
|
|
219
|
-
const imageStyles = [
|
|
220
|
-
{
|
|
221
|
-
height: containerSize?.height,
|
|
222
|
-
},
|
|
223
|
-
! resizeMode && {
|
|
224
|
-
aspectRatio: imageData?.aspectRatio,
|
|
225
|
-
},
|
|
226
|
-
focalPoint && styles.focalPoint,
|
|
227
|
-
focalPoint &&
|
|
228
|
-
getImageWithFocalPointStyles(
|
|
229
|
-
focalPoint,
|
|
230
|
-
containerSize,
|
|
231
|
-
imageData
|
|
232
|
-
),
|
|
233
|
-
! focalPoint &&
|
|
234
|
-
imageData &&
|
|
235
|
-
containerSize && {
|
|
236
|
-
height:
|
|
237
|
-
imageData?.width > containerSize?.width && ! imageWidth
|
|
238
|
-
? containerSize?.width / imageData?.aspectRatio
|
|
239
|
-
: undefined,
|
|
240
|
-
},
|
|
241
|
-
imageHeight && { height: imageHeight },
|
|
242
|
-
shapeStyle,
|
|
243
|
-
];
|
|
244
|
-
|
|
245
|
-
// On iOS, add 1 to height to account for the 1px non-visible image
|
|
246
|
-
// that is used to determine when the network image has loaded
|
|
247
|
-
// We also must verify that it is not NaN, as it can be NaN when the image is loading.
|
|
248
|
-
// This is not necessary on Android as the non-visible image is not used.
|
|
249
|
-
let calculatedSelectedHeight;
|
|
250
|
-
if ( Platform.isIOS ) {
|
|
251
|
-
calculatedSelectedHeight =
|
|
252
|
-
containerSize && ! isNaN( containerSize.height )
|
|
253
|
-
? containerSize.height + 1
|
|
254
|
-
: 0;
|
|
255
|
-
} else {
|
|
256
|
-
calculatedSelectedHeight = containerSize?.height;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
const imageSelectedStyles = [
|
|
260
|
-
usePreferredColorSchemeStyle(
|
|
261
|
-
styles.imageBorder,
|
|
262
|
-
styles.imageBorderDark
|
|
263
|
-
),
|
|
264
|
-
{
|
|
265
|
-
height: calculatedSelectedHeight,
|
|
266
|
-
},
|
|
267
|
-
];
|
|
268
|
-
|
|
269
|
-
return (
|
|
270
|
-
<View
|
|
271
|
-
style={ [
|
|
272
|
-
styles.container,
|
|
273
|
-
// Only set alignItems if an image exists because alignItems causes the placeholder
|
|
274
|
-
// to disappear when an aligned image can't be downloaded
|
|
275
|
-
// https://github.com/wordpress-mobile/gutenberg-mobile/issues/1592
|
|
276
|
-
imageData && align && { alignItems: align },
|
|
277
|
-
style,
|
|
278
|
-
] }
|
|
279
|
-
onLayout={ onContainerLayout }
|
|
280
|
-
>
|
|
281
|
-
<View
|
|
282
|
-
accessible
|
|
283
|
-
disabled={ ! isSelected }
|
|
284
|
-
accessibilityLabel={ alt }
|
|
285
|
-
accessibilityHint={ __( 'Double tap to view larger.' ) }
|
|
286
|
-
accessibilityRole="imagebutton"
|
|
287
|
-
key={ url }
|
|
288
|
-
style={ imageContainerStyles }
|
|
289
|
-
>
|
|
290
|
-
{ isSelected && highlightSelected && (
|
|
291
|
-
<View style={ imageSelectedStyles } />
|
|
292
|
-
) }
|
|
293
|
-
|
|
294
|
-
{ ! imageData ? (
|
|
295
|
-
<View style={ placeholderStyles }>
|
|
296
|
-
<View style={ styles.imageUploadingIconContainer }>
|
|
297
|
-
{ getIcon( ICON_TYPE.UPLOAD ) }
|
|
298
|
-
</View>
|
|
299
|
-
</View>
|
|
300
|
-
) : (
|
|
301
|
-
<View style={ focalPoint && styles.focalPointContent }>
|
|
302
|
-
{ Platform.isAndroid && (
|
|
303
|
-
<>
|
|
304
|
-
{ networkImageLoaded && networkURL && (
|
|
305
|
-
<Image
|
|
306
|
-
style={ imageStyles }
|
|
307
|
-
fadeDuration={ 0 }
|
|
308
|
-
source={ { uri: networkURL } }
|
|
309
|
-
{ ...( ! focalPoint && {
|
|
310
|
-
resizeMethod: 'scale',
|
|
311
|
-
} ) }
|
|
312
|
-
resizeMode={ imageResizeMode }
|
|
313
|
-
testID={ `network-image-${ url }` }
|
|
314
|
-
/>
|
|
315
|
-
) }
|
|
316
|
-
{ ! networkImageLoaded && ! networkURL && (
|
|
317
|
-
<Image
|
|
318
|
-
style={ imageStyles }
|
|
319
|
-
fadeDuration={ 0 }
|
|
320
|
-
source={ { uri: localURL } }
|
|
321
|
-
{ ...( ! focalPoint && {
|
|
322
|
-
resizeMethod: 'scale',
|
|
323
|
-
} ) }
|
|
324
|
-
resizeMode={ imageResizeMode }
|
|
325
|
-
/>
|
|
326
|
-
) }
|
|
327
|
-
</>
|
|
328
|
-
) }
|
|
329
|
-
{ Platform.isIOS && (
|
|
330
|
-
<>
|
|
331
|
-
<Image
|
|
332
|
-
style={ imageStyles }
|
|
333
|
-
source={ {
|
|
334
|
-
uri:
|
|
335
|
-
networkURL && networkImageLoaded
|
|
336
|
-
? networkURL
|
|
337
|
-
: localURL || url,
|
|
338
|
-
} }
|
|
339
|
-
{ ...( ! focalPoint && {
|
|
340
|
-
resizeMethod: 'scale',
|
|
341
|
-
} ) }
|
|
342
|
-
resizeMode={ imageResizeMode }
|
|
343
|
-
testID={ `network-image-${
|
|
344
|
-
networkURL && networkImageLoaded
|
|
345
|
-
? networkURL
|
|
346
|
-
: localURL || url
|
|
347
|
-
}` }
|
|
348
|
-
/>
|
|
349
|
-
<Image
|
|
350
|
-
source={ { uri: networkURL } }
|
|
351
|
-
style={ styles.nonVisibleImage }
|
|
352
|
-
onLoad={ () => {
|
|
353
|
-
setNetworkImageLoaded( true );
|
|
354
|
-
} }
|
|
355
|
-
/>
|
|
356
|
-
</>
|
|
357
|
-
) }
|
|
358
|
-
</View>
|
|
359
|
-
) }
|
|
360
|
-
|
|
361
|
-
{ ( isUploadFailed || isUploadPaused ) && retryMessage && (
|
|
362
|
-
<View
|
|
363
|
-
style={ [
|
|
364
|
-
styles.imageContainer,
|
|
365
|
-
retryContainerStyles,
|
|
366
|
-
] }
|
|
367
|
-
>
|
|
368
|
-
<View
|
|
369
|
-
style={ [
|
|
370
|
-
retryIconStyles,
|
|
371
|
-
retryIcon && styles.customRetryIcon,
|
|
372
|
-
] }
|
|
373
|
-
>
|
|
374
|
-
{ isUploadPaused
|
|
375
|
-
? getIcon( ICON_TYPE.OFFLINE )
|
|
376
|
-
: getIcon( ICON_TYPE.RETRY ) }
|
|
377
|
-
</View>
|
|
378
|
-
<Text style={ uploadFailedTextStyles }>
|
|
379
|
-
{ retryMessage }
|
|
380
|
-
</Text>
|
|
381
|
-
</View>
|
|
382
|
-
) }
|
|
383
|
-
</View>
|
|
384
|
-
|
|
385
|
-
{ editButton && isSelected && ! isUploadInProgress && (
|
|
386
|
-
<ImageEditingButton
|
|
387
|
-
onSelectMediaUploadOption={ onSelectMediaUploadOption }
|
|
388
|
-
openMediaOptions={ openMediaOptions }
|
|
389
|
-
url={
|
|
390
|
-
! ( isUploadFailed || isUploadPaused ) &&
|
|
391
|
-
imageData &&
|
|
392
|
-
url
|
|
393
|
-
}
|
|
394
|
-
pickerOptions={ mediaPickerOptions }
|
|
395
|
-
/>
|
|
396
|
-
) }
|
|
397
|
-
</View>
|
|
398
|
-
);
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
export default ImageComponent;
|