@monolith-forensics/monolith-ui 1.0.12 → 1.1.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 (189) hide show
  1. package/Button/Button.tsx +382 -0
  2. package/Button/index.ts +2 -0
  3. package/{src/components/Calendar/Calendar.js → Calendar/Calendar.tsx} +104 -93
  4. package/{src/components/Calendar/CalendarStyles.js → Calendar/CalendarStyles.tsx} +26 -36
  5. package/{src/components/Calendar/calendarHelpers.js → Calendar/calendarHelpers.ts} +10 -8
  6. package/Calendar/index.ts +1 -0
  7. package/CheckBox/CheckBox.tsx +61 -0
  8. package/CheckBox/index.ts +1 -0
  9. package/{src/components/DateInput/DateInput.js → DateInput/DateInput.tsx} +227 -93
  10. package/DateInput/index.ts +1 -0
  11. package/DropDownMenu/DropDownMenu.tsx +402 -0
  12. package/DropDownMenu/index.ts +1 -0
  13. package/Error/Error.tsx +51 -0
  14. package/Error/index.ts +1 -0
  15. package/{src/components/FieldLabel → FieldLabel}/FieldLabel.tsx +25 -22
  16. package/{src/components/FileInputField/FileInputField.js → FileInputField/FileInputField.tsx} +23 -15
  17. package/FileInputField/index.ts +1 -0
  18. package/Flyout/Flyout.tsx +172 -0
  19. package/Flyout/FlyoutHeader.tsx +14 -0
  20. package/Flyout/FlyoutTitle.tsx +10 -0
  21. package/Flyout/index.ts +3 -0
  22. package/FormSection/FormSection.tsx +71 -0
  23. package/FormSection/index.ts +1 -0
  24. package/Grid/Grid.tsx +18 -0
  25. package/Grid/index.ts +1 -0
  26. package/IconButton/IconButton.tsx +27 -0
  27. package/IconButton/index.ts +1 -0
  28. package/{src/components/Input → Input}/Input.tsx +57 -34
  29. package/Modal/Modal.tsx +172 -0
  30. package/Modal/index.ts +1 -0
  31. package/{src/components/Pill → Pill}/Pill.tsx +41 -11
  32. package/SelectBox/SelectBox.tsx +745 -0
  33. package/SelectBox/index.ts +1 -0
  34. package/Switch/Switch.tsx +204 -0
  35. package/Switch/index.ts +1 -0
  36. package/TagBox/TagBox.tsx +694 -0
  37. package/TagBox/TagBoxStyles.tsx +116 -0
  38. package/TagBox/index.ts +1 -0
  39. package/{src/components/TextArea → TextArea}/TextArea.tsx +35 -13
  40. package/{src/components/TextAreaInput → TextAreaInput}/TextAreaInput.tsx +11 -13
  41. package/{src/components/TextInput → TextInput}/TextInput.tsx +11 -13
  42. package/Tooltip/Tooltip.tsx +68 -0
  43. package/Tooltip/index.ts +1 -0
  44. package/{src/components/ArrowButton → core}/ArrowButton.tsx +17 -20
  45. package/core/ClearButton.tsx +51 -0
  46. package/core/StyledContent.tsx +50 -0
  47. package/core/StyledFloatContainer.tsx +7 -0
  48. package/core/Types/Size.ts +3 -0
  49. package/core/Types/Variant.ts +10 -0
  50. package/core/index.ts +6 -0
  51. package/dist/Button/Button.d.ts +19 -0
  52. package/dist/Button/Button.js +332 -0
  53. package/dist/Button/index.d.ts +2 -0
  54. package/dist/Button/index.js +8 -0
  55. package/dist/Calendar/Calendar.d.ts +15 -0
  56. package/dist/Calendar/Calendar.js +232 -0
  57. package/dist/Calendar/CalendarStyles.d.ts +36 -0
  58. package/dist/Calendar/CalendarStyles.js +170 -0
  59. package/dist/Calendar/calendarHelpers.d.ts +53 -0
  60. package/dist/Calendar/calendarHelpers.js +181 -0
  61. package/dist/Calendar/index.d.ts +1 -0
  62. package/dist/Calendar/index.js +8 -0
  63. package/dist/CheckBox/CheckBox.d.ts +11 -0
  64. package/dist/CheckBox/CheckBox.js +34 -0
  65. package/dist/CheckBox/index.d.ts +1 -0
  66. package/dist/CheckBox/index.js +8 -0
  67. package/dist/DateInput/DateInput.d.ts +24 -0
  68. package/dist/DateInput/DateInput.js +511 -0
  69. package/dist/DateInput/index.d.ts +1 -0
  70. package/dist/DateInput/index.js +8 -0
  71. package/dist/DropDownMenu/DropDownMenu.d.ts +36 -0
  72. package/dist/DropDownMenu/DropDownMenu.js +212 -0
  73. package/dist/DropDownMenu/index.d.ts +1 -0
  74. package/dist/DropDownMenu/index.js +8 -0
  75. package/dist/Error/Error.d.ts +4 -0
  76. package/dist/Error/Error.js +38 -0
  77. package/dist/Error/index.d.ts +1 -0
  78. package/dist/Error/index.js +8 -0
  79. package/dist/FieldLabel/FieldLabel.d.ts +19 -0
  80. package/dist/FieldLabel/FieldLabel.js +119 -0
  81. package/dist/FieldLabel/index.d.ts +1 -0
  82. package/dist/FieldLabel/index.js +8 -0
  83. package/dist/FileInputField/FileInputField.d.ts +18 -0
  84. package/dist/FileInputField/FileInputField.js +116 -0
  85. package/dist/FileInputField/index.d.ts +1 -0
  86. package/dist/FileInputField/index.js +8 -0
  87. package/dist/Flyout/Flyout.d.ts +10 -0
  88. package/dist/Flyout/Flyout.js +111 -0
  89. package/dist/Flyout/FlyoutHeader.d.ts +5 -0
  90. package/dist/Flyout/FlyoutHeader.js +12 -0
  91. package/dist/Flyout/FlyoutTitle.d.ts +2 -0
  92. package/dist/Flyout/FlyoutTitle.js +13 -0
  93. package/dist/Flyout/index.d.ts +3 -0
  94. package/dist/Flyout/index.js +12 -0
  95. package/dist/FormSection/FormSection.d.ts +9 -0
  96. package/dist/FormSection/FormSection.js +51 -0
  97. package/dist/FormSection/index.d.ts +1 -0
  98. package/dist/FormSection/index.js +8 -0
  99. package/dist/Grid/Grid.d.ts +6 -0
  100. package/dist/Grid/Grid.js +15 -0
  101. package/dist/Grid/index.d.ts +1 -0
  102. package/dist/Grid/index.js +8 -0
  103. package/dist/IconButton/IconButton.d.ts +5 -0
  104. package/dist/IconButton/IconButton.js +30 -0
  105. package/dist/IconButton/index.d.ts +1 -0
  106. package/dist/IconButton/index.js +8 -0
  107. package/dist/Input/Input.d.ts +21 -0
  108. package/dist/Input/Input.js +148 -0
  109. package/dist/Input/index.d.ts +1 -0
  110. package/dist/Input/index.js +8 -0
  111. package/dist/Modal/Modal.d.ts +14 -0
  112. package/dist/Modal/Modal.js +134 -0
  113. package/dist/Modal/index.d.ts +1 -0
  114. package/dist/Modal/index.js +8 -0
  115. package/dist/Pill/Pill.d.ts +11 -0
  116. package/dist/Pill/Pill.js +146 -0
  117. package/dist/Pill/index.d.ts +1 -0
  118. package/dist/Pill/index.js +8 -0
  119. package/dist/SelectBox/SelectBox.d.ts +45 -0
  120. package/dist/SelectBox/SelectBox.js +469 -0
  121. package/dist/SelectBox/index.d.ts +1 -0
  122. package/dist/SelectBox/index.js +8 -0
  123. package/dist/Switch/Switch.d.ts +18 -0
  124. package/dist/Switch/Switch.js +157 -0
  125. package/dist/Switch/index.d.ts +1 -0
  126. package/dist/Switch/index.js +8 -0
  127. package/dist/TagBox/TagBox.d.ts +38 -0
  128. package/dist/TagBox/TagBox.js +440 -0
  129. package/dist/TagBox/TagBoxStyles.d.ts +11 -0
  130. package/dist/TagBox/TagBoxStyles.js +113 -0
  131. package/dist/TagBox/index.d.ts +1 -0
  132. package/dist/TagBox/index.js +8 -0
  133. package/dist/TextArea/TextArea.d.ts +16 -0
  134. package/dist/TextArea/TextArea.js +80 -0
  135. package/dist/TextArea/index.d.ts +1 -0
  136. package/dist/TextArea/index.js +8 -0
  137. package/dist/TextAreaInput/TextAreaInput.d.ts +12 -0
  138. package/dist/TextAreaInput/TextAreaInput.js +23 -0
  139. package/dist/TextAreaInput/index.d.ts +1 -0
  140. package/dist/TextAreaInput/index.js +8 -0
  141. package/dist/TextInput/TextInput.d.ts +12 -0
  142. package/dist/TextInput/TextInput.js +30 -0
  143. package/dist/TextInput/index.d.ts +1 -0
  144. package/dist/TextInput/index.js +8 -0
  145. package/dist/Tooltip/Tooltip.d.ts +12 -0
  146. package/dist/Tooltip/Tooltip.js +53 -0
  147. package/dist/Tooltip/index.d.ts +1 -0
  148. package/dist/Tooltip/index.js +8 -0
  149. package/dist/core/ArrowButton.d.ts +6 -0
  150. package/dist/core/ArrowButton.js +48 -0
  151. package/dist/core/ClearButton.d.ts +6 -0
  152. package/dist/core/ClearButton.js +48 -0
  153. package/dist/core/StyledContent.d.ts +7 -0
  154. package/dist/core/StyledContent.js +46 -0
  155. package/dist/core/StyledFloatContainer.d.ts +2 -0
  156. package/dist/core/StyledFloatContainer.js +10 -0
  157. package/dist/core/Types/Size.d.ts +2 -0
  158. package/dist/core/Types/Size.js +2 -0
  159. package/dist/core/Types/Variant.d.ts +2 -0
  160. package/dist/core/Types/Variant.js +2 -0
  161. package/dist/core/index.d.ts +6 -0
  162. package/dist/core/index.js +14 -0
  163. package/dist/index.d.ts +22 -0
  164. package/dist/index.js +51 -0
  165. package/index.ts +22 -0
  166. package/package.json +12 -20
  167. package/{src/components/theme → theme}/components.js +0 -2
  168. package/{src/components/theme → theme}/index.js +0 -1
  169. package/{src/components/theme → theme}/variants.js +0 -1
  170. package/tsconfig.json +11 -11
  171. package/.gitattributes +0 -2
  172. package/rollup.config.js +0 -10
  173. package/src/components/ArrowButton/index.tsx +0 -1
  174. package/src/components/Button/Button.tsx +0 -278
  175. package/src/components/Button/index.ts +0 -1
  176. package/src/components/SelectBox/SelectBox.js +0 -543
  177. package/src/components/TagBox/TagBox.js +0 -563
  178. package/src/components/index.ts +0 -7
  179. package/src/index.ts +0 -1
  180. /package/{src/components/FieldLabel → FieldLabel}/index.ts +0 -0
  181. /package/{src/components/Input/index.tsx → Input/index.ts} +0 -0
  182. /package/{src/components/Pill → Pill}/index.ts +0 -0
  183. /package/{src/components/TextArea → TextArea}/index.ts +0 -0
  184. /package/{src/components/TextAreaInput → TextAreaInput}/index.ts +0 -0
  185. /package/{src/components/TextInput/index.tsx → TextInput/index.ts} +0 -0
  186. /package/{src/components/core/index.js → core/MonolithThemeProvider.js} +0 -0
  187. /package/{src/components/theme → theme}/breakpoints.js +0 -0
  188. /package/{src/components/theme → theme}/shadows.js +0 -0
  189. /package/{src/components/theme → theme}/typography.js +0 -0
package/package.json CHANGED
@@ -1,23 +1,17 @@
1
1
  {
2
2
  "name": "@monolith-forensics/monolith-ui",
3
- "version": "1.0.12",
4
- "description": "UI used for Monolith Apps",
5
- "main": "index.js",
6
- "type": "module",
7
- "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1",
9
- "compile": "rollup -c"
10
- },
3
+ "version": "1.1.0",
4
+ "main": "./dist/index.js",
5
+ "author": "Matt Danner (Monolith Forensics LLC)",
6
+ "license": "private",
11
7
  "repository": {
12
8
  "type": "git",
13
- "url": "git+https://github.com/Monolith-Forensics/monolith-ui.git"
9
+ "url": "git+"
14
10
  },
15
- "author": "Matt Danner, Monolith Forensics LLC",
16
- "license": "ISC",
17
- "bugs": {
18
- "url": "https://github.com/Monolith-Forensics/monolith-ui/issues"
11
+ "types": "index.d.ts",
12
+ "scripts": {
13
+ "prepublish": "rm -r ./dist && tsc"
19
14
  },
20
- "homepage": "https://github.com/Monolith-Forensics/monolith-ui#readme",
21
15
  "dependencies": {
22
16
  "@floating-ui/react": "^0.26.16",
23
17
  "@radix-ui/react-tooltip": "^1.0.7",
@@ -26,12 +20,10 @@
26
20
  "react-textarea-autosize": "^8.5.3",
27
21
  "styled-components": "^6.1.11"
28
22
  },
23
+ "peerDependencies": {
24
+ "react": "18.2.0"
25
+ },
29
26
  "devDependencies": {
30
- "@rollup/plugin-typescript": "^11.1.6",
31
- "@types/react": "^18.3.2",
32
- "react": "^18.3.1",
33
- "rollup": "^4.18.0",
34
- "tslib": "^2.6.2",
35
- "typescript": "^5.4.5"
27
+ "typescript": "^5.5.4"
36
28
  }
37
29
  }
@@ -26,8 +26,6 @@ const components = {
26
26
  styleOverrides: {
27
27
  root: {
28
28
  borderRadius: "0px",
29
- // boxShadow:
30
- // "rgba(50, 50, 93, 0.025) 0px 2px 5px -1px, rgba(0, 0, 0, 0.05) 0px 1px 3px -1px",
31
29
  boxShadow:
32
30
  "0 1px 3px rgb(0 0 0 / 12%), 0 1px 2px rgb(0 0 0 / 24%) !important",
33
31
  backgroundImage: "none",
@@ -51,7 +51,6 @@ const createTheme = (name) => {
51
51
  // @ts-ignore
52
52
  components: componentsStyled,
53
53
  typography: typography,
54
- // shadows: shadows,
55
54
  palette: themeConfig.palette,
56
55
  zIndex: {
57
56
  mobileStepper: 1800,
@@ -41,7 +41,6 @@ const defaultVariant = {
41
41
  contrastText: "#FFF",
42
42
  },
43
43
  background: {
44
- // default: "#F7F9FC",
45
44
  default: "#FFF",
46
45
  paper: "#FFF",
47
46
  alt: "#ededed",
package/tsconfig.json CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "exclude": ["node_modules", "dist"],
2
3
  "compilerOptions": {
3
4
  /* Visit https://aka.ms/tsconfig to read more about this file */
4
5
 
@@ -11,9 +12,9 @@
11
12
  // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
13
 
13
14
  /* Language and Environment */
14
- "target": "ES2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
15
+ "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
15
16
  // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
- "jsx": "react" /* Specify what JSX code is generated. */,
17
+ "jsx": "react-jsx" /* Specify what JSX code is generated. */,
17
18
  // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
18
19
  // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
20
  // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
@@ -25,9 +26,9 @@
25
26
  // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26
27
 
27
28
  /* Modules */
28
- "module": "ESNext" /* Specify what module code is generated. */,
29
+ "module": "commonjs" /* Specify what module code is generated. */,
29
30
  // "rootDir": "./", /* Specify the root folder within your source files. */
30
- "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
31
+ // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
31
32
  // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
32
33
  // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
33
34
  // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
@@ -51,15 +52,14 @@
51
52
  /* Emit */
52
53
  "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
53
54
  // "declarationMap": true, /* Create sourcemaps for d.ts files. */
54
- "emitDeclarationOnly": true /* Only output d.ts files and not JavaScript files. */,
55
- "sourceMap": true /* Create source map files for emitted JavaScript files. */,
55
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
56
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
56
57
  // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
57
58
  // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
58
- "outDir": "dist" /* Specify an output folder for all emitted files. */,
59
+ "outDir": "./dist" /* Specify an output folder for all emitted files. */,
59
60
  // "removeComments": true, /* Disable emitting comments. */
60
61
  // "noEmit": true, /* Disable emitting files from a compilation. */
61
62
  // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
62
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
63
63
  // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
64
64
  // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
65
65
  // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
@@ -70,13 +70,13 @@
70
70
  // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
71
71
  // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
72
72
  // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
73
- "declarationDir": "dist/types" /* Specify the output directory for generated declaration files. */,
74
- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
73
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
75
74
 
76
75
  /* Interop Constraints */
77
76
  // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
78
77
  // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
79
- "allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */,
78
+ // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
79
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
80
80
  "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
81
81
  // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
82
82
  "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
package/.gitattributes DELETED
@@ -1,2 +0,0 @@
1
- # Auto detect text files and perform LF normalization
2
- * text=auto
package/rollup.config.js DELETED
@@ -1,10 +0,0 @@
1
- import typescript from "@rollup/plugin-typescript";
2
-
3
- export default {
4
- input: "src/index.ts",
5
- output: {
6
- dir: "dist",
7
- format: "cjs",
8
- },
9
- plugins: [typescript()],
10
- };
@@ -1 +0,0 @@
1
- export { default } from "./ArrowButton";
@@ -1,278 +0,0 @@
1
- import React from "react";
2
- import { forwardRef } from "react";
3
- import styled from "styled-components";
4
-
5
- const colors = {
6
- gray: "#dee2e6",
7
- red: "#e03131",
8
- pink: "#c2255c",
9
- grape: "#9c36b5",
10
- violet: "#6741d9",
11
- indigo: "#3b5bdb",
12
- cyan: "#0c8599",
13
- teal: "#099268",
14
- green: "#2f9e44",
15
- lime: "#66a80f",
16
- yellow: "#f08c00",
17
- orange: "#e8590c",
18
- };
19
-
20
- interface StyledButtonProps {
21
- variant?:
22
- | "default"
23
- | "contained"
24
- | "filled"
25
- | "light"
26
- | "outlined"
27
- | "text"
28
- | "subtle";
29
- color?: string;
30
- size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl";
31
- fullWidth?: boolean;
32
- }
33
-
34
- const StyledButton = styled.button<StyledButtonProps>`
35
- width: ${({ fullWidth }) => (fullWidth ? "100%" : "auto")};
36
- height: ${({ size }) => {
37
- switch (size) {
38
- case "xxs":
39
- return `24px`;
40
- case "xs":
41
- return `28px`;
42
- case "sm":
43
- return `34px`;
44
- case "md":
45
- return `40px`;
46
- case "lg":
47
- return `48px`;
48
- case "xl":
49
- return `58px`;
50
- default:
51
- return `34px`;
52
- }
53
- }};
54
-
55
- font-weight: 525;
56
- letter-spacing: 0.75px;
57
- font-size: ${({ size }) => {
58
- switch (size) {
59
- case "xxs":
60
- return `11px`;
61
- case "xs":
62
- return `12px`;
63
- case "sm":
64
- return `14px`;
65
- case "md":
66
- return `16px`;
67
- case "lg":
68
- return `18px`;
69
- case "xl":
70
- return `20px`;
71
- default:
72
- return `14px`;
73
- }
74
- }};
75
-
76
- padding: ${({ size }) => {
77
- switch (size) {
78
- case "xxs":
79
- return `0px 8px`;
80
- case "xs":
81
- return `0px 12px`;
82
- case "sm":
83
- return `0px 16px`;
84
- case "md":
85
- return `0px 20px`;
86
- case "lg":
87
- return `0px 24px`;
88
- case "xl":
89
- return `0px 30px`;
90
- default:
91
- return `0px 16px`;
92
- }
93
- }};
94
-
95
- color: ${({ theme, variant, color }) => {
96
- if (variant === "default") return theme.palette.text.primary;
97
- if (variant === "contained") return "white";
98
- if (variant === "filled") return "white";
99
-
100
- switch (color) {
101
- case "primary":
102
- return theme.palette.primary.main;
103
- case undefined || null:
104
- return theme.palette.text.primary;
105
- default:
106
- return (
107
- theme?.palette?.[color!]?.main ||
108
- colors?.[color!] ||
109
- theme.palette.text.primary
110
- );
111
- }
112
- }};
113
-
114
- background-color: ${({ theme, variant, color }) => {
115
- if (variant === "default") return "transparent";
116
- switch (variant) {
117
- case "contained":
118
- if (!color) return theme.palette.background.secondary;
119
- return (
120
- theme?.palette?.[color]?.main ||
121
- colors?.[color] ||
122
- theme.palette.background.secondary
123
- );
124
- case "filled":
125
- if (!color) return theme.palette.background.secondary;
126
- return (
127
- theme?.palette?.[color]?.main ||
128
- colors?.[color] ||
129
- theme.palette.background.secondary
130
- );
131
- case "light":
132
- if (!color) return theme.palette.background.secondary + "30";
133
- return (
134
- (theme?.palette?.[color]?.main ||
135
- colors?.[color] ||
136
- theme.palette.background.secondary) + "30"
137
- );
138
- case "outlined":
139
- return "transparent";
140
- case "text":
141
- return "transparent";
142
- default:
143
- return "transparent";
144
- }
145
- }};
146
-
147
- border-radius: 4px;
148
- border: 1px solid
149
- ${({ theme, variant, color }) => {
150
- switch (variant) {
151
- case "contained":
152
- return "transparent";
153
- case "filled":
154
- return "transparent";
155
- case "light":
156
- return "transparent";
157
- case "outlined":
158
- if (!color) return theme.palette.divider;
159
- return (
160
- theme?.palette?.[color]?.main ||
161
- colors?.[color] ||
162
- theme.palette.divider
163
- );
164
- case "text":
165
- return "transparent";
166
- case "subtle":
167
- return "transparent";
168
- default:
169
- if (!color) return theme.palette.divider;
170
- return (
171
- theme?.palette?.[color]?.main ||
172
- colors?.[color] ||
173
- theme.palette.divider
174
- );
175
- }
176
- }};
177
-
178
- cursor: pointer;
179
-
180
- transition: background-color 0.2s, border 0.2s;
181
-
182
- &:hover {
183
- background-color: ${({ theme, variant, color }) => {
184
- if (variant === "default") return "transparent";
185
- switch (variant) {
186
- case "contained":
187
- if (!color) return theme.palette.background.secondary + "90";
188
- return (
189
- (theme?.palette?.[color]?.main ||
190
- colors?.[color] ||
191
- theme.palette.background.secondary) + "90"
192
- );
193
- case "filled":
194
- if (!color) return theme.palette.background.secondary + "90";
195
- return (
196
- (theme?.palette?.[color]?.main ||
197
- colors?.[color] ||
198
- theme.palette.background.secondary) + "90"
199
- );
200
- case "light":
201
- if (!color) return theme.palette.background.secondary + "70";
202
- return (
203
- (theme?.palette?.[color]?.main ||
204
- colors?.[color] ||
205
- theme.palette.background.secondary) + "70"
206
- );
207
- case "outlined":
208
- return theme.palette.action.hover;
209
- case "text":
210
- return "transparent";
211
- case "subtle":
212
- if (!color) return theme.palette.action.hover;
213
- return theme?.palette?.[color]?.main || colors?.[color]
214
- ? (theme?.palette?.[color]?.main || colors?.[color]) + "30"
215
- : theme.palette.action.hover;
216
- default:
217
- return theme.palette.action.hover;
218
- }
219
- }};
220
-
221
- border: 1px solid
222
- ${({ theme, variant, color }) => {
223
- switch (variant) {
224
- case "contained":
225
- return "transparent";
226
- case "filled":
227
- return "transparent";
228
- case "light":
229
- return "transparent";
230
- case "outlined":
231
- if (!color) return theme.palette.divider;
232
- return colors?.[color] || theme.palette.divider;
233
- case "text":
234
- return "transparent";
235
- case "subtle":
236
- return "transparent";
237
- default:
238
- if (!color) return theme.palette.divider;
239
- return (
240
- theme?.palette?.[color]?.main ||
241
- colors?.[color] ||
242
- theme.palette.divider
243
- );
244
- }
245
- }};
246
- }
247
- `;
248
-
249
- export interface ButtonProps {
250
- children: React.ReactNode;
251
- variant?:
252
- | "default"
253
- | "contained"
254
- | "filled"
255
- | "light"
256
- | "outlined"
257
- | "text"
258
- | "subtle";
259
- color?: string;
260
- size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl";
261
- fullWidth?: boolean;
262
- onClick?: () => void;
263
- }
264
-
265
- const Button = forwardRef(
266
- (props: ButtonProps, ref: React.Ref<HTMLButtonElement>) => {
267
- const { children, ...other } = props;
268
- return (
269
- <StyledButton ref={ref} {...other}>
270
- <span style={{ height: "100%" }}>
271
- <span style={{ height: "100%" }}>{children}</span>
272
- </span>
273
- </StyledButton>
274
- );
275
- }
276
- );
277
-
278
- export default Button;
@@ -1 +0,0 @@
1
- export { default } from "./Button";