aha-components 1.5.6 → 1.5.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.
package/dist/Alert.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsx as l,jsxs as e}from"react/jsx-runtime";import{useState as i}from"react";var n={success:l("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l("path",{d:"M10 1.66663C5.40002 1.66663 1.66669 5.39996 1.66669 9.99996C1.66669 14.6 5.40002 18.3333 10 18.3333C14.6 18.3333 18.3334 14.6 18.3334 9.99996C18.3334 5.39996 14.6 1.66663 10 1.66663ZM13.3584 8.49997L9.46668 12.3833C9.35001 12.5083 9.19168 12.5666 9.02501 12.5666C8.86668 12.5666 8.70834 12.5083 8.58334 12.3833L6.64169 10.4417C6.40002 10.2 6.40002 9.79994 6.64169 9.55827C6.88336 9.3166 7.28335 9.3166 7.52502 9.55827L9.02501 11.0583L12.475 7.61664C12.7167 7.36664 13.1167 7.36664 13.3584 7.61664C13.6 7.8583 13.6 8.24997 13.3584 8.49997Z",fill:"#00BC7D"})}),error:l("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l("path",{d:"M17.1342 6.3009L13.6999 2.86666C13.4658 2.63249 13.1474 2.50085 12.8157 2.50085H7.18504C6.85337 2.50085 6.53584 2.63249 6.30084 2.86666L2.8666 6.3009C2.63243 6.53507 2.50079 6.85343 2.50079 7.1851V12.8158C2.50079 13.1475 2.63243 13.465 2.8666 13.7L6.30084 17.1342C6.53501 17.3684 6.85337 17.5 7.18504 17.5H12.8157C13.1474 17.5 13.4649 17.3684 13.6999 17.1342L17.1342 13.7C17.3683 13.4658 17.5 13.1475 17.5 12.8158V7.1851C17.5 6.85343 17.3683 6.53507 17.1342 6.3009ZM12.525 11.6417C12.7692 11.8858 12.7692 12.2817 12.525 12.5259C12.4033 12.6475 12.2433 12.7092 12.0833 12.7092C11.9233 12.7092 11.7633 12.6484 11.6416 12.5259L9.99998 10.8842L8.35834 12.5259C8.23667 12.6475 8.07665 12.7092 7.91665 12.7092C7.75665 12.7092 7.59662 12.6484 7.47496 12.5259C7.23079 12.2817 7.23079 11.8858 7.47496 11.6417L9.1166 10L7.47496 8.3584C7.23079 8.11423 7.23079 7.71837 7.47496 7.4742C7.71912 7.23004 8.11498 7.23004 8.35915 7.4742L10.0008 9.11585L11.6424 7.4742C11.8866 7.23004 12.2825 7.23004 12.5266 7.4742C12.7708 7.71837 12.7708 8.11423 12.5266 8.3584L10.885 10L12.525 11.6417Z",fill:"#FB2C36"})}),warning:l("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l("path",{d:"M18.0057 14.2935L12.4999 3.99662C11.4333 2.00162 8.56744 2.00162 7.49995 3.99662L1.99417 14.2935C1.01583 16.1235 2.3442 18.3334 4.42337 18.3334H15.5765C17.6549 18.3334 18.9841 16.1226 18.0057 14.2935ZM9.37495 8.33337C9.37495 7.98837 9.65494 7.70837 9.99994 7.70837C10.3449 7.70837 10.6249 7.98837 10.6249 8.33337V11.6667C10.6249 12.0117 10.3449 12.2917 9.99994 12.2917C9.65494 12.2917 9.37495 12.0117 9.37495 11.6667V8.33337ZM10.0166 15C9.55663 15 9.17902 14.6267 9.17902 14.1667C9.17902 13.7067 9.54829 13.3334 10.0083 13.3334H10.0166C10.4775 13.3334 10.85 13.7067 10.85 14.1667C10.85 14.6267 10.4766 15 10.0166 15Z",fill:"#FE9A00"})}),info:l("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l("path",{d:"M14.6875 2.5H5.3125C3.4375 2.5 2.5 3.4375 2.5 5.3125V14.6875C2.5 16.5625 3.4375 17.5 5.3125 17.5H14.6875C16.5625 17.5 17.5 16.5625 17.5 14.6875V5.3125C17.5 3.4375 16.5625 2.5 14.6875 2.5ZM10.625 13.75C10.625 14.095 10.345 14.375 10 14.375C9.655 14.375 9.375 14.095 9.375 13.75V9.9408C9.375 9.5958 9.655 9.3158 10 9.3158C10.345 9.3158 10.625 9.5958 10.625 9.9408V13.75ZM10.0167 7.91667C9.55668 7.91667 9.17908 7.54333 9.17908 7.08333C9.17908 6.62333 9.54834 6.25 10.0083 6.25H10.0167C10.4775 6.25 10.85 6.62333 10.85 7.08333C10.85 7.54333 10.4767 7.91667 10.0167 7.91667Z",fill:"#2B7FFF"})})},s=l("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l("path",{d:"M15.4416 14.5583C15.6858 14.8025 15.6858 15.1984 15.4416 15.4425C15.32 15.5642 15.16 15.6258 15 15.6258C14.84 15.6258 14.68 15.565 14.5583 15.4425L9.99997 10.8842L5.44164 15.4425C5.31997 15.5642 5.15997 15.6258 4.99997 15.6258C4.83997 15.6258 4.67997 15.565 4.55831 15.4425C4.31414 15.1984 4.31414 14.8025 4.55831 14.5583L9.11664 10L4.55831 5.44171C4.31414 5.19754 4.31414 4.80168 4.55831 4.55751C4.80247 4.31335 5.19831 4.31335 5.44248 4.55751L10.0008 9.11587L14.5591 4.55751C14.8033 4.31335 15.1991 4.31335 15.4433 4.55751C15.6875 4.80168 15.6875 5.19754 15.4433 5.44171L10.885 10L15.4416 14.5583Z",fill:"#57534D"})}),t=function(t){var o=t.className,C=void 0===o?"":o,a=t.type,r=void 0===a?"info":a,c=t.title,d=t.description,h=t.icon,f=void 0===h?n[r]:h,g=t.showIcon,w=void 0===g||g,m=t.closeable,v=void 0!==m&&m,x=t.action,L=t.children,u=t.onClose,p=i(!0),F=p[0],M=p[1];return F?e("div",{className:"".concat("aha-alert px-4 py-3 rounded-md flex gap-2 relative"," ").concat(C),style:{success:{backgroundColor:"#ECFDF5"},error:{backgroundColor:"#FEF2F2"},warning:{backgroundColor:"#FFFBEB"},info:{backgroundColor:"#EFF6FF"}}[r],children:[w&&f,e("div",{className:"flex flex-col gap-1",style:v?{paddingRight:"2rem"}:{},children:[c&&l("div",{className:"justify-start text-[#292524] text-base font-semibold font-['DM_Sans'] leading-normal",children:c}),d&&l("div",{className:"w-full justify-center text-[#57534D] text-sm font-normal font-['DM_Sans'] leading-snug",children:d}),L&&l("div",{className:"w-full justify-center text-[#57534D] text-sm font-normal font-['DM_Sans'] leading-snug",children:L}),x&&v&&l("div",{className:"mt-3",children:x})]}),x&&!v&&l("div",{className:"ml-3",children:x}),v&&l("div",{className:"absolute right-4 top-3 cursor-pointer",onClick:function(){M(!1),null==u||u()},children:s})]}):null};export{t as default};
1
+ import{jsx as e,jsxs as l}from"react/jsx-runtime";import{useState as n}from"react";var i={success:e("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M10 1.66663C5.40002 1.66663 1.66669 5.39996 1.66669 9.99996C1.66669 14.6 5.40002 18.3333 10 18.3333C14.6 18.3333 18.3334 14.6 18.3334 9.99996C18.3334 5.39996 14.6 1.66663 10 1.66663ZM13.3584 8.49997L9.46668 12.3833C9.35001 12.5083 9.19168 12.5666 9.02501 12.5666C8.86668 12.5666 8.70834 12.5083 8.58334 12.3833L6.64169 10.4417C6.40002 10.2 6.40002 9.79994 6.64169 9.55827C6.88336 9.3166 7.28335 9.3166 7.52502 9.55827L9.02501 11.0583L12.475 7.61664C12.7167 7.36664 13.1167 7.36664 13.3584 7.61664C13.6 7.8583 13.6 8.24997 13.3584 8.49997Z",fill:"#00BC7D"})}),error:e("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M17.1342 6.3009L13.6999 2.86666C13.4658 2.63249 13.1474 2.50085 12.8157 2.50085H7.18504C6.85337 2.50085 6.53584 2.63249 6.30084 2.86666L2.8666 6.3009C2.63243 6.53507 2.50079 6.85343 2.50079 7.1851V12.8158C2.50079 13.1475 2.63243 13.465 2.8666 13.7L6.30084 17.1342C6.53501 17.3684 6.85337 17.5 7.18504 17.5H12.8157C13.1474 17.5 13.4649 17.3684 13.6999 17.1342L17.1342 13.7C17.3683 13.4658 17.5 13.1475 17.5 12.8158V7.1851C17.5 6.85343 17.3683 6.53507 17.1342 6.3009ZM12.525 11.6417C12.7692 11.8858 12.7692 12.2817 12.525 12.5259C12.4033 12.6475 12.2433 12.7092 12.0833 12.7092C11.9233 12.7092 11.7633 12.6484 11.6416 12.5259L9.99998 10.8842L8.35834 12.5259C8.23667 12.6475 8.07665 12.7092 7.91665 12.7092C7.75665 12.7092 7.59662 12.6484 7.47496 12.5259C7.23079 12.2817 7.23079 11.8858 7.47496 11.6417L9.1166 10L7.47496 8.3584C7.23079 8.11423 7.23079 7.71837 7.47496 7.4742C7.71912 7.23004 8.11498 7.23004 8.35915 7.4742L10.0008 9.11585L11.6424 7.4742C11.8866 7.23004 12.2825 7.23004 12.5266 7.4742C12.7708 7.71837 12.7708 8.11423 12.5266 8.3584L10.885 10L12.525 11.6417Z",fill:"#FB2C36"})}),warning:e("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M18.0057 14.2935L12.4999 3.99662C11.4333 2.00162 8.56744 2.00162 7.49995 3.99662L1.99417 14.2935C1.01583 16.1235 2.3442 18.3334 4.42337 18.3334H15.5765C17.6549 18.3334 18.9841 16.1226 18.0057 14.2935ZM9.37495 8.33337C9.37495 7.98837 9.65494 7.70837 9.99994 7.70837C10.3449 7.70837 10.6249 7.98837 10.6249 8.33337V11.6667C10.6249 12.0117 10.3449 12.2917 9.99994 12.2917C9.65494 12.2917 9.37495 12.0117 9.37495 11.6667V8.33337ZM10.0166 15C9.55663 15 9.17902 14.6267 9.17902 14.1667C9.17902 13.7067 9.54829 13.3334 10.0083 13.3334H10.0166C10.4775 13.3334 10.85 13.7067 10.85 14.1667C10.85 14.6267 10.4766 15 10.0166 15Z",fill:"#FE9A00"})}),info:e("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M14.6875 2.5H5.3125C3.4375 2.5 2.5 3.4375 2.5 5.3125V14.6875C2.5 16.5625 3.4375 17.5 5.3125 17.5H14.6875C16.5625 17.5 17.5 16.5625 17.5 14.6875V5.3125C17.5 3.4375 16.5625 2.5 14.6875 2.5ZM10.625 13.75C10.625 14.095 10.345 14.375 10 14.375C9.655 14.375 9.375 14.095 9.375 13.75V9.9408C9.375 9.5958 9.655 9.3158 10 9.3158C10.345 9.3158 10.625 9.5958 10.625 9.9408V13.75ZM10.0167 7.91667C9.55668 7.91667 9.17908 7.54333 9.17908 7.08333C9.17908 6.62333 9.54834 6.25 10.0083 6.25H10.0167C10.4775 6.25 10.85 6.62333 10.85 7.08333C10.85 7.54333 10.4767 7.91667 10.0167 7.91667Z",fill:"#2B7FFF"})})},t=e("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M15.4416 14.5583C15.6858 14.8025 15.6858 15.1984 15.4416 15.4425C15.32 15.5642 15.16 15.6258 15 15.6258C14.84 15.6258 14.68 15.565 14.5583 15.4425L9.99997 10.8842L5.44164 15.4425C5.31997 15.5642 5.15997 15.6258 4.99997 15.6258C4.83997 15.6258 4.67997 15.565 4.55831 15.4425C4.31414 15.1984 4.31414 14.8025 4.55831 14.5583L9.11664 10L4.55831 5.44171C4.31414 5.19754 4.31414 4.80168 4.55831 4.55751C4.80247 4.31335 5.19831 4.31335 5.44248 4.55751L10.0008 9.11587L14.5591 4.55751C14.8033 4.31335 15.1991 4.31335 15.4433 4.55751C15.6875 4.80168 15.6875 5.19754 15.4433 5.44171L10.885 10L15.4416 14.5583Z",fill:"#57534D"})}),o=function(o){var s=o.className,r=void 0===s?"":s,a=o.type,C=void 0===a?"info":a,c=o.title,d=o.description,h=o.icon,f=void 0===h?i[C]:h,w=o.showIcon,g=void 0===w||w,m=o.closeable,x=void 0!==m&&m,v=o.action,u=o.children,L=o.onClose,p=n(!0),F=p[0],M=p[1],N=function(){M(!1),null==L||L()},k=v||x;return F?l("div",{className:"".concat("aha-alert px-4 py-3 rounded-md flex gap-2"," ").concat(r),style:{success:{backgroundColor:"#ECFDF5"},error:{backgroundColor:"#FEF2F2"},warning:{backgroundColor:"#FFFBEB"},info:{backgroundColor:"#EFF6FF"}}[C],children:[g&&f,l("div",{className:"flex flex-col gap-1 ".concat(k?"flex-1 min-w-0":""),children:[c&&e("div",{className:"justify-start text-[#292524] text-base font-semibold font-['DM_Sans'] leading-normal",children:c}),d&&e("div",{className:"w-full justify-center text-[#57534D] text-sm font-normal font-['DM_Sans'] leading-snug",children:d}),u&&e("div",{className:"w-full justify-center text-[#57534D] text-sm font-normal font-['DM_Sans'] leading-snug",children:u})]}),k&&l("div",{className:"ml-auto flex-shrink-0 self-center flex items-center gap-2",children:[v,x&&e("div",{className:"cursor-pointer relative top-[-12px]",onClick:N,onKeyDown:function(e){return"Enter"===e.key&&N()},role:"button",tabIndex:0,"aria-label":"关闭",children:t})]})]}):null};export{o as default};
2
2
  //# sourceMappingURL=Alert.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.esm.js","sources":["../src/components/Alert/icon.tsx","../src/components/Alert/index.tsx"],"sourcesContent":["export const AlertIcon = {\n success: (\n <svg\n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M10 1.66663C5.40002 1.66663 1.66669 5.39996 1.66669 9.99996C1.66669 14.6 5.40002 18.3333 10 18.3333C14.6 18.3333 18.3334 14.6 18.3334 9.99996C18.3334 5.39996 14.6 1.66663 10 1.66663ZM13.3584 8.49997L9.46668 12.3833C9.35001 12.5083 9.19168 12.5666 9.02501 12.5666C8.86668 12.5666 8.70834 12.5083 8.58334 12.3833L6.64169 10.4417C6.40002 10.2 6.40002 9.79994 6.64169 9.55827C6.88336 9.3166 7.28335 9.3166 7.52502 9.55827L9.02501 11.0583L12.475 7.61664C12.7167 7.36664 13.1167 7.36664 13.3584 7.61664C13.6 7.8583 13.6 8.24997 13.3584 8.49997Z\"\n fill=\"#00BC7D\"\n />\n </svg>\n ),\n error: (\n <svg\n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M17.1342 6.3009L13.6999 2.86666C13.4658 2.63249 13.1474 2.50085 12.8157 2.50085H7.18504C6.85337 2.50085 6.53584 2.63249 6.30084 2.86666L2.8666 6.3009C2.63243 6.53507 2.50079 6.85343 2.50079 7.1851V12.8158C2.50079 13.1475 2.63243 13.465 2.8666 13.7L6.30084 17.1342C6.53501 17.3684 6.85337 17.5 7.18504 17.5H12.8157C13.1474 17.5 13.4649 17.3684 13.6999 17.1342L17.1342 13.7C17.3683 13.4658 17.5 13.1475 17.5 12.8158V7.1851C17.5 6.85343 17.3683 6.53507 17.1342 6.3009ZM12.525 11.6417C12.7692 11.8858 12.7692 12.2817 12.525 12.5259C12.4033 12.6475 12.2433 12.7092 12.0833 12.7092C11.9233 12.7092 11.7633 12.6484 11.6416 12.5259L9.99998 10.8842L8.35834 12.5259C8.23667 12.6475 8.07665 12.7092 7.91665 12.7092C7.75665 12.7092 7.59662 12.6484 7.47496 12.5259C7.23079 12.2817 7.23079 11.8858 7.47496 11.6417L9.1166 10L7.47496 8.3584C7.23079 8.11423 7.23079 7.71837 7.47496 7.4742C7.71912 7.23004 8.11498 7.23004 8.35915 7.4742L10.0008 9.11585L11.6424 7.4742C11.8866 7.23004 12.2825 7.23004 12.5266 7.4742C12.7708 7.71837 12.7708 8.11423 12.5266 8.3584L10.885 10L12.525 11.6417Z\"\n fill=\"#FB2C36\"\n />\n </svg>\n ),\n warning: (\n <svg \n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M18.0057 14.2935L12.4999 3.99662C11.4333 2.00162 8.56744 2.00162 7.49995 3.99662L1.99417 14.2935C1.01583 16.1235 2.3442 18.3334 4.42337 18.3334H15.5765C17.6549 18.3334 18.9841 16.1226 18.0057 14.2935ZM9.37495 8.33337C9.37495 7.98837 9.65494 7.70837 9.99994 7.70837C10.3449 7.70837 10.6249 7.98837 10.6249 8.33337V11.6667C10.6249 12.0117 10.3449 12.2917 9.99994 12.2917C9.65494 12.2917 9.37495 12.0117 9.37495 11.6667V8.33337ZM10.0166 15C9.55663 15 9.17902 14.6267 9.17902 14.1667C9.17902 13.7067 9.54829 13.3334 10.0083 13.3334H10.0166C10.4775 13.3334 10.85 13.7067 10.85 14.1667C10.85 14.6267 10.4766 15 10.0166 15Z\"\n fill=\"#FE9A00\"\n />\n </svg>\n ),\n info: (\n <svg\n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M14.6875 2.5H5.3125C3.4375 2.5 2.5 3.4375 2.5 5.3125V14.6875C2.5 16.5625 3.4375 17.5 5.3125 17.5H14.6875C16.5625 17.5 17.5 16.5625 17.5 14.6875V5.3125C17.5 3.4375 16.5625 2.5 14.6875 2.5ZM10.625 13.75C10.625 14.095 10.345 14.375 10 14.375C9.655 14.375 9.375 14.095 9.375 13.75V9.9408C9.375 9.5958 9.655 9.3158 10 9.3158C10.345 9.3158 10.625 9.5958 10.625 9.9408V13.75ZM10.0167 7.91667C9.55668 7.91667 9.17908 7.54333 9.17908 7.08333C9.17908 6.62333 9.54834 6.25 10.0083 6.25H10.0167C10.4775 6.25 10.85 6.62333 10.85 7.08333C10.85 7.54333 10.4767 7.91667 10.0167 7.91667Z\"\n fill=\"#2B7FFF\"\n />\n </svg>\n ),\n};\n\nexport const CloseIcon = (\n <svg\n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M15.4416 14.5583C15.6858 14.8025 15.6858 15.1984 15.4416 15.4425C15.32 15.5642 15.16 15.6258 15 15.6258C14.84 15.6258 14.68 15.565 14.5583 15.4425L9.99997 10.8842L5.44164 15.4425C5.31997 15.5642 5.15997 15.6258 4.99997 15.6258C4.83997 15.6258 4.67997 15.565 4.55831 15.4425C4.31414 15.1984 4.31414 14.8025 4.55831 14.5583L9.11664 10L4.55831 5.44171C4.31414 5.19754 4.31414 4.80168 4.55831 4.55751C4.80247 4.31335 5.19831 4.31335 5.44248 4.55751L10.0008 9.11587L14.5591 4.55751C14.8033 4.31335 15.1991 4.31335 15.4433 4.55751C15.6875 4.80168 15.6875 5.19754 15.4433 5.44171L10.885 10L15.4416 14.5583Z\"\n fill=\"#57534D\"\n />\n </svg>\n);\n","import React, { useState } from \"react\";\nimport { AlertIcon, CloseIcon } from \"./icon\";\n\nexport interface AlertProps {\n title?: string;\n description?: string;\n className?: string;\n type?: \"success\" | \"error\" | \"warning\" | \"info\";\n icon?: React.ReactNode;\n showIcon?: boolean;\n closeable?: boolean;\n action?: React.ReactNode;\n children?: React.ReactNode;\n /** 关闭回调 */\n onClose?: () => void;\n}\n\nconst Alert: React.FC<AlertProps> = ({\n className = \"\",\n type = \"info\",\n title,\n description,\n icon = AlertIcon[type],\n showIcon = true,\n closeable = false,\n action,\n children,\n onClose\n}) => {\n const baseClasses = \"aha-alert px-4 py-3 rounded-md flex gap-2 relative\";\n\n // 使用内联样式作为备选方案,确保样式始终生效\n const typeStyles = {\n success: { backgroundColor: '#ECFDF5' },\n error: { backgroundColor: '#FEF2F2' },\n warning: { backgroundColor: '#FFFBEB' },\n info: { backgroundColor: '#EFF6FF' },\n };\n\n const [visible, setVisible] = useState(true);\n const handleClose = () => {\n setVisible(false);\n onClose?.();\n };\n\n if (!visible) return null;\n\n return (\n <div \n className={`${baseClasses} ${className}`}\n style={typeStyles[type]}\n >\n {showIcon && icon}\n <div \n className=\"flex flex-col gap-1\"\n style={closeable ? { paddingRight: '2rem' } : {}}\n >\n {title && (\n <div className=\"justify-start text-[#292524] text-base font-semibold font-['DM_Sans'] leading-normal\">\n {title}\n </div>\n )}\n {description && (\n <div className=\"w-full justify-center text-[#57534D] text-sm font-normal font-['DM_Sans'] leading-snug\">\n {description}\n </div>\n )}\n {children && (\n <div className=\"w-full justify-center text-[#57534D] text-sm font-normal font-['DM_Sans'] leading-snug\">\n {children}\n </div>\n )}\n {action && closeable && <div className=\"mt-3\">{action}</div>}\n </div>\n {action && !closeable && <div className=\"ml-3\">{action}</div>}\n {closeable && (\n <div\n className=\"absolute right-4 top-3 cursor-pointer\"\n onClick={handleClose}\n >\n {CloseIcon}\n </div>\n )}\n </div>\n );\n};\n\nexport default Alert;\n"],"names":["AlertIcon","success","_jsx","className","width","height","viewBox","fill","xmlns","children","d","error","warning","info","CloseIcon","Alert","_a","_b","_c","type","title","description","_d","icon","_e","showIcon","_f","closeable","action","onClose","_g","useState","visible","setVisible","_jsxs","concat","style","backgroundColor","paddingRight","onClick"],"mappings":"mFAAO,IAAMA,EAAY,CACvBC,QACEC,EAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAP,EAAA,OAAA,CACEQ,EAAE,6hBACFH,KAAK,cAIXI,MACET,EAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAP,EAAA,OAAA,CACEQ,EAAE,gjCACFH,KAAK,cAIXK,QACEV,EAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAP,EAAA,OAAA,CACEQ,EAAE,2mBACFH,KAAK,cAIXM,KACEX,EAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAP,EAAA,OAAA,CACEQ,EAAE,6jBACFH,KAAK,eAMAO,EACXZ,EAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAP,EAAA,OAAA,CACEQ,EAAE,0lBACFH,KAAK,cCzDLQ,EAA8B,SAACC,OACnCC,EAAcD,EAAAb,UAAdA,OAAY,IAAAc,EAAA,KACZC,EAAAF,EAAAG,KAAAA,OAAO,IAAAD,EAAA,SACPE,EAAKJ,EAAAI,MACLC,EAAWL,EAAAK,YACXC,EAAsBN,EAAAO,KAAtBA,OAAI,IAAAD,EAAGtB,EAAUmB,GAAKG,EACtBE,EAAeR,EAAAS,SAAfA,OAAW,IAAAD,GAAIA,EACfE,EAAiBV,EAAAW,UAAjBA,OAAY,IAAAD,GAAKA,EACjBE,EAAMZ,EAAAY,OACNnB,EAAQO,EAAAP,SACRoB,EAAOb,EAAAa,QAYDC,EAAwBC,GAAS,GAAhCC,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GAM1B,OAAKE,EAGHE,EACE,MAAA,CAAA/B,UAAW,GAAAgC,OApBK,qDAoBS,KAAAA,OAAIhC,GAC7BiC,MAlBe,CACjBnC,QAAS,CAAEoC,gBAAiB,WAC5B1B,MAAO,CAAE0B,gBAAiB,WAC1BzB,QAAS,CAAEyB,gBAAiB,WAC5BxB,KAAM,CAAEwB,gBAAiB,YAcLlB,GAAKV,SAAA,CAEtBgB,GAAYF,EACbW,EACE,MAAA,CAAA/B,UAAU,sBACViC,MAAOT,EAAY,CAAEW,aAAc,QAAW,GAAE7B,SAAA,CAE/CW,GACClB,EAAA,MAAA,CAAKC,UAAU,uFAAsFM,SAClGW,IAGJC,GACCnB,EAAA,MAAA,CAAKC,UAAU,yFACZM,SAAAY,IAGJZ,GACCP,EAAK,MAAA,CAAAC,UAAU,yFACZM,SAAAA,IAGJmB,GAAUD,GAAazB,EAAA,MAAA,CAAKC,UAAU,OAAMM,SAAEmB,OAEhDA,IAAWD,GAAazB,EAAA,MAAA,CAAKC,UAAU,OAAMM,SAAEmB,IAC/CD,GACCzB,EACE,MAAA,CAAAC,UAAU,wCACVoC,QAtCY,WAClBN,GAAW,GACXJ,SAAAA,GACF,EAqCSpB,SAAAK,OAnCY,IAwCvB"}
1
+ {"version":3,"file":"Alert.esm.js","sources":["../src/components/Alert/icon.tsx","../src/components/Alert/index.tsx"],"sourcesContent":["export const AlertIcon = {\n success: (\n <svg\n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M10 1.66663C5.40002 1.66663 1.66669 5.39996 1.66669 9.99996C1.66669 14.6 5.40002 18.3333 10 18.3333C14.6 18.3333 18.3334 14.6 18.3334 9.99996C18.3334 5.39996 14.6 1.66663 10 1.66663ZM13.3584 8.49997L9.46668 12.3833C9.35001 12.5083 9.19168 12.5666 9.02501 12.5666C8.86668 12.5666 8.70834 12.5083 8.58334 12.3833L6.64169 10.4417C6.40002 10.2 6.40002 9.79994 6.64169 9.55827C6.88336 9.3166 7.28335 9.3166 7.52502 9.55827L9.02501 11.0583L12.475 7.61664C12.7167 7.36664 13.1167 7.36664 13.3584 7.61664C13.6 7.8583 13.6 8.24997 13.3584 8.49997Z\"\n fill=\"#00BC7D\"\n />\n </svg>\n ),\n error: (\n <svg\n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M17.1342 6.3009L13.6999 2.86666C13.4658 2.63249 13.1474 2.50085 12.8157 2.50085H7.18504C6.85337 2.50085 6.53584 2.63249 6.30084 2.86666L2.8666 6.3009C2.63243 6.53507 2.50079 6.85343 2.50079 7.1851V12.8158C2.50079 13.1475 2.63243 13.465 2.8666 13.7L6.30084 17.1342C6.53501 17.3684 6.85337 17.5 7.18504 17.5H12.8157C13.1474 17.5 13.4649 17.3684 13.6999 17.1342L17.1342 13.7C17.3683 13.4658 17.5 13.1475 17.5 12.8158V7.1851C17.5 6.85343 17.3683 6.53507 17.1342 6.3009ZM12.525 11.6417C12.7692 11.8858 12.7692 12.2817 12.525 12.5259C12.4033 12.6475 12.2433 12.7092 12.0833 12.7092C11.9233 12.7092 11.7633 12.6484 11.6416 12.5259L9.99998 10.8842L8.35834 12.5259C8.23667 12.6475 8.07665 12.7092 7.91665 12.7092C7.75665 12.7092 7.59662 12.6484 7.47496 12.5259C7.23079 12.2817 7.23079 11.8858 7.47496 11.6417L9.1166 10L7.47496 8.3584C7.23079 8.11423 7.23079 7.71837 7.47496 7.4742C7.71912 7.23004 8.11498 7.23004 8.35915 7.4742L10.0008 9.11585L11.6424 7.4742C11.8866 7.23004 12.2825 7.23004 12.5266 7.4742C12.7708 7.71837 12.7708 8.11423 12.5266 8.3584L10.885 10L12.525 11.6417Z\"\n fill=\"#FB2C36\"\n />\n </svg>\n ),\n warning: (\n <svg \n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M18.0057 14.2935L12.4999 3.99662C11.4333 2.00162 8.56744 2.00162 7.49995 3.99662L1.99417 14.2935C1.01583 16.1235 2.3442 18.3334 4.42337 18.3334H15.5765C17.6549 18.3334 18.9841 16.1226 18.0057 14.2935ZM9.37495 8.33337C9.37495 7.98837 9.65494 7.70837 9.99994 7.70837C10.3449 7.70837 10.6249 7.98837 10.6249 8.33337V11.6667C10.6249 12.0117 10.3449 12.2917 9.99994 12.2917C9.65494 12.2917 9.37495 12.0117 9.37495 11.6667V8.33337ZM10.0166 15C9.55663 15 9.17902 14.6267 9.17902 14.1667C9.17902 13.7067 9.54829 13.3334 10.0083 13.3334H10.0166C10.4775 13.3334 10.85 13.7067 10.85 14.1667C10.85 14.6267 10.4766 15 10.0166 15Z\"\n fill=\"#FE9A00\"\n />\n </svg>\n ),\n info: (\n <svg\n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M14.6875 2.5H5.3125C3.4375 2.5 2.5 3.4375 2.5 5.3125V14.6875C2.5 16.5625 3.4375 17.5 5.3125 17.5H14.6875C16.5625 17.5 17.5 16.5625 17.5 14.6875V5.3125C17.5 3.4375 16.5625 2.5 14.6875 2.5ZM10.625 13.75C10.625 14.095 10.345 14.375 10 14.375C9.655 14.375 9.375 14.095 9.375 13.75V9.9408C9.375 9.5958 9.655 9.3158 10 9.3158C10.345 9.3158 10.625 9.5958 10.625 9.9408V13.75ZM10.0167 7.91667C9.55668 7.91667 9.17908 7.54333 9.17908 7.08333C9.17908 6.62333 9.54834 6.25 10.0083 6.25H10.0167C10.4775 6.25 10.85 6.62333 10.85 7.08333C10.85 7.54333 10.4767 7.91667 10.0167 7.91667Z\"\n fill=\"#2B7FFF\"\n />\n </svg>\n ),\n};\n\nexport const CloseIcon = (\n <svg\n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M15.4416 14.5583C15.6858 14.8025 15.6858 15.1984 15.4416 15.4425C15.32 15.5642 15.16 15.6258 15 15.6258C14.84 15.6258 14.68 15.565 14.5583 15.4425L9.99997 10.8842L5.44164 15.4425C5.31997 15.5642 5.15997 15.6258 4.99997 15.6258C4.83997 15.6258 4.67997 15.565 4.55831 15.4425C4.31414 15.1984 4.31414 14.8025 4.55831 14.5583L9.11664 10L4.55831 5.44171C4.31414 5.19754 4.31414 4.80168 4.55831 4.55751C4.80247 4.31335 5.19831 4.31335 5.44248 4.55751L10.0008 9.11587L14.5591 4.55751C14.8033 4.31335 15.1991 4.31335 15.4433 4.55751C15.6875 4.80168 15.6875 5.19754 15.4433 5.44171L10.885 10L15.4416 14.5583Z\"\n fill=\"#57534D\"\n />\n </svg>\n);\n","import React, { useState } from \"react\";\nimport { AlertIcon, CloseIcon } from \"./icon\";\n\nexport interface AlertProps {\n title?: string;\n description?: string;\n className?: string;\n type?: \"success\" | \"error\" | \"warning\" | \"info\";\n icon?: React.ReactNode;\n showIcon?: boolean;\n closeable?: boolean;\n action?: React.ReactNode;\n children?: React.ReactNode;\n /** 关闭回调 */\n onClose?: () => void;\n}\n\nconst Alert: React.FC<AlertProps> = ({\n className = \"\",\n type = \"info\",\n title,\n description,\n icon = AlertIcon[type],\n showIcon = true,\n closeable = false,\n action,\n children,\n onClose\n}) => {\n const baseClasses = \"aha-alert px-4 py-3 rounded-md flex gap-2\";\n\n // 使用内联样式作为备选方案,确保样式始终生效\n const typeStyles = {\n success: { backgroundColor: '#ECFDF5' },\n error: { backgroundColor: '#FEF2F2' },\n warning: { backgroundColor: '#FFFBEB' },\n info: { backgroundColor: '#EFF6FF' },\n };\n\n const [visible, setVisible] = useState(true);\n const handleClose = () => {\n setVisible(false);\n onClose?.();\n };\n\n const hasRightSlot = action || closeable;\n\n if (!visible) return null;\n\n return (\n <div \n className={`${baseClasses} ${className}`}\n style={typeStyles[type]}\n >\n {showIcon && icon}\n <div\n className={`flex flex-col gap-1 ${hasRightSlot ? \"flex-1 min-w-0\" : \"\"}`}\n >\n {title && (\n <div className=\"justify-start text-[#292524] text-base font-semibold font-['DM_Sans'] leading-normal\">\n {title}\n </div>\n )}\n {description && (\n <div className=\"w-full justify-center text-[#57534D] text-sm font-normal font-['DM_Sans'] leading-snug\">\n {description}\n </div>\n )}\n {children && (\n <div className=\"w-full justify-center text-[#57534D] text-sm font-normal font-['DM_Sans'] leading-snug\">\n {children}\n </div>\n )}\n </div>\n {hasRightSlot && (\n <div className=\"ml-auto flex-shrink-0 self-center flex items-center gap-2\">\n {action}\n {closeable && (\n <div\n className=\"cursor-pointer relative top-[-12px]\"\n onClick={handleClose}\n onKeyDown={(e) => e.key === \"Enter\" && handleClose()}\n role=\"button\"\n tabIndex={0}\n aria-label=\"关闭\"\n >\n {CloseIcon}\n </div>\n )}\n </div>\n )}\n </div>\n );\n};\n\nexport default Alert;\n"],"names":["AlertIcon","success","_jsx","className","width","height","viewBox","fill","xmlns","children","d","error","warning","info","CloseIcon","Alert","_a","_b","_c","type","title","description","_d","icon","_e","showIcon","_f","closeable","action","onClose","_g","useState","visible","setVisible","handleClose","hasRightSlot","_jsxs","concat","style","backgroundColor","onClick","onKeyDown","e","key","role","tabIndex"],"mappings":"mFAAO,IAAMA,EAAY,CACvBC,QACEC,EAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAP,EAAA,OAAA,CACEQ,EAAE,6hBACFH,KAAK,cAIXI,MACET,EAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAP,EAAA,OAAA,CACEQ,EAAE,gjCACFH,KAAK,cAIXK,QACEV,EAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAP,EAAA,OAAA,CACEQ,EAAE,2mBACFH,KAAK,cAIXM,KACEX,EAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAP,EAAA,OAAA,CACEQ,EAAE,6jBACFH,KAAK,eAMAO,EACXZ,EAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAP,EAAA,OAAA,CACEQ,EAAE,0lBACFH,KAAK,cCzDLQ,EAA8B,SAACC,OACnCC,EAAcD,EAAAb,UAAdA,OAAY,IAAAc,EAAA,KACZC,EAAAF,EAAAG,KAAAA,OAAO,IAAAD,EAAA,SACPE,EAAKJ,EAAAI,MACLC,EAAWL,EAAAK,YACXC,EAAsBN,EAAAO,KAAtBA,OAAI,IAAAD,EAAGtB,EAAUmB,GAAKG,EACtBE,EAAeR,EAAAS,SAAfA,OAAW,IAAAD,GAAIA,EACfE,EAAiBV,EAAAW,UAAjBA,OAAY,IAAAD,GAAKA,EACjBE,EAAMZ,EAAAY,OACNnB,EAAQO,EAAAP,SACRoB,EAAOb,EAAAa,QAYDC,EAAwBC,GAAS,GAAhCC,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GACpBI,EAAc,WAClBD,GAAW,GACXJ,SAAAA,GACF,EAEMM,EAAeP,GAAUD,EAE/B,OAAKK,EAGHI,EAAA,MAAA,CACEjC,UAAW,GAAGkC,OAtBE,4CAsBa,KAAAA,OAAAlC,GAC7BmC,MApBe,CACjBrC,QAAS,CAAEsC,gBAAiB,WAC5B5B,MAAO,CAAE4B,gBAAiB,WAC1B3B,QAAS,CAAE2B,gBAAiB,WAC5B1B,KAAM,CAAE0B,gBAAiB,YAgBLpB,GAEjBV,SAAA,CAAAgB,GAAYF,EACba,EAAA,MAAA,CACEjC,UAAW,uBAAuBkC,OAAAF,EAAe,iBAAmB,IAEnE1B,SAAA,CAAAW,GACClB,EAAK,MAAA,CAAAC,UAAU,uFACZM,SAAAW,IAGJC,GACCnB,EAAK,MAAA,CAAAC,UAAU,yFACZM,SAAAY,IAGJZ,GACCP,EAAA,MAAA,CAAKC,UAAU,yFAAwFM,SACpGA,OAIN0B,GACCC,EAAK,MAAA,CAAAjC,UAAU,4DACZM,SAAA,CAAAmB,EACAD,GACCzB,EACE,MAAA,CAAAC,UAAU,sCACVqC,QAASN,EACTO,UAAW,SAACC,GAAM,MAAU,UAAVA,EAAEC,KAAmBT,GAAa,EACpDU,KAAK,SACLC,SAAU,EAAC,aACA,KAAIpC,SAEdK,UAvCQ,IA8CvB"}
package/dist/Alert.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),l={success:e.jsx("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M10 1.66663C5.40002 1.66663 1.66669 5.39996 1.66669 9.99996C1.66669 14.6 5.40002 18.3333 10 18.3333C14.6 18.3333 18.3334 14.6 18.3334 9.99996C18.3334 5.39996 14.6 1.66663 10 1.66663ZM13.3584 8.49997L9.46668 12.3833C9.35001 12.5083 9.19168 12.5666 9.02501 12.5666C8.86668 12.5666 8.70834 12.5083 8.58334 12.3833L6.64169 10.4417C6.40002 10.2 6.40002 9.79994 6.64169 9.55827C6.88336 9.3166 7.28335 9.3166 7.52502 9.55827L9.02501 11.0583L12.475 7.61664C12.7167 7.36664 13.1167 7.36664 13.3584 7.61664C13.6 7.8583 13.6 8.24997 13.3584 8.49997Z",fill:"#00BC7D"})}),error:e.jsx("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M17.1342 6.3009L13.6999 2.86666C13.4658 2.63249 13.1474 2.50085 12.8157 2.50085H7.18504C6.85337 2.50085 6.53584 2.63249 6.30084 2.86666L2.8666 6.3009C2.63243 6.53507 2.50079 6.85343 2.50079 7.1851V12.8158C2.50079 13.1475 2.63243 13.465 2.8666 13.7L6.30084 17.1342C6.53501 17.3684 6.85337 17.5 7.18504 17.5H12.8157C13.1474 17.5 13.4649 17.3684 13.6999 17.1342L17.1342 13.7C17.3683 13.4658 17.5 13.1475 17.5 12.8158V7.1851C17.5 6.85343 17.3683 6.53507 17.1342 6.3009ZM12.525 11.6417C12.7692 11.8858 12.7692 12.2817 12.525 12.5259C12.4033 12.6475 12.2433 12.7092 12.0833 12.7092C11.9233 12.7092 11.7633 12.6484 11.6416 12.5259L9.99998 10.8842L8.35834 12.5259C8.23667 12.6475 8.07665 12.7092 7.91665 12.7092C7.75665 12.7092 7.59662 12.6484 7.47496 12.5259C7.23079 12.2817 7.23079 11.8858 7.47496 11.6417L9.1166 10L7.47496 8.3584C7.23079 8.11423 7.23079 7.71837 7.47496 7.4742C7.71912 7.23004 8.11498 7.23004 8.35915 7.4742L10.0008 9.11585L11.6424 7.4742C11.8866 7.23004 12.2825 7.23004 12.5266 7.4742C12.7708 7.71837 12.7708 8.11423 12.5266 8.3584L10.885 10L12.525 11.6417Z",fill:"#FB2C36"})}),warning:e.jsx("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M18.0057 14.2935L12.4999 3.99662C11.4333 2.00162 8.56744 2.00162 7.49995 3.99662L1.99417 14.2935C1.01583 16.1235 2.3442 18.3334 4.42337 18.3334H15.5765C17.6549 18.3334 18.9841 16.1226 18.0057 14.2935ZM9.37495 8.33337C9.37495 7.98837 9.65494 7.70837 9.99994 7.70837C10.3449 7.70837 10.6249 7.98837 10.6249 8.33337V11.6667C10.6249 12.0117 10.3449 12.2917 9.99994 12.2917C9.65494 12.2917 9.37495 12.0117 9.37495 11.6667V8.33337ZM10.0166 15C9.55663 15 9.17902 14.6267 9.17902 14.1667C9.17902 13.7067 9.54829 13.3334 10.0083 13.3334H10.0166C10.4775 13.3334 10.85 13.7067 10.85 14.1667C10.85 14.6267 10.4766 15 10.0166 15Z",fill:"#FE9A00"})}),info:e.jsx("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M14.6875 2.5H5.3125C3.4375 2.5 2.5 3.4375 2.5 5.3125V14.6875C2.5 16.5625 3.4375 17.5 5.3125 17.5H14.6875C16.5625 17.5 17.5 16.5625 17.5 14.6875V5.3125C17.5 3.4375 16.5625 2.5 14.6875 2.5ZM10.625 13.75C10.625 14.095 10.345 14.375 10 14.375C9.655 14.375 9.375 14.095 9.375 13.75V9.9408C9.375 9.5958 9.655 9.3158 10 9.3158C10.345 9.3158 10.625 9.5958 10.625 9.9408V13.75ZM10.0167 7.91667C9.55668 7.91667 9.17908 7.54333 9.17908 7.08333C9.17908 6.62333 9.54834 6.25 10.0083 6.25H10.0167C10.4775 6.25 10.85 6.62333 10.85 7.08333C10.85 7.54333 10.4767 7.91667 10.0167 7.91667Z",fill:"#2B7FFF"})})},i=e.jsx("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M15.4416 14.5583C15.6858 14.8025 15.6858 15.1984 15.4416 15.4425C15.32 15.5642 15.16 15.6258 15 15.6258C14.84 15.6258 14.68 15.565 14.5583 15.4425L9.99997 10.8842L5.44164 15.4425C5.31997 15.5642 5.15997 15.6258 4.99997 15.6258C4.83997 15.6258 4.67997 15.565 4.55831 15.4425C4.31414 15.1984 4.31414 14.8025 4.55831 14.5583L9.11664 10L4.55831 5.44171C4.31414 5.19754 4.31414 4.80168 4.55831 4.55751C4.80247 4.31335 5.19831 4.31335 5.44248 4.55751L10.0008 9.11587L14.5591 4.55751C14.8033 4.31335 15.1991 4.31335 15.4433 4.55751C15.6875 4.80168 15.6875 5.19754 15.4433 5.44171L10.885 10L15.4416 14.5583Z",fill:"#57534D"})});exports.default=function(n){var t=n.className,r=void 0===t?"":t,o=n.type,C=void 0===o?"info":o,a=n.title,c=n.description,d=n.icon,h=void 0===d?l[C]:d,x=n.showIcon,f=void 0===x||x,g=n.closeable,w=void 0!==g&&g,v=n.action,m=n.children,u=n.onClose,L=s.useState(!0),j=L[0],p=L[1];return j?e.jsxs("div",{className:"".concat("aha-alert px-4 py-3 rounded-md flex gap-2 relative"," ").concat(r),style:{success:{backgroundColor:"#ECFDF5"},error:{backgroundColor:"#FEF2F2"},warning:{backgroundColor:"#FFFBEB"},info:{backgroundColor:"#EFF6FF"}}[C],children:[f&&h,e.jsxs("div",{className:"flex flex-col gap-1",style:w?{paddingRight:"2rem"}:{},children:[a&&e.jsx("div",{className:"justify-start text-[#292524] text-base font-semibold font-['DM_Sans'] leading-normal",children:a}),c&&e.jsx("div",{className:"w-full justify-center text-[#57534D] text-sm font-normal font-['DM_Sans'] leading-snug",children:c}),m&&e.jsx("div",{className:"w-full justify-center text-[#57534D] text-sm font-normal font-['DM_Sans'] leading-snug",children:m}),v&&w&&e.jsx("div",{className:"mt-3",children:v})]}),v&&!w&&e.jsx("div",{className:"ml-3",children:v}),w&&e.jsx("div",{className:"absolute right-4 top-3 cursor-pointer",onClick:function(){p(!1),null==u||u()},children:i})]}):null};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),l={success:e.jsx("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M10 1.66663C5.40002 1.66663 1.66669 5.39996 1.66669 9.99996C1.66669 14.6 5.40002 18.3333 10 18.3333C14.6 18.3333 18.3334 14.6 18.3334 9.99996C18.3334 5.39996 14.6 1.66663 10 1.66663ZM13.3584 8.49997L9.46668 12.3833C9.35001 12.5083 9.19168 12.5666 9.02501 12.5666C8.86668 12.5666 8.70834 12.5083 8.58334 12.3833L6.64169 10.4417C6.40002 10.2 6.40002 9.79994 6.64169 9.55827C6.88336 9.3166 7.28335 9.3166 7.52502 9.55827L9.02501 11.0583L12.475 7.61664C12.7167 7.36664 13.1167 7.36664 13.3584 7.61664C13.6 7.8583 13.6 8.24997 13.3584 8.49997Z",fill:"#00BC7D"})}),error:e.jsx("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M17.1342 6.3009L13.6999 2.86666C13.4658 2.63249 13.1474 2.50085 12.8157 2.50085H7.18504C6.85337 2.50085 6.53584 2.63249 6.30084 2.86666L2.8666 6.3009C2.63243 6.53507 2.50079 6.85343 2.50079 7.1851V12.8158C2.50079 13.1475 2.63243 13.465 2.8666 13.7L6.30084 17.1342C6.53501 17.3684 6.85337 17.5 7.18504 17.5H12.8157C13.1474 17.5 13.4649 17.3684 13.6999 17.1342L17.1342 13.7C17.3683 13.4658 17.5 13.1475 17.5 12.8158V7.1851C17.5 6.85343 17.3683 6.53507 17.1342 6.3009ZM12.525 11.6417C12.7692 11.8858 12.7692 12.2817 12.525 12.5259C12.4033 12.6475 12.2433 12.7092 12.0833 12.7092C11.9233 12.7092 11.7633 12.6484 11.6416 12.5259L9.99998 10.8842L8.35834 12.5259C8.23667 12.6475 8.07665 12.7092 7.91665 12.7092C7.75665 12.7092 7.59662 12.6484 7.47496 12.5259C7.23079 12.2817 7.23079 11.8858 7.47496 11.6417L9.1166 10L7.47496 8.3584C7.23079 8.11423 7.23079 7.71837 7.47496 7.4742C7.71912 7.23004 8.11498 7.23004 8.35915 7.4742L10.0008 9.11585L11.6424 7.4742C11.8866 7.23004 12.2825 7.23004 12.5266 7.4742C12.7708 7.71837 12.7708 8.11423 12.5266 8.3584L10.885 10L12.525 11.6417Z",fill:"#FB2C36"})}),warning:e.jsx("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M18.0057 14.2935L12.4999 3.99662C11.4333 2.00162 8.56744 2.00162 7.49995 3.99662L1.99417 14.2935C1.01583 16.1235 2.3442 18.3334 4.42337 18.3334H15.5765C17.6549 18.3334 18.9841 16.1226 18.0057 14.2935ZM9.37495 8.33337C9.37495 7.98837 9.65494 7.70837 9.99994 7.70837C10.3449 7.70837 10.6249 7.98837 10.6249 8.33337V11.6667C10.6249 12.0117 10.3449 12.2917 9.99994 12.2917C9.65494 12.2917 9.37495 12.0117 9.37495 11.6667V8.33337ZM10.0166 15C9.55663 15 9.17902 14.6267 9.17902 14.1667C9.17902 13.7067 9.54829 13.3334 10.0083 13.3334H10.0166C10.4775 13.3334 10.85 13.7067 10.85 14.1667C10.85 14.6267 10.4766 15 10.0166 15Z",fill:"#FE9A00"})}),info:e.jsx("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M14.6875 2.5H5.3125C3.4375 2.5 2.5 3.4375 2.5 5.3125V14.6875C2.5 16.5625 3.4375 17.5 5.3125 17.5H14.6875C16.5625 17.5 17.5 16.5625 17.5 14.6875V5.3125C17.5 3.4375 16.5625 2.5 14.6875 2.5ZM10.625 13.75C10.625 14.095 10.345 14.375 10 14.375C9.655 14.375 9.375 14.095 9.375 13.75V9.9408C9.375 9.5958 9.655 9.3158 10 9.3158C10.345 9.3158 10.625 9.5958 10.625 9.9408V13.75ZM10.0167 7.91667C9.55668 7.91667 9.17908 7.54333 9.17908 7.08333C9.17908 6.62333 9.54834 6.25 10.0083 6.25H10.0167C10.4775 6.25 10.85 6.62333 10.85 7.08333C10.85 7.54333 10.4767 7.91667 10.0167 7.91667Z",fill:"#2B7FFF"})})},n=e.jsx("svg",{className:"flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M15.4416 14.5583C15.6858 14.8025 15.6858 15.1984 15.4416 15.4425C15.32 15.5642 15.16 15.6258 15 15.6258C14.84 15.6258 14.68 15.565 14.5583 15.4425L9.99997 10.8842L5.44164 15.4425C5.31997 15.5642 5.15997 15.6258 4.99997 15.6258C4.83997 15.6258 4.67997 15.565 4.55831 15.4425C4.31414 15.1984 4.31414 14.8025 4.55831 14.5583L9.11664 10L4.55831 5.44171C4.31414 5.19754 4.31414 4.80168 4.55831 4.55751C4.80247 4.31335 5.19831 4.31335 5.44248 4.55751L10.0008 9.11587L14.5591 4.55751C14.8033 4.31335 15.1991 4.31335 15.4433 4.55751C15.6875 4.80168 15.6875 5.19754 15.4433 5.44171L10.885 10L15.4416 14.5583Z",fill:"#57534D"})});exports.default=function(t){var i=t.className,o=void 0===i?"":i,r=t.type,a=void 0===r?"info":r,C=t.title,c=t.description,d=t.icon,x=void 0===d?l[a]:d,h=t.showIcon,f=void 0===h||h,w=t.closeable,g=void 0!==w&&w,u=t.action,v=t.children,m=t.onClose,L=s.useState(!0),p=L[0],j=L[1],F=function(){j(!1),null==m||m()},M=u||g;return p?e.jsxs("div",{className:"".concat("aha-alert px-4 py-3 rounded-md flex gap-2"," ").concat(o),style:{success:{backgroundColor:"#ECFDF5"},error:{backgroundColor:"#FEF2F2"},warning:{backgroundColor:"#FFFBEB"},info:{backgroundColor:"#EFF6FF"}}[a],children:[f&&x,e.jsxs("div",{className:"flex flex-col gap-1 ".concat(M?"flex-1 min-w-0":""),children:[C&&e.jsx("div",{className:"justify-start text-[#292524] text-base font-semibold font-['DM_Sans'] leading-normal",children:C}),c&&e.jsx("div",{className:"w-full justify-center text-[#57534D] text-sm font-normal font-['DM_Sans'] leading-snug",children:c}),v&&e.jsx("div",{className:"w-full justify-center text-[#57534D] text-sm font-normal font-['DM_Sans'] leading-snug",children:v})]}),M&&e.jsxs("div",{className:"ml-auto flex-shrink-0 self-center flex items-center gap-2",children:[u,g&&e.jsx("div",{className:"cursor-pointer relative top-[-12px]",onClick:F,onKeyDown:function(e){return"Enter"===e.key&&F()},role:"button",tabIndex:0,"aria-label":"关闭",children:n})]})]}):null};
2
2
  //# sourceMappingURL=Alert.js.map
package/dist/Alert.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.js","sources":["../src/components/Alert/icon.tsx","../src/components/Alert/index.tsx"],"sourcesContent":["export const AlertIcon = {\n success: (\n <svg\n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M10 1.66663C5.40002 1.66663 1.66669 5.39996 1.66669 9.99996C1.66669 14.6 5.40002 18.3333 10 18.3333C14.6 18.3333 18.3334 14.6 18.3334 9.99996C18.3334 5.39996 14.6 1.66663 10 1.66663ZM13.3584 8.49997L9.46668 12.3833C9.35001 12.5083 9.19168 12.5666 9.02501 12.5666C8.86668 12.5666 8.70834 12.5083 8.58334 12.3833L6.64169 10.4417C6.40002 10.2 6.40002 9.79994 6.64169 9.55827C6.88336 9.3166 7.28335 9.3166 7.52502 9.55827L9.02501 11.0583L12.475 7.61664C12.7167 7.36664 13.1167 7.36664 13.3584 7.61664C13.6 7.8583 13.6 8.24997 13.3584 8.49997Z\"\n fill=\"#00BC7D\"\n />\n </svg>\n ),\n error: (\n <svg\n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M17.1342 6.3009L13.6999 2.86666C13.4658 2.63249 13.1474 2.50085 12.8157 2.50085H7.18504C6.85337 2.50085 6.53584 2.63249 6.30084 2.86666L2.8666 6.3009C2.63243 6.53507 2.50079 6.85343 2.50079 7.1851V12.8158C2.50079 13.1475 2.63243 13.465 2.8666 13.7L6.30084 17.1342C6.53501 17.3684 6.85337 17.5 7.18504 17.5H12.8157C13.1474 17.5 13.4649 17.3684 13.6999 17.1342L17.1342 13.7C17.3683 13.4658 17.5 13.1475 17.5 12.8158V7.1851C17.5 6.85343 17.3683 6.53507 17.1342 6.3009ZM12.525 11.6417C12.7692 11.8858 12.7692 12.2817 12.525 12.5259C12.4033 12.6475 12.2433 12.7092 12.0833 12.7092C11.9233 12.7092 11.7633 12.6484 11.6416 12.5259L9.99998 10.8842L8.35834 12.5259C8.23667 12.6475 8.07665 12.7092 7.91665 12.7092C7.75665 12.7092 7.59662 12.6484 7.47496 12.5259C7.23079 12.2817 7.23079 11.8858 7.47496 11.6417L9.1166 10L7.47496 8.3584C7.23079 8.11423 7.23079 7.71837 7.47496 7.4742C7.71912 7.23004 8.11498 7.23004 8.35915 7.4742L10.0008 9.11585L11.6424 7.4742C11.8866 7.23004 12.2825 7.23004 12.5266 7.4742C12.7708 7.71837 12.7708 8.11423 12.5266 8.3584L10.885 10L12.525 11.6417Z\"\n fill=\"#FB2C36\"\n />\n </svg>\n ),\n warning: (\n <svg \n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M18.0057 14.2935L12.4999 3.99662C11.4333 2.00162 8.56744 2.00162 7.49995 3.99662L1.99417 14.2935C1.01583 16.1235 2.3442 18.3334 4.42337 18.3334H15.5765C17.6549 18.3334 18.9841 16.1226 18.0057 14.2935ZM9.37495 8.33337C9.37495 7.98837 9.65494 7.70837 9.99994 7.70837C10.3449 7.70837 10.6249 7.98837 10.6249 8.33337V11.6667C10.6249 12.0117 10.3449 12.2917 9.99994 12.2917C9.65494 12.2917 9.37495 12.0117 9.37495 11.6667V8.33337ZM10.0166 15C9.55663 15 9.17902 14.6267 9.17902 14.1667C9.17902 13.7067 9.54829 13.3334 10.0083 13.3334H10.0166C10.4775 13.3334 10.85 13.7067 10.85 14.1667C10.85 14.6267 10.4766 15 10.0166 15Z\"\n fill=\"#FE9A00\"\n />\n </svg>\n ),\n info: (\n <svg\n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M14.6875 2.5H5.3125C3.4375 2.5 2.5 3.4375 2.5 5.3125V14.6875C2.5 16.5625 3.4375 17.5 5.3125 17.5H14.6875C16.5625 17.5 17.5 16.5625 17.5 14.6875V5.3125C17.5 3.4375 16.5625 2.5 14.6875 2.5ZM10.625 13.75C10.625 14.095 10.345 14.375 10 14.375C9.655 14.375 9.375 14.095 9.375 13.75V9.9408C9.375 9.5958 9.655 9.3158 10 9.3158C10.345 9.3158 10.625 9.5958 10.625 9.9408V13.75ZM10.0167 7.91667C9.55668 7.91667 9.17908 7.54333 9.17908 7.08333C9.17908 6.62333 9.54834 6.25 10.0083 6.25H10.0167C10.4775 6.25 10.85 6.62333 10.85 7.08333C10.85 7.54333 10.4767 7.91667 10.0167 7.91667Z\"\n fill=\"#2B7FFF\"\n />\n </svg>\n ),\n};\n\nexport const CloseIcon = (\n <svg\n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M15.4416 14.5583C15.6858 14.8025 15.6858 15.1984 15.4416 15.4425C15.32 15.5642 15.16 15.6258 15 15.6258C14.84 15.6258 14.68 15.565 14.5583 15.4425L9.99997 10.8842L5.44164 15.4425C5.31997 15.5642 5.15997 15.6258 4.99997 15.6258C4.83997 15.6258 4.67997 15.565 4.55831 15.4425C4.31414 15.1984 4.31414 14.8025 4.55831 14.5583L9.11664 10L4.55831 5.44171C4.31414 5.19754 4.31414 4.80168 4.55831 4.55751C4.80247 4.31335 5.19831 4.31335 5.44248 4.55751L10.0008 9.11587L14.5591 4.55751C14.8033 4.31335 15.1991 4.31335 15.4433 4.55751C15.6875 4.80168 15.6875 5.19754 15.4433 5.44171L10.885 10L15.4416 14.5583Z\"\n fill=\"#57534D\"\n />\n </svg>\n);\n","import React, { useState } from \"react\";\nimport { AlertIcon, CloseIcon } from \"./icon\";\n\nexport interface AlertProps {\n title?: string;\n description?: string;\n className?: string;\n type?: \"success\" | \"error\" | \"warning\" | \"info\";\n icon?: React.ReactNode;\n showIcon?: boolean;\n closeable?: boolean;\n action?: React.ReactNode;\n children?: React.ReactNode;\n /** 关闭回调 */\n onClose?: () => void;\n}\n\nconst Alert: React.FC<AlertProps> = ({\n className = \"\",\n type = \"info\",\n title,\n description,\n icon = AlertIcon[type],\n showIcon = true,\n closeable = false,\n action,\n children,\n onClose\n}) => {\n const baseClasses = \"aha-alert px-4 py-3 rounded-md flex gap-2 relative\";\n\n // 使用内联样式作为备选方案,确保样式始终生效\n const typeStyles = {\n success: { backgroundColor: '#ECFDF5' },\n error: { backgroundColor: '#FEF2F2' },\n warning: { backgroundColor: '#FFFBEB' },\n info: { backgroundColor: '#EFF6FF' },\n };\n\n const [visible, setVisible] = useState(true);\n const handleClose = () => {\n setVisible(false);\n onClose?.();\n };\n\n if (!visible) return null;\n\n return (\n <div \n className={`${baseClasses} ${className}`}\n style={typeStyles[type]}\n >\n {showIcon && icon}\n <div \n className=\"flex flex-col gap-1\"\n style={closeable ? { paddingRight: '2rem' } : {}}\n >\n {title && (\n <div className=\"justify-start text-[#292524] text-base font-semibold font-['DM_Sans'] leading-normal\">\n {title}\n </div>\n )}\n {description && (\n <div className=\"w-full justify-center text-[#57534D] text-sm font-normal font-['DM_Sans'] leading-snug\">\n {description}\n </div>\n )}\n {children && (\n <div className=\"w-full justify-center text-[#57534D] text-sm font-normal font-['DM_Sans'] leading-snug\">\n {children}\n </div>\n )}\n {action && closeable && <div className=\"mt-3\">{action}</div>}\n </div>\n {action && !closeable && <div className=\"ml-3\">{action}</div>}\n {closeable && (\n <div\n className=\"absolute right-4 top-3 cursor-pointer\"\n onClick={handleClose}\n >\n {CloseIcon}\n </div>\n )}\n </div>\n );\n};\n\nexport default Alert;\n"],"names":["AlertIcon","success","_jsx","jsx","className","width","height","viewBox","fill","xmlns","children","d","error","warning","info","CloseIcon","_a","_b","_c","type","title","description","_d","icon","_e","showIcon","_f","closeable","action","onClose","_g","useState","visible","setVisible","_jsxs","jsxs","concat","style","backgroundColor","paddingRight","onClick"],"mappings":"0HAAaA,EAAY,CACvBC,QACEC,EAAAC,IAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAR,EAAAC,IAAA,OAAA,CACEQ,EAAE,6hBACFH,KAAK,cAIXI,MACEV,EAAAC,IAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAR,EAAAC,IAAA,OAAA,CACEQ,EAAE,gjCACFH,KAAK,cAIXK,QACEX,EAAAC,IAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAR,EAAAC,IAAA,OAAA,CACEQ,EAAE,2mBACFH,KAAK,cAIXM,KACEZ,EAAAC,IAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAR,EAAAC,IAAA,OAAA,CACEQ,EAAE,6jBACFH,KAAK,eAMAO,EACXb,EAAAC,IAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAR,EAAAC,IAAA,OAAA,CACEQ,EAAE,0lBACFH,KAAK,8BCzDyB,SAACQ,OACnCC,EAAcD,EAAAZ,UAAdA,OAAY,IAAAa,EAAA,KACZC,EAAAF,EAAAG,KAAAA,OAAO,IAAAD,EAAA,SACPE,EAAKJ,EAAAI,MACLC,EAAWL,EAAAK,YACXC,EAAsBN,EAAAO,KAAtBA,OAAI,IAAAD,EAAGtB,EAAUmB,GAAKG,EACtBE,EAAeR,EAAAS,SAAfA,OAAW,IAAAD,GAAIA,EACfE,EAAiBV,EAAAW,UAAjBA,OAAY,IAAAD,GAAKA,EACjBE,EAAMZ,EAAAY,OACNlB,EAAQM,EAAAN,SACRmB,EAAOb,EAAAa,QAYDC,EAAwBC,EAAAA,UAAS,GAAhCC,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GAM1B,OAAKE,EAGHE,EACEC,KAAA,MAAA,CAAA/B,UAAW,GAAAgC,OApBK,qDAoBS,KAAAA,OAAIhC,GAC7BiC,MAlBe,CACjBpC,QAAS,CAAEqC,gBAAiB,WAC5B1B,MAAO,CAAE0B,gBAAiB,WAC1BzB,QAAS,CAAEyB,gBAAiB,WAC5BxB,KAAM,CAAEwB,gBAAiB,YAcLnB,GAAKT,SAAA,CAEtBe,GAAYF,EACbW,EACEC,KAAA,MAAA,CAAA/B,UAAU,sBACViC,MAAOV,EAAY,CAAEY,aAAc,QAAW,GAAE7B,SAAA,CAE/CU,GACClB,EAAAC,IAAA,MAAA,CAAKC,UAAU,uFAAsFM,SAClGU,IAGJC,GACCnB,EAAAA,IAAA,MAAA,CAAKE,UAAU,yFACZM,SAAAW,IAGJX,GACCR,MAAK,MAAA,CAAAE,UAAU,yFACZM,SAAAA,IAGJkB,GAAUD,GAAazB,MAAA,MAAA,CAAKE,UAAU,OAAMM,SAAEkB,OAEhDA,IAAWD,GAAazB,MAAA,MAAA,CAAKE,UAAU,OAAMM,SAAEkB,IAC/CD,GACCzB,EAAAA,IACE,MAAA,CAAAE,UAAU,wCACVoC,QAtCY,WAClBP,GAAW,GACXJ,SAAAA,GACF,EAqCSnB,SAAAK,OAnCY,IAwCvB"}
1
+ {"version":3,"file":"Alert.js","sources":["../src/components/Alert/icon.tsx","../src/components/Alert/index.tsx"],"sourcesContent":["export const AlertIcon = {\n success: (\n <svg\n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M10 1.66663C5.40002 1.66663 1.66669 5.39996 1.66669 9.99996C1.66669 14.6 5.40002 18.3333 10 18.3333C14.6 18.3333 18.3334 14.6 18.3334 9.99996C18.3334 5.39996 14.6 1.66663 10 1.66663ZM13.3584 8.49997L9.46668 12.3833C9.35001 12.5083 9.19168 12.5666 9.02501 12.5666C8.86668 12.5666 8.70834 12.5083 8.58334 12.3833L6.64169 10.4417C6.40002 10.2 6.40002 9.79994 6.64169 9.55827C6.88336 9.3166 7.28335 9.3166 7.52502 9.55827L9.02501 11.0583L12.475 7.61664C12.7167 7.36664 13.1167 7.36664 13.3584 7.61664C13.6 7.8583 13.6 8.24997 13.3584 8.49997Z\"\n fill=\"#00BC7D\"\n />\n </svg>\n ),\n error: (\n <svg\n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M17.1342 6.3009L13.6999 2.86666C13.4658 2.63249 13.1474 2.50085 12.8157 2.50085H7.18504C6.85337 2.50085 6.53584 2.63249 6.30084 2.86666L2.8666 6.3009C2.63243 6.53507 2.50079 6.85343 2.50079 7.1851V12.8158C2.50079 13.1475 2.63243 13.465 2.8666 13.7L6.30084 17.1342C6.53501 17.3684 6.85337 17.5 7.18504 17.5H12.8157C13.1474 17.5 13.4649 17.3684 13.6999 17.1342L17.1342 13.7C17.3683 13.4658 17.5 13.1475 17.5 12.8158V7.1851C17.5 6.85343 17.3683 6.53507 17.1342 6.3009ZM12.525 11.6417C12.7692 11.8858 12.7692 12.2817 12.525 12.5259C12.4033 12.6475 12.2433 12.7092 12.0833 12.7092C11.9233 12.7092 11.7633 12.6484 11.6416 12.5259L9.99998 10.8842L8.35834 12.5259C8.23667 12.6475 8.07665 12.7092 7.91665 12.7092C7.75665 12.7092 7.59662 12.6484 7.47496 12.5259C7.23079 12.2817 7.23079 11.8858 7.47496 11.6417L9.1166 10L7.47496 8.3584C7.23079 8.11423 7.23079 7.71837 7.47496 7.4742C7.71912 7.23004 8.11498 7.23004 8.35915 7.4742L10.0008 9.11585L11.6424 7.4742C11.8866 7.23004 12.2825 7.23004 12.5266 7.4742C12.7708 7.71837 12.7708 8.11423 12.5266 8.3584L10.885 10L12.525 11.6417Z\"\n fill=\"#FB2C36\"\n />\n </svg>\n ),\n warning: (\n <svg \n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M18.0057 14.2935L12.4999 3.99662C11.4333 2.00162 8.56744 2.00162 7.49995 3.99662L1.99417 14.2935C1.01583 16.1235 2.3442 18.3334 4.42337 18.3334H15.5765C17.6549 18.3334 18.9841 16.1226 18.0057 14.2935ZM9.37495 8.33337C9.37495 7.98837 9.65494 7.70837 9.99994 7.70837C10.3449 7.70837 10.6249 7.98837 10.6249 8.33337V11.6667C10.6249 12.0117 10.3449 12.2917 9.99994 12.2917C9.65494 12.2917 9.37495 12.0117 9.37495 11.6667V8.33337ZM10.0166 15C9.55663 15 9.17902 14.6267 9.17902 14.1667C9.17902 13.7067 9.54829 13.3334 10.0083 13.3334H10.0166C10.4775 13.3334 10.85 13.7067 10.85 14.1667C10.85 14.6267 10.4766 15 10.0166 15Z\"\n fill=\"#FE9A00\"\n />\n </svg>\n ),\n info: (\n <svg\n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M14.6875 2.5H5.3125C3.4375 2.5 2.5 3.4375 2.5 5.3125V14.6875C2.5 16.5625 3.4375 17.5 5.3125 17.5H14.6875C16.5625 17.5 17.5 16.5625 17.5 14.6875V5.3125C17.5 3.4375 16.5625 2.5 14.6875 2.5ZM10.625 13.75C10.625 14.095 10.345 14.375 10 14.375C9.655 14.375 9.375 14.095 9.375 13.75V9.9408C9.375 9.5958 9.655 9.3158 10 9.3158C10.345 9.3158 10.625 9.5958 10.625 9.9408V13.75ZM10.0167 7.91667C9.55668 7.91667 9.17908 7.54333 9.17908 7.08333C9.17908 6.62333 9.54834 6.25 10.0083 6.25H10.0167C10.4775 6.25 10.85 6.62333 10.85 7.08333C10.85 7.54333 10.4767 7.91667 10.0167 7.91667Z\"\n fill=\"#2B7FFF\"\n />\n </svg>\n ),\n};\n\nexport const CloseIcon = (\n <svg\n className=\"flex-shrink-0\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M15.4416 14.5583C15.6858 14.8025 15.6858 15.1984 15.4416 15.4425C15.32 15.5642 15.16 15.6258 15 15.6258C14.84 15.6258 14.68 15.565 14.5583 15.4425L9.99997 10.8842L5.44164 15.4425C5.31997 15.5642 5.15997 15.6258 4.99997 15.6258C4.83997 15.6258 4.67997 15.565 4.55831 15.4425C4.31414 15.1984 4.31414 14.8025 4.55831 14.5583L9.11664 10L4.55831 5.44171C4.31414 5.19754 4.31414 4.80168 4.55831 4.55751C4.80247 4.31335 5.19831 4.31335 5.44248 4.55751L10.0008 9.11587L14.5591 4.55751C14.8033 4.31335 15.1991 4.31335 15.4433 4.55751C15.6875 4.80168 15.6875 5.19754 15.4433 5.44171L10.885 10L15.4416 14.5583Z\"\n fill=\"#57534D\"\n />\n </svg>\n);\n","import React, { useState } from \"react\";\nimport { AlertIcon, CloseIcon } from \"./icon\";\n\nexport interface AlertProps {\n title?: string;\n description?: string;\n className?: string;\n type?: \"success\" | \"error\" | \"warning\" | \"info\";\n icon?: React.ReactNode;\n showIcon?: boolean;\n closeable?: boolean;\n action?: React.ReactNode;\n children?: React.ReactNode;\n /** 关闭回调 */\n onClose?: () => void;\n}\n\nconst Alert: React.FC<AlertProps> = ({\n className = \"\",\n type = \"info\",\n title,\n description,\n icon = AlertIcon[type],\n showIcon = true,\n closeable = false,\n action,\n children,\n onClose\n}) => {\n const baseClasses = \"aha-alert px-4 py-3 rounded-md flex gap-2\";\n\n // 使用内联样式作为备选方案,确保样式始终生效\n const typeStyles = {\n success: { backgroundColor: '#ECFDF5' },\n error: { backgroundColor: '#FEF2F2' },\n warning: { backgroundColor: '#FFFBEB' },\n info: { backgroundColor: '#EFF6FF' },\n };\n\n const [visible, setVisible] = useState(true);\n const handleClose = () => {\n setVisible(false);\n onClose?.();\n };\n\n const hasRightSlot = action || closeable;\n\n if (!visible) return null;\n\n return (\n <div \n className={`${baseClasses} ${className}`}\n style={typeStyles[type]}\n >\n {showIcon && icon}\n <div\n className={`flex flex-col gap-1 ${hasRightSlot ? \"flex-1 min-w-0\" : \"\"}`}\n >\n {title && (\n <div className=\"justify-start text-[#292524] text-base font-semibold font-['DM_Sans'] leading-normal\">\n {title}\n </div>\n )}\n {description && (\n <div className=\"w-full justify-center text-[#57534D] text-sm font-normal font-['DM_Sans'] leading-snug\">\n {description}\n </div>\n )}\n {children && (\n <div className=\"w-full justify-center text-[#57534D] text-sm font-normal font-['DM_Sans'] leading-snug\">\n {children}\n </div>\n )}\n </div>\n {hasRightSlot && (\n <div className=\"ml-auto flex-shrink-0 self-center flex items-center gap-2\">\n {action}\n {closeable && (\n <div\n className=\"cursor-pointer relative top-[-12px]\"\n onClick={handleClose}\n onKeyDown={(e) => e.key === \"Enter\" && handleClose()}\n role=\"button\"\n tabIndex={0}\n aria-label=\"关闭\"\n >\n {CloseIcon}\n </div>\n )}\n </div>\n )}\n </div>\n );\n};\n\nexport default Alert;\n"],"names":["AlertIcon","success","_jsx","jsx","className","width","height","viewBox","fill","xmlns","children","d","error","warning","info","CloseIcon","_a","_b","_c","type","title","description","_d","icon","_e","showIcon","_f","closeable","action","onClose","_g","useState","visible","setVisible","handleClose","hasRightSlot","_jsxs","concat","style","backgroundColor","jsxs","onClick","onKeyDown","e","key","role","tabIndex"],"mappings":"0HAAaA,EAAY,CACvBC,QACEC,EAAAC,IAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAR,EAAAC,IAAA,OAAA,CACEQ,EAAE,6hBACFH,KAAK,cAIXI,MACEV,EAAAC,IAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAR,EAAAC,IAAA,OAAA,CACEQ,EAAE,gjCACFH,KAAK,cAIXK,QACEX,EAAAC,IAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAR,EAAAC,IAAA,OAAA,CACEQ,EAAE,2mBACFH,KAAK,cAIXM,KACEZ,EAAAC,IAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAR,EAAAC,IAAA,OAAA,CACEQ,EAAE,6jBACFH,KAAK,eAMAO,EACXb,EAAAC,IAAA,MAAA,CACEC,UAAU,gBACVC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENC,SAAAR,EAAAC,IAAA,OAAA,CACEQ,EAAE,0lBACFH,KAAK,8BCzDyB,SAACQ,OACnCC,EAAcD,EAAAZ,UAAdA,OAAY,IAAAa,EAAA,KACZC,EAAAF,EAAAG,KAAAA,OAAO,IAAAD,EAAA,SACPE,EAAKJ,EAAAI,MACLC,EAAWL,EAAAK,YACXC,EAAsBN,EAAAO,KAAtBA,OAAI,IAAAD,EAAGtB,EAAUmB,GAAKG,EACtBE,EAAeR,EAAAS,SAAfA,OAAW,IAAAD,GAAIA,EACfE,EAAiBV,EAAAW,UAAjBA,OAAY,IAAAD,GAAKA,EACjBE,EAAMZ,EAAAY,OACNlB,EAAQM,EAAAN,SACRmB,EAAOb,EAAAa,QAYDC,EAAwBC,EAAAA,UAAS,GAAhCC,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GACpBI,EAAc,WAClBD,GAAW,GACXJ,SAAAA,GACF,EAEMM,EAAeP,GAAUD,EAE/B,OAAKK,EAGHI,OAAA,MAAA,CACEhC,UAAW,GAAGiC,OAtBE,4CAsBa,KAAAA,OAAAjC,GAC7BkC,MApBe,CACjBrC,QAAS,CAAEsC,gBAAiB,WAC5B3B,MAAO,CAAE2B,gBAAiB,WAC1B1B,QAAS,CAAE0B,gBAAiB,WAC5BzB,KAAM,CAAEyB,gBAAiB,YAgBLpB,GAEjBT,SAAA,CAAAe,GAAYF,EACba,EAAAA,KAAA,MAAA,CACEhC,UAAW,uBAAuBiC,OAAAF,EAAe,iBAAmB,IAEnEzB,SAAA,CAAAU,GACClB,EAAKC,IAAA,MAAA,CAAAC,UAAU,uFACZM,SAAAU,IAGJC,GACCnB,EAAKC,IAAA,MAAA,CAAAC,UAAU,yFACZM,SAAAW,IAGJX,GACCR,EAAAC,IAAA,MAAA,CAAKC,UAAU,yFAAwFM,SACpGA,OAINyB,GACCC,EAAKI,KAAA,MAAA,CAAApC,UAAU,4DACZM,SAAA,CAAAkB,EACAD,GACCzB,EAAAA,IACE,MAAA,CAAAE,UAAU,sCACVqC,QAASP,EACTQ,UAAW,SAACC,GAAM,MAAU,UAAVA,EAAEC,KAAmBV,GAAa,EACpDW,KAAK,SACLC,SAAU,EAAC,aACA,KAAIpC,SAEdK,UAvCQ,IA8CvB"}
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as n,Fragment as i}from"react/jsx-runtime";import{createContext as o,useContext as t,useState as r,useMemo as l,useEffect as a}from"react";var d=function(){return d=Object.assign||function(e){for(var n,i=1,o=arguments.length;i<o;i++)for(var t in n=arguments[i])Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e},d.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var s={primaryColor:"#FB6011"},p=o(s),u=function(){var e=t(p);return e||s},c={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"}},x=function(o){var t=o.size,r=o.color;return e(i,{children:[n("style",{children:"\n @keyframes aha-button-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "}),e("svg",{width:t,height:t,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"})]})]})},h=function(i){var o,t=i.children,l=i.type,a=void 0===l?"default":l,s=i.size,p=void 0===s?"medium":s,h=i.disabled,f=void 0!==h&&h,g=i.loading,m=void 0!==g&&g,b=i.onClick,y=i.htmlType,v=void 0===y?"button":y,F=i.className,C=void 0===F?"":F,S=i.style,w=i.icon,k=i.iconPosition,E=void 0===k?"left":k,z=function(e,n){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(o=Object.getOwnPropertySymbols(e);t<o.length;t++)n.indexOf(o[t])<0&&Object.prototype.propertyIsEnumerable.call(e,o[t])&&(i[o[t]]=e[o[t]])}return i}(i,["children","type","size","disabled","loading","onClick","htmlType","className","style","icon","iconPosition"]),A=u().primaryColor,j=void 0===A?"#FB6011":A,M=r(!1),D=M[0],R=M[1],L=r(!1),H=L[0],O=L[1],N=c[p],B=f||m,W=function(){if(m){var e="primary"===a?"#FFFFFF":"#101828",i=parseInt(N.iconSize.replace("px",""));return n(x,{size:i,color:e})}return w?n("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:N.iconSize,height:N.iconSize,flexShrink:0},children:w}):null},I=(o=d({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:N.gap,height:N.height,paddingLeft:N.paddingLeft,paddingRight:N.paddingRight,fontSize:N.fontSize,lineHeight:N.lineHeight,fontWeight:500,fontFamily:"DM Sans, sans-serif",borderRadius:"8px",border:"none",cursor:B?"not-allowed":"pointer",outline:"none",transition:"all 0.2s",userSelect:"none",WebkitTapHighlightColor:"transparent"},S),"primary"===a?(o.color="#FFFFFF",o.backgroundColor=j,f?(o.opacity=.4,o.cursor="not-allowed"):m?o.backgroundColor=j:H?o.backgroundColor="#EC470A":D&&(o.backgroundColor="#FD843A")):f?(o.backgroundColor="#FAFAF9",o.color="#D6D3D1",o.border="1px solid #E7E5E4"):m?(o.backgroundColor="#FFFFFF",o.color="#101828",o.border="1px solid #E7E5E4",o.boxShadow="0px 1px 2px 0px rgba(12, 10, 9, 0.05)"):H?(o.backgroundColor="#F5F5F4",o.color="#101828",o.border="1px solid #D7D3D0",o.boxShadow="0px 1px 2px 0px rgba(12, 10, 9, 0.05)"):D?(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",d({type:v,className:"aha-button aha-button--".concat(a," aha-button--").concat(p," ").concat(B?"aha-button--disabled":""," ").concat(m?"aha-button--loading":""," ").concat(C),disabled:B,onClick:function(e){B?e.preventDefault():null==b||b(e)},onMouseEnter:function(){return!B&&R(!0)},onMouseLeave:function(){R(!1),O(!1)},onMouseDown:function(){return!B&&O(!0)},onMouseUp:function(){return O(!1)},style:I},z,{children:[m&&W(),!m&&"left"===E&&W(),t&&n("span",{style:{display:"inline-block"},children:t}),!m&&"right"===E&&W()]}))};h.displayName="Button";var f=function(e){var i=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:i,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"})})},g=function(e){var i=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:i,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"})})},m=function(o){var t=o.current,s=o.defaultCurrent,p=void 0===s?1:s,c=o.total,x=void 0===c?0:c,m=o.pageSize,b=o.defaultPageSize,y=void 0===b?10:b,v=o.showSizeChanger,F=void 0!==v&&v,C=o.pageSizeOptions,S=void 0===C?["10","20","50","100"]:C,w=o.showQuickJumper,k=void 0!==w&&w,E=o.showTotal,z=o.onChange,A=o.onShowSizeChange,j=o.simple,M=void 0!==j&&j,D=o.disabled,R=void 0!==D&&D,L=o.hideOnSinglePage,H=void 0!==L&&L,O=o.className,N=void 0===O?"":O,B=o.style,W=o.size,I=void 0===W?"default":W,P=o.responsive,T=void 0!==P&&P;o.showLessItems;var J=o.itemRender,K=u().primaryColor,Q=void 0===K?"#FB6011":K,U=r(p),_=U[0],q=U[1],G=r(y),V=G[0],X=G[1],Y=r(""),Z=Y[0],$=Y[1],ee=null!=t?t:_,ne=null!=m?m:V,ie=l(function(){return Math.ceil(x/ne)},[x,ne]);a(function(){void 0!==t&&q(t)},[t]),a(function(){void 0!==m&&X(m)},[m]);var oe=function(e){e<1||e>ie||e===ee||R||(void 0===t&&q(e),null==z||z(e,ne))},te=function(){var e=parseInt(Z,10);e>=1&&e<=ie&&(oe(e),$(""))};if(H&&ie<=1)return null;if(M)return e("div",{className:"aha-pagination aha-pagination-simple ".concat(N),style:B,children:[n(h,{onClick:function(){return oe(ee-1)},disabled:R||1===ee,type:"default",size:"default"===I?"medium":"small",style:{marginRight:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(f,{})}),e("span",{style:{margin:"0 8px",fontSize:"14px",lineHeight:"20px",color:"#475467",fontFamily:"DM Sans, sans-serif"},children:[ee," / ",ie]}),n(h,{onClick:function(){return oe(ee+1)},disabled:R||ee===ie,type:"default",size:"default"===I?"medium":"small",style:{marginLeft:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(g,{})})]});var re=(ee-1)*ne+1,le=Math.min(ee*ne,x);return e("div",{className:"aha-pagination w-full ".concat(N),style:d({display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:T?"wrap":"nowrap",fontFamily:"DM Sans, sans-serif"},B),children:[E&&n("div",{className:"justify-start text-Text-text-secondary text-sm font-medium font-['DM_Sans'] leading-5",children:E(x,[re,le])}),e("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[x>0&&n(i,{children:J?J(ee-1,"prev",n(h,{onClick:function(){return oe(ee-1)},disabled:R||1===ee,type:"default",size:"default"===I?"medium":"small",style:{height:"small"===I?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(f,{})})):n(h,{onClick:function(){return oe(ee-1)},disabled:R||1===ee,type:"default",size:"default"===I?"medium":"small",style:{height:"small"===I?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(f,{})})}),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(ee<=4){for(var n=1;n<=5;n++)e.push(n);e.push("jump-next"),e.push(ie)}else if(ee>=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=ee-1;n<=ee+1;n++)e.push(n);e.push("jump-next"),e.push(ie)}return e}().map(function(e,i){return function(e){if("number"==typeof e){var i=e===ee,o=n(h,{onClick:function(){return oe(e)},disabled:R,type:"default",size:"default"===I?"medium":"small",style:{minWidth:"small"===I?"32px":"36px",height:"small"===I?"32px":"36px",padding:"0 12px",margin:0,fontWeight:i?500:400,border:"none",background:i?"#FAFAF9":"white",backgroundColor:i?"#FAFAF9":"white",color:i?Q:"#79716B",boxShadow:"none",borderRadius:"8px"},children:e},e);return J?J(e,"page",o):o}if("jump-prev"===e)return o=n(h,{onClick:function(){return oe(Math.max(1,ee-5))},disabled:R,type:"default",size:"default"===I?"medium":"small",style:{minWidth:"small"===I?"32px":"36px",height:"small"===I?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-prev"),J?J(ee-5,"jump-prev",o):o;if("jump-next"===e)return o=n(h,{onClick:function(){return oe(Math.min(ie,ee+5))},disabled:R,type:"default",size:"default"===I?"medium":"small",style:{minWidth:"small"===I?"32px":"36px",height:"small"===I?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-next"),J?J(ee+5,"jump-next",o):o;return null}(e)})}),x>0&&n(i,{children:J?J(ee+1,"next",n(h,{onClick:function(){return oe(ee+1)},disabled:R||ee===ie,type:"default",size:"default"===I?"medium":"small",style:{height:"small"===I?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(g,{})})):n(h,{onClick:function(){return oe(ee+1)},disabled:R||ee===ie,type:"default",size:"default"===I?"medium":"small",style:{height:"small"===I?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(g,{})})}),F&&n("select",{value:ne,onChange:function(e){return n=Number(e.target.value),i=Math.ceil(x/n),o=ee>i?i:ee,void 0===m&&X(n),void 0===t&&q(o),null==A||A(o,n),void(null==z||z(o,n));var n,i,o},disabled:R,style:{padding:"small"===I?"6px 12px":"8px 12px",border:"1px solid #EAECF0",borderRadius:"8px",fontSize:"small"===I?"12px":"14px",lineHeight:"small"===I?"18px":"20px",color:"#101828",fontFamily:"DM Sans, sans-serif",cursor:R?"not-allowed":"pointer",backgroundColor:"white",outline:"none",transition:"all 0.2s"},onMouseEnter:function(e){R||(e.currentTarget.style.borderColor=Q)},onMouseLeave:function(e){e.currentTarget.style.borderColor="#EAECF0"},children:S.map(function(n){return e("option",{value:n,children:[n," 条/页"]},n)})}),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:"跳至"}),n("input",{type:"number",min:"1",value:Z,onChange:function(e){return $(e.target.value)},onKeyPress:function(e){return"Enter"===e.key&&te()},disabled:R,style:{width:"56px",height:"small"===I?"28px":"36px",padding:"0 8px",border:"1px solid #EAECF0",borderRadius:"8px",fontSize:"14px",lineHeight:"20px",color:"#101828",fontFamily:"DM Sans, sans-serif",outline:"none",transition:"all 0.2s"},onFocus:function(e){e.currentTarget.style.borderColor=Q},onBlur:function(e){e.currentTarget.style.borderColor="#EAECF0"}}),n("span",{style:{fontSize:"14px",lineHeight:"20px",color:"#475467"},children:"页"}),"object"==typeof k&&k.goButton?n(h,{onClick:te,disabled:R,type:"default",size:"default"===I?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:k.goButton}):n(h,{onClick:te,disabled:R,type:"default",size:"default"===I?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"确定"})]})]})]})};export{m as default};
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,k=void 0===F?"":F,C=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],j=l(!1),H=j[0],R=j[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"},C),"primary"===a?(o.color="#FFFFFF",o.backgroundColor=L,u?(o.opacity=.4,o.cursor="not-allowed"):x?o.backgroundColor=L:H?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)"):H?(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(k),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,k=i.onClear,C=i.className,S=void 0===C?"":C,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,j=i.onBlur,H=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],V=T[1],Y=o.useState(!1),K=Y[0],U=Y[1];p(function(){"function"==typeof r?r(O.current):r&&(r.current=O.current)},[r]);var q=void 0!==L,G=q?L:P,J=function(e){var n;e.stopPropagation(),q||V("");null==M||M({target:{value:""},currentTarget:{value:""}}),null==k||k(),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){q||V(e.target.value),null==M||M(e)},onFocus:function(e){U(!0),null==W||W(e)},onBlur:function(e){U(!1),null==j||j(e)},onKeyDown:function(e){var n;"Enter"===e.key&&H&&H(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 k=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,k=void 0!==F&&F,C=i.placeholder,S=void 0===C?"Please select":C,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,j=i.onChange,H=i.onSelect,R=i.onDeselect,I=i.onSearch,N=i.onFocus,O=i.onBlur,T=i.onDropdownVisibleChange,P=i.className,V=void 0===P?"":P,Y=i.style,K=i.dropdownClassName,U=void 0===K?"":K,q=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,ke="multiple"===y||"tags"===y,Ce=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(){if(he.current){var e=he.current.getBoundingClientRect();ve({top:e.bottom+window.scrollY+4,left:e.left+window.scrollX,width:e.width})}};return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),function(){window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}}ve(null)},[Fe]),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(ke){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==H||H(e.value,e)),ye||oe(t);var i=m.filter(function(e){return t.includes(e.value)});null==j||j(t,i)}else ye||oe(e.value),null==j||j(e.value,e),null==H||H(e.value,e),be||le(!1),null==T||T(!1),pe(""),null===(n=he.current)||void 0===n||n.focus()},[ke,we,ye,be,m,j,H,R,T]),Ee=s(function(e,n){if(e.stopPropagation(),ke&&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==j||j(t,Ce()),null==R||R(n,o)}},[ke,we,ye,m,j,R,Ce]),De=function(e){e.stopPropagation();var n=ke?[]:void 0;ye||oe(n),null==j||j(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 Ce()},[Ce]),Me=u(function(){return W&&we&&!w},[W,we,w]),We=u(function(){return ke?Array.isArray(we)&&we.length>0:null!=we&&""!==we},[ke,we]),je=u(function(){if(!ke||!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]})]})},[ke,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(V),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(k?"#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"},Y),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:ke?je||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(U),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:"translateY(-8px)",animation:"dropdownFadeIn 0.2s ease-out forwards",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain"},q),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=ke?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)]})};k.displayName="Select";var C=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,j=void 0!==W&&W,H=o.hideOnSinglePage,R=void 0!==H&&H,I=o.className,N=void 0===I?"":I,O=o.style,T=o.size,P=void 0===T?"default":T,V=o.responsive,Y=void 0!==V&&V;o.showLessItems;var K=o.itemRender,U=v().primaryColor,q=void 0===U?"#FB6011":U,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||j||(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:j||1===te,type:"default",size:"default"===P?"medium":"small",style:{marginRight:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:n(C,{})}),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:j||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:Y?"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:j||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(C,{})})):n(w,{onClick:function(){return re(te-1)},disabled:j||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(C,{})})}),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,t){return function(e){if("number"==typeof e){var t=e===te,o=n(w,{onClick:function(){return re(e)},disabled:j,type:"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:"none",background:t?"#FAFAF9":"white",backgroundColor:t?"#FAFAF9":"white",color:t?q:"#79716B",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:j,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:j,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:j||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:j||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(k,{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:j,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:j,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:j,type:"default",size:"default"===P?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:A.goButton}):n(w,{onClick:le,disabled:j,type:"default",size:"default"===P?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"OK"})]})]})]})};export{z as default};
2
2
  //# sourceMappingURL=Pagination.esm.js.map