taro-react-uilib 1.3.4-8 → 1.3.4-9

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 CHANGED
@@ -1,3 +1,18 @@
1
+ ## [1.3.4-9](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.4-8...v1.3.4-9) (2023-08-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * cell ([22dca0c](https://code.xhdev.xyz/h5group/taro-uilib/commits/22dca0cc9506f8e094ca325ea00feb3160a92da9))
7
+
8
+
9
+ ### Features
10
+
11
+ * page ([82317a9](https://code.xhdev.xyz/h5group/taro-uilib/commits/82317a956784db9394ab9695b6a73d717e0ccb1b))
12
+ * popup classname ([ab9e3d1](https://code.xhdev.xyz/h5group/taro-uilib/commits/ab9e3d1af2c022e01443a35d74e9884cb0f6943f))
13
+
14
+
15
+
1
16
  ## [1.3.4-8](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.4-7...v1.3.4-8) (2023-08-02)
2
17
 
3
18
 
@@ -1,2 +1,2 @@
1
- import e from"react";import{View as l,Text as a}from"@tarojs/components";import c from"classnames";var t=function(t){var o=t.icon,n=t.value,r=t.extraIcon,s=t.arrow,i=t.border,m=void 0===i||i,d=t.paddingHorizontal,p=void 0===d||d,u=t.onClick,v=t.className,h=t.outline,x=void 0===h||h,E=t.descriptionColor,N=void 0===E?"":E,f=t.valueColor,b=t.ellipsis,y=void 0===b||b,C=t.content,g=t.contentDescription,k=t.description,w=t.subDescription,z=t.secondary,D=t.alignItems,H=void 0===D?o?"start":"center":D,I=t.placeholder,j=void 0===I?"":I,q=c("xh-cell",{border:m},{secondary:z},{outline:x},{paddingHorizontal:p},H,v),A=c("xh-cell-main",{ellipsis:y});return e.createElement(l,{className:q,onClick:function(e){u&&u(e)}},o&&e.createElement(l,{className:"xh-cell-icon"},o),e.createElement(l,{className:A},C&&e.createElement(a,{className:"xh-cell-main-content"},C),g&&e.createElement(a,{className:"xh-cell-main-description"},g)),e.createElement(l,{className:"xh-cell-description",style:{color:N}},k?e.createElement(a,null,k):e.createElement(a,{className:"xh-cell-description-placeholder"},j),e.createElement(a,{className:"xh-cell-description-sub"},w)),e.createElement(l,{className:"xh-cell-value"},e.createElement(l,{className:"xh-cell-value-info",style:{color:f}},n),e.createElement(l,{className:"xh-cell-value-icon"},r||s&&e.createElement(l,{className:"xh-cell-value-icon-arrow"}))))};export{t as default};
1
+ import e from"react";import{View as l,Text as a}from"@tarojs/components";import c from"classnames";var t=function(t){var o=t.icon,n=t.value,r=t.extraIcon,s=t.arrow,i=t.border,m=void 0===i||i,d=t.paddingHorizontal,p=void 0===d||d,u=t.onClick,v=t.className,h=t.outline,x=void 0===h||h,E=t.descriptionColor,N=void 0===E?"":E,f=t.valueColor,b=t.ellipsis,y=void 0===b||b,C=t.content,g=t.contentDescription,k=t.description,w=t.subDescription,z=t.secondary,D=t.alignItems,H=void 0===D?o?"start":"center":D,I=t.placeholder,j=void 0===I?"":I,q=c("xh-cell",{border:m},{secondary:z},{outline:x},{paddingHorizontal:p},H,v),A=c("xh-cell-main",{ellipsis:y});return e.createElement(l,{className:q,onClick:function(e){u&&u(e)}},o&&e.createElement(l,{className:"xh-cell-icon"},o),e.createElement(l,{className:A},C&&e.createElement(l,{className:"xh-cell-main-content"},C),g&&e.createElement(l,{className:"xh-cell-main-description"},g)),e.createElement(l,{className:"xh-cell-description",style:{color:N}},k?e.createElement(l,null,k):e.createElement(l,{className:"xh-cell-description-placeholder"},j),e.createElement(a,{className:"xh-cell-description-sub"},w)),e.createElement(l,{className:"xh-cell-value"},e.createElement(l,{className:"xh-cell-value-info",style:{color:f}},n),e.createElement(l,{className:"xh-cell-value-icon"},r||s&&e.createElement(l,{className:"xh-cell-value-icon-arrow"}))))};export{t as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/Cell/index.tsx"],"sourcesContent":["import React, { FC, ReactNode } from \"react\";\nimport { View, Text, ITouchEvent } from \"@tarojs/components\";\nimport classNames from \"classnames\";\nimport { StandardLonghandProperties } from \"csstype\";\nimport { XHComponentCommonProps } from \"../../types\";\n\nimport \"./index.scss\";\n\nexport type XHCellProps = {\n content?: ReactNode;\n contentDescription?: ReactNode;\n description?: ReactNode;\n subDescription?: ReactNode;\n paddingHorizontal?: boolean;\n icon?: ReactNode;\n value?: ReactNode;\n extraIcon?: ReactNode;\n border?: boolean;\n arrow?: boolean;\n outline?: boolean;\n onClick?: (e: ITouchEvent) => void;\n descriptionColor?: StandardLonghandProperties[\"color\"];\n valueColor?: StandardLonghandProperties[\"color\"];\n ellipsis?: boolean;\n placeholder?: string;\n alignItems?: \"start\" | \"center\" | \"end\";\n /**\n * @description 是否是次级列表\n */\n secondary?: boolean;\n} & XHComponentCommonProps;\n\nconst XHCell: FC<XHCellProps> = props => {\n const {\n icon,\n value,\n extraIcon,\n arrow,\n border = true,\n paddingHorizontal = true,\n onClick,\n className,\n outline = true,\n descriptionColor = \"\",\n valueColor,\n ellipsis = true,\n content,\n contentDescription,\n description,\n subDescription,\n secondary,\n alignItems = icon ? \"start\" : \"center\",\n placeholder = \"\",\n } = props;\n\n const cellcls = classNames(\n \"xh-cell\",\n { border },\n { secondary },\n { outline },\n { paddingHorizontal },\n alignItems,\n className\n );\n\n const mainCls = classNames(\"xh-cell-main\", {\n ellipsis,\n });\n\n const handleClick = (e: ITouchEvent) => {\n onClick && onClick(e);\n };\n\n return (\n <View className={cellcls} onClick={handleClick}>\n {icon && <View className=\"xh-cell-icon\">{icon}</View>}\n <View className={mainCls}>\n {content && <Text className=\"xh-cell-main-content\">{content}</Text>}\n {contentDescription && (\n <Text className=\"xh-cell-main-description\">{contentDescription}</Text>\n )}\n </View>\n <View className=\"xh-cell-description\" style={{ color: descriptionColor }}>\n {description ? (\n <Text>{description}</Text>\n ) : (\n <Text className=\"xh-cell-description-placeholder\">{placeholder}</Text>\n )}\n <Text className=\"xh-cell-description-sub\">{subDescription}</Text>\n </View>\n <View className=\"xh-cell-value\">\n <View className=\"xh-cell-value-info\" style={{ color: valueColor }}>\n {value}\n </View>\n <View className=\"xh-cell-value-icon\">\n {extraIcon\n ? extraIcon\n : arrow && <View className=\"xh-cell-value-icon-arrow\" />}\n </View>\n </View>\n </View>\n );\n};\nexport default XHCell;\n"],"names":["XHCell","props","icon","value","extraIcon","arrow","_a","border","_b","paddingHorizontal","onClick","className","_c","outline","_d","descriptionColor","valueColor","_e","ellipsis","content","contentDescription","description","subDescription","secondary","_f","alignItems","_g","placeholder","cellcls","classNames","mainCls","React","createElement","View","e","Text","style","color"],"mappings":"mGAgCM,IAAAA,EAA0B,SAAAC,GAE5B,IAAAC,EAmBED,EAAKC,KAlBPC,EAkBEF,EAlBGE,MACLC,EAiBEH,EAAKG,UAhBPC,EAgBEJ,EAhBGI,MACLC,EAeEL,EAfWM,OAAbA,OAAM,IAAAD,GAAOA,EACbE,EAcEP,EAdsBQ,kBAAxBA,OAAiB,IAAAD,GAAOA,EACxBE,EAaET,EAbKS,QACPC,EAYEV,EAZOU,UACTC,EAWEX,EAXYY,QAAdA,OAAO,IAAAD,GAAOA,EACdE,EAUEb,EAAKc,iBAVPA,aAAmB,GAAED,EACrBE,EASEf,EATQe,WACVC,EAQEhB,EARaiB,SAAfA,OAAQ,IAAAD,GAAOA,EACfE,EAOElB,EAPKkB,QACPC,EAMEnB,EAAKmB,mBALPC,EAKEpB,EALSoB,YACXC,EAIErB,EAJYqB,eACdC,EAGEtB,EAAKsB,UAFPC,EAEEvB,EAAKwB,WAFPA,OAAa,IAAAD,EAAAtB,EAAO,QAAU,SAAQsB,EACtCE,EACEzB,EAAK0B,YADPA,OAAc,IAAAD,EAAA,KAGVE,EAAUC,EACd,UACA,CAAEtB,OAAMA,GACR,CAAEgB,UAASA,GACX,CAAEV,QAAOA,GACT,CAAEJ,kBAAiBA,GACnBgB,EACAd,GAGImB,EAAUD,EAAW,eAAgB,CACzCX,SAAQA,IAOV,OACEa,EAACC,cAAAC,EAAK,CAAAtB,UAAWiB,EAASlB,QALR,SAACwB,GACnBxB,GAAWA,EAAQwB,EACrB,GAIKhC,GAAQ6B,gBAACE,EAAI,CAACtB,UAAU,gBAAgBT,GACzC6B,EAAAC,cAACC,EAAI,CAACtB,UAAWmB,GACdX,GAAWY,gBAACI,EAAI,CAACxB,UAAU,wBAAwBQ,GACnDC,GACCW,EAACC,cAAAG,EAAK,CAAAxB,UAAU,4BAA4BS,IAGhDW,EAAAC,cAACC,EAAI,CAACtB,UAAU,sBAAsByB,MAAO,CAAEC,MAAOtB,IACnDM,EACCU,gBAACI,EAAI,KAAEd,GAEPU,EAACC,cAAAG,EAAK,CAAAxB,UAAU,mCAAmCgB,GAErDI,EAACC,cAAAG,GAAKxB,UAAU,2BAA2BW,IAE7CS,EAAAC,cAACC,EAAI,CAACtB,UAAU,iBACdoB,EAAAC,cAACC,EAAI,CAACtB,UAAU,qBAAqByB,MAAO,CAAEC,MAAOrB,IAClDb,GAEH4B,EAAAC,cAACC,EAAK,CAAAtB,UAAU,sBACbP,GAEGC,GAAS0B,EAAAC,cAACC,EAAK,CAAAtB,UAAU,+BAKvC"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/Cell/index.tsx"],"sourcesContent":["import React, { FC, ReactNode } from \"react\";\nimport { View, Text, ITouchEvent } from \"@tarojs/components\";\nimport classNames from \"classnames\";\nimport { StandardLonghandProperties } from \"csstype\";\nimport { XHComponentCommonProps } from \"../../types\";\n\nimport \"./index.scss\";\n\nexport type XHCellProps = {\n content?: ReactNode;\n contentDescription?: ReactNode;\n description?: ReactNode;\n subDescription?: ReactNode;\n paddingHorizontal?: boolean;\n icon?: ReactNode;\n value?: ReactNode;\n extraIcon?: ReactNode;\n border?: boolean;\n arrow?: boolean;\n outline?: boolean;\n onClick?: (e: ITouchEvent) => void;\n descriptionColor?: StandardLonghandProperties[\"color\"];\n valueColor?: StandardLonghandProperties[\"color\"];\n ellipsis?: boolean;\n placeholder?: string;\n alignItems?: \"start\" | \"center\" | \"end\";\n /**\n * @description 是否是次级列表\n */\n secondary?: boolean;\n} & XHComponentCommonProps;\n\nconst XHCell: FC<XHCellProps> = props => {\n const {\n icon,\n value,\n extraIcon,\n arrow,\n border = true,\n paddingHorizontal = true,\n onClick,\n className,\n outline = true,\n descriptionColor = \"\",\n valueColor,\n ellipsis = true,\n content,\n contentDescription,\n description,\n subDescription,\n secondary,\n alignItems = icon ? \"start\" : \"center\",\n placeholder = \"\",\n } = props;\n\n const cellcls = classNames(\n \"xh-cell\",\n { border },\n { secondary },\n { outline },\n { paddingHorizontal },\n alignItems,\n className\n );\n\n const mainCls = classNames(\"xh-cell-main\", {\n ellipsis,\n });\n\n const handleClick = (e: ITouchEvent) => {\n onClick && onClick(e);\n };\n\n return (\n <View className={cellcls} onClick={handleClick}>\n {icon && <View className=\"xh-cell-icon\">{icon}</View>}\n <View className={mainCls}>\n {content && <View className=\"xh-cell-main-content\">{content}</View>}\n {contentDescription && (\n <View className=\"xh-cell-main-description\">{contentDescription}</View>\n )}\n </View>\n <View className=\"xh-cell-description\" style={{ color: descriptionColor }}>\n {description ? (\n <View>{description}</View>\n ) : (\n <View className=\"xh-cell-description-placeholder\">{placeholder}</View>\n )}\n <Text className=\"xh-cell-description-sub\">{subDescription}</Text>\n </View>\n <View className=\"xh-cell-value\">\n <View className=\"xh-cell-value-info\" style={{ color: valueColor }}>\n {value}\n </View>\n <View className=\"xh-cell-value-icon\">\n {extraIcon\n ? extraIcon\n : arrow && <View className=\"xh-cell-value-icon-arrow\" />}\n </View>\n </View>\n </View>\n );\n};\nexport default XHCell;\n"],"names":["XHCell","props","icon","value","extraIcon","arrow","_a","border","_b","paddingHorizontal","onClick","className","_c","outline","_d","descriptionColor","valueColor","_e","ellipsis","content","contentDescription","description","subDescription","secondary","_f","alignItems","_g","placeholder","cellcls","classNames","mainCls","React","createElement","View","e","style","color","Text"],"mappings":"mGAgCM,IAAAA,EAA0B,SAAAC,GAE5B,IAAAC,EAmBED,EAAKC,KAlBPC,EAkBEF,EAlBGE,MACLC,EAiBEH,EAAKG,UAhBPC,EAgBEJ,EAhBGI,MACLC,EAeEL,EAfWM,OAAbA,OAAM,IAAAD,GAAOA,EACbE,EAcEP,EAdsBQ,kBAAxBA,OAAiB,IAAAD,GAAOA,EACxBE,EAaET,EAbKS,QACPC,EAYEV,EAZOU,UACTC,EAWEX,EAXYY,QAAdA,OAAO,IAAAD,GAAOA,EACdE,EAUEb,EAAKc,iBAVPA,aAAmB,GAAED,EACrBE,EASEf,EATQe,WACVC,EAQEhB,EARaiB,SAAfA,OAAQ,IAAAD,GAAOA,EACfE,EAOElB,EAPKkB,QACPC,EAMEnB,EAAKmB,mBALPC,EAKEpB,EALSoB,YACXC,EAIErB,EAJYqB,eACdC,EAGEtB,EAAKsB,UAFPC,EAEEvB,EAAKwB,WAFPA,OAAa,IAAAD,EAAAtB,EAAO,QAAU,SAAQsB,EACtCE,EACEzB,EAAK0B,YADPA,OAAc,IAAAD,EAAA,KAGVE,EAAUC,EACd,UACA,CAAEtB,OAAMA,GACR,CAAEgB,UAASA,GACX,CAAEV,QAAOA,GACT,CAAEJ,kBAAiBA,GACnBgB,EACAd,GAGImB,EAAUD,EAAW,eAAgB,CACzCX,SAAQA,IAOV,OACEa,EAACC,cAAAC,EAAK,CAAAtB,UAAWiB,EAASlB,QALR,SAACwB,GACnBxB,GAAWA,EAAQwB,EACrB,GAIKhC,GAAQ6B,gBAACE,EAAI,CAACtB,UAAU,gBAAgBT,GACzC6B,EAAAC,cAACC,EAAI,CAACtB,UAAWmB,GACdX,GAAWY,gBAACE,EAAI,CAACtB,UAAU,wBAAwBQ,GACnDC,GACCW,EAACC,cAAAC,EAAK,CAAAtB,UAAU,4BAA4BS,IAGhDW,EAAAC,cAACC,EAAI,CAACtB,UAAU,sBAAsBwB,MAAO,CAAEC,MAAOrB,IACnDM,EACCU,gBAACE,EAAI,KAAEZ,GAEPU,EAACC,cAAAC,EAAK,CAAAtB,UAAU,mCAAmCgB,GAErDI,EAACC,cAAAK,GAAK1B,UAAU,2BAA2BW,IAE7CS,EAAAC,cAACC,EAAI,CAACtB,UAAU,iBACdoB,EAAAC,cAACC,EAAI,CAACtB,UAAU,qBAAqBwB,MAAO,CAAEC,MAAOpB,IAClDb,GAEH4B,EAAAC,cAACC,EAAK,CAAAtB,UAAU,sBACbP,GAEGC,GAAS0B,EAAAC,cAACC,EAAK,CAAAtB,UAAU,+BAKvC"}
@@ -1,2 +1,2 @@
1
- import e,{useEffect as t}from"react";import o from"react-dom";import n from"classnames";import{View as r}from"@tarojs/components";import c from"../Animated/Slide/index.js";import m from"../Animated/Fade/index.js";import i from"../Mask/index.js";var d={top:"down",bottom:"up",left:"right",right:"left"},p=function(p){var a=p.visible,l=p.position,u=void 0===l?"bottom":l,s=p.children,f=p.onClose,h=d[u],v=n("xh-popup-content",{"xh-popup-content-left":"left"===u,"xh-popup-content-right":"right"===u,"xh-popup-content-top":"top"===u,"xh-popup-content-bottom":"bottom"===u}),b=function(e){e.stopPropagation(),e.preventDefault()};function y(){f&&f()}if(t((function(){return a?(document.body.style.touchAction="none",document.body.addEventListener("touchmove",b),document.body.style.overflowY="hidden"):(document.body.style.touchAction="",document.body.removeEventListener("touchmove",b),document.body.style.overflowY="auto"),function(){document.body.style.touchAction="",document.body.style.overflowY="auto",document.body.removeEventListener("touchmove",b)}}),[a]),"h5"!==process.env.TARO_ENV){var E=n("xh-popup",a?"visible":"hidden");return e.createElement(r,{className:E},e.createElement(i,{onClick:y}),e.createElement(r,{className:v},s))}return o.createPortal(e.createElement(m,{in:a},e.createElement("div",{className:"xh-popup"},e.createElement(i,{onClick:y}),e.createElement(c,{direction:h,in:a},e.createElement("div",{className:v},s)))),document.body)};export{p as default};
1
+ import e,{useEffect as t}from"react";import o from"react-dom";import n from"classnames";import{View as r}from"@tarojs/components";import c from"../Animated/Slide/index.js";import m from"../Animated/Fade/index.js";import i from"../Mask/index.js";var d={top:"down",bottom:"up",left:"right",right:"left"},a=function(a){var p=a.visible,l=a.position,s=void 0===l?"bottom":l,u=a.children,f=a.onClose,h=a.className,v=d[s],b=n("xh-popup-content",{"xh-popup-content-left":"left"===s,"xh-popup-content-right":"right"===s,"xh-popup-content-top":"top"===s,"xh-popup-content-bottom":"bottom"===s}),y=function(e){e.stopPropagation(),e.preventDefault()};function E(){f&&f()}if(t((function(){return p?(document.body.style.touchAction="none",document.body.addEventListener("touchmove",y),document.body.style.overflowY="hidden"):(document.body.style.touchAction="",document.body.removeEventListener("touchmove",y),document.body.style.overflowY="auto"),function(){document.body.style.touchAction="",document.body.style.overflowY="auto",document.body.removeEventListener("touchmove",y)}}),[p]),"h5"!==process.env.TARO_ENV){var x=n("xh-popup",h,p?"visible":"hidden");return e.createElement(r,{className:x},e.createElement(i,{onClick:E}),e.createElement(r,{className:b},u))}return o.createPortal(e.createElement(m,{in:p},e.createElement("div",{className:n("xh-popup",h)},e.createElement(i,{onClick:E}),e.createElement(c,{direction:v,in:p},e.createElement("div",{className:b},u)))),document.body)};export{a as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/Popup/index.tsx"],"sourcesContent":["import React, { FC, PropsWithChildren, useEffect } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\n\nimport { Fade, Slide } from \"../Animated\";\nimport { SlideDirection } from \"../Animated/Slide\";\nimport Mask from \"../Mask\";\n\nimport \"./index.scss\";\n\nexport type PopupPosition = \"top\" | \"bottom\" | \"left\" | \"right\";\n\nexport interface PopupProps extends PropsWithChildren<{}> {\n visible: boolean;\n position?: PopupPosition;\n onClose?: () => void;\n}\n\nconst positionMap = {\n top: \"down\",\n bottom: \"up\",\n left: \"right\",\n right: \"left\",\n};\n\nconst Popup: FC<PopupProps> = props => {\n const { visible, position = \"bottom\", children, onClose } = props;\n const direction = positionMap[position] as SlideDirection;\n const cls = classNames(\"xh-popup-content\", {\n \"xh-popup-content-left\": position === \"left\",\n \"xh-popup-content-right\": position === \"right\",\n \"xh-popup-content-top\": position === \"top\",\n \"xh-popup-content-bottom\": position === \"bottom\",\n });\n\n const preventSTH = (e: TouchEvent) => {\n e.stopPropagation();\n e.preventDefault();\n };\n\n useEffect(() => {\n if (visible) {\n document.body.style.touchAction = \"none\";\n document.body.addEventListener(\"touchmove\", preventSTH);\n document.body.style.overflowY = \"hidden\";\n } else {\n document.body.style.touchAction = \"\";\n document.body.removeEventListener(\"touchmove\", preventSTH);\n document.body.style.overflowY = \"auto\";\n }\n\n return () => {\n document.body.style.touchAction = \"\";\n document.body.style.overflowY = \"auto\";\n document.body.removeEventListener(\"touchmove\", preventSTH);\n };\n }, [visible]);\n\n function handleClickOnMask(): void {\n onClose && onClose();\n }\n if (process.env.TARO_ENV !== \"h5\") {\n const minicls = classNames(\"xh-popup\", visible ? \"visible\" : \"hidden\");\n return (\n <View className={minicls}>\n <Mask onClick={handleClickOnMask} />\n <View className={cls}>{children}</View>\n </View>\n );\n }\n return ReactDOM.createPortal(\n <Fade in={visible}>\n <div className=\"xh-popup\">\n <Mask onClick={handleClickOnMask} />\n <Slide direction={direction} in={visible}>\n <div className={cls}>{children}</div>\n </Slide>\n </div>\n </Fade>,\n document.body\n );\n};\n\nexport default Popup;\n"],"names":["positionMap","top","bottom","left","right","Popup","props","visible","_a","position","children","onClose","direction","cls","classNames","preventSTH","e","stopPropagation","preventDefault","handleClickOnMask","useEffect","document","body","style","touchAction","addEventListener","overflowY","removeEventListener","process","env","TARO_ENV","minicls","React","createElement","View","className","Mask","onClick","ReactDOM","createPortal","Fade","in","Slide"],"mappings":"qPAmBA,IAAMA,EAAc,CAClBC,IAAK,OACLC,OAAQ,KACRC,KAAM,QACNC,MAAO,QAGHC,EAAwB,SAAAC,GACpB,IAAAC,EAAoDD,EAAKC,QAAhDC,EAA2CF,EAAxBG,SAAnBA,OAAQ,IAAAD,EAAG,SAAQA,EAAEE,EAAsBJ,EAAKI,SAAjBC,EAAYL,EAAKK,QAC3DC,EAAYZ,EAAYS,GACxBI,EAAMC,EAAW,mBAAoB,CACzC,wBAAsC,SAAbL,EACzB,yBAAuC,UAAbA,EAC1B,uBAAqC,QAAbA,EACxB,0BAAwC,WAAbA,IAGvBM,EAAa,SAACC,GAClBA,EAAEC,kBACFD,EAAEE,gBACJ,EAoBA,SAASC,IACPR,GAAWA,GACZ,CACD,GArBAS,GAAU,WAWR,OAVIb,GACFc,SAASC,KAAKC,MAAMC,YAAc,OAClCH,SAASC,KAAKG,iBAAiB,YAAaV,GAC5CM,SAASC,KAAKC,MAAMG,UAAY,WAEhCL,SAASC,KAAKC,MAAMC,YAAc,GAClCH,SAASC,KAAKK,oBAAoB,YAAaZ,GAC/CM,SAASC,KAAKC,MAAMG,UAAY,QAG3B,WACLL,SAASC,KAAKC,MAAMC,YAAc,GAClCH,SAASC,KAAKC,MAAMG,UAAY,OAChCL,SAASC,KAAKK,oBAAoB,YAAaZ,EACjD,CACF,GAAG,CAACR,IAKyB,OAAzBqB,QAAQC,IAAIC,SAAmB,CACjC,IAAMC,EAAUjB,EAAW,WAAYP,EAAU,UAAY,UAC7D,OACEyB,EAACC,cAAAC,EAAK,CAAAC,UAAWJ,GACfC,EAAAC,cAACG,EAAI,CAACC,QAASlB,IACfa,EAACC,cAAAC,EAAK,CAAAC,UAAWtB,GAAMH,GAG5B,CACD,OAAO4B,EAASC,aACdP,gBAACQ,EAAI,CAACC,GAAIlC,GACRyB,EAAKC,cAAA,MAAA,CAAAE,UAAU,YACbH,EAAAC,cAACG,EAAI,CAACC,QAASlB,IACfa,EAACC,cAAAS,GAAM9B,UAAWA,EAAW6B,GAAIlC,GAC/ByB,EAAAC,cAAA,MAAA,CAAKE,UAAWtB,GAAMH,MAI5BW,SAASC,KAEb"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/Popup/index.tsx"],"sourcesContent":["import React, { FC, PropsWithChildren, useEffect } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\n\nimport { Fade, Slide } from \"../Animated\";\nimport { SlideDirection } from \"../Animated/Slide\";\nimport Mask from \"../Mask\";\n\nimport \"./index.scss\";\n\nexport type PopupPosition = \"top\" | \"bottom\" | \"left\" | \"right\";\n\nexport interface PopupProps extends PropsWithChildren<{}> {\n visible: boolean;\n position?: PopupPosition;\n className?: string;\n onClose?: () => void;\n}\n\nconst positionMap = {\n top: \"down\",\n bottom: \"up\",\n left: \"right\",\n right: \"left\",\n};\n\nconst Popup: FC<PopupProps> = props => {\n const { visible, position = \"bottom\", children, onClose, className } = props;\n const direction = positionMap[position] as SlideDirection;\n const cls = classNames(\"xh-popup-content\", {\n \"xh-popup-content-left\": position === \"left\",\n \"xh-popup-content-right\": position === \"right\",\n \"xh-popup-content-top\": position === \"top\",\n \"xh-popup-content-bottom\": position === \"bottom\",\n });\n\n const preventSTH = (e: TouchEvent) => {\n e.stopPropagation();\n e.preventDefault();\n };\n\n useEffect(() => {\n if (visible) {\n document.body.style.touchAction = \"none\";\n document.body.addEventListener(\"touchmove\", preventSTH);\n document.body.style.overflowY = \"hidden\";\n } else {\n document.body.style.touchAction = \"\";\n document.body.removeEventListener(\"touchmove\", preventSTH);\n document.body.style.overflowY = \"auto\";\n }\n\n return () => {\n document.body.style.touchAction = \"\";\n document.body.style.overflowY = \"auto\";\n document.body.removeEventListener(\"touchmove\", preventSTH);\n };\n }, [visible]);\n\n function handleClickOnMask(): void {\n onClose && onClose();\n }\n if (process.env.TARO_ENV !== \"h5\") {\n const minicls = classNames(\n \"xh-popup\",\n className,\n visible ? \"visible\" : \"hidden\"\n );\n return (\n <View className={minicls}>\n <Mask onClick={handleClickOnMask} />\n <View className={cls}>{children}</View>\n </View>\n );\n }\n return ReactDOM.createPortal(\n <Fade in={visible}>\n <div className={classNames(\"xh-popup\", className)}>\n <Mask onClick={handleClickOnMask} />\n <Slide direction={direction} in={visible}>\n <div className={cls}>{children}</div>\n </Slide>\n </div>\n </Fade>,\n document.body\n );\n};\n\nexport default Popup;\n"],"names":["positionMap","top","bottom","left","right","Popup","props","visible","_a","position","children","onClose","className","direction","cls","classNames","preventSTH","e","stopPropagation","preventDefault","handleClickOnMask","useEffect","document","body","style","touchAction","addEventListener","overflowY","removeEventListener","process","env","TARO_ENV","minicls","React","createElement","View","Mask","onClick","ReactDOM","createPortal","Fade","in","Slide"],"mappings":"qPAoBA,IAAMA,EAAc,CAClBC,IAAK,OACLC,OAAQ,KACRC,KAAM,QACNC,MAAO,QAGHC,EAAwB,SAAAC,GACpB,IAAAC,EAA+DD,EAAKC,QAA3DC,EAAsDF,EAAKG,SAA3DA,OAAW,IAAAD,EAAA,SAAQA,EAAEE,EAAiCJ,EAAKI,SAA5BC,EAAuBL,EAAhBK,QAAEC,EAAcN,EAAKM,UACtEC,EAAYb,EAAYS,GACxBK,EAAMC,EAAW,mBAAoB,CACzC,wBAAsC,SAAbN,EACzB,yBAAuC,UAAbA,EAC1B,uBAAqC,QAAbA,EACxB,0BAAwC,WAAbA,IAGvBO,EAAa,SAACC,GAClBA,EAAEC,kBACFD,EAAEE,gBACJ,EAoBA,SAASC,IACPT,GAAWA,GACZ,CACD,GArBAU,GAAU,WAWR,OAVId,GACFe,SAASC,KAAKC,MAAMC,YAAc,OAClCH,SAASC,KAAKG,iBAAiB,YAAaV,GAC5CM,SAASC,KAAKC,MAAMG,UAAY,WAEhCL,SAASC,KAAKC,MAAMC,YAAc,GAClCH,SAASC,KAAKK,oBAAoB,YAAaZ,GAC/CM,SAASC,KAAKC,MAAMG,UAAY,QAG3B,WACLL,SAASC,KAAKC,MAAMC,YAAc,GAClCH,SAASC,KAAKC,MAAMG,UAAY,OAChCL,SAASC,KAAKK,oBAAoB,YAAaZ,EACjD,CACF,GAAG,CAACT,IAKyB,OAAzBsB,QAAQC,IAAIC,SAAmB,CACjC,IAAMC,EAAUjB,EACd,WACAH,EACAL,EAAU,UAAY,UAExB,OACE0B,EAACC,cAAAC,EAAK,CAAAvB,UAAWoB,GACfC,EAAAC,cAACE,EAAI,CAACC,QAASjB,IACfa,EAACC,cAAAC,EAAK,CAAAvB,UAAWE,GAAMJ,GAG5B,CACD,OAAO4B,EAASC,aACdN,gBAACO,EAAI,CAACC,GAAIlC,GACR0B,EAAAC,cAAA,MAAA,CAAKtB,UAAWG,EAAW,WAAYH,IACrCqB,EAAAC,cAACE,EAAI,CAACC,QAASjB,IACfa,EAACC,cAAAQ,GAAM7B,UAAWA,EAAW4B,GAAIlC,GAC/B0B,EAAAC,cAAA,MAAA,CAAKtB,UAAWE,GAAMJ,MAI5BY,SAASC,KAEb"}