taro-react-uilib 1.0.30 → 1.1.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 +41 -6
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Captcha/index.js +1 -1
- package/dist/components/Captcha/index.js.map +1 -1
- package/dist/components/DialogRef/index.js +1 -1
- package/dist/components/DialogRef/index.js.map +1 -1
- package/dist/components/ThemeProvider/index.js +2 -0
- package/dist/components/ThemeProvider/index.js.map +1 -0
- package/dist/components/src/index.js +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/styles/components/button.scss +17 -16
- package/dist/styles/components/captcha.scss +1 -1
- package/dist/styles/components/dialog.scss +1 -1
- package/dist/styles/components/dialogref.scss +9 -5
- package/dist/styles/components/index.scss +1 -0
- package/dist/styles/components/themeprovider.scss +0 -0
- package/dist/styles/themes/default.scss +2 -1
- package/dist/styles/themes/variable.scss +2 -2
- package/lib/components/Button/index.js +3 -3
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Captcha/index.js +11 -7
- package/lib/components/Captcha/index.js.map +1 -1
- package/lib/components/DialogRef/index.js +5 -4
- package/lib/components/DialogRef/index.js.map +1 -1
- package/lib/components/ThemeProvider/index.js +28 -0
- package/lib/components/ThemeProvider/index.js.map +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
- package/types/components/Button/index.d.ts +2 -1
- package/types/components/Captcha/index.d.ts +3 -1
- package/types/components/Theme/index.d.ts +27 -0
- package/types/components/ThemeProvider/index.d.ts +27 -0
- package/types/index.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
# [1.1.0](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.0.31...v1.1.0) (2023-04-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* 主题组件新增 ([79d796c](https://code.xhdev.xyz/h5group/taro-uilib/commits/79d796ce4bc269a2ead087727cf14564e8b19817))
|
|
7
|
+
* 导出theme组件 ([f95c875](https://code.xhdev.xyz/h5group/taro-uilib/commits/f95c87522b609125a804d30dc7671e2421d8c49d))
|
|
8
|
+
* 新增主题组件 ([7c9066c](https://code.xhdev.xyz/h5group/taro-uilib/commits/7c9066c61a0fef94eea651aba6b4df7283971492))
|
|
9
|
+
* 新增主题组件 ([529b142](https://code.xhdev.xyz/h5group/taro-uilib/commits/529b142d93f685b1639cea3fc6aa3c8f9f972312))
|
|
10
|
+
* 添加主题的支持 ([f1c1658](https://code.xhdev.xyz/h5group/taro-uilib/commits/f1c16583a23ecd4f210fb350889b427c561939c3))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.0.31](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.0.30...v1.0.31) (2023-03-17)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* dialogref 小程序适配问题 ([7b032ed](https://code.xhdev.xyz/h5group/taro-uilib/commits/7b032ed7bb42438c5f55cbc74d9af384c06f7ac3))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Performance Improvements
|
|
23
|
+
|
|
24
|
+
* captcha支持自动倒计时、获取倒计时状态 ([cdd8ff5](https://code.xhdev.xyz/h5group/taro-uilib/commits/cdd8ff5b1ccb95ed5753ec0784dcf71da171b76b))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
1
28
|
## [1.0.30](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.0.29...v1.0.30) (2023-03-16)
|
|
2
29
|
|
|
3
30
|
|
|
@@ -31,7 +58,7 @@
|
|
|
31
58
|
|
|
32
59
|
|
|
33
60
|
|
|
34
|
-
## [1.0.27](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.0.
|
|
61
|
+
## [1.0.27](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.0.24...v1.0.27) (2022-12-05)
|
|
35
62
|
|
|
36
63
|
|
|
37
64
|
### Bug Fixes
|
|
@@ -44,9 +71,17 @@
|
|
|
44
71
|
|
|
45
72
|
* forminput width 100% ([56586d6](https://code.xhdev.xyz/h5group/taro-uilib/commits/56586d6d8d6576f0e9b25b2cbe1294c35c5fee02))
|
|
46
73
|
* forminput width 100% ([cb368ee](https://code.xhdev.xyz/h5group/taro-uilib/commits/cb368ee6f0445cf777ef5b4c974a64d351e82b66))
|
|
74
|
+
* input的typescript问题 ([cb06bf5](https://code.xhdev.xyz/h5group/taro-uilib/commits/cb06bf581006ac671e7c9d13884194f82bbf4b0e))
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## [1.0.24](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.0.23...v1.0.24) (2022-11-16)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Features
|
|
82
|
+
|
|
47
83
|
* input ref处理 ([eeb9be4](https://code.xhdev.xyz/h5group/taro-uilib/commits/eeb9be4e213ac50c6783a3d502311793027f51fd))
|
|
48
84
|
* input ref处理 ([e899e62](https://code.xhdev.xyz/h5group/taro-uilib/commits/e899e62658789bc1ff0d62af350801f83ae6a84d))
|
|
49
|
-
* input的typescript问题 ([cb06bf5](https://code.xhdev.xyz/h5group/taro-uilib/commits/cb06bf581006ac671e7c9d13884194f82bbf4b0e))
|
|
50
85
|
|
|
51
86
|
|
|
52
87
|
|
|
@@ -56,6 +91,10 @@
|
|
|
56
91
|
### Features
|
|
57
92
|
|
|
58
93
|
* toast 增加hide回调 ([bad7c55](https://code.xhdev.xyz/h5group/taro-uilib/commits/bad7c55e9ca3ab41d9af8d3a946794d9e2200aed))
|
|
94
|
+
* 修复button存在的内存泄露问题 ([72494d8](https://code.xhdev.xyz/h5group/taro-uilib/commits/72494d877289a443e593a868c53a9e3fb86c0938))
|
|
95
|
+
* 修复button存在的内存泄露问题 ([41853b4](https://code.xhdev.xyz/h5group/taro-uilib/commits/41853b49910fc4f5c99107ddc23649bab61334fc))
|
|
96
|
+
* 修复button存在的内存泄露问题 ([59fe743](https://code.xhdev.xyz/h5group/taro-uilib/commits/59fe743744553ae213f8c43237d67a1a68230f77))
|
|
97
|
+
* 修复button存在的内存泄露问题 ([3beb7a8](https://code.xhdev.xyz/h5group/taro-uilib/commits/3beb7a82cbbb248c5ca9bd9e973af68548111510))
|
|
59
98
|
* 借款组件适配 ([3970d31](https://code.xhdev.xyz/h5group/taro-uilib/commits/3970d3135c682fe75b40b6756542ac7ce46c0920))
|
|
60
99
|
|
|
61
100
|
|
|
@@ -72,10 +111,6 @@
|
|
|
72
111
|
* picker开发 ([ff67009](https://code.xhdev.xyz/h5group/taro-uilib/commits/ff67009dc98e504cddb2cd8a677f63ea45118ade))
|
|
73
112
|
* react-transition-group不能外置 ([4854208](https://code.xhdev.xyz/h5group/taro-uilib/commits/48542088e18826043f683d472fdf8432328a63b9))
|
|
74
113
|
* v21 ([168a9d6](https://code.xhdev.xyz/h5group/taro-uilib/commits/168a9d630de84f0d50ed478ddcebf6e6f0775983))
|
|
75
|
-
* 修复button存在的内存泄露问题 ([72494d8](https://code.xhdev.xyz/h5group/taro-uilib/commits/72494d877289a443e593a868c53a9e3fb86c0938))
|
|
76
|
-
* 修复button存在的内存泄露问题 ([41853b4](https://code.xhdev.xyz/h5group/taro-uilib/commits/41853b49910fc4f5c99107ddc23649bab61334fc))
|
|
77
|
-
* 修复button存在的内存泄露问题 ([59fe743](https://code.xhdev.xyz/h5group/taro-uilib/commits/59fe743744553ae213f8c43237d67a1a68230f77))
|
|
78
|
-
* 修复button存在的内存泄露问题 ([3beb7a8](https://code.xhdev.xyz/h5group/taro-uilib/commits/3beb7a82cbbb248c5ca9bd9e973af68548111510))
|
|
79
114
|
|
|
80
115
|
|
|
81
116
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__read as e}from"../node_modules/tslib/tslib.es6.js";import t,{useState as n,useRef as o,useEffect as r}from"react";import
|
|
1
|
+
import{__read as e}from"../node_modules/tslib/tslib.es6.js";import t,{useState as n,useRef as o,useEffect as r}from"react";import s from"classnames";import{Button as a}from"@tarojs/components";import{useTaroEnv as i}from"../src/hooks/index.js";var u=function(u){var l=u.disabled,m=void 0!==l&&l,d=u.type,p=void 0===d?"default":d,c=u.size,h=void 0===c?"normal":c,b=u.shape,f=void 0===b?"round":b,g=u.children,x=u.className,y=u.htmlType,v=u.formType,P=u.text,T=u.openType,E=u.lang,M=u.sessionFrom,C=u.sendMessageTitle,w=u.sendMessagePath,I=u.sendMessageImg,N=u.showMessageCard,k=u.appParameter,G=u.onGetUserInfo,j=u.onGetPhoneNumber,W=u.onOpenSetting,q=u.onError,A=u.onContact,F=u.onClick,O=u.preventTime,S=void 0===O?2500:O,U=u.style,z=i(),B=e(n(!1),2),D=B[0],_=B[1],H=o(),J=s("xh-button",{"xh-button-default":"default"===p,"xh-button-primary":"primary"===p,"xh-button-secondary":"secondary"===p,"xh-button-ghost":"ghost"===p,"xh-button-warn":"warn"===p,"xh-button-square":"square"===f,"xh-button-round":"round"===f,"xh-button-rectangle":"rectangle"===f,"xh-button-normal":"normal"===h,"xh-button-small":"mini"===h,"xh-button-full":"full"===h,"xh-button-disabled":m,"xh-button-webutton":"WEAPP"===z},x),K=function(e){"WEB"===z&&e.nativeEvent.stopImmediatePropagation(),e.preventDefault(),D&&0!==S||(0!==S&&(H.current=setTimeout((function(){_(!1),clearTimeout(H.current)}),S)),0!==S&&_(!0),F&&F(e))};r((function(){return function(){clearTimeout(H.current)}}),[]);var L=t.createElement(a,{className:J,formType:v,openType:T,lang:E,type:p,sessionFrom:M,sendMessageTitle:C,sendMessagePath:w,sendMessageImg:I,showMessageCard:N,appParameter:k,onGetUserInfo:G,onGetPhoneNumber:j,onOpenSetting:W,onError:q,onContact:A,onClick:K,disabled:m,style:U},g);return"WEAPP"===z?L:t.createElement("button",{className:J,disabled:m,type:y,onClick:m?void 0:K,style:U},g||P)};export{u as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Button/index.tsx"],"sourcesContent":["import React, {\n FC,\n MouseEventHandler,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport classNames from \"classnames\";\nimport { Button } from \"@tarojs/components\";\nimport { ButtonProps } from \"@tarojs/components/types/Button\";\nimport {\n ITouchEvent,\n TouchEventFunction,\n} from \"@tarojs/components/types/common\";\n\nimport { useTaroEnv } from \"../../hooks\";\nimport \"./index.scss\";\n\nexport type ButtonType = \"default\" | \"secondary\" | \"primary\" | \"warn\" | \"ghost\";\n\nexport type ButtonShape = \"square\" | \"round\" | \"rectangle\";\n\nexport type ButtonSize = \"default\" | \"mini\" | \"full\";\n\nexport type WechatOpenType =\n | \"contact\"\n /** 触发用户转发,使用前建议先阅读使用指引\n * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%BC%95\n */\n | \"share\"\n /** 获取用户手机号,可以从 bindgetphonenumber 回调中获取到用户信息\n * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html\n */\n | \"getPhoneNumber\"\n /** 获取用户信息,可以从 bindgetuserinfo 回调中获取到用户信息 */\n | \"getUserInfo\"\n /** 用户实名信息授权,已经弃用 */\n | \"getRealnameAuthInfo\"\n /** 打开APP,可以通过app-parameter属性设定向APP传的参数\n * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/launchApp.html\n */\n | \"launchApp\"\n /** 打开授权设置页 */\n | \"openSetting\"\n /** 打开“意见反馈”页面,用户可提交反馈内容并上传日志,开发者可以登录小程序管理后台后进入左侧菜单“客服反馈”页面获取到反馈内容 */\n | \"feedback\";\nexport type XhButtonProps = {\n htmlType?: \"button\" | \"submit\" | \"reset\";\n type?: ButtonType;\n size?: ButtonSize;\n shape?: ButtonShape;\n disabled?: boolean;\n className?: string;\n styleName?: string;\n text?: string;\n preventTime?: number;\n onClick?: (e: ITouchEvent | MouseEvent) => void;\n} & Omit<ButtonProps, \"type\" | \"size\">;\n\nconst XhButton: FC<XhButtonProps> = props => {\n const {\n disabled = false,\n type = \"default\",\n size = \"normal\",\n shape = \"round\",\n children,\n className,\n htmlType,\n formType,\n text,\n openType,\n lang,\n sessionFrom,\n sendMessageTitle,\n sendMessagePath,\n sendMessageImg,\n showMessageCard,\n appParameter,\n onGetUserInfo,\n onGetPhoneNumber,\n onOpenSetting,\n onError,\n onContact,\n onClick,\n preventTime = 2500,\n } = props;\n const state = useTaroEnv();\n const [preventClick, setPreventClick] = useState(false);\n const timer = useRef<NodeJS.Timeout | undefined>();\n const classObj = classNames(\n \"xh-button\",\n {\n \"xh-button-default\": type === \"default\",\n \"xh-button-primary\": type === \"primary\",\n \"xh-button-secondary\": type === \"secondary\",\n \"xh-button-ghost\": type === \"ghost\",\n \"xh-button-warn\": type === \"warn\",\n \"xh-button-square\": shape === \"square\",\n \"xh-button-round\": shape === \"round\",\n \"xh-button-rectangle\": shape === \"rectangle\",\n \"xh-button-normal\": size === \"normal\",\n \"xh-button-small\": size === \"mini\",\n \"xh-button-full\": size === \"full\",\n \"xh-button-disabled\": disabled,\n \"xh-button-webutton\": state === \"WEAPP\",\n },\n className\n );\n\n const handleClick: MouseEventHandler & TouchEventFunction = e => {\n state === \"WEB\" && e.nativeEvent.stopImmediatePropagation();\n e.preventDefault();\n\n if (preventClick && preventTime !== 0) {\n console.log(\"重复点击\");\n return;\n }\n if (preventTime !== 0) {\n timer.current = setTimeout(() => {\n setPreventClick(false);\n clearTimeout(timer.current);\n }, preventTime);\n }\n if (preventTime !== 0) setPreventClick(true);\n console.log(\"正常点击\");\n onClick && onClick(e);\n };\n\n useEffect(() => {\n return () => {\n clearTimeout(timer.current);\n };\n }, []);\n\n const weButton = (\n <Button\n className={classObj}\n formType={formType}\n openType={openType}\n lang={lang}\n type={type as ButtonProps[\"type\"]}\n sessionFrom={sessionFrom}\n sendMessageTitle={sendMessageTitle}\n sendMessagePath={sendMessagePath}\n sendMessageImg={sendMessageImg}\n showMessageCard={showMessageCard}\n appParameter={appParameter}\n onGetUserInfo={onGetUserInfo}\n onGetPhoneNumber={onGetPhoneNumber}\n onOpenSetting={onOpenSetting}\n onError={onError}\n onContact={onContact}\n onClick={handleClick}\n disabled={disabled}\n >\n {children}\n </Button>\n );\n\n if (state === \"WEAPP\") {\n return weButton;\n }\n\n return (\n // eslint-disable-next-line react/button-has-type\n <button\n className={classObj}\n disabled={disabled}\n type={htmlType}\n onClick={disabled ? undefined : handleClick}\n >\n {children || text}\n </button>\n );\n};\n\nexport default XhButton;\n"],"names":["XhButton","props","_a","disabled","_b","type","_c","size","_d","shape","children","className","htmlType","formType","text","openType","lang","sessionFrom","sendMessageTitle","sendMessagePath","sendMessageImg","showMessageCard","appParameter","onGetUserInfo","onGetPhoneNumber","onOpenSetting","onError","onContact","onClick","_e","preventTime","state","useTaroEnv","_f","__read","useState","preventClick","setPreventClick","timer","useRef","classObj","classNames","handleClick","e","nativeEvent","stopImmediatePropagation","preventDefault","current","setTimeout","clearTimeout","useEffect","weButton","React","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Button/index.tsx"],"sourcesContent":["import React, {\n FC,\n MouseEventHandler,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport classNames from \"classnames\";\nimport { Button } from \"@tarojs/components\";\nimport { ButtonProps } from \"@tarojs/components/types/Button\";\nimport {\n ITouchEvent,\n TouchEventFunction,\n} from \"@tarojs/components/types/common\";\n\nimport { useTaroEnv } from \"../../hooks\";\nimport \"./index.scss\";\n\nexport type ButtonType = \"default\" | \"secondary\" | \"primary\" | \"warn\" | \"ghost\";\n\nexport type ButtonShape = \"square\" | \"round\" | \"rectangle\";\n\nexport type ButtonSize = \"default\" | \"mini\" | \"full\";\n\nexport type WechatOpenType =\n | \"contact\"\n /** 触发用户转发,使用前建议先阅读使用指引\n * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%BC%95\n */\n | \"share\"\n /** 获取用户手机号,可以从 bindgetphonenumber 回调中获取到用户信息\n * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html\n */\n | \"getPhoneNumber\"\n /** 获取用户信息,可以从 bindgetuserinfo 回调中获取到用户信息 */\n | \"getUserInfo\"\n /** 用户实名信息授权,已经弃用 */\n | \"getRealnameAuthInfo\"\n /** 打开APP,可以通过app-parameter属性设定向APP传的参数\n * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/launchApp.html\n */\n | \"launchApp\"\n /** 打开授权设置页 */\n | \"openSetting\"\n /** 打开“意见反馈”页面,用户可提交反馈内容并上传日志,开发者可以登录小程序管理后台后进入左侧菜单“客服反馈”页面获取到反馈内容 */\n | \"feedback\";\nexport type XhButtonProps = {\n htmlType?: \"button\" | \"submit\" | \"reset\";\n type?: ButtonType;\n size?: ButtonSize;\n shape?: ButtonShape;\n disabled?: boolean;\n className?: string;\n styleName?: string;\n text?: string;\n preventTime?: number;\n onClick?: (e: ITouchEvent | MouseEvent) => void;\n style?: React.CSSProperties;\n} & Omit<ButtonProps, \"type\" | \"size\">;\n\nconst XhButton: FC<XhButtonProps> = props => {\n const {\n disabled = false,\n type = \"default\",\n size = \"normal\",\n shape = \"round\",\n children,\n className,\n htmlType,\n formType,\n text,\n openType,\n lang,\n sessionFrom,\n sendMessageTitle,\n sendMessagePath,\n sendMessageImg,\n showMessageCard,\n appParameter,\n onGetUserInfo,\n onGetPhoneNumber,\n onOpenSetting,\n onError,\n onContact,\n onClick,\n preventTime = 2500,\n style,\n } = props;\n const state = useTaroEnv();\n const [preventClick, setPreventClick] = useState(false);\n const timer = useRef<NodeJS.Timeout | undefined>();\n const classObj = classNames(\n \"xh-button\",\n {\n \"xh-button-default\": type === \"default\",\n \"xh-button-primary\": type === \"primary\",\n \"xh-button-secondary\": type === \"secondary\",\n \"xh-button-ghost\": type === \"ghost\",\n \"xh-button-warn\": type === \"warn\",\n \"xh-button-square\": shape === \"square\",\n \"xh-button-round\": shape === \"round\",\n \"xh-button-rectangle\": shape === \"rectangle\",\n \"xh-button-normal\": size === \"normal\",\n \"xh-button-small\": size === \"mini\",\n \"xh-button-full\": size === \"full\",\n \"xh-button-disabled\": disabled,\n \"xh-button-webutton\": state === \"WEAPP\",\n },\n className\n );\n\n const handleClick: MouseEventHandler & TouchEventFunction = e => {\n state === \"WEB\" && e.nativeEvent.stopImmediatePropagation();\n e.preventDefault();\n\n if (preventClick && preventTime !== 0) {\n console.log(\"重复点击\");\n return;\n }\n if (preventTime !== 0) {\n timer.current = setTimeout(() => {\n setPreventClick(false);\n clearTimeout(timer.current);\n }, preventTime);\n }\n if (preventTime !== 0) setPreventClick(true);\n console.log(\"正常点击\");\n onClick && onClick(e);\n };\n\n useEffect(() => {\n return () => {\n clearTimeout(timer.current);\n };\n }, []);\n\n const weButton = (\n <Button\n className={classObj}\n formType={formType}\n openType={openType}\n lang={lang}\n type={type as ButtonProps[\"type\"]}\n sessionFrom={sessionFrom}\n sendMessageTitle={sendMessageTitle}\n sendMessagePath={sendMessagePath}\n sendMessageImg={sendMessageImg}\n showMessageCard={showMessageCard}\n appParameter={appParameter}\n onGetUserInfo={onGetUserInfo}\n onGetPhoneNumber={onGetPhoneNumber}\n onOpenSetting={onOpenSetting}\n onError={onError}\n onContact={onContact}\n onClick={handleClick}\n disabled={disabled}\n style={style}\n >\n {children}\n </Button>\n );\n\n if (state === \"WEAPP\") {\n return weButton;\n }\n\n return (\n // eslint-disable-next-line react/button-has-type\n <button\n className={classObj}\n disabled={disabled}\n type={htmlType}\n onClick={disabled ? undefined : handleClick}\n style={style}\n >\n {children || text}\n </button>\n );\n};\n\nexport default XhButton;\n"],"names":["XhButton","props","_a","disabled","_b","type","_c","size","_d","shape","children","className","htmlType","formType","text","openType","lang","sessionFrom","sendMessageTitle","sendMessagePath","sendMessageImg","showMessageCard","appParameter","onGetUserInfo","onGetPhoneNumber","onOpenSetting","onError","onContact","onClick","_e","preventTime","style","state","useTaroEnv","_f","__read","useState","preventClick","setPreventClick","timer","useRef","classObj","classNames","handleClick","e","nativeEvent","stopImmediatePropagation","preventDefault","current","setTimeout","clearTimeout","useEffect","weButton","React","Button","createElement","undefined"],"mappings":"oPA4DM,IAAAA,EAA8B,SAAAC,GAEhC,IAAAC,EAyBED,EAzBcE,SAAhBA,OAAW,IAAAD,GAAKA,EAChBE,EAwBEH,EAxBcI,KAAhBA,OAAO,IAAAD,EAAA,UAASA,EAChBE,EAuBEL,EAvBaM,KAAfA,OAAO,IAAAD,EAAA,SAAQA,EACfE,EAsBEP,EAAKQ,MAtBPA,aAAQ,QAAOD,EACfE,EAqBET,EArBMS,SACRC,EAoBEV,EApBOU,UACTC,EAmBEX,EAAKW,SAlBPC,EAkBEZ,EAAKY,SAjBPC,EAiBEb,OAhBFc,EAgBEd,WAfFe,EAeEf,OAdFgB,EAcEhB,EAdSgB,YACXC,EAaEjB,EAbciB,iBAChBC,EAYElB,EAAKkB,gBAXPC,EAWEnB,EAAKmB,eAVPC,EAUEpB,EAVaoB,gBACfC,EASErB,EATUqB,aACZC,EAQEtB,EARWsB,cACbC,EAOEvB,EAPcuB,iBAChBC,EAMExB,EAAKwB,cALPC,EAKEzB,EAAKyB,QAJPC,EAIE1B,YAHF2B,EAGE3B,EAHK2B,QACPC,EAEE5B,cAFF6B,OAAc,IAAAD,EAAA,OACdE,EACE9B,QACE+B,EAAQC,IACRC,EAAAC,EAAkCC,GAAS,GAAM,GAAhDC,EAAYH,EAAA,GAAEI,OACfC,EAAQC,IACRC,EAAWC,EACf,YACA,CACE,oBAA8B,YAATrC,EACrB,oBAA8B,YAATA,EACrB,sBAAgC,cAATA,EACvB,kBAA4B,UAATA,EACnB,iBAA2B,SAATA,EAClB,mBAA8B,WAAVI,EACpB,kBAA6B,UAAVA,EACnB,sBAAiC,cAAVA,EACvB,mBAA6B,WAATF,EACpB,kBAA4B,SAATA,EACnB,iBAA2B,SAATA,EAClB,qBAAsBJ,EACtB,qBAAgC,UAAV6B,GAExBrB,GAGIgC,EAAsD,SAAAC,GAChD,QAAVZ,GAAmBY,EAAEC,YAAYC,2BACjCF,EAAEG,iBAEEV,GAAgC,IAAhBP,IAIA,IAAhBA,IACFS,EAAMS,QAAUC,YAAW,WACzBX,GAAgB,GAChBY,aAAaX,EAAMS,QACpB,GAAElB,IAEe,IAAhBA,GAAmBQ,GAAgB,GAEvCV,GAAWA,EAAQgB,GACrB,EAEAO,GAAU,WACR,OAAO,WACLD,aAAaX,EAAMS,QACrB,CACD,GAAE,IAEH,IAAMI,EACJC,gBAACC,EAAM,CACL3C,UAAW8B,EACX5B,SAAUA,EACVE,SAAUA,EACVC,KAAMA,EACNX,KAAMA,EACNY,YAAaA,EACbC,iBAAkBA,EAClBC,gBAAiBA,EACjBC,eAAgBA,EAChBC,gBAAiBA,EACjBC,aAAcA,EACdC,cAAeA,EACfC,iBAAkBA,EAClBC,cAAeA,EACfC,QAASA,EACTC,UAAWA,EACXC,QAASe,EACTxC,SAAUA,EACV4B,MAAOA,GAENrB,GAIL,MAAc,UAAVsB,EACKoB,EAKPC,EAAAE,cAAA,SAAA,CACE5C,UAAW8B,EACXtC,SAAUA,EACVE,KAAMO,EACNgB,QAASzB,OAAWqD,EAAYb,EAChCZ,MAAOA,GAENrB,GAAYI,EAGnB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as
|
|
1
|
+
import{__rest as n,__read as t,__assign as e}from"../node_modules/tslib/tslib.es6.js";import r,{forwardRef as c,useRef as a,useState as o,useImperativeHandle as i,useEffect as u,useMemo as l}from"react";import s from"classnames";import m from"../Button/index.js";var f=c((function(c,f){var v=c.timeout,d=void 0===v?59:v,h=c.text,p=void 0===h?"获取验证码":h,x=c.onClick,I=c.className,b=c.ingText,g=void 0===b?"s重新获取":b,k=c.onEnd,C=n(c,["timeout","text","onClick","className","ingText","onEnd"]),E=a(),N=t(o(0),2),j=N[0],w=N[1],y=t(o(!1),2),D=y[0],M=y[1],T=function(){E.current&&clearInterval(E.current),w(0),M(!1)};i(f,(function(){return{reset:T,begin:z,beginning:D}}),[D]),u((function(){return E.current&&clearInterval(E.current),function(){E.current&&clearInterval(E.current)}}),[]);var q=l((function(){return j?"".concat(j).concat(g):p}),[j,p,g]),z=function(){var n=Date.now(),t=n;M(!0),E.current&&clearInterval(E.current),w(d),E.current=setInterval((function(){t=Date.now();var e=n+1e3*d+100,r=Math.max(Math.floor((e-t)/1e3),0);0===r&&(E.current&&clearInterval(E.current),M(!1),k&&k()),w(r)}),1e3)};return r.createElement(m,e({},c,{className:s("xh-captcha",I),disabled:D,onClick:function(){var n=x();n&&n.then&&n.then(z).catch((function(){M(!1)}))},type:"secondary",shape:"square",size:"mini"},C),q)}));export{f as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Captcha/index.tsx"],"sourcesContent":["import React, {\n useRef,\n useState,\n useEffect,\n useImperativeHandle,\n forwardRef,\n Ref,\n useMemo,\n} from \"react\";\nimport classnames from \"classnames\";\n\nimport Button, { XhButtonProps } from \"../Button\";\n\nimport \"./index.scss\";\n\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Captcha/index.tsx"],"sourcesContent":["import React, {\n useRef,\n useState,\n useEffect,\n useImperativeHandle,\n forwardRef,\n Ref,\n useMemo,\n} from \"react\";\nimport classnames from \"classnames\";\n\nimport Button, { XhButtonProps } from \"../Button\";\n\nimport \"./index.scss\";\n\nexport type refMe = {\n reset: () => void;\n begin: () => void;\n beginning: boolean;\n};\n\nexport interface CaptchaProps extends XhButtonProps {\n timeout?: number;\n className?: string;\n styleName?: string;\n text?: string;\n onClick: () => Promise<boolean>;\n ref: Ref<refMe>;\n timeingTemp?: string;\n ingText?: string;\n onEnd?: () => void;\n}\n\nconst CountdownButton = forwardRef<refMe, CaptchaProps>((props, fromRef) => {\n const {\n timeout = 59,\n text = \"获取验证码\",\n onClick,\n className,\n ingText = \"s重新获取\",\n onEnd,\n ...rest\n } = props;\n const intervalRef = useRef<NodeJS.Timeout | null>();\n const [time, setTime] = useState(0);\n const [disabled, setDisabled] = useState(false);\n\n const reset = (): void => {\n intervalRef.current && clearInterval(intervalRef.current);\n setTime(0);\n setDisabled(false);\n };\n\n useImperativeHandle(\n fromRef,\n () => ({\n reset,\n begin: counter,\n beginning: disabled,\n }),\n [disabled]\n );\n\n useEffect(() => {\n intervalRef.current && clearInterval(intervalRef.current);\n return () => {\n intervalRef.current && clearInterval(intervalRef.current);\n };\n }, []);\n\n // 倒计时\n const buttonText = useMemo((): string | number => {\n if (time) {\n return `${time}${ingText}`;\n }\n return text;\n }, [time, text, ingText]);\n\n const counter = () => {\n const now = Date.now();\n let nowStamp = now;\n\n setDisabled(true);\n\n if (intervalRef.current) {\n clearInterval(intervalRef.current);\n }\n\n setTime(timeout);\n\n intervalRef.current = setInterval(() => {\n nowStamp = Date.now();\n const overTimeStamp = now + timeout * 1000 + 100;\n const leftTime = Math.max(\n Math.floor((overTimeStamp - nowStamp) / 1000),\n 0\n );\n\n if (leftTime === 0) {\n intervalRef.current && clearInterval(intervalRef.current);\n setDisabled(false);\n onEnd && onEnd();\n }\n\n setTime(leftTime);\n }, 1000);\n };\n\n const handleClick = (): any => {\n const promise = onClick();\n if (promise && promise.then) {\n promise.then(counter).catch(() => {\n console.log(\"callback reject....\");\n setDisabled(false);\n });\n }\n };\n\n return (\n <Button\n {...props}\n className={classnames(\"xh-captcha\", className)}\n disabled={disabled}\n onClick={handleClick}\n type=\"secondary\"\n shape=\"square\"\n size=\"mini\"\n {...rest}\n >\n {buttonText}\n </Button>\n );\n});\nexport default CountdownButton;\n"],"names":["CountdownButton","forwardRef","props","fromRef","_a","timeout","_b","text","onClick","className","_c","ingText","onEnd","rest","intervalRef","useRef","_d","__read","useState","time","setTime","_e","disabled","setDisabled","reset","current","clearInterval","useImperativeHandle","begin","counter","beginning","useEffect","buttonText","useMemo","concat","now","Date","nowStamp","setInterval","overTimeStamp","leftTime","Math","max","floor","React","createElement","Button","classnames","promise","then","catch","type","shape","size"],"mappings":"uQAiCA,IAAMA,EAAkBC,GAAgC,SAACC,EAAOC,GAE5D,IAAAC,EAOEF,EAPUG,QAAZA,OAAU,IAAAD,EAAA,GAAEA,EACZE,EAMEJ,OANFK,aAAO,QAAOD,EACdE,EAKEN,EAAKM,QAJPC,EAIEP,EAAKO,UAHPC,EAGER,UAHFS,OAAU,IAAAD,EAAA,QAAOA,EACjBE,EAEEV,QADCW,IACDX,EARE,CAQL,UAAA,OAAA,UAAA,YAAA,UAAA,UACKY,EAAcC,IACdC,EAAAC,EAAkBC,EAAS,GAAE,GAA5BC,EAAIH,EAAA,GAAEI,OACPC,EAAAJ,EAA0BC,GAAS,GAAM,GAAxCI,EAAQD,EAAA,GAAEE,OAEXC,EAAQ,WACZV,EAAYW,SAAWC,cAAcZ,EAAYW,SACjDL,EAAQ,GACRG,GAAY,EACd,EAEAI,EACExB,GACA,WAAM,MAAC,CACLqB,MAAKA,EACLI,MAAOC,EACPC,UAAWR,EACX,GACF,CAACA,IAGHS,GAAU,WAER,OADAjB,EAAYW,SAAWC,cAAcZ,EAAYW,SAC1C,WACLX,EAAYW,SAAWC,cAAcZ,EAAYW,QACnD,CACD,GAAE,IAGH,IAAMO,EAAaC,GAAQ,WACzB,OAAId,EACK,GAAGe,OAAAf,GAAOe,OAAAvB,GAEZJ,CACR,GAAE,CAACY,EAAMZ,EAAMI,IAEVkB,EAAU,WACd,IAAMM,EAAMC,KAAKD,MACbE,EAAWF,EAEfZ,GAAY,GAERT,EAAYW,SACdC,cAAcZ,EAAYW,SAG5BL,EAAQf,GAERS,EAAYW,QAAUa,aAAY,WAChCD,EAAWD,KAAKD,MAChB,IAAMI,EAAgBJ,EAAgB,IAAV9B,EAAiB,IACvCmC,EAAWC,KAAKC,IACpBD,KAAKE,OAAOJ,EAAgBF,GAAY,KACxC,GAGe,IAAbG,IACF1B,EAAYW,SAAWC,cAAcZ,EAAYW,SACjDF,GAAY,GACZX,GAASA,KAGXQ,EAAQoB,EACT,GAAE,IACL,EAYA,OACEI,EAACC,cAAAC,OACK5C,EAAK,CACTO,UAAWsC,EAAW,aAActC,GACpCa,SAAUA,EACVd,QAfgB,WAClB,IAAMwC,EAAUxC,IACZwC,GAAWA,EAAQC,MACrBD,EAAQC,KAAKpB,GAASqB,OAAM,WAE1B3B,GAAY,EACd,GAEJ,EAQI4B,KAAK,YACLC,MAAM,SACNC,KAAK,QACDxC,GAEHmB,EAGP"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__read as e}from"../node_modules/tslib/tslib.es6.js";import
|
|
1
|
+
import{__read as e,__assign as o}from"../node_modules/tslib/tslib.es6.js";import t,{forwardRef as n,useState as r,useImperativeHandle as a,useEffect as c}from"react";import s from"classnames";import{View as i}from"@tarojs/components";import l from"../Button/index.js";import m from"../Mask/index.js";import f from"../node_modules/react-transition-group/esm/CSSTransition.js";var p=n((function(n,p){var d=n.header,h=n.content,u=n.className,v=void 0===u?"":u,x=n.visible,E=n.showCancel,N=void 0===E||E,g=n.confirmText,T=void 0===g?"确定":g,b=n.cancelText,C=void 0===b?"取消":b,_=n.footer,j=void 0!==_&&_,A=n.onConfirm,O=n.onCancel,R=n.onClose,V=e(r(!1),2),k=V[0],y=V[1];a(p,(function(){return{close:w,open:S}}));var w=function(){R&&R(),y(!1)},S=function(){y(!0)};c((function(){x||R&&R(),y(x)}),[x]);var B=s("xh-dialog-ref",v,{show:k}),M=s("xh-dialog-ref-content-footer-buttons",{microApp:"h5"!==process.env.TARO_ENV}),q="h5"!==process.env.TARO_ENV?{type:"ghost",shape:"rectangle"}:{},z=t.createElement(i,{className:M},N&&t.createElement(l,o({},q,{preventTime:0,onClick:function(){O&&O(),w()},className:"h5"!==process.env.TARO_ENV?"xh-dialog-ref-content-footer-buttons-microapp-cancel":"xh-dialog-ref-content-footer-buttons-h5-cancel"}),C),t.createElement(l,o({type:"primary"},q,{className:"h5"!==process.env.TARO_ENV?"xh-dialog-ref-content-footer-buttons-microapp-confirm":"xh-dialog-ref-content-footer-buttons-h5-confirm",onClick:function(){A&&A()},preventTime:0}),T));return t.createElement(i,{className:B},t.createElement(m,null),t.createElement(f,{in:k,timeout:200,classNames:"scale"},t.createElement(i,{className:"xh-dialog-ref-content"},t.createElement(i,{className:"xh-dialog-ref-content-header"},d),t.createElement(i,{className:"xh-dialog-ref-content-content"},h),j||t.createElement(i,{className:"xh-dialog-ref-content-footer"},z))))}));export{p as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/DialogRef/index.tsx"],"sourcesContent":["import React, {\n ReactNode,\n useState,\n useImperativeHandle,\n forwardRef,\n useEffect,\n} from \"react\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport { CSSTransition } from \"react-transition-group\";\nimport Button from \"../Button\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport Mask from \"../Mask\";\nimport \"./index.scss\";\n\nexport type DialogProps = {\n header?: string | ReactNode;\n content: string | ReactNode;\n footer?: ReactNode;\n cancelText?: string;\n confirmText?: string;\n showCancel?: boolean;\n visible: boolean;\n onConfirm?: () => void;\n onCancel?: () => void;\n onClose?: () => void;\n} & XHComponentCommonProps;\n\nexport type IDialogRef = {\n close: () => void;\n open: () => void;\n};\nconst DialogCom = forwardRef<IDialogRef, DialogProps>((props, fromRef) => {\n const {\n header,\n content,\n className = \"\",\n visible,\n showCancel = true,\n confirmText = \"确定\",\n cancelText = \"取消\",\n footer = false,\n onConfirm,\n onCancel,\n onClose,\n } = props;\n const [selfVisible, setSelfVisible] = useState(false);\n\n useImperativeHandle(fromRef, () => ({\n close,\n open,\n }));\n\n const close = () => {\n onClose && onClose();\n setSelfVisible(false);\n };\n\n const open = () => {\n setSelfVisible(true);\n };\n\n const handleConfirm = () => {\n onConfirm && onConfirm();\n // close();\n };\n const handleCancel = () => {\n onCancel && onCancel();\n close();\n };\n\n useEffect(() => {\n if (!visible) {\n onClose && onClose();\n }\n setSelfVisible(visible);\n }, [visible]);\n\n const dialogcls = classNames(\"xh-dialog-ref\", className, {\n show: selfVisible,\n });\n const footercls = classNames(\"xh-dialog-ref-content-footer-buttons\", {\n microApp: process.env.TARO_ENV !== \"h5\",\n });\n\n const dialogFooter = (\n <View className={footercls}>\n {showCancel && (\n <Button\n preventTime={0}\n onClick={handleCancel}\n className={\n process.env.TARO_ENV !== \"h5\"\n ? \"xh-dialog-ref-content-footer-buttons-microapp-cancel\"\n : \"xh-dialog-ref-content-footer-buttons-h5-cancel\"\n }\n >\n {cancelText}\n </Button>\n )}\n <Button\n type=\"primary\"\n className={\n process.env.TARO_ENV !== \"h5\"\n ? \"xh-dialog-ref-content-footer-buttons-microapp-confirm\"\n : \"xh-dialog-ref-content-footer-buttons-h5-confirm\"\n }\n onClick={handleConfirm}\n preventTime={0}\n >\n {confirmText}\n </Button>\n </View>\n );\n\n const DialogMain = (\n <View className={dialogcls}>\n <Mask />\n <CSSTransition in={selfVisible} timeout={200} classNames=\"scale\">\n <View className=\"xh-dialog-ref-content\">\n <View className=\"xh-dialog-ref-content-header\">{header}</View>\n <View className=\"xh-dialog-ref-content-content\">{content}</View>\n {footer || (\n <View className=\"xh-dialog-ref-content-footer\">{dialogFooter}</View>\n )}\n </View>\n </CSSTransition>\n </View>\n );\n return DialogMain;\n});\n\nexport default DialogCom;\n"],"names":["DialogCom","forwardRef","props","fromRef","header","content","_a","className","visible","_b","showCancel","_c","confirmText","_d","cancelText","_e","footer","onConfirm","onCancel","onClose","_f","__read","useState","selfVisible","setSelfVisible","useImperativeHandle","close","open","useEffect","dialogcls","classNames","show","footercls","microApp","process","env","TARO_ENV","dialogFooter","React","createElement","View","Button","preventTime","onClick","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/DialogRef/index.tsx"],"sourcesContent":["import React, {\n ReactNode,\n useState,\n useImperativeHandle,\n forwardRef,\n useEffect,\n} from \"react\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport { CSSTransition } from \"react-transition-group\";\nimport Button, { XhButtonProps } from \"../Button\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport Mask from \"../Mask\";\nimport \"./index.scss\";\n\nexport type DialogProps = {\n header?: string | ReactNode;\n content: string | ReactNode;\n footer?: ReactNode;\n cancelText?: string;\n confirmText?: string;\n showCancel?: boolean;\n visible: boolean;\n onConfirm?: () => void;\n onCancel?: () => void;\n onClose?: () => void;\n} & XHComponentCommonProps;\n\nexport type IDialogRef = {\n close: () => void;\n open: () => void;\n};\nconst DialogCom = forwardRef<IDialogRef, DialogProps>((props, fromRef) => {\n const {\n header,\n content,\n className = \"\",\n visible,\n showCancel = true,\n confirmText = \"确定\",\n cancelText = \"取消\",\n footer = false,\n onConfirm,\n onCancel,\n onClose,\n } = props;\n const [selfVisible, setSelfVisible] = useState(false);\n\n useImperativeHandle(fromRef, () => ({\n close,\n open,\n }));\n\n const close = () => {\n onClose && onClose();\n setSelfVisible(false);\n };\n\n const open = () => {\n setSelfVisible(true);\n };\n\n const handleConfirm = () => {\n onConfirm && onConfirm();\n // close();\n };\n const handleCancel = () => {\n onCancel && onCancel();\n close();\n };\n\n useEffect(() => {\n if (!visible) {\n onClose && onClose();\n }\n setSelfVisible(visible);\n }, [visible]);\n\n const dialogcls = classNames(\"xh-dialog-ref\", className, {\n show: selfVisible,\n });\n const footercls = classNames(\"xh-dialog-ref-content-footer-buttons\", {\n microApp: process.env.TARO_ENV !== \"h5\",\n });\n\n const morcoBtnProps:\n | { type: XhButtonProps[\"type\"]; shape: XhButtonProps[\"shape\"] }\n | {} =\n process.env.TARO_ENV !== \"h5\" ? { type: \"ghost\", shape: \"rectangle\" } : {};\n\n const dialogFooter = (\n <View className={footercls}>\n {showCancel && (\n <Button\n {...morcoBtnProps}\n preventTime={0}\n onClick={handleCancel}\n className={\n process.env.TARO_ENV !== \"h5\"\n ? \"xh-dialog-ref-content-footer-buttons-microapp-cancel\"\n : \"xh-dialog-ref-content-footer-buttons-h5-cancel\"\n }\n >\n {cancelText}\n </Button>\n )}\n <Button\n type=\"primary\"\n {...morcoBtnProps}\n className={\n process.env.TARO_ENV !== \"h5\"\n ? \"xh-dialog-ref-content-footer-buttons-microapp-confirm\"\n : \"xh-dialog-ref-content-footer-buttons-h5-confirm\"\n }\n onClick={handleConfirm}\n preventTime={0}\n >\n {confirmText}\n </Button>\n </View>\n );\n\n const DialogMain = (\n <View className={dialogcls}>\n <Mask />\n <CSSTransition in={selfVisible} timeout={200} classNames=\"scale\">\n <View className=\"xh-dialog-ref-content\">\n <View className=\"xh-dialog-ref-content-header\">{header}</View>\n <View className=\"xh-dialog-ref-content-content\">{content}</View>\n {footer || (\n <View className=\"xh-dialog-ref-content-footer\">{dialogFooter}</View>\n )}\n </View>\n </CSSTransition>\n </View>\n );\n return DialogMain;\n});\n\nexport default DialogCom;\n"],"names":["DialogCom","forwardRef","props","fromRef","header","content","_a","className","visible","_b","showCancel","_c","confirmText","_d","cancelText","_e","footer","onConfirm","onCancel","onClose","_f","__read","useState","selfVisible","setSelfVisible","useImperativeHandle","close","open","useEffect","dialogcls","classNames","show","footercls","microApp","process","env","TARO_ENV","morcoBtnProps","type","shape","dialogFooter","React","createElement","View","Button","preventTime","onClick","__assign","Mask","CSSTransition","in","timeout"],"mappings":"uXAgCA,IAAMA,EAAYC,GAAoC,SAACC,EAAOC,GAE1D,IAAAC,EAWEF,EAAKE,OAVPC,EAUEH,EAAKG,QATPC,EASEJ,EATYK,UAAdA,OAAY,IAAAD,EAAA,GAAEA,EACdE,EAQEN,EARKM,QACPC,EAOEP,EAAKQ,WAPPA,cAAiBD,EACjBE,EAMET,EANgBU,YAAlBA,OAAW,IAAAD,EAAG,KAAIA,EAClBE,EAKEX,EALeY,WAAjBA,OAAU,IAAAD,EAAG,KAAIA,EACjBE,EAIEb,SAJFc,OAAS,IAAAD,KACTE,EAGEf,YAFFgB,EAEEhB,WADFiB,EACEjB,UACEkB,EAAAC,EAAgCC,GAAS,GAAM,GAA9CC,EAAWH,EAAA,GAAEI,OAEpBC,EAAoBtB,GAAS,WAAM,MAAC,CAClCuB,MAAKA,EACLC,KAAIA,EACJ,IAEF,IAAMD,EAAQ,WACZP,GAAWA,IACXK,GAAe,EACjB,EAEMG,EAAO,WACXH,GAAe,EACjB,EAWAI,GAAU,WACHpB,GACHW,GAAWA,IAEbK,EAAehB,EACjB,GAAG,CAACA,IAEJ,IAAMqB,EAAYC,EAAW,gBAAiBvB,EAAW,CACvDwB,KAAMR,IAEFS,EAAYF,EAAW,uCAAwC,CACnEG,SAAmC,OAAzBC,QAAQC,IAAIC,WAGlBC,EAGqB,OAAzBH,QAAQC,IAAIC,SAAoB,CAAEE,KAAM,QAASC,MAAO,aAAgB,CAAA,EAEpEC,EACJC,EAAAC,cAACC,EAAK,CAAApC,UAAWyB,GACdtB,GACC+B,EAACC,cAAAE,OACKP,EAAa,CACjBQ,YAAa,EACbC,QA9Ba,WACnB5B,GAAYA,IACZQ,GACF,EA4BQnB,UAC2B,OAAzB2B,QAAQC,IAAIC,SACR,uDACA,mDAGLtB,GAGL2B,EAAAC,cAACE,EACCG,EAAA,CAAAT,KAAK,WACDD,EAAa,CACjB9B,UAC2B,OAAzB2B,QAAQC,IAAIC,SACR,wDACA,kDAENU,QApDgB,WACpB7B,GAAaA,GAEf,EAkDM4B,YAAa,IAEZjC,IAmBP,OAbE6B,EAAAC,cAACC,EAAK,CAAApC,UAAWsB,GACfY,EAAAC,cAACM,EAAO,MACRP,EAAAC,cAACO,EAAa,CAACC,GAAI3B,EAAa4B,QAAS,IAAKrB,WAAW,SACvDW,EAAAC,cAACC,EAAI,CAACpC,UAAU,yBACdkC,EAAAC,cAACC,EAAK,CAAApC,UAAU,gCAAgCH,GAChDqC,EAAAC,cAACC,EAAK,CAAApC,UAAU,iCAAiCF,GAChDW,GACCyB,EAAAC,cAACC,EAAI,CAACpC,UAAU,gCAAgCiC,KAO5D"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e}from"../node_modules/tslib/tslib.es6.js";import t,{createContext as r}from"react";var o=r(e({},{})),n=function(e){var r=e.children,n=e.value,l=e.scoped,c=r;return void 0!==l&&l?c=t.Children.map(r,(function(e,r){return 0===r?t.cloneElement(e,{style:n}):e})):Object.keys(n).forEach((function(e){document.body.style.setProperty(e,n[e])})),t.createElement(o.Provider,{value:n},c)};export{o as ThemeContext,n as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/ThemeProvider/index.tsx"],"sourcesContent":["import React, { createContext } from \"react\";\n\nexport type ThemeValue = {\n \"--color-primary\"?: string;\n \"--color-primary-dark\"?: string;\n \"--color-primary-reverse\"?: string;\n \"--color-disabled\"?: string;\n \"--color-warning\"?: string;\n \"--color-warning-light\"?: string;\n \"--background-color\"?: string;\n \"--body-background-color\"?: string;\n \"--font-color\"?: string;\n \"--font-color-secondary\"?: string;\n \"--font-color-tertiary\"?: string;\n \"--border-color\"?: string;\n \"--btn-color\"?: string;\n \"--btn-shadow-primary\"?: string;\n \"--mask-color\"?: string;\n};\n\nexport type ThemeProviderProps = {\n value: ThemeValue;\n scoped?: boolean;\n};\n\nconst createTheme = (theme: { [key: string]: string }) => {\n return createContext({ ...theme });\n};\n\nexport const ThemeContext = createTheme({});\n\nconst ThemeProvider: React.FC<ThemeProviderProps> = ({\n children,\n value,\n scoped = false,\n}) => {\n let clonedElement = children;\n if (!scoped) {\n Object.keys(value).forEach(key => {\n document.body.style.setProperty(key, value[key]);\n });\n } else {\n clonedElement = React.Children.map(children, (child, index) => {\n if (index === 0) {\n return React.cloneElement(child as any, {\n style: value,\n });\n } else {\n return child;\n }\n });\n }\n\n return (\n <ThemeContext.Provider value={value}>{clonedElement}</ThemeContext.Provider>\n );\n};\n\nexport default ThemeProvider;\n"],"names":["ThemeContext","createContext","__assign","ThemeProvider","_a","children","value","_b","clonedElement","React","Children","map","child","index","cloneElement","style","Object","keys","forEach","key","document","body","setProperty","createElement","Provider"],"mappings":"uGAyBA,IAIaA,EAHJC,EAAaC,EAAA,GAGkB,KAElCC,EAA8C,SAACC,OACnDC,EAAQD,EAAAC,SACRC,EAAKF,EAAAE,MACLC,WAEIC,EAAgBH,EAiBpB,YAnBS,IAAAE,GAAKA,EAQZC,EAAgBC,EAAMC,SAASC,IAAIN,GAAU,SAACO,EAAOC,GACnD,OAAc,IAAVA,EACKJ,EAAMK,aAAaF,EAAc,CACtCG,MAAOT,IAGFM,CAEX,IAZAI,OAAOC,KAAKX,GAAOY,SAAQ,SAAAC,GACzBC,SAASC,KAAKN,MAAMO,YAAYH,EAAKb,EAAMa,GAC7C,IAcAV,EAAAc,cAACvB,EAAawB,SAAQ,CAAClB,MAAOA,GAAQE,EAE1C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{default as XHButton}from"../Button/index.js";export{default as XHPage}from"../Page/index.js";export{default as XHLoading}from"../Loading/index.js";export{default as XHBankIcon}from"../BankIcon/index.js";export{default as XHCaptcha}from"../Captcha/index.js";export{default as XHFormInput}from"../FormInput/index.js";export{default as XHList}from"../List/index.js";export{default as XHMask}from"../Mask/index.js";export{default as XHImage}from"../Image/index.js";export{default as XHDialog}from"../Dialog/index.js";export{default as XHNumberKeyboard}from"../NumberKeyboard/index.js";export{default as XHPasswordInput}from"../PasswordInput/index.js";export{default as XHProgress}from"../Progress/index.js";export{default as XHToast}from"../Toast/index.js";export{default as XHDialogRef}from"../DialogRef/index.js";export{default as XHTabbar}from"../Tabbar/index.js";export{default as XHPopup}from"../Popup/index.js";export{default as XHPicker}from"../Picker/index.js";
|
|
1
|
+
export{default as XHButton}from"../Button/index.js";export{default as XHPage}from"../Page/index.js";export{default as XHLoading}from"../Loading/index.js";export{default as XHBankIcon}from"../BankIcon/index.js";export{default as XHCaptcha}from"../Captcha/index.js";export{default as XHFormInput}from"../FormInput/index.js";export{default as XHList}from"../List/index.js";export{default as XHMask}from"../Mask/index.js";export{default as XHImage}from"../Image/index.js";export{default as XHDialog}from"../Dialog/index.js";export{default as XHNumberKeyboard}from"../NumberKeyboard/index.js";export{default as XHPasswordInput}from"../PasswordInput/index.js";export{default as XHProgress}from"../Progress/index.js";export{default as XHToast}from"../Toast/index.js";export{default as XHDialogRef}from"../DialogRef/index.js";export{default as XHTabbar}from"../Tabbar/index.js";export{default as XHPopup}from"../Popup/index.js";export{default as XHPicker}from"../Picker/index.js";export{default as ThemeProvider}from"../ThemeProvider/index.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|