@wordpress/components 29.2.0 → 29.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/build/alignment-matrix-control/icon.js +0 -1
- package/build/alignment-matrix-control/icon.js.map +1 -1
- package/build/alignment-matrix-control/index.js +0 -1
- package/build/alignment-matrix-control/index.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +0 -1
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.native.js +0 -1
- package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build/autocomplete/get-default-use-items.js +0 -1
- package/build/autocomplete/get-default-use-items.js.map +1 -1
- package/build/autocomplete/index.js +0 -1
- package/build/autocomplete/index.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/component.js +8 -15
- package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build/border-box-control/utils.js +0 -1
- package/build/border-box-control/utils.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js +0 -1
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/border-control/border-control-style-picker/component.js +0 -1
- package/build/border-control/border-control-style-picker/component.js.map +1 -1
- package/build/box-control/index.js +6 -1
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/input-control.js +0 -1
- package/build/box-control/input-control.js.map +1 -1
- package/build/box-control/linked-button.js +7 -11
- package/build/box-control/linked-button.js.map +1 -1
- package/build/box-control/types.js.map +1 -1
- package/build/box-control/utils.js +0 -1
- package/build/box-control/utils.js.map +1 -1
- package/build/button/index.native.js +0 -1
- package/build/button/index.native.js.map +1 -1
- package/build/color-indicator/index.native.js +0 -1
- package/build/color-indicator/index.native.js.map +1 -1
- package/build/color-palette/index.js +0 -1
- package/build/color-palette/index.js.map +1 -1
- package/build/color-palette/index.native.js +0 -1
- package/build/color-palette/index.native.js.map +1 -1
- package/build/color-palette/utils.js +0 -1
- package/build/color-palette/utils.js.map +1 -1
- package/build/combobox-control/index.js +4 -3
- package/build/combobox-control/index.js.map +1 -1
- package/build/combobox-control/types.js.map +1 -1
- package/build/composite/legacy/index.js +0 -1
- package/build/composite/legacy/index.js.map +1 -1
- package/build/context/context-connect.js +0 -1
- package/build/context/context-connect.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js +0 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/index.js +0 -1
- package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/utils.js +0 -1
- package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
- package/build/custom-gradient-picker/index.js +0 -1
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/custom-gradient-picker/serializer.js +0 -1
- package/build/custom-gradient-picker/serializer.js.map +1 -1
- package/build/custom-gradient-picker/utils.js +0 -1
- package/build/custom-gradient-picker/utils.js.map +1 -1
- package/build/custom-select-control/index.js +0 -1
- package/build/custom-select-control/index.js.map +1 -1
- package/build/dashicon/index.js +0 -1
- package/build/dashicon/index.js.map +1 -1
- package/build/date-time/date/index.js +0 -1
- package/build/date-time/date/index.js.map +1 -1
- package/build/date-time/date/use-lilius/index.js +0 -1
- package/build/date-time/date/use-lilius/index.js.map +1 -1
- package/build/date-time/time/index.js +0 -1
- package/build/date-time/time/index.js.map +1 -1
- package/build/dimension-control/index.js +0 -1
- package/build/dimension-control/index.js.map +1 -1
- package/build/dimension-control/sizes.js +0 -1
- package/build/dimension-control/sizes.js.map +1 -1
- package/build/draggable/index.js +0 -1
- package/build/draggable/index.js.map +1 -1
- package/build/draggable/index.native.js +0 -1
- package/build/draggable/index.native.js.map +1 -1
- package/build/dropdown-menu/index.js +0 -1
- package/build/dropdown-menu/index.js.map +1 -1
- package/build/dropdown-menu/index.native.js +0 -1
- package/build/dropdown-menu/index.native.js.map +1 -1
- package/build/duotone-picker/color-list-picker/index.js +0 -1
- package/build/duotone-picker/color-list-picker/index.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +0 -1
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/duotone-picker/utils.js +0 -1
- package/build/duotone-picker/utils.js.map +1 -1
- package/build/external-link/index.js +0 -1
- package/build/external-link/index.js.map +1 -1
- package/build/font-size-picker/font-size-picker-select.js +4 -15
- package/build/font-size-picker/font-size-picker-select.js.map +1 -1
- package/build/font-size-picker/font-size-picker-toggle-group.js +0 -1
- package/build/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
- package/build/font-size-picker/index.js +0 -1
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/index.native.js +0 -1
- package/build/font-size-picker/index.native.js.map +1 -1
- package/build/font-size-picker/utils.js +0 -1
- package/build/font-size-picker/utils.js.map +1 -1
- package/build/form-token-field/index.js +0 -1
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/suggestions-list.js +0 -1
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/gradient-picker/index.js +0 -1
- package/build/gradient-picker/index.js.map +1 -1
- package/build/guide/index.js +0 -1
- package/build/guide/index.js.map +1 -1
- package/build/guide/page-control.js +0 -1
- package/build/guide/page-control.js.map +1 -1
- package/build/h-stack/hook.js +0 -1
- package/build/h-stack/hook.js.map +1 -1
- package/build/higher-order/navigate-regions/index.js +0 -1
- package/build/higher-order/navigate-regions/index.js.map +1 -1
- package/build/higher-order/with-fallback-styles/index.js +0 -1
- package/build/higher-order/with-fallback-styles/index.js.map +1 -1
- package/build/higher-order/with-filters/index.js +0 -1
- package/build/higher-order/with-filters/index.js.map +1 -1
- package/build/higher-order/with-notices/index.js +0 -1
- package/build/higher-order/with-notices/index.js.map +1 -1
- package/build/keyboard-shortcuts/index.js +0 -1
- package/build/keyboard-shortcuts/index.js.map +1 -1
- package/build/menu-items-choice/index.js +0 -1
- package/build/menu-items-choice/index.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +0 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -1
- package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
- package/build/mobile/bottom-sheet/picker-cell.native.js +0 -1
- package/build/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet-select-control/index.native.js +0 -1
- package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build/mobile/color-settings/palette.screen.native.js +0 -1
- package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build/mobile/gradient/index.native.js +0 -1
- package/build/mobile/gradient/index.native.js.map +1 -1
- package/build/mobile/media-edit/index.native.js +0 -1
- package/build/mobile/media-edit/index.native.js.map +1 -1
- package/build/mobile/picker/index.android.js +0 -1
- package/build/mobile/picker/index.android.js.map +1 -1
- package/build/mobile/picker/index.ios.js +0 -1
- package/build/mobile/picker/index.ios.js.map +1 -1
- package/build/mobile/segmented-control/index.native.js +0 -1
- package/build/mobile/segmented-control/index.native.js.map +1 -1
- package/build/mobile/utils/get-px-from-css-unit.native.js +0 -1
- package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build/navigable-container/container.js +0 -1
- package/build/navigable-container/container.js.map +1 -1
- package/build/navigation/group/index.js +0 -1
- package/build/navigation/group/index.js.map +1 -1
- package/build/navigation/menu/menu-title-search.js +0 -1
- package/build/navigation/menu/menu-title-search.js.map +1 -1
- package/build/navigation/menu/search-no-results-found.js +0 -1
- package/build/navigation/menu/search-no-results-found.js.map +1 -1
- package/build/navigator/navigator/component.js +0 -1
- package/build/navigator/navigator/component.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +0 -1
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/navigator/utils/router.js +0 -1
- package/build/navigator/utils/router.js.map +1 -1
- package/build/notice/index.js +0 -1
- package/build/notice/index.js.map +1 -1
- package/build/notice/list.js +0 -1
- package/build/notice/list.js.map +1 -1
- package/build/notice/list.native.js +0 -1
- package/build/notice/list.native.js.map +1 -1
- package/build/palette-edit/index.js +0 -1
- package/build/palette-edit/index.js.map +1 -1
- package/build/panel/actions.native.js +0 -1
- package/build/panel/actions.native.js.map +1 -1
- package/build/query-controls/index.js +0 -1
- package/build/query-controls/index.js.map +1 -1
- package/build/query-controls/terms.js +0 -1
- package/build/query-controls/terms.js.map +1 -1
- package/build/radio-control/index.js +0 -1
- package/build/radio-control/index.js.map +1 -1
- package/build/radio-control/index.native.js +0 -1
- package/build/radio-control/index.native.js.map +1 -1
- package/build/range-control/rail.js +0 -1
- package/build/range-control/rail.js.map +1 -1
- package/build/resizable-box/index.js +0 -1
- package/build/resizable-box/index.js.map +1 -1
- package/build/sandbox/index.js +0 -1
- package/build/sandbox/index.js.map +1 -1
- package/build/sandbox/index.native.js +0 -1
- package/build/sandbox/index.native.js.map +1 -1
- package/build/search-control/index.native.js +0 -1
- package/build/search-control/index.native.js.map +1 -1
- package/build/select-control/index.js +0 -1
- package/build/select-control/index.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +0 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build/slot-fill/provider.js +0 -1
- package/build/slot-fill/provider.js.map +1 -1
- package/build/slot-fill/slot.js +0 -1
- package/build/slot-fill/slot.js.map +1 -1
- package/build/snackbar/index.js +0 -1
- package/build/snackbar/index.js.map +1 -1
- package/build/snackbar/list.js +0 -1
- package/build/snackbar/list.js.map +1 -1
- package/build/tab-panel/index.js +0 -1
- package/build/tab-panel/index.js.map +1 -1
- package/build/tabs/index.js +0 -1
- package/build/tabs/index.js.map +1 -1
- package/build/text/utils.js +0 -1
- package/build/text/utils.js.map +1 -1
- package/build/theme/color-algorithms.js +0 -1
- package/build/theme/color-algorithms.js.map +1 -1
- package/build/toolbar/toolbar-group/index.js +0 -1
- package/build/toolbar/toolbar-group/index.js.map +1 -1
- package/build/tools-panel/tools-panel/hook.js +0 -1
- package/build/tools-panel/tools-panel/hook.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js +0 -1
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/tree-grid/index.js +0 -1
- package/build/tree-grid/index.js.map +1 -1
- package/build/tree-select/index.js +0 -1
- package/build/tree-select/index.js.map +1 -1
- package/build/unit-control/index.js +0 -1
- package/build/unit-control/index.js.map +1 -1
- package/build/unit-control/index.native.js +0 -1
- package/build/unit-control/index.native.js.map +1 -1
- package/build/unit-control/unit-select-control.js +0 -1
- package/build/unit-control/unit-select-control.js.map +1 -1
- package/build/unit-control/utils.js +0 -1
- package/build/unit-control/utils.js.map +1 -1
- package/build/utils/get-valid-children.js +0 -1
- package/build/utils/get-valid-children.js.map +1 -1
- package/build/utils/hooks/use-animated-offset-rect.js +0 -1
- package/build/utils/hooks/use-animated-offset-rect.js.map +1 -1
- package/build/utils/hooks/use-cx.js +0 -1
- package/build/utils/hooks/use-cx.js.map +1 -1
- package/build/utils/math.js +0 -1
- package/build/utils/math.js.map +1 -1
- package/build/utils/rtl.js +0 -1
- package/build/utils/rtl.js.map +1 -1
- package/build/utils/values.js +0 -1
- package/build/utils/values.js.map +1 -1
- package/build/z-stack/component.js +0 -1
- package/build/z-stack/component.js.map +1 -1
- package/build-module/alignment-matrix-control/icon.js +0 -1
- package/build-module/alignment-matrix-control/icon.js.map +1 -1
- package/build-module/alignment-matrix-control/index.js +0 -1
- package/build-module/alignment-matrix-control/index.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +0 -1
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.native.js +0 -1
- package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build-module/autocomplete/get-default-use-items.js +0 -1
- package/build-module/autocomplete/get-default-use-items.js.map +1 -1
- package/build-module/autocomplete/index.js +0 -1
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/component.js +8 -15
- package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build-module/border-box-control/utils.js +0 -1
- package/build-module/border-box-control/utils.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +0 -1
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/border-control/border-control-style-picker/component.js +0 -1
- package/build-module/border-control/border-control-style-picker/component.js.map +1 -1
- package/build-module/box-control/index.js +6 -1
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/input-control.js +0 -1
- package/build-module/box-control/input-control.js.map +1 -1
- package/build-module/box-control/linked-button.js +7 -11
- package/build-module/box-control/linked-button.js.map +1 -1
- package/build-module/box-control/types.js.map +1 -1
- package/build-module/box-control/utils.js +0 -1
- package/build-module/box-control/utils.js.map +1 -1
- package/build-module/button/index.native.js +0 -1
- package/build-module/button/index.native.js.map +1 -1
- package/build-module/color-indicator/index.native.js +0 -1
- package/build-module/color-indicator/index.native.js.map +1 -1
- package/build-module/color-palette/index.js +0 -1
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-palette/index.native.js +0 -1
- package/build-module/color-palette/index.native.js.map +1 -1
- package/build-module/color-palette/utils.js +0 -1
- package/build-module/color-palette/utils.js.map +1 -1
- package/build-module/combobox-control/index.js +4 -3
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/combobox-control/types.js.map +1 -1
- package/build-module/composite/legacy/index.js +0 -1
- package/build-module/composite/legacy/index.js.map +1 -1
- package/build-module/context/context-connect.js +0 -1
- package/build-module/context/context-connect.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js +0 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/index.js +0 -1
- package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/utils.js +0 -1
- package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
- package/build-module/custom-gradient-picker/index.js +0 -1
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/custom-gradient-picker/serializer.js +0 -1
- package/build-module/custom-gradient-picker/serializer.js.map +1 -1
- package/build-module/custom-gradient-picker/utils.js +0 -1
- package/build-module/custom-gradient-picker/utils.js.map +1 -1
- package/build-module/custom-select-control/index.js +0 -1
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/dashicon/index.js +0 -1
- package/build-module/dashicon/index.js.map +1 -1
- package/build-module/date-time/date/index.js +0 -1
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/date-time/date/use-lilius/index.js +0 -1
- package/build-module/date-time/date/use-lilius/index.js.map +1 -1
- package/build-module/date-time/time/index.js +0 -1
- package/build-module/date-time/time/index.js.map +1 -1
- package/build-module/dimension-control/index.js +0 -1
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/dimension-control/sizes.js +0 -1
- package/build-module/dimension-control/sizes.js.map +1 -1
- package/build-module/draggable/index.js +0 -1
- package/build-module/draggable/index.js.map +1 -1
- package/build-module/draggable/index.native.js +0 -1
- package/build-module/draggable/index.native.js.map +1 -1
- package/build-module/dropdown-menu/index.js +0 -1
- package/build-module/dropdown-menu/index.js.map +1 -1
- package/build-module/dropdown-menu/index.native.js +0 -1
- package/build-module/dropdown-menu/index.native.js.map +1 -1
- package/build-module/duotone-picker/color-list-picker/index.js +0 -1
- package/build-module/duotone-picker/color-list-picker/index.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +0 -1
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/duotone-picker/utils.js +0 -1
- package/build-module/duotone-picker/utils.js.map +1 -1
- package/build-module/external-link/index.js +0 -1
- package/build-module/external-link/index.js.map +1 -1
- package/build-module/font-size-picker/font-size-picker-select.js +4 -15
- package/build-module/font-size-picker/font-size-picker-select.js.map +1 -1
- package/build-module/font-size-picker/font-size-picker-toggle-group.js +0 -1
- package/build-module/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
- package/build-module/font-size-picker/index.js +0 -1
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/index.native.js +0 -1
- package/build-module/font-size-picker/index.native.js.map +1 -1
- package/build-module/font-size-picker/utils.js +0 -1
- package/build-module/font-size-picker/utils.js.map +1 -1
- package/build-module/form-token-field/index.js +0 -1
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/suggestions-list.js +0 -1
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/gradient-picker/index.js +0 -1
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/guide/index.js +0 -1
- package/build-module/guide/index.js.map +1 -1
- package/build-module/guide/page-control.js +0 -1
- package/build-module/guide/page-control.js.map +1 -1
- package/build-module/h-stack/hook.js +0 -1
- package/build-module/h-stack/hook.js.map +1 -1
- package/build-module/higher-order/navigate-regions/index.js +0 -1
- package/build-module/higher-order/navigate-regions/index.js.map +1 -1
- package/build-module/higher-order/with-fallback-styles/index.js +0 -1
- package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
- package/build-module/higher-order/with-filters/index.js +0 -1
- package/build-module/higher-order/with-filters/index.js.map +1 -1
- package/build-module/higher-order/with-notices/index.js +0 -1
- package/build-module/higher-order/with-notices/index.js.map +1 -1
- package/build-module/keyboard-shortcuts/index.js +0 -1
- package/build-module/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/menu-items-choice/index.js +0 -1
- package/build-module/menu-items-choice/index.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +0 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -1
- package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/picker-cell.native.js +0 -1
- package/build-module/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet-select-control/index.native.js +0 -1
- package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build-module/mobile/color-settings/palette.screen.native.js +0 -1
- package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build-module/mobile/gradient/index.native.js +0 -1
- package/build-module/mobile/gradient/index.native.js.map +1 -1
- package/build-module/mobile/media-edit/index.native.js +0 -1
- package/build-module/mobile/media-edit/index.native.js.map +1 -1
- package/build-module/mobile/picker/index.android.js +0 -1
- package/build-module/mobile/picker/index.android.js.map +1 -1
- package/build-module/mobile/picker/index.ios.js +0 -1
- package/build-module/mobile/picker/index.ios.js.map +1 -1
- package/build-module/mobile/segmented-control/index.native.js +0 -1
- package/build-module/mobile/segmented-control/index.native.js.map +1 -1
- package/build-module/mobile/utils/get-px-from-css-unit.native.js +0 -1
- package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build-module/navigable-container/container.js +0 -1
- package/build-module/navigable-container/container.js.map +1 -1
- package/build-module/navigation/group/index.js +0 -1
- package/build-module/navigation/group/index.js.map +1 -1
- package/build-module/navigation/menu/menu-title-search.js +0 -1
- package/build-module/navigation/menu/menu-title-search.js.map +1 -1
- package/build-module/navigation/menu/search-no-results-found.js +0 -1
- package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
- package/build-module/navigator/navigator/component.js +0 -1
- package/build-module/navigator/navigator/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +0 -1
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/navigator/utils/router.js +0 -1
- package/build-module/navigator/utils/router.js.map +1 -1
- package/build-module/notice/index.js +0 -1
- package/build-module/notice/index.js.map +1 -1
- package/build-module/notice/list.js +0 -1
- package/build-module/notice/list.js.map +1 -1
- package/build-module/notice/list.native.js +0 -1
- package/build-module/notice/list.native.js.map +1 -1
- package/build-module/palette-edit/index.js +0 -1
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/panel/actions.native.js +0 -1
- package/build-module/panel/actions.native.js.map +1 -1
- package/build-module/query-controls/index.js +0 -1
- package/build-module/query-controls/index.js.map +1 -1
- package/build-module/query-controls/terms.js +0 -1
- package/build-module/query-controls/terms.js.map +1 -1
- package/build-module/radio-control/index.js +0 -1
- package/build-module/radio-control/index.js.map +1 -1
- package/build-module/radio-control/index.native.js +0 -1
- package/build-module/radio-control/index.native.js.map +1 -1
- package/build-module/range-control/rail.js +0 -1
- package/build-module/range-control/rail.js.map +1 -1
- package/build-module/resizable-box/index.js +0 -1
- package/build-module/resizable-box/index.js.map +1 -1
- package/build-module/sandbox/index.js +0 -1
- package/build-module/sandbox/index.js.map +1 -1
- package/build-module/sandbox/index.native.js +0 -1
- package/build-module/sandbox/index.native.js.map +1 -1
- package/build-module/search-control/index.native.js +0 -1
- package/build-module/search-control/index.native.js.map +1 -1
- package/build-module/select-control/index.js +0 -1
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +0 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build-module/slot-fill/provider.js +0 -1
- package/build-module/slot-fill/provider.js.map +1 -1
- package/build-module/slot-fill/slot.js +0 -1
- package/build-module/slot-fill/slot.js.map +1 -1
- package/build-module/snackbar/index.js +0 -1
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/snackbar/list.js +0 -1
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/tab-panel/index.js +0 -1
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/tabs/index.js +0 -1
- package/build-module/tabs/index.js.map +1 -1
- package/build-module/text/utils.js +0 -1
- package/build-module/text/utils.js.map +1 -1
- package/build-module/theme/color-algorithms.js +0 -1
- package/build-module/theme/color-algorithms.js.map +1 -1
- package/build-module/toolbar/toolbar-group/index.js +0 -1
- package/build-module/toolbar/toolbar-group/index.js.map +1 -1
- package/build-module/tools-panel/tools-panel/hook.js +0 -1
- package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +0 -1
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/tree-grid/index.js +0 -1
- package/build-module/tree-grid/index.js.map +1 -1
- package/build-module/tree-select/index.js +0 -1
- package/build-module/tree-select/index.js.map +1 -1
- package/build-module/unit-control/index.js +0 -1
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/unit-control/index.native.js +0 -1
- package/build-module/unit-control/index.native.js.map +1 -1
- package/build-module/unit-control/unit-select-control.js +0 -1
- package/build-module/unit-control/unit-select-control.js.map +1 -1
- package/build-module/unit-control/utils.js +0 -1
- package/build-module/unit-control/utils.js.map +1 -1
- package/build-module/utils/get-valid-children.js +0 -1
- package/build-module/utils/get-valid-children.js.map +1 -1
- package/build-module/utils/hooks/use-animated-offset-rect.js +0 -1
- package/build-module/utils/hooks/use-animated-offset-rect.js.map +1 -1
- package/build-module/utils/hooks/use-cx.js +0 -1
- package/build-module/utils/hooks/use-cx.js.map +1 -1
- package/build-module/utils/math.js +0 -1
- package/build-module/utils/math.js.map +1 -1
- package/build-module/utils/rtl.js +0 -1
- package/build-module/utils/rtl.js.map +1 -1
- package/build-module/utils/values.js +0 -1
- package/build-module/utils/values.js.map +1 -1
- package/build-module/z-stack/component.js +0 -1
- package/build-module/z-stack/component.js.map +1 -1
- package/build-style/style-rtl.css +3 -0
- package/build-style/style.css +3 -0
- package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
- package/build-types/box-control/index.d.ts.map +1 -1
- package/build-types/box-control/linked-button.d.ts.map +1 -1
- package/build-types/box-control/stories/index.story.d.ts +7 -2331
- package/build-types/box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/box-control/types.d.ts +15 -3
- package/build-types/box-control/types.d.ts.map +1 -1
- package/build-types/combobox-control/index.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.story.d.ts +4 -0
- package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/combobox-control/types.d.ts +7 -0
- package/build-types/combobox-control/types.d.ts.map +1 -1
- package/build-types/font-size-picker/font-size-picker-select.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/border-box-control/border-box-control-linked-button/component.tsx +9 -14
- package/src/box-control/index.tsx +9 -0
- package/src/box-control/linked-button.tsx +8 -11
- package/src/box-control/test/index.tsx +9 -2
- package/src/box-control/types.ts +26 -11
- package/src/combobox-control/README.md +9 -1
- package/src/combobox-control/index.tsx +4 -1
- package/src/combobox-control/style.scss +4 -1
- package/src/combobox-control/types.ts +7 -0
- package/src/font-size-picker/font-size-picker-select.tsx +4 -23
- package/src/font-size-picker/test/index.tsx +2 -24
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["v4","uuid","forwardRef","useState","useMemo","createHigherOrderComponent","NoticeList","jsx","_jsx","OriginalComponent","Component","props","ref","noticeList","setNoticeList","noticeOperations","createNotice","notice","noticeToAdd","id","current","createErrorNotice","msg","status","content","removeNotice","filter","removeAllNotices","propsOut","noticeUI","length","className","notices","onRemove","isForwardRef","render"],"sources":["@wordpress/components/src/higher-order/with-notices/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport { v4 as uuid } from 'uuid';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useState, useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NoticeList from '../../notice/list';\nimport type { WithNoticeProps } from './types';\n\n/**\n * Override the default edit UI to include notices if supported.\n *\n * Wrapping the original component with `withNotices` encapsulates the component\n * with the additional props `noticeOperations` and `noticeUI`.\n *\n * ```jsx\n * import { withNotices, Button } from '@wordpress/components';\n *\n * const MyComponentWithNotices = withNotices(\n * \t( { noticeOperations, noticeUI } ) => {\n * \t\tconst addError = () =>\n * \t\t\tnoticeOperations.createErrorNotice( 'Error message' );\n * \t\treturn (\n * \t\t\t<div>\n * \t\t\t\t{ noticeUI }\n * \t\t\t\t<Button variant=\"secondary\" onClick={ addError }>\n * \t\t\t\t\tAdd error\n * \t\t\t\t</Button>\n * \t\t\t</div>\n * \t\t);\n * \t}\n * );\n * ```\n *\n * @param OriginalComponent Original component.\n *\n * @return Wrapped component.\n */\nexport default createHigherOrderComponent( ( OriginalComponent ) => {\n\tfunction Component(\n\t\tprops: { [ key: string ]: any },\n\t\tref: React.ForwardedRef< any >\n\t) {\n\t\tconst [ noticeList, setNoticeList ] = useState<\n\t\t\tWithNoticeProps[ 'noticeList' ]\n\t\t>( [] );\n\n\t\tconst noticeOperations = useMemo<\n\t\t\tWithNoticeProps[ 'noticeOperations' ]\n\t\t>( () => {\n\t\t\tconst createNotice: WithNoticeProps[ 'noticeOperations' ][ 'createNotice' ] =\n\t\t\t\t( notice ) => {\n\t\t\t\t\tconst noticeToAdd = notice.id\n\t\t\t\t\t\t? notice\n\t\t\t\t\t\t: { ...notice, id: uuid() };\n\t\t\t\t\tsetNoticeList( ( current ) => [ ...current, noticeToAdd ] );\n\t\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tcreateNotice,\n\t\t\t\tcreateErrorNotice: ( msg ) => {\n\t\t\t\t\t// @ts-expect-error TODO: Missing `id`, potentially a bug\n\t\t\t\t\tcreateNotice( {\n\t\t\t\t\t\tstatus: 'error',\n\t\t\t\t\t\tcontent: msg,\n\t\t\t\t\t} );\n\t\t\t\t},\n\t\t\t\tremoveNotice: ( id ) => {\n\t\t\t\t\tsetNoticeList( ( current ) =>\n\t\t\t\t\t\tcurrent.filter( ( notice ) => notice.id !== id )\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tremoveAllNotices: () => {\n\t\t\t\t\tsetNoticeList( [] );\n\t\t\t\t},\n\t\t\t};\n\t\t}, [] );\n\n\t\tconst propsOut = {\n\t\t\t...props,\n\t\t\tnoticeList,\n\t\t\tnoticeOperations,\n\t\t\tnoticeUI: noticeList.length > 0 && (\n\t\t\t\t<NoticeList\n\t\t\t\t\tclassName=\"components-with-notices-ui\"\n\t\t\t\t\tnotices={ noticeList }\n\t\t\t\t\tonRemove={ noticeOperations.removeNotice }\n\t\t\t\t/>\n\t\t\t),\n\t\t};\n\n\t\treturn isForwardRef ? (\n\t\t\t<OriginalComponent { ...propsOut } ref={ ref } />\n\t\t) : (\n\t\t\t<OriginalComponent { ...propsOut } />\n\t\t);\n\t}\n\n\tlet isForwardRef: boolean;\n\t// @ts-expect-error - `render` will only be present when OriginalComponent was wrapped with forwardRef().\n\tconst { render } = OriginalComponent;\n\t// Returns a forwardRef if OriginalComponent appears to be a forwardRef.\n\tif ( typeof render === 'function' ) {\n\t\tisForwardRef = true;\n\t\treturn forwardRef( Component );\n\t}\n\treturn Component;\n}, 'withNotices' );\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["v4","uuid","forwardRef","useState","useMemo","createHigherOrderComponent","NoticeList","jsx","_jsx","OriginalComponent","Component","props","ref","noticeList","setNoticeList","noticeOperations","createNotice","notice","noticeToAdd","id","current","createErrorNotice","msg","status","content","removeNotice","filter","removeAllNotices","propsOut","noticeUI","length","className","notices","onRemove","isForwardRef","render"],"sources":["@wordpress/components/src/higher-order/with-notices/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport { v4 as uuid } from 'uuid';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useState, useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NoticeList from '../../notice/list';\nimport type { WithNoticeProps } from './types';\n\n/**\n * Override the default edit UI to include notices if supported.\n *\n * Wrapping the original component with `withNotices` encapsulates the component\n * with the additional props `noticeOperations` and `noticeUI`.\n *\n * ```jsx\n * import { withNotices, Button } from '@wordpress/components';\n *\n * const MyComponentWithNotices = withNotices(\n * \t( { noticeOperations, noticeUI } ) => {\n * \t\tconst addError = () =>\n * \t\t\tnoticeOperations.createErrorNotice( 'Error message' );\n * \t\treturn (\n * \t\t\t<div>\n * \t\t\t\t{ noticeUI }\n * \t\t\t\t<Button variant=\"secondary\" onClick={ addError }>\n * \t\t\t\t\tAdd error\n * \t\t\t\t</Button>\n * \t\t\t</div>\n * \t\t);\n * \t}\n * );\n * ```\n *\n * @param OriginalComponent Original component.\n *\n * @return Wrapped component.\n */\nexport default createHigherOrderComponent( ( OriginalComponent ) => {\n\tfunction Component(\n\t\tprops: { [ key: string ]: any },\n\t\tref: React.ForwardedRef< any >\n\t) {\n\t\tconst [ noticeList, setNoticeList ] = useState<\n\t\t\tWithNoticeProps[ 'noticeList' ]\n\t\t>( [] );\n\n\t\tconst noticeOperations = useMemo<\n\t\t\tWithNoticeProps[ 'noticeOperations' ]\n\t\t>( () => {\n\t\t\tconst createNotice: WithNoticeProps[ 'noticeOperations' ][ 'createNotice' ] =\n\t\t\t\t( notice ) => {\n\t\t\t\t\tconst noticeToAdd = notice.id\n\t\t\t\t\t\t? notice\n\t\t\t\t\t\t: { ...notice, id: uuid() };\n\t\t\t\t\tsetNoticeList( ( current ) => [ ...current, noticeToAdd ] );\n\t\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tcreateNotice,\n\t\t\t\tcreateErrorNotice: ( msg ) => {\n\t\t\t\t\t// @ts-expect-error TODO: Missing `id`, potentially a bug\n\t\t\t\t\tcreateNotice( {\n\t\t\t\t\t\tstatus: 'error',\n\t\t\t\t\t\tcontent: msg,\n\t\t\t\t\t} );\n\t\t\t\t},\n\t\t\t\tremoveNotice: ( id ) => {\n\t\t\t\t\tsetNoticeList( ( current ) =>\n\t\t\t\t\t\tcurrent.filter( ( notice ) => notice.id !== id )\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tremoveAllNotices: () => {\n\t\t\t\t\tsetNoticeList( [] );\n\t\t\t\t},\n\t\t\t};\n\t\t}, [] );\n\n\t\tconst propsOut = {\n\t\t\t...props,\n\t\t\tnoticeList,\n\t\t\tnoticeOperations,\n\t\t\tnoticeUI: noticeList.length > 0 && (\n\t\t\t\t<NoticeList\n\t\t\t\t\tclassName=\"components-with-notices-ui\"\n\t\t\t\t\tnotices={ noticeList }\n\t\t\t\t\tonRemove={ noticeOperations.removeNotice }\n\t\t\t\t/>\n\t\t\t),\n\t\t};\n\n\t\treturn isForwardRef ? (\n\t\t\t<OriginalComponent { ...propsOut } ref={ ref } />\n\t\t) : (\n\t\t\t<OriginalComponent { ...propsOut } />\n\t\t);\n\t}\n\n\tlet isForwardRef: boolean;\n\t// @ts-expect-error - `render` will only be present when OriginalComponent was wrapped with forwardRef().\n\tconst { render } = OriginalComponent;\n\t// Returns a forwardRef if OriginalComponent appears to be a forwardRef.\n\tif ( typeof render === 'function' ) {\n\t\tisForwardRef = true;\n\t\treturn forwardRef( Component );\n\t}\n\treturn Component;\n}, 'withNotices' );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,IAAIC,IAAI,QAAQ,MAAM;;AAEjC;AACA;AACA;AACA,SAASC,UAAU,EAAEC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AAClE,SAASC,0BAA0B,QAAQ,oBAAoB;;AAE/D;AACA;AACA;AACA,OAAOC,UAAU,MAAM,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAG3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeH,0BAA0B,CAAII,iBAAiB,IAAM;EACnE,SAASC,SAASA,CACjBC,KAA+B,EAC/BC,GAA8B,EAC7B;IACD,MAAM,CAAEC,UAAU,EAAEC,aAAa,CAAE,GAAGX,QAAQ,CAE3C,EAAG,CAAC;IAEP,MAAMY,gBAAgB,GAAGX,OAAO,CAE7B,MAAM;MACR,MAAMY,YAAqE,GACxEC,MAAM,IAAM;QACb,MAAMC,WAAW,GAAGD,MAAM,CAACE,EAAE,GAC1BF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AAC;EAC/B;EACA,OAAOA,SAAS;AACjB,CAAC,EAAE,aAAc,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRef","Children","useKeyboardShortcut","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","KeyboardShortcut","target","callback","shortcut","bindGlobal","eventName","KeyboardShortcuts","children","shortcuts","element","Object","entries","map","count","ref"],"sources":["@wordpress/components/src/keyboard-shortcuts/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, Children } from '@wordpress/element';\nimport { useKeyboardShortcut } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport type { KeyboardShortcutProps, KeyboardShortcutsProps } from './types';\n\nfunction KeyboardShortcut( {\n\ttarget,\n\tcallback,\n\tshortcut,\n\tbindGlobal,\n\teventName,\n}: KeyboardShortcutProps ) {\n\tuseKeyboardShortcut( shortcut, callback, {\n\t\tbindGlobal,\n\t\ttarget,\n\t\teventName,\n\t} );\n\n\treturn null;\n}\n\n/**\n * `KeyboardShortcuts` is a component which handles keyboard sequences during the lifetime of the rendering element.\n *\n * When passed children, it will capture key events which occur on or within the children. If no children are passed, events are captured on the document.\n *\n * It uses the [Mousetrap](https://craig.is/killing/mice) library to implement keyboard sequence bindings.\n *\n * ```jsx\n * import { KeyboardShortcuts } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyKeyboardShortcuts = () => {\n * \tconst [ isAllSelected, setIsAllSelected ] = useState( false );\n * \tconst selectAll = () => {\n * \t\tsetIsAllSelected( true );\n * \t};\n *\n * \treturn (\n * \t\t<div>\n * \t\t\t<KeyboardShortcuts\n * \t\t\t\tshortcuts={ {\n * \t\t\t\t\t'mod+a': selectAll,\n * \t\t\t\t} }\n * \t\t\t/>\n * \t\t\t[cmd/ctrl + A] Combination pressed? { isAllSelected ? 'Yes' : 'No' }\n * \t\t</div>\n * \t);\n * };\n * ```\n */\nfunction KeyboardShortcuts( {\n\tchildren,\n\tshortcuts,\n\tbindGlobal,\n\teventName,\n}: KeyboardShortcutsProps ) {\n\tconst target = useRef( null );\n\n\tconst element = Object.entries( shortcuts ?? {} ).map(\n\t\t( [ shortcut, callback ] ) => (\n\t\t\t<KeyboardShortcut\n\t\t\t\tkey={ shortcut }\n\t\t\t\tshortcut={ shortcut }\n\t\t\t\tcallback={ callback }\n\t\t\t\tbindGlobal={ bindGlobal }\n\t\t\t\teventName={ eventName }\n\t\t\t\ttarget={ target }\n\t\t\t/>\n\t\t)\n\t);\n\n\t// Render as non-visual if there are no children pressed. Keyboard\n\t// events will be bound to the document instead.\n\tif ( ! Children.count( children ) ) {\n\t\treturn <>{ element }</>;\n\t}\n\n\treturn (\n\t\t<div ref={ target }>\n\t\t\t{ element }\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default KeyboardShortcuts;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["useRef","Children","useKeyboardShortcut","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","KeyboardShortcut","target","callback","shortcut","bindGlobal","eventName","KeyboardShortcuts","children","shortcuts","element","Object","entries","map","count","ref"],"sources":["@wordpress/components/src/keyboard-shortcuts/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, Children } from '@wordpress/element';\nimport { useKeyboardShortcut } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport type { KeyboardShortcutProps, KeyboardShortcutsProps } from './types';\n\nfunction KeyboardShortcut( {\n\ttarget,\n\tcallback,\n\tshortcut,\n\tbindGlobal,\n\teventName,\n}: KeyboardShortcutProps ) {\n\tuseKeyboardShortcut( shortcut, callback, {\n\t\tbindGlobal,\n\t\ttarget,\n\t\teventName,\n\t} );\n\n\treturn null;\n}\n\n/**\n * `KeyboardShortcuts` is a component which handles keyboard sequences during the lifetime of the rendering element.\n *\n * When passed children, it will capture key events which occur on or within the children. If no children are passed, events are captured on the document.\n *\n * It uses the [Mousetrap](https://craig.is/killing/mice) library to implement keyboard sequence bindings.\n *\n * ```jsx\n * import { KeyboardShortcuts } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyKeyboardShortcuts = () => {\n * \tconst [ isAllSelected, setIsAllSelected ] = useState( false );\n * \tconst selectAll = () => {\n * \t\tsetIsAllSelected( true );\n * \t};\n *\n * \treturn (\n * \t\t<div>\n * \t\t\t<KeyboardShortcuts\n * \t\t\t\tshortcuts={ {\n * \t\t\t\t\t'mod+a': selectAll,\n * \t\t\t\t} }\n * \t\t\t/>\n * \t\t\t[cmd/ctrl + A] Combination pressed? { isAllSelected ? 'Yes' : 'No' }\n * \t\t</div>\n * \t);\n * };\n * ```\n */\nfunction KeyboardShortcuts( {\n\tchildren,\n\tshortcuts,\n\tbindGlobal,\n\teventName,\n}: KeyboardShortcutsProps ) {\n\tconst target = useRef( null );\n\n\tconst element = Object.entries( shortcuts ?? {} ).map(\n\t\t( [ shortcut, callback ] ) => (\n\t\t\t<KeyboardShortcut\n\t\t\t\tkey={ shortcut }\n\t\t\t\tshortcut={ shortcut }\n\t\t\t\tcallback={ callback }\n\t\t\t\tbindGlobal={ bindGlobal }\n\t\t\t\teventName={ eventName }\n\t\t\t\ttarget={ target }\n\t\t\t/>\n\t\t)\n\t);\n\n\t// Render as non-visual if there are no children pressed. Keyboard\n\t// events will be bound to the document instead.\n\tif ( ! Children.count( children ) ) {\n\t\treturn <>{ element }</>;\n\t}\n\n\treturn (\n\t\t<div ref={ target }>\n\t\t\t{ element }\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default KeyboardShortcuts;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,QAAQ,QAAQ,oBAAoB;AACrD,SAASC,mBAAmB,QAAQ,oBAAoB;;AAExD;AACA;AACA;AAFA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAKA,SAASC,gBAAgBA,CAAE;EAC1BC,MAAM;EACNC,QAAQ;EACRC,QAAQ;EACRC,UAAU;EACVC;AACsB,CAAC,EAAG;EAC1BZ,mBAAmB,CAAEU,QAAQ,EAAED,QAAQ,EAAE;IACxCE,UAAU;IACVH,MAAM;IACNI;EACD,CAAE,CAAC;EAEH,OAAO,IAAI;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,iBAAiBA,CAAE;EAC3BC,QAAQ;EACRC,SAAS;EACTJ,UAAU;EACVC;AACuB,CAAC,EAAG;EAC3B,MAAMJ,MAAM,GAAGV,MAAM,CAAE,IAAK,CAAC;EAE7B,MAAMkB,OAAO,GAAGC,MAAM,CAACC,OAAO,CAAEH,SAAS,aAATA,SAAS,cAATA,SAAS,GAAI,CAAC,CAAE,CAAC,CAACI,GAAG,CACpD,CAAE,CAAET,QAAQ,EAAED,QAAQ,CAAE,kBACvBP,IAAA,CAACK,gBAAgB;IAEhBG,QAAQ,EAAGA,QAAU;IACrBD,QAAQ,EAAGA,QAAU;IACrBE,UAAU,EAAGA,UAAY;IACzBC,SAAS,EAAGA,SAAW;IACvBJ,MAAM,EAAGA;EAAQ,GALXE,QAMN,CAEH,CAAC;;EAED;EACA;EACA,IAAK,CAAEX,QAAQ,CAACqB,KAAK,CAAEN,QAAS,CAAC,EAAG;IACnC,oBAAOZ,IAAA,CAAAE,SAAA;MAAAU,QAAA,EAAIE;IAAO,CAAI,CAAC;EACxB;EAEA,oBACCV,KAAA;IAAKe,GAAG,EAAGb,MAAQ;IAAAM,QAAA,GAChBE,OAAO,EACPF,QAAQ;EAAA,CACN,CAAC;AAER;AAEA,eAAeD,iBAAiB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["check","MenuItem","jsx","_jsx","Fragment","_Fragment","noop","MenuItemsChoice","choices","onHover","onSelect","value","children","map","item","isSelected","role","disabled","icon","info","shortcut","className","onClick","onMouseEnter","onMouseLeave","label"],"sources":["@wordpress/components/src/menu-items-choice/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport MenuItem from '../menu-item';\nimport type { MenuItemsChoiceProps } from './types';\n\nconst noop = () => {};\n\n/**\n * `MenuItemsChoice` functions similarly to a set of `MenuItem`s, but allows the user to select one option from a set of multiple choices.\n *\n *\n * ```jsx\n * import { MenuGroup, MenuItemsChoice } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyMenuItemsChoice = () => {\n * \tconst [ mode, setMode ] = useState( 'visual' );\n * \tconst choices = [\n * \t\t{\n * \t\t\tvalue: 'visual',\n * \t\t\tlabel: 'Visual editor',\n * \t\t},\n * \t\t{\n * \t\t\tvalue: 'text',\n * \t\t\tlabel: 'Code editor',\n * \t\t},\n * \t];\n *\n * \treturn (\n * \t\t<MenuGroup label=\"Editor\">\n * \t\t\t<MenuItemsChoice\n * \t\t\t\tchoices={ choices }\n * \t\t\t\tvalue={ mode }\n * \t\t\t\tonSelect={ ( newMode ) => setMode( newMode ) }\n * \t\t\t/>\n * \t\t</MenuGroup>\n * \t);\n * };\n * ```\n */\nfunction MenuItemsChoice( {\n\tchoices = [],\n\tonHover = noop,\n\tonSelect,\n\tvalue,\n}: MenuItemsChoiceProps ) {\n\treturn (\n\t\t<>\n\t\t\t{ choices.map( ( item ) => {\n\t\t\t\tconst isSelected = value === item.value;\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ item.value }\n\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\tdisabled={ item.disabled }\n\t\t\t\t\t\ticon={ isSelected ? check : null }\n\t\t\t\t\t\tinfo={ item.info }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tshortcut={ item.shortcut }\n\t\t\t\t\t\tclassName=\"components-menu-items-choice\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( ! isSelected ) {\n\t\t\t\t\t\t\t\tonSelect( item.value );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonMouseEnter={ () => onHover( item.value ) }\n\t\t\t\t\t\tonMouseLeave={ () => onHover( null ) }\n\t\t\t\t\t\taria-label={ item[ 'aria-label' ] }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ item.label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport default MenuItemsChoice;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["check","MenuItem","jsx","_jsx","Fragment","_Fragment","noop","MenuItemsChoice","choices","onHover","onSelect","value","children","map","item","isSelected","role","disabled","icon","info","shortcut","className","onClick","onMouseEnter","onMouseLeave","label"],"sources":["@wordpress/components/src/menu-items-choice/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport MenuItem from '../menu-item';\nimport type { MenuItemsChoiceProps } from './types';\n\nconst noop = () => {};\n\n/**\n * `MenuItemsChoice` functions similarly to a set of `MenuItem`s, but allows the user to select one option from a set of multiple choices.\n *\n *\n * ```jsx\n * import { MenuGroup, MenuItemsChoice } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyMenuItemsChoice = () => {\n * \tconst [ mode, setMode ] = useState( 'visual' );\n * \tconst choices = [\n * \t\t{\n * \t\t\tvalue: 'visual',\n * \t\t\tlabel: 'Visual editor',\n * \t\t},\n * \t\t{\n * \t\t\tvalue: 'text',\n * \t\t\tlabel: 'Code editor',\n * \t\t},\n * \t];\n *\n * \treturn (\n * \t\t<MenuGroup label=\"Editor\">\n * \t\t\t<MenuItemsChoice\n * \t\t\t\tchoices={ choices }\n * \t\t\t\tvalue={ mode }\n * \t\t\t\tonSelect={ ( newMode ) => setMode( newMode ) }\n * \t\t\t/>\n * \t\t</MenuGroup>\n * \t);\n * };\n * ```\n */\nfunction MenuItemsChoice( {\n\tchoices = [],\n\tonHover = noop,\n\tonSelect,\n\tvalue,\n}: MenuItemsChoiceProps ) {\n\treturn (\n\t\t<>\n\t\t\t{ choices.map( ( item ) => {\n\t\t\t\tconst isSelected = value === item.value;\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ item.value }\n\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\tdisabled={ item.disabled }\n\t\t\t\t\t\ticon={ isSelected ? check : null }\n\t\t\t\t\t\tinfo={ item.info }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tshortcut={ item.shortcut }\n\t\t\t\t\t\tclassName=\"components-menu-items-choice\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( ! isSelected ) {\n\t\t\t\t\t\t\t\tonSelect( item.value );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonMouseEnter={ () => onHover( item.value ) }\n\t\t\t\t\t\tonMouseLeave={ () => onHover( null ) }\n\t\t\t\t\t\taria-label={ item[ 'aria-label' ] }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ item.label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport default MenuItemsChoice;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,kBAAkB;;AAExC;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA;AAGpC,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,eAAeA,CAAE;EACzBC,OAAO,GAAG,EAAE;EACZC,OAAO,GAAGH,IAAI;EACdI,QAAQ;EACRC;AACqB,CAAC,EAAG;EACzB,oBACCR,IAAA,CAAAE,SAAA;IAAAO,QAAA,EACGJ,OAAO,CAACK,GAAG,CAAIC,IAAI,IAAM;MAC1B,MAAMC,UAAU,GAAGJ,KAAK,KAAKG,IAAI,CAACH,KAAK;MACvC,oBACCR,IAAA,CAACF,QAAQ;QAERe,IAAI,EAAC,eAAe;QACpBC,QAAQ,EAAGH,IAAI,CAACG,QAAU;QAC1BC,IAAI,EAAGH,UAAU,GAAGf,KAAK,GAAG,IAAM;QAClCmB,IAAI,EAAGL,IAAI,CAACK,IAAM;QAClBJ,UAAU,EAAGA,UAAY;QACzBK,QAAQ,EAAGN,IAAI,CAACM,QAAU;QAC1BC,SAAS,EAAC,8BAA8B;QACxCC,OAAO,EAAGA,CAAA,KAAM;UACf,IAAK,CAAEP,UAAU,EAAG;YACnBL,QAAQ,CAAEI,IAAI,CAACH,KAAM,CAAC;UACvB;QACD,CAAG;QACHY,YAAY,EAAGA,CAAA,KAAMd,OAAO,CAAEK,IAAI,CAACH,KAAM,CAAG;QAC5Ca,YAAY,EAAGA,CAAA,KAAMf,OAAO,CAAE,IAAK,CAAG;QACtC,cAAaK,IAAI,CAAE,YAAY,CAAI;QAAAF,QAAA,EAEjCE,IAAI,CAACW;MAAK,GAjBNX,IAAI,CAACH,KAkBF,CAAC;IAEb,CAAE;EAAC,CACF,CAAC;AAEL;AAEA,eAAeJ,eAAe","ignoreList":[]}
|
package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NavigationContainer","DefaultTheme","createStackNavigator","Animated","Easing","useAnimatedStyle","useSharedValue","withTiming","useContext","useMemo","useCallback","Children","useRef","cloneElement","usePreferredColorSchemeStyle","BottomSheetNavigationContext","BottomSheetNavigationProvider","BottomSheetContext","styles","jsx","_jsx","AnimationSpec","animation","config","duration","easing","ease","fadeConfig","current","cardStyle","opacity","progress","options","transitionSpec","open","close","headerShown","gestureEnabled","cardStyleInterpolator","keyboardHandlingEnabled","HEIGHT_ANIMATION_DURATION","DEFAULT_HEIGHT","BottomSheetNavigationContainer","children","animate","main","theme","style","testID","Stack","navigationContext","maxHeight","sheetMaxHeight","isMaxHeightSet","isSheetMaxHeightSet","currentHeight","value","backgroundStyle","background","backgroundDark","defaultTheme","colors","backgroundColor","_theme","setHeight","height","Math","round","newHeight","min","shouldAnimate","out","cubic","animatedStyles","screens","map","child","screen","name","otherProps","props","isNested","Screen","View","Navigator","screenOptions","detachInactiveScreens"],"sources":["@wordpress/components/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { NavigationContainer, DefaultTheme } from '@react-navigation/native';\nimport { createStackNavigator } from '@react-navigation/stack';\nimport Animated, {\n\tEasing,\n\tuseAnimatedStyle,\n\tuseSharedValue,\n\twithTiming,\n} from 'react-native-reanimated';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseContext,\n\tuseMemo,\n\tuseCallback,\n\tChildren,\n\tuseRef,\n\tcloneElement,\n} from '@wordpress/element';\n\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBottomSheetNavigationContext,\n\tBottomSheetNavigationProvider,\n} from './bottom-sheet-navigation-context';\nimport { BottomSheetContext } from '../bottom-sheet-context';\n\nimport styles from './styles.scss';\n\nconst AnimationSpec = {\n\tanimation: 'timing',\n\tconfig: {\n\t\tduration: 200,\n\t\teasing: Easing.ease,\n\t},\n};\n\nconst fadeConfig = ( { current } ) => {\n\treturn {\n\t\tcardStyle: {\n\t\t\topacity: current.progress,\n\t\t},\n\t};\n};\n\nconst options = {\n\ttransitionSpec: {\n\t\topen: AnimationSpec,\n\t\tclose: AnimationSpec,\n\t},\n\theaderShown: false,\n\tgestureEnabled: false,\n\tcardStyleInterpolator: fadeConfig,\n\tkeyboardHandlingEnabled: false,\n};\n\nconst HEIGHT_ANIMATION_DURATION = 300;\nconst DEFAULT_HEIGHT = 1;\n\nfunction BottomSheetNavigationContainer( {\n\tchildren,\n\tanimate,\n\tmain,\n\ttheme,\n\tstyle,\n\ttestID,\n} ) {\n\tconst Stack = useRef( createStackNavigator() ).current;\n\tconst navigationContext = useContext( BottomSheetNavigationContext );\n\tconst { maxHeight: sheetMaxHeight, isMaxHeightSet: isSheetMaxHeightSet } =\n\t\tuseContext( BottomSheetContext );\n\tconst currentHeight = useSharedValue(\n\t\tnavigationContext.currentHeight?.value || DEFAULT_HEIGHT\n\t);\n\n\tconst backgroundStyle = usePreferredColorSchemeStyle(\n\t\tstyles.background,\n\t\tstyles.backgroundDark\n\t);\n\n\tconst defaultTheme = useMemo(\n\t\t() => ( {\n\t\t\t...DefaultTheme,\n\t\t\tcolors: {\n\t\t\t\t...DefaultTheme.colors,\n\t\t\t\tbackground: backgroundStyle.backgroundColor,\n\t\t\t},\n\t\t} ),\n\t\t[ backgroundStyle.backgroundColor ]\n\t);\n\tconst _theme = theme || defaultTheme;\n\n\tconst setHeight = useCallback(\n\t\t( height ) => {\n\t\t\tif (\n\t\t\t\theight > DEFAULT_HEIGHT &&\n\t\t\t\tMath.round( height ) !== Math.round( currentHeight.value )\n\t\t\t) {\n\t\t\t\t// If max height is set in the bottom sheet, we clamp\n\t\t\t\t// the new height using that value.\n\t\t\t\tconst newHeight = isSheetMaxHeightSet\n\t\t\t\t\t? Math.min( sheetMaxHeight, height )\n\t\t\t\t\t: height;\n\t\t\t\tconst shouldAnimate =\n\t\t\t\t\tanimate && currentHeight.value !== DEFAULT_HEIGHT;\n\n\t\t\t\tif ( shouldAnimate ) {\n\t\t\t\t\tcurrentHeight.value = withTiming( newHeight, {\n\t\t\t\t\t\tduration: HEIGHT_ANIMATION_DURATION,\n\t\t\t\t\t\teasing: Easing.out( Easing.cubic ),\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tcurrentHeight.value = newHeight;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[ animate, currentHeight, isSheetMaxHeightSet, sheetMaxHeight ]\n\t);\n\n\tconst animatedStyles = useAnimatedStyle( () => ( {\n\t\theight: currentHeight.value,\n\t} ) );\n\n\tconst screens = useMemo( () => {\n\t\treturn Children.map( children, ( child ) => {\n\t\t\tlet screen = child;\n\t\t\tconst { name, ...otherProps } = child.props;\n\t\t\tif ( ! main ) {\n\t\t\t\tscreen = cloneElement( child, {\n\t\t\t\t\t...child.props,\n\t\t\t\t\tisNested: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<Stack.Screen\n\t\t\t\t\tname={ name }\n\t\t\t\t\t{ ...otherProps }\n\t\t\t\t\tchildren={ () => screen }\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t}, [ children, main ] );\n\n\treturn useMemo( () => {\n\t\treturn (\n\t\t\t<Animated.View\n\t\t\t\tstyle={ [ style, animatedStyles ] }\n\t\t\t\ttestID={ testID }\n\t\t\t>\n\t\t\t\t<BottomSheetNavigationProvider\n\t\t\t\t\tvalue={ { setHeight, currentHeight } }\n\t\t\t\t>\n\t\t\t\t\t{ main ? (\n\t\t\t\t\t\t<NavigationContainer theme={ _theme }>\n\t\t\t\t\t\t\t<Stack.Navigator\n\t\t\t\t\t\t\t\tscreenOptions={ options }\n\t\t\t\t\t\t\t\tdetachInactiveScreens={ false }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ screens }\n\t\t\t\t\t\t\t</Stack.Navigator>\n\t\t\t\t\t\t</NavigationContainer>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Stack.Navigator\n\t\t\t\t\t\t\tscreenOptions={ options }\n\t\t\t\t\t\t\tdetachInactiveScreens={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ screens }\n\t\t\t\t\t\t</Stack.Navigator>\n\t\t\t\t\t) }\n\t\t\t\t</BottomSheetNavigationProvider>\n\t\t\t</Animated.View>\n\t\t);\n\t}, [\n\t\t_theme,\n\t\tanimatedStyles,\n\t\tcurrentHeight,\n\t\tmain,\n\t\tscreens,\n\t\tsetHeight,\n\t\tstyle,\n\t\ttestID,\n\t] );\n}\n\nexport default BottomSheetNavigationContainer;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["NavigationContainer","DefaultTheme","createStackNavigator","Animated","Easing","useAnimatedStyle","useSharedValue","withTiming","useContext","useMemo","useCallback","Children","useRef","cloneElement","usePreferredColorSchemeStyle","BottomSheetNavigationContext","BottomSheetNavigationProvider","BottomSheetContext","styles","jsx","_jsx","AnimationSpec","animation","config","duration","easing","ease","fadeConfig","current","cardStyle","opacity","progress","options","transitionSpec","open","close","headerShown","gestureEnabled","cardStyleInterpolator","keyboardHandlingEnabled","HEIGHT_ANIMATION_DURATION","DEFAULT_HEIGHT","BottomSheetNavigationContainer","children","animate","main","theme","style","testID","Stack","navigationContext","maxHeight","sheetMaxHeight","isMaxHeightSet","isSheetMaxHeightSet","currentHeight","value","backgroundStyle","background","backgroundDark","defaultTheme","colors","backgroundColor","_theme","setHeight","height","Math","round","newHeight","min","shouldAnimate","out","cubic","animatedStyles","screens","map","child","screen","name","otherProps","props","isNested","Screen","View","Navigator","screenOptions","detachInactiveScreens"],"sources":["@wordpress/components/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { NavigationContainer, DefaultTheme } from '@react-navigation/native';\nimport { createStackNavigator } from '@react-navigation/stack';\nimport Animated, {\n\tEasing,\n\tuseAnimatedStyle,\n\tuseSharedValue,\n\twithTiming,\n} from 'react-native-reanimated';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseContext,\n\tuseMemo,\n\tuseCallback,\n\tChildren,\n\tuseRef,\n\tcloneElement,\n} from '@wordpress/element';\n\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBottomSheetNavigationContext,\n\tBottomSheetNavigationProvider,\n} from './bottom-sheet-navigation-context';\nimport { BottomSheetContext } from '../bottom-sheet-context';\n\nimport styles from './styles.scss';\n\nconst AnimationSpec = {\n\tanimation: 'timing',\n\tconfig: {\n\t\tduration: 200,\n\t\teasing: Easing.ease,\n\t},\n};\n\nconst fadeConfig = ( { current } ) => {\n\treturn {\n\t\tcardStyle: {\n\t\t\topacity: current.progress,\n\t\t},\n\t};\n};\n\nconst options = {\n\ttransitionSpec: {\n\t\topen: AnimationSpec,\n\t\tclose: AnimationSpec,\n\t},\n\theaderShown: false,\n\tgestureEnabled: false,\n\tcardStyleInterpolator: fadeConfig,\n\tkeyboardHandlingEnabled: false,\n};\n\nconst HEIGHT_ANIMATION_DURATION = 300;\nconst DEFAULT_HEIGHT = 1;\n\nfunction BottomSheetNavigationContainer( {\n\tchildren,\n\tanimate,\n\tmain,\n\ttheme,\n\tstyle,\n\ttestID,\n} ) {\n\tconst Stack = useRef( createStackNavigator() ).current;\n\tconst navigationContext = useContext( BottomSheetNavigationContext );\n\tconst { maxHeight: sheetMaxHeight, isMaxHeightSet: isSheetMaxHeightSet } =\n\t\tuseContext( BottomSheetContext );\n\tconst currentHeight = useSharedValue(\n\t\tnavigationContext.currentHeight?.value || DEFAULT_HEIGHT\n\t);\n\n\tconst backgroundStyle = usePreferredColorSchemeStyle(\n\t\tstyles.background,\n\t\tstyles.backgroundDark\n\t);\n\n\tconst defaultTheme = useMemo(\n\t\t() => ( {\n\t\t\t...DefaultTheme,\n\t\t\tcolors: {\n\t\t\t\t...DefaultTheme.colors,\n\t\t\t\tbackground: backgroundStyle.backgroundColor,\n\t\t\t},\n\t\t} ),\n\t\t[ backgroundStyle.backgroundColor ]\n\t);\n\tconst _theme = theme || defaultTheme;\n\n\tconst setHeight = useCallback(\n\t\t( height ) => {\n\t\t\tif (\n\t\t\t\theight > DEFAULT_HEIGHT &&\n\t\t\t\tMath.round( height ) !== Math.round( currentHeight.value )\n\t\t\t) {\n\t\t\t\t// If max height is set in the bottom sheet, we clamp\n\t\t\t\t// the new height using that value.\n\t\t\t\tconst newHeight = isSheetMaxHeightSet\n\t\t\t\t\t? Math.min( sheetMaxHeight, height )\n\t\t\t\t\t: height;\n\t\t\t\tconst shouldAnimate =\n\t\t\t\t\tanimate && currentHeight.value !== DEFAULT_HEIGHT;\n\n\t\t\t\tif ( shouldAnimate ) {\n\t\t\t\t\tcurrentHeight.value = withTiming( newHeight, {\n\t\t\t\t\t\tduration: HEIGHT_ANIMATION_DURATION,\n\t\t\t\t\t\teasing: Easing.out( Easing.cubic ),\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tcurrentHeight.value = newHeight;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[ animate, currentHeight, isSheetMaxHeightSet, sheetMaxHeight ]\n\t);\n\n\tconst animatedStyles = useAnimatedStyle( () => ( {\n\t\theight: currentHeight.value,\n\t} ) );\n\n\tconst screens = useMemo( () => {\n\t\treturn Children.map( children, ( child ) => {\n\t\t\tlet screen = child;\n\t\t\tconst { name, ...otherProps } = child.props;\n\t\t\tif ( ! main ) {\n\t\t\t\tscreen = cloneElement( child, {\n\t\t\t\t\t...child.props,\n\t\t\t\t\tisNested: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<Stack.Screen\n\t\t\t\t\tname={ name }\n\t\t\t\t\t{ ...otherProps }\n\t\t\t\t\tchildren={ () => screen }\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t}, [ children, main ] );\n\n\treturn useMemo( () => {\n\t\treturn (\n\t\t\t<Animated.View\n\t\t\t\tstyle={ [ style, animatedStyles ] }\n\t\t\t\ttestID={ testID }\n\t\t\t>\n\t\t\t\t<BottomSheetNavigationProvider\n\t\t\t\t\tvalue={ { setHeight, currentHeight } }\n\t\t\t\t>\n\t\t\t\t\t{ main ? (\n\t\t\t\t\t\t<NavigationContainer theme={ _theme }>\n\t\t\t\t\t\t\t<Stack.Navigator\n\t\t\t\t\t\t\t\tscreenOptions={ options }\n\t\t\t\t\t\t\t\tdetachInactiveScreens={ false }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ screens }\n\t\t\t\t\t\t\t</Stack.Navigator>\n\t\t\t\t\t\t</NavigationContainer>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Stack.Navigator\n\t\t\t\t\t\t\tscreenOptions={ options }\n\t\t\t\t\t\t\tdetachInactiveScreens={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ screens }\n\t\t\t\t\t\t</Stack.Navigator>\n\t\t\t\t\t) }\n\t\t\t\t</BottomSheetNavigationProvider>\n\t\t\t</Animated.View>\n\t\t);\n\t}, [\n\t\t_theme,\n\t\tanimatedStyles,\n\t\tcurrentHeight,\n\t\tmain,\n\t\tscreens,\n\t\tsetHeight,\n\t\tstyle,\n\t\ttestID,\n\t] );\n}\n\nexport default BottomSheetNavigationContainer;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,mBAAmB,EAAEC,YAAY,QAAQ,0BAA0B;AAC5E,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,OAAOC,QAAQ,IACdC,MAAM,EACNC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,QACJ,yBAAyB;;AAEhC;AACA;AACA;AACA,SACCC,UAAU,EACVC,OAAO,EACPC,WAAW,EACXC,QAAQ,EACRC,MAAM,EACNC,YAAY,QACN,oBAAoB;AAE3B,SAASC,4BAA4B,QAAQ,oBAAoB;;AAEjE;AACA;AACA;AACA,SACCC,4BAA4B,EAC5BC,6BAA6B,QACvB,mCAAmC;AAC1C,SAASC,kBAAkB,QAAQ,yBAAyB;AAE5D,OAAOC,MAAM,MAAM,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnC,MAAMC,aAAa,GAA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"version":3,"names":["Keyboard","LayoutAnimation","Platform","StyleSheet","View","Dimensions","Component","jsx","_jsx","KeyboardAvoidingView","constructor","arguments","_onKeyboardChange","bind","_subscriptions","state","bottom","_relativeKeyboardHeight","keyboardFrame","windowWidth","get","width","isFloatingKeyboard","windowHeight","height","keyboardY","screenY","props","keyboardVerticalOffset","final","Math","max","event","setState","duration","easing","endCoordinates","configureNext","update","type","Types","componentDidMount","OS","addListener","componentWillUnmount","forEach","subscription","remove","render","children","enabled","style","finalStyle","bottomHeight","compose","paddingBottom","defaultProps"],"sources":["@wordpress/components/src/mobile/bottom-sheet/keyboard-avoiding-view.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tKeyboard,\n\tLayoutAnimation,\n\tPlatform,\n\tStyleSheet,\n\tView,\n\tDimensions,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\n\n/**\n * This is a simplified version of Facebook's KeyboardAvoidingView.\n * It's meant to work specifically with BottomSheets.\n * This fixes an issue in the bottom padding calculation, when the\n * BottomSheet was presented on Landscape, with the keyboard already present,\n * and a TextField on Autofocus (situation present on Links UI)\n */\nclass KeyboardAvoidingView extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis._onKeyboardChange = this._onKeyboardChange.bind( this );\n\t\tthis._subscriptions = [];\n\t\tthis.state = {\n\t\t\tbottom: 0,\n\t\t};\n\t}\n\n\t_relativeKeyboardHeight( keyboardFrame ) {\n\t\tif ( ! keyboardFrame ) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst windowWidth = Dimensions.get( 'window' ).width;\n\t\tconst isFloatingKeyboard = keyboardFrame.width !== windowWidth;\n\t\tif ( isFloatingKeyboard ) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst windowHeight = Dimensions.get( 'window' ).height;\n\t\tconst keyboardY =\n\t\t\tkeyboardFrame.screenY - this.props.keyboardVerticalOffset;\n\n\t\tconst final = Math.max( windowHeight - keyboardY, 0 );\n\t\treturn final;\n\t}\n\n\t/**\n\t * @param {Object} event Keyboard event.\n\t */\n\t_onKeyboardChange( event ) {\n\t\tif ( event === null ) {\n\t\t\tthis.setState( { bottom: 0 } );\n\t\t\treturn;\n\t\t}\n\n\t\tconst { duration, easing, endCoordinates } = event;\n\t\tconst height = this._relativeKeyboardHeight( endCoordinates );\n\n\t\tif ( this.state.bottom === height ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( duration && easing ) {\n\t\t\tLayoutAnimation.configureNext( {\n\t\t\t\tduration,\n\t\t\t\tupdate: {\n\t\t\t\t\tduration,\n\t\t\t\t\ttype: LayoutAnimation.Types[ easing ] || 'keyboard',\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t\tthis.setState( { bottom: height } );\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( Platform.OS === 'ios' ) {\n\t\t\tthis._subscriptions = [\n\t\t\t\tKeyboard.addListener(\n\t\t\t\t\t'keyboardWillChangeFrame',\n\t\t\t\t\tthis._onKeyboardChange\n\t\t\t\t),\n\t\t\t];\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis._subscriptions.forEach( ( subscription ) => {\n\t\t\tsubscription.remove();\n\t\t} );\n\t}\n\n\trender() {\n\t\tconst { children, enabled, keyboardVerticalOffset, style, ...props } =\n\t\t\tthis.props;\n\n\t\tlet finalStyle = style;\n\t\tif ( Platform.OS === 'ios' ) {\n\t\t\tconst bottomHeight = enabled ? this.state.bottom : 0;\n\t\t\tfinalStyle = StyleSheet.compose( style, {\n\t\t\t\tpaddingBottom: bottomHeight,\n\t\t\t} );\n\t\t}\n\n\t\treturn (\n\t\t\t<View style={ finalStyle } { ...props }>\n\t\t\t\t{ children }\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nKeyboardAvoidingView.defaultProps = {\n\tenabled: true,\n\tkeyboardVerticalOffset: 0,\n};\n\nexport default KeyboardAvoidingView;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["Keyboard","LayoutAnimation","Platform","StyleSheet","View","Dimensions","Component","jsx","_jsx","KeyboardAvoidingView","constructor","arguments","_onKeyboardChange","bind","_subscriptions","state","bottom","_relativeKeyboardHeight","keyboardFrame","windowWidth","get","width","isFloatingKeyboard","windowHeight","height","keyboardY","screenY","props","keyboardVerticalOffset","final","Math","max","event","setState","duration","easing","endCoordinates","configureNext","update","type","Types","componentDidMount","OS","addListener","componentWillUnmount","forEach","subscription","remove","render","children","enabled","style","finalStyle","bottomHeight","compose","paddingBottom","defaultProps"],"sources":["@wordpress/components/src/mobile/bottom-sheet/keyboard-avoiding-view.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tKeyboard,\n\tLayoutAnimation,\n\tPlatform,\n\tStyleSheet,\n\tView,\n\tDimensions,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\n\n/**\n * This is a simplified version of Facebook's KeyboardAvoidingView.\n * It's meant to work specifically with BottomSheets.\n * This fixes an issue in the bottom padding calculation, when the\n * BottomSheet was presented on Landscape, with the keyboard already present,\n * and a TextField on Autofocus (situation present on Links UI)\n */\nclass KeyboardAvoidingView extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis._onKeyboardChange = this._onKeyboardChange.bind( this );\n\t\tthis._subscriptions = [];\n\t\tthis.state = {\n\t\t\tbottom: 0,\n\t\t};\n\t}\n\n\t_relativeKeyboardHeight( keyboardFrame ) {\n\t\tif ( ! keyboardFrame ) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst windowWidth = Dimensions.get( 'window' ).width;\n\t\tconst isFloatingKeyboard = keyboardFrame.width !== windowWidth;\n\t\tif ( isFloatingKeyboard ) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst windowHeight = Dimensions.get( 'window' ).height;\n\t\tconst keyboardY =\n\t\t\tkeyboardFrame.screenY - this.props.keyboardVerticalOffset;\n\n\t\tconst final = Math.max( windowHeight - keyboardY, 0 );\n\t\treturn final;\n\t}\n\n\t/**\n\t * @param {Object} event Keyboard event.\n\t */\n\t_onKeyboardChange( event ) {\n\t\tif ( event === null ) {\n\t\t\tthis.setState( { bottom: 0 } );\n\t\t\treturn;\n\t\t}\n\n\t\tconst { duration, easing, endCoordinates } = event;\n\t\tconst height = this._relativeKeyboardHeight( endCoordinates );\n\n\t\tif ( this.state.bottom === height ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( duration && easing ) {\n\t\t\tLayoutAnimation.configureNext( {\n\t\t\t\tduration,\n\t\t\t\tupdate: {\n\t\t\t\t\tduration,\n\t\t\t\t\ttype: LayoutAnimation.Types[ easing ] || 'keyboard',\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t\tthis.setState( { bottom: height } );\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( Platform.OS === 'ios' ) {\n\t\t\tthis._subscriptions = [\n\t\t\t\tKeyboard.addListener(\n\t\t\t\t\t'keyboardWillChangeFrame',\n\t\t\t\t\tthis._onKeyboardChange\n\t\t\t\t),\n\t\t\t];\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis._subscriptions.forEach( ( subscription ) => {\n\t\t\tsubscription.remove();\n\t\t} );\n\t}\n\n\trender() {\n\t\tconst { children, enabled, keyboardVerticalOffset, style, ...props } =\n\t\t\tthis.props;\n\n\t\tlet finalStyle = style;\n\t\tif ( Platform.OS === 'ios' ) {\n\t\t\tconst bottomHeight = enabled ? this.state.bottom : 0;\n\t\t\tfinalStyle = StyleSheet.compose( style, {\n\t\t\t\tpaddingBottom: bottomHeight,\n\t\t\t} );\n\t\t}\n\n\t\treturn (\n\t\t\t<View style={ finalStyle } { ...props }>\n\t\t\t\t{ children }\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nKeyboardAvoidingView.defaultProps = {\n\tenabled: true,\n\tkeyboardVerticalOffset: 0,\n};\n\nexport default KeyboardAvoidingView;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,QAAQ,EACRC,eAAe,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CAAE,CAAC;IACJ;IAEA,oBACC7C,IAAA,CAACJ,IAAI;MAAC+C,KAAK,EAAGC,UAAY;MAAA,GAAMzB,KAAK;MAAAsB,QAAA,EAClCA;IAAQ,CACL,CAAC;EAET;AACD;AAEAxC,oBAAoB,CAAC+C,YAAY,GAAG;EACnCN,OAAO,EAAE,IAAI;EACbtB,sBAAsB,EAAE;AACzB,CAAC;AAED,eAAenB,oBAAoB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Cell","Picker","jsx","_jsx","BottomSheetPickerCell","props","options","hideCancelButton","onChangeValue","value","cellProps","picker","onCellPress","presentPicker","onChange","newValue","option","find","opt","label","onPress","editable","children","leftAlign","ref","instance"],"sources":["@wordpress/components/src/mobile/bottom-sheet/picker-cell.native.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport Cell from './cell';\nimport Picker from '../picker';\n\nexport default function BottomSheetPickerCell( props ) {\n\tconst { options, hideCancelButton, onChangeValue, value, ...cellProps } =\n\t\tprops;\n\n\tlet picker;\n\n\tconst onCellPress = () => {\n\t\tpicker.presentPicker();\n\t};\n\n\tconst onChange = ( newValue ) => {\n\t\tonChangeValue( newValue );\n\t};\n\n\tconst option = options.find( ( opt ) => opt.value === value );\n\tconst label = option ? option.label : value;\n\n\treturn (\n\t\t<Cell\n\t\t\tonPress={ onCellPress }\n\t\t\teditable={ false }\n\t\t\tvalue={ label }\n\t\t\t{ ...cellProps }\n\t\t>\n\t\t\t<Picker\n\t\t\t\tleftAlign\n\t\t\t\thideCancelButton={ hideCancelButton }\n\t\t\t\tref={ ( instance ) => ( picker = instance ) }\n\t\t\t\toptions={ options }\n\t\t\t\tonChange={ onChange }\n\t\t\t/>\n\t\t</Cell>\n\t);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["Cell","Picker","jsx","_jsx","BottomSheetPickerCell","props","options","hideCancelButton","onChangeValue","value","cellProps","picker","onCellPress","presentPicker","onChange","newValue","option","find","opt","label","onPress","editable","children","leftAlign","ref","instance"],"sources":["@wordpress/components/src/mobile/bottom-sheet/picker-cell.native.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport Cell from './cell';\nimport Picker from '../picker';\n\nexport default function BottomSheetPickerCell( props ) {\n\tconst { options, hideCancelButton, onChangeValue, value, ...cellProps } =\n\t\tprops;\n\n\tlet picker;\n\n\tconst onCellPress = () => {\n\t\tpicker.presentPicker();\n\t};\n\n\tconst onChange = ( newValue ) => {\n\t\tonChangeValue( newValue );\n\t};\n\n\tconst option = options.find( ( opt ) => opt.value === value );\n\tconst label = option ? option.label : value;\n\n\treturn (\n\t\t<Cell\n\t\t\tonPress={ onCellPress }\n\t\t\teditable={ false }\n\t\t\tvalue={ label }\n\t\t\t{ ...cellProps }\n\t\t>\n\t\t\t<Picker\n\t\t\t\tleftAlign\n\t\t\t\thideCancelButton={ hideCancelButton }\n\t\t\t\tref={ ( instance ) => ( picker = instance ) }\n\t\t\t\toptions={ options }\n\t\t\t\tonChange={ onChange }\n\t\t\t/>\n\t\t</Cell>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,QAAQ;AACzB,OAAOC,MAAM,MAAM,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/B,eAAe,SAASC,qBAAqBA,CAAEC,KAAK,EAAG;EACtD,MAAM;IAAEC,OAAO;IAAEC,gBAAgB;IAAEC,aAAa;IAAEC,KAAK;IAAE,GAAGC;EAAU,CAAC,GACtEL,KAAK;EAEN,IAAIM,MAAM;EAEV,MAAMC,WAAW,GAAGA,CAAA,KAAM;IACzBD,MAAM,CAACE,aAAa,CAAC,CAAC;EACvB,CAAC;EAED,MAAMC,QAAQ,GAAKC,QAAQ,IAAM;IAChCP,aAAa,CAAEO,QAAS,CAAC;EAC1B,CAAC;EAED,MAAMC,MAAM,GAAGV,OAAO,CAACW,IAAI,CAAIC,GAAG,IAAMA,GAAG,CAACT,KAAK,KAAKA,KAAM,CAAC;EAC7D,MAAMU,KAAK,GAAGH,MAAM,GAAGA,MAAM,CAACG,KAAK,GAAGV,KAAK;EAE3C,oBACCN,IAAA,CAACH,IAAI;IACJoB,OAAO,EAAGR,WAAa;IACvBS,QAAQ,EAAG,KAAO;IAClBZ,KAAK,EAAGU,KAAO;IAAA,GACVT,SAAS;IAAAY,QAAA,eAEdnB,IAAA,CAACF,MAAM;MACNsB,SAAS;MACThB,gBAAgB,EAAGA,gBAAkB;MACrCiB,GAAG,EAAKC,QAAQ,IAAQd,MAAM,GAAGc,QAAY;MAC7CnB,OAAO,EAAGA,OAAS;MACnBQ,QAAQ,EAAGA;IAAU,CACrB;EAAC,CACG,CAAC;AAET","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","useNavigation","useState","Icon","chevronRight","check","__","sprintf","styles","BottomSheet","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","EMPTY_OPTION","label","BottomSheetSelectControl","icon","options","items","onChange","value","selectedValue","disabled","_items$find","showSubSheet","setShowSubSheet","navigation","onChangeValue","goBack","selectedOption","find","option","openSubSheet","navigate","SubSheet","screenName","navigationButton","Cell","separatorType","onPress","accessibilityRole","accessibilityLabel","accessibilityHint","children","showSheet","NavBar","BackButton","Heading","style","selectControl","map","item","index","customActionButton","leftAlign"],"sources":["@wordpress/components/src/mobile/bottom-sheet-select-control/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useNavigation } from '@react-navigation/native';\nimport { useState } from '@wordpress/element';\nimport { Icon, chevronRight, check } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport BottomSheet from '../bottom-sheet';\n\nconst EMPTY_OPTION = {\n\tlabel: '',\n};\n\nconst BottomSheetSelectControl = ( {\n\tlabel,\n\ticon,\n\toptions: items,\n\tonChange,\n\tvalue: selectedValue,\n\tdisabled,\n} ) => {\n\tconst [ showSubSheet, setShowSubSheet ] = useState( false );\n\tconst navigation = useNavigation();\n\n\tconst onChangeValue = ( value ) => {\n\t\treturn () => {\n\t\t\tgoBack();\n\t\t\tonChange( value );\n\t\t};\n\t};\n\n\tconst selectedOption =\n\t\titems.find( ( option ) => option.value === selectedValue ) ??\n\t\tEMPTY_OPTION;\n\n\tconst goBack = () => {\n\t\tsetShowSubSheet( false );\n\t\tnavigation.goBack();\n\t};\n\n\tconst openSubSheet = () => {\n\t\tnavigation.navigate( BottomSheet.SubSheet.screenName );\n\t\tsetShowSubSheet( true );\n\t};\n\n\treturn (\n\t\t<BottomSheet.SubSheet\n\t\t\tnavigationButton={\n\t\t\t\t<BottomSheet.Cell\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tseparatorType=\"none\"\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tvalue={ selectedOption.label }\n\t\t\t\t\tonPress={ openSubSheet }\n\t\t\t\t\taccessibilityRole=\"button\"\n\t\t\t\t\taccessibilityLabel={ sprintf(\n\t\t\t\t\t\t// translators: 1: Select control button label e.g. \"Button width\". 2: Select control option value e.g: \"Auto, 25%\".\n\t\t\t\t\t\t__( '%1$s. Currently selected: %2$s' ),\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tselectedOption.label\n\t\t\t\t\t) }\n\t\t\t\t\taccessibilityHint={ sprintf(\n\t\t\t\t\t\t// translators: %s: Select control button label e.g. \"Button width\"\n\t\t\t\t\t\t__( 'Navigates to select %s' ),\n\t\t\t\t\t\tlabel\n\t\t\t\t\t) }\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t>\n\t\t\t\t\t{ disabled ? null : <Icon icon={ chevronRight } /> }\n\t\t\t\t</BottomSheet.Cell>\n\t\t\t}\n\t\t\tshowSheet={ showSubSheet }\n\t\t>\n\t\t\t<>\n\t\t\t\t<BottomSheet.NavBar>\n\t\t\t\t\t<BottomSheet.NavBar.BackButton onPress={ goBack } />\n\t\t\t\t\t<BottomSheet.NavBar.Heading>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</BottomSheet.NavBar.Heading>\n\t\t\t\t</BottomSheet.NavBar>\n\t\t\t\t<View style={ styles.selectControl }>\n\t\t\t\t\t{ items.map( ( item, index ) => (\n\t\t\t\t\t\t<BottomSheet.Cell\n\t\t\t\t\t\t\tcustomActionButton\n\t\t\t\t\t\t\tseparatorType=\"none\"\n\t\t\t\t\t\t\tlabel={ item.label }\n\t\t\t\t\t\t\ticon={ item.icon }\n\t\t\t\t\t\t\tonPress={ onChangeValue( item.value ) }\n\t\t\t\t\t\t\tleftAlign\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\taccessibilityRole=\"button\"\n\t\t\t\t\t\t\taccessibilityLabel={\n\t\t\t\t\t\t\t\titem.value === selectedValue\n\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t// translators: %s: The selected option.\n\t\t\t\t\t\t\t\t\t\t\t__( 'Selected: %s' ),\n\t\t\t\t\t\t\t\t\t\t\titem.label\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: item.label\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taccessibilityHint={ __( 'Double tap to select' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ item.value === selectedValue && (\n\t\t\t\t\t\t\t\t<Icon icon={ check }></Icon>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</BottomSheet.Cell>\n\t\t\t\t\t) ) }\n\t\t\t\t</View>\n\t\t\t</>\n\t\t</BottomSheet.SubSheet>\n\t);\n};\n\nexport default BottomSheetSelectControl;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["View","useNavigation","useState","Icon","chevronRight","check","__","sprintf","styles","BottomSheet","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","EMPTY_OPTION","label","BottomSheetSelectControl","icon","options","items","onChange","value","selectedValue","disabled","_items$find","showSubSheet","setShowSubSheet","navigation","onChangeValue","goBack","selectedOption","find","option","openSubSheet","navigate","SubSheet","screenName","navigationButton","Cell","separatorType","onPress","accessibilityRole","accessibilityLabel","accessibilityHint","children","showSheet","NavBar","BackButton","Heading","style","selectControl","map","item","index","customActionButton","leftAlign"],"sources":["@wordpress/components/src/mobile/bottom-sheet-select-control/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useNavigation } from '@react-navigation/native';\nimport { useState } from '@wordpress/element';\nimport { Icon, chevronRight, check } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport BottomSheet from '../bottom-sheet';\n\nconst EMPTY_OPTION = {\n\tlabel: '',\n};\n\nconst BottomSheetSelectControl = ( {\n\tlabel,\n\ticon,\n\toptions: items,\n\tonChange,\n\tvalue: selectedValue,\n\tdisabled,\n} ) => {\n\tconst [ showSubSheet, setShowSubSheet ] = useState( false );\n\tconst navigation = useNavigation();\n\n\tconst onChangeValue = ( value ) => {\n\t\treturn () => {\n\t\t\tgoBack();\n\t\t\tonChange( value );\n\t\t};\n\t};\n\n\tconst selectedOption =\n\t\titems.find( ( option ) => option.value === selectedValue ) ??\n\t\tEMPTY_OPTION;\n\n\tconst goBack = () => {\n\t\tsetShowSubSheet( false );\n\t\tnavigation.goBack();\n\t};\n\n\tconst openSubSheet = () => {\n\t\tnavigation.navigate( BottomSheet.SubSheet.screenName );\n\t\tsetShowSubSheet( true );\n\t};\n\n\treturn (\n\t\t<BottomSheet.SubSheet\n\t\t\tnavigationButton={\n\t\t\t\t<BottomSheet.Cell\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tseparatorType=\"none\"\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tvalue={ selectedOption.label }\n\t\t\t\t\tonPress={ openSubSheet }\n\t\t\t\t\taccessibilityRole=\"button\"\n\t\t\t\t\taccessibilityLabel={ sprintf(\n\t\t\t\t\t\t// translators: 1: Select control button label e.g. \"Button width\". 2: Select control option value e.g: \"Auto, 25%\".\n\t\t\t\t\t\t__( '%1$s. Currently selected: %2$s' ),\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tselectedOption.label\n\t\t\t\t\t) }\n\t\t\t\t\taccessibilityHint={ sprintf(\n\t\t\t\t\t\t// translators: %s: Select control button label e.g. \"Button width\"\n\t\t\t\t\t\t__( 'Navigates to select %s' ),\n\t\t\t\t\t\tlabel\n\t\t\t\t\t) }\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t>\n\t\t\t\t\t{ disabled ? null : <Icon icon={ chevronRight } /> }\n\t\t\t\t</BottomSheet.Cell>\n\t\t\t}\n\t\t\tshowSheet={ showSubSheet }\n\t\t>\n\t\t\t<>\n\t\t\t\t<BottomSheet.NavBar>\n\t\t\t\t\t<BottomSheet.NavBar.BackButton onPress={ goBack } />\n\t\t\t\t\t<BottomSheet.NavBar.Heading>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</BottomSheet.NavBar.Heading>\n\t\t\t\t</BottomSheet.NavBar>\n\t\t\t\t<View style={ styles.selectControl }>\n\t\t\t\t\t{ items.map( ( item, index ) => (\n\t\t\t\t\t\t<BottomSheet.Cell\n\t\t\t\t\t\t\tcustomActionButton\n\t\t\t\t\t\t\tseparatorType=\"none\"\n\t\t\t\t\t\t\tlabel={ item.label }\n\t\t\t\t\t\t\ticon={ item.icon }\n\t\t\t\t\t\t\tonPress={ onChangeValue( item.value ) }\n\t\t\t\t\t\t\tleftAlign\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\taccessibilityRole=\"button\"\n\t\t\t\t\t\t\taccessibilityLabel={\n\t\t\t\t\t\t\t\titem.value === selectedValue\n\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t// translators: %s: The selected option.\n\t\t\t\t\t\t\t\t\t\t\t__( 'Selected: %s' ),\n\t\t\t\t\t\t\t\t\t\t\titem.label\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: item.label\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taccessibilityHint={ __( 'Double tap to select' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ item.value === selectedValue && (\n\t\t\t\t\t\t\t\t<Icon icon={ check }></Icon>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</BottomSheet.Cell>\n\t\t\t\t\t) ) }\n\t\t\t\t</View>\n\t\t\t</>\n\t\t</BottomSheet.SubSheet>\n\t);\n};\n\nexport default BottomSheetSelectControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,cAAc;;AAEnC;AACA;AACA;AACA,SAASC,aAAa,QAAQ,0BAA0B;AACxD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,IAAI,EAAEC,YAAY,EAAEC,KAAK,QAAQ,kBAAkB;AAC5D,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AACjC,OAAOC,WAAW,MAAM,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAE1C,MAAMC,YAAY,GAAG;EACpBC,KAAK,EAAE;AACR,CAAC;AAED,MAAMC,wBAAwB,GAAGA,CAAE;EAClCD,KAAK;EACLE,IAAI;EACJC,OAAO,EAAEC,KAAK;EACdC,QAAQ;EACRC,KAAK,EAAEC,aAAa;EACpBC;AACD,CAAC,KAAM;EAAA,IAAAC,WAAA;EACN,MAAM,CAAEC,YAAY,EAAEC,eAAe,CAAE,GAAG1B,QAAQ,CAAE,KAAM,CAAC;EAC3D,MAAM2B,UAAU,GAAG5B,aAAa,CAAC,CAAC;EAElC,MAAM6B,aAAa,GAAKP,KAAK,IAAM;IAClC,OAAO,MAAM;MACZQ,MAAM,CAAC,CA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,CAACuC,MAAM;QAAAF,QAAA,gBAClBnC,IAAA,CAACF,WAAW,CAACuC,MAAM,CAACC,UAAU;UAACP,OAAO,EAAGX;QAAQ,CAAE,CAAC,eACpDpB,IAAA,CAACF,WAAW,CAACuC,MAAM,CAACE,OAAO;UAAAJ,QAAA,EACxB7B;QAAK,CACoB,CAAC;MAAA,CACV,CAAC,eACrBN,IAAA,CAACX,IAAI;QAACmD,KAAK,EAAG3C,MAAM,CAAC4C,aAAe;QAAAN,QAAA,EACjCzB,KAAK,CAACgC,GAAG,CAAE,CAAEC,IAAI,EAAEC,KAAK,kBACzB5C,IAAA,CAACF,WAAW,CAAC+B,IAAI;UAChBgB,kBAAkB;UAClBf,aAAa,EAAC,MAAM;UACpBxB,KAAK,EAAGqC,IAAI,CAACrC,KAAO;UACpBE,IAAI,EAAGmC,IAAI,CAACnC,IAAM;UAClBuB,OAAO,EAAGZ,aAAa,CAAEwB,IAAI,CAAC/B,KAAM,CAAG;UACvCkC,SAAS;UAETd,iBAAiB,EAAC,QAAQ;UAC1BC,kBAAkB,EACjBU,IAAI,CAAC/B,KAAK,KAAKC,aAAa,GACzBjB,OAAO;UACP;UACAD,EAAE,CAAE,cAAe,CAAC,EACpBgD,IAAI,CAACrC,KACL,CAAC,GACDqC,IAAI,CAACrC,KACR;UACD4B,iBAAiB,EAAGvC,EAAE,CAAE,sBAAuB,CAAG;UAAAwC,QAAA,EAEhDQ,IAAI,CAAC/B,KAAK,KAAKC,aAAa,iBAC7Bb,IAAA,CAACR,IAAI;YAACgB,IAAI,EAAGd;UAAO,CAAO;QAC3B,GAfKkD,KAgBW,CACjB;MAAC,CACE,CAAC;IAAA,CACN;EAAC,CACkB,CAAC;AAEzB,CAAC;AAED,eAAerC,wBAAwB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","Text","TouchableWithoutFeedback","__","useState","useContext","usePreferredColorSchemeStyle","useRoute","useNavigation","ColorPalette","ColorIndicator","NavBar","SegmentedControls","colorsUtils","PanelBody","BottomSheetContext","ColorControl","styles","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","HIT_SLOP","top","bottom","left","right","PaletteScreen","route","navigation","shouldEnableBottomSheetScroll","label","onColorChange","onGradientChange","onColorCleared","colorValue","defaultSettings","hideNavigation","params","segments","isGradient","currentValue","setCurrentValue","isGradientColor","selectedSegmentIndex","currentSegment","setCurrentSegment","isGradientSegment","currentSegmentColors","colors","gradients","allAvailableColors","allAvailableGradients","flatMap","filter","Boolean","horizontalSeparatorStyle","horizontalSeparator","horizontalSeparatorDark","clearButtonStyle","clearButton","clearButtonDark","selectedColorTextStyle","colorText","colorTextDark","isSolidSegment","isCustomGadientShown","setColor","color","onClear","undefined","onCustomPress","navigate","screens","picker","gradientPicker","getClearButton","accessibilityLabel","onPress","hitSlop","children","style","clearButtonContainer","getFooter","segmentHandler","selectedIndex","indexOf","addonLeft","colorIndicator","addonRight","footer","flex","maxFontSizeMultiplier","selectable","toUpperCase","selectColorText","BackButton","goBack","Heading","colorPalettes","map","palette","paletteKey","paletteSettings","allColors","allGradients","enableCustomColor","name","activeColor","withColorIndicator"],"sources":["@wordpress/components/src/mobile/color-settings/palette.screen.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text, TouchableWithoutFeedback } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState, useContext } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { useRoute, useNavigation } from '@react-navigation/native';\n\n/**\n * Internal dependencies\n */\nimport ColorPalette from '../../color-palette';\nimport ColorIndicator from '../../color-indicator';\nimport NavBar from '../bottom-sheet/nav-bar';\nimport SegmentedControls from '../segmented-control';\nimport { colorsUtils } from './utils';\nimport PanelBody from '../../panel/body';\nimport { BottomSheetContext } from '../bottom-sheet/bottom-sheet-context';\nimport ColorControl from '../../color-control';\n\nimport styles from './style.scss';\n\nconst HIT_SLOP = { top: 8, bottom: 8, left: 8, right: 8 };\n\nconst PaletteScreen = () => {\n\tconst route = useRoute();\n\tconst navigation = useNavigation();\n\tconst { shouldEnableBottomSheetScroll } = useContext( BottomSheetContext );\n\tconst {\n\t\tlabel,\n\t\tonColorChange,\n\t\tonGradientChange,\n\t\tonColorCleared,\n\t\tcolorValue,\n\t\tdefaultSettings,\n\t\thideNavigation = false,\n\t} = route.params || {};\n\tconst { segments, isGradient } = colorsUtils;\n\tconst [ currentValue, setCurrentValue ] = useState( colorValue );\n\tconst isGradientColor = isGradient( currentValue );\n\tconst selectedSegmentIndex = isGradientColor ? 1 : 0;\n\n\tconst [ currentSegment, setCurrentSegment ] = useState(\n\t\tsegments[ selectedSegmentIndex ]\n\t);\n\tconst isGradientSegment = currentSegment === colorsUtils.segments[ 1 ];\n\tconst currentSegmentColors = ! isGradientSegment\n\t\t? defaultSettings.colors\n\t\t: defaultSettings.gradients;\n\tconst allAvailableColors = defaultSettings?.allAvailableColors || [];\n\tconst allAvailableGradients = currentSegmentColors\n\t\t.flatMap( ( { gradients } ) => gradients )\n\t\t.filter( Boolean );\n\n\tconst horizontalSeparatorStyle = usePreferredColorSchemeStyle(\n\t\tstyles.horizontalSeparator,\n\t\tstyles.horizontalSeparatorDark\n\t);\n\tconst clearButtonStyle = usePreferredColorSchemeStyle(\n\t\tstyles.clearButton,\n\t\tstyles.clearButtonDark\n\t);\n\tconst selectedColorTextStyle = usePreferredColorSchemeStyle(\n\t\tstyles.colorText,\n\t\tstyles.colorTextDark\n\t);\n\n\tconst isSolidSegment = currentSegment === segments[ 0 ];\n\tconst isCustomGadientShown = ! isSolidSegment && isGradientColor;\n\n\tconst setColor = ( color ) => {\n\t\tsetCurrentValue( color );\n\t\tif ( isSolidSegment && onColorChange && onGradientChange ) {\n\t\t\tonColorChange( color );\n\t\t} else if ( isSolidSegment && onColorChange ) {\n\t\t\tonColorChange( color );\n\t\t} else if ( ! isSolidSegment && onGradientChange ) {\n\t\t\tonGradientChange( color );\n\t\t}\n\t};\n\n\tfunction onClear() {\n\t\tsetCurrentValue( undefined );\n\n\t\tif ( onColorCleared ) {\n\t\t\tonColorCleared();\n\t\t}\n\t}\n\n\tfunction onCustomPress() {\n\t\tif ( isSolidSegment ) {\n\t\t\tnavigation.navigate( colorsUtils.screens.picker, {\n\t\t\t\tcurrentValue,\n\t\t\t\tsetColor,\n\t\t\t} );\n\t\t} else {\n\t\t\tnavigation.navigate( colorsUtils.screens.gradientPicker, {\n\t\t\t\tsetColor,\n\t\t\t\tisGradientColor,\n\t\t\t\tcurrentValue,\n\t\t\t} );\n\t\t}\n\t}\n\n\tfunction getClearButton() {\n\t\treturn (\n\t\t\t<TouchableWithoutFeedback\n\t\t\t\taccessibilityLabel={ __( 'Clear selected color' ) }\n\t\t\t\tonPress={ onClear }\n\t\t\t\thitSlop={ HIT_SLOP }\n\t\t\t>\n\t\t\t\t<View style={ styles.clearButtonContainer }>\n\t\t\t\t\t<Text style={ clearButtonStyle }>{ __( 'Reset' ) }</Text>\n\t\t\t\t</View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t);\n\t}\n\n\tfunction getFooter() {\n\t\tif ( onGradientChange ) {\n\t\t\treturn (\n\t\t\t\t<SegmentedControls\n\t\t\t\t\tsegments={ segments }\n\t\t\t\t\tsegmentHandler={ setCurrentSegment }\n\t\t\t\t\tselectedIndex={ segments.indexOf( currentSegment ) }\n\t\t\t\t\taddonLeft={\n\t\t\t\t\t\tcurrentValue && (\n\t\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\t\tcolor={ currentValue }\n\t\t\t\t\t\t\t\tstyle={ styles.colorIndicator }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\taddonRight={ currentValue && getClearButton() }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t\treturn (\n\t\t\t<View style={ styles.footer }>\n\t\t\t\t<View style={ styles.flex }>\n\t\t\t\t\t{ currentValue && (\n\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\tcolor={ currentValue }\n\t\t\t\t\t\t\tstyle={ styles.colorIndicator }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</View>\n\t\t\t\t{ currentValue ? (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tstyle={ selectedColorTextStyle }\n\t\t\t\t\t\tmaxFontSizeMultiplier={ 2 }\n\t\t\t\t\t\tselectable\n\t\t\t\t\t>\n\t\t\t\t\t\t{ currentValue.toUpperCase() }\n\t\t\t\t\t</Text>\n\t\t\t\t) : (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tstyle={ styles.selectColorText }\n\t\t\t\t\t\tmaxFontSizeMultiplier={ 2 }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Select a color above' ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t\t<View style={ styles.flex }>\n\t\t\t\t\t{ currentValue && getClearButton() }\n\t\t\t\t</View>\n\t\t\t</View>\n\t\t);\n\t}\n\treturn (\n\t\t<View>\n\t\t\t{ ! hideNavigation && (\n\t\t\t\t<NavBar>\n\t\t\t\t\t<NavBar.BackButton onPress={ navigation.goBack } />\n\t\t\t\t\t<NavBar.Heading>{ label } </NavBar.Heading>\n\t\t\t\t</NavBar>\n\t\t\t) }\n\n\t\t\t<View style={ styles.colorPalettes }>\n\t\t\t\t{ currentSegmentColors.map( ( palette, paletteKey ) => {\n\t\t\t\t\tconst paletteSettings = {\n\t\t\t\t\t\tcolors: palette.colors,\n\t\t\t\t\t\tgradients: palette.gradients,\n\t\t\t\t\t\tallColors: allAvailableColors,\n\t\t\t\t\t\tallGradients: allAvailableGradients,\n\t\t\t\t\t};\n\t\t\t\t\t// Limit to show the custom indicator to the first available palette\n\t\t\t\t\tconst enableCustomColor = paletteKey === 0;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\tenableCustomColor={ enableCustomColor }\n\t\t\t\t\t\t\tlabel={ palette.name }\n\t\t\t\t\t\t\tkey={ paletteKey }\n\t\t\t\t\t\t\tsetColor={ setColor }\n\t\t\t\t\t\t\tactiveColor={ currentValue }\n\t\t\t\t\t\t\tisGradientColor={ isGradientColor }\n\t\t\t\t\t\t\tcurrentSegment={ currentSegment }\n\t\t\t\t\t\t\tonCustomPress={ onCustomPress }\n\t\t\t\t\t\t\tshouldEnableBottomSheetScroll={\n\t\t\t\t\t\t\t\tshouldEnableBottomSheetScroll\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefaultSettings={ paletteSettings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</View>\n\n\t\t\t{ isCustomGadientShown && (\n\t\t\t\t<>\n\t\t\t\t\t<View style={ horizontalSeparatorStyle } />\n\t\t\t\t\t<PanelBody>\n\t\t\t\t\t\t<ColorControl\n\t\t\t\t\t\t\tlabel={ __( 'Customize Gradient' ) }\n\t\t\t\t\t\t\tonPress={ onCustomPress }\n\t\t\t\t\t\t\twithColorIndicator={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<View style={ horizontalSeparatorStyle } />\n\t\t\t{ getFooter() }\n\t\t</View>\n\t);\n};\n\nexport default PaletteScreen;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,IAAI,EAAEC,wBAAwB,QAAQ,cAAc;;AAEnE;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,UAAU,QAAQ,oBAAoB;AACzD,SAASC,4BAA4B,QAAQ,oBAAoB;AACjE,SAASC,QAAQ,EAAEC,aAAa,QAAQ,0BAA0B;;AAElE;AACA;AACA;AACA,OAAOC,YAAY,MAAM,qBAAqB;AAC9C,OAAOC,cAAc,MAAM,uBAAuB;AAClD,OAAOC,MAAM,MAAM,yBAAyB;AAC5C,OAAOC,iBAAiB,MAAM,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OAAO,CAACpD,MAAM;UACtBC,SAAS,EAAEmD,OAAO,CAACnD,SAAS;UAC5BsD,SAAS,EAAErD,kBAAkB;UAC7BsD,YAAY,EAAErD;QACf,CAAC;QACD;QACA,MAAMsD,iBAAiB,GAAGJ,UAAU,KAAK,CAAC;QAE1C,oBACCrF,IAAA,CAACV,YAAY;UACZmG,iBAAiB,EAAGA,iBAAmB;UACvC3E,KAAK,EAAGsE,OAAO,CAACM,IAAM;UAEtBxC,QAAQ,EAAGA,QAAU;UACrByC,WAAW,EAAGnE,YAAc;UAC5BE,eAAe,EAAGA,eAAiB;UACnCE,cAAc,EAAGA,cAAgB;UACjC0B,aAAa,EAAGA,aAAe;UAC/BzC,6BAA6B,EAC5BA,6BACA;UACDM,eAAe,EAAGmE;QAAiB,GAT7BD,UAUN,CAAC;MAEJ,CAAE;IAAC,CACE,CAAC,EAELpC,oBAAoB,iBACrB/C,KAAA,CAAAE,SAAA;MAAA2D,QAAA,gBACC/D,IAAA,CAACnB,IAAI;QAACmF,KAAK,EAAGzB;MAA0B,CAAE,CAAC,eAC3CvC,IAAA,CAACL,SAAS;QAAAoE,QAAA,eACT/D,IAAA,CAACH,YAAY;UACZiB,KAAK,EAAG9B,EAAE,CAAE,oBAAqB,CAAG;UACpC6E,OAAO,EAAGP,aAAe;UACzBsC,kBAAkB,EAAG;QAAO,CAC5B;MAAC,CACQ,CAAC;IAAA,CACX,CACF,eACD5F,IAAA,CAACnB,IAAI;MAACmF,KAAK,EAAGzB;IAA0B,CAAE,CAAC,EACzC2B,SAAS,CAAC,CAAC;EAAA,CACR,CAAC;AAET,CAAC;AAED,eAAexD,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["View","Text","TouchableWithoutFeedback","__","useState","useContext","usePreferredColorSchemeStyle","useRoute","useNavigation","ColorPalette","ColorIndicator","NavBar","SegmentedControls","colorsUtils","PanelBody","BottomSheetContext","ColorControl","styles","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","HIT_SLOP","top","bottom","left","right","PaletteScreen","route","navigation","shouldEnableBottomSheetScroll","label","onColorChange","onGradientChange","onColorCleared","colorValue","defaultSettings","hideNavigation","params","segments","isGradient","currentValue","setCurrentValue","isGradientColor","selectedSegmentIndex","currentSegment","setCurrentSegment","isGradientSegment","currentSegmentColors","colors","gradients","allAvailableColors","allAvailableGradients","flatMap","filter","Boolean","horizontalSeparatorStyle","horizontalSeparator","horizontalSeparatorDark","clearButtonStyle","clearButton","clearButtonDark","selectedColorTextStyle","colorText","colorTextDark","isSolidSegment","isCustomGadientShown","setColor","color","onClear","undefined","onCustomPress","navigate","screens","picker","gradientPicker","getClearButton","accessibilityLabel","onPress","hitSlop","children","style","clearButtonContainer","getFooter","segmentHandler","selectedIndex","indexOf","addonLeft","colorIndicator","addonRight","footer","flex","maxFontSizeMultiplier","selectable","toUpperCase","selectColorText","BackButton","goBack","Heading","colorPalettes","map","palette","paletteKey","paletteSettings","allColors","allGradients","enableCustomColor","name","activeColor","withColorIndicator"],"sources":["@wordpress/components/src/mobile/color-settings/palette.screen.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text, TouchableWithoutFeedback } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState, useContext } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { useRoute, useNavigation } from '@react-navigation/native';\n\n/**\n * Internal dependencies\n */\nimport ColorPalette from '../../color-palette';\nimport ColorIndicator from '../../color-indicator';\nimport NavBar from '../bottom-sheet/nav-bar';\nimport SegmentedControls from '../segmented-control';\nimport { colorsUtils } from './utils';\nimport PanelBody from '../../panel/body';\nimport { BottomSheetContext } from '../bottom-sheet/bottom-sheet-context';\nimport ColorControl from '../../color-control';\n\nimport styles from './style.scss';\n\nconst HIT_SLOP = { top: 8, bottom: 8, left: 8, right: 8 };\n\nconst PaletteScreen = () => {\n\tconst route = useRoute();\n\tconst navigation = useNavigation();\n\tconst { shouldEnableBottomSheetScroll } = useContext( BottomSheetContext );\n\tconst {\n\t\tlabel,\n\t\tonColorChange,\n\t\tonGradientChange,\n\t\tonColorCleared,\n\t\tcolorValue,\n\t\tdefaultSettings,\n\t\thideNavigation = false,\n\t} = route.params || {};\n\tconst { segments, isGradient } = colorsUtils;\n\tconst [ currentValue, setCurrentValue ] = useState( colorValue );\n\tconst isGradientColor = isGradient( currentValue );\n\tconst selectedSegmentIndex = isGradientColor ? 1 : 0;\n\n\tconst [ currentSegment, setCurrentSegment ] = useState(\n\t\tsegments[ selectedSegmentIndex ]\n\t);\n\tconst isGradientSegment = currentSegment === colorsUtils.segments[ 1 ];\n\tconst currentSegmentColors = ! isGradientSegment\n\t\t? defaultSettings.colors\n\t\t: defaultSettings.gradients;\n\tconst allAvailableColors = defaultSettings?.allAvailableColors || [];\n\tconst allAvailableGradients = currentSegmentColors\n\t\t.flatMap( ( { gradients } ) => gradients )\n\t\t.filter( Boolean );\n\n\tconst horizontalSeparatorStyle = usePreferredColorSchemeStyle(\n\t\tstyles.horizontalSeparator,\n\t\tstyles.horizontalSeparatorDark\n\t);\n\tconst clearButtonStyle = usePreferredColorSchemeStyle(\n\t\tstyles.clearButton,\n\t\tstyles.clearButtonDark\n\t);\n\tconst selectedColorTextStyle = usePreferredColorSchemeStyle(\n\t\tstyles.colorText,\n\t\tstyles.colorTextDark\n\t);\n\n\tconst isSolidSegment = currentSegment === segments[ 0 ];\n\tconst isCustomGadientShown = ! isSolidSegment && isGradientColor;\n\n\tconst setColor = ( color ) => {\n\t\tsetCurrentValue( color );\n\t\tif ( isSolidSegment && onColorChange && onGradientChange ) {\n\t\t\tonColorChange( color );\n\t\t} else if ( isSolidSegment && onColorChange ) {\n\t\t\tonColorChange( color );\n\t\t} else if ( ! isSolidSegment && onGradientChange ) {\n\t\t\tonGradientChange( color );\n\t\t}\n\t};\n\n\tfunction onClear() {\n\t\tsetCurrentValue( undefined );\n\n\t\tif ( onColorCleared ) {\n\t\t\tonColorCleared();\n\t\t}\n\t}\n\n\tfunction onCustomPress() {\n\t\tif ( isSolidSegment ) {\n\t\t\tnavigation.navigate( colorsUtils.screens.picker, {\n\t\t\t\tcurrentValue,\n\t\t\t\tsetColor,\n\t\t\t} );\n\t\t} else {\n\t\t\tnavigation.navigate( colorsUtils.screens.gradientPicker, {\n\t\t\t\tsetColor,\n\t\t\t\tisGradientColor,\n\t\t\t\tcurrentValue,\n\t\t\t} );\n\t\t}\n\t}\n\n\tfunction getClearButton() {\n\t\treturn (\n\t\t\t<TouchableWithoutFeedback\n\t\t\t\taccessibilityLabel={ __( 'Clear selected color' ) }\n\t\t\t\tonPress={ onClear }\n\t\t\t\thitSlop={ HIT_SLOP }\n\t\t\t>\n\t\t\t\t<View style={ styles.clearButtonContainer }>\n\t\t\t\t\t<Text style={ clearButtonStyle }>{ __( 'Reset' ) }</Text>\n\t\t\t\t</View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t);\n\t}\n\n\tfunction getFooter() {\n\t\tif ( onGradientChange ) {\n\t\t\treturn (\n\t\t\t\t<SegmentedControls\n\t\t\t\t\tsegments={ segments }\n\t\t\t\t\tsegmentHandler={ setCurrentSegment }\n\t\t\t\t\tselectedIndex={ segments.indexOf( currentSegment ) }\n\t\t\t\t\taddonLeft={\n\t\t\t\t\t\tcurrentValue && (\n\t\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\t\tcolor={ currentValue }\n\t\t\t\t\t\t\t\tstyle={ styles.colorIndicator }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\taddonRight={ currentValue && getClearButton() }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t\treturn (\n\t\t\t<View style={ styles.footer }>\n\t\t\t\t<View style={ styles.flex }>\n\t\t\t\t\t{ currentValue && (\n\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\tcolor={ currentValue }\n\t\t\t\t\t\t\tstyle={ styles.colorIndicator }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</View>\n\t\t\t\t{ currentValue ? (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tstyle={ selectedColorTextStyle }\n\t\t\t\t\t\tmaxFontSizeMultiplier={ 2 }\n\t\t\t\t\t\tselectable\n\t\t\t\t\t>\n\t\t\t\t\t\t{ currentValue.toUpperCase() }\n\t\t\t\t\t</Text>\n\t\t\t\t) : (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tstyle={ styles.selectColorText }\n\t\t\t\t\t\tmaxFontSizeMultiplier={ 2 }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Select a color above' ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t\t<View style={ styles.flex }>\n\t\t\t\t\t{ currentValue && getClearButton() }\n\t\t\t\t</View>\n\t\t\t</View>\n\t\t);\n\t}\n\treturn (\n\t\t<View>\n\t\t\t{ ! hideNavigation && (\n\t\t\t\t<NavBar>\n\t\t\t\t\t<NavBar.BackButton onPress={ navigation.goBack } />\n\t\t\t\t\t<NavBar.Heading>{ label } </NavBar.Heading>\n\t\t\t\t</NavBar>\n\t\t\t) }\n\n\t\t\t<View style={ styles.colorPalettes }>\n\t\t\t\t{ currentSegmentColors.map( ( palette, paletteKey ) => {\n\t\t\t\t\tconst paletteSettings = {\n\t\t\t\t\t\tcolors: palette.colors,\n\t\t\t\t\t\tgradients: palette.gradients,\n\t\t\t\t\t\tallColors: allAvailableColors,\n\t\t\t\t\t\tallGradients: allAvailableGradients,\n\t\t\t\t\t};\n\t\t\t\t\t// Limit to show the custom indicator to the first available palette\n\t\t\t\t\tconst enableCustomColor = paletteKey === 0;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\tenableCustomColor={ enableCustomColor }\n\t\t\t\t\t\t\tlabel={ palette.name }\n\t\t\t\t\t\t\tkey={ paletteKey }\n\t\t\t\t\t\t\tsetColor={ setColor }\n\t\t\t\t\t\t\tactiveColor={ currentValue }\n\t\t\t\t\t\t\tisGradientColor={ isGradientColor }\n\t\t\t\t\t\t\tcurrentSegment={ currentSegment }\n\t\t\t\t\t\t\tonCustomPress={ onCustomPress }\n\t\t\t\t\t\t\tshouldEnableBottomSheetScroll={\n\t\t\t\t\t\t\t\tshouldEnableBottomSheetScroll\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefaultSettings={ paletteSettings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</View>\n\n\t\t\t{ isCustomGadientShown && (\n\t\t\t\t<>\n\t\t\t\t\t<View style={ horizontalSeparatorStyle } />\n\t\t\t\t\t<PanelBody>\n\t\t\t\t\t\t<ColorControl\n\t\t\t\t\t\t\tlabel={ __( 'Customize Gradient' ) }\n\t\t\t\t\t\t\tonPress={ onCustomPress }\n\t\t\t\t\t\t\twithColorIndicator={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<View style={ horizontalSeparatorStyle } />\n\t\t\t{ getFooter() }\n\t\t</View>\n\t);\n};\n\nexport default PaletteScreen;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,IAAI,EAAEC,wBAAwB,QAAQ,cAAc;;AAEnE;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,UAAU,QAAQ,oBAAoB;AACzD,SAASC,4BAA4B,QAAQ,oBAAoB;AACjE,SAASC,QAAQ,EAAEC,aAAa,QAAQ,0BAA0B;;AAElE;AACA;AACA;AACA,OAAOC,YAAY,MAAM,qBAAqB;AAC9C,OAAOC,cAAc,MAAM,uBAAuB;AAClD,OAAOC,MAAM,MAAM,yBAAyB;AAC5C,OAAOC,iBAAiB,MAAM,sBAAsB;AACpD,SAASC,WAAW,QAAQ,SAAS;AACrC,OAAOC,SAAS,MAAM,kBAAkB;AACxC,SAASC,kBAA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;UAC7BsD,YAAY,EAAErD;QACf,CAAC;QACD;QACA,MAAMsD,iBAAiB,GAAGJ,UAAU,KAAK,CAAC;QAE1C,oBACCrF,IAAA,CAACV,YAAY;UACZmG,iBAAiB,EAAGA,iBAAmB;UACvC3E,KAAK,EAAGsE,OAAO,CAACM,IAAM;UAEtBxC,QAAQ,EAAGA,QAAU;UACrByC,WAAW,EAAGnE,YAAc;UAC5BE,eAAe,EAAGA,eAAiB;UACnCE,cAAc,EAAGA,cAAgB;UACjC0B,aAAa,EAAGA,aAAe;UAC/BzC,6BAA6B,EAC5BA,6BACA;UACDM,eAAe,EAAGmE;QAAiB,GAT7BD,UAUN,CAAC;MAEJ,CAAE;IAAC,CACE,CAAC,EAELpC,oBAAoB,iBACrB/C,KAAA,CAAAE,SAAA;MAAA2D,QAAA,gBACC/D,IAAA,CAACnB,IAAI;QAACmF,KAAK,EAAGzB;MAA0B,CAAE,CAAC,eAC3CvC,IAAA,CAACL,SAAS;QAAAoE,QAAA,eACT/D,IAAA,CAACH,YAAY;UACZiB,KAAK,EAAG9B,EAAE,CAAE,oBAAqB,CAAG;UACpC6E,OAAO,EAAGP,aAAe;UACzBsC,kBAAkB,EAAG;QAAO,CAC5B;MAAC,CACQ,CAAC;IAAA,CACX,CACF,eACD5F,IAAA,CAACnB,IAAI;MAACmF,KAAK,EAAGzB;IAA0B,CAAE,CAAC,EACzC2B,SAAS,CAAC,CAAC;EAAA,CACR,CAAC;AAET,CAAC;AAED,eAAexD,aAAa","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","Platform","RNLinearGradient","gradientParser","RadialGradient","Stop","SVG","Defs","Rect","useResizeObserver","useMemo","styles","colorsUtils","jsx","_jsx","jsxs","_jsxs","getGradientAngle","gradientValue","angleBase","matchAngle","angle","exec","angleType","includes","parseFloat","getGradientColorGroup","colorNeedParenthesis","excludeSideOrCorner","modifiedGradientValue","replace","concat","parse","map","gradient","colorStops","color","index","type","value","length","fallbackLength","colorLength","join","getGradientBaseColors","colorGroup","getColorLocations","location","Number","Gradient","style","angleCenter","x","y","children","otherProps","resizeObserver","sizes","width","height","isGradient","getGradientType","gradients","locations","colors","isLinearGradient","linear","useAngle","overflow","radialGradientContent","id","gradientUnits","rx","ry","cy","OS","group","offset","stopColor","stopOpacity","fill"],"sources":["@wordpress/components/src/mobile/gradient/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Platform } from 'react-native';\nimport RNLinearGradient from 'react-native-linear-gradient';\nimport gradientParser from 'gradient-parser';\n/**\n * WordPress dependencies\n */\nimport { RadialGradient, Stop, SVG, Defs, Rect } from '@wordpress/primitives';\nimport { useResizeObserver } from '@wordpress/compose';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport { colorsUtils } from '../color-settings/utils';\n\nexport function getGradientAngle( gradientValue ) {\n\tconst angleBase = 45;\n\tconst matchAngle = /\\(((\\d+deg)|(to\\s[^,]+))/;\n\tconst angle = matchAngle.exec( gradientValue )\n\t\t? matchAngle.exec( gradientValue )[ 1 ]\n\t\t: '180deg';\n\n\tconst angleType = angle.includes( 'deg' ) ? 'angle' : 'sideOrCorner';\n\n\tif ( angleType === 'sideOrCorner' ) {\n\t\tswitch ( angle ) {\n\t\t\tcase 'to top':\n\t\t\t\treturn 0;\n\t\t\tcase 'to top right':\n\t\t\tcase 'to right top':\n\t\t\t\treturn angleBase;\n\t\t\tcase 'to right':\n\t\t\t\treturn 2 * angleBase;\n\t\t\tcase 'to bottom right':\n\t\t\tcase 'to right bottom':\n\t\t\t\treturn 3 * angleBase;\n\t\t\tcase 'to bottom':\n\t\t\t\treturn 4 * angleBase;\n\t\t\tcase 'to bottom left':\n\t\t\tcase 'to left bottom':\n\t\t\t\treturn 5 * angleBase;\n\t\t\tcase 'to left':\n\t\t\t\treturn 6 * angleBase;\n\t\t\tcase 'to top left':\n\t\t\tcase 'to left top':\n\t\t\t\treturn 7 * angleBase;\n\t\t}\n\t} else if ( angleType === 'angle' ) {\n\t\treturn parseFloat( angle );\n\t} else {\n\t\treturn 4 * angleBase;\n\t}\n}\n\nexport function getGradientColorGroup( gradientValue ) {\n\tconst colorNeedParenthesis = [ 'rgb', 'rgba' ];\n\n\tconst excludeSideOrCorner = /linear-gradient\\(to\\s+([a-z\\s]+,)/;\n\n\t// Parser has some difficulties with angle defined as a side or corner (e.g. `to left`)\n\t// so it's going to be excluded in order to matching color groups.\n\tconst modifiedGradientValue = gradientValue.replace(\n\t\texcludeSideOrCorner,\n\t\t'linear-gradient('\n\t);\n\n\treturn [].concat(\n\t\t...gradientParser.parse( modifiedGradientValue )?.map( ( gradient ) =>\n\t\t\tgradient.colorStops?.map( ( color, index ) => {\n\t\t\t\tconst { type, value, length } = color;\n\t\t\t\tconst fallbackLength = `${\n\t\t\t\t\t100 * ( index / ( gradient.colorStops.length - 1 ) )\n\t\t\t\t}%`;\n\t\t\t\tconst colorLength = length\n\t\t\t\t\t? `${ length.value }${ length.type }`\n\t\t\t\t\t: fallbackLength;\n\n\t\t\t\tif ( colorNeedParenthesis.includes( type ) ) {\n\t\t\t\t\treturn [ `${ type }(${ value.join( ',' ) })`, colorLength ];\n\t\t\t\t} else if ( type === 'literal' ) {\n\t\t\t\t\treturn [ value, colorLength ];\n\t\t\t\t}\n\t\t\t\treturn [ `#${ value }`, colorLength ];\n\t\t\t} )\n\t\t)\n\t);\n}\n\nexport function getGradientBaseColors( colorGroup ) {\n\treturn colorGroup.map( ( color ) => color[ 0 ] );\n}\n\nexport function getColorLocations( colorGroup ) {\n\treturn colorGroup.map(\n\t\t( location ) => Number( location[ 1 ].replace( '%', '' ) ) / 100\n\t);\n}\n\nfunction Gradient( {\n\tgradientValue,\n\tstyle,\n\tangleCenter = { x: 0.5, y: 0.5 },\n\tchildren,\n\t...otherProps\n} ) {\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\tconst { width = 0, height = 0 } = sizes || {};\n\tconst { isGradient, getGradientType, gradients } = colorsUtils;\n\n\tconst colorGroup = useMemo(\n\t\t() => getGradientColorGroup( gradientValue ),\n\t\t[ gradientValue ]\n\t);\n\n\tconst locations = useMemo(\n\t\t() => getColorLocations( colorGroup ),\n\t\t[ colorGroup ]\n\t);\n\n\tconst colors = useMemo(\n\t\t() => getGradientBaseColors( colorGroup ),\n\t\t[ colorGroup ]\n\t);\n\n\tif ( ! gradientValue || ! isGradient( gradientValue ) ) {\n\t\treturn null;\n\t}\n\n\tconst isLinearGradient =\n\t\tgetGradientType( gradientValue ) === gradients.linear;\n\n\tif ( isLinearGradient ) {\n\t\treturn (\n\t\t\t<RNLinearGradient\n\t\t\t\tcolors={ colors }\n\t\t\t\tuseAngle\n\t\t\t\tangle={ getGradientAngle( gradientValue ) }\n\t\t\t\tlocations={ locations }\n\t\t\t\tangleCenter={ angleCenter }\n\t\t\t\tstyle={ style }\n\t\t\t\t{ ...otherProps }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</RNLinearGradient>\n\t\t);\n\t}\n\n\treturn (\n\t\t<View style={ [ style, styles.overflow ] }>\n\t\t\t<View style={ styles.radialGradientContent }>{ children }</View>\n\t\t\t{ resizeObserver }\n\t\t\t<SVG>\n\t\t\t\t<Defs>\n\t\t\t\t\t<RadialGradient\n\t\t\t\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\t\t\t\tid=\"radialGradient\"\n\t\t\t\t\t\tgradientUnits=\"userSpaceOnUse\"\n\t\t\t\t\t\trx=\"70%\"\n\t\t\t\t\t\try=\"70%\"\n\t\t\t\t\t\tcy={ Platform.OS === 'android' ? width / 2 : '50%' }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ colorGroup.map( ( group ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<Stop\n\t\t\t\t\t\t\t\t\toffset={ group[ 1 ] }\n\t\t\t\t\t\t\t\t\tstopColor={ group[ 0 ] }\n\t\t\t\t\t\t\t\t\tstopOpacity=\"1\"\n\t\t\t\t\t\t\t\t\tkey={ `${ group[ 1 ] }-${ group[ 0 ] }` }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t</RadialGradient>\n\t\t\t\t</Defs>\n\t\t\t\t<Rect\n\t\t\t\t\theight={ height }\n\t\t\t\t\twidth={ width }\n\t\t\t\t\tfill=\"url(#radialGradient)\"\n\t\t\t\t/>\n\t\t\t</SVG>\n\t\t</View>\n\t);\n}\n\nexport default Gradient;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,QAAQ,QAAQ,cAAc;AAC7C,OAAOC,gBAAgB,MAAM,8BAA8B;AAC3D,OAAOC,cAAc,MAAM,iBAAiB;AAC5C;AACA;AACA;AACA,SAASC,cAAc,EAAEC,IAAI,EAAEC,GAAG,EAAEC,IAAI,EAAEC,IAAI,QAAQ,uBAAuB;AAC7E,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AACjC,SAASC,WAAW,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEtD,OAAO,SAASC,gBAAgBA,CAAEC,aAAa,EAAG;EACjD,MAAMC,SAAS,GAAG,EAAE;EACpB,MAAMC,UAAU,GAAG,0BAA0B;EAC7C,MAAMC,KAAK,GAAGD,UAAU,CAACE,IAAI,CAAEJ,aAAc,CAAC,GAC3CE,UAAU,CAACE,IAAI,CAAEJ,aAAc,CAAC,CAAE,CAAC,CAAE,GACrC,QAAQ;EAEX,MAAMK,SAAS,GAAGF,KAAK,CAACG,QAAQ,CAAE,KAAM,CAAC,GAAG,OAAO,GAAG,cAAc;EAEpE,IAAKD,SAAS,KAAK,cAAc,EAAG;IACnC,QAASF,KAAK;MACb,KAAK,QAAQ;QACZ,OAAO,CAAC;MACT,KAAK,cAAc;M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KAAK,SAAS,GAAGjB,KAAK,GAAG,CAAC,GAAG,KAAO;UAAAJ,QAAA,EAElDT,UAAU,CAACZ,GAAG,CAAI2C,KAAK,IAAM;YAC9B,oBACC9D,IAAA,CAACT,IAAI;cACJwE,MAAM,EAAGD,KAAK,CAAE,CAAC,CAAI;cACrBE,SAAS,EAAGF,KAAK,CAAE,CAAC,CAAI;cACxBG,WAAW,EAAC;YAAG,GACT,GAAIH,KAAK,CAAE,CAAC,CAAE,IAAMA,KAAK,CAAE,CAAC,CAAE,EACpC,CAAC;UAEJ,CAAE;QAAC,CACY;MAAC,CACZ,CAAC,eACP9D,IAAA,CAACN,IAAI;QACJmD,MAAM,EAAGA,MAAQ;QACjBD,KAAK,EAAGA,KAAO;QACfsB,IAAI,EAAC;MAAsB,CAC3B,CAAC;IAAA,CACE,CAAC;EAAA,CACD,CAAC;AAET;AAEA,eAAe/B,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["View","Platform","RNLinearGradient","gradientParser","RadialGradient","Stop","SVG","Defs","Rect","useResizeObserver","useMemo","styles","colorsUtils","jsx","_jsx","jsxs","_jsxs","getGradientAngle","gradientValue","angleBase","matchAngle","angle","exec","angleType","includes","parseFloat","getGradientColorGroup","colorNeedParenthesis","excludeSideOrCorner","modifiedGradientValue","replace","concat","parse","map","gradient","colorStops","color","index","type","value","length","fallbackLength","colorLength","join","getGradientBaseColors","colorGroup","getColorLocations","location","Number","Gradient","style","angleCenter","x","y","children","otherProps","resizeObserver","sizes","width","height","isGradient","getGradientType","gradients","locations","colors","isLinearGradient","linear","useAngle","overflow","radialGradientContent","id","gradientUnits","rx","ry","cy","OS","group","offset","stopColor","stopOpacity","fill"],"sources":["@wordpress/components/src/mobile/gradient/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Platform } from 'react-native';\nimport RNLinearGradient from 'react-native-linear-gradient';\nimport gradientParser from 'gradient-parser';\n/**\n * WordPress dependencies\n */\nimport { RadialGradient, Stop, SVG, Defs, Rect } from '@wordpress/primitives';\nimport { useResizeObserver } from '@wordpress/compose';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport { colorsUtils } from '../color-settings/utils';\n\nexport function getGradientAngle( gradientValue ) {\n\tconst angleBase = 45;\n\tconst matchAngle = /\\(((\\d+deg)|(to\\s[^,]+))/;\n\tconst angle = matchAngle.exec( gradientValue )\n\t\t? matchAngle.exec( gradientValue )[ 1 ]\n\t\t: '180deg';\n\n\tconst angleType = angle.includes( 'deg' ) ? 'angle' : 'sideOrCorner';\n\n\tif ( angleType === 'sideOrCorner' ) {\n\t\tswitch ( angle ) {\n\t\t\tcase 'to top':\n\t\t\t\treturn 0;\n\t\t\tcase 'to top right':\n\t\t\tcase 'to right top':\n\t\t\t\treturn angleBase;\n\t\t\tcase 'to right':\n\t\t\t\treturn 2 * angleBase;\n\t\t\tcase 'to bottom right':\n\t\t\tcase 'to right bottom':\n\t\t\t\treturn 3 * angleBase;\n\t\t\tcase 'to bottom':\n\t\t\t\treturn 4 * angleBase;\n\t\t\tcase 'to bottom left':\n\t\t\tcase 'to left bottom':\n\t\t\t\treturn 5 * angleBase;\n\t\t\tcase 'to left':\n\t\t\t\treturn 6 * angleBase;\n\t\t\tcase 'to top left':\n\t\t\tcase 'to left top':\n\t\t\t\treturn 7 * angleBase;\n\t\t}\n\t} else if ( angleType === 'angle' ) {\n\t\treturn parseFloat( angle );\n\t} else {\n\t\treturn 4 * angleBase;\n\t}\n}\n\nexport function getGradientColorGroup( gradientValue ) {\n\tconst colorNeedParenthesis = [ 'rgb', 'rgba' ];\n\n\tconst excludeSideOrCorner = /linear-gradient\\(to\\s+([a-z\\s]+,)/;\n\n\t// Parser has some difficulties with angle defined as a side or corner (e.g. `to left`)\n\t// so it's going to be excluded in order to matching color groups.\n\tconst modifiedGradientValue = gradientValue.replace(\n\t\texcludeSideOrCorner,\n\t\t'linear-gradient('\n\t);\n\n\treturn [].concat(\n\t\t...gradientParser.parse( modifiedGradientValue )?.map( ( gradient ) =>\n\t\t\tgradient.colorStops?.map( ( color, index ) => {\n\t\t\t\tconst { type, value, length } = color;\n\t\t\t\tconst fallbackLength = `${\n\t\t\t\t\t100 * ( index / ( gradient.colorStops.length - 1 ) )\n\t\t\t\t}%`;\n\t\t\t\tconst colorLength = length\n\t\t\t\t\t? `${ length.value }${ length.type }`\n\t\t\t\t\t: fallbackLength;\n\n\t\t\t\tif ( colorNeedParenthesis.includes( type ) ) {\n\t\t\t\t\treturn [ `${ type }(${ value.join( ',' ) })`, colorLength ];\n\t\t\t\t} else if ( type === 'literal' ) {\n\t\t\t\t\treturn [ value, colorLength ];\n\t\t\t\t}\n\t\t\t\treturn [ `#${ value }`, colorLength ];\n\t\t\t} )\n\t\t)\n\t);\n}\n\nexport function getGradientBaseColors( colorGroup ) {\n\treturn colorGroup.map( ( color ) => color[ 0 ] );\n}\n\nexport function getColorLocations( colorGroup ) {\n\treturn colorGroup.map(\n\t\t( location ) => Number( location[ 1 ].replace( '%', '' ) ) / 100\n\t);\n}\n\nfunction Gradient( {\n\tgradientValue,\n\tstyle,\n\tangleCenter = { x: 0.5, y: 0.5 },\n\tchildren,\n\t...otherProps\n} ) {\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\tconst { width = 0, height = 0 } = sizes || {};\n\tconst { isGradient, getGradientType, gradients } = colorsUtils;\n\n\tconst colorGroup = useMemo(\n\t\t() => getGradientColorGroup( gradientValue ),\n\t\t[ gradientValue ]\n\t);\n\n\tconst locations = useMemo(\n\t\t() => getColorLocations( colorGroup ),\n\t\t[ colorGroup ]\n\t);\n\n\tconst colors = useMemo(\n\t\t() => getGradientBaseColors( colorGroup ),\n\t\t[ colorGroup ]\n\t);\n\n\tif ( ! gradientValue || ! isGradient( gradientValue ) ) {\n\t\treturn null;\n\t}\n\n\tconst isLinearGradient =\n\t\tgetGradientType( gradientValue ) === gradients.linear;\n\n\tif ( isLinearGradient ) {\n\t\treturn (\n\t\t\t<RNLinearGradient\n\t\t\t\tcolors={ colors }\n\t\t\t\tuseAngle\n\t\t\t\tangle={ getGradientAngle( gradientValue ) }\n\t\t\t\tlocations={ locations }\n\t\t\t\tangleCenter={ angleCenter }\n\t\t\t\tstyle={ style }\n\t\t\t\t{ ...otherProps }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</RNLinearGradient>\n\t\t);\n\t}\n\n\treturn (\n\t\t<View style={ [ style, styles.overflow ] }>\n\t\t\t<View style={ styles.radialGradientContent }>{ children }</View>\n\t\t\t{ resizeObserver }\n\t\t\t<SVG>\n\t\t\t\t<Defs>\n\t\t\t\t\t<RadialGradient\n\t\t\t\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\t\t\t\tid=\"radialGradient\"\n\t\t\t\t\t\tgradientUnits=\"userSpaceOnUse\"\n\t\t\t\t\t\trx=\"70%\"\n\t\t\t\t\t\try=\"70%\"\n\t\t\t\t\t\tcy={ Platform.OS === 'android' ? width / 2 : '50%' }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ colorGroup.map( ( group ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<Stop\n\t\t\t\t\t\t\t\t\toffset={ group[ 1 ] }\n\t\t\t\t\t\t\t\t\tstopColor={ group[ 0 ] }\n\t\t\t\t\t\t\t\t\tstopOpacity=\"1\"\n\t\t\t\t\t\t\t\t\tkey={ `${ group[ 1 ] }-${ group[ 0 ] }` }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t</RadialGradient>\n\t\t\t\t</Defs>\n\t\t\t\t<Rect\n\t\t\t\t\theight={ height }\n\t\t\t\t\twidth={ width }\n\t\t\t\t\tfill=\"url(#radialGradient)\"\n\t\t\t\t/>\n\t\t\t</SVG>\n\t\t</View>\n\t);\n}\n\nexport default Gradient;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,QAAQ,QAAQ,cAA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,IAAA,CAACN,IAAI;QACJmD,MAAM,EAAGA,MAAQ;QACjBD,KAAK,EAAGA,KAAO;QACfsB,IAAI,EAAC;MAAsB,CAC3B,CAAC;IAAA,CACE,CAAC;EAAA,CACD,CAAC;AAET;AAEA,eAAe/B,QAAQ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Component","__","requestMediaEditor","mediaSources","Picker","jsx","_jsx","MEDIA_TYPE_IMAGE","MEDIA_EDITOR","editOption","id","value","label","requiresModal","types","replaceOption","deviceLibrary","MediaEdit","constructor","props","onPickerPresent","bind","onPickerSelect","getMediaOptionsItems","getDestructiveButtonIndex","pickerOptions","openReplaceMediaOptions","source","uri","filter","Boolean","options","destructiveButtonIndex","findIndex","option","destructiveButton","undefined","picker","presentPicker","onSelect","multiple","media","optionSelected","find","onPress","render","mediaOptions","hideCancelButton","ref","instance","leftAlign","onChange","title","open"],"sources":["@wordpress/components/src/mobile/media-edit/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\trequestMediaEditor,\n\tmediaSources,\n} from '@wordpress/react-native-bridge';\n\n/**\n * Internal dependencies\n */\nimport Picker from '../picker';\n\nexport const MEDIA_TYPE_IMAGE = 'image';\n\nexport const MEDIA_EDITOR = 'MEDIA_EDITOR';\n\nconst editOption = {\n\tid: MEDIA_EDITOR,\n\tvalue: MEDIA_EDITOR,\n\tlabel: __( 'Edit' ),\n\trequiresModal: true,\n\ttypes: [ MEDIA_TYPE_IMAGE ],\n};\n\nconst replaceOption = {\n\tid: mediaSources.deviceLibrary,\n\tvalue: mediaSources.deviceLibrary,\n\tlabel: __( 'Replace' ),\n\ttypes: [ MEDIA_TYPE_IMAGE ],\n};\n\nexport class MediaEdit extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\t\tthis.onPickerPresent = this.onPickerPresent.bind( this );\n\t\tthis.onPickerSelect = this.onPickerSelect.bind( this );\n\t\tthis.getMediaOptionsItems = this.getMediaOptionsItems.bind( this );\n\t\tthis.getDestructiveButtonIndex =\n\t\t\tthis.getDestructiveButtonIndex.bind( this );\n\t}\n\n\tgetMediaOptionsItems() {\n\t\tconst { pickerOptions, openReplaceMediaOptions, source } = this.props;\n\n\t\treturn [\n\t\t\tsource?.uri && editOption,\n\t\t\topenReplaceMediaOptions && replaceOption,\n\t\t\t...( pickerOptions ? pickerOptions : [] ),\n\t\t].filter( Boolean );\n\t}\n\n\tgetDestructiveButtonIndex() {\n\t\tconst options = this.getMediaOptionsItems();\n\t\tconst destructiveButtonIndex = options.findIndex(\n\t\t\t( option ) => option?.destructiveButton\n\t\t);\n\n\t\treturn destructiveButtonIndex !== -1\n\t\t\t? destructiveButtonIndex + 1\n\t\t\t: undefined;\n\t}\n\n\tonPickerPresent() {\n\t\tif ( this.picker ) {\n\t\t\tthis.picker.presentPicker();\n\t\t}\n\t}\n\n\tonPickerSelect( value ) {\n\t\tconst {\n\t\t\tonSelect,\n\t\t\tpickerOptions,\n\t\t\tmultiple = false,\n\t\t\topenReplaceMediaOptions,\n\t\t} = this.props;\n\n\t\tswitch ( value ) {\n\t\t\tcase MEDIA_EDITOR:\n\t\t\t\trequestMediaEditor( this.props.source.uri, ( media ) => {\n\t\t\t\t\tif ( ( multiple && media ) || ( media && media.id ) ) {\n\t\t\t\t\t\tonSelect( media );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tconst optionSelected =\n\t\t\t\t\tpickerOptions &&\n\t\t\t\t\tpickerOptions.find( ( option ) => option.id === value );\n\n\t\t\t\tif ( optionSelected && optionSelected.onPress ) {\n\t\t\t\t\toptionSelected.onPress();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( openReplaceMediaOptions ) {\n\t\t\t\t\topenReplaceMediaOptions();\n\t\t\t\t}\n\t\t}\n\t}\n\n\trender() {\n\t\tconst mediaOptions = () => (\n\t\t\t<Picker\n\t\t\t\thideCancelButton\n\t\t\t\tref={ ( instance ) => ( this.picker = instance ) }\n\t\t\t\toptions={ this.getMediaOptionsItems() }\n\t\t\t\tleftAlign\n\t\t\t\tonChange={ this.onPickerSelect }\n\t\t\t\t// translators: %s: block title e.g: \"Paragraph\".\n\t\t\t\ttitle={ __( 'Media options' ) }\n\t\t\t\tdestructiveButtonIndex={ this.getDestructiveButtonIndex() }\n\t\t\t/>\n\t\t);\n\n\t\treturn this.props.render( {\n\t\t\topen: this.onPickerPresent,\n\t\t\tmediaOptions,\n\t\t} );\n\t}\n}\n\nexport default MediaEdit;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["Component","__","requestMediaEditor","mediaSources","Picker","jsx","_jsx","MEDIA_TYPE_IMAGE","MEDIA_EDITOR","editOption","id","value","label","requiresModal","types","replaceOption","deviceLibrary","MediaEdit","constructor","props","onPickerPresent","bind","onPickerSelect","getMediaOptionsItems","getDestructiveButtonIndex","pickerOptions","openReplaceMediaOptions","source","uri","filter","Boolean","options","destructiveButtonIndex","findIndex","option","destructiveButton","undefined","picker","presentPicker","onSelect","multiple","media","optionSelected","find","onPress","render","mediaOptions","hideCancelButton","ref","instance","leftAlign","onChange","title","open"],"sources":["@wordpress/components/src/mobile/media-edit/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\trequestMediaEditor,\n\tmediaSources,\n} from '@wordpress/react-native-bridge';\n\n/**\n * Internal dependencies\n */\nimport Picker from '../picker';\n\nexport const MEDIA_TYPE_IMAGE = 'image';\n\nexport const MEDIA_EDITOR = 'MEDIA_EDITOR';\n\nconst editOption = {\n\tid: MEDIA_EDITOR,\n\tvalue: MEDIA_EDITOR,\n\tlabel: __( 'Edit' ),\n\trequiresModal: true,\n\ttypes: [ MEDIA_TYPE_IMAGE ],\n};\n\nconst replaceOption = {\n\tid: mediaSources.deviceLibrary,\n\tvalue: mediaSources.deviceLibrary,\n\tlabel: __( 'Replace' ),\n\ttypes: [ MEDIA_TYPE_IMAGE ],\n};\n\nexport class MediaEdit extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\t\tthis.onPickerPresent = this.onPickerPresent.bind( this );\n\t\tthis.onPickerSelect = this.onPickerSelect.bind( this );\n\t\tthis.getMediaOptionsItems = this.getMediaOptionsItems.bind( this );\n\t\tthis.getDestructiveButtonIndex =\n\t\t\tthis.getDestructiveButtonIndex.bind( this );\n\t}\n\n\tgetMediaOptionsItems() {\n\t\tconst { pickerOptions, openReplaceMediaOptions, source } = this.props;\n\n\t\treturn [\n\t\t\tsource?.uri && editOption,\n\t\t\topenReplaceMediaOptions && replaceOption,\n\t\t\t...( pickerOptions ? pickerOptions : [] ),\n\t\t].filter( Boolean );\n\t}\n\n\tgetDestructiveButtonIndex() {\n\t\tconst options = this.getMediaOptionsItems();\n\t\tconst destructiveButtonIndex = options.findIndex(\n\t\t\t( option ) => option?.destructiveButton\n\t\t);\n\n\t\treturn destructiveButtonIndex !== -1\n\t\t\t? destructiveButtonIndex + 1\n\t\t\t: undefined;\n\t}\n\n\tonPickerPresent() {\n\t\tif ( this.picker ) {\n\t\t\tthis.picker.presentPicker();\n\t\t}\n\t}\n\n\tonPickerSelect( value ) {\n\t\tconst {\n\t\t\tonSelect,\n\t\t\tpickerOptions,\n\t\t\tmultiple = false,\n\t\t\topenReplaceMediaOptions,\n\t\t} = this.props;\n\n\t\tswitch ( value ) {\n\t\t\tcase MEDIA_EDITOR:\n\t\t\t\trequestMediaEditor( this.props.source.uri, ( media ) => {\n\t\t\t\t\tif ( ( multiple && media ) || ( media && media.id ) ) {\n\t\t\t\t\t\tonSelect( media );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tconst optionSelected =\n\t\t\t\t\tpickerOptions &&\n\t\t\t\t\tpickerOptions.find( ( option ) => option.id === value );\n\n\t\t\t\tif ( optionSelected && optionSelected.onPress ) {\n\t\t\t\t\toptionSelected.onPress();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( openReplaceMediaOptions ) {\n\t\t\t\t\topenReplaceMediaOptions();\n\t\t\t\t}\n\t\t}\n\t}\n\n\trender() {\n\t\tconst mediaOptions = () => (\n\t\t\t<Picker\n\t\t\t\thideCancelButton\n\t\t\t\tref={ ( instance ) => ( this.picker = instance ) }\n\t\t\t\toptions={ this.getMediaOptionsItems() }\n\t\t\t\tleftAlign\n\t\t\t\tonChange={ this.onPickerSelect }\n\t\t\t\t// translators: %s: block title e.g: \"Paragraph\".\n\t\t\t\ttitle={ __( 'Media options' ) }\n\t\t\t\tdestructiveButtonIndex={ this.getDestructiveButtonIndex() }\n\t\t\t/>\n\t\t);\n\n\t\treturn this.props.render( {\n\t\t\topen: this.onPickerPresent,\n\t\t\tmediaOptions,\n\t\t} );\n\t}\n}\n\nexport default MediaEdit;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,kBAAkB,EAClBC,YAAY,QACN,gCAAgC;;AAEvC;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/B,OAAO,MAAMC,gBAAgB,GAAG,OAAO;AAEvC,OAAO,MAAMC,YAAY,GAAG,cAAc;AAE1C,MAAMC,UAAU,GAAG;EAClBC,EAAE,EAAEF,YAAY;EAChBG,KAAK,EAAEH,YAAY;EACnBI,KAAK,EAAEX,EAAE,CAAE,MAAO,CAAC;EACnBY,aAAa,EAAE,IAAI;EACnBC,KAAK,EAAE,CAAEP,gBAAgB;AAC1B,CAAC;AAED,MAAMQ,aAAa,GAAG;EACrBL,EAAE,EAAEP,YAAY,CAACa,aAAa;EAC9BL,KAAK,EAAER,YAAY,CAACa,aAAa;EACjCJ,KAAK,EAAEX,EAAE,CAAE,SAAU,CA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|
-
{"version":3,"names":["View","__","Component","Fragment","usePreferredColorSchemeStyle","BottomSheet","styles","PanelBody","TextControl","jsx","_jsx","jsxs","_jsxs","Separator","separatorStyle","style","Picker","constructor","arguments","onClose","bind","onCellPress","state","isVisible","presentPicker","setState","value","onChange","props","getOptions","options","leftAlign","map","option","children","length","separated","Cell","icon","label","separatorType","onPress","disabled","render","hideCancelButton","title","testID","hideHeader"],"sources":["@wordpress/components/src/mobile/picker/index.android.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Component, Fragment } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BottomSheet from '../bottom-sheet';\nimport styles from './styles.scss';\nimport PanelBody from '../../panel/body';\nimport TextControl from '../../text-control';\n\nfunction Separator() {\n\tconst separatorStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'components-picker__separator' ],\n\t\tstyles[ 'components-picker__separator--dark' ]\n\t);\n\n\treturn <View style={ separatorStyle } />;\n}\n\nexport default class Picker extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.onClose = this.onClose.bind( this );\n\t\tthis.onCellPress = this.onCellPress.bind( this );\n\n\t\tthis.state = {\n\t\t\tisVisible: false,\n\t\t};\n\t}\n\n\tpresentPicker() {\n\t\tthis.setState( { isVisible: true } );\n\t}\n\n\tonClose() {\n\t\tthis.setState( { isVisible: false } );\n\t}\n\n\tonCellPress( value ) {\n\t\tconst { onChange } = this.props;\n\t\tonChange( value );\n\t\tthis.onClose();\n\t}\n\n\tgetOptions() {\n\t\tconst { options, leftAlign } = this.props;\n\n\t\treturn options.map( ( option ) => (\n\t\t\t<Fragment key={ `${ option.label }-${ option.value }` }>\n\t\t\t\t{ options.length > 1 && option.separated && <Separator /> }\n\t\t\t\t<BottomSheet.Cell\n\t\t\t\t\ticon={ option.icon }\n\t\t\t\t\tleftAlign={ leftAlign }\n\t\t\t\t\tlabel={ option.label }\n\t\t\t\t\tseparatorType=\"none\"\n\t\t\t\t\tonPress={ () => this.onCellPress( option.value ) }\n\t\t\t\t\tdisabled={ option.disabled }\n\t\t\t\t\tstyle={\n\t\t\t\t\t\toption.disabled &&\n\t\t\t\t\t\tstyles[ 'components-picker__button--disabled' ]\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</Fragment>\n\t\t) );\n\t}\n\n\trender() {\n\t\tconst { hideCancelButton, title, testID } = this.props;\n\t\tconst { isVisible } = this.state;\n\n\t\treturn (\n\t\t\t<BottomSheet\n\t\t\t\tisVisible={ isVisible }\n\t\t\t\tonClose={ this.onClose }\n\t\t\t\thideHeader\n\t\t\t\ttestID={ testID }\n\t\t\t>\n\t\t\t\t<PanelBody\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tstyle={ styles[ 'components-picker__panel' ] }\n\t\t\t\t>\n\t\t\t\t\t{ this.getOptions() }\n\t\t\t\t\t{ ! hideCancelButton && (\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tlabel={ __( 'Cancel' ) }\n\t\t\t\t\t\t\tonPress={ this.onClose }\n\t\t\t\t\t\t\tseparatorType=\"none\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</BottomSheet>\n\t\t);\n\t}\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["View","__","Component","Fragment","usePreferredColorSchemeStyle","BottomSheet","styles","PanelBody","TextControl","jsx","_jsx","jsxs","_jsxs","Separator","separatorStyle","style","Picker","constructor","arguments","onClose","bind","onCellPress","state","isVisible","presentPicker","setState","value","onChange","props","getOptions","options","leftAlign","map","option","children","length","separated","Cell","icon","label","separatorType","onPress","disabled","render","hideCancelButton","title","testID","hideHeader"],"sources":["@wordpress/components/src/mobile/picker/index.android.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Component, Fragment } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BottomSheet from '../bottom-sheet';\nimport styles from './styles.scss';\nimport PanelBody from '../../panel/body';\nimport TextControl from '../../text-control';\n\nfunction Separator() {\n\tconst separatorStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'components-picker__separator' ],\n\t\tstyles[ 'components-picker__separator--dark' ]\n\t);\n\n\treturn <View style={ separatorStyle } />;\n}\n\nexport default class Picker extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.onClose = this.onClose.bind( this );\n\t\tthis.onCellPress = this.onCellPress.bind( this );\n\n\t\tthis.state = {\n\t\t\tisVisible: false,\n\t\t};\n\t}\n\n\tpresentPicker() {\n\t\tthis.setState( { isVisible: true } );\n\t}\n\n\tonClose() {\n\t\tthis.setState( { isVisible: false } );\n\t}\n\n\tonCellPress( value ) {\n\t\tconst { onChange } = this.props;\n\t\tonChange( value );\n\t\tthis.onClose();\n\t}\n\n\tgetOptions() {\n\t\tconst { options, leftAlign } = this.props;\n\n\t\treturn options.map( ( option ) => (\n\t\t\t<Fragment key={ `${ option.label }-${ option.value }` }>\n\t\t\t\t{ options.length > 1 && option.separated && <Separator /> }\n\t\t\t\t<BottomSheet.Cell\n\t\t\t\t\ticon={ option.icon }\n\t\t\t\t\tleftAlign={ leftAlign }\n\t\t\t\t\tlabel={ option.label }\n\t\t\t\t\tseparatorType=\"none\"\n\t\t\t\t\tonPress={ () => this.onCellPress( option.value ) }\n\t\t\t\t\tdisabled={ option.disabled }\n\t\t\t\t\tstyle={\n\t\t\t\t\t\toption.disabled &&\n\t\t\t\t\t\tstyles[ 'components-picker__button--disabled' ]\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</Fragment>\n\t\t) );\n\t}\n\n\trender() {\n\t\tconst { hideCancelButton, title, testID } = this.props;\n\t\tconst { isVisible } = this.state;\n\n\t\treturn (\n\t\t\t<BottomSheet\n\t\t\t\tisVisible={ isVisible }\n\t\t\t\tonClose={ this.onClose }\n\t\t\t\thideHeader\n\t\t\t\ttestID={ testID }\n\t\t\t>\n\t\t\t\t<PanelBody\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tstyle={ styles[ 'components-picker__panel' ] }\n\t\t\t\t>\n\t\t\t\t\t{ this.getOptions() }\n\t\t\t\t\t{ ! hideCancelButton && (\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tlabel={ __( 'Cancel' ) }\n\t\t\t\t\t\t\tonPress={ this.onClose }\n\t\t\t\t\t\t\tseparatorType=\"none\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</BottomSheet>\n\t\t);\n\t}\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,cAAc;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,4BAA4B,QAAQ,oBAAoB;;AAEjE;AACA;AACA;AACA,OAAOC,WAAW,MAAM,iBAAiB;AACzC,OAAOC,MAAM,MAAM,eAAe;AAClC,OAAOC,SAAS,MAAM,kBAAkB;AACxC,OAAOC,WAAW,MAAM,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE7C,SAASC,SAASA,CAAA,EAAG;EACpB,MAAMC,cAAc,GAAGV,4BAA4B,CAClDE,MAAM,CAAE,8BAA8B,CAAE,EACxCA,MAAM,CAAE,oCAAoC,CAC7C,CAAC;EAED,oBAAOI,IAAA,CAACV,IAAI;IAACe,KAAK,EAAGD;EAAgB,CAAE,CAAC;AACzC;AAEA,eAAe,MAAME,MAAM,SAASd,SAAS,CAAC;EAC7Ce,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,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E,qCAAqC;MAC7C,CACD,CAAC;IAAA,GAba,GAAI2B,MAAM,CAACM,KAAK,IAAMN,MAAM,CAACP,KAAK,EAcxC,CACT,CAAC;EACJ;EAEAiB,MAAMA,CAAA,EAAG;IACR,MAAM;MAAEC,gBAAgB;MAAEC,KAAK;MAAEC;IAAO,CAAC,GAAG,IAAI,CAAClB,KAAK;IACtD,MAAM;MAAEL;IAAU,CAAC,GAAG,IAAI,CAACD,KAAK;IAEhC,oBACCZ,IAAA,CAACL,WAAW;MACXkB,SAAS,EAAGA,SAAW;MACvBJ,OAAO,EAAG,IAAI,CAACA,OAAS;MACxB4B,UAAU;MACVD,MAAM,EAAGA,MAAQ;MAAAZ,QAAA,eAEjBtB,KAAA,CAACL,SAAS;QACTsC,KAAK,EAAGA,KAAO;QACf9B,KAAK,EAAGT,MAAM,CAAE,0BAA0B,CAAI;QAAA4B,QAAA,GAE5C,IAAI,CAACL,UAAU,CAAC,CAAC,EACjB,CAAEe,gBAAgB,iBACnBlC,IAAA,CAACF,WAAW;UACX+B,KAAK,EAAGtC,EAAE,CAAE,QAAS,CAAG;UACxBwC,OAAO,EAAG,IAAI,CAACtB,OAAS;UACxBqB,aAAa,EAAC;QAAM,CACpB,CACD;MAAA,CACS;IAAC,CACA,CAAC;EAEhB;AACD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ActionSheetIOS","__","Component","forwardRef","useContext","useDispatch","useSelect","usePreferredColorScheme","styles","BottomSheetContext","jsx","_jsx","Picker","presentPicker","options","onChange","title","destructiveButtonIndex","disabledButtonIndices","getAnchor","isBottomSheetOpened","closeBottomSheet","onHandleClosingBottomSheet","colorScheme","props","labels","map","label","fullOptions","concat","buttonTitleColor","color","showActionSheetWithOptions","cancelButtonIndex","anchor","tintColor","buttonIndex","selected","requiresModal","value","render","PickerComponent","ref","select","isEditorSidebarOpened","closeGeneralSidebar"],"sources":["@wordpress/components/src/mobile/picker/index.ios.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { ActionSheetIOS } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Component, forwardRef, useContext } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { usePreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\nimport { BottomSheetContext } from '../bottom-sheet/bottom-sheet-context';\n\nclass Picker extends Component {\n\tpresentPicker() {\n\t\tconst {\n\t\t\toptions,\n\t\t\tonChange,\n\t\t\ttitle,\n\t\t\tdestructiveButtonIndex,\n\t\t\tdisabledButtonIndices,\n\t\t\tgetAnchor,\n\t\t\tisBottomSheetOpened,\n\t\t\tcloseBottomSheet,\n\t\t\tonHandleClosingBottomSheet,\n\t\t\tcolorScheme,\n\t\t} = this.props;\n\t\tconst labels = options.map( ( { label } ) => label );\n\t\tconst fullOptions = [ __( 'Cancel' ) ].concat( labels );\n\n\t\tconst buttonTitleColor =\n\t\t\tcolorScheme === 'light'\n\t\t\t\t? styles[ 'components-picker__button-title' ].color\n\t\t\t\t: styles[ 'components-picker__button-title--dark' ].color;\n\n\t\tActionSheetIOS.showActionSheetWithOptions(\n\t\t\t{\n\t\t\t\ttitle,\n\t\t\t\toptions: fullOptions,\n\t\t\t\tcancelButtonIndex: 0,\n\t\t\t\tdestructiveButtonIndex,\n\t\t\t\tdisabledButtonIndices,\n\t\t\t\tanchor: getAnchor && getAnchor(),\n\t\t\t\ttintColor: buttonTitleColor,\n\t\t\t},\n\t\t\t( buttonIndex ) => {\n\t\t\t\tif ( buttonIndex === 0 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst selected = options[ buttonIndex - 1 ];\n\n\t\t\t\tif ( selected.requiresModal && isBottomSheetOpened ) {\n\t\t\t\t\tonHandleClosingBottomSheet( () => {\n\t\t\t\t\t\tonChange( selected.value );\n\t\t\t\t\t} );\n\t\t\t\t\tcloseBottomSheet();\n\t\t\t\t} else {\n\t\t\t\t\tonChange( selected.value );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\trender() {\n\t\treturn null;\n\t}\n}\n\nconst PickerComponent = forwardRef( ( props, ref ) => {\n\tconst isBottomSheetOpened = useSelect( ( select ) =>\n\t\tselect( 'core/edit-post' ).isEditorSidebarOpened()\n\t);\n\tconst { closeGeneralSidebar } = useDispatch( 'core/edit-post' );\n\tconst { onHandleClosingBottomSheet } = useContext( BottomSheetContext );\n\n\tconst colorScheme = usePreferredColorScheme();\n\n\treturn (\n\t\t<Picker\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tisBottomSheetOpened={ isBottomSheetOpened }\n\t\t\tcloseBottomSheet={ closeGeneralSidebar }\n\t\t\tonHandleClosingBottomSheet={ onHandleClosingBottomSheet }\n\t\t\tcolorScheme={ colorScheme }\n\t\t/>\n\t);\n} );\n\nexport default PickerComponent;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ActionSheetIOS","__","Component","forwardRef","useContext","useDispatch","useSelect","usePreferredColorScheme","styles","BottomSheetContext","jsx","_jsx","Picker","presentPicker","options","onChange","title","destructiveButtonIndex","disabledButtonIndices","getAnchor","isBottomSheetOpened","closeBottomSheet","onHandleClosingBottomSheet","colorScheme","props","labels","map","label","fullOptions","concat","buttonTitleColor","color","showActionSheetWithOptions","cancelButtonIndex","anchor","tintColor","buttonIndex","selected","requiresModal","value","render","PickerComponent","ref","select","isEditorSidebarOpened","closeGeneralSidebar"],"sources":["@wordpress/components/src/mobile/picker/index.ios.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { ActionSheetIOS } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Component, forwardRef, useContext } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { usePreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\nimport { BottomSheetContext } from '../bottom-sheet/bottom-sheet-context';\n\nclass Picker extends Component {\n\tpresentPicker() {\n\t\tconst {\n\t\t\toptions,\n\t\t\tonChange,\n\t\t\ttitle,\n\t\t\tdestructiveButtonIndex,\n\t\t\tdisabledButtonIndices,\n\t\t\tgetAnchor,\n\t\t\tisBottomSheetOpened,\n\t\t\tcloseBottomSheet,\n\t\t\tonHandleClosingBottomSheet,\n\t\t\tcolorScheme,\n\t\t} = this.props;\n\t\tconst labels = options.map( ( { label } ) => label );\n\t\tconst fullOptions = [ __( 'Cancel' ) ].concat( labels );\n\n\t\tconst buttonTitleColor =\n\t\t\tcolorScheme === 'light'\n\t\t\t\t? styles[ 'components-picker__button-title' ].color\n\t\t\t\t: styles[ 'components-picker__button-title--dark' ].color;\n\n\t\tActionSheetIOS.showActionSheetWithOptions(\n\t\t\t{\n\t\t\t\ttitle,\n\t\t\t\toptions: fullOptions,\n\t\t\t\tcancelButtonIndex: 0,\n\t\t\t\tdestructiveButtonIndex,\n\t\t\t\tdisabledButtonIndices,\n\t\t\t\tanchor: getAnchor && getAnchor(),\n\t\t\t\ttintColor: buttonTitleColor,\n\t\t\t},\n\t\t\t( buttonIndex ) => {\n\t\t\t\tif ( buttonIndex === 0 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst selected = options[ buttonIndex - 1 ];\n\n\t\t\t\tif ( selected.requiresModal && isBottomSheetOpened ) {\n\t\t\t\t\tonHandleClosingBottomSheet( () => {\n\t\t\t\t\t\tonChange( selected.value );\n\t\t\t\t\t} );\n\t\t\t\t\tcloseBottomSheet();\n\t\t\t\t} else {\n\t\t\t\t\tonChange( selected.value );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\trender() {\n\t\treturn null;\n\t}\n}\n\nconst PickerComponent = forwardRef( ( props, ref ) => {\n\tconst isBottomSheetOpened = useSelect( ( select ) =>\n\t\tselect( 'core/edit-post' ).isEditorSidebarOpened()\n\t);\n\tconst { closeGeneralSidebar } = useDispatch( 'core/edit-post' );\n\tconst { onHandleClosingBottomSheet } = useContext( BottomSheetContext );\n\n\tconst colorScheme = usePreferredColorScheme();\n\n\treturn (\n\t\t<Picker\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tisBottomSheetOpened={ isBottomSheetOpened }\n\t\t\tcloseBottomSheet={ closeGeneralSidebar }\n\t\t\tonHandleClosingBottomSheet={ onHandleClosingBottomSheet }\n\t\t\tcolorScheme={ colorScheme }\n\t\t/>\n\t);\n} );\n\nexport default PickerComponent;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,cAAc;;AAE7C;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;AACtE,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,uBAAuB,QAAQ,oBAAoB;;AAE5D;AACA;AACA;AACA,OAAOC,MAAM,MAAM,eAAe;AAClC,SAASC,kBAAkB,QAAQ,sCAAsC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1E,MAAMC,MAAM,SAASV,SAAS,CAAC;EAC9BW,aAAaA,CAAA,EAAG;IACf,MAAM;MACLC,OAAO;MACPC,QAAQ;MACRC,KAAK;MACLC,sBAAsB;MACtBC,qBAAqB;MACrBC,SAAS;MACTC,mBAAmB;MACnBC,gBAAgB;MAChBC,0BAA0B;MAC1BC;IACD,CAAC,GAAG,IAAI,CAACC,KAAK;IACd,MAAMC,MAAM,GAAGX,OAAO,CAACY,GAAG,CAAE,CAAE;MAAEC;IAAM,CAAC,KAAMA,KAAM,CAAC;IACpD,MAAMC,WAAW,GAAG,CAAE3B,EAAE,CAAE,QAAS,CAAC,CAAE,CAAC4B,MAAM,CAAEJ,MAAO,CAAC;IAEvD,MAAMK,gBAAgB,GACrBP,WAAW,KAAK,OAAO,GACpBf,MAAM,CAAE,iCAAiC,CAAE,CAACuB,KAAK,GACjDvB,MAAM,C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