@abmrifat1/js-ui-component-library 0.0.0-stage → 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/README.md +29 -2
- package/dist/App.d.ts +2 -0
- package/dist/Button.d.ts +9 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +34 -0
- package/dist/main.d.ts +1 -0
- package/package.json +44 -4
package/README.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
-
#
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## Expanding the ESLint configuration
|
|
11
|
+
|
|
12
|
+
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
|
|
13
|
+
|
|
14
|
+
- Configure the top-level `parserOptions` property like this:
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
export default {
|
|
18
|
+
// other rules...
|
|
19
|
+
parserOptions: {
|
|
20
|
+
ecmaVersion: 'latest',
|
|
21
|
+
sourceType: 'module',
|
|
22
|
+
project: ['./tsconfig.json', './tsconfig.node.json'],
|
|
23
|
+
tsconfigRootDir: __dirname,
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
|
|
29
|
+
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
|
|
30
|
+
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
|
package/dist/App.d.ts
ADDED
package/dist/Button.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
align?: 'left' | 'center' | 'right';
|
|
4
|
+
size?: 'small' | 'large' | 'full';
|
|
5
|
+
color?: 'blue' | 'red' | 'white';
|
|
6
|
+
outline?: 'primary' | 'default';
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const Button: React.FC<ButtonProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),u=({align:l="center",size:t="small",color:e="blue",outline:n="default",children:f,style:o,...i})=>{const s={display:"flex",width:"100%",justifyContent:l==="left"?"flex-start":l==="right"?"flex-end":"center",marginBottom:"16px"},d={display:"inline-flex",alignItems:"center",justifyContent:"center",width:t==="full"?"100%":"auto",padding:t==="small"?"6px 12px":"12px 24px",fontSize:t==="small"?"14px":t==="large"?"18px":"16px",border:n==="primary"?"2px solid #007bff":"1px solid #ccc",backgroundColor:e==="blue"?"#007bff":e==="red"?"#dc3545":"#ffffff",color:e==="white"?"#000000":"#ffffff",cursor:"pointer",borderRadius:"4px",...o};return r.jsx("div",{style:s,children:r.jsx("button",{style:d,...i,children:f})})};exports.Button=u;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
const s = ({
|
|
3
|
+
align: f = "center",
|
|
4
|
+
size: t = "small",
|
|
5
|
+
color: e = "blue",
|
|
6
|
+
outline: r = "default",
|
|
7
|
+
children: n,
|
|
8
|
+
style: o,
|
|
9
|
+
...p
|
|
10
|
+
}) => {
|
|
11
|
+
const d = {
|
|
12
|
+
display: "flex",
|
|
13
|
+
width: "100%",
|
|
14
|
+
justifyContent: f === "left" ? "flex-start" : f === "right" ? "flex-end" : "center",
|
|
15
|
+
marginBottom: "16px"
|
|
16
|
+
}, i = {
|
|
17
|
+
display: "inline-flex",
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
justifyContent: "center",
|
|
20
|
+
width: t === "full" ? "100%" : "auto",
|
|
21
|
+
padding: t === "small" ? "6px 12px" : "12px 24px",
|
|
22
|
+
fontSize: t === "small" ? "14px" : t === "large" ? "18px" : "16px",
|
|
23
|
+
border: r === "primary" ? "2px solid #007bff" : "1px solid #ccc",
|
|
24
|
+
backgroundColor: e === "blue" ? "#007bff" : e === "red" ? "#dc3545" : "#ffffff",
|
|
25
|
+
color: e === "white" ? "#000000" : "#ffffff",
|
|
26
|
+
cursor: "pointer",
|
|
27
|
+
borderRadius: "4px",
|
|
28
|
+
...o
|
|
29
|
+
};
|
|
30
|
+
return /* @__PURE__ */ l("div", { style: d, children: /* @__PURE__ */ l("button", { style: i, ...p, children: n }) });
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
s as Button
|
|
34
|
+
};
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abmrifat1/js-ui-component-library",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Reusable React ui component with align, size, color, and outline props.",
|
|
5
|
+
"main": "dist/index.cjs.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.cjs.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": ["dist"],
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"react": ">=18.0.0",
|
|
19
|
+
"react-dom": ">=18.0.0"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"dev": "vite",
|
|
23
|
+
"build": "tsc && vite build",
|
|
24
|
+
"prepublishOnly": "npm run build",
|
|
25
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
26
|
+
"preview": "vite preview"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"react": "^18.2.0",
|
|
30
|
+
"react-dom": "^18.2.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^26.6.5",
|
|
34
|
+
"@types/react": "^18.2.37",
|
|
35
|
+
"@types/react-dom": "^18.2.15",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
|
37
|
+
"@typescript-eslint/parser": "^6.10.0",
|
|
38
|
+
"@vitejs/plugin-react": "^4.2.0",
|
|
39
|
+
"eslint": "^8.53.0",
|
|
40
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
41
|
+
"eslint-plugin-react-refresh": "^0.4.4",
|
|
42
|
+
"typescript": "^5.2.2",
|
|
43
|
+
"vite": "^5.0.0",
|
|
44
|
+
"vite-plugin-dts": "^5.1.2"
|
|
45
|
+
}
|
|
46
|
+
}
|