taro-react-uilib 1.3.2-1 → 1.3.2-2

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/components/DialogRef/index.js +1 -1
  3. package/dist/components/DialogRef/index.js.map +1 -1
  4. package/dist/components/Step/Steps/index.js +1 -1
  5. package/dist/components/Step/Steps/index.js.map +1 -1
  6. package/dist/components/Step/index.js +1 -1
  7. package/dist/components/Step/index.js.map +1 -1
  8. package/dist/components/Switch/index.js +2 -0
  9. package/dist/components/Switch/index.js.map +1 -0
  10. package/dist/components/Tabbar/tabbar/Tabbar.js +1 -1
  11. package/dist/components/Tabbar/tabbar/Tabbar.js.map +1 -1
  12. package/dist/components/src/index.js +1 -1
  13. package/dist/index.js +2 -2
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.umd.js +2 -2
  16. package/dist/index.umd.js.map +1 -1
  17. package/dist/styles/components/captcha.scss +6 -5
  18. package/dist/styles/components/dialogref.scss +5 -3
  19. package/dist/styles/components/forminput.scss +15 -15
  20. package/dist/styles/components/index.scss +1 -0
  21. package/dist/styles/components/step.scss +9 -1
  22. package/dist/styles/components/switch.scss +40 -0
  23. package/lib/components/DialogRef/index.js +3 -3
  24. package/lib/components/DialogRef/index.js.map +1 -1
  25. package/lib/components/Step/Steps/index.js +1 -0
  26. package/lib/components/Step/Steps/index.js.map +1 -1
  27. package/lib/components/Step/index.js +2 -1
  28. package/lib/components/Step/index.js.map +1 -1
  29. package/lib/components/Switch/index.js +26 -0
  30. package/lib/components/Switch/index.js.map +1 -0
  31. package/lib/components/Tabbar/tabbar/Tabbar.js +9 -7
  32. package/lib/components/Tabbar/tabbar/Tabbar.js.map +1 -1
  33. package/lib/index.js +1 -0
  34. package/lib/index.js.map +1 -1
  35. package/package.json +1 -1
  36. package/types/components/DialogRef/index.d.ts +2 -0
  37. package/types/components/Step/index.d.ts +1 -0
  38. package/types/components/Switch/index.d.ts +12 -0
  39. package/types/components/Tabbar/tabbar/Tabbar.d.ts +3 -1
  40. package/types/index.d.ts +1 -0
  41. /package/{readme.md → README.md} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [1.3.2-2](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.2-1...v1.3.2-2) (2023-07-06)
2
+
3
+
4
+ ### Features
5
+
6
+ * Switch组件、组件优化 ([ec81a39](https://code.xhdev.xyz/h5group/taro-uilib/commits/ec81a39876c3755113c78289b030216e22e2375d))
7
+ * tabbar组件新增属性 ([77f16c7](https://code.xhdev.xyz/h5group/taro-uilib/commits/77f16c7d57cd8ecb3e03310ffae8bd9238c5afc0))
8
+ * 修改radio、checkbox disble样式 ([0249cb3](https://code.xhdev.xyz/h5group/taro-uilib/commits/0249cb31e5582e4f098e8fd5d3c3154f61068381))
9
+
10
+
11
+
1
12
  ## [1.3.2-1](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.2-0...v1.3.2-1) (2023-07-03)
2
13
 
3
14
 
@@ -1,2 +1,2 @@
1
- import{__read as e}from"../node_modules/tslib/tslib.es6.js";import t,{forwardRef as o,useState as n,useImperativeHandle as a,useEffect as r}from"react";import s from"classnames";import{View as c}from"@tarojs/components";import l from"../Button/index.js";import i from"../Mask/index.js";import m from"../node_modules/react-transition-group/esm/CSSTransition.js";var f=o((function(o,f){var d=o.header,u=o.content,p=o.className,h=void 0===p?"":p,g=o.visible,x=o.showCancel,v=void 0===x||x,E=o.confirmText,N=void 0===E?"确定":E,C=o.cancelText,b=void 0===C?"取消":C,j=o.footer,T=void 0!==j&&j,k=o.onConfirm,w=o.onCancel,y=o.onClose,z=e(n(!1),2),S=z[0],_=z[1];a(f,(function(){return{close:B,open:M}}));var B=function(){y&&y(),_(!1)},M=function(){_(!0)};r((function(){g||y&&y(),_(g)}),[g]);var q=s("xh-dialog-ref",h,{show:S}),A=t.createElement(c,{className:"xh-dialog-ref-content-footer-buttons"},v&&t.createElement(l,{ghost:!0,size:"full",shape:"rectangle",preventTime:0,onClick:function(){w&&w(),B()},className:"xh-dialog-ref-content-footer-buttons-cancel"},b),t.createElement(l,{type:"primary",shape:"rectangle",size:"full",ghost:!0,className:"xh-dialog-ref-content-footer-buttons--confirm",onClick:function(){k&&k()},preventTime:0},N));return t.createElement(c,{className:q},t.createElement(i,null),t.createElement(m,{in:S,timeout:200,classNames:"scale"},t.createElement(c,{className:"xh-dialog-ref-content"},t.createElement(c,{className:"xh-dialog-ref-content-header"},d),t.createElement(c,{className:"xh-dialog-ref-content-content"},u),T||t.createElement(c,{className:"xh-dialog-ref-content-footer"},A))))}));export{f as default};
1
+ import{__read as e}from"../node_modules/tslib/tslib.es6.js";import t,{forwardRef as o,useState as n,useImperativeHandle as a,useEffect as r}from"react";import s from"classnames";import{View as c}from"@tarojs/components";import l from"../Button/index.js";import i from"../Mask/index.js";import m from"../node_modules/react-transition-group/esm/CSSTransition.js";var f=o((function(o,f){var d=o.header,u=o.content,p=o.className,h=void 0===p?"":p,g=o.visible,v=o.showCancel,x=void 0===v||v,E=o.confirmText,N=void 0===E?"确定":E,C=o.cancelText,b=void 0===C?"取消":C,j=o.footer,T=void 0!==j&&j,k=o.onConfirm,w=o.onCancel,y=o.onClose,z=o.tranparent,S=void 0!==z&&z,_=e(n(!1),2),B=_[0],M=_[1];a(f,(function(){return{close:q,open:A}}));var q=function(){y&&y(),M(!1)},A=function(){M(!0)};r((function(){g||y&&y(),M(g)}),[g]);var D=s("xh-dialog-ref",h,{show:B}),F=t.createElement(c,{className:"xh-dialog-ref-content-footer-buttons"},x&&t.createElement(l,{ghost:!0,size:"full",shape:"rectangle",preventTime:0,onClick:function(){w&&w(),q()},className:"xh-dialog-ref-content-footer-buttons-cancel"},b),t.createElement(l,{type:"primary",shape:"rectangle",size:"full",ghost:!0,className:"xh-dialog-ref-content-footer-buttons--confirm",onClick:function(){k&&k()},preventTime:0},N));return t.createElement(c,{className:D},t.createElement(i,null),t.createElement(m,{in:B,timeout:200,classNames:"scale"},t.createElement(c,{className:s("xh-dialog-ref-content",{tranparent:S})},d&&t.createElement(c,{className:"xh-dialog-ref-content-header"},d),t.createElement(c,{className:"xh-dialog-ref-content-content"},u),T||t.createElement(c,{className:"xh-dialog-ref-content-footer"},F))))}));export{f 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\n const dialogFooter = (\n <View className=\"xh-dialog-ref-content-footer-buttons\">\n {showCancel && (\n <Button\n ghost\n size=\"full\"\n shape=\"rectangle\"\n preventTime={0}\n onClick={handleCancel}\n className=\"xh-dialog-ref-content-footer-buttons-cancel\"\n >\n {cancelText}\n </Button>\n )}\n <Button\n type=\"primary\"\n shape=\"rectangle\"\n size=\"full\"\n ghost\n className=\"xh-dialog-ref-content-footer-buttons--confirm\"\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","dialogFooter","React","createElement","View","Button","ghost","size","shape","preventTime","onClick","type","Mask","CSSTransition","in","timeout"],"mappings":"yWAgCA,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,IAGFS,EACJC,EAAAC,cAACC,EAAK,CAAA5B,UAAU,wCACbG,GACCuB,EAACC,cAAAE,EACC,CAAAC,OACA,EAAAC,KAAK,OACLC,MAAM,YACNC,YAAa,EACbC,QAxBa,WACnBvB,GAAYA,IACZQ,GACF,EAsBQnB,UAAU,+CAETO,GAGLmB,EAAAC,cAACE,EAAM,CACLM,KAAK,UACLH,MAAM,YACND,KAAK,OACLD,OAAK,EACL9B,UAAU,gDACVkC,QAxCgB,WACpBxB,GAAaA,GAEf,EAsCMuB,YAAa,GAEZ5B,IAmBP,OAbEqB,EAAAC,cAACC,EAAK,CAAA5B,UAAWsB,GACfI,EAAAC,cAACS,EAAO,MACRV,EAAAC,cAACU,EAAa,CAACC,GAAItB,EAAauB,QAAS,IAAKhB,WAAW,SACvDG,EAAAC,cAACC,EAAI,CAAC5B,UAAU,yBACd0B,EAAAC,cAACC,EAAK,CAAA5B,UAAU,gCAAgCH,GAChD6B,EAAAC,cAACC,EAAK,CAAA5B,UAAU,iCAAiCF,GAChDW,GACCiB,EAAAC,cAACC,EAAI,CAAC5B,UAAU,gCAAgCyB,KAO5D"}
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 tranparent?: boolean;\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 tranparent = false,\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\n const dialogFooter = (\n <View className=\"xh-dialog-ref-content-footer-buttons\">\n {showCancel && (\n <Button\n ghost\n size=\"full\"\n shape=\"rectangle\"\n preventTime={0}\n onClick={handleCancel}\n className=\"xh-dialog-ref-content-footer-buttons-cancel\"\n >\n {cancelText}\n </Button>\n )}\n <Button\n type=\"primary\"\n shape=\"rectangle\"\n size=\"full\"\n ghost\n className=\"xh-dialog-ref-content-footer-buttons--confirm\"\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={classNames(\"xh-dialog-ref-content\", { tranparent })}>\n {header && (\n <View className=\"xh-dialog-ref-content-header\">{header}</View>\n )}\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","tranparent","_g","__read","useState","selfVisible","setSelfVisible","useImperativeHandle","close","open","useEffect","dialogcls","classNames","show","dialogFooter","React","createElement","View","Button","ghost","size","shape","preventTime","onClick","type","Mask","CSSTransition","in","timeout"],"mappings":"yWAiCA,IAAMA,EAAYC,GAAoC,SAACC,EAAOC,GAE1D,IAAAC,EAYEF,EAZIE,OACNC,EAWEH,EAXKG,QACPC,EAUEJ,EAAKK,UAVPA,OAAS,IAAAD,EAAG,GAAEA,EACdE,EASEN,EATKM,QACPC,EAQEP,EAAKQ,WARPA,OAAU,IAAAD,GAAOA,EACjBE,EAOET,cAPFU,aAAc,KAAID,EAClBE,EAMEX,EANeY,WAAjBA,OAAa,IAAAD,EAAA,OACbE,EAKEb,EAAKc,OALPA,OAAM,IAAAD,GAAQA,EACdE,EAIEf,EAJOe,UACTC,EAGEhB,WAFFiB,EAEEjB,EAAKiB,QADPC,EACElB,EADgBmB,WAAlBA,OAAa,IAAAD,KAETE,EAAAC,EAAgCC,GAAS,GAAM,GAA9CC,EAAWH,EAAA,GAAEI,OAEpBC,EAAoBxB,GAAS,WAAM,MAAC,CAClCyB,MAAKA,EACLC,KAAIA,EACJ,IAEF,IAAMD,EAAQ,WACZT,GAAWA,IACXO,GAAe,EACjB,EAEMG,EAAO,WACXH,GAAe,EACjB,EAWAI,GAAU,WACHtB,GACHW,GAAWA,IAEbO,EAAelB,EACjB,GAAG,CAACA,IAEJ,IAAMuB,EAAYC,EAAW,gBAAiBzB,EAAW,CACvD0B,KAAMR,IAGFS,EACJC,EAAAC,cAACC,EAAK,CAAA9B,UAAU,wCACbG,GACCyB,EAACC,cAAAE,EACC,CAAAC,OACA,EAAAC,KAAK,OACLC,MAAM,YACNC,YAAa,EACbC,QAxBa,WACnBzB,GAAYA,IACZU,GACF,EAsBQrB,UAAU,+CAETO,GAGLqB,EAAAC,cAACE,EAAM,CACLM,KAAK,UACLH,MAAM,YACND,KAAK,OACLD,OAAK,EACLhC,UAAU,gDACVoC,QAxCgB,WACpB1B,GAAaA,GAEf,EAsCMyB,YAAa,GAEZ9B,IAqBP,OAfEuB,EAAAC,cAACC,EAAK,CAAA9B,UAAWwB,GACfI,EAAAC,cAACS,EAAO,MACRV,EAAAC,cAACU,EAAa,CAACC,GAAItB,EAAauB,QAAS,IAAKhB,WAAW,SACvDG,EAAAC,cAACC,EAAI,CAAC9B,UAAWyB,EAAW,wBAAyB,CAAEX,WAAUA,KAC9DjB,GACC+B,EAAAC,cAACC,EAAI,CAAC9B,UAAU,gCAAgCH,GAElD+B,EAAAC,cAACC,EAAK,CAAA9B,UAAU,iCAAiCF,GAChDW,GACCmB,EAAAC,cAACC,EAAI,CAAC9B,UAAU,gCAAgC2B,KAO5D"}
@@ -1,2 +1,2 @@
1
- import t from"react";import e from"classnames";import{View as s}from"@tarojs/components";var a=t.createElement("span",{className:"".concat("xh-step","-icon-dot")}),r=function(r){var n=r.direction,o=void 0===n?"horizontal":n,c=r.current,i=void 0===c?0:c,l=r.style,m=r.className,p=e("xh-steps","".concat("xh-steps","-").concat(o),m);return t.createElement(s,{className:p,style:l},t.Children.map(r.children,(function(e,s){var r;if(!t.isValidElement(e))return e;var n=e.props,o=n.status||"wait";s<i?o=n.status||"finish":s===i&&(o=n.status||"process");var c=null!==(r=n.icon)&&void 0!==r?r:a;return t.cloneElement(e,{status:o,icon:c})})))};export{r as default};
1
+ import t from"react";import e from"classnames";import{View as s}from"@tarojs/components";var a=t.createElement("span",{className:"".concat("xh-step","-icon-dot")}),r=function(r){var n=r.direction,o=void 0===n?"horizontal":n,c=r.current,i=void 0===c?0:c,l=r.style,m=r.className,p=e("xh-steps","".concat("xh-steps","-").concat(o),m);return t.createElement(s,{className:p,style:l},t.Children.map(r.children,(function(e,s){var r;if(!t.isValidElement(e))return e;var n=e.props,c=n.status||"wait";s<i?c=n.status||"finish":s===i&&(c=n.status||"process");var l=null!==(r=n.icon)&&void 0!==r?r:a;return t.cloneElement(e,{status:c,icon:l,direction:o})})))};export{r as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Step/Steps/index.tsx"],"sourcesContent":["import React, { FC, ReactElement } from \"react\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport type { XHComponentCommonProps } from \"../../../types\";\n\nimport { StepProps } from \"..\";\n\nconst classPrefix = `xh-steps`;\nconst stepClassPrefix = `xh-step`;\n\nconst defaultIcon = <span className={`${stepClassPrefix}-icon-dot`} />;\n\nexport type StepsProps = {\n current?: number;\n direction?: \"horizontal\" | \"vertical\";\n children?: React.ReactNode;\n style?: React.CSSProperties & {\n \"--line-to-next-color\"?: string;\n \"--color-primary\"?: string;\n };\n} & XHComponentCommonProps;\n\nconst Steps: FC<StepsProps> = props => {\n const { direction = \"horizontal\", current = 0, style, className } = props;\n const classString = classNames(\n classPrefix,\n `${classPrefix}-${direction}`,\n className\n );\n\n return (\n <View className={classString} style={style}>\n {React.Children.map(\n props.children,\n (child: ReactElement<StepProps>, index) => {\n if (!React.isValidElement(child)) {\n return child;\n }\n const props = child.props;\n let status = props.status || \"wait\";\n\n if (index < current) {\n status = props.status || \"finish\";\n } else if (index === current) {\n status = props.status || \"process\";\n }\n\n const icon = props.icon ?? defaultIcon;\n\n return React.cloneElement(child, {\n status,\n icon,\n });\n }\n )}\n </View>\n );\n};\n\nexport default Steps;\n"],"names":["defaultIcon","React","createElement","className","concat","Steps","props","_a","direction","_b","current","style","classString","classNames","View","Children","map","children","child","index","isValidElement","status","icon","cloneElement"],"mappings":"yFAOA,IAGMA,EAAcC,EAAMC,cAAA,OAAA,CAAAC,UAAW,GAAGC,OAFhB,UAE0C,eAY5DC,EAAwB,SAAAC,GACpB,IAAAC,EAA4DD,EAAKE,UAAjEA,OAAY,IAAAD,EAAA,aAAYA,EAAEE,EAAkCH,EAAvBI,QAAXA,OAAO,IAAAD,EAAG,EAACA,EAAEE,EAAqBL,EAAhBK,MAAER,EAAcG,EAAKH,UACnES,EAAcC,EAjBF,WAmBhB,GAAAT,OAnBgB,WAmBF,KAAAA,OAAII,GAClBL,GAGF,OACEF,EAACC,cAAAY,EAAK,CAAAX,UAAWS,EAAaD,MAAOA,GAClCV,EAAMc,SAASC,IACdV,EAAMW,UACN,SAACC,EAAgCC,SAC/B,IAAKlB,EAAMmB,eAAeF,GACxB,OAAOA,EAET,IAAMZ,EAAQY,EAAMZ,MAChBe,EAASf,EAAMe,QAAU,OAEzBF,EAAQT,EACVW,EAASf,EAAMe,QAAU,SAChBF,IAAUT,IACnBW,EAASf,EAAMe,QAAU,WAG3B,IAAMC,EAAiB,QAAVf,EAAAD,EAAMgB,YAAI,IAAAf,EAAAA,EAAIP,EAE3B,OAAOC,EAAMsB,aAAaL,EAAO,CAC/BG,OAAMA,EACNC,KAAIA,GAEP,IAIT"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Step/Steps/index.tsx"],"sourcesContent":["import React, { FC, ReactElement } from \"react\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport type { XHComponentCommonProps } from \"../../../types\";\n\nimport { StepProps } from \"..\";\n\nconst classPrefix = `xh-steps`;\nconst stepClassPrefix = `xh-step`;\n\nconst defaultIcon = <span className={`${stepClassPrefix}-icon-dot`} />;\n\nexport type StepsProps = {\n current?: number;\n direction?: \"horizontal\" | \"vertical\";\n children?: React.ReactNode;\n style?: React.CSSProperties & {\n \"--line-to-next-color\"?: string;\n \"--color-primary\"?: string;\n };\n} & XHComponentCommonProps;\n\nconst Steps: FC<StepsProps> = props => {\n const { direction = \"horizontal\", current = 0, style, className } = props;\n const classString = classNames(\n classPrefix,\n `${classPrefix}-${direction}`,\n className\n );\n\n return (\n <View className={classString} style={style}>\n {React.Children.map(\n props.children,\n (child: ReactElement<StepProps>, index) => {\n if (!React.isValidElement(child)) {\n return child;\n }\n const props = child.props;\n\n let status = props.status || \"wait\";\n if (index < current) {\n status = props.status || \"finish\";\n } else if (index === current) {\n status = props.status || \"process\";\n }\n\n const icon = props.icon ?? defaultIcon;\n\n return React.cloneElement(child, {\n status,\n icon,\n direction,\n });\n }\n )}\n </View>\n );\n};\n\nexport default Steps;\n"],"names":["defaultIcon","React","createElement","className","concat","Steps","props","_a","direction","_b","current","style","classString","classNames","View","Children","map","children","child","index","isValidElement","status","icon","cloneElement"],"mappings":"yFAOA,IAGMA,EAAcC,EAAMC,cAAA,OAAA,CAAAC,UAAW,GAAGC,OAFhB,UAE0C,eAY5DC,EAAwB,SAAAC,GACpB,IAAAC,EAA4DD,EAAKE,UAAjEA,OAAY,IAAAD,EAAA,aAAYA,EAAEE,EAAkCH,EAAvBI,QAAXA,OAAO,IAAAD,EAAG,EAACA,EAAEE,EAAqBL,EAAhBK,MAAER,EAAcG,EAAKH,UACnES,EAAcC,EAjBF,WAmBhB,GAAAT,OAnBgB,WAmBF,KAAAA,OAAII,GAClBL,GAGF,OACEF,EAACC,cAAAY,EAAK,CAAAX,UAAWS,EAAaD,MAAOA,GAClCV,EAAMc,SAASC,IACdV,EAAMW,UACN,SAACC,EAAgCC,SAC/B,IAAKlB,EAAMmB,eAAeF,GACxB,OAAOA,EAET,IAAMZ,EAAQY,EAAMZ,MAEhBe,EAASf,EAAMe,QAAU,OACzBF,EAAQT,EACVW,EAASf,EAAMe,QAAU,SAChBF,IAAUT,IACnBW,EAASf,EAAMe,QAAU,WAG3B,IAAMC,EAAiB,QAAVf,EAAAD,EAAMgB,YAAI,IAAAf,EAAAA,EAAIP,EAE3B,OAAOC,EAAMsB,aAAaL,EAAO,CAC/BG,OAAMA,EACNC,KAAIA,EACJd,UAASA,GAEZ,IAIT"}
@@ -1,2 +1,2 @@
1
- import t from"react";import e from"classnames";import{View as a}from"@tarojs/components";import c from"./Steps/index.js";var s=function(c){var s=c.title,n=c.description,o=c.icon,r=c.status,m=void 0===r?"wait":r,i=c.fancy,l=c.style,p=c.className;return t.createElement(a,{className:e("".concat("xh-step"),"".concat("xh-step","-status-").concat(m),p),style:l},t.createElement(a,{className:"".concat("xh-step","-indicator")},t.createElement(a,{className:e("".concat("xh-step","-icon-container"),{fancy:i})},o)),t.createElement(a,{className:"".concat("xh-step","-content")},t.createElement(a,{className:"".concat("xh-step","-title")},s),!!n&&t.createElement(a,{className:"".concat("xh-step","-description")},n)))};s.Steps=c;export{s as default};
1
+ import e from"react";import t from"classnames";import{View as a}from"@tarojs/components";import c from"./Steps/index.js";var s=function(c){var s=c.title,n=c.description,o=c.icon,r=c.status,m=void 0===r?"wait":r,i=c.fancy,l=c.style,p=c.className,x=c.direction,f=c.prefix;return e.createElement(a,{className:t("".concat("xh-step"),"".concat("xh-step","-status-").concat(m),p),style:l},"vertical"===x&&f&&e.createElement(a,{className:"".concat("xh-step","-prefix")},f),e.createElement(a,{className:"".concat("xh-step","-indicator")},e.createElement(a,{className:t("".concat("xh-step","-icon-container"),{fancy:i})},o)),e.createElement(a,{className:"".concat("xh-step","-content")},e.createElement(a,{className:"".concat("xh-step","-title")},s),!!n&&e.createElement(a,{className:"".concat("xh-step","-description")},n)))};s.Steps=c;export{s as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/Step/index.tsx"],"sourcesContent":["import React, { ReactNode, ForwardRefExoticComponent } from \"react\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport type { XHComponentCommonProps } from \"../../types\";\n\nimport Steps from \"./Steps\";\nimport \"./index.scss\";\n\nexport type StepProps = {\n icon?: string | ReactNode;\n title: string | ReactNode;\n description?: string | ReactNode;\n direction?: \"horizontal\" | \"vertical\";\n status?: \"wait\" | \"process\" | \"finish\" | \"error\";\n fancy?: boolean;\n style?: React.CSSProperties;\n} & XHComponentCommonProps;\n\nconst classPrefix = \"xh-step\";\n\nconst Step: React.FC<StepProps> = props => {\n const {\n title,\n description,\n icon,\n status = \"wait\",\n fancy,\n style,\n className,\n } = props;\n\n return (\n <View\n className={classNames(\n `${classPrefix}`,\n `${classPrefix}-status-${status}`,\n className\n )}\n style={style}\n >\n <View className={`${classPrefix}-indicator`}>\n <View\n className={classNames(`${classPrefix}-icon-container`, { fancy })}\n >\n {icon}\n </View>\n </View>\n <View className={`${classPrefix}-content`}>\n <View className={`${classPrefix}-title`}>{title}</View>\n {!!description && (\n <View className={`${classPrefix}-description`}>{description}</View>\n )}\n </View>\n </View>\n );\n};\n\nexport type HybridComponent = ForwardRefExoticComponent<StepProps> & {\n Steps: typeof Steps;\n};\n\nconst XHStep = Step as HybridComponent;\nXHStep.Steps = Steps;\n\nexport default XHStep;\n"],"names":["XHStep","props","title","description","icon","_a","status","fancy","style","className","React","View","classNames","concat","createElement","Steps"],"mappings":"yHAkBA,IA2CMA,EAzC4B,SAAAC,GAE9B,IAAAC,EAOED,EAPGC,MACLC,EAMEF,EANSE,YACXC,EAKEH,OAJFI,EAIEJ,EAJaK,OAAfA,OAAM,IAAAD,EAAG,OAAMA,EACfE,EAGEN,EAHGM,MACLC,EAEEP,EAFGO,MACLC,EACER,YAEJ,OACES,gBAACC,EAAI,CACHF,UAAWG,EACT,GAAAC,OAhBY,WAiBZ,GAAGA,OAjBS,UAiBa,YAAAA,OAAAP,GACzBG,GAEFD,MAAOA,GAEPE,EAAAI,cAACH,EAAK,CAAAF,UAAW,GAAAI,OAtBH,UAsB6B,eACzCH,EAAAI,cAACH,EACC,CAAAF,UAAWG,EAAW,UAxBZ,UAwB0B,mBAAmB,CAAEL,MAAKA,KAE7DH,IAGLM,EAAAI,cAACH,EAAK,CAAAF,UAAW,GAAAI,OA7BH,UA6B2B,aACvCH,EAACI,cAAAH,GAAKF,UAAW,UA9BL,UA8BmB,WAAWP,KACvCC,GACDO,EAACI,cAAAH,GAAKF,UAAW,UAhCP,UAgCqB,iBAAiBN,IAK1D,EAOAH,EAAOe,MAAQA"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/Step/index.tsx"],"sourcesContent":["import React, { ReactNode, ForwardRefExoticComponent } from \"react\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport type { XHComponentCommonProps } from \"../../types\";\n\nimport Steps from \"./Steps\";\nimport \"./index.scss\";\n\nexport type StepProps = {\n icon?: string | ReactNode;\n title: string | ReactNode;\n description?: string | ReactNode;\n direction?: \"horizontal\" | \"vertical\";\n status?: \"wait\" | \"process\" | \"finish\" | \"error\";\n fancy?: boolean;\n style?: React.CSSProperties;\n prefix?: ReactNode;\n} & XHComponentCommonProps;\n\nconst classPrefix = \"xh-step\";\n\nconst Step: React.FC<StepProps> = props => {\n const {\n title,\n description,\n icon,\n status = \"wait\",\n fancy,\n style,\n className,\n direction,\n prefix,\n } = props;\n\n return (\n <View\n className={classNames(\n `${classPrefix}`,\n `${classPrefix}-status-${status}`,\n className\n )}\n style={style}\n >\n {direction === \"vertical\" && prefix && (\n <View className={`${classPrefix}-prefix`}>{prefix}</View>\n )}\n <View className={`${classPrefix}-indicator`}>\n <View\n className={classNames(`${classPrefix}-icon-container`, { fancy })}\n >\n {icon}\n </View>\n </View>\n <View className={`${classPrefix}-content`}>\n <View className={`${classPrefix}-title`}>{title}</View>\n {!!description && (\n <View className={`${classPrefix}-description`}>{description}</View>\n )}\n </View>\n </View>\n );\n};\n\nexport type HybridComponent = ForwardRefExoticComponent<StepProps> & {\n Steps: typeof Steps;\n};\n\nconst XHStep = Step as HybridComponent;\nXHStep.Steps = Steps;\n\nexport default XHStep;\n"],"names":["XHStep","props","title","description","icon","_a","status","fancy","style","className","direction","prefix","React","View","classNames","concat","createElement","Steps"],"mappings":"yHAmBA,IAgDMA,EA9C4B,SAAAC,GAE9B,IAAAC,EASED,EAAKC,MARPC,EAQEF,EAAKE,YAPPC,EAOEH,EAAKG,KANPC,EAMEJ,SANFK,OAAS,IAAAD,EAAA,OAAMA,EACfE,EAKEN,QAJFO,EAIEP,EAAKO,MAHPC,EAGER,YAFFS,EAEET,EAAKS,UADPC,EACEV,EAAKU,OAET,OACEC,gBAACC,EAAI,CACHJ,UAAWK,EACT,GAAAC,OAlBY,WAmBZ,GAAGA,OAnBS,UAmBa,YAAAA,OAAAT,GACzBG,GAEFD,MAAOA,GAEQ,aAAdE,GAA4BC,GAC3BC,EAACI,cAAAH,EAAK,CAAAJ,UAAW,GAAGM,OAzBR,sBAyB+BJ,GAE7CC,EAAAI,cAACH,EAAK,CAAAJ,UAAW,GAAAM,OA3BH,UA2B6B,eACzCH,EAAAI,cAACH,EACC,CAAAJ,UAAWK,EAAW,UA7BZ,UA6B0B,mBAAmB,CAAEP,MAAKA,KAE7DH,IAGLQ,EAAAI,cAACH,EAAK,CAAAJ,UAAW,GAAAM,OAlCH,UAkC2B,aACvCH,EAACI,cAAAH,GAAKJ,UAAW,UAnCL,UAmCmB,WAAWP,KACvCC,GACDS,EAACI,cAAAH,GAAKJ,UAAW,UArCP,UAqCqB,iBAAiBN,IAK1D,EAOAH,EAAOiB,MAAQA"}
@@ -0,0 +1,2 @@
1
+ import{__read as e}from"../node_modules/tslib/tslib.es6.js";import{View as t}from"@tarojs/components";import c,{useState as n,useMemo as o}from"react";import r from"classnames";var s=function(s){var a=s.checked,i=void 0!==a&&a,l=s.checkedText,m=void 0===l?"":l,d=s.uncheckedText,h=void 0===d?"":d,u=s.onChange,f=s.className,p=s.disabled,x=e(n(i),2),k=x[0],v=x[1],b=o((function(){return k?m:h}),[k,m,h]);return c.createElement(t,{className:r("xh-switch",{checked:k},{disabled:p},f),onClick:function(){p||v((function(e){return null==u||u(!e),!e}))}},c.createElement(t,{className:"xh-switch-control"}),c.createElement(t,{className:"xh-switch-inner"},b))};export{s as default};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/Switch/index.tsx"],"sourcesContent":["import { View } from \"@tarojs/components\";\nimport React, { ReactNode, useMemo, useState } from \"react\";\nimport classNames from \"classnames\";\n\nimport \"./index.scss\";\nimport { XHComponentCommonProps } from \"../../types\";\n\nexport type SwitchProps = {\n checked?: boolean;\n checkedText?: ReactNode;\n uncheckedText?: ReactNode;\n onChange?: (checked: boolean) => void;\n disabled?: boolean;\n} & XHComponentCommonProps;\n\nconst Switch: React.FC<SwitchProps> = props => {\n const {\n checked = false,\n checkedText = \"\",\n uncheckedText = \"\",\n onChange,\n className,\n disabled,\n } = props;\n\n const [innerChecked, setInnerChecked] = useState(checked);\n\n const handleCheckedChange = () => {\n if (disabled) return;\n setInnerChecked(old => {\n onChange?.(!old);\n return !old;\n });\n };\n\n const checkedInner = useMemo(() => {\n if (innerChecked) return checkedText;\n return uncheckedText;\n }, [innerChecked, checkedText, uncheckedText]);\n\n return (\n <View\n className={classNames(\n \"xh-switch\",\n { checked: innerChecked },\n { disabled },\n className\n )}\n onClick={handleCheckedChange}\n >\n <View className=\"xh-switch-control\"></View>\n <View className=\"xh-switch-inner\">{checkedInner}</View>\n </View>\n );\n};\n\nexport default Switch;\n"],"names":["Switch","props","_a","checked","_b","checkedText","_c","uncheckedText","onChange","className","disabled","_d","__read","useState","innerChecked","setInnerChecked","checkedInner","useMemo","React","createElement","View","classNames","onClick","old"],"mappings":"iLAeM,IAAAA,EAAgC,SAAAC,GAElC,IAAAC,EAMED,EAAKE,QANPA,OAAO,IAAAD,GAAQA,EACfE,EAKEH,cALFI,aAAc,GAAED,EAChBE,EAIEL,EAJgBM,cAAlBA,OAAgB,IAAAD,EAAA,KAChBE,EAGEP,EAAKO,SAFPC,EAEER,EAFOQ,UACTC,EACET,WAEEU,EAAAC,EAAkCC,EAASV,GAAQ,GAAlDW,EAAYH,EAAA,GAAEI,OAUfC,EAAeC,GAAQ,WAC3B,OAAIH,EAAqBT,EAClBE,CACR,GAAE,CAACO,EAAcT,EAAaE,IAE/B,OACEW,EAACC,cAAAC,EACC,CAAAX,UAAWY,EACT,YACA,CAAElB,QAASW,GACX,CAAEJ,SAAQA,GACVD,GAEFa,QArBwB,WACtBZ,GACJK,GAAgB,SAAAQ,GAEd,OADAf,SAAAA,GAAYe,IACJA,CACV,GACF,GAiBIL,EAAAC,cAACC,EAAI,CAACX,UAAU,sBAChBS,EAACC,cAAAC,EAAK,CAAAX,UAAU,mBAAmBO,GAGzC"}
@@ -1,2 +1,2 @@
1
- import{__read as t}from"../../node_modules/tslib/tslib.es6.js";import e,{useState as a,useEffect as n}from"react";import{createSelectorQuery as o}from"@tarojs/taro";import{View as r}from"@tarojs/components";import i from"classnames";import c from"./TabItem.js";var l=function(c){var l=c.children,m=void 0===l?[]:l,s=c.animated,b=void 0!==s&&s,v=c.initIndex,h=void 0===v?0:v,p=c.lineColor,f=void 0===p?"#F6AB00":p,u=c.titleActiveColor,d=void 0===u?"#333":u,x=c.titleInctiveColor,C=void 0===x?"#999":x,g=c.onChange,y=t(a(h),2),E=y[0],I=y[1],N=t(a(0),2),T=N[0],k=N[1],A=t(a(0),2),j=A[0],R=A[1];n((function(){var t=setTimeout((function(){var e=o();e.selectAll(".xh-tabbar-nav-item").boundingClientRect(),e.selectAll(".xh-tabbar-content-item").boundingClientRect(),e.exec((function(e){if(e[0][E]){var a=e[0][E].width;if(k(a),e[1][E]){var n=e[1][E].height;R(n),clearTimeout(t)}}}))}),300)}),[E,m]);var X;return e.createElement(r,{className:"xh-tabbar"},e.createElement(r,{className:"xh-tabbar-nav"},m.map((function(t,a){return e.createElement(r,{key:a,className:"xh-tabbar-nav-item",style:{color:E===a?d:C},onClick:function(){return function(t){I(t);var e=o();e.selectAll(".xh-tabbar-content-item").boundingClientRect(),e.exec((function(e){if(e[0][t]){var a=e[0][t].height;R(a)}})),g&&g(t)}(a)}},t.props.TabItemComponent?t.props.TabItemComponent:t.props.title)})),(X=T/2+E*T,e.createElement("div",{className:i("xh-tabbar-nav-line",{"xh-tabbar-nav-line-active":b}),style:{background:"".concat(f),transform:"translateX(".concat(X,"px) translate(-50%, -50%)"),WebkitTransform:"translateX(".concat(X,"px) translate(-50%, -50%)")}}))),e.createElement(r,{className:"xh-tabbar-content",style:{width:"".concat(100*m.length,"%"),height:j?"".concat(j,"px"):"auto"}},m.map((function(t,a){return e.createElement(r,{key:a,className:i("xh-tabbar-content-item",{"xh-tabbar-content-item-dispaly":E!==a&&!b,"xh-tabbar-content-item-active":E===a}),style:{transform:b?"translateX(-".concat(100*E,"%)"):""}},t.props.children)}))))};l.Item=c;export{l as default};
1
+ import{__read as t}from"../../node_modules/tslib/tslib.es6.js";import e,{useState as a,useEffect as n}from"react";import{createSelectorQuery as o}from"@tarojs/taro";import{View as r}from"@tarojs/components";import i from"classnames";import c from"./TabItem.js";var l=function(c){var l=c.children,m=void 0===l?[]:l,s=c.animated,b=void 0!==s&&s,v=c.initIndex,h=void 0===v?0:v,p=c.lineColor,u=void 0===p?"#F6AB00":p,f=c.titleActiveColor,d=void 0===f?"#333":f,x=c.titleInctiveColor,C=void 0===x?"#999":x,g=c.onChange,y=c.content,E=t(a(h),2),I=E[0],N=E[1],T=t(a(0),2),k=T[0],A=T[1],j=t(a(0),2),R=j[0],X=j[1];n((function(){var t=setTimeout((function(){var e=o();e.selectAll(".xh-tabbar-nav-item").boundingClientRect(),e.selectAll(".xh-tabbar-content-item").boundingClientRect(),e.exec((function(e){if(e[0][I]){var a=e[0][I].width;if(A(a),e[1][I]){var n=e[1][I].height;X(n),clearTimeout(t)}}}))}),300)}),[I,m]);var w;return e.createElement(r,{className:"xh-tabbar"},e.createElement(r,{className:"xh-tabbar-nav"},m.map((function(t,a){return e.createElement(r,{key:a,className:"xh-tabbar-nav-item",style:{color:I===a?d:C},onClick:function(){return function(t){N(t);var e=o();e.selectAll(".xh-tabbar-content-item").boundingClientRect(),e.exec((function(e){if(e[0][t]){var a=e[0][t].height;X(a)}})),g&&g(t)}(a)}},t.props.TabItemComponent?t.props.TabItemComponent:t.props.title)})),(w=k/2+I*k,e.createElement("div",{className:i("xh-tabbar-nav-line",{"xh-tabbar-nav-line-active":b}),style:{background:"".concat(u),transform:"translateX(".concat(w,"px) translate(-50%, -50%)"),WebkitTransform:"translateX(".concat(w,"px) translate(-50%, -50%)")}}))),e.createElement(r,{className:"xh-tabbar-content",style:{width:"".concat(100*m.length,"%"),height:R?"".concat(R,"px"):"auto"}},y&&e.createElement(r,null,y),m.map((function(t,a){return e.createElement(r,{key:a,className:i("xh-tabbar-content-item",{"xh-tabbar-content-item-dispaly":I!==a&&!b,"xh-tabbar-content-item-active":I===a}),style:{transform:b?"translateX(-".concat(100*I,"%)"):""}},t.props.children)}))))};l.Item=c;export{l as default};
2
2
  //# sourceMappingURL=Tabbar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tabbar.js","sources":["../../../../src/components/Tabbar/tabbar/Tabbar.tsx"],"sourcesContent":["import React, { FC, ReactElement, useEffect, useState } from \"react\";\nimport { createSelectorQuery } from \"@tarojs/taro\";\nimport { View } from \"@tarojs/components\";\nimport classNames from \"classnames\";\nimport Item from \"./TabItem\";\n\n/**\n * Tab切换\n *\n * @param children //子组件\n * @param animated //是否开启转场动画\n * @param selectIndex //默认选中第几个\n * @param lineColor //下划线颜色\n * @param titleActiveColor //标题选中态颜色\n * @param titleInctiveColor //标题默认态颜色\n * @param onChange //切换回调事件\n *\n */\n\nexport interface TabProps {\n children: ReactElement[];\n animated?: boolean;\n initIndex?: number;\n lineColor?: string;\n titleActiveColor?: string;\n titleInctiveColor?: string;\n onChange?: (index: number) => void;\n}\n\nexport interface TabsComponent<P = {}> extends FC<P> {\n Item: typeof Item;\n}\n\nconst XHTabs: TabsComponent<TabProps> = props => {\n const {\n children = [],\n animated = false,\n initIndex = 0,\n lineColor = \"#F6AB00\",\n titleActiveColor = \"#333\",\n titleInctiveColor = \"#999\",\n onChange,\n } = props;\n\n const [selectIndex, setSelectIndex] = useState(initIndex);\n const [tabWdith, setTabWdith] = useState(0);\n const [tabContentHeight, setTabContentHeight] = useState(0);\n\n useEffect(() => {\n const timer = setTimeout(() => {\n const query = createSelectorQuery();\n query.selectAll(\".xh-tabbar-nav-item\").boundingClientRect();\n query.selectAll(\".xh-tabbar-content-item\").boundingClientRect();\n\n query.exec(res => {\n if (!res[0][selectIndex]) return;\n const width: number = res[0][selectIndex].width;\n setTabWdith(width);\n\n if (!res[1][selectIndex]) return;\n const height: number = res[1][selectIndex].height;\n setTabContentHeight(height);\n clearTimeout(timer);\n });\n }, 300);\n console.log(children.length);\n }, [selectIndex, children]);\n\n const handleClick = (index: number): void => {\n setSelectIndex(index);\n const query = createSelectorQuery();\n query.selectAll(\".xh-tabbar-content-item\").boundingClientRect();\n query.exec(res => {\n if (!res[0][index]) return;\n const height: number = res[0][index].height;\n setTabContentHeight(height);\n });\n\n onChange && onChange(index);\n };\n\n function renderLine(): ReactElement | null {\n const left: number = tabWdith / 2 + selectIndex * tabWdith;\n return (\n <div\n className={classNames(\"xh-tabbar-nav-line\", {\n \"xh-tabbar-nav-line-active\": animated,\n })}\n style={{\n background: `${lineColor}`,\n transform: `translateX(${left}px) translate(-50%, -50%)`,\n WebkitTransform: `translateX(${left}px) translate(-50%, -50%)`,\n }}\n />\n );\n }\n\n return (\n <View className=\"xh-tabbar\">\n <View className=\"xh-tabbar-nav\">\n {children.map((child, index) => (\n <View\n key={index}\n className=\"xh-tabbar-nav-item\"\n style={{\n color:\n selectIndex === index ? titleActiveColor : titleInctiveColor,\n }}\n onClick={() => handleClick(index)}\n >\n {child.props.TabItemComponent\n ? child.props.TabItemComponent\n : child.props.title}\n </View>\n ))}\n {renderLine()}\n </View>\n <View\n className=\"xh-tabbar-content\"\n style={{\n width: `${children.length * 100}%`,\n height: tabContentHeight ? `${tabContentHeight}px` : \"auto\",\n }}\n >\n {children.map((child, index) => (\n <View\n key={index}\n className={classNames(\"xh-tabbar-content-item\", {\n \"xh-tabbar-content-item-dispaly\":\n selectIndex !== index && !animated,\n \"xh-tabbar-content-item-active\": selectIndex === index,\n })}\n style={{\n transform: animated ? `translateX(-${selectIndex * 100}%)` : \"\",\n }}\n >\n {child.props.children}\n </View>\n ))}\n </View>\n </View>\n );\n};\n\nXHTabs.Item = Item;\n\nexport default XHTabs;\nexport const TabItem = Item;\n"],"names":["XHTabs","props","_a","children","_b","animated","_c","initIndex","_d","lineColor","_e","titleActiveColor","_f","titleInctiveColor","onChange","_g","__read","useState","selectIndex","setSelectIndex","_h","tabWdith","setTabWdith","_j","tabContentHeight","setTabContentHeight","useEffect","timer","setTimeout","query","createSelectorQuery","selectAll","boundingClientRect","exec","res","width","height","clearTimeout","left","React","createElement","View","className","map","child","index","key","style","color","onClick","handleClick","TabItemComponent","title","classNames","background","concat","transform","WebkitTransform","length","Item"],"mappings":"qQAiCM,IAAAA,EAAkC,SAAAC,GAEpC,IAAAC,EAOED,EAAKE,SAPPA,OAAW,IAAAD,EAAA,GAAEA,EACbE,EAMEH,EANcI,SAAhBA,OAAQ,IAAAD,GAAQA,EAChBE,EAKEL,EAAKM,UALPA,OAAY,IAAAD,EAAA,EAACA,EACbE,EAIEP,YAJFQ,OAAY,IAAAD,EAAA,UAASA,EACrBE,EAGET,EAHuBU,iBAAzBA,OAAgB,IAAAD,EAAG,OAAMA,EACzBE,EAEEX,EAAKY,kBAFPA,OAAoB,IAAAD,EAAA,OAAMA,EAC1BE,EACEb,EAAKa,SAEHC,EAAAC,EAAgCC,EAASV,GAAU,GAAlDW,EAAWH,EAAA,GAAEI,OACdC,EAAAJ,EAA0BC,EAAS,GAAE,GAApCI,EAAQD,EAAA,GAAEE,OACXC,EAAAP,EAA0CC,EAAS,GAAE,GAApDO,EAAgBD,EAAA,GAAEE,OAEzBC,GAAU,WACR,IAAMC,EAAQC,YAAW,WACvB,IAAMC,EAAQC,IACdD,EAAME,UAAU,uBAAuBC,qBACvCH,EAAME,UAAU,2BAA2BC,qBAE3CH,EAAMI,MAAK,SAAAC,GACT,GAAKA,EAAI,GAAGhB,GAAZ,CACA,IAAMiB,EAAgBD,EAAI,GAAGhB,GAAaiB,MAG1C,GAFAb,EAAYa,GAEPD,EAAI,GAAGhB,GAAZ,CACA,IAAMkB,EAAiBF,EAAI,GAAGhB,GAAakB,OAC3CX,EAAoBW,GACpBC,aAAaV,EAHoB,CAJA,CAQnC,GACD,GAAE,IAEL,GAAG,CAACT,EAAaf,IAEjB,IAcQmC,EAeR,OACEC,EAACC,cAAAC,EAAK,CAAAC,UAAU,aACdH,EAAAC,cAACC,EAAI,CAACC,UAAU,iBACbvC,EAASwC,KAAI,SAACC,EAAOC,GAAU,OAC9BN,EAAAC,cAACC,EACC,CAAAK,IAAKD,EACLH,UAAU,qBACVK,MAAO,CACLC,MACE9B,IAAgB2B,EAAQlC,EAAmBE,GAE/CoC,QAAS,WAAM,OAxCL,SAACJ,GACnB1B,EAAe0B,GACf,IAAMhB,EAAQC,IACdD,EAAME,UAAU,2BAA2BC,qBAC3CH,EAAMI,MAAK,SAAAC,GACT,GAAKA,EAAI,GAAGW,GAAZ,CACA,IAAMT,EAAiBF,EAAI,GAAGW,GAAOT,OACrCX,EAAoBW,EAFO,CAG7B,IAEAtB,GAAYA,EAAS+B,EACvB,CA6ByBK,CAAYL,KAE1BD,EAAM3C,MAAMkD,iBACTP,EAAM3C,MAAMkD,iBACZP,EAAM3C,MAAMmD,WA9BlBd,EAAejB,EAAW,EAAIH,EAAcG,EAEhDkB,EACEC,cAAA,MAAA,CAAAE,UAAWW,EAAW,qBAAsB,CAC1C,4BAA6BhD,IAE/B0C,MAAO,CACLO,WAAY,GAAGC,OAAA9C,GACf+C,UAAW,cAAcD,OAAAjB,EAA+B,6BACxDmB,gBAAiB,cAAcF,OAAAjB,EAA+B,kCA0BlEC,EAAAC,cAACC,EACC,CAAAC,UAAU,oBACVK,MAAO,CACLZ,MAAO,GAAGoB,OAAkB,IAAlBpD,EAASuD,OAAe,KAClCtB,OAAQZ,EAAmB,GAAG+B,OAAA/B,EAAoB,MAAG,SAGtDrB,EAASwC,KAAI,SAACC,EAAOC,GAAU,OAC9BN,gBAACE,EAAI,CACHK,IAAKD,EACLH,UAAWW,EAAW,yBAA0B,CAC9C,iCACEnC,IAAgB2B,IAAUxC,EAC5B,gCAAiCa,IAAgB2B,IAEnDE,MAAO,CACLS,UAAWnD,EAAW,eAAAkD,OAA6B,IAAdrC,EAAiB,MAAO,KAG9D0B,EAAM3C,MAAME,SAEhB,KAIT,EAEAH,EAAO2D,KAAOA"}
1
+ {"version":3,"file":"Tabbar.js","sources":["../../../../src/components/Tabbar/tabbar/Tabbar.tsx"],"sourcesContent":["import React, { FC, ReactElement, useEffect, useState, ReactNode } from \"react\";\nimport { createSelectorQuery } from \"@tarojs/taro\";\nimport { View } from \"@tarojs/components\";\nimport classNames from \"classnames\";\nimport Item from \"./TabItem\";\n\n/**\n * Tab切换\n *\n * @param children //子组件\n * @param animated //是否开启转场动画\n * @param selectIndex //默认选中第几个\n * @param lineColor //下划线颜色\n * @param titleActiveColor //标题选中态颜色\n * @param titleInctiveColor //标题默认态颜色\n * @param onChange //切换回调事件\n * @param content //item公共节点\n *\n */\n\nexport interface TabProps {\n children: ReactElement[];\n animated?: boolean;\n initIndex?: number;\n lineColor?: string;\n titleActiveColor?: string;\n titleInctiveColor?: string;\n onChange?: (index: number) => void;\n content?: string | ReactNode;\n}\n\nexport interface TabsComponent<P = {}> extends FC<P> {\n Item: typeof Item;\n}\n\nconst XHTabs: TabsComponent<TabProps> = props => {\n const {\n children = [],\n animated = false,\n initIndex = 0,\n lineColor = \"#F6AB00\",\n titleActiveColor = \"#333\",\n titleInctiveColor = \"#999\",\n onChange,\n content,\n } = props;\n\n const [selectIndex, setSelectIndex] = useState(initIndex);\n const [tabWdith, setTabWdith] = useState(0);\n const [tabContentHeight, setTabContentHeight] = useState(0);\n\n useEffect(() => {\n const timer = setTimeout(() => {\n const query = createSelectorQuery();\n query.selectAll(\".xh-tabbar-nav-item\").boundingClientRect();\n query.selectAll(\".xh-tabbar-content-item\").boundingClientRect();\n\n query.exec(res => {\n if (!res[0][selectIndex]) return;\n const width: number = res[0][selectIndex].width;\n setTabWdith(width);\n\n if (!res[1][selectIndex]) return;\n const height: number = res[1][selectIndex].height;\n setTabContentHeight(height);\n clearTimeout(timer);\n });\n }, 300);\n console.log(children.length);\n }, [selectIndex, children]);\n\n const handleClick = (index: number): void => {\n setSelectIndex(index);\n const query = createSelectorQuery();\n query.selectAll(\".xh-tabbar-content-item\").boundingClientRect();\n query.exec(res => {\n if (!res[0][index]) return;\n const height: number = res[0][index].height;\n setTabContentHeight(height);\n });\n\n onChange && onChange(index);\n };\n\n function renderLine(): ReactElement | null {\n const left: number = tabWdith / 2 + selectIndex * tabWdith;\n return (\n <div\n className={classNames(\"xh-tabbar-nav-line\", {\n \"xh-tabbar-nav-line-active\": animated,\n })}\n style={{\n background: `${lineColor}`,\n transform: `translateX(${left}px) translate(-50%, -50%)`,\n WebkitTransform: `translateX(${left}px) translate(-50%, -50%)`,\n }}\n />\n );\n }\n\n return (\n <View className=\"xh-tabbar\">\n <View className=\"xh-tabbar-nav\">\n {children.map((child, index) => (\n <View\n key={index}\n className=\"xh-tabbar-nav-item\"\n style={{\n color:\n selectIndex === index ? titleActiveColor : titleInctiveColor,\n }}\n onClick={() => handleClick(index)}\n >\n {child.props.TabItemComponent\n ? child.props.TabItemComponent\n : child.props.title}\n </View>\n ))}\n {renderLine()}\n </View>\n <View\n className=\"xh-tabbar-content\"\n style={{\n width: `${children.length * 100}%`,\n height: tabContentHeight ? `${tabContentHeight}px` : \"auto\",\n }}\n >\n {content && <View>{content}</View>}\n {children.map((child, index) => (\n <View\n key={index}\n className={classNames(\"xh-tabbar-content-item\", {\n \"xh-tabbar-content-item-dispaly\":\n selectIndex !== index && !animated,\n \"xh-tabbar-content-item-active\": selectIndex === index,\n })}\n style={{\n transform: animated ? `translateX(-${selectIndex * 100}%)` : \"\",\n }}\n >\n {child.props.children}\n </View>\n ))}\n </View>\n </View>\n );\n};\n\nXHTabs.Item = Item;\n\nexport default XHTabs;\nexport const TabItem = Item;\n"],"names":["XHTabs","props","_a","children","_b","animated","_c","initIndex","_d","lineColor","_e","titleActiveColor","_f","titleInctiveColor","onChange","content","_g","__read","useState","selectIndex","setSelectIndex","_h","tabWdith","setTabWdith","_j","tabContentHeight","setTabContentHeight","useEffect","timer","setTimeout","query","createSelectorQuery","selectAll","boundingClientRect","exec","res","width","height","clearTimeout","left","React","createElement","View","className","map","child","index","key","style","color","onClick","handleClick","TabItemComponent","title","classNames","background","concat","transform","WebkitTransform","length","Item"],"mappings":"qQAmCM,IAAAA,EAAkC,SAAAC,GAEpC,IAAAC,EAQED,EARWE,SAAbA,OAAQ,IAAAD,EAAG,GAAEA,EACbE,EAOEH,EAAKI,SAPPA,OAAW,IAAAD,GAAKA,EAChBE,EAMEL,EANWM,UAAbA,OAAS,IAAAD,EAAG,EAACA,EACbE,EAKEP,EALmBQ,UAArBA,OAAS,IAAAD,EAAG,UAASA,EACrBE,EAIET,EAAKU,iBAJPA,OAAmB,IAAAD,EAAA,OAAMA,EACzBE,EAGEX,EAAKY,kBAHPA,OAAoB,IAAAD,EAAA,OAAMA,EAC1BE,EAEEb,EAAKa,SADPC,EACEd,UAEEe,EAAAC,EAAgCC,EAASX,GAAU,GAAlDY,EAAWH,EAAA,GAAEI,OACdC,EAAAJ,EAA0BC,EAAS,GAAE,GAApCI,EAAQD,EAAA,GAAEE,OACXC,EAAAP,EAA0CC,EAAS,GAAE,GAApDO,EAAgBD,EAAA,GAAEE,OAEzBC,GAAU,WACR,IAAMC,EAAQC,YAAW,WACvB,IAAMC,EAAQC,IACdD,EAAME,UAAU,uBAAuBC,qBACvCH,EAAME,UAAU,2BAA2BC,qBAE3CH,EAAMI,MAAK,SAAAC,GACT,GAAKA,EAAI,GAAGhB,GAAZ,CACA,IAAMiB,EAAgBD,EAAI,GAAGhB,GAAaiB,MAG1C,GAFAb,EAAYa,GAEPD,EAAI,GAAGhB,GAAZ,CACA,IAAMkB,EAAiBF,EAAI,GAAGhB,GAAakB,OAC3CX,EAAoBW,GACpBC,aAAaV,EAHoB,CAJA,CAQnC,GACD,GAAE,IAEL,GAAG,CAACT,EAAahB,IAEjB,IAcQoC,EAeR,OACEC,EAACC,cAAAC,EAAK,CAAAC,UAAU,aACdH,EAAAC,cAACC,EAAI,CAACC,UAAU,iBACbxC,EAASyC,KAAI,SAACC,EAAOC,GAAU,OAC9BN,EAAAC,cAACC,EACC,CAAAK,IAAKD,EACLH,UAAU,qBACVK,MAAO,CACLC,MACE9B,IAAgB2B,EAAQnC,EAAmBE,GAE/CqC,QAAS,WAAM,OAxCL,SAACJ,GACnB1B,EAAe0B,GACf,IAAMhB,EAAQC,IACdD,EAAME,UAAU,2BAA2BC,qBAC3CH,EAAMI,MAAK,SAAAC,GACT,GAAKA,EAAI,GAAGW,GAAZ,CACA,IAAMT,EAAiBF,EAAI,GAAGW,GAAOT,OACrCX,EAAoBW,EAFO,CAG7B,IAEAvB,GAAYA,EAASgC,EACvB,CA6ByBK,CAAYL,KAE1BD,EAAM5C,MAAMmD,iBACTP,EAAM5C,MAAMmD,iBACZP,EAAM5C,MAAMoD,WA9BlBd,EAAejB,EAAW,EAAIH,EAAcG,EAEhDkB,EACEC,cAAA,MAAA,CAAAE,UAAWW,EAAW,qBAAsB,CAC1C,4BAA6BjD,IAE/B2C,MAAO,CACLO,WAAY,GAAGC,OAAA/C,GACfgD,UAAW,cAAcD,OAAAjB,EAA+B,6BACxDmB,gBAAiB,cAAcF,OAAAjB,EAA+B,kCA0BlEC,EAAAC,cAACC,EACC,CAAAC,UAAU,oBACVK,MAAO,CACLZ,MAAO,GAAGoB,OAAkB,IAAlBrD,EAASwD,OAAe,KAClCtB,OAAQZ,EAAmB,GAAG+B,OAAA/B,EAAoB,MAAG,SAGtDV,GAAWyB,EAAAC,cAACC,EAAI,KAAE3B,GAClBZ,EAASyC,KAAI,SAACC,EAAOC,GAAU,OAC9BN,EAAAC,cAACC,EACC,CAAAK,IAAKD,EACLH,UAAWW,EAAW,yBAA0B,CAC9C,iCACEnC,IAAgB2B,IAAUzC,EAC5B,gCAAiCc,IAAgB2B,IAEnDE,MAAO,CACLS,UAAWpD,EAAW,eAAAmD,OAA6B,IAAdrC,EAAiB,MAAO,KAG9D0B,EAAM5C,MAAME,SAEhB,KAIT,EAEAH,EAAO4D,KAAOA"}
@@ -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";
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";
2
2
  //# sourceMappingURL=index.js.map