@liujip0/components 0.0.0 → 0.0.2
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 +2 -68
- package/dist/assets/Button.css +1 -1
- package/dist/assets/IconButton.css +1 -1
- package/dist/assets/ToggleButton.css +1 -1
- package/dist/assets/ToggleButtonGroup.css +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/IconButton/IconButton.js +4 -4
- package/dist/components/Button/ToggleButton/ToggleButton.js +15 -15
- package/dist/components/Button/ToggleButton/ToggleButtonGroup.js +14 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,69 +1,3 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @liujip0/components
|
|
2
2
|
|
|
3
|
-
|
|
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) uses [Babel](https://babeljs.io/) for Fast Refresh
|
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/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
|
-
```js
|
|
15
|
-
export default tseslint.config([
|
|
16
|
-
globalIgnores(['dist']),
|
|
17
|
-
{
|
|
18
|
-
files: ['**/*.{ts,tsx}'],
|
|
19
|
-
extends: [
|
|
20
|
-
// Other configs...
|
|
21
|
-
|
|
22
|
-
// Remove tseslint.configs.recommended and replace with this
|
|
23
|
-
...tseslint.configs.recommendedTypeChecked,
|
|
24
|
-
// Alternatively, use this for stricter rules
|
|
25
|
-
...tseslint.configs.strictTypeChecked,
|
|
26
|
-
// Optionally, add this for stylistic rules
|
|
27
|
-
...tseslint.configs.stylisticTypeChecked,
|
|
28
|
-
|
|
29
|
-
// Other configs...
|
|
30
|
-
],
|
|
31
|
-
languageOptions: {
|
|
32
|
-
parserOptions: {
|
|
33
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
34
|
-
tsconfigRootDir: import.meta.dirname,
|
|
35
|
-
},
|
|
36
|
-
// other options...
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
])
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
43
|
-
|
|
44
|
-
```js
|
|
45
|
-
// eslint.config.js
|
|
46
|
-
import reactX from 'eslint-plugin-react-x'
|
|
47
|
-
import reactDom from 'eslint-plugin-react-dom'
|
|
48
|
-
|
|
49
|
-
export default tseslint.config([
|
|
50
|
-
globalIgnores(['dist']),
|
|
51
|
-
{
|
|
52
|
-
files: ['**/*.{ts,tsx}'],
|
|
53
|
-
extends: [
|
|
54
|
-
// Other configs...
|
|
55
|
-
// Enable lint rules for React
|
|
56
|
-
reactX.configs['recommended-typescript'],
|
|
57
|
-
// Enable lint rules for React DOM
|
|
58
|
-
reactDom.configs.recommended,
|
|
59
|
-
],
|
|
60
|
-
languageOptions: {
|
|
61
|
-
parserOptions: {
|
|
62
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
63
|
-
tsconfigRootDir: import.meta.dirname,
|
|
64
|
-
},
|
|
65
|
-
// other options...
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
])
|
|
69
|
-
```
|
|
3
|
+
Just a simple components library for my own personal use!
|
package/dist/assets/Button.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._button_7qhy4_1{min-width:64px;padding:6px 16px;border:none;border-radius:var(--border-radius);display:flex;align-items:center;justify-content:center;gap:4px;font-size:1.25rem;font-family:var(--text-font-family);text-transform:uppercase;font-weight:500;line-height:1.75;letter-spacing:.02857em;cursor:pointer}._button_7qhy4_1:hover{filter:var(--hover-dim)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._button_rs8jj_1{display:flex;align-items:center;justify-content:center;padding:6px;border:none;color:var(--color-primary);background-color:var(--color-background);cursor:pointer;clip-path:circle(50%)}._button_rs8jj_1:hover{filter:var(--hover-dim)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._buttonFalse_1ssvl_1{color:var(--color-primary);border:var(--button-border-width) solid var(--color-primary);background-color:var(--color-background)}._buttonTrue_1ssvl_7{color:var(--color-primary-contrastText);border:none;background-color:var(--color-primary)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._container_12l5n_1{display:flex;flex-direction:column}._outline_12l5n_6{display:flex;gap:4px}._label_12l5n_11{font-family:var(--text-font-family);font-size:var(--text-label-size)}._helperText_12l5n_16{margin:4px 8px;font-family:var(--text-font-family);font-size:.75em;color:var(--color-primary)}._helperTextError_12l5n_23{color:var(--color-error)}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import '../../../assets/IconButton.css';const u = "
|
|
2
|
+
import '../../../assets/IconButton.css';const u = "_button_rs8jj_1", r = {
|
|
3
3
|
button: u
|
|
4
4
|
};
|
|
5
|
-
function
|
|
5
|
+
function c({ children: t, className: o, ...n }) {
|
|
6
6
|
return /* @__PURE__ */ s(
|
|
7
7
|
"button",
|
|
8
8
|
{
|
|
9
|
-
className:
|
|
9
|
+
className: r.button + " " + (o || ""),
|
|
10
10
|
...n,
|
|
11
11
|
children: t
|
|
12
12
|
}
|
|
13
13
|
);
|
|
14
14
|
}
|
|
15
15
|
export {
|
|
16
|
-
|
|
16
|
+
c as IconButton
|
|
17
17
|
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Button as
|
|
3
|
-
import '../../../assets/ToggleButton.css';const
|
|
4
|
-
buttonFalse:
|
|
5
|
-
buttonTrue:
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { Button as b } from "../Button.js";
|
|
3
|
+
import '../../../assets/ToggleButton.css';const C = "_buttonFalse_1ssvl_1", _ = "_buttonTrue_1ssvl_7", e = {
|
|
4
|
+
buttonFalse: C,
|
|
5
|
+
buttonTrue: _
|
|
6
6
|
};
|
|
7
7
|
function m({
|
|
8
8
|
value: n,
|
|
9
9
|
children: o,
|
|
10
|
-
className:
|
|
11
|
-
classNameTrue:
|
|
12
|
-
classNameFalse:
|
|
13
|
-
disabled:
|
|
14
|
-
ref:
|
|
10
|
+
className: l,
|
|
11
|
+
classNameTrue: u,
|
|
12
|
+
classNameFalse: i,
|
|
13
|
+
disabled: s,
|
|
14
|
+
ref: c,
|
|
15
15
|
...t
|
|
16
16
|
}) {
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
|
|
17
|
+
return /* @__PURE__ */ a(
|
|
18
|
+
b,
|
|
19
19
|
{
|
|
20
|
-
ref:
|
|
21
|
-
className: (("selected" in t ? t.selected : n) ? e.buttonTrue + " " + (
|
|
20
|
+
ref: c,
|
|
21
|
+
className: (("selected" in t ? t.selected : n) ? e.buttonTrue + " " + (u || "") : e.buttonFalse + " " + (i || "")) + " " + (l || ""),
|
|
22
22
|
onClick: () => {
|
|
23
23
|
"onChange" in t && t.onChange !== void 0 ? t.onChange(!n) : "onClick" in t && t.onClick !== void 0 && t.onClick();
|
|
24
24
|
},
|
|
25
|
-
disabled:
|
|
25
|
+
disabled: s,
|
|
26
26
|
children: o
|
|
27
27
|
}
|
|
28
28
|
);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import '../../../assets/ToggleButtonGroup.css';const m = "
|
|
1
|
+
import { jsxs as u, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import n from "react";
|
|
3
|
+
import '../../../assets/ToggleButtonGroup.css';const m = "_container_12l5n_1", x = "_outline_12l5n_6", h = "_label_12l5n_11", T = "_helperText_12l5n_16", E = "_helperTextError_12l5n_23", r = {
|
|
4
4
|
container: m,
|
|
5
5
|
outline: x,
|
|
6
|
-
label:
|
|
7
|
-
helperText:
|
|
8
|
-
helperTextError:
|
|
6
|
+
label: h,
|
|
7
|
+
helperText: T,
|
|
8
|
+
helperTextError: E
|
|
9
9
|
};
|
|
10
|
-
function
|
|
11
|
-
value:
|
|
10
|
+
function v({
|
|
11
|
+
value: t,
|
|
12
12
|
onChange: o,
|
|
13
13
|
children: c,
|
|
14
14
|
label: s,
|
|
@@ -16,15 +16,15 @@ function f({
|
|
|
16
16
|
helperText: p,
|
|
17
17
|
className: a
|
|
18
18
|
}) {
|
|
19
|
-
const
|
|
20
|
-
selected:
|
|
19
|
+
const _ = n.Children.map(c, (e) => n.isValidElement(e) ? n.cloneElement(e, {
|
|
20
|
+
selected: t === e.props.value,
|
|
21
21
|
onClick: () => {
|
|
22
|
-
|
|
22
|
+
t === e.props.value ? o("") : o(e.props.value);
|
|
23
23
|
}
|
|
24
24
|
}) : e);
|
|
25
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ u("div", { className: r.container + " " + (a || ""), children: [
|
|
26
26
|
s && /* @__PURE__ */ l("p", { className: r.label, children: s }),
|
|
27
|
-
/* @__PURE__ */ l("div", { className: r.outline, children:
|
|
27
|
+
/* @__PURE__ */ l("div", { className: r.outline, children: _ }),
|
|
28
28
|
p && /* @__PURE__ */ l(
|
|
29
29
|
"p",
|
|
30
30
|
{
|
|
@@ -35,5 +35,5 @@ function f({
|
|
|
35
35
|
] });
|
|
36
36
|
}
|
|
37
37
|
export {
|
|
38
|
-
|
|
38
|
+
v as ToggleButtonGroup
|
|
39
39
|
};
|