admin-panel-ui-components 0.1.4 → 0.1.6

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.
@@ -0,0 +1,17 @@
1
+ import React, { ButtonHTMLAttributes, InputHTMLAttributes } from 'react';
2
+
3
+ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
4
+ variant?: "primary" | "secondary" | "ghost";
5
+ size?: "sm" | "md" | "lg";
6
+ loading?: boolean;
7
+ className?: string;
8
+ }
9
+ declare const Button: React.FC<ButtonProps>;
10
+
11
+ interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
12
+ variant?: "outline" | "filled";
13
+ className?: string;
14
+ }
15
+ declare const Input: React.FC<InputProps>;
16
+
17
+ export { Button, Input };
package/dist/index.d.ts CHANGED
@@ -1 +1,17 @@
1
- export { default as Button } from "./Button";
1
+ import React, { ButtonHTMLAttributes, InputHTMLAttributes } from 'react';
2
+
3
+ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
4
+ variant?: "primary" | "secondary" | "ghost";
5
+ size?: "sm" | "md" | "lg";
6
+ loading?: boolean;
7
+ className?: string;
8
+ }
9
+ declare const Button: React.FC<ButtonProps>;
10
+
11
+ interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
12
+ variant?: "outline" | "filled";
13
+ className?: string;
14
+ }
15
+ declare const Input: React.FC<InputProps>;
16
+
17
+ export { Button, Input };
package/dist/index.js CHANGED
@@ -1 +1,2 @@
1
- export { default as Button } from "./Button";
1
+ "use strict";var c=Object.create;var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var h=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},a=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of x(e))!f.call(t,o)&&o!==r&&s(t,o,{get:()=>e[o],enumerable:!(n=g(e,o))||n.enumerable});return t};var p=(t,e,r)=>(r=t!=null?c(y(t)):{},a(e||!t||!t.__esModule?s(r,"default",{value:t,enumerable:!0}):r,t)),B=t=>a(s({},"__esModule",{value:!0}),t);var L={};h(L,{Button:()=>H,Input:()=>I});module.exports=B(L);var u=p(require("clsx")),i=require("react/jsx-runtime"),H=({children:t,variant:e="primary",size:r="md",loading:n=!1,className:o,disabled:d,...b})=>(0,i.jsx)("button",{className:(0,u.default)("inline-flex items-center justify-center rounded-md font-medium transition-colors",{"bg-blue-500 text-white hover:bg-blue-600":e==="primary","bg-gray-200 text-black hover:bg-gray-300":e==="secondary","bg-transparent text-blue-500 hover:underline":e==="ghost"},{"px-4 py-2 text-sm":r==="sm","px-6 py-3":r==="md","px-8 py-4 text-lg":r==="lg"},"disabled:opacity-50 disabled:cursor-not-allowed",n&&"cursor-wait",o),disabled:d||n,...b,children:n?"\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC...":t});var l=p(require("clsx")),m=require("react/jsx-runtime"),I=({variant:t="outline",className:e,...r})=>(0,m.jsx)("input",{className:(0,l.default)("rounded-md px-4 py-2",t==="outline"?"border border-gray-300":"bg-gray-100",e),...r});0&&(module.exports={Button,Input});
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/components/Button/Button.tsx","../src/components/Input/Input.tsx"],"sourcesContent":["export * from \"./components/Button/Button\";\nexport * from \"./components/Input/Input\";","import React, { ButtonHTMLAttributes } from \"react\";\nimport clsx from \"clsx\";\n\ninterface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: \"primary\" | \"secondary\" | \"ghost\";\n size?: \"sm\" | \"md\" | \"lg\";\n loading?: boolean;\n className?: string;\n}\n\nexport const Button: React.FC<ButtonProps> = ({ children, variant = \"primary\", size = \"md\", loading = false, className, disabled, ...props }) => {\n return (\n <button\n className={clsx(\n \"inline-flex items-center justify-center rounded-md font-medium transition-colors\",\n {\n \"bg-blue-500 text-white hover:bg-blue-600\": variant === \"primary\",\n \"bg-gray-200 text-black hover:bg-gray-300\": variant === \"secondary\",\n \"bg-transparent text-blue-500 hover:underline\": variant === \"ghost\",\n },\n {\n \"px-4 py-2 text-sm\": size === \"sm\",\n \"px-6 py-3\": size === \"md\",\n \"px-8 py-4 text-lg\": size === \"lg\",\n },\n \"disabled:opacity-50 disabled:cursor-not-allowed\",\n loading && \"cursor-wait\",\n className\n )}\n disabled={disabled || loading}\n {...props}\n >\n {loading ? \"در حال بارگذاری...\" : children}\n </button>\n );\n};\n","import React, { InputHTMLAttributes } from \"react\";\nimport clsx from \"clsx\";\n\ninterface InputProps extends InputHTMLAttributes<HTMLInputElement> {\n variant?: \"outline\" | \"filled\";\n className?: string;\n}\n\nexport const Input: React.FC<InputProps> = ({ variant = \"outline\", className, ...props }) => {\n return <input className={clsx(\"rounded-md px-4 py-2\", variant === \"outline\" ? \"border border-gray-300\" : \"bg-gray-100\", className)} {...props} />;\n};\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,UAAAC,IAAA,eAAAC,EAAAJ,GCCA,IAAAK,EAAiB,mBAWbC,EAAA,6BAFSC,EAAgC,CAAC,CAAE,SAAAC,EAAU,QAAAC,EAAU,UAAW,KAAAC,EAAO,KAAM,QAAAC,EAAU,GAAO,UAAAC,EAAW,SAAAC,EAAU,GAAGC,CAAM,OAEvI,OAAC,UACC,aAAW,EAAAC,SACT,mFACA,CACE,2CAA4CN,IAAY,UACxD,2CAA4CA,IAAY,YACxD,+CAAgDA,IAAY,OAC9D,EACA,CACE,oBAAqBC,IAAS,KAC9B,YAAaA,IAAS,KACtB,oBAAqBA,IAAS,IAChC,EACA,kDACAC,GAAW,cACXC,CACF,EACA,SAAUC,GAAYF,EACrB,GAAGG,EAEH,SAAAH,EAAU,sFAAuBH,EACpC,EChCJ,IAAAQ,EAAiB,mBAQRC,EAAA,6BADIC,EAA8B,CAAC,CAAE,QAAAC,EAAU,UAAW,UAAAC,EAAW,GAAGC,CAAM,OAC9E,OAAC,SAAM,aAAW,EAAAC,SAAK,uBAAwBH,IAAY,UAAY,yBAA2B,cAAeC,CAAS,EAAI,GAAGC,EAAO","names":["index_exports","__export","Button","Input","__toCommonJS","import_clsx","import_jsx_runtime","Button","children","variant","size","loading","className","disabled","props","clsx","import_clsx","import_jsx_runtime","Input","variant","className","props","clsx"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import p from"clsx";import{jsx as u}from"react/jsx-runtime";var d=({children:r,variant:t="primary",size:e="md",loading:o=!1,className:n,disabled:s,...a})=>u("button",{className:p("inline-flex items-center justify-center rounded-md font-medium transition-colors",{"bg-blue-500 text-white hover:bg-blue-600":t==="primary","bg-gray-200 text-black hover:bg-gray-300":t==="secondary","bg-transparent text-blue-500 hover:underline":t==="ghost"},{"px-4 py-2 text-sm":e==="sm","px-6 py-3":e==="md","px-8 py-4 text-lg":e==="lg"},"disabled:opacity-50 disabled:cursor-not-allowed",o&&"cursor-wait",n),disabled:s||o,...a,children:o?"\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC...":r});import i from"clsx";import{jsx as l}from"react/jsx-runtime";var x=({variant:r="outline",className:t,...e})=>l("input",{className:i("rounded-md px-4 py-2",r==="outline"?"border border-gray-300":"bg-gray-100",t),...e});export{d as Button,x as Input};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Button/Button.tsx","../src/components/Input/Input.tsx"],"sourcesContent":["import React, { ButtonHTMLAttributes } from \"react\";\nimport clsx from \"clsx\";\n\ninterface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: \"primary\" | \"secondary\" | \"ghost\";\n size?: \"sm\" | \"md\" | \"lg\";\n loading?: boolean;\n className?: string;\n}\n\nexport const Button: React.FC<ButtonProps> = ({ children, variant = \"primary\", size = \"md\", loading = false, className, disabled, ...props }) => {\n return (\n <button\n className={clsx(\n \"inline-flex items-center justify-center rounded-md font-medium transition-colors\",\n {\n \"bg-blue-500 text-white hover:bg-blue-600\": variant === \"primary\",\n \"bg-gray-200 text-black hover:bg-gray-300\": variant === \"secondary\",\n \"bg-transparent text-blue-500 hover:underline\": variant === \"ghost\",\n },\n {\n \"px-4 py-2 text-sm\": size === \"sm\",\n \"px-6 py-3\": size === \"md\",\n \"px-8 py-4 text-lg\": size === \"lg\",\n },\n \"disabled:opacity-50 disabled:cursor-not-allowed\",\n loading && \"cursor-wait\",\n className\n )}\n disabled={disabled || loading}\n {...props}\n >\n {loading ? \"در حال بارگذاری...\" : children}\n </button>\n );\n};\n","import React, { InputHTMLAttributes } from \"react\";\nimport clsx from \"clsx\";\n\ninterface InputProps extends InputHTMLAttributes<HTMLInputElement> {\n variant?: \"outline\" | \"filled\";\n className?: string;\n}\n\nexport const Input: React.FC<InputProps> = ({ variant = \"outline\", className, ...props }) => {\n return <input className={clsx(\"rounded-md px-4 py-2\", variant === \"outline\" ? \"border border-gray-300\" : \"bg-gray-100\", className)} {...props} />;\n};\n"],"mappings":"AACA,OAAOA,MAAU,OAWb,cAAAC,MAAA,oBAFG,IAAMC,EAAgC,CAAC,CAAE,SAAAC,EAAU,QAAAC,EAAU,UAAW,KAAAC,EAAO,KAAM,QAAAC,EAAU,GAAO,UAAAC,EAAW,SAAAC,EAAU,GAAGC,CAAM,IAEvIR,EAAC,UACC,UAAWD,EACT,mFACA,CACE,2CAA4CI,IAAY,UACxD,2CAA4CA,IAAY,YACxD,+CAAgDA,IAAY,OAC9D,EACA,CACE,oBAAqBC,IAAS,KAC9B,YAAaA,IAAS,KACtB,oBAAqBA,IAAS,IAChC,EACA,kDACAC,GAAW,cACXC,CACF,EACA,SAAUC,GAAYF,EACrB,GAAGG,EAEH,SAAAH,EAAU,sFAAuBH,EACpC,EChCJ,OAAOO,MAAU,OAQR,cAAAC,MAAA,oBADF,IAAMC,EAA8B,CAAC,CAAE,QAAAC,EAAU,UAAW,UAAAC,EAAW,GAAGC,CAAM,IAC9EJ,EAAC,SAAM,UAAWD,EAAK,uBAAwBG,IAAY,UAAY,yBAA2B,cAAeC,CAAS,EAAI,GAAGC,EAAO","names":["clsx","jsx","Button","children","variant","size","loading","className","disabled","props","clsx","jsx","Input","variant","className","props"]}
package/package.json CHANGED
@@ -1,13 +1,23 @@
1
1
  {
2
2
  "name": "admin-panel-ui-components",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.cjs"
12
+ }
13
+ },
7
14
  "scripts": {
8
- "build": "tsc && cp src/*.css dist/"
15
+ "build": "tsup"
9
16
  },
10
17
  "peerDependencies": {
18
+ "@types/react": "^19.2.7",
19
+ "@types/react-dom": "^19.2.3",
20
+ "clsx": "^2.1.1",
11
21
  "react": "^19.2.3",
12
22
  "react-dom": "^19.2.3"
13
23
  },
@@ -15,10 +25,14 @@
15
25
  "author": "",
16
26
  "license": "ISC",
17
27
  "devDependencies": {
18
- "@types/react": "^19.2.7",
19
- "@types/react-dom": "^19.2.3",
28
+ "@types/react": "*",
29
+ "@types/react-dom": "*",
30
+ "autoprefixer": "^10.4.23",
31
+ "postcss": "^8.5.6",
20
32
  "react": "^19.2.3",
21
33
  "react-dom": "^19.2.3",
34
+ "tailwindcss": "^4.1.18",
35
+ "tsup": "^8.5.1",
22
36
  "typescript": "^5.9.3"
23
37
  },
24
38
  "dependencies": {
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ };
@@ -0,0 +1,36 @@
1
+ import React, { ButtonHTMLAttributes } from "react";
2
+ import clsx from "clsx";
3
+
4
+ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
5
+ variant?: "primary" | "secondary" | "ghost";
6
+ size?: "sm" | "md" | "lg";
7
+ loading?: boolean;
8
+ className?: string;
9
+ }
10
+
11
+ export const Button: React.FC<ButtonProps> = ({ children, variant = "primary", size = "md", loading = false, className, disabled, ...props }) => {
12
+ return (
13
+ <button
14
+ className={clsx(
15
+ "inline-flex items-center justify-center rounded-md font-medium transition-colors",
16
+ {
17
+ "bg-blue-500 text-white hover:bg-blue-600": variant === "primary",
18
+ "bg-gray-200 text-black hover:bg-gray-300": variant === "secondary",
19
+ "bg-transparent text-blue-500 hover:underline": variant === "ghost",
20
+ },
21
+ {
22
+ "px-4 py-2 text-sm": size === "sm",
23
+ "px-6 py-3": size === "md",
24
+ "px-8 py-4 text-lg": size === "lg",
25
+ },
26
+ "disabled:opacity-50 disabled:cursor-not-allowed",
27
+ loading && "cursor-wait",
28
+ className
29
+ )}
30
+ disabled={disabled || loading}
31
+ {...props}
32
+ >
33
+ {loading ? "در حال بارگذاری..." : children}
34
+ </button>
35
+ );
36
+ };
@@ -0,0 +1,11 @@
1
+ import React, { InputHTMLAttributes } from "react";
2
+ import clsx from "clsx";
3
+
4
+ interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
5
+ variant?: "outline" | "filled";
6
+ className?: string;
7
+ }
8
+
9
+ export const Input: React.FC<InputProps> = ({ variant = "outline", className, ...props }) => {
10
+ return <input className={clsx("rounded-md px-4 py-2", variant === "outline" ? "border border-gray-300" : "bg-gray-100", className)} {...props} />;
11
+ };
package/src/index.ts CHANGED
@@ -1 +1,2 @@
1
- export { default as Button } from "./Button";
1
+ export * from "./components/Button/Button";
2
+ export * from "./components/Input/Input";
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ content: ["./src/**/*.{ts,tsx}"],
3
+ theme: { extend: {} },
4
+ plugins: [],
5
+ };
package/tsup.config.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { defineConfig } from "tsup";
2
+
3
+ export default defineConfig({
4
+ entry: ["src/index.ts"],
5
+ format: ["cjs", "esm"],
6
+ dts: true,
7
+ splitting: false,
8
+ sourcemap: true,
9
+ clean: true,
10
+ external: ["react", "react-dom"],
11
+ minify: true,
12
+ target: 'es2020',
13
+ });
package/dist/Button.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import React from "react";
2
- interface ButtonProps {
3
- children: React.ReactNode;
4
- variant?: "primary" | "secondary";
5
- onClick?: () => void;
6
- className?: string;
7
- }
8
- declare const Button: React.FC<ButtonProps>;
9
- export default Button;
package/dist/Button.js DELETED
@@ -1,13 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { twMerge } from "tailwind-merge";
3
- var Button = function (_a) {
4
- var children = _a.children, _b = _a.variant, variant = _b === void 0 ? "primary" : _b, onClick = _a.onClick, className = _a.className;
5
- var baseClasses = "text-base font-semibold rounded-lg transition px-6 py-3";
6
- var variantClasses = {
7
- primary: "bg-blue-600 text-white hover:bg-blue-700",
8
- secondary: "bg-gray-600 text-white hover:bg-gray-700",
9
- };
10
- var mergedClasses = twMerge(baseClasses, variantClasses[variant], className);
11
- return (_jsx("button", { className: mergedClasses, onClick: onClick, children: children }));
12
- };
13
- export default Button;
package/src/Button.tsx DELETED
@@ -1,28 +0,0 @@
1
- import React from "react";
2
- import { twMerge } from "tailwind-merge";
3
-
4
- interface ButtonProps {
5
- children: React.ReactNode;
6
- variant?: "primary" | "secondary";
7
- onClick?: () => void;
8
- className?: string;
9
- }
10
-
11
- const Button: React.FC<ButtonProps> = ({ children, variant = "primary", onClick, className }) => {
12
- const baseClasses = "text-base font-semibold rounded-lg transition px-6 py-3";
13
-
14
- const variantClasses = {
15
- primary: "bg-blue-600 text-white hover:bg-blue-700",
16
- secondary: "bg-gray-600 text-white hover:bg-gray-700",
17
- };
18
-
19
- const mergedClasses = twMerge(baseClasses, variantClasses[variant], className);
20
-
21
- return (
22
- <button className={mergedClasses} onClick={onClick}>
23
- {children}
24
- </button>
25
- );
26
- };
27
-
28
- export default Button;