@zesty-io/material 0.2.5 → 0.3.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.
Files changed (118) hide show
  1. package/es/ConfirmDialog/ConfirmDialog.stories.d.ts +6 -0
  2. package/es/ConfirmDialog/ConfirmDialog.stories.js +24 -0
  3. package/es/ConfirmDialog/index.d.ts +18 -0
  4. package/es/ConfirmDialog/index.js +11 -0
  5. package/es/ConfirmModal/ConfirmModal.stories.d.ts +6 -0
  6. package/es/ConfirmModal/ConfirmModal.stories.js +24 -0
  7. package/es/ConfirmModal/index.d.ts +18 -0
  8. package/es/ConfirmModal/index.js +11 -0
  9. package/es/CopyButton/CopyButton.stories.d.ts +5 -0
  10. package/es/CopyButton/CopyButton.stories.js +14 -0
  11. package/es/CopyButton/index.d.ts +10 -0
  12. package/es/CopyButton/index.js +26 -0
  13. package/es/FieldTypeColor/FieldTypeColor.stories.d.ts +5 -0
  14. package/es/FieldTypeColor/FieldTypeColor.stories.js +21 -0
  15. package/es/FieldTypeColor/index.d.ts +6 -0
  16. package/es/FieldTypeColor/index.js +16 -0
  17. package/es/FieldTypeDate/FieldTypeDate.stories.d.ts +5 -0
  18. package/es/FieldTypeDate/FieldTypeDate.stories.js +17 -0
  19. package/es/FieldTypeDate/index.d.ts +9 -0
  20. package/es/FieldTypeDate/index.js +10 -0
  21. package/es/FieldTypeDateTime/FieldTypeDateTime.stories.d.ts +5 -0
  22. package/es/FieldTypeDateTime/FieldTypeDateTime.stories.js +17 -0
  23. package/es/FieldTypeDateTime/index.d.ts +9 -0
  24. package/es/FieldTypeDateTime/index.js +10 -0
  25. package/es/FieldTypeDropdown/FieldTypeDropwdon.stories.d.ts +5 -0
  26. package/es/FieldTypeDropdown/FieldTypeDropwdon.stories.js +35 -0
  27. package/es/FieldTypeDropdown/index.d.ts +11 -0
  28. package/es/FieldTypeDropdown/index.js +10 -0
  29. package/es/FieldTypeNumber/FieldTypeNumber.stories.d.ts +5 -0
  30. package/es/FieldTypeNumber/FieldTypeNumber.stories.js +21 -0
  31. package/es/FieldTypeNumber/index.d.ts +6 -0
  32. package/es/FieldTypeNumber/index.js +7 -0
  33. package/es/FieldTypeOneToMany/FieldTypeOneToMany.stories.d.ts +5 -0
  34. package/es/FieldTypeOneToMany/FieldTypeOneToMany.stories.js +28 -0
  35. package/es/FieldTypeOneToMany/index.d.ts +32 -0
  36. package/es/FieldTypeOneToMany/index.js +29 -0
  37. package/es/FieldTypeOneToOne/FieldTypeOneToOne.stories.d.ts +5 -0
  38. package/es/FieldTypeOneToOne/FieldTypeOneToOne.stories.js +28 -0
  39. package/es/FieldTypeOneToOne/index.d.ts +34 -0
  40. package/es/FieldTypeOneToOne/index.js +33 -0
  41. package/es/FieldTypeSort/FieldTypeSort.stories.d.ts +5 -0
  42. package/es/FieldTypeSort/FieldTypeSort.stories.js +22 -0
  43. package/es/FieldTypeSort/index.d.ts +7 -0
  44. package/es/FieldTypeSort/index.js +34 -0
  45. package/es/FieldTypeText/FieldTypeText.stories.d.ts +6 -0
  46. package/es/FieldTypeText/FieldTypeText.stories.js +29 -0
  47. package/es/FieldTypeText/index.d.ts +12 -0
  48. package/es/FieldTypeText/index.js +7 -0
  49. package/es/FieldTypeUrl/FieldTypeUrl.stories.d.ts +5 -0
  50. package/es/FieldTypeUrl/FieldTypeUrl.stories.js +21 -0
  51. package/es/FieldTypeUrl/index.d.ts +12 -0
  52. package/es/FieldTypeUrl/index.js +14 -0
  53. package/es/LegacyTheme/index.d.ts +3 -0
  54. package/es/LegacyTheme/index.js +83 -0
  55. package/es/LegacyTheme/palette.d.ts +3 -0
  56. package/es/LegacyTheme/palette.js +23 -0
  57. package/{src/LegacyTheme/typography.ts → es/LegacyTheme/typography.d.ts} +1 -5
  58. package/es/LegacyTheme/typography.js +4 -0
  59. package/es/TextField.stories.d.ts +5 -0
  60. package/es/TextField.stories.js +18 -0
  61. package/es/VitualizedAutocomplete/VirtualizedAutocomplete.stories.d.ts +5 -0
  62. package/es/VitualizedAutocomplete/VirtualizedAutocomplete.stories.js +27 -0
  63. package/es/VitualizedAutocomplete/index.d.ts +28 -0
  64. package/es/VitualizedAutocomplete/index.js +21 -0
  65. package/es/icons/FolderGlobal.d.ts +3 -0
  66. package/es/icons/FolderGlobal.js +3 -0
  67. package/es/icons/index.d.ts +1 -0
  68. package/es/icons/index.js +1 -0
  69. package/{src/index.ts → es/index.d.ts} +4 -3
  70. package/es/index.js +15 -0
  71. package/es/stories/Theme.stories.d.ts +4 -0
  72. package/es/stories/Theme.stories.js +10 -0
  73. package/es/theme/Theme.stories.d.ts +4 -0
  74. package/es/theme/Theme.stories.js +10 -0
  75. package/es/theme/index.d.ts +11 -0
  76. package/es/theme/index.js +143 -0
  77. package/es/theme/palette.d.ts +16 -0
  78. package/es/theme/palette.js +138 -0
  79. package/es/theme/typography.d.ts +9 -0
  80. package/es/theme/typography.js +57 -0
  81. package/es/utils/virtualization.d.ts +2 -0
  82. package/es/utils/virtualization.js +63 -0
  83. package/package.json +12 -10
  84. package/.storybook/main.js +0 -25
  85. package/.storybook/preview-head.html +0 -1
  86. package/.storybook/preview.js +0 -15
  87. package/src/ConfirmDialog/ConfirmDialog.stories.tsx +0 -35
  88. package/src/ConfirmDialog/index.tsx +0 -50
  89. package/src/CopyButton/CopyButton.stories.tsx +0 -20
  90. package/src/CopyButton/index.tsx +0 -55
  91. package/src/FieldTypeColor/FieldTypeColor.stories.tsx +0 -35
  92. package/src/FieldTypeColor/index.tsx +0 -43
  93. package/src/FieldTypeDate/FieldTypeDate.stories.tsx +0 -23
  94. package/src/FieldTypeDate/index.tsx +0 -35
  95. package/src/FieldTypeDateTime/FieldTypeDateTime.stories.tsx +0 -23
  96. package/src/FieldTypeDateTime/index.tsx +0 -36
  97. package/src/FieldTypeNumber/FieldTypeNumber.stories.tsx +0 -35
  98. package/src/FieldTypeNumber/index.tsx +0 -22
  99. package/src/FieldTypeOneToMany/FieldTypeOneToMany.stories.tsx +0 -47
  100. package/src/FieldTypeOneToMany/index.tsx +0 -90
  101. package/src/FieldTypeOneToOne/FieldTypeOneToOne.stories.tsx +0 -46
  102. package/src/FieldTypeOneToOne/index.tsx +0 -96
  103. package/src/FieldTypeSort/FieldTypeSort.stories.tsx +0 -36
  104. package/src/FieldTypeSort/index.tsx +0 -70
  105. package/src/FieldTypeText/FieldTypeText.stories.tsx +0 -45
  106. package/src/FieldTypeText/index.tsx +0 -35
  107. package/src/FieldTypeUrl/FieldTypeUrl.stories.tsx +0 -33
  108. package/src/FieldTypeUrl/index.tsx +0 -44
  109. package/src/LegacyTheme/index.ts +0 -88
  110. package/src/LegacyTheme/palette.ts +0 -25
  111. package/src/VitualizedAutocomplete/VirtualizedAutocomplete.stories.tsx +0 -45
  112. package/src/VitualizedAutocomplete/index.tsx +0 -69
  113. package/src/theme/Theme.stories.tsx +0 -16
  114. package/src/theme/index.ts +0 -53
  115. package/src/theme/palette.ts +0 -153
  116. package/src/theme/typography.ts +0 -69
  117. package/src/utils/virtualization.tsx +0 -107
  118. package/tsconfig.json +0 -22
@@ -0,0 +1,143 @@
1
+ import palette from './palette';
2
+ import typography from './typography';
3
+ import { alpha, createTheme, } from '@mui/material/styles';
4
+ let theme = createTheme({
5
+ palette,
6
+ typography,
7
+ });
8
+ theme = createTheme(theme, {
9
+ components: {
10
+ MuiFormLabel: {
11
+ styleOverrides: {
12
+ root: {
13
+ ...theme.typography.body2,
14
+ },
15
+ },
16
+ },
17
+ MuiTab: {
18
+ styleOverrides: {
19
+ root: {
20
+ borderBottom: 2,
21
+ borderColor: theme?.palette?.grey?.[100],
22
+ borderStyle: "solid",
23
+ },
24
+ },
25
+ },
26
+ MuiCardHeader: {
27
+ styleOverrides: {
28
+ root: {
29
+ padding: "16px 16px 0px",
30
+ },
31
+ },
32
+ },
33
+ MuiCardContent: {
34
+ styleOverrides: {
35
+ root: {
36
+ padding: "8px 16px 16px",
37
+ ":last-child": {
38
+ paddingBottom: "16px",
39
+ },
40
+ },
41
+ },
42
+ },
43
+ MuiButton: {
44
+ styleOverrides: { root: { textTransform: 'none' } },
45
+ defaultProps: {
46
+ disableElevation: true,
47
+ },
48
+ },
49
+ MuiOutlinedInput: {
50
+ styleOverrides: {
51
+ root: {
52
+ padding: "0px 8px",
53
+ borderRadius: '8px',
54
+ },
55
+ input: {
56
+ padding: "10px 0px",
57
+ },
58
+ sizeSmall: {
59
+ 'input': {
60
+ padding: "8px 0px",
61
+ },
62
+ },
63
+ notchedOutline: {
64
+ // Important to override all pseudo classes
65
+ borderColor: `${theme.palette.border} !important`,
66
+ },
67
+ }
68
+ },
69
+ MuiInputBase: {
70
+ styleOverrides: {
71
+ input: {
72
+ ...theme.typography.body2,
73
+ '::placeholder': {
74
+ color: theme?.palette?.text?.disabled
75
+ }
76
+ }
77
+ }
78
+ },
79
+ MuiInputAdornment: {
80
+ styleOverrides: {
81
+ root: {
82
+ '& > .MuiSvgIcon-root': {
83
+ margin: '4px',
84
+ }
85
+ }
86
+ }
87
+ },
88
+ MuiIconButton: {
89
+ styleOverrides: {
90
+ sizeSmall: {
91
+ padding: '4px',
92
+ }
93
+ }
94
+ },
95
+ MuiDialogTitle: {
96
+ styleOverrides: {
97
+ root: {
98
+ ...theme.typography.h5,
99
+ fontWeight: 600,
100
+ }
101
+ }
102
+ },
103
+ MuiDialogContentText: {
104
+ styleOverrides: {
105
+ root: {
106
+ ...theme.typography.body2,
107
+ }
108
+ }
109
+ },
110
+ MuiTreeItem: {
111
+ styleOverrides: {
112
+ content: {
113
+ paddingTop: '6px',
114
+ paddingBottom: '6px',
115
+ paddingLeft: 0,
116
+ paddingRight: '12px',
117
+ borderRadius: 4,
118
+ width: "unset",
119
+ '&.Mui-selected': {
120
+ background: alpha(theme?.palette?.primary?.main, 0.04),
121
+ ' .MuiTreeItem-label .MuiSvgIcon-root': {
122
+ color: theme?.palette?.primary?.main,
123
+ },
124
+ ' .MuiTypography-root': {
125
+ color: theme?.palette?.primary?.dark,
126
+ }
127
+ }
128
+ },
129
+ label: {
130
+ paddingLeft: '0',
131
+ },
132
+ iconContainer: {
133
+ marginRight: '0',
134
+ width: '24px',
135
+ 'svg': {
136
+ fontSize: '24px',
137
+ }
138
+ }
139
+ }
140
+ }
141
+ },
142
+ });
143
+ export default theme;
@@ -0,0 +1,16 @@
1
+ import { Color } from '@mui/material';
2
+ import { PaletteOptions } from '@mui/material/styles';
3
+ declare module '@mui/material/styles' {
4
+ interface PaletteOptions {
5
+ red?: Partial<Color>;
6
+ deepPurple?: Partial<Color>;
7
+ deepOrange?: Partial<Color>;
8
+ pink?: Partial<Color>;
9
+ blue?: Partial<Color>;
10
+ green?: Partial<Color>;
11
+ purple?: Partial<Color>;
12
+ border?: string;
13
+ }
14
+ }
15
+ declare const palette: PaletteOptions;
16
+ export default palette;
@@ -0,0 +1,138 @@
1
+ const palette = {
2
+ primary: {
3
+ main: "#FF5D0A",
4
+ dark: "#EC4A0A",
5
+ light: "#FD853A",
6
+ },
7
+ success: {
8
+ main: "#12B76A",
9
+ dark: "#027A48",
10
+ light: "#D1FADF",
11
+ },
12
+ warning: {
13
+ main: "#F79009",
14
+ dark: "B54708",
15
+ light: "#FEF0C7",
16
+ },
17
+ error: {
18
+ main: "#F04438",
19
+ dark: "#B42318",
20
+ light: "#FECDCA",
21
+ },
22
+ info: {
23
+ main: "#0BA5EC",
24
+ dark: "#026AA2",
25
+ light: "#7CD4FD",
26
+ },
27
+ text: {
28
+ primary: "#101828",
29
+ secondary: "#475467",
30
+ disabled: "#101828",
31
+ },
32
+ grey: {
33
+ 50: "#F9FAFB",
34
+ 100: "#F2F4F7",
35
+ 200: "#E4E7EC",
36
+ 300: "#D0D5DD",
37
+ 400: "#98A2B3",
38
+ 500: "#667085",
39
+ 600: "#475467",
40
+ 700: "#344054",
41
+ 800: "#1D2939",
42
+ 900: "#101828",
43
+ },
44
+ deepPurple: {
45
+ 50: '#F8F9FC',
46
+ 100: '#EAECF5',
47
+ 200: '#C8CCE5',
48
+ 300: '#9EA5D1',
49
+ 400: "#4E5BA6",
50
+ 500: '#4E5BA6',
51
+ 600: '#3E4784',
52
+ 700: '#363F72',
53
+ 800: '#293056',
54
+ 900: '#101323'
55
+ },
56
+ deepOrange: {
57
+ 50: "#FFF6ED",
58
+ 100: "#FFEAD5",
59
+ 200: "#FDDCAB",
60
+ 300: "#FEB273",
61
+ 400: "#FD853A",
62
+ 500: "#FF5C08",
63
+ 600: "#EC4A0A",
64
+ 700: "#C4320A",
65
+ 800: "#9C2A10",
66
+ 900: "#7E2410",
67
+ },
68
+ red: {
69
+ 50: '#FEF3F2',
70
+ 100: '#FEE4E2',
71
+ 200: '#FECDCA',
72
+ 300: '#FDA29B',
73
+ 400: '#F97066',
74
+ 500: '#F04438',
75
+ 600: '#D92D20',
76
+ 700: '#B42318',
77
+ 800: '#912018',
78
+ 900: '#7A271A',
79
+ },
80
+ pink: {
81
+ 50: '#FDF2FA',
82
+ 100: '#FCE7F6',
83
+ 200: '#FCCEEE',
84
+ 300: '#FAA7E0',
85
+ 400: "#F670C7",
86
+ 500: '#EE46BC',
87
+ 600: '#DD2590',
88
+ 700: '#C11574',
89
+ 800: '#9E165F',
90
+ 900: '#851651',
91
+ },
92
+ blue: {
93
+ 50: '#F0F9FF',
94
+ 100: "#E0F2FE",
95
+ 200: '#B9E6FE',
96
+ 300: '#7CD4FD',
97
+ 400: "#36BFFA",
98
+ 500: '#0BA5EC',
99
+ 600: '#0086C9',
100
+ 700: '#026AA2',
101
+ 800: '#065986',
102
+ 900: '#0B4A6F',
103
+ },
104
+ green: {
105
+ 50: '#ECFDF3',
106
+ 100: "#D1FADF",
107
+ 200: '#A6F4C5',
108
+ 300: '#6CE9A6',
109
+ 400: "#32D583",
110
+ 500: '#12B76A',
111
+ 600: '#039855',
112
+ 700: '#027A48',
113
+ 800: '#05603A',
114
+ 900: '#054F31',
115
+ },
116
+ purple: {
117
+ 50: '#F3E5F5',
118
+ 100: '#E1BEE7',
119
+ 200: '#CE93D8',
120
+ 300: '#BA68C8',
121
+ 400: '#AB47BC',
122
+ 500: '#9C27B0',
123
+ 600: '#8E24AA',
124
+ 700: '#7B1FA2',
125
+ 800: '#6A1B9A',
126
+ 900: '#4A148C',
127
+ },
128
+ border: "#F2F4F7",
129
+ action: {
130
+ active: "rgba(16, 24, 40, 0.40)",
131
+ hover: "rgba(16, 24, 40, 0.04)",
132
+ selected: "rgba(16, 24, 40, 0.08)",
133
+ disabled: "rgba(16, 24, 40, 0.26)",
134
+ disabledBackground: "rgba(16, 24, 40, 0.12)",
135
+ focus: "rgba(16, 24, 40, 0.12)",
136
+ }
137
+ };
138
+ export default palette;
@@ -0,0 +1,9 @@
1
+ import { TypographyVariantsOptions } from '@mui/material/styles';
2
+ import { TypographyStyleOptions } from '@mui/material/styles/createTypography';
3
+ declare module '@mui/material/styles' {
4
+ interface TypographyVariantsOptions {
5
+ body3?: TypographyStyleOptions;
6
+ }
7
+ }
8
+ declare const typography: TypographyVariantsOptions;
9
+ export default typography;
@@ -0,0 +1,57 @@
1
+ const typography = {
2
+ fontFamily: "'Mulish'",
3
+ h1: {
4
+ fontSize: "36px",
5
+ lineHeight: "44px",
6
+ },
7
+ h2: {
8
+ fontSize: "32px",
9
+ lineHeight: "40px",
10
+ },
11
+ h3: {
12
+ fontSize: "28px",
13
+ lineHeight: "36px",
14
+ },
15
+ h4: {
16
+ fontSize: "24px",
17
+ lineHeight: "32px",
18
+ },
19
+ h5: {
20
+ fontSize: "20px",
21
+ lineHeight: "28px",
22
+ },
23
+ h6: {
24
+ fontSize: "16px",
25
+ lineHeight: "22px",
26
+ },
27
+ body1: {
28
+ fontSize: '16px',
29
+ lineHeight: '24px',
30
+ },
31
+ body2: {
32
+ fontSize: '14px',
33
+ lineHeight: '20px',
34
+ },
35
+ body3: {
36
+ fontSize: '12px',
37
+ lineHeight: '18px',
38
+ letterSpacing: '0.15px',
39
+ },
40
+ subtitle1: {
41
+ fontSize: '16px',
42
+ lineHeight: "28px",
43
+ },
44
+ subtitle2: {
45
+ fontSize: '14px',
46
+ lineHeight: "22px",
47
+ },
48
+ caption: {
49
+ fontSize: '12px',
50
+ lineHeight: "20px",
51
+ },
52
+ overline: {
53
+ fontSize: "12px",
54
+ letterSpacing: "1px",
55
+ },
56
+ };
57
+ export default typography;
@@ -0,0 +1,2 @@
1
+ import * as React from 'react';
2
+ export declare const ListboxComponent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,63 @@
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
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zesty-io/material",
3
- "version": "0.2.5",
3
+ "version": "0.3.0",
4
4
  "description": "Contains custom components which are in addition to the @mui design-system",
5
5
  "author": "Zesty.io",
6
6
  "license": "MIT",
@@ -12,13 +12,11 @@
12
12
  "url": "https://github.com/zesty-io/material/issues"
13
13
  },
14
14
  "homepage": "https://zesty-io.github.io/material",
15
- "main": "cjs/index.js",
16
- "module": "es/index.js",
17
- "types": "es/index.d.ts",
15
+ "main": "./cjs/index.js",
16
+ "module": "./es/index.js",
17
+ "types": "./es/index.d.ts",
18
18
  "scripts": {
19
- "build": "npm run build:esm && npm run build:cjs",
20
- "build:esm": "tsc",
21
- "build:cjs": "tsc --module commonjs --outDir cjs",
19
+ "build": "npm ci && tsc",
22
20
  "prerelease": "npm test",
23
21
  "release": "npm run build && npm publish --access public",
24
22
  "release:alpha": "npm run build && npm publish --access public --tag alpha",
@@ -48,10 +46,14 @@
48
46
  "@types/react-window": "^1.8.5",
49
47
  "babel-loader": "^8.2.5",
50
48
  "gh-pages": "^3.2.3",
51
- "react": "^18.1.0",
49
+ "react": "^17.0.2",
52
50
  "react-docgen-typescript": "^2.2.2",
53
- "react-dom": "^18.1.0",
51
+ "react-dom": "^17.0.2",
54
52
  "react-json-view": "^1.21.3",
55
53
  "typescript": "^4.6.3"
56
- }
54
+ },
55
+ "files": [
56
+ "cjs",
57
+ "es"
58
+ ]
57
59
  }
@@ -1,25 +0,0 @@
1
- module.exports = {
2
- "stories": [
3
- "../src/**/*.stories.mdx",
4
- "../src/**/*.stories.@(js|jsx|ts|tsx)"
5
- ],
6
- "addons": [
7
- "@storybook/addon-links",
8
- "@storybook/addon-essentials",
9
- ],
10
- "framework": "@storybook/react",
11
- typescript: {
12
- check: true,
13
- reactDocgen: 'react-docgen-typescript',
14
- reactDocgenTypescriptOptions: {
15
- shouldExtractLiteralValuesFromEnum: true,
16
- shouldRemoveUndefinedFromOptional: true,
17
- propFilter: (prop) => {
18
- return prop.parent
19
- ? /@mui/.test(prop.parent.fileName) ||
20
- !/node_modules/.test(prop.parent.fileName)
21
- : true;
22
- },
23
- },
24
- },
25
- }
@@ -1 +0,0 @@
1
- <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Mulish" />
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import { ThemeProvider } from 'emotion-theming';
3
- import { theme } from '../src/index.ts';
4
-
5
- export const parameters = {
6
- actions: { argTypesRegex: '^on[A-Z].*' },
7
- };
8
-
9
- export const decorators = [
10
- (Story) => (
11
- <ThemeProvider theme={theme}>
12
- <Story />
13
- </ThemeProvider>
14
- ),
15
- ];
@@ -1,35 +0,0 @@
1
- import { useState } from 'react';
2
- import { Story, Meta } from '@storybook/react/types-6-0';
3
- import { Button, Stack } from '@mui/material';
4
- import ConfirmDialog, { ConfirmDialogProps } from '.';
5
-
6
- export default {
7
- title: 'ConfirmDialog',
8
- component: ConfirmDialog,
9
- argType: {},
10
- } as Meta;
11
-
12
- const Template: Story<ConfirmDialogProps> = (args) => {
13
- const [open, setOpen] = useState(false);
14
-
15
- return (
16
- <>
17
- <Button variant="contained" onClick={() => setOpen(true)}>Click me to open</Button>
18
- <ConfirmDialog {...args} open={open} callback={(confirmed) => setOpen(false) } />
19
- </>
20
- );
21
- };
22
-
23
- export const Default = Template.bind({});
24
- Default.args = {
25
- title: 'Confirm modal title',
26
- content: 'Confirm modal content',
27
- };
28
-
29
- export const CustomChildren = Template.bind({});
30
- CustomChildren.args = {
31
- title: 'Confirm modal title',
32
- content: 'Confirm modal content',
33
- children: <><Button color="error" variant="contained">Custom 1</Button><Button color="success" variant="contained">Custom 2</Button></>
34
- };
35
-
@@ -1,50 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import Dialog, { DialogProps } from '@mui/material/Dialog';
3
- import DialogActions from '@mui/material/DialogActions';
4
- import DialogContent from '@mui/material/DialogContent';
5
- import DialogContentText from '@mui/material/DialogContentText';
6
- import DialogTitle from '@mui/material/DialogTitle';
7
- import { Button } from '@mui/material';
8
-
9
- export interface ConfirmDialogProps extends Omit<DialogProps, 'title'> {
10
- /**
11
- * Title of confirm dialog
12
- */
13
- title: string | ReactNode ;
14
- /**
15
- * Content of confirm dialog
16
- */
17
- content: string | ReactNode ;
18
- /**
19
- * Callback of confirm dialog
20
- */
21
- callback: (confirmed: boolean) => void ;
22
- }
23
-
24
- const ConfirmDialog = ({title, content, onClose, children, callback, ...props }: ConfirmDialogProps) => {
25
-
26
- return (
27
- <Dialog
28
- {...props}
29
- >
30
- <DialogTitle>
31
- {title}
32
- </DialogTitle>
33
- <DialogContent>
34
- <DialogContentText>
35
- {content}
36
- </DialogContentText>
37
- </DialogContent>
38
- {children ? <DialogActions>{children}</DialogActions> : (
39
- <DialogActions>
40
- <Button variant="contained" onClick={() => callback(false)}>No</Button>
41
- <Button variant="contained" onClick={() => callback(true)} autoFocus>
42
- Yes
43
- </Button>
44
- </DialogActions>
45
- )}
46
- </Dialog>
47
- );
48
- };
49
-
50
- export default ConfirmDialog;
@@ -1,20 +0,0 @@
1
- import { Story, Meta } from '@storybook/react/types-6-0';
2
- import CopyButton, { CopyButtonProps } from '.';
3
-
4
- export default {
5
- title: 'CopyButton',
6
- component: CopyButton,
7
- argType: {},
8
- } as Meta;
9
-
10
- const Template: Story<CopyButtonProps> = (args) => {
11
-
12
- return (
13
- <CopyButton {...args} />
14
- );
15
- };
16
-
17
- export const Default = Template.bind({});
18
- Default.args = {
19
- value: 'Copy Me!'
20
- };
@@ -1,55 +0,0 @@
1
- import { useCallback, useState, useEffect } from 'react';
2
- import Button, { ButtonProps } from '@mui/material/Button';
3
- import ContentCopyIcon from '@mui/icons-material/ContentCopy';
4
- import CheckIcon from '@mui/icons-material/Check';
5
-
6
- export interface CopyButtonProps extends ButtonProps {
7
- /**
8
- * Value to be copied to clipboard
9
- */
10
- value: string ;
11
- }
12
-
13
- const CopyButton = ({value, sx, ...props }: CopyButtonProps) => {
14
- const [copied, setCopied] = useState(false);
15
-
16
- const copyValue = useCallback(() => {
17
- navigator?.clipboard.writeText(value);
18
- setCopied(true);
19
- }, [value]);
20
-
21
- useEffect(() => {
22
- const iconTimer = setTimeout(() => {
23
- setCopied(false);
24
- }, 500);
25
-
26
- return () => {
27
- clearTimeout(iconTimer);
28
- };
29
- }, [copied]);
30
-
31
- return (
32
- <Button
33
- variant='outlined'
34
- onClick={copyValue}
35
- size="small"
36
- title={props.children ? `Copy ${props.children}` : `Copy ${value}`}
37
- sx={{
38
- textTransform: 'unset',
39
- // Spread sx prop at the end to allow sx prop overrides
40
- ...sx,
41
- }}
42
- startIcon={copied ? (
43
- <CheckIcon color='success' fontSize='small' />
44
- ) : (
45
- <ContentCopyIcon fontSize='small' />
46
- )}
47
- // Spread props at the end to allow prop overrides
48
- {...props}
49
- >
50
- {props.children ? props.children : value}
51
- </Button>
52
- );
53
- };
54
-
55
- export default CopyButton;