@xqmsg/ui-core 0.18.0 → 0.18.2
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/navigation/index.d.ts +8 -2
- package/dist/components/toolbar/index.d.ts +2 -6
- package/dist/ui-core.cjs.development.js +6 -236
- 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 +6 -236
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/navigation/index.tsx +10 -5
- package/src/components/toolbar/Toolbar.stories.tsx +9 -2
- package/src/components/toolbar/index.tsx +5 -49
- package/dist/components/toolbar/components/actions/index.d.ts +0 -14
- package/src/components/toolbar/components/actions/index.tsx +0 -39
package/package.json
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import React, { useMemo, useState } from 'react';
|
|
2
2
|
import { Box } from '@chakra-ui/react';
|
|
3
3
|
import { NavigationMenuHeader } from './components/header';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { NavigationMenuItem } from './components/items';
|
|
5
|
+
|
|
6
|
+
export interface GroupedMenuItems {
|
|
7
|
+
leftIcon: JSX.Element;
|
|
8
|
+
label: string;
|
|
9
|
+
href?: string;
|
|
10
|
+
rightIcon?: JSX.Element;
|
|
11
|
+
isExternal?: boolean;
|
|
12
|
+
}
|
|
8
13
|
|
|
9
14
|
export interface NavigationMenuProps {
|
|
10
15
|
groupedMenuItems: {
|
|
11
16
|
groupSortValue: number;
|
|
12
17
|
groupHeader?: string;
|
|
13
|
-
groupMenuItems:
|
|
18
|
+
groupMenuItems: GroupedMenuItems[];
|
|
14
19
|
}[];
|
|
15
20
|
defaultSelectedMenuItem?: string;
|
|
16
21
|
}
|
|
@@ -4,6 +4,7 @@ import { Meta, Story } from '@storybook/react';
|
|
|
4
4
|
import { Box } from '@chakra-ui/react';
|
|
5
5
|
import { Toolbar, ToolbarProps } from '.';
|
|
6
6
|
import { useState } from '@storybook/addons';
|
|
7
|
+
import { Button } from '../button';
|
|
7
8
|
|
|
8
9
|
const meta: Meta<ToolbarProps> = {
|
|
9
10
|
title: 'Toolbar example',
|
|
@@ -41,10 +42,16 @@ const Template: Story<ToolbarProps> = args => {
|
|
|
41
42
|
{...args}
|
|
42
43
|
pageList={pageList}
|
|
43
44
|
currentPage={currentPage}
|
|
44
|
-
sortOptions={sortOptions}
|
|
45
45
|
searchValue={searchValue}
|
|
46
46
|
onChangeSearch={(value: string) => setSearchValue(value)}
|
|
47
|
-
|
|
47
|
+
>
|
|
48
|
+
<Button
|
|
49
|
+
variant="secondary"
|
|
50
|
+
text="Sign Out"
|
|
51
|
+
width="variable"
|
|
52
|
+
ariaLabel="button"
|
|
53
|
+
/>
|
|
54
|
+
</Toolbar>
|
|
48
55
|
</Box>
|
|
49
56
|
);
|
|
50
57
|
};
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
2
|
import { Flex } from '@chakra-ui/react';
|
|
3
3
|
import { ToolbarBreadcrumbs } from './components/breadcrumbs';
|
|
4
|
-
import { Actions } from './components/actions';
|
|
5
|
-
import { useMediaQuery } from '@chakra-ui/media-query';
|
|
6
|
-
import StackedInput from '../input/StackedInput/StackedInput';
|
|
7
|
-
import colors from '../../theme/foundations/colors';
|
|
8
|
-
import { FieldOption, FieldOptions } from '../input/InputTypes';
|
|
9
4
|
|
|
10
5
|
export type ToolbarLabelAndHandler = { label: string; handler: () => void };
|
|
11
6
|
|
|
12
|
-
export interface ToolbarProps {
|
|
7
|
+
export interface ToolbarProps extends PropsWithChildren {
|
|
13
8
|
pageList: ToolbarLabelAndHandler[];
|
|
14
9
|
currentPage: string;
|
|
15
10
|
searchValue: string;
|
|
16
|
-
|
|
17
|
-
onSelectSortItem: (option: FieldOption) => void;
|
|
18
|
-
onClickAdd: () => void;
|
|
11
|
+
|
|
19
12
|
onChangeSearch: (value: string) => void;
|
|
20
13
|
}
|
|
21
14
|
|
|
@@ -23,23 +16,10 @@ export interface ToolbarProps {
|
|
|
23
16
|
* A functional React component utilized to render the `Toolbar` component
|
|
24
17
|
*/
|
|
25
18
|
export const Toolbar: React.FC<ToolbarProps> = ({
|
|
19
|
+
children,
|
|
26
20
|
pageList,
|
|
27
21
|
currentPage,
|
|
28
|
-
searchValue,
|
|
29
|
-
sortOptions,
|
|
30
|
-
onChangeSearch,
|
|
31
|
-
onClickAdd,
|
|
32
|
-
onSelectSortItem,
|
|
33
22
|
}) => {
|
|
34
|
-
const [breakpoint800] = useMediaQuery('(min-width: 600px)');
|
|
35
|
-
const [showSearch, setShowSearch] = useState(false);
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (breakpoint800) {
|
|
39
|
-
setShowSearch(false);
|
|
40
|
-
}
|
|
41
|
-
}, [breakpoint800, showSearch]);
|
|
42
|
-
|
|
43
23
|
return (
|
|
44
24
|
<Flex flexDirection="column">
|
|
45
25
|
<Flex
|
|
@@ -50,32 +30,8 @@ export const Toolbar: React.FC<ToolbarProps> = ({
|
|
|
50
30
|
background="white"
|
|
51
31
|
>
|
|
52
32
|
<ToolbarBreadcrumbs pageList={pageList} currentPage={currentPage} />
|
|
53
|
-
<
|
|
54
|
-
onChangeSearch={onChangeSearch}
|
|
55
|
-
onClickAdd={onClickAdd}
|
|
56
|
-
onClickSearch={() => setShowSearch(!showSearch)}
|
|
57
|
-
onSelectSortItem={onSelectSortItem}
|
|
58
|
-
searchValue={searchValue}
|
|
59
|
-
sortOptions={sortOptions}
|
|
60
|
-
/>
|
|
33
|
+
<Flex alignItems="center">{children} </Flex>
|
|
61
34
|
</Flex>
|
|
62
|
-
{showSearch && (
|
|
63
|
-
<Flex
|
|
64
|
-
px="13px"
|
|
65
|
-
height="52px"
|
|
66
|
-
alignItems="center"
|
|
67
|
-
background="white"
|
|
68
|
-
borderTop="1px solid"
|
|
69
|
-
borderColor={colors.fill.light.tertiary}
|
|
70
|
-
>
|
|
71
|
-
<StackedInput
|
|
72
|
-
placeholder="Search..."
|
|
73
|
-
name="search"
|
|
74
|
-
value={searchValue}
|
|
75
|
-
onChange={e => onChangeSearch(e.target.value)}
|
|
76
|
-
/>
|
|
77
|
-
</Flex>
|
|
78
|
-
)}
|
|
79
35
|
</Flex>
|
|
80
36
|
);
|
|
81
37
|
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FieldOption, FieldOptions } from '../../../input/InputTypes';
|
|
3
|
-
export interface ActionsProps {
|
|
4
|
-
onSelectSortItem: (option: FieldOption) => void;
|
|
5
|
-
onClickAdd: () => void;
|
|
6
|
-
onClickSearch: () => void;
|
|
7
|
-
onChangeSearch: (value: string) => void;
|
|
8
|
-
searchValue: string;
|
|
9
|
-
sortOptions: FieldOptions;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* A functional React component utilized to render the `Actions` component
|
|
13
|
-
*/
|
|
14
|
-
export declare const Actions: React.FC<ActionsProps>;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Flex } from '@chakra-ui/react';
|
|
3
|
-
import { Add } from './add';
|
|
4
|
-
import { Sort } from './sort';
|
|
5
|
-
import { Search } from './search';
|
|
6
|
-
import { FieldOption, FieldOptions } from '../../../input/InputTypes';
|
|
7
|
-
|
|
8
|
-
export interface ActionsProps {
|
|
9
|
-
onSelectSortItem: (option: FieldOption) => void;
|
|
10
|
-
onClickAdd: () => void;
|
|
11
|
-
onClickSearch: () => void;
|
|
12
|
-
onChangeSearch: (value: string) => void;
|
|
13
|
-
searchValue: string;
|
|
14
|
-
sortOptions: FieldOptions;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* A functional React component utilized to render the `Actions` component
|
|
19
|
-
*/
|
|
20
|
-
export const Actions: React.FC<ActionsProps> = ({
|
|
21
|
-
onSelectSortItem,
|
|
22
|
-
onClickAdd,
|
|
23
|
-
onChangeSearch,
|
|
24
|
-
onClickSearch,
|
|
25
|
-
searchValue,
|
|
26
|
-
sortOptions,
|
|
27
|
-
}) => {
|
|
28
|
-
return (
|
|
29
|
-
<Flex alignItems="center">
|
|
30
|
-
<Sort onSelectItem={onSelectSortItem} sortOptions={sortOptions} />
|
|
31
|
-
<Add onClick={onClickAdd} />
|
|
32
|
-
<Search
|
|
33
|
-
onChange={onChangeSearch}
|
|
34
|
-
onClick={onClickSearch}
|
|
35
|
-
searchValue={searchValue}
|
|
36
|
-
/>
|
|
37
|
-
</Flex>
|
|
38
|
-
);
|
|
39
|
-
};
|