@wordpress/components 27.0.0 → 27.2.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 +50 -2
- package/build/base-control/index.native.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/button/index.js +4 -5
- package/build/button/index.js.map +1 -1
- package/build/button/index.native.js.map +1 -1
- package/build/button/types.js.map +1 -1
- package/build/confirm-dialog/component.js.map +1 -1
- package/build/custom-select-control-v2/default-component/index.js.map +1 -1
- package/build/custom-select-control-v2/index.js +2 -2
- package/build/custom-select-control-v2/index.js.map +1 -1
- package/build/custom-select-control-v2/types.js.map +1 -1
- package/build/date-time/date/styles.js +7 -7
- package/build/date-time/date/styles.js.map +1 -1
- package/build/draggable/index.native.js +2 -2
- package/build/draggable/index.native.js.map +1 -1
- package/build/dropdown-menu/index.native.js.map +1 -1
- package/build/flex/flex/hook.js +1 -1
- package/build/flex/flex/hook.js.map +1 -1
- package/build/font-size-picker/index.native.js.map +1 -1
- package/build/form-token-field/index.js +1 -1
- package/build/form-token-field/index.js.map +1 -1
- package/build/h-stack/hook.js +6 -1
- package/build/h-stack/hook.js.map +1 -1
- package/build/input-control/index.js +1 -1
- package/build/input-control/index.js.map +1 -1
- package/build/mobile/bottom-sheet/button.native.js.map +1 -1
- package/build/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/range-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
- package/build/mobile/gradient/index.native.js.map +1 -1
- package/build/mobile/image/index.native.js +4 -13
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/media-edit/index.native.js.map +1 -1
- package/build/palette-edit/index.js +18 -12
- package/build/palette-edit/index.js.map +1 -1
- package/build/query-controls/index.native.js.map +1 -1
- package/build/range-control/index.js.map +1 -1
- package/build/search-control/index.native.js.map +1 -1
- package/build/snackbar/index.js +3 -2
- package/build/snackbar/index.js.map +1 -1
- package/build/snackbar/list.js +2 -1
- package/build/snackbar/list.js.map +1 -1
- package/build/snackbar/types.js.map +1 -1
- package/build/tabs/index.js +7 -7
- package/build/tabs/index.js.map +1 -1
- package/build/tabs/types.js.map +1 -1
- package/build/text-control/types.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/component.js +4 -1
- package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js +1 -1
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/utils/config-values.js +1 -1
- package/build/utils/config-values.js.map +1 -1
- package/build/utils/hooks/index.js +0 -7
- package/build/utils/hooks/index.js.map +1 -1
- package/build/utils/input/base.js +2 -2
- package/build/utils/input/base.js.map +1 -1
- package/build-module/base-control/index.native.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/button/index.js +4 -5
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/index.native.js.map +1 -1
- package/build-module/button/types.js.map +1 -1
- package/build-module/confirm-dialog/component.js.map +1 -1
- package/build-module/custom-select-control-v2/default-component/index.js.map +1 -1
- package/build-module/custom-select-control-v2/index.js +1 -1
- package/build-module/custom-select-control-v2/index.js.map +1 -1
- package/build-module/custom-select-control-v2/types.js.map +1 -1
- package/build-module/date-time/date/styles.js +7 -7
- package/build-module/date-time/date/styles.js.map +1 -1
- package/build-module/draggable/index.native.js +2 -2
- package/build-module/draggable/index.native.js.map +1 -1
- package/build-module/dropdown-menu/index.native.js.map +1 -1
- package/build-module/flex/flex/hook.js +1 -1
- package/build-module/flex/flex/hook.js.map +1 -1
- package/build-module/font-size-picker/index.native.js.map +1 -1
- package/build-module/form-token-field/index.js +1 -1
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/h-stack/hook.js +6 -1
- package/build-module/h-stack/hook.js.map +1 -1
- package/build-module/input-control/index.js +1 -1
- package/build-module/input-control/index.js.map +1 -1
- package/build-module/mobile/bottom-sheet/button.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/range-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
- package/build-module/mobile/gradient/index.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +6 -15
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/media-edit/index.native.js.map +1 -1
- package/build-module/palette-edit/index.js +17 -11
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/query-controls/index.native.js.map +1 -1
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/search-control/index.native.js.map +1 -1
- package/build-module/snackbar/index.js +3 -2
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/snackbar/list.js +2 -1
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/snackbar/types.js.map +1 -1
- package/build-module/tabs/index.js +7 -7
- package/build-module/tabs/index.js.map +1 -1
- package/build-module/tabs/types.js.map +1 -1
- package/build-module/text-control/types.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +4 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/utils/config-values.js +1 -1
- package/build-module/utils/config-values.js.map +1 -1
- package/build-module/utils/hooks/index.js +0 -1
- package/build-module/utils/hooks/index.js.map +1 -1
- package/build-module/utils/input/base.js +2 -2
- package/build-module/utils/input/base.js.map +1 -1
- package/build-style/style-rtl.css +33 -23
- package/build-style/style.css +33 -23
- package/build-types/box-control/styles/box-control-styles.d.ts +1 -1
- package/build-types/button/deprecated.d.ts +4 -10
- package/build-types/button/deprecated.d.ts.map +1 -1
- package/build-types/button/index.d.ts +3 -3
- package/build-types/button/index.d.ts.map +1 -1
- package/build-types/button/stories/e2e/index.story.d.ts +1 -1
- package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
- package/build-types/button/stories/index.story.d.ts +7 -7
- package/build-types/button/stories/index.story.d.ts.map +1 -1
- package/build-types/button/types.d.ts +37 -8
- package/build-types/button/types.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +1 -1
- package/build-types/custom-select-control-v2/default-component/index.d.ts +2 -1
- package/build-types/custom-select-control-v2/default-component/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/index.d.ts +1 -1
- package/build-types/custom-select-control-v2/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/legacy-component/test/index.d.ts +2 -0
- package/build-types/custom-select-control-v2/legacy-component/test/index.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/stories/default.story.d.ts +4 -3
- package/build-types/custom-select-control-v2/stories/default.story.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/stories/legacy.story.d.ts +2 -2
- package/build-types/custom-select-control-v2/stories/legacy.story.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/types.d.ts +0 -1
- package/build-types/custom-select-control-v2/types.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +1 -1
- package/build-types/dropdown/stories/index.story.d.ts +1 -0
- package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
- package/build-types/flex/flex/hook.d.ts +2 -3
- package/build-types/flex/flex/hook.d.ts.map +1 -1
- package/build-types/font-size-picker/styles.d.ts +1 -1
- package/build-types/form-token-field/index.d.ts +1 -1
- package/build-types/h-stack/hook.d.ts +2 -4
- package/build-types/h-stack/hook.d.ts.map +1 -1
- package/build-types/input-control/index.d.ts +1 -1
- package/build-types/input-control/stories/index.story.d.ts.map +1 -1
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -1
- package/build-types/navigation/styles/navigation-styles.d.ts +1 -1
- package/build-types/navigator/navigator-back-button/component.d.ts +0 -1
- package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +1 -2
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/component.d.ts +0 -1
- package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +1 -2
- package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-to-parent-button/component.d.ts +0 -1
- package/build-types/navigator/navigator-to-parent-button/component.d.ts.map +1 -1
- package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
- package/build-types/palette-edit/index.d.ts +6 -3
- package/build-types/palette-edit/index.d.ts.map +1 -1
- package/build-types/palette-edit/styles.d.ts +2 -2
- package/build-types/radio-group/stories/index.story.d.ts.map +1 -1
- package/build-types/snackbar/index.d.ts +5 -2
- package/build-types/snackbar/index.d.ts.map +1 -1
- package/build-types/snackbar/list.d.ts.map +1 -1
- package/build-types/snackbar/test/index.d.ts +2 -0
- package/build-types/snackbar/test/index.d.ts.map +1 -0
- package/build-types/snackbar/test/list.d.ts +2 -0
- package/build-types/snackbar/test/list.d.ts.map +1 -0
- package/build-types/snackbar/types.d.ts +18 -2
- package/build-types/snackbar/types.d.ts.map +1 -1
- package/build-types/tabs/index.d.ts +1 -1
- package/build-types/tabs/types.d.ts +1 -1
- package/build-types/text-control/index.d.ts +1 -1
- package/build-types/text-control/types.d.ts +1 -1
- package/build-types/text-control/types.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-button/index.d.ts +4 -10
- package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
- package/build-types/utils/hooks/index.d.ts +0 -1
- package/build-types/v-stack/hook.d.ts +2 -4
- package/build-types/v-stack/hook.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/base-control/index.native.js +1 -1
- package/src/base-control/test/index.tsx +1 -1
- package/src/border-box-control/border-box-control/component.tsx +1 -1
- package/src/border-box-control/border-box-control-split-controls/component.tsx +4 -4
- package/src/border-control/border-control-dropdown/component.tsx +1 -1
- package/src/button/index.native.js +1 -1
- package/src/button/index.tsx +3 -4
- package/src/button/style.scss +1 -3
- package/src/button/test/index.tsx +6 -6
- package/src/button/types.ts +37 -9
- package/src/circular-option-picker/test/index.tsx +2 -4
- package/src/combobox-control/test/index.tsx +1 -1
- package/src/confirm-dialog/README.md +7 -0
- package/src/confirm-dialog/component.tsx +1 -1
- package/src/confirm-dialog/test/index.tsx +5 -21
- package/src/custom-select-control-v2/default-component/index.tsx +4 -1
- package/src/custom-select-control-v2/index.tsx +1 -1
- package/src/custom-select-control-v2/legacy-component/test/index.tsx +457 -0
- package/src/custom-select-control-v2/stories/legacy.story.tsx +5 -6
- package/src/custom-select-control-v2/test/index.tsx +279 -749
- package/src/custom-select-control-v2/types.ts +0 -1
- package/src/date-time/date/styles.ts +2 -2
- package/src/dimension-control/test/__snapshots__/index.test.js.snap +4 -4
- package/src/disabled/test/index.tsx +1 -1
- package/src/draggable/index.native.js +2 -2
- package/src/draggable/test/index.native.js +6 -2
- package/src/dropdown/stories/index.story.tsx +19 -0
- package/src/dropdown/style.scss +26 -0
- package/src/dropdown-menu/index.native.js +2 -2
- package/src/dropdown-menu/style.scss +0 -25
- package/src/flex/flex/README.md +2 -2
- package/src/flex/flex/hook.ts +1 -1
- package/src/font-size-picker/index.native.js +2 -2
- package/src/form-token-field/README.md +1 -1
- package/src/form-token-field/index.tsx +2 -2
- package/src/grid/README.md +11 -11
- package/src/h-stack/README.md +6 -6
- package/src/h-stack/hook.tsx +2 -1
- package/src/h-stack/test/index.tsx +10 -0
- package/src/heading/README.md +1 -1
- package/src/heading/test/__snapshots__/index.tsx.snap +3 -3
- package/src/input-control/README.md +1 -1
- package/src/input-control/index.tsx +1 -1
- package/src/input-control/stories/index.story.tsx +1 -0
- package/src/item-group/test/__snapshots__/index.js.snap +11 -11
- package/src/item-group/test/index.js +2 -2
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +10 -15
- package/src/mobile/bottom-sheet/button.native.js +1 -5
- package/src/mobile/bottom-sheet/index.native.js +2 -2
- package/src/mobile/bottom-sheet/range-cell.native.js +1 -1
- package/src/mobile/bottom-sheet/stepper-cell/index.native.js +2 -2
- package/src/mobile/bottom-sheet-select-control/README.md +1 -1
- package/src/mobile/bottom-sheet-select-control/index.native.js +1 -1
- package/src/mobile/bottom-sheet-text-control/index.native.js +1 -1
- package/src/mobile/gradient/index.native.js +1 -1
- package/src/mobile/image/index.native.js +8 -23
- package/src/mobile/media-edit/index.native.js +1 -1
- package/src/modal/test/index.tsx +1 -1
- package/src/navigation/stories/utils/hide-if-empty.tsx +2 -6
- package/src/palette-edit/index.tsx +23 -23
- package/src/palette-edit/test/index.tsx +21 -17
- package/src/placeholder/style.scss +5 -1
- package/src/popover/test/index.tsx +1 -4
- package/src/progress-bar/README.md +1 -1
- package/src/query-controls/index.native.js +2 -2
- package/src/radio-control/README.md +3 -3
- package/src/radio-group/stories/index.story.tsx +1 -0
- package/src/range-control/index.tsx +3 -3
- package/src/range-control/test/index.tsx +2 -2
- package/src/resizable-box/resize-tooltip/README.md +2 -2
- package/src/search-control/index.native.js +1 -1
- package/src/snackbar/index.tsx +5 -2
- package/src/snackbar/list.tsx +6 -1
- package/src/snackbar/stories/list.story.tsx +0 -3
- package/src/snackbar/test/index.tsx +267 -0
- package/src/snackbar/test/list.tsx +46 -0
- package/src/snackbar/types.ts +31 -3
- package/src/tabs/README.md +18 -18
- package/src/tabs/index.tsx +7 -7
- package/src/tabs/stories/index.story.tsx +1 -1
- package/src/tabs/test/index.tsx +30 -30
- package/src/tabs/types.ts +1 -1
- package/src/text/test/__snapshots__/index.tsx.snap +3 -3
- package/src/text-control/types.ts +12 -1
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +14 -10
- package/src/toggle-group-control/test/index.tsx +1 -1
- package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +12 -10
- package/src/tools-panel/stories/index.story.tsx +8 -8
- package/src/tools-panel/test/index.tsx +10 -28
- package/src/tools-panel/tools-panel-header/component.tsx +1 -1
- package/src/tooltip/style.scss +2 -1
- package/src/tooltip/test/index.native.js +3 -3
- package/src/tree-grid/test/index.tsx +1 -1
- package/src/truncate/README.md +5 -5
- package/src/utils/config-values.js +1 -1
- package/src/utils/hooks/index.js +0 -1
- package/src/utils/input/base.js +1 -1
- package/src/v-stack/README.md +6 -6
- package/src/v-stack/test/index.tsx +10 -0
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/custom-select-control-v2/legacy-adapter.js +0 -29
- package/build/custom-select-control-v2/legacy-adapter.js.map +0 -1
- package/build/utils/hooks/use-latest-ref.js +0 -33
- package/build/utils/hooks/use-latest-ref.js.map +0 -1
- package/build-module/custom-select-control-v2/legacy-adapter.js +0 -21
- package/build-module/custom-select-control-v2/legacy-adapter.js.map +0 -1
- package/build-module/utils/hooks/use-latest-ref.js +0 -27
- package/build-module/utils/hooks/use-latest-ref.js.map +0 -1
- package/build-types/custom-select-control-v2/legacy-adapter.d.ts +0 -6
- package/build-types/custom-select-control-v2/legacy-adapter.d.ts.map +0 -1
- package/build-types/utils/hooks/use-latest-ref.d.ts +0 -15
- package/build-types/utils/hooks/use-latest-ref.d.ts.map +0 -1
- package/src/custom-select-control-v2/legacy-adapter.tsx +0 -25
- package/src/utils/hooks/test/use-latest-ref.js +0 -119
- package/src/utils/hooks/use-latest-ref.ts +0 -29
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_slider","_interopRequireDefault","_i18n","_element","_compose","_cell","_lockIcon","_rangeCell","_rangeTextInput","_utils","isIOS","Platform","OS","BottomSheetRangeCell","Component","constructor","props","onSliderChange","bind","onCompleteSliderChange","onTextInputChange","a11yIncrementValue","a11yDecrementValue","a11yUpdateValue","value","defaultValue","minimumValue","initialValue","Number","state","inputValue","sliderValue","componentWillUnmount","clearTimeout","timeoutAnnounceValue","decimalNum","onChange","toFixed","setState","nextValue","onComplete","step","maximumValue","newValue","undefined","announceValue","label","unitLabel","setTimeout","AccessibilityInfo","announceForAccessibility","render","disabled","preferredColorScheme","minimumTrackTintColor","maximumTrackTintColor","thumbTintColor","preview","cellContainerStyle","shouldDisplayTextInput","settingLabel","openUnitPicker","children","cellProps","getAccessibilityHint","__","getAccessibilityLabel","sprintf","containerStyle","styles","container","containerIOS","containerAndroid","_react","createElement","View","accessible","accessibilityRole","accessibilityActions","name","onAccessibilityAction","event","nativeEvent","actionName","accessibilityLabel","accessibilityHint","importantForAccessibility","default","cellContainerStyles","cellRowContainerStyle","leftAlign","editable","activeOpacity","valueStyle","showLockIcon","style","testID","onValueChange","onSlidingComplete","ref","slider","sliderRef","sliderIOS","sliderAndroid","min","max","_default","exports","withPreferredColorScheme"],"sources":["@wordpress/components/src/mobile/bottom-sheet/range-cell.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Platform, AccessibilityInfo, View } from 'react-native';\nimport Slider from '@react-native-community/slider';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Component } from '@wordpress/element';\nimport { withPreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Cell from './cell';\nimport LockIcon from './lock-icon';\nimport styles from './range-cell.scss';\nimport RangeTextInput from './range-text-input';\nimport { toFixed } from '../utils';\n\nconst isIOS = Platform.OS === 'ios';\n\nclass BottomSheetRangeCell extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\t\tthis.onSliderChange = this.onSliderChange.bind( this );\n\t\tthis.onCompleteSliderChange = this.onCompleteSliderChange.bind( this );\n\t\tthis.onTextInputChange = this.onTextInputChange.bind( this );\n\t\tthis.a11yIncrementValue = this.a11yIncrementValue.bind( this );\n\t\tthis.a11yDecrementValue = this.a11yDecrementValue.bind( this );\n\t\tthis.a11yUpdateValue = this.a11yUpdateValue.bind( this );\n\n\t\tconst { value, defaultValue, minimumValue } = props;\n\t\tconst initialValue = Number( value || defaultValue || minimumValue );\n\n\t\tthis.state = {\n\t\t\tinputValue: initialValue,\n\t\t\tsliderValue: initialValue,\n\t\t};\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearTimeout( this.timeoutAnnounceValue );\n\t}\n\n\tonSliderChange( initialValue ) {\n\t\tconst { decimalNum, onChange } = this.props;\n\t\tinitialValue = toFixed( initialValue, decimalNum );\n\t\tthis.setState( { inputValue: initialValue } );\n\t\tonChange( initialValue );\n\t}\n\n\tonTextInputChange( nextValue ) {\n\t\tconst { onChange, onComplete } = this.props;\n\t\tthis.setState( {\n\t\t\tsliderValue: nextValue,\n\t\t} );\n\t\tonChange( nextValue );\n\t\tif ( onComplete ) {\n\t\t\tonComplete( nextValue );\n\t\t}\n\t}\n\n\tonCompleteSliderChange( nextValue ) {\n\t\tconst { decimalNum, onComplete } = this.props;\n\t\tnextValue = toFixed( nextValue, decimalNum );\n\t\tif ( onComplete ) {\n\t\t\tonComplete( nextValue );\n\t\t}\n\t}\n\n\t/*\n\t * Only used with screenreaders like VoiceOver and TalkBack. Increments the\n\t * value of this setting programmatically.\n\t */\n\ta11yIncrementValue() {\n\t\tconst { step = 5, maximumValue, decimalNum } = this.props;\n\t\tconst { inputValue } = this.state;\n\n\t\tconst newValue = toFixed( inputValue + step, decimalNum );\n\n\t\tif ( newValue <= maximumValue || maximumValue === undefined ) {\n\t\t\tthis.a11yUpdateValue( newValue );\n\t\t}\n\t}\n\n\t/*\n\t * Only used with screenreaders like VoiceOver and TalkBack. Decrements the\n\t * value of this setting programmatically.\n\t */\n\ta11yDecrementValue() {\n\t\tconst { step = 5, minimumValue, decimalNum } = this.props;\n\t\tconst { sliderValue } = this.state;\n\n\t\tconst newValue = toFixed( sliderValue - step, decimalNum );\n\n\t\tif ( newValue >= minimumValue ) {\n\t\t\tthis.a11yUpdateValue( newValue );\n\t\t}\n\t}\n\n\ta11yUpdateValue( newValue ) {\n\t\tconst { onChange, onComplete } = this.props;\n\t\tthis.setState( {\n\t\t\tsliderValue: newValue,\n\t\t\tinputValue: newValue,\n\t\t} );\n\t\tonChange( newValue );\n\t\tif ( onComplete ) {\n\t\t\tonComplete( newValue );\n\t\t}\n\t\tthis.announceValue( newValue );\n\t}\n\n\t/*\n\t * Only used with screenreaders like VoiceOver and TalkBack.\n\t */\n\tannounceValue( value ) {\n\t\tconst { label, unitLabel = '' } = this.props;\n\n\t\tif ( isIOS ) {\n\t\t\t// On Android it triggers the accessibilityLabel with the value change, but\n\t\t\t// on iOS we need to do this manually.\n\t\t\tclearTimeout( this.timeoutAnnounceValue );\n\t\t\tthis.timeoutAnnounceValue = setTimeout( () => {\n\t\t\t\tAccessibilityInfo.announceForAccessibility(\n\t\t\t\t\t`${ value } ${ unitLabel }, ${ label }`\n\t\t\t\t);\n\t\t\t}, 300 );\n\t\t}\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\tminimumValue = 0,\n\t\t\tmaximumValue = 10,\n\t\t\tdisabled,\n\t\t\tstep = 1,\n\t\t\tpreferredColorScheme,\n\t\t\tminimumTrackTintColor = preferredColorScheme === 'light'\n\t\t\t\t? '#00669b'\n\t\t\t\t: '#5198d9',\n\t\t\tmaximumTrackTintColor = isIOS ? '#e9eff3' : '#909090',\n\t\t\tthumbTintColor = ! isIOS && '#00669b',\n\t\t\tpreview,\n\t\t\tcellContainerStyle,\n\t\t\tshouldDisplayTextInput = true,\n\t\t\tunitLabel = '',\n\t\t\tsettingLabel = 'Value',\n\t\t\topenUnitPicker,\n\t\t\tchildren,\n\t\t\tdecimalNum,\n\t\t\t...cellProps\n\t\t} = this.props;\n\n\t\tconst { inputValue, sliderValue } = this.state;\n\n\t\tconst getAccessibilityHint = () => {\n\t\t\treturn openUnitPicker ? __( 'double-tap to change unit' ) : '';\n\t\t};\n\n\t\tconst getAccessibilityLabel = () => {\n\t\t\treturn sprintf(\n\t\t\t\t/* translators: accessibility text. Inform about current value. %1$s: Control label %2$s: setting label (example: width), %3$s: Current value. %4$s: value measurement unit (example: pixels) */\n\t\t\t\t__( '%1$s. %2$s is %3$s %4$s.' ),\n\t\t\t\tcellProps.label,\n\t\t\t\tsettingLabel,\n\t\t\t\ttoFixed( value, decimalNum ),\n\t\t\t\tunitLabel\n\t\t\t);\n\t\t};\n\n\t\tconst containerStyle = [\n\t\t\tstyles.container,\n\t\t\tisIOS ? styles.containerIOS : styles.containerAndroid,\n\t\t];\n\n\t\treturn (\n\t\t\t<View\n\t\t\t\taccessible={ true }\n\t\t\t\taccessibilityRole=\"adjustable\"\n\t\t\t\taccessibilityActions={ [\n\t\t\t\t\t{ name: 'increment' },\n\t\t\t\t\t{ name: 'decrement' },\n\t\t\t\t\t{ name: 'activate' },\n\t\t\t\t] }\n\t\t\t\tonAccessibilityAction={ ( event ) => {\n\t\t\t\t\tswitch ( event.nativeEvent.actionName ) {\n\t\t\t\t\t\tcase 'increment':\n\t\t\t\t\t\t\tthis.a11yIncrementValue();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'decrement':\n\t\t\t\t\t\t\tthis.a11yDecrementValue();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'activate':\n\t\t\t\t\t\t\tif ( openUnitPicker ) {\n\t\t\t\t\t\t\t\topenUnitPicker();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\taccessibilityLabel={ getAccessibilityLabel() }\n\t\t\t\taccessibilityHint={ getAccessibilityHint() }\n\t\t\t>\n\t\t\t\t<View importantForAccessibility=\"no-hide-descendants\">\n\t\t\t\t\t<Cell\n\t\t\t\t\t\t{ ...cellProps }\n\t\t\t\t\t\tcellContainerStyle={ [\n\t\t\t\t\t\t\tstyles.cellContainerStyles,\n\t\t\t\t\t\t\tcellContainerStyle,\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tcellRowContainerStyle={ containerStyle }\n\t\t\t\t\t\tleftAlign\n\t\t\t\t\t\teditable={ false }\n\t\t\t\t\t\tactiveOpacity={ 1 }\n\t\t\t\t\t\taccessible={ false }\n\t\t\t\t\t\tvalueStyle={ styles.valueStyle }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tshowLockIcon={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t<View style={ containerStyle }>\n\t\t\t\t\t\t\t{ preview }\n\t\t\t\t\t\t\t<Slider\n\t\t\t\t\t\t\t\ttestID={ `Slider ${ cellProps.label }` }\n\t\t\t\t\t\t\t\tvalue={ sliderValue }\n\t\t\t\t\t\t\t\tdefaultValue={ defaultValue }\n\t\t\t\t\t\t\t\tdisabled={ disabled && ! isIOS }\n\t\t\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\t\t\tminimumValue={ minimumValue }\n\t\t\t\t\t\t\t\tmaximumValue={ maximumValue }\n\t\t\t\t\t\t\t\tminimumTrackTintColor={ minimumTrackTintColor }\n\t\t\t\t\t\t\t\tmaximumTrackTintColor={ maximumTrackTintColor }\n\t\t\t\t\t\t\t\tthumbTintColor={ thumbTintColor }\n\t\t\t\t\t\t\t\tonValueChange={ this.onSliderChange }\n\t\t\t\t\t\t\t\tonSlidingComplete={\n\t\t\t\t\t\t\t\t\tthis.onCompleteSliderChange\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tref={ ( slider ) => {\n\t\t\t\t\t\t\t\t\tthis.sliderRef = slider;\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\tisIOS\n\t\t\t\t\t\t\t\t\t\t? styles.sliderIOS\n\t\t\t\t\t\t\t\t\t\t: styles.sliderAndroid\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ shouldDisplayTextInput && (\n\t\t\t\t\t\t\t\t<RangeTextInput\n\t\t\t\t\t\t\t\t\tlabel={ cellProps.label }\n\t\t\t\t\t\t\t\t\tonChange={ this.onTextInputChange }\n\t\t\t\t\t\t\t\t\tdefaultValue={ `${ inputValue }` }\n\t\t\t\t\t\t\t\t\tvalue={ inputValue }\n\t\t\t\t\t\t\t\t\tmin={ minimumValue }\n\t\t\t\t\t\t\t\t\tmax={ maximumValue }\n\t\t\t\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\t\t\t\tdecimalNum={ decimalNum }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t\t</RangeTextInput>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ disabled && <LockIcon /> }\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</Cell>\n\t\t\t\t</View>\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nexport default withPreferredColorScheme( BottomSheetRangeCell );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,KAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,SAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,UAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,eAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AApBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;A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nB,IAAI,CAACC,SAAS,GAAGD,MAAM;MACxB,CAAG;MACHL,KAAK,EACJrF,KAAK,GACF2D,kBAAM,CAACiC,SAAS,GAChBjC,kBAAM,CAACkC;IACV,CACD,CAAC,EACA5C,sBAAsB,IACvB,IAAAc,MAAA,CAAAC,aAAA,EAAClE,eAAA,CAAA+E,OAAc;MACdzC,KAAK,EAAGiB,SAAS,CAACjB,KAAO;MACzBV,QAAQ,EAAG,IAAI,CAAChB,iBAAmB;MACnCK,YAAY,EAAI,GAAGK,UAAY,EAAG;MAClCN,KAAK,EAAGM,UAAY;MACpB0E,GAAG,EAAG9E,YAAc;MACpB+E,GAAG,EAAG/D,YAAc;MACpBD,IAAI,EAAGA,IAAM;MACbN,UAAU,EAAGA;IAAY,GAEvB2B,QACa,CAChB,EACCV,QAAQ,IAAI,IAAAqB,MAAA,CAAAC,aAAA,EAACpE,SAAA,CAAAiF,OAAQ,MAAE,CACpB,CACD,CACD,CACD,CAAC;EAET;AACD;AAAC,IAAAmB,QAAA,GAAAC,OAAA,CAAApB,OAAA,GAEc,IAAAqB,iCAAwB,EAAE/F,oBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_slider","_interopRequireDefault","_i18n","_element","_compose","_cell","_lockIcon","_rangeCell","_rangeTextInput","_utils","isIOS","Platform","OS","BottomSheetRangeCell","Component","constructor","props","onSliderChange","bind","onCompleteSliderChange","onTextInputChange","a11yIncrementValue","a11yDecrementValue","a11yUpdateValue","value","defaultValue","minimumValue","initialValue","Number","state","inputValue","sliderValue","componentWillUnmount","clearTimeout","timeoutAnnounceValue","decimalNum","onChange","toFixed","setState","nextValue","onComplete","step","maximumValue","newValue","undefined","announceValue","label","unitLabel","setTimeout","AccessibilityInfo","announceForAccessibility","render","disabled","preferredColorScheme","minimumTrackTintColor","maximumTrackTintColor","thumbTintColor","preview","cellContainerStyle","shouldDisplayTextInput","settingLabel","openUnitPicker","children","cellProps","getAccessibilityHint","__","getAccessibilityLabel","sprintf","containerStyle","styles","container","containerIOS","containerAndroid","_react","createElement","View","accessible","accessibilityRole","accessibilityActions","name","onAccessibilityAction","event","nativeEvent","actionName","accessibilityLabel","accessibilityHint","importantForAccessibility","default","cellContainerStyles","cellRowContainerStyle","leftAlign","editable","activeOpacity","valueStyle","showLockIcon","style","testID","onValueChange","onSlidingComplete","ref","slider","sliderRef","sliderIOS","sliderAndroid","min","max","_default","exports","withPreferredColorScheme"],"sources":["@wordpress/components/src/mobile/bottom-sheet/range-cell.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Platform, AccessibilityInfo, View } from 'react-native';\nimport Slider from '@react-native-community/slider';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Component } from '@wordpress/element';\nimport { withPreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Cell from './cell';\nimport LockIcon from './lock-icon';\nimport styles from './range-cell.scss';\nimport RangeTextInput from './range-text-input';\nimport { toFixed } from '../utils';\n\nconst isIOS = Platform.OS === 'ios';\n\nclass BottomSheetRangeCell extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\t\tthis.onSliderChange = this.onSliderChange.bind( this );\n\t\tthis.onCompleteSliderChange = this.onCompleteSliderChange.bind( this );\n\t\tthis.onTextInputChange = this.onTextInputChange.bind( this );\n\t\tthis.a11yIncrementValue = this.a11yIncrementValue.bind( this );\n\t\tthis.a11yDecrementValue = this.a11yDecrementValue.bind( this );\n\t\tthis.a11yUpdateValue = this.a11yUpdateValue.bind( this );\n\n\t\tconst { value, defaultValue, minimumValue } = props;\n\t\tconst initialValue = Number( value || defaultValue || minimumValue );\n\n\t\tthis.state = {\n\t\t\tinputValue: initialValue,\n\t\t\tsliderValue: initialValue,\n\t\t};\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearTimeout( this.timeoutAnnounceValue );\n\t}\n\n\tonSliderChange( initialValue ) {\n\t\tconst { decimalNum, onChange } = this.props;\n\t\tinitialValue = toFixed( initialValue, decimalNum );\n\t\tthis.setState( { inputValue: initialValue } );\n\t\tonChange( initialValue );\n\t}\n\n\tonTextInputChange( nextValue ) {\n\t\tconst { onChange, onComplete } = this.props;\n\t\tthis.setState( {\n\t\t\tsliderValue: nextValue,\n\t\t} );\n\t\tonChange( nextValue );\n\t\tif ( onComplete ) {\n\t\t\tonComplete( nextValue );\n\t\t}\n\t}\n\n\tonCompleteSliderChange( nextValue ) {\n\t\tconst { decimalNum, onComplete } = this.props;\n\t\tnextValue = toFixed( nextValue, decimalNum );\n\t\tif ( onComplete ) {\n\t\t\tonComplete( nextValue );\n\t\t}\n\t}\n\n\t/*\n\t * Only used with screenreaders like VoiceOver and TalkBack. Increments the\n\t * value of this setting programmatically.\n\t */\n\ta11yIncrementValue() {\n\t\tconst { step = 5, maximumValue, decimalNum } = this.props;\n\t\tconst { inputValue } = this.state;\n\n\t\tconst newValue = toFixed( inputValue + step, decimalNum );\n\n\t\tif ( newValue <= maximumValue || maximumValue === undefined ) {\n\t\t\tthis.a11yUpdateValue( newValue );\n\t\t}\n\t}\n\n\t/*\n\t * Only used with screenreaders like VoiceOver and TalkBack. Decrements the\n\t * value of this setting programmatically.\n\t */\n\ta11yDecrementValue() {\n\t\tconst { step = 5, minimumValue, decimalNum } = this.props;\n\t\tconst { sliderValue } = this.state;\n\n\t\tconst newValue = toFixed( sliderValue - step, decimalNum );\n\n\t\tif ( newValue >= minimumValue ) {\n\t\t\tthis.a11yUpdateValue( newValue );\n\t\t}\n\t}\n\n\ta11yUpdateValue( newValue ) {\n\t\tconst { onChange, onComplete } = this.props;\n\t\tthis.setState( {\n\t\t\tsliderValue: newValue,\n\t\t\tinputValue: newValue,\n\t\t} );\n\t\tonChange( newValue );\n\t\tif ( onComplete ) {\n\t\t\tonComplete( newValue );\n\t\t}\n\t\tthis.announceValue( newValue );\n\t}\n\n\t/*\n\t * Only used with screenreaders like VoiceOver and TalkBack.\n\t */\n\tannounceValue( value ) {\n\t\tconst { label, unitLabel = '' } = this.props;\n\n\t\tif ( isIOS ) {\n\t\t\t// On Android it triggers the accessibilityLabel with the value change, but\n\t\t\t// on iOS we need to do this manually.\n\t\t\tclearTimeout( this.timeoutAnnounceValue );\n\t\t\tthis.timeoutAnnounceValue = setTimeout( () => {\n\t\t\t\tAccessibilityInfo.announceForAccessibility(\n\t\t\t\t\t`${ value } ${ unitLabel }, ${ label }`\n\t\t\t\t);\n\t\t\t}, 300 );\n\t\t}\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\tminimumValue = 0,\n\t\t\tmaximumValue = 10,\n\t\t\tdisabled,\n\t\t\tstep = 1,\n\t\t\tpreferredColorScheme,\n\t\t\tminimumTrackTintColor = preferredColorScheme === 'light'\n\t\t\t\t? '#00669b'\n\t\t\t\t: '#5198d9',\n\t\t\tmaximumTrackTintColor = isIOS ? '#e9eff3' : '#909090',\n\t\t\tthumbTintColor = ! isIOS && '#00669b',\n\t\t\tpreview,\n\t\t\tcellContainerStyle,\n\t\t\tshouldDisplayTextInput = true,\n\t\t\tunitLabel = '',\n\t\t\tsettingLabel = 'Value',\n\t\t\topenUnitPicker,\n\t\t\tchildren,\n\t\t\tdecimalNum,\n\t\t\t...cellProps\n\t\t} = this.props;\n\n\t\tconst { inputValue, sliderValue } = this.state;\n\n\t\tconst getAccessibilityHint = () => {\n\t\t\treturn openUnitPicker ? __( 'double-tap to change unit' ) : '';\n\t\t};\n\n\t\tconst getAccessibilityLabel = () => {\n\t\t\treturn sprintf(\n\t\t\t\t/* translators: accessibility text. Inform about current value. %1$s: Control label %2$s: setting label (example: width), %3$s: Current value. %4$s: value measurement unit (example: pixels) */\n\t\t\t\t__( '%1$s. %2$s is %3$s %4$s.' ),\n\t\t\t\tcellProps.label,\n\t\t\t\tsettingLabel,\n\t\t\t\ttoFixed( value, decimalNum ),\n\t\t\t\tunitLabel\n\t\t\t);\n\t\t};\n\n\t\tconst containerStyle = [\n\t\t\tstyles.container,\n\t\t\tisIOS ? styles.containerIOS : styles.containerAndroid,\n\t\t];\n\n\t\treturn (\n\t\t\t<View\n\t\t\t\taccessible\n\t\t\t\taccessibilityRole=\"adjustable\"\n\t\t\t\taccessibilityActions={ [\n\t\t\t\t\t{ name: 'increment' },\n\t\t\t\t\t{ name: 'decrement' },\n\t\t\t\t\t{ name: 'activate' },\n\t\t\t\t] }\n\t\t\t\tonAccessibilityAction={ ( event ) => {\n\t\t\t\t\tswitch ( event.nativeEvent.actionName ) {\n\t\t\t\t\t\tcase 'increment':\n\t\t\t\t\t\t\tthis.a11yIncrementValue();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'decrement':\n\t\t\t\t\t\t\tthis.a11yDecrementValue();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'activate':\n\t\t\t\t\t\t\tif ( openUnitPicker ) {\n\t\t\t\t\t\t\t\topenUnitPicker();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\taccessibilityLabel={ getAccessibilityLabel() }\n\t\t\t\taccessibilityHint={ getAccessibilityHint() }\n\t\t\t>\n\t\t\t\t<View importantForAccessibility=\"no-hide-descendants\">\n\t\t\t\t\t<Cell\n\t\t\t\t\t\t{ ...cellProps }\n\t\t\t\t\t\tcellContainerStyle={ [\n\t\t\t\t\t\t\tstyles.cellContainerStyles,\n\t\t\t\t\t\t\tcellContainerStyle,\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tcellRowContainerStyle={ containerStyle }\n\t\t\t\t\t\tleftAlign\n\t\t\t\t\t\teditable={ false }\n\t\t\t\t\t\tactiveOpacity={ 1 }\n\t\t\t\t\t\taccessible={ false }\n\t\t\t\t\t\tvalueStyle={ styles.valueStyle }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tshowLockIcon={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t<View style={ containerStyle }>\n\t\t\t\t\t\t\t{ preview }\n\t\t\t\t\t\t\t<Slider\n\t\t\t\t\t\t\t\ttestID={ `Slider ${ cellProps.label }` }\n\t\t\t\t\t\t\t\tvalue={ sliderValue }\n\t\t\t\t\t\t\t\tdefaultValue={ defaultValue }\n\t\t\t\t\t\t\t\tdisabled={ disabled && ! isIOS }\n\t\t\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\t\t\tminimumValue={ minimumValue }\n\t\t\t\t\t\t\t\tmaximumValue={ maximumValue }\n\t\t\t\t\t\t\t\tminimumTrackTintColor={ minimumTrackTintColor }\n\t\t\t\t\t\t\t\tmaximumTrackTintColor={ maximumTrackTintColor }\n\t\t\t\t\t\t\t\tthumbTintColor={ thumbTintColor }\n\t\t\t\t\t\t\t\tonValueChange={ this.onSliderChange }\n\t\t\t\t\t\t\t\tonSlidingComplete={\n\t\t\t\t\t\t\t\t\tthis.onCompleteSliderChange\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tref={ ( slider ) => {\n\t\t\t\t\t\t\t\t\tthis.sliderRef = slider;\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\tisIOS\n\t\t\t\t\t\t\t\t\t\t? styles.sliderIOS\n\t\t\t\t\t\t\t\t\t\t: styles.sliderAndroid\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ shouldDisplayTextInput && (\n\t\t\t\t\t\t\t\t<RangeTextInput\n\t\t\t\t\t\t\t\t\tlabel={ cellProps.label }\n\t\t\t\t\t\t\t\t\tonChange={ this.onTextInputChange }\n\t\t\t\t\t\t\t\t\tdefaultValue={ `${ inputValue }` }\n\t\t\t\t\t\t\t\t\tvalue={ inputValue }\n\t\t\t\t\t\t\t\t\tmin={ minimumValue }\n\t\t\t\t\t\t\t\t\tmax={ maximumValue }\n\t\t\t\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\t\t\t\tdecimalNum={ decimalNum }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t\t</RangeTextInput>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ disabled && <LockIcon /> }\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</Cell>\n\t\t\t\t</View>\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nexport default withPreferredColorScheme( BottomSheetRangeCell );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,KAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,SAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,UAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,eAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AApBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AAOA,MAAMW,KAAK,GAAGC,qBAAQ,CAACC,EAAE,KAAK,KAAK;AAEnC,MAAMC,oBAAoB,SAASC,kBAAS,CAAC;EAC5CC,WAAWA,CAAEC,KAAK,EAAG;IACpB,KAAK,CAAEA,KAAM,CAAC;IACd,IAAI,CAACC,cAAc,GAAG,IAAI,CAACA,cAAc,CAACC,IAAI,CAAE,IAAK,CAAC;IACtD,IAAI,CAACC,sBAAsB,GAAG,IAAI,CAACA,sBAAsB,CAACD,IAAI,CAAE,IAAK,CAAC;IACtE,IAAI,CAACE,iBAAiB,GAAG,IAAI,CAACA,iBAAiB,CAACF,IAAI,CAAE,IAAK,CAAC;IAC5D,IAAI,CAACG,kBAAkB,GAAG,IAAI,CAACA,kBAAkB,CAACH,IAAI,CAAE,IAAK,CAAC;IAC9D,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MAAA,CAAAC,aAAA,EAACpE,SAAA,CAAAiF,OAAQ,MAAE,CACpB,CACD,CACD,CACD,CAAC;EAET;AACD;AAAC,IAAAmB,QAAA,GAAAC,OAAA,CAAApB,OAAA,GAEc,IAAAqB,iCAAwB,EAAE/F,oBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_i18n","_element","_compose","_cell","_interopRequireDefault","_stepper","_style","_rangeTextInput","_utils","STEP_DELAY","DEFAULT_STEP","isIOS","Platform","OS","BottomSheetStepperCell","Component","constructor","props","announceValue","bind","onDecrementValue","onDecrementValuePressIn","onIncrementValue","onIncrementValuePressIn","onPressOut","value","defaultValue","min","initialValue","state","inputValue","stepperValue","componentWillUnmount","clearTimeout","timeout","clearInterval","interval","timeoutAnnounceValue","step","max","onChange","decimalNum","newValue","toFixed","parseInt","undefined","setState","setTimeout","startPressInterval","callback","speed","counter","setInterval","label","unitLabel","AccessibilityInfo","announceForAccessibility","render","settingLabel","icon","separatorType","children","shouldDisplayTextInput","preview","openUnitPicker","cellContainerStyle","disabled","isMinValue","isMaxValue","labelStyle","styles","cellLabel","cellLabelNoIcon","getAccessibilityHint","__","accessibilityLabel","sprintf","containerStyle","rowContainer","containerIOS","containerAndroid","_react","createElement","View","accessible","accessibilityRole","accessibilityHint","accessibilityActions","name","onAccessibilityAction","event","nativeEvent","actionName","importantForAccessibility","default","columnContainer","cellRowContainerStyle","cellRowStyles","editable","leftAlign","style","onPressInDecrement","onPressInIncrement","defaultProps","_default","exports","withPreferredColorScheme"],"sources":["@wordpress/components/src/mobile/bottom-sheet/stepper-cell/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { AccessibilityInfo, View, Platform } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Component } from '@wordpress/element';\nimport { withPreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Cell from '../cell';\nimport Stepper from './stepper';\nimport styles from './style.scss';\nimport RangeTextInput from '../range-text-input';\nimport { toFixed } from '../../utils';\n\nconst STEP_DELAY = 200;\nconst DEFAULT_STEP = 1;\n\nconst isIOS = Platform.OS === 'ios';\n\nclass BottomSheetStepperCell extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\n\t\tthis.announceValue = this.announceValue.bind( this );\n\t\tthis.onDecrementValue = this.onDecrementValue.bind( this );\n\t\tthis.onDecrementValuePressIn =\n\t\t\tthis.onDecrementValuePressIn.bind( this );\n\t\tthis.onIncrementValue = this.onIncrementValue.bind( this );\n\t\tthis.onIncrementValuePressIn =\n\t\t\tthis.onIncrementValuePressIn.bind( this );\n\t\tthis.onPressOut = this.onPressOut.bind( this );\n\n\t\tconst { value, defaultValue, min } = props;\n\n\t\tconst initialValue = value || defaultValue || min;\n\n\t\tthis.state = {\n\t\t\tinputValue: initialValue,\n\t\t\tstepperValue: initialValue,\n\t\t};\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearTimeout( this.timeout );\n\t\tclearInterval( this.interval );\n\t\tclearTimeout( this.timeoutAnnounceValue );\n\t}\n\n\tonIncrementValue() {\n\t\tconst { step, max, onChange, value, decimalNum } = this.props;\n\t\tlet newValue = toFixed( value + step, decimalNum );\n\t\tnewValue =\n\t\t\tparseInt( newValue ) === newValue ? parseInt( newValue ) : newValue;\n\t\tif ( newValue <= max || max === undefined ) {\n\t\t\tonChange( newValue );\n\t\t\tthis.setState( {\n\t\t\t\tinputValue: newValue,\n\t\t\t} );\n\t\t\tthis.announceValue( newValue );\n\t\t}\n\t}\n\n\tonDecrementValue() {\n\t\tconst { step, min, onChange, value, decimalNum } = this.props;\n\t\tlet newValue = toFixed( value - step, decimalNum );\n\t\tnewValue =\n\t\t\tparseInt( newValue ) === newValue ? parseInt( newValue ) : newValue;\n\t\tif ( newValue >= min ) {\n\t\t\tonChange( newValue );\n\t\t\tthis.setState( {\n\t\t\t\tinputValue: newValue,\n\t\t\t} );\n\t\t\tthis.announceValue( newValue );\n\t\t}\n\t}\n\n\tonIncrementValuePressIn() {\n\t\tthis.onIncrementValue();\n\t\tthis.timeout = setTimeout( () => {\n\t\t\tthis.startPressInterval( this.onIncrementValue );\n\t\t}, 500 );\n\t}\n\n\tonDecrementValuePressIn() {\n\t\tthis.onDecrementValue();\n\t\tthis.timeout = setTimeout( () => {\n\t\t\tthis.startPressInterval( this.onDecrementValue );\n\t\t}, 500 );\n\t}\n\n\tonPressOut() {\n\t\tclearTimeout( this.timeout );\n\t\tclearInterval( this.interval );\n\t}\n\n\tstartPressInterval( callback, speed = STEP_DELAY ) {\n\t\tlet counter = 0;\n\t\tthis.interval = setInterval( () => {\n\t\t\tcallback();\n\t\t\tcounter += 1;\n\n\t\t\tif ( counter === 10 ) {\n\t\t\t\tclearInterval( this.interval );\n\t\t\t\tthis.startPressInterval( callback, speed / 2 );\n\t\t\t}\n\t\t}, speed );\n\t}\n\n\tannounceValue( value ) {\n\t\tconst { label, unitLabel = '' } = this.props;\n\n\t\tif ( isIOS ) {\n\t\t\t// On Android it triggers the accessibilityLabel with the value change\n\t\t\tclearTimeout( this.timeoutAnnounceValue );\n\t\t\tthis.timeoutAnnounceValue = setTimeout( () => {\n\t\t\t\tAccessibilityInfo.announceForAccessibility(\n\t\t\t\t\t`${ value } ${ unitLabel } ${ label }`\n\t\t\t\t);\n\t\t\t}, 300 );\n\t\t}\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tlabel,\n\t\t\tsettingLabel = 'Value',\n\t\t\tunitLabel = '',\n\t\t\ticon,\n\t\t\tmin,\n\t\t\tmax,\n\t\t\tvalue,\n\t\t\tseparatorType,\n\t\t\tchildren,\n\t\t\tshouldDisplayTextInput = false,\n\t\t\tpreview,\n\t\t\tonChange,\n\t\t\topenUnitPicker,\n\t\t\tdecimalNum,\n\t\t\tcellContainerStyle,\n\t\t\tdisabled,\n\t\t} = this.props;\n\t\tconst { inputValue } = this.state;\n\t\tconst isMinValue = value === min;\n\t\tconst isMaxValue = value === max;\n\t\tconst labelStyle = [\n\t\t\tstyles.cellLabel,\n\t\t\t! icon ? styles.cellLabelNoIcon : {},\n\t\t];\n\n\t\tconst getAccessibilityHint = () => {\n\t\t\treturn openUnitPicker ? __( 'double-tap to change unit' ) : '';\n\t\t};\n\n\t\tconst accessibilityLabel = sprintf(\n\t\t\t/* translators: accessibility text. Inform about current value. %1$s: Control label %2$s: setting label (example: width), %3$s: Current value. %4$s: value measurement unit (example: pixels) */\n\t\t\t__( '%1$s. %2$s is %3$s %4$s.' ),\n\t\t\tlabel,\n\t\t\tsettingLabel,\n\t\t\tvalue,\n\t\t\tunitLabel\n\t\t);\n\n\t\tconst containerStyle = [\n\t\t\tstyles.rowContainer,\n\t\t\tisIOS ? styles.containerIOS : styles.containerAndroid,\n\t\t];\n\n\t\treturn (\n\t\t\t<View\n\t\t\t\taccessible={ true }\n\t\t\t\taccessibilityRole=\"adjustable\"\n\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\taccessibilityHint={ getAccessibilityHint() }\n\t\t\t\taccessibilityActions={ [\n\t\t\t\t\t{ name: 'increment' },\n\t\t\t\t\t{ name: 'decrement' },\n\t\t\t\t\t{ name: 'activate' },\n\t\t\t\t] }\n\t\t\t\tonAccessibilityAction={ ( event ) => {\n\t\t\t\t\tswitch ( event.nativeEvent.actionName ) {\n\t\t\t\t\t\tcase 'increment':\n\t\t\t\t\t\t\tthis.onIncrementValue();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'decrement':\n\t\t\t\t\t\t\tthis.onDecrementValue();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'activate':\n\t\t\t\t\t\t\tif ( openUnitPicker ) {\n\t\t\t\t\t\t\t\topenUnitPicker();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<View importantForAccessibility=\"no-hide-descendants\">\n\t\t\t\t\t<Cell\n\t\t\t\t\t\taccessible={ false }\n\t\t\t\t\t\tcellContainerStyle={ [\n\t\t\t\t\t\t\tstyles.cellContainerStyle,\n\t\t\t\t\t\t\tpreview && styles.columnContainer,\n\t\t\t\t\t\t\tcellContainerStyle,\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tcellRowContainerStyle={\n\t\t\t\t\t\t\tpreview ? containerStyle : styles.cellRowStyles\n\t\t\t\t\t\t}\n\t\t\t\t\t\teditable={ false }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tlabelStyle={ labelStyle }\n\t\t\t\t\t\tleftAlign={ true }\n\t\t\t\t\t\tseparatorType={ separatorType }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t<View style={ preview && containerStyle }>\n\t\t\t\t\t\t\t{ preview }\n\t\t\t\t\t\t\t<Stepper\n\t\t\t\t\t\t\t\tisMaxValue={ isMaxValue }\n\t\t\t\t\t\t\t\tisMinValue={ isMinValue }\n\t\t\t\t\t\t\t\tonPressInDecrement={\n\t\t\t\t\t\t\t\t\tthis.onDecrementValuePressIn\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonPressInIncrement={\n\t\t\t\t\t\t\t\t\tthis.onIncrementValuePressIn\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonPressOut={ this.onPressOut }\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\tshouldDisplayTextInput={\n\t\t\t\t\t\t\t\t\tshouldDisplayTextInput\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ shouldDisplayTextInput && (\n\t\t\t\t\t\t\t\t\t<RangeTextInput\n\t\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\t\t\tdefaultValue={ `${ inputValue }` }\n\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\t\t\t\t\tstep={ 1 }\n\t\t\t\t\t\t\t\t\t\tdecimalNum={ decimalNum }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t\t\t</RangeTextInput>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Stepper>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</Cell>\n\t\t\t\t</View>\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nBottomSheetStepperCell.defaultProps = {\n\tstep: DEFAULT_STEP,\n};\n\nexport default withPreferredColorScheme( BottomSheetStepperCell );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,KAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,QAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,MAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,eAAA,GAAAH,sBAAA,CAAAL,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAOA,MAAMU,UAAU,GAAG,GAAG;AACtB,MAAMC,YAAY,GAAG,CAAC;AAEtB,MAAMC,KAAK,GAAGC,qBAAQ,CAACC,EAAE,KAAK,KAAK;AAEnC,MAAMC,sBAAsB,SAASC,kBAAS,CAAC;EAC9CC,WAAWA,CAAEC,KAAK,EAAG;IACpB,KAAK,CAAEA,KAAM,CAAC;IAEd,IAAI,CAACC,aAAa,GAAG,IAAI,CAACA,aAAa,CAACC,IAAI,CAAE,IAAK,CAAC;IACpD,IAAI,CAACC,gBAAgB,GAAG,IAAI,CAACA,gBAAgB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,QAAA,GAAAC,OAAA,CAAAX,OAAA,GAEa,IAAAY,iCAAwB,EAAE5F,sBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_i18n","_element","_compose","_cell","_interopRequireDefault","_stepper","_style","_rangeTextInput","_utils","STEP_DELAY","DEFAULT_STEP","isIOS","Platform","OS","BottomSheetStepperCell","Component","constructor","props","announceValue","bind","onDecrementValue","onDecrementValuePressIn","onIncrementValue","onIncrementValuePressIn","onPressOut","value","defaultValue","min","initialValue","state","inputValue","stepperValue","componentWillUnmount","clearTimeout","timeout","clearInterval","interval","timeoutAnnounceValue","step","max","onChange","decimalNum","newValue","toFixed","parseInt","undefined","setState","setTimeout","startPressInterval","callback","speed","counter","setInterval","label","unitLabel","AccessibilityInfo","announceForAccessibility","render","settingLabel","icon","separatorType","children","shouldDisplayTextInput","preview","openUnitPicker","cellContainerStyle","disabled","isMinValue","isMaxValue","labelStyle","styles","cellLabel","cellLabelNoIcon","getAccessibilityHint","__","accessibilityLabel","sprintf","containerStyle","rowContainer","containerIOS","containerAndroid","_react","createElement","View","accessible","accessibilityRole","accessibilityHint","accessibilityActions","name","onAccessibilityAction","event","nativeEvent","actionName","importantForAccessibility","default","columnContainer","cellRowContainerStyle","cellRowStyles","editable","leftAlign","style","onPressInDecrement","onPressInIncrement","defaultProps","_default","exports","withPreferredColorScheme"],"sources":["@wordpress/components/src/mobile/bottom-sheet/stepper-cell/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { AccessibilityInfo, View, Platform } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Component } from '@wordpress/element';\nimport { withPreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Cell from '../cell';\nimport Stepper from './stepper';\nimport styles from './style.scss';\nimport RangeTextInput from '../range-text-input';\nimport { toFixed } from '../../utils';\n\nconst STEP_DELAY = 200;\nconst DEFAULT_STEP = 1;\n\nconst isIOS = Platform.OS === 'ios';\n\nclass BottomSheetStepperCell extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\n\t\tthis.announceValue = this.announceValue.bind( this );\n\t\tthis.onDecrementValue = this.onDecrementValue.bind( this );\n\t\tthis.onDecrementValuePressIn =\n\t\t\tthis.onDecrementValuePressIn.bind( this );\n\t\tthis.onIncrementValue = this.onIncrementValue.bind( this );\n\t\tthis.onIncrementValuePressIn =\n\t\t\tthis.onIncrementValuePressIn.bind( this );\n\t\tthis.onPressOut = this.onPressOut.bind( this );\n\n\t\tconst { value, defaultValue, min } = props;\n\n\t\tconst initialValue = value || defaultValue || min;\n\n\t\tthis.state = {\n\t\t\tinputValue: initialValue,\n\t\t\tstepperValue: initialValue,\n\t\t};\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearTimeout( this.timeout );\n\t\tclearInterval( this.interval );\n\t\tclearTimeout( this.timeoutAnnounceValue );\n\t}\n\n\tonIncrementValue() {\n\t\tconst { step, max, onChange, value, decimalNum } = this.props;\n\t\tlet newValue = toFixed( value + step, decimalNum );\n\t\tnewValue =\n\t\t\tparseInt( newValue ) === newValue ? parseInt( newValue ) : newValue;\n\t\tif ( newValue <= max || max === undefined ) {\n\t\t\tonChange( newValue );\n\t\t\tthis.setState( {\n\t\t\t\tinputValue: newValue,\n\t\t\t} );\n\t\t\tthis.announceValue( newValue );\n\t\t}\n\t}\n\n\tonDecrementValue() {\n\t\tconst { step, min, onChange, value, decimalNum } = this.props;\n\t\tlet newValue = toFixed( value - step, decimalNum );\n\t\tnewValue =\n\t\t\tparseInt( newValue ) === newValue ? parseInt( newValue ) : newValue;\n\t\tif ( newValue >= min ) {\n\t\t\tonChange( newValue );\n\t\t\tthis.setState( {\n\t\t\t\tinputValue: newValue,\n\t\t\t} );\n\t\t\tthis.announceValue( newValue );\n\t\t}\n\t}\n\n\tonIncrementValuePressIn() {\n\t\tthis.onIncrementValue();\n\t\tthis.timeout = setTimeout( () => {\n\t\t\tthis.startPressInterval( this.onIncrementValue );\n\t\t}, 500 );\n\t}\n\n\tonDecrementValuePressIn() {\n\t\tthis.onDecrementValue();\n\t\tthis.timeout = setTimeout( () => {\n\t\t\tthis.startPressInterval( this.onDecrementValue );\n\t\t}, 500 );\n\t}\n\n\tonPressOut() {\n\t\tclearTimeout( this.timeout );\n\t\tclearInterval( this.interval );\n\t}\n\n\tstartPressInterval( callback, speed = STEP_DELAY ) {\n\t\tlet counter = 0;\n\t\tthis.interval = setInterval( () => {\n\t\t\tcallback();\n\t\t\tcounter += 1;\n\n\t\t\tif ( counter === 10 ) {\n\t\t\t\tclearInterval( this.interval );\n\t\t\t\tthis.startPressInterval( callback, speed / 2 );\n\t\t\t}\n\t\t}, speed );\n\t}\n\n\tannounceValue( value ) {\n\t\tconst { label, unitLabel = '' } = this.props;\n\n\t\tif ( isIOS ) {\n\t\t\t// On Android it triggers the accessibilityLabel with the value change\n\t\t\tclearTimeout( this.timeoutAnnounceValue );\n\t\t\tthis.timeoutAnnounceValue = setTimeout( () => {\n\t\t\t\tAccessibilityInfo.announceForAccessibility(\n\t\t\t\t\t`${ value } ${ unitLabel } ${ label }`\n\t\t\t\t);\n\t\t\t}, 300 );\n\t\t}\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tlabel,\n\t\t\tsettingLabel = 'Value',\n\t\t\tunitLabel = '',\n\t\t\ticon,\n\t\t\tmin,\n\t\t\tmax,\n\t\t\tvalue,\n\t\t\tseparatorType,\n\t\t\tchildren,\n\t\t\tshouldDisplayTextInput = false,\n\t\t\tpreview,\n\t\t\tonChange,\n\t\t\topenUnitPicker,\n\t\t\tdecimalNum,\n\t\t\tcellContainerStyle,\n\t\t\tdisabled,\n\t\t} = this.props;\n\t\tconst { inputValue } = this.state;\n\t\tconst isMinValue = value === min;\n\t\tconst isMaxValue = value === max;\n\t\tconst labelStyle = [\n\t\t\tstyles.cellLabel,\n\t\t\t! icon ? styles.cellLabelNoIcon : {},\n\t\t];\n\n\t\tconst getAccessibilityHint = () => {\n\t\t\treturn openUnitPicker ? __( 'double-tap to change unit' ) : '';\n\t\t};\n\n\t\tconst accessibilityLabel = sprintf(\n\t\t\t/* translators: accessibility text. Inform about current value. %1$s: Control label %2$s: setting label (example: width), %3$s: Current value. %4$s: value measurement unit (example: pixels) */\n\t\t\t__( '%1$s. %2$s is %3$s %4$s.' ),\n\t\t\tlabel,\n\t\t\tsettingLabel,\n\t\t\tvalue,\n\t\t\tunitLabel\n\t\t);\n\n\t\tconst containerStyle = [\n\t\t\tstyles.rowContainer,\n\t\t\tisIOS ? styles.containerIOS : styles.containerAndroid,\n\t\t];\n\n\t\treturn (\n\t\t\t<View\n\t\t\t\taccessible\n\t\t\t\taccessibilityRole=\"adjustable\"\n\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\taccessibilityHint={ getAccessibilityHint() }\n\t\t\t\taccessibilityActions={ [\n\t\t\t\t\t{ name: 'increment' },\n\t\t\t\t\t{ name: 'decrement' },\n\t\t\t\t\t{ name: 'activate' },\n\t\t\t\t] }\n\t\t\t\tonAccessibilityAction={ ( event ) => {\n\t\t\t\t\tswitch ( event.nativeEvent.actionName ) {\n\t\t\t\t\t\tcase 'increment':\n\t\t\t\t\t\t\tthis.onIncrementValue();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'decrement':\n\t\t\t\t\t\t\tthis.onDecrementValue();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'activate':\n\t\t\t\t\t\t\tif ( openUnitPicker ) {\n\t\t\t\t\t\t\t\topenUnitPicker();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<View importantForAccessibility=\"no-hide-descendants\">\n\t\t\t\t\t<Cell\n\t\t\t\t\t\taccessible={ false }\n\t\t\t\t\t\tcellContainerStyle={ [\n\t\t\t\t\t\t\tstyles.cellContainerStyle,\n\t\t\t\t\t\t\tpreview && styles.columnContainer,\n\t\t\t\t\t\t\tcellContainerStyle,\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tcellRowContainerStyle={\n\t\t\t\t\t\t\tpreview ? containerStyle : styles.cellRowStyles\n\t\t\t\t\t\t}\n\t\t\t\t\t\teditable={ false }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tlabelStyle={ labelStyle }\n\t\t\t\t\t\tleftAlign\n\t\t\t\t\t\tseparatorType={ separatorType }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t<View style={ preview && containerStyle }>\n\t\t\t\t\t\t\t{ preview }\n\t\t\t\t\t\t\t<Stepper\n\t\t\t\t\t\t\t\tisMaxValue={ isMaxValue }\n\t\t\t\t\t\t\t\tisMinValue={ isMinValue }\n\t\t\t\t\t\t\t\tonPressInDecrement={\n\t\t\t\t\t\t\t\t\tthis.onDecrementValuePressIn\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonPressInIncrement={\n\t\t\t\t\t\t\t\t\tthis.onIncrementValuePressIn\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonPressOut={ this.onPressOut }\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\tshouldDisplayTextInput={\n\t\t\t\t\t\t\t\t\tshouldDisplayTextInput\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ shouldDisplayTextInput && (\n\t\t\t\t\t\t\t\t\t<RangeTextInput\n\t\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\t\t\tdefaultValue={ `${ inputValue }` }\n\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\t\t\t\t\tstep={ 1 }\n\t\t\t\t\t\t\t\t\t\tdecimalNum={ decimalNum }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t\t\t</RangeTextInput>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Stepper>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</Cell>\n\t\t\t\t</View>\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nBottomSheetStepperCell.defaultProps = {\n\tstep: DEFAULT_STEP,\n};\n\nexport default withPreferredColorScheme( BottomSheetStepperCell );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,KAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,QAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,MAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,eAAA,GAAAH,sBAAA,CAAAL,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAOA,MAAMU,UAAU,GAAG,GAAG;AACtB,MAAMC,YAAY,GAAG,CAAC;AAEtB,MAAMC,KAAK,GAAGC,qBAAQ,CAACC,EAAE,KAAK,KAAK;AAEnC,MAAMC,sBAAsB,SAASC,kBAAS,CAAC;EAC9CC,WAAWA,CAAEC,KAAK,EAAG;IACpB,KAAK,CAAEA,KAAM,CAAC;IAEd,IAAI,CAACC,aAAa,GAAG,IAAI,CAACA,aAAa,CAACC,IAAI,CAAE,IAAK,CAAC;IACpD,IAAI,CAACC,gBAAgB,GAAG,IAAI,CAACA,gBAAgB,CAACD,IAAI,CAAE,IAAK,CAAC;IAC1D,IAAI,CAACE,uBAAuB,GAC3B,IAAI,CAACA,uBAAuB,CAACF,IAAI,CAAE,IAAK,CAAC;IAC1C,IAAI,CAACG,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AkB,CAChB;MACH+B,qBAAqB,EACpBjC,OAAO,GAAGc,cAAc,GAAGP,cAAM,CAAC2B,aAClC;MACDC,QAAQ,EAAG,KAAO;MAClBvC,IAAI,EAAGA,IAAM;MACbN,KAAK,EAAGA,KAAO;MACfgB,UAAU,EAAGA,UAAY;MACzB8B,SAAS;MACTvC,aAAa,EAAGA,aAAe;MAC/BM,QAAQ,EAAGA;IAAU,GAErB,IAAAe,MAAA,CAAAC,aAAA,EAACpF,YAAA,CAAAqF,IAAI;MAACiB,KAAK,EAAGrC,OAAO,IAAIc;IAAgB,GACtCd,OAAO,EACT,IAAAkB,MAAA,CAAAC,aAAA,EAAC7E,QAAA,CAAAyF,OAAO;MACP1B,UAAU,EAAGA,UAAY;MACzBD,UAAU,EAAGA,UAAY;MACzBkC,kBAAkB,EACjB,IAAI,CAAChF,uBACL;MACDiF,kBAAkB,EACjB,IAAI,CAAC/E,uBACL;MACDC,UAAU,EAAG,IAAI,CAACA,UAAY;MAC9BC,KAAK,EAAGA,KAAO;MACfqC,sBAAsB,EACrBA;IACA,GAECA,sBAAsB,IACvB,IAAAmB,MAAA,CAAAC,aAAA,EAAC3E,eAAA,CAAAuF,OAAc;MACdzC,KAAK,EAAGA,KAAO;MACfb,QAAQ,EAAGA,QAAU;MACrBd,YAAY,EAAI,GAAGI,UAAY,EAAG;MAClCL,KAAK,EAAGA,KAAO;MACfE,GAAG,EAAGA,GAAK;MACXW,IAAI,EAAG,CAAG;MACVG,UAAU,EAAGA;IAAY,GAEvBoB,QACa,CAET,CACJ,CACD,CACD,CACD,CAAC;EAET;AACD;AAEA/C,sBAAsB,CAACyF,YAAY,GAAG;EACrCjE,IAAI,EAAE5B;AACP,CAAC;AAAC,IAAA8F,QAAA,GAAAC,OAAA,CAAAX,OAAA,GAEa,IAAAY,iCAAwB,EAAE5F,sBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_native","_element","_icons","_i18n","_components","_style","_interopRequireDefault","BottomSheetSelectControl","label","icon","options","items","onChange","value","selectedValue","disabled","showSubSheet","setShowSubSheet","useState","navigation","useNavigation","onChangeValue","goBack","selectedOption","find","option","openSubSheet","navigate","BottomSheet","SubSheet","screenName","_react","createElement","navigationButton","Cell","separatorType","onPress","accessibilityRole","accessibilityLabel","sprintf","__","accessibilityHint","Icon","chevronRight","showSheet","Fragment","NavBar","BackButton","Heading","View","style","styles","selectControl","map","item","index","customActionButton","leftAlign","key","check","_default","exports","default"],"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';\nimport { BottomSheet } from '@wordpress/components';\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\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 = items.find(\n\t\t( option ) => option.value === selectedValue\n\t);\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$s: Select control button label e.g. \"Button width\". %2$s: 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
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_native","_element","_icons","_i18n","_components","_style","_interopRequireDefault","BottomSheetSelectControl","label","icon","options","items","onChange","value","selectedValue","disabled","showSubSheet","setShowSubSheet","useState","navigation","useNavigation","onChangeValue","goBack","selectedOption","find","option","openSubSheet","navigate","BottomSheet","SubSheet","screenName","_react","createElement","navigationButton","Cell","separatorType","onPress","accessibilityRole","accessibilityLabel","sprintf","__","accessibilityHint","Icon","chevronRight","showSheet","Fragment","NavBar","BackButton","Heading","View","style","styles","selectControl","map","item","index","customActionButton","leftAlign","key","check","_default","exports","default"],"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';\nimport { BottomSheet } from '@wordpress/components';\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\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 = items.find(\n\t\t( option ) => option.value === selectedValue\n\t);\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$s: Select control button label e.g. \"Button width\". %2$s: 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: Select control option value e.g: \"Auto, 25%\".\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":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAIA,IAAAM,MAAA,GAAAC,sBAAA,CAAAP,OAAA;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;;AAGA,MAAMQ,wBAAwB,GAAGA,CAAE;EAClCC,KAAK;EACLC,IAAI;EACJC,OAAO,EAAEC,KAAK;EACdC,QAAQ;EACRC,KAAK,EAAEC,aAAa;EACpBC;AACD,CAAC,KAAM;EACN,MAAM,CAAEC,YAAY,EAAEC,eAAe,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EAC3D,MAAMC,UAAU,GAAG,IAAAC,qBAAa,EAAC,CAAC;EAElC,MAAMC,aAAa,GAAKR,KAAK,IAAM;IAClC,OAAO,MAAM;MACZS,MAAM,CAAC,CAAC;MACRV,QAAQ,CAAEC,KAAM,CAAC;IAClB,CAAC;EACF,CAAC;EAED,MAAMU,cAAc,GAAGZ,KAAK,CAACa,IAAI,CAC9BC,MAAM,IAAMA,MAAM,CAACZ,KAAK,KAAKC,aAChC,CAAC;EAED,MAAMQ,MAAM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IAACX,OAAO,EAAGd;EAAQ,CAAE,CAAC,EACpD,IAAAS,MAAA,CAAAC,aAAA,EAAC5B,WAAA,CAAAwB,WAAW,CAACkB,MAAM,CAACE,OAAO,QACxBxC,KACyB,CACT,CAAC,EACrB,IAAAuB,MAAA,CAAAC,aAAA,EAAClC,YAAA,CAAAmD,IAAI;IAACC,KAAK,EAAGC,cAAM,CAACC;EAAe,GACjCzC,KAAK,CAAC0C,GAAG,CAAE,CAAEC,IAAI,EAAEC,KAAK,KACzB,IAAAxB,MAAA,CAAAC,aAAA,EAAC5B,WAAA,CAAAwB,WAAW,CAACM,IAAI;IAChBsB,kBAAkB;IAClBrB,aAAa,EAAC,MAAM;IACpB3B,KAAK,EAAG8C,IAAI,CAAC9C,KAAO;IACpBC,IAAI,EAAG6C,IAAI,CAAC7C,IAAM;IAClB2B,OAAO,EAAGf,aAAa,CAAEiC,IAAI,CAACzC,KAAM,CAAG;IACvC4C,SAAS;IACTC,GAAG,EAAGH,KAAO;IACblB,iBAAiB,EAAG,QAAU;IAC9BC,kBAAkB,EACjBgB,IAAI,CAACzC,KAAK,KAAKC,aAAa,GACzB,IAAAyB,aAAO;IACP;IACA,IAAAC,QAAE,EAAE,cAAe,CAAC,EACpBc,IAAI,CAAC9C,KACL,CAAC,GACD8C,IAAI,CAAC9C,KACR;IACDiC,iBAAiB,EAAG,IAAAD,QAAE,EAAE,sBAAuB;EAAG,GAEhDc,IAAI,CAACzC,KAAK,KAAKC,aAAa,IAC7B,IAAAiB,MAAA,CAAAC,aAAA,EAAC9B,MAAA,CAAAwC,IAAI;IAACjC,IAAI,EAAGkD;EAAO,CAAO,CAEX,CACjB,CACG,CACL,CACmB,CAAC;AAEzB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEavD,wBAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_native","_element","_icons","_compose","_components","_styles","_interopRequireDefault","BottomSheetTextControl","initialValue","onChange","placeholder","label","icon","footerNote","cellPlaceholder","disabled","showSubSheet","setShowSubSheet","useState","navigation","useNavigation","goBack","openSubSheet","navigate","BottomSheet","SubSheet","screenName","horizontalBorderStyle","usePreferredColorSchemeStyle","styles","horizontalBorder","horizontalBorderDark","textEditorStyle","textEditor","textEditorDark","_react","createElement","navigationButton","Cell","onPress","value","Icon","chevronRight","showSheet","Fragment","NavBar","BackButton","Heading","PanelBody","style","TextInput","onChangeText","text","defaultValue","multiline","placeholderTextColor","textAlignVertical","textFooternote","FooterMessageControl","textAlign","_default","exports","default"],"sources":["@wordpress/components/src/mobile/bottom-sheet-text-control/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { TextInput } from 'react-native';\nimport { useNavigation } from '@react-navigation/native';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { Icon, chevronRight } from '@wordpress/icons';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport {\n\tBottomSheet,\n\tPanelBody,\n\tFooterMessageControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\n\nconst BottomSheetTextControl = ( {\n\tinitialValue,\n\tonChange,\n\tplaceholder,\n\tlabel,\n\ticon,\n\tfooterNote,\n\tcellPlaceholder,\n\tdisabled,\n} ) => {\n\tconst [ showSubSheet, setShowSubSheet ] = useState( false );\n\tconst navigation = useNavigation();\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\tconst horizontalBorderStyle = usePreferredColorSchemeStyle(\n\t\tstyles.horizontalBorder,\n\t\tstyles.horizontalBorderDark\n\t);\n\n\tconst textEditorStyle = usePreferredColorSchemeStyle(\n\t\tstyles.textEditor,\n\t\tstyles.textEditorDark\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\ticon={ icon }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tonPress={ openSubSheet }\n\t\t\t\t\tvalue={ initialValue || '' }\n\t\t\t\t\tplaceholder={ cellPlaceholder || placeholder || '' }\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<PanelBody style={ horizontalBorderStyle }>\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tonChangeText={ ( text ) => onChange( text ) }\n\t\t\t\t\t\tdefaultValue={ initialValue }\n\t\t\t\t\t\tmultiline
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_native","_element","_icons","_compose","_components","_styles","_interopRequireDefault","BottomSheetTextControl","initialValue","onChange","placeholder","label","icon","footerNote","cellPlaceholder","disabled","showSubSheet","setShowSubSheet","useState","navigation","useNavigation","goBack","openSubSheet","navigate","BottomSheet","SubSheet","screenName","horizontalBorderStyle","usePreferredColorSchemeStyle","styles","horizontalBorder","horizontalBorderDark","textEditorStyle","textEditor","textEditorDark","_react","createElement","navigationButton","Cell","onPress","value","Icon","chevronRight","showSheet","Fragment","NavBar","BackButton","Heading","PanelBody","style","TextInput","onChangeText","text","defaultValue","multiline","placeholderTextColor","textAlignVertical","textFooternote","FooterMessageControl","textAlign","_default","exports","default"],"sources":["@wordpress/components/src/mobile/bottom-sheet-text-control/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { TextInput } from 'react-native';\nimport { useNavigation } from '@react-navigation/native';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { Icon, chevronRight } from '@wordpress/icons';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport {\n\tBottomSheet,\n\tPanelBody,\n\tFooterMessageControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\n\nconst BottomSheetTextControl = ( {\n\tinitialValue,\n\tonChange,\n\tplaceholder,\n\tlabel,\n\ticon,\n\tfooterNote,\n\tcellPlaceholder,\n\tdisabled,\n} ) => {\n\tconst [ showSubSheet, setShowSubSheet ] = useState( false );\n\tconst navigation = useNavigation();\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\tconst horizontalBorderStyle = usePreferredColorSchemeStyle(\n\t\tstyles.horizontalBorder,\n\t\tstyles.horizontalBorderDark\n\t);\n\n\tconst textEditorStyle = usePreferredColorSchemeStyle(\n\t\tstyles.textEditor,\n\t\tstyles.textEditorDark\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\ticon={ icon }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tonPress={ openSubSheet }\n\t\t\t\t\tvalue={ initialValue || '' }\n\t\t\t\t\tplaceholder={ cellPlaceholder || placeholder || '' }\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<PanelBody style={ horizontalBorderStyle }>\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tonChangeText={ ( text ) => onChange( text ) }\n\t\t\t\t\t\tdefaultValue={ initialValue }\n\t\t\t\t\t\tmultiline\n\t\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\t\tplaceholderTextColor={ '#87a6bc' }\n\t\t\t\t\t\tstyle={ textEditorStyle }\n\t\t\t\t\t\ttextAlignVertical={ 'top' }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</>\n\n\t\t\t{ footerNote && (\n\t\t\t\t<PanelBody style={ styles.textFooternote }>\n\t\t\t\t\t<FooterMessageControl\n\t\t\t\t\t\tlabel={ footerNote }\n\t\t\t\t\t\ttextAlign=\"left\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</BottomSheet.SubSheet>\n\t);\n};\n\nexport default BottomSheetTextControl;\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AASA,IAAAM,OAAA,GAAAC,sBAAA,CAAAP,OAAA;AArBA;AACA;AACA;;AAIA;AACA;AACA;;AAUA;AACA;AACA;;AAGA,MAAMQ,sBAAsB,GAAGA,CAAE;EAChCC,YAAY;EACZC,QAAQ;EACRC,WAAW;EACXC,KAAK;EACLC,IAAI;EACJC,UAAU;EACVC,eAAe;EACfC;AACD,CAAC,KAAM;EACN,MAAM,CAAEC,YAAY,E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,CAACqB,MAAM,QAClB,IAAAV,MAAA,CAAAC,aAAA,EAAChC,WAAA,CAAAoB,WAAW,CAACqB,MAAM,CAACC,UAAU;IAACP,OAAO,EAAGlB;EAAQ,CAAE,CAAC,EACpD,IAAAc,MAAA,CAAAC,aAAA,EAAChC,WAAA,CAAAoB,WAAW,CAACqB,MAAM,CAACE,OAAO,QACxBpC,KACyB,CACT,CAAC,EACrB,IAAAwB,MAAA,CAAAC,aAAA,EAAChC,WAAA,CAAA4C,SAAS;IAACC,KAAK,EAAGtB;EAAuB,GACzC,IAAAQ,MAAA,CAAAC,aAAA,EAACtC,YAAA,CAAAoD,SAAS;IACTvC,KAAK,EAAGA,KAAO;IACfwC,YAAY,EAAKC,IAAI,IAAM3C,QAAQ,CAAE2C,IAAK,CAAG;IAC7CC,YAAY,EAAG7C,YAAc;IAC7B8C,SAAS;IACT5C,WAAW,EAAGA,WAAa;IAC3B6C,oBAAoB,EAAG,SAAW;IAClCN,KAAK,EAAGjB,eAAiB;IACzBwB,iBAAiB,EAAG;EAAO,CAC3B,CACS,CACV,CAAC,EAED3C,UAAU,IACX,IAAAsB,MAAA,CAAAC,aAAA,EAAChC,WAAA,CAAA4C,SAAS;IAACC,KAAK,EAAGpB,eAAM,CAAC4B;EAAgB,GACzC,IAAAtB,MAAA,CAAAC,aAAA,EAAChC,WAAA,CAAAsD,oBAAoB;IACpB/C,KAAK,EAAGE,UAAY;IACpB8C,SAAS,EAAC;EAAM,CAChB,CACS,CAES,CAAC;AAEzB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEavD,sBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_reactNativeLinearGradient","_interopRequireDefault","_gradientParser","_components","_primitives","_compose","_element","_style","getGradientAngle","gradientValue","angleBase","matchAngle","angle","exec","angleType","includes","parseFloat","getGradientColorGroup","colorNeedParenthesis","excludeSideOrCorner","modifiedGradientValue","replace","concat","gradientParser","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","useResizeObserver","width","height","isGradient","getGradientType","gradients","colorsUtils","useMemo","locations","colors","isLinearGradient","linear","_react","createElement","default","useAngle","View","styles","overflow","radialGradientContent","SVG","Defs","RadialGradient","id","gradientUnits","rx","ry","cy","Platform","OS","group","Stop","offset","stopColor","stopOpacity","key","Rect","fill","_default","exports"],"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 { colorsUtils } from '@wordpress/components';\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';\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 return 4 * angleBase;\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={ true }\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":";;;;;;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,0BAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,eAAA,GAAAD,sBAAA,CAAAF,OAAA;AAIA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAN,sBAAA,CAAAF,OAAA;AAjBA;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;;AAGO,SAASS,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;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E,EAAC,gBAAgB;IACnBC,aAAa,EAAC,gBAAgB;IAC9BC,EAAE,EAAC,KAAK;IACRC,EAAE,EAAC,KAAK;IACRC,EAAE,EAAGC,qBAAQ,CAACC,EAAE,KAAK,SAAS,GAAG5B,KAAK,GAAG,CAAC,GAAG;EAAO,GAElDd,UAAU,CAACZ,GAAG,CAAIuD,KAAK,IAAM;IAC9B,OACC,IAAAlB,MAAA,CAAAC,aAAA,EAAC3D,WAAA,CAAA6E,IAAI;MACJC,MAAM,EAAGF,KAAK,CAAE,CAAC,CAAI;MACrBG,SAAS,EAAGH,KAAK,CAAE,CAAC,CAAI;MACxBI,WAAW,EAAC,GAAG;MACfC,GAAG,EAAI,GAAGL,KAAK,CAAE,CAAC,CAAI,IAAIA,KAAK,CAAE,CAAC,CAAI;IAAG,CACzC,CAAC;EAEJ,CAAE,CACa,CACX,CAAC,EACP,IAAAlB,MAAA,CAAAC,aAAA,EAAC3D,WAAA,CAAAkF,IAAI;IACJlC,MAAM,EAAGA,MAAQ;IACjBD,KAAK,EAAGA,KAAO;IACfoC,IAAI,EAAC;EAAsB,CAC3B,CACG,CACA,CAAC;AAET;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzB,OAAA,GAEcvB,QAAQ"}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_reactNativeLinearGradient","_interopRequireDefault","_gradientParser","_components","_primitives","_compose","_element","_style","getGradientAngle","gradientValue","angleBase","matchAngle","angle","exec","angleType","includes","parseFloat","getGradientColorGroup","colorNeedParenthesis","excludeSideOrCorner","modifiedGradientValue","replace","concat","gradientParser","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","useResizeObserver","width","height","isGradient","getGradientType","gradients","colorsUtils","useMemo","locations","colors","isLinearGradient","linear","_react","createElement","default","useAngle","View","styles","overflow","radialGradientContent","SVG","Defs","RadialGradient","id","gradientUnits","rx","ry","cy","Platform","OS","group","Stop","offset","stopColor","stopOpacity","key","Rect","fill","_default","exports"],"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 { colorsUtils } from '@wordpress/components';\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';\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 return 4 * angleBase;\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\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AAA,EAAC3D,WAAA,CAAA6E,IAAI;MACJC,MAAM,EAAGF,KAAK,CAAE,CAAC,CAAI;MACrBG,SAAS,EAAGH,KAAK,CAAE,CAAC,CAAI;MACxBI,WAAW,EAAC,GAAG;MACfC,GAAG,EAAI,GAAGL,KAAK,CAAE,CAAC,CAAI,IAAIA,KAAK,CAAE,CAAC,CAAI;IAAG,CACzC,CAAC;EAEJ,CAAE,CACa,CACX,CAAC,EACP,IAAAlB,MAAA,CAAAC,aAAA,EAAC3D,WAAA,CAAAkF,IAAI;IACJlC,MAAM,EAAGA,MAAQ;IACjBD,KAAK,EAAGA,KAAO;IACfoC,IAAI,EAAC;EAAsB,CAC3B,CACG,CACA,CAAC;AAET;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzB,OAAA,GAEcvB,QAAQ"}
|
|
@@ -168,16 +168,7 @@ const ImageComponent = ({
|
|
|
168
168
|
}, resizeMode && {
|
|
169
169
|
width: _style.default.wide?.width
|
|
170
170
|
}, focalPoint && _style.default.focalPointContainer];
|
|
171
|
-
const opacityValue = (0, _element.useRef)(new _reactNative.Animated.Value(1)).current;
|
|
172
|
-
(0, _element.useEffect)(() => {
|
|
173
|
-
_reactNative.Animated.timing(opacityValue, {
|
|
174
|
-
toValue: isUploadInProgress ? 0.3 : 1,
|
|
175
|
-
duration: 100,
|
|
176
|
-
useNativeDriver: true
|
|
177
|
-
}).start();
|
|
178
|
-
}, [isUploadInProgress, opacityValue]);
|
|
179
171
|
const imageStyles = [{
|
|
180
|
-
opacity: opacityValue,
|
|
181
172
|
height: containerSize?.height
|
|
182
173
|
}, !resizeMode && {
|
|
183
174
|
aspectRatio: imageData?.aspectRatio
|
|
@@ -217,7 +208,7 @@ const ImageComponent = ({
|
|
|
217
208
|
accessibilityRole: 'imagebutton',
|
|
218
209
|
key: url,
|
|
219
210
|
style: imageContainerStyles
|
|
220
|
-
}, isSelected && highlightSelected &&
|
|
211
|
+
}, isSelected && highlightSelected && (0, _react.createElement)(_reactNative.View, {
|
|
221
212
|
style: imageSelectedStyles
|
|
222
213
|
}), !imageData ? (0, _react.createElement)(_reactNative.View, {
|
|
223
214
|
style: placeholderStyles
|
|
@@ -225,7 +216,7 @@ const ImageComponent = ({
|
|
|
225
216
|
style: _style.default.imageUploadingIconContainer
|
|
226
217
|
}, getIcon(ICON_TYPE.UPLOAD))) : (0, _react.createElement)(_reactNative.View, {
|
|
227
218
|
style: focalPoint && _style.default.focalPointContent
|
|
228
|
-
}, _element.Platform.isAndroid && (0, _react.createElement)(_react.Fragment, null, networkImageLoaded && networkURL && (0, _react.createElement)(
|
|
219
|
+
}, _element.Platform.isAndroid && (0, _react.createElement)(_react.Fragment, null, networkImageLoaded && networkURL && (0, _react.createElement)(Image, {
|
|
229
220
|
style: imageStyles,
|
|
230
221
|
fadeDuration: 0,
|
|
231
222
|
source: {
|
|
@@ -236,7 +227,7 @@ const ImageComponent = ({
|
|
|
236
227
|
}),
|
|
237
228
|
resizeMode: imageResizeMode,
|
|
238
229
|
testID: `network-image-${url}`
|
|
239
|
-
}), !networkImageLoaded && !networkURL && (0, _react.createElement)(
|
|
230
|
+
}), !networkImageLoaded && !networkURL && (0, _react.createElement)(Image, {
|
|
240
231
|
style: imageStyles,
|
|
241
232
|
fadeDuration: 0,
|
|
242
233
|
source: {
|
|
@@ -246,7 +237,7 @@ const ImageComponent = ({
|
|
|
246
237
|
resizeMethod: 'scale'
|
|
247
238
|
}),
|
|
248
239
|
resizeMode: imageResizeMode
|
|
249
|
-
})), _element.Platform.isIOS && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(
|
|
240
|
+
})), _element.Platform.isIOS && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(Image, {
|
|
250
241
|
style: imageStyles,
|
|
251
242
|
source: {
|
|
252
243
|
uri: networkURL && networkImageLoaded ? networkURL : localURL || url
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_reactNativeFastImage","_interopRequireDefault","_i18n","_components","_icons","_compose","_element","_utils","_style","_iconRetry","_imageEditingButton","ICON_TYPE","OFFLINE","PLACEHOLDER","RETRY","UPLOAD","ImageComponent","align","alt","editButton","focalPoint","height","imageHeight","highlightSelected","isSelected","shouldUseFastImage","isUploadFailed","isUploadPaused","isUploadInProgress","mediaPickerOptions","onImageDataLoad","onSelectMediaUploadOption","openMediaOptions","resizeMode","retryMessage","retryIcon","url","shapeStyle","style","width","imageWidth","imageData","setImageData","useState","containerSize","setContainerSize","localURL","setLocalURL","networkURL","setNetworkURL","networkImageLoaded","setNetworkImageLoaded","Image","Platform","isAndroid","RNImage","FastImage","imageResizeMode","useEffect","isCurrent","getSize","imgWidth","imgHeight","metaData","aspectRatio","startsWith","isIOS","prefetch","then","onContainerLayout","event","nativeEvent","layout","getIcon","iconType","icon","iconStyle","SvgIconRetry","iconRetryStyles","offline","iconOfflineStyles","image","iconPlaceholderStyles","iconUploadStyles","_react","createElement","Icon","usePreferredColorSchemeStyle","styles","iconPlaceholder","iconPlaceholderDark","iconUpload","iconUploadDark","iconOffline","iconOfflineDark","retryIconStyles","retryIconDark","iconRetry","iconRetryDark","retryContainerStyles","retryContainer","retryContainerDark","uploadFailedTextStyles","uploadFailedText","uploadFailedTextDark","placeholderStyles","imageContainerUpload","imageContainerUploadDark","imageContainerUploadWithFocalpoint","customWidth","wide","imageContainerStyles","imageContent","focalPointContainer","opacityValue","useRef","Animated","Value","current","timing","toValue","duration","useNativeDriver","start","imageStyles","opacity","getImageWithFocalPointStyles","undefined","calculatedSelectedHeight","isNaN","imageSelectedStyles","imageBorder","imageBorderDark","View","container","alignItems","onLayout","accessible","disabled","accessibilityLabel","accessibilityHint","__","accessibilityRole","key","imageUploadingIconContainer","focalPointContent","Fragment","fadeDuration","source","uri","resizeMethod","testID","nonVisibleImage","onLoad","imageContainer","customRetryIcon","Text","default","pickerOptions","_default","exports"],"sources":["@wordpress/components/src/mobile/image/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Animated, Image as RNImage, Text, View } from 'react-native';\nimport FastImage from 'react-native-fast-image';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon } from '@wordpress/components';\nimport { image, offline } from '@wordpress/icons';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { useEffect, useState, useRef, Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getImageWithFocalPointStyles } from './utils';\nimport styles from './style.scss';\nimport SvgIconRetry from './icon-retry';\nimport ImageEditingButton from './image-editing-button';\n\nconst ICON_TYPE = {\n\tOFFLINE: 'offline',\n\tPLACEHOLDER: 'placeholder',\n\tRETRY: 'retry',\n\tUPLOAD: 'upload',\n};\n\nconst ImageComponent = ( {\n\talign,\n\talt,\n\teditButton = true,\n\tfocalPoint,\n\theight: imageHeight,\n\thighlightSelected = true,\n\tisSelected,\n\tshouldUseFastImage,\n\tisUploadFailed,\n\tisUploadPaused,\n\tisUploadInProgress,\n\tmediaPickerOptions,\n\tonImageDataLoad,\n\tonSelectMediaUploadOption,\n\topenMediaOptions,\n\tresizeMode,\n\tretryMessage,\n\tretryIcon,\n\turl,\n\tshapeStyle,\n\tstyle,\n\twidth: imageWidth,\n} ) => {\n\tconst [ imageData, setImageData ] = useState( null );\n\tconst [ containerSize, setContainerSize ] = useState( null );\n\tconst [ localURL, setLocalURL ] = useState( null );\n\tconst [ networkURL, setNetworkURL ] = useState( null );\n\tconst [ networkImageLoaded, setNetworkImageLoaded ] = useState( false );\n\n\t// Disabled for Android due to https://github.com/WordPress/gutenberg/issues/43149\n\tconst Image =\n\t\t! shouldUseFastImage || Platform.isAndroid ? RNImage : FastImage;\n\tconst imageResizeMode =\n\t\t! shouldUseFastImage || Platform.isAndroid\n\t\t\t? resizeMode\n\t\t\t: FastImage.resizeMode[ resizeMode ];\n\n\tuseEffect( () => {\n\t\tlet isCurrent = true;\n\t\tif ( url ) {\n\t\t\tRNImage.getSize( url, ( imgWidth, imgHeight ) => {\n\t\t\t\tif ( ! isCurrent ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst metaData = {\n\t\t\t\t\taspectRatio: imgWidth / imgHeight,\n\t\t\t\t\twidth: imgWidth,\n\t\t\t\t\theight: imgHeight,\n\t\t\t\t};\n\t\t\t\tsetImageData( metaData );\n\t\t\t\tif ( onImageDataLoad ) {\n\t\t\t\t\tonImageDataLoad( metaData );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tif ( url.startsWith( 'file:///' ) ) {\n\t\t\t\tsetLocalURL( url );\n\t\t\t\tsetNetworkURL( null );\n\t\t\t\tsetNetworkImageLoaded( false );\n\t\t\t} else if ( url.startsWith( 'https://' ) ) {\n\t\t\t\tif ( Platform.isIOS ) {\n\t\t\t\t\tsetNetworkURL( url );\n\t\t\t\t} else if ( Platform.isAndroid ) {\n\t\t\t\t\tRNImage.prefetch( url ).then(\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tif ( ! isCurrent ) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetNetworkURL( url );\n\t\t\t\t\t\t\tsetNetworkImageLoaded( true );\n\t\t\t\t\t\t},\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t// This callback is called when the image fails to load,\n\t\t\t\t\t\t\t// but these events are handled by `isUploadFailed`\n\t\t\t\t\t\t\t// and `isUploadPaused` events instead.\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// Ignoring the error event will persist the local image URI.\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn () => ( isCurrent = false );\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ url ] );\n\n\tconst onContainerLayout = ( event ) => {\n\t\tconst { height, width } = event.nativeEvent.layout;\n\n\t\tif (\n\t\t\twidth !== 0 &&\n\t\t\theight !== 0 &&\n\t\t\t( containerSize?.width !== width ||\n\t\t\t\tcontainerSize?.height !== height )\n\t\t) {\n\t\t\tsetContainerSize( { width, height } );\n\t\t}\n\t};\n\n\tconst getIcon = ( iconType ) => {\n\t\tlet icon;\n\t\tlet iconStyle;\n\t\tswitch ( iconType ) {\n\t\t\tcase ICON_TYPE.RETRY:\n\t\t\t\ticon = retryIcon || SvgIconRetry;\n\t\t\t\ticonStyle = iconRetryStyles;\n\t\t\t\tbreak;\n\t\t\tcase ICON_TYPE.OFFLINE:\n\t\t\t\ticon = offline;\n\t\t\t\ticonStyle = iconOfflineStyles;\n\t\t\t\tbreak;\n\t\t\tcase ICON_TYPE.PLACEHOLDER:\n\t\t\t\ticon = image;\n\t\t\t\ticonStyle = iconPlaceholderStyles;\n\t\t\t\tbreak;\n\t\t\tcase ICON_TYPE.UPLOAD:\n\t\t\t\ticon = image;\n\t\t\t\ticonStyle = iconUploadStyles;\n\t\t\t\tbreak;\n\t\t}\n\t\treturn <Icon icon={ icon } { ...iconStyle } />;\n\t};\n\n\tconst iconPlaceholderStyles = usePreferredColorSchemeStyle(\n\t\tstyles.iconPlaceholder,\n\t\tstyles.iconPlaceholderDark\n\t);\n\n\tconst iconUploadStyles = usePreferredColorSchemeStyle(\n\t\tstyles.iconUpload,\n\t\tstyles.iconUploadDark\n\t);\n\n\tconst iconOfflineStyles = usePreferredColorSchemeStyle(\n\t\tstyles.iconOffline,\n\t\tstyles.iconOfflineDark\n\t);\n\n\tconst retryIconStyles = usePreferredColorSchemeStyle(\n\t\tstyles.retryIcon,\n\t\tstyles.retryIconDark\n\t);\n\n\tconst iconRetryStyles = usePreferredColorSchemeStyle(\n\t\tstyles.iconRetry,\n\t\tstyles.iconRetryDark\n\t);\n\n\tconst retryContainerStyles = usePreferredColorSchemeStyle(\n\t\tstyles.retryContainer,\n\t\tstyles.retryContainerDark\n\t);\n\n\tconst uploadFailedTextStyles = usePreferredColorSchemeStyle(\n\t\tstyles.uploadFailedText,\n\t\tstyles.uploadFailedTextDark\n\t);\n\n\tconst placeholderStyles = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles.imageContainerUpload,\n\t\t\tstyles.imageContainerUploadDark\n\t\t),\n\t\tfocalPoint && styles.imageContainerUploadWithFocalpoint,\n\t\timageHeight && { height: imageHeight },\n\t];\n\n\tconst customWidth =\n\t\timageData?.width < containerSize?.width\n\t\t\t? imageData?.width\n\t\t\t: styles.wide?.width;\n\n\tconst imageContainerStyles = [\n\t\tstyles.imageContent,\n\t\t{\n\t\t\twidth:\n\t\t\t\timageWidth === styles.wide?.width ||\n\t\t\t\t( imageData &&\n\t\t\t\t\timageWidth > 0 &&\n\t\t\t\t\timageWidth < containerSize?.width )\n\t\t\t\t\t? imageWidth\n\t\t\t\t\t: customWidth,\n\t\t},\n\t\tresizeMode && { width: styles.wide?.width },\n\t\tfocalPoint && styles.focalPointContainer,\n\t];\n\n\tconst opacityValue = useRef( new Animated.Value( 1 ) ).current;\n\n\tuseEffect( () => {\n\t\tAnimated.timing( opacityValue, {\n\t\t\ttoValue: isUploadInProgress ? 0.3 : 1,\n\t\t\tduration: 100,\n\t\t\tuseNativeDriver: true,\n\t\t} ).start();\n\t}, [ isUploadInProgress, opacityValue ] );\n\n\tconst imageStyles = [\n\t\t{\n\t\t\topacity: opacityValue,\n\t\t\theight: containerSize?.height,\n\t\t},\n\t\t! resizeMode && {\n\t\t\taspectRatio: imageData?.aspectRatio,\n\t\t},\n\t\tfocalPoint && styles.focalPoint,\n\t\tfocalPoint &&\n\t\t\tgetImageWithFocalPointStyles(\n\t\t\t\tfocalPoint,\n\t\t\t\tcontainerSize,\n\t\t\t\timageData\n\t\t\t),\n\t\t! focalPoint &&\n\t\t\timageData &&\n\t\t\tcontainerSize && {\n\t\t\t\theight:\n\t\t\t\t\timageData?.width > containerSize?.width && ! imageWidth\n\t\t\t\t\t\t? containerSize?.width / imageData?.aspectRatio\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\timageHeight && { height: imageHeight },\n\t\tshapeStyle,\n\t];\n\n\t// On iOS, add 1 to height to account for the 1px non-visible image\n\t// that is used to determine when the network image has loaded\n\t// We also must verify that it is not NaN, as it can be NaN when the image is loading.\n\t// This is not necessary on Android as the non-visible image is not used.\n\tlet calculatedSelectedHeight;\n\tif ( Platform.isIOS ) {\n\t\tcalculatedSelectedHeight =\n\t\t\tcontainerSize && ! isNaN( containerSize.height )\n\t\t\t\t? containerSize.height + 1\n\t\t\t\t: 0;\n\t} else {\n\t\tcalculatedSelectedHeight = containerSize?.height;\n\t}\n\n\tconst imageSelectedStyles = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles.imageBorder,\n\t\t\tstyles.imageBorderDark\n\t\t),\n\t\t{\n\t\t\theight: calculatedSelectedHeight,\n\t\t},\n\t];\n\n\treturn (\n\t\t<View\n\t\t\tstyle={ [\n\t\t\t\tstyles.container,\n\t\t\t\t// Only set alignItems if an image exists because alignItems causes the placeholder\n\t\t\t\t// to disappear when an aligned image can't be downloaded\n\t\t\t\t// https://github.com/wordpress-mobile/gutenberg-mobile/issues/1592\n\t\t\t\timageData && align && { alignItems: align },\n\t\t\t\tstyle,\n\t\t\t] }\n\t\t\tonLayout={ onContainerLayout }\n\t\t>\n\t\t\t<View\n\t\t\t\taccessible\n\t\t\t\tdisabled={ ! isSelected }\n\t\t\t\taccessibilityLabel={ alt }\n\t\t\t\taccessibilityHint={ __( 'Double tap and hold to edit' ) }\n\t\t\t\taccessibilityRole={ 'imagebutton' }\n\t\t\t\tkey={ url }\n\t\t\t\tstyle={ imageContainerStyles }\n\t\t\t>\n\t\t\t\t{ isSelected &&\n\t\t\t\t\thighlightSelected &&\n\t\t\t\t\t! (\n\t\t\t\t\t\tisUploadInProgress ||\n\t\t\t\t\t\tisUploadFailed ||\n\t\t\t\t\t\tisUploadPaused\n\t\t\t\t\t) && <View style={ imageSelectedStyles } /> }\n\n\t\t\t\t{ ! imageData ? (\n\t\t\t\t\t<View style={ placeholderStyles }>\n\t\t\t\t\t\t<View style={ styles.imageUploadingIconContainer }>\n\t\t\t\t\t\t\t{ getIcon( ICON_TYPE.UPLOAD ) }\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</View>\n\t\t\t\t) : (\n\t\t\t\t\t<View style={ focalPoint && styles.focalPointContent }>\n\t\t\t\t\t\t{ Platform.isAndroid && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{ networkImageLoaded && networkURL && (\n\t\t\t\t\t\t\t\t\t<Animated.Image\n\t\t\t\t\t\t\t\t\t\tstyle={ imageStyles }\n\t\t\t\t\t\t\t\t\t\tfadeDuration={ 0 }\n\t\t\t\t\t\t\t\t\t\tsource={ { uri: networkURL } }\n\t\t\t\t\t\t\t\t\t\t{ ...( ! focalPoint && {\n\t\t\t\t\t\t\t\t\t\t\tresizeMethod: 'scale',\n\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\tresizeMode={ imageResizeMode }\n\t\t\t\t\t\t\t\t\t\ttestID={ `network-image-${ url }` }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ ! networkImageLoaded && ! networkURL && (\n\t\t\t\t\t\t\t\t\t<Animated.Image\n\t\t\t\t\t\t\t\t\t\tstyle={ imageStyles }\n\t\t\t\t\t\t\t\t\t\tfadeDuration={ 0 }\n\t\t\t\t\t\t\t\t\t\tsource={ { uri: localURL } }\n\t\t\t\t\t\t\t\t\t\t{ ...( ! focalPoint && {\n\t\t\t\t\t\t\t\t\t\t\tresizeMethod: 'scale',\n\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\tresizeMode={ imageResizeMode }\n\t\t\t\t\t\t\t\t\t/>\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\t{ Platform.isIOS && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<Animated.Image\n\t\t\t\t\t\t\t\t\tstyle={ imageStyles }\n\t\t\t\t\t\t\t\t\tsource={ {\n\t\t\t\t\t\t\t\t\t\turi:\n\t\t\t\t\t\t\t\t\t\t\tnetworkURL && networkImageLoaded\n\t\t\t\t\t\t\t\t\t\t\t\t? networkURL\n\t\t\t\t\t\t\t\t\t\t\t\t: localURL || url,\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t{ ...( ! focalPoint && {\n\t\t\t\t\t\t\t\t\t\tresizeMethod: 'scale',\n\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\tresizeMode={ imageResizeMode }\n\t\t\t\t\t\t\t\t\ttestID={ `network-image-${\n\t\t\t\t\t\t\t\t\t\tnetworkURL && networkImageLoaded\n\t\t\t\t\t\t\t\t\t\t\t? networkURL\n\t\t\t\t\t\t\t\t\t\t\t: localURL || url\n\t\t\t\t\t\t\t\t\t}` }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<Image\n\t\t\t\t\t\t\t\t\tsource={ { uri: networkURL } }\n\t\t\t\t\t\t\t\t\tstyle={ styles.nonVisibleImage }\n\t\t\t\t\t\t\t\t\tonLoad={ () => {\n\t\t\t\t\t\t\t\t\t\tsetNetworkImageLoaded( true );\n\t\t\t\t\t\t\t\t\t} }\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</View>\n\t\t\t\t) }\n\n\t\t\t\t{ ( isUploadFailed || isUploadPaused ) && retryMessage && (\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\tstyles.imageContainer,\n\t\t\t\t\t\t\tretryContainerStyles,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<View\n\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\tretryIconStyles,\n\t\t\t\t\t\t\t\tretryIcon && styles.customRetryIcon,\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ isUploadPaused\n\t\t\t\t\t\t\t\t? getIcon( ICON_TYPE.OFFLINE )\n\t\t\t\t\t\t\t\t: getIcon( ICON_TYPE.RETRY ) }\n\t\t\t\t\t\t</View>\n\t\t\t\t\t\t<Text style={ uploadFailedTextStyles }>\n\t\t\t\t\t\t\t{ retryMessage }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\t\t\t</View>\n\n\t\t\t{ editButton && isSelected && ! isUploadInProgress && (\n\t\t\t\t<ImageEditingButton\n\t\t\t\t\tonSelectMediaUploadOption={ onSelectMediaUploadOption }\n\t\t\t\t\topenMediaOptions={ openMediaOptions }\n\t\t\t\t\turl={\n\t\t\t\t\t\t! ( isUploadFailed || isUploadPaused ) &&\n\t\t\t\t\t\timageData &&\n\t\t\t\t\t\turl\n\t\t\t\t\t}\n\t\t\t\t\tpickerOptions={ mediaPickerOptions }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</View>\n\t);\n};\n\nexport default ImageComponent;\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,UAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,mBAAA,GAAAT,sBAAA,CAAAF,OAAA;AArBA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;;AAMA,MAAMY,SAAS,GAAG;EACjBC,OAAO,EAAE,SAAS;EAClBC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AAGkD,cAAM,CAACgE,eAAiB;IAChCC,MAAM,EAAGA,CAAA,KAAM;MACdtG,qBAAqB,CAAE,IAAK,CAAC;IAC9B;EAAG,CACH,CACA,CAEE,CACN,EAEC,CAAEzB,cAAc,IAAIC,cAAc,KAAMO,YAAY,IACrD,IAAAkD,MAAA,CAAAC,aAAA,EAACvF,YAAA,CAAAuI,IAAI;IACJ/F,KAAK,EAAG,CACPkD,cAAM,CAACkE,cAAc,EACrBvD,oBAAoB;EAClB,GAEH,IAAAf,MAAA,CAAAC,aAAA,EAACvF,YAAA,CAAAuI,IAAI;IACJ/F,KAAK,EAAG,CACPyD,eAAe,EACf5D,SAAS,IAAIqD,cAAM,CAACmE,eAAe;EACjC,GAEDhI,cAAc,GACb8C,OAAO,CAAE9D,SAAS,CAACC,OAAQ,CAAC,GAC5B6D,OAAO,CAAE9D,SAAS,CAACG,KAAM,CACvB,CAAC,EACP,IAAAsE,MAAA,CAAAC,aAAA,EAACvF,YAAA,CAAA8J,IAAI;IAACtH,KAAK,EAAGgE;EAAwB,GACnCpE,YACG,CACD,CAEF,CAAC,EAELf,UAAU,IAAIK,UAAU,IAAI,CAAEI,kBAAkB,IACjD,IAAAwD,MAAA,CAAAC,aAAA,EAAC3E,mBAAA,CAAAmJ,OAAkB;IAClB9H,yBAAyB,EAAGA,yBAA2B;IACvDC,gBAAgB,EAAGA,gBAAkB;IACrCI,GAAG,EACF,EAAIV,cAAc,IAAIC,cAAc,CAAE,IACtCc,SAAS,IACTL,GACA;IACD0H,aAAa,EAAGjI;EAAoB,CACpC,CAEG,CAAC;AAET,CAAC;AAAC,IAAAkI,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEa7I,cAAc"}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_reactNativeFastImage","_interopRequireDefault","_i18n","_components","_icons","_compose","_element","_utils","_style","_iconRetry","_imageEditingButton","ICON_TYPE","OFFLINE","PLACEHOLDER","RETRY","UPLOAD","ImageComponent","align","alt","editButton","focalPoint","height","imageHeight","highlightSelected","isSelected","shouldUseFastImage","isUploadFailed","isUploadPaused","isUploadInProgress","mediaPickerOptions","onImageDataLoad","onSelectMediaUploadOption","openMediaOptions","resizeMode","retryMessage","retryIcon","url","shapeStyle","style","width","imageWidth","imageData","setImageData","useState","containerSize","setContainerSize","localURL","setLocalURL","networkURL","setNetworkURL","networkImageLoaded","setNetworkImageLoaded","Image","Platform","isAndroid","RNImage","FastImage","imageResizeMode","useEffect","isCurrent","getSize","imgWidth","imgHeight","metaData","aspectRatio","startsWith","isIOS","prefetch","then","onContainerLayout","event","nativeEvent","layout","getIcon","iconType","icon","iconStyle","SvgIconRetry","iconRetryStyles","offline","iconOfflineStyles","image","iconPlaceholderStyles","iconUploadStyles","_react","createElement","Icon","usePreferredColorSchemeStyle","styles","iconPlaceholder","iconPlaceholderDark","iconUpload","iconUploadDark","iconOffline","iconOfflineDark","retryIconStyles","retryIconDark","iconRetry","iconRetryDark","retryContainerStyles","retryContainer","retryContainerDark","uploadFailedTextStyles","uploadFailedText","uploadFailedTextDark","placeholderStyles","imageContainerUpload","imageContainerUploadDark","imageContainerUploadWithFocalpoint","customWidth","wide","imageContainerStyles","imageContent","focalPointContainer","imageStyles","getImageWithFocalPointStyles","undefined","calculatedSelectedHeight","isNaN","imageSelectedStyles","imageBorder","imageBorderDark","View","container","alignItems","onLayout","accessible","disabled","accessibilityLabel","accessibilityHint","__","accessibilityRole","key","imageUploadingIconContainer","focalPointContent","Fragment","fadeDuration","source","uri","resizeMethod","testID","nonVisibleImage","onLoad","imageContainer","customRetryIcon","Text","default","pickerOptions","_default","exports"],"sources":["@wordpress/components/src/mobile/image/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Image as RNImage, Text, View } from 'react-native';\nimport FastImage from 'react-native-fast-image';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon } from '@wordpress/components';\nimport { image, offline } from '@wordpress/icons';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { useEffect, useState, Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getImageWithFocalPointStyles } from './utils';\nimport styles from './style.scss';\nimport SvgIconRetry from './icon-retry';\nimport ImageEditingButton from './image-editing-button';\n\nconst ICON_TYPE = {\n\tOFFLINE: 'offline',\n\tPLACEHOLDER: 'placeholder',\n\tRETRY: 'retry',\n\tUPLOAD: 'upload',\n};\n\nconst ImageComponent = ( {\n\talign,\n\talt,\n\teditButton = true,\n\tfocalPoint,\n\theight: imageHeight,\n\thighlightSelected = true,\n\tisSelected,\n\tshouldUseFastImage,\n\tisUploadFailed,\n\tisUploadPaused,\n\tisUploadInProgress,\n\tmediaPickerOptions,\n\tonImageDataLoad,\n\tonSelectMediaUploadOption,\n\topenMediaOptions,\n\tresizeMode,\n\tretryMessage,\n\tretryIcon,\n\turl,\n\tshapeStyle,\n\tstyle,\n\twidth: imageWidth,\n} ) => {\n\tconst [ imageData, setImageData ] = useState( null );\n\tconst [ containerSize, setContainerSize ] = useState( null );\n\tconst [ localURL, setLocalURL ] = useState( null );\n\tconst [ networkURL, setNetworkURL ] = useState( null );\n\tconst [ networkImageLoaded, setNetworkImageLoaded ] = useState( false );\n\n\t// Disabled for Android due to https://github.com/WordPress/gutenberg/issues/43149\n\tconst Image =\n\t\t! shouldUseFastImage || Platform.isAndroid ? RNImage : FastImage;\n\tconst imageResizeMode =\n\t\t! shouldUseFastImage || Platform.isAndroid\n\t\t\t? resizeMode\n\t\t\t: FastImage.resizeMode[ resizeMode ];\n\n\tuseEffect( () => {\n\t\tlet isCurrent = true;\n\t\tif ( url ) {\n\t\t\tRNImage.getSize( url, ( imgWidth, imgHeight ) => {\n\t\t\t\tif ( ! isCurrent ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst metaData = {\n\t\t\t\t\taspectRatio: imgWidth / imgHeight,\n\t\t\t\t\twidth: imgWidth,\n\t\t\t\t\theight: imgHeight,\n\t\t\t\t};\n\t\t\t\tsetImageData( metaData );\n\t\t\t\tif ( onImageDataLoad ) {\n\t\t\t\t\tonImageDataLoad( metaData );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tif ( url.startsWith( 'file:///' ) ) {\n\t\t\t\tsetLocalURL( url );\n\t\t\t\tsetNetworkURL( null );\n\t\t\t\tsetNetworkImageLoaded( false );\n\t\t\t} else if ( url.startsWith( 'https://' ) ) {\n\t\t\t\tif ( Platform.isIOS ) {\n\t\t\t\t\tsetNetworkURL( url );\n\t\t\t\t} else if ( Platform.isAndroid ) {\n\t\t\t\t\tRNImage.prefetch( url ).then(\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tif ( ! isCurrent ) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetNetworkURL( url );\n\t\t\t\t\t\t\tsetNetworkImageLoaded( true );\n\t\t\t\t\t\t},\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t// This callback is called when the image fails to load,\n\t\t\t\t\t\t\t// but these events are handled by `isUploadFailed`\n\t\t\t\t\t\t\t// and `isUploadPaused` events instead.\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// Ignoring the error event will persist the local image URI.\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn () => ( isCurrent = false );\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ url ] );\n\n\tconst onContainerLayout = ( event ) => {\n\t\tconst { height, width } = event.nativeEvent.layout;\n\n\t\tif (\n\t\t\twidth !== 0 &&\n\t\t\theight !== 0 &&\n\t\t\t( containerSize?.width !== width ||\n\t\t\t\tcontainerSize?.height !== height )\n\t\t) {\n\t\t\tsetContainerSize( { width, height } );\n\t\t}\n\t};\n\n\tconst getIcon = ( iconType ) => {\n\t\tlet icon;\n\t\tlet iconStyle;\n\t\tswitch ( iconType ) {\n\t\t\tcase ICON_TYPE.RETRY:\n\t\t\t\ticon = retryIcon || SvgIconRetry;\n\t\t\t\ticonStyle = iconRetryStyles;\n\t\t\t\tbreak;\n\t\t\tcase ICON_TYPE.OFFLINE:\n\t\t\t\ticon = offline;\n\t\t\t\ticonStyle = iconOfflineStyles;\n\t\t\t\tbreak;\n\t\t\tcase ICON_TYPE.PLACEHOLDER:\n\t\t\t\ticon = image;\n\t\t\t\ticonStyle = iconPlaceholderStyles;\n\t\t\t\tbreak;\n\t\t\tcase ICON_TYPE.UPLOAD:\n\t\t\t\ticon = image;\n\t\t\t\ticonStyle = iconUploadStyles;\n\t\t\t\tbreak;\n\t\t}\n\t\treturn <Icon icon={ icon } { ...iconStyle } />;\n\t};\n\n\tconst iconPlaceholderStyles = usePreferredColorSchemeStyle(\n\t\tstyles.iconPlaceholder,\n\t\tstyles.iconPlaceholderDark\n\t);\n\n\tconst iconUploadStyles = usePreferredColorSchemeStyle(\n\t\tstyles.iconUpload,\n\t\tstyles.iconUploadDark\n\t);\n\n\tconst iconOfflineStyles = usePreferredColorSchemeStyle(\n\t\tstyles.iconOffline,\n\t\tstyles.iconOfflineDark\n\t);\n\n\tconst retryIconStyles = usePreferredColorSchemeStyle(\n\t\tstyles.retryIcon,\n\t\tstyles.retryIconDark\n\t);\n\n\tconst iconRetryStyles = usePreferredColorSchemeStyle(\n\t\tstyles.iconRetry,\n\t\tstyles.iconRetryDark\n\t);\n\n\tconst retryContainerStyles = usePreferredColorSchemeStyle(\n\t\tstyles.retryContainer,\n\t\tstyles.retryContainerDark\n\t);\n\n\tconst uploadFailedTextStyles = usePreferredColorSchemeStyle(\n\t\tstyles.uploadFailedText,\n\t\tstyles.uploadFailedTextDark\n\t);\n\n\tconst placeholderStyles = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles.imageContainerUpload,\n\t\t\tstyles.imageContainerUploadDark\n\t\t),\n\t\tfocalPoint && styles.imageContainerUploadWithFocalpoint,\n\t\timageHeight && { height: imageHeight },\n\t];\n\n\tconst customWidth =\n\t\timageData?.width < containerSize?.width\n\t\t\t? imageData?.width\n\t\t\t: styles.wide?.width;\n\n\tconst imageContainerStyles = [\n\t\tstyles.imageContent,\n\t\t{\n\t\t\twidth:\n\t\t\t\timageWidth === styles.wide?.width ||\n\t\t\t\t( imageData &&\n\t\t\t\t\timageWidth > 0 &&\n\t\t\t\t\timageWidth < containerSize?.width )\n\t\t\t\t\t? imageWidth\n\t\t\t\t\t: customWidth,\n\t\t},\n\t\tresizeMode && { width: styles.wide?.width },\n\t\tfocalPoint && styles.focalPointContainer,\n\t];\n\n\tconst imageStyles = [\n\t\t{\n\t\t\theight: containerSize?.height,\n\t\t},\n\t\t! resizeMode && {\n\t\t\taspectRatio: imageData?.aspectRatio,\n\t\t},\n\t\tfocalPoint && styles.focalPoint,\n\t\tfocalPoint &&\n\t\t\tgetImageWithFocalPointStyles(\n\t\t\t\tfocalPoint,\n\t\t\t\tcontainerSize,\n\t\t\t\timageData\n\t\t\t),\n\t\t! focalPoint &&\n\t\t\timageData &&\n\t\t\tcontainerSize && {\n\t\t\t\theight:\n\t\t\t\t\timageData?.width > containerSize?.width && ! imageWidth\n\t\t\t\t\t\t? containerSize?.width / imageData?.aspectRatio\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\timageHeight && { height: imageHeight },\n\t\tshapeStyle,\n\t];\n\n\t// On iOS, add 1 to height to account for the 1px non-visible image\n\t// that is used to determine when the network image has loaded\n\t// We also must verify that it is not NaN, as it can be NaN when the image is loading.\n\t// This is not necessary on Android as the non-visible image is not used.\n\tlet calculatedSelectedHeight;\n\tif ( Platform.isIOS ) {\n\t\tcalculatedSelectedHeight =\n\t\t\tcontainerSize && ! isNaN( containerSize.height )\n\t\t\t\t? containerSize.height + 1\n\t\t\t\t: 0;\n\t} else {\n\t\tcalculatedSelectedHeight = containerSize?.height;\n\t}\n\n\tconst imageSelectedStyles = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles.imageBorder,\n\t\t\tstyles.imageBorderDark\n\t\t),\n\t\t{\n\t\t\theight: calculatedSelectedHeight,\n\t\t},\n\t];\n\n\treturn (\n\t\t<View\n\t\t\tstyle={ [\n\t\t\t\tstyles.container,\n\t\t\t\t// Only set alignItems if an image exists because alignItems causes the placeholder\n\t\t\t\t// to disappear when an aligned image can't be downloaded\n\t\t\t\t// https://github.com/wordpress-mobile/gutenberg-mobile/issues/1592\n\t\t\t\timageData && align && { alignItems: align },\n\t\t\t\tstyle,\n\t\t\t] }\n\t\t\tonLayout={ onContainerLayout }\n\t\t>\n\t\t\t<View\n\t\t\t\taccessible\n\t\t\t\tdisabled={ ! isSelected }\n\t\t\t\taccessibilityLabel={ alt }\n\t\t\t\taccessibilityHint={ __( 'Double tap and hold to edit' ) }\n\t\t\t\taccessibilityRole={ 'imagebutton' }\n\t\t\t\tkey={ url }\n\t\t\t\tstyle={ imageContainerStyles }\n\t\t\t>\n\t\t\t\t{ isSelected && highlightSelected && (\n\t\t\t\t\t<View style={ imageSelectedStyles } />\n\t\t\t\t) }\n\n\t\t\t\t{ ! imageData ? (\n\t\t\t\t\t<View style={ placeholderStyles }>\n\t\t\t\t\t\t<View style={ styles.imageUploadingIconContainer }>\n\t\t\t\t\t\t\t{ getIcon( ICON_TYPE.UPLOAD ) }\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</View>\n\t\t\t\t) : (\n\t\t\t\t\t<View style={ focalPoint && styles.focalPointContent }>\n\t\t\t\t\t\t{ Platform.isAndroid && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{ networkImageLoaded && networkURL && (\n\t\t\t\t\t\t\t\t\t<Image\n\t\t\t\t\t\t\t\t\t\tstyle={ imageStyles }\n\t\t\t\t\t\t\t\t\t\tfadeDuration={ 0 }\n\t\t\t\t\t\t\t\t\t\tsource={ { uri: networkURL } }\n\t\t\t\t\t\t\t\t\t\t{ ...( ! focalPoint && {\n\t\t\t\t\t\t\t\t\t\t\tresizeMethod: 'scale',\n\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\tresizeMode={ imageResizeMode }\n\t\t\t\t\t\t\t\t\t\ttestID={ `network-image-${ url }` }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ ! networkImageLoaded && ! networkURL && (\n\t\t\t\t\t\t\t\t\t<Image\n\t\t\t\t\t\t\t\t\t\tstyle={ imageStyles }\n\t\t\t\t\t\t\t\t\t\tfadeDuration={ 0 }\n\t\t\t\t\t\t\t\t\t\tsource={ { uri: localURL } }\n\t\t\t\t\t\t\t\t\t\t{ ...( ! focalPoint && {\n\t\t\t\t\t\t\t\t\t\t\tresizeMethod: 'scale',\n\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\tresizeMode={ imageResizeMode }\n\t\t\t\t\t\t\t\t\t/>\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\t{ Platform.isIOS && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<Image\n\t\t\t\t\t\t\t\t\tstyle={ imageStyles }\n\t\t\t\t\t\t\t\t\tsource={ {\n\t\t\t\t\t\t\t\t\t\turi:\n\t\t\t\t\t\t\t\t\t\t\tnetworkURL && networkImageLoaded\n\t\t\t\t\t\t\t\t\t\t\t\t? networkURL\n\t\t\t\t\t\t\t\t\t\t\t\t: localURL || url,\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t{ ...( ! focalPoint && {\n\t\t\t\t\t\t\t\t\t\tresizeMethod: 'scale',\n\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\tresizeMode={ imageResizeMode }\n\t\t\t\t\t\t\t\t\ttestID={ `network-image-${\n\t\t\t\t\t\t\t\t\t\tnetworkURL && networkImageLoaded\n\t\t\t\t\t\t\t\t\t\t\t? networkURL\n\t\t\t\t\t\t\t\t\t\t\t: localURL || url\n\t\t\t\t\t\t\t\t\t}` }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<Image\n\t\t\t\t\t\t\t\t\tsource={ { uri: networkURL } }\n\t\t\t\t\t\t\t\t\tstyle={ styles.nonVisibleImage }\n\t\t\t\t\t\t\t\t\tonLoad={ () => {\n\t\t\t\t\t\t\t\t\t\tsetNetworkImageLoaded( true );\n\t\t\t\t\t\t\t\t\t} }\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</View>\n\t\t\t\t) }\n\n\t\t\t\t{ ( isUploadFailed || isUploadPaused ) && retryMessage && (\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\tstyles.imageContainer,\n\t\t\t\t\t\t\tretryContainerStyles,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<View\n\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\tretryIconStyles,\n\t\t\t\t\t\t\t\tretryIcon && styles.customRetryIcon,\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ isUploadPaused\n\t\t\t\t\t\t\t\t? getIcon( ICON_TYPE.OFFLINE )\n\t\t\t\t\t\t\t\t: getIcon( ICON_TYPE.RETRY ) }\n\t\t\t\t\t\t</View>\n\t\t\t\t\t\t<Text style={ uploadFailedTextStyles }>\n\t\t\t\t\t\t\t{ retryMessage }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\t\t\t</View>\n\n\t\t\t{ editButton && isSelected && ! isUploadInProgress && (\n\t\t\t\t<ImageEditingButton\n\t\t\t\t\tonSelectMediaUploadOption={ onSelectMediaUploadOption }\n\t\t\t\t\topenMediaOptions={ openMediaOptions }\n\t\t\t\t\turl={\n\t\t\t\t\t\t! ( isUploadFailed || isUploadPaused ) &&\n\t\t\t\t\t\timageData &&\n\t\t\t\t\t\turl\n\t\t\t\t\t}\n\t\t\t\t\tpickerOptions={ mediaPickerOptions }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</View>\n\t);\n};\n\nexport default ImageComponent;\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,UAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,mBAAA,GAAAT,sBAAA,CAAAF,OAAA;AArBA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;;AAMA,MAAMY,SAAS,GAAG;EACjBC,OAAO,EAAE,SAAS;EAClBC,WAAW,EAAE,aAAa;EAC1BC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE;AACT,CAAC;AAED,MAAMC,cAAc,GAAGA,CAAE;EACxBC,KAAK;EACLC,GAAG;EACHC,UAAU,GAAG,IAAI;EACjBC,UAAU;EACVC,MAAM,EAAEC,WAAW;EACnBC,iBAAiB,GAAG,IAAI;EACxBC,UAAU;EACVC,kBAAkB;EAClBC,cAAc;EACdC,cAAc;EACdC,kBAAkB;EAClBC,kBAAkB;EAClBC,eAAe;EACfC,yBAAyB;EACzBC,gBAAgB;EAChBC,UAAU;EACVC,YAAY;EACZC,SAAS;EACTC,GAAG;EACHC,UAAU;EACVC,KAAK;EACLC,KAAK,EAAEC;AACR,CAAC,KAAM;EACN,MAAM,CAAEC,SAAS,EAAEC,YAAY,CAAE,GAAG,IAAAC,iBAAQ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{"version":3,"names":["_element","require","_i18n","_components","_reactNativeBridge","MEDIA_TYPE_IMAGE","exports","MEDIA_EDITOR","editOption","id","value","label","__","requiresModal","types","replaceOption","mediaSources","deviceLibrary","MediaEdit","Component","constructor","props","onPickerPresent","bind","onPickerSelect","getMediaOptionsItems","getDestructiveButtonIndex","pickerOptions","openReplaceMediaOptions","source","uri","filter","Boolean","options","destructiveButtonIndex","findIndex","option","destructiveButton","undefined","picker","presentPicker","onSelect","multiple","requestMediaEditor","media","optionSelected","find","onPress","render","mediaOptions","_react","createElement","Picker","hideCancelButton","ref","instance","leftAlign","onChange","title","open","_default","default"],"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 { Picker } from '@wordpress/components';\nimport {\n\trequestMediaEditor,\n\tmediaSources,\n} from '@wordpress/react-native-bridge';\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
|
|
1
|
+
{"version":3,"names":["_element","require","_i18n","_components","_reactNativeBridge","MEDIA_TYPE_IMAGE","exports","MEDIA_EDITOR","editOption","id","value","label","__","requiresModal","types","replaceOption","mediaSources","deviceLibrary","MediaEdit","Component","constructor","props","onPickerPresent","bind","onPickerSelect","getMediaOptionsItems","getDestructiveButtonIndex","pickerOptions","openReplaceMediaOptions","source","uri","filter","Boolean","options","destructiveButtonIndex","findIndex","option","destructiveButton","undefined","picker","presentPicker","onSelect","multiple","requestMediaEditor","media","optionSelected","find","onPress","render","mediaOptions","_react","createElement","Picker","hideCancelButton","ref","instance","leftAlign","onChange","title","open","_default","default"],"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 { Picker } from '@wordpress/components';\nimport {\n\trequestMediaEditor,\n\tmediaSources,\n} from '@wordpress/react-native-bridge';\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":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AANA;AACA;AACA;;AASO,MAAMI,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,OAAO;AAEhC,MAAME,YAAY,GAAAD,OAAA,CAAAC,YAAA,GAAG,cAAc;AAE1C,MAAMC,UAAU,GAAG;EAClBC,EAAE,EAAEF,YAAY;EAChBG,KAAK,EAAEH,YAAY;EACnBI,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO,CAAC;EACnBC,aAAa,EAAE,IAAI;EACnBC,KAAK,EAAE,CAAET,gBAAgB;AAC1B,CAAC;AAED,MAAMU,aAAa,GAAG;EACrBN,EAAE,EAAEO,+BAAY,CAACC,aAAa;EAC9BP,KAAK,EAAEM,+BAAY,CAACC,aAAa;EACjCN,KAAK,EAAE,IAAAC,QAAE,EAAE,SAAU,CAAC;EACtBE,KAAK,EAAE,CAAET,gBAAgB;AAC1B,CAAC;AAEM,MAAMa,SAAS,SAASC,kBAAS,CAAC;EACxCC,WAAWA,CAAEC,KAAK,EAAG;IACpB,KAAK,CAAEA,KAAM,CAAC;IACd,IAAI,CAACC,eAAe,GAAG,IAAI,CAACA,eAAe,CAACC,IAAI,CAAE,IAAK,CAAC;IACxD,IAAI,CAACC,cAAc,GAAG,IAAI,CAACA,cAAc,CAACD,IAAI,CAAE,IAAK,CAAC;IACtD,IAAI,CAACE,oBAAoB,GAAG,IAAI,CAACA,oBAAoB,CAACF,IAAI,CAAE,IAAK,CAAC;IAClE,IAAI,CAACG,yBAAyB,GAC7B,IAAI,CAACA,yBAAyB,CAACH,IAAI,CAAE,IAA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C;QAExD,IAAKmC,cAAc,IAAIA,cAAc,CAACE,OAAO,EAAG;UAC/CF,cAAc,CAACE,OAAO,CAAC,CAAC;UACxB;QACD;QAEA,IAAKnB,uBAAuB,EAAG;UAC9BA,uBAAuB,CAAC,CAAC;QAC1B;IACF;EACD;EAEAoB,MAAMA,CAAA,EAAG;IACR,MAAMC,YAAY,GAAGA,CAAA,KACpB,IAAAC,MAAA,CAAAC,aAAA,EAAChD,WAAA,CAAAiD,MAAM;MACNC,gBAAgB;MAChBC,GAAG,EAAKC,QAAQ,IAAQ,IAAI,CAAChB,MAAM,GAAGgB,QAAY;MAClDtB,OAAO,EAAG,IAAI,CAACR,oBAAoB,CAAC,CAAG;MACvC+B,SAAS;MACTC,QAAQ,EAAG,IAAI,CAACjC;MAChB;MAAA;MACAkC,KAAK,EAAG,IAAA9C,QAAE,EAAE,eAAgB,CAAG;MAC/BsB,sBAAsB,EAAG,IAAI,CAACR,yBAAyB,CAAC;IAAG,CAC3D,CACD;IAED,OAAO,IAAI,CAACL,KAAK,CAAC2B,MAAM,CAAE;MACzBW,IAAI,EAAE,IAAI,CAACrC,eAAe;MAC1B2B;IACD,CAAE,CAAC;EACJ;AACD;AAAC3C,OAAA,CAAAY,SAAA,GAAAA,SAAA;AAAA,IAAA0C,QAAA,GAAAtD,OAAA,CAAAuD,OAAA,GAEc3C,SAAS"}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.PaletteEdit = PaletteEdit;
|
|
8
8
|
exports.default = void 0;
|
|
9
|
-
exports.
|
|
9
|
+
exports.getNameAndSlugForPosition = getNameAndSlugForPosition;
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
12
|
var _element = require("@wordpress/element");
|
|
@@ -55,7 +55,7 @@ function NameInput({
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* Returns a name for a palette item
|
|
58
|
+
* Returns a name and slug for a palette item. The name takes the format "Color + id".
|
|
59
59
|
* To ensure there are no duplicate ids, this function checks all slugs.
|
|
60
60
|
* It expects slugs to be in the format: slugPrefix + color- + number.
|
|
61
61
|
* It then sets the id component of the new name based on the incremented id of the highest existing slug id.
|
|
@@ -63,9 +63,9 @@ function NameInput({
|
|
|
63
63
|
* @param elements An array of color palette items.
|
|
64
64
|
* @param slugPrefix The slug prefix used to match the element slug.
|
|
65
65
|
*
|
|
66
|
-
* @return A
|
|
66
|
+
* @return A name and slug for the new palette item.
|
|
67
67
|
*/
|
|
68
|
-
function
|
|
68
|
+
function getNameAndSlugForPosition(elements, slugPrefix) {
|
|
69
69
|
const nameRegex = new RegExp(`^${slugPrefix}color-([\\d]+)$`);
|
|
70
70
|
const position = elements.reduce((previousValue, currentValue) => {
|
|
71
71
|
if (typeof currentValue?.slug === 'string') {
|
|
@@ -79,8 +79,11 @@ function getNameForPosition(elements, slugPrefix) {
|
|
|
79
79
|
}
|
|
80
80
|
return previousValue;
|
|
81
81
|
}, 1);
|
|
82
|
-
return
|
|
83
|
-
|
|
82
|
+
return {
|
|
83
|
+
name: (0, _i18n.sprintf)( /* translators: %s: is an id for a custom color */
|
|
84
|
+
(0, _i18n.__)('Color %s'), position),
|
|
85
|
+
slug: `${slugPrefix}color-${position}`
|
|
86
|
+
};
|
|
84
87
|
}
|
|
85
88
|
function ColorPickerPopover({
|
|
86
89
|
isGradient,
|
|
@@ -308,18 +311,21 @@ function PaletteEdit({
|
|
|
308
311
|
icon: _icons.plus,
|
|
309
312
|
label: isGradient ? (0, _i18n.__)('Add gradient') : (0, _i18n.__)('Add color'),
|
|
310
313
|
onClick: () => {
|
|
311
|
-
const
|
|
314
|
+
const {
|
|
315
|
+
name,
|
|
316
|
+
slug
|
|
317
|
+
} = getNameAndSlugForPosition(elements, slugPrefix);
|
|
312
318
|
if (!!gradients) {
|
|
313
319
|
onChange([...gradients, {
|
|
314
320
|
gradient: _constants.DEFAULT_GRADIENT,
|
|
315
|
-
name
|
|
316
|
-
slug
|
|
321
|
+
name,
|
|
322
|
+
slug
|
|
317
323
|
}]);
|
|
318
324
|
} else {
|
|
319
325
|
onChange([...colors, {
|
|
320
326
|
color: DEFAULT_COLOR,
|
|
321
|
-
name
|
|
322
|
-
slug
|
|
327
|
+
name,
|
|
328
|
+
slug
|
|
323
329
|
}]);
|
|
324
330
|
}
|
|
325
331
|
setIsEditing(true);
|
|
@@ -329,7 +335,7 @@ function PaletteEdit({
|
|
|
329
335
|
icon: _icons.moreVertical,
|
|
330
336
|
label: isGradient ? (0, _i18n.__)('Gradient options') : (0, _i18n.__)('Color options'),
|
|
331
337
|
toggleProps: {
|
|
332
|
-
|
|
338
|
+
size: 'small'
|
|
333
339
|
}
|
|
334
340
|
}, ({
|
|
335
341
|
onClose
|