@liujip0/components 0.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 ADDED
@@ -0,0 +1,69 @@
1
+ # React + TypeScript + Vite
2
+
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) 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
+ ```
@@ -0,0 +1 @@
1
+ ._button_p3w70_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_p3w70_1:hover{filter:var(--hover-dim)}
@@ -0,0 +1 @@
1
+ ._button_osttw_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_osttw_1:hover{filter:var(--hover-dim)}
@@ -0,0 +1 @@
1
+ ._buttonFalse_upi8f_1{color:var(--color-primary);border:var(--button-border-width) solid var(--color-primary);background-color:var(--color-background)}._buttonTrue_upi8f_13{color:var(--color-primary-contrastText);border:none;background-color:var(--color-primary)}
@@ -0,0 +1 @@
1
+ ._container_1lbeu_1{display:flex;flex-direction:column}._outline_1lbeu_11{display:flex;gap:4px}._label_1lbeu_21{font-family:var(--text-font-family);font-size:var(--text-label-size)}._helperText_1lbeu_31{margin:4px 8px;font-family:var(--text-font-family);font-size:.75em;color:var(--color-primary)}._helperTextError_1lbeu_45{color:var(--color-error)}
@@ -0,0 +1,7 @@
1
+ type ButtonProps = {
2
+ children?: React.ReactNode;
3
+ className?: string;
4
+ ref?: React.Ref<HTMLButtonElement>;
5
+ } & React.ButtonHTMLAttributes<HTMLButtonElement>;
6
+ export declare function Button({ children, className, ref, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,18 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import '../../assets/Button.css';const b = "_button_p3w70_1", r = {
3
+ button: b
4
+ };
5
+ function e({ children: t, className: o, ref: n, ...u }) {
6
+ return /* @__PURE__ */ s(
7
+ "button",
8
+ {
9
+ ref: n,
10
+ className: r.button + " " + (o || ""),
11
+ ...u,
12
+ children: t
13
+ }
14
+ );
15
+ }
16
+ export {
17
+ e as Button
18
+ };
@@ -0,0 +1,6 @@
1
+ type IconButtonProps = {
2
+ children: React.ReactNode;
3
+ className?: string;
4
+ } & React.ButtonHTMLAttributes<HTMLButtonElement>;
5
+ export declare function IconButton({ children, className, ...props }: IconButtonProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,17 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import '../../../assets/IconButton.css';const u = "_button_osttw_1", b = {
3
+ button: u
4
+ };
5
+ function r({ children: t, className: o, ...n }) {
6
+ return /* @__PURE__ */ s(
7
+ "button",
8
+ {
9
+ className: b.button + " " + (o || ""),
10
+ ...n,
11
+ children: t
12
+ }
13
+ );
14
+ }
15
+ export {
16
+ r as IconButton
17
+ };
@@ -0,0 +1,20 @@
1
+ type ToggleButtonProps = {
2
+ children?: React.ReactNode;
3
+ className?: string;
4
+ classNameTrue?: string;
5
+ classNameFalse?: string;
6
+ disabled?: boolean;
7
+ ref?: React.Ref<HTMLButtonElement>;
8
+ };
9
+ type ToggleButtonPropsAsStandalone = {
10
+ value: boolean;
11
+ onChange: (value: boolean) => void;
12
+ } & ToggleButtonProps;
13
+ export type ToggleButtonPropsAsChild = {
14
+ value: string;
15
+ selected?: boolean;
16
+ onClick?: () => void;
17
+ } & ToggleButtonProps;
18
+ export declare function ToggleButton({ value, onClick, children, }: ToggleButtonPropsAsChild): React.ReactNode;
19
+ export declare function ToggleButton({ value, onChange, children, }: ToggleButtonPropsAsStandalone): React.ReactNode;
20
+ export {};
@@ -0,0 +1,32 @@
1
+ import { jsx as b } from "react/jsx-runtime";
2
+ import { Button as s } from "../Button.js";
3
+ import '../../../assets/ToggleButton.css';const f = "_buttonFalse_upi8f_1", C = "_buttonTrue_upi8f_13", e = {
4
+ buttonFalse: f,
5
+ buttonTrue: C
6
+ };
7
+ function m({
8
+ value: n,
9
+ children: o,
10
+ className: u,
11
+ classNameTrue: i,
12
+ classNameFalse: l,
13
+ disabled: c,
14
+ ref: a,
15
+ ...t
16
+ }) {
17
+ return /* @__PURE__ */ b(
18
+ s,
19
+ {
20
+ ref: a,
21
+ className: (("selected" in t ? t.selected : n) ? e.buttonTrue + " " + (i || "") : e.buttonFalse + " " + (l || "")) + " " + (u || ""),
22
+ onClick: () => {
23
+ "onChange" in t && t.onChange !== void 0 ? t.onChange(!n) : "onClick" in t && t.onClick !== void 0 && t.onClick();
24
+ },
25
+ disabled: c,
26
+ children: o
27
+ }
28
+ );
29
+ }
30
+ export {
31
+ m as ToggleButton
32
+ };
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ type ToggleButtonGroupProps = {
3
+ value: string;
4
+ onChange: (value: string) => void;
5
+ children?: React.ReactNode;
6
+ label?: string;
7
+ error?: boolean;
8
+ helperText?: string;
9
+ className?: string;
10
+ };
11
+ export declare function ToggleButtonGroup({ value, onChange, children, label, error, helperText, className, }: ToggleButtonGroupProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,39 @@
1
+ import { jsxs as _, jsx as l } from "react/jsx-runtime";
2
+ import t from "react";
3
+ import '../../../assets/ToggleButtonGroup.css';const m = "_container_1lbeu_1", x = "_outline_1lbeu_11", b = "_label_1lbeu_21", h = "_helperText_1lbeu_31", T = "_helperTextError_1lbeu_45", r = {
4
+ container: m,
5
+ outline: x,
6
+ label: b,
7
+ helperText: h,
8
+ helperTextError: T
9
+ };
10
+ function f({
11
+ value: n,
12
+ onChange: o,
13
+ children: c,
14
+ label: s,
15
+ error: i,
16
+ helperText: p,
17
+ className: a
18
+ }) {
19
+ const u = t.Children.map(c, (e) => t.isValidElement(e) ? t.cloneElement(e, {
20
+ selected: n === e.props.value,
21
+ onClick: () => {
22
+ n === e.props.value ? o("") : o(e.props.value);
23
+ }
24
+ }) : e);
25
+ return /* @__PURE__ */ _("div", { className: r.container + " " + (a || ""), children: [
26
+ s && /* @__PURE__ */ l("p", { className: r.label, children: s }),
27
+ /* @__PURE__ */ l("div", { className: r.outline, children: u }),
28
+ p && /* @__PURE__ */ l(
29
+ "p",
30
+ {
31
+ className: r.helperText + " " + (i ? r.helperTextError : ""),
32
+ children: p
33
+ }
34
+ )
35
+ ] });
36
+ }
37
+ export {
38
+ f as ToggleButtonGroup
39
+ };
package/dist/main.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export { Button } from './components/Button/Button.tsx';
2
+ export { IconButton } from './components/Button/IconButton/IconButton.tsx';
3
+ export { ToggleButton } from './components/Button/ToggleButton/ToggleButton.tsx';
4
+ export { ToggleButtonGroup } from './components/Button/ToggleButton/ToggleButtonGroup.tsx';
package/dist/main.js ADDED
@@ -0,0 +1,10 @@
1
+ import { Button as r } from "./components/Button/Button.js";
2
+ import { IconButton as n } from "./components/Button/IconButton/IconButton.js";
3
+ import { ToggleButton as u } from "./components/Button/ToggleButton/ToggleButton.js";
4
+ import { ToggleButtonGroup as g } from "./components/Button/ToggleButton/ToggleButtonGroup.js";
5
+ export {
6
+ r as Button,
7
+ n as IconButton,
8
+ u as ToggleButton,
9
+ g as ToggleButtonGroup
10
+ };
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@liujip0/components",
3
+ "private": false,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "main": "dist/main.js",
7
+ "types": "dist/main.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "peerDependencies": {
12
+ "react": "^19.1.0",
13
+ "react-dom": "^19.1.0"
14
+ },
15
+ "devDependencies": {
16
+ "react": "^19.1.0",
17
+ "react-dom": "^19.1.0",
18
+ "@eslint/js": "^9.30.1",
19
+ "@types/node": "^24.1.0",
20
+ "@types/react": "^19.1.8",
21
+ "@types/react-dom": "^19.1.6",
22
+ "@vitejs/plugin-react": "^4.6.0",
23
+ "eslint": "^9.30.1",
24
+ "eslint-plugin-react-hooks": "^5.2.0",
25
+ "eslint-plugin-react-refresh": "^0.4.20",
26
+ "glob": "^11.0.3",
27
+ "globals": "^16.3.0",
28
+ "prettier": "^3.6.2",
29
+ "typescript": "~5.8.3",
30
+ "typescript-eslint": "^8.35.1",
31
+ "vite": "^7.0.4",
32
+ "vite-plugin-dts": "^4.5.4",
33
+ "vite-plugin-lib-inject-css": "^2.2.2"
34
+ },
35
+ "sideEffects": [
36
+ "**/*.css"
37
+ ],
38
+ "scripts": {
39
+ "dev": "vite",
40
+ "build": "tsc --p ./tsconfig-build.json && vite build",
41
+ "lint": "eslint .",
42
+ "preview": "vite preview"
43
+ }
44
+ }