@monolith-forensics/monolith-ui 1.0.8 → 1.0.9

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 (38) hide show
  1. package/.gitattributes +2 -0
  2. package/package.json +24 -9
  3. package/rollup.config.js +10 -0
  4. package/src/components/ArrowButton/ArrowButton.tsx +54 -0
  5. package/src/components/ArrowButton/index.tsx +1 -0
  6. package/{Button/Button.js → src/components/Button/Button.tsx} +61 -17
  7. package/src/components/Button/index.ts +1 -0
  8. package/{FieldLabel/FieldLabel.js → src/components/FieldLabel/FieldLabel.tsx} +46 -28
  9. package/src/components/FieldLabel/index.ts +1 -0
  10. package/{primitives/Input.js → src/components/Input/Input.tsx} +28 -14
  11. package/src/components/Input/index.tsx +1 -0
  12. package/{Pill/Pill.js → src/components/Pill/Pill.tsx} +8 -1
  13. package/src/components/Pill/index.ts +1 -0
  14. package/{SelectBox → src/components/SelectBox}/SelectBox.js +2 -38
  15. package/{primitives/TextArea.js → src/components/TextArea/TextArea.tsx} +9 -4
  16. package/src/components/TextArea/index.ts +1 -0
  17. package/{TextAreaInput/TextAreaInput.js → src/components/TextAreaInput/TextAreaInput.tsx} +18 -5
  18. package/src/components/TextAreaInput/index.ts +1 -0
  19. package/{TextInput/TextInput.js → src/components/TextInput/TextInput.tsx} +18 -5
  20. package/src/components/TextInput/index.tsx +1 -0
  21. package/src/components/index.ts +7 -0
  22. package/src/index.ts +1 -0
  23. package/tsconfig.json +109 -0
  24. package/TagBox/TagBoxOLD.js +0 -75
  25. package/TagBox/TagBoxStyles.js +0 -122
  26. /package/{Calendar → src/components/Calendar}/Calendar.js +0 -0
  27. /package/{Calendar → src/components/Calendar}/CalendarStyles.js +0 -0
  28. /package/{Calendar → src/components/Calendar}/calendarHelpers.js +0 -0
  29. /package/{DateInput → src/components/DateInput}/DateInput.js +0 -0
  30. /package/{FileInputField → src/components/FileInputField}/FileInputField.js +0 -0
  31. /package/{TagBox → src/components/TagBox}/TagBox.js +0 -0
  32. /package/{core → src/components/core}/index.js +0 -0
  33. /package/{theme → src/components/theme}/breakpoints.js +0 -0
  34. /package/{theme → src/components/theme}/components.js +0 -0
  35. /package/{theme → src/components/theme}/index.js +0 -0
  36. /package/{theme → src/components/theme}/shadows.js +0 -0
  37. /package/{theme → src/components/theme}/typography.js +0 -0
  38. /package/{theme → src/components/theme}/variants.js +0 -0
package/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
package/package.json CHANGED
@@ -1,23 +1,38 @@
1
1
  {
2
2
  "name": "@monolith-forensics/monolith-ui",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
+ "description": "UI used for Monolith Apps",
4
5
  "main": "index.js",
5
- "author": "Matt Danner (Monolith Forensics LLC)",
6
- "license": "private",
6
+ "type": "module",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "compile": "rollup -c",
10
+ "publish": "npm publish"
11
+ },
7
12
  "repository": {
8
13
  "type": "git",
9
- "url": "git+https://github.com/Monolith-Forensics/monolith-app.git",
10
- "directory": "packages/@monolith-ui"
14
+ "url": "git+https://github.com/Monolith-Forensics/monolith-ui.git"
15
+ },
16
+ "author": "Matt Danner, Monolith Forensics LLC",
17
+ "license": "ISC",
18
+ "bugs": {
19
+ "url": "https://github.com/Monolith-Forensics/monolith-ui/issues"
11
20
  },
21
+ "homepage": "https://github.com/Monolith-Forensics/monolith-ui#readme",
12
22
  "dependencies": {
13
23
  "@floating-ui/react": "^0.26.16",
14
24
  "@radix-ui/react-tooltip": "^1.0.7",
15
25
  "deepmerge": "^4.3.1",
16
26
  "lucide-react": "^0.378.0",
17
- "styled-components": "^6.1.11",
18
- "react-textarea-autosize": "^8.5.3"
27
+ "react-textarea-autosize": "^8.5.3",
28
+ "styled-components": "^6.1.11"
19
29
  },
20
- "peerDependencies": {
21
- "react": "18.2.0"
30
+ "devDependencies": {
31
+ "@rollup/plugin-typescript": "^11.1.6",
32
+ "@types/react": "^18.3.2",
33
+ "react": "^18.3.1",
34
+ "rollup": "^4.18.0",
35
+ "tslib": "^2.6.2",
36
+ "typescript": "^5.4.5"
22
37
  }
23
38
  }
@@ -0,0 +1,10 @@
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
+ };
@@ -0,0 +1,54 @@
1
+ import React from "react";
2
+ import { ChevronDownIcon } from "lucide-react";
3
+ import styled from "styled-components";
4
+
5
+ interface ArrowIconProps {
6
+ className?: string;
7
+ }
8
+
9
+ const ArrowIcon: React.FC<ArrowIconProps> = styled(
10
+ ({ className, ...props }: ArrowIconProps) => (
11
+ <div className={className} {...props}>
12
+ <ChevronDownIcon size={16} />
13
+ </div>
14
+ )
15
+ )`
16
+ color: ${(props) => props.theme.palette.text.secondary};
17
+ transition: transform 0.2s ease-in-out;
18
+ transform: rotate(0deg);
19
+ will-change: transform;
20
+
21
+ display: flex;
22
+ flex-direction: column;
23
+ align-items: center;
24
+ justify-content: center;
25
+ `;
26
+
27
+ interface ArrowButtonProps {
28
+ className?: string;
29
+ }
30
+
31
+ const ArrowButton: React.FC<ArrowButtonProps> = styled(
32
+ ({ className, ...props }: ArrowButtonProps) => (
33
+ <button
34
+ className={className}
35
+ {...props}
36
+ tabIndex={-1}
37
+ data-default-btn={true}
38
+ >
39
+ <ArrowIcon />
40
+ </button>
41
+ )
42
+ )`
43
+ position: absolute;
44
+ right: 0;
45
+ height: 100%;
46
+ padding-inline: 10px;
47
+ background: none;
48
+ border: none;
49
+ cursor: pointer;
50
+ margin: 0;
51
+ outline: none;
52
+ `;
53
+
54
+ export default ArrowButton;
@@ -0,0 +1 @@
1
+ export { default } from "./ArrowButton";
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { forwardRef } from "react";
2
3
  import styled from "styled-components";
3
4
 
@@ -16,9 +17,23 @@ const colors = {
16
17
  orange: "#e8590c",
17
18
  };
18
19
 
19
- const StyledButton = styled.button`
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>`
20
35
  width: ${({ fullWidth }) => (fullWidth ? "100%" : "auto")};
21
- height: ${({ theme, size }) => {
36
+ height: ${({ size }) => {
22
37
  switch (size) {
23
38
  case "xxs":
24
39
  return `24px`;
@@ -39,7 +54,7 @@ const StyledButton = styled.button`
39
54
 
40
55
  font-weight: 525;
41
56
  letter-spacing: 0.75px;
42
- font-size: ${({ theme, size }) => {
57
+ font-size: ${({ size }) => {
43
58
  switch (size) {
44
59
  case "xxs":
45
60
  return `11px`;
@@ -58,7 +73,7 @@ const StyledButton = styled.button`
58
73
  }
59
74
  }};
60
75
 
61
- padding: ${({ theme, size }) => {
76
+ padding: ${({ size }) => {
62
77
  switch (size) {
63
78
  case "xxs":
64
79
  return `0px 8px`;
@@ -85,12 +100,12 @@ const StyledButton = styled.button`
85
100
  switch (color) {
86
101
  case "primary":
87
102
  return theme.palette.primary.main;
88
- case !color:
103
+ case undefined || null:
89
104
  return theme.palette.text.primary;
90
105
  default:
91
106
  return (
92
- theme?.palette?.[color]?.main ||
93
- colors?.[color] ||
107
+ theme?.palette?.[color!]?.main ||
108
+ colors?.[color!] ||
94
109
  theme.palette.text.primary
95
110
  );
96
111
  }
@@ -100,18 +115,21 @@ const StyledButton = styled.button`
100
115
  if (variant === "default") return "transparent";
101
116
  switch (variant) {
102
117
  case "contained":
118
+ if (!color) return theme.palette.background.secondary;
103
119
  return (
104
120
  theme?.palette?.[color]?.main ||
105
121
  colors?.[color] ||
106
122
  theme.palette.background.secondary
107
123
  );
108
124
  case "filled":
125
+ if (!color) return theme.palette.background.secondary;
109
126
  return (
110
127
  theme?.palette?.[color]?.main ||
111
128
  colors?.[color] ||
112
129
  theme.palette.background.secondary
113
130
  );
114
131
  case "light":
132
+ if (!color) return theme.palette.background.secondary + "30";
115
133
  return (
116
134
  (theme?.palette?.[color]?.main ||
117
135
  colors?.[color] ||
@@ -137,6 +155,7 @@ const StyledButton = styled.button`
137
155
  case "light":
138
156
  return "transparent";
139
157
  case "outlined":
158
+ if (!color) return theme.palette.divider;
140
159
  return (
141
160
  theme?.palette?.[color]?.main ||
142
161
  colors?.[color] ||
@@ -147,6 +166,7 @@ const StyledButton = styled.button`
147
166
  case "subtle":
148
167
  return "transparent";
149
168
  default:
169
+ if (!color) return theme.palette.divider;
150
170
  return (
151
171
  theme?.palette?.[color]?.main ||
152
172
  colors?.[color] ||
@@ -164,18 +184,21 @@ const StyledButton = styled.button`
164
184
  if (variant === "default") return "transparent";
165
185
  switch (variant) {
166
186
  case "contained":
187
+ if (!color) return theme.palette.background.secondary + "90";
167
188
  return (
168
189
  (theme?.palette?.[color]?.main ||
169
190
  colors?.[color] ||
170
191
  theme.palette.background.secondary) + "90"
171
192
  );
172
193
  case "filled":
194
+ if (!color) return theme.palette.background.secondary + "90";
173
195
  return (
174
196
  (theme?.palette?.[color]?.main ||
175
197
  colors?.[color] ||
176
198
  theme.palette.background.secondary) + "90"
177
199
  );
178
200
  case "light":
201
+ if (!color) return theme.palette.background.secondary + "70";
179
202
  return (
180
203
  (theme?.palette?.[color]?.main ||
181
204
  colors?.[color] ||
@@ -186,6 +209,7 @@ const StyledButton = styled.button`
186
209
  case "text":
187
210
  return "transparent";
188
211
  case "subtle":
212
+ if (!color) return theme.palette.action.hover;
189
213
  return theme?.palette?.[color]?.main || colors?.[color]
190
214
  ? (theme?.palette?.[color]?.main || colors?.[color]) + "30"
191
215
  : theme.palette.action.hover;
@@ -204,12 +228,14 @@ const StyledButton = styled.button`
204
228
  case "light":
205
229
  return "transparent";
206
230
  case "outlined":
231
+ if (!color) return theme.palette.divider;
207
232
  return colors?.[color] || theme.palette.divider;
208
233
  case "text":
209
234
  return "transparent";
210
235
  case "subtle":
211
236
  return "transparent";
212
237
  default:
238
+ if (!color) return theme.palette.divider;
213
239
  return (
214
240
  theme?.palette?.[color]?.main ||
215
241
  colors?.[color] ||
@@ -220,15 +246,33 @@ const StyledButton = styled.button`
220
246
  }
221
247
  `;
222
248
 
223
- const Button = forwardRef((props, ref) => {
224
- const { children, ...other } = props;
225
- return (
226
- <StyledButton ref={ref} {...other}>
227
- <span style={{ height: "100%" }}>
228
- <span style={{ height: "100%" }}>{children}</span>
229
- </span>
230
- </StyledButton>
231
- );
232
- });
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
+ );
233
277
 
234
278
  export default Button;
@@ -0,0 +1 @@
1
+ export { default } from "./Button";
@@ -1,33 +1,42 @@
1
+ import React from "react";
1
2
  import styled from "styled-components";
2
3
  import * as Tooltip from "@radix-ui/react-tooltip";
3
4
 
4
- const InfoComponent = styled(({ className, children, description, label }) => {
5
- if (!description) return children;
6
-
7
- return (
8
- <Tooltip.Provider
9
- delayDuration={800}
10
- skipDelayDuration={0}
11
- disableHoverableContent
12
- >
13
- <Tooltip.Root>
14
- <Tooltip.Trigger asChild>{children}</Tooltip.Trigger>
15
- <Tooltip.Portal>
16
- <Tooltip.Content
17
- className={className}
18
- side="right"
19
- sideOffset={15}
20
- align="start"
21
- onClick={(e) => e.stopPropagation()}
22
- >
23
- <div className="title">{label || "Info"}</div>
24
- <div>{description || "N/A"}</div>
25
- </Tooltip.Content>
26
- </Tooltip.Portal>
27
- </Tooltip.Root>
28
- </Tooltip.Provider>
29
- );
30
- })`
5
+ interface InfoComponentProps {
6
+ description?: string | null;
7
+ label?: string | Element;
8
+ children: React.ReactNode;
9
+ }
10
+
11
+ const InfoComponent: React.FC<InfoComponentProps> = styled(
12
+ ({ className, children, description, label }) => {
13
+ if (!description) return children;
14
+
15
+ return (
16
+ <Tooltip.Provider
17
+ delayDuration={800}
18
+ skipDelayDuration={0}
19
+ disableHoverableContent
20
+ >
21
+ <Tooltip.Root>
22
+ <Tooltip.Trigger asChild>{children}</Tooltip.Trigger>
23
+ <Tooltip.Portal>
24
+ <Tooltip.Content
25
+ className={className}
26
+ side="right"
27
+ sideOffset={15}
28
+ align="start"
29
+ onClick={(e) => e.stopPropagation()}
30
+ >
31
+ <div className="title">{label || "Info"}</div>
32
+ <div>{description || "N/A"}</div>
33
+ </Tooltip.Content>
34
+ </Tooltip.Portal>
35
+ </Tooltip.Root>
36
+ </Tooltip.Provider>
37
+ );
38
+ }
39
+ )`
31
40
  pointer-events: none;
32
41
  z-index: 99999;
33
42
  background-color: ${({ theme }) => theme.palette.background.default};
@@ -47,7 +56,16 @@ const InfoComponent = styled(({ className, children, description, label }) => {
47
56
  }
48
57
  `;
49
58
 
50
- const FieldLabel = styled(
59
+ interface FieldLabelProps {
60
+ errorMessage?: string;
61
+ error?: boolean;
62
+ description?: string | null;
63
+ size?: "xs" | "sm" | "md" | "lg" | "xl";
64
+ asterisk?: boolean;
65
+ children: string | Element;
66
+ }
67
+
68
+ const FieldLabel: React.FC<FieldLabelProps> = styled(
51
69
  ({
52
70
  className,
53
71
  children,
@@ -0,0 +1 @@
1
+ export { default } from "./FieldLabel";
@@ -1,24 +1,36 @@
1
+ import React from "react";
1
2
  import styled from "styled-components";
2
3
 
3
- export const StyledInput = styled.input`
4
+ interface StyledInputProps {
5
+ variant?: "contained" | "filled" | "outlined" | "text";
6
+ size?: "xs" | "sm" | "md" | "lg" | "xl";
7
+ width?: string | number | null;
8
+ error?: boolean;
9
+ }
10
+
11
+ const StyledInput = styled.input<StyledInputProps>`
4
12
  font-family: ${({ theme }) => theme.typography.fontFamily};
5
13
  pointer-events: "all";
6
14
  user-select: "all";
7
15
  outline: none;
8
16
 
9
- color: ${({ theme, error }) => theme.palette.text.primary};
10
- font-size: ${({ size }) =>
11
- size === "xs"
12
- ? "12px"
13
- : size === "sm"
14
- ? "14px"
15
- : size === "md"
16
- ? "16px"
17
- : size === "lg"
18
- ? "18px"
19
- : size === "xl"
20
- ? "20px"
21
- : "12px"};
17
+ color: ${({ theme }) => theme.palette.text.primary};
18
+ font-size: ${({ size }) => {
19
+ switch (size) {
20
+ case "xs":
21
+ return "12px";
22
+ case "sm":
23
+ return "14px";
24
+ case "md":
25
+ return "16px";
26
+ case "lg":
27
+ return "18px";
28
+ case "xl":
29
+ return "20px";
30
+ default:
31
+ return "12px";
32
+ }
33
+ }};
22
34
 
23
35
  height: ${({ size }) =>
24
36
  size === "xs"
@@ -125,3 +137,5 @@ export const StyledInput = styled.input`
125
137
  border: 1px solid ${({ theme, error }) => theme.palette.primary.main};
126
138
  }
127
139
  `;
140
+
141
+ export default StyledInput;
@@ -0,0 +1 @@
1
+ export { default } from "./Input";
@@ -1,6 +1,13 @@
1
+ import React from "react";
1
2
  import styled from "styled-components";
2
3
  import { X } from "lucide-react";
3
4
 
5
+ interface PillProps {
6
+ size?: "xs" | "sm" | "md" | "lg" | "xl";
7
+ showRemoveIcon?: boolean;
8
+ onRemove?: () => void;
9
+ }
10
+
4
11
  const StyledButton = styled.button`
5
12
  background-color: transparent;
6
13
  border: none;
@@ -15,7 +22,7 @@ const StyledButton = styled.button`
15
22
  padding-inline-end: 5px;
16
23
  `;
17
24
 
18
- const Pill = styled(
25
+ const Pill: React.FC<PillProps> = styled(
19
26
  ({ className, children, size, showRemoveIcon = true, onRemove }) => {
20
27
  const handleRemove = (e) => {
21
28
  e.preventDefault();
@@ -0,0 +1 @@
1
+ export { default } from "./Pill";
@@ -1,8 +1,9 @@
1
1
  import styled from "styled-components";
2
2
  import { useFloating, flip, offset } from "@floating-ui/react";
3
3
  import { useCallback, useEffect, useRef, useState } from "react";
4
- import { ChevronDownIcon, X } from "lucide-react";
4
+ import { X } from "lucide-react";
5
5
  import FieldLabel from "../FieldLabel/FieldLabel.js";
6
+ import ArrowButton from "../ArrowButton";
6
7
 
7
8
  export const StyledInputContainer = styled.div`
8
9
  position: relative;
@@ -215,43 +216,6 @@ const StyledItem = styled.div`
215
216
  }
216
217
  `;
217
218
 
218
- const ArrowIcon = styled(({ className, ...props }) => (
219
- <div className={className} {...props}>
220
- <ChevronDownIcon size={16} />
221
- </div>
222
- ))`
223
- color: ${(props) => props.theme.palette.text.secondary};
224
- transition: transform 0.2s ease-in-out;
225
- transform: rotate(0deg);
226
- will-change: transform;
227
-
228
- display: flex;
229
- flex-direction: column;
230
- align-items: center;
231
- justify-content: center;
232
- `;
233
-
234
- export const ArrowButton = styled(({ className, ...props }) => (
235
- <button
236
- className={className}
237
- {...props}
238
- tabIndex={-1}
239
- data-default-btn={true}
240
- >
241
- <ArrowIcon />
242
- </button>
243
- ))`
244
- position: absolute;
245
- right: 0;
246
- height: 100%;
247
- padding-inline: 10px;
248
- background: none;
249
- border: none;
250
- cursor: pointer;
251
- margin: 0;
252
- outline: none;
253
- `;
254
-
255
219
  const ClearIcon = styled(({ className, ...props }) => (
256
220
  <div className={className} {...props}>
257
221
  <X size={16} />
@@ -1,7 +1,13 @@
1
+ import React from "react";
1
2
  import styled from "styled-components";
2
3
  import TextareaAutosize from "react-textarea-autosize";
3
4
 
4
- export const StyledTextArea = styled(TextareaAutosize)`
5
+ interface StyledTextAreaProps {
6
+ variant?: "contained" | "filled" | "outlined" | "text";
7
+ size?: "xs" | "sm" | "md" | "lg" | "xl";
8
+ }
9
+
10
+ const StyledTextArea = styled(TextareaAutosize)<StyledTextAreaProps>`
5
11
  outline: none;
6
12
  resize: none;
7
13
  padding: 8px 8px;
@@ -59,7 +65,6 @@ export const StyledTextArea = styled(TextareaAutosize)`
59
65
  &:focus {
60
66
  border: 1px solid ${(props) => props.theme.palette.primary.main};
61
67
  }
62
- // ::placeholder {
63
- // color: ${(props) => props.theme.palette.input.placeholder};
64
- // }
65
68
  `;
69
+
70
+ export default StyledTextArea;
@@ -0,0 +1 @@
1
+ export { default } from "./TextArea";
@@ -1,12 +1,25 @@
1
- import FieldLabel from "../FieldLabel/FieldLabel.js";
2
- import { StyledTextArea } from "../primitives/TextArea.js";
1
+ import React from "react";
2
+ import FieldLabel from "../FieldLabel";
3
+ import StyledTextArea from "../TextArea";
3
4
 
4
- const TextAreaInput = ({
5
+ interface TextAreaInputProps {
6
+ label?: string;
7
+ error?: boolean;
8
+ errorMessage?: string;
9
+ required?: boolean;
10
+ colSpan?: number;
11
+ size?: "xs" | "sm" | "md" | "lg" | "xl";
12
+ description?: string | null;
13
+ }
14
+
15
+ const TextAreaInput: React.FC<TextAreaInputProps> = ({
5
16
  label,
6
17
  error,
7
18
  errorMessage,
8
19
  required,
9
20
  colSpan = 1,
21
+ size,
22
+ description,
10
23
  ...other
11
24
  }) => {
12
25
  return (
@@ -21,8 +34,8 @@ const TextAreaInput = ({
21
34
  error={error}
22
35
  errorMessage={errorMessage}
23
36
  asterisk={required}
24
- size={other.size}
25
- description={other.description}
37
+ size={size}
38
+ description={description}
26
39
  >
27
40
  {label}
28
41
  </FieldLabel>
@@ -0,0 +1 @@
1
+ export { default } from "./TextAreaInput";
@@ -1,12 +1,25 @@
1
- import FieldLabel from "../FieldLabel/FieldLabel.js";
2
- import { StyledInput } from "../primitives/Input.js";
1
+ import React from "react";
2
+ import FieldLabel from "../FieldLabel";
3
+ import StyledInput from "../Input";
3
4
 
4
- const TextInput = ({
5
+ interface TextInputProps {
6
+ label?: string;
7
+ error?: boolean;
8
+ errorMessage?: string;
9
+ required?: boolean;
10
+ colSpan?: number;
11
+ size?: "xs" | "sm" | "md" | "lg" | "xl";
12
+ description?: string | null;
13
+ }
14
+
15
+ const TextInput: React.FC<TextInputProps> = ({
5
16
  label,
6
17
  error,
7
18
  errorMessage,
8
19
  required,
9
20
  colSpan = 1,
21
+ size,
22
+ description,
10
23
  ...other
11
24
  }) => {
12
25
  return (
@@ -23,8 +36,8 @@ const TextInput = ({
23
36
  error={error}
24
37
  errorMessage={errorMessage}
25
38
  asterisk={required}
26
- size={other.size}
27
- description={other.description}
39
+ size={size}
40
+ description={description}
28
41
  >
29
42
  {label}
30
43
  </FieldLabel>
@@ -0,0 +1 @@
1
+ export { default } from "./TextInput";
@@ -0,0 +1,7 @@
1
+ export { default as Button } from "./Button";
2
+ export { default as Input } from "./Input";
3
+ export { default as TextArea } from "./TextArea";
4
+ export { default as FieldLabel } from "./FieldLabel";
5
+ export { default as TextInput } from "./TextInput";
6
+ export { default as TextAreaInput } from "./TextAreaInput";
7
+ export { default as Pill } from "./Pill";
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./components";
package/tsconfig.json ADDED
@@ -0,0 +1,109 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
+
5
+ /* Projects */
6
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
+
13
+ /* Language and Environment */
14
+ "target": "ES2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
15
+ // "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
+ // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
18
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
20
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
22
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26
+
27
+ /* Modules */
28
+ "module": "ESNext" /* Specify what module code is generated. */,
29
+ // "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
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
32
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
33
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
34
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
35
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
36
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
37
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
38
+ // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
39
+ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
40
+ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
41
+ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
42
+ // "resolveJsonModule": true, /* Enable importing .json files. */
43
+ // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
44
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
45
+
46
+ /* JavaScript Support */
47
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
48
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
49
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
50
+
51
+ /* Emit */
52
+ "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
53
+ // "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. */,
56
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
57
+ // "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
+ // "removeComments": true, /* Disable emitting comments. */
60
+ // "noEmit": true, /* Disable emitting files from a compilation. */
61
+ // "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
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
64
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
65
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
66
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
67
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
68
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
69
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
70
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
71
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
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. */
75
+
76
+ /* Interop Constraints */
77
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
78
+ // "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. */,
80
+ "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
81
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
82
+ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
83
+
84
+ /* Type Checking */
85
+ "strict": true /* Enable all strict type-checking options. */,
86
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
87
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
88
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
89
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
90
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
91
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
92
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
93
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
94
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
95
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
96
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
97
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
98
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
99
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
100
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
101
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
102
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
103
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
104
+
105
+ /* Completeness */
106
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
107
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
108
+ }
109
+ }
@@ -1,75 +0,0 @@
1
- import { useState } from "react";
2
- import { useRef } from "react";
3
- import styled from "styled-components";
4
- import { InputLabel } from "../Input";
5
- import {
6
- Tag,
7
- TagBoxContainer,
8
- TagBoxInner,
9
- TagBoxInput,
10
- TagKillButton,
11
- TagsContainer,
12
- TagText,
13
- } from "./TagBoxStyles";
14
-
15
- const TestTags = [
16
- "STG-1200",
17
- "Archive Drive 1",
18
- "NAS 1",
19
- "Riker",
20
- "Azure",
21
- "Tag 6",
22
- ];
23
-
24
- const TagBox = styled(({ labelName, labelStyle = {}, data = [] }) => {
25
- const [tags, setTags] = useState(TestTags);
26
- const tagBoxContainerRef = useRef(null);
27
- const tagBoxInputRef = useRef(null);
28
- const tagBoxInnerRef = useRef(null);
29
-
30
- const onClick = (e) => {
31
- tagBoxInputRef.current.focus();
32
- };
33
-
34
- const onBlur = (e) => {
35
- tagBoxInnerRef.current.scrollLeft = -99999;
36
- };
37
-
38
- const removeTag = ({ event, clickedTag }) => {
39
- event.stopPropagation();
40
- event.preventDefault();
41
- setTags(tags.filter((tag) => tag !== clickedTag));
42
- };
43
-
44
- return (
45
- <TagBoxContainer ref={tagBoxContainerRef} onClick={onClick} onBlur={onBlur}>
46
- {labelName && (
47
- <InputLabel
48
- labelName={labelName}
49
- style={{ ...labelStyle }}
50
- ></InputLabel>
51
- )}
52
- <TagBoxInner ref={tagBoxInnerRef}>
53
- <TagsContainer>
54
- {tags.map((tag, index) => {
55
- return (
56
- <Tag key={index} value={tag}>
57
- <TagText>{tag}</TagText>
58
- <TagKillButton
59
- onClick={(e) => {
60
- removeTag({ event: e, clickedTag: tag });
61
- }}
62
- ></TagKillButton>
63
- </Tag>
64
- );
65
- })}
66
- </TagsContainer>
67
- <TagBoxInput ref={tagBoxInputRef}></TagBoxInput>
68
- </TagBoxInner>
69
- </TagBoxContainer>
70
- );
71
- })``;
72
-
73
- TagBox.displayName = "TagBox";
74
-
75
- export default TagBox;
@@ -1,122 +0,0 @@
1
- import styled from "styled-components";
2
- import CloseIcon from "@mui/icons-material/Close";
3
-
4
- export const TagBoxContainer = styled.div`
5
- width: 100%;
6
- `;
7
-
8
- export const TagBoxInner = styled.div`
9
- height: 33px;
10
- display: flex;
11
- border: 1px solid ${(props) => props.theme.palette.input.border};
12
- color: ${(props) => props.theme.palette.text.primary};
13
- outline: none;
14
- padding: 8px 8px;
15
- width: 100%;
16
- background-color: ${(props) => props.theme.palette.input.background};
17
- border-radius: 5px;
18
- transition: border 0.1s ease-in-out;
19
- overflow-x: hidden;
20
- &:focus {
21
- border: 1px solid ${(props) => props.theme.palette.primary.main};
22
- }
23
- `;
24
-
25
- export const TagsContainer = styled.div`
26
- // min-height: 34px;
27
- display: flex;
28
- -webkit-box-align: center;
29
- align-items: center;
30
- flex-wrap: nowrap;
31
- margin-left: calc(-5px);
32
- box-sizing: border-box;
33
- `;
34
-
35
- export const TagBoxInput = styled.input`
36
- border: none;
37
- outline: none;
38
- width: 100%;
39
- min-width: 50px;
40
- background-color: transparent;
41
- color: ${(props) => props.theme.palette.text.primary};
42
- &:focus {
43
- border: none;
44
- outline: none;
45
- }
46
- `;
47
-
48
- export const Tag = styled.div`
49
- display: flex;
50
- -webkit-box-align: center;
51
- align-items: center;
52
- background-color: rgb(26, 27, 30);
53
- color: rgb(193, 194, 197);
54
- height: 22px;
55
- padding-left: 10px;
56
- padding-right: 0px;
57
- font-weight: 500;
58
- font-size: 12px;
59
- border-radius: 4px;
60
- cursor: default;
61
- user-select: none;
62
- max-width: 120px;
63
- margin: calc(3px) calc(5px);
64
- `;
65
-
66
- export const TagText = styled.div`
67
- display: flex;
68
- -webkit-box-align: center;
69
- align-items: center;
70
- background-color: rgb(26, 27, 30);
71
- color: rgb(193, 194, 197);
72
- height: 22px;
73
- // padding-left: 12px;
74
- padding-right: 0px;
75
- font-weight: 500;
76
- font-size: 12px;
77
- border-radius: 4px;
78
- cursor: default;
79
- user-select: none;
80
- max-width: 75px;
81
- // margin: calc(3px) calc(5px);
82
- white-space: nowrap;
83
- overflow: hidden;
84
- text-overflow: ellipsis;
85
- `;
86
-
87
- export const TagKillButton = styled(CloseIcon)`
88
- -webkit-tap-highlight-color: transparent;
89
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
90
- Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
91
- cursor: pointer;
92
- appearance: none;
93
- // font-size: 18px;
94
- text-align: left;
95
- text-decoration: none;
96
- box-sizing: border-box;
97
- border: 1px solid transparent;
98
- background-color: transparent;
99
- position: relative;
100
- height: 19px;
101
- min-height: 19px;
102
- width: 22px;
103
- min-width: 19px;
104
- border-radius: 2px;
105
- line-height: 1;
106
- display: flex;
107
- -webkit-box-align: center;
108
- align-items: center;
109
- -webkit-box-pack: center;
110
- justify-content: center;
111
- color: rgb(193, 194, 197);
112
- // margin-left: 4px;
113
- // margin-right: 4px;
114
- padding: 0px 3px;
115
- &:hover {
116
- color: rgb(255, 255, 255);
117
- }
118
- `;
119
-
120
- export const TagBoxOptions = styled.div``;
121
-
122
- export const TagBoxOption = styled.div``;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes