@bosonprotocol/react-kit 0.31.1-alpha.0 → 0.32.0-alpha.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 (136) hide show
  1. package/dist/cjs/components/buttons/BaseButton.d.ts +27 -0
  2. package/dist/cjs/components/buttons/BaseButton.d.ts.map +1 -0
  3. package/dist/cjs/components/buttons/BaseButton.js +154 -0
  4. package/dist/cjs/components/buttons/BaseButton.js.map +1 -0
  5. package/dist/cjs/components/form/BaseInput.d.ts +17 -0
  6. package/dist/cjs/components/form/BaseInput.d.ts.map +1 -0
  7. package/dist/cjs/components/form/BaseInput.js +88 -0
  8. package/dist/cjs/components/form/BaseInput.js.map +1 -0
  9. package/dist/cjs/components/form/BaseTagsInput.d.ts +8 -0
  10. package/dist/cjs/components/form/BaseTagsInput.d.ts.map +1 -0
  11. package/dist/cjs/components/form/{TagsInput.js → BaseTagsInput.js} +24 -16
  12. package/dist/cjs/components/form/BaseTagsInput.js.map +1 -0
  13. package/dist/cjs/components/form/ClearButton.d.ts +14 -0
  14. package/dist/cjs/components/form/ClearButton.d.ts.map +1 -0
  15. package/dist/cjs/components/form/ClearButton.js +28 -0
  16. package/dist/cjs/components/form/ClearButton.js.map +1 -0
  17. package/dist/cjs/components/form/Field.styles.d.ts +45 -7
  18. package/dist/cjs/components/form/Field.styles.d.ts.map +1 -1
  19. package/dist/cjs/components/form/Field.styles.js +44 -36
  20. package/dist/cjs/components/form/Field.styles.js.map +1 -1
  21. package/dist/cjs/components/form/Input.d.ts +3 -2
  22. package/dist/cjs/components/form/Input.d.ts.map +1 -1
  23. package/dist/cjs/components/form/Input.js +37 -24
  24. package/dist/cjs/components/form/Input.js.map +1 -1
  25. package/dist/cjs/components/form/Phone.js +1 -1
  26. package/dist/cjs/components/form/Phone.js.map +1 -1
  27. package/dist/cjs/components/form/index.d.ts +3 -2
  28. package/dist/cjs/components/form/index.d.ts.map +1 -1
  29. package/dist/cjs/components/form/index.js +17 -3
  30. package/dist/cjs/components/form/index.js.map +1 -1
  31. package/dist/cjs/components/form/styles/{TagsInput.styles.d.ts → BaseTagsInput.styles.d.ts} +6 -2
  32. package/dist/cjs/components/form/styles/BaseTagsInput.styles.d.ts.map +1 -0
  33. package/dist/cjs/components/form/styles/BaseTagsInput.styles.js +76 -0
  34. package/dist/cjs/components/form/styles/BaseTagsInput.styles.js.map +1 -0
  35. package/dist/cjs/components/styles/GlobalStyle.d.ts +1 -14
  36. package/dist/cjs/components/styles/GlobalStyle.d.ts.map +1 -1
  37. package/dist/cjs/components/styles/GlobalStyle.js +14 -41
  38. package/dist/cjs/components/styles/GlobalStyle.js.map +1 -1
  39. package/dist/cjs/components/ui/ThemedButton.d.ts.map +1 -1
  40. package/dist/cjs/components/ui/ThemedButton.js +3 -97
  41. package/dist/cjs/components/ui/ThemedButton.js.map +1 -1
  42. package/dist/cjs/components/ui/styles.d.ts.map +1 -1
  43. package/dist/cjs/components/ui/styles.js +5 -2
  44. package/dist/cjs/components/ui/styles.js.map +1 -1
  45. package/dist/cjs/hooks/useCurrentSellers.js.map +1 -1
  46. package/dist/cjs/index.d.ts +2 -0
  47. package/dist/cjs/index.d.ts.map +1 -1
  48. package/dist/cjs/index.js +2 -0
  49. package/dist/cjs/index.js.map +1 -1
  50. package/dist/esm/components/buttons/BaseButton.d.ts +27 -0
  51. package/dist/esm/components/buttons/BaseButton.d.ts.map +1 -0
  52. package/dist/esm/components/buttons/BaseButton.js +107 -0
  53. package/dist/esm/components/buttons/BaseButton.js.map +1 -0
  54. package/dist/esm/components/form/BaseInput.d.ts +17 -0
  55. package/dist/esm/components/form/BaseInput.d.ts.map +1 -0
  56. package/dist/esm/components/form/BaseInput.js +47 -0
  57. package/dist/esm/components/form/BaseInput.js.map +1 -0
  58. package/dist/esm/components/form/BaseTagsInput.d.ts +8 -0
  59. package/dist/esm/components/form/BaseTagsInput.d.ts.map +1 -0
  60. package/dist/esm/components/form/{TagsInput.js → BaseTagsInput.js} +22 -17
  61. package/dist/esm/components/form/BaseTagsInput.js.map +1 -0
  62. package/dist/esm/components/form/ClearButton.d.ts +14 -0
  63. package/dist/esm/components/form/ClearButton.d.ts.map +1 -0
  64. package/dist/esm/components/form/ClearButton.js +22 -0
  65. package/dist/esm/components/form/ClearButton.js.map +1 -0
  66. package/dist/esm/components/form/Field.styles.d.ts +45 -7
  67. package/dist/esm/components/form/Field.styles.d.ts.map +1 -1
  68. package/dist/esm/components/form/Field.styles.js +44 -36
  69. package/dist/esm/components/form/Field.styles.js.map +1 -1
  70. package/dist/esm/components/form/Input.d.ts +3 -2
  71. package/dist/esm/components/form/Input.d.ts.map +1 -1
  72. package/dist/esm/components/form/Input.js +37 -12
  73. package/dist/esm/components/form/Input.js.map +1 -1
  74. package/dist/esm/components/form/Phone.js +1 -1
  75. package/dist/esm/components/form/Phone.js.map +1 -1
  76. package/dist/esm/components/form/index.d.ts +3 -2
  77. package/dist/esm/components/form/index.d.ts.map +1 -1
  78. package/dist/esm/components/form/index.js +2 -1
  79. package/dist/esm/components/form/index.js.map +1 -1
  80. package/dist/esm/components/form/styles/{TagsInput.styles.d.ts → BaseTagsInput.styles.d.ts} +6 -2
  81. package/dist/esm/components/form/styles/BaseTagsInput.styles.d.ts.map +1 -0
  82. package/dist/esm/components/form/styles/{TagsInput.styles.js → BaseTagsInput.styles.js} +14 -4
  83. package/dist/esm/components/form/styles/BaseTagsInput.styles.js.map +1 -0
  84. package/dist/esm/components/styles/GlobalStyle.d.ts +1 -14
  85. package/dist/esm/components/styles/GlobalStyle.d.ts.map +1 -1
  86. package/dist/esm/components/styles/GlobalStyle.js +14 -41
  87. package/dist/esm/components/styles/GlobalStyle.js.map +1 -1
  88. package/dist/esm/components/ui/ThemedButton.d.ts.map +1 -1
  89. package/dist/esm/components/ui/ThemedButton.js +4 -98
  90. package/dist/esm/components/ui/ThemedButton.js.map +1 -1
  91. package/dist/esm/components/ui/styles.d.ts.map +1 -1
  92. package/dist/esm/components/ui/styles.js +5 -2
  93. package/dist/esm/components/ui/styles.js.map +1 -1
  94. package/dist/esm/hooks/useCurrentSellers.js.map +1 -1
  95. package/dist/esm/index.d.ts +2 -0
  96. package/dist/esm/index.d.ts.map +1 -1
  97. package/dist/esm/index.js +2 -0
  98. package/dist/esm/index.js.map +1 -1
  99. package/package.json +2 -2
  100. package/src/components/buttons/BaseButton.tsx +181 -0
  101. package/src/components/form/BaseInput.tsx +88 -0
  102. package/src/components/form/{TagsInput.tsx → BaseTagsInput.tsx} +46 -24
  103. package/src/components/form/ClearButton.tsx +39 -0
  104. package/src/components/form/Field.styles.ts +83 -40
  105. package/src/components/form/Input.tsx +42 -21
  106. package/src/components/form/Phone.tsx +1 -1
  107. package/src/components/form/index.ts +3 -2
  108. package/src/components/form/styles/{TagsInput.styles.ts → BaseTagsInput.styles.ts} +18 -4
  109. package/src/components/styles/GlobalStyle.tsx +15 -71
  110. package/src/components/ui/ThemedButton.tsx +8 -145
  111. package/src/components/ui/styles.ts +5 -2
  112. package/src/hooks/useCurrentSellers.ts +8 -8
  113. package/src/index.tsx +2 -0
  114. package/src/stories/buttons/button.stories.tsx +84 -62
  115. package/src/stories/form/Input.stories.tsx +67 -0
  116. package/src/stories/ui/ThemedButton.stories.tsx +79 -52
  117. package/dist/cjs/components/form/TagsInput.d.ts +0 -4
  118. package/dist/cjs/components/form/TagsInput.d.ts.map +0 -1
  119. package/dist/cjs/components/form/TagsInput.js.map +0 -1
  120. package/dist/cjs/components/form/styles/TagsInput.styles.d.ts.map +0 -1
  121. package/dist/cjs/components/form/styles/TagsInput.styles.js +0 -46
  122. package/dist/cjs/components/form/styles/TagsInput.styles.js.map +0 -1
  123. package/dist/cjs/global.d.ts +0 -5
  124. package/dist/cjs/global.d.ts.map +0 -1
  125. package/dist/cjs/global.js +0 -44
  126. package/dist/cjs/global.js.map +0 -1
  127. package/dist/esm/components/form/TagsInput.d.ts +0 -4
  128. package/dist/esm/components/form/TagsInput.d.ts.map +0 -1
  129. package/dist/esm/components/form/TagsInput.js.map +0 -1
  130. package/dist/esm/components/form/styles/TagsInput.styles.d.ts.map +0 -1
  131. package/dist/esm/components/form/styles/TagsInput.styles.js.map +0 -1
  132. package/dist/esm/global.d.ts +0 -5
  133. package/dist/esm/global.d.ts.map +0 -1
  134. package/dist/esm/global.js +0 -41
  135. package/dist/esm/global.js.map +0 -1
  136. package/src/global.ts +0 -42
@@ -1,21 +1,24 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  import { useField, useFormikContext } from "formik";
3
2
  import { KeyReturn } from "phosphor-react";
4
- import React, { useEffect } from "react";
3
+ import React, { useEffect, useRef } from "react";
5
4
 
6
5
  import { Grid } from "../ui/Grid";
7
6
  import { Typography } from "../ui/Typography";
8
7
  import Error from "./Error";
9
- import { FieldInput } from "./Field.styles";
8
+ import { FieldInput, HeightSize, InputTheme } from "./Field.styles";
10
9
  import {
11
10
  Close,
12
11
  Helper,
13
12
  TagContainer,
14
13
  TagWrapper
15
- } from "./styles/TagsInput.styles";
16
- import { TagsProps } from "./types";
17
-
18
- const TagsInput = ({
14
+ } from "./styles/BaseTagsInput.styles";
15
+ import { TagsProps as TagsPropsWithoutTheme } from "./types";
16
+ export type BaseTagsInputProps = TagsPropsWithoutTheme & {
17
+ theme?: InputTheme;
18
+ heightSize?: HeightSize;
19
+ };
20
+ const gap = "0.5rem";
21
+ export const BaseTagsInput = ({
19
22
  name,
20
23
  placeholder,
21
24
  onAddTag,
@@ -23,8 +26,10 @@ const TagsInput = ({
23
26
  compareTags = (tagA: string, tagB: string) =>
24
27
  tagA.toLowerCase() === tagB.toLowerCase(),
25
28
  transform = (tag: string) => tag,
26
- label
27
- }: TagsProps) => {
29
+ label,
30
+ heightSize,
31
+ theme
32
+ }: BaseTagsInputProps) => {
28
33
  const { validateForm } = useFormikContext();
29
34
  const [field, meta, helpers] = useField<string[]>(name);
30
35
  const tags = field.value || [];
@@ -39,7 +44,9 @@ const TagsInput = ({
39
44
  }
40
45
  };
41
46
 
42
- function handleKeyDown(event: any) {
47
+ function handleKeyDown(
48
+ event: Parameters<React.KeyboardEventHandler<HTMLInputElement>>[0]
49
+ ) {
43
50
  if (event.key !== "Enter") return;
44
51
  event.preventDefault();
45
52
  const value: string = event.target.value;
@@ -69,31 +76,48 @@ const TagsInput = ({
69
76
  validateForm();
70
77
  // eslint-disable-next-line react-hooks/exhaustive-deps
71
78
  }, [field.value]);
79
+ const labelRef = useRef<HTMLDivElement>(null);
80
+ const hitEnterWidth = useRef<HTMLDivElement>(null);
72
81
  return (
73
82
  <>
74
- <Grid gap="0.5rem" alignItems="center">
75
- {label && <Typography>{label}</Typography>}
76
- <TagContainer>
83
+ <Grid gap={gap} alignItems="center">
84
+ {label && (
85
+ <Typography data-label ref={labelRef}>
86
+ {label}
87
+ </Typography>
88
+ )}
89
+ <TagContainer $gap={gap}>
77
90
  <FieldInput
91
+ theme={theme}
92
+ $heightSize={heightSize}
78
93
  onKeyDown={handleKeyDown}
79
94
  type="text"
80
95
  placeholder={placeholder || "Choose tags..."}
81
96
  name={name}
82
97
  onBlur={handleBlur}
83
- error={errorMessage}
98
+ $error={errorMessage}
99
+ {...(hitEnterWidth.current?.clientWidth && {
100
+ style: {
101
+ paddingRight: `calc(${hitEnterWidth.current.clientWidth}px + 1rem)`
102
+ }
103
+ })}
84
104
  />
85
- <Helper>
86
- Hit Enter <KeyReturn size={16} />
105
+ <Helper ref={hitEnterWidth}>
106
+ Hit Enter <KeyReturn size={13} />
87
107
  </Helper>
88
108
  </TagContainer>
89
109
  </Grid>
90
- <TagContainer style={{ marginTop: "1em" }}>
91
- {label && (
92
- <Typography style={{ visibility: "hidden" }}>{label}</Typography>
93
- )}
110
+ <TagContainer
111
+ $gap={gap}
112
+ $paddingLeft={
113
+ label
114
+ ? `calc(${labelRef.current?.clientWidth}px + ${gap})`
115
+ : undefined
116
+ }
117
+ >
94
118
  {tags.map((tag: string, index: number) => (
95
- <TagWrapper key={`tags-wrapper_${tag}`}>
96
- <span className="text">{tag}</span>
119
+ <TagWrapper key={`tags-wrapper_${tag}`} theme={theme}>
120
+ <span className="text tag">{tag}</span>
97
121
  <Close onClick={() => removeTag(index)}>&times;</Close>
98
122
  </TagWrapper>
99
123
  ))}
@@ -102,5 +126,3 @@ const TagsInput = ({
102
126
  </>
103
127
  );
104
128
  };
105
-
106
- export default TagsInput;
@@ -0,0 +1,39 @@
1
+ import styled, { CSSProperties } from "styled-components";
2
+ import React from "react";
3
+ const CrossIcon = (props: Record<string, unknown>) => (
4
+ <svg
5
+ height="20"
6
+ width="20"
7
+ viewBox="0 0 20 20"
8
+ aria-hidden="true"
9
+ focusable="false"
10
+ {...props}
11
+ >
12
+ <path d="M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"></path>
13
+ </svg>
14
+ );
15
+ export type ClearButtonTheme = {
16
+ fill: CSSProperties["fill"];
17
+ stroke: CSSProperties["stroke"];
18
+ hover: {
19
+ fill: CSSProperties["fill"];
20
+ stroke: CSSProperties["stroke"];
21
+ };
22
+ };
23
+ export const ClearButton = styled(CrossIcon)`
24
+ position: absolute;
25
+ top: 0;
26
+ right: 0;
27
+ height: 100%;
28
+ margin: 0 5px;
29
+ cursor: pointer;
30
+ display: inline-block;
31
+ fill: ${(props) => props.theme?.fill || "#cccccc"};
32
+ line-height: 1;
33
+ stroke: ${(props) => props.theme?.stroke || "#cccccc"};
34
+ stroke-width: 0;
35
+ &:hover * {
36
+ stroke: ${(props) => props.theme?.hover?.stroke || "#999999"};
37
+ fill: ${(props) => props.theme?.hover?.fill || "#999999"};
38
+ }
39
+ `;
@@ -1,5 +1,5 @@
1
1
  /* eslint @typescript-eslint/no-explicit-any: "off" */
2
- import styled, { css } from "styled-components";
2
+ import styled, { CSSProperties, css } from "styled-components";
3
3
 
4
4
  import { transition } from "../../components/ui/styles";
5
5
  import { checkIfValueIsEmpty } from "../../lib/object/checkIfValueIsEmpty";
@@ -12,15 +12,54 @@ export const CopyButton = styled.button`
12
12
  background: none;
13
13
  border: none;
14
14
  `;
15
-
16
- export const FieldInput = styled.input<{ error?: any }>`
15
+ export type InputTheme = {
16
+ background: CSSProperties["backgroundColor"];
17
+ borderColor: CSSProperties["borderColor"];
18
+ borderRadius: CSSProperties["borderRadius"];
19
+ focus: {
20
+ caretColor: CSSProperties["caretColor"];
21
+ };
22
+ hover: {
23
+ borderColor: CSSProperties["borderColor"];
24
+ };
25
+ error: {
26
+ borderColor: CSSProperties["borderColor"];
27
+ hover: {
28
+ borderColor: CSSProperties["borderColor"];
29
+ };
30
+ focus: {
31
+ borderColor: CSSProperties["borderColor"];
32
+ caretColor: CSSProperties["caretColor"];
33
+ };
34
+ placeholder: {
35
+ color: CSSProperties["color"];
36
+ };
37
+ };
38
+ };
39
+ export type HeightSize = keyof typeof sizeToHeight;
40
+ const sizeToHeight = {
41
+ small: "40px",
42
+ regular: "49px",
43
+ large: "56px"
44
+ } as const;
45
+ export const FieldInput = styled.input<{
46
+ $error?: any;
47
+ $heightSize?: HeightSize;
48
+ theme?: InputTheme;
49
+ }>`
50
+ box-sizing: border-box;
51
+ ${({ $heightSize }) =>
52
+ $heightSize &&
53
+ css`
54
+ height: ${sizeToHeight[$heightSize]};
55
+ `};
17
56
  width: 100%;
18
57
  padding: 1rem;
19
58
  gap: 0.5rem;
20
59
 
21
- background: ${colors.lightGrey};
22
- border: 1px solid ${colors.border};
23
- border-radius: 0;
60
+ background: ${(props) => props.theme?.background || "transparent"};
61
+ border: 1px solid ${(props) => props.theme?.borderColor || colors.border};
62
+ border-radius: ${(props) => props.theme?.borderRadius || 0}px;
24
63
  outline: none;
25
64
  font-family: "Plus Jakarta Sans";
26
65
 
@@ -29,7 +68,9 @@ export const FieldInput = styled.input<{ error?: any }>`
29
68
  &:not(:disabled) {
30
69
  &:focus,
31
70
  &:hover {
32
- border: 1px solid var(--secondary);
71
+ border: 1px solid
72
+ ${(props) => props.theme?.hover?.borderColor || colors.lightGrey};
73
+ caret-color: ${(props) => props.theme?.focus?.caretColor || "initial"};
33
74
  }
34
75
  }
35
76
 
@@ -38,39 +79,41 @@ export const FieldInput = styled.input<{ error?: any }>`
38
79
  opacity: 0.5;
39
80
  }
40
81
 
41
- ${({ error }) =>
42
- !checkIfValueIsEmpty(error)
43
- ? css`
44
- border: 1px solid ${colors.orange};
45
- &:not(:disabled) {
46
- &:hover {
47
- border: 1px solid ${colors.orange};
48
- }
49
- }
50
- &:not(:disabled) {
51
- &:focus {
52
- border: 1px solid var(--secondary);
53
- }
54
- }
55
- &::placeholder {
56
- color: ${colors.orange};
57
- opacity: 1;
58
- }
59
- &:-ms-input-placeholder {
60
- color: ${colors.orange};
61
- }
62
- &::-ms-input-placeholder {
63
- color: ${colors.orange};
64
- }
65
- `
66
- : css`
67
- &:not(:disabled) {
68
- &:focus,
69
- &:hover {
70
- border: 1px solid var(--secondary);
71
- }
72
- }
73
- `}
82
+ ${({ $error }) =>
83
+ !checkIfValueIsEmpty($error) &&
84
+ css`
85
+ border: 1px solid
86
+ ${(props) => props.theme?.error?.borderColor || colors.orange};
87
+ &:not(:disabled) {
88
+ &:hover {
89
+ border: 1px solid
90
+ ${(props) =>
91
+ props.theme?.error?.hover?.borderColor || colors.orange};
92
+ }
93
+ }
94
+ &:not(:disabled) {
95
+ &:focus {
96
+ border: 1px solid
97
+ ${(props) =>
98
+ props.theme?.error?.focus?.borderColor || colors.lightGrey};
99
+ caret-color: ${(props) =>
100
+ props.theme?.error?.focus?.caretColor || colors.orange};
101
+ }
102
+ }
103
+ &::placeholder {
104
+ color: ${(props) =>
105
+ props.theme?.error?.placeholder?.color || colors.orange};
106
+ opacity: 1;
107
+ }
108
+ &:-ms-input-placeholder {
109
+ color: ${(props) =>
110
+ props.theme?.error?.placeholder?.color || colors.orange};
111
+ }
112
+ &::-ms-input-placeholder {
113
+ color: ${(props) =>
114
+ props.theme?.error?.placeholder?.color || colors.orange};
115
+ }
116
+ `};
74
117
  `;
75
118
 
76
119
  export const FileUploadWrapper = styled.div<{ choosen: any; error: any }>`
@@ -1,25 +1,46 @@
1
1
  import React from "react";
2
- import { useField, useFormikContext } from "formik";
3
-
4
- import Error from "./Error";
5
- import { FieldInput } from "./Field.styles";
6
- import type { InputProps } from "./types";
7
-
8
- export default function Input({ name, ...props }: InputProps) {
9
- const { status } = useFormikContext();
10
- const [field, meta] = useField(name);
11
- const errorText = meta.error || status?.[name];
12
- const errorMessage = errorText && meta.touched ? errorText : "";
13
- const displayError =
14
- typeof errorMessage === typeof "string" && errorMessage !== "";
15
-
2
+ import { theme } from "../../theme";
3
+ import { BaseInput, BaseInputProps } from "./BaseInput";
4
+ const colors = theme.colors.light;
5
+ const bosonTheme = {
6
+ background: colors.lightGrey,
7
+ borderColor: colors.border,
8
+ borderRadius: 0,
9
+ focus: {
10
+ caretColor: "initial"
11
+ },
12
+ hover: {
13
+ borderColor: colors.lightGrey
14
+ },
15
+ error: {
16
+ borderColor: colors.orange,
17
+ hover: {
18
+ borderColor: colors.orange
19
+ },
20
+ focus: {
21
+ borderColor: colors.orange,
22
+ caretColor: colors.orange
23
+ },
24
+ placeholder: {
25
+ color: colors.orange
26
+ }
27
+ }
28
+ } satisfies BaseInputProps["theme"];
29
+ const clearButtonTheme = {
30
+ fill: "#cccccc",
31
+ stroke: "#cccccc",
32
+ hover: {
33
+ fill: "#999999",
34
+ stroke: "#999999"
35
+ }
36
+ } satisfies BaseInputProps["clearButtonTheme"];
37
+ export type InputProps = Omit<BaseInputProps, "theme" | "clearButtonTheme">;
38
+ export default function Input(props: InputProps) {
16
39
  return (
17
- <>
18
- <FieldInput error={errorMessage} {...field} {...props} />
19
- <Error
20
- display={!props.hideError && displayError}
21
- message={errorMessage}
22
- />
23
- </>
40
+ <BaseInput
41
+ {...props}
42
+ theme={bosonTheme}
43
+ clearButtonTheme={clearButtonTheme}
44
+ />
24
45
  );
25
46
  }
@@ -248,7 +248,7 @@ export default function Phone({ name, ...props }: InputProps) {
248
248
  </PhoneWrapper>
249
249
  <FieldInput
250
250
  type="hidden"
251
- error={errorMessage}
251
+ $error={errorMessage}
252
252
  disabled
253
253
  {...field}
254
254
  {...props}
@@ -2,9 +2,10 @@ export { default as Checkbox } from "./Checkbox";
2
2
  export { default as Datepicker } from "./Datepicker";
3
3
  export { default as Error } from "./Error";
4
4
  export { default as FormField } from "./FormField";
5
- export { default as Input } from "./Input";
5
+ export * from "./BaseInput";
6
+ export { default as Input, InputProps } from "./Input";
6
7
  export { default as Phone } from "./Phone";
7
8
  export { default as Select } from "./Select";
8
- export { default as TagsInput } from "./TagsInput";
9
+ export * from "./BaseTagsInput";
9
10
  export { default as Textarea } from "./Textarea";
10
11
  export { default as Upload } from "./Upload/Upload";
@@ -1,22 +1,31 @@
1
- import styled from "styled-components";
1
+ import styled, { CSSProperties, css } from "styled-components";
2
2
  import { theme } from "../../../theme";
3
3
 
4
4
  const colors = theme.colors.light;
5
5
 
6
- export const TagContainer = styled.div`
6
+ export const TagContainer = styled.div<{
7
+ $gap: CSSProperties["gap"];
8
+ $paddingLeft?: CSSProperties["paddingLeft"];
9
+ }>`
7
10
  position: relative;
8
11
  width: 100%;
9
12
  border-radius: 3px;
10
13
  display: flex;
11
14
  align-items: center;
12
15
  flex-wrap: wrap;
13
- gap: 0.5em;
16
+ gap: ${({ $gap }) => $gap};
17
+ box-sizing: border-box;
18
+ ${({ $paddingLeft }) =>
19
+ $paddingLeft &&
20
+ css`
21
+ padding-left: ${$paddingLeft};
22
+ `};
14
23
  `;
15
24
 
16
25
  export const Helper = styled.div`
17
26
  position: absolute;
18
27
  right: 0.5rem;
19
- font-size: 0.875rem;
28
+ font-size: 0.7rem;
20
29
  font-weight: 600;
21
30
  opacity: 0.5;
22
31
  pointer-events: none;
@@ -29,6 +38,11 @@ export const TagWrapper = styled.div`
29
38
  background-color: ${colors.lightGrey};
30
39
  display: inline-block;
31
40
  padding: 0.5em 0.75em;
41
+ margin-top: 1rem;
42
+ border-radius: ${(props) => props.theme.borderRadius || 0}px;
43
+ .text {
44
+ word-break: break-word;
45
+ }
32
46
  `;
33
47
 
34
48
  export const Close = styled.span`
@@ -4,22 +4,7 @@ import { theme } from "../../theme";
4
4
  import { zIndex } from "../ui/zIndex";
5
5
 
6
6
  const colors = theme.colors.light;
7
- const GlobalStyle = createGlobalStyle<
8
- Partial<{
9
- $withBosonStyles: boolean;
10
- $headerBgColor: string;
11
- $headerTextColor: string;
12
- $primaryBgColor: string;
13
- $secondaryBgColor: string;
14
- $accentColor: string;
15
- $textColor: string;
16
- $footerBgColor: string;
17
- $footerTextColor: string;
18
- $fontFamily: string;
19
- $buttonBgColor: string;
20
- $buttonTextColor: string;
21
- }>
22
- >`
7
+ const GlobalStyle = createGlobalStyle`
23
8
  @font-face {
24
9
  font-family: barlow;
25
10
  src: url(src/assets/fonts/Barlow-Regular.ttf);
@@ -32,60 +17,19 @@ const GlobalStyle = createGlobalStyle<
32
17
  }
33
18
  :root {
34
19
  --l: 50%;
35
- --headerBgColor: ${(props) =>
36
- props.$headerBgColor && !props.$withBosonStyles
37
- ? props.$headerBgColor
38
- : colors.white};
39
- --headerTextColor: ${(props) =>
40
- props.$headerTextColor && !props.$withBosonStyles
41
- ? props.$headerTextColor
42
- : colors.darkGrey};
43
- --primary: ${(props) =>
44
- props.$primaryBgColor && !props.$withBosonStyles
45
- ? props.$primaryBgColor
46
- : colors.primary};
47
- --secondary: ${(props) =>
48
- props.$secondaryBgColor && !props.$withBosonStyles
49
- ? props.$secondaryBgColor
50
- : colors.lightGrey};
51
- --accent: ${(props) =>
52
- props.$accentColor && !props.$withBosonStyles
53
- ? props.$accentColor
54
- : colors.accent};
55
- --accentNoDefault : ${(props) =>
56
- props.$accentColor && !props.$withBosonStyles ? props.$accentColor : ""};
57
- --accentDark: ${(props) =>
58
- props.$accentColor && !props.$withBosonStyles
59
- ? props.$accentColor
60
- : colors.arsenic};
61
- --textColor: ${(props) =>
62
- props.$textColor && !props.$withBosonStyles
63
- ? props.$textColor
64
- : colors.black};
65
- --primaryBgColor: ${(props) =>
66
- props.$primaryBgColor && !props.$withBosonStyles
67
- ? props.$primaryBgColor
68
- : colors.primaryBgColor};
69
- --secondaryBgColor: ${(props) =>
70
- props.$secondaryBgColor && !props.$withBosonStyles
71
- ? props.$secondaryBgColor
72
- : colors.secondary};
73
- --footerBgColor: ${(props) =>
74
- props.$footerBgColor && !props.$withBosonStyles
75
- ? props.$footerBgColor
76
- : colors.black};
77
- --footerTextColor: ${(props) =>
78
- props.$footerTextColor && !props.$withBosonStyles
79
- ? props.$footerTextColor
80
- : colors.white};
81
- --buttonBgColor: ${(props) =>
82
- props.$buttonBgColor && !props.$withBosonStyles
83
- ? props.$buttonBgColor
84
- : colors.primary};
85
- --buttonTextColor: ${(props) =>
86
- props.$buttonTextColor && !props.$withBosonStyles
87
- ? props.$buttonTextColor
88
- : colors.black};
20
+ --headerBgColor: ${colors.white};
21
+ --headerTextColor: ${colors.darkGrey};
22
+ --primary: ${colors.primary};
23
+ --secondary: ${colors.lightGrey};
24
+ --accent: ${colors.accent};
25
+ --accentDark: ${colors.arsenic};
26
+ --textColor: ${colors.black};
27
+ --primaryBgColor: ${colors.primaryBgColor};
28
+ --secondaryBgColor: ${colors.secondary};
29
+ --footerBgColor: ${colors.black};
30
+ --footerTextColor: ${colors.white};
31
+ --buttonBgColor: ${colors.primary};
32
+ --buttonTextColor: ${colors.black};
89
33
 
90
34
  font-size: 0.75rem;
91
35
  ${breakpoint.xs} {
@@ -119,7 +63,7 @@ const GlobalStyle = createGlobalStyle<
119
63
 
120
64
  color: var(--textColor);
121
65
 
122
- font-family: ${(props) => props.$fontFamily || "Plus Jakarta Sans"};
66
+ font-family: "Plus Jakarta Sans";
123
67
  font-style: normal;
124
68
 
125
69
  max-height: 100vh;