@xqmsg/ui-core 0.24.10 → 0.24.11
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 -2
- package/dist/components/input/InputTypes.d.ts +0 -1
- package/dist/components/input/StackedMultiSelect/index.d.ts +2 -2
- package/dist/components/input/StackedRadio/StackedRadioGroup.d.ts +2 -2
- package/dist/components/input/StackedSelect/index.d.ts +3 -3
- package/dist/components/input/components/dropdown/index.d.ts +2 -2
- package/dist/components/input/index.d.ts +3 -3
- package/dist/components/select/index.d.ts +3 -3
- package/dist/components/toolbar/components/actions/sort/index.d.ts +2 -2
- package/dist/components/toolbar/components/dropdown/index.d.ts +2 -2
- package/dist/theme/components/menu.d.ts +55 -0
- package/dist/ui-core.cjs.development.js +92 -24
- 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 +92 -24
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/form/FormTypes.ts +2 -2
- package/src/components/input/InputTypes.ts +0 -2
- package/src/components/input/StackedMultiSelect/index.tsx +5 -9
- package/src/components/input/StackedRadio/StackedRadioGroup.tsx +2 -3
- package/src/components/input/StackedSelect/index.tsx +4 -4
- package/src/components/input/components/dropdown/index.tsx +2 -2
- package/src/components/input/index.tsx +6 -6
- package/src/components/select/index.tsx +3 -3
- package/src/components/toolbar/components/actions/sort/index.tsx +2 -2
- package/src/components/toolbar/components/dropdown/index.tsx +2 -2
- package/src/theme/components/menu.ts +78 -0
- package/src/theme/customXQChakraTheme.ts +2 -0
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FieldOption, InputType } from '../input/InputTypes';
|
|
2
2
|
|
|
3
3
|
export interface FormInput {
|
|
4
4
|
label: string;
|
|
5
5
|
name: string;
|
|
6
6
|
ariaLabel: string;
|
|
7
7
|
inputType: InputType;
|
|
8
|
-
options?:
|
|
8
|
+
options?: FieldOption[];
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
isRequired: boolean;
|
|
11
11
|
maxLength?: number;
|
|
@@ -5,11 +5,7 @@ import React, {
|
|
|
5
5
|
useState,
|
|
6
6
|
} from 'react';
|
|
7
7
|
import { Box, Flex, Text, Input } from '@chakra-ui/react';
|
|
8
|
-
import {
|
|
9
|
-
FieldOption,
|
|
10
|
-
FieldOptions,
|
|
11
|
-
ReactSelectFieldProps,
|
|
12
|
-
} from '../InputTypes';
|
|
8
|
+
import { FieldOption, ReactSelectFieldProps } from '../InputTypes';
|
|
13
9
|
import colors from '../../../theme/foundations/colors';
|
|
14
10
|
import {
|
|
15
11
|
Control,
|
|
@@ -25,7 +21,7 @@ import Token from '../components/token';
|
|
|
25
21
|
import { useOnClickOutside } from '../../../hooks/useOnOutsideClick';
|
|
26
22
|
|
|
27
23
|
export interface StackedMultiSelectProps extends ReactSelectFieldProps {
|
|
28
|
-
options:
|
|
24
|
+
options: FieldOption[];
|
|
29
25
|
setValue: UseFormSetValue<FieldValues>;
|
|
30
26
|
setError: UseFormSetError<FieldValues>;
|
|
31
27
|
clearErrors: UseFormClearErrors<FieldValues>;
|
|
@@ -51,9 +47,9 @@ const StackedMultiSelect = React.forwardRef<
|
|
|
51
47
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
52
48
|
|
|
53
49
|
const [isInit, setIsInit] = useState(false);
|
|
54
|
-
const [localValues, setLocalValues] = useState<
|
|
55
|
-
const [localOptions, setLocalOptions] = useState<
|
|
56
|
-
const [filteredOptions, setFilteredOptions] = useState<
|
|
50
|
+
const [localValues, setLocalValues] = useState<FieldOption[]>([]);
|
|
51
|
+
const [localOptions, setLocalOptions] = useState<FieldOption[]>(options);
|
|
52
|
+
const [filteredOptions, setFilteredOptions] = useState<FieldOption[]>(
|
|
57
53
|
localOptions
|
|
58
54
|
);
|
|
59
55
|
const [isFocussed, setIsFocussed] = useState(false);
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Flex, InputGroup, Radio, RadioGroup } from '@chakra-ui/react';
|
|
3
|
-
import {
|
|
3
|
+
import { FieldOption, SelectFieldProps } from '../InputTypes';
|
|
4
4
|
|
|
5
5
|
export interface StackedRadioGroupProps extends SelectFieldProps {
|
|
6
6
|
flexDirection?: 'row' | 'column';
|
|
7
|
-
|
|
8
|
-
options: FieldOptions;
|
|
7
|
+
options: FieldOption[];
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -5,7 +5,7 @@ import React, {
|
|
|
5
5
|
useState,
|
|
6
6
|
} from 'react';
|
|
7
7
|
import { Box, Input, InputGroup, InputRightElement } from '@chakra-ui/react';
|
|
8
|
-
import {
|
|
8
|
+
import { FieldOption } from '../InputTypes';
|
|
9
9
|
import { StackedInputProps } from '../StackedInput/StackedInput';
|
|
10
10
|
import { UseFormSetValue, FieldValues, Control } from 'react-hook-form';
|
|
11
11
|
import { Dropdown } from '../components/dropdown';
|
|
@@ -13,8 +13,8 @@ import { useOnClickOutside } from '../../../hooks/useOnOutsideClick';
|
|
|
13
13
|
import { Dropdown as DropdownIcon } from '../../icons/dropdown';
|
|
14
14
|
|
|
15
15
|
export interface StackedSelectProps extends StackedInputProps {
|
|
16
|
-
options:
|
|
17
|
-
fullOptions?:
|
|
16
|
+
options: FieldOption[];
|
|
17
|
+
fullOptions?: FieldOption[];
|
|
18
18
|
setValue: UseFormSetValue<FieldValues>;
|
|
19
19
|
control: Control<FieldValues, any>;
|
|
20
20
|
handleOnChange: (value?: string) => void;
|
|
@@ -52,7 +52,7 @@ const StackedSelect = React.forwardRef<HTMLInputElement, StackedSelectProps>(
|
|
|
52
52
|
const [optionIndex, setOptionIndex] = useState<number | null>(null);
|
|
53
53
|
const [position, setPosition] = useState<'top' | 'bottom'>('top');
|
|
54
54
|
const [searchValue, setSearchValue] = useState('');
|
|
55
|
-
const [filteredOptions, setFilteredOptions] = useState<
|
|
55
|
+
const [filteredOptions, setFilteredOptions] = useState<FieldOption[]>(
|
|
56
56
|
options
|
|
57
57
|
);
|
|
58
58
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { RefObject, useMemo } from 'react';
|
|
2
2
|
import { Box, Flex, Spinner } from '@chakra-ui/react';
|
|
3
3
|
import colors from '../../../../../src/theme/foundations/colors';
|
|
4
|
-
import { FieldOption
|
|
4
|
+
import { FieldOption } from '../../InputTypes';
|
|
5
5
|
|
|
6
6
|
export interface DropdownProps {
|
|
7
7
|
onSelectItem: (option: FieldOption) => void;
|
|
8
|
-
options:
|
|
8
|
+
options: FieldOption[];
|
|
9
9
|
dropdownRef: RefObject<HTMLDivElement>;
|
|
10
10
|
position: 'top' | 'bottom';
|
|
11
11
|
optionIndex?: number | null;
|
|
@@ -4,7 +4,7 @@ import StackedInput from './StackedInput/StackedInput';
|
|
|
4
4
|
import StackedRadioGroup from './StackedRadio/StackedRadioGroup';
|
|
5
5
|
import StackedSelect from './StackedSelect';
|
|
6
6
|
import StackedTextarea from './StackedTextarea/StackedTextarea';
|
|
7
|
-
import {
|
|
7
|
+
import { FieldOption, ValidationProps, InputType } from './InputTypes';
|
|
8
8
|
import {
|
|
9
9
|
FormControl,
|
|
10
10
|
FormErrorMessage,
|
|
@@ -35,8 +35,8 @@ export interface InputProps<T extends FieldValues = FieldValues>
|
|
|
35
35
|
defaultValue?: string;
|
|
36
36
|
label?: string;
|
|
37
37
|
className?: string;
|
|
38
|
-
options?:
|
|
39
|
-
fullOptions?:
|
|
38
|
+
options?: FieldOption[];
|
|
39
|
+
fullOptions?: FieldOption[];
|
|
40
40
|
maxLength?: number;
|
|
41
41
|
helperText?: React.ReactNode;
|
|
42
42
|
control: Control<T, any>;
|
|
@@ -126,7 +126,7 @@ export function Input<T extends FieldValues>({
|
|
|
126
126
|
name={name}
|
|
127
127
|
id={name}
|
|
128
128
|
isInvalid={isInvalid}
|
|
129
|
-
options={options as
|
|
129
|
+
options={options as FieldOption[]}
|
|
130
130
|
onChange={onChange as (e: ChangeEvent) => void}
|
|
131
131
|
onBlur={onBlur}
|
|
132
132
|
ref={ref}
|
|
@@ -142,7 +142,7 @@ export function Input<T extends FieldValues>({
|
|
|
142
142
|
id={name}
|
|
143
143
|
isRequired={isRequired}
|
|
144
144
|
isInvalid={isInvalid}
|
|
145
|
-
options={options as
|
|
145
|
+
options={options as FieldOption[]}
|
|
146
146
|
handleOnChange={onChange as (v?: string) => void}
|
|
147
147
|
onBlur={onBlur}
|
|
148
148
|
setValue={setValue as UseFormSetValue<FieldValues>}
|
|
@@ -201,7 +201,7 @@ export function Input<T extends FieldValues>({
|
|
|
201
201
|
name={name}
|
|
202
202
|
id={name}
|
|
203
203
|
isInvalid={isInvalid}
|
|
204
|
-
options={options as
|
|
204
|
+
options={options as FieldOption[]}
|
|
205
205
|
onChange={onChange as (e: ChangeEvent) => void}
|
|
206
206
|
onBlur={onBlur}
|
|
207
207
|
ref={ref}
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
UseFormSetError,
|
|
16
16
|
UseFormSetValue,
|
|
17
17
|
} from 'react-hook-form';
|
|
18
|
-
import {
|
|
18
|
+
import { FieldOption, ValidationProps } from 'src/components/input/InputTypes';
|
|
19
19
|
|
|
20
20
|
export interface SelectNativeProps<T extends FieldValues>
|
|
21
21
|
extends ValidationProps,
|
|
@@ -28,8 +28,8 @@ export interface SelectNativeProps<T extends FieldValues>
|
|
|
28
28
|
defaultValue?: string;
|
|
29
29
|
label?: string;
|
|
30
30
|
className?: string;
|
|
31
|
-
options?:
|
|
32
|
-
fullOptions?:
|
|
31
|
+
options?: FieldOption[];
|
|
32
|
+
fullOptions?: FieldOption[];
|
|
33
33
|
helperText?: React.ReactNode;
|
|
34
34
|
control: Control<T, unknown>;
|
|
35
35
|
onChange?: (e: React.ChangeEvent<HTMLSelectElement>) => void;
|
|
@@ -2,11 +2,11 @@ import React, { useRef, useState } from 'react';
|
|
|
2
2
|
import { Box, Flex, useOutsideClick } from '@chakra-ui/react';
|
|
3
3
|
import { ChevronDown, TableOutline } from '../../../../icons';
|
|
4
4
|
import { Dropdown } from '../../dropdown';
|
|
5
|
-
import { FieldOption
|
|
5
|
+
import { FieldOption } from '../../../../input/InputTypes';
|
|
6
6
|
|
|
7
7
|
export interface SortProps {
|
|
8
8
|
onSelectItem: (option: FieldOption) => void;
|
|
9
|
-
sortOptions:
|
|
9
|
+
sortOptions: FieldOption[];
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { RefObject, useMemo } from 'react';
|
|
2
2
|
import { Box, Flex } from '@chakra-ui/react';
|
|
3
3
|
import colors from '../../../../theme/foundations/colors';
|
|
4
|
-
import { FieldOption
|
|
4
|
+
import { FieldOption } from '../../../input/InputTypes';
|
|
5
5
|
import { Checkmark } from '../../../icons';
|
|
6
6
|
|
|
7
7
|
export interface DropdownProps {
|
|
8
8
|
onSelectItem: (option: FieldOption) => void;
|
|
9
|
-
options:
|
|
9
|
+
options: FieldOption[];
|
|
10
10
|
dropdownRef: RefObject<HTMLDivElement>;
|
|
11
11
|
position: 'top' | 'bottom';
|
|
12
12
|
optionIndex: number | null;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { mode } from '@chakra-ui/theme-tools';
|
|
2
|
+
import colors from '../foundations/colors';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
+
type Dict = Record<string, any>;
|
|
6
|
+
|
|
7
|
+
const parts = ['item', 'command', 'list', 'button', 'groupTitle'];
|
|
8
|
+
|
|
9
|
+
function baseStyleList(props: Dict) {
|
|
10
|
+
return {
|
|
11
|
+
bg: colors.fill.light.quaternary,
|
|
12
|
+
boxShadow: mode(`2xl`, `dark-lg`)(props),
|
|
13
|
+
color: 'inherit',
|
|
14
|
+
minW: '3xs',
|
|
15
|
+
py: 4,
|
|
16
|
+
px: 2,
|
|
17
|
+
zIndex: 'docked',
|
|
18
|
+
borderWidth: 0,
|
|
19
|
+
overflow: 'hidden',
|
|
20
|
+
backdropFilter: 'auto',
|
|
21
|
+
backdropBlur: '64px',
|
|
22
|
+
borderRadius: '4px',
|
|
23
|
+
border: '0.25px solid',
|
|
24
|
+
borderColor: colors.fill.light.tertiary,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function baseStyleItem(props: Dict) {
|
|
29
|
+
return {
|
|
30
|
+
fontSize: '13px;',
|
|
31
|
+
fontWeight: 500,
|
|
32
|
+
lineHeight: '16px',
|
|
33
|
+
py: 3,
|
|
34
|
+
px: 4,
|
|
35
|
+
borderRadius: '4px',
|
|
36
|
+
width: '100%',
|
|
37
|
+
transition: 'background 50ms ease-in 0s',
|
|
38
|
+
_hover: {
|
|
39
|
+
color: colors.white,
|
|
40
|
+
background: colors.fill.action,
|
|
41
|
+
},
|
|
42
|
+
_active: {
|
|
43
|
+
bg: mode(`gray.200`, `whiteAlpha.200`)(props),
|
|
44
|
+
},
|
|
45
|
+
_expanded: {
|
|
46
|
+
bg: mode(`gray.100`, `whiteAlpha.100`)(props),
|
|
47
|
+
},
|
|
48
|
+
_disabled: {
|
|
49
|
+
opacity: 0.4,
|
|
50
|
+
cursor: 'not-allowed',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const baseStyleGroupTitle = {
|
|
56
|
+
mx: 4,
|
|
57
|
+
my: 2,
|
|
58
|
+
fontWeight: 'semibold',
|
|
59
|
+
fontSize: 'sm',
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const baseStyleCommand = {
|
|
63
|
+
opacity: 0.6,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const baseStyle = (props: Dict) => {
|
|
67
|
+
return {
|
|
68
|
+
list: baseStyleList(props),
|
|
69
|
+
item: baseStyleItem(props),
|
|
70
|
+
groupTitle: baseStyleGroupTitle,
|
|
71
|
+
command: baseStyleCommand,
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default {
|
|
76
|
+
parts,
|
|
77
|
+
baseStyle,
|
|
78
|
+
};
|
|
@@ -13,6 +13,7 @@ import FormError from './components/form-error';
|
|
|
13
13
|
import FormLabel from './components/form-label';
|
|
14
14
|
import Input from './components/input';
|
|
15
15
|
import Link from './components/link';
|
|
16
|
+
import Menu from './components/menu';
|
|
16
17
|
import Modal from './components/modal';
|
|
17
18
|
import Popover from './components/popover';
|
|
18
19
|
import Select from './components/select';
|
|
@@ -39,6 +40,7 @@ const customXQChakraTheme = extendTheme({
|
|
|
39
40
|
FormLabel,
|
|
40
41
|
Input,
|
|
41
42
|
Link,
|
|
43
|
+
Menu,
|
|
42
44
|
Modal,
|
|
43
45
|
Popover,
|
|
44
46
|
Select,
|