mui-fast-start 0.1.4 → 0.2.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 +356 -356
- package/README_KR.md +355 -0
- package/dist/components/Obj/Checkbox/ObjCheckIcon.d.ts +3 -0
- package/dist/components/Obj/Checkbox/ObjCheckIcon.d.ts.map +1 -0
- package/dist/components/Obj/Checkbox/ObjCheckbox.d.ts +3 -0
- package/dist/components/Obj/Checkbox/ObjCheckbox.d.ts.map +1 -0
- package/dist/components/Obj/Textfield/ObjFloat.d.ts +3 -0
- package/dist/components/Obj/Textfield/ObjFloat.d.ts.map +1 -0
- package/dist/components/Obj/Textfield/ObjInteger.d.ts +3 -0
- package/dist/components/Obj/Textfield/ObjInteger.d.ts.map +1 -0
- package/dist/components/Obj/Textfield/ObjText.d.ts +3 -0
- package/dist/components/Obj/Textfield/ObjText.d.ts.map +1 -0
- package/dist/components/Single/Checkbox/SingleCheckIcon.d.ts +3 -0
- package/dist/components/Single/Checkbox/SingleCheckIcon.d.ts.map +1 -0
- package/dist/components/Single/Checkbox/SingleCheckbox.d.ts +3 -0
- package/dist/components/Single/Checkbox/SingleCheckbox.d.ts.map +1 -0
- package/dist/components/Single/TextField/SingleFloat.d.ts +3 -0
- package/dist/components/Single/TextField/SingleFloat.d.ts.map +1 -0
- package/dist/components/Single/TextField/SingleInteger.d.ts +3 -0
- package/dist/components/Single/TextField/SingleInteger.d.ts.map +1 -0
- package/dist/components/Single/TextField/SingleText.d.ts +3 -0
- package/dist/components/Single/TextField/SingleText.d.ts.map +1 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/{types/hooks → hooks}/splits/useSplitSingleNumberProps.d.ts +2 -1
- package/dist/hooks/splits/useSplitSingleNumberProps.d.ts.map +1 -0
- package/dist/{types/hooks → hooks}/splits/useSplitSingleTextProps.d.ts +2 -1
- package/dist/hooks/splits/useSplitSingleTextProps.d.ts.map +1 -0
- package/dist/{types/hooks → hooks}/state/useObjToSingle.d.ts +2 -1
- package/dist/hooks/state/useObjToSingle.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +278 -0
- package/dist/styles/FastStartProvider.d.ts +21 -0
- package/dist/styles/FastStartProvider.d.ts.map +1 -0
- package/dist/styles/createDefaultProps.d.ts +3 -0
- package/dist/styles/createDefaultProps.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/{types/props.d.ts → props.d.ts} +8 -1
- package/dist/types/props.d.ts.map +1 -0
- package/dist/types/{types/provider.d.ts → provider.d.ts} +2 -1
- package/dist/types/provider.d.ts.map +1 -0
- package/dist/types/{types/types.d.ts → types.d.ts} +1 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/number/calculate.d.ts +7 -0
- package/dist/utils/number/calculate.d.ts.map +1 -0
- package/dist/utils/object/error.d.ts +4 -0
- package/dist/utils/object/error.d.ts.map +1 -0
- package/dist/utils/object/merge.d.ts +4 -0
- package/dist/utils/object/merge.d.ts.map +1 -0
- package/eslint.config.js +23 -0
- package/examples/basic/README.md +73 -0
- package/examples/basic/eslint.config.js +23 -0
- package/examples/basic/index.html +13 -0
- package/examples/basic/package.json +37 -0
- package/examples/basic/src/App.css +5 -0
- package/examples/basic/src/App.tsx +28 -0
- package/examples/basic/src/index.css +30 -0
- package/examples/basic/src/main.tsx +57 -0
- package/examples/basic/src/pages/ObjPage.tsx +93 -0
- package/examples/basic/src/pages/SinglePage.tsx +70 -0
- package/examples/basic/tsconfig.app.json +38 -0
- package/examples/basic/tsconfig.json +7 -0
- package/examples/basic/tsconfig.node.json +35 -0
- package/examples/basic/vite.config.ts +28 -0
- package/mui-fast-start-0.1.5.tgz +0 -0
- package/package.json +67 -85
- package/src/components/Obj/Checkbox/ObjCheckIcon.tsx +19 -0
- package/src/components/Obj/Checkbox/ObjCheckbox.tsx +19 -0
- package/src/components/Obj/Textfield/ObjFloat.tsx +22 -0
- package/src/components/Obj/Textfield/ObjInteger.tsx +22 -0
- package/src/components/Obj/Textfield/ObjText.tsx +22 -0
- package/src/components/Single/Checkbox/SingleCheckIcon.tsx +25 -0
- package/src/components/Single/Checkbox/SingleCheckbox.tsx +31 -0
- package/src/components/Single/TextField/SingleFloat.tsx +12 -0
- package/src/components/Single/TextField/SingleInteger.tsx +12 -0
- package/src/components/Single/TextField/SingleText.tsx +12 -0
- package/src/components/index.ts +13 -0
- package/src/hooks/splits/useSplitSingleNumberProps.ts +159 -0
- package/src/hooks/splits/useSplitSingleTextProps.ts +36 -0
- package/src/hooks/state/useObjToSingle.ts +23 -0
- package/src/index.ts +8 -0
- package/src/styles/FastStartProvider.tsx +26 -0
- package/src/styles/createDefaultProps.ts +45 -0
- package/src/types/props.ts +67 -0
- package/src/types/provider.ts +47 -0
- package/src/types/types.ts +9 -0
- package/src/utils/number/calculate.ts +102 -0
- package/src/utils/object/error.ts +14 -0
- package/src/utils/object/merge.ts +47 -0
- package/src.zip +0 -0
- package/tsconfig.json +34 -0
- package/tsconfig.lib.json +9 -0
- package/vite.config.ts +35 -0
- package/dist/index.cjs.js +0 -1
- package/dist/index.esm.js +0 -266
- package/dist/types/components/Obj/Checkbox/ObjCheckIcon.d.ts +0 -3
- package/dist/types/components/Obj/Checkbox/ObjCheckbox.d.ts +0 -3
- package/dist/types/components/Obj/Textfield/ObjFloat.d.ts +0 -3
- package/dist/types/components/Obj/Textfield/ObjInteger.d.ts +0 -3
- package/dist/types/components/Obj/Textfield/ObjText.d.ts +0 -3
- package/dist/types/components/Single/Checkbox/SingleCheckIcon.d.ts +0 -3
- package/dist/types/components/Single/Checkbox/SingleCheckbox.d.ts +0 -3
- package/dist/types/components/Single/TextField/SingleFloat.d.ts +0 -3
- package/dist/types/components/Single/TextField/SingleInteger.d.ts +0 -3
- package/dist/types/components/Single/TextField/SingleText.d.ts +0 -3
- package/dist/types/components/index.d.ts +0 -12
- package/dist/types/styles/FastStartProvider.d.ts +0 -20
- package/dist/types/styles/createDefaultProps.d.ts +0 -3
- package/dist/types/styles/index.d.ts +0 -2
- package/dist/types/utils/number/calculate.d.ts +0 -5
- package/dist/types/utils/object/merge.d.ts +0 -3
- /package/{dist/types/hooks/index.d.ts → src/hooks/index.ts} +0 -0
- /package/{dist/types/types/index.d.ts → src/types/index.ts} +0 -0
- /package/{dist/types/utils/index.d.ts → src/utils/index.ts} +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {StrictMode} from 'react'
|
|
2
|
+
import {createRoot} from 'react-dom/client'
|
|
3
|
+
import './index.css'
|
|
4
|
+
import App from './App.tsx'
|
|
5
|
+
import {createTheme, CssBaseline} from "@mui/material";
|
|
6
|
+
import { FastStartProvider, createDefaultProps } from 'mui-fast-start';
|
|
7
|
+
|
|
8
|
+
const theme = createTheme();
|
|
9
|
+
const defaultProps = createDefaultProps({
|
|
10
|
+
Single: {
|
|
11
|
+
Float: {
|
|
12
|
+
variant: 'filled',
|
|
13
|
+
size: 'medium',
|
|
14
|
+
fullWidth: false,
|
|
15
|
+
autoComplete: 'off',
|
|
16
|
+
inputMode: 'decimal',
|
|
17
|
+
type: 'text',
|
|
18
|
+
step: 0.01,
|
|
19
|
+
def: 0
|
|
20
|
+
},
|
|
21
|
+
Integer: {
|
|
22
|
+
variant: 'filled',
|
|
23
|
+
size: 'medium',
|
|
24
|
+
fullWidth: false,
|
|
25
|
+
autoComplete: 'off',
|
|
26
|
+
inputMode: 'numeric',
|
|
27
|
+
type: 'text',
|
|
28
|
+
step: 1,
|
|
29
|
+
def: 0
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
Obj: {
|
|
33
|
+
Float: {
|
|
34
|
+
variant: 'filled',
|
|
35
|
+
size: 'medium',
|
|
36
|
+
fullWidth: false,
|
|
37
|
+
autoComplete: 'off',
|
|
38
|
+
inputMode: 'decimal',
|
|
39
|
+
type: 'text',
|
|
40
|
+
step: 0.01,
|
|
41
|
+
def: 0
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
createRoot(document.getElementById('root')!).render(
|
|
47
|
+
<FastStartProvider
|
|
48
|
+
defaultProps={defaultProps}
|
|
49
|
+
theme={theme}
|
|
50
|
+
defaultMode='dark'
|
|
51
|
+
>
|
|
52
|
+
<CssBaseline/>
|
|
53
|
+
<StrictMode>
|
|
54
|
+
<App/>
|
|
55
|
+
</StrictMode>
|
|
56
|
+
</FastStartProvider>
|
|
57
|
+
)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Grid, InputAdornment, TextField } from "@mui/material";
|
|
2
|
+
import { ObjCheckbox, ObjCheckIcon, ObjFloat, ObjInteger, ObjText } from "mui-fast-start";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
|
|
5
|
+
type TempType = {
|
|
6
|
+
check1: boolean,
|
|
7
|
+
check2: boolean,
|
|
8
|
+
float: number,
|
|
9
|
+
integer: number,
|
|
10
|
+
text: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const ObjPage = () => {
|
|
14
|
+
const [error, setError] = useState<object>({
|
|
15
|
+
text: '에러 메시지',
|
|
16
|
+
})
|
|
17
|
+
const [temp, setTemp] = useState<TempType>({
|
|
18
|
+
check1: false,
|
|
19
|
+
check2: false,
|
|
20
|
+
float: 0,
|
|
21
|
+
integer: 0,
|
|
22
|
+
text: ''
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const handleTextChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
26
|
+
setTemp({...temp, text: e.target.value});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Grid container>
|
|
31
|
+
<TextField
|
|
32
|
+
fullWidth={true}
|
|
33
|
+
autoComplete="off"
|
|
34
|
+
size="small"
|
|
35
|
+
variant="outlined"
|
|
36
|
+
label='테스트'
|
|
37
|
+
value={temp.text}
|
|
38
|
+
onChange={handleTextChange}
|
|
39
|
+
/>
|
|
40
|
+
|
|
41
|
+
<Grid size={12}>
|
|
42
|
+
{JSON.stringify(temp)}
|
|
43
|
+
</Grid>
|
|
44
|
+
|
|
45
|
+
<Grid size={2}>
|
|
46
|
+
<ObjCheckbox<TempType>
|
|
47
|
+
label='테스트1' name='check1'
|
|
48
|
+
get={temp} set={setTemp}
|
|
49
|
+
/>
|
|
50
|
+
</Grid>
|
|
51
|
+
<Grid size={2}>
|
|
52
|
+
<ObjCheckIcon<TempType>
|
|
53
|
+
on='on' off='off' name='check2'
|
|
54
|
+
get={temp} set={setTemp}
|
|
55
|
+
/>
|
|
56
|
+
</Grid>
|
|
57
|
+
|
|
58
|
+
<Grid size={2}>
|
|
59
|
+
<ObjFloat<TempType>
|
|
60
|
+
label='실수형' name='float'
|
|
61
|
+
get={temp} set={setTemp}
|
|
62
|
+
errorData={error}
|
|
63
|
+
/>
|
|
64
|
+
</Grid>
|
|
65
|
+
<Grid size={2}>
|
|
66
|
+
<ObjInteger<TempType>
|
|
67
|
+
label='정수형' name='integer'
|
|
68
|
+
get={temp} set={setTemp}
|
|
69
|
+
errorData={error}
|
|
70
|
+
/>
|
|
71
|
+
</Grid>
|
|
72
|
+
<Grid size={2}>
|
|
73
|
+
<ObjText<TempType>
|
|
74
|
+
label='텍스트' name='text'
|
|
75
|
+
get={temp} set={setTemp}
|
|
76
|
+
errorData={error}
|
|
77
|
+
startAdornment={(
|
|
78
|
+
<InputAdornment position="start">
|
|
79
|
+
S
|
|
80
|
+
</InputAdornment>
|
|
81
|
+
)}
|
|
82
|
+
endAdornment={(
|
|
83
|
+
<InputAdornment position="end">
|
|
84
|
+
E
|
|
85
|
+
</InputAdornment>
|
|
86
|
+
)}
|
|
87
|
+
/>
|
|
88
|
+
</Grid>
|
|
89
|
+
</Grid>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export default ObjPage;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {Grid, InputAdornment, TextField} from "@mui/material";
|
|
2
|
+
import {SingleCheckbox, SingleCheckIcon, SingleFloat, SingleInteger, SingleText} from "mui-fast-start";
|
|
3
|
+
import React, {useState} from "react";
|
|
4
|
+
|
|
5
|
+
const SinglePage = () => {
|
|
6
|
+
const [float, setFloat] = useState<number>(0);
|
|
7
|
+
const [integer, setInteger] = useState<number>(0);
|
|
8
|
+
const [text, setText] = useState<string>('');
|
|
9
|
+
const [checked, setChecked] = useState<boolean>(false);
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<Grid container>
|
|
14
|
+
<Grid size={2}>{checked.toString()}</Grid>
|
|
15
|
+
<Grid size={2}>
|
|
16
|
+
<SingleCheckbox
|
|
17
|
+
label='테스트'
|
|
18
|
+
get={checked} set={setChecked}
|
|
19
|
+
/>
|
|
20
|
+
</Grid>
|
|
21
|
+
|
|
22
|
+
<Grid size={2}>{checked.toString()}</Grid>
|
|
23
|
+
<Grid size={2}>
|
|
24
|
+
<SingleCheckIcon
|
|
25
|
+
on={"on"} off={"off"}
|
|
26
|
+
get={checked} set={setChecked}
|
|
27
|
+
/>
|
|
28
|
+
</Grid>
|
|
29
|
+
|
|
30
|
+
<Grid size={2}>{float}</Grid>
|
|
31
|
+
<Grid size={2}>
|
|
32
|
+
<SingleFloat
|
|
33
|
+
label='실수형'
|
|
34
|
+
min={-100} max={100}
|
|
35
|
+
get={float} set={setFloat}
|
|
36
|
+
/>
|
|
37
|
+
</Grid>
|
|
38
|
+
|
|
39
|
+
<Grid size={2}>{integer}</Grid>
|
|
40
|
+
<Grid size={2}>
|
|
41
|
+
<SingleInteger
|
|
42
|
+
label='정수형'
|
|
43
|
+
min={-100} max={100}
|
|
44
|
+
startAdornment={(
|
|
45
|
+
<InputAdornment position="start">
|
|
46
|
+
S
|
|
47
|
+
</InputAdornment>
|
|
48
|
+
)}
|
|
49
|
+
endAdornment={(
|
|
50
|
+
<InputAdornment position="end">
|
|
51
|
+
E
|
|
52
|
+
</InputAdornment>
|
|
53
|
+
)}
|
|
54
|
+
get={integer} set={setInteger}
|
|
55
|
+
/>
|
|
56
|
+
</Grid>
|
|
57
|
+
|
|
58
|
+
<Grid size={2}>{text}</Grid>
|
|
59
|
+
<Grid size={2}>
|
|
60
|
+
<SingleText
|
|
61
|
+
label='텍스트'
|
|
62
|
+
maxLength={10}
|
|
63
|
+
get={text} set={setText}
|
|
64
|
+
/>
|
|
65
|
+
</Grid>
|
|
66
|
+
</Grid>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default SinglePage;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"useDefineForClassFields": true,
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"types": ["vite/client"],
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
|
|
11
|
+
/* Bundler mode */
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"moduleDetection": "force",
|
|
16
|
+
"noEmit": true,
|
|
17
|
+
"jsx": "react-jsx",
|
|
18
|
+
|
|
19
|
+
/* Path alias for local library development */
|
|
20
|
+
// "baseUrl": ".",
|
|
21
|
+
// "paths": {
|
|
22
|
+
// "mui-fast-start": ["../../src/index.ts"],
|
|
23
|
+
// "mui-fast-start/styles": ["../../src/styles/index.ts"],
|
|
24
|
+
// "mui-fast-start/hooks": ["../../src/hooks/index.ts"],
|
|
25
|
+
// "mui-fast-start/types": ["../../src/types/index.ts"]
|
|
26
|
+
// },
|
|
27
|
+
|
|
28
|
+
/* Linting */
|
|
29
|
+
"strict": true,
|
|
30
|
+
"noUnusedLocals": true,
|
|
31
|
+
"noUnusedParameters": true,
|
|
32
|
+
"erasableSyntaxOnly": true,
|
|
33
|
+
"noFallthroughCasesInSwitch": true,
|
|
34
|
+
"noUncheckedSideEffectImports": true,
|
|
35
|
+
"allowSyntheticDefaultImports": true
|
|
36
|
+
},
|
|
37
|
+
"include": ["src", "../../src"]
|
|
38
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "ES2023",
|
|
5
|
+
"lib": ["ES2023"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
|
|
10
|
+
/* Bundler mode */
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"allowImportingTsExtensions": true,
|
|
13
|
+
"verbatimModuleSyntax": true,
|
|
14
|
+
"moduleDetection": "force",
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
|
|
17
|
+
/* Path alias for local library development */
|
|
18
|
+
// "baseUrl": ".",
|
|
19
|
+
// "paths": {
|
|
20
|
+
// "mui-fast-start": ["../../src/index.ts"],
|
|
21
|
+
// "mui-fast-start/styles": ["../../src/styles/index.ts"],
|
|
22
|
+
// "mui-fast-start/hooks": ["../../src/hooks/index.ts"],
|
|
23
|
+
// "mui-fast-start/types": ["../../src/types/index.ts"]
|
|
24
|
+
// },
|
|
25
|
+
|
|
26
|
+
/* Linting */
|
|
27
|
+
"strict": true,
|
|
28
|
+
"noUnusedLocals": true,
|
|
29
|
+
"noUnusedParameters": true,
|
|
30
|
+
"erasableSyntaxOnly": true,
|
|
31
|
+
"noFallthroughCasesInSwitch": true,
|
|
32
|
+
"noUncheckedSideEffectImports": true
|
|
33
|
+
},
|
|
34
|
+
"include": ["vite.config.ts"]
|
|
35
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import react from '@vitejs/plugin-react'
|
|
3
|
+
import { resolve } from 'path'
|
|
4
|
+
|
|
5
|
+
const libRoot = resolve(__dirname, '../../src');
|
|
6
|
+
|
|
7
|
+
// https://vite.dev/config/
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
plugins: [react()],
|
|
10
|
+
resolve: {
|
|
11
|
+
alias: {
|
|
12
|
+
// 'mui-fast-start/styles': resolve(libRoot, 'styles/index.ts'),
|
|
13
|
+
// 'mui-fast-start/hooks': resolve(libRoot, 'hooks/index.ts'),
|
|
14
|
+
// 'mui-fast-start/types': resolve(libRoot, 'types/index.ts'),
|
|
15
|
+
'mui-fast-start': resolve(libRoot, 'index.ts'),
|
|
16
|
+
//
|
|
17
|
+
// '@': libRoot,
|
|
18
|
+
// '@components': resolve(libRoot, 'components'),
|
|
19
|
+
// '@hooks': resolve(libRoot, 'hooks'),
|
|
20
|
+
// '@styles': resolve(libRoot, 'styles'),
|
|
21
|
+
// '@types': resolve(libRoot, 'types'),
|
|
22
|
+
// '@utils': resolve(libRoot, 'utils'),
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
optimizeDeps: {
|
|
26
|
+
exclude: ['mui-fast-start']
|
|
27
|
+
}
|
|
28
|
+
})
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,85 +1,67 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mui-fast-start",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Fast and easy-to-use MUI components for React",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"mui",
|
|
7
|
-
"material-ui",
|
|
8
|
-
"react",
|
|
9
|
-
"components",
|
|
10
|
-
"form"
|
|
11
|
-
],
|
|
12
|
-
"author": "PersesTitan",
|
|
13
|
-
"license": "MIT",
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"react": "
|
|
58
|
-
"react-dom": "
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"@types/node": "^24.10.1",
|
|
69
|
-
"@types/react": "^19.2.5",
|
|
70
|
-
"@types/react-dom": "^19.2.3",
|
|
71
|
-
"@vitejs/plugin-react": "^5.1.1",
|
|
72
|
-
"eslint": "^9.39.1",
|
|
73
|
-
"eslint-plugin-react-hooks": "^7.0.1",
|
|
74
|
-
"eslint-plugin-react-refresh": "^0.4.24",
|
|
75
|
-
"globals": "^16.5.0",
|
|
76
|
-
"react": "^19.2.0",
|
|
77
|
-
"react-dom": "^19.2.0",
|
|
78
|
-
"typescript": "~5.9.3",
|
|
79
|
-
"typescript-eslint": "^8.46.4",
|
|
80
|
-
"vite": "npm:rolldown-vite@7.2.5"
|
|
81
|
-
},
|
|
82
|
-
"overrides": {
|
|
83
|
-
"vite": "npm:rolldown-vite@7.2.5"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "mui-fast-start",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Fast and easy-to-use MUI components for React",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mui",
|
|
7
|
+
"material-ui",
|
|
8
|
+
"react",
|
|
9
|
+
"components",
|
|
10
|
+
"form"
|
|
11
|
+
],
|
|
12
|
+
"author": "PersesTitan",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/PersesTitan/mui-fast-start.git"
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "dist/index.js",
|
|
21
|
+
"module": "dist/index.js",
|
|
22
|
+
"types": "dist/index.d.ts",
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"scripts": {
|
|
25
|
+
"dev": "vite",
|
|
26
|
+
"build": "vite build && tsc -p tsconfig.json",
|
|
27
|
+
"lint": "eslint .",
|
|
28
|
+
"preview": "vite preview",
|
|
29
|
+
"prepublishOnly": "npm run build"
|
|
30
|
+
},
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"import": "./dist/index.js",
|
|
34
|
+
"types": "./dist/index.d.ts"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"@emotion/react": ">=11",
|
|
39
|
+
"@emotion/styled": ">=11",
|
|
40
|
+
"@mui/material": ">=6",
|
|
41
|
+
"react": ">=18",
|
|
42
|
+
"react-dom": ">=18"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@emotion/react": "^11.14.0",
|
|
46
|
+
"@emotion/styled": "^11.14.1",
|
|
47
|
+
"@eslint/js": "^9.39.1",
|
|
48
|
+
"@mui/material": "^7.1.1",
|
|
49
|
+
"@types/node": "^24.10.1",
|
|
50
|
+
"@types/react": "^19.2.5",
|
|
51
|
+
"@types/react-dom": "^19.2.3",
|
|
52
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
53
|
+
"eslint": "^9.39.1",
|
|
54
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
55
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
56
|
+
"globals": "^16.5.0",
|
|
57
|
+
"react": "^19.2.0",
|
|
58
|
+
"react-dom": "^19.2.0",
|
|
59
|
+
"tsc-alias": "^1.8.16",
|
|
60
|
+
"typescript": "~5.9.3",
|
|
61
|
+
"typescript-eslint": "^8.46.4",
|
|
62
|
+
"vite": "npm:rolldown-vite@7.2.5"
|
|
63
|
+
},
|
|
64
|
+
"overrides": {
|
|
65
|
+
"vite": "npm:rolldown-vite@7.2.5"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {useContext} from "react";
|
|
2
|
+
import {DeepPartial, ObjCheckIconProps, SingleCheckIconProps} from "../../../types";
|
|
3
|
+
import {fastDeepMerge} from "../../../utils";
|
|
4
|
+
import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
|
|
5
|
+
import {SingleCheckIcon} from "../../Single/Checkbox/SingleCheckIcon.tsx";
|
|
6
|
+
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
7
|
+
|
|
8
|
+
export const ObjCheckIcon = <T extends object>(customProps: ObjCheckIconProps<T>) => {
|
|
9
|
+
const defaultProps = useContext(FastStartContext)?.Obj?.CheckIcon as DeepPartial<ObjCheckIconProps<T>>;
|
|
10
|
+
const {get, set, ...props} = fastDeepMerge<ObjCheckIconProps<T>>(defaultProps, customProps);
|
|
11
|
+
const [value, setValue] = useObjToSingle<T, boolean>(props.name, get, set);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<SingleCheckIcon
|
|
15
|
+
get={value} set={setValue}
|
|
16
|
+
{...(props as unknown as Omit<SingleCheckIconProps, 'get' | 'set'>)}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, {useContext} from "react";
|
|
2
|
+
import useObjToSingle from '../../../hooks/state/useObjToSingle.ts';
|
|
3
|
+
import {fastDeepMerge} from "../../../utils";
|
|
4
|
+
import {DeepPartial, ObjCheckboxProps, SingleCheckboxProps} from "../../../types";
|
|
5
|
+
import {SingleCheckbox} from "../../Single/Checkbox/SingleCheckbox.tsx";
|
|
6
|
+
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
7
|
+
|
|
8
|
+
export const ObjCheckbox = <T extends object>(customProps: ObjCheckboxProps<T>) => {
|
|
9
|
+
const defaultProps = useContext(FastStartContext)?.Obj?.Checkbox as DeepPartial<ObjCheckboxProps<T>>;
|
|
10
|
+
const {get, set, ...props} = fastDeepMerge<ObjCheckboxProps<T>>(defaultProps, customProps);
|
|
11
|
+
const [value, setValue] = useObjToSingle<T, boolean>(props.name, get, set);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<SingleCheckbox
|
|
15
|
+
get={value} set={setValue}
|
|
16
|
+
{...(props as unknown as Omit<SingleCheckboxProps, 'set' | 'get'>)}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {useContext} from "react";
|
|
2
|
+
import {DeepPartial, ObjNumberProps, SingleNumberProps} from "../../../types";
|
|
3
|
+
import {fastDeepMerge} from "../../../utils";
|
|
4
|
+
import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
|
|
5
|
+
import {SingleFloat} from "../../Single/TextField/SingleFloat.tsx";
|
|
6
|
+
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
7
|
+
import {errorObjectToString} from "../../../utils/object/error.ts";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export const ObjFloat = <T extends object>(customProps: ObjNumberProps<T>) => {
|
|
11
|
+
const defaultProps = useContext(FastStartContext)?.Obj?.Float as DeepPartial<ObjNumberProps<T>>;
|
|
12
|
+
const {get, set, errorData, ...props} = fastDeepMerge<ObjNumberProps<T>>(defaultProps, customProps);
|
|
13
|
+
const [value, setValue] = useObjToSingle<T, number>(props.name, get, set);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<SingleFloat
|
|
17
|
+
get={value} set={setValue}
|
|
18
|
+
errorData={errorObjectToString(props.name, errorData)}
|
|
19
|
+
{...(props as unknown as Omit<SingleNumberProps, 'get' | 'set' | 'errorData'>)}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import {DeepPartial, ObjNumberProps, SingleNumberProps} from "../../../types";
|
|
3
|
+
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
4
|
+
import {fastDeepMerge} from "../../../utils";
|
|
5
|
+
import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
|
|
6
|
+
import {SingleInteger} from "../../Single/TextField/SingleInteger.tsx";
|
|
7
|
+
import {errorObjectToString} from "../../../utils/object/error.ts";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export const ObjInteger = <T extends object>(customProps: ObjNumberProps<T>) => {
|
|
11
|
+
const defaultProps = useContext(FastStartContext)?.Obj?.Integer as DeepPartial<ObjNumberProps<T>>;
|
|
12
|
+
const {get, set, errorData, ...props} = fastDeepMerge<ObjNumberProps<T>>(defaultProps, customProps);
|
|
13
|
+
const [value, setValue] = useObjToSingle<T, number>(props.name, get, set);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<SingleInteger
|
|
17
|
+
get={value} set={setValue}
|
|
18
|
+
errorData={errorObjectToString(props.name, errorData)}
|
|
19
|
+
{...(props as unknown as Omit<SingleNumberProps, 'get' | 'set' | 'errorData'>)}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import {DeepPartial, ObjTextProps, SingleTextProps} from "../../../types";
|
|
3
|
+
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
4
|
+
import {fastDeepMerge} from "../../../utils";
|
|
5
|
+
import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
|
|
6
|
+
import {SingleText} from "../../Single/TextField/SingleText.tsx";
|
|
7
|
+
import {errorObjectToString} from "../../../utils/object/error.ts";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export const ObjText = <T extends object>(customProps: ObjTextProps<T>) => {
|
|
11
|
+
const defaultProps = useContext(FastStartContext)?.Obj?.Text as DeepPartial<ObjTextProps<T>>;
|
|
12
|
+
const {get, set, errorData, ...props} = fastDeepMerge<ObjTextProps<T>>(defaultProps, customProps);
|
|
13
|
+
const [value, setValue] = useObjToSingle<T, string>(props.name, get, set);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<SingleText
|
|
17
|
+
get={value} set={setValue}
|
|
18
|
+
errorData={errorObjectToString(props.name, errorData)}
|
|
19
|
+
{...(props as unknown as Omit<SingleTextProps, 'get' | 'set' | 'errorData'>)}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {useCallback, useContext} from "react";
|
|
2
|
+
import {IconButton} from "@mui/material";
|
|
3
|
+
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
4
|
+
import {SingleCheckIconProps} from "../../../types";
|
|
5
|
+
import {fastDeepMerge} from "../../../utils";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export const SingleCheckIcon = (customProps: SingleCheckIconProps) => {
|
|
9
|
+
const defaultProps = useContext(FastStartContext)?.Single?.CheckIcon;
|
|
10
|
+
const {
|
|
11
|
+
get, set, on, off,
|
|
12
|
+
...props
|
|
13
|
+
} = fastDeepMerge<SingleCheckIconProps>(defaultProps, customProps);
|
|
14
|
+
|
|
15
|
+
const onClick = useCallback(() => set((state) => !state), [set]);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<IconButton
|
|
19
|
+
onClick={onClick}
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
{get ? on : off}
|
|
23
|
+
</IconButton>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {Checkbox, FormControlLabel} from "@mui/material";
|
|
2
|
+
import React, {useCallback, useContext} from "react";
|
|
3
|
+
import {SingleCheckboxProps} from "../../../types";
|
|
4
|
+
import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
|
|
5
|
+
import {fastDeepMerge} from "../../../utils";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export const SingleCheckbox = (customProps: SingleCheckboxProps) => {
|
|
9
|
+
const defaultProps = useContext(FastStartContext)?.Single?.Checkbox;
|
|
10
|
+
const {
|
|
11
|
+
get, set, label,
|
|
12
|
+
...props
|
|
13
|
+
} = fastDeepMerge<SingleCheckboxProps>(defaultProps, customProps);
|
|
14
|
+
|
|
15
|
+
const onChange = useCallback(() => set((state) => !state), [set]);
|
|
16
|
+
|
|
17
|
+
return label == null ? (
|
|
18
|
+
<Checkbox
|
|
19
|
+
checked={get}
|
|
20
|
+
onChange={onChange}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
) : (
|
|
24
|
+
<FormControlLabel
|
|
25
|
+
checked={get}
|
|
26
|
+
label={label}
|
|
27
|
+
onChange={onChange}
|
|
28
|
+
control={<Checkbox {...props}/>}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
};
|