aha-components 1.7.7 → 1.7.8

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.
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as n,Fragment as t}from"react/jsx-runtime";import o,{createContext as i,useContext as r,useState as l,forwardRef as a,useRef as d,useEffect as p,useCallback as s,useMemo as u}from"react";import{createPortal as c}from"react-dom";var h=function(){return h=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},h.apply(this,arguments)};function f(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(e);i<o.length;i++)n.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(t[o[i]]=e[o[i]])}return t}function x(e,n,t){if(t||2===arguments.length)for(var o,i=0,r=n.length;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var g={primaryColor:"#FB6011"},m=i(g),v=function(){var e=r(m);return e||g},y={small:{height:"32px",paddingLeft:"12px",paddingRight:"12px",fontSize:"14px",lineHeight:"20px",iconSize:"16px",gap:"6px"},mediumSmall:{height:"36px",paddingLeft:"14px",paddingRight:"14px",fontSize:"14px",lineHeight:"20px",iconSize:"16px",gap:"6px"},medium:{height:"40px",paddingLeft:"16px",paddingRight:"16px",fontSize:"14px",lineHeight:"20px",iconSize:"18px",gap:"8px"},large:{height:"48px",paddingLeft:"20px",paddingRight:"20px",fontSize:"16px",lineHeight:"24px",iconSize:"20px",gap:"8px"}},b=function(o){var i=o.size,r=o.color;return e(t,{children:[n("style",{children:"\n @keyframes aha-button-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "}),e("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"none",style:{animation:"aha-button-spin 1s linear infinite"},children:[n("circle",{cx:"12",cy:"12",r:"10",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"24",opacity:"0.3"}),n("circle",{cx:"12",cy:"12",r:"10",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"16"})]})]})},w=function(t){var o,i=t.children,r=t.type,a=void 0===r?"default":r,d=t.size,p=void 0===d?"medium":d,s=t.disabled,u=void 0!==s&&s,c=t.loading,x=void 0!==c&&c,g=t.onClick,m=t.htmlType,w=void 0===m?"button":m,F=t.className,C=void 0===F?"":F,k=t.style,S=t.icon,z=t.iconPosition,A=void 0===z?"left":z,E=f(t,["children","type","size","disabled","loading","onClick","htmlType","className","style","icon","iconPosition"]),D=v().primaryColor,L=void 0===D?"#FB6011":D,B=l(!1),M=B[0],W=B[1],H=l(!1),j=H[0],R=H[1],I=y[p],N=u||x,O=function(){if(x){var e="primary"===a?"#FFFFFF":"#101828",t=parseInt(I.iconSize.replace("px",""));return n(b,{size:t,color:e})}return S?n("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:I.iconSize,height:I.iconSize,flexShrink:0},children:S}):null},T=(o=h({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:I.gap,height:I.height,paddingLeft:I.paddingLeft,paddingRight:I.paddingRight,fontSize:I.fontSize,lineHeight:I.lineHeight,fontWeight:500,fontFamily:"DM Sans, sans-serif",borderRadius:"8px",border:"none",cursor:N?"not-allowed":"pointer",outline:"none",transition:"all 0.2s",userSelect:"none",WebkitTapHighlightColor:"transparent"},k),"primary"===a?(o.color="#FFFFFF",o.backgroundColor=L,u?(o.opacity=.4,o.cursor="not-allowed"):x?o.backgroundColor=L:j?o.backgroundColor="#EC470A":M&&(o.backgroundColor="#FD843A")):u?(o.backgroundColor="#FAFAF9",o.color="#D6D3D1",o.border="1px solid #E7E5E4"):x?(o.backgroundColor="#FFFFFF",o.color="#101828",o.border="1px solid #E7E5E4",o.boxShadow="0px 1px 2px 0px rgba(12, 10, 9, 0.05)"):j?(o.backgroundColor="#F5F5F4",o.color="#101828",o.border="1px solid #D7D3D0",o.boxShadow="0px 1px 2px 0px rgba(12, 10, 9, 0.05)"):M?(o.backgroundColor="#FAFAF9",o.color="#101828",o.border="1px solid #D7D3D0",o.boxShadow="0px 2px 4px 0px rgba(12, 10, 9, 0.08)"):(o.backgroundColor="#FFFFFF",o.color="#101828",o.border="1px solid #E7E5E4",o.boxShadow="0px 1px 2px 0px rgba(12, 10, 9, 0.05)"),o);return e("button",h({type:w,className:"aha-button aha-button--".concat(a," aha-button--").concat(p," ").concat(N?"aha-button--disabled":""," ").concat(x?"aha-button--loading":""," ").concat(C),disabled:N,onClick:function(e){N?e.preventDefault():null==g||g(e)},onMouseEnter:function(){return!N&&W(!0)},onMouseLeave:function(){W(!1),R(!1)},onMouseDown:function(){return!N&&R(!0)},onMouseUp:function(){return R(!1)},style:T},E,{children:[x&&O(),!x&&"left"===A&&O(),i&&n("span",{style:{display:"inline-block"},children:i}),!x&&"right"===A&&O()]}))};w.displayName="Button";var F=a(function(i,r){var l=i.size,a=void 0===l?"medium":l,s=i.disabled,u=void 0!==s&&s,c=i.error,x=void 0!==c&&c,g=i.readOnly,m=void 0!==g&&g,y=i.prefix,b=i.suffix,w=i.allowClear,F=void 0!==w&&w,C=i.onClear,k=i.className,S=void 0===k?"":k,z=i.style,A=i.type,E=void 0===A?"text":A,D=i.placeholder,L=i.value,B=i.defaultValue,M=i.onChange,W=i.onFocus,H=i.onBlur,j=i.onPressEnter,R=f(i,["size","disabled","error","readOnly","prefix","suffix","allowClear","onClear","className","style","type","placeholder","value","defaultValue","onChange","onFocus","onBlur","onPressEnter"]),I=v().primaryColor,N=void 0===I?"#FB6011":I,O=d(null),T=o.useState(B||L||""),P=T[0],Y=T[1],V=o.useState(!1),K=V[0],q=V[1];p(function(){"function"==typeof r?r(O.current):r&&(r.current=O.current)},[r]);var U=void 0!==L,G=U?L:P,J=function(e){var n;e.stopPropagation(),U||Y("");null==M||M({target:{value:""},currentTarget:{value:""}}),null==C||C(),null===(n=O.current)||void 0===n||n.focus()},Q=F&&G&&!u,X={small:{height:"32px",paddingTop:"3px",paddingBottom:"3px"},mediumSmall:{height:"36px",paddingTop:"5px",paddingBottom:"5px"},medium:{height:"40px",paddingTop:"7px",paddingBottom:"7px"},large:{height:"48px",paddingTop:"11px",paddingBottom:"11px"}},_=b||Q?"40px":"12px",Z=h({width:"100%",boxSizing:"border-box",fontFamily:"DM Sans, sans-serif",borderRadius:"8px",border:"1px solid ".concat(x?"#F04438":K?N:"#D7D3D0"),backgroundColor:u||m?"#FAFAF9":"#FFFFFF",color:u?"#98A2B3":"#1C1917",fontSize:"16px",fontWeight:400,lineHeight:"24px",paddingLeft:y?"40px":"12px",paddingRight:_,paddingTop:X[a].paddingTop,paddingBottom:X[a].paddingBottom,transition:"all 0.2s",outline:"none",WebkitAppearance:"none",MozAppearance:"textfield",appearance:"none"},z);return e(t,{children:[n("style",{children:'\n .aha-input-wrapper input::placeholder {\n color: #D7D3D0;\n font-size: 16px;\n font-weight: 400;\n opacity: 1;\n }\n .aha-input-wrapper input::-webkit-input-placeholder {\n color: #D7D3D0;\n font-size: 16px;\n font-weight: 400;\n opacity: 1;\n }\n .aha-input-wrapper input::-moz-placeholder {\n color: #D7D3D0;\n font-size: 16px;\n font-weight: 400;\n opacity: 1;\n }\n .aha-input-wrapper input:-ms-input-placeholder {\n color: #D7D3D0;\n font-size: 16px;\n font-weight: 400;\n opacity: 1;\n }\n /* 移动端优化 */\n .aha-input-wrapper input {\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n touch-action: manipulation;\n }\n /* 移除数字输入框的上下箭头 */\n .aha-input-wrapper input[type="number"]::-webkit-inner-spin-button,\n .aha-input-wrapper input[type="number"]::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n .aha-input-wrapper input[type="number"] {\n -moz-appearance: textfield;\n }\n '}),e("div",{className:"aha-input-wrapper ".concat(S),style:{position:"relative",display:"inline-flex",alignItems:"center",width:"100%"},children:[y&&n("span",{style:{position:"absolute",left:"12px",display:"flex",alignItems:"center",color:u?"#98A2B3":"#78716C",zIndex:1,pointerEvents:"none"},children:y}),n("input",h({ref:O,type:E,value:G,placeholder:D,disabled:u,readOnly:m,onChange:function(e){U||Y(e.target.value),null==M||M(e)},onFocus:function(e){q(!0),null==W||W(e)},onBlur:function(e){q(!1),null==H||H(e)},onKeyDown:function(e){var n;"Enter"===e.key&&j&&j(e),null===(n=R.onKeyDown)||void 0===n||n.call(R,e)},style:Z,autoComplete:R.autoComplete||"off",autoCorrect:R.autoCorrect||"off",autoCapitalize:R.autoCapitalize||"off",spellCheck:R.spellCheck||!1},R)),(b||Q)&&e("span",{style:{position:"absolute",right:"12px",display:"flex",alignItems:"center",gap:"4px",color:u?"#98A2B3":"#78716C",zIndex:1},children:[Q&&n(function(){return n("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:J,style:{cursor:"pointer",flexShrink:0,color:"#78716C"},children:n("path",{d:"M12 4L4 12M4 4L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},{}),b&&n("span",{style:{pointerEvents:"none"},children:b})]})]})]})});F.displayName="Input";var C=function(i){var r,a=i.value,f=i.defaultValue,g=i.options,m=void 0===g?[]:g,y=i.mode,b=i.disabled,w=void 0!==b&&b,F=i.error,C=void 0!==F&&F,k=i.placeholder,S=void 0===k?"Please select":k,z=i.size,A=void 0===z?"medium":z,E=i.showSearch,D=void 0!==E&&E,L=i.filterOption,B=void 0===L||L,M=i.allowClear,W=void 0!==M&&M,H=i.onChange,j=i.onSelect,R=i.onDeselect,I=i.onSearch,N=i.onFocus,O=i.onBlur,T=i.onDropdownVisibleChange,P=i.className,Y=void 0===P?"":P,V=i.style,K=i.dropdownClassName,q=void 0===K?"":K,U=i.dropdownStyle,G=i.defaultOpen,J=void 0!==G&&G,Q=i.open,X=i.maxTagCount,_=i.tagRender,Z=i.optionRender,$=v().primaryColor,ee=void 0===$?"#FB6011":$,ne=l(void 0!==f?f:y?[]:void 0),te=ne[0],oe=ne[1],ie=l(J),re=ie[0],le=ie[1],ae=l(""),de=ae[0],pe=ae[1],se=l(-1),ue=se[0],ce=se[1],he=d(null),fe=d(null),xe=d(null),ge=l(null),me=ge[0],ve=ge[1],ye=void 0!==a,be=void 0!==Q,we=ye?a:te,Fe=be?Q:re,Ce="multiple"===y||"tags"===y,ke=s(function(){if(!we)return[];var e=Array.isArray(we)?we:[we];return m.filter(function(n){return e.includes(n.value)})},[we,m]),Se=s(function(){return D&&de?!1===B?m:"function"==typeof B?m.filter(function(e){return B(de,e)}):m.filter(function(e){var n=String(e.label||"").toLowerCase(),t=de.toLowerCase();return n.includes(t)}):m},[m,de,D,B]),ze=u(function(){return Se()},[Se]);p(function(){if(Fe&&he.current){var e=function(){var e,n;if(he.current){var t=he.current.getBoundingClientRect(),o=null!==(n=null===(e=xe.current)||void 0===e?void 0:e.offsetHeight)&&void 0!==n?n:Math.min(256,Math.max(40,40*ze.length)),i=window.innerHeight-t.bottom,r=t.top,l=i<o+4&&r>i,a=l?t.top+window.scrollY-o-4:t.bottom+window.scrollY+4;ve({top:a,left:t.left+window.scrollX,width:t.width,placement:l?"top":"bottom"})}};return e(),requestAnimationFrame(e),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),function(){window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}}ve(null)},[Fe,ze.length]),p(function(){var e=function(e){var n=e.target;he.current&&!he.current.contains(n)&&xe.current&&!xe.current.contains(n)&&(be||le(!1),null==T||T(!1),pe(""))};if(Fe)return document.addEventListener("mousedown",e,!0),document.addEventListener("touchstart",e,!0),function(){document.removeEventListener("mousedown",e,!0),document.removeEventListener("touchstart",e,!0)}},[Fe,be,T]),p(function(){if(Fe){var e=function(e){var n;if("ArrowDown"===e.key)e.preventDefault(),ce(function(e){return e<ze.length-1?e+1:e});else if("ArrowUp"===e.key)e.preventDefault(),ce(function(e){return e>0?e-1:0});else if("Enter"===e.key&&ue>=0){e.preventDefault();var t=ze[ue];t&&!t.disabled&&Ae(t)}else"Escape"===e.key&&(e.preventDefault(),be||le(!1),null==T||T(!1),null===(n=he.current)||void 0===n||n.focus())};return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}}},[Fe,ze,ue,be,T]),p(function(){if(ue>=0&&xe.current){var e=xe.current.querySelectorAll(".aha-select-option")[ue];e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})}},[ue]);var Ae=s(function(e){var n;if(!e.disabled)if(Ce){var t,o=Array.isArray(we)?we:[];o.includes(e.value)?(t=o.filter(function(n){return n!==e.value}),null==R||R(e.value,e)):(t=x(x([],o,!0),[e.value],!1),null==j||j(e.value,e)),ye||oe(t);var i=m.filter(function(e){return t.includes(e.value)});null==H||H(t,i)}else ye||oe(e.value),null==H||H(e.value,e),null==j||j(e.value,e),be||le(!1),null==T||T(!1),pe(""),null===(n=he.current)||void 0===n||n.focus()},[Ce,we,ye,be,m,H,j,R,T]),Ee=s(function(e,n){if(e.stopPropagation(),Ce&&Array.isArray(we)){var t=we.filter(function(e){return e!==n}),o=m.find(function(e){return e.value===n});ye||oe(t),null==H||H(t,ke()),null==R||R(n,o)}},[Ce,we,ye,m,H,R,ke]),De=function(e){e.stopPropagation();var n=Ce?[]:void 0;ye||oe(n),null==H||H(n,[]),pe("")},Le={small:{height:"32px",paddingTop:"3px",paddingBottom:"3px",fontSize:"16px",lineHeight:"24px"},mediumSmall:{height:"36px",paddingTop:"5px",paddingBottom:"5px",fontSize:"16px",lineHeight:"24px"},medium:{height:"40px",paddingTop:"7px",paddingBottom:"7px",fontSize:"16px",lineHeight:"24px"},large:{height:"48px",paddingTop:"11px",paddingBottom:"11px",fontSize:"16px",lineHeight:"24px"}},Be=u(function(){return ke()},[ke]),Me=u(function(){return W&&we&&!w},[W,we,w]),We=u(function(){return Ce?Array.isArray(we)&&we.length>0:null!=we&&""!==we},[Ce,we]),He=u(function(){if(!Ce||!Array.isArray(we)||0===we.length)return null;var t="responsive"===X?Be.slice(0,2):X?Be.slice(0,X):Be,i=X&&Be.length>t.length?Be.length-t.length:0;return e("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"4px",flex:1,minWidth:0},children:[t.map(function(t){var i={label:t.label,value:t.value,closable:!w,onClose:function(){return Ee({},t.value)}};return _?n(o.Fragment,{children:_(i)},t.value):e("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",backgroundColor:"#F5F5F4",borderRadius:"4px",fontSize:"12px",lineHeight:"18px",color:"#101828",fontFamily:"DM Sans, sans-serif",maxWidth:"100%"},children:[n("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.label}),!w&&n("span",{onClick:function(e){return Ee(e,t.value)},style:{cursor:"pointer",display:"flex",alignItems:"center",color:"#78716C",marginLeft:"4px"},children:n("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n("path",{d:"M9 3L3 9M3 3L9 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]},t.value)}),i>0&&e("span",{style:{fontSize:"12px",lineHeight:"18px",color:"#78716C",fontFamily:"DM Sans, sans-serif"},children:["+",i]})]})},[Ce,we,Be,X,w,_]);return e(t,{children:[n("style",{children:"\n @keyframes dropdownFadeIn {\n from {\n opacity: 0;\n transform: translateY(-8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n "}),e("div",{ref:he,className:"aha-select ".concat(Y),style:h({position:"relative",display:"inline-flex",alignItems:"center",width:"100%",minWidth:"120px",boxSizing:"border-box",fontFamily:"DM Sans, sans-serif",borderRadius:"8px",border:"1px solid ".concat(C?"#F04438":Fe?ee:"#D7D3D0"),backgroundColor:w?"#FAFAF9":"#FFFFFF",cursor:w?"not-allowed":"pointer",transition:"all 0.2s",paddingLeft:"12px",paddingRight:"36px",paddingTop:Le[A].paddingTop,paddingBottom:Le[A].paddingBottom,fontSize:Le[A].fontSize,lineHeight:Le[A].lineHeight,fontWeight:400,WebkitTapHighlightColor:"transparent",WebkitTouchCallout:"none",touchAction:"manipulation",userSelect:"none"},V),onClick:function(){if(!w){var e=!Fe;be||le(e),null==T||T(e),e&&D?setTimeout(function(){var e;null===(e=fe.current)||void 0===e||e.focus()},0):pe("")}},onFocus:function(e){null==N||N(e)},onBlur:function(e){null==O||O(e)},onTouchStart:function(e){w||(e.currentTarget.style.opacity="0.8")},onTouchEnd:function(e){e.currentTarget.style.opacity="1"},tabIndex:w?-1:0,children:[n("div",{style:{display:"flex",alignItems:"center",flex:1,minWidth:0,gap:"8px"},children:Ce?He||n("span",S?{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"#79716B",fontSize:"16px",lineHeight:"24px",fontWeight:400},children:S}:{style:{flex:1,minHeight:"24px"}}):D&&Fe?n("input",{ref:fe,type:"text",value:de,onChange:function(e){var n=e.target.value;pe(n),null==I||I(n),ce(-1)},onClick:function(e){return e.stopPropagation()},onFocus:function(e){return e.stopPropagation()},style:{flex:1,border:"none",outline:"none",background:"transparent",fontSize:"16px",lineHeight:"24px",fontWeight:400,color:w?"#98A2B3":"#1C1917",fontFamily:"DM Sans, sans-serif",minWidth:0,WebkitAppearance:"none",appearance:"none"},placeholder:We?void 0:S,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}):n("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:We?w?"#98A2B3":"#1C1917":"#79716B",fontSize:"16px",lineHeight:"24px",fontWeight:400,minHeight:"24px",display:"inline-block"},children:We?(null===(r=Be[0])||void 0===r?void 0:r.label)||we:S||" "})}),e("div",{style:{position:"absolute",right:"12px",display:"flex",alignItems:"center",gap:"4px"},children:[Me&&n(function(){return n("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:De,style:{cursor:"pointer",flexShrink:0,color:"#78716C"},children:n("path",{d:"M12 4L4 12M4 4L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},{}),n(function(e){var t=e.isOpen;return n("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{transform:t?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease-in-out",flexShrink:0},children:n("path",{d:"M4 6L8 10L12 6",stroke:"#78716C",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},{isOpen:Fe})]})]}),Fe&&me&&c(n("div",{ref:xe,className:"aha-select-dropdown ".concat(q),style:h({position:"absolute",top:"".concat(me.top,"px"),left:"".concat(me.left,"px"),width:"".concat(me.width,"px"),zIndex:1050,backgroundColor:"#FFFFFF",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",border:"1px solid #E7E5E4",maxHeight:"256px",overflow:"auto",opacity:0,transform:"top"===me.placement?"translateY(8px)":"translateY(-8px)",animation:"dropdownFadeIn 0.2s ease-out forwards",transformOrigin:"top"===me.placement?"bottom center":"top center",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain"},U),children:0===ze.length?n("div",{style:{padding:"8px 16px",textAlign:"center",color:"#78716C",fontSize:"14px",fontFamily:"DM Sans, sans-serif"},children:"No data"}):ze.map(function(t,o){var i=Ce?Array.isArray(we)&&we.includes(t.value):we===t.value,r=o===ue;return Z?n("div",{className:"aha-select-option ".concat(t.disabled?"":"hover:bg-[#FAFAF9]"," ").concat(i?"bg-[#FAFAF9]":""),onClick:function(){return!t.disabled&&Ae(t)},style:{cursor:t.disabled?"not-allowed":"pointer",transition:"background-color 0.2s"},children:Z(t,{selected:i,focused:r,disabled:t.disabled||!1})},t.value):e("div",{className:"aha-select-option ".concat(t.disabled?"":"hover:bg-[#FAFAF9]"," ").concat(i?"bg-[#FAFAF9]":""),onClick:function(){return Ae(t)},style:{padding:"8px 16px",cursor:t.disabled?"not-allowed":"pointer",color:t.disabled?"#98A2B3":"#101828",fontSize:"14px",lineHeight:"20px",fontFamily:"DM Sans, sans-serif",display:"flex",alignItems:"center",justifyContent:"space-between",transition:"background-color 0.2s"},children:[n("span",{children:t.label}),i&&n("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:r?"hidden":"",children:n("path",{d:"M13.3333 4L6 11.3333L2.66667 8",stroke:ee,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},t.value)})}),document.body)]})};C.displayName="Select";var k=function(e){var t=e.className,o=e.style;return n("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:o,children:n("path",{d:"M15.8334 10H4.16675M4.16675 10L10.0001 15.8334M4.16675 10L10.0001 4.16669",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})})},S=function(e){var t=e.className,o=e.style;return n("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:o,children:n("path",{d:"M4.16675 10H15.8334M15.8334 10L10.0001 4.16669M15.8334 10L10.0001 15.8334",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})})},z=function(o){var i=o.current,r=o.defaultCurrent,a=void 0===r?1:r,d=o.total,s=void 0===d?0:d,c=o.pageSize,f=o.defaultPageSize,x=void 0===f?10:f,g=o.showSizeChanger,m=void 0!==g&&g,y=o.pageSizeOptions,b=void 0===y?["10","20","50","100"]:y,z=o.showQuickJumper,A=void 0!==z&&z,E=o.showTotal,D=o.onChange,L=o.onShowSizeChange,B=o.simple,M=void 0!==B&&B,W=o.disabled,H=void 0!==W&&W,j=o.hideOnSinglePage,R=void 0!==j&&j,I=o.className,N=void 0===I?"":I,O=o.style,T=o.size,P=void 0===T?"default":T,Y=o.responsive,V=void 0!==Y&&Y;o.showLessItems;var K=o.itemRender,q=v().primaryColor,U=void 0===q?"#FB6011":q,G=l(a),J=G[0],Q=G[1],X=l(x),_=X[0],Z=X[1],$=l(""),ee=$[0],ne=$[1],te=null!=i?i:J,oe=null!=c?c:_,ie=u(function(){return Math.ceil(s/oe)},[s,oe]);p(function(){void 0!==i&&Q(i)},[i]),p(function(){void 0!==c&&Z(c)},[c]);var re=function(e){e<1||e>ie||e===te||H||(void 0===i&&Q(e),null==D||D(e,oe))},le=function(){var e=parseInt(ee,10);e>=1&&e<=ie&&(re(e),ne(""))};if(R&&ie<=1)return null;if(M)return e("div",{className:"aha-pagination aha-pagination-simple ".concat(N),style:O,children:[n(w,{onClick:function(){return re(te-1)},disabled:H||1===te,type:"default",size:"default"===P?"medium":"small",style:{marginRight:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(k,{})}),e("span",{style:{margin:"0 8px",fontSize:"14px",lineHeight:"20px",color:"#475467",fontFamily:"DM Sans, sans-serif"},children:[te," / ",ie]}),n(w,{onClick:function(){return re(te+1)},disabled:H||te===ie,type:"default",size:"default"===P?"medium":"small",style:{marginLeft:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(S,{})})]});var ae=(te-1)*oe+1,de=Math.min(te*oe,s);return e("div",{className:"aha-pagination w-full ".concat(N),style:h({display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:V?"wrap":"nowrap",fontFamily:"DM Sans, sans-serif"},O),children:[E&&n("div",{className:"justify-start text-Text-text-secondary text-sm font-medium font-['DM_Sans'] leading-5",children:E(s,[ae,de])}),e("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[s>0&&n(t,{children:K?K(te-1,"prev",n(w,{onClick:function(){return re(te-1)},disabled:H||1===te,type:"default",size:"default"===P?"medium":"small",style:{height:"small"===P?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(k,{})})):n(w,{onClick:function(){return re(te-1)},disabled:H||1===te,type:"default",size:"default"===P?"medium":"small",style:{height:"small"===P?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(k,{})})}),n("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:function(){if(ie<=7)return Array.from({length:ie},function(e,n){return n+1});var e=[];if(te<=4){for(var n=1;n<=5;n++)e.push(n);e.push("jump-next"),e.push(ie)}else if(te>=ie-3){e.push(1),e.push("jump-prev");for(n=ie-4;n<=ie;n++)e.push(n)}else{e.push(1),e.push("jump-prev");for(n=te-1;n<=te+1;n++)e.push(n);e.push("jump-next"),e.push(ie)}return e}().map(function(e){return function(e){if("number"==typeof e){var t=e===te,o=n(w,{onClick:function(){return re(e)},disabled:H,type:t?"primary":"default",size:"default"===P?"medium":"small",style:{minWidth:"small"===P?"32px":"36px",height:"small"===P?"32px":"36px",padding:"0 12px",margin:0,fontWeight:t?500:400,border:t?"1px solid ".concat(U):void 0,boxShadow:"none",borderRadius:"8px"},children:e},e);return K?K(e,"page",o):o}if("jump-prev"===e)return o=n(w,{onClick:function(){return re(Math.max(1,te-5))},disabled:H,type:"default",size:"default"===P?"medium":"small",style:{minWidth:"small"===P?"32px":"36px",height:"small"===P?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-prev"),K?K(te-5,"jump-prev",o):o;if("jump-next"===e)return o=n(w,{onClick:function(){return re(Math.min(ie,te+5))},disabled:H,type:"default",size:"default"===P?"medium":"small",style:{minWidth:"small"===P?"32px":"36px",height:"small"===P?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-next"),K?K(te+5,"jump-next",o):o;return null}(e)})}),s>0&&n(t,{children:K?K(te+1,"next",n(w,{onClick:function(){return re(te+1)},disabled:H||te===ie,type:"default",size:"default"===P?"medium":"small",style:{height:"small"===P?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(S,{})})):n(w,{onClick:function(){return re(te+1)},disabled:H||te===ie,type:"default",size:"default"===P?"medium":"small",style:{height:"small"===P?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(S,{})})}),m&&n(C,{value:oe,options:b.map(function(e){return{label:"".concat(e," / page"),value:Number(e)}}),onChange:function(e){return n=Number(e),t=Math.ceil(s/n),o=te>t?t:te,void 0===c&&Z(n),void 0===i&&Q(o),null==L||L(o,n),void(null==D||D(o,n));var n,t,o},disabled:H,size:"small"===P?"small":"medium",style:{minWidth:"small"===P?80:96}}),A&&e("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontFamily:"DM Sans, sans-serif"},children:[n("span",{style:{fontSize:"14px",lineHeight:"20px",color:"#475467"},children:"Go to"}),n(F,{type:"number",min:1,value:ee,onChange:function(e){return ne(e.target.value)},onPressEnter:le,disabled:H,size:"small"===P?"small":"medium",style:{width:56,minWidth:56}}),n("span",{style:{fontSize:"14px",lineHeight:"20px",color:"#475467"},children:"page"}),"object"==typeof A&&A.goButton?n(w,{onClick:le,disabled:H,type:"default",size:"default"===P?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:A.goButton}):n(w,{onClick:le,disabled:H,type:"default",size:"default"===P?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"OK"})]})]})]})};export{z as default};
1
+ import{jsxs as e,jsx as n,Fragment as o}from"react/jsx-runtime";import r,{createContext as t,useContext as i,useState as a,forwardRef as l,useRef as d,useEffect as s,useCallback as p,useMemo as c}from"react";import{createPortal as u}from"react-dom";var f=function(){return f=Object.assign||function(e){for(var n,o=1,r=arguments.length;o<r;o++)for(var t in n=arguments[o])Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e},f.apply(this,arguments)};function h(e,n){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(r=Object.getOwnPropertySymbols(e);t<r.length;t++)n.indexOf(r[t])<0&&Object.prototype.propertyIsEnumerable.call(e,r[t])&&(o[r[t]]=e[r[t]])}return o}function g(e,n,o){if(o||2===arguments.length)for(var r,t=0,i=n.length;t<i;t++)!r&&t in n||(r||(r=Array.prototype.slice.call(n,0,t)),r[t]=n[t]);return e.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var v={primaryColor:"#FB6011"},m=t(v),x=function(){var e=i(m);return e||v},y={sm:"sm",md:"md",lg:"lg",xl:"xl",small:"sm",mediumSmall:"sm",medium:"md",large:"xl"},b={primary:"primary",secondary:"secondary",tertiary:"tertiary","link-color":"link-color","link-gray":"link-gray","destructive-primary":"destructive-primary","destructive-secondary":"destructive-secondary","destructive-tertiary":"destructive-tertiary","destructive-link":"destructive-link",default:"secondary"},w={sm:{height:36,paddingX:12,paddingXLg:12,fontSize:14,lineHeight:20,iconSize:20,gap:4,iconOnlyPad:8},md:{height:40,paddingX:14,paddingXLg:14,fontSize:14,lineHeight:20,iconSize:20,gap:4,iconOnlyPad:10},lg:{height:44,paddingX:16,paddingXLg:16,fontSize:16,lineHeight:24,iconSize:20,gap:6,iconOnlyPad:12},xl:{height:48,paddingX:18,paddingXLg:18,fontSize:16,lineHeight:24,iconSize:20,gap:6,iconOnlyPad:14}},k=function(r){var t=r.size,i=r.color;return e(o,{children:[n("style",{children:"@keyframes aha-button-spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}"}),e("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,style:{animation:"aha-button-spin 1s linear infinite",flexShrink:0},children:[n("circle",{cx:"12",cy:"12",r:"10",stroke:i,strokeWidth:"2",opacity:"0.25"}),n("path",{d:"M22 12a10 10 0 0 1-10 10",stroke:i,strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})]})},C=function(o){var r=o.children,t=o.type,i=void 0===t?"secondary":t,l=o.size,d=void 0===l?"md":l,s=o.disabled,p=void 0!==s&&s,c=o.loading,u=void 0!==c&&c,g=o.iconOnly,v=o.focused,m=void 0!==v&&v,C=o.onClick,S=o.htmlType,F=void 0===S?"button":S,z=o.className,L=void 0===z?"":z,A=o.style,D=o.icon,E=o.iconPosition,B=void 0===E?"left":E,M=h(o,["children","type","size","disabled","loading","iconOnly","focused","onClick","htmlType","className","style","icon","iconPosition"]),W=x().primaryColor,O=a(!1),j=O[0],H=O[1],I=a(!1),N=I[0],R=I[1],T=b[i]||"secondary",P=w[y[d]||"md"],_=null!=g?g:!!D&&null==r,X="link-color"===T||"link-gray"===T||"destructive-link"===T,q=p||u,Y=m,V=W,K=function(){if(p)return"primary"===T||"secondary"===T||"destructive-primary"===T||"destructive-secondary"===T?{bg:"var(--color-bg-disabled, #f5f5f4)",color:"var(--color-fg-disabled, #a9a29d)",iconColor:"var(--color-fg-disabled, #a9a29d)",border:"1px solid var(--color-border-disabled_subtle, #e7e5e4)",boxShadow:"none"}:{bg:"transparent",color:"var(--color-fg-disabled, #a9a29d)",iconColor:"var(--color-fg-disabled, #a9a29d)",border:"none",boxShadow:"none"};var e=j||N;return"primary"===T?{bg:e?"var(--color-bg-brand-solid_hover, #ec470a)":V||"var(--color-bg-brand-solid, #fb6011)",color:"var(--color-text-white, #ffffff)",iconColor:"var(--color-brand-300, #feb073)",border:"none",boxShadow:"var(--shadow-xs-skeuomorphic, 0 1px 2px 0 rgba(10,13,18,.05))"}:"secondary"===T?{bg:e?"var(--color-bg-primary_hover, #fafaf9)":"var(--color-bg-primary, #ffffff)",color:e?"var(--color-text-secondary_hover, #292524)":"var(--color-text-secondary, #44403c)",iconColor:e?"var(--color-fg-quaternary_hover, #79716b)":"var(--color-fg-quaternary, #a9a29d)",border:"none",boxShadow:"var(--shadow-xs-skeuomorphic)"}:"tertiary"===T?{bg:e?"var(--color-bg-primary_hover, #fafaf9)":"transparent",color:e?"var(--color-text-tertiary_hover, #44403c)":"var(--color-text-tertiary, #57534e)",iconColor:e?"var(--color-fg-quaternary_hover, #79716b)":"var(--color-fg-quaternary, #a9a29d)",border:"none",boxShadow:"none"}:"link-color"===T?{bg:"transparent",color:e?"var(--color-text-brand-secondary_hover, #c4330a)":"var(--color-text-brand-secondary, #ec470a)",iconColor:"var(--color-fg-brand-secondary_alt, #fb6011)",border:"none",boxShadow:"none",textDecoration:e?"underline":"none"}:"link-gray"===T?{bg:"transparent",color:e?"var(--color-text-tertiary_hover, #44403c)":"var(--color-text-tertiary, #57534e)",iconColor:"var(--color-fg-quaternary, #a9a29d)",border:"none",boxShadow:"none",textDecoration:e?"underline":"none"}:"destructive-primary"===T?{bg:e?"var(--color-error-600)":"var(--color-error-500)",color:"var(--color-text-white)",iconColor:e?"var(--color-error-200)":"var(--color-error-300)",border:"none",boxShadow:"var(--shadow-xs-skeuomorphic)"}:"destructive-secondary"===T?{bg:e?"var(--color-bg-error-primary)":"var(--color-bg-primary)",color:"var(--color-text-error-primary)",iconColor:"var(--color-fg-error-secondary)",border:"none",boxShadow:"inset 0 0 0 1px var(--color-border-error_subtle), inset 0 -2px 0 0 rgba(10,13,18,0.05), 0 1px 2px 0 rgba(10,13,18,0.05)"}:"destructive-tertiary"===T?{bg:e?"var(--color-bg-error-primary)":"transparent",color:"var(--color-text-error-primary)",iconColor:"var(--color-fg-error-secondary)",border:"none",boxShadow:"none"}:{bg:"transparent",color:e?"var(--color-text-error-primary_hover)":"var(--color-text-error-primary)",iconColor:"var(--color-fg-error-secondary)",border:"none",boxShadow:"none",textDecoration:e?"underline":"none"}}(),U=function(){if(Y)return"destructive-primary"===T||"destructive-secondary"===T||"destructive-tertiary"===T||"destructive-link"===T?"destructive-primary"===T||"destructive-secondary"===T?"var(--focus-ring-error-shadow-xs-skeuomorphic)":"var(--focus-ring-error)":"primary"===T||"secondary"===T?"var(--focus-ring-shadow-xs-skeuomorphic, 0 0 0 2px #fff, 0 0 0 4px #fb6011)":"var(--focus-ring, 0 0 0 2px #fff, 0 0 0 4px #fb6011)"}(),G=f({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:P.gap,fontFamily:'var(--font-family-body, "DM Sans", system-ui, sans-serif)',fontWeight:600,fontSize:P.fontSize,lineHeight:"".concat(P.lineHeight,"px"),cursor:q?"not-allowed":"pointer",outline:"none",transition:"background-color .15s ease, color .15s ease, box-shadow .15s ease",userSelect:"none",WebkitTapHighlightColor:"transparent",whiteSpace:"nowrap",backgroundColor:K.bg,color:K.color,border:K.border,boxShadow:null!=U?U:K.boxShadow,textDecoration:K.textDecoration},A);X?(G.borderRadius="4px",G.overflow="hidden",_?(G.width=P.height,G.height=P.height,G.padding=0):(G.height=P.height,G.paddingLeft=P.paddingX,G.paddingRight=P.paddingX)):(G.borderRadius="var(--radius-md, 8px)",_?(G.width=P.height,G.height=P.height,G.padding=0):(G.height=P.height,G.paddingLeft=P.paddingX,G.paddingRight=P.paddingX));var J=function(){return u?n(k,{size:P.iconSize,color:K.iconColor}):D?n("span",{"aria-hidden":!0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:P.iconSize,height:P.iconSize,color:K.iconColor,flexShrink:0},children:D}):null},Q=u||D&&"left"===B,Z=!u&&D&&"right"===B;return e("button",f({type:F,className:["aha-button","aha-button--".concat(T),"aha-button--".concat(y[d]||"md"),_&&"aha-button--icon-only",q&&"aha-button--disabled",u&&"aha-button--loading",Y&&"aha-button--focused",L].filter(Boolean).join(" "),disabled:q,onClick:function(e){q?e.preventDefault():null==C||C(e)},onMouseEnter:function(){return!q&&H(!0)},onMouseLeave:function(){H(!1),R(!1)},onMouseDown:function(){return!q&&R(!0)},onMouseUp:function(){return R(!1)},style:G},M,{children:[Q&&J(),!_&&r,Z&&J(),_&&!D&&!u&&r]}))};C.displayName="Button";var S=l(function(t,i){var a=t.size,l=void 0===a?"medium":a,p=t.disabled,c=void 0!==p&&p,u=t.error,g=void 0!==u&&u,v=t.readOnly,m=void 0!==v&&v,y=t.prefix,b=t.suffix,w=t.allowClear,k=void 0!==w&&w,C=t.onClear,S=t.className,F=void 0===S?"":S,z=t.style,L=t.type,A=void 0===L?"text":L,D=t.placeholder,E=t.value,B=t.defaultValue,M=t.onChange,W=t.onFocus,O=t.onBlur,j=t.onPressEnter,H=h(t,["size","disabled","error","readOnly","prefix","suffix","allowClear","onClear","className","style","type","placeholder","value","defaultValue","onChange","onFocus","onBlur","onPressEnter"]),I=x().primaryColor,N=void 0===I?"#FB6011":I,R=d(null),T=r.useState(B||E||""),P=T[0],_=T[1],X=r.useState(!1),q=X[0],Y=X[1];s(function(){"function"==typeof i?i(R.current):i&&(i.current=R.current)},[i]);var V=void 0!==E,K=V?E:P,U=function(e){var n;e.stopPropagation(),V||_("");null==M||M({target:{value:""},currentTarget:{value:""}}),null==C||C(),null===(n=R.current)||void 0===n||n.focus()},G=k&&K&&!c,J={small:{height:"32px",paddingTop:"3px",paddingBottom:"3px"},mediumSmall:{height:"36px",paddingTop:"5px",paddingBottom:"5px"},medium:{height:"40px",paddingTop:"7px",paddingBottom:"7px"},large:{height:"48px",paddingTop:"11px",paddingBottom:"11px"}},Q=b||G?"40px":"12px",Z=f({width:"100%",boxSizing:"border-box",fontFamily:"DM Sans, sans-serif",borderRadius:"8px",border:"1px solid ".concat(g?"#F04438":q?N:"#D7D3D0"),backgroundColor:c||m?"#FAFAF9":"#FFFFFF",color:c?"#98A2B3":"#1C1917",fontSize:"16px",fontWeight:400,lineHeight:"24px",paddingLeft:y?"40px":"12px",paddingRight:Q,paddingTop:J[l].paddingTop,paddingBottom:J[l].paddingBottom,transition:"all 0.2s",outline:"none",WebkitAppearance:"none",MozAppearance:"textfield",appearance:"none"},z);return e(o,{children:[n("style",{children:'\n .aha-input-wrapper input::placeholder {\n color: #D7D3D0;\n font-size: 16px;\n font-weight: 400;\n opacity: 1;\n }\n .aha-input-wrapper input::-webkit-input-placeholder {\n color: #D7D3D0;\n font-size: 16px;\n font-weight: 400;\n opacity: 1;\n }\n .aha-input-wrapper input::-moz-placeholder {\n color: #D7D3D0;\n font-size: 16px;\n font-weight: 400;\n opacity: 1;\n }\n .aha-input-wrapper input:-ms-input-placeholder {\n color: #D7D3D0;\n font-size: 16px;\n font-weight: 400;\n opacity: 1;\n }\n /* 移动端优化 */\n .aha-input-wrapper input {\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n touch-action: manipulation;\n }\n /* 移除数字输入框的上下箭头 */\n .aha-input-wrapper input[type="number"]::-webkit-inner-spin-button,\n .aha-input-wrapper input[type="number"]::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n .aha-input-wrapper input[type="number"] {\n -moz-appearance: textfield;\n }\n '}),e("div",{className:"aha-input-wrapper ".concat(F),style:{position:"relative",display:"inline-flex",alignItems:"center",width:"100%"},children:[y&&n("span",{style:{position:"absolute",left:"12px",display:"flex",alignItems:"center",color:c?"#98A2B3":"#78716C",zIndex:1,pointerEvents:"none"},children:y}),n("input",f({ref:R,type:A,value:K,placeholder:D,disabled:c,readOnly:m,onChange:function(e){V||_(e.target.value),null==M||M(e)},onFocus:function(e){Y(!0),null==W||W(e)},onBlur:function(e){Y(!1),null==O||O(e)},onKeyDown:function(e){var n;"Enter"===e.key&&j&&j(e),null===(n=H.onKeyDown)||void 0===n||n.call(H,e)},style:Z,autoComplete:H.autoComplete||"off",autoCorrect:H.autoCorrect||"off",autoCapitalize:H.autoCapitalize||"off",spellCheck:H.spellCheck||!1},H)),(b||G)&&e("span",{style:{position:"absolute",right:"12px",display:"flex",alignItems:"center",gap:"4px",color:c?"#98A2B3":"#78716C",zIndex:1},children:[G&&n(function(){return n("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:U,style:{cursor:"pointer",flexShrink:0,color:"#78716C"},children:n("path",{d:"M12 4L4 12M4 4L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},{}),b&&n("span",{style:{pointerEvents:"none"},children:b})]})]})]})});S.displayName="Input";var F=function(t){var i,l=t.value,h=t.defaultValue,v=t.options,m=void 0===v?[]:v,y=t.mode,b=t.disabled,w=void 0!==b&&b,k=t.error,C=void 0!==k&&k,S=t.placeholder,F=void 0===S?"Please select":S,z=t.size,L=void 0===z?"medium":z,A=t.showSearch,D=void 0!==A&&A,E=t.filterOption,B=void 0===E||E,M=t.allowClear,W=void 0!==M&&M,O=t.onChange,j=t.onSelect,H=t.onDeselect,I=t.onSearch,N=t.onFocus,R=t.onBlur,T=t.onDropdownVisibleChange,P=t.className,_=void 0===P?"":P,X=t.style,q=t.dropdownClassName,Y=void 0===q?"":q,V=t.dropdownStyle,K=t.defaultOpen,U=void 0!==K&&K,G=t.open,J=t.maxTagCount,Q=t.tagRender,Z=t.optionRender,$=x().primaryColor,ee=void 0===$?"#FB6011":$,ne=a(void 0!==h?h:y?[]:void 0),oe=ne[0],re=ne[1],te=a(U),ie=te[0],ae=te[1],le=a(""),de=le[0],se=le[1],pe=a(-1),ce=pe[0],ue=pe[1],fe=d(null),he=d(null),ge=d(null),ve=a(null),me=ve[0],xe=ve[1],ye=void 0!==l,be=void 0!==G,we=ye?l:oe,ke=be?G:ie,Ce="multiple"===y||"tags"===y,Se=p(function(){if(!we)return[];var e=Array.isArray(we)?we:[we];return m.filter(function(n){return e.includes(n.value)})},[we,m]),Fe=p(function(){return D&&de?!1===B?m:"function"==typeof B?m.filter(function(e){return B(de,e)}):m.filter(function(e){var n=String(e.label||"").toLowerCase(),o=de.toLowerCase();return n.includes(o)}):m},[m,de,D,B]),ze=c(function(){return Fe()},[Fe]);s(function(){if(ke&&fe.current){var e=function(){var e,n;if(fe.current){var o=fe.current.getBoundingClientRect(),r=null!==(n=null===(e=ge.current)||void 0===e?void 0:e.offsetHeight)&&void 0!==n?n:Math.min(256,Math.max(40,40*ze.length)),t=window.innerHeight-o.bottom,i=o.top,a=t<r+4&&i>t,l=a?o.top+window.scrollY-r-4:o.bottom+window.scrollY+4;xe({top:l,left:o.left+window.scrollX,width:o.width,placement:a?"top":"bottom"})}};return e(),requestAnimationFrame(e),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),function(){window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}}xe(null)},[ke,ze.length]),s(function(){var e=function(e){var n=e.target;fe.current&&!fe.current.contains(n)&&ge.current&&!ge.current.contains(n)&&(be||ae(!1),null==T||T(!1),se(""))};if(ke)return document.addEventListener("mousedown",e,!0),document.addEventListener("touchstart",e,!0),function(){document.removeEventListener("mousedown",e,!0),document.removeEventListener("touchstart",e,!0)}},[ke,be,T]),s(function(){if(ke){var e=function(e){var n;if("ArrowDown"===e.key)e.preventDefault(),ue(function(e){return e<ze.length-1?e+1:e});else if("ArrowUp"===e.key)e.preventDefault(),ue(function(e){return e>0?e-1:0});else if("Enter"===e.key&&ce>=0){e.preventDefault();var o=ze[ce];o&&!o.disabled&&Le(o)}else"Escape"===e.key&&(e.preventDefault(),be||ae(!1),null==T||T(!1),null===(n=fe.current)||void 0===n||n.focus())};return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}}},[ke,ze,ce,be,T]),s(function(){if(ce>=0&&ge.current){var e=ge.current.querySelectorAll(".aha-select-option")[ce];e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})}},[ce]);var Le=p(function(e){var n;if(!e.disabled)if(Ce){var o,r=Array.isArray(we)?we:[];r.includes(e.value)?(o=r.filter(function(n){return n!==e.value}),null==H||H(e.value,e)):(o=g(g([],r,!0),[e.value],!1),null==j||j(e.value,e)),ye||re(o);var t=m.filter(function(e){return o.includes(e.value)});null==O||O(o,t)}else ye||re(e.value),null==O||O(e.value,e),null==j||j(e.value,e),be||ae(!1),null==T||T(!1),se(""),null===(n=fe.current)||void 0===n||n.focus()},[Ce,we,ye,be,m,O,j,H,T]),Ae=p(function(e,n){if(e.stopPropagation(),Ce&&Array.isArray(we)){var o=we.filter(function(e){return e!==n}),r=m.find(function(e){return e.value===n});ye||re(o),null==O||O(o,Se()),null==H||H(n,r)}},[Ce,we,ye,m,O,H,Se]),De=function(e){e.stopPropagation();var n=Ce?[]:void 0;ye||re(n),null==O||O(n,[]),se("")},Ee={small:{height:"32px",paddingTop:"3px",paddingBottom:"3px",fontSize:"16px",lineHeight:"24px"},mediumSmall:{height:"36px",paddingTop:"5px",paddingBottom:"5px",fontSize:"16px",lineHeight:"24px"},medium:{height:"40px",paddingTop:"7px",paddingBottom:"7px",fontSize:"16px",lineHeight:"24px"},large:{height:"48px",paddingTop:"11px",paddingBottom:"11px",fontSize:"16px",lineHeight:"24px"}},Be=c(function(){return Se()},[Se]),Me=c(function(){return W&&we&&!w},[W,we,w]),We=c(function(){return Ce?Array.isArray(we)&&we.length>0:null!=we&&""!==we},[Ce,we]),Oe=c(function(){if(!Ce||!Array.isArray(we)||0===we.length)return null;var o="responsive"===J?Be.slice(0,2):J?Be.slice(0,J):Be,t=J&&Be.length>o.length?Be.length-o.length:0;return e("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"4px",flex:1,minWidth:0},children:[o.map(function(o){var t={label:o.label,value:o.value,closable:!w,onClose:function(){return Ae({},o.value)}};return Q?n(r.Fragment,{children:Q(t)},o.value):e("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",backgroundColor:"#F5F5F4",borderRadius:"4px",fontSize:"12px",lineHeight:"18px",color:"#101828",fontFamily:"DM Sans, sans-serif",maxWidth:"100%"},children:[n("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.label}),!w&&n("span",{onClick:function(e){return Ae(e,o.value)},style:{cursor:"pointer",display:"flex",alignItems:"center",color:"#78716C",marginLeft:"4px"},children:n("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n("path",{d:"M9 3L3 9M3 3L9 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]},o.value)}),t>0&&e("span",{style:{fontSize:"12px",lineHeight:"18px",color:"#78716C",fontFamily:"DM Sans, sans-serif"},children:["+",t]})]})},[Ce,we,Be,J,w,Q]);return e(o,{children:[n("style",{children:"\n @keyframes dropdownFadeIn {\n from {\n opacity: 0;\n transform: translateY(-8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n "}),e("div",{ref:fe,className:"aha-select ".concat(_),style:f({position:"relative",display:"inline-flex",alignItems:"center",width:"100%",minWidth:"120px",boxSizing:"border-box",fontFamily:"DM Sans, sans-serif",borderRadius:"8px",border:"1px solid ".concat(C?"#F04438":ke?ee:"#D7D3D0"),backgroundColor:w?"#FAFAF9":"#FFFFFF",cursor:w?"not-allowed":"pointer",transition:"all 0.2s",paddingLeft:"12px",paddingRight:"36px",paddingTop:Ee[L].paddingTop,paddingBottom:Ee[L].paddingBottom,fontSize:Ee[L].fontSize,lineHeight:Ee[L].lineHeight,fontWeight:400,WebkitTapHighlightColor:"transparent",WebkitTouchCallout:"none",touchAction:"manipulation",userSelect:"none"},X),onClick:function(){if(!w){var e=!ke;be||ae(e),null==T||T(e),e&&D?setTimeout(function(){var e;null===(e=he.current)||void 0===e||e.focus()},0):se("")}},onFocus:function(e){null==N||N(e)},onBlur:function(e){null==R||R(e)},onTouchStart:function(e){w||(e.currentTarget.style.opacity="0.8")},onTouchEnd:function(e){e.currentTarget.style.opacity="1"},tabIndex:w?-1:0,children:[n("div",{style:{display:"flex",alignItems:"center",flex:1,minWidth:0,gap:"8px"},children:Ce?Oe||n("span",F?{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"#79716B",fontSize:"16px",lineHeight:"24px",fontWeight:400},children:F}:{style:{flex:1,minHeight:"24px"}}):D&&ke?n("input",{ref:he,type:"text",value:de,onChange:function(e){var n=e.target.value;se(n),null==I||I(n),ue(-1)},onClick:function(e){return e.stopPropagation()},onFocus:function(e){return e.stopPropagation()},style:{flex:1,border:"none",outline:"none",background:"transparent",fontSize:"16px",lineHeight:"24px",fontWeight:400,color:w?"#98A2B3":"#1C1917",fontFamily:"DM Sans, sans-serif",minWidth:0,WebkitAppearance:"none",appearance:"none"},placeholder:We?void 0:F,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}):n("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:We?w?"#98A2B3":"#1C1917":"#79716B",fontSize:"16px",lineHeight:"24px",fontWeight:400,minHeight:"24px",display:"inline-block"},children:We?(null===(i=Be[0])||void 0===i?void 0:i.label)||we:F||" "})}),e("div",{style:{position:"absolute",right:"12px",display:"flex",alignItems:"center",gap:"4px"},children:[Me&&n(function(){return n("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:De,style:{cursor:"pointer",flexShrink:0,color:"#78716C"},children:n("path",{d:"M12 4L4 12M4 4L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},{}),n(function(e){var o=e.isOpen;return n("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{transform:o?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease-in-out",flexShrink:0},children:n("path",{d:"M4 6L8 10L12 6",stroke:"#78716C",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},{isOpen:ke})]})]}),ke&&me&&u(n("div",{ref:ge,className:"aha-select-dropdown ".concat(Y),style:f({position:"absolute",top:"".concat(me.top,"px"),left:"".concat(me.left,"px"),width:"".concat(me.width,"px"),zIndex:1050,backgroundColor:"#FFFFFF",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",border:"1px solid #E7E5E4",maxHeight:"256px",overflow:"auto",opacity:0,transform:"top"===me.placement?"translateY(8px)":"translateY(-8px)",animation:"dropdownFadeIn 0.2s ease-out forwards",transformOrigin:"top"===me.placement?"bottom center":"top center",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain"},V),children:0===ze.length?n("div",{style:{padding:"8px 16px",textAlign:"center",color:"#78716C",fontSize:"14px",fontFamily:"DM Sans, sans-serif"},children:"No data"}):ze.map(function(o,r){var t=Ce?Array.isArray(we)&&we.includes(o.value):we===o.value,i=r===ce;return Z?n("div",{className:"aha-select-option ".concat(o.disabled?"":"hover:bg-[#FAFAF9]"," ").concat(t?"bg-[#FAFAF9]":""),onClick:function(){return!o.disabled&&Le(o)},style:{cursor:o.disabled?"not-allowed":"pointer",transition:"background-color 0.2s"},children:Z(o,{selected:t,focused:i,disabled:o.disabled||!1})},o.value):e("div",{className:"aha-select-option ".concat(o.disabled?"":"hover:bg-[#FAFAF9]"," ").concat(t?"bg-[#FAFAF9]":""),onClick:function(){return Le(o)},style:{padding:"8px 16px",cursor:o.disabled?"not-allowed":"pointer",color:o.disabled?"#98A2B3":"#101828",fontSize:"14px",lineHeight:"20px",fontFamily:"DM Sans, sans-serif",display:"flex",alignItems:"center",justifyContent:"space-between",transition:"background-color 0.2s"},children:[n("span",{children:o.label}),t&&n("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:i?"hidden":"",children:n("path",{d:"M13.3333 4L6 11.3333L2.66667 8",stroke:ee,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},o.value)})}),document.body)]})};F.displayName="Select";var z=function(e){var o=e.className,r=e.style;return n("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:o,style:r,children:n("path",{d:"M15.8334 10H4.16675M4.16675 10L10.0001 15.8334M4.16675 10L10.0001 4.16669",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})})},L=function(e){var o=e.className,r=e.style;return n("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:o,style:r,children:n("path",{d:"M4.16675 10H15.8334M15.8334 10L10.0001 4.16669M15.8334 10L10.0001 15.8334",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})})},A=function(r){var t=r.current,i=r.defaultCurrent,l=void 0===i?1:i,d=r.total,p=void 0===d?0:d,u=r.pageSize,h=r.defaultPageSize,g=void 0===h?10:h,v=r.showSizeChanger,m=void 0!==v&&v,y=r.pageSizeOptions,b=void 0===y?["10","20","50","100"]:y,w=r.showQuickJumper,k=void 0!==w&&w,A=r.showTotal,D=r.onChange,E=r.onShowSizeChange,B=r.simple,M=void 0!==B&&B,W=r.disabled,O=void 0!==W&&W,j=r.hideOnSinglePage,H=void 0!==j&&j,I=r.className,N=void 0===I?"":I,R=r.style,T=r.size,P=void 0===T?"default":T,_=r.responsive,X=void 0!==_&&_;r.showLessItems;var q=r.itemRender,Y=x().primaryColor,V=void 0===Y?"#FB6011":Y,K=a(l),U=K[0],G=K[1],J=a(g),Q=J[0],Z=J[1],$=a(""),ee=$[0],ne=$[1],oe=null!=t?t:U,re=null!=u?u:Q,te=c(function(){return Math.ceil(p/re)},[p,re]);s(function(){void 0!==t&&G(t)},[t]),s(function(){void 0!==u&&Z(u)},[u]);var ie=function(e){e<1||e>te||e===oe||O||(void 0===t&&G(e),null==D||D(e,re))},ae=function(){var e=parseInt(ee,10);e>=1&&e<=te&&(ie(e),ne(""))};if(H&&te<=1)return null;if(M)return e("div",{className:"aha-pagination aha-pagination-simple ".concat(N),style:R,children:[n(C,{onClick:function(){return ie(oe-1)},disabled:O||1===oe,type:"default",size:"default"===P?"medium":"small",style:{marginRight:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(z,{})}),e("span",{style:{margin:"0 8px",fontSize:"14px",lineHeight:"20px",color:"#475467",fontFamily:"DM Sans, sans-serif"},children:[oe," / ",te]}),n(C,{onClick:function(){return ie(oe+1)},disabled:O||oe===te,type:"default",size:"default"===P?"medium":"small",style:{marginLeft:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(L,{})})]});var le=(oe-1)*re+1,de=Math.min(oe*re,p);return e("div",{className:"aha-pagination w-full ".concat(N),style:f({display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:X?"wrap":"nowrap",fontFamily:"DM Sans, sans-serif"},R),children:[A&&n("div",{className:"justify-start text-Text-text-secondary text-sm font-medium font-['DM_Sans'] leading-5",children:A(p,[le,de])}),e("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[p>0&&n(o,{children:q?q(oe-1,"prev",n(C,{onClick:function(){return ie(oe-1)},disabled:O||1===oe,type:"default",size:"default"===P?"medium":"small",style:{height:"small"===P?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(z,{})})):n(C,{onClick:function(){return ie(oe-1)},disabled:O||1===oe,type:"default",size:"default"===P?"medium":"small",style:{height:"small"===P?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(z,{})})}),n("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:function(){if(te<=7)return Array.from({length:te},function(e,n){return n+1});var e=[];if(oe<=4){for(var n=1;n<=5;n++)e.push(n);e.push("jump-next"),e.push(te)}else if(oe>=te-3){e.push(1),e.push("jump-prev");for(n=te-4;n<=te;n++)e.push(n)}else{e.push(1),e.push("jump-prev");for(n=oe-1;n<=oe+1;n++)e.push(n);e.push("jump-next"),e.push(te)}return e}().map(function(e){return function(e){if("number"==typeof e){var o=e===oe,r=n(C,{onClick:function(){return ie(e)},disabled:O,type:o?"primary":"default",size:"default"===P?"medium":"small",style:{minWidth:"small"===P?"32px":"36px",height:"small"===P?"32px":"36px",padding:"0 12px",margin:0,fontWeight:o?500:400,border:o?"1px solid ".concat(V):void 0,boxShadow:"none",borderRadius:"8px"},children:e},e);return q?q(e,"page",r):r}if("jump-prev"===e)return r=n(C,{onClick:function(){return ie(Math.max(1,oe-5))},disabled:O,type:"default",size:"default"===P?"medium":"small",style:{minWidth:"small"===P?"32px":"36px",height:"small"===P?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-prev"),q?q(oe-5,"jump-prev",r):r;if("jump-next"===e)return r=n(C,{onClick:function(){return ie(Math.min(te,oe+5))},disabled:O,type:"default",size:"default"===P?"medium":"small",style:{minWidth:"small"===P?"32px":"36px",height:"small"===P?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-next"),q?q(oe+5,"jump-next",r):r;return null}(e)})}),p>0&&n(o,{children:q?q(oe+1,"next",n(C,{onClick:function(){return ie(oe+1)},disabled:O||oe===te,type:"default",size:"default"===P?"medium":"small",style:{height:"small"===P?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(L,{})})):n(C,{onClick:function(){return ie(oe+1)},disabled:O||oe===te,type:"default",size:"default"===P?"medium":"small",style:{height:"small"===P?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(L,{})})}),m&&n(F,{value:re,options:b.map(function(e){return{label:"".concat(e," / page"),value:Number(e)}}),onChange:function(e){return n=Number(e),o=Math.ceil(p/n),r=oe>o?o:oe,void 0===u&&Z(n),void 0===t&&G(r),null==E||E(r,n),void(null==D||D(r,n));var n,o,r},disabled:O,size:"small"===P?"small":"medium",style:{minWidth:"small"===P?80:96}}),k&&e("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontFamily:"DM Sans, sans-serif"},children:[n("span",{style:{fontSize:"14px",lineHeight:"20px",color:"#475467"},children:"Go to"}),n(S,{type:"number",min:1,value:ee,onChange:function(e){return ne(e.target.value)},onPressEnter:ae,disabled:O,size:"small"===P?"small":"medium",style:{width:56,minWidth:56}}),n("span",{style:{fontSize:"14px",lineHeight:"20px",color:"#475467"},children:"page"}),"object"==typeof k&&k.goButton?n(C,{onClick:ae,disabled:O,type:"default",size:"default"===P?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:k.goButton}):n(C,{onClick:ae,disabled:O,type:"default",size:"default"===P?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"OK"})]})]})]})};export{A as default};
2
2
  //# sourceMappingURL=Pagination.esm.js.map