aha-components 0.0.1 → 1.0.0
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/CHANGELOG.md +49 -0
- package/README.md +257 -38
- package/dist/Alert.esm.js +2 -0
- package/dist/Alert.esm.js.map +1 -0
- package/dist/Alert.js +2 -0
- package/dist/Alert.js.map +1 -0
- package/dist/AlertComponent.esm.js +2 -0
- package/dist/AlertComponent.esm.js.map +1 -0
- package/dist/AlertComponent.js +2 -0
- package/dist/AlertComponent.js.map +1 -0
- package/dist/Button.esm.js +2 -0
- package/dist/Button.esm.js.map +1 -0
- package/dist/Button.js +2 -0
- package/dist/Button.js.map +1 -0
- package/dist/Card.esm.js +2 -0
- package/dist/Card.esm.js.map +1 -0
- package/dist/Card.js +2 -0
- package/dist/Card.js.map +1 -0
- package/dist/Input.esm.js +2 -0
- package/dist/Input.esm.js.map +1 -0
- package/dist/Input.js +2 -0
- package/dist/Input.js.map +1 -0
- package/dist/TestComponent.esm.js +2 -0
- package/dist/TestComponent.esm.js.map +1 -0
- package/dist/TestComponent.js +2 -0
- package/dist/TestComponent.js.map +1 -0
- package/dist/components/Alert/icon.d.ts +7 -0
- package/dist/components/Alert/index.d.ts +13 -0
- package/dist/components/AlertComponent/index.d.ts +9 -0
- package/dist/components/Button/index.d.ts +11 -0
- package/dist/components/Card/index.d.ts +10 -0
- package/dist/components/Input/index.d.ts +14 -0
- package/dist/components/TestComponent/index.d.ts +7 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/setupTests.d.ts +1 -0
- package/package.json +95 -30
- package/dist/assets/index-BtVi8doP.js +0 -40
- package/dist/assets/index-n_ryQ3BS.css +0 -1
- package/dist/assets/react-CHdo91hT.svg +0 -1
- package/dist/index.html +0 -14
- package/dist/vite.svg +0 -1
- package/eslint.config.js +0 -28
- package/index.html +0 -13
- package/public/vite.svg +0 -1
- package/rollup.config.js +0 -33
- package/src/App.css +0 -42
- package/src/App.tsx +0 -35
- package/src/assets/react.svg +0 -1
- package/src/components/Button/Button.less +0 -13
- package/src/components/Button/Button.tsx +0 -22
- package/src/components/Button/Button.types.ts +0 -36
- package/src/components/Button/index.ts +0 -2
- package/src/components/index.ts +0 -2
- package/src/index.css +0 -68
- package/src/main.tsx +0 -10
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.app.json +0 -26
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -24
- package/vite.config.ts +0 -7
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface InputProps {
|
|
3
|
+
value?: string;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
type?: 'text' | 'password' | 'email' | 'number';
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
onChange?: (value: string) => void;
|
|
8
|
+
onFocus?: () => void;
|
|
9
|
+
onBlur?: () => void;
|
|
10
|
+
className?: string;
|
|
11
|
+
size?: 'small' | 'medium' | 'large';
|
|
12
|
+
}
|
|
13
|
+
declare const Input: React.FC<InputProps>;
|
|
14
|
+
export default Input;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface ButtonProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
variant?: 'primary' | 'secondary' | 'outline';
|
|
6
|
+
size?: 'small' | 'medium' | 'large';
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const Button: React.FC<ButtonProps>;
|
|
12
|
+
|
|
13
|
+
interface InputProps {
|
|
14
|
+
value?: string;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
type?: 'text' | 'password' | 'email' | 'number';
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
onChange?: (value: string) => void;
|
|
19
|
+
onFocus?: () => void;
|
|
20
|
+
onBlur?: () => void;
|
|
21
|
+
className?: string;
|
|
22
|
+
size?: 'small' | 'medium' | 'large';
|
|
23
|
+
}
|
|
24
|
+
declare const Input: React.FC<InputProps>;
|
|
25
|
+
|
|
26
|
+
interface CardProps {
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
title?: string;
|
|
29
|
+
subtitle?: string;
|
|
30
|
+
className?: string;
|
|
31
|
+
onClick?: () => void;
|
|
32
|
+
}
|
|
33
|
+
declare const Card: React.FC<CardProps>;
|
|
34
|
+
|
|
35
|
+
interface TestComponentProps {
|
|
36
|
+
children?: React.ReactNode;
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
declare const TestComponent: React.FC<TestComponentProps>;
|
|
40
|
+
|
|
41
|
+
interface AlertComponentProps {
|
|
42
|
+
children: React.ReactNode;
|
|
43
|
+
variant?: 'success' | 'error' | 'warning' | 'info';
|
|
44
|
+
className?: string;
|
|
45
|
+
onClose?: () => void;
|
|
46
|
+
}
|
|
47
|
+
declare const AlertComponent: React.FC<AlertComponentProps>;
|
|
48
|
+
|
|
49
|
+
export { AlertComponent, AlertComponentProps, Button, ButtonProps, Card, CardProps, Input, InputProps, TestComponent, TestComponentProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";var o=function(r){var o=r.children,t=r.variant,n=void 0===t?"primary":t,a=r.size,c=void 0===a?"medium":a,i=r.disabled,l=void 0!==i&&i,d=r.onClick,s=r.className,u=void 0===s?"":s,m=l?"opacity-50 cursor-not-allowed":"cursor-pointer",b="".concat("inline-flex items-center justify-center rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2"," ").concat({primary:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",secondary:"bg-gray-600 text-white hover:bg-gray-700 focus:ring-gray-500",outline:"border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 focus:ring-blue-500"}[n]," ").concat({small:"px-3 py-1.5 text-sm",medium:"px-4 py-2 text-base",large:"px-6 py-3 text-lg"}[c]," ").concat(m," ").concat(u);return e("button",{className:b,disabled:l,onClick:d,children:o})},t=function(r){var o=r.value,t=void 0===o?"":o,n=r.placeholder,a=void 0===n?"":n,c=r.type,i=void 0===c?"text":c,l=r.disabled,d=void 0!==l&&l,s=r.onChange,u=r.onFocus,m=r.onBlur,b=r.className,g=void 0===b?"":b,v=r.size,p=void 0===v?"medium":v,h=d?"opacity-50 cursor-not-allowed bg-gray-100":"bg-white",y="".concat("border border-gray-300 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"," ").concat({small:"px-3 py-1.5 text-sm",medium:"px-4 py-2 text-base",large:"px-6 py-3 text-lg"}[p]," ").concat(h," ").concat(g);return e("input",{type:i,value:t,placeholder:a,disabled:d,onChange:function(e){s&&s(e.target.value)},onFocus:u,onBlur:m,className:y})},n=function(o){var t=o.children,n=o.title,a=o.subtitle,c=o.className,i=void 0===c?"":c,l=o.onClick,d=l?"cursor-pointer":"",s="".concat("bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md transition-shadow"," ").concat(d," ").concat(i);return r("div",{className:s,onClick:l,children:[(n||a)&&r("div",{className:"px-6 py-4 border-b border-gray-200",children:[n&&e("h3",{className:"text-lg font-semibold text-gray-900",children:n}),a&&e("p",{className:"mt-1 text-sm text-gray-600",children:a})]}),e("div",{className:"px-6 py-4",children:t})]})},a=function(r){var o=r.children,t=r.className;return e("div",{className:"testcomponent-component ".concat(void 0===t?"":t),children:o})},c=function(o){var t=o.children,n=o.variant,a=void 0===n?"info":n,c=o.className,i=void 0===c?"":c,l=o.onClose,d="".concat("border rounded-md p-4 relative"," ").concat({success:"bg-green-50 border-green-200 text-green-800",error:"bg-red-50 border-red-200 text-red-800",warning:"bg-yellow-50 border-yellow-200 text-yellow-800",info:"bg-blue-50 border-blue-200 text-blue-800"}[a]," ").concat(i);return e("div",{className:d,children:r("div",{className:"flex",children:[e("div",{className:"flex-1",children:t}),l&&e("button",{onClick:l,className:"ml-3 text-current hover:opacity-70 transition-opacity",children:"✕"})]})})};export{c as AlertComponent,o as Button,n as Card,t as Input,a as TestComponent};
|
|
2
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/components/Button/index.tsx","../src/components/Input/index.tsx","../src/components/Card/index.tsx","../src/components/TestComponent/index.tsx","../src/components/AlertComponent/index.tsx"],"sourcesContent":["import React from 'react';\n\nexport interface ButtonProps {\n children: React.ReactNode;\n variant?: 'primary' | 'secondary' | 'outline';\n size?: 'small' | 'medium' | 'large';\n disabled?: boolean;\n onClick?: () => void;\n className?: string;\n}\n\nconst Button: React.FC<ButtonProps> = ({\n children,\n variant = 'primary',\n size = 'medium',\n disabled = false,\n onClick,\n className = '',\n}) => {\n const baseClasses = 'inline-flex items-center justify-center rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2';\n \n const variantClasses = {\n primary: 'bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500',\n secondary: 'bg-gray-600 text-white hover:bg-gray-700 focus:ring-gray-500',\n outline: 'border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 focus:ring-blue-500',\n };\n \n const sizeClasses = {\n small: 'px-3 py-1.5 text-sm',\n medium: 'px-4 py-2 text-base',\n large: 'px-6 py-3 text-lg',\n };\n \n const disabledClasses = disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer';\n \n const classes = `${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]} ${disabledClasses} ${className}`;\n \n return (\n <button\n className={classes}\n disabled={disabled}\n onClick={onClick}\n >\n {children}\n </button>\n );\n};\n\nexport default Button; ","import React from 'react';\n\nexport interface InputProps {\n value?: string;\n placeholder?: string;\n type?: 'text' | 'password' | 'email' | 'number';\n disabled?: boolean;\n onChange?: (value: string) => void;\n onFocus?: () => void;\n onBlur?: () => void;\n className?: string;\n size?: 'small' | 'medium' | 'large';\n}\n\nconst Input: React.FC<InputProps> = ({\n value = '',\n placeholder = '',\n type = 'text',\n disabled = false,\n onChange,\n onFocus,\n onBlur,\n className = '',\n size = 'medium',\n}) => {\n const baseClasses = 'border border-gray-300 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500';\n \n const sizeClasses = {\n small: 'px-3 py-1.5 text-sm',\n medium: 'px-4 py-2 text-base',\n large: 'px-6 py-3 text-lg',\n };\n \n const disabledClasses = disabled ? 'opacity-50 cursor-not-allowed bg-gray-100' : 'bg-white';\n \n const classes = `${baseClasses} ${sizeClasses[size]} ${disabledClasses} ${className}`;\n \n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange) {\n onChange(e.target.value);\n }\n };\n \n return (\n <input\n type={type}\n value={value}\n placeholder={placeholder}\n disabled={disabled}\n onChange={handleChange}\n onFocus={onFocus}\n onBlur={onBlur}\n className={classes}\n />\n );\n};\n\nexport default Input; ","import React from 'react';\n\nexport interface CardProps {\n children: React.ReactNode;\n title?: string;\n subtitle?: string;\n className?: string;\n onClick?: () => void;\n}\n\nconst Card: React.FC<CardProps> = ({\n children,\n title,\n subtitle,\n className = '',\n onClick,\n}) => {\n const baseClasses = 'bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md transition-shadow';\n const clickableClasses = onClick ? 'cursor-pointer' : '';\n const classes = `${baseClasses} ${clickableClasses} ${className}`;\n \n return (\n <div className={classes} onClick={onClick}>\n {(title || subtitle) && (\n <div className=\"px-6 py-4 border-b border-gray-200\">\n {title && <h3 className=\"text-lg font-semibold text-gray-900\">{title}</h3>}\n {subtitle && <p className=\"mt-1 text-sm text-gray-600\">{subtitle}</p>}\n </div>\n )}\n <div className=\"px-6 py-4\">\n {children}\n </div>\n </div>\n );\n};\n\nexport default Card; ","import React from 'react';\n\nexport interface TestComponentProps {\n children?: React.ReactNode;\n className?: string;\n // TODO: 添加更多属性\n}\n\nconst TestComponent: React.FC<TestComponentProps> = ({\n children,\n className = '',\n}) => {\n return (\n <div className={`testcomponent-component ${className}`}>\n {children}\n </div>\n );\n};\n\nexport default TestComponent;\n","import React from 'react';\n\nexport interface AlertComponentProps {\n children: React.ReactNode;\n variant?: 'success' | 'error' | 'warning' | 'info';\n className?: string;\n onClose?: () => void;\n}\n\nconst AlertComponent: React.FC<AlertComponentProps> = ({\n children,\n variant = 'info',\n className = '',\n onClose,\n}) => {\n const variantClasses = {\n success: 'bg-green-50 border-green-200 text-green-800',\n error: 'bg-red-50 border-red-200 text-red-800',\n warning: 'bg-yellow-50 border-yellow-200 text-yellow-800',\n info: 'bg-blue-50 border-blue-200 text-blue-800',\n };\n\n const baseClasses = 'border rounded-md p-4 relative';\n const classes = `${baseClasses} ${variantClasses[variant]} ${className}`;\n\n return (\n <div className={classes}>\n <div className=\"flex\">\n <div className=\"flex-1\">{children}</div>\n {onClose && (\n <button\n onClick={onClose}\n className=\"ml-3 text-current hover:opacity-70 transition-opacity\"\n >\n ✕\n </button>\n )}\n </div>\n </div>\n );\n};\n\nexport default AlertComponent;\n"],"names":["Button","_a","children","_b","variant","_c","size","_d","disabled","onClick","_e","className","disabledClasses","classes","concat","primary","secondary","outline","small","medium","large","_jsx","Input","value","placeholder","type","onChange","onFocus","onBlur","_f","_g","e","target","Card","title","subtitle","clickableClasses","_jsxs","TestComponent","AlertComponent","onClose","success","error","warning","info"],"mappings":"kDAWM,IAAAA,EAAgC,SAACC,GACrC,IAAAC,EAAQD,EAAAC,SACRC,EAAmBF,EAAAG,QAAnBA,OAAO,IAAAD,EAAG,UAASA,EACnBE,EAAAJ,EAAAK,KAAAA,aAAO,SAAQD,EACfE,EAAAN,EAAAO,SAAAA,OAAW,IAAAD,KACXE,EAAOR,EAAAQ,QACPC,EAAcT,EAAAU,UAAdA,OAAS,IAAAD,EAAG,GAAEA,EAgBRE,EAAkBJ,EAAW,gCAAkC,iBAE/DK,EAAU,GAAAC,OA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EAAgB,KAAAtB,OAAIH,GAEtD,OACE0B,EAAK,MAAA,CAAA1B,UAAWE,EAASJ,QAASA,EAAOP,SAAA,EACrCgC,GAASC,IACTE,EAAK,MAAA,CAAA1B,UAAU,qCAAoCT,SAAA,CAChDgC,GAASb,EAAI,KAAA,CAAAV,UAAU,sCAAqCT,SAAEgC,IAC9DC,GAAYd,EAAG,IAAA,CAAAV,UAAU,6BAA8BT,SAAAiC,OAG5Dd,EAAA,MAAA,CAAKV,UAAU,YAAWT,SACvBA,MAIT,EC1BMoC,EAA8C,SAACrC,GACnD,IAAAC,aACAC,EAAAF,EAAAU,UAEA,OACEU,EAAK,MAAA,CAAAV,UAAW,2BAAAG,YAHT,IAAAX,EAAG,GAAEA,GAITD,SAAAA,GAGP,ECRMqC,EAAgD,SAACtC,GACrD,IAAAC,aACAC,EAAAF,EAAAG,QAAAA,aAAU,OAAMD,EAChBE,EAAAJ,EAAAU,UAAAA,OAAS,IAAAN,EAAG,GAAEA,EACdmC,EAAOvC,EAAAuC,QAUD3B,EAAU,GAAGC,OADC,iCACc,KAAAA,OARX,CACrB2B,QAAS,8CACTC,MAAO,wCACPC,QAAS,iDACTC,KAAM,4CAIyCxC,GAAQ,KAAAU,OAAIH,GAE7D,OACEU,EAAA,MAAA,CAAKV,UAAWE,EACdX,SAAAmC,EAAA,MAAA,CAAK1B,UAAU,OACbT,SAAA,CAAAmB,EAAA,MAAA,CAAKV,UAAU,SAAUT,SAAAA,IACxBsC,GACCnB,EACE,SAAA,CAAAZ,QAAS+B,EACT7B,UAAU,wDAGHT,SAAA,UAKnB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime");exports.AlertComponent=function(r){var o=r.children,t=r.variant,n=void 0===t?"info":t,a=r.className,c=void 0===a?"":a,s=r.onClose,i="".concat("border rounded-md p-4 relative"," ").concat({success:"bg-green-50 border-green-200 text-green-800",error:"bg-red-50 border-red-200 text-red-800",warning:"bg-yellow-50 border-yellow-200 text-yellow-800",info:"bg-blue-50 border-blue-200 text-blue-800"}[n]," ").concat(c);return e.jsx("div",{className:i,children:e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:"flex-1",children:o}),s&&e.jsx("button",{onClick:s,className:"ml-3 text-current hover:opacity-70 transition-opacity",children:"✕"})]})})},exports.Button=function(r){var o=r.children,t=r.variant,n=void 0===t?"primary":t,a=r.size,c=void 0===a?"medium":a,s=r.disabled,i=void 0!==s&&s,l=r.onClick,d=r.className,u=void 0===d?"":d,m=i?"opacity-50 cursor-not-allowed":"cursor-pointer",x="".concat("inline-flex items-center justify-center rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2"," ").concat({primary:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",secondary:"bg-gray-600 text-white hover:bg-gray-700 focus:ring-gray-500",outline:"border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 focus:ring-blue-500"}[n]," ").concat({small:"px-3 py-1.5 text-sm",medium:"px-4 py-2 text-base",large:"px-6 py-3 text-lg"}[c]," ").concat(m," ").concat(u);return e.jsx("button",{className:x,disabled:i,onClick:l,children:o})},exports.Card=function(r){var o=r.children,t=r.title,n=r.subtitle,a=r.className,c=void 0===a?"":a,s=r.onClick,i=s?"cursor-pointer":"",l="".concat("bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md transition-shadow"," ").concat(i," ").concat(c);return e.jsxs("div",{className:l,onClick:s,children:[(t||n)&&e.jsxs("div",{className:"px-6 py-4 border-b border-gray-200",children:[t&&e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:t}),n&&e.jsx("p",{className:"mt-1 text-sm text-gray-600",children:n})]}),e.jsx("div",{className:"px-6 py-4",children:o})]})},exports.Input=function(r){var o=r.value,t=void 0===o?"":o,n=r.placeholder,a=void 0===n?"":n,c=r.type,s=void 0===c?"text":c,i=r.disabled,l=void 0!==i&&i,d=r.onChange,u=r.onFocus,m=r.onBlur,x=r.className,b=void 0===x?"":x,g=r.size,p=void 0===g?"medium":g,v=l?"opacity-50 cursor-not-allowed bg-gray-100":"bg-white",h="".concat("border border-gray-300 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"," ").concat({small:"px-3 py-1.5 text-sm",medium:"px-4 py-2 text-base",large:"px-6 py-3 text-lg"}[p]," ").concat(v," ").concat(b);return e.jsx("input",{type:s,value:t,placeholder:a,disabled:l,onChange:function(e){d&&d(e.target.value)},onFocus:u,onBlur:m,className:h})},exports.TestComponent=function(r){var o=r.children,t=r.className,n=void 0===t?"":t;return e.jsx("div",{className:"testcomponent-component ".concat(n),children:o})};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/components/AlertComponent/index.tsx","../src/components/Button/index.tsx","../src/components/Card/index.tsx","../src/components/Input/index.tsx","../src/components/TestComponent/index.tsx"],"sourcesContent":["import React from 'react';\n\nexport interface AlertComponentProps {\n children: React.ReactNode;\n variant?: 'success' | 'error' | 'warning' | 'info';\n className?: string;\n onClose?: () => void;\n}\n\nconst AlertComponent: React.FC<AlertComponentProps> = ({\n children,\n variant = 'info',\n className = '',\n onClose,\n}) => {\n const variantClasses = {\n success: 'bg-green-50 border-green-200 text-green-800',\n error: 'bg-red-50 border-red-200 text-red-800',\n warning: 'bg-yellow-50 border-yellow-200 text-yellow-800',\n info: 'bg-blue-50 border-blue-200 text-blue-800',\n };\n\n const baseClasses = 'border rounded-md p-4 relative';\n const classes = `${baseClasses} ${variantClasses[variant]} ${className}`;\n\n return (\n <div className={classes}>\n <div className=\"flex\">\n <div className=\"flex-1\">{children}</div>\n {onClose && (\n <button\n onClick={onClose}\n className=\"ml-3 text-current hover:opacity-70 transition-opacity\"\n >\n ✕\n </button>\n )}\n </div>\n </div>\n );\n};\n\nexport default AlertComponent;\n","import React from 'react';\n\nexport interface ButtonProps {\n children: React.ReactNode;\n variant?: 'primary' | 'secondary' | 'outline';\n size?: 'small' | 'medium' | 'large';\n disabled?: boolean;\n onClick?: () => void;\n className?: string;\n}\n\nconst Button: React.FC<ButtonProps> = ({\n children,\n variant = 'primary',\n size = 'medium',\n disabled = false,\n onClick,\n className = '',\n}) => {\n const baseClasses = 'inline-flex items-center justify-center rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2';\n \n const variantClasses = {\n primary: 'bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500',\n secondary: 'bg-gray-600 text-white hover:bg-gray-700 focus:ring-gray-500',\n outline: 'border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 focus:ring-blue-500',\n };\n \n const sizeClasses = {\n small: 'px-3 py-1.5 text-sm',\n medium: 'px-4 py-2 text-base',\n large: 'px-6 py-3 text-lg',\n };\n \n const disabledClasses = disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer';\n \n const classes = `${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]} ${disabledClasses} ${className}`;\n \n return (\n <button\n className={classes}\n disabled={disabled}\n onClick={onClick}\n >\n {children}\n </button>\n );\n};\n\nexport default Button; ","import React from 'react';\n\nexport interface CardProps {\n children: React.ReactNode;\n title?: string;\n subtitle?: string;\n className?: string;\n onClick?: () => void;\n}\n\nconst Card: React.FC<CardProps> = ({\n children,\n title,\n subtitle,\n className = '',\n onClick,\n}) => {\n const baseClasses = 'bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md transition-shadow';\n const clickableClasses = onClick ? 'cursor-pointer' : '';\n const classes = `${baseClasses} ${clickableClasses} ${className}`;\n \n return (\n <div className={classes} onClick={onClick}>\n {(title || subtitle) && (\n <div className=\"px-6 py-4 border-b border-gray-200\">\n {title && <h3 className=\"text-lg font-semibold text-gray-900\">{title}</h3>}\n {subtitle && <p className=\"mt-1 text-sm text-gray-600\">{subtitle}</p>}\n </div>\n )}\n <div className=\"px-6 py-4\">\n {children}\n </div>\n </div>\n );\n};\n\nexport default Card; ","import React from 'react';\n\nexport interface InputProps {\n value?: string;\n placeholder?: string;\n type?: 'text' | 'password' | 'email' | 'number';\n disabled?: boolean;\n onChange?: (value: string) => void;\n onFocus?: () => void;\n onBlur?: () => void;\n className?: string;\n size?: 'small' | 'medium' | 'large';\n}\n\nconst Input: React.FC<InputProps> = ({\n value = '',\n placeholder = '',\n type = 'text',\n disabled = false,\n onChange,\n onFocus,\n onBlur,\n className = '',\n size = 'medium',\n}) => {\n const baseClasses = 'border border-gray-300 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500';\n \n const sizeClasses = {\n small: 'px-3 py-1.5 text-sm',\n medium: 'px-4 py-2 text-base',\n large: 'px-6 py-3 text-lg',\n };\n \n const disabledClasses = disabled ? 'opacity-50 cursor-not-allowed bg-gray-100' : 'bg-white';\n \n const classes = `${baseClasses} ${sizeClasses[size]} ${disabledClasses} ${className}`;\n \n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange) {\n onChange(e.target.value);\n }\n };\n \n return (\n <input\n type={type}\n value={value}\n placeholder={placeholder}\n disabled={disabled}\n onChange={handleChange}\n onFocus={onFocus}\n onBlur={onBlur}\n className={classes}\n />\n );\n};\n\nexport default Input; ","import React from 'react';\n\nexport interface TestComponentProps {\n children?: React.ReactNode;\n className?: string;\n // TODO: 添加更多属性\n}\n\nconst TestComponent: React.FC<TestComponentProps> = ({\n children,\n className = '',\n}) => {\n return (\n <div className={`testcomponent-component ${className}`}>\n {children}\n </div>\n );\n};\n\nexport default TestComponent;\n"],"names":["_a","children","_b","variant","_c","className","onClose","classes","concat","success","error","warning","info","_jsx","_jsxs","onClick","size","_d","disabled","_e","disabledClasses","primary","secondary","outline","small","medium","large","title","subtitle","clickableClasses","jsxs","jsx","value","placeholder","type","onChange","onFocus","onBlur","_f","_g","e","target"],"mappings":"uEASsD,SAACA,GACrD,IAAAC,aACAC,EAAAF,EAAAG,QAAAA,aAAU,OAAMD,EAChBE,EAAAJ,EA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A2BH,GACxCJ,SAAAA,GAGP"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
package/package.json
CHANGED
|
@@ -1,36 +1,101 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aha-components",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A React component library with tree-shaking support",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.esm.js",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md",
|
|
19
|
+
"CHANGELOG.md"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "rollup -c",
|
|
23
|
+
"dev": "rollup -c -w",
|
|
24
|
+
"test": "jest",
|
|
25
|
+
"test:watch": "jest --watch",
|
|
26
|
+
"storybook": "storybook dev -p 6006",
|
|
27
|
+
"build-storybook": "build-storybook",
|
|
28
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
29
|
+
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
30
|
+
"type-check": "tsc --noEmit",
|
|
31
|
+
"dev:example": "vite examples --port 3000",
|
|
32
|
+
"build:example": "vite build examples",
|
|
33
|
+
"generate": "node scripts/generate-component.js",
|
|
34
|
+
"generate:advanced": "node scripts/generate-component-advanced.js",
|
|
35
|
+
"prepublishOnly": "npm run build",
|
|
36
|
+
"release": "npm run build && npm publish",
|
|
37
|
+
"publish:script": "node scripts/publish.js",
|
|
38
|
+
"docs:build": "npm run build-storybook",
|
|
39
|
+
"docs:deploy": "npm run build-storybook && npx storybook-to-ghpages"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"react",
|
|
43
|
+
"components",
|
|
44
|
+
"ui",
|
|
45
|
+
"typescript",
|
|
46
|
+
"tailwindcss",
|
|
47
|
+
"storybook"
|
|
48
|
+
],
|
|
49
|
+
"author": "Your Name",
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "https://github.com/yourusername/aha-components.git"
|
|
54
|
+
},
|
|
55
|
+
"bugs": {
|
|
56
|
+
"url": "https://github.com/yourusername/aha-components/issues"
|
|
57
|
+
},
|
|
58
|
+
"homepage": "https://yourusername.github.io/aha-components",
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"react": "^18.0.0",
|
|
61
|
+
"react-dom": "^18.0.0"
|
|
10
62
|
},
|
|
11
63
|
"devDependencies": {
|
|
12
|
-
"@
|
|
13
|
-
"@
|
|
14
|
-
"@
|
|
15
|
-
"@
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
64
|
+
"@rollup/plugin-commonjs": "^25.0.0",
|
|
65
|
+
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
66
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
67
|
+
"@storybook/addon-actions": "^7.0.0",
|
|
68
|
+
"@storybook/addon-essentials": "^7.0.0",
|
|
69
|
+
"@storybook/addon-interactions": "^7.0.0",
|
|
70
|
+
"@storybook/addon-links": "^7.0.0",
|
|
71
|
+
"@storybook/blocks": "^7.0.0",
|
|
72
|
+
"@storybook/react": "^7.0.0",
|
|
73
|
+
"@storybook/react-vite": "^7.0.0",
|
|
74
|
+
"@storybook/testing-library": "^0.2.0",
|
|
75
|
+
"@testing-library/jest-dom": "^6.0.0",
|
|
76
|
+
"@testing-library/react": "^14.0.0",
|
|
77
|
+
"@types/jest": "^29.0.0",
|
|
78
|
+
"@types/react": "^18.0.0",
|
|
79
|
+
"@types/react-dom": "^18.0.0",
|
|
80
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
81
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
82
|
+
"@vitejs/plugin-react": "^4.0.0",
|
|
83
|
+
"eslint": "^8.0.0",
|
|
84
|
+
"eslint-plugin-react": "^7.0.0",
|
|
85
|
+
"eslint-plugin-react-hooks": "^4.0.0",
|
|
86
|
+
"jest": "^29.0.0",
|
|
87
|
+
"jest-environment-jsdom": "^29.0.0",
|
|
88
|
+
"react": "^18.0.0",
|
|
89
|
+
"react-dom": "^18.0.0",
|
|
90
|
+
"rollup": "^3.0.0",
|
|
91
|
+
"rollup-plugin-dts": "^5.0.0",
|
|
24
92
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
25
|
-
"rollup
|
|
26
|
-
"
|
|
27
|
-
"typescript
|
|
28
|
-
"vite": "^
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"build": "tsc -b && vite build",
|
|
33
|
-
"lint": "eslint .",
|
|
34
|
-
"preview": "vite preview"
|
|
93
|
+
"@rollup/plugin-terser": "^0.4.0",
|
|
94
|
+
"storybook": "^7.0.0",
|
|
95
|
+
"typescript": "^5.0.0",
|
|
96
|
+
"vite": "^4.0.0",
|
|
97
|
+
"tailwindcss": "^3.3.0",
|
|
98
|
+
"autoprefixer": "^10.4.0",
|
|
99
|
+
"postcss": "^8.4.0"
|
|
35
100
|
}
|
|
36
|
-
}
|
|
101
|
+
}
|