@granto-umbrella/umbrella-components 2.3.21 → 2.3.23

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 (36) hide show
  1. package/dist/umbrella-components.es.js +36414 -36248
  2. package/dist/umbrella-components.umd.js +495 -375
  3. package/package.json +4 -3
  4. package/src/components/atoms/Badge/Badge.styles.ts +24 -17
  5. package/src/components/atoms/Badge/Badge.tsx +19 -11
  6. package/src/components/atoms/Badge/Badge.types.ts +3 -2
  7. package/src/components/atoms/Breadcrumb/Breadcrumb.styles.ts +18 -11
  8. package/src/components/atoms/Breadcrumb/Breadcrumb.tsx +11 -3
  9. package/src/components/atoms/Button/Button.styles.ts +86 -12
  10. package/src/components/atoms/Button/Button.types.ts +6 -1
  11. package/src/components/atoms/Checkbox/Checkbox.styles.ts +4 -4
  12. package/src/components/atoms/Checkbox/Checkbox.tsx +2 -1
  13. package/src/components/atoms/CodeInput/CodeInput.styles.tsx +39 -0
  14. package/src/components/atoms/CodeInput/CodeInput.tsx +19 -0
  15. package/src/components/atoms/CodeInput/CodeInput.types.ts +3 -0
  16. package/src/components/atoms/CodeInput/index.tsx +1 -0
  17. package/src/components/atoms/Input/Input.styles.ts +24 -8
  18. package/src/components/atoms/Input/Input.tsx +10 -9
  19. package/src/components/atoms/Input/Input.types.ts +4 -25
  20. package/src/components/atoms/Label/Label.styles.ts +8 -7
  21. package/src/components/atoms/RadioButton/RadioButton.styles.ts +3 -2
  22. package/src/components/atoms/RadioButton/RadioButton.tsx +1 -0
  23. package/src/components/atoms/Select/Select.styles.ts +81 -23
  24. package/src/components/atoms/Select/Select.tsx +17 -30
  25. package/src/components/atoms/Select/Select.types.ts +17 -9
  26. package/src/components/atoms/Switch/Switch.styles.ts +13 -8
  27. package/src/components/atoms/Switch/Switch.tsx +1 -1
  28. package/src/components/atoms/Text/Text.tsx +1 -0
  29. package/src/components/atoms/Textarea/Textarea.styles.ts +7 -8
  30. package/src/components/atoms/Textarea/Textarea.tsx +1 -1
  31. package/src/components/molecules/ButtonGroup/ButtonGroup.tsx +12 -6
  32. package/src/components/molecules/ButtonGroup/ButtonGroup.types.ts +16 -2
  33. package/src/index.ts +5 -1
  34. package/src/styles/tokens/colors.ts +102 -96
  35. package/src/styles/tokens/shadows.ts +3 -3
  36. package/src/styles/tokens/typography.ts +148 -123
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@granto-umbrella/umbrella-components",
3
- "version": "2.3.21",
3
+ "version": "2.3.23",
4
4
  "description": "Umbrella Components for React",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -30,8 +30,9 @@
30
30
  "bump:major": "npm version major"
31
31
  },
32
32
  "dependencies": {
33
+ "@granto-umbrella/umbrella-components": "^2.3.21",
33
34
  "@phosphor-icons/react": "^2.1.7",
34
- "@radix-ui/react-dialog": "^1.1.7",
35
+ "@radix-ui/react-dialog": "^1.1.15",
35
36
  "@radix-ui/react-label": "^2.1.3",
36
37
  "@radix-ui/react-popover": "^1.1.11",
37
38
  "@radix-ui/react-radio-group": "^1.2.4",
@@ -41,7 +42,7 @@
41
42
  "react-datepicker": "^8.3.0",
42
43
  "react-day-picker": "^9.6.7",
43
44
  "react-dom": "^18.3.1",
44
- "react-hook-form": "^7.54.2",
45
+ "react-hook-form": "^7.63.0",
45
46
  "react-select": "^5.10.0",
46
47
  "tailwind-merge": "^3.2.0"
47
48
  },
@@ -19,6 +19,7 @@ const badgeVariants = {
19
19
  danger: css`
20
20
  background: ${semanticColors.global.surface.danger.disabled};
21
21
  color: ${semanticColors.global.text.feedback.strong.error};
22
+
22
23
  `,
23
24
  success: css`
24
25
  background: ${semanticColors.success.surface.feedback};
@@ -32,23 +33,33 @@ const badgeVariants = {
32
33
  background: ${semanticColors.neutral[200]};
33
34
  color: ${semanticColors.neutral[700]};
34
35
  `,
36
+ info: css`
37
+ background: ${semanticColors.info.surface.feedback};
38
+ color: ${semanticColors.info.text.feedback.strong};
39
+ `,
35
40
  };
36
41
 
37
42
  const badgeSizes = {
38
43
  sm: css`
39
- padding: ${semanticSizes.global.padding.xs}${" "}${semanticSizes.global
40
- .padding.sm};
44
+ padding: ${semanticSizes.global.padding.xs} ${semanticSizes.global.padding.sm};
41
45
  font-size: ${typographyTokens.fontSizes.labelS};
46
+ font-weight: ${typographyTokens.fontWeights.medium};
47
+ line-height: ${typographyTokens.lineHeights.labelS};
48
+ font-family: ${typographyTokens.fontFamily.base};
42
49
  `,
43
50
  md: css`
44
- padding: ${semanticSizes.global.padding.sm}${" "}${semanticSizes.global
45
- .padding.md};
51
+ padding: ${semanticSizes.global.padding.sm} ${semanticSizes.global.padding.md};
46
52
  font-size: ${typographyTokens.fontSizes.labelM};
53
+ font-weight: ${typographyTokens.fontWeights.medium};
54
+ line-height: ${typographyTokens.lineHeights.labelM};
55
+ font-family: ${typographyTokens.fontFamily.base};
47
56
  `,
48
57
  lg: css`
49
- padding: ${semanticSizes.global.padding.md}${" "}${semanticSizes.global
50
- .padding.lg};
58
+ padding: ${semanticSizes.global.padding.md} ${semanticSizes.global.padding.lg};
51
59
  font-size: ${typographyTokens.fontSizes.labelL};
60
+ font-weight: ${typographyTokens.fontWeights.medium};
61
+ line-height: ${typographyTokens.lineHeights.labelL};
62
+ font-family: ${typographyTokens.fontFamily.base};
52
63
  `,
53
64
  };
54
65
 
@@ -60,20 +71,16 @@ export const StyledBadge = styled.span<{
60
71
  display: inline-flex;
61
72
  align-items: center;
62
73
  justify-content: center;
63
- font-weight: 500;
64
74
  border-radius: ${({ $radius }) => semanticRadius.global.radius[$radius]};
75
+ gap: ${semanticSizes.global.gap.xs};
76
+
65
77
  ${({ $size }) => badgeSizes[$size]}
66
78
  ${({ $variant }) => badgeVariants[$variant]}
67
79
 
68
- gap: ${semanticSizes.global.gap.xs};
69
-
70
- .icon-left {
71
- margin-right: ${semanticSizes.global.padding.xs};
72
- margin-top: ${semanticSizes.global.padding.xs};
73
- }
74
-
80
+ .icon-left,
75
81
  .icon-right {
76
- margin-left: ${semanticSizes.global.padding.xs};
77
- margin-top: ${semanticSizes.global.padding.xs};
82
+ display: flex;
83
+ align-items: center;
84
+ line-height: 1;
78
85
  }
79
- `;
86
+ `;;
@@ -2,6 +2,18 @@ import React from "react";
2
2
  import { StyledBadge } from "./Badge.styles";
3
3
  import { BadgeProps } from "./Badge.types";
4
4
  import * as Icons from "@phosphor-icons/react";
5
+ import { semanticSizes } from "../../../styles/tokens/sizes";
6
+
7
+ const getIconSize = (size: BadgeProps["size"]) => {
8
+ switch (size) {
9
+ case "sm":
10
+ return semanticSizes.global.padding.lg;
11
+ case "lg":
12
+ return semanticSizes.global.padding['2xl'];
13
+ default: // Caso 'md'
14
+ return semanticSizes.global.padding.xl;
15
+ }
16
+ };
5
17
 
6
18
  const Badge: React.FC<BadgeProps> = ({
7
19
  children,
@@ -11,26 +23,22 @@ const Badge: React.FC<BadgeProps> = ({
11
23
  leftIcon,
12
24
  rightIcon,
13
25
  }) => {
14
- const IconComponentLeft =
15
- leftIcon && (Icons[leftIcon as keyof typeof Icons] as React.ElementType);
16
- const IconComponentRight =
17
- rightIcon && (Icons[rightIcon as keyof typeof Icons] as React.ElementType);
26
+ const IconComponentLeft = leftIcon && (Icons[leftIcon as keyof typeof Icons] as React.ElementType);
27
+ const IconComponentRight = rightIcon && (Icons[rightIcon as keyof typeof Icons] as React.ElementType);
28
+
29
+ const iconSize = getIconSize(size);
18
30
 
19
31
  return (
20
32
  <StyledBadge $size={size} $variant={variant} $radius={radius}>
21
33
  {IconComponentLeft && (
22
- <span className="icon-left">
23
- <IconComponentLeft size={16} />
24
- </span>
34
+ <IconComponentLeft size={parseInt(iconSize)} />
25
35
  )}
26
36
  {children}
27
37
  {IconComponentRight && (
28
- <span className="icon-right">
29
- <IconComponentRight size={16} />
30
- </span>
38
+ <IconComponentRight size={parseInt(iconSize)} />
31
39
  )}
32
40
  </StyledBadge>
33
41
  );
34
42
  };
35
43
 
36
- export default Badge;
44
+ export default Badge;
@@ -7,8 +7,9 @@ export interface BadgeProps {
7
7
  | "danger"
8
8
  | "success"
9
9
  | "warning"
10
- | "neutral";
10
+ | "neutral"
11
+ | "info";
11
12
  radius?: "sm" | "md" | "lg" | "full";
12
13
  leftIcon?: string;
13
14
  rightIcon?: string;
14
- }
15
+ }
@@ -1,36 +1,43 @@
1
- import styled from "styled-components";
1
+ import styled, { css } from "styled-components";
2
2
  import {
3
3
  semanticColors,
4
4
  semanticSizes,
5
5
  typographyTokens,
6
6
  } from "../../../styles/tokens";
7
7
 
8
+ import { textStyles } from "../../../styles/tokens/typography";
9
+
8
10
  export const BreadcrumbContainer = styled.nav`
9
11
  display: flex;
10
12
  align-items: center;
11
- font-size: ${typographyTokens.fontSizes.labelS};
12
- color: ${semanticColors.neutral[500]};
13
+ font-family: ${typographyTokens.fontFamily.base};
14
+ ${css(textStyles.labelS)};
13
15
  `;
14
16
 
15
17
  export const BreadcrumbItem = styled.span<{ $isActive?: boolean }>`
16
18
  display: flex;
17
19
  align-items: center;
18
- gap: ${semanticSizes.global.spacings.sm};
20
+ gap: ${semanticSizes.global.gap.xs};
19
21
  cursor: pointer;
22
+
20
23
  color: ${({ $isActive }) =>
21
24
  $isActive
22
- ? semanticColors.branding.text.accent.pressed
23
- : semanticColors.neutral[500]};
24
- font-weight: ${({ $isActive }) => ($isActive ? "bold" : "normal")};
25
+ ? semanticColors.branding.text.accent.enabled
26
+ : semanticColors.global.text.onSurface.subtitle};
27
+
28
+ font-weight: ${({ $isActive }) =>
29
+ $isActive
30
+ ? typographyTokens.fontWeights.semibold
31
+ : typographyTokens.fontWeights.regular};
25
32
 
26
33
  &:hover {
27
- color: ${semanticColors.branding.text.accent.hover};
34
+ color: ${semanticColors.branding.text.accent.hover};
28
35
  }
29
36
  `;
30
37
 
31
38
  export const BreadcrumbSeparator = styled.span`
32
39
  display: flex;
33
40
  align-items: center;
34
- margin: 0 ${semanticSizes.global.spacings.sm};
35
- color: ${semanticColors.neutral[400]};
36
- `;
41
+ margin: 0 ${semanticSizes.global.gap.xs};
42
+ color: ${semanticColors.global.text.onSurface.subtitle};
43
+ `;
@@ -1,3 +1,5 @@
1
+ // src/components/atoms/Breadcrumb/Breadcrumb.tsx
2
+
1
3
  import React from "react";
2
4
  import * as Icons from "@phosphor-icons/react";
3
5
  import { BreadcrumbProps } from "./Breadcrumb.types";
@@ -7,6 +9,9 @@ import {
7
9
  BreadcrumbSeparator,
8
10
  } from "./Breadcrumb.styles";
9
11
 
12
+
13
+ import { semanticSizes } from "../../../styles/tokens/sizes";
14
+
10
15
  const Breadcrumb: React.FC<BreadcrumbProps> = ({
11
16
  items,
12
17
  separator = "chevron-right",
@@ -15,6 +20,9 @@ const Breadcrumb: React.FC<BreadcrumbProps> = ({
15
20
  separator as keyof typeof Icons
16
21
  ] as React.ElementType;
17
22
 
23
+
24
+ const iconSize = parseInt(semanticSizes.global.padding.lg);
25
+
18
26
  return (
19
27
  <BreadcrumbContainer>
20
28
  {items.map((item, index) => (
@@ -23,12 +31,12 @@ const Breadcrumb: React.FC<BreadcrumbProps> = ({
23
31
  onClick={() => item.onClick && item.onClick()}
24
32
  $isActive={index === items.length - 1}
25
33
  >
26
- {item.icon && <item.icon size={16} />}
34
+ {item.icon && <item.icon size={iconSize} />}
27
35
  {item.label}
28
36
  </BreadcrumbItem>
29
37
  {index < items.length - 1 && (
30
38
  <BreadcrumbSeparator>
31
- {SeparatorIcon && <SeparatorIcon size={16} />}
39
+ {SeparatorIcon && <SeparatorIcon size={iconSize} />}
32
40
  </BreadcrumbSeparator>
33
41
  )}
34
42
  </React.Fragment>
@@ -37,4 +45,4 @@ const Breadcrumb: React.FC<BreadcrumbProps> = ({
37
45
  );
38
46
  };
39
47
 
40
- export default Breadcrumb;
48
+ export default Breadcrumb;
@@ -1,28 +1,26 @@
1
- import styled, { css } from "styled-components";
1
+ import styled, { css } from 'styled-components';
2
2
  import {
3
3
  semanticColors,
4
4
  semanticSizes,
5
5
  semanticRadius,
6
6
  typographyTokens,
7
- } from "../../../styles/tokens";
7
+ } from '../../../styles/tokens';
8
8
 
9
9
  const buttonSizes = {
10
10
  sm: css`
11
11
  padding: ${semanticSizes.global.padding.md};
12
12
  font-size: ${typographyTokens.fontSizes.labelS};
13
- icon-size: ${semanticSizes.global.padding.lg};
13
+
14
14
  `,
15
15
  md: css`
16
- padding: ${semanticSizes.global.padding.md}${" "}${semanticSizes.global
17
- .padding.lg};
16
+ padding: ${semanticSizes.global.padding.md}${' '}${semanticSizes.global.padding.xl};
18
17
  font-size: ${typographyTokens.fontSizes.bodyS};
19
- icon-size: ${semanticSizes.global.padding.lg};
18
+
20
19
  `,
21
20
  lg: css`
22
- padding: ${semanticSizes.global.padding.md}${" "}${semanticSizes.global
23
- .padding.xl};
21
+ padding: ${semanticSizes.global.padding.md}${' '}${semanticSizes.global.padding.xl};
24
22
  font-size: ${typographyTokens.fontSizes.bodyL};
25
- icon-size: ${semanticSizes.global.padding.xl};
23
+
26
24
  `,
27
25
  };
28
26
 
@@ -169,6 +167,82 @@ const buttonVariants = {
169
167
  color: ${semanticColors.neutral[400]};
170
168
  }
171
169
  `,
170
+
171
+ 'danger-no-fill': css`
172
+ background: transparent;
173
+ color: ${semanticColors.danger.text.enabled};
174
+ border: none;
175
+ &:hover {
176
+ color: ${semanticColors.danger.text.hover};
177
+ }
178
+ &:active {
179
+ color: ${semanticColors.danger.text.pressed};
180
+ }
181
+ &:disabled {
182
+ color: ${semanticColors.danger.text.disabled};
183
+ }
184
+ `,
185
+ 'accent-outline': css`
186
+ background: transparent;
187
+ color: ${semanticColors.branding.text.accent.enabled};
188
+ border: 1px solid ${semanticColors.branding.border.enabled};
189
+ &:hover {
190
+ color: ${semanticColors.branding.text.accent.hover};
191
+ border: 1px solid ${semanticColors.branding.border.hover};
192
+ }
193
+ &:active {
194
+ color: ${semanticColors.branding.text.accent.pressed};
195
+ border: 1px solid ${semanticColors.branding.border.pressed};
196
+ }
197
+ &:disabled {
198
+ color: ${semanticColors.branding.text.accent.disabled};
199
+ border: 1px solid ${semanticColors.branding.border.disabled};
200
+ }
201
+ `,
202
+ 'accent-fill': css`
203
+ background: ${semanticColors.branding.surface.enabled};
204
+ color: ${semanticColors.branding.text.onSurfaceAccent.enabled};
205
+ border: none;
206
+ &:hover {
207
+ background: ${semanticColors.branding.surface.hover};
208
+ }
209
+ &:active {
210
+ background: ${semanticColors.branding.surface.pressed};
211
+ }
212
+ &:disabled {
213
+ background: ${semanticColors.branding.surface.disabled};
214
+ }
215
+ `,
216
+ 'secondary-outline': css`
217
+ background: transparent;
218
+ color: ${semanticColors.global.text.subtitle.enabled};
219
+ border: 1px solid ${semanticColors.global.border.strong};
220
+ &:hover {
221
+ background: ${semanticColors.neutral[200]};
222
+ }
223
+ &:active {
224
+ background: ${semanticColors.neutral[300]};
225
+ }
226
+ &:disabled {
227
+ color: ${semanticColors.global.text.onSurface.enabled};
228
+ border: 1px solid ${semanticColors.global.text.onSurface.enabled};
229
+ background: ${semanticColors.global.surface.disabled};
230
+ }
231
+ `,
232
+ 'danger-fill': css`
233
+ background: ${semanticColors.danger.surface.enabled};
234
+ color: ${semanticColors.danger.text.onSurface};
235
+ border: none;
236
+ &:hover {
237
+ background: ${semanticColors.danger.surface.hover};
238
+ }
239
+ &:active {
240
+ background: ${semanticColors.danger.surface.pressed};
241
+ }
242
+ &:disabled {
243
+ background: ${semanticColors.danger.surface.disabled};
244
+ }
245
+ `,
172
246
  };
173
247
 
174
248
  export const StyledButton = styled.button<{
@@ -186,7 +260,7 @@ export const StyledButton = styled.button<{
186
260
  font-weight: 500;
187
261
  border-radius: ${({ $radius }) =>
188
262
  semanticRadius.global.radius[
189
- ($radius as keyof typeof semanticRadius.global.radius) || "md"
263
+ ($radius as keyof typeof semanticRadius.global.radius) || 'md'
190
264
  ]};
191
265
  cursor: pointer;
192
266
  transition: all 0.2s ease-in-out;
@@ -196,8 +270,8 @@ export const StyledButton = styled.button<{
196
270
  ${({ $size }) => buttonSizes[$size]}
197
271
  ${({ $variant }) => buttonVariants[$variant]}
198
272
 
199
- width: ${({ $width }) => $width || "auto"};
200
- height: ${({ $height }) => $height || "auto"};
273
+ width: ${({ $width }) => $width || 'auto'};
274
+ height: ${({ $height }) => $height || 'auto'};
201
275
 
202
276
  &:disabled {
203
277
  cursor: not-allowed;
@@ -10,7 +10,12 @@ export interface ButtonProps
10
10
  | "danger"
11
11
  | "ghost"
12
12
  | "ghost_alert"
13
- | "alert";
13
+ | "alert"
14
+ | "danger-no-fill"
15
+ | "accent-outline"
16
+ | "accent-fill"
17
+ | "secondary-outline"
18
+ | "danger-fill";
14
19
  radius?: string;
15
20
  isLoading?: boolean;
16
21
  leftIcon?: string;
@@ -17,8 +17,8 @@ export const CheckboxWrapper = styled.label`
17
17
  `;
18
18
 
19
19
  export const StyledCheckbox = styled.input`
20
- width: ${semanticSizes.global.padding.lg};
21
- height: ${semanticSizes.global.padding.lg};
20
+ width: ${semanticSizes.global.padding.xl};
21
+ height: ${semanticSizes.global.padding.xl};
22
22
  border: 2px solid ${semanticColors.neutral[400]};
23
23
  border-radius: ${semanticRadius.global.radius.sm};
24
24
  appearance: none;
@@ -37,8 +37,8 @@ export const CheckboxIconWrapper = styled.div<{ checked?: boolean }>`
37
37
  align-items: center;
38
38
  justify-content: center;
39
39
  position: absolute;
40
- width: ${semanticSizes.global.padding.lg};
41
- height: ${semanticSizes.global.padding.lg};
40
+ width: ${semanticSizes.global.padding.xl};
41
+ height: ${semanticSizes.global.padding.xl};
42
42
  left: 0;
43
43
  top: 50%;
44
44
  transform: translateY(-50%);
@@ -7,6 +7,7 @@ import {
7
7
  CheckboxIconWrapper,
8
8
  } from "./Checkbox.styles";
9
9
  import { CheckboxProps } from "./Checkbox.types";
10
+ import { semanticSizes } from "../../../styles/tokens";
10
11
 
11
12
  export const Checkbox: React.FC<CheckboxProps> = ({
12
13
  label,
@@ -26,7 +27,7 @@ export const Checkbox: React.FC<CheckboxProps> = ({
26
27
  />
27
28
  {checked && (
28
29
  <CheckboxIconWrapper>
29
- <Check size={8} weight="bold" />
30
+ <Check size={semanticSizes.global.padding.sm} weight="bold" />
30
31
  </CheckboxIconWrapper>
31
32
  )}
32
33
  {label && <CheckboxLabel>{label}</CheckboxLabel>}
@@ -0,0 +1,39 @@
1
+
2
+ import {
3
+ primitiveSizes,
4
+ semanticBorders,
5
+ semanticColors,
6
+ semanticSizes,
7
+ semanticRadius,
8
+ typographyTokens,
9
+ } from "../../../styles/tokens";
10
+ import { styled } from "styled-components";
11
+
12
+ const borderColor = semanticColors.global.border.strong;
13
+ const inputWidth = semanticSizes.global.spacings.lg;
14
+ const inputHeight = primitiveSizes.size.x14;
15
+ const fontSize = typographyTokens.fontSizes.labelL;
16
+ const borderRadius = semanticRadius.global.radius.md;
17
+ const borderStyle = semanticBorders.global.sm;
18
+
19
+ export const StyledCodeInput = styled.input`
20
+ width: ${inputWidth};
21
+ height: ${inputHeight};
22
+ font-size: ${fontSize};
23
+ text-align: center;
24
+ border-top: ${borderStyle} solid ${borderColor};
25
+ border-bottom: ${borderStyle} solid ${borderColor};
26
+ border-left: 0;
27
+ border-right: ${borderStyle} solid ${borderColor};
28
+
29
+ &:first-child {
30
+ border-top-left-radius: ${borderRadius};
31
+ border-bottom-left-radius: ${borderRadius};
32
+ border-left: ${borderStyle} solid ${borderColor};
33
+ }
34
+
35
+ &:last-child {
36
+ border-top-right-radius: ${borderRadius};
37
+ border-bottom-right-radius: ${borderRadius};
38
+ }
39
+ `;
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import { StyledCodeInput } from "./CodeInput.styles";
3
+ import { CodeInputProps } from "./CodeInput.types";
4
+
5
+ const CodeInput = React.forwardRef<HTMLInputElement, CodeInputProps>(
6
+ ({ ...props }, ref) => {
7
+ return (
8
+ <StyledCodeInput
9
+ ref={ref}
10
+ type="text"
11
+ {...props}
12
+ />
13
+ );
14
+ }
15
+ );
16
+
17
+ CodeInput.displayName = "CodeInput";
18
+
19
+ export default CodeInput;
@@ -0,0 +1,3 @@
1
+ import { InputHTMLAttributes } from "react";
2
+
3
+ export type CodeInputProps = InputHTMLAttributes<HTMLInputElement>;
@@ -0,0 +1 @@
1
+ export { default } from "./CodeInput";
@@ -1,4 +1,4 @@
1
- import styled from "styled-components";
1
+ import styled, { css } from 'styled-components';
2
2
  import {
3
3
  semanticColors,
4
4
  semanticShadows,
@@ -7,7 +7,22 @@ import {
7
7
  semanticSizes,
8
8
  semanticBorders,
9
9
  typographyTokens,
10
- } from "../../../styles/tokens";
10
+ } from '../../../styles/tokens';
11
+
12
+ const inputSizes = {
13
+ sm: css`
14
+ padding: ${semanticSizes.global.padding.md} ${semanticSizes.global.padding.lg};
15
+ gap: ${semanticSizes.global.gap.sm};
16
+ `,
17
+ md: css`
18
+ padding: ${semanticSizes.global.padding.lg} ${semanticSizes.global.padding.xl};
19
+ gap: ${semanticSizes.global.gap.md};
20
+ `,
21
+ lg: css`
22
+ padding: ${semanticSizes.global.padding['2xl']} ${semanticSizes.global.padding['3xl']};
23
+ gap: ${semanticSizes.global.gap.lg};
24
+ `,
25
+ };
11
26
 
12
27
  export const Container = styled.div`
13
28
  display: flex;
@@ -34,19 +49,20 @@ export const InputWrapper = styled.div<{
34
49
  $disabled?: boolean;
35
50
  $radius?: keyof typeof semanticRadius.global.radius;
36
51
  $shadow?: keyof typeof semanticShadows.shadow;
52
+ $size: keyof typeof inputSizes;
37
53
  }>`
38
54
  display: flex;
39
55
  align-items: center;
40
- padding: ${semanticSizes.global.padding.md} ${semanticSizes.global.padding.lg};
41
- gap: ${semanticSizes.global.gap.md};
42
56
 
43
- box-shadow: ${({ $shadow }) => semanticShadows.shadow[$shadow || "default"]};
57
+ ${({ $size }) => inputSizes[$size]}
58
+
59
+ box-shadow: ${({ $shadow }) => semanticShadows.shadow[$shadow || 'default']};
44
60
  border-radius: ${semanticBorders.global.lg};
45
61
  border: 1px solid
46
62
  ${({ $error }) =>
47
63
  $error
48
64
  ? semanticColors.danger.border.enabled
49
- : semanticColors.neutral[300]};
65
+ : semanticColors.global.border.medium};
50
66
  background-color: ${({ $disabled }) =>
51
67
  $disabled ? semanticColors.neutral[100] : semanticColors.base.background};
52
68
  transition: border-color 0.2s, box-shadow 0.2s;
@@ -65,10 +81,10 @@ export const StyledInput = styled.input`
65
81
  border: none;
66
82
  outline: none;
67
83
  font-size: ${typographyTokens.fontSizes.labelM};
68
- color: ${semanticColors.global.text.onSurface.enabled};
84
+ color: ${semanticColors.global.text.default.enabled};
69
85
 
70
86
  &::placeholder {
71
- color: ${semanticColors.neutral[300]};
87
+ color: ${semanticColors.global.text.onSurface.enabled};
72
88
  }
73
89
 
74
90
  &:disabled {
@@ -1,5 +1,5 @@
1
- import React, { forwardRef } from "react";
2
- import { InputProps } from "./Input.types";
1
+ import React, { forwardRef } from 'react';
2
+ import { InputProps } from './Input.types';
3
3
  import {
4
4
  Container,
5
5
  Label,
@@ -7,14 +7,14 @@ import {
7
7
  StyledInput,
8
8
  Icon,
9
9
  SupportText,
10
- } from "./Input.styles";
10
+ } from './Input.styles';
11
11
 
12
12
  function mergeRefs<T>(
13
13
  ...refs: (React.Ref<T> | null | undefined)[]
14
14
  ): React.RefCallback<T> {
15
15
  return (value: T) => {
16
16
  refs.forEach((ref) => {
17
- if (typeof ref === "function") {
17
+ if (typeof ref === 'function') {
18
18
  ref(value);
19
19
  } else if (ref != null) {
20
20
  (ref as React.MutableRefObject<T | null>).current = value;
@@ -26,8 +26,8 @@ function mergeRefs<T>(
26
26
  const Input = forwardRef<HTMLInputElement, InputProps>(
27
27
  (
28
28
  {
29
- type = "text",
30
- placeholder = "",
29
+ type = 'text',
30
+ placeholder = '',
31
31
  value,
32
32
  onChange,
33
33
  error = false,
@@ -35,8 +35,9 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
35
35
  icon,
36
36
  label,
37
37
  supportText,
38
- radius = "md" as "md" | "lg" | "sm" | "full",
39
- shadow = "default" as "none" | "default" | "md" | "lg",
38
+ size = 'md',
39
+ radius = 'md' as 'md' | 'lg' | 'sm' | 'full',
40
+ shadow = 'default' as 'none' | 'default' | 'md' | 'lg',
40
41
  style,
41
42
  register,
42
43
  testId,
@@ -53,6 +54,7 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
53
54
  $disabled={disabled}
54
55
  $radius={radius}
55
56
  $shadow={shadow}
57
+ $size={size}
56
58
  >
57
59
  {icon && <Icon>{icon}</Icon>}
58
60
  <StyledInput
@@ -75,5 +77,4 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
75
77
  );
76
78
  }
77
79
  );
78
-
79
80
  export default Input;