@xqmsg/ui-core 0.19.2 → 0.19.4
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/icons/index.d.ts +2 -1
- package/dist/components/icons/services/index.d.ts +8 -0
- package/dist/components/input/StackedSelect/index.d.ts +1 -0
- package/dist/components/input/index.d.ts +2 -1
- package/dist/components/navigation/index.d.ts +1 -1
- package/dist/ui-core.cjs.development.js +49 -19
- 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 +50 -21
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/icons/index.tsx +2 -0
- package/src/components/icons/services/index.tsx +13 -0
- package/src/components/icons/services/services.svg +3 -0
- package/src/components/input/StackedSelect/index.tsx +6 -4
- package/src/components/input/index.tsx +3 -0
- package/src/components/navigation/index.tsx +9 -7
package/package.json
CHANGED
|
@@ -28,6 +28,7 @@ import { TableFill } from './table/fill';
|
|
|
28
28
|
import { TableOutline } from './table/outline';
|
|
29
29
|
import { Trash } from './trash';
|
|
30
30
|
import { Warning } from './warning';
|
|
31
|
+
import { Services } from './services';
|
|
31
32
|
|
|
32
33
|
export {
|
|
33
34
|
Checkmark,
|
|
@@ -55,6 +56,7 @@ export {
|
|
|
55
56
|
Neutral,
|
|
56
57
|
Positive,
|
|
57
58
|
Search,
|
|
59
|
+
Services,
|
|
58
60
|
Settings,
|
|
59
61
|
TableFill,
|
|
60
62
|
TableOutline,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ReactComponent as ServicesIcon } from './services.svg';
|
|
3
|
+
|
|
4
|
+
export interface ServicesProps {
|
|
5
|
+
boxSize: number | string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A functional React component utilized to render the `Services` icon component
|
|
10
|
+
*/
|
|
11
|
+
export const Services: React.FC<ServicesProps> = ({ boxSize }) => {
|
|
12
|
+
return <ServicesIcon boxSize={boxSize} />;
|
|
13
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M8.5 3.05796C8.5 2.82119 8.62403 2.60718 8.76747 2.4188C8.91473 2.2254 9 1.996 9 1.75C9 1.05964 8.32843 0.5 7.5 0.5C6.67157 0.5 6 1.05964 6 1.75C6 1.996 6.08527 2.2254 6.23253 2.4188C6.37597 2.60718 6.5 2.82119 6.5 3.05796V3.05796C6.5 3.29881 6.30277 3.49331 6.06202 3.48638C5.12626 3.45942 4.20056 3.3923 3.2866 3.28666C3.41084 4.36184 3.48179 5.45325 3.49674 6.55818C3.50004 6.80215 3.30195 6.99997 3.05796 7V7C2.82119 7 2.60718 6.87597 2.4188 6.73253C2.2254 6.58527 1.996 6.5 1.75 6.5C1.05964 6.5 0.5 7.17157 0.5 8C0.5 8.82843 1.05964 9.5 1.75 9.5C1.996 9.5 2.2254 9.41473 2.4188 9.26747C2.60718 9.12403 2.82119 9 3.05796 9V9C3.26409 9 3.42771 9.17385 3.4126 9.37942C3.32871 10.5208 3.18495 11.6455 2.98445 12.7504C3.99638 12.8771 5.02301 12.9566 6.06204 12.9865C6.30283 12.9934 6.50008 12.7989 6.50008 12.558V12.558C6.50008 12.3212 6.37604 12.1072 6.23261 11.9188C6.08535 11.7254 6.00008 11.496 6.00008 11.25C6.00008 10.5597 6.67165 10 7.50008 10C8.3285 10 9.00008 10.5597 9.00008 11.25C9.00008 11.496 8.9148 11.7254 8.76755 11.9188C8.62411 12.1072 8.50008 12.3212 8.50008 12.558V12.558C8.50008 12.7799 8.68543 12.9571 8.90697 12.9441C10.1328 12.8721 11.3401 12.731 12.5251 12.5248C12.7047 11.4926 12.8349 10.4435 12.9131 9.37989C12.9282 9.17408 12.7644 9.00003 12.558 9.00003V9.00003C12.3213 9.00003 12.1073 9.12406 11.9189 9.2675C11.7255 9.41476 11.4961 9.50003 11.2501 9.50003C10.5597 9.50003 10.0001 8.82846 10.0001 8.00003C10.0001 7.1716 10.5597 6.50003 11.2501 6.50003C11.4961 6.50003 11.7255 6.5853 11.9189 6.73256C12.1073 6.876 12.3213 7.00003 12.558 7.00003V7.00003C12.8023 7.00003 13.0006 6.80203 12.9972 6.55783C12.9809 5.34942 12.8975 4.15715 12.7508 2.98465C11.4935 3.21277 10.2107 3.36743 8.90685 3.44404C8.68533 3.45705 8.5 3.27986 8.5 3.05796V3.05796Z" stroke="#0082FF" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
</svg>
|
|
@@ -11,13 +11,13 @@ import { StackedInputProps } from '../StackedInput/StackedInput';
|
|
|
11
11
|
import colors from '../../../theme/foundations/colors';
|
|
12
12
|
import { UseFormSetValue, FieldValues, Control } from 'react-hook-form';
|
|
13
13
|
import { Dropdown } from '../components/dropdown';
|
|
14
|
-
import useDidMountEffect from '../../../hooks/useDidMountEffect';
|
|
15
14
|
import { useOnClickOutside } from '../../../hooks/useOnOutsideClick';
|
|
16
15
|
import { Dropdown as DropdownIcon } from '../../icons/dropdown';
|
|
17
16
|
import { debounce } from 'lodash';
|
|
18
17
|
|
|
19
18
|
export interface StackedSelectProps extends StackedInputProps {
|
|
20
19
|
options: FieldOptions;
|
|
20
|
+
fullOptions?: FieldOptions;
|
|
21
21
|
setValue: UseFormSetValue<FieldValues>;
|
|
22
22
|
control: Control<FieldValues, any>;
|
|
23
23
|
handleOnChange: (value?: string) => void;
|
|
@@ -36,6 +36,7 @@ const StackedSelect = React.forwardRef<HTMLInputElement, StackedSelectProps>(
|
|
|
36
36
|
handleOnChange,
|
|
37
37
|
disabled,
|
|
38
38
|
value,
|
|
39
|
+
fullOptions,
|
|
39
40
|
...props
|
|
40
41
|
},
|
|
41
42
|
_ref
|
|
@@ -64,11 +65,12 @@ const StackedSelect = React.forwardRef<HTMLInputElement, StackedSelectProps>(
|
|
|
64
65
|
}
|
|
65
66
|
}, [boundingClientRect]);
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
useEffect(() => {
|
|
68
69
|
setSelectedOption(
|
|
69
|
-
options.find(option => option.value === value)
|
|
70
|
+
(fullOptions || options).find(option => option.value === value)
|
|
71
|
+
?.label ?? ''
|
|
70
72
|
);
|
|
71
|
-
}, [value]);
|
|
73
|
+
}, [fullOptions, value]);
|
|
72
74
|
|
|
73
75
|
useOnClickOutside(dropdownRef, () => setIsFocussed(false));
|
|
74
76
|
|
|
@@ -35,6 +35,7 @@ export interface InputProps<T extends FieldValues> extends ValidationProps {
|
|
|
35
35
|
label?: string;
|
|
36
36
|
className?: string;
|
|
37
37
|
options?: FieldOptions;
|
|
38
|
+
fullOptions?: FieldOptions;
|
|
38
39
|
maxLength?: number;
|
|
39
40
|
helperText?: React.ReactNode;
|
|
40
41
|
control: Control<T, any>;
|
|
@@ -67,6 +68,7 @@ export function Input<T extends FieldValues>({
|
|
|
67
68
|
isRequired,
|
|
68
69
|
maxLength,
|
|
69
70
|
defaultValue,
|
|
71
|
+
fullOptions,
|
|
70
72
|
control,
|
|
71
73
|
disabled,
|
|
72
74
|
rightElement,
|
|
@@ -136,6 +138,7 @@ export function Input<T extends FieldValues>({
|
|
|
136
138
|
value={value}
|
|
137
139
|
defaultValue={defaultValue}
|
|
138
140
|
placeholder={placeholder}
|
|
141
|
+
fullOptions={fullOptions}
|
|
139
142
|
/>
|
|
140
143
|
);
|
|
141
144
|
case 'textarea':
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo, useState } from 'react';
|
|
1
|
+
import React, { useMemo, useState, useEffect } from 'react';
|
|
2
2
|
import { Box } from '@chakra-ui/react';
|
|
3
3
|
import { NavigationMenuHeader } from './components/header';
|
|
4
4
|
import { NavigationMenuItem } from './components/items';
|
|
@@ -20,7 +20,7 @@ export type GroupedMenuItem = {
|
|
|
20
20
|
|
|
21
21
|
export interface NavigationMenuProps {
|
|
22
22
|
groupedMenuItems: GroupedMenuItem[];
|
|
23
|
-
|
|
23
|
+
selectedMenuItem?: string;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
@@ -28,16 +28,18 @@ export interface NavigationMenuProps {
|
|
|
28
28
|
*/
|
|
29
29
|
export const NavigationMenu: React.FC<NavigationMenuProps> = ({
|
|
30
30
|
groupedMenuItems,
|
|
31
|
-
|
|
31
|
+
selectedMenuItem,
|
|
32
32
|
}) => {
|
|
33
33
|
const sortedGroupedMenuItems = useMemo(
|
|
34
34
|
() => groupedMenuItems?.sort((a, b) => a.groupSortValue - b.groupSortValue),
|
|
35
35
|
[groupedMenuItems]
|
|
36
36
|
);
|
|
37
37
|
|
|
38
|
-
const [
|
|
39
|
-
|
|
40
|
-
)
|
|
38
|
+
const [_selectedMenuItem, setSelectedMenuItem] = useState<string>('');
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (selectedMenuItem) setSelectedMenuItem(selectedMenuItem);
|
|
42
|
+
}, [selectedMenuItem]);
|
|
41
43
|
|
|
42
44
|
return (
|
|
43
45
|
<Box
|
|
@@ -57,7 +59,7 @@ export const NavigationMenu: React.FC<NavigationMenuProps> = ({
|
|
|
57
59
|
<NavigationMenuItem
|
|
58
60
|
{...item}
|
|
59
61
|
key={idx}
|
|
60
|
-
isSelected={
|
|
62
|
+
isSelected={_selectedMenuItem === item.label}
|
|
61
63
|
onClick={() => setSelectedMenuItem(item.label)}
|
|
62
64
|
/>
|
|
63
65
|
))}
|