@plurix/ecom-components 0.0.1
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 +48 -0
- package/dist/assets/index.css +1 -0
- package/dist/assets/index2.css +1 -0
- package/dist/assets/index3.css +1 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.js +12 -0
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Input/index.js +12 -0
- package/dist/components/Label/index.d.ts +2 -0
- package/dist/components/Label/index.js +12 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.js +8 -0
- package/dist/vite-env.d.js +1 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<img width="500" alt="ViteReactComponentLibrary" src="https://github.com/receter/my-component-library/assets/2504695/dbb53036-d228-477b-8cf8-f61cd6130776">
|
|
2
|
+
|
|
3
|
+
# A simple (demo) react component library
|
|
4
|
+
This repository was published together with an article on [how to create a react component library](https://dev.to/receter/how-to-create-a-react-component-library-using-vites-library-mode-4lma) using Vite's library mode.
|
|
5
|
+
|
|
6
|
+
Here is another repo that consumes this libarary: https://github.com/receter/my-component-library-consumer
|
|
7
|
+
|
|
8
|
+
The demo library on npm: https://www.npmjs.com/package/@receter/my-component-library
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
You can install it with npm (don't expect much fanciness):
|
|
12
|
+
```bash
|
|
13
|
+
npm i @receter/my-component-library
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
```javascript
|
|
18
|
+
import { Button, Label, Input } from '@receter/my-component-library';
|
|
19
|
+
```
|
|
20
|
+
See this file for an example on using this library: https://github.com/receter/my-component-library-consumer/blob/main/src/App.tsx
|
|
21
|
+
|
|
22
|
+
## React + TypeScript + Vite
|
|
23
|
+
|
|
24
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
25
|
+
|
|
26
|
+
Currently, two official plugins are available:
|
|
27
|
+
|
|
28
|
+
- [@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
|
|
29
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
30
|
+
|
|
31
|
+
### Expanding the ESLint configuration
|
|
32
|
+
|
|
33
|
+
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
|
|
34
|
+
|
|
35
|
+
- Configure the top-level `parserOptions` property like this:
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
parserOptions: {
|
|
39
|
+
ecmaVersion: 'latest',
|
|
40
|
+
sourceType: 'module',
|
|
41
|
+
project: ['./tsconfig.json', './tsconfig.node.json'],
|
|
42
|
+
tsconfigRootDir: __dirname,
|
|
43
|
+
},
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
|
|
47
|
+
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
|
|
48
|
+
- 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._label_mog69_1{font-weight:700}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._input_1auw0_1{padding:1rem}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._button_1m5ht_1{padding:1rem}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import '../../assets/index3.css';
|
|
2
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
+
const u = "_button_1m5ht_1", r = {
|
|
4
|
+
button: u
|
|
5
|
+
};
|
|
6
|
+
function e(t) {
|
|
7
|
+
const { className: o, ...n } = t;
|
|
8
|
+
return /* @__PURE__ */ s("button", { className: `${o} ${r.button}`, ...n });
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
e as Button
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import '../../assets/index2.css';
|
|
2
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
3
|
+
const u = "_input_1auw0_1", o = {
|
|
4
|
+
input: u
|
|
5
|
+
};
|
|
6
|
+
function r(t) {
|
|
7
|
+
const { className: n, ...s } = t;
|
|
8
|
+
return /* @__PURE__ */ p("input", { className: `${n} ${o.input}`, ...s });
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
r as Input
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import '../../assets/index.css';
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
+
const o = "_label_mog69_1", t = {
|
|
4
|
+
label: o
|
|
5
|
+
};
|
|
6
|
+
function b(l) {
|
|
7
|
+
const { className: e, ...s } = l;
|
|
8
|
+
return /* @__PURE__ */ a("label", { className: `${e} ${t.label}`, ...s });
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
b as Label
|
|
12
|
+
};
|
package/dist/main.d.ts
ADDED
package/dist/main.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@plurix/ecom-components",
|
|
3
|
+
"author": "Plurix",
|
|
4
|
+
"private": false,
|
|
5
|
+
"version": "0.0.1",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/main.js",
|
|
8
|
+
"types": "dist/main.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/plurix-ecommerce/ecom-components"
|
|
15
|
+
},
|
|
16
|
+
"sideEffects": [
|
|
17
|
+
"**/*.css"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "vite",
|
|
21
|
+
"build": "tsc --p ./tsconfig-build.json && vite build",
|
|
22
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
23
|
+
"preview": "vite preview"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"react": "^18.2.0",
|
|
27
|
+
"react-dom": "^18.2.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@commitlint/cli": "^17.4.2",
|
|
31
|
+
"@commitlint/config-conventional": "^17.4.2",
|
|
32
|
+
"@types/node": "^20.11.30",
|
|
33
|
+
"@types/react": "^18.2.71",
|
|
34
|
+
"@types/react-dom": "^18.2.22",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
36
|
+
"@typescript-eslint/parser": "^6.21.0",
|
|
37
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
38
|
+
"eslint": "^8.57.0",
|
|
39
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
40
|
+
"eslint-plugin-react-refresh": "^0.4.6",
|
|
41
|
+
"glob": "^10.3.10",
|
|
42
|
+
"prettier": "^2.2.1",
|
|
43
|
+
"react": "^18.2.0",
|
|
44
|
+
"react-dom": "^18.2.0",
|
|
45
|
+
"typescript": "^5.4.3",
|
|
46
|
+
"vite": "^4.5.3",
|
|
47
|
+
"vite-plugin-dts": "^3.7.3",
|
|
48
|
+
"vite-plugin-lib-inject-css": "^2.0.1"
|
|
49
|
+
}
|
|
50
|
+
}
|