@xqmsg/ui-core 0.9.2 → 0.10.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 (47) hide show
  1. package/dist/components/input/InputTypes.d.ts +5 -3
  2. package/dist/components/input/StackedInput/StackedInput.d.ts +0 -3
  3. package/dist/components/input/StackedMultiSelect/index.d.ts +1 -1
  4. package/dist/components/input/StackedSelect/StackedSelect.d.ts +7 -3
  5. package/dist/components/input/components/dropdown/index.d.ts +10 -0
  6. package/dist/components/input/components/label/index.d.ts +9 -0
  7. package/dist/components/input/components/token/Token.stories.d.ts +5 -0
  8. package/dist/components/input/components/token/index.d.ts +7 -0
  9. package/dist/components/input/index.d.ts +1 -3
  10. package/dist/theme/components/form-error.d.ts +3 -3
  11. package/dist/theme/components/form-label.d.ts +4 -6
  12. package/dist/theme/components/form.d.ts +3 -3
  13. package/dist/theme/components/input.d.ts +32 -161
  14. package/dist/theme/components/select.d.ts +27 -153
  15. package/dist/theme/components/textarea.d.ts +10 -117
  16. package/dist/theme/foundations/colors.d.ts +30 -0
  17. package/dist/ui-core.cjs.development.js +455 -490
  18. package/dist/ui-core.cjs.development.js.map +1 -1
  19. package/dist/ui-core.cjs.production.min.js +1 -1
  20. package/dist/ui-core.cjs.production.min.js.map +1 -1
  21. package/dist/ui-core.esm.js +459 -494
  22. package/dist/ui-core.esm.js.map +1 -1
  23. package/package.json +5 -3
  24. package/src/components/input/Input.stories.tsx +28 -12
  25. package/src/components/input/InputTypes.ts +7 -1
  26. package/src/components/input/StackedInput/StackedInput.tsx +3 -15
  27. package/src/components/input/StackedMultiSelect/components/MultiValue/index.tsx +2 -2
  28. package/src/components/input/StackedMultiSelect/index.tsx +89 -93
  29. package/src/components/input/StackedPilledInput/index.tsx +145 -56
  30. package/src/components/input/StackedSelect/StackedSelect.tsx +63 -20
  31. package/src/components/input/StackedSelect/assets/svg/subtract.svg +3 -0
  32. package/src/components/input/components/dropdown/index.tsx +79 -0
  33. package/src/components/input/components/label/index.tsx +24 -0
  34. package/src/components/input/components/token/Token.stories.tsx +22 -0
  35. package/src/components/input/components/token/assets/svg/close.svg +3 -0
  36. package/src/components/input/components/token/index.tsx +37 -0
  37. package/src/components/input/index.tsx +8 -20
  38. package/src/theme/components/alert.ts +4 -4
  39. package/src/theme/components/form-error.ts +11 -14
  40. package/src/theme/components/form-label.ts +8 -8
  41. package/src/theme/components/form.ts +10 -13
  42. package/src/theme/components/input.ts +17 -191
  43. package/src/theme/components/select.ts +5 -10
  44. package/src/theme/components/textarea.ts +2 -38
  45. package/src/theme/foundations/colors.ts +17 -1
  46. package/dist/components/input/components/InputTag/index.d.ts +0 -7
  47. package/src/components/input/components/InputTag/index.tsx +0 -24
@@ -1,29 +1,26 @@
1
- import { mode } from '@chakra-ui/theme-tools';
2
-
3
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
- type Dict = Record<string, any>;
1
+ import colors from '../foundations/colors';
5
2
 
6
3
  const parts = ['text', 'icon'];
7
4
 
8
- function baseStyleText(props: Dict) {
5
+ function baseStyleText() {
9
6
  return {
10
- color: mode('red.500', 'red.300')(props),
7
+ color: colors.label.error,
11
8
  mt: 1,
12
- lineHeight: 'normal',
13
- fontSize: 'sm',
9
+ ml: 1,
10
+ fontSize: '13px',
14
11
  };
15
12
  }
16
13
 
17
- function baseStyleIcon(props: Dict) {
14
+ function baseStyleIcon() {
18
15
  return {
19
- mr: '0.5em',
20
- color: mode('red.500', 'red.300')(props),
16
+ ml: 1,
17
+ color: colors.label.error,
21
18
  };
22
19
  }
23
20
 
24
- const baseStyle = (props: Dict) => ({
25
- text: baseStyleText(props),
26
- icon: baseStyleIcon(props),
21
+ const baseStyle = () => ({
22
+ text: baseStyleText(),
23
+ icon: baseStyleIcon(),
27
24
  });
28
25
 
29
26
  export default {
@@ -1,14 +1,14 @@
1
+ import colors from '../foundations/colors';
2
+
1
3
  const baseStyle = {
2
- fontSize: 'md',
3
- mr: 3,
4
+ fontSize: '13px',
5
+ position: 'absolute',
6
+ top: 0,
7
+ display: 'flex',
8
+ ml: 1,
4
9
  mb: 1,
5
- fontWeight: 'bold',
6
- color: 'gray.700',
7
- transition: 'all 0.2s',
10
+ color: colors.label.primary.light,
8
11
  opacity: 1,
9
- _disabled: {
10
- opacity: 0.4,
11
- },
12
12
  };
13
13
 
14
14
  export default {
@@ -1,29 +1,26 @@
1
- import { mode } from '@chakra-ui/theme-tools';
2
-
3
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
- type Dict = Record<string, any>;
1
+ import colors from '../foundations/colors';
5
2
 
6
3
  const parts = ['requiredIndicator', 'helperText'];
7
4
 
8
- function baseStyleRequiredIndicator(props: Dict) {
5
+ function baseStyleRequiredIndicator() {
9
6
  return {
10
7
  ml: 1,
11
- color: mode('red.500', 'red.300')(props),
8
+ color: colors.label.error,
12
9
  };
13
10
  }
14
11
 
15
- function baseStyleHelperText(props: Dict) {
12
+ function baseStyleHelperText() {
16
13
  return {
14
+ color: colors.label.secondary.light,
17
15
  mt: 1,
18
- color: mode('gray.400', 'whiteAlpha.600')(props),
19
- lineHeight: 'normal',
20
- fontSize: 'sm',
16
+ ml: 1,
17
+ fontSize: '13px',
21
18
  };
22
19
  }
23
20
 
24
- const baseStyle = (props: Dict) => ({
25
- requiredIndicator: baseStyleRequiredIndicator(props),
26
- helperText: baseStyleHelperText(props),
21
+ const baseStyle = () => ({
22
+ requiredIndicator: baseStyleRequiredIndicator(),
23
+ helperText: baseStyleHelperText(),
27
24
  });
28
25
 
29
26
  export default {
@@ -1,213 +1,39 @@
1
- import { getColor, mode, transparentize } from '@chakra-ui/theme-tools';
1
+ import colors from '../foundations/colors';
2
2
 
3
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
- type Dict = Record<string, any>;
5
-
6
- const parts = ['field', 'addon'];
3
+ const parts = ['field'];
7
4
 
8
5
  const baseStyle = {
9
6
  field: {
10
- width: '100%',
11
- outline: 0,
12
- position: 'relative',
13
- appearance: 'none',
14
- transition: 'all 0.2s',
7
+ fontSize: '13px',
15
8
  '::placeholder': {
16
- color: 'gray.300',
9
+ color: colors.label.secondary.light,
17
10
  },
18
- },
19
- };
20
-
21
- const size = {
22
- lg: {
23
- fontSize: 'md',
24
- pl: 3,
25
- pr: 3,
26
- h: 12,
27
- borderRadius: 'md',
28
- },
29
-
30
- md: {
31
- fontSize: 'md',
32
- pl: 3,
33
- pr: 3,
34
- h: 10,
35
- borderRadius: 'md',
36
- },
37
-
38
- sm: {
39
- fontSize: 'sm',
40
- pl: 3,
41
- pr: 3,
42
- h: 8,
43
- borderRadius: 'sm',
44
- },
45
- };
46
-
47
- const sizes = {
48
- lg: {
49
- field: size.lg,
50
- addon: size.lg,
51
- },
52
- md: {
53
- field: size.md,
54
- addon: size.md,
55
- },
56
- sm: {
57
- field: size.sm,
58
- addon: size.sm,
59
- },
60
- };
61
-
62
- function getDefaults(props: Dict) {
63
- const { focusBorderColor: fc, errorBorderColor: ec } = props;
64
- return {
65
- focusBorderColor: fc || mode('blue.500', 'blue.300')(props),
66
- errorBorderColor: ec || mode('red.500', 'red.300')(props),
67
- };
68
- }
69
-
70
- function variantOutline(props: Dict) {
71
- const { theme } = props;
72
- const { focusBorderColor: fc, errorBorderColor: ec } = getDefaults(props);
73
-
74
- return {
75
- field: {
76
- border: '1px solid',
77
- borderColor: 'inherit',
78
- bg: 'white',
79
- _hover: {
80
- borderColor: mode('gray.300', 'whiteAlpha.400')(props),
81
- },
82
- _readOnly: {
83
- boxShadow: 'none !important',
84
- userSelect: 'all',
85
- },
86
- _disabled: {
87
- opacity: 0.4,
88
- cursor: 'not-allowed',
89
- },
90
- _focus: {
91
- zIndex: 1,
92
- borderColor: getColor(theme, fc),
93
- boxShadow: `0 0 0 2px ${transparentize(fc, 0.3)(theme)}`,
94
- },
95
- _invalid: {
96
- borderColor: getColor(theme, ec),
97
- boxShadow: 'none',
98
- _focus: {
99
- boxShadow: `0 0 0 2px ${transparentize(ec, 0.3)(theme)}`,
100
- },
101
- },
102
- },
103
- addon: {
104
- border: '1px solid',
105
- borderColor: mode('inherit', 'whiteAlpha.50')(props),
106
- bg: mode('gray.100', 'whiteAlpha.300')(props),
107
- },
108
- };
109
- }
110
-
111
- function variantFilled(props: Dict) {
112
- const { theme } = props;
113
- const { focusBorderColor: fc, errorBorderColor: ec } = getDefaults(props);
114
-
115
- return {
116
- field: {
117
- border: '2px solid',
118
- borderColor: 'transparent',
119
- bg: mode('gray.50', 'whiteAlpha.50')(props),
120
- _hover: {
121
- bg: mode('gray.100', 'whiteAlpha.100')(props),
122
- },
123
- _readOnly: {
124
- boxShadow: 'none !important',
125
- userSelect: 'all',
126
- },
127
- _disabled: {
128
- opacity: 0.4,
129
- cursor: 'not-allowed',
130
- },
131
- _focus: {
132
- bg: 'transparent',
133
- borderColor: getColor(theme, fc),
134
- },
135
- _invalid: {
136
- borderColor: getColor(theme, ec),
137
- },
11
+ py: '5px',
12
+ px: '8px',
13
+ border: '1px solid',
14
+ borderColor: colors.border.default,
15
+ _disabled: {
16
+ cursor: 'not-allowed',
17
+ bg: colors.fill.light,
18
+ color: colors.label.secondary.light,
138
19
  },
139
- addon: {
20
+ _focus: {
21
+ bg: '#ffffff',
140
22
  border: '2px solid',
141
- borderColor: 'transparent',
142
- bg: mode('gray.100', 'whiteAlpha.50')(props),
23
+ borderColor: colors.border.focus,
143
24
  },
144
- };
145
- }
146
-
147
- function variantFlushed(props: Dict) {
148
- const { theme } = props;
149
- const { focusBorderColor: fc, errorBorderColor: ec } = getDefaults(props);
150
-
151
- return {
152
- field: {
153
- borderBottom: '1px solid inherit',
154
- borderRadius: 0,
155
- pl: 0,
156
- pr: 0,
157
- bg: 'transparent',
158
- _readOnly: {
159
- boxShadow: 'none !important',
160
- userSelect: 'all',
161
- },
162
- _focus: {
163
- borderColor: getColor(theme, fc),
164
- boxShadow: `0px 1px 0px 0px ${getColor(theme, fc)}`,
165
- },
166
- _invalid: {
167
- borderColor: getColor(theme, ec),
168
- },
169
- },
170
- addon: {
171
- borderBottom: '2px solid',
172
- borderColor: 'inherit',
173
- borderRadius: 0,
174
- paddingX: 0,
175
- bg: 'transparent',
176
- },
177
- };
178
- }
179
-
180
- const variantUnstyled = {
181
- field: {
182
- bg: 'transparent',
183
- pl: 0,
184
- pr: 0,
185
- height: 'auto',
186
- },
187
- addon: {
188
- bg: 'transparent',
189
- pl: 0,
190
- pr: 0,
191
- height: 'auto',
192
25
  },
193
26
  };
194
27
 
195
- const variants = {
196
- outline: variantOutline,
197
- filled: variantFilled,
198
- flushed: variantFlushed,
199
- unstyled: variantUnstyled,
200
- };
28
+ const variants = { default: baseStyle };
201
29
 
202
30
  const defaultProps = {
203
- size: 'lg',
204
- variant: 'outline',
31
+ variant: 'default',
205
32
  };
206
33
 
207
34
  export default {
208
35
  parts,
209
36
  baseStyle,
210
- sizes,
211
37
  variants,
212
38
  defaultProps,
213
39
  };
@@ -1,14 +1,10 @@
1
- import { mode } from '@chakra-ui/theme-tools';
2
1
  import Input from './input';
3
2
 
4
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
- type Dict = Record<string, any>;
6
-
7
- const { sizes, defaultProps, variants } = Input;
3
+ const { defaultProps, variants } = Input;
8
4
 
9
5
  const parts = ['field', 'icon'];
10
6
 
11
- function baseStyleField(props: Dict) {
7
+ function baseStyleField() {
12
8
  return {
13
9
  ...Input.baseStyle.field,
14
10
  appearance: 'none',
@@ -16,7 +12,7 @@ function baseStyleField(props: Dict) {
16
12
  lineHeight: 'normal',
17
13
  bg: 'white',
18
14
  '> option': {
19
- bg: mode('white', 'gray.700')(props),
15
+ // bg: mode('white', 'gray.700')(props),
20
16
  },
21
17
  };
22
18
  }
@@ -27,15 +23,14 @@ const baseStyleInput = {
27
23
  _disabled: { opacity: 0.5 },
28
24
  };
29
25
 
30
- const baseStyle = (props: Dict) => ({
31
- field: baseStyleField(props),
26
+ const baseStyle = () => ({
27
+ field: baseStyleField(),
32
28
  icon: baseStyleInput,
33
29
  });
34
30
 
35
31
  export default {
36
32
  parts,
37
33
  baseStyle,
38
- sizes,
39
34
  variants,
40
35
  defaultProps,
41
36
  };
@@ -1,54 +1,18 @@
1
1
  import Input from './input';
2
2
 
3
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
- type Dict = Record<string, any>;
5
-
6
3
  const baseStyle = {
7
4
  ...Input.baseStyle.field,
8
5
  display: 'block', // Removes gap below textarea because it defaults to inline.
9
6
  paddingY: '8px',
10
- minHeight: '80px',
7
+ height: '80px',
11
8
  lineHeight: 'short',
12
9
  };
13
10
 
14
- const codeVariant = (props: Dict) => {
15
- const { _focus } = Input.variants.outline(props).field;
16
- return {
17
- bg: 'blue.900',
18
- color: 'white',
19
- fontFamily: 'mono',
20
- fontSize: 'sm',
21
- border: '1px',
22
- borderColor: 'blue.900',
23
- borderRadius: 'lg',
24
- p: 6,
25
- wordBreak: 'break-all',
26
- _focus,
27
- };
28
- };
29
-
30
- const variants = {
31
- outline: (props: Dict) => Input.variants.outline(props).field,
32
- flushed: (props: Dict) => Input.variants.flushed(props).field,
33
- filled: (props: Dict) => Input.variants.filled(props).field,
34
- code: (props: Dict) => codeVariant(props),
35
- unstyled: Input.variants.unstyled.field,
36
- };
37
-
38
- const sizes = {
39
- sm: Input.sizes.sm.field,
40
- md: Input.sizes.md.field,
41
- lg: Input.sizes.lg.field,
42
- };
43
-
44
11
  const defaultProps = {
45
- size: 'lg',
46
- variant: 'outline',
12
+ variant: 'default',
47
13
  };
48
14
 
49
15
  export default {
50
16
  baseStyle,
51
- sizes,
52
- variants,
53
17
  defaultProps,
54
18
  };
@@ -72,6 +72,21 @@ const aliases: Record<string, ColorHues> = {
72
72
 
73
73
  const label = {
74
74
  primary: { light: '#000000', dark: '#FFFFFF' },
75
+ secondary: { light: '#3C3C4399' },
76
+ error: '#FF0000',
77
+ };
78
+
79
+ const border = {
80
+ focus: '#3A6CD980',
81
+ default: '#9999991A',
82
+ };
83
+
84
+ const fill = {
85
+ light: '#7474800D',
86
+ positive: '#d8f1b8',
87
+ error: '#ffbdb9',
88
+ warning: '#ffefb4',
89
+ blue: '#0082ff',
75
90
  };
76
91
 
77
92
  const colors = {
@@ -85,7 +100,8 @@ const colors = {
85
100
  backdrop: '#fbfcff',
86
101
  ...aliases,
87
102
  label,
88
-
103
+ border,
104
+ fill,
89
105
  whiteAlpha: {
90
106
  50: 'rgba(255, 255, 255, 0.04)',
91
107
  100: 'rgba(255, 255, 255, 0.06)',
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- interface InputTagProps {
3
- value: any;
4
- onDelete?: any;
5
- }
6
- declare const InputTag: React.FC<InputTagProps>;
7
- export default InputTag;
@@ -1,24 +0,0 @@
1
- import { Tag, TagCloseButton, TagLabel } from '@chakra-ui/react';
2
- import React from 'react';
3
-
4
- interface InputTagProps {
5
- value: any;
6
- onDelete?: any;
7
- }
8
-
9
- const InputTag: React.FC<InputTagProps> = ({ value, onDelete }) => {
10
- return (
11
- <Tag
12
- size={'md'}
13
- key={value}
14
- borderRadius="full"
15
- variant="solid"
16
- backgroundColor="#eeeeee"
17
- >
18
- <TagLabel color={'gray.700'}>{value}</TagLabel>
19
- {onDelete && <TagCloseButton color={'gray.700'} onClick={onDelete} />}
20
- </Tag>
21
- );
22
- };
23
-
24
- export default InputTag;