@xqmsg/ui-core 0.10.0 → 0.12.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/button/index.d.ts +3 -7
- package/dist/components/input/Input.stories.d.ts +4 -0
- package/dist/components/table/TableTypes.d.ts +0 -1
- package/dist/components/table/{loading → components/loading}/index.d.ts +0 -0
- package/dist/components/table/components/text/index.d.ts +9 -0
- package/dist/components/table/index.d.ts +2 -4
- package/dist/theme/components/button.d.ts +68 -207
- package/dist/theme/components/table.d.ts +28 -0
- package/dist/theme/foundations/colors.d.ts +44 -22
- package/dist/ui-core.cjs.development.js +188 -390
- 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 +190 -392
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +1 -2
- package/src/components/banner/index.tsx +7 -1
- package/src/components/button/Button.stories.tsx +19 -7
- package/src/components/button/index.tsx +7 -19
- package/src/components/button/spinner/index.tsx +2 -7
- package/src/components/input/Input.stories.tsx +45 -59
- package/src/components/input/StackedMultiSelect/index.tsx +11 -11
- package/src/components/input/StackedPilledInput/index.tsx +6 -12
- package/src/components/input/components/dropdown/index.tsx +3 -2
- package/src/components/input/index.tsx +0 -1
- package/src/components/loading/index.tsx +1 -1
- package/src/components/table/Table.stories.tsx +5 -3
- package/src/components/table/TableTypes.ts +0 -20
- package/src/components/table/{loading → components/loading}/index.tsx +8 -5
- package/src/components/table/components/text/index.tsx +23 -0
- package/src/components/table/index.tsx +4 -10
- package/src/components/tabs/index.tsx +1 -1
- package/src/components/text/index.tsx +1 -1
- package/src/theme/components/alert.ts +2 -2
- package/src/theme/components/button.ts +45 -186
- package/src/theme/components/input.ts +1 -1
- package/src/theme/components/link.ts +2 -1
- package/src/theme/components/table.ts +34 -0
- package/src/theme/components/tabs.ts +3 -3
- package/src/theme/customXQChakraTheme.ts +2 -2
- package/src/theme/foundations/colors.ts +19 -14
- package/src/theme/foundations/shadows.ts +3 -3
- package/dist/theme/components/menu.d.ts +0 -48
- package/src/theme/components/menu.ts +0 -70
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.12.0",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -98,7 +98,6 @@
|
|
|
98
98
|
"@hookform/resolvers": "^2.9.7",
|
|
99
99
|
"axios": "^0.27.2",
|
|
100
100
|
"framer-motion": "6.3.0",
|
|
101
|
-
"ip-regex": "^5.0.0",
|
|
102
101
|
"react": "^18.0.0",
|
|
103
102
|
"react-dom": "^18.0.0",
|
|
104
103
|
"react-hook-form": "^7.34.0",
|
|
@@ -11,6 +11,7 @@ import ErrorIcon from './assets/svg/error.svg';
|
|
|
11
11
|
import PositiveIcon from './assets/svg/positive.svg';
|
|
12
12
|
import NeutralIcon from './assets/svg/neutral.svg';
|
|
13
13
|
import WarningIcon from './assets/svg/warning.svg';
|
|
14
|
+
import colors from 'src/theme/foundations/colors';
|
|
14
15
|
|
|
15
16
|
export type BannerVariant = 'positive' | 'warning' | 'error' | 'neutral';
|
|
16
17
|
|
|
@@ -52,7 +53,12 @@ export const Banner: React.FC<BannerProps> = ({
|
|
|
52
53
|
{message}
|
|
53
54
|
{onClick && buttonText && (
|
|
54
55
|
<Flex pt="8px" justifyContent="flex-end">
|
|
55
|
-
<Button
|
|
56
|
+
<Button
|
|
57
|
+
size="sm"
|
|
58
|
+
bg="white"
|
|
59
|
+
color={colors.fill.action}
|
|
60
|
+
onClick={onClick}
|
|
61
|
+
>
|
|
56
62
|
{buttonText}
|
|
57
63
|
</Button>
|
|
58
64
|
</Flex>
|
|
@@ -1,11 +1,17 @@
|
|
|
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
5
|
|
|
5
6
|
const meta: Meta<ButtonProps> = {
|
|
6
7
|
title: 'Button example',
|
|
7
8
|
component: Button,
|
|
8
9
|
argTypes: {
|
|
10
|
+
width: {
|
|
11
|
+
control: null,
|
|
12
|
+
description:
|
|
13
|
+
'`variable` adopts 100% of the width of the parent component, whereas `fixed` fits the label content to the button',
|
|
14
|
+
},
|
|
9
15
|
text: {
|
|
10
16
|
control: {
|
|
11
17
|
type: 'text',
|
|
@@ -24,23 +30,29 @@ const meta: Meta<ButtonProps> = {
|
|
|
24
30
|
control: 'boolean',
|
|
25
31
|
description: 'Disabled state of the button',
|
|
26
32
|
},
|
|
27
|
-
size: {
|
|
28
|
-
control: 'select',
|
|
29
|
-
options: ['xs', 'sm', 'md', 'lg'],
|
|
30
|
-
description: 'The chakra based size prop for the button',
|
|
31
|
-
},
|
|
32
33
|
},
|
|
33
34
|
parameters: {
|
|
34
35
|
controls: { expanded: true },
|
|
35
36
|
},
|
|
36
37
|
};
|
|
37
38
|
export default meta;
|
|
38
|
-
const Template: Story<ButtonProps> = args =>
|
|
39
|
+
const Template: Story<ButtonProps> = args => (
|
|
40
|
+
<Flex flexDir="column" height="200px" justifyContent="space-between">
|
|
41
|
+
<Button {...args} text="Solid Fixed" variant="solid" width="fixed" />
|
|
42
|
+
<Button {...args} text="Outline Fixed" variant="outline" width="fixed" />
|
|
43
|
+
<Button {...args} text="Solid Variable" variant="solid" width="variable" />
|
|
44
|
+
<Button
|
|
45
|
+
{...args}
|
|
46
|
+
text="Outline Variable"
|
|
47
|
+
variant="outline"
|
|
48
|
+
width="variable"
|
|
49
|
+
/>
|
|
50
|
+
</Flex>
|
|
51
|
+
);
|
|
39
52
|
|
|
40
53
|
export const Default = Template.bind({});
|
|
41
54
|
Default.args = {
|
|
42
55
|
onClick: () => alert('This is a button click!'),
|
|
43
|
-
text: 'Button',
|
|
44
56
|
type: 'button',
|
|
45
57
|
disabled: false,
|
|
46
58
|
};
|
|
@@ -1,52 +1,40 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Button as ChakraButton,
|
|
4
|
-
ButtonProps as ChakraButtonProps,
|
|
5
|
-
} from '@chakra-ui/react';
|
|
2
|
+
import { Button as ChakraButton } from '@chakra-ui/react';
|
|
6
3
|
import buttonTheme from '../../theme/components/button';
|
|
7
4
|
|
|
8
5
|
export interface ButtonProps {
|
|
9
6
|
text: string;
|
|
10
7
|
onClick?: () => void;
|
|
8
|
+
width: 'variable' | 'fixed';
|
|
11
9
|
variant?: keyof typeof buttonTheme.variants;
|
|
12
|
-
|
|
13
|
-
type: 'button' | 'submit' | 'reset' | undefined;
|
|
10
|
+
type?: 'button' | 'submit' | 'reset';
|
|
14
11
|
ariaLabel: string;
|
|
15
|
-
size?: 'sm' | 'md' | 'lg' | 'xs';
|
|
16
12
|
disabled?: boolean;
|
|
17
13
|
className?: string;
|
|
18
|
-
style?: React.CSSProperties;
|
|
19
|
-
width?: string | number;
|
|
20
14
|
}
|
|
21
15
|
|
|
22
16
|
/**
|
|
23
17
|
* A functional React component utilized to render the `Button` component
|
|
24
18
|
*/
|
|
25
|
-
export const Button: React.FC<ButtonProps
|
|
19
|
+
export const Button: React.FC<ButtonProps> = ({
|
|
26
20
|
onClick,
|
|
27
21
|
text,
|
|
28
|
-
type,
|
|
22
|
+
type = 'button',
|
|
29
23
|
ariaLabel,
|
|
30
24
|
variant = 'solid',
|
|
31
|
-
colorScheme = 'primary',
|
|
32
|
-
style,
|
|
33
|
-
size = 'md',
|
|
34
25
|
disabled,
|
|
35
26
|
className,
|
|
36
|
-
|
|
27
|
+
width,
|
|
37
28
|
}) => {
|
|
38
29
|
return (
|
|
39
30
|
<ChakraButton
|
|
40
31
|
onClick={onClick}
|
|
41
32
|
type={type}
|
|
42
33
|
variant={variant}
|
|
43
|
-
colorScheme={colorScheme}
|
|
44
|
-
size={size}
|
|
45
34
|
disabled={disabled}
|
|
46
35
|
aria-label={ariaLabel}
|
|
47
|
-
style={style}
|
|
48
36
|
className={className}
|
|
49
|
-
{
|
|
37
|
+
width={width === 'variable' ? '100%' : 'fit-content'}
|
|
50
38
|
>
|
|
51
39
|
{text}
|
|
52
40
|
</ChakraButton>
|
|
@@ -15,25 +15,20 @@ export const SpinnerButton: React.FC<SpinnerButtonProps> = ({
|
|
|
15
15
|
onClick,
|
|
16
16
|
type,
|
|
17
17
|
ariaLabel,
|
|
18
|
-
style,
|
|
19
18
|
variant = 'solid',
|
|
20
|
-
|
|
21
|
-
size = 'md',
|
|
19
|
+
|
|
22
20
|
disabled,
|
|
23
21
|
className,
|
|
24
22
|
}) => {
|
|
25
23
|
return (
|
|
26
24
|
<Button
|
|
27
|
-
spinner={<Spinner size={
|
|
25
|
+
spinner={<Spinner size={'md'} />}
|
|
28
26
|
isLoading={isLoading}
|
|
29
27
|
onClick={onClick}
|
|
30
28
|
type={type}
|
|
31
29
|
variant={variant}
|
|
32
|
-
colorScheme={colorScheme}
|
|
33
|
-
size={size}
|
|
34
30
|
disabled={disabled}
|
|
35
31
|
aria-label={ariaLabel}
|
|
36
|
-
style={style}
|
|
37
32
|
className={className}
|
|
38
33
|
>
|
|
39
34
|
{text}
|
|
@@ -5,9 +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
|
|
9
|
-
import { useEffect, useMemo } from '@storybook/addons';
|
|
10
|
-
import { Box } from '@chakra-ui/react';
|
|
8
|
+
import { useMemo } from '@storybook/addons';
|
|
11
9
|
|
|
12
10
|
const meta: Meta<InputProps<StoryFormSchema>> = {
|
|
13
11
|
title: 'Input example',
|
|
@@ -20,17 +18,6 @@ const meta: Meta<InputProps<StoryFormSchema>> = {
|
|
|
20
18
|
description: 'The label for the input',
|
|
21
19
|
},
|
|
22
20
|
inputType: {
|
|
23
|
-
control: 'select',
|
|
24
|
-
options: [
|
|
25
|
-
'text',
|
|
26
|
-
'textarea',
|
|
27
|
-
'radio',
|
|
28
|
-
'select',
|
|
29
|
-
'checkbox',
|
|
30
|
-
'multi-select',
|
|
31
|
-
'pilled-text',
|
|
32
|
-
'switch',
|
|
33
|
-
],
|
|
34
21
|
description: 'The type of the input',
|
|
35
22
|
},
|
|
36
23
|
options: {
|
|
@@ -71,51 +58,32 @@ const meta: Meta<InputProps<StoryFormSchema>> = {
|
|
|
71
58
|
|
|
72
59
|
interface StoryFormSchema {
|
|
73
60
|
prop?: string;
|
|
61
|
+
prop2?: string;
|
|
62
|
+
prop3?: string;
|
|
63
|
+
prop4?: string;
|
|
64
|
+
prop5?: string;
|
|
74
65
|
}
|
|
75
66
|
|
|
76
67
|
const onStubbedSubmit = () => null;
|
|
77
68
|
|
|
78
69
|
const storyFormDefaultValues: StoryFormSchema = {
|
|
79
70
|
prop: '',
|
|
71
|
+
prop2: '',
|
|
72
|
+
prop3: '',
|
|
73
|
+
prop4: '',
|
|
74
|
+
prop5: '',
|
|
80
75
|
};
|
|
81
76
|
|
|
82
77
|
const storyFormSchema: Yup.SchemaOf<StoryFormSchema> = Yup.object().shape({
|
|
83
|
-
prop: Yup.string()
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const ipStringsToArray = value.split(',');
|
|
89
|
-
const isIPValidArray = ipStringsToArray.map((ip) => {
|
|
90
|
-
return ipRegex({ exact: true }).test(ip as string);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
if (isIPValidArray && isIPValidArray.includes(false)) {
|
|
94
|
-
const malformedIPList = isIPValidArray
|
|
95
|
-
// eslint-disable-next-line
|
|
96
|
-
.map((testedIP, i) => {
|
|
97
|
-
if (testedIP === false) {
|
|
98
|
-
const malformedIP = ipStringsToArray[i];
|
|
99
|
-
|
|
100
|
-
return malformedIP.trim();
|
|
101
|
-
}
|
|
102
|
-
})
|
|
103
|
-
.filter((invalidIP) => invalidIP !== undefined);
|
|
104
|
-
|
|
105
|
-
const errorMessage = `Malformed IPs: ${malformedIPList.join(', ')}`;
|
|
106
|
-
return testContext.createError({
|
|
107
|
-
message:
|
|
108
|
-
errorMessage.length <= 45 ? errorMessage : `${errorMessage}...`,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return true;
|
|
113
|
-
}
|
|
114
|
-
),
|
|
78
|
+
prop: Yup.string(),
|
|
79
|
+
prop2: Yup.string(),
|
|
80
|
+
prop3: Yup.string(),
|
|
81
|
+
prop4: Yup.string(),
|
|
82
|
+
prop5: Yup.string(),
|
|
115
83
|
});
|
|
116
84
|
|
|
117
85
|
export default meta;
|
|
118
|
-
const Template: Story<InputProps<StoryFormSchema>> =
|
|
86
|
+
const Template: Story<InputProps<StoryFormSchema>> = args => {
|
|
119
87
|
const formHandler = useFormHandler<StoryFormSchema>(
|
|
120
88
|
onStubbedSubmit,
|
|
121
89
|
storyFormDefaultValues,
|
|
@@ -126,19 +94,38 @@ const Template: Story<InputProps<StoryFormSchema>> = (args) => {
|
|
|
126
94
|
|
|
127
95
|
const { form } = formHandler;
|
|
128
96
|
|
|
129
|
-
const valueErrorMessage = useMemo(() => {
|
|
130
|
-
if (form.formState.errors) return form.formState.errors.prop?.message;
|
|
131
|
-
}, [form.formState.errors]);
|
|
132
|
-
|
|
133
|
-
useEffect(() => {
|
|
134
|
-
form.resetField('prop');
|
|
135
|
-
}, [args.inputType, form]);
|
|
136
|
-
|
|
137
97
|
return (
|
|
138
98
|
<Form formHandler={formHandler}>
|
|
139
|
-
<Input
|
|
140
|
-
|
|
141
|
-
|
|
99
|
+
<Input
|
|
100
|
+
{...args}
|
|
101
|
+
inputType="multi-select"
|
|
102
|
+
setValue={form.setValue}
|
|
103
|
+
name="prop5"
|
|
104
|
+
/>
|
|
105
|
+
<Input
|
|
106
|
+
{...args}
|
|
107
|
+
inputType="select"
|
|
108
|
+
setValue={form.setValue}
|
|
109
|
+
name="prop4"
|
|
110
|
+
/>
|
|
111
|
+
<Input
|
|
112
|
+
{...args}
|
|
113
|
+
inputType="text"
|
|
114
|
+
name="prop3"
|
|
115
|
+
onChange={e => form.setValue('prop3', e.target.value)}
|
|
116
|
+
/>
|
|
117
|
+
<Input
|
|
118
|
+
{...args}
|
|
119
|
+
inputType="textarea"
|
|
120
|
+
name="prop2"
|
|
121
|
+
onChange={e => form.setValue('prop2', e.target.value)}
|
|
122
|
+
/>
|
|
123
|
+
<Input
|
|
124
|
+
{...args}
|
|
125
|
+
name="prop"
|
|
126
|
+
inputType="pilled-text"
|
|
127
|
+
setValue={form.setValue}
|
|
128
|
+
/>
|
|
142
129
|
</Form>
|
|
143
130
|
);
|
|
144
131
|
};
|
|
@@ -147,7 +134,6 @@ export const Default = Template.bind({});
|
|
|
147
134
|
Default.args = {
|
|
148
135
|
label: 'Input Label',
|
|
149
136
|
inputType: 'text',
|
|
150
|
-
name: 'prop',
|
|
151
137
|
options: [
|
|
152
138
|
{ value: 'section_header', label: 'Section 1', sortValue: 0 },
|
|
153
139
|
{
|
|
@@ -50,7 +50,7 @@ const StackedMultiSelect = React.forwardRef<
|
|
|
50
50
|
.split(',')
|
|
51
51
|
.filter(Boolean)
|
|
52
52
|
.map((value: string) =>
|
|
53
|
-
options.find(
|
|
53
|
+
options.find(option => option.value === value)
|
|
54
54
|
)
|
|
55
55
|
);
|
|
56
56
|
}
|
|
@@ -66,16 +66,16 @@ const StackedMultiSelect = React.forwardRef<
|
|
|
66
66
|
shouldDirty: true,
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
-
setLocalOptions(
|
|
70
|
-
prevLocalOptions.filter(
|
|
69
|
+
setLocalOptions(prevLocalOptions =>
|
|
70
|
+
prevLocalOptions.filter(prevLocalOption => prevLocalOption !== option)
|
|
71
71
|
);
|
|
72
72
|
|
|
73
|
-
setLocalValues(
|
|
73
|
+
setLocalValues(prevLocalValues => [...prevLocalValues, option]);
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
const handleDelete = (option: FieldOption) => {
|
|
77
77
|
const newValue = localValues
|
|
78
|
-
.filter(
|
|
78
|
+
.filter(localValue => localValue !== option)
|
|
79
79
|
.map(({ value }) => value)
|
|
80
80
|
.join(',');
|
|
81
81
|
|
|
@@ -84,12 +84,12 @@ const StackedMultiSelect = React.forwardRef<
|
|
|
84
84
|
shouldDirty: true,
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
-
setLocalOptions(
|
|
87
|
+
setLocalOptions(prevLocalOptions =>
|
|
88
88
|
[...prevLocalOptions, option].sort((a, b) => a.sortValue - b.sortValue)
|
|
89
89
|
);
|
|
90
90
|
|
|
91
|
-
setLocalValues(
|
|
92
|
-
prevLocalValues.filter(
|
|
91
|
+
setLocalValues(prevLocalValues =>
|
|
92
|
+
prevLocalValues.filter(prevLocalValue => prevLocalValue !== option)
|
|
93
93
|
);
|
|
94
94
|
};
|
|
95
95
|
|
|
@@ -105,12 +105,12 @@ const StackedMultiSelect = React.forwardRef<
|
|
|
105
105
|
alignItems="center"
|
|
106
106
|
justifyContent="space-between"
|
|
107
107
|
onClick={() => !disabled && setIsFocussed(true)}
|
|
108
|
-
bg={disabled ? colors.fill.light : '#ffffff'}
|
|
108
|
+
bg={disabled ? colors.fill.light.quaternary : '#ffffff'}
|
|
109
109
|
cursor={disabled ? 'not-allowed' : 'pointer'}
|
|
110
110
|
>
|
|
111
111
|
<Flex height="28px" alignItems="center">
|
|
112
112
|
{localValues.length ? (
|
|
113
|
-
localValues.map(
|
|
113
|
+
localValues.map(option => (
|
|
114
114
|
<Box mr="4px">
|
|
115
115
|
<Token
|
|
116
116
|
label={option.label}
|
|
@@ -130,7 +130,7 @@ const StackedMultiSelect = React.forwardRef<
|
|
|
130
130
|
</Flex>
|
|
131
131
|
{isFocussed && (
|
|
132
132
|
<Dropdown
|
|
133
|
-
onSelectItem={
|
|
133
|
+
onSelectItem={option => handleChange(option)}
|
|
134
134
|
options={localOptions}
|
|
135
135
|
/>
|
|
136
136
|
)}
|
|
@@ -58,7 +58,7 @@ const StackedPilledInput = React.forwardRef<
|
|
|
58
58
|
const filteredUniqueValues = Array.from(
|
|
59
59
|
new Set(
|
|
60
60
|
lastestFormValueToArray.filter(
|
|
61
|
-
|
|
61
|
+
value => value !== lastestFormValueToArray[tokenIndex]
|
|
62
62
|
)
|
|
63
63
|
)
|
|
64
64
|
);
|
|
@@ -103,7 +103,7 @@ const StackedPilledInput = React.forwardRef<
|
|
|
103
103
|
const filteredUniqueValues = Array.from(
|
|
104
104
|
new Set(
|
|
105
105
|
[...lastestFormValueToArray].filter(
|
|
106
|
-
|
|
106
|
+
value => value !== lastestFormValueToArray[tokenIndex]
|
|
107
107
|
)
|
|
108
108
|
)
|
|
109
109
|
);
|
|
@@ -127,9 +127,7 @@ const StackedPilledInput = React.forwardRef<
|
|
|
127
127
|
return setTokenIndex(lastestFormValueToArray.length - 1);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
return setTokenIndex(
|
|
131
|
-
(prevTokenIndex) => (prevTokenIndex as number) - 1
|
|
132
|
-
);
|
|
130
|
+
return setTokenIndex(prevTokenIndex => (prevTokenIndex as number) - 1);
|
|
133
131
|
}
|
|
134
132
|
|
|
135
133
|
if (e.key === 'ArrowRight') {
|
|
@@ -138,9 +136,7 @@ const StackedPilledInput = React.forwardRef<
|
|
|
138
136
|
if (tokenIndex === lastestFormValueToArray.length - 1) {
|
|
139
137
|
return setTokenIndex(null);
|
|
140
138
|
}
|
|
141
|
-
return setTokenIndex(
|
|
142
|
-
(prevTokenIndex) => (prevTokenIndex as number) + 1
|
|
143
|
-
);
|
|
139
|
+
return setTokenIndex(prevTokenIndex => (prevTokenIndex as number) + 1);
|
|
144
140
|
}
|
|
145
141
|
}
|
|
146
142
|
};
|
|
@@ -199,7 +195,7 @@ const StackedPilledInput = React.forwardRef<
|
|
|
199
195
|
inputRef.current?.focus();
|
|
200
196
|
}
|
|
201
197
|
}}
|
|
202
|
-
bg={disabled ? colors.fill.light : '#ffffff'}
|
|
198
|
+
bg={disabled ? colors.fill.light.quaternary : '#ffffff'}
|
|
203
199
|
cursor={disabled ? 'not-allowed' : 'pointer'}
|
|
204
200
|
ref={inputWrapperRef}
|
|
205
201
|
>
|
|
@@ -243,9 +239,7 @@ const StackedPilledInput = React.forwardRef<
|
|
|
243
239
|
color={tokenIndex !== null ? 'transparent' : colors.label.primary}
|
|
244
240
|
_focus={{ boxShadow: 'none !important' }}
|
|
245
241
|
value={localValue}
|
|
246
|
-
onChange={(e)
|
|
247
|
-
tokenIndex === null && setLocalValue(e.target.value)
|
|
248
|
-
}
|
|
242
|
+
onChange={e => tokenIndex === null && setLocalValue(e.target.value)}
|
|
249
243
|
ref={inputRef}
|
|
250
244
|
onFocus={() => setIsFocussed(true)}
|
|
251
245
|
/>
|
|
@@ -49,7 +49,7 @@ export const Dropdown: React.FC<DropdownProps> = ({
|
|
|
49
49
|
color={colors.label.primary.light}
|
|
50
50
|
_hover={{
|
|
51
51
|
color: colors.label.primary.dark,
|
|
52
|
-
bg: colors.fill.
|
|
52
|
+
bg: colors.fill.action,
|
|
53
53
|
borderRadius: '4px',
|
|
54
54
|
}}
|
|
55
55
|
>
|
|
@@ -62,7 +62,7 @@ export const Dropdown: React.FC<DropdownProps> = ({
|
|
|
62
62
|
|
|
63
63
|
return (
|
|
64
64
|
<Box
|
|
65
|
-
bg={colors.fill.light}
|
|
65
|
+
bg={colors.fill.light.quaternary}
|
|
66
66
|
backdropFilter="blur(64px)"
|
|
67
67
|
borderRadius="4px"
|
|
68
68
|
mt="3px"
|
|
@@ -72,6 +72,7 @@ export const Dropdown: React.FC<DropdownProps> = ({
|
|
|
72
72
|
py="4px"
|
|
73
73
|
position="absolute"
|
|
74
74
|
width="100%"
|
|
75
|
+
zIndex="100"
|
|
75
76
|
>
|
|
76
77
|
{DropdownContent}
|
|
77
78
|
</Box>
|
|
@@ -4,6 +4,7 @@ import { Text } from '../text';
|
|
|
4
4
|
import { Table, TableProps } from '.';
|
|
5
5
|
import { TableBody, TableHeaders } from './TableTypes';
|
|
6
6
|
import { useArgs } from '@storybook/addons';
|
|
7
|
+
import { TableText } from './components/text';
|
|
7
8
|
|
|
8
9
|
const tableColumns = ['foo', 'bar'];
|
|
9
10
|
|
|
@@ -13,7 +14,10 @@ const tableHeaders: TableHeaders<typeof tableColumns> = {
|
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
const tableBody: TableBody<typeof tableColumns> = [
|
|
16
|
-
{
|
|
17
|
+
{
|
|
18
|
+
foo: <TableText primaryText="hee" secondaryText="hi" />,
|
|
19
|
+
bar: 'hey',
|
|
20
|
+
},
|
|
17
21
|
{ foo: 'hi', bar: 'hey' },
|
|
18
22
|
{ foo: 'hi', bar: 'hey' },
|
|
19
23
|
];
|
|
@@ -68,6 +72,4 @@ Default.args = {
|
|
|
68
72
|
headers: tableHeaders,
|
|
69
73
|
columns: tableColumns,
|
|
70
74
|
loading: false,
|
|
71
|
-
variant: 'simple',
|
|
72
|
-
colorScheme: 'messenger',
|
|
73
75
|
};
|
|
@@ -13,23 +13,3 @@ export type TableRow<K extends ReadonlyTableColumns> = {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export type TableBody<R extends ReadonlyTableColumns> = TableRow<R>[];
|
|
16
|
-
|
|
17
|
-
export type TableColorScheme =
|
|
18
|
-
| 'blue'
|
|
19
|
-
| 'cyan'
|
|
20
|
-
| 'gray'
|
|
21
|
-
| 'green'
|
|
22
|
-
| 'orange'
|
|
23
|
-
| 'pink'
|
|
24
|
-
| 'purple'
|
|
25
|
-
| 'red'
|
|
26
|
-
| 'teal'
|
|
27
|
-
| 'yellow'
|
|
28
|
-
| 'whiteAlpha'
|
|
29
|
-
| 'blackAlpha'
|
|
30
|
-
| 'linkedin'
|
|
31
|
-
| 'facebook'
|
|
32
|
-
| 'messenger'
|
|
33
|
-
| 'whatsapp'
|
|
34
|
-
| 'twitter'
|
|
35
|
-
| 'telegram';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Flex, IconButton, Spinner } from '@chakra-ui/react';
|
|
3
3
|
import { HiOutlineRefresh } from 'react-icons/hi';
|
|
4
|
-
import colors from '
|
|
5
|
-
import typography from '
|
|
4
|
+
import colors from '../../../../theme/foundations/colors';
|
|
5
|
+
import typography from '../../../../theme/foundations/typography';
|
|
6
6
|
|
|
7
7
|
interface TableLoadingRowsProps {
|
|
8
8
|
isLoading: boolean;
|
|
@@ -23,17 +23,20 @@ export const TableLoadingRows: React.FC<TableLoadingRowsProps> = ({
|
|
|
23
23
|
justifyContent="center"
|
|
24
24
|
alignItems="center"
|
|
25
25
|
height={20}
|
|
26
|
-
borderTopColor={colors.
|
|
26
|
+
borderTopColor={colors.fill.light.quaternary}
|
|
27
27
|
>
|
|
28
28
|
{isLoading ? (
|
|
29
|
-
<Spinner size="lg" color={colors.
|
|
29
|
+
<Spinner size="lg" color={colors.fill.action} />
|
|
30
30
|
) : (
|
|
31
31
|
<IconButton
|
|
32
32
|
aria-label="Fetch more rows"
|
|
33
33
|
icon={<HiOutlineRefresh />}
|
|
34
34
|
fontSize={typography.fontSizes['3xl']}
|
|
35
|
+
bg="transparent"
|
|
36
|
+
shadow="none"
|
|
37
|
+
color={colors.fill.action}
|
|
35
38
|
type="button"
|
|
36
|
-
variant="
|
|
39
|
+
variant="outline"
|
|
37
40
|
onClick={onLoadMore}
|
|
38
41
|
/>
|
|
39
42
|
)}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Text } from '@chakra-ui/react';
|
|
3
|
+
import colors from 'src/theme/foundations/colors';
|
|
4
|
+
|
|
5
|
+
export interface TableTextProps {
|
|
6
|
+
primaryText: string;
|
|
7
|
+
secondaryText?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A functional React component utilized to render the `TableText` component
|
|
12
|
+
*/
|
|
13
|
+
export const TableText: React.FC<TableTextProps> = ({
|
|
14
|
+
primaryText,
|
|
15
|
+
secondaryText,
|
|
16
|
+
}) => {
|
|
17
|
+
return (
|
|
18
|
+
<Box>
|
|
19
|
+
<Text color={colors.label.primary.light}>{primaryText}</Text>
|
|
20
|
+
<Text color={colors.label.secondary.light}>{secondaryText}</Text>
|
|
21
|
+
</Box>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
ReadonlyTableColumns,
|
|
4
4
|
TableBody,
|
|
5
|
-
TableColorScheme,
|
|
6
5
|
TableColumns,
|
|
7
6
|
TableHeaders,
|
|
8
7
|
} from './TableTypes';
|
|
@@ -18,16 +17,13 @@ import {
|
|
|
18
17
|
Thead,
|
|
19
18
|
Tr,
|
|
20
19
|
} from '@chakra-ui/react';
|
|
21
|
-
import { TableLoadingRows } from './loading';
|
|
22
|
-
import colors from '../../theme/foundations/colors';
|
|
20
|
+
import { TableLoadingRows } from './components/loading';
|
|
23
21
|
|
|
24
22
|
export interface TableProps<T extends ReadonlyTableColumns> {
|
|
25
23
|
columns: TableColumns;
|
|
26
24
|
headers: TableHeaders<T>;
|
|
27
25
|
body: TableBody<T>;
|
|
28
26
|
loading?: boolean;
|
|
29
|
-
variant: 'simple' | 'striped' | 'unstyled';
|
|
30
|
-
colorScheme?: TableColorScheme;
|
|
31
27
|
borderTopRadius?: boolean;
|
|
32
28
|
loadMore?: () => void;
|
|
33
29
|
placeholder?: string;
|
|
@@ -42,8 +38,7 @@ export function Table<T extends ReadonlyTableColumns>({
|
|
|
42
38
|
body,
|
|
43
39
|
placeholder = 'There is currently no available data',
|
|
44
40
|
loading,
|
|
45
|
-
|
|
46
|
-
colorScheme,
|
|
41
|
+
|
|
47
42
|
borderTopRadius = true,
|
|
48
43
|
loadMore,
|
|
49
44
|
}: TableProps<T>) {
|
|
@@ -51,15 +46,14 @@ export function Table<T extends ReadonlyTableColumns>({
|
|
|
51
46
|
|
|
52
47
|
return (
|
|
53
48
|
<TableContainer
|
|
54
|
-
border="
|
|
55
|
-
borderColor={colors.gray[100]}
|
|
49
|
+
border="none"
|
|
56
50
|
overflowX="auto"
|
|
57
51
|
bg="white"
|
|
58
52
|
borderRadius="md"
|
|
59
53
|
borderTopLeftRadius={borderTopRadius ? 'md' : 0}
|
|
60
54
|
borderTopRightRadius={borderTopRadius ? 'md' : 0}
|
|
61
55
|
>
|
|
62
|
-
<ChakraTable variant=
|
|
56
|
+
<ChakraTable variant="unstyled">
|
|
63
57
|
<Thead>
|
|
64
58
|
<Tr>
|
|
65
59
|
{columnsAsConst.map(column => (
|
|
@@ -22,7 +22,7 @@ export const TabsWrapper: React.FC<TabsWrapperProps> = ({
|
|
|
22
22
|
<TabList
|
|
23
23
|
flexDirection={{ base: 'column', sm: 'row' }}
|
|
24
24
|
border="1px"
|
|
25
|
-
borderColor={colors.
|
|
25
|
+
borderColor={colors.fill.light.quaternary}
|
|
26
26
|
bg="white"
|
|
27
27
|
borderRadius="md"
|
|
28
28
|
borderBottom={0}
|