taro-react-uilib 1.4.24-2 → 1.4.24-4
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/components/BankIcon/index.js.map +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Cell/index.js +1 -1
- package/dist/components/Cell/index.js.map +1 -1
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/DialogComponent/index.js +1 -1
- package/dist/components/DialogComponent/index.js.map +1 -1
- package/dist/components/Image/index.js +1 -1
- package/dist/components/Image/index.js.map +1 -1
- package/dist/components/Loading/index.js +1 -1
- package/dist/components/Loading/index.js.map +1 -1
- package/dist/components/Radio/index.js +1 -1
- package/dist/components/Radio/index.js.map +1 -1
- package/dist/components/ThemeProvider/index.js +1 -1
- package/dist/components/ThemeProvider/index.js.map +1 -1
- package/dist/components/src/index.js +1 -1
- package/dist/index.esm.js +5 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/styles/components/badge.scss +1 -2
- package/dist/styles/components/cell.scss +4 -9
- package/dist/styles/components/checkbox.scss +15 -9
- package/dist/styles/components/dialog.scss +31 -12
- package/dist/styles/components/dialogref.scss +2 -1
- package/dist/styles/components/index.scss +0 -1
- package/dist/styles/components/loading.scss +6 -1
- package/dist/styles/components/radio.scss +15 -9
- package/package.json +1 -5
- package/types/components/BankIcon/index.d.ts +1 -2
- package/types/components/Checkbox/index.d.ts +4 -0
- package/types/components/Loading/index.d.ts +0 -1
- package/types/components/Radio/index.d.ts +4 -0
- package/types/index.d.ts +0 -1
- package/CHANGELOG.md +0 -1543
- package/dist/components/Curtain/index.js +0 -2
- package/dist/components/Curtain/index.js.map +0 -1
- package/dist/styles/components/curtain.scss +0 -105
- package/dist/styles/components/font/.DS_Store +0 -0
- package/types/.DS_Store +0 -0
- package/types/components/Curtain/index.d.ts +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/BankIcon/index.tsx"],"sourcesContent":["import React, { FC } from \"react\";\nimport classNames from \"classnames\";\n\nimport Image from \"../../../src/components/Image\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport \"./index.scss\";\n\nexport type
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/BankIcon/index.tsx"],"sourcesContent":["import React, { FC } from \"react\";\nimport classNames from \"classnames\";\n\nimport Image from \"../../../src/components/Image\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport \"./index.scss\";\n\nexport type XHListProps = {\n code: string;\n size?: number;\n} & XHComponentCommonProps;\n\nconst BANKCARD_URL =\n \"https://s.xh1.cn/resources/images/bank/logo-2.0.0/placeholder.png\";\n\nconst XHBankIcon: FC<XHListProps> = props => {\n const { code, className, size } = props;\n\n const cls = classNames(\"xh-bank-icon\", className);\n\n return (\n <Image\n src={BANKCARD_URL.replace(\"placeholder\", code)}\n alt={code}\n width={size}\n height={size}\n className={cls}\n />\n );\n};\nexport default XHBankIcon;\n"],"names":["XHBankIcon","props","code","className","size","cls","classNames","React","createElement","Image","src","replace","alt","width","height"],"mappings":"gFAYA,IAGMA,EAA8B,SAAAC,GAC1B,IAAAC,EAA0BD,EAAKC,KAAzBC,EAAoBF,EAAKE,UAAdC,EAASH,OAE5BI,EAAMC,EAAW,eAAgBH,GAEvC,OACEI,EAAAC,cAACC,EAAK,CACJC,IATJ,oEASsBC,QAAQ,cAAeT,GACzCU,IAAKV,EACLW,MAAOT,EACPU,OAAQV,EACRD,UAAWE,GAGjB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__read as e}from"../node_modules/tslib/tslib.es6.js";import o,{useState as n,useRef as t,useEffect as r}from"react";import a from"classnames";import{Button as s}from"@tarojs/components";import{useTaroEnv as l}from"../src/hooks/index.js";import i from"./DotJump.js";var m=function(m){var d=m.disabled,p=void 0!==d&&d,c=m.type,u=void 0===c?"default":c,g=m.size,f=void 0===g?"normal":g,y=m.shape,h=void 0===y?"round":y,v=m.children,b=m.className,T=m.htmlType,E=m.formType,P=m.text,M=m.openType,w=m.lang,C=m.sessionFrom,I=m.sendMessageTitle,N=m.sendMessagePath,j=m.sendMessageImg,k=m.showMessageCard,x=m.appParameter,G=m.onGetUserInfo,S=m.onGetPhoneNumber,W=m.onOpenSetting,q=m.onError,B=m.onContact,D=m.onClick,F=m.preventTime,O=void 0===F?2500:F,U=m.style,z=m.loading,A=m.loadingStyle,J=m.loadingSpace,_=m.ghost,H=void 0!==_&&_,K=m.hollow,L=void 0!==K&&K,Q=l(),R=e(n(!1),2),V=R[0],X=R[1],Y=t(),Z=a("xh-button",{default:"default"===u,primary:"primary"===u,secondary:"secondary"===u,ghost:H,hollow:L,warn:"warn"===u,
|
|
1
|
+
import{__read as e}from"../node_modules/tslib/tslib.es6.js";import o,{useState as n,useRef as t,useEffect as r}from"react";import a from"classnames";import{Button as s}from"@tarojs/components";import{useTaroEnv as l}from"../src/hooks/index.js";import i from"./DotJump.js";var m=function(m){var d=m.disabled,p=void 0!==d&&d,c=m.type,u=void 0===c?"default":c,g=m.size,f=void 0===g?"normal":g,y=m.shape,h=void 0===y?"round":y,v=m.children,b=m.className,T=m.htmlType,E=m.formType,P=m.text,M=m.openType,w=m.lang,C=m.sessionFrom,I=m.sendMessageTitle,N=m.sendMessagePath,j=m.sendMessageImg,k=m.showMessageCard,x=m.appParameter,G=m.onGetUserInfo,S=m.onGetPhoneNumber,W=m.onOpenSetting,q=m.onError,B=m.onContact,D=m.onClick,F=m.preventTime,O=void 0===F?2500:F,U=m.style,z=m.loading,A=m.loadingStyle,J=m.loadingSpace,_=m.ghost,H=void 0!==_&&_,K=m.hollow,L=void 0!==K&&K,Q=l(),R=e(n(!1),2),V=R[0],X=R[1],Y=t(),Z=a("xh-button",{default:"default"===u,primary:"primary"===u,secondary:"secondary"===u,ghost:H,hollow:L,warn:"warn"===u,quare:"square"===h,round:"round"===h,rectangle:"rectangle"===h,normal:"normal"===f,small:"mini"===f,full:"full"===f,disabled:p,webutton:"WEAPP"===Q},b),$=function(e){"WEB"===Q&&e.nativeEvent.stopImmediatePropagation(),e.preventDefault(),V&&0!==O||(0!==O&&(Y.current=setTimeout((function(){X(!1),clearTimeout(Y.current)}),O)),0!==O&&X(!0),D&&D(e))};r((function(){return function(){clearTimeout(Y.current)}}),[]);var ee=o.createElement(s,{className:Z,formType:E,openType:M,lang:w,type:u,sessionFrom:C,sendMessageTitle:I,sendMessagePath:N,sendMessageImg:j,showMessageCard:k,appParameter:x,onGetUserInfo:G,onGetPhoneNumber:S,onOpenSetting:W,onError:q,onContact:B,onClick:$,disabled:p,style:U,loading:z},v);return"WEB"!==Q?ee:o.createElement("button",{className:Z,disabled:p,type:T,onClick:p?void 0:$,style:U},v||P,z&&o.createElement(i,{style:A,space:J}))};export{m 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\";\nimport DotJump from \"./DotJump\";\n\nexport type ButtonType = \"default\" | \"secondary\" | \"primary\" | \"warn\";\n\nexport type ButtonShape = \"square\" | \"round\" | \"rectangle\";\n\nexport type ButtonSize = \"default\" | \"mini\" | \"full\";\n\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 loading?: boolean;\n loadingStyle?: React.CSSProperties;\n loadingSpace?: number;\n ghost?: boolean;\n /**\n * 镂空\n */\n hollow?: boolean;\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 loading,\n loadingStyle,\n loadingSpace,\n ghost = false,\n hollow = false,\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 default: type === \"default\",\n primary: type === \"primary\",\n secondary: type === \"secondary\",\n ghost: ghost,\n hollow: hollow,\n warn: type === \"warn\",\n
|
|
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\";\nimport DotJump from \"./DotJump\";\n\nexport type ButtonType = \"default\" | \"secondary\" | \"primary\" | \"warn\";\n\nexport type ButtonShape = \"square\" | \"round\" | \"rectangle\";\n\nexport type ButtonSize = \"default\" | \"mini\" | \"full\";\n\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 loading?: boolean;\n loadingStyle?: React.CSSProperties;\n loadingSpace?: number;\n ghost?: boolean;\n /**\n * 镂空\n */\n hollow?: boolean;\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 loading,\n loadingStyle,\n loadingSpace,\n ghost = false,\n hollow = false,\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 default: type === \"default\",\n primary: type === \"primary\",\n secondary: type === \"secondary\",\n ghost: ghost,\n hollow: hollow,\n warn: type === \"warn\",\n quare: shape === \"square\",\n round: shape === \"round\",\n rectangle: shape === \"rectangle\",\n normal: size === \"normal\",\n small: size === \"mini\",\n full: size === \"full\",\n disabled: disabled,\n 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 loading={loading}\n >\n {children}\n </Button>\n );\n\n if (state !== \"WEB\") {\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 {loading && <DotJump style={loadingStyle} space={loadingSpace} />}\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","loading","loadingStyle","loadingSpace","_f","ghost","_g","hollow","state","useTaroEnv","_h","__read","useState","preventClick","setPreventClick","timer","useRef","classObj","classNames","default","primary","secondary","warn","quare","round","rectangle","normal","small","full","webutton","handleClick","e","nativeEvent","stopImmediatePropagation","preventDefault","current","setTimeout","clearTimeout","useEffect","weButton","React","Button","createElement","undefined","DotJump","space"],"mappings":"gRA+CM,IAAAA,EAA8B,SAAAC,GAEhC,IAAAC,EA8BED,EAAKE,SA9BPA,OAAQ,IAAAD,GAAQA,EAChBE,EA6BEH,OA7BFI,aAAO,UAASD,EAChBE,EA4BEL,EA5BaM,KAAfA,OAAO,IAAAD,EAAA,WACPE,EA2BEP,EA3BaQ,MAAfA,OAAQ,IAAAD,EAAA,UACRE,EA0BET,EAAKS,SAzBPC,EAyBEV,EAAKU,UAxBPC,EAwBEX,EAxBMW,SACRC,EAuBEZ,EAvBMY,SACRC,EAsBEb,OArBFc,EAqBEd,EAAKc,SApBPC,EAoBEf,EAAKe,KAnBPC,EAmBEhB,EAnBSgB,YACXC,EAkBEjB,mBAjBFkB,EAiBElB,EAAKkB,gBAhBPC,EAgBEnB,EAAKmB,eAfPC,EAeEpB,EAfaoB,gBACfC,EAcErB,EAdUqB,aACZC,EAaEtB,gBAZFuB,EAYEvB,EAAKuB,iBAXPC,EAWExB,EAAKwB,cAVPC,EAUEzB,EAVKyB,QACPC,EASE1B,YARF2B,EAQE3B,EAAK2B,QAPPC,EAOE5B,EAPgB6B,YAAlBA,OAAc,IAAAD,EAAA,OACdE,EAME9B,EAAK8B,MALPC,EAKE/B,EALK+B,QACPC,EAIEhC,eAHFiC,EAGEjC,eAFFkC,EAEElC,EAFWmC,MAAbA,OAAQ,IAAAD,KACRE,EACEpC,EADYqC,OAAdA,OAAS,IAAAD,KAELE,EAAQC,IACRC,EAAAC,EAAkCC,GAAS,GAAM,GAAhDC,EAAYH,EAAA,GAAEI,OACfC,EAAQC,IACRC,EAAWC,EACf,YACA,CACEC,QAAkB,YAAT7C,EACT8C,QAAkB,YAAT9C,EACT+C,UAAoB,cAAT/C,EACX+B,MAAOA,EACPE,OAAQA,EACRe,KAAe,SAAThD,EACNiD,MAAiB,WAAV7C,EACP8C,MAAiB,UAAV9C,EACP+C,UAAqB,cAAV/C,EACXgD,OAAiB,WAATlD,EACRmD,MAAgB,SAATnD,EACPoD,KAAe,SAATpD,EACNJ,SAAUA,EACVyD,SAAoB,UAAVrB,GAEZ5B,GAGIkD,EAAsD,SAAAC,GAChD,QAAVvB,GAAmBuB,EAAEC,YAAYC,2BACjCF,EAAEG,iBAEErB,GAAgC,IAAhBd,IAIA,IAAhBA,IACFgB,EAAMoB,QAAUC,YAAW,WACzBtB,GAAgB,GAChBuB,aAAatB,EAAMoB,QACpB,GAAEpC,IAEe,IAAhBA,GAAmBe,GAAgB,GAEvCjB,GAAWA,EAAQkC,GACrB,EAEAO,GAAU,WACR,OAAO,WACLD,aAAatB,EAAMoB,QACrB,CACD,GAAE,IAEH,IAAMI,GACJC,gBAACC,EAAM,CACL7D,UAAWqC,EACXnC,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,QAASiC,EACT1D,SAAUA,EACV4B,MAAOA,EACPC,QAASA,GAERtB,GAIL,MAAc,QAAV6B,EACK+B,GAKPC,EACEE,cAAA,SAAA,CAAA9D,UAAWqC,EACX7C,SAAUA,EACVE,KAAMO,EACNgB,QAASzB,OAAWuE,EAAYb,EAChC9B,MAAOA,GAENrB,GAAYI,EACZkB,GAAWuC,EAAAE,cAACE,EAAO,CAAC5C,MAAOE,EAAc2C,MAAO1C,IAGvD"}
|
|
@@ -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(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:
|
|
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 && <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
|
|
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{__read as e}from"../node_modules/tslib/tslib.es6.js";import
|
|
1
|
+
import{__read as e}from"../node_modules/tslib/tslib.es6.js";import c,{useState as a}from"react";import t from"classnames";import{View as o}from"@tarojs/components";import s from"../src/hooks/useGenerateId.js";import{pxTransform as l}from"../src/utils/index.js";import i from"./Group/index.js";import n from"../Icon/index.js";var r=function(i){var r=i.className,m=i.name,h=i.label,d=i.id,u=i.circle,p=i.onChange,x=i.align,k=i.direction,b=i.justify,f=i.checked,v=i.disabled,N=i.value,E=void 0===N?"":N,g=i.style,j=i.size,y=void 0===j?0:j,F=i.iconColor,C=void 0===F?"#FFFFFF":F,_=s(d,"xh-checkbox-id"),z=e(a(f||!1),2),A=z[0],G=z[1],O=t("xh-checkbox",r,x,k,b,{h5:"h5"===process.env.TARO_ENV});return"h5"!==process.env.TARO_ENV?c.createElement(o,{onClick:function(){v||(G(!A),null==p||p(!A,E))},className:O,style:g},c.createElement(o,{className:t("xh-checkbox-input",{checked:A,disabled:v})}," "),c.createElement("span",{style:y>0?{width:l(y),height:l(y)}:{},className:t("xh-checkbox-input-fake",u&&"circle")},c.createElement(n,{icon:"duigou",className:"xh-checkbox-input-fake-icon",color:C,size:y?.55*y:22})),c.createElement("span",{className:"xh-radio-label"},h)):c.createElement("label",{htmlFor:_,className:O,style:g},c.createElement("input",{type:"checkbox",id:_,name:m,className:"xh-checkbox-input",onChange:function(e){var c=f||!1,a="";"h5"===process.env.TARO_ENV?(c=e.target.checked,a=e.target.value):(c=e.detail.value.length>0,a=e.detail.value[0]),p&&p(c,a)},value:E,defaultChecked:f}),c.createElement("span",{style:y>0?{width:l(y),height:l(y)}:{},className:t("xh-checkbox-input-fake",u&&"circle")},c.createElement(n,{icon:"duigou",className:"xh-checkbox-input-fake-icon",color:C,size:y?.55*y:22})),c.createElement("span",{className:"xh-checkbox-label"},h))};r.Group=i;export{r as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Checkbox/index.tsx"],"sourcesContent":["import React, { FC, ReactNode, useState } from \"react\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport useGenerateId from \"@/hooks/useGenerateId\";\nimport { pxTransform } from \"@/utils\";\nimport Group from \"./Group\";\nimport \"./index.scss\";\nimport type { XHComponentCommonProps } from \"../../types\";\n\ntype CompoundedComponent = React.ForwardRefExoticComponent<\n XHCheckboxProps & React.RefAttributes<HTMLInputElement>\n> & {\n Group: typeof Group;\n};\n\nexport type XHCheckboxProps = {\n onChange?: (check: boolean, value: string) => void;\n checked?: boolean;\n name?: string;\n label: string | ReactNode;\n size?: number;\n circle?: boolean;\n align?: \"center\" | \"end\";\n direction?: \"rtl\";\n justify?: \"around\" | \"between\";\n value?: string | number;\n id?: string;\n disabled?: boolean;\n style?: React.CSSProperties;\n /**\n * 抖音不支持属性选择器\n * @description 主要为抖音支持颜色\n */\n color?: string;\n} & XHComponentCommonProps;\n\nconst XHCheckbox: FC<XHCheckboxProps> = props => {\n const {\n className,\n name,\n label,\n id,\n circle,\n onChange,\n align,\n direction,\n justify,\n checked,\n disabled,\n value = \"\",\n style,\n size = 0,\n } = props;\n\n const finalId = useGenerateId(id, \"xh-checkbox-id\");\n const [innerChecked, setInnerChecked] = useState(checked || false);\n\n const handleOnchange = e => {\n let finalchecked = checked || false;\n let value = \"\";\n if (process.env.TARO_ENV === \"h5\") {\n finalchecked = e.target.checked;\n value = e.target.value;\n } else {\n finalchecked = e.detail.value.length > 0;\n value = e.detail.value[0];\n }\n onChange && onChange(finalchecked, value);\n };\n\n const handleFakeChange = () => {\n if (disabled) return;\n setInnerChecked(!innerChecked);\n onChange?.(!innerChecked, value as string);\n };\n\n const cls = classNames(\"xh-checkbox\", className, align, direction, justify, {\n h5: process.env.TARO_ENV === \"h5\",\n });\n if (process.env.TARO_ENV !== \"h5\") {\n return (\n <View onClick={handleFakeChange} className={cls} style={style}>\n <View\n className={classNames(\"xh-checkbox-input\", {\n checked: innerChecked,\n disabled,\n })}\n >\n {\" \"}\n </View>\n <span\n style={\n size > 0\n ? {\n width: pxTransform(size),\n height: pxTransform(size),\n }\n : {}\n }\n className={classNames(\"xh-checkbox-input-fake\", circle && \"circle\")}\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Checkbox/index.tsx"],"sourcesContent":["import React, { FC, ReactNode, useState } from \"react\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport useGenerateId from \"@/hooks/useGenerateId\";\nimport { pxTransform } from \"@/utils\";\nimport Group from \"./Group\";\nimport \"./index.scss\";\nimport type { XHComponentCommonProps } from \"../../types\";\nimport Icon from \"../Icon\";\n\ntype CompoundedComponent = React.ForwardRefExoticComponent<\n XHCheckboxProps & React.RefAttributes<HTMLInputElement>\n> & {\n Group: typeof Group;\n};\n\nexport type XHCheckboxProps = {\n onChange?: (check: boolean, value: string) => void;\n checked?: boolean;\n name?: string;\n label: string | ReactNode;\n size?: number;\n circle?: boolean;\n align?: \"center\" | \"end\";\n direction?: \"rtl\";\n justify?: \"around\" | \"between\";\n value?: string | number;\n id?: string;\n disabled?: boolean;\n style?: React.CSSProperties;\n /**\n * 抖音不支持属性选择器\n * @description 主要为抖音支持颜色\n */\n color?: string;\n /**\n * 选中状态下打勾icon的颜色\n */\n iconColor?: string;\n} & XHComponentCommonProps;\n\nconst XHCheckbox: FC<XHCheckboxProps> = props => {\n const {\n className,\n name,\n label,\n id,\n circle,\n onChange,\n align,\n direction,\n justify,\n checked,\n disabled,\n value = \"\",\n style,\n size = 0,\n iconColor = \"#FFFFFF\",\n } = props;\n\n const finalId = useGenerateId(id, \"xh-checkbox-id\");\n const [innerChecked, setInnerChecked] = useState(checked || false);\n\n const handleOnchange = e => {\n let finalchecked = checked || false;\n let value = \"\";\n if (process.env.TARO_ENV === \"h5\") {\n finalchecked = e.target.checked;\n value = e.target.value;\n } else {\n finalchecked = e.detail.value.length > 0;\n value = e.detail.value[0];\n }\n onChange && onChange(finalchecked, value);\n };\n\n const handleFakeChange = () => {\n if (disabled) return;\n setInnerChecked(!innerChecked);\n onChange?.(!innerChecked, value as string);\n };\n\n const cls = classNames(\"xh-checkbox\", className, align, direction, justify, {\n h5: process.env.TARO_ENV === \"h5\",\n });\n if (process.env.TARO_ENV !== \"h5\") {\n return (\n <View onClick={handleFakeChange} className={cls} style={style}>\n <View\n className={classNames(\"xh-checkbox-input\", {\n checked: innerChecked,\n disabled,\n })}\n >\n {\" \"}\n </View>\n <span\n style={\n size > 0\n ? {\n width: pxTransform(size),\n height: pxTransform(size),\n }\n : {}\n }\n className={classNames(\"xh-checkbox-input-fake\", circle && \"circle\")}\n >\n <Icon\n icon=\"duigou\"\n className=\"xh-checkbox-input-fake-icon\"\n color={iconColor}\n size={size ? size * 0.55 : 22}\n />\n </span>\n <span className=\"xh-radio-label\">{label}</span>\n </View>\n );\n }\n\n return (\n <label htmlFor={finalId} className={cls} style={style}>\n <input\n type=\"checkbox\"\n id={finalId}\n name={name}\n className=\"xh-checkbox-input\"\n onChange={handleOnchange}\n value={value}\n defaultChecked={checked}\n />\n <span\n style={\n size > 0\n ? {\n width: pxTransform(size),\n height: pxTransform(size),\n }\n : {}\n }\n className={classNames(\"xh-checkbox-input-fake\", circle && \"circle\")}\n >\n <Icon\n icon=\"duigou\"\n className=\"xh-checkbox-input-fake-icon\"\n color={iconColor}\n size={size ? size * 0.55 : 22}\n />\n </span>\n <span className=\"xh-checkbox-label\">{label}</span>\n </label>\n );\n};\n\nconst CheckBox = XHCheckbox as CompoundedComponent;\nCheckBox.Group = Group;\n\nexport default CheckBox;\n"],"names":["CheckBox","props","className","name","label","id","circle","onChange","align","direction","justify","checked","disabled","_a","value","style","_b","size","_c","iconColor","finalId","useGenerateId","_d","__read","useState","innerChecked","setInnerChecked","cls","classNames","h5","process","env","TARO_ENV","React","createElement","View","onClick","width","pxTransform","height","Icon","icon","color","htmlFor","type","e","finalchecked","target","detail","length","defaultChecked","Group"],"mappings":"qUAyCA,IAgHMA,EAhHkC,SAAAC,GAEpC,IAAAC,EAeED,YAdFE,EAcEF,EAAKE,KAbPC,EAaEH,EAAKG,MAZPC,EAYEJ,EAZAI,GACFC,EAWEL,EAXIK,OACNC,EAUEN,WATFO,EASEP,EAAKO,MARPC,EAQER,EAROQ,UACTC,EAOET,EAPKS,QACPC,EAMEV,UALFW,EAKEX,EAAKW,SAJPC,EAIEZ,EAJQa,MAAVA,OAAQ,IAAAD,EAAA,KACRE,EAGEd,QAFFe,EAEEf,EAFMgB,KAARA,OAAO,IAAAD,EAAA,IACPE,EACEjB,EADmBkB,UAArBA,OAAY,IAAAD,EAAA,YAGRE,EAAUC,EAAchB,EAAI,kBAC5BiB,EAAAC,EAAkCC,EAASb,IAAW,GAAM,GAA3Dc,EAAYH,EAAA,GAAEI,OAqBfC,EAAMC,EAAW,cAAe1B,EAAWM,EAAOC,EAAWC,EAAS,CAC1EmB,GAA6B,OAAzBC,QAAQC,IAAIC,WAElB,MAA6B,OAAzBF,QAAQC,IAAIC,SAEZC,EAAAC,cAACC,EAAI,CAACC,QAXe,WACnBxB,IACJc,GAAiBD,GACjBlB,SAAAA,GAAYkB,EAAcX,GAC5B,EAOqCZ,UAAWyB,EAAKZ,MAAOA,GACtDkB,EAAAC,cAACC,EACC,CAAAjC,UAAW0B,EAAW,oBAAqB,CACzCjB,QAASc,EACTb,SAAQA,KAGT,KAEHqB,EAAAC,cAAA,OAAA,CACEnB,MACEE,EAAO,EACH,CACEoB,MAAOC,EAAYrB,GACnBsB,OAAQD,EAAYrB,IAEtB,CAAE,EAERf,UAAW0B,EAAW,yBAA0BtB,GAAU,WAE1D2B,EAAAC,cAACM,EAAI,CACHC,KAAK,SACLvC,UAAU,8BACVwC,MAAOvB,EACPF,KAAMA,EAAc,IAAPA,EAAc,MAG/BgB,EAAMC,cAAA,OAAA,CAAAhC,UAAU,kBAAkBE,IAMtC6B,EAAAC,cAAA,QAAA,CAAOS,QAASvB,EAASlB,UAAWyB,EAAKZ,MAAOA,GAC9CkB,EACEC,cAAA,QAAA,CAAAU,KAAK,WACLvC,GAAIe,EACJjB,KAAMA,EACND,UAAU,oBACVK,SA/DiB,SAAAsC,GACrB,IAAIC,EAAenC,IAAW,EAC1BG,EAAQ,GACiB,OAAzBgB,QAAQC,IAAIC,UACdc,EAAeD,EAAEE,OAAOpC,QACxBG,EAAQ+B,EAAEE,OAAOjC,QAEjBgC,EAAeD,EAAEG,OAAOlC,MAAMmC,OAAS,EACvCnC,EAAQ+B,EAAEG,OAAOlC,MAAM,IAEzBP,GAAYA,EAASuC,EAAchC,EACrC,EAqDMA,MAAOA,EACPoC,eAAgBvC,IAElBsB,EAAAC,cAAA,OAAA,CACEnB,MACEE,EAAO,EACH,CACEoB,MAAOC,EAAYrB,GACnBsB,OAAQD,EAAYrB,IAEtB,CAAE,EAERf,UAAW0B,EAAW,yBAA0BtB,GAAU,WAE1D2B,EAAAC,cAACM,EAAI,CACHC,KAAK,SACLvC,UAAU,8BACVwC,MAAOvB,EACPF,KAAMA,EAAc,IAAPA,EAAc,MAG/BgB,EAAMC,cAAA,OAAA,CAAAhC,UAAU,qBAAqBE,GAG3C,EAGAJ,EAASmD,MAAQA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__read as e}from"../node_modules/tslib/tslib.es6.js";import t,{forwardRef as o,useState as a,useImperativeHandle as n,useEffect as r}from"react";import s from"react-dom";import m from"classnames";import{View as c}from"@tarojs/components";import l from"../Mask/index.js";import i from"../node_modules/react-transition-group/esm/CSSTransition.js";var d=o((function(o,d){var u=o.header,f=o.content,p=o.footer,h=o.className,E=void 0===h?"":h,x=o.visible,N=e(a(!1),2),g=N[0],v=N[1];n(d,(function(){return{close:function(){v(!1)}}})),r((function(){v(x)}),[x]);var b=m("xh-dialog",E,{microApp:"h5"!==process.env.TARO_ENV}),j=m("xh-dialog-content-content",{headless:!u}),_=t.createElement(c,{className:b},t.createElement(l,null),t.createElement(i,{in:g,timeout:200,classNames:"scale",unmountOnExit:!0},t.createElement(c,{className:"xh-dialog-content"},t.createElement(c,{className:"xh-dialog-content-header"},u),t.createElement(c,{className:j},f),t.createElement(c,{className:"xh-dialog-content-footer"},p))));return s.createPortal(_,document.body)}));export{d as default};
|
|
1
|
+
import{__read as e}from"../node_modules/tslib/tslib.es6.js";import t,{forwardRef as o,useState as a,useImperativeHandle as n,useEffect as r}from"react";import s from"react-dom";import m from"classnames";import{View as c}from"@tarojs/components";import l from"../Mask/index.js";import i from"../node_modules/react-transition-group/esm/CSSTransition.js";var d=o((function(o,d){var u=o.header,f=o.content,p=o.footer,h=o.className,E=void 0===h?"":h,x=o.visible,N=e(a(!1),2),g=N[0],v=N[1];n(d,(function(){return{close:function(){v(!1)}}})),r((function(){v(x)}),[x]);var b=m("xh-dialog",E,{microApp:"h5"!==process.env.TARO_ENV}),j=m("xh-dialog-content-content",{headless:!u}),_=t.createElement(c,{className:b},t.createElement(l,null),t.createElement(i,{in:g,timeout:200,classNames:"scale",unmountOnExit:!0},t.createElement(c,{className:"xh-dialog-content"},u&&t.createElement(c,{className:"xh-dialog-content-header"},u),t.createElement(c,{className:j},f),t.createElement(c,{className:"xh-dialog-content-footer"},p))));return s.createPortal(_,document.body)}));export{d as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/DialogComponent/index.tsx"],"sourcesContent":["import React, {\n ReactNode,\n useState,\n useImperativeHandle,\n forwardRef,\n useEffect,\n} from \"react\";\nimport ReactDOM from \"react-dom\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport { CSSTransition } from \"react-transition-group\";\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?: string | ReactNode;\n visible: boolean;\n} & XHComponentCommonProps;\n\nexport type DialogRef = {\n close: () => void;\n};\nconst DialogCom = forwardRef<DialogRef, DialogProps>((props, fromRef) => {\n const { header, content, footer, className = \"\", visible } = props;\n const [selfVisible, setSelfVisible] = useState(false);\n\n useImperativeHandle(fromRef, () => ({\n close: () => {\n console.log(\"closes\");\n setSelfVisible(false);\n },\n }));\n\n useEffect(() => {\n setSelfVisible(visible);\n }, [visible]);\n\n const dialogcls = classNames(\"xh-dialog\", className, {\n microApp: process.env.TARO_ENV !== \"h5\",\n });\n\n const dialogContent = classNames(\"xh-dialog-content-content\", {\n headless: !header,\n });\n const DialogMain = (\n <View className={dialogcls}>\n <Mask />\n <CSSTransition\n in={selfVisible}\n timeout={200}\n classNames=\"scale\"\n unmountOnExit\n >\n <View className=\"xh-dialog-content\">\n <View className=\"xh-dialog-content-header\">{header}</View
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/DialogComponent/index.tsx"],"sourcesContent":["import React, {\n ReactNode,\n useState,\n useImperativeHandle,\n forwardRef,\n useEffect,\n} from \"react\";\nimport ReactDOM from \"react-dom\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport { CSSTransition } from \"react-transition-group\";\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?: string | ReactNode;\n visible: boolean;\n} & XHComponentCommonProps;\n\nexport type DialogRef = {\n close: () => void;\n};\nconst DialogCom = forwardRef<DialogRef, DialogProps>((props, fromRef) => {\n const { header, content, footer, className = \"\", visible } = props;\n const [selfVisible, setSelfVisible] = useState(false);\n\n useImperativeHandle(fromRef, () => ({\n close: () => {\n console.log(\"closes\");\n setSelfVisible(false);\n },\n }));\n\n useEffect(() => {\n setSelfVisible(visible);\n }, [visible]);\n\n const dialogcls = classNames(\"xh-dialog\", className, {\n microApp: process.env.TARO_ENV !== \"h5\",\n });\n\n const dialogContent = classNames(\"xh-dialog-content-content\", {\n headless: !header,\n });\n const DialogMain = (\n <View className={dialogcls}>\n <Mask />\n <CSSTransition\n in={selfVisible}\n timeout={200}\n classNames=\"scale\"\n unmountOnExit\n >\n <View className=\"xh-dialog-content\">\n {header && <View className=\"xh-dialog-content-header\">{header}</View>}\n <View className={dialogContent}>{content}</View>\n <View className=\"xh-dialog-content-footer\">{footer}</View>\n </View>\n </CSSTransition>\n </View>\n );\n\n return ReactDOM.createPortal(DialogMain, document.body);\n});\n\nexport default DialogCom;\n"],"names":["DialogCom","forwardRef","props","fromRef","header","content","footer","_a","className","visible","_b","__read","useState","selfVisible","setSelfVisible","useImperativeHandle","close","useEffect","dialogcls","classNames","microApp","process","env","TARO_ENV","dialogContent","headless","DialogMain","React","createElement","View","Mask","CSSTransition","in","timeout","unmountOnExit","ReactDOM","createPortal","document","body"],"mappings":"gWAyBA,IAAMA,EAAYC,GAAmC,SAACC,EAAOC,GACnD,IAAAC,EAAqDF,EAAKE,OAAlDC,EAA6CH,EAAtCG,QAAEC,EAAoCJ,EAAKI,OAAjCC,EAA4BL,EAAKM,UAAjCA,OAAY,IAAAD,EAAA,GAAEA,EAAEE,EAAYP,EAAKO,QAC5DC,EAAAC,EAAgCC,GAAS,GAAM,GAA9CC,EAAWH,EAAA,GAAEI,OAEpBC,EAAoBZ,GAAS,WAAM,MAAC,CAClCa,MAAO,WAELF,GAAe,EAChB,EACD,IAEFG,GAAU,WACRH,EAAeL,EACjB,GAAG,CAACA,IAEJ,IAAMS,EAAYC,EAAW,YAAaX,EAAW,CACnDY,SAAmC,OAAzBC,QAAQC,IAAIC,WAGlBC,EAAgBL,EAAW,4BAA6B,CAC5DM,UAAWrB,IAEPsB,EACJC,EAAAC,cAACC,EAAK,CAAArB,UAAWU,GACfS,EAAAC,cAACE,EAAO,MACRH,EAAAC,cAACG,EAAa,CACZC,GAAInB,EACJoB,QAAS,IACTd,WAAW,QACXe,eAAa,GAEbP,EAAAC,cAACC,EAAI,CAACrB,UAAU,qBACbJ,GAAUuB,gBAACE,EAAI,CAACrB,UAAU,4BAA4BJ,GACvDuB,EAAAC,cAACC,EAAK,CAAArB,UAAWgB,GAAgBnB,GACjCsB,EAAAC,cAACC,EAAI,CAACrB,UAAU,4BAA4BF,MAMpD,OAAO6B,EAASC,aAAaV,EAAYW,SAASC,KACpD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as t,__read as e,__assign as s}from"../node_modules/tslib/tslib.es6.js";import r,{useState as o,useEffect as i,useMemo as c}from"react";import{Image as a}from"@tarojs/components";import{getImageInfo as m}from"@tarojs/taro";import n from"classnames";import{pxTransform as h}from"../src/utils/index.js";var l=function(l){var f=l.width,d=void 0===f?0:f,g=l.height,p=void 0===g?0:g,u=l.src,v=l.className,N=
|
|
1
|
+
import{__rest as t,__read as e,__assign as s}from"../node_modules/tslib/tslib.es6.js";import r,{useState as o,useEffect as i,useMemo as c}from"react";import{Image as a}from"@tarojs/components";import{getImageInfo as m}from"@tarojs/taro";import n from"classnames";import{pxTransform as h}from"../src/utils/index.js";var l=function(l){var f=l.width,d=void 0===f?0:f,g=l.height,p=void 0===g?0:g,u=l.src,v=l.className,N=t(l,["width","height","src","className"]),w=e(o({}),2),j=w[0],E=w[1];i((function(){"h5"===process.env.TARO_ENV||v||m({src:u,success:function(t){"getImageInfo:ok"===t.errMsg&&E({width:t.width,height:t.height})}})}),[]);var x=c((function(){var t=j||{};return d&&(t.width="".concat(h(d))),p&&(t.height="".concat(h(p))),t}),[d,p,j]),_=n("xh-image",v);return"h5"!==process.env.TARO_ENV?r.createElement(a,{src:u,style:s(s({},x),N),className:_}):r.createElement("img",s({src:u,style:x,className:_},N))};export{l as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Image/index.tsx"],"sourcesContent":["import React, { FC, useEffect, useMemo, useState } from \"react\";\nimport { Image } from \"@tarojs/components\";\nimport { getImageInfo } from \"@tarojs/taro\";\nimport classNames from \"classnames\";\n\nimport { pxTransform } from \"../../utils/index\";\nimport \"./index.scss\";\nimport { XHComponentCommonProps } from \"../../types\";\n\nexport type ImageProps = {\n width?: number;\n height?: number;\n src: string;\n alt?: string;\n style?: React.CSSProperties;\n} & XHComponentCommonProps;\n\nconst XHImage: FC<ImageProps> = props => {\n const { width = 0, height = 0, src, className,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Image/index.tsx"],"sourcesContent":["import React, { FC, useEffect, useMemo, useState } from \"react\";\nimport { Image } from \"@tarojs/components\";\nimport { getImageInfo } from \"@tarojs/taro\";\nimport classNames from \"classnames\";\n\nimport { pxTransform } from \"../../utils/index\";\nimport \"./index.scss\";\nimport { XHComponentCommonProps } from \"../../types\";\n\nexport type ImageProps = {\n width?: number;\n height?: number;\n src: string;\n alt?: string;\n style?: React.CSSProperties;\n} & XHComponentCommonProps;\n\nconst XHImage: FC<ImageProps> = props => {\n const { width = 0, height = 0, src, className, ...rest } = props;\n const [defaultSize, setDefaultSize] = useState<{\n width?: number;\n height?: number;\n }>({});\n\n useEffect(() => {\n if (process.env.TARO_ENV !== \"h5\" && !className) {\n getImageInfo({\n src,\n success: res => {\n if (res.errMsg === \"getImageInfo:ok\") {\n console.log(res);\n setDefaultSize({ width: res.width, height: res.height });\n }\n },\n });\n }\n }, []);\n\n const size = useMemo(() => {\n let computedSize: { width?: string | number; height?: string | number } =\n defaultSize || {};\n if (width) {\n computedSize.width = `${pxTransform(width)}`;\n }\n if (height) {\n computedSize.height = `${pxTransform(height)}`;\n }\n\n return computedSize;\n }, [width, height, defaultSize]);\n\n const imgCls = classNames(\"xh-image\", className);\n\n return process.env.TARO_ENV !== \"h5\" ? (\n <Image src={src} style={{ ...size, ...rest }} className={imgCls} />\n ) : (\n <img src={src} style={size} className={imgCls} {...rest} />\n );\n};\n\nexport default XHImage;\n"],"names":["XHImage","props","_a","width","_b","height","src","className","rest","__rest","_c","__read","useState","defaultSize","setDefaultSize","useEffect","process","env","TARO_ENV","getImageInfo","success","res","errMsg","size","useMemo","computedSize","concat","pxTransform","imgCls","classNames","React","Image","style","__assign","createElement"],"mappings":"2TAiBM,IAAAA,EAA0B,SAAAC,GACtB,IAAAC,EAAmDD,EAA1CE,MAATA,OAAQ,IAAAD,EAAA,EAACA,EAAEE,EAAwCH,EAAKI,OAA7CA,aAAS,EAACD,EAAEE,EAA4BL,EAAzBK,IAAEC,EAAuBN,EAAdM,UAAKC,EAASC,EAAAR,EAArD,CAAA,QAAA,SAAA,MAAA,cACAS,EAAAC,EAAgCC,EAGnC,CAAE,GAAC,GAHCC,EAAWH,EAAA,GAAEI,OAKpBC,GAAU,WACqB,OAAzBC,QAAQC,IAAIC,UAAsBX,GACpCY,EAAa,CACXb,IAAGA,EACHc,QAAS,SAAAC,GACY,oBAAfA,EAAIC,QAENR,EAAe,CAAEX,MAAOkB,EAAIlB,MAAOE,OAAQgB,EAAIhB,QAElD,GAGN,GAAE,IAEH,IAAMkB,EAAOC,GAAQ,WACnB,IAAIC,EACFZ,GAAe,GAQjB,OAPIV,IACFsB,EAAatB,MAAQ,GAAAuB,OAAGC,EAAYxB,KAElCE,IACFoB,EAAapB,OAAS,GAAAqB,OAAGC,EAAYtB,KAGhCoB,CACR,GAAE,CAACtB,EAAOE,EAAQQ,IAEbe,EAASC,EAAW,WAAYtB,GAEtC,MAAgC,OAAzBS,QAAQC,IAAIC,SACjBY,gBAACC,EAAK,CAACzB,IAAKA,EAAK0B,MAAKC,EAAAA,EAAA,CAAA,EAAOV,GAASf,GAAQD,UAAWqB,IAEzDE,EAAKI,cAAA,MAAAD,EAAA,CAAA3B,IAAKA,EAAK0B,MAAOT,EAAMhB,UAAWqB,GAAYpB,GAEvD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a from"react";import e from"classnames";import{View as m}from"@tarojs/components";import t from"../Mask/index.js";var s=function(s){var r=s.mask,n=s.className,i=s.tip,o=void 0===i?"加载中":i,l=e("xh-loading",n);return a.createElement(m,{className:l},a.createElement(t,{mask:r}),a.createElement(m,{className:e("xh-loading-main",{hasTip:o})},a.createElement(m,{className:"xh-loading-main-gif"}),o&&a.createElement(m,{className:"xh-loading-main-tip"},o)))};export{s as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Loading/index.tsx"],"sourcesContent":["import React, { FC, ReactNode } from \"react\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport Mask, { MaskProps } from \"../Mask\";\n// import Activityindicator from \"../ActivityIndicator\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport \"./index.scss\";\n\nexport type LoadingProps = {\n mask?: MaskProps[\"mask\"];\n color?: string;\n tip?: string | ReactNode;\n size?: number;\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Loading/index.tsx"],"sourcesContent":["import React, { FC, ReactNode } from \"react\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport Mask, { MaskProps } from \"../Mask\";\n// import Activityindicator from \"../ActivityIndicator\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport \"./index.scss\";\n\nexport type LoadingProps = {\n mask?: MaskProps[\"mask\"];\n color?: string;\n tip?: string | ReactNode;\n size?: number;\n} & XHComponentCommonProps;\n\nconst Loading: FC<LoadingProps> = ({\n mask,\n className,\n tip = \"加载中\",\n // color = \"#FFF\",\n // size = 60,\n}) => {\n const cls = classNames(\"xh-loading\", className);\n\n return (\n <View className={cls}>\n <Mask mask={mask} />\n <View className={classNames(\"xh-loading-main\", { hasTip: tip })}>\n {/* <Activityindicator\n size={size}\n style={{\n \"--loading-border-color\": color,\n \"--loading-border-width\": \"3px\",\n }}\n /> */}\n <View className=\"xh-loading-main-gif\"></View>\n {/* <Image src={require('../../assets/images/loading.gif')} className=\"xh-loading-main-gif\" /> */}\n\n {/* <View className=\"xh-loading-main-spinner\">\n {[...Array(12).keys()].map((index) => (\n <View\n className={classNames(\n \"xh-loading-main-spinner-circle\",\n `is-circle${index + 1}`\n )}\n key={`spinner${index}`}\n >\n <View\n className=\"dot-rotate\"\n style={{ backgroundColor: color }}\n ></View>\n </View>\n ))}\n </View> */}\n {tip && <View className=\"xh-loading-main-tip\">{tip}</View>}\n </View>\n </View>\n );\n};\n\nexport default Loading;\n"],"names":["Loading","_a","mask","className","_b","tip","cls","classNames","React","createElement","View","Mask","hasTip"],"mappings":"yHAeM,IAAAA,EAA4B,SAACC,OACjCC,EAAID,EAAAC,KACJC,EAASF,EAAAE,UACTC,QAAAC,OAAM,IAAAD,EAAA,MAAKA,EAILE,EAAMC,EAAW,aAAcJ,GAErC,OACEK,EAACC,cAAAC,EAAK,CAAAP,UAAWG,GACfE,EAAAC,cAACE,EAAI,CAACT,KAAMA,IACZM,EAAAC,cAACC,EAAI,CAACP,UAAWI,EAAW,kBAAmB,CAAEK,OAAQP,KAQvDG,EAAAC,cAACC,EAAI,CAACP,UAAU,wBAmBfE,GAAOG,EAAAC,cAACC,EAAI,CAACP,UAAU,uBAAuBE,IAIvD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__read as e}from"../node_modules/tslib/tslib.es6.js";import a,{useState as
|
|
1
|
+
import{__read as e}from"../node_modules/tslib/tslib.es6.js";import a,{useState as o,useEffect as i}from"react";import t from"classnames";import{eventCenter as r}from"@tarojs/taro";import{View as n}from"@tarojs/components";import s from"../src/hooks/useGenerateId.js";import{pxTransform as l}from"../src/utils/index.js";import c from"./Group/index.js";import d from"../Icon/index.js";var m=function(c){var m=c.className,u=c.name,h=c.label,p=c.id,f=c.circle,v=void 0===f||f,x=c.onChange,N=c.align,E=c.direction,g=c.justify,k=c.checked,y=c.disabled,b=c.value,j=c.style,C=c.size,F=void 0===C?0:C,_=c.fancy,A=void 0!==_&&_,O=c.index,R=void 0===O?0:O,T=c.group,V=void 0!==T&&T,z=c.iconColor,G=void 0===z?"#FFFFFF":z,w=s(p,"xh-radio-id"),I=e(o(k),2),q=I[0],B=I[1],D=function(e){"h5"!==process.env.TARO_ENV&&e!==R&&B(!1)};i((function(){return"h5"!==process.env.TARO_ENV&&r.on("radioChange",D),function(){r.off("radioChange",D)}}),[]);var H=t("xh-radio",m,N,E,g);return"h5"!==process.env.TARO_ENV?a.createElement(n,{onClick:function(){q&&V||(B(!q),null==x||x(!q,b||""))},className:H,style:j},a.createElement(n,{className:t("xh-radio-input",{checked:q})}),a.createElement("span",{style:F>0?{width:l(F),height:l(F)}:{},className:t("xh-radio-input-fake",v&&"circle",{fancy:A})},a.createElement(d,{icon:"duigou",className:"xh-radio-input-fake-icon",color:G,size:F?.55*F:22})),a.createElement("span",{className:"xh-radio-label"},h)):a.createElement("label",{htmlFor:w,className:H,style:j},a.createElement("input",{type:"radio",id:w,name:u,className:"xh-radio-input",onChange:function(e){var a=k||!1,o="";"h5"===process.env.TARO_ENV?(a=e.target.checked,o=e.target.value):(a=e.detail.value,o=e.detail.value),null==x||x(a,o)},value:b,disabled:y,defaultChecked:k}),a.createElement("span",{style:F>0?{width:l(F),height:l(F)}:{},className:t("xh-radio-input-fake",{circle:v,fancy:A})},a.createElement(d,{icon:"duigou",className:"xh-radio-input-fake-icon",color:G,size:F?.55*F:22})),a.createElement("span",{className:"xh-radio-label"},h))};m.Group=c;export{m as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Radio/index.tsx"],"sourcesContent":["import React, { FC, ReactNode, useState, useEffect } from \"react\";\nimport classNames from \"classnames\";\nimport { eventCenter } from \"@tarojs/taro\";\nimport { View } from \"@tarojs/components\";\nimport useGenerateId from \"@/hooks/useGenerateId\";\nimport { pxTransform } from \"@/utils\";\n\nimport Group from \"./Group\";\nimport type { XHComponentCommonProps } from \"../../types\";\n\nimport \"./index.scss\";\n\ntype CompoundedComponent = React.ForwardRefExoticComponent<\n XHRadioProps & React.RefAttributes<HTMLInputElement>\n> & {\n Group: typeof Group;\n};\n\nexport type XHRadioProps = {\n onChange?: (check: boolean, value: string | number) => void;\n checked?: boolean;\n name?: string;\n label: string | ReactNode;\n size?: number;\n circle?: boolean;\n align?: \"center\" | \"end\";\n direction?: \"rtl\";\n justify?: \"around\" | \"between\";\n value?: string | number;\n id?: string;\n disabled?: boolean;\n style?: React.CSSProperties;\n fancy?: boolean;\n index?: number;\n /**\n * 抖音不支持属性选择器\n * @description 主要为抖音支持颜色\n */\n color?: string;\n group?: boolean;\n} & XHComponentCommonProps;\n\nconst XHRadio: FC<XHRadioProps> = props => {\n const {\n className,\n name,\n label,\n id,\n circle = true,\n onChange,\n align,\n direction,\n justify,\n checked,\n disabled,\n value,\n style,\n size = 0,\n fancy = false,\n index = 0,\n group = false,\n } = props;\n\n const finalId = useGenerateId(id, \"xh-radio-id\");\n\n const [innerChecked, setInnerChecked] = useState(checked);\n\n const resetChecked = idx => {\n if (process.env.TARO_ENV !== \"h5\" && idx !== index) {\n setInnerChecked(false);\n }\n };\n\n useEffect(() => {\n if (process.env.TARO_ENV !== \"h5\") {\n eventCenter.on(\"radioChange\", resetChecked);\n }\n\n return () => {\n eventCenter.off(\"radioChange\", resetChecked);\n };\n }, []);\n\n const handleOnchange = e => {\n let finalchecked = checked || false;\n let value = \"\";\n\n if (process.env.TARO_ENV === \"h5\") {\n finalchecked = e.target.checked;\n value = e.target.value;\n } else {\n finalchecked = e.detail.value;\n\n value = e.detail.value;\n }\n\n onChange?.(finalchecked, value);\n };\n\n const handleFakeChange = () => {\n if (innerChecked && group) return;\n setInnerChecked(!innerChecked);\n onChange?.(!innerChecked, value || \"\");\n };\n\n const cls = classNames(\"xh-radio\", className, align, direction, justify);\n if (process.env.TARO_ENV !== \"h5\") {\n return (\n <View onClick={handleFakeChange} className={cls} style={style}>\n <View\n className={classNames(\"xh-radio-input\", {\n checked: innerChecked,\n })}\n />\n <span\n style={\n size > 0\n ? {\n width: pxTransform(size),\n height: pxTransform(size),\n }\n : {}\n }\n className={classNames(\"xh-radio-input-fake\", circle && \"circle\", {\n fancy,\n })}\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Radio/index.tsx"],"sourcesContent":["import React, { FC, ReactNode, useState, useEffect } from \"react\";\nimport classNames from \"classnames\";\nimport { eventCenter } from \"@tarojs/taro\";\nimport { View } from \"@tarojs/components\";\nimport useGenerateId from \"@/hooks/useGenerateId\";\nimport { pxTransform } from \"@/utils\";\n\nimport Group from \"./Group\";\nimport type { XHComponentCommonProps } from \"../../types\";\nimport Icon from \"../Icon\";\n\nimport \"./index.scss\";\n\ntype CompoundedComponent = React.ForwardRefExoticComponent<\n XHRadioProps & React.RefAttributes<HTMLInputElement>\n> & {\n Group: typeof Group;\n};\n\nexport type XHRadioProps = {\n onChange?: (check: boolean, value: string | number) => void;\n checked?: boolean;\n name?: string;\n label: string | ReactNode;\n size?: number;\n circle?: boolean;\n align?: \"center\" | \"end\";\n direction?: \"rtl\";\n justify?: \"around\" | \"between\";\n value?: string | number;\n id?: string;\n disabled?: boolean;\n style?: React.CSSProperties;\n fancy?: boolean;\n index?: number;\n /**\n * 抖音不支持属性选择器\n * @description 主要为抖音支持颜色\n */\n color?: string;\n group?: boolean;\n /**\n * 选中状态下打勾icon的颜色\n */\n iconColor?: string;\n} & XHComponentCommonProps;\n\nconst XHRadio: FC<XHRadioProps> = props => {\n const {\n className,\n name,\n label,\n id,\n circle = true,\n onChange,\n align,\n direction,\n justify,\n checked,\n disabled,\n value,\n style,\n size = 0,\n fancy = false,\n index = 0,\n group = false,\n iconColor = \"#FFFFFF\",\n } = props;\n\n const finalId = useGenerateId(id, \"xh-radio-id\");\n\n const [innerChecked, setInnerChecked] = useState(checked);\n\n const resetChecked = idx => {\n if (process.env.TARO_ENV !== \"h5\" && idx !== index) {\n setInnerChecked(false);\n }\n };\n\n useEffect(() => {\n if (process.env.TARO_ENV !== \"h5\") {\n eventCenter.on(\"radioChange\", resetChecked);\n }\n\n return () => {\n eventCenter.off(\"radioChange\", resetChecked);\n };\n }, []);\n\n const handleOnchange = e => {\n let finalchecked = checked || false;\n let value = \"\";\n\n if (process.env.TARO_ENV === \"h5\") {\n finalchecked = e.target.checked;\n value = e.target.value;\n } else {\n finalchecked = e.detail.value;\n\n value = e.detail.value;\n }\n\n onChange?.(finalchecked, value);\n };\n\n const handleFakeChange = () => {\n if (innerChecked && group) return;\n setInnerChecked(!innerChecked);\n onChange?.(!innerChecked, value || \"\");\n };\n\n const cls = classNames(\"xh-radio\", className, align, direction, justify);\n if (process.env.TARO_ENV !== \"h5\") {\n return (\n <View onClick={handleFakeChange} className={cls} style={style}>\n <View\n className={classNames(\"xh-radio-input\", {\n checked: innerChecked,\n })}\n />\n <span\n style={\n size > 0\n ? {\n width: pxTransform(size),\n height: pxTransform(size),\n }\n : {}\n }\n className={classNames(\"xh-radio-input-fake\", circle && \"circle\", {\n fancy,\n })}\n >\n <Icon\n icon=\"duigou\"\n className=\"xh-radio-input-fake-icon\"\n color={iconColor}\n size={size ? size * 0.55 : 22}\n />\n </span>\n <span className=\"xh-radio-label\">{label}</span>\n </View>\n );\n }\n\n return (\n <label htmlFor={finalId} className={cls} style={style}>\n <input\n type=\"radio\"\n id={finalId}\n name={name}\n className=\"xh-radio-input\"\n onChange={handleOnchange}\n value={value}\n disabled={disabled}\n defaultChecked={checked}\n />\n <span\n style={\n size > 0\n ? {\n width: pxTransform(size),\n height: pxTransform(size),\n }\n : {}\n }\n className={classNames(\"xh-radio-input-fake\", { circle, fancy })}\n >\n <Icon\n icon=\"duigou\"\n className=\"xh-radio-input-fake-icon\"\n color={iconColor}\n size={size ? size * 0.55 : 22}\n />\n </span>\n <span className=\"xh-radio-label\">{label}</span>\n </label>\n );\n};\n\nconst Radio = XHRadio as CompoundedComponent;\nRadio.Group = Group;\n\nexport default Radio;\n"],"names":["Radio","props","className","name","label","id","_a","circle","onChange","align","direction","justify","checked","disabled","value","style","_b","size","_c","fancy","_d","index","_e","group","_f","iconColor","finalId","useGenerateId","_g","__read","useState","innerChecked","setInnerChecked","resetChecked","idx","process","env","TARO_ENV","useEffect","eventCenter","on","off","cls","classNames","React","createElement","View","onClick","width","pxTransform","height","Icon","icon","color","htmlFor","type","e","finalchecked","target","detail","defaultChecked","Group"],"mappings":"+XA+CA,IAqIMA,EArI4B,SAAAC,GAE9B,IAAAC,EAkBED,EAlBOC,UACTC,EAiBEF,EAjBEE,KACJC,EAgBEH,EAhBGG,MACLC,EAeEJ,EAAKI,GAdPC,EAcEL,EAAKM,OAdPA,OAAS,IAAAD,KACTE,EAaEP,EAbMO,SACRC,EAYER,EAZGQ,MACLC,EAWET,EAXOS,UACTC,EAUEV,EAAKU,QATPC,EASEX,EATKW,QACPC,EAQEZ,EARMY,SACRC,EAOEb,EAAKa,MANPC,EAMEd,EAAKc,MALPC,EAKEf,EALMgB,KAARA,OAAI,IAAAD,EAAG,EAACA,EACRE,EAIEjB,EAAKkB,MAJPA,OAAQ,IAAAD,KACRE,EAGEnB,EAAKoB,MAHPA,OAAQ,IAAAD,EAAA,EAACA,EACTE,EAEErB,EAFWsB,MAAbA,OAAQ,IAAAD,GAAKA,EACbE,EACEvB,EADmBwB,UAArBA,OAAS,IAAAD,EAAG,UAASA,EAGjBE,EAAUC,EAActB,EAAI,eAE5BuB,EAAAC,EAAkCC,EAASlB,GAAQ,GAAlDmB,EAAYH,EAAA,GAAEI,OAEfC,EAAe,SAAAC,GACU,OAAzBC,QAAQC,IAAIC,UAAqBH,IAAQb,GAC3CW,GAAgB,EAEpB,EAEAM,GAAU,WAKR,MAJ6B,OAAzBH,QAAQC,IAAIC,UACdE,EAAYC,GAAG,cAAeP,GAGzB,WACLM,EAAYE,IAAI,cAAeR,EACjC,CACD,GAAE,IAEH,IAsBMS,EAAMC,EAAW,WAAYzC,EAAWO,EAAOC,EAAWC,GAChE,MAA6B,OAAzBwB,QAAQC,IAAIC,SAEZO,EAAAC,cAACC,EAAI,CAACC,QATe,WACnBhB,GAAgBR,IACpBS,GAAiBD,GACjBvB,SAAAA,GAAYuB,EAAcjB,GAAS,IACrC,EAKqCZ,UAAWwC,EAAK3B,MAAOA,GACtD6B,EAAAC,cAACC,EACC,CAAA5C,UAAWyC,EAAW,iBAAkB,CACtC/B,QAASmB,MAGba,EAAAC,cAAA,OAAA,CACE9B,MACEE,EAAO,EACH,CACE+B,MAAOC,EAAYhC,GACnBiC,OAAQD,EAAYhC,IAEtB,CAAA,EAENf,UAAWyC,EAAW,sBAAuBpC,GAAU,SAAU,CAC/DY,MAAKA,KAGPyB,EAAAC,cAACM,EAAI,CACHC,KAAK,SACLlD,UAAU,2BACVmD,MAAO5B,EACPR,KAAMA,EAAc,IAAPA,EAAc,MAG/B2B,EAAMC,cAAA,OAAA,CAAA3C,UAAU,kBAAkBE,IAMtCwC,EAAAC,cAAA,QAAA,CAAOS,QAAS5B,EAASxB,UAAWwC,EAAK3B,MAAOA,GAC9C6B,EAAAC,cAAA,QAAA,CACEU,KAAK,QACLlD,GAAIqB,EACJvB,KAAMA,EACND,UAAU,iBACVM,SA/DiB,SAAAgD,GACrB,IAAIC,EAAe7C,IAAW,EAC1BE,EAAQ,GAEiB,OAAzBqB,QAAQC,IAAIC,UACdoB,EAAeD,EAAEE,OAAO9C,QACxBE,EAAQ0C,EAAEE,OAAO5C,QAEjB2C,EAAeD,EAAEG,OAAO7C,MAExBA,EAAQ0C,EAAEG,OAAO7C,OAGnBN,SAAAA,EAAWiD,EAAc3C,EAC3B,EAkDMA,MAAOA,EACPD,SAAUA,EACV+C,eAAgBhD,IAElBgC,EAAAC,cAAA,OAAA,CACE9B,MACEE,EAAO,EACH,CACE+B,MAAOC,EAAYhC,GACnBiC,OAAQD,EAAYhC,IAEtB,GAENf,UAAWyC,EAAW,sBAAuB,CAAEpC,OAAMA,EAAEY,MAAKA,KAE5DyB,EAAAC,cAACM,EAAI,CACHC,KAAK,SACLlD,UAAU,2BACVmD,MAAO5B,EACPR,KAAMA,EAAc,IAAPA,EAAc,MAG/B2B,EAAMC,cAAA,OAAA,CAAA3C,UAAU,kBAAkBE,GAGxC,EAGAJ,EAAM6D,MAAQA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"../node_modules/tslib/tslib.es6.js";import r,{createContext as o}from"react";import
|
|
1
|
+
import{__assign as e}from"../node_modules/tslib/tslib.es6.js";import r,{createContext as o}from"react";import t from"../node_modules/css-vars-ponyfill/dist/css-vars-ponyfill.esm.js";var s=o(e({},{})),l=function(e){var o=e.children,l=e.value,n=e.scoped,i=o;return void 0!==n&&n?i=r.Children.map(o,(function(e,o){return 0===o?r.cloneElement(e,{style:l}):e})):Object.keys(l).forEach((function(e){document.body.style.setProperty(e,l[e])})),t({variables:l}),r.createElement(s.Provider,{value:l},i)};export{s as ThemeContext,l as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/ThemeProvider/index.tsx"],"sourcesContent":["import React, { createContext, PropsWithChildren } from \"react\";\nimport cssVars from \"css-vars-ponyfill\";\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 \"--btn-color-disabled\"?: string;\n};\n\nexport type ThemeProviderProps = {\n value: ThemeValue & { [key: string]: string };\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<PropsWithChildren<ThemeProviderProps>> = ({\n children,\n value,\n scoped = false,\n}) => {\n let clonedElement = children;\n if (!scoped) {\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/ThemeProvider/index.tsx"],"sourcesContent":["import React, { createContext, PropsWithChildren } from \"react\";\nimport cssVars from \"css-vars-ponyfill\";\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 \"--btn-color-disabled\"?: string;\n};\n\nexport type ThemeProviderProps = {\n value: ThemeValue & { [key: string]: string };\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<PropsWithChildren<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 cssVars({\n variables: value as { [key: string]: string },\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","cssVars","variables","createElement","Provider"],"mappings":"sLA2BA,IAIaA,EAHJC,EAAaC,EAAA,GAGkB,KAElCC,EAAiE,SAACC,OACtEC,EAAQD,EAAAC,SACRC,EAAKF,EAAAE,MACLC,WAEIC,EAAgBH,EAqBpB,YAvBS,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,IAaFI,EAAQ,CACNC,UAAWlB,IAIXG,EAAAgB,cAACzB,EAAa0B,SAAQ,CAACpB,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";export{default as XHSpace}from"../Space/index.js";export{default as ThemeProvider}from"../ThemeProvider/index.js";export{default as XHCheckbox}from"../Checkbox/index.js";export{default as XHRadio}from"../Radio/index.js";export{default as XHStep}from"../Step/index.js";export{default as XHBadge}from"../Badge/index.js";export{default as XHAmountInput}from"../AmountInput/index.js";export{default as XHAmountKeyboard}from"../AmountKeyboard/index.js";export{default as XHCollapse}from"../Collapse/index.js";export{default as XHNavBar}from"../NavBar/index.js";export{default as XHIcon}from"../Icon/index.js";export{default as XHActionSheet}from"../ActionSheet/index.js";export{default as XHRank}from"../Rank/index.js";export{default as XHCell}from"../Cell/index.js";export{default as XHActivityIndicator}from"../ActivityIndicator/index.js";export{default as XHSwitch}from"../Switch/index.js";export{default as XHLinkMan}from"../LinkMan/index.js";export{default as XHResult}from"../Result/index.js";export{default as XHProgressCircle}from"../ProgressCircle/index.js";export{default as XHLicensePlateInput}from"../LicensePlateInput/index.js";export{default as XHCountdown}from"../Countdown/index.js";export{default as XHCheckboxButton}from"../CheckboxButton/index.js";export{default as XHNotice}from"../Notice/index.js";export{default as
|
|
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 XHSpace}from"../Space/index.js";export{default as ThemeProvider}from"../ThemeProvider/index.js";export{default as XHCheckbox}from"../Checkbox/index.js";export{default as XHRadio}from"../Radio/index.js";export{default as XHStep}from"../Step/index.js";export{default as XHBadge}from"../Badge/index.js";export{default as XHAmountInput}from"../AmountInput/index.js";export{default as XHAmountKeyboard}from"../AmountKeyboard/index.js";export{default as XHCollapse}from"../Collapse/index.js";export{default as XHNavBar}from"../NavBar/index.js";export{default as XHIcon}from"../Icon/index.js";export{default as XHActionSheet}from"../ActionSheet/index.js";export{default as XHRank}from"../Rank/index.js";export{default as XHCell}from"../Cell/index.js";export{default as XHActivityIndicator}from"../ActivityIndicator/index.js";export{default as XHSwitch}from"../Switch/index.js";export{default as XHLinkMan}from"../LinkMan/index.js";export{default as XHResult}from"../Result/index.js";export{default as XHProgressCircle}from"../ProgressCircle/index.js";export{default as XHLicensePlateInput}from"../LicensePlateInput/index.js";export{default as XHCountdown}from"../Countdown/index.js";export{default as XHCheckboxButton}from"../CheckboxButton/index.js";export{default as XHNotice}from"../Notice/index.js";export{default as XHBankCardNumberInput}from"../BankCardNumberInput/index.js";export{default as XHIDNumberInput}from"../IDNumberInput/index.js";export{default as XHEcharts}from"../Echarts/index.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|