@xqmsg/ui-core 0.24.1 → 0.24.3
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/README.md +8 -13
- package/dist/components/{table/index.d.ts → SimpleTable/SimpleTable.d.ts} +2 -2
- package/dist/components/SimpleTable/SimpleTable.stories.d.ts +6 -0
- package/dist/components/icons/workspace/index.d.ts +1 -0
- package/dist/components/input/components/dropdown/index.d.ts +1 -0
- package/dist/components/input/components/label/index.d.ts +1 -1
- package/dist/components/input/index.d.ts +1 -1
- package/dist/components/tabs/TabsWrapper.stories.d.ts +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/theme/components/popover.d.ts +8 -0
- package/dist/ui-core.cjs.development.js +230 -131
- 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 +234 -136
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +6 -2
- package/src/components/{table/Table.stories.tsx → SimpleTable/SimpleTable.stories.tsx} +8 -5
- package/src/components/{table/index.tsx → SimpleTable/SimpleTable.tsx} +3 -3
- package/src/components/{table → SimpleTable}/components/text/index.tsx +1 -1
- package/src/components/icons/checkmark/index.tsx +1 -1
- package/src/components/icons/chevron/down/index.tsx +7 -1
- package/src/components/icons/chevron/right/index.tsx +1 -1
- package/src/components/icons/clock/index.tsx +1 -1
- package/src/components/icons/dropdown/index.tsx +5 -1
- package/src/components/icons/error/index.tsx +1 -1
- package/src/components/icons/file/fill/index.tsx +1 -1
- package/src/components/icons/file/outline/index.tsx +1 -1
- package/src/components/icons/folder/add/fill/index.tsx +1 -1
- package/src/components/icons/folder/add/outline/index.tsx +1 -1
- package/src/components/icons/folder/outline/index.tsx +1 -1
- package/src/components/icons/group/index.tsx +1 -1
- package/src/components/icons/home/index.tsx +1 -1
- package/src/components/icons/image/index.tsx +1 -1
- package/src/components/icons/link/index.tsx +1 -1
- package/src/components/icons/menu/index.tsx +1 -1
- package/src/components/icons/microsoft/index.tsx +1 -1
- package/src/components/icons/neutral/index.tsx +3 -1
- package/src/components/icons/page/index.tsx +1 -1
- package/src/components/icons/positive/index.tsx +1 -1
- package/src/components/icons/question/index.tsx +1 -1
- package/src/components/icons/search/index.tsx +1 -1
- package/src/components/icons/services/index.tsx +1 -1
- package/src/components/icons/settings/index.tsx +3 -1
- package/src/components/icons/table/fill/index.tsx +1 -1
- package/src/components/icons/table/outline/index.tsx +1 -1
- package/src/components/icons/task/index.tsx +1 -1
- package/src/components/icons/trash/index.tsx +1 -1
- package/src/components/icons/video/index.tsx +1 -1
- package/src/components/icons/warning/index.tsx +1 -1
- package/src/components/icons/workspace/index.tsx +9 -1
- package/src/components/icons/workspace/workspace.svg +8 -0
- package/src/components/input/Input.stories.tsx +45 -0
- package/src/components/input/StackedMultiSelect/index.tsx +34 -27
- package/src/components/input/StackedSelect/index.tsx +30 -25
- package/src/components/input/components/dropdown/index.tsx +39 -11
- package/src/components/input/components/label/index.tsx +22 -6
- package/src/components/input/index.tsx +1 -1
- package/src/components/tabs/TabsWrapper.stories.tsx +4 -4
- package/src/index.tsx +4 -1
- package/src/theme/components/popover.ts +7 -0
- package/src/theme/customXQChakraTheme.ts +2 -0
- package/dist/components/table/Table.stories.d.ts +0 -6
- /package/dist/components/{table → SimpleTable}/TableTypes.d.ts +0 -0
- /package/dist/components/{table → SimpleTable}/components/loading/index.d.ts +0 -0
- /package/dist/components/{table → SimpleTable}/components/text/index.d.ts +0 -0
- /package/dist/components/{table → SimpleTable}/empty/index.d.ts +0 -0
- /package/dist/components/{table → SimpleTable}/utils/generateTableColumns.d.ts +0 -0
- /package/src/components/{table → SimpleTable}/TableTypes.ts +0 -0
- /package/src/components/{table → SimpleTable}/components/loading/index.tsx +0 -0
- /package/src/components/{table → SimpleTable}/empty/index.tsx +0 -0
- /package/src/components/{table → SimpleTable}/utils/generateTableColumns.ts +0 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.24.
|
|
2
|
+
"version": "0.24.3",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -37,7 +37,11 @@
|
|
|
37
37
|
"trailingComma": "es5"
|
|
38
38
|
},
|
|
39
39
|
"name": "@xqmsg/ui-core",
|
|
40
|
-
"author":
|
|
40
|
+
"author": {
|
|
41
|
+
"name": "XQ",
|
|
42
|
+
"email": "ike@xqmsg.com",
|
|
43
|
+
"url": "https://xqmsg.co"
|
|
44
|
+
},
|
|
41
45
|
"module": "dist/ui-core.esm.js",
|
|
42
46
|
"size-limit": [
|
|
43
47
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Meta, Story } from '@storybook/react';
|
|
3
3
|
import { Text } from '../text';
|
|
4
|
-
import {
|
|
4
|
+
import { SimpleTable, SimpleTableProps } from './SimpleTable';
|
|
5
5
|
import { TableBody, TableHeaders } from './TableTypes';
|
|
6
6
|
import { useArgs } from '@storybook/addons';
|
|
7
7
|
|
|
@@ -21,9 +21,9 @@ const tableBody: TableBody<typeof tableColumns> = [
|
|
|
21
21
|
{ AppliesToTypes: 'hi', bar: 'hey' },
|
|
22
22
|
];
|
|
23
23
|
|
|
24
|
-
const meta: Meta<
|
|
24
|
+
const meta: Meta<SimpleTableProps<typeof tableColumns>> = {
|
|
25
25
|
title: 'Table example',
|
|
26
|
-
component:
|
|
26
|
+
component: SimpleTable,
|
|
27
27
|
argTypes: {
|
|
28
28
|
body: {
|
|
29
29
|
description:
|
|
@@ -45,11 +45,14 @@ const meta: Meta<TableProps<typeof tableColumns>> = {
|
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
47
|
export default meta;
|
|
48
|
-
const Template: Story<
|
|
48
|
+
const Template: Story<SimpleTableProps<typeof tableColumns>> = args => {
|
|
49
49
|
const [, updateArgs] = useArgs();
|
|
50
50
|
|
|
51
51
|
return (
|
|
52
|
-
<
|
|
52
|
+
<SimpleTable
|
|
53
|
+
{...args}
|
|
54
|
+
loadMore={() => updateArgs({ ...args, loading: true })}
|
|
55
|
+
/>
|
|
53
56
|
);
|
|
54
57
|
};
|
|
55
58
|
|
|
@@ -20,7 +20,7 @@ import { TableLoadingRows } from './components/loading';
|
|
|
20
20
|
import colors from '../../theme/foundations/colors';
|
|
21
21
|
import { EmptyTable } from './empty';
|
|
22
22
|
|
|
23
|
-
export interface
|
|
23
|
+
export interface SimpleTableProps<T extends ReadonlyTableColumns> {
|
|
24
24
|
columns: TableColumns;
|
|
25
25
|
headers?: TableHeaders<T>;
|
|
26
26
|
body: TableBody<T>;
|
|
@@ -32,13 +32,13 @@ export interface TableProps<T extends ReadonlyTableColumns> {
|
|
|
32
32
|
/**
|
|
33
33
|
* A React component utilized to render the `Table` component
|
|
34
34
|
*/
|
|
35
|
-
export function
|
|
35
|
+
export function SimpleTable<T extends ReadonlyTableColumns>({
|
|
36
36
|
columns,
|
|
37
37
|
headers,
|
|
38
38
|
body,
|
|
39
39
|
loading,
|
|
40
40
|
loadMore,
|
|
41
|
-
}:
|
|
41
|
+
}: SimpleTableProps<T>) {
|
|
42
42
|
const columnsAsConst = generateTableColumnsAsConst(columns);
|
|
43
43
|
|
|
44
44
|
return (
|
|
@@ -9,5 +9,5 @@ export interface CheckmarkProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Checkmark` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Checkmark: React.FC<CheckmarkProps> = ({ boxSize }) => {
|
|
12
|
-
return <CheckmarkIcon boxSize={boxSize} />;
|
|
12
|
+
return <CheckmarkIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -10,5 +10,11 @@ export interface ChevronDownProps {
|
|
|
10
10
|
* A functional React component utilized to render the `ChevronDown` icon component
|
|
11
11
|
*/
|
|
12
12
|
export const ChevronDown: React.FC<ChevronDownProps> = ({ boxSize }) => {
|
|
13
|
-
return
|
|
13
|
+
return (
|
|
14
|
+
<ChevronDownIcon
|
|
15
|
+
width={boxSize}
|
|
16
|
+
height={boxSize}
|
|
17
|
+
fill={colors.fill.action}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
14
20
|
};
|
|
@@ -9,5 +9,5 @@ export interface ChevronRightProps {
|
|
|
9
9
|
* A functional React component utilized to render the `ChevronRight` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const ChevronRight: React.FC<ChevronRightProps> = ({ boxSize }) => {
|
|
12
|
-
return <ChevronRightIcon boxSize={boxSize} />;
|
|
12
|
+
return <ChevronRightIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface ClockProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Clock` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Clock: React.FC<ClockProps> = ({ boxSize }) => {
|
|
12
|
-
return <ClockIcon boxSize={boxSize} />;
|
|
12
|
+
return <ClockIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -11,6 +11,10 @@ export interface DropdownProps {
|
|
|
11
11
|
*/
|
|
12
12
|
export const Dropdown: React.FC<DropdownProps> = ({ boxSize, disabled }) => {
|
|
13
13
|
return (
|
|
14
|
-
<DropdownIcon
|
|
14
|
+
<DropdownIcon
|
|
15
|
+
width={boxSize}
|
|
16
|
+
height={boxSize}
|
|
17
|
+
fill={disabled ? '#3C3C4399' : '#0082FF'}
|
|
18
|
+
/>
|
|
15
19
|
);
|
|
16
20
|
};
|
|
@@ -9,5 +9,5 @@ export interface ErrorProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Error` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Error: React.FC<ErrorProps> = ({ boxSize }) => {
|
|
12
|
-
return <ErrorIcon boxSize={boxSize} />;
|
|
12
|
+
return <ErrorIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface FileFillProps {
|
|
|
9
9
|
* A functional React component utilized to render the `FileFill` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const FileFill: React.FC<FileFillProps> = ({ boxSize }) => {
|
|
12
|
-
return <FileFillIcon boxSize={boxSize} />;
|
|
12
|
+
return <FileFillIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface FileOutlineProps {
|
|
|
9
9
|
* A functional React component utilized to render the `FileOutline` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const FileOutline: React.FC<FileOutlineProps> = ({ boxSize }) => {
|
|
12
|
-
return <FileOutlineIcon boxSize={boxSize} />;
|
|
12
|
+
return <FileOutlineIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface FolderAddFillProps {
|
|
|
9
9
|
* A functional React component utilized to render the `FolderAddFill` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const FolderAddFill: React.FC<FolderAddFillProps> = ({ boxSize }) => {
|
|
12
|
-
return <FolderAddFillIcon boxSize={boxSize} />;
|
|
12
|
+
return <FolderAddFillIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface FolderOutlineProps {
|
|
|
9
9
|
* A functional React component utilized to render the `FolderOutline` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const FolderOutline: React.FC<FolderOutlineProps> = ({ boxSize }) => {
|
|
12
|
-
return <FolderOutlineIcon boxSize={boxSize} />;
|
|
12
|
+
return <FolderOutlineIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface GroupProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Group` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Group: React.FC<GroupProps> = ({ boxSize }) => {
|
|
12
|
-
return <GroupIcon boxSize={boxSize} />;
|
|
12
|
+
return <GroupIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface HomeProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Home` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Home: React.FC<HomeProps> = ({ boxSize }) => {
|
|
12
|
-
return <HomeIcon boxSize={boxSize} />;
|
|
12
|
+
return <HomeIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface ImageProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Image` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Image: React.FC<ImageProps> = ({ boxSize }) => {
|
|
12
|
-
return <ImageIcon boxSize={boxSize} />;
|
|
12
|
+
return <ImageIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface LinkProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Link` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Link: React.FC<LinkProps> = ({ boxSize }) => {
|
|
12
|
-
return <LinkIcon boxSize={boxSize} />;
|
|
12
|
+
return <LinkIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface MenuProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Menu` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Menu: React.FC<MenuProps> = ({ boxSize }) => {
|
|
12
|
-
return <MenuIcon boxSize={boxSize} />;
|
|
12
|
+
return <MenuIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface MicrosoftProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Microsoft` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Microsoft: React.FC<MicrosoftProps> = ({ boxSize }) => {
|
|
12
|
-
return <MicrosoftLogo boxSize={boxSize} />;
|
|
12
|
+
return <MicrosoftLogo width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -10,5 +10,7 @@ export interface NeutralProps {
|
|
|
10
10
|
* A functional React component utilized to render the `Neutral` icon component
|
|
11
11
|
*/
|
|
12
12
|
export const Neutral: React.FC<NeutralProps> = ({ color, boxSize }) => {
|
|
13
|
-
return
|
|
13
|
+
return (
|
|
14
|
+
<NeutralIcon width={boxSize} height={boxSize} fill={color || '#3C3C43'} />
|
|
15
|
+
);
|
|
14
16
|
};
|
|
@@ -9,5 +9,5 @@ export interface PageProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Page` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Page: React.FC<PageProps> = ({ boxSize }) => {
|
|
12
|
-
return <PageIcon boxSize={boxSize} />;
|
|
12
|
+
return <PageIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface PositiveProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Positive` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Positive: React.FC<PositiveProps> = ({ boxSize }) => {
|
|
12
|
-
return <PositiveIcon boxSize={boxSize} />;
|
|
12
|
+
return <PositiveIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface QuestionProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Question` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Question: React.FC<QuestionProps> = ({ boxSize }) => {
|
|
12
|
-
return <QuestionIcon boxSize={boxSize} />;
|
|
12
|
+
return <QuestionIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface SearchProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Search` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Search: React.FC<SearchProps> = ({ boxSize }) => {
|
|
12
|
-
return <SearchIcon boxSize={boxSize} />;
|
|
12
|
+
return <SearchIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface ServicesProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Services` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Services: React.FC<ServicesProps> = ({ boxSize }) => {
|
|
12
|
-
return <ServicesIcon boxSize={boxSize} />;
|
|
12
|
+
return <ServicesIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -10,5 +10,7 @@ export interface SettingsProps {
|
|
|
10
10
|
* A functional React component utilized to render the `Settings` icon component
|
|
11
11
|
*/
|
|
12
12
|
export const Settings: React.FC<SettingsProps> = ({ boxSize }) => {
|
|
13
|
-
return
|
|
13
|
+
return (
|
|
14
|
+
<SettingsIcon width={boxSize} height={boxSize} fill={colors.fill.action} />
|
|
15
|
+
);
|
|
14
16
|
};
|
|
@@ -9,5 +9,5 @@ export interface TableFillProps {
|
|
|
9
9
|
* A functional React component utilized to render the `TableFill` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const TableFill: React.FC<TableFillProps> = ({ boxSize }) => {
|
|
12
|
-
return <TableFillIcon boxSize={boxSize} />;
|
|
12
|
+
return <TableFillIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface TableOutlineProps {
|
|
|
9
9
|
* A functional React component utilized to render the `TableOutline` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const TableOutline: React.FC<TableOutlineProps> = ({ boxSize }) => {
|
|
12
|
-
return <TableOutlineIcon boxSize={boxSize} />;
|
|
12
|
+
return <TableOutlineIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -6,5 +6,5 @@ import { IconProps } from '..';
|
|
|
6
6
|
* A functional React component utilized to render the `Task` icon component
|
|
7
7
|
*/
|
|
8
8
|
export const Task: React.FC<IconProps> = ({ boxSize }) => {
|
|
9
|
-
return <TaskIcon boxSize={boxSize} />;
|
|
9
|
+
return <TaskIcon width={boxSize} height={boxSize} />;
|
|
10
10
|
};
|
|
@@ -9,5 +9,5 @@ export interface TrashProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Trash` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Trash: React.FC<TrashProps> = ({ boxSize }) => {
|
|
12
|
-
return <TrashIcon boxSize={boxSize} />;
|
|
12
|
+
return <TrashIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface VideoProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Video` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Video: React.FC<VideoProps> = ({ boxSize }) => {
|
|
12
|
-
return <VideoIcon boxSize={boxSize} />;
|
|
12
|
+
return <VideoIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -9,5 +9,5 @@ export interface WarningProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Warning` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Warning: React.FC<WarningProps> = ({ boxSize }) => {
|
|
12
|
-
return <WarningIcon boxSize={boxSize} />;
|
|
12
|
+
return <WarningIcon width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Image } from '@chakra-ui/react';
|
|
3
3
|
import path from './workspace.png';
|
|
4
|
+
import { ReactComponent as WorkspaceIcon } from './workspace.svg';
|
|
4
5
|
|
|
5
6
|
export interface WorkspaceProps {
|
|
6
7
|
boxSize: number | string;
|
|
8
|
+
filled?: boolean;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* A functional React component utilized to render the `Workspace` icon component
|
|
11
13
|
*/
|
|
12
|
-
export const Workspace: React.FC<WorkspaceProps> = ({
|
|
14
|
+
export const Workspace: React.FC<WorkspaceProps> = ({
|
|
15
|
+
boxSize,
|
|
16
|
+
filled = false,
|
|
17
|
+
}) => {
|
|
18
|
+
if (filled) {
|
|
19
|
+
return <WorkspaceIcon boxSize={boxSize} />;
|
|
20
|
+
}
|
|
13
21
|
return <Image src={path} boxSize={boxSize} />;
|
|
14
22
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg width="56" height="51" viewBox="0 0 56 51" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M18 10.75C18 5.22715 22.4772 0.75 28 0.75C33.5228 0.75 38 5.22715 38 10.75C38 16.2728 33.5228 20.75 28 20.75C22.4772 20.75 18 16.2728 18 10.75Z" fill="#0082FF"/>
|
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M38 18.75C38 14.3317 41.5817 10.75 46 10.75C50.4183 10.75 54 14.3317 54 18.75C54 23.1683 50.4183 26.75 46 26.75C41.5817 26.75 38 23.1683 38 18.75Z" fill="#0082FF"/>
|
|
4
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 18.75C2 14.3317 5.58172 10.75 10 10.75C14.4183 10.75 18 14.3317 18 18.75C18 23.1683 14.4183 26.75 10 26.75C5.58172 26.75 2 23.1683 2 18.75Z" fill="#0082FF"/>
|
|
5
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.8263 33.0634C16.0209 28.0684 21.6223 24.75 28 24.75C34.3785 24.75 39.9805 28.0692 43.1749 33.0652C45.3833 36.5191 46.3387 40.6838 45.8906 44.7445C45.8205 45.379 45.4517 45.942 44.898 46.2598C39.9184 49.117 34.1469 50.75 28 50.75C21.8531 50.75 16.0816 49.117 11.102 46.2598C10.5482 45.942 10.1795 45.379 10.1094 44.7445C9.66116 40.6831 10.6171 36.5176 12.8263 33.0634Z" fill="#0082FF"/>
|
|
6
|
+
<path d="M9.55275 30.7598C9.52064 30.8092 9.48872 30.8586 9.457 30.9082C6.88244 34.9337 5.70421 39.7278 6.0659 44.454C4.44445 44.2077 2.87119 43.8116 1.36114 43.2798L1.05459 43.1718C0.495356 42.9749 0.104606 42.467 0.0575759 41.876L0.031795 41.552C0.0107124 41.2871 0 41.0196 0 40.75C0 35.377 4.23745 30.9938 9.55275 30.7598Z" fill="#0082FF"/>
|
|
7
|
+
<path d="M49.935 44.4539C50.2966 39.7287 49.119 34.9355 46.5454 30.9105C46.5132 30.8601 46.4808 30.8099 46.4482 30.7599C51.7631 30.9943 56 35.3774 56 40.75C56 41.0196 55.9893 41.2871 55.9682 41.552L55.9424 41.876C55.8954 42.467 55.5046 42.9749 54.9454 43.1718L54.6389 43.2798C53.1291 43.8115 51.5561 44.2076 49.935 44.4539Z" fill="#0082FF"/>
|
|
8
|
+
</svg>
|
|
@@ -6,6 +6,19 @@ import { useFormHandler } from '../form/hooks/useFormHandler';
|
|
|
6
6
|
import * as Yup from 'yup';
|
|
7
7
|
import { Form } from '../form';
|
|
8
8
|
import { SelectNative } from '../select';
|
|
9
|
+
import {
|
|
10
|
+
Box,
|
|
11
|
+
Flex,
|
|
12
|
+
Popover,
|
|
13
|
+
PopoverArrow,
|
|
14
|
+
PopoverBody,
|
|
15
|
+
PopoverContent,
|
|
16
|
+
PopoverHeader,
|
|
17
|
+
PopoverTrigger,
|
|
18
|
+
Tooltip,
|
|
19
|
+
Text,
|
|
20
|
+
} from '@chakra-ui/react';
|
|
21
|
+
import { Question } from '../icons';
|
|
9
22
|
|
|
10
23
|
const meta: Meta<InputProps<StoryFormSchema>> = {
|
|
11
24
|
title: 'Input example',
|
|
@@ -133,6 +146,25 @@ const Template: Story<InputProps<StoryFormSchema>> = args => {
|
|
|
133
146
|
name="prop3"
|
|
134
147
|
onChange={e => form.setValue('prop3', e.target.value)}
|
|
135
148
|
/>
|
|
149
|
+
<Input
|
|
150
|
+
{...args}
|
|
151
|
+
inputType="text"
|
|
152
|
+
name="prop3"
|
|
153
|
+
onChange={e => form.setValue('prop3', e.target.value)}
|
|
154
|
+
tooltipText={
|
|
155
|
+
<Box>
|
|
156
|
+
<Text fontSize={13}>Explanation!</Text>
|
|
157
|
+
<Text>Are you sure you want to have that milkshake?</Text>
|
|
158
|
+
</Box>
|
|
159
|
+
}
|
|
160
|
+
/>
|
|
161
|
+
<Input
|
|
162
|
+
{...args}
|
|
163
|
+
inputType="text"
|
|
164
|
+
name="prop3"
|
|
165
|
+
onChange={e => form.setValue('prop3', e.target.value)}
|
|
166
|
+
tooltipText="test text"
|
|
167
|
+
/>
|
|
136
168
|
<Input
|
|
137
169
|
{...args}
|
|
138
170
|
inputType="textarea"
|
|
@@ -174,6 +206,19 @@ const Template: Story<InputProps<StoryFormSchema>> = args => {
|
|
|
174
206
|
name="prop4"
|
|
175
207
|
defaultValue={'value1'}
|
|
176
208
|
/>
|
|
209
|
+
<Input
|
|
210
|
+
{...args}
|
|
211
|
+
inputType="select"
|
|
212
|
+
setValue={form.setValue}
|
|
213
|
+
name="prop4"
|
|
214
|
+
defaultValue={'value1'}
|
|
215
|
+
tooltipText={
|
|
216
|
+
<Box>
|
|
217
|
+
<Text fontSize={13}>Explanation!</Text>
|
|
218
|
+
<Text>Are you sure you want to have that milkshake?</Text>
|
|
219
|
+
</Box>
|
|
220
|
+
}
|
|
221
|
+
/>
|
|
177
222
|
<SelectNative
|
|
178
223
|
{...args}
|
|
179
224
|
setValue={form.setValue}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React, {
|
|
2
2
|
KeyboardEventHandler,
|
|
3
3
|
useEffect,
|
|
4
|
-
useMemo,
|
|
5
4
|
useRef,
|
|
6
5
|
useState,
|
|
7
6
|
} from 'react';
|
|
8
7
|
import { Box, Flex, Text, Input } from '@chakra-ui/react';
|
|
9
|
-
import { debounce } from 'lodash';
|
|
10
8
|
import {
|
|
11
9
|
FieldOption,
|
|
12
10
|
FieldOptions,
|
|
@@ -50,13 +48,16 @@ const StackedMultiSelect = React.forwardRef<
|
|
|
50
48
|
const [isInit, setIsInit] = useState(false);
|
|
51
49
|
const [localValues, setLocalValues] = useState<FieldOptions>([]);
|
|
52
50
|
const [localOptions, setLocalOptions] = useState<FieldOptions>(options);
|
|
51
|
+
const [filteredOptions, setFilteredOptions] = useState<FieldOptions>(
|
|
52
|
+
localOptions
|
|
53
|
+
);
|
|
53
54
|
const [isFocussed, setIsFocussed] = useState(false);
|
|
54
55
|
const [shouldSideScroll, setShouldSideScroll] = useState(false);
|
|
55
56
|
const [optionIndex, setOptionIndex] = useState<number | null>(null);
|
|
56
57
|
|
|
57
58
|
const [position, setPosition] = useState<'top' | 'bottom'>('top');
|
|
58
59
|
const [searchValue, setSearchValue] = useState('');
|
|
59
|
-
const [debouncedSearchValue, setDebouncedSearchValue] = useState('');
|
|
60
|
+
// const [debouncedSearchValue, setDebouncedSearchValue] = useState('');
|
|
60
61
|
|
|
61
62
|
const boundingClientRect = dropdownRef.current?.getBoundingClientRect() as DOMRect;
|
|
62
63
|
|
|
@@ -137,6 +138,9 @@ const StackedMultiSelect = React.forwardRef<
|
|
|
137
138
|
);
|
|
138
139
|
|
|
139
140
|
setLocalValues(prevLocalValues => [...prevLocalValues, option]);
|
|
141
|
+
|
|
142
|
+
// reset search on value select
|
|
143
|
+
setSearchValue('');
|
|
140
144
|
};
|
|
141
145
|
|
|
142
146
|
const handleDelete = (option: FieldOption) => {
|
|
@@ -180,8 +184,8 @@ const StackedMultiSelect = React.forwardRef<
|
|
|
180
184
|
|
|
181
185
|
if (e.key === 'ArrowUp' && optionIndex !== null && optionIndex > 0) {
|
|
182
186
|
const incrementValue =
|
|
183
|
-
|
|
184
|
-
|
|
187
|
+
filteredOptions[optionIndex - 1] &&
|
|
188
|
+
filteredOptions[optionIndex - 1].value === 'section_header'
|
|
185
189
|
? 2
|
|
186
190
|
: 1;
|
|
187
191
|
setOptionIndex(optionIndex - incrementValue);
|
|
@@ -195,11 +199,11 @@ const StackedMultiSelect = React.forwardRef<
|
|
|
195
199
|
if (
|
|
196
200
|
e.key === 'ArrowDown' &&
|
|
197
201
|
optionIndex !== null &&
|
|
198
|
-
optionIndex <
|
|
202
|
+
optionIndex < filteredOptions.length
|
|
199
203
|
) {
|
|
200
204
|
const incrementValue =
|
|
201
|
-
|
|
202
|
-
|
|
205
|
+
filteredOptions[optionIndex + 1] &&
|
|
206
|
+
filteredOptions[optionIndex + 1].value === 'section_header'
|
|
203
207
|
? 2
|
|
204
208
|
: 1;
|
|
205
209
|
setOptionIndex(optionIndex + incrementValue);
|
|
@@ -211,7 +215,7 @@ const StackedMultiSelect = React.forwardRef<
|
|
|
211
215
|
}
|
|
212
216
|
|
|
213
217
|
if (e.key === 'Enter' && optionIndex !== null) {
|
|
214
|
-
const option =
|
|
218
|
+
const option = filteredOptions.find((_, idx) => optionIndex === idx);
|
|
215
219
|
if (!option) return;
|
|
216
220
|
|
|
217
221
|
handleChange(option);
|
|
@@ -222,8 +226,6 @@ const StackedMultiSelect = React.forwardRef<
|
|
|
222
226
|
if (e.key === 'Tab') {
|
|
223
227
|
return setIsFocussed(false);
|
|
224
228
|
}
|
|
225
|
-
|
|
226
|
-
return update(debouncedSearchValue.concat(e.key));
|
|
227
229
|
}
|
|
228
230
|
};
|
|
229
231
|
|
|
@@ -236,24 +238,27 @@ const StackedMultiSelect = React.forwardRef<
|
|
|
236
238
|
);
|
|
237
239
|
|
|
238
240
|
dropdownMenuRef.current?.scrollTo({
|
|
239
|
-
top: idx *
|
|
241
|
+
top: idx * 27,
|
|
240
242
|
behavior: 'smooth',
|
|
241
243
|
});
|
|
242
|
-
|
|
243
|
-
setSearchValue('');
|
|
244
|
-
setDebouncedSearchValue('');
|
|
245
244
|
}
|
|
246
245
|
}, [options, searchValue]);
|
|
247
246
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
247
|
+
useEffect(() => {
|
|
248
|
+
setFilteredOptions(
|
|
249
|
+
localOptions.filter(element => {
|
|
250
|
+
return element.label.toLowerCase().includes(searchValue.toLowerCase());
|
|
251
|
+
})
|
|
252
|
+
);
|
|
253
|
+
}, [localOptions, searchValue]);
|
|
254
|
+
|
|
255
|
+
const handleInput = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
256
|
+
console.log(e);
|
|
257
|
+
const initialOptionIndex =
|
|
258
|
+
filteredOptions[0]?.value === 'section_header' ? 1 : 0;
|
|
259
|
+
setOptionIndex(initialOptionIndex);
|
|
260
|
+
const { value } = e.target;
|
|
261
|
+
setSearchValue(value);
|
|
257
262
|
};
|
|
258
263
|
|
|
259
264
|
return (
|
|
@@ -330,17 +335,19 @@ const StackedMultiSelect = React.forwardRef<
|
|
|
330
335
|
_focus={{ boxShadow: 'none !important' }}
|
|
331
336
|
/>
|
|
332
337
|
<Flex mr="4px" justifyContent="center" alignItems="center">
|
|
333
|
-
<DropdownIcon boxSize="
|
|
338
|
+
<DropdownIcon boxSize="12px" disabled={disabled} />
|
|
334
339
|
</Flex>
|
|
335
340
|
</Flex>
|
|
336
341
|
{isFocussed && (
|
|
337
342
|
<Dropdown
|
|
338
343
|
dropdownRef={dropdownMenuRef}
|
|
339
344
|
onSelectItem={option => handleChange(option)}
|
|
340
|
-
options={
|
|
345
|
+
options={filteredOptions}
|
|
341
346
|
position={position}
|
|
342
347
|
optionIndex={optionIndex}
|
|
343
|
-
|
|
348
|
+
>
|
|
349
|
+
<Input value={searchValue} onChange={handleInput} />
|
|
350
|
+
</Dropdown>
|
|
344
351
|
)}
|
|
345
352
|
</Box>
|
|
346
353
|
);
|