mui-fast-start 0.3.2 → 0.3.3

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.
Files changed (62) hide show
  1. package/README.md +403 -403
  2. package/README_KR.md +403 -403
  3. package/dist/components/Object/Select/ObjSelectRecord.d.ts +2 -1
  4. package/dist/components/Object/Select/ObjSelectRecord.d.ts.map +1 -1
  5. package/dist/components/Single/Select/SingleSelectRecord.d.ts +2 -1
  6. package/dist/components/Single/Select/SingleSelectRecord.d.ts.map +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/styles/FastStartProps.d.ts +2 -1
  9. package/dist/styles/FastStartProps.d.ts.map +1 -1
  10. package/dist/types/props.d.ts +1 -1
  11. package/dist/types/props.d.ts.map +1 -1
  12. package/dist/types/provider.d.ts +2 -1
  13. package/dist/types/provider.d.ts.map +1 -1
  14. package/examples/basic/README.md +73 -73
  15. package/examples/basic/eslint.config.js +23 -23
  16. package/examples/basic/index.html +13 -13
  17. package/examples/basic/package.json +37 -37
  18. package/examples/basic/src/App.css +4 -4
  19. package/examples/basic/src/App.tsx +28 -28
  20. package/examples/basic/src/index.css +29 -29
  21. package/examples/basic/src/main.tsx +50 -50
  22. package/examples/basic/src/pages/ObjPage.tsx +175 -175
  23. package/examples/basic/src/pages/SinglePage.tsx +137 -137
  24. package/examples/basic/tsconfig.app.json +43 -43
  25. package/examples/basic/tsconfig.json +7 -7
  26. package/examples/basic/tsconfig.node.json +40 -40
  27. package/examples/basic/vite.config.ts +28 -28
  28. package/mui-fast-start-0.1.4.tgz +0 -0
  29. package/package.json +67 -67
  30. package/src/components/Object/Checkbox/ObjCheckIcon.tsx +29 -29
  31. package/src/components/Object/Checkbox/ObjCheckbox.tsx +31 -31
  32. package/src/components/Object/Select/ObjSelectOne.tsx +33 -33
  33. package/src/components/Object/Select/ObjSelectRecord.tsx +33 -33
  34. package/src/components/Object/Textfield/ObjNumber.tsx +51 -51
  35. package/src/components/Object/Textfield/ObjText.tsx +29 -29
  36. package/src/components/Single/Checkbox/SingleCheckIcon.tsx +27 -27
  37. package/src/components/Single/Checkbox/SingleCheckbox.tsx +33 -33
  38. package/src/components/Single/Select/BaseSingleSelect.tsx +45 -45
  39. package/src/components/Single/Select/SingleSelectOne.tsx +56 -56
  40. package/src/components/Single/Select/SingleSelectRecord.tsx +51 -51
  41. package/src/components/Single/TextField/SingleNumber.tsx +18 -18
  42. package/src/components/Single/TextField/SingleText.tsx +13 -13
  43. package/src/components/index.ts +15 -15
  44. package/src/hooks/index.ts +3 -3
  45. package/src/hooks/splits/useSplitNumberProps.ts +161 -161
  46. package/src/hooks/splits/useSplitTextProps.ts +36 -36
  47. package/src/hooks/state/useObjToSingle.ts +24 -24
  48. package/src/index.ts +7 -7
  49. package/src/styles/FastStartProps.ts +82 -81
  50. package/src/styles/FastStartProvider.tsx +25 -25
  51. package/src/types/index.ts +3 -3
  52. package/src/types/props.internal.ts +21 -21
  53. package/src/types/props.ts +81 -81
  54. package/src/types/provider.ts +72 -71
  55. package/src/types/types.ts +9 -9
  56. package/src/utils/index.ts +2 -2
  57. package/src/utils/number/calculate.ts +102 -102
  58. package/src/utils/object/error.ts +15 -15
  59. package/src/utils/object/merge.ts +47 -47
  60. package/tsconfig.json +34 -34
  61. package/tsconfig.lib.json +9 -9
  62. package/vite.config.ts +35 -35
@@ -1,43 +1,43 @@
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
- "baseUrl": ".",
20
- "paths": {
21
- "mui-fast-start": ["../../src/index.ts"]
22
- },
23
-
24
- /* Path alias for local library development */
25
- // "baseUrl": ".",
26
- // "paths": {
27
- // "mui-fast-start": ["../../src/index.ts"],
28
- // "mui-fast-start/styles": ["../../src/styles/index.ts"],
29
- // "mui-fast-start/hooks": ["../../src/hooks/index.ts"],
30
- // "mui-fast-start/types": ["../../src/types/index.ts"]
31
- // },
32
-
33
- /* Linting */
34
- "strict": true,
35
- "noUnusedLocals": true,
36
- "noUnusedParameters": true,
37
- "erasableSyntaxOnly": true,
38
- "noFallthroughCasesInSwitch": true,
39
- "noUncheckedSideEffectImports": true,
40
- "allowSyntheticDefaultImports": true
41
- },
42
- "include": ["src", "../../src"]
43
- }
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
+ "baseUrl": ".",
20
+ "paths": {
21
+ "mui-fast-start": ["../../src/index.ts"]
22
+ },
23
+
24
+ /* Path alias for local library development */
25
+ // "baseUrl": ".",
26
+ // "paths": {
27
+ // "mui-fast-start": ["../../src/index.ts"],
28
+ // "mui-fast-start/styles": ["../../src/styles/index.ts"],
29
+ // "mui-fast-start/hooks": ["../../src/hooks/index.ts"],
30
+ // "mui-fast-start/types": ["../../src/types/index.ts"]
31
+ // },
32
+
33
+ /* Linting */
34
+ "strict": true,
35
+ "noUnusedLocals": true,
36
+ "noUnusedParameters": true,
37
+ "erasableSyntaxOnly": true,
38
+ "noFallthroughCasesInSwitch": true,
39
+ "noUncheckedSideEffectImports": true,
40
+ "allowSyntheticDefaultImports": true
41
+ },
42
+ "include": ["src", "../../src"]
43
+ }
@@ -1,7 +1,7 @@
1
- {
2
- "files": [],
3
- "references": [
4
- { "path": "./tsconfig.app.json" },
5
- { "path": "./tsconfig.node.json" }
6
- ]
7
- }
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ { "path": "./tsconfig.app.json" },
5
+ { "path": "./tsconfig.node.json" }
6
+ ]
7
+ }
@@ -1,40 +1,40 @@
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
- "baseUrl": ".",
18
- "paths": {
19
- "mui-fast-start": ["../../src/index.ts"]
20
- },
21
-
22
- /* Path alias for local library development */
23
- // "baseUrl": ".",
24
- // "paths": {
25
- // "mui-fast-start": ["../../src/index.ts"],
26
- // "mui-fast-start/styles": ["../../src/styles/index.ts"],
27
- // "mui-fast-start/hooks": ["../../src/hooks/index.ts"],
28
- // "mui-fast-start/types": ["../../src/types/index.ts"]
29
- // },
30
-
31
- /* Linting */
32
- "strict": true,
33
- "noUnusedLocals": true,
34
- "noUnusedParameters": true,
35
- "erasableSyntaxOnly": true,
36
- "noFallthroughCasesInSwitch": true,
37
- "noUncheckedSideEffectImports": true
38
- },
39
- "include": ["vite.config.ts"]
40
- }
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
+ "baseUrl": ".",
18
+ "paths": {
19
+ "mui-fast-start": ["../../src/index.ts"]
20
+ },
21
+
22
+ /* Path alias for local library development */
23
+ // "baseUrl": ".",
24
+ // "paths": {
25
+ // "mui-fast-start": ["../../src/index.ts"],
26
+ // "mui-fast-start/styles": ["../../src/styles/index.ts"],
27
+ // "mui-fast-start/hooks": ["../../src/hooks/index.ts"],
28
+ // "mui-fast-start/types": ["../../src/types/index.ts"]
29
+ // },
30
+
31
+ /* Linting */
32
+ "strict": true,
33
+ "noUnusedLocals": true,
34
+ "noUnusedParameters": true,
35
+ "erasableSyntaxOnly": true,
36
+ "noFallthroughCasesInSwitch": true,
37
+ "noUncheckedSideEffectImports": true
38
+ },
39
+ "include": ["vite.config.ts"]
40
+ }
@@ -1,28 +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
- })
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,67 +1,67 @@
1
- {
2
- "name": "mui-fast-start",
3
- "version": "0.3.2",
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
- }
1
+ {
2
+ "name": "mui-fast-start",
3
+ "version": "0.3.3",
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
+ }
@@ -1,29 +1,29 @@
1
- import {useContext} from "react";
2
- import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
3
- import {SingleCheckIcon} from "../../Single/Checkbox/SingleCheckIcon.tsx";
4
- import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
5
- import {IconButtonProps} from "@mui/material";
6
- import {MfsObjectCheckIconProps} from "../../../types";
7
-
8
-
9
- export const ObjCheckIcon = <T extends object>(
10
- customProps: Omit<IconButtonProps, 'name'> & MfsObjectCheckIconProps<T>
11
- ) => {
12
- const defaultProps = useContext(FastStartContext)?.Object?.MfsCheckIcon;
13
- const {
14
- get, set, name,
15
- ...props
16
- } = defaultProps == null
17
- ? customProps
18
- : Object.assign({...defaultProps}, customProps);
19
-
20
- const [value, setValue] = useObjToSingle<T, boolean>(name, get, set);
21
-
22
- return (
23
- <SingleCheckIcon
24
- get={value} set={setValue}
25
- name={name?.toString()}
26
- {...props}
27
- />
28
- );
29
- }
1
+ import {useContext} from "react";
2
+ import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
3
+ import {SingleCheckIcon} from "../../Single/Checkbox/SingleCheckIcon.tsx";
4
+ import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
5
+ import {IconButtonProps} from "@mui/material";
6
+ import {MfsObjectCheckIconProps} from "../../../types";
7
+
8
+
9
+ export const ObjCheckIcon = <T extends object>(
10
+ customProps: Omit<IconButtonProps, 'name'> & MfsObjectCheckIconProps<T>
11
+ ) => {
12
+ const defaultProps = useContext(FastStartContext)?.Object?.MfsCheckIcon;
13
+ const {
14
+ get, set, name,
15
+ ...props
16
+ } = defaultProps == null
17
+ ? customProps
18
+ : Object.assign({...defaultProps}, customProps);
19
+
20
+ const [value, setValue] = useObjToSingle<T, boolean>(name, get, set);
21
+
22
+ return (
23
+ <SingleCheckIcon
24
+ get={value} set={setValue}
25
+ name={name?.toString()}
26
+ {...props}
27
+ />
28
+ );
29
+ }
@@ -1,31 +1,31 @@
1
- import React, {useContext} from "react";
2
- import {SingleCheckbox} from "../../Single/Checkbox/SingleCheckbox.tsx";
3
- import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
4
- import {CheckboxProps} from "@mui/material";
5
- import {MfsObjectCheckboxProps} from "../../../types";
6
- import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
7
-
8
-
9
- export const ObjCheckbox = <T extends object>(
10
- customProps: Omit<CheckboxProps, 'name'> & MfsObjectCheckboxProps<T>
11
- ) => {
12
- const defaultProps = useContext(FastStartContext)?.Object?.MfsCheckbox;
13
- const {
14
- get, set, label, name,
15
- ...props
16
- } = defaultProps == null
17
- ? customProps
18
- : Object.assign({...defaultProps}, customProps);
19
-
20
- const [value, setValue] = useObjToSingle<T, boolean>(name, get, set);
21
-
22
- return (
23
- <SingleCheckbox
24
- get={value}
25
- set={setValue}
26
- label={label}
27
- name={name?.toString()}
28
- {...props}
29
- />
30
- );
31
- }
1
+ import React, {useContext} from "react";
2
+ import {SingleCheckbox} from "../../Single/Checkbox/SingleCheckbox.tsx";
3
+ import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
4
+ import {CheckboxProps} from "@mui/material";
5
+ import {MfsObjectCheckboxProps} from "../../../types";
6
+ import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
7
+
8
+
9
+ export const ObjCheckbox = <T extends object>(
10
+ customProps: Omit<CheckboxProps, 'name'> & MfsObjectCheckboxProps<T>
11
+ ) => {
12
+ const defaultProps = useContext(FastStartContext)?.Object?.MfsCheckbox;
13
+ const {
14
+ get, set, label, name,
15
+ ...props
16
+ } = defaultProps == null
17
+ ? customProps
18
+ : Object.assign({...defaultProps}, customProps);
19
+
20
+ const [value, setValue] = useObjToSingle<T, boolean>(name, get, set);
21
+
22
+ return (
23
+ <SingleCheckbox
24
+ get={value}
25
+ set={setValue}
26
+ label={label}
27
+ name={name?.toString()}
28
+ {...props}
29
+ />
30
+ );
31
+ }
@@ -1,34 +1,34 @@
1
- import {useContext} from "react";
2
- import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
3
- import {SingleSelectOne} from "../../Single/Select/SingleSelectOne.tsx";
4
- import {SelectProps} from "@mui/material";
5
- import {MfsObjectSelectOneProps} from "../../../types";
6
- import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
7
- import {errorObjectToString} from "../../../utils/object/error.ts";
8
-
9
-
10
- export const ObjSelectOne = <
11
- T extends object,
12
- Item
13
- >(customProps: Omit<SelectProps, 'name'> & MfsObjectSelectOneProps<T, Item>) => {
14
- const defaultProps = useContext(FastStartContext)?.Object?.MfsSelectOne;
15
- const {
16
- get, set, err, name,
17
- variant,
18
- ...props
19
- } = defaultProps == null
20
- ? customProps
21
- : Object.assign({...defaultProps}, customProps);
22
-
23
- const [value, setValue] = useObjToSingle<T, Item>(name, get, set);
24
-
25
- return (
26
- <SingleSelectOne<Item>
27
- get={value} set={setValue}
28
- name={name?.toString()}
29
- err={errorObjectToString(name, err)}
30
- variant={variant}
31
- {...props}
32
- />
33
- )
1
+ import {useContext} from "react";
2
+ import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
3
+ import {SingleSelectOne} from "../../Single/Select/SingleSelectOne.tsx";
4
+ import {SelectProps} from "@mui/material";
5
+ import {MfsObjectSelectOneProps} from "../../../types";
6
+ import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
7
+ import {errorObjectToString} from "../../../utils/object/error.ts";
8
+
9
+
10
+ export const ObjSelectOne = <
11
+ T extends object,
12
+ Item
13
+ >(customProps: Omit<SelectProps, 'name'> & MfsObjectSelectOneProps<T, Item>) => {
14
+ const defaultProps = useContext(FastStartContext)?.Object?.MfsSelectOne;
15
+ const {
16
+ get, set, err, name,
17
+ variant,
18
+ ...props
19
+ } = defaultProps == null
20
+ ? customProps
21
+ : Object.assign({...defaultProps}, customProps);
22
+
23
+ const [value, setValue] = useObjToSingle<T, Item>(name, get, set);
24
+
25
+ return (
26
+ <SingleSelectOne<Item>
27
+ get={value} set={setValue}
28
+ name={name?.toString()}
29
+ err={errorObjectToString(name, err)}
30
+ variant={variant}
31
+ {...props}
32
+ />
33
+ )
34
34
  }
@@ -1,34 +1,34 @@
1
- import {useContext} from "react";
2
- import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
3
- import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
4
- import {SingleSelectRecord} from "../../Single/Select/SingleSelectRecord.tsx";
5
- import {MfsObjectSelectRecordProps} from "../../../types";
6
- import {SelectProps} from "@mui/material";
7
- import {errorObjectToString} from "../../../utils/object/error.ts";
8
-
9
-
10
- export const ObjSelectRecord = <
11
- T extends object,
12
- Item extends Record<PropertyKey, unknown>
13
- >(customProps: Omit<SelectProps, 'name'> & MfsObjectSelectRecordProps<T, Item>) => {
14
- const defaultProps = useContext(FastStartContext)?.Single?.MfsSelectRecord;
15
- const {
16
- get, set, err, name,
17
- variant,
18
- ...props
19
- } = defaultProps == null
20
- ? customProps
21
- : Object.assign({...defaultProps}, customProps);
22
-
23
- const [value, setValue] = useObjToSingle<T, Item>(name, get, set);
24
-
25
- return (
26
- <SingleSelectRecord
27
- get={value} set={setValue}
28
- name={name?.toString()}
29
- err={errorObjectToString(name, err)}
30
- variant={variant}
31
- {...props}
32
- />
33
- )
1
+ import React, {useContext} from "react";
2
+ import {FastStartContext} from "../../../styles/FastStartProvider.tsx";
3
+ import useObjToSingle from "../../../hooks/state/useObjToSingle.ts";
4
+ import {SingleSelectRecord} from "../../Single/Select/SingleSelectRecord.tsx";
5
+ import {MfsObjectSelectRecordProps} from "../../../types";
6
+ import {SelectProps} from "@mui/material";
7
+ import {errorObjectToString} from "../../../utils/object/error.ts";
8
+
9
+
10
+ export const ObjSelectRecord = <
11
+ T extends object,
12
+ Item extends Record<PropertyKey, React.ReactNode>
13
+ >(customProps: Omit<SelectProps, 'name'> & MfsObjectSelectRecordProps<T, Item>) => {
14
+ const defaultProps = useContext(FastStartContext)?.Single?.MfsSelectRecord;
15
+ const {
16
+ get, set, err, name,
17
+ variant,
18
+ ...props
19
+ } = defaultProps == null
20
+ ? customProps
21
+ : Object.assign({...defaultProps}, customProps);
22
+
23
+ const [value, setValue] = useObjToSingle<T, Item>(name, get, set);
24
+
25
+ return (
26
+ <SingleSelectRecord
27
+ get={value} set={setValue}
28
+ name={name?.toString()}
29
+ err={errorObjectToString(name, err)}
30
+ variant={variant}
31
+ {...props}
32
+ />
33
+ )
34
34
  }