@os-design-mobile/image-upload 1.0.104 → 1.0.106
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/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
- package/src/index.tsx +5 -5
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeGestureHandler=require("react-native-gesture-handler");var _actionMenu=_interopRequireWildcard(require("@os-design-mobile/action-menu"));var _icons=require("@os-design-mobile/icons");var _reactNativeImagePicker=require("react-native-image-picker");var _text=_interopRequireDefault(require("@os-design-mobile/text"));var _image=_interopRequireDefault(require("@os-design-mobile/image"));var _useForwardedState3=_interopRequireDefault(require("@os-design/use-forwarded-state"));var _native=_interopRequireDefault(require("@emotion/native"));var _omitEmotionProps=_interopRequireDefault(require("@os-design/omit-emotion-props"));var _theming=require("@os-design-mobile/theming");var _button=_interopRequireDefault(require("@os-design-mobile/button"));var _defaultLocale=_interopRequireDefault(require("./utils/defaultLocale"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["url","locale","imageLibraryOptions","cameraOptions","value","defaultValue","onChange","onPress"];function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&{}.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var overlayHasImageStyles=function overlayHasImageStyles(p){return p.hasImage?{backgroundColor:(0,_theming.clr)([0,0,0,p.theme.imageUploadOverlayOpacity]),borderRadius:p.theme.borderRadius*p.theme.fontSize}:{};};var Overlay=(0,_native.default)(_reactNative.View,(0,_omitEmotionProps.default)('hasImage'))(function(p){return Object.assign({position:'absolute',top:0,right:0,bottom:0,left:0,justifyContent:'center',alignItems:'center',padding:p.theme.imageUploadOverlayPadding*p.theme.fontSize},overlayHasImageStyles(p));});var StyledRectButton=(0,_native.default)(_reactNativeGestureHandler.RectButton)(function(p){return{width:'100%',maxWidth:p.theme.imageUploadMaxWidth*p.theme.fontSize,minHeight:p.theme.imageUploadMinHeight*p.theme.fontSize,borderRadius:p.theme.borderRadius*p.theme.fontSize};});var notHasImageStyles=function notHasImageStyles(p){return!p.hasImage?{backgroundColor:(0,_theming.clr)(p.theme.imageUploadNoImageColorBg),borderWidth:2,borderColor:(0,_theming.clr)(p.theme.imageUploadNoImageColorBorder),borderStyle:'dashed'}:{};};var Container=(0,_native.default)(_reactNative.View,(0,_omitEmotionProps.default)('hasImage'))(function(p){return Object.assign({minHeight:p.theme.imageUploadMinHeight*p.theme.fontSize,borderRadius:p.theme.borderRadius*p.theme.fontSize},notHasImageStyles(p));});var Content=_native.default.View({flex:1,justifyContent:'center',alignItems:'center'});var Title=(0,_native.default)(_text.default)(function(p){return{marginTop:0.5*p.theme.fontSize,textAlign:'center'};});var StyledImage=(0,_native.default)(_image.default)({resizeMode:'cover',aspectRatio:1});var DeleteButtonContainer=_native.default.View(function(p){return{position:'absolute',top:0.5*p.theme.fontSize,right:0.5*p.theme.fontSize};});var ImageUpload=(0,_react.forwardRef)(function(_ref,ref){var url=_ref.url,_ref$locale=_ref.locale,locale=_ref$locale===void 0?_defaultLocale.default:_ref$locale,_ref$imageLibraryOpti=_ref.imageLibraryOptions,imageLibraryOptions=_ref$imageLibraryOpti===void 0?{}:_ref$imageLibraryOpti,_ref$cameraOptions=_ref.cameraOptions,cameraOptions=_ref$cameraOptions===void 0?{}:_ref$cameraOptions,value=_ref.value,defaultValue=_ref.defaultValue,onChange=_ref.onChange,_ref$onPress=_ref.onPress,_onPress=_ref$onPress===void 0?function(){}:_ref$onPress,rest=(0,_objectWithoutProperties2.default)(_ref,_excluded);var _useForwardedState=(0,_useForwardedState3.default)({value:value,defaultValue:defaultValue,onChange:onChange}),_useForwardedState2=(0,_slicedToArray2.default)(_useForwardedState,2),forwardedValue=_useForwardedState2[0],setForwardedValue=_useForwardedState2[1];var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),modalVisible=_useState2[0],setModalVisible=_useState2[1];var _useTheme=(0,_theming.useTheme)(),theme=_useTheme.theme;var chooseFromPhotoLibraryHandler=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){try{var _yield$Promise=yield new Promise(function(resolve){(0,_reactNativeImagePicker.launchImageLibrary)(Object.assign({mediaType:'photo'},imageLibraryOptions),resolve);}),assets=_yield$Promise.assets;setModalVisible(false);if(assets)setForwardedValue(assets[0]);}catch(_unused){}}),[imageLibraryOptions,setForwardedValue]);var takePhotoHandler=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){try{var _yield$Promise2=yield new Promise(function(resolve){(0,_reactNativeImagePicker.launchCamera)(Object.assign({mediaType:'photo'},cameraOptions),resolve);}),assets=_yield$Promise2.assets;setModalVisible(false);if(assets)setForwardedValue(assets[0]);}catch(_unused2){}}),[cameraOptions,setForwardedValue]);var source=(0,_react.useMemo)(function(){if(forwardedValue===null)return null;if(forwardedValue)return forwardedValue.uri;if(url)return url;return null;},[forwardedValue,url]);var hasImage=(0,_react.useMemo)(function(){return!!source;},[source]);return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_theming.ThemeOverrider,{overrides:hasImage?{colorText:[0,0,100]}:{},children:(0,_jsxRuntime.jsx)(StyledRectButton,Object.assign({onPress:function onPress(e){setModalVisible(true);_onPress(e);},underlayColor:hasImage?(0,_theming.clr)([0,0,100]):(0,_theming.clr)(theme.imageUploadNoImageBgHighlight),
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeGestureHandler=require("react-native-gesture-handler");var _actionMenu=_interopRequireWildcard(require("@os-design-mobile/action-menu"));var _icons=require("@os-design-mobile/icons");var _reactNativeImagePicker=require("react-native-image-picker");var _text=_interopRequireDefault(require("@os-design-mobile/text"));var _image=_interopRequireDefault(require("@os-design-mobile/image"));var _useForwardedState3=_interopRequireDefault(require("@os-design/use-forwarded-state"));var _native=_interopRequireDefault(require("@emotion/native"));var _omitEmotionProps=_interopRequireDefault(require("@os-design/omit-emotion-props"));var _theming=require("@os-design-mobile/theming");var _button=_interopRequireDefault(require("@os-design-mobile/button"));var _defaultLocale=_interopRequireDefault(require("./utils/defaultLocale"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["url","locale","imageLibraryOptions","cameraOptions","value","defaultValue","onChange","onPress"];function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&{}.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var overlayHasImageStyles=function overlayHasImageStyles(p){return p.hasImage?{backgroundColor:(0,_theming.clr)([0,0,0,p.theme.imageUploadOverlayOpacity]),borderRadius:p.theme.borderRadius*p.theme.fontSize}:{};};var Overlay=(0,_native.default)(_reactNative.View,(0,_omitEmotionProps.default)('hasImage'))(function(p){return Object.assign({position:'absolute',top:0,right:0,bottom:0,left:0,justifyContent:'center',alignItems:'center',padding:p.theme.imageUploadOverlayPadding*p.theme.fontSize},overlayHasImageStyles(p));});var StyledRectButton=(0,_native.default)(_reactNativeGestureHandler.RectButton)(function(p){return{width:'100%',maxWidth:p.theme.imageUploadMaxWidth*p.theme.fontSize,minHeight:p.theme.imageUploadMinHeight*p.theme.fontSize,borderRadius:p.theme.borderRadius*p.theme.fontSize};});var notHasImageStyles=function notHasImageStyles(p){return!p.hasImage?{backgroundColor:(0,_theming.clr)(p.theme.imageUploadNoImageColorBg),borderWidth:2,borderColor:(0,_theming.clr)(p.theme.imageUploadNoImageColorBorder),borderStyle:'dashed'}:{};};var Container=(0,_native.default)(_reactNative.View,(0,_omitEmotionProps.default)('hasImage'))(function(p){return Object.assign({minHeight:p.theme.imageUploadMinHeight*p.theme.fontSize,borderRadius:p.theme.borderRadius*p.theme.fontSize},notHasImageStyles(p));});var Content=_native.default.View({flex:1,justifyContent:'center',alignItems:'center'});var Title=(0,_native.default)(_text.default)(function(p){return{marginTop:0.5*p.theme.fontSize,textAlign:'center'};});var StyledImage=(0,_native.default)(_image.default)({resizeMode:'cover',aspectRatio:1});var DeleteButtonContainer=_native.default.View(function(p){return{position:'absolute',top:0.5*p.theme.fontSize,right:0.5*p.theme.fontSize};});var ImageUpload=(0,_react.forwardRef)(function(_ref,ref){var url=_ref.url,_ref$locale=_ref.locale,locale=_ref$locale===void 0?_defaultLocale.default:_ref$locale,_ref$imageLibraryOpti=_ref.imageLibraryOptions,imageLibraryOptions=_ref$imageLibraryOpti===void 0?{}:_ref$imageLibraryOpti,_ref$cameraOptions=_ref.cameraOptions,cameraOptions=_ref$cameraOptions===void 0?{}:_ref$cameraOptions,value=_ref.value,defaultValue=_ref.defaultValue,onChange=_ref.onChange,_ref$onPress=_ref.onPress,_onPress=_ref$onPress===void 0?function(){}:_ref$onPress,rest=(0,_objectWithoutProperties2.default)(_ref,_excluded);var _useForwardedState=(0,_useForwardedState3.default)({value:value,defaultValue:defaultValue,onChange:onChange}),_useForwardedState2=(0,_slicedToArray2.default)(_useForwardedState,2),forwardedValue=_useForwardedState2[0],setForwardedValue=_useForwardedState2[1];var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),modalVisible=_useState2[0],setModalVisible=_useState2[1];var _useTheme=(0,_theming.useTheme)(),theme=_useTheme.theme;var chooseFromPhotoLibraryHandler=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){try{var _yield$Promise=yield new Promise(function(resolve){(0,_reactNativeImagePicker.launchImageLibrary)(Object.assign({mediaType:'photo'},imageLibraryOptions),resolve);}),assets=_yield$Promise.assets;setModalVisible(false);if(assets)setForwardedValue(assets[0]);}catch(_unused){}}),[imageLibraryOptions,setForwardedValue]);var takePhotoHandler=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){try{var _yield$Promise2=yield new Promise(function(resolve){(0,_reactNativeImagePicker.launchCamera)(Object.assign({mediaType:'photo'},cameraOptions),resolve);}),assets=_yield$Promise2.assets;setModalVisible(false);if(assets)setForwardedValue(assets[0]);}catch(_unused2){}}),[cameraOptions,setForwardedValue]);var source=(0,_react.useMemo)(function(){if(forwardedValue===null)return null;if(forwardedValue)return forwardedValue.uri;if(url)return url;return null;},[forwardedValue,url]);var hasImage=(0,_react.useMemo)(function(){return!!source;},[source]);return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_theming.ThemeOverrider,{overrides:hasImage?{colorText:[0,0,100]}:{},children:(0,_jsxRuntime.jsx)(StyledRectButton,Object.assign({onPress:function onPress(e){setModalVisible(true);_onPress(e);},underlayColor:hasImage?(0,_theming.clr)([0,0,100]):(0,_theming.clr)(theme.imageUploadNoImageBgHighlight),activeOpacity:hasImage?0.8:1},rest,{ref:ref,children:(0,_jsxRuntime.jsxs)(Container,{hasImage:hasImage,accessible:true,accessibilityRole:"imagebutton",children:[source&&(0,_jsxRuntime.jsx)(StyledImage,{source:{uri:source}}),(0,_jsxRuntime.jsxs)(Overlay,{hasImage:hasImage,children:[(0,_jsxRuntime.jsxs)(Content,{children:[(0,_jsxRuntime.jsx)(_theming.ThemeOverrider,{overrides:function overrides(t){return{fontSize:2.5*t.fontSize};},children:(0,_jsxRuntime.jsx)(_icons.Picture,{})}),(0,_jsxRuntime.jsx)(Title,{children:locale==null?void 0:locale.title})]}),hasImage&&(0,_jsxRuntime.jsx)(_theming.ThemeOverrider,{overrides:{buttonGhostColorText:[0,0,100],buttonGhostColorBgHighlight:[0,0,100,0.1]},children:(0,_jsxRuntime.jsx)(DeleteButtonContainer,{children:(0,_jsxRuntime.jsx)(_button.default,{type:"ghost",onPress:function onPress(){return setForwardedValue(null);},children:(0,_jsxRuntime.jsx)(_icons.Delete,{})})})})]})]})}))}),(0,_jsxRuntime.jsxs)(_actionMenu.default,{visible:modalVisible,onClose:function onClose(){return setModalVisible(false);},children:[(0,_jsxRuntime.jsx)(_actionMenu.MenuItem,{left:(0,_jsxRuntime.jsx)(_icons.Picture,{}),onPress:chooseFromPhotoLibraryHandler,children:locale==null?void 0:locale.chooseFromLibrary}),(0,_jsxRuntime.jsx)(_actionMenu.MenuItem,{left:(0,_jsxRuntime.jsx)(_icons.Camera,{}),onPress:takePhotoHandler,children:locale==null?void 0:locale.takePhoto})]})]});});ImageUpload.displayName='ImageUpload';var _default=exports.default=ImageUpload;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeGestureHandler","_actionMenu","_icons","_reactNativeImagePicker","_text","_interopRequireDefault","_image","_useForwardedState3","_native","_omitEmotionProps","_theming","_button","_defaultLocale","_jsxRuntime","_excluded","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","overlayHasImageStyles","p","hasImage","backgroundColor","clr","theme","imageUploadOverlayOpacity","borderRadius","fontSize","Overlay","styled","View","omitEmotionProps","assign","position","top","right","bottom","left","justifyContent","alignItems","padding","imageUploadOverlayPadding","StyledRectButton","RectButton","width","maxWidth","imageUploadMaxWidth","minHeight","imageUploadMinHeight","notHasImageStyles","imageUploadNoImageColorBg","borderWidth","borderColor","imageUploadNoImageColorBorder","borderStyle","Container","Content","flex","Title","Text","marginTop","textAlign","StyledImage","Image","resizeMode","aspectRatio","DeleteButtonContainer","ImageUpload","forwardRef","_ref","ref","url","_ref$locale","locale","defaultLocale","_ref$imageLibraryOpti","imageLibraryOptions","_ref$cameraOptions","cameraOptions","value","defaultValue","onChange","_ref$onPress","onPress","rest","_objectWithoutProperties2","_useForwardedState","useForwardedState","_useForwardedState2","_slicedToArray2","forwardedValue","setForwardedValue","_useState","useState","_useState2","modalVisible","setModalVisible","_useTheme","useTheme","chooseFromPhotoLibraryHandler","useCallback","_asyncToGenerator2","_yield$Promise","Promise","resolve","launchImageLibrary","mediaType","assets","_unused","takePhotoHandler","_yield$Promise2","launchCamera","_unused2","source","useMemo","uri","jsxs","Fragment","children","jsx","ThemeOverrider","overrides","colorText","underlayColor","imageUploadNoImageBgHighlight","rippleColor","imageUploadNoImageBgRipple","activeOpacity","accessible","accessibilityRole","Picture","title","buttonGhostColorText","buttonGhostColorBgHighlight","type","Delete","visible","onClose","MenuItem","chooseFromLibrary","Camera","takePhoto","displayName","_default","exports"],"sources":["../src/index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo, useState } from 'react';\nimport { View, type ViewProps } from 'react-native';\nimport { RectButton, type RectButtonProps } from 'react-native-gesture-handler';\nimport ActionMenu, { MenuItem } from '@os-design-mobile/action-menu';\nimport { Picture, Camera, Delete } from '@os-design-mobile/icons';\nimport {\n launchImageLibrary,\n launchCamera,\n type Asset,\n type ImagePickerResponse,\n type CameraOptions,\n type ImageLibraryOptions,\n} from 'react-native-image-picker';\nimport Text from '@os-design-mobile/text';\nimport Image from '@os-design-mobile/image';\nimport useForwardedState from '@os-design/use-forwarded-state';\nimport styled from '@emotion/native';\nimport omitEmotionProps from '@os-design/omit-emotion-props';\nimport { clr, ThemeOverrider, useTheme } from '@os-design-mobile/theming';\nimport Button from '@os-design-mobile/button';\nimport defaultLocale, { type ImageUploadLocale } from './utils/defaultLocale';\n\nexport interface ImageUploadProps extends RectButtonProps {\n /**\n * The url of the image.\n * @default undefined\n */\n url?: string;\n /**\n * The locale of the component.\n * @default undefined\n */\n locale?: ImageUploadLocale;\n /**\n * The image library options.\n * @default undefined\n */\n imageLibraryOptions?: Pick<\n ImageLibraryOptions,\n 'maxWidth' | 'maxHeight' | 'quality'\n >;\n /**\n * The camera options.\n * @default undefined\n */\n cameraOptions?: Pick<\n CameraOptions,\n 'maxWidth' | 'maxHeight' | 'quality' | 'saveToPhotos' | 'cameraType'\n >;\n /**\n * The selected local file, or null if the image is marked as deleted.\n * @default undefined\n */\n value?: Asset | null;\n /**\n * The default value.\n * @default undefined\n */\n defaultValue?: Asset | null;\n /**\n * The change event handler.\n * @default undefined\n */\n onChange?: (value: Asset | null) => void;\n}\n\nconst overlayHasImageStyles = (p) =>\n p.hasImage\n ? {\n backgroundColor: clr([0, 0, 0, p.theme.imageUploadOverlayOpacity]),\n borderRadius: p.theme.borderRadius * p.theme.fontSize,\n }\n : {};\n\ninterface OverlayProps {\n hasImage: boolean;\n}\nconst Overlay = styled(\n View,\n omitEmotionProps('hasImage')\n)<OverlayProps>((p) => ({\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n justifyContent: 'center',\n alignItems: 'center',\n padding: p.theme.imageUploadOverlayPadding * p.theme.fontSize,\n ...overlayHasImageStyles(p),\n}));\n\nconst StyledRectButton = styled(RectButton)((p) => ({\n width: '100%',\n maxWidth: p.theme.imageUploadMaxWidth * p.theme.fontSize,\n minHeight: p.theme.imageUploadMinHeight * p.theme.fontSize,\n borderRadius: p.theme.borderRadius * p.theme.fontSize,\n}));\n\nconst notHasImageStyles = (p): Partial<ViewProps> =>\n !p.hasImage\n ? ({\n backgroundColor: clr(p.theme.imageUploadNoImageColorBg),\n borderWidth: 2,\n borderColor: clr(p.theme.imageUploadNoImageColorBorder),\n borderStyle: 'dashed',\n } as Partial<ViewProps>)\n : {};\n\ninterface ContainerProps {\n hasImage: boolean;\n}\n\nconst Container = styled(\n View,\n omitEmotionProps('hasImage')\n)<ContainerProps>((p) => ({\n minHeight: p.theme.imageUploadMinHeight * p.theme.fontSize,\n borderRadius: p.theme.borderRadius * p.theme.fontSize,\n ...notHasImageStyles(p),\n}));\n\nconst Content = styled.View({\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n});\n\nconst Title = styled(Text)((p) => ({\n marginTop: 0.5 * p.theme.fontSize,\n textAlign: 'center',\n}));\n\nconst StyledImage = styled(Image)({\n resizeMode: 'cover',\n aspectRatio: 1,\n});\n\nconst DeleteButtonContainer = styled.View((p) => ({\n position: 'absolute',\n top: 0.5 * p.theme.fontSize,\n right: 0.5 * p.theme.fontSize,\n}));\n\n/**\n * The component to upload an image.\n */\nconst ImageUpload = forwardRef<typeof RectButton, ImageUploadProps>(\n (\n {\n url,\n locale = defaultLocale,\n imageLibraryOptions = {},\n cameraOptions = {},\n value,\n defaultValue,\n onChange,\n onPress = () => {},\n ...rest\n },\n ref\n ) => {\n const [forwardedValue, setForwardedValue] = useForwardedState({\n value,\n defaultValue,\n onChange,\n });\n\n const [modalVisible, setModalVisible] = useState(false);\n const { theme } = useTheme();\n\n const chooseFromPhotoLibraryHandler = useCallback(async () => {\n try {\n const { assets } = await new Promise<ImagePickerResponse>((resolve) => {\n launchImageLibrary(\n {\n mediaType: 'photo',\n ...imageLibraryOptions,\n },\n resolve\n );\n });\n setModalVisible(false);\n if (assets) setForwardedValue(assets[0]);\n } catch {} // eslint-disable-line no-empty\n }, [imageLibraryOptions, setForwardedValue]);\n\n const takePhotoHandler = useCallback(async () => {\n try {\n const { assets } = await new Promise<ImagePickerResponse>((resolve) => {\n launchCamera(\n {\n mediaType: 'photo',\n ...cameraOptions,\n },\n resolve\n );\n });\n setModalVisible(false);\n if (assets) setForwardedValue(assets[0]);\n } catch {} // eslint-disable-line no-empty\n }, [cameraOptions, setForwardedValue]);\n\n const source = useMemo(() => {\n if (forwardedValue === null) return null;\n if (forwardedValue) return forwardedValue.uri; // If the user select an image\n if (url) return url; // If the image already exists\n return null;\n }, [forwardedValue, url]);\n\n const hasImage = useMemo(() => !!source, [source]);\n\n return (\n <>\n <ThemeOverrider overrides={hasImage ? { colorText: [0, 0, 100] } : {}}>\n <StyledRectButton\n onPress={(e) => {\n setModalVisible(true);\n onPress(e);\n }}\n underlayColor={\n hasImage\n ? clr([0, 0, 100])\n : clr(theme.imageUploadNoImageBgHighlight)\n }\n rippleColor={\n hasImage\n ? clr([0, 0, 100])\n : clr(theme.imageUploadNoImageBgRipple)\n }\n activeOpacity={hasImage ? 0.8 : 1}\n {...rest}\n ref={ref}\n >\n <Container\n hasImage={hasImage}\n accessible\n accessibilityRole='imagebutton'\n >\n {source && <StyledImage source={{ uri: source }} />}\n\n <Overlay hasImage={hasImage}>\n <Content>\n <ThemeOverrider\n overrides={(t) => ({ fontSize: 2.5 * t.fontSize })}\n >\n <Picture />\n </ThemeOverrider>\n <Title>{locale?.title}</Title>\n </Content>\n\n {hasImage && (\n <ThemeOverrider\n overrides={{\n buttonGhostColorText: [0, 0, 100],\n buttonGhostColorBgHighlight: [0, 0, 100, 0.1],\n }}\n >\n <DeleteButtonContainer>\n <Button\n type='ghost'\n onPress={() => setForwardedValue(null)}\n >\n <Delete />\n </Button>\n </DeleteButtonContainer>\n </ThemeOverrider>\n )}\n </Overlay>\n </Container>\n </StyledRectButton>\n </ThemeOverrider>\n\n <ActionMenu\n visible={modalVisible}\n onClose={() => setModalVisible(false)}\n >\n <MenuItem left={<Picture />} onPress={chooseFromPhotoLibraryHandler}>\n {locale?.chooseFromLibrary}\n </MenuItem>\n <MenuItem left={<Camera />} onPress={takePhotoHandler}>\n {locale?.takePhoto}\n </MenuItem>\n </ActionMenu>\n </>\n );\n }\n);\n\nImageUpload.displayName = 'ImageUpload';\n\nexport default ImageUpload;\n"],"mappings":"idAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WACA,IAAAC,YAAA,CAAAD,OAAA,iBACA,IAAAE,0BAAA,CAAAF,OAAA,iCACA,IAAAG,WAAA,CAAAJ,uBAAA,CAAAC,OAAA,mCACA,IAAAI,MAAA,CAAAJ,OAAA,4BACA,IAAAK,uBAAA,CAAAL,OAAA,8BAQA,IAAAM,KAAA,CAAAC,sBAAA,CAAAP,OAAA,4BACA,IAAAQ,MAAA,CAAAD,sBAAA,CAAAP,OAAA,6BACA,IAAAS,mBAAA,CAAAF,sBAAA,CAAAP,OAAA,oCACA,IAAAU,OAAA,CAAAH,sBAAA,CAAAP,OAAA,qBACA,IAAAW,iBAAA,CAAAJ,sBAAA,CAAAP,OAAA,mCACA,IAAAY,QAAA,CAAAZ,OAAA,8BACA,IAAAa,OAAA,CAAAN,sBAAA,CAAAP,OAAA,8BACA,IAAAc,cAAA,CAAAP,sBAAA,CAAAP,OAAA,2BAA8E,IAAAe,WAAA,CAAA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AM,EACLiI,IAAI,CAAC,OAAO,CACZnD,OAAO,CAAE,QAAT,CAAAA,OAAOA,CAAA,QAAQ,CAAAQ,iBAAiB,CAAC,IAAI,CAAC,EAAC,CAAA2B,QAAA,CAEvC,GAAAzH,WAAA,CAAA0H,GAAA,EAACrI,MAAA,CAAAqJ,MAAM,GAAE,CAAC,CACJ,CAAC,CACY,CAAC,CACV,CACjB,EACM,CAAC,EACD,CAAC,EACI,CAAC,CACL,CAAC,CAEjB,GAAA1I,WAAA,CAAAuH,IAAA,EAACnI,WAAA,CAAAoB,OAAU,EACTmI,OAAO,CAAEzC,YAAa,CACtB0C,OAAO,CAAE,QAAT,CAAAA,OAAOA,CAAA,QAAQ,CAAAzC,eAAe,CAAC,KAAK,CAAC,EAAC,CAAAsB,QAAA,EAEtC,GAAAzH,WAAA,CAAA0H,GAAA,EAACtI,WAAA,CAAAyJ,QAAQ,EAACrG,IAAI,CAAE,GAAAxC,WAAA,CAAA0H,GAAA,EAACrI,MAAA,CAAAgJ,OAAO,GAAE,CAAE,CAAC/C,OAAO,CAAEgB,6BAA8B,CAAAmB,QAAA,CACjE7C,MAAM,cAANA,MAAM,CAAEkE,iBAAiB,CAClB,CAAC,CACX,GAAA9I,WAAA,CAAA0H,GAAA,EAACtI,WAAA,CAAAyJ,QAAQ,EAACrG,IAAI,CAAE,GAAAxC,WAAA,CAAA0H,GAAA,EAACrI,MAAA,CAAA0J,MAAM,GAAE,CAAE,CAACzD,OAAO,CAAE0B,gBAAiB,CAAAS,QAAA,CACnD7C,MAAM,cAANA,MAAM,CAAEoE,SAAS,CACV,CAAC,EACD,CAAC,EACb,CAAC,CAEP,CACF,CAAC,CAED1E,WAAW,CAAC2E,WAAW,CAAG,aAAa,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAA3I,OAAA,CAEzB8D,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeGestureHandler","_actionMenu","_icons","_reactNativeImagePicker","_text","_interopRequireDefault","_image","_useForwardedState3","_native","_omitEmotionProps","_theming","_button","_defaultLocale","_jsxRuntime","_excluded","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","overlayHasImageStyles","p","hasImage","backgroundColor","clr","theme","imageUploadOverlayOpacity","borderRadius","fontSize","Overlay","styled","View","omitEmotionProps","assign","position","top","right","bottom","left","justifyContent","alignItems","padding","imageUploadOverlayPadding","StyledRectButton","RectButton","width","maxWidth","imageUploadMaxWidth","minHeight","imageUploadMinHeight","notHasImageStyles","imageUploadNoImageColorBg","borderWidth","borderColor","imageUploadNoImageColorBorder","borderStyle","Container","Content","flex","Title","Text","marginTop","textAlign","StyledImage","Image","resizeMode","aspectRatio","DeleteButtonContainer","ImageUpload","forwardRef","_ref","ref","url","_ref$locale","locale","defaultLocale","_ref$imageLibraryOpti","imageLibraryOptions","_ref$cameraOptions","cameraOptions","value","defaultValue","onChange","_ref$onPress","onPress","rest","_objectWithoutProperties2","_useForwardedState","useForwardedState","_useForwardedState2","_slicedToArray2","forwardedValue","setForwardedValue","_useState","useState","_useState2","modalVisible","setModalVisible","_useTheme","useTheme","chooseFromPhotoLibraryHandler","useCallback","_asyncToGenerator2","_yield$Promise","Promise","resolve","launchImageLibrary","mediaType","assets","_unused","takePhotoHandler","_yield$Promise2","launchCamera","_unused2","source","useMemo","uri","jsxs","Fragment","children","jsx","ThemeOverrider","overrides","colorText","underlayColor","imageUploadNoImageBgHighlight","activeOpacity","accessible","accessibilityRole","Picture","title","buttonGhostColorText","buttonGhostColorBgHighlight","type","Delete","visible","onClose","MenuItem","chooseFromLibrary","Camera","takePhoto","displayName","_default","exports"],"sources":["../src/index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo, useState } from 'react';\nimport { View, type ViewProps } from 'react-native';\nimport { RectButton, type RectButtonProps } from 'react-native-gesture-handler';\nimport ActionMenu, { MenuItem } from '@os-design-mobile/action-menu';\nimport { Picture, Camera, Delete } from '@os-design-mobile/icons';\nimport {\n launchImageLibrary,\n launchCamera,\n type Asset,\n type ImagePickerResponse,\n type CameraOptions,\n type ImageLibraryOptions,\n} from 'react-native-image-picker';\nimport Text from '@os-design-mobile/text';\nimport Image from '@os-design-mobile/image';\nimport useForwardedState from '@os-design/use-forwarded-state';\nimport styled from '@emotion/native';\nimport omitEmotionProps from '@os-design/omit-emotion-props';\nimport { clr, ThemeOverrider, useTheme } from '@os-design-mobile/theming';\nimport Button from '@os-design-mobile/button';\nimport defaultLocale, { type ImageUploadLocale } from './utils/defaultLocale';\n\nexport interface ImageUploadProps extends RectButtonProps {\n /**\n * The url of the image.\n * @default undefined\n */\n url?: string;\n /**\n * The locale of the component.\n * @default undefined\n */\n locale?: ImageUploadLocale;\n /**\n * The image library options.\n * @default undefined\n */\n imageLibraryOptions?: Pick<\n ImageLibraryOptions,\n 'maxWidth' | 'maxHeight' | 'quality'\n >;\n /**\n * The camera options.\n * @default undefined\n */\n cameraOptions?: Pick<\n CameraOptions,\n 'maxWidth' | 'maxHeight' | 'quality' | 'saveToPhotos' | 'cameraType'\n >;\n /**\n * The selected local file, or null if the image is marked as deleted.\n * @default undefined\n */\n value?: Asset | null;\n /**\n * The default value.\n * @default undefined\n */\n defaultValue?: Asset | null;\n /**\n * The change event handler.\n * @default undefined\n */\n onChange?: (value: Asset | null) => void;\n}\n\nconst overlayHasImageStyles = (p) =>\n p.hasImage\n ? {\n backgroundColor: clr([0, 0, 0, p.theme.imageUploadOverlayOpacity]),\n borderRadius: p.theme.borderRadius * p.theme.fontSize,\n }\n : {};\n\ninterface OverlayProps {\n hasImage: boolean;\n}\nconst Overlay = styled(\n View,\n omitEmotionProps('hasImage')\n)<OverlayProps>((p) => ({\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n justifyContent: 'center',\n alignItems: 'center',\n padding: p.theme.imageUploadOverlayPadding * p.theme.fontSize,\n ...overlayHasImageStyles(p),\n}));\n\nconst StyledRectButton = styled(RectButton)((p) => ({\n width: '100%',\n maxWidth: p.theme.imageUploadMaxWidth * p.theme.fontSize,\n minHeight: p.theme.imageUploadMinHeight * p.theme.fontSize,\n borderRadius: p.theme.borderRadius * p.theme.fontSize,\n}));\n\nconst notHasImageStyles = (p): Partial<ViewProps> =>\n !p.hasImage\n ? ({\n backgroundColor: clr(p.theme.imageUploadNoImageColorBg),\n borderWidth: 2,\n borderColor: clr(p.theme.imageUploadNoImageColorBorder),\n borderStyle: 'dashed',\n } as Partial<ViewProps>)\n : {};\n\ninterface ContainerProps {\n hasImage: boolean;\n}\n\nconst Container = styled(\n View,\n omitEmotionProps('hasImage')\n)<ContainerProps>((p) => ({\n minHeight: p.theme.imageUploadMinHeight * p.theme.fontSize,\n borderRadius: p.theme.borderRadius * p.theme.fontSize,\n ...notHasImageStyles(p),\n}));\n\nconst Content = styled.View({\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n});\n\nconst Title = styled(Text)((p) => ({\n marginTop: 0.5 * p.theme.fontSize,\n textAlign: 'center',\n}));\n\nconst StyledImage = styled(Image)({\n resizeMode: 'cover',\n aspectRatio: 1,\n});\n\nconst DeleteButtonContainer = styled.View((p) => ({\n position: 'absolute',\n top: 0.5 * p.theme.fontSize,\n right: 0.5 * p.theme.fontSize,\n}));\n\n/**\n * The component to upload an image.\n */\nconst ImageUpload = forwardRef<typeof RectButton, ImageUploadProps>(\n (\n {\n url,\n locale = defaultLocale,\n imageLibraryOptions = {},\n cameraOptions = {},\n value,\n defaultValue,\n onChange,\n onPress = () => {},\n ...rest\n },\n ref\n ) => {\n const [forwardedValue, setForwardedValue] = useForwardedState({\n value,\n defaultValue,\n onChange,\n });\n\n const [modalVisible, setModalVisible] = useState(false);\n const { theme } = useTheme();\n\n const chooseFromPhotoLibraryHandler = useCallback(async () => {\n try {\n const { assets } = await new Promise<ImagePickerResponse>((resolve) => {\n launchImageLibrary(\n {\n mediaType: 'photo',\n ...imageLibraryOptions,\n },\n resolve\n );\n });\n setModalVisible(false);\n if (assets) setForwardedValue(assets[0]);\n } catch {} // eslint-disable-line no-empty\n }, [imageLibraryOptions, setForwardedValue]);\n\n const takePhotoHandler = useCallback(async () => {\n try {\n const { assets } = await new Promise<ImagePickerResponse>((resolve) => {\n launchCamera(\n {\n mediaType: 'photo',\n ...cameraOptions,\n },\n resolve\n );\n });\n setModalVisible(false);\n if (assets) setForwardedValue(assets[0]);\n } catch {} // eslint-disable-line no-empty\n }, [cameraOptions, setForwardedValue]);\n\n const source = useMemo(() => {\n if (forwardedValue === null) return null;\n if (forwardedValue) return forwardedValue.uri; // If the user select an image\n if (url) return url; // If the image already exists\n return null;\n }, [forwardedValue, url]);\n\n const hasImage = useMemo(() => !!source, [source]);\n\n return (\n <>\n <ThemeOverrider overrides={hasImage ? { colorText: [0, 0, 100] } : {}}>\n <StyledRectButton\n onPress={(e) => {\n setModalVisible(true);\n onPress(e);\n }}\n underlayColor={\n hasImage\n ? clr([0, 0, 100])\n : clr(theme.imageUploadNoImageBgHighlight)\n }\n // rippleColor={\n // hasImage\n // ? clr([0, 0, 100])\n // : clr(theme.imageUploadNoImageBgRipple)\n // }\n activeOpacity={hasImage ? 0.8 : 1}\n {...rest}\n ref={ref}\n >\n <Container\n hasImage={hasImage}\n accessible\n accessibilityRole='imagebutton'\n >\n {source && <StyledImage source={{ uri: source }} />}\n\n <Overlay hasImage={hasImage}>\n <Content>\n <ThemeOverrider\n overrides={(t) => ({ fontSize: 2.5 * t.fontSize })}\n >\n <Picture />\n </ThemeOverrider>\n <Title>{locale?.title}</Title>\n </Content>\n\n {hasImage && (\n <ThemeOverrider\n overrides={{\n buttonGhostColorText: [0, 0, 100],\n buttonGhostColorBgHighlight: [0, 0, 100, 0.1],\n }}\n >\n <DeleteButtonContainer>\n <Button\n type='ghost'\n onPress={() => setForwardedValue(null)}\n >\n <Delete />\n </Button>\n </DeleteButtonContainer>\n </ThemeOverrider>\n )}\n </Overlay>\n </Container>\n </StyledRectButton>\n </ThemeOverrider>\n\n <ActionMenu\n visible={modalVisible}\n onClose={() => setModalVisible(false)}\n >\n <MenuItem left={<Picture />} onPress={chooseFromPhotoLibraryHandler}>\n {locale?.chooseFromLibrary}\n </MenuItem>\n <MenuItem left={<Camera />} onPress={takePhotoHandler}>\n {locale?.takePhoto}\n </MenuItem>\n </ActionMenu>\n </>\n );\n }\n);\n\nImageUpload.displayName = 'ImageUpload';\n\nexport default ImageUpload;\n"],"mappings":"idAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WACA,IAAAC,YAAA,CAAAD,OAAA,iBACA,IAAAE,0BAAA,CAAAF,OAAA,iCACA,IAAAG,WAAA,CAAAJ,uBAAA,CAAAC,OAAA,mCACA,IAAAI,MAAA,CAAAJ,OAAA,4BACA,IAAAK,uBAAA,CAAAL,OAAA,8BAQA,IAAAM,KAAA,CAAAC,sBAAA,CAAAP,OAAA,4BACA,IAAAQ,MAAA,CAAAD,sBAAA,CAAAP,OAAA,6BACA,IAAAS,mBAAA,CAAAF,sBAAA,CAAAP,OAAA,oCACA,IAAAU,OAAA,CAAAH,sBAAA,CAAAP,OAAA,qBACA,IAAAW,iBAAA,CAAAJ,sBAAA,CAAAP,OAAA,mCACA,IAAAY,QAAA,CAAAZ,OAAA,8BACA,IAAAa,OAAA,CAAAN,sBAAA,CAAAP,OAAA,8BACA,IAAAc,cAAA,CAAAP,sBAAA,CAAAP,OAAA,2BAA8E,IAAAe,WAAA,CAAAf,OAAA,0BAAAgB,SAAA,6GAAAC,yBAAAC,CAAA,wBAAAC,OAAA,iBAAAC,CAAA,KAAAD,OAAA,GAAAE,CAAA,KAAAF,OAAA,UAAAF,wBAAA,UAAAA,yBAAAC,CAAA,SAAAA,CAAA,CAAAG,CAAA,CAAAD,CAAA,IAAAF,CAAA,YAAAnB,wBAAAmB,CAAA,CAAAE,CAAA,MAAAA,CAAA,EAAAF,CAAA,EAAAA,CAAA,CAAAI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vC,eAAe,CAAC,KAAK,CAAC,EAAC,CAAAsB,QAAA,EAEtC,GAAAzH,WAAA,CAAA0H,GAAA,EAACtI,WAAA,CAAAuJ,QAAQ,EAACnG,IAAI,CAAE,GAAAxC,WAAA,CAAA0H,GAAA,EAACrI,MAAA,CAAA8I,OAAO,GAAE,CAAE,CAAC7C,OAAO,CAAEgB,6BAA8B,CAAAmB,QAAA,CACjE7C,MAAM,cAANA,MAAM,CAAEgE,iBAAiB,CAClB,CAAC,CACX,GAAA5I,WAAA,CAAA0H,GAAA,EAACtI,WAAA,CAAAuJ,QAAQ,EAACnG,IAAI,CAAE,GAAAxC,WAAA,CAAA0H,GAAA,EAACrI,MAAA,CAAAwJ,MAAM,GAAE,CAAE,CAACvD,OAAO,CAAE0B,gBAAiB,CAAAS,QAAA,CACnD7C,MAAM,cAANA,MAAM,CAAEkE,SAAS,CACV,CAAC,EACD,CAAC,EACb,CAAC,CAEP,CACF,CAAC,CAEDxE,WAAW,CAACyE,WAAW,CAAG,aAAa,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAAzI,OAAA,CAEzB8D,WAAW","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@os-design-mobile/image-upload",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.106",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": "git@gitlab.com:os-team/libs/os-design-mobile.git",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@os-design-mobile/action-menu": "^1.0.
|
|
32
|
-
"@os-design-mobile/button": "^1.0.
|
|
33
|
-
"@os-design-mobile/icons": "^1.0.
|
|
34
|
-
"@os-design-mobile/image": "^1.0.
|
|
35
|
-
"@os-design-mobile/text": "^1.0.
|
|
36
|
-
"@os-design-mobile/theming": "^1.0.
|
|
37
|
-
"@os-design/omit-emotion-props": "^1.0.
|
|
38
|
-
"@os-design/use-forwarded-state": "^1.0.
|
|
31
|
+
"@os-design-mobile/action-menu": "^1.0.105",
|
|
32
|
+
"@os-design-mobile/button": "^1.0.80",
|
|
33
|
+
"@os-design-mobile/icons": "^1.0.75",
|
|
34
|
+
"@os-design-mobile/image": "^1.0.61",
|
|
35
|
+
"@os-design-mobile/text": "^1.0.73",
|
|
36
|
+
"@os-design-mobile/theming": "^1.0.55",
|
|
37
|
+
"@os-design/omit-emotion-props": "^1.0.28",
|
|
38
|
+
"@os-design/use-forwarded-state": "^1.0.30"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@emotion/native": ">=11",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"react-native-safe-area-context": ">=3",
|
|
49
49
|
"react-native-svg": ">=12"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "38630c387090a1f0e9f7366d582133c9768524e3"
|
|
52
52
|
}
|
package/src/index.tsx
CHANGED
|
@@ -223,11 +223,11 @@ const ImageUpload = forwardRef<typeof RectButton, ImageUploadProps>(
|
|
|
223
223
|
? clr([0, 0, 100])
|
|
224
224
|
: clr(theme.imageUploadNoImageBgHighlight)
|
|
225
225
|
}
|
|
226
|
-
rippleColor={
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
226
|
+
// rippleColor={
|
|
227
|
+
// hasImage
|
|
228
|
+
// ? clr([0, 0, 100])
|
|
229
|
+
// : clr(theme.imageUploadNoImageBgRipple)
|
|
230
|
+
// }
|
|
231
231
|
activeOpacity={hasImage ? 0.8 : 1}
|
|
232
232
|
{...rest}
|
|
233
233
|
ref={ref}
|