@xqmsg/ui-core 0.22.3 → 0.23.1-rc.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/form/FormTypes.d.ts +2 -0
- package/dist/components/input/StackedCheckbox/StackedCheckbox.d.ts +3 -2
- package/dist/components/input/StackedInput/StackedInput.d.ts +1 -0
- package/dist/components/input/StackedPilledInput/index.d.ts +2 -0
- package/dist/components/input/StackedTextarea/StackedTextarea.d.ts +3 -0
- package/dist/components/input/components/token/index.d.ts +1 -0
- package/dist/components/input/index.d.ts +3 -2
- package/dist/components/select/index.d.ts +27 -0
- package/dist/index.d.ts +1 -0
- package/dist/theme/components/button.d.ts +116 -0
- package/dist/theme/components/checkbox.d.ts +28 -0
- package/dist/theme/components/input.d.ts +12 -0
- package/dist/theme/components/select.d.ts +12 -0
- package/dist/theme/components/textarea.d.ts +66 -0
- package/dist/ui-core.cjs.development.js +330 -55
- 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 +332 -58
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +2 -1
- package/src/components/button/Button.stories.tsx +92 -27
- package/src/components/form/FormTypes.ts +2 -0
- package/src/components/form/section/index.tsx +2 -0
- package/src/components/input/Input.stories.tsx +66 -0
- package/src/components/input/StackedCheckbox/StackedCheckbox.tsx +12 -4
- package/src/components/input/StackedInput/StackedInput.tsx +5 -0
- package/src/components/input/StackedPilledInput/index.tsx +287 -251
- package/src/components/input/StackedTextarea/StackedTextarea.tsx +29 -5
- package/src/components/input/components/dropdown/index.tsx +1 -1
- package/src/components/input/components/token/index.tsx +6 -5
- package/src/components/input/index.tsx +22 -9
- package/src/components/select/index.tsx +184 -0
- package/src/components/tabs/TabsWrapper.stories.tsx +1 -1
- package/src/index.tsx +3 -0
- package/src/theme/components/button.ts +67 -0
- package/src/theme/components/checkbox.ts +25 -0
- package/src/theme/components/input.ts +15 -1
- package/src/theme/components/textarea.ts +20 -0
- package/src/theme/customXQChakraTheme.ts +2 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.23.1-rc.0",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
"yup": "^0.32.11"
|
|
112
112
|
},
|
|
113
113
|
"resolutions": {
|
|
114
|
+
"framer-motion": "6.4.1",
|
|
114
115
|
"**/@typescript-eslint/eslint-plugin": "^5.59.5",
|
|
115
116
|
"**/@typescript-eslint/parser": "^5.59.5"
|
|
116
117
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Meta, Story } from '@storybook/react';
|
|
3
3
|
import { Button, ButtonProps } from '.';
|
|
4
|
-
import { Flex } from '@chakra-ui/react';
|
|
4
|
+
import { Box, Flex } from '@chakra-ui/react';
|
|
5
5
|
|
|
6
6
|
const meta: Meta<ButtonProps> = {
|
|
7
7
|
title: 'Button example',
|
|
@@ -38,32 +38,97 @@ const meta: Meta<ButtonProps> = {
|
|
|
38
38
|
export default meta;
|
|
39
39
|
const Template: Story<ButtonProps> = args => (
|
|
40
40
|
<Flex flexDir="column" height="150px" justifyContent="space-between">
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
41
|
+
<Box p={5}>
|
|
42
|
+
<Button {...args} text="Primary Fixed" variant="primary" width="fixed" />
|
|
43
|
+
</Box>
|
|
44
|
+
<Box p={5}>
|
|
45
|
+
<Button
|
|
46
|
+
{...args}
|
|
47
|
+
text="Secondary Fixed"
|
|
48
|
+
variant="secondary"
|
|
49
|
+
width="fixed"
|
|
50
|
+
/>
|
|
51
|
+
</Box>
|
|
52
|
+
<Box p={5}>
|
|
53
|
+
<Button
|
|
54
|
+
{...args}
|
|
55
|
+
text="Tertiary Fixed"
|
|
56
|
+
variant="tertiary"
|
|
57
|
+
width="fixed"
|
|
58
|
+
/>
|
|
59
|
+
</Box>
|
|
60
|
+
<Box p={5}>
|
|
61
|
+
<Button
|
|
62
|
+
{...args}
|
|
63
|
+
text="Primary Variable"
|
|
64
|
+
variant="primary"
|
|
65
|
+
width="variable"
|
|
66
|
+
/>
|
|
67
|
+
</Box>
|
|
68
|
+
<Box p={5}>
|
|
69
|
+
<Button
|
|
70
|
+
{...args}
|
|
71
|
+
text="Secondary Variable"
|
|
72
|
+
variant="secondary"
|
|
73
|
+
width="variable"
|
|
74
|
+
/>
|
|
75
|
+
</Box>
|
|
76
|
+
<Box p={5}>
|
|
77
|
+
<Button
|
|
78
|
+
{...args}
|
|
79
|
+
text="Tertiary Variable"
|
|
80
|
+
variant="tertiary"
|
|
81
|
+
width="variable"
|
|
82
|
+
/>
|
|
83
|
+
</Box>
|
|
84
|
+
<Box p={5}>
|
|
85
|
+
<Button
|
|
86
|
+
{...args}
|
|
87
|
+
text="Primary Variable Flat"
|
|
88
|
+
variant="flat-primary"
|
|
89
|
+
width="variable"
|
|
90
|
+
/>
|
|
91
|
+
</Box>
|
|
92
|
+
<Box p={5}>
|
|
93
|
+
<Button
|
|
94
|
+
{...args}
|
|
95
|
+
text="Secondary Variable Flat"
|
|
96
|
+
variant="flat-secondary"
|
|
97
|
+
width="variable"
|
|
98
|
+
/>
|
|
99
|
+
</Box>
|
|
100
|
+
<Box p={5}>
|
|
101
|
+
<Button
|
|
102
|
+
{...args}
|
|
103
|
+
text="Tertiary Variable Flat"
|
|
104
|
+
variant="flat-tertiary"
|
|
105
|
+
width="variable"
|
|
106
|
+
/>
|
|
107
|
+
</Box>
|
|
108
|
+
<Box p={5}>
|
|
109
|
+
<Button
|
|
110
|
+
{...args}
|
|
111
|
+
text="Primary Fixed Flat"
|
|
112
|
+
variant="flat-primary"
|
|
113
|
+
width="fixed"
|
|
114
|
+
/>
|
|
115
|
+
</Box>
|
|
116
|
+
<Box p={5}>
|
|
117
|
+
<Button
|
|
118
|
+
{...args}
|
|
119
|
+
text="Secondary Fixed Flat"
|
|
120
|
+
variant="flat-secondary"
|
|
121
|
+
width="fixed"
|
|
122
|
+
/>
|
|
123
|
+
</Box>
|
|
124
|
+
<Box p={5}>
|
|
125
|
+
<Button
|
|
126
|
+
{...args}
|
|
127
|
+
text="Tertiary Fixed Flat"
|
|
128
|
+
variant="flat-tertiary"
|
|
129
|
+
width="fixed"
|
|
130
|
+
/>
|
|
131
|
+
</Box>
|
|
67
132
|
</Flex>
|
|
68
133
|
);
|
|
69
134
|
|
|
@@ -60,6 +60,7 @@ export function FormSection<
|
|
|
60
60
|
ariaLabel,
|
|
61
61
|
disabled,
|
|
62
62
|
defaultValue,
|
|
63
|
+
variant,
|
|
63
64
|
}: FormInput) => (
|
|
64
65
|
<Input<U>
|
|
65
66
|
key={name}
|
|
@@ -77,6 +78,7 @@ export function FormSection<
|
|
|
77
78
|
setValue={form.setValue}
|
|
78
79
|
setError={form.setError}
|
|
79
80
|
clearErrors={form.clearErrors}
|
|
81
|
+
variant={variant ? variant : ''}
|
|
80
82
|
/>
|
|
81
83
|
)
|
|
82
84
|
)}
|
|
@@ -5,6 +5,7 @@ import { Input, InputProps } from '.';
|
|
|
5
5
|
import { useFormHandler } from '../form/hooks/useFormHandler';
|
|
6
6
|
import * as Yup from 'yup';
|
|
7
7
|
import { Form } from '../form';
|
|
8
|
+
import { SelectNative } from '../select';
|
|
8
9
|
|
|
9
10
|
const meta: Meta<InputProps<StoryFormSchema>> = {
|
|
10
11
|
title: 'Input example',
|
|
@@ -108,9 +109,27 @@ const Template: Story<InputProps<StoryFormSchema>> = args => {
|
|
|
108
109
|
errorText={form.formState.errors['prop5']?.message}
|
|
109
110
|
name="prop5"
|
|
110
111
|
/>
|
|
112
|
+
<Input
|
|
113
|
+
{...args}
|
|
114
|
+
inputType="multi-select"
|
|
115
|
+
variant="mobile"
|
|
116
|
+
setValue={form.setValue}
|
|
117
|
+
setError={form.setError}
|
|
118
|
+
clearErrors={form.clearErrors}
|
|
119
|
+
isInvalid={!!form.formState.errors['prop5']?.message}
|
|
120
|
+
errorText={form.formState.errors['prop5']?.message}
|
|
121
|
+
name="prop5"
|
|
122
|
+
/>
|
|
123
|
+
<Input
|
|
124
|
+
{...args}
|
|
125
|
+
inputType="text"
|
|
126
|
+
name="prop3"
|
|
127
|
+
onChange={e => form.setValue('prop3', e.target.value)}
|
|
128
|
+
/>
|
|
111
129
|
<Input
|
|
112
130
|
{...args}
|
|
113
131
|
inputType="text"
|
|
132
|
+
variant="mobile"
|
|
114
133
|
name="prop3"
|
|
115
134
|
onChange={e => form.setValue('prop3', e.target.value)}
|
|
116
135
|
/>
|
|
@@ -120,9 +139,27 @@ const Template: Story<InputProps<StoryFormSchema>> = args => {
|
|
|
120
139
|
name="prop2"
|
|
121
140
|
onChange={e => form.setValue('prop2', e.target.value)}
|
|
122
141
|
/>
|
|
142
|
+
<Input
|
|
143
|
+
{...args}
|
|
144
|
+
inputType="textarea"
|
|
145
|
+
variant="mobile"
|
|
146
|
+
name="prop2"
|
|
147
|
+
onChange={e => form.setValue('prop2', e.target.value)}
|
|
148
|
+
/>
|
|
149
|
+
<Input
|
|
150
|
+
{...args}
|
|
151
|
+
name="prop"
|
|
152
|
+
inputType="pilled-text"
|
|
153
|
+
setValue={form.setValue}
|
|
154
|
+
setError={form.setError}
|
|
155
|
+
clearErrors={form.clearErrors}
|
|
156
|
+
isInvalid={!!form.formState.errors['prop']?.message}
|
|
157
|
+
errorText={form.formState.errors['prop']?.message}
|
|
158
|
+
/>
|
|
123
159
|
<Input
|
|
124
160
|
{...args}
|
|
125
161
|
name="prop"
|
|
162
|
+
variant="mobile"
|
|
126
163
|
inputType="pilled-text"
|
|
127
164
|
setValue={form.setValue}
|
|
128
165
|
setError={form.setError}
|
|
@@ -135,10 +172,32 @@ const Template: Story<InputProps<StoryFormSchema>> = args => {
|
|
|
135
172
|
inputType="select"
|
|
136
173
|
setValue={form.setValue}
|
|
137
174
|
name="prop4"
|
|
175
|
+
defaultValue={'value1'}
|
|
176
|
+
/>
|
|
177
|
+
<SelectNative
|
|
178
|
+
{...args}
|
|
179
|
+
setValue={form.setValue}
|
|
180
|
+
name="prop4"
|
|
181
|
+
setError={form.setError}
|
|
182
|
+
clearErrors={form.clearErrors}
|
|
183
|
+
isInvalid={!!form.formState.errors['prop']?.message}
|
|
184
|
+
errorText={form.formState.errors['prop']?.message}
|
|
185
|
+
disabled={false}
|
|
186
|
+
isRequired
|
|
187
|
+
control={form.control}
|
|
188
|
+
ariaLabel="expires in input"
|
|
189
|
+
defaultValue={'value1'}
|
|
190
|
+
/>
|
|
191
|
+
<Input
|
|
192
|
+
{...args}
|
|
193
|
+
name="prop6"
|
|
194
|
+
inputType="switch"
|
|
195
|
+
setValue={form.setValue}
|
|
138
196
|
/>
|
|
139
197
|
<Input
|
|
140
198
|
{...args}
|
|
141
199
|
name="prop6"
|
|
200
|
+
variant="mobile"
|
|
142
201
|
inputType="switch"
|
|
143
202
|
setValue={form.setValue}
|
|
144
203
|
/>
|
|
@@ -148,6 +207,13 @@ const Template: Story<InputProps<StoryFormSchema>> = args => {
|
|
|
148
207
|
inputType="checkbox"
|
|
149
208
|
setValue={form.setValue}
|
|
150
209
|
/>
|
|
210
|
+
<Input
|
|
211
|
+
{...args}
|
|
212
|
+
name="prop6"
|
|
213
|
+
inputType="checkbox"
|
|
214
|
+
variant="mobile"
|
|
215
|
+
setValue={form.setValue}
|
|
216
|
+
/>
|
|
151
217
|
</Form>
|
|
152
218
|
);
|
|
153
219
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Checkbox, Text } from '@chakra-ui/react';
|
|
3
|
-
import {
|
|
3
|
+
import { InputFieldProps } from '../InputTypes';
|
|
4
4
|
|
|
5
|
-
export interface StackedCheckboxProps extends
|
|
5
|
+
export interface StackedCheckboxProps extends InputFieldProps {
|
|
6
6
|
label: string;
|
|
7
|
+
variant: string;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -12,7 +13,7 @@ export interface StackedCheckboxProps extends SelectFieldProps {
|
|
|
12
13
|
const StackedCheckbox = React.forwardRef<
|
|
13
14
|
HTMLInputElement,
|
|
14
15
|
StackedCheckboxProps
|
|
15
|
-
>(({ value, label, onChange, disabled }, _ref) => {
|
|
16
|
+
>(({ value, label, onChange, disabled, variant }, _ref) => {
|
|
16
17
|
if (value === null) return null;
|
|
17
18
|
|
|
18
19
|
return (
|
|
@@ -25,10 +26,17 @@ const StackedCheckbox = React.forwardRef<
|
|
|
25
26
|
}}
|
|
26
27
|
isChecked={Boolean(value)}
|
|
27
28
|
disabled={disabled}
|
|
29
|
+
variant={variant}
|
|
28
30
|
>
|
|
29
|
-
|
|
31
|
+
{/* solved like this because of bug in chakra
|
|
32
|
+
https://github.com/chakra-ui/chakra-ui/issues/7328 */}
|
|
33
|
+
<Text
|
|
34
|
+
fontSize={variant === 'mobile' ? '17px' : '13px'}
|
|
35
|
+
alignSelf="center"
|
|
36
|
+
>
|
|
30
37
|
{label}
|
|
31
38
|
</Text>
|
|
39
|
+
{/* {label} */}
|
|
32
40
|
</Checkbox>
|
|
33
41
|
);
|
|
34
42
|
});
|
|
@@ -7,6 +7,7 @@ export interface StackedInputProps extends InputFieldProps {
|
|
|
7
7
|
allowDefault?: boolean;
|
|
8
8
|
leftElement?: React.ReactNode;
|
|
9
9
|
rightElement?: React.ReactNode;
|
|
10
|
+
variant?: string;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -21,6 +22,7 @@ const StackedInput = React.forwardRef<HTMLInputElement, StackedInputProps>(
|
|
|
21
22
|
leftElement,
|
|
22
23
|
defaultValue,
|
|
23
24
|
allowDefault,
|
|
25
|
+
variant,
|
|
24
26
|
...props
|
|
25
27
|
},
|
|
26
28
|
_ref
|
|
@@ -28,12 +30,15 @@ const StackedInput = React.forwardRef<HTMLInputElement, StackedInputProps>(
|
|
|
28
30
|
return (
|
|
29
31
|
<InputGroup>
|
|
30
32
|
{leftElement && leftElement}
|
|
33
|
+
{variant}
|
|
31
34
|
<Input
|
|
32
35
|
type={type}
|
|
33
36
|
isRequired={isRequired}
|
|
34
37
|
{...props}
|
|
35
38
|
ref={_ref}
|
|
36
39
|
defaultValue={defaultValue}
|
|
40
|
+
fontSize={variant === 'mobile' ? '17px' : '13px'}
|
|
41
|
+
variant={variant}
|
|
37
42
|
onKeyDown={e => {
|
|
38
43
|
if (e.key === 'Enter' && !allowDefault) {
|
|
39
44
|
e.stopPropagation();
|