@kirill.konshin/mui 0.0.2 → 0.0.4

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 (65) hide show
  1. package/README.md +87 -0
  2. package/dist/admin/appProvider.d.ts +18 -0
  3. package/dist/admin/appProvider.d.ts.map +1 -0
  4. package/dist/admin/appProvider.js +32 -0
  5. package/dist/admin/appProvider.js.map +1 -0
  6. package/dist/admin/dashboardLayout.d.ts +8 -0
  7. package/dist/admin/dashboardLayout.d.ts.map +1 -0
  8. package/dist/admin/dashboardLayout.js +17 -0
  9. package/dist/admin/dashboardLayout.js.map +1 -0
  10. package/dist/admin/index.d.ts +4 -0
  11. package/dist/admin/index.d.ts.map +1 -0
  12. package/dist/admin/index.js +4 -0
  13. package/dist/admin/signInPage.d.ts +22 -0
  14. package/dist/admin/signInPage.d.ts.map +1 -0
  15. package/dist/admin/signInPage.js +60 -0
  16. package/dist/admin/signInPage.js.map +1 -0
  17. package/dist/appBarOffset.d.ts.map +1 -1
  18. package/dist/appBarOffset.js +11 -7
  19. package/dist/appBarOffset.js.map +1 -1
  20. package/dist/formControlFieldset.d.ts +1 -1
  21. package/dist/formControlFieldset.d.ts.map +1 -1
  22. package/dist/formControlFieldset.js +17 -26
  23. package/dist/formControlFieldset.js.map +1 -1
  24. package/dist/formControlFieldset.stories.d.ts +2 -2
  25. package/dist/formControlFieldset.stories.d.ts.map +1 -1
  26. package/dist/formLabelLegend.d.ts.map +1 -1
  27. package/dist/formLabelLegend.js +13 -10
  28. package/dist/formLabelLegend.js.map +1 -1
  29. package/dist/formLabelLegend.stories.d.ts +2 -2
  30. package/dist/formLabelLegend.stories.d.ts.map +1 -1
  31. package/dist/genericControl.d.ts.map +1 -1
  32. package/dist/genericControl.js +17 -21
  33. package/dist/genericControl.js.map +1 -1
  34. package/dist/genericControl.stories.d.ts +2 -2
  35. package/dist/genericControl.stories.d.ts.map +1 -1
  36. package/dist/index.d.ts +6 -5
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +6 -9
  39. package/dist/readOnly.d.ts.map +1 -1
  40. package/dist/readOnly.js +15 -7
  41. package/dist/readOnly.js.map +1 -1
  42. package/dist/readOnly.stories.d.ts +2 -2
  43. package/dist/readOnly.stories.d.ts.map +1 -1
  44. package/package.json +38 -5
  45. package/.ctirc +0 -20
  46. package/.storybook/main.ts +0 -2
  47. package/.storybook/preview.ts +0 -2
  48. package/.turbo/turbo-build.log +0 -24
  49. package/AGENTS.md +0 -19
  50. package/CHANGELOG.md +0 -8
  51. package/dist/index.js.map +0 -1
  52. package/src/README.md +0 -3
  53. package/src/appBarOffset.tsx +0 -8
  54. package/src/formControlFieldset.stories.tsx +0 -71
  55. package/src/formControlFieldset.tsx +0 -26
  56. package/src/formLabelLegend.stories.tsx +0 -139
  57. package/src/formLabelLegend.tsx +0 -13
  58. package/src/genericControl.stories.tsx +0 -111
  59. package/src/genericControl.tsx +0 -22
  60. package/src/index.ts +0 -5
  61. package/src/readOnly.stories.tsx +0 -118
  62. package/src/readOnly.tsx +0 -8
  63. package/tsconfig.json +0 -10
  64. package/turbo.json +0 -10
  65. package/vite.config.ts +0 -2
package/dist/readOnly.js CHANGED
@@ -1,10 +1,18 @@
1
- import { jsx } from "react/jsx-runtime";
2
1
  import { memo } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
3
  import Input from "@mui/material/Input";
4
- const ReadOnly = memo(function ReadOnly2({ children, inputProps, ...props }) {
5
- return /* @__PURE__ */ jsx(Input, { ...props, inputComponent: "div", inputProps: { ...inputProps, children } });
4
+ //#region src/readOnly.tsx
5
+ var ReadOnly = memo(function ReadOnly({ children, inputProps, ...props }) {
6
+ return /* @__PURE__ */ jsx(Input, {
7
+ ...props,
8
+ inputComponent: "div",
9
+ inputProps: {
10
+ ...inputProps,
11
+ children
12
+ }
13
+ });
6
14
  });
7
- export {
8
- ReadOnly
9
- };
10
- //# sourceMappingURL=readOnly.js.map
15
+ //#endregion
16
+ export { ReadOnly };
17
+
18
+ //# sourceMappingURL=readOnly.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"readOnly.js","sources":["../src/readOnly.tsx"],"sourcesContent":["import React, { FC, memo } from 'react';\nimport { default as Input, InputProps } from '@mui/material/Input';\n\nexport type ReadOnlyProps = InputProps & { children: any };\n\nexport const ReadOnly: FC<ReadOnlyProps> = memo(function ReadOnly({ children, inputProps, ...props }) {\n return <Input {...props} inputComponent={'div' as any} inputProps={{ ...inputProps, children }}></Input>;\n});\n"],"names":["ReadOnly"],"mappings":";;;AAKO,MAAM,WAA8B,KAAK,SAASA,UAAS,EAAE,UAAU,YAAY,GAAG,SAAS;AAClG,SAAO,oBAAC,OAAA,EAAO,GAAG,OAAO,gBAAgB,OAAc,YAAY,EAAE,GAAG,YAAY,SAAA,EAAS,CAAG;AACpG,CAAC;"}
1
+ {"version":3,"file":"readOnly.js","names":[],"sources":["../src/readOnly.tsx"],"sourcesContent":["import React, { type FC, memo } from 'react';\n\nimport { default as Input, type InputProps } from '@mui/material/Input';\n\nexport type ReadOnlyProps = InputProps & { children: any };\n\nexport const ReadOnly: FC<ReadOnlyProps> = memo(function ReadOnly({ children, inputProps, ...props }) {\n return <Input {...props} inputComponent={'div' as any} inputProps={{ ...inputProps, children }}></Input>;\n});\n"],"mappings":";;;;AAMA,IAAa,WAA8B,KAAK,SAAS,SAAS,EAAE,UAAU,YAAY,GAAG,SAAS;CAClG,OAAO,oBAAC,OAAD;EAAO,GAAI;EAAO,gBAAgB;EAAc,YAAY;GAAE,GAAG;GAAY;EAAS;CAAU,CAAA;AAC3G,CAAC"}
@@ -1,5 +1,5 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { ReadOnly } from './readOnly';
1
+ import { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { ReadOnly } from './readOnly.js';
3
3
  declare const meta: Meta<typeof ReadOnly>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
@@ -1 +1 @@
1
- {"version":3,"file":"readOnly.stories.d.ts","sourceRoot":"","sources":["../src/readOnly.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAIvD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAY/B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAOvB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAS7B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAqB5B,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,KAyBrC,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAevB,CAAC"}
1
+ {"version":3,"file":"readOnly.stories.d.ts","sourceRoot":"","sources":["../src/readOnly.stories.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAY/B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAOvB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAS7B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAqB5B,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,KAyBrC,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAevB,CAAC"}
package/package.json CHANGED
@@ -1,18 +1,17 @@
1
1
  {
2
2
  "name": "@kirill.konshin/mui",
3
3
  "description": "Utilities",
4
- "version": "0.0.2",
4
+ "version": "0.0.4",
5
5
  "type": "module",
6
+ "hasStorybook": true,
6
7
  "scripts": {
7
8
  "----- BUILD -----": "",
8
9
  "clean": "rm -rf dist .tscache tsconfig.tsbuildinfo",
9
10
  "build": "vite build",
10
- "build:index": "ctix build",
11
- "build:check-types": "attw --pack .",
12
11
  "start": "yarn build --watch",
13
12
  "wait": "wait-on ./dist/index.js",
14
13
  "----- TEST -----": "",
15
- "test:disabled": "vitest run --coverage",
14
+ "test": "vitest run --coverage",
16
15
  "test:watch": "vitest watch --coverage",
17
16
  "----- STORYBOOK -----": "",
18
17
  "storybook:start": "storybook dev -p 6006",
@@ -21,18 +20,33 @@
21
20
  "devDependencies": {
22
21
  "@emotion/react": "^11.14.0",
23
22
  "@emotion/styled": "^11.14.0",
23
+ "@kirill.konshin/auth": "*",
24
24
  "@kirill.konshin/utils-private": "*",
25
25
  "@mui/material": "^7.3.0",
26
+ "@toolpad/core": "^0.16.0",
27
+ "next": "^16.2.12",
26
28
  "react": "^19.1.1"
27
29
  },
28
30
  "peerDependencies": {
31
+ "@kirill.konshin/auth": "*",
29
32
  "@mui/material": "^7",
33
+ "@toolpad/core": "^0.16",
34
+ "next": "^16",
30
35
  "react": "^19"
31
36
  },
32
37
  "peerDependenciesMeta": {
38
+ "@kirill.konshin/auth": {
39
+ "optional": true
40
+ },
33
41
  "@mui/material": {
34
42
  "optional": true
35
43
  },
44
+ "@toolpad/core": {
45
+ "optional": true
46
+ },
47
+ "next": {
48
+ "optional": true
49
+ },
36
50
  "react": {
37
51
  "optional": true
38
52
  }
@@ -43,6 +57,12 @@
43
57
  "author": "Kirill Konshin <kirill@konshin.org> (https://konshin.org)",
44
58
  "license": "MIT",
45
59
  "exports": {
60
+ "./admin": {
61
+ "import": {
62
+ "import": "./dist/admin/index.js",
63
+ "types": "./dist/admin/index.d.ts"
64
+ }
65
+ },
46
66
  ".": {
47
67
  "import": {
48
68
  "import": "./dist/index.js",
@@ -52,5 +72,18 @@
52
72
  },
53
73
  "main": "./dist/index.js",
54
74
  "module": "./dist/index.js",
55
- "types": "./dist/index.d.ts"
75
+ "types": "./dist/index.d.ts",
76
+ "repository": {
77
+ "type": "git",
78
+ "url": "https://github.com/kirill-konshin/utils.git",
79
+ "directory": "packages/mui"
80
+ },
81
+ "nx": {
82
+ "tags": [
83
+ "platform:next"
84
+ ]
85
+ },
86
+ "files": [
87
+ "dist"
88
+ ]
56
89
  }
package/.ctirc DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "options": [
3
- {
4
- "mode": "create",
5
- "project": "tsconfig.json",
6
- "include": "src/**/*.{ts,tsx}",
7
- "exclude": [
8
- "**/*.stories.*",
9
- "**/*.test.*",
10
- "**/*.fixture.*"
11
- ],
12
- "startFrom": "src",
13
- "backup": false,
14
- "overwrite": true,
15
- "generationStyle": "default-alias-named-star",
16
- "output": "src",
17
- "verbose": true
18
- }
19
- ]
20
- }
@@ -1,2 +0,0 @@
1
- import config from '../../utils-private/.storybook/main';
2
- export default config;
@@ -1,2 +0,0 @@
1
- import preview from '../../utils-private/.storybook/preview';
2
- export default preview;
@@ -1,24 +0,0 @@
1
- vite v7.0.6 building SSR bundle for production...
2
- - ctix 'create' mode start, ...
3
- ✔ /home/runner/work/utils/utils/packages/mui/tsconfig.json loading complete!
4
- ✔ analysis export statements completed!
5
- - build "index.ts" file start
6
- - output file exists check, ...
7
-
8
-
9
- ✔ ctix 'create' mode complete!
10
- transforming...
11
- ✓ 6 modules transformed.
12
- rendering chunks...
13
-
14
- [vite:dts] Start generate declaration files...
15
- dist/appBarOffset.js 0.37 kB │ map: 0.68 kB
16
- dist/readOnly.js 0.37 kB │ map: 0.68 kB
17
- dist/index.js 0.40 kB │ map: 0.09 kB
18
- dist/formLabelLegend.js 0.44 kB │ map: 0.79 kB
19
- dist/genericControl.js 0.59 kB │ map: 1.16 kB
20
- dist/formControlFieldset.js 0.68 kB │ map: 1.24 kB
21
- [vite:dts] Declaration files built in 3345ms.
22
-
23
- ✓ built in 7.04s
24
- Updated package.json with exports
package/AGENTS.md DELETED
@@ -1,19 +0,0 @@
1
- # MUI Classes In Selectors
2
-
3
- Always use following notation because it's the only one that works with minification:
4
-
5
- ```tsx
6
- import Input, { inputClasses } from '@mui/material/Input';
7
-
8
- const cmp = (
9
- <Box
10
- sx={{
11
- [`& .${inputClasses.root}`]: {
12
- // styles
13
- },
14
- }}
15
- >
16
- <Input />
17
- </Box>
18
- );
19
- ```
package/CHANGELOG.md DELETED
@@ -1,8 +0,0 @@
1
- # @kirill.konshin/mui
2
-
3
- ## 0.0.2
4
-
5
- ### Patch Changes
6
-
7
- - 63fdba8: Agent-assisted refactoring
8
- - 63fdba8: Divided core to browser/node/worker-specific packages, CTIX upgrade, etc.
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
package/src/README.md DELETED
@@ -1,3 +0,0 @@
1
- ## Prior Art
2
-
3
- https://codesandbox.io/p/sandbox/l7vykxl57q MUI v4
@@ -1,8 +0,0 @@
1
- import React, { FC, memo } from 'react';
2
- import { default as Box, BoxProps } from '@mui/material/Box';
3
-
4
- export type AppBarOffsetProps = BoxProps;
5
-
6
- export const AppBarOffset: FC<AppBarOffsetProps> = memo(function AppBarOffset({ sx, ...props }) {
7
- return <Box {...props} sx={[({ mixins }) => mixins.toolbar, ...(Array.isArray(sx) ? sx : [sx])]} />;
8
- });
@@ -1,71 +0,0 @@
1
- import React from 'react';
2
- import type { Meta, StoryObj } from '@storybook/react';
3
-
4
- import { TextField, Stack, InputLabel, RadioGroup, Radio, FormControlLabel, Box } from '@mui/material';
5
-
6
- import { GenericControl } from './genericControl';
7
- import { ReadOnly } from './readOnly';
8
- import { FormControlFieldset } from './formControlFieldset';
9
- import { FormLabelLegend } from './formLabelLegend';
10
-
11
- // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
12
- const meta: Meta<typeof GenericControl> = {
13
- title: 'MUI / FormControlFieldset',
14
- parameters: {
15
- layout: 'centered',
16
- },
17
- tags: ['autodocs'],
18
- argTypes: {},
19
- render: function Render() {
20
- return (
21
- <Box sx={{ position: 'relative' }}>
22
- <Rule top={12} />
23
- <Rule top={37} />
24
- <Rule top={48} />
25
- <Stack direction="row" gap={3} sx={{ alignItems: 'flex-start' }}>
26
- <FormControlFieldset>
27
- <FormLabelLegend>Radios</FormLabelLegend>
28
- <ReadOnly>
29
- {/* TODO The size of the component. small is equivalent to the dense radio styling. */}
30
- <RadioGroup row defaultValue="female" name="radio-buttons-group" sx={{ mt: -1 }}>
31
- <FormControlLabel value="female" label="Female" control={<Radio size="small" />} />
32
- <FormControlLabel value="male" label="Male" control={<Radio size="small" />} />
33
- <FormControlLabel value="other" label="Other" control={<Radio size="small" />} />
34
- </RadioGroup>
35
- </ReadOnly>
36
- </FormControlFieldset>
37
-
38
- <GenericControl>
39
- <InputLabel shrink>GenericControl</InputLabel>
40
- <ReadOnly>
41
- This is a <code>div</code>, not an input with <code>readOnly</code>
42
- </ReadOnly>
43
- </GenericControl>
44
-
45
- <FormControlFieldset>
46
- <FormLabelLegend>FormLabelLegend</FormLabelLegend>
47
- <ReadOnly>
48
- This is a <code>div</code>, not an input with <code>readOnly</code>
49
- </ReadOnly>
50
- </FormControlFieldset>
51
-
52
- <TextField label="TextField" defaultValue="Bar" variant="standard" />
53
- </Stack>
54
- </Box>
55
- );
56
- },
57
- } satisfies Meta<typeof GenericControl>;
58
-
59
- export default meta;
60
-
61
- type Story = StoryObj<typeof meta>;
62
-
63
- function Rule({ top }) {
64
- return (
65
- <Box sx={{ background: 'red', position: 'absolute', left: 0, top: `${top}px`, width: '100%', height: '1px' }} />
66
- );
67
- }
68
-
69
- export const Default: Story = {
70
- args: {},
71
- };
@@ -1,26 +0,0 @@
1
- import React, { FC, memo } from 'react';
2
- import { GenericControl, GenericControlProps } from './genericControl';
3
- import { inputClasses } from '@mui/material/Input';
4
-
5
- export type FormControlFieldsetProps = GenericControlProps;
6
-
7
- export const FormControlFieldset: FC<FormControlFieldsetProps> = memo(function FormControlFieldset({
8
- children,
9
- sx,
10
- ...props
11
- }) {
12
- return (
13
- <GenericControl
14
- {...props}
15
- component="fieldset"
16
- sx={{
17
- ...sx,
18
- [`legend + .${inputClasses.root}`]: {
19
- marginTop: 2, //FIXME 16px, hardcoded from @mui/material/Input/Input.js @ 59
20
- },
21
- }}
22
- >
23
- {children}
24
- </GenericControl>
25
- );
26
- });
@@ -1,139 +0,0 @@
1
- import React from 'react';
2
- import type { Meta, StoryObj } from '@storybook/react';
3
-
4
- import { InputLabel, RadioGroup, Radio, FormControlLabel, Stack, Box } from '@mui/material';
5
-
6
- import { FormLabelLegend } from './formLabelLegend';
7
- import { FormControlFieldset } from './formControlFieldset';
8
- import { GenericControl } from './genericControl';
9
- import { ReadOnly } from './readOnly';
10
-
11
- const meta: Meta<typeof FormLabelLegend> = {
12
- title: 'MUI / FormLabelLegend',
13
- component: FormLabelLegend,
14
- parameters: {
15
- layout: 'centered',
16
- },
17
- tags: ['autodocs'],
18
- argTypes: {
19
- children: { control: 'text' },
20
- disabled: { control: 'boolean' },
21
- error: { control: 'boolean' },
22
- required: { control: 'boolean' },
23
- },
24
- };
25
-
26
- export default meta;
27
-
28
- type Story = StoryObj<typeof meta>;
29
-
30
- export const Default: Story = {
31
- args: {
32
- children: 'Form Label Legend',
33
- },
34
- render: (args) => (
35
- <FormControlFieldset>
36
- <FormLabelLegend {...args} />
37
- <ReadOnly>Content goes here</ReadOnly>
38
- </FormControlFieldset>
39
- ),
40
- };
41
-
42
- export const WithRadioGroup: Story = {
43
- render: () => (
44
- <FormControlFieldset>
45
- <FormLabelLegend>Select Option</FormLabelLegend>
46
- <ReadOnly>
47
- <RadioGroup row defaultValue="option1">
48
- <FormControlLabel value="option1" label="Option 1" control={<Radio size="small" />} />
49
- <FormControlLabel value="option2" label="Option 2" control={<Radio size="small" />} />
50
- <FormControlLabel value="option3" label="Option 3" control={<Radio size="small" />} />
51
- </RadioGroup>
52
- </ReadOnly>
53
- </FormControlFieldset>
54
- ),
55
- };
56
-
57
- export const Required: Story = {
58
- args: {
59
- children: 'Required Field',
60
- required: true,
61
- },
62
- render: (args) => (
63
- <FormControlFieldset required>
64
- <FormLabelLegend {...args} />
65
- <ReadOnly>This field is required</ReadOnly>
66
- </FormControlFieldset>
67
- ),
68
- };
69
-
70
- export const WithError: Story = {
71
- args: {
72
- children: 'Error State',
73
- error: true,
74
- },
75
- render: (args) => (
76
- <FormControlFieldset error>
77
- <FormLabelLegend {...args} />
78
- <ReadOnly>This field has an error</ReadOnly>
79
- </FormControlFieldset>
80
- ),
81
- };
82
-
83
- export const Disabled: Story = {
84
- args: {
85
- children: 'Disabled Field',
86
- disabled: true,
87
- },
88
- render: (args) => (
89
- <FormControlFieldset disabled>
90
- <FormLabelLegend {...args} />
91
- <ReadOnly>This field is disabled</ReadOnly>
92
- </FormControlFieldset>
93
- ),
94
- };
95
-
96
- export const ComparisonWithInputLabel: Story = {
97
- parameters: {
98
- docs: {
99
- description: {
100
- story: 'FormLabelLegend renders as a `<legend>` element, which is semantically correct for fieldsets. InputLabel renders as a `<label>` element.',
101
- },
102
- },
103
- },
104
- render: () => (
105
- <Stack direction="row" spacing={3}>
106
- <FormControlFieldset>
107
- <FormLabelLegend>FormLabelLegend</FormLabelLegend>
108
- <ReadOnly>Uses legend element</ReadOnly>
109
- </FormControlFieldset>
110
-
111
- <GenericControl>
112
- <InputLabel shrink>InputLabel</InputLabel>
113
- <ReadOnly>Uses label element</ReadOnly>
114
- </GenericControl>
115
- </Stack>
116
- ),
117
- };
118
-
119
- export const MultipleFieldsets: Story = {
120
- render: () => (
121
- <Stack spacing={3}>
122
- <FormControlFieldset>
123
- <FormLabelLegend>Personal Information</FormLabelLegend>
124
- <ReadOnly>John Doe, john@example.com</ReadOnly>
125
- </FormControlFieldset>
126
-
127
- <FormControlFieldset>
128
- <FormLabelLegend>Preferences</FormLabelLegend>
129
- <ReadOnly>
130
- <RadioGroup row defaultValue="email">
131
- <FormControlLabel value="email" label="Email" control={<Radio size="small" />} />
132
- <FormControlLabel value="sms" label="SMS" control={<Radio size="small" />} />
133
- <FormControlLabel value="none" label="None" control={<Radio size="small" />} />
134
- </RadioGroup>
135
- </ReadOnly>
136
- </FormControlFieldset>
137
- </Stack>
138
- ),
139
- };
@@ -1,13 +0,0 @@
1
- import React, { FC, memo } from 'react';
2
- import { default as InputLabel, InputLabelProps } from '@mui/material/InputLabel';
3
-
4
- export type FormLabelLegendProps = InputLabelProps;
5
-
6
- export const FormLabelLegend: FC<FormLabelLegendProps> = memo(function FormLabelLegend({ children, ...props }) {
7
- return (
8
- // sx={(theme) => theme.typography.caption}
9
- <InputLabel {...props} shrink={true} component={'legend' as any}>
10
- {children}
11
- </InputLabel>
12
- );
13
- });
@@ -1,111 +0,0 @@
1
- import React from 'react';
2
- import type { Meta, StoryObj } from '@storybook/react';
3
-
4
- import { InputLabel, Input, TextField, Stack, Box } from '@mui/material';
5
-
6
- import { GenericControl } from './genericControl';
7
- import { ReadOnly } from './readOnly';
8
-
9
- const meta: Meta<typeof GenericControl> = {
10
- title: 'MUI / GenericControl',
11
- component: GenericControl,
12
- parameters: {
13
- layout: 'centered',
14
- },
15
- tags: ['autodocs'],
16
- argTypes: {
17
- disabled: { control: 'boolean' },
18
- error: { control: 'boolean' },
19
- fullWidth: { control: 'boolean' },
20
- required: { control: 'boolean' },
21
- },
22
- };
23
-
24
- export default meta;
25
-
26
- type Story = StoryObj<typeof meta>;
27
-
28
- export const Default: Story = {
29
- args: {
30
- children: (
31
- <>
32
- <InputLabel shrink>Label</InputLabel>
33
- <Input defaultValue="Some value" />
34
- </>
35
- ),
36
- },
37
- };
38
-
39
- export const WithCustomContent: Story = {
40
- args: {
41
- children: (
42
- <>
43
- <InputLabel shrink>Custom Content</InputLabel>
44
- <ReadOnly>This is custom content inside GenericControl</ReadOnly>
45
- </>
46
- ),
47
- },
48
- };
49
-
50
- export const Disabled: Story = {
51
- args: {
52
- disabled: true,
53
- children: (
54
- <>
55
- <InputLabel shrink>Disabled Control</InputLabel>
56
- <Input defaultValue="Disabled value" />
57
- </>
58
- ),
59
- },
60
- };
61
-
62
- export const WithError: Story = {
63
- args: {
64
- error: true,
65
- children: (
66
- <>
67
- <InputLabel shrink>Error State</InputLabel>
68
- <Input defaultValue="Invalid value" />
69
- </>
70
- ),
71
- },
72
- };
73
-
74
- export const FullWidth: Story = {
75
- args: {
76
- fullWidth: true,
77
- children: (
78
- <>
79
- <InputLabel shrink>Full Width</InputLabel>
80
- <Input defaultValue="Full width input" />
81
- </>
82
- ),
83
- },
84
- decorators: [
85
- (Story) => (
86
- <Box sx={{ width: 400 }}>
87
- <Story />
88
- </Box>
89
- ),
90
- ],
91
- };
92
-
93
- export const ComparisonWithTextField: Story = {
94
- parameters: {
95
- docs: {
96
- description: {
97
- story: 'GenericControl removes the underline from inputs, making it suitable for read-only or custom content displays.',
98
- },
99
- },
100
- },
101
- render: () => (
102
- <Stack direction="row" spacing={3}>
103
- <GenericControl>
104
- <InputLabel shrink>GenericControl</InputLabel>
105
- <Input defaultValue="No underline" />
106
- </GenericControl>
107
-
108
- <TextField label="TextField" defaultValue="With underline" variant="standard" />
109
- </Stack>
110
- ),
111
- };
@@ -1,22 +0,0 @@
1
- import React, { FC, memo } from 'react';
2
- import { FormControlProps, default as FormControl } from '@mui/material/FormControl';
3
- import { inputClasses } from '@mui/material/Input';
4
-
5
- export type GenericControlProps = FormControlProps & { children: any };
6
-
7
- export const GenericControl: FC<GenericControlProps> = memo(function GenericControl({ children, sx, ...props }) {
8
- return (
9
- <FormControl
10
- variant="standard"
11
- sx={{
12
- ...sx,
13
- [`& .${inputClasses.root}`]: {
14
- '&:before, &:after': { display: 'none' },
15
- },
16
- }}
17
- {...props}
18
- >
19
- {children}
20
- </FormControl>
21
- );
22
- });
package/src/index.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from './appBarOffset';
2
- export * from './formControlFieldset';
3
- export * from './formLabelLegend';
4
- export * from './genericControl';
5
- export * from './readOnly';