@zesty-io/material 0.2.4 → 0.2.5

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 (104) hide show
  1. package/{es → cjs}/ConfirmDialog/ConfirmDialog.stories.d.ts +0 -0
  2. package/cjs/ConfirmDialog/ConfirmDialog.stories.js +27 -0
  3. package/{es → cjs}/ConfirmDialog/index.d.ts +0 -0
  4. package/cjs/ConfirmDialog/index.js +13 -0
  5. package/{es → cjs}/CopyButton/CopyButton.stories.d.ts +0 -0
  6. package/cjs/CopyButton/CopyButton.stories.js +17 -0
  7. package/{es → cjs}/CopyButton/index.d.ts +0 -0
  8. package/cjs/CopyButton/index.js +28 -0
  9. package/{es → cjs}/FieldTypeColor/FieldTypeColor.stories.d.ts +0 -0
  10. package/cjs/FieldTypeColor/FieldTypeColor.stories.js +24 -0
  11. package/{es → cjs}/FieldTypeColor/index.d.ts +0 -0
  12. package/cjs/FieldTypeColor/index.js +18 -0
  13. package/{es → cjs}/FieldTypeDate/FieldTypeDate.stories.d.ts +0 -0
  14. package/cjs/FieldTypeDate/FieldTypeDate.stories.js +20 -0
  15. package/{es → cjs}/FieldTypeDate/index.d.ts +0 -0
  16. package/cjs/FieldTypeDate/index.js +12 -0
  17. package/{es → cjs}/FieldTypeDateTime/FieldTypeDateTime.stories.d.ts +0 -0
  18. package/cjs/FieldTypeDateTime/FieldTypeDateTime.stories.js +20 -0
  19. package/{es → cjs}/FieldTypeDateTime/index.d.ts +0 -0
  20. package/cjs/FieldTypeDateTime/index.js +12 -0
  21. package/{es → cjs}/FieldTypeNumber/FieldTypeNumber.stories.d.ts +0 -0
  22. package/cjs/FieldTypeNumber/FieldTypeNumber.stories.js +24 -0
  23. package/{es → cjs}/FieldTypeNumber/index.d.ts +0 -0
  24. package/cjs/FieldTypeNumber/index.js +9 -0
  25. package/{es → cjs}/FieldTypeOneToMany/FieldTypeOneToMany.stories.d.ts +0 -0
  26. package/cjs/FieldTypeOneToMany/FieldTypeOneToMany.stories.js +31 -0
  27. package/{es → cjs}/FieldTypeOneToMany/index.d.ts +0 -0
  28. package/cjs/FieldTypeOneToMany/index.js +31 -0
  29. package/{es → cjs}/FieldTypeOneToOne/FieldTypeOneToOne.stories.d.ts +0 -0
  30. package/cjs/FieldTypeOneToOne/FieldTypeOneToOne.stories.js +31 -0
  31. package/{es → cjs}/FieldTypeOneToOne/index.d.ts +0 -0
  32. package/cjs/FieldTypeOneToOne/index.js +35 -0
  33. package/{es → cjs}/FieldTypeSort/FieldTypeSort.stories.d.ts +0 -0
  34. package/cjs/FieldTypeSort/FieldTypeSort.stories.js +25 -0
  35. package/{es → cjs}/FieldTypeSort/index.d.ts +0 -0
  36. package/{es → cjs}/FieldTypeSort/index.js +13 -11
  37. package/{es → cjs}/FieldTypeText/FieldTypeText.stories.d.ts +0 -0
  38. package/cjs/FieldTypeText/FieldTypeText.stories.js +32 -0
  39. package/{es → cjs}/FieldTypeText/index.d.ts +0 -0
  40. package/cjs/FieldTypeText/index.js +9 -0
  41. package/{es → cjs}/FieldTypeUrl/FieldTypeUrl.stories.d.ts +0 -0
  42. package/cjs/FieldTypeUrl/FieldTypeUrl.stories.js +24 -0
  43. package/{es → cjs}/FieldTypeUrl/index.d.ts +0 -0
  44. package/cjs/FieldTypeUrl/index.js +16 -0
  45. package/{es → cjs}/LegacyTheme/index.d.ts +0 -0
  46. package/{es → cjs}/LegacyTheme/index.js +10 -8
  47. package/{es → cjs}/LegacyTheme/palette.d.ts +0 -0
  48. package/{es → cjs}/LegacyTheme/palette.js +3 -1
  49. package/{es → cjs}/LegacyTheme/typography.d.ts +0 -0
  50. package/cjs/LegacyTheme/typography.js +6 -0
  51. package/{es → cjs}/VitualizedAutocomplete/VirtualizedAutocomplete.stories.d.ts +0 -0
  52. package/cjs/VitualizedAutocomplete/VirtualizedAutocomplete.stories.js +30 -0
  53. package/{es → cjs}/VitualizedAutocomplete/index.d.ts +0 -0
  54. package/cjs/VitualizedAutocomplete/index.js +23 -0
  55. package/{es → cjs}/index.d.ts +0 -0
  56. package/cjs/index.js +31 -0
  57. package/{es/stories → cjs/theme}/Theme.stories.d.ts +0 -0
  58. package/cjs/theme/Theme.stories.js +13 -0
  59. package/{es → cjs}/theme/index.d.ts +0 -0
  60. package/{es → cjs}/theme/index.js +10 -8
  61. package/{es → cjs}/theme/palette.d.ts +0 -0
  62. package/{es → cjs}/theme/palette.js +3 -1
  63. package/{es → cjs}/theme/typography.d.ts +0 -0
  64. package/{es → cjs}/theme/typography.js +3 -1
  65. package/{es → cjs}/utils/virtualization.d.ts +0 -0
  66. package/cjs/utils/virtualization.js +66 -0
  67. package/package.json +5 -3
  68. package/es/ConfirmDialog/ConfirmDialog.stories.js +0 -24
  69. package/es/ConfirmDialog/index.js +0 -11
  70. package/es/ConfirmModal/ConfirmModal.stories.d.ts +0 -6
  71. package/es/ConfirmModal/ConfirmModal.stories.js +0 -24
  72. package/es/ConfirmModal/index.d.ts +0 -18
  73. package/es/ConfirmModal/index.js +0 -11
  74. package/es/CopyButton/CopyButton.stories.js +0 -14
  75. package/es/CopyButton/index.js +0 -26
  76. package/es/FieldTypeColor/FieldTypeColor.stories.js +0 -21
  77. package/es/FieldTypeColor/index.js +0 -16
  78. package/es/FieldTypeDate/FieldTypeDate.stories.js +0 -17
  79. package/es/FieldTypeDate/index.js +0 -10
  80. package/es/FieldTypeDateTime/FieldTypeDateTime.stories.js +0 -17
  81. package/es/FieldTypeDateTime/index.js +0 -10
  82. package/es/FieldTypeDropdown/FieldTypeDropwdon.stories.d.ts +0 -5
  83. package/es/FieldTypeDropdown/FieldTypeDropwdon.stories.js +0 -35
  84. package/es/FieldTypeDropdown/index.d.ts +0 -11
  85. package/es/FieldTypeDropdown/index.js +0 -10
  86. package/es/FieldTypeNumber/FieldTypeNumber.stories.js +0 -21
  87. package/es/FieldTypeNumber/index.js +0 -7
  88. package/es/FieldTypeOneToMany/FieldTypeOneToMany.stories.js +0 -28
  89. package/es/FieldTypeOneToMany/index.js +0 -29
  90. package/es/FieldTypeOneToOne/FieldTypeOneToOne.stories.js +0 -28
  91. package/es/FieldTypeOneToOne/index.js +0 -33
  92. package/es/FieldTypeSort/FieldTypeSort.stories.js +0 -22
  93. package/es/FieldTypeText/FieldTypeText.stories.js +0 -29
  94. package/es/FieldTypeText/index.js +0 -7
  95. package/es/FieldTypeUrl/FieldTypeUrl.stories.js +0 -21
  96. package/es/FieldTypeUrl/index.js +0 -14
  97. package/es/LegacyTheme/typography.js +0 -4
  98. package/es/VitualizedAutocomplete/VirtualizedAutocomplete.stories.js +0 -27
  99. package/es/VitualizedAutocomplete/index.js +0 -21
  100. package/es/index.js +0 -14
  101. package/es/stories/Theme.stories.js +0 -10
  102. package/es/theme/Theme.stories.d.ts +0 -4
  103. package/es/theme/Theme.stories.js +0 -10
  104. package/es/utils/virtualization.js +0 -63
@@ -1,28 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import FieldTypeOneToMany from '.';
4
- export default {
5
- title: 'FieldTypeOneToMany',
6
- component: FieldTypeOneToMany,
7
- argType: {},
8
- };
9
- const Template = (args) => {
10
- const [value, setValue] = useState([]);
11
- const [options, setOptions] = useState([]);
12
- const handleOnOpen = async () => {
13
- const largeArr = new Array(1000).fill(null);
14
- await new Promise((resolve) => setTimeout(resolve, 3000));
15
- const data = largeArr.map((_, idx) => ({ component: _jsx("div", { children: `Test ${idx}` }), value: String(Math.random()), inputLabel: `Test ${idx}` }));
16
- setOptions(data);
17
- };
18
- const handleOnChange = (e, values) => {
19
- setValue(values);
20
- };
21
- return (_jsx(FieldTypeOneToMany, { ...args, value: value, onChange: handleOnChange, options: options, onOpen: handleOnOpen }));
22
- };
23
- export const Default = Template.bind({});
24
- Default.args = {
25
- placeholder: 'Placeholder Text...',
26
- label: 'OneToMany label',
27
- helperText: 'OneToMany helperText',
28
- };
@@ -1,29 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import { FormControl, FormLabel, Popper, styled, TextField } from '@mui/material';
4
- import Autocomplete, { autocompleteClasses } from '@mui/material/Autocomplete';
5
- import { ListboxComponent } from '../utils/virtualization';
6
- const FieldTypeOneToMany = ({ label, helperText, placeholder, error, onOpen, options, required, ...props }) => {
7
- const [loaded, setLoaded] = useState(false);
8
- const [loading, setLoading] = useState(false);
9
- const handleOpen = () => {
10
- if (!loaded && onOpen) {
11
- onOpen().then(() => {
12
- setLoading(false);
13
- });
14
- setLoading(true);
15
- setLoaded(true);
16
- }
17
- };
18
- return (_jsxs(FormControl, { fullWidth: true, required: required, children: [_jsx(FormLabel, { children: label }), _jsx(Autocomplete, { onOpen: handleOpen, loading: loading, fullWidth: true, multiple: true, disableListWrap: true, disableClearable: true, disablePortal: true, size: 'small', PopperComponent: StyledPopper, ListboxComponent: ListboxComponent, renderInput: (params) => (_jsx(TextField, { ...params, helperText: helperText, error: error, placeholder: placeholder })), options: loading ? [] : options, getOptionLabel: (option) => option.inputLabel, renderOption: (props, option) => [props, option.component], ...props })] }));
19
- };
20
- export default FieldTypeOneToMany;
21
- const StyledPopper = styled(Popper)({
22
- [`& .${autocompleteClasses.listbox}`]: {
23
- boxSizing: 'border-box',
24
- '& ul': {
25
- padding: 0,
26
- margin: 0,
27
- },
28
- },
29
- });
@@ -1,28 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import FieldTypeOneToOne from './';
4
- export default {
5
- title: 'FieldTypeOneToOne',
6
- component: FieldTypeOneToOne,
7
- argType: {},
8
- };
9
- const Template = (args) => {
10
- const [value, setValue] = useState({ component: '- None -', value: '0', inputLabel: '- None -' });
11
- const [options, setOptions] = useState([]);
12
- const handleOnOpen = async () => {
13
- const largeArr = new Array(1000).fill(null);
14
- await new Promise((resolve) => setTimeout(resolve, 3000));
15
- const data = largeArr.map((_, idx) => ({ component: _jsx("div", { children: `Test ${idx}` }), value: String(Math.random()), inputLabel: `Test ${idx}` }));
16
- setOptions(data);
17
- };
18
- const handleOnChange = (e, option) => {
19
- setValue(option);
20
- };
21
- return (_jsx(FieldTypeOneToOne, { ...args, value: value, onChange: handleOnChange, options: options, onOpen: handleOnOpen }));
22
- };
23
- export const Default = Template.bind({});
24
- Default.args = {
25
- label: 'OneToOne label',
26
- helperText: 'OneToOne helperText',
27
- placeholder: 'OneToOne placeholder'
28
- };
@@ -1,33 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import { Popper, styled, TextField, FormLabel, FormControl, InputAdornment } from '@mui/material';
4
- import Autocomplete, { autocompleteClasses } from '@mui/material/Autocomplete';
5
- import { ListboxComponent } from '../utils/virtualization';
6
- const FieldTypeOneToOne = ({ label, helperText, placeholder, error, onOpen, options, required, startAdornment, endAdornment, ...props }) => {
7
- const [loaded, setLoaded] = useState(false);
8
- const [loading, setLoading] = useState(false);
9
- const handleOpen = () => {
10
- if (!loaded && onOpen) {
11
- onOpen().then(() => {
12
- setLoading(false);
13
- });
14
- setLoading(true);
15
- setLoaded(true);
16
- }
17
- };
18
- return (_jsxs(FormControl, { fullWidth: true, required: required, children: [_jsx(FormLabel, { children: label }), _jsx(Autocomplete, { onOpen: handleOpen, loading: loading, fullWidth: true, disableListWrap: true, disableClearable: true, disablePortal: true, size: 'small', PopperComponent: StyledPopper, ListboxComponent: ListboxComponent, renderInput: (params) => (_jsx(TextField, { ...params, helperText: helperText, error: error, placeholder: placeholder, InputProps: {
19
- ...params.InputProps,
20
- startAdornment: _jsx(InputAdornment, { position: 'end', children: startAdornment }),
21
- endAdornment: _jsxs(_Fragment, { children: [params.InputProps.endAdornment, _jsx(InputAdornment, { sx: { position: 'relative', right: '40px' }, position: 'end', children: endAdornment })] })
22
- } })), options: loading ? [] : options, getOptionLabel: (option) => option.inputLabel, renderOption: (props, option) => [props, option.component], ...props })] }));
23
- };
24
- export default FieldTypeOneToOne;
25
- const StyledPopper = styled(Popper)({
26
- [`& .${autocompleteClasses.listbox}`]: {
27
- boxSizing: 'border-box',
28
- '& ul': {
29
- padding: 0,
30
- margin: 0,
31
- },
32
- },
33
- });
@@ -1,22 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import FieldTypeSort from './';
4
- export default {
5
- title: 'FieldTypeSort',
6
- component: FieldTypeSort,
7
- argType: {},
8
- };
9
- const Template = (args) => {
10
- const [value, setValue] = useState('3');
11
- const handleOnChange = (e) => {
12
- setValue(e.target.value);
13
- };
14
- return (_jsx(FieldTypeSort, { ...args, value: value, onChange: handleOnChange }));
15
- };
16
- export const Default = Template.bind({});
17
- Default.args = {
18
- placeholder: 'Placeholder Text...',
19
- label: 'Sort label',
20
- helperText: 'Sort helper text',
21
- error: false,
22
- };
@@ -1,29 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import FieldTypeText from './';
4
- export default {
5
- title: 'FieldTypeText',
6
- component: FieldTypeText,
7
- argType: {},
8
- };
9
- const Template = (args) => {
10
- const [value, setValue] = useState('');
11
- const handleOnChange = (e) => {
12
- setValue(e.target.value);
13
- };
14
- return (_jsx(_Fragment, { children: _jsx(FieldTypeText, { ...args, value: value, onChange: handleOnChange }) }));
15
- };
16
- export const Default = Template.bind({});
17
- Default.args = {
18
- placeholder: 'Placeholder Text...',
19
- label: 'Text label',
20
- helperText: 'Text helper text',
21
- };
22
- export const TextArea = Template.bind({});
23
- TextArea.args = {
24
- multiline: true,
25
- rows: 4,
26
- placeholder: 'Placeholder Text...',
27
- label: 'Text Label',
28
- helperText: 'Text helper text',
29
- };
@@ -1,7 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import MuiTextField from '@mui/material/TextField';
3
- import { FormControl, FormLabel, Box } from '@mui/material';
4
- const FieldTypeText = ({ label, maxLength = 150, value, helperText, required, ...props }) => {
5
- return (_jsxs(FormControl, { fullWidth: true, required: required, children: [_jsxs(FormLabel, { sx: { display: 'flex', justifyContent: 'space-between', '& .MuiFormLabel-asterisk': { order: 2 } }, children: [_jsx(Box, { sx: { order: 1 }, children: label }), _jsxs(Box, { sx: { order: 3, flex: 1, textAlign: 'right' }, children: [value?.length, "/", maxLength] })] }), _jsx(MuiTextField, { size: "small", variant: 'outlined', value: value, error: value?.length > maxLength, helperText: value?.length > maxLength ? 'Your input is over the specified limit' : helperText, ...props })] }));
6
- };
7
- export default FieldTypeText;
@@ -1,21 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import FieldTypeUrl from './';
4
- export default {
5
- title: 'FieldTypeUrl',
6
- component: FieldTypeUrl,
7
- argType: {},
8
- };
9
- const Template = (args) => {
10
- const [value, setValue] = useState('');
11
- const handleOnChange = (e) => {
12
- setValue(e.target.value);
13
- };
14
- return (_jsx(FieldTypeUrl, { ...args, value: value, onChange: handleOnChange }));
15
- };
16
- export const Default = Template.bind({});
17
- Default.args = {
18
- placeholder: 'Placeholder Text...',
19
- label: 'Some label',
20
- fullWidth: true,
21
- };
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import MuiTextField from '@mui/material/TextField';
4
- import { FormControl, FormLabel, Box } from '@mui/material';
5
- const FieldTypeUrl = ({ label, maxLength = 2000, value, helperText, required, inputProps, ...props }) => {
6
- // Use state to hold input reference to re-render once ref changes in case error needs to be shown on mount
7
- const [inputRef, setInputRef] = useState();
8
- return (_jsxs(FormControl, { fullWidth: true, required: required, children: [_jsxs(FormLabel, { sx: { display: 'flex', justifyContent: 'space-between', '& .MuiFormLabel-asterisk': { order: 2 } }, children: [_jsx(Box, { sx: { order: 1 }, children: label }), _jsxs(Box, { sx: { order: 3, flex: 1, textAlign: 'right' }, children: [value?.length, "/", maxLength] })] }), _jsx(MuiTextField, { size: "small", type: 'url', variant: 'outlined', value: value, inputProps: {
9
- ref: (inputRef) => setInputRef(inputRef),
10
- // Spread props at the end to allow inputProps prop overrides
11
- ...inputProps,
12
- }, error: (value && !inputRef?.validity.valid) || value?.length > maxLength, helperText: value?.length > maxLength ? 'Your input is over the specified limit' : (value && !inputRef?.validity.valid) ? 'Your input is not a valid url' : helperText, ...props })] }));
13
- };
14
- export default FieldTypeUrl;
@@ -1,4 +0,0 @@
1
- const typography = {
2
- fontFamily: "'Mulish'",
3
- };
4
- export default typography;
@@ -1,27 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import VirtualizedAutocomplete from './';
4
- export default {
5
- title: 'VirtualizedAutocomplete',
6
- component: VirtualizedAutocomplete,
7
- argType: {},
8
- };
9
- const Template = (args) => {
10
- const [value, setValue] = useState({ component: '- None -', value: '0', inputLabel: '- None -' });
11
- const [options, setOptions] = useState([]);
12
- const handleOnOpen = async () => {
13
- const largeArr = new Array(1000).fill(null);
14
- await new Promise((resolve) => setTimeout(resolve, 3000));
15
- const data = largeArr.map((_, idx) => ({ component: _jsx("div", { children: `Test ${idx}` }), value: String(Math.random()), inputLabel: `Test ${idx}` }));
16
- setOptions(data);
17
- };
18
- const handleOnChange = (e, option) => {
19
- setValue(option);
20
- };
21
- return (_jsx(VirtualizedAutocomplete, { ...args, value: value, onChange: handleOnChange, options: options, onOpen: handleOnOpen }));
22
- };
23
- export const Default = Template.bind({});
24
- Default.args = {
25
- helperText: 'OneToOne helperText',
26
- placeholder: 'OneToOne placeholder'
27
- };
@@ -1,21 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Popper, styled, TextField, InputAdornment } from '@mui/material';
3
- import Autocomplete, { autocompleteClasses } from '@mui/material/Autocomplete';
4
- import { ListboxComponent } from '../utils/virtualization';
5
- const VirtualizedAutocomplete = ({ helperText, placeholder, error, startAdornment, endAdornment, ...props }) => {
6
- return (_jsx(Autocomplete, { fullWidth: true, disableListWrap: true, size: 'small', PopperComponent: StyledPopper, ListboxComponent: ListboxComponent, renderInput: (params) => (_jsx(TextField, { ...params, helperText: helperText, error: error, placeholder: placeholder, InputProps: {
7
- ...params.InputProps,
8
- startAdornment: _jsx(InputAdornment, { position: 'end', children: startAdornment }),
9
- endAdornment: _jsxs(_Fragment, { children: [params.InputProps.endAdornment, _jsx(InputAdornment, { sx: { position: 'relative', right: '40px' }, position: 'end', children: endAdornment })] })
10
- } })), getOptionLabel: (option) => option.inputLabel, renderOption: (props, option) => [props, option.component], ...props }));
11
- };
12
- export default VirtualizedAutocomplete;
13
- const StyledPopper = styled(Popper)({
14
- [`& .${autocompleteClasses.listbox}`]: {
15
- boxSizing: 'border-box',
16
- '& ul': {
17
- padding: 0,
18
- margin: 0,
19
- },
20
- },
21
- });
package/es/index.js DELETED
@@ -1,14 +0,0 @@
1
- export { default as legacyTheme } from './LegacyTheme';
2
- export { default as theme } from './theme';
3
- export { default as FieldTypeText } from './FieldTypeText';
4
- export { default as FieldTypeSort } from './FieldTypeSort';
5
- export { default as FieldTypeUrl } from './FieldTypeUrl';
6
- export { default as FieldTypeDate } from './FieldTypeDate';
7
- export { default as FieldTypeDateTime } from './FieldTypeDateTime';
8
- export { default as FieldTypeColor } from './FieldTypeColor';
9
- export { default as FieldTypeNumber } from './FieldTypeNumber';
10
- export { default as FieldTypeOneToOne } from './FieldTypeOneToOne';
11
- export { default as FieldTypeOneToMany } from './FieldTypeOneToMany';
12
- export { default as CopyButton } from './CopyButton';
13
- export { default as ConfirmDialog } from './ConfirmDialog';
14
- export { default as VirtualizedAutocomplete } from './VitualizedAutocomplete';
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import ReactJson from 'react-json-view';
3
- import theme from '../theme';
4
- export default {
5
- title: 'Theme',
6
- };
7
- const Template = (args) => {
8
- return (_jsx(ReactJson, { src: theme }));
9
- };
10
- export const Default = Template.bind({});
@@ -1,4 +0,0 @@
1
- import { Story, Meta } from '@storybook/react/types-6-0';
2
- declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
3
- export default _default;
4
- export declare const Default: Story<import("@storybook/react/types-6-0").Args>;
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import ReactJson from 'react-json-view';
3
- import theme from '.';
4
- export default {
5
- title: 'Theme',
6
- };
7
- const Template = (args) => {
8
- return (_jsx(ReactJson, { src: theme }));
9
- };
10
- export const Default = Template.bind({});
@@ -1,63 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import * as React from 'react';
3
- import useMediaQuery from '@mui/material/useMediaQuery';
4
- import ListSubheader from '@mui/material/ListSubheader';
5
- import { useTheme } from '@mui/material/styles';
6
- import { VariableSizeList } from 'react-window';
7
- import Typography from '@mui/material/Typography';
8
- const LISTBOX_PADDING = 8; // px
9
- function renderRow(props) {
10
- const { data, index, style } = props;
11
- const dataSet = data[index];
12
- const inlineStyle = {
13
- ...style,
14
- top: style.top + LISTBOX_PADDING,
15
- };
16
- if (dataSet.hasOwnProperty('group')) {
17
- return (_jsx(ListSubheader, { component: "div", style: inlineStyle, children: dataSet.group }, dataSet.key));
18
- }
19
- return (_jsx(Typography, { component: "li", ...dataSet[0], noWrap: true, style: inlineStyle, children: dataSet[1] }));
20
- }
21
- const OuterElementContext = React.createContext({});
22
- const OuterElementType = React.forwardRef((props, ref) => {
23
- const outerProps = React.useContext(OuterElementContext);
24
- return _jsx("div", { ref: ref, ...props, ...outerProps });
25
- });
26
- function useResetCache(data) {
27
- const ref = React.useRef(null);
28
- React.useEffect(() => {
29
- if (ref.current != null) {
30
- ref.current.resetAfterIndex(0, true);
31
- }
32
- }, [data]);
33
- return ref;
34
- }
35
- // Adapter for react-window
36
- export const ListboxComponent = React.forwardRef(function ListboxComponent(props, ref) {
37
- const { children, ...other } = props;
38
- const itemData = [];
39
- children.forEach((item) => {
40
- itemData.push(item);
41
- itemData.push(...(item.children || []));
42
- });
43
- const theme = useTheme();
44
- const smUp = useMediaQuery(theme.breakpoints.up('sm'), {
45
- noSsr: true,
46
- });
47
- const itemCount = itemData.length;
48
- const itemSize = smUp ? 36 : 48;
49
- const getChildSize = (child) => {
50
- if (child.hasOwnProperty('group')) {
51
- return 48;
52
- }
53
- return itemSize;
54
- };
55
- const getHeight = () => {
56
- if (itemCount > 8) {
57
- return 8 * itemSize;
58
- }
59
- return itemData.map(getChildSize).reduce((a, b) => a + b, 0);
60
- };
61
- const gridRef = useResetCache(itemCount);
62
- return (_jsx("div", { ref: ref, children: _jsx(OuterElementContext.Provider, { value: other, children: _jsx(VariableSizeList, { itemData: itemData, height: getHeight() + 2 * LISTBOX_PADDING, width: "100%", ref: gridRef, outerElementType: OuterElementType, innerElementType: "ul", itemSize: (index) => getChildSize(itemData[index]), overscanCount: 5, itemCount: itemCount, children: renderRow }) }) }));
63
- });