aha-components 1.7.12 → 1.8.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 (126) hide show
  1. package/README.md +10 -0
  2. package/dist/Avatar.esm.js +2 -0
  3. package/dist/Avatar.esm.js.map +1 -0
  4. package/dist/Avatar.js +2 -0
  5. package/dist/Avatar.js.map +1 -0
  6. package/dist/Badge.esm.js +2 -0
  7. package/dist/Badge.esm.js.map +1 -0
  8. package/dist/Badge.js +2 -0
  9. package/dist/Badge.js.map +1 -0
  10. package/dist/Checkbox.esm.js +1 -1
  11. package/dist/Checkbox.esm.js.map +1 -1
  12. package/dist/Checkbox.js +1 -1
  13. package/dist/Checkbox.js.map +1 -1
  14. package/dist/Input.esm.js +1 -1
  15. package/dist/Input.esm.js.map +1 -1
  16. package/dist/Input.js +1 -1
  17. package/dist/Input.js.map +1 -1
  18. package/dist/Pagination.esm.js +1 -1
  19. package/dist/Pagination.esm.js.map +1 -1
  20. package/dist/Pagination.js +1 -1
  21. package/dist/Pagination.js.map +1 -1
  22. package/dist/Radio.esm.js +1 -1
  23. package/dist/Radio.esm.js.map +1 -1
  24. package/dist/Radio.js +1 -1
  25. package/dist/Radio.js.map +1 -1
  26. package/dist/Table.esm.js +1 -1
  27. package/dist/Table.esm.js.map +1 -1
  28. package/dist/Table.js +1 -1
  29. package/dist/Table.js.map +1 -1
  30. package/dist/Tag.esm.js +1 -1
  31. package/dist/Tag.esm.js.map +1 -1
  32. package/dist/Tag.js +1 -1
  33. package/dist/Tag.js.map +1 -1
  34. package/dist/Textarea.esm.js +1 -1
  35. package/dist/Textarea.esm.js.map +1 -1
  36. package/dist/Textarea.js +1 -1
  37. package/dist/Textarea.js.map +1 -1
  38. package/dist/components/Avatar/Avatar.stories.d.ts +12 -0
  39. package/dist/components/Avatar/index.d.ts +42 -0
  40. package/dist/components/Badge/Badge.stories.d.ts +15 -0
  41. package/dist/components/Badge/index.d.ts +71 -0
  42. package/dist/components/Checkbox/Checkbox.stories 2.d.ts +12 -0
  43. package/dist/components/Checkbox/Checkbox.stories.d.ts +5 -4
  44. package/dist/components/Checkbox/index 2.d.ts +12 -0
  45. package/dist/components/Checkbox/index.d.ts +6 -0
  46. package/dist/components/DatePicker/DatePicker.stories 2.d.ts +25 -0
  47. package/dist/components/DatePicker/index 2.d.ts +96 -0
  48. package/dist/components/Drawer/Drawer.stories 2.d.ts +9 -0
  49. package/dist/components/Drawer/index 2.d.ts +58 -0
  50. package/dist/components/Form/Form.stories 2.d.ts +15 -0
  51. package/dist/components/Form/FormContext 2.d.ts +41 -0
  52. package/dist/components/Form/FormItem 2.d.ts +58 -0
  53. package/dist/components/Form/index 2.d.ts +85 -0
  54. package/dist/components/Input/Input.stories 2.d.ts +16 -0
  55. package/dist/components/Input/Input.stories.d.ts +7 -4
  56. package/dist/components/Input/InputGroup.d.ts +25 -0
  57. package/dist/components/Input/InputTags.d.ts +17 -0
  58. package/dist/components/Input/index 2.d.ts +41 -0
  59. package/dist/components/Input/index.d.ts +7 -18
  60. package/dist/components/Loading/Loading.stories 2.d.ts +11 -0
  61. package/dist/components/Loading/index 2.d.ts +10 -0
  62. package/dist/components/MenuList/MenuList.stories 2.d.ts +17 -0
  63. package/dist/components/MenuList/MenuList.test 2.d.ts +1 -0
  64. package/dist/components/MenuList/index 2.d.ts +85 -0
  65. package/dist/components/Pagination/Pagination.stories 2.d.ts +16 -0
  66. package/dist/components/Pagination/index 2.d.ts +27 -0
  67. package/dist/components/Popover/Popover.stories 2.d.ts +11 -0
  68. package/dist/components/Popover/index 2.d.ts +31 -0
  69. package/dist/components/Progress/Progress.stories 2.d.ts +18 -0
  70. package/dist/components/Progress/Progress.test 2.d.ts +1 -0
  71. package/dist/components/Progress/index 2.d.ts +33 -0
  72. package/dist/components/Radio/Radio.stories 2.d.ts +10 -0
  73. package/dist/components/Radio/Radio.stories.d.ts +6 -4
  74. package/dist/components/Radio/index 2.d.ts +13 -0
  75. package/dist/components/Radio/index.d.ts +6 -0
  76. package/dist/components/Select/Select.stories 2.d.ts +17 -0
  77. package/dist/components/Select/index 2.d.ts +74 -0
  78. package/dist/components/Switch/Switch.stories 2.d.ts +14 -0
  79. package/dist/components/Switch/index 2.d.ts +27 -0
  80. package/dist/components/Tab/Tab.stories 2.d.ts +19 -0
  81. package/dist/components/Tab/index 2.d.ts +26 -0
  82. package/dist/components/Table/Table.stories 2.d.ts +21 -0
  83. package/dist/components/Table/index 2.d.ts +167 -0
  84. package/dist/components/Tag/Tag.stories.d.ts +5 -8
  85. package/dist/components/Tag/index.d.ts +24 -2
  86. package/dist/components/Textarea/Textarea.stories 2.d.ts +15 -0
  87. package/dist/components/Textarea/Textarea.stories.d.ts +3 -6
  88. package/dist/components/Textarea/TextareaTags.d.ts +8 -0
  89. package/dist/components/Textarea/index 2.d.ts +38 -0
  90. package/dist/components/Textarea/index.d.ts +6 -17
  91. package/dist/components/Tooltip/Tooltip.stories 2.d.ts +20 -0
  92. package/dist/components/Tooltip/index 2.d.ts +35 -0
  93. package/dist/design-tokens/theme.css +26 -0
  94. package/dist/design-tokens/theme.tailwind4.css +26 -0
  95. package/dist/icons/index 2.d.ts +33 -0
  96. package/dist/index.css +4810 -1
  97. package/dist/index.d.ts +195 -39
  98. package/dist/index.esm.css +4810 -1
  99. package/dist/index.esm.js +1 -1
  100. package/dist/index.esm.js.map +1 -1
  101. package/dist/index.js +1 -1
  102. package/dist/index.js.map +1 -1
  103. package/dist/stories/DesignTokens.stories 2.d.ts +5 -0
  104. package/dist/theme/Theme.stories 2.d.ts +10 -0
  105. package/dist/theme/ThemeContext 2.d.ts +11 -0
  106. package/dist/theme/utils 2.d.ts +10 -0
  107. package/dist/theme.css +26 -0
  108. package/dist/tokens.d.ts +30 -0
  109. package/package.json +1 -1
  110. package/dist/AlertComponent.esm.js +0 -2
  111. package/dist/AlertComponent.esm.js.map +0 -1
  112. package/dist/AlertComponent.js +0 -2
  113. package/dist/AlertComponent.js.map +0 -1
  114. package/dist/Card.esm.js +0 -2
  115. package/dist/Card.esm.js.map +0 -1
  116. package/dist/Card.js +0 -2
  117. package/dist/Card.js.map +0 -1
  118. package/dist/TestComponent.esm.js +0 -2
  119. package/dist/TestComponent.esm.js.map +0 -1
  120. package/dist/TestComponent.js +0 -2
  121. package/dist/TestComponent.js.map +0 -1
  122. package/dist/Toast.css +0 -1
  123. package/dist/Toast.esm.css +0 -1
  124. package/dist/components/AlertComponent/index.d.ts +0 -9
  125. package/dist/components/Card/index.d.ts +0 -10
  126. package/dist/components/TestComponent/index.d.ts +0 -7
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),o=require("react-dom"),r=function(){return r=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},r.apply(this,arguments)};function t(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 i(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 a={primaryColor:"#FB6011"},l=n.createContext(a),s=function(){var e=n.useContext(l);return e||a},d={sm:"sm",md:"md",lg:"lg",xl:"xl",small:"sm",mediumSmall:"sm",medium:"md",large:"xl"},c={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"},p={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}},u=function(n){var o=n.size,r=n.color;return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:"@keyframes aha-button-spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}"}),e.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,style:{animation:"aha-button-spin 1s linear infinite",flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:r,strokeWidth:"2",opacity:"0.25"}),e.jsx("path",{d:"M22 12a10 10 0 0 1-10 10",stroke:r,strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})]})},f=function(o){var i=o.children,a=o.type,l=void 0===a?"secondary":a,f=o.size,h=void 0===f?"md":f,x=o.disabled,g=void 0!==x&&x,v=o.loading,m=void 0!==v&&v,y=o.iconOnly,b=o.focused,w=void 0!==b&&b,C=o.onClick,k=o.htmlType,S=void 0===k?"button":k,j=o.className,F=void 0===j?"":j,z=o.style,E=o.icon,L=o.iconPosition,A=void 0===L?"left":L,D=t(o,["children","type","size","disabled","loading","iconOnly","focused","onClick","htmlType","className","style","icon","iconPosition"]),M=s().primaryColor,B=n.useState(!1),O=B[0],W=B[1],H=n.useState(!1),R=H[0],I=H[1],N=c[l]||"secondary",T=p[d[h]||"md"],P=null!=y?y:!!E&&null==i,_="link-color"===N||"link-gray"===N||"destructive-link"===N,X=g||m,q=w,Y=M,V=function(){if(g)return"primary"===N||"secondary"===N||"destructive-primary"===N||"destructive-secondary"===N?{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=O||R;return"primary"===N?{bg:e?"var(--color-bg-brand-solid_hover, #ec470a)":Y||"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"===N?{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"===N?{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"===N?{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"===N?{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"===N?{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"===N?{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"===N?{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"}}(),K=function(){if(q)return"destructive-primary"===N||"destructive-secondary"===N||"destructive-tertiary"===N||"destructive-link"===N?"destructive-primary"===N||"destructive-secondary"===N?"var(--focus-ring-error-shadow-xs-skeuomorphic)":"var(--focus-ring-error)":"primary"===N||"secondary"===N?"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)"}(),U=r({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:T.gap,fontFamily:'var(--font-family-body, "DM Sans", system-ui, sans-serif)',fontWeight:600,fontSize:T.fontSize,lineHeight:"".concat(T.lineHeight,"px"),cursor:X?"not-allowed":"pointer",outline:"none",transition:"background-color .15s ease, color .15s ease, box-shadow .15s ease",userSelect:"none",WebkitTapHighlightColor:"transparent",whiteSpace:"nowrap",backgroundColor:V.bg,color:V.color,border:V.border,boxShadow:null!=K?K:V.boxShadow,textDecoration:V.textDecoration},z);_?(U.borderRadius="4px",U.overflow="hidden",P?(U.width=T.height,U.height=T.height,U.padding=0):(U.height=T.height,U.paddingLeft=T.paddingX,U.paddingRight=T.paddingX)):(U.borderRadius="var(--radius-md, 8px)",P?(U.width=T.height,U.height=T.height,U.padding=0):(U.height=T.height,U.paddingLeft=T.paddingX,U.paddingRight=T.paddingX));var G=function(){return m?e.jsx(u,{size:T.iconSize,color:V.iconColor}):E?e.jsx("span",{"aria-hidden":!0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:T.iconSize,height:T.iconSize,color:V.iconColor,flexShrink:0},children:E}):null},J=m||E&&"left"===A,Q=!m&&E&&"right"===A;return e.jsxs("button",r({type:S,className:["aha-button","aha-button--".concat(N),"aha-button--".concat(d[h]||"md"),P&&"aha-button--icon-only",X&&"aha-button--disabled",m&&"aha-button--loading",q&&"aha-button--focused",F].filter(Boolean).join(" "),disabled:X,onClick:function(e){X?e.preventDefault():null==C||C(e)},onMouseEnter:function(){return!X&&W(!0)},onMouseLeave:function(){W(!1),I(!1)},onMouseDown:function(){return!X&&I(!0)},onMouseUp:function(){return I(!1)},style:U},D,{children:[J&&G(),!P&&i,Q&&G(),P&&!E&&!m&&i]}))};f.displayName="Button";var h=n.forwardRef(function(o,i){var a=o.size,l=void 0===a?"medium":a,d=o.disabled,c=void 0!==d&&d,p=o.error,u=void 0!==p&&p,f=o.readOnly,h=void 0!==f&&f,x=o.prefix,g=o.suffix,v=o.allowClear,m=void 0!==v&&v,y=o.onClear,b=o.className,w=void 0===b?"":b,C=o.style,k=o.type,S=void 0===k?"text":k,j=o.placeholder,F=o.value,z=o.defaultValue,E=o.onChange,L=o.onFocus,A=o.onBlur,D=o.onPressEnter,M=t(o,["size","disabled","error","readOnly","prefix","suffix","allowClear","onClear","className","style","type","placeholder","value","defaultValue","onChange","onFocus","onBlur","onPressEnter"]),B=s().primaryColor,O=void 0===B?"#FB6011":B,W=n.useRef(null),H=n.useState(z||F||""),R=H[0],I=H[1],N=n.useState(!1),T=N[0],P=N[1];n.useEffect(function(){"function"==typeof i?i(W.current):i&&(i.current=W.current)},[i]);var _=void 0!==F,X=_?F:R,q=function(e){var n;e.stopPropagation(),_||I("");null==E||E({target:{value:""},currentTarget:{value:""}}),null==y||y(),null===(n=W.current)||void 0===n||n.focus()},Y=m&&X&&!c,V={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"}},K=g||Y?"40px":"12px",U=r({width:"100%",boxSizing:"border-box",fontFamily:"DM Sans, sans-serif",borderRadius:"8px",border:"1px solid ".concat(u?"#F04438":T?O:"#D7D3D0"),backgroundColor:c||h?"#FAFAF9":"#FFFFFF",color:c?"#98A2B3":"#1C1917",fontSize:"16px",fontWeight:400,lineHeight:"24px",paddingLeft:x?"40px":"12px",paddingRight:K,paddingTop:V[l].paddingTop,paddingBottom:V[l].paddingBottom,transition:"all 0.2s",outline:"none",WebkitAppearance:"none",MozAppearance:"textfield",appearance:"none"},C);return e.jsxs(e.Fragment,{children:[e.jsx("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.jsxs("div",{className:"aha-input-wrapper ".concat(w),style:{position:"relative",display:"inline-flex",alignItems:"center",width:"100%"},children:[x&&e.jsx("span",{style:{position:"absolute",left:"12px",display:"flex",alignItems:"center",color:c?"#98A2B3":"#78716C",zIndex:1,pointerEvents:"none"},children:x}),e.jsx("input",r({ref:W,type:S,value:X,placeholder:j,disabled:c,readOnly:h,onChange:function(e){_||I(e.target.value),null==E||E(e)},onFocus:function(e){P(!0),null==L||L(e)},onBlur:function(e){P(!1),null==A||A(e)},onKeyDown:function(e){var n;"Enter"===e.key&&D&&D(e),null===(n=M.onKeyDown)||void 0===n||n.call(M,e)},style:U,autoComplete:M.autoComplete||"off",autoCorrect:M.autoCorrect||"off",autoCapitalize:M.autoCapitalize||"off",spellCheck:M.spellCheck||!1},M)),(g||Y)&&e.jsxs("span",{style:{position:"absolute",right:"12px",display:"flex",alignItems:"center",gap:"4px",color:c?"#98A2B3":"#78716C",zIndex:1},children:[Y&&e.jsx(function(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:q,style:{cursor:"pointer",flexShrink:0,color:"#78716C"},children:e.jsx("path",{d:"M12 4L4 12M4 4L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},{}),g&&e.jsx("span",{style:{pointerEvents:"none"},children:g})]})]})]})});h.displayName="Input";var x=function(t){var a,l=t.value,d=t.defaultValue,c=t.options,p=void 0===c?[]:c,u=t.mode,f=t.disabled,h=void 0!==f&&f,x=t.error,g=void 0!==x&&x,v=t.placeholder,m=void 0===v?"Please select":v,y=t.size,b=void 0===y?"medium":y,w=t.showSearch,C=void 0!==w&&w,k=t.filterOption,S=void 0===k||k,j=t.allowClear,F=void 0!==j&&j,z=t.onChange,E=t.onSelect,L=t.onDeselect,A=t.onSearch,D=t.onFocus,M=t.onBlur,B=t.onDropdownVisibleChange,O=t.className,W=void 0===O?"":O,H=t.style,R=t.dropdownClassName,I=void 0===R?"":R,N=t.dropdownStyle,T=t.defaultOpen,P=void 0!==T&&T,_=t.open,X=t.maxTagCount,q=t.tagRender,Y=t.optionRender,V=s().primaryColor,K=void 0===V?"#FB6011":V,U=n.useState(void 0!==d?d:u?[]:void 0),G=U[0],J=U[1],Q=n.useState(P),Z=Q[0],$=Q[1],ee=n.useState(""),ne=ee[0],oe=ee[1],re=n.useState(-1),te=re[0],ie=re[1],ae=n.useRef(null),le=n.useRef(null),se=n.useRef(null),de=n.useState(null),ce=de[0],pe=de[1],ue=void 0!==l,fe=void 0!==_,he=ue?l:G,xe=fe?_:Z,ge="multiple"===u||"tags"===u,ve=n.useCallback(function(){if(!he)return[];var e=Array.isArray(he)?he:[he];return p.filter(function(n){return e.includes(n.value)})},[he,p]),me=n.useCallback(function(){return C&&ne?!1===S?p:"function"==typeof S?p.filter(function(e){return S(ne,e)}):p.filter(function(e){var n=String(e.label||"").toLowerCase(),o=ne.toLowerCase();return n.includes(o)}):p},[p,ne,C,S]),ye=n.useMemo(function(){return me()},[me]);n.useEffect(function(){if(xe&&ae.current){var e=function(){var e,n;if(ae.current){var o=ae.current.getBoundingClientRect(),r=null!==(n=null===(e=se.current)||void 0===e?void 0:e.offsetHeight)&&void 0!==n?n:Math.min(256,Math.max(40,40*ye.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;pe({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)}}pe(null)},[xe,ye.length]),n.useEffect(function(){var e=function(e){var n=e.target;ae.current&&!ae.current.contains(n)&&se.current&&!se.current.contains(n)&&(fe||$(!1),null==B||B(!1),oe(""))};if(xe)return document.addEventListener("mousedown",e,!0),document.addEventListener("touchstart",e,!0),function(){document.removeEventListener("mousedown",e,!0),document.removeEventListener("touchstart",e,!0)}},[xe,fe,B]),n.useEffect(function(){if(xe){var e=function(e){var n;if("ArrowDown"===e.key)e.preventDefault(),ie(function(e){return e<ye.length-1?e+1:e});else if("ArrowUp"===e.key)e.preventDefault(),ie(function(e){return e>0?e-1:0});else if("Enter"===e.key&&te>=0){e.preventDefault();var o=ye[te];o&&!o.disabled&&be(o)}else"Escape"===e.key&&(e.preventDefault(),fe||$(!1),null==B||B(!1),null===(n=ae.current)||void 0===n||n.focus())};return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}}},[xe,ye,te,fe,B]),n.useEffect(function(){if(te>=0&&se.current){var e=se.current.querySelectorAll(".aha-select-option")[te];e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})}},[te]);var be=n.useCallback(function(e){var n;if(!e.disabled)if(ge){var o,r=Array.isArray(he)?he:[];r.includes(e.value)?(o=r.filter(function(n){return n!==e.value}),null==L||L(e.value,e)):(o=i(i([],r,!0),[e.value],!1),null==E||E(e.value,e)),ue||J(o);var t=p.filter(function(e){return o.includes(e.value)});null==z||z(o,t)}else ue||J(e.value),null==z||z(e.value,e),null==E||E(e.value,e),fe||$(!1),null==B||B(!1),oe(""),null===(n=ae.current)||void 0===n||n.focus()},[ge,he,ue,fe,p,z,E,L,B]),we=n.useCallback(function(e,n){if(e.stopPropagation(),ge&&Array.isArray(he)){var o=he.filter(function(e){return e!==n}),r=p.find(function(e){return e.value===n});ue||J(o),null==z||z(o,ve()),null==L||L(n,r)}},[ge,he,ue,p,z,L,ve]),Ce=function(e){e.stopPropagation();var n=ge?[]:void 0;ue||J(n),null==z||z(n,[]),oe("")},ke={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"}},Se=n.useMemo(function(){return ve()},[ve]),je=n.useMemo(function(){return F&&he&&!h},[F,he,h]),Fe=n.useMemo(function(){return ge?Array.isArray(he)&&he.length>0:null!=he&&""!==he},[ge,he]),ze=n.useMemo(function(){if(!ge||!Array.isArray(he)||0===he.length)return null;var o="responsive"===X?Se.slice(0,2):X?Se.slice(0,X):Se,r=X&&Se.length>o.length?Se.length-o.length:0;return e.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"4px",flex:1,minWidth:0},children:[o.map(function(o){var r={label:o.label,value:o.value,closable:!h,onClose:function(){return we({},o.value)}};return q?e.jsx(n.Fragment,{children:q(r)},o.value):e.jsxs("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:[e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.label}),!h&&e.jsx("span",{onClick:function(e){return we(e,o.value)},style:{cursor:"pointer",display:"flex",alignItems:"center",color:"#78716C",marginLeft:"4px"},children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M9 3L3 9M3 3L9 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]},o.value)}),r>0&&e.jsxs("span",{style:{fontSize:"12px",lineHeight:"18px",color:"#78716C",fontFamily:"DM Sans, sans-serif"},children:["+",r]})]})},[ge,he,Se,X,h,q]);return e.jsxs(e.Fragment,{children:[e.jsx("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.jsxs("div",{ref:ae,className:"aha-select ".concat(W),style:r({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(g?"#F04438":xe?K:"#D7D3D0"),backgroundColor:h?"#FAFAF9":"#FFFFFF",cursor:h?"not-allowed":"pointer",transition:"all 0.2s",paddingLeft:"12px",paddingRight:"36px",paddingTop:ke[b].paddingTop,paddingBottom:ke[b].paddingBottom,fontSize:ke[b].fontSize,lineHeight:ke[b].lineHeight,fontWeight:400,WebkitTapHighlightColor:"transparent",WebkitTouchCallout:"none",touchAction:"manipulation",userSelect:"none"},H),onClick:function(){if(!h){var e=!xe;fe||$(e),null==B||B(e),e&&C?setTimeout(function(){var e;null===(e=le.current)||void 0===e||e.focus()},0):oe("")}},onFocus:function(e){null==D||D(e)},onBlur:function(e){null==M||M(e)},onTouchStart:function(e){h||(e.currentTarget.style.opacity="0.8")},onTouchEnd:function(e){e.currentTarget.style.opacity="1"},tabIndex:h?-1:0,children:[e.jsx("div",{style:{display:"flex",alignItems:"center",flex:1,minWidth:0,gap:"8px"},children:ge?ze||(m?e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"#79716B",fontSize:"16px",lineHeight:"24px",fontWeight:400},children:m}):e.jsx("span",{style:{flex:1,minHeight:"24px"}})):C&&xe?e.jsx("input",{ref:le,type:"text",value:ne,onChange:function(e){var n=e.target.value;oe(n),null==A||A(n),ie(-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:h?"#98A2B3":"#1C1917",fontFamily:"DM Sans, sans-serif",minWidth:0,WebkitAppearance:"none",appearance:"none"},placeholder:Fe?void 0:m,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:Fe?h?"#98A2B3":"#1C1917":"#79716B",fontSize:"16px",lineHeight:"24px",fontWeight:400,minHeight:"24px",display:"inline-block"},children:Fe?(null===(a=Se[0])||void 0===a?void 0:a.label)||he:m||" "})}),e.jsxs("div",{style:{position:"absolute",right:"12px",display:"flex",alignItems:"center",gap:"4px"},children:[je&&e.jsx(function(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:Ce,style:{cursor:"pointer",flexShrink:0,color:"#78716C"},children:e.jsx("path",{d:"M12 4L4 12M4 4L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},{}),e.jsx(function(n){var o=n.isOpen;return e.jsx("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:e.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#78716C",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},{isOpen:xe})]})]}),xe&&ce&&o.createPortal(e.jsx("div",{ref:se,className:"aha-select-dropdown ".concat(I),style:r({position:"absolute",top:"".concat(ce.top,"px"),left:"".concat(ce.left,"px"),width:"".concat(ce.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"===ce.placement?"translateY(8px)":"translateY(-8px)",animation:"dropdownFadeIn 0.2s ease-out forwards",transformOrigin:"top"===ce.placement?"bottom center":"top center",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain"},N),children:0===ye.length?e.jsx("div",{style:{padding:"8px 16px",textAlign:"center",color:"#78716C",fontSize:"14px",fontFamily:"DM Sans, sans-serif"},children:"No data"}):ye.map(function(n,o){var r=ge?Array.isArray(he)&&he.includes(n.value):he===n.value,t=o===te;return Y?e.jsx("div",{className:"aha-select-option ".concat(n.disabled?"":"hover:bg-[#FAFAF9]"," ").concat(r?"bg-[#FAFAF9]":""),onClick:function(){return!n.disabled&&be(n)},style:{cursor:n.disabled?"not-allowed":"pointer",transition:"background-color 0.2s"},children:Y(n,{selected:r,focused:t,disabled:n.disabled||!1})},n.value):e.jsxs("div",{className:"aha-select-option ".concat(n.disabled?"":"hover:bg-[#FAFAF9]"," ").concat(r?"bg-[#FAFAF9]":""),onClick:function(){return be(n)},style:{padding:"8px 16px",cursor:n.disabled?"not-allowed":"pointer",color:n.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:[e.jsx("span",{children:n.label}),r&&e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t?"hidden":"",children:e.jsx("path",{d:"M13.3333 4L6 11.3333L2.66667 8",stroke:K,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},n.value)})}),document.body)]})};x.displayName="Select";var g=function(n){var o=n.className,r=n.style;return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:o,style:r,children:e.jsx("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"})})},v=function(n){var o=n.className,r=n.style;return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:o,style:r,children:e.jsx("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"})})};exports.default=function(o){var t=o.current,i=o.defaultCurrent,a=void 0===i?1:i,l=o.total,d=void 0===l?0:l,c=o.pageSize,p=o.defaultPageSize,u=void 0===p?10:p,m=o.showSizeChanger,y=void 0!==m&&m,b=o.pageSizeOptions,w=void 0===b?["10","20","50","100"]:b,C=o.showQuickJumper,k=void 0!==C&&C,S=o.showTotal,j=o.onChange,F=o.onShowSizeChange,z=o.simple,E=void 0!==z&&z,L=o.disabled,A=void 0!==L&&L,D=o.hideOnSinglePage,M=void 0!==D&&D,B=o.className,O=void 0===B?"":B,W=o.style,H=o.size,R=void 0===H?"default":H,I=o.responsive,N=void 0!==I&&I;o.showLessItems;var T=o.itemRender,P=s().primaryColor,_=void 0===P?"#FB6011":P,X=n.useState(a),q=X[0],Y=X[1],V=n.useState(u),K=V[0],U=V[1],G=n.useState(""),J=G[0],Q=G[1],Z=null!=t?t:q,$=null!=c?c:K,ee=n.useMemo(function(){return Math.ceil(d/$)},[d,$]);n.useEffect(function(){void 0!==t&&Y(t)},[t]),n.useEffect(function(){void 0!==c&&U(c)},[c]);var ne=function(e){e<1||e>ee||e===Z||A||(void 0===t&&Y(e),null==j||j(e,$))},oe=function(){var e=parseInt(J,10);e>=1&&e<=ee&&(ne(e),Q(""))};if(M&&ee<=1)return null;if(E)return e.jsxs("div",{className:"aha-pagination aha-pagination-simple ".concat(O),style:W,children:[e.jsx(f,{onClick:function(){return ne(Z-1)},disabled:A||1===Z,type:"default",size:"default"===R?"medium":"small",style:{marginRight:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(g,{})}),e.jsxs("span",{style:{margin:"0 8px",fontSize:"14px",lineHeight:"20px",color:"#475467",fontFamily:"DM Sans, sans-serif"},children:[Z," / ",ee]}),e.jsx(f,{onClick:function(){return ne(Z+1)},disabled:A||Z===ee,type:"default",size:"default"===R?"medium":"small",style:{marginLeft:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(v,{})})]});var re=(Z-1)*$+1,te=Math.min(Z*$,d);return e.jsxs("div",{className:"aha-pagination w-full ".concat(O),style:r({display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:N?"wrap":"nowrap",fontFamily:"DM Sans, sans-serif"},W),children:[S&&e.jsx("div",{className:"justify-start text-Text-text-secondary text-sm font-medium font-['DM_Sans'] leading-5",children:S(d,[re,te])}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[d>0&&e.jsx(e.Fragment,{children:T?T(Z-1,"prev",e.jsx(f,{onClick:function(){return ne(Z-1)},disabled:A||1===Z,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(g,{})})):e.jsx(f,{onClick:function(){return ne(Z-1)},disabled:A||1===Z,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(g,{})})}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:function(){if(ee<=7)return Array.from({length:ee},function(e,n){return n+1});var e=[];if(Z<=4){for(var n=1;n<=5;n++)e.push(n);e.push("jump-next"),e.push(ee)}else if(Z>=ee-3){e.push(1),e.push("jump-prev");for(n=ee-4;n<=ee;n++)e.push(n)}else{e.push(1),e.push("jump-prev");for(n=Z-1;n<=Z+1;n++)e.push(n);e.push("jump-next"),e.push(ee)}return e}().map(function(n){return function(n){if("number"==typeof n){var o=n===Z,r=e.jsx(f,{onClick:function(){return ne(n)},disabled:A,type:o?"primary":"default",size:"default"===R?"medium":"small",style:{minWidth:"small"===R?"32px":"36px",height:"small"===R?"32px":"36px",padding:"0 12px",margin:0,fontWeight:o?500:400,border:o?"1px solid ".concat(_):void 0,boxShadow:"none",borderRadius:"8px"},children:n},n);return T?T(n,"page",r):r}if("jump-prev"===n)return r=e.jsx(f,{onClick:function(){return ne(Math.max(1,Z-5))},disabled:A,type:"default",size:"default"===R?"medium":"small",style:{minWidth:"small"===R?"32px":"36px",height:"small"===R?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-prev"),T?T(Z-5,"jump-prev",r):r;if("jump-next"===n)return r=e.jsx(f,{onClick:function(){return ne(Math.min(ee,Z+5))},disabled:A,type:"default",size:"default"===R?"medium":"small",style:{minWidth:"small"===R?"32px":"36px",height:"small"===R?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-next"),T?T(Z+5,"jump-next",r):r;return null}(n)})}),d>0&&e.jsx(e.Fragment,{children:T?T(Z+1,"next",e.jsx(f,{onClick:function(){return ne(Z+1)},disabled:A||Z===ee,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(v,{})})):e.jsx(f,{onClick:function(){return ne(Z+1)},disabled:A||Z===ee,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(v,{})})}),y&&e.jsx(x,{value:$,options:w.map(function(e){return{label:"".concat(e," / page"),value:Number(e)}}),onChange:function(e){return n=Number(e),o=Math.ceil(d/n),r=Z>o?o:Z,void 0===c&&U(n),void 0===t&&Y(r),null==F||F(r,n),void(null==j||j(r,n));var n,o,r},disabled:A,size:"small"===R?"small":"medium",style:{minWidth:"small"===R?80:96}}),k&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontFamily:"DM Sans, sans-serif"},children:[e.jsx("span",{style:{fontSize:"14px",lineHeight:"20px",color:"#475467"},children:"Go to"}),e.jsx(h,{type:"number",min:1,value:J,onChange:function(e){return Q(e.target.value)},onPressEnter:oe,disabled:A,size:"small"===R?"small":"medium",style:{width:56,minWidth:56}}),e.jsx("span",{style:{fontSize:"14px",lineHeight:"20px",color:"#475467"},children:"page"}),"object"==typeof k&&k.goButton?e.jsx(f,{onClick:oe,disabled:A,type:"default",size:"default"===R?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:k.goButton}):e.jsx(f,{onClick:oe,disabled:A,type:"default",size:"default"===R?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"OK"})]})]})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("react"),r=require("react-dom"),n=function(){return n=Object.assign||function(e){for(var o,r=1,n=arguments.length;r<n;r++)for(var t in o=arguments[r])Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t]);return e},n.apply(this,arguments)};function t(e,o){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(n=Object.getOwnPropertySymbols(e);t<n.length;t++)o.indexOf(n[t])<0&&Object.prototype.propertyIsEnumerable.call(e,n[t])&&(r[n[t]]=e[n[t]])}return r}function i(e,o,r){if(r||2===arguments.length)for(var n,t=0,i=o.length;t<i;t++)!n&&t in o||(n||(n=Array.prototype.slice.call(o,0,t)),n[t]=o[t]);return e.concat(n||Array.prototype.slice.call(o))}"function"==typeof SuppressedError&&SuppressedError;var a={primaryColor:"#FB6011"},l=o.createContext(a),d=function(){var e=o.useContext(l);return e||a},s={sm:"sm",md:"md",lg:"lg",xl:"xl",small:"sm",mediumSmall:"sm",medium:"md",large:"xl"},c={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"},p={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}},u=function(o){var r=o.size,n=o.color;return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:"@keyframes aha-button-spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}"}),e.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,style:{animation:"aha-button-spin 1s linear infinite",flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:n,strokeWidth:"2",opacity:"0.25"}),e.jsx("path",{d:"M22 12a10 10 0 0 1-10 10",stroke:n,strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})]})},f=function(r){var i=r.children,a=r.type,l=void 0===a?"secondary":a,f=r.size,x=void 0===f?"md":f,h=r.disabled,g=void 0!==h&&h,v=r.loading,m=void 0!==v&&v,b=r.iconOnly,y=r.focused,w=void 0!==y&&y,S=r.onClick,j=r.htmlType,k=void 0===j?"button":j,C=r.className,z=void 0===C?"":C,F=r.style,L=r.icon,E=r.iconPosition,A=void 0===E?"left":E,M=t(r,["children","type","size","disabled","loading","iconOnly","focused","onClick","htmlType","className","style","icon","iconPosition"]),O=d().primaryColor,B=o.useState(!1),W=B[0],R=B[1],H=o.useState(!1),T=H[0],D=H[1],I=c[l]||"secondary",N=p[s[x]||"md"],P=null!=b?b:!!L&&null==i,_="link-color"===I||"link-gray"===I||"destructive-link"===I,q=g||m,X=w,Y=O,V=function(){if(g)return"primary"===I||"secondary"===I||"destructive-primary"===I||"destructive-secondary"===I?{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=W||T;return"primary"===I?{bg:e?"var(--color-bg-brand-solid_hover, #ec470a)":Y||"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"===I?{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"===I?{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"===I?{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"===I?{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"===I?{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"===I?{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"===I?{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"}}(),K=function(){if(X)return"destructive-primary"===I||"destructive-secondary"===I||"destructive-tertiary"===I||"destructive-link"===I?"destructive-primary"===I||"destructive-secondary"===I?"var(--focus-ring-error-shadow-xs-skeuomorphic)":"var(--focus-ring-error)":"primary"===I||"secondary"===I?"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=n({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:N.gap,fontFamily:'var(--font-family-body, "DM Sans", system-ui, sans-serif)',fontWeight:600,fontSize:N.fontSize,lineHeight:"".concat(N.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:V.bg,color:V.color,border:V.border,boxShadow:null!=K?K:V.boxShadow,textDecoration:V.textDecoration},F);_?(G.borderRadius="4px",G.overflow="hidden",P?(G.width=N.height,G.height=N.height,G.padding=0):(G.height=N.height,G.paddingLeft=N.paddingX,G.paddingRight=N.paddingX)):(G.borderRadius="var(--radius-md, 8px)",P?(G.width=N.height,G.height=N.height,G.padding=0):(G.height=N.height,G.paddingLeft=N.paddingX,G.paddingRight=N.paddingX));var U=function(){return m?e.jsx(u,{size:N.iconSize,color:V.iconColor}):L?e.jsx("span",{"aria-hidden":!0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:N.iconSize,height:N.iconSize,color:V.iconColor,flexShrink:0},children:L}):null},J=m||L&&"left"===A,Q=!m&&L&&"right"===A;return e.jsxs("button",n({type:k,className:["aha-button","aha-button--".concat(I),"aha-button--".concat(s[x]||"md"),P&&"aha-button--icon-only",q&&"aha-button--disabled",m&&"aha-button--loading",X&&"aha-button--focused",z].filter(Boolean).join(" "),disabled:q,onClick:function(e){q?e.preventDefault():null==S||S(e)},onMouseEnter:function(){return!q&&R(!0)},onMouseLeave:function(){R(!1),D(!1)},onMouseDown:function(){return!q&&D(!0)},onMouseUp:function(){return D(!1)},style:G},M,{children:[J&&U(),!P&&i,Q&&U(),P&&!L&&!m&&i]}))};f.displayName="Button";var x="var(--shadow-xs)",h={small:{pt:"5px",pb:"5px"},mediumSmall:{pt:"7px",pb:"7px"},medium:{pt:"9px",pb:"9px"},large:{pt:"11px",pb:"11px"}};o.forwardRef(function(r,i){var a=r.size,l=void 0===a?"mediumSmall":a,d=r.error,s=void 0!==d&&d,c=r.disabled,p=void 0!==c&&c,u=r.readOnly,f=void 0!==u&&u,g=r.prefix,v=r.suffix,m=r.leadingText,b=r.trailingText,y=r.leadingAddon,w=r.trailingAddon,S=r.className,j=void 0===S?"":S,k=r.style,C=r.onFocus,z=r.onBlur,F=r.onKeyDown,L=r.onPressEnter,E=r.value,A=r.defaultValue,M=r.onChange,O=r.placeholder,B=r.type,W=void 0===B?"text":B,R=r.label,H=r.required,T=r.hintText,D=t(r,["size","error","disabled","readOnly","prefix","suffix","leadingText","trailingText","leadingAddon","trailingAddon","className","style","onFocus","onBlur","onKeyDown","onPressEnter","value","defaultValue","onChange","placeholder","type","label","required","hintText"]),I=o.useRef(null),N=o.useState(!1),P=N[0],_=N[1],q=o.useState(null!=A?A:""),X=q[0],Y=q[1];o.useEffect(function(){"function"==typeof i?i(I.current):i&&(i.current=I.current)},[i]);var V=void 0!==E,K=V?E:X,G=p?{border:"1px solid var(--color-border-disabled)",boxShadow:x,outline:"none"}:s&&P?{border:"1px solid var(--color-border-error)",boxShadow:x,outline:"2px solid var(--color-border-error)",outlineOffset:"-2px"}:s?{border:"1px solid var(--color-border-error_subtle)",boxShadow:x,outline:"none"}:P?{border:"1px solid var(--color-border-brand)",boxShadow:x,outline:"2px solid var(--color-border-brand)",outlineOffset:"-2px"}:{border:"1px solid var(--color-border-primary)",boxShadow:x,outline:"none"},U=G.border,J=G.boxShadow,Q=G.outline,Z=G.outlineOffset,$=h[l],ee=$.pt,oe=$.pb,re=p?"var(--color-border-disabled)":"var(--color-border-primary)",ne=!!g,te=!!v,ie={position:"absolute",top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",color:p?"var(--color-fg-disabled)":"var(--color-fg-quaternary)",zIndex:1,pointerEvents:"none"},ae={display:"flex",alignItems:"center",paddingTop:ee,paddingBottom:oe,paddingLeft:"14px",paddingRight:"12px",color:"var(--color-text-tertiary)",fontFamily:"var(--font-family-body)",fontSize:"var(--font-size-text-md)",lineHeight:"var(--line-height-text-md)",whiteSpace:"nowrap",flexShrink:0,backgroundColor:p?"var(--color-bg-disabled_subtle)":"transparent"},le=e.jsxs("div",{className:"aha-input-group ".concat(j),style:n({display:"flex",alignItems:"stretch",width:"100%",border:U,boxShadow:J,outline:Q,outlineOffset:Z,borderRadius:"var(--radius-md)",backgroundColor:p||f?"var(--color-bg-disabled_subtle)":"var(--color-bg-primary)",overflow:"hidden",boxSizing:"border-box",transition:"border-color 0.15s ease, box-shadow 0.15s ease"},k),children:[void 0!==m&&e.jsx("div",{style:n(n({},ae),{borderRight:"1px solid ".concat(re)}),children:m}),void 0!==y&&e.jsx("div",{style:{display:"flex",alignItems:"stretch",flexShrink:0,borderRight:"1px solid ".concat(re)},children:y}),e.jsxs("div",{style:{flex:1,position:"relative",display:"flex",alignItems:"stretch",minWidth:0},children:[ne&&e.jsx("span",{style:n(n({},ie),{left:"14px"}),children:g}),e.jsx("input",n({ref:I,type:W,value:K,placeholder:O,disabled:p,readOnly:f,onChange:function(e){V||Y(e.target.value),null==M||M(e)},onFocus:function(e){_(!0),null==C||C(e)},onBlur:function(e){_(!1),null==z||z(e)},onKeyDown:function(e){"Enter"===e.key&&L&&L(e),null==F||F(e)},style:{flex:1,border:"none",outline:"none",width:"100%",boxSizing:"border-box",fontFamily:"var(--font-family-body)",fontSize:"var(--font-size-text-md)",fontWeight:400,lineHeight:"var(--line-height-text-md)",backgroundColor:"transparent",color:p?"var(--color-text-disabled)":"var(--color-text-primary)",paddingTop:ee,paddingBottom:oe,paddingLeft:ne?"40px":"14px",paddingRight:te?"40px":"14px"},autoComplete:D.autoComplete||"off"},D)),te&&e.jsx("span",{style:n(n({},ie),{right:"14px"}),children:v})]}),void 0!==b&&e.jsx("div",{style:n(n({},ae),{paddingLeft:"12px",paddingRight:"14px",borderLeft:"1px solid ".concat(re)}),children:b}),void 0!==w&&e.jsx("div",{style:{display:"flex",alignItems:"stretch",flexShrink:0,borderLeft:"1px solid ".concat(re)},children:w})]});if(!R&&!T)return le;var de={margin:0,fontFamily:"var(--font-family-body)",fontSize:"var(--font-size-text-sm)",fontWeight:400,lineHeight:"20px",color:s?"var(--color-error-600)":"var(--color-text-tertiary)"};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",width:"100%"},children:[R&&e.jsxs("label",{style:{fontFamily:"var(--font-family-body)",fontSize:"var(--font-size-text-sm)",fontWeight:500,lineHeight:"20px",color:"var(--color-text-secondary)"},children:[R,H&&e.jsx("span",{style:{color:"var(--color-error-600)",marginLeft:"2px"},children:"*"})]}),le,T&&e.jsx("p",{style:de,children:T})]})}).displayName="InputGroup";var g={small:{height:"36px",paddingTop:"5px",paddingBottom:"5px"},mediumSmall:{height:"40px",paddingTop:"7px",paddingBottom:"7px"},medium:{height:"44px",paddingTop:"9px",paddingBottom:"9px"},large:{height:"48px",paddingTop:"11px",paddingBottom:"11px"}},v="var(--shadow-xs)",m=function(o){var r=o.onClick;return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:r,style:{cursor:"pointer",flexShrink:0},children:e.jsx("path",{d:"M12 4L4 12M4 4L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},b=o.forwardRef(function(r,i){var a=r.size,l=void 0===a?"mediumSmall":a,d=r.disabled,s=void 0!==d&&d,c=r.error,p=void 0!==c&&c,u=r.readOnly,f=void 0!==u&&u,x=r.prefix,h=r.suffix,b=r.allowClear,y=void 0!==b&&b,w=r.onClear,S=r.className,j=void 0===S?"":S,k=r.style,C=r.type,z=void 0===C?"text":C,F=r.placeholder,L=r.value,E=r.defaultValue,A=r.onChange,M=r.onFocus,O=r.onBlur,B=r.onPressEnter,W=r.label,R=r.required,H=r.hintText,T=t(r,["size","disabled","error","readOnly","prefix","suffix","allowClear","onClear","className","style","type","placeholder","value","defaultValue","onChange","onFocus","onBlur","onPressEnter","label","required","hintText"]),D=o.useRef(null),I=o.useState(E||L||""),N=I[0],P=I[1],_=o.useState(!1),q=_[0],X=_[1];o.useEffect(function(){"function"==typeof i?i(D.current):i&&(i.current=D.current)},[i]);var Y=void 0!==L,V=Y?L:N,K=y&&V&&!s,G=s?{border:"1px solid var(--color-border-disabled)",boxShadow:v,outline:"none"}:p&&q?{border:"1px solid var(--color-border-error)",boxShadow:v,outline:"2px solid var(--color-border-error)",outlineOffset:"-2px"}:p?{border:"1px solid var(--color-border-error_subtle)",boxShadow:v,outline:"none"}:q?{border:"1px solid var(--color-border-brand)",boxShadow:v,outline:"2px solid var(--color-border-brand)",outlineOffset:"-2px"}:{border:"1px solid var(--color-border-primary)",boxShadow:v,outline:"none"},U=G.border,J=G.boxShadow,Q=G.outline,Z=G.outlineOffset,$=g[l],ee=$.height,oe=$.paddingTop,re=$.paddingBottom,ne=n({width:"100%",height:ee,boxSizing:"border-box",fontFamily:"var(--font-family-body)",fontSize:"var(--font-size-text-md)",fontWeight:400,lineHeight:"var(--line-height-text-md)",borderRadius:"var(--radius-md)",border:U,boxShadow:J,backgroundColor:s||f?"var(--color-bg-disabled_subtle)":"var(--color-bg-primary)",color:s?"var(--color-text-disabled)":"var(--color-text-primary)",paddingTop:oe,paddingBottom:re,paddingLeft:x?"40px":"14px",paddingRight:h||K?"40px":"14px",transition:"border-color 0.15s ease, box-shadow 0.15s ease, outline-color 0.15s ease",outline:Q,outlineOffset:Z,WebkitAppearance:"none",MozAppearance:"textfield",appearance:"none"},k),te={position:"absolute",top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",color:s?"var(--color-fg-disabled)":"var(--color-fg-quaternary)",zIndex:1},ie=e.jsxs(e.Fragment,{children:[e.jsx("style",{children:'\n .aha-input-wrapper input::placeholder {\n color: var(--color-text-placeholder);\n font-size: var(--font-size-text-md);\n font-weight: 400;\n opacity: 1;\n }\n .aha-input-wrapper input::-webkit-input-placeholder { color: var(--color-text-placeholder); }\n .aha-input-wrapper input::-moz-placeholder { color: var(--color-text-placeholder); }\n .aha-input-wrapper input:-ms-input-placeholder { color: var(--color-text-placeholder); }\n .aha-input-wrapper input {\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n touch-action: manipulation;\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"] { -moz-appearance: textfield; }\n '}),e.jsxs("div",{className:"aha-input-wrapper ".concat(j),style:{position:"relative",display:"block",width:"100%"},children:[x&&e.jsx("span",{style:n(n({},te),{left:"14px",pointerEvents:"none"}),children:x}),e.jsx("input",n({ref:D,type:z,value:V,placeholder:F,disabled:s,readOnly:f,onChange:function(e){Y||P(e.target.value),null==A||A(e)},onFocus:function(e){X(!0),null==M||M(e)},onBlur:function(e){X(!1),null==O||O(e)},onKeyDown:function(e){var o;"Enter"===e.key&&B&&B(e),null===(o=T.onKeyDown)||void 0===o||o.call(T,e)},style:ne,autoComplete:T.autoComplete||"off",autoCorrect:T.autoCorrect||"off",autoCapitalize:T.autoCapitalize||"off",spellCheck:T.spellCheck||!1},T)),(h||K)&&e.jsxs("span",{style:n(n({},te),{right:"14px",gap:"var(--spacing-xs)"}),children:[K&&e.jsx(m,{onClick:function(e){var o;e.stopPropagation(),Y||P("");null==A||A({target:{value:""},currentTarget:{value:""}}),null==w||w(),null===(o=D.current)||void 0===o||o.focus()}}),h]})]})]});return W||H?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",width:"100%"},children:[W&&e.jsxs("label",{style:{fontFamily:"var(--font-family-body)",fontSize:"var(--font-size-text-sm)",fontWeight:500,lineHeight:"20px",color:"var(--color-text-secondary)"},children:[W,R&&e.jsx("span",{style:{color:"var(--color-error-600)",marginLeft:"2px"},children:"*"})]}),ie,H&&e.jsx("p",{style:{margin:0,fontFamily:"var(--font-family-body)",fontSize:"var(--font-size-text-sm)",fontWeight:400,lineHeight:"20px",color:p?"var(--color-error-600)":"var(--color-text-tertiary)"},children:H})]}):ie});b.displayName="Input";var y=function(t){var a,l=t.value,s=t.defaultValue,c=t.options,p=void 0===c?[]:c,u=t.mode,f=t.disabled,x=void 0!==f&&f,h=t.error,g=void 0!==h&&h,v=t.placeholder,m=void 0===v?"Please select":v,b=t.size,y=void 0===b?"medium":b,w=t.showSearch,S=void 0!==w&&w,j=t.filterOption,k=void 0===j||j,C=t.allowClear,z=void 0!==C&&C,F=t.onChange,L=t.onSelect,E=t.onDeselect,A=t.onSearch,M=t.onFocus,O=t.onBlur,B=t.onDropdownVisibleChange,W=t.className,R=void 0===W?"":W,H=t.style,T=t.dropdownClassName,D=void 0===T?"":T,I=t.dropdownStyle,N=t.defaultOpen,P=void 0!==N&&N,_=t.open,q=t.maxTagCount,X=t.tagRender,Y=t.optionRender,V=d().primaryColor,K=void 0===V?"#FB6011":V,G=o.useState(void 0!==s?s:u?[]:void 0),U=G[0],J=G[1],Q=o.useState(P),Z=Q[0],$=Q[1],ee=o.useState(""),oe=ee[0],re=ee[1],ne=o.useState(-1),te=ne[0],ie=ne[1],ae=o.useRef(null),le=o.useRef(null),de=o.useRef(null),se=o.useState(null),ce=se[0],pe=se[1],ue=void 0!==l,fe=void 0!==_,xe=ue?l:U,he=fe?_:Z,ge="multiple"===u||"tags"===u,ve=o.useCallback(function(){if(!xe)return[];var e=Array.isArray(xe)?xe:[xe];return p.filter(function(o){return e.includes(o.value)})},[xe,p]),me=o.useCallback(function(){return S&&oe?!1===k?p:"function"==typeof k?p.filter(function(e){return k(oe,e)}):p.filter(function(e){var o=String(e.label||"").toLowerCase(),r=oe.toLowerCase();return o.includes(r)}):p},[p,oe,S,k]),be=o.useMemo(function(){return me()},[me]);o.useEffect(function(){if(he&&ae.current){var e=function(){var e,o;if(ae.current){var r=ae.current.getBoundingClientRect(),n=null!==(o=null===(e=de.current)||void 0===e?void 0:e.offsetHeight)&&void 0!==o?o:Math.min(256,Math.max(40,40*be.length)),t=window.innerHeight-r.bottom,i=r.top,a=t<n+4&&i>t,l=a?r.top+window.scrollY-n-4:r.bottom+window.scrollY+4;pe({top:l,left:r.left+window.scrollX,width:r.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)}}pe(null)},[he,be.length]),o.useEffect(function(){var e=function(e){var o=e.target;ae.current&&!ae.current.contains(o)&&de.current&&!de.current.contains(o)&&(fe||$(!1),null==B||B(!1),re(""))};if(he)return document.addEventListener("mousedown",e,!0),document.addEventListener("touchstart",e,!0),function(){document.removeEventListener("mousedown",e,!0),document.removeEventListener("touchstart",e,!0)}},[he,fe,B]),o.useEffect(function(){if(he){var e=function(e){var o;if("ArrowDown"===e.key)e.preventDefault(),ie(function(e){return e<be.length-1?e+1:e});else if("ArrowUp"===e.key)e.preventDefault(),ie(function(e){return e>0?e-1:0});else if("Enter"===e.key&&te>=0){e.preventDefault();var r=be[te];r&&!r.disabled&&ye(r)}else"Escape"===e.key&&(e.preventDefault(),fe||$(!1),null==B||B(!1),null===(o=ae.current)||void 0===o||o.focus())};return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}}},[he,be,te,fe,B]),o.useEffect(function(){if(te>=0&&de.current){var e=de.current.querySelectorAll(".aha-select-option")[te];e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})}},[te]);var ye=o.useCallback(function(e){var o;if(!e.disabled)if(ge){var r,n=Array.isArray(xe)?xe:[];n.includes(e.value)?(r=n.filter(function(o){return o!==e.value}),null==E||E(e.value,e)):(r=i(i([],n,!0),[e.value],!1),null==L||L(e.value,e)),ue||J(r);var t=p.filter(function(e){return r.includes(e.value)});null==F||F(r,t)}else ue||J(e.value),null==F||F(e.value,e),null==L||L(e.value,e),fe||$(!1),null==B||B(!1),re(""),null===(o=ae.current)||void 0===o||o.focus()},[ge,xe,ue,fe,p,F,L,E,B]),we=o.useCallback(function(e,o){if(e.stopPropagation(),ge&&Array.isArray(xe)){var r=xe.filter(function(e){return e!==o}),n=p.find(function(e){return e.value===o});ue||J(r),null==F||F(r,ve()),null==E||E(o,n)}},[ge,xe,ue,p,F,E,ve]),Se=function(e){e.stopPropagation();var o=ge?[]:void 0;ue||J(o),null==F||F(o,[]),re("")},je={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"}},ke=o.useMemo(function(){return ve()},[ve]),Ce=o.useMemo(function(){return z&&xe&&!x},[z,xe,x]),ze=o.useMemo(function(){return ge?Array.isArray(xe)&&xe.length>0:null!=xe&&""!==xe},[ge,xe]),Fe=o.useMemo(function(){if(!ge||!Array.isArray(xe)||0===xe.length)return null;var r="responsive"===q?ke.slice(0,2):q?ke.slice(0,q):ke,n=q&&ke.length>r.length?ke.length-r.length:0;return e.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"4px",flex:1,minWidth:0},children:[r.map(function(r){var n={label:r.label,value:r.value,closable:!x,onClose:function(){return we({},r.value)}};return X?e.jsx(o.Fragment,{children:X(n)},r.value):e.jsxs("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:[e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.label}),!x&&e.jsx("span",{onClick:function(e){return we(e,r.value)},style:{cursor:"pointer",display:"flex",alignItems:"center",color:"#78716C",marginLeft:"4px"},children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M9 3L3 9M3 3L9 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]},r.value)}),n>0&&e.jsxs("span",{style:{fontSize:"12px",lineHeight:"18px",color:"#78716C",fontFamily:"DM Sans, sans-serif"},children:["+",n]})]})},[ge,xe,ke,q,x,X]);return e.jsxs(e.Fragment,{children:[e.jsx("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.jsxs("div",{ref:ae,className:"aha-select ".concat(R),style:n({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(g?"#F04438":he?K:"#D7D3D0"),backgroundColor:x?"#FAFAF9":"#FFFFFF",cursor:x?"not-allowed":"pointer",transition:"all 0.2s",paddingLeft:"12px",paddingRight:"36px",paddingTop:je[y].paddingTop,paddingBottom:je[y].paddingBottom,fontSize:je[y].fontSize,lineHeight:je[y].lineHeight,fontWeight:400,WebkitTapHighlightColor:"transparent",WebkitTouchCallout:"none",touchAction:"manipulation",userSelect:"none"},H),onClick:function(){if(!x){var e=!he;fe||$(e),null==B||B(e),e&&S?setTimeout(function(){var e;null===(e=le.current)||void 0===e||e.focus()},0):re("")}},onFocus:function(e){null==M||M(e)},onBlur:function(e){null==O||O(e)},onTouchStart:function(e){x||(e.currentTarget.style.opacity="0.8")},onTouchEnd:function(e){e.currentTarget.style.opacity="1"},tabIndex:x?-1:0,children:[e.jsx("div",{style:{display:"flex",alignItems:"center",flex:1,minWidth:0,gap:"8px"},children:ge?Fe||(m?e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"#79716B",fontSize:"16px",lineHeight:"24px",fontWeight:400},children:m}):e.jsx("span",{style:{flex:1,minHeight:"24px"}})):S&&he?e.jsx("input",{ref:le,type:"text",value:oe,onChange:function(e){var o=e.target.value;re(o),null==A||A(o),ie(-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:x?"#98A2B3":"#1C1917",fontFamily:"DM Sans, sans-serif",minWidth:0,WebkitAppearance:"none",appearance:"none"},placeholder:ze?void 0:m,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:ze?x?"#98A2B3":"#1C1917":"#79716B",fontSize:"16px",lineHeight:"24px",fontWeight:400,minHeight:"24px",display:"inline-block"},children:ze?(null===(a=ke[0])||void 0===a?void 0:a.label)||xe:m||" "})}),e.jsxs("div",{style:{position:"absolute",right:"12px",display:"flex",alignItems:"center",gap:"4px"},children:[Ce&&e.jsx(function(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:Se,style:{cursor:"pointer",flexShrink:0,color:"#78716C"},children:e.jsx("path",{d:"M12 4L4 12M4 4L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},{}),e.jsx(function(o){var r=o.isOpen;return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{transform:r?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease-in-out",flexShrink:0},children:e.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#78716C",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},{isOpen:he})]})]}),he&&ce&&r.createPortal(e.jsx("div",{ref:de,className:"aha-select-dropdown ".concat(D),style:n({position:"absolute",top:"".concat(ce.top,"px"),left:"".concat(ce.left,"px"),width:"".concat(ce.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"===ce.placement?"translateY(8px)":"translateY(-8px)",animation:"dropdownFadeIn 0.2s ease-out forwards",transformOrigin:"top"===ce.placement?"bottom center":"top center",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain"},I),children:0===be.length?e.jsx("div",{style:{padding:"8px 16px",textAlign:"center",color:"#78716C",fontSize:"14px",fontFamily:"DM Sans, sans-serif"},children:"No data"}):be.map(function(o,r){var n=ge?Array.isArray(xe)&&xe.includes(o.value):xe===o.value,t=r===te;return Y?e.jsx("div",{className:"aha-select-option ".concat(o.disabled?"":"hover:bg-[#FAFAF9]"," ").concat(n?"bg-[#FAFAF9]":""),onClick:function(){return!o.disabled&&ye(o)},style:{cursor:o.disabled?"not-allowed":"pointer",transition:"background-color 0.2s"},children:Y(o,{selected:n,focused:t,disabled:o.disabled||!1})},o.value):e.jsxs("div",{className:"aha-select-option ".concat(o.disabled?"":"hover:bg-[#FAFAF9]"," ").concat(n?"bg-[#FAFAF9]":""),onClick:function(){return ye(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:[e.jsx("span",{children:o.label}),n&&e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t?"hidden":"",children:e.jsx("path",{d:"M13.3333 4L6 11.3333L2.66667 8",stroke:K,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},o.value)})}),document.body)]})};y.displayName="Select";var w=function(o){var r=o.className,n=o.style;return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:r,style:n,children:e.jsx("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(o){var r=o.className,n=o.style;return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:r,style:n,children:e.jsx("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"})})};exports.default=function(r){var t=r.current,i=r.defaultCurrent,a=void 0===i?1:i,l=r.total,s=void 0===l?0:l,c=r.pageSize,p=r.defaultPageSize,u=void 0===p?10:p,x=r.showSizeChanger,h=void 0!==x&&x,g=r.pageSizeOptions,v=void 0===g?["10","20","50","100"]:g,m=r.showQuickJumper,j=void 0!==m&&m,k=r.showTotal,C=r.onChange,z=r.onShowSizeChange,F=r.simple,L=void 0!==F&&F,E=r.disabled,A=void 0!==E&&E,M=r.hideOnSinglePage,O=void 0!==M&&M,B=r.className,W=void 0===B?"":B,R=r.style,H=r.size,T=void 0===H?"default":H,D=r.responsive,I=void 0!==D&&D;r.showLessItems;var N=r.itemRender,P=d().primaryColor,_=void 0===P?"#FB6011":P,q=o.useState(a),X=q[0],Y=q[1],V=o.useState(u),K=V[0],G=V[1],U=o.useState(""),J=U[0],Q=U[1],Z=null!=t?t:X,$=null!=c?c:K,ee=o.useMemo(function(){return Math.ceil(s/$)},[s,$]);o.useEffect(function(){void 0!==t&&Y(t)},[t]),o.useEffect(function(){void 0!==c&&G(c)},[c]);var oe=function(e){e<1||e>ee||e===Z||A||(void 0===t&&Y(e),null==C||C(e,$))},re=function(){var e=parseInt(J,10);e>=1&&e<=ee&&(oe(e),Q(""))};if(O&&ee<=1)return null;if(L)return e.jsxs("div",{className:"aha-pagination aha-pagination-simple ".concat(W),style:R,children:[e.jsx(f,{onClick:function(){return oe(Z-1)},disabled:A||1===Z,type:"default",size:"default"===T?"medium":"small",style:{marginRight:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(w,{})}),e.jsxs("span",{style:{margin:"0 8px",fontSize:"14px",lineHeight:"20px",color:"#475467",fontFamily:"DM Sans, sans-serif"},children:[Z," / ",ee]}),e.jsx(f,{onClick:function(){return oe(Z+1)},disabled:A||Z===ee,type:"default",size:"default"===T?"medium":"small",style:{marginLeft:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(S,{})})]});var ne=(Z-1)*$+1,te=Math.min(Z*$,s);return e.jsxs("div",{className:"aha-pagination w-full ".concat(W),style:n({display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:I?"wrap":"nowrap",fontFamily:"DM Sans, sans-serif"},R),children:[k&&e.jsx("div",{className:"justify-start text-Text-text-secondary text-sm font-medium font-['DM_Sans'] leading-5",children:k(s,[ne,te])}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[s>0&&e.jsx(e.Fragment,{children:N?N(Z-1,"prev",e.jsx(f,{onClick:function(){return oe(Z-1)},disabled:A||1===Z,type:"default",size:"default"===T?"medium":"small",style:{height:"small"===T?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(w,{})})):e.jsx(f,{onClick:function(){return oe(Z-1)},disabled:A||1===Z,type:"default",size:"default"===T?"medium":"small",style:{height:"small"===T?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(w,{})})}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:function(){if(ee<=7)return Array.from({length:ee},function(e,o){return o+1});var e=[];if(Z<=4){for(var o=1;o<=5;o++)e.push(o);e.push("jump-next"),e.push(ee)}else if(Z>=ee-3){e.push(1),e.push("jump-prev");for(o=ee-4;o<=ee;o++)e.push(o)}else{e.push(1),e.push("jump-prev");for(o=Z-1;o<=Z+1;o++)e.push(o);e.push("jump-next"),e.push(ee)}return e}().map(function(o){return function(o){if("number"==typeof o){var r=o===Z,n=e.jsx(f,{onClick:function(){return oe(o)},disabled:A,type:r?"primary":"default",size:"default"===T?"medium":"small",style:{minWidth:"small"===T?"32px":"36px",height:"small"===T?"32px":"36px",padding:"0 12px",margin:0,fontWeight:r?500:400,border:r?"1px solid ".concat(_):void 0,boxShadow:"none",borderRadius:"8px"},children:o},o);return N?N(o,"page",n):n}if("jump-prev"===o)return n=e.jsx(f,{onClick:function(){return oe(Math.max(1,Z-5))},disabled:A,type:"default",size:"default"===T?"medium":"small",style:{minWidth:"small"===T?"32px":"36px",height:"small"===T?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-prev"),N?N(Z-5,"jump-prev",n):n;if("jump-next"===o)return n=e.jsx(f,{onClick:function(){return oe(Math.min(ee,Z+5))},disabled:A,type:"default",size:"default"===T?"medium":"small",style:{minWidth:"small"===T?"32px":"36px",height:"small"===T?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-next"),N?N(Z+5,"jump-next",n):n;return null}(o)})}),s>0&&e.jsx(e.Fragment,{children:N?N(Z+1,"next",e.jsx(f,{onClick:function(){return oe(Z+1)},disabled:A||Z===ee,type:"default",size:"default"===T?"medium":"small",style:{height:"small"===T?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(S,{})})):e.jsx(f,{onClick:function(){return oe(Z+1)},disabled:A||Z===ee,type:"default",size:"default"===T?"medium":"small",style:{height:"small"===T?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(S,{})})}),h&&e.jsx(y,{value:$,options:v.map(function(e){return{label:"".concat(e," / page"),value:Number(e)}}),onChange:function(e){return o=Number(e),r=Math.ceil(s/o),n=Z>r?r:Z,void 0===c&&G(o),void 0===t&&Y(n),null==z||z(n,o),void(null==C||C(n,o));var o,r,n},disabled:A,size:"small"===T?"small":"medium",style:{minWidth:"small"===T?80:96}}),j&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontFamily:"DM Sans, sans-serif"},children:[e.jsx("span",{style:{fontSize:"14px",lineHeight:"20px",color:"#475467"},children:"Go to"}),e.jsx(b,{type:"number",min:1,value:J,onChange:function(e){return Q(e.target.value)},onPressEnter:re,disabled:A,size:"small"===T?"small":"medium",style:{width:56,minWidth:56}}),e.jsx("span",{style:{fontSize:"14px",lineHeight:"20px",color:"#475467"},children:"page"}),"object"==typeof j&&j.goButton?e.jsx(f,{onClick:re,disabled:A,type:"default",size:"default"===T?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:j.goButton}):e.jsx(f,{onClick:re,disabled:A,type:"default",size:"default"===T?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"OK"})]})]})]})};
2
2
  //# sourceMappingURL=Pagination.js.map