@xqmsg/ui-core 0.9.3 → 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.
- package/dist/components/input/InputTypes.d.ts +5 -3
- package/dist/components/input/StackedInput/StackedInput.d.ts +0 -3
- package/dist/components/input/StackedMultiSelect/index.d.ts +1 -1
- package/dist/components/input/StackedSelect/StackedSelect.d.ts +7 -3
- package/dist/components/input/components/dropdown/index.d.ts +10 -0
- package/dist/components/input/components/label/index.d.ts +9 -0
- package/dist/components/input/components/token/Token.stories.d.ts +5 -0
- package/dist/components/input/components/token/index.d.ts +7 -0
- package/dist/components/input/index.d.ts +1 -3
- package/dist/theme/components/form-error.d.ts +3 -3
- package/dist/theme/components/form-label.d.ts +4 -6
- package/dist/theme/components/form.d.ts +3 -3
- package/dist/theme/components/input.d.ts +32 -161
- package/dist/theme/components/select.d.ts +27 -153
- package/dist/theme/components/textarea.d.ts +10 -117
- package/dist/theme/foundations/colors.d.ts +30 -0
- package/dist/ui-core.cjs.development.js +455 -490
- package/dist/ui-core.cjs.development.js.map +1 -1
- package/dist/ui-core.cjs.production.min.js +1 -1
- package/dist/ui-core.cjs.production.min.js.map +1 -1
- package/dist/ui-core.esm.js +459 -494
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/input/Input.stories.tsx +28 -12
- package/src/components/input/InputTypes.ts +7 -1
- package/src/components/input/StackedInput/StackedInput.tsx +3 -15
- package/src/components/input/StackedMultiSelect/components/MultiValue/index.tsx +2 -2
- package/src/components/input/StackedMultiSelect/index.tsx +89 -93
- package/src/components/input/StackedPilledInput/index.tsx +145 -56
- package/src/components/input/StackedSelect/StackedSelect.tsx +63 -20
- package/src/components/input/StackedSelect/assets/svg/subtract.svg +3 -0
- package/src/components/input/components/dropdown/index.tsx +79 -0
- package/src/components/input/components/label/index.tsx +24 -0
- package/src/components/input/components/token/Token.stories.tsx +22 -0
- package/src/components/input/components/token/assets/svg/close.svg +3 -0
- package/src/components/input/components/token/index.tsx +37 -0
- package/src/components/input/index.tsx +8 -20
- package/src/theme/components/alert.ts +4 -4
- package/src/theme/components/form-error.ts +11 -14
- package/src/theme/components/form-label.ts +8 -8
- package/src/theme/components/form.ts +10 -13
- package/src/theme/components/input.ts +17 -191
- package/src/theme/components/select.ts +5 -10
- package/src/theme/components/textarea.ts +2 -38
- package/src/theme/foundations/colors.ts +17 -1
- package/dist/components/input/components/InputTag/index.d.ts +0 -7
- package/src/components/input/components/InputTag/index.tsx +0 -24
|
@@ -1,213 +1,39 @@
|
|
|
1
|
-
import
|
|
1
|
+
import colors from '../foundations/colors';
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
11
|
-
outline: 0,
|
|
12
|
-
position: 'relative',
|
|
13
|
-
appearance: 'none',
|
|
14
|
-
transition: 'all 0.2s',
|
|
7
|
+
fontSize: '13px',
|
|
15
8
|
'::placeholder': {
|
|
16
|
-
color:
|
|
9
|
+
color: colors.label.secondary.light,
|
|
17
10
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
20
|
+
_focus: {
|
|
21
|
+
bg: '#ffffff',
|
|
140
22
|
border: '2px solid',
|
|
141
|
-
borderColor:
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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 = (
|
|
31
|
-
field: baseStyleField(
|
|
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
|
-
|
|
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
|
-
|
|
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,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;
|