@xqmsg/ui-core 0.24.1 → 0.24.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.
Files changed (37) hide show
  1. package/dist/components/{table/index.d.ts → SimpleTable/SimpleTable.d.ts} +2 -2
  2. package/dist/components/SimpleTable/SimpleTable.stories.d.ts +6 -0
  3. package/dist/components/icons/workspace/index.d.ts +1 -0
  4. package/dist/components/input/components/label/index.d.ts +1 -1
  5. package/dist/components/input/index.d.ts +1 -1
  6. package/dist/components/tabs/TabsWrapper.stories.d.ts +2 -2
  7. package/dist/index.d.ts +2 -1
  8. package/dist/theme/components/popover.d.ts +8 -0
  9. package/dist/ui-core.cjs.development.js +74 -31
  10. package/dist/ui-core.cjs.development.js.map +1 -1
  11. package/dist/ui-core.cjs.production.min.js +1 -1
  12. package/dist/ui-core.cjs.production.min.js.map +1 -1
  13. package/dist/ui-core.esm.js +77 -35
  14. package/dist/ui-core.esm.js.map +1 -1
  15. package/package.json +1 -1
  16. package/src/components/{table/Table.stories.tsx → SimpleTable/SimpleTable.stories.tsx} +8 -5
  17. package/src/components/{table/index.tsx → SimpleTable/SimpleTable.tsx} +3 -3
  18. package/src/components/{table → SimpleTable}/components/text/index.tsx +1 -1
  19. package/src/components/icons/workspace/index.tsx +9 -1
  20. package/src/components/icons/workspace/workspace.svg +8 -0
  21. package/src/components/input/Input.stories.tsx +45 -0
  22. package/src/components/input/components/label/index.tsx +22 -6
  23. package/src/components/input/index.tsx +1 -1
  24. package/src/components/tabs/TabsWrapper.stories.tsx +4 -4
  25. package/src/index.tsx +4 -1
  26. package/src/theme/components/popover.ts +7 -0
  27. package/src/theme/customXQChakraTheme.ts +2 -0
  28. package/dist/components/table/Table.stories.d.ts +0 -6
  29. /package/dist/components/{table → SimpleTable}/TableTypes.d.ts +0 -0
  30. /package/dist/components/{table → SimpleTable}/components/loading/index.d.ts +0 -0
  31. /package/dist/components/{table → SimpleTable}/components/text/index.d.ts +0 -0
  32. /package/dist/components/{table → SimpleTable}/empty/index.d.ts +0 -0
  33. /package/dist/components/{table → SimpleTable}/utils/generateTableColumns.d.ts +0 -0
  34. /package/src/components/{table → SimpleTable}/TableTypes.ts +0 -0
  35. /package/src/components/{table → SimpleTable}/components/loading/index.tsx +0 -0
  36. /package/src/components/{table → SimpleTable}/empty/index.tsx +0 -0
  37. /package/src/components/{table → SimpleTable}/utils/generateTableColumns.ts +0 -0
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.24.1",
2
+ "version": "0.24.2",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -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 { Table, TableProps } from '.';
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<TableProps<typeof tableColumns>> = {
24
+ const meta: Meta<SimpleTableProps<typeof tableColumns>> = {
25
25
  title: 'Table example',
26
- component: Table,
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<TableProps<typeof tableColumns>> = args => {
48
+ const Template: Story<SimpleTableProps<typeof tableColumns>> = args => {
49
49
  const [, updateArgs] = useArgs();
50
50
 
51
51
  return (
52
- <Table {...args} loadMore={() => updateArgs({ ...args, loading: true })} />
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 TableProps<T extends ReadonlyTableColumns> {
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 Table<T extends ReadonlyTableColumns>({
35
+ export function SimpleTable<T extends ReadonlyTableColumns>({
36
36
  columns,
37
37
  headers,
38
38
  body,
39
39
  loading,
40
40
  loadMore,
41
- }: TableProps<T>) {
41
+ }: SimpleTableProps<T>) {
42
42
  const columnsAsConst = generateTableColumnsAsConst(columns);
43
43
 
44
44
  return (
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Box, Text } from '@chakra-ui/react';
3
- import colors from '../../../../../src/theme/foundations/colors';
3
+ import colors from '../../../../theme/foundations/colors';
4
4
 
5
5
  export interface TableTextProps {
6
6
  primaryText: string;
@@ -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> = ({ boxSize }) => {
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,11 +1,19 @@
1
1
  import React from 'react';
2
- import { Box, FormLabel, Tooltip } from '@chakra-ui/react';
2
+ import {
3
+ Box,
4
+ FormLabel,
5
+ Popover,
6
+ PopoverArrow,
7
+ PopoverBody,
8
+ PopoverContent,
9
+ PopoverTrigger,
10
+ } from '@chakra-ui/react';
3
11
  import colors from '../../../../../src/theme/foundations/colors';
4
- import { QuestionOutlineIcon } from '@chakra-ui/icons';
12
+ import { QuestionIcon } from '@chakra-ui/icons';
5
13
 
6
14
  export interface LabelProps {
7
15
  label: string;
8
- tooltipText?: string;
16
+ tooltipText?: string | React.ReactNode;
9
17
  isRequired?: boolean;
10
18
  }
11
19
 
@@ -26,9 +34,17 @@ export const Label: React.FC<LabelProps> = ({
26
34
  </Box>
27
35
  )}
28
36
  {!!tooltipText && (
29
- <Tooltip label={tooltipText} placement="top">
30
- <QuestionOutlineIcon boxSize="13px" ml="8px" />
31
- </Tooltip>
37
+ <Popover trigger="hover" placement="top">
38
+ <PopoverTrigger>
39
+ <Box as="span">
40
+ <QuestionIcon boxSize="13px" ml={1} color={colors.fill.action} />
41
+ </Box>
42
+ </PopoverTrigger>
43
+ <PopoverContent>
44
+ <PopoverArrow />
45
+ <PopoverBody>{tooltipText}</PopoverBody>
46
+ </PopoverContent>
47
+ </Popover>
32
48
  )}
33
49
  </FormLabel>
34
50
  );
@@ -42,7 +42,7 @@ export interface InputProps<T extends FieldValues = FieldValues>
42
42
  control: Control<T, any>;
43
43
  onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
44
44
  disabled?: boolean;
45
- tooltipText?: string;
45
+ tooltipText?: string | React.ReactNode;
46
46
  setValue: UseFormSetValue<T>;
47
47
  setError: UseFormSetError<T>;
48
48
  clearErrors: UseFormClearErrors<T>;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { Meta, Story } from '@storybook/react';
3
3
  import { Text } from '../text';
4
- import { Table, TableProps } from '../table';
5
- import { TableBody, TableHeaders } from '../table/TableTypes';
4
+ import { SimpleTable, SimpleTableProps } from '../SimpleTable/SimpleTable';
5
+ import { TableBody, TableHeaders } from '../SimpleTable/TableTypes';
6
6
  import { useMemo, useState } from '@storybook/addons';
7
7
  import { TabsWrapper, TabsWrapperProps } from '.';
8
8
 
@@ -48,7 +48,7 @@ enum Foo {
48
48
  }
49
49
 
50
50
  export default meta;
51
- const Template: Story<TableProps<typeof tableColumns>> = args => {
51
+ const Template: Story<SimpleTableProps<typeof tableColumns>> = args => {
52
52
  const [index, setIndex] = useState(Foo.ALL);
53
53
 
54
54
  const body = useMemo(() => {
@@ -69,7 +69,7 @@ const Template: Story<TableProps<typeof tableColumns>> = args => {
69
69
  navIndex={index}
70
70
  setNavIndex={(index: number) => setIndex(index)}
71
71
  >
72
- <Table
72
+ <SimpleTable
73
73
  {...args}
74
74
  body={body}
75
75
  borderTopRadius={false}
package/src/index.tsx CHANGED
@@ -38,6 +38,9 @@ export * from './components/input';
38
38
  // Select
39
39
  export { SelectNative } from './components/select';
40
40
 
41
+ // Label
42
+ export * from './components/input/components/label';
43
+
41
44
  // Layout
42
45
  export * from './components/layout';
43
46
 
@@ -54,7 +57,7 @@ export * from './components/modal';
54
57
  export * from './components/navigation';
55
58
 
56
59
  // Table
57
- export * from './components/table';
60
+ export { SimpleTable } from './components/SimpleTable/SimpleTable';
58
61
 
59
62
  // Table Nav
60
63
  export * from './components/tabs';
@@ -0,0 +1,7 @@
1
+ export default {
2
+ baseStyle: {
3
+ content: {
4
+ w: '100%',
5
+ },
6
+ },
7
+ };
@@ -14,6 +14,7 @@ import FormLabel from './components/form-label';
14
14
  import Input from './components/input';
15
15
  import Link from './components/link';
16
16
  import Modal from './components/modal';
17
+ import Popover from './components/popover';
17
18
  import Select from './components/select';
18
19
  import Switch from './components/switch';
19
20
  import Table from './components/table';
@@ -39,6 +40,7 @@ const customXQChakraTheme = extendTheme({
39
40
  Input,
40
41
  Link,
41
42
  Modal,
43
+ Popover,
42
44
  Select,
43
45
  Switch,
44
46
  Table,
@@ -1,6 +0,0 @@
1
- import { Meta } from '@storybook/react';
2
- import { TableProps } from '.';
3
- declare const tableColumns: string[];
4
- declare const meta: Meta<TableProps<typeof tableColumns>>;
5
- export default meta;
6
- export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, TableProps<string[]>>;