@100mslive/roomkit-react 0.4.2 → 0.4.3-alpha.1
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/index.cjs.css +2 -2
- package/dist/index.cjs.css.map +1 -1
- package/dist/index.cjs.js +25 -5
- package/dist/index.cjs.js.map +2 -2
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/index.js +25 -5
- package/dist/index.js.map +2 -2
- package/dist/meta.cjs.json +14 -14
- package/dist/meta.esbuild.json +14 -14
- package/package.json +8 -20
- package/src/Accordion/Accordion.stories.tsx +0 -50
- package/src/Avatar/Avatar.stories.tsx +0 -33
- package/src/Button/Button.mdx +0 -43
- package/src/Button/Button.stories.tsx +0 -52
- package/src/Chat/Chat.mdx +0 -39
- package/src/Chat/Chat.stories.tsx +0 -39
- package/src/Checkbox/Checkbox.stories.tsx +0 -61
- package/src/Divider/HorizontalDivider.stories.tsx +0 -34
- package/src/Divider/VerticalDivider.stories.tsx +0 -40
- package/src/Dropdown/Dropdown.stories.tsx +0 -94
- package/src/Fieldset/Fieldset.stories.tsx +0 -29
- package/src/Footer/Footer.stories.tsx +0 -61
- package/src/Icons/Icons.stories.mdx +0 -10
- package/src/Icons/IconsList.jsx +0 -17
- package/src/Input/Input.stories.tsx +0 -25
- package/src/Input/PasswordInput.stories.tsx +0 -53
- package/src/Introduction/Integrating.stories.mdx +0 -100
- package/src/Introduction/Introduction.stories.mdx +0 -9
- package/src/Link/Link.stories.tsx +0 -18
- package/src/Loading/Loading.mdx +0 -15
- package/src/Loading/Loading.stories.tsx +0 -37
- package/src/Modal/Dialog.mdx +0 -19
- package/src/Modal/Dialog.stories.tsx +0 -68
- package/src/Pagination/StyledPagination.stories.tsx +0 -80
- package/src/Popover/Popover.mdx +0 -9
- package/src/Popover/Popover.stories.tsx +0 -95
- package/src/Prebuilt/Prebuilt.stories.tsx +0 -46
- package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.stories.tsx +0 -40
- package/src/QRCode/QRCode.mdx +0 -9
- package/src/QRCode/QRCode.stories.tsx +0 -29
- package/src/RadioGroup/RadioGroup.stories.tsx +0 -32
- package/src/ReactSelect/ReactSelect.stories.tsx +0 -83
- package/src/Select/Select.stories.tsx +0 -33
- package/src/Sheet/Sheet.mdx +0 -19
- package/src/Sheet/Sheet.stories.tsx +0 -103
- package/src/Slider/Slider.stories.tsx +0 -21
- package/src/Switch/Switch.mdx +0 -11
- package/src/Switch/Switch.stories.tsx +0 -46
- package/src/Tabs/Tabs.stories.tsx +0 -77
- package/src/Text/Text.stories.tsx +0 -21
- package/src/Theme/Theme.stories.mdx +0 -8
- package/src/Theme/ThemeStory.jsx +0 -56
- package/src/Toast/AppToast.stories.tsx +0 -56
- package/src/Toast/Toast.mdx +0 -19
- package/src/Toast/Toast.stories.tsx +0 -57
- package/src/Tooltip/Tooltip.stories.tsx +0 -62
- package/src/Video/UseVideo.mdx +0 -22
- package/src/Video/UseVideo.stories.tsx +0 -26
- package/src/Video/Video.mdx +0 -24
- package/src/Video/Video.stories.tsx +0 -27
- package/src/VideoList/VideoList.stories.tsx +0 -92
- package/src/VideoTile/VideoTile.mdx +0 -28
- package/src/VideoTile/VideoTile.stories.tsx +0 -32
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { ChevronLeftIcon, ChevronRightIcon } from '@100mslive/react-icons';
|
|
4
|
-
import { StyledPagination } from '.';
|
|
5
|
-
|
|
6
|
-
type PaginationProps = {
|
|
7
|
-
page: number;
|
|
8
|
-
setPage: (page: number) => void;
|
|
9
|
-
numPages: number;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const PaginationComponent = ({ page: propsPage, setPage: propsSetPage, numPages }: PaginationProps) => {
|
|
13
|
-
const [page, setPage] = useState(propsPage);
|
|
14
|
-
|
|
15
|
-
const disableLeft = page === 0;
|
|
16
|
-
const disableRight = page === numPages - 1;
|
|
17
|
-
|
|
18
|
-
const handlePageChange = useCallback(
|
|
19
|
-
(page: number) => {
|
|
20
|
-
setPage(page);
|
|
21
|
-
propsSetPage(page);
|
|
22
|
-
},
|
|
23
|
-
[propsSetPage],
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const nextPage = () => {
|
|
27
|
-
handlePageChange(Math.min(page + 1, numPages - 1));
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const prevPage = () => {
|
|
31
|
-
handlePageChange(Math.max(page - 1, 0));
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
handlePageChange(propsPage);
|
|
36
|
-
}, [propsPage, handlePageChange]);
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<StyledPagination.Root>
|
|
40
|
-
<StyledPagination.Chevron
|
|
41
|
-
disabled={disableLeft}
|
|
42
|
-
onClick={prevPage}
|
|
43
|
-
type="button"
|
|
44
|
-
css={{ padding: 0, border: 'none', backgroundColor: 'transparent' }}
|
|
45
|
-
>
|
|
46
|
-
<ChevronLeftIcon width={16} height={16} style={{ cursor: disableLeft ? 'not-allowed' : 'pointer' }} />
|
|
47
|
-
</StyledPagination.Chevron>
|
|
48
|
-
<StyledPagination.Dots>
|
|
49
|
-
{[...Array(numPages)].map((_, i) => (
|
|
50
|
-
<StyledPagination.Dot key={i} active={page === i} onClick={() => handlePageChange(i)} type="button" />
|
|
51
|
-
))}
|
|
52
|
-
</StyledPagination.Dots>
|
|
53
|
-
<StyledPagination.Chevron
|
|
54
|
-
disabled={disableRight}
|
|
55
|
-
onClick={nextPage}
|
|
56
|
-
type="button"
|
|
57
|
-
css={{ padding: 0, border: 'none', backgroundColor: 'transparent' }}
|
|
58
|
-
>
|
|
59
|
-
<ChevronRightIcon width={16} height={16} style={{ cursor: disableRight ? 'not-allowed' : 'pointer' }} />
|
|
60
|
-
</StyledPagination.Chevron>
|
|
61
|
-
</StyledPagination.Root>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export default {
|
|
66
|
-
title: 'UI Components/Pagination',
|
|
67
|
-
component: PaginationComponent,
|
|
68
|
-
argTypes: {
|
|
69
|
-
setPage: { action: { type: 'click' } },
|
|
70
|
-
page: { control: { type: 'number' }, defaultValue: 0 },
|
|
71
|
-
numPages: { control: { type: 'number' }, defaultValue: 5 },
|
|
72
|
-
},
|
|
73
|
-
} as ComponentMeta<typeof PaginationComponent>;
|
|
74
|
-
|
|
75
|
-
const Template: ComponentStory<typeof PaginationComponent> = args => {
|
|
76
|
-
return <PaginationComponent {...args} />;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const Example = Template.bind({});
|
|
80
|
-
Example.storyName = 'Pagination';
|
package/src/Popover/Popover.mdx
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { CrossIcon, VerticalMenuIcon } from '@100mslive/react-icons';
|
|
4
|
-
import { Button } from '../Button';
|
|
5
|
-
import { Fieldset } from '../Fieldset';
|
|
6
|
-
import { Input } from '../Input';
|
|
7
|
-
import { Label } from '../Label';
|
|
8
|
-
import { Box, Flex } from '../Layout';
|
|
9
|
-
import { Text } from '../Text';
|
|
10
|
-
import { Popover } from './index';
|
|
11
|
-
import PopoverDocs from './Popover.mdx';
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
title: 'UI Components/Popover',
|
|
15
|
-
component: Popover.Root,
|
|
16
|
-
argTypes: { onClick: { action: 'clicked' } },
|
|
17
|
-
args: {
|
|
18
|
-
css: {},
|
|
19
|
-
},
|
|
20
|
-
parameters: {
|
|
21
|
-
docs: {
|
|
22
|
-
page: PopoverDocs,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
} as ComponentMeta<typeof Popover.Root>;
|
|
26
|
-
|
|
27
|
-
//👇 We create a “template” of how args map to rendering
|
|
28
|
-
const Template: ComponentStory<typeof Popover.Root> = () => (
|
|
29
|
-
<Flex css={{ w: '$80' }} justify="center">
|
|
30
|
-
<Popover.Root>
|
|
31
|
-
<Popover.Trigger asChild>
|
|
32
|
-
<Button
|
|
33
|
-
variant="standard"
|
|
34
|
-
css={{
|
|
35
|
-
aspectRatio: '1',
|
|
36
|
-
r: '$round',
|
|
37
|
-
p: '$2 $2',
|
|
38
|
-
bg: '$background_default',
|
|
39
|
-
'&:hover': { bg: '$background_dim !important' },
|
|
40
|
-
}}
|
|
41
|
-
>
|
|
42
|
-
<Box css={{ w: '$10', h: '$10', c: '$on_primary_high' }}>
|
|
43
|
-
<VerticalMenuIcon />
|
|
44
|
-
</Box>
|
|
45
|
-
</Button>
|
|
46
|
-
</Popover.Trigger>
|
|
47
|
-
<Popover.Content align="center" side="bottom" sideOffset={10}>
|
|
48
|
-
<Flex css={{ flexDirection: 'column', gap: 10 }} justify="center" align="center">
|
|
49
|
-
<Flex direction="row" justify="between" css={{ width: '100%' }}>
|
|
50
|
-
<Text as="div" variant="caption" css={{ color: '$on_surface_medium' }}>
|
|
51
|
-
Dimensions
|
|
52
|
-
</Text>
|
|
53
|
-
<Box css={{ color: '$on_surface_medium' }}>
|
|
54
|
-
<CrossIcon width="0.75rem" height="0.75rem" />
|
|
55
|
-
</Box>
|
|
56
|
-
</Flex>
|
|
57
|
-
<Fieldset css={{ justifyContent: 'between', width: '100%' }}>
|
|
58
|
-
<Label htmlFor="width" asChild>
|
|
59
|
-
<Text as="span" variant="sub2">
|
|
60
|
-
Width
|
|
61
|
-
</Text>
|
|
62
|
-
</Label>
|
|
63
|
-
<Input />
|
|
64
|
-
</Fieldset>
|
|
65
|
-
<Fieldset css={{ justifyContent: 'between', width: '100%' }}>
|
|
66
|
-
<Label htmlFor="maxWidth" asChild>
|
|
67
|
-
<Text as="span" variant="sub2">
|
|
68
|
-
Max. width
|
|
69
|
-
</Text>
|
|
70
|
-
</Label>
|
|
71
|
-
<Input />
|
|
72
|
-
</Fieldset>
|
|
73
|
-
<Fieldset css={{ justifyContent: 'between', width: '100%' }}>
|
|
74
|
-
<Label htmlFor="height" asChild>
|
|
75
|
-
<Text as="span" variant="sub2">
|
|
76
|
-
Height
|
|
77
|
-
</Text>
|
|
78
|
-
</Label>
|
|
79
|
-
<Input />
|
|
80
|
-
</Fieldset>
|
|
81
|
-
<Fieldset css={{ justifyContent: 'between', width: '100%' }}>
|
|
82
|
-
<Label htmlFor="maxHeight" asChild>
|
|
83
|
-
<Text as="span" variant="sub2">
|
|
84
|
-
Max. height
|
|
85
|
-
</Text>
|
|
86
|
-
</Label>
|
|
87
|
-
<Input />
|
|
88
|
-
</Fieldset>
|
|
89
|
-
</Flex>
|
|
90
|
-
</Popover.Content>
|
|
91
|
-
</Popover.Root>
|
|
92
|
-
</Flex>
|
|
93
|
-
);
|
|
94
|
-
export const Example = Template.bind({});
|
|
95
|
-
Example.storyName = 'Popover';
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react';
|
|
3
|
-
import { HMSPrebuilt, HMSPrebuiltOptions, HMSPrebuiltProps } from '.';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'UI Components/Prebuilt',
|
|
7
|
-
component: HMSPrebuilt,
|
|
8
|
-
argTypes: {
|
|
9
|
-
roomCode: { control: { type: 'text' }, defaultValue: '' },
|
|
10
|
-
logo: { control: { type: 'object' }, defaultValue: null },
|
|
11
|
-
typography: { control: { type: 'object' }, defaultValue: 'Roboto' },
|
|
12
|
-
options: { control: { type: 'object' }, defaultValue: {} },
|
|
13
|
-
},
|
|
14
|
-
} as Meta<typeof HMSPrebuilt>;
|
|
15
|
-
|
|
16
|
-
const PrebuiltRoomCodeStory: StoryFn<typeof HMSPrebuilt> = ({
|
|
17
|
-
roomCode = '',
|
|
18
|
-
logo,
|
|
19
|
-
themes,
|
|
20
|
-
typography,
|
|
21
|
-
options,
|
|
22
|
-
}: HMSPrebuiltProps) => {
|
|
23
|
-
return <HMSPrebuilt roomCode={roomCode} logo={logo} options={options} themes={themes} typography={typography} />;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const Example = PrebuiltRoomCodeStory.bind({});
|
|
27
|
-
const endpoints: HMSPrebuiltOptions['endpoints'] = {
|
|
28
|
-
roomLayout: process.env.STORYBOOK_ROOM_LAYOUT_ENDPOINT,
|
|
29
|
-
tokenByRoomCode: process.env.STORYBOOK_TOKEN_BY_ROOM_CODE_ENDPOINT,
|
|
30
|
-
init: process.env.STORYBOOK_INIT_API_ENDPOINT,
|
|
31
|
-
event: process.env.STORYBOOK_EVENT_API_ENDPOINT,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const hasEndpoints = Object.values(endpoints).some(val => !!val);
|
|
35
|
-
|
|
36
|
-
Example.args = {
|
|
37
|
-
roomCode: process.env.STORYBOOK_SAMPLE_ROOM_CODE,
|
|
38
|
-
options: {
|
|
39
|
-
userName: '',
|
|
40
|
-
userId: '',
|
|
41
|
-
endpoints: hasEndpoints ? endpoints : undefined,
|
|
42
|
-
},
|
|
43
|
-
typography: {
|
|
44
|
-
font_family: 'Roboto',
|
|
45
|
-
},
|
|
46
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Meta } from '@storybook/react';
|
|
3
|
-
import { MicIcon } from '@100mslive/react-icons';
|
|
4
|
-
import { Box } from '../../../Layout';
|
|
5
|
-
import { Text } from '../../../Text';
|
|
6
|
-
import { IconButtonWithOptions } from './IconButtonWithOptions';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: 'Components/IconButtonWithOptions',
|
|
10
|
-
component: IconButtonWithOptions,
|
|
11
|
-
argTypes: {
|
|
12
|
-
tooltipMessage: { control: 'text' },
|
|
13
|
-
icon: { control: 'object' },
|
|
14
|
-
options: { control: 'object' },
|
|
15
|
-
active: { control: 'boolean' },
|
|
16
|
-
onClick: { control: 'function' },
|
|
17
|
-
key: { control: 'string' },
|
|
18
|
-
},
|
|
19
|
-
} as Meta;
|
|
20
|
-
|
|
21
|
-
const Template = args => (
|
|
22
|
-
<Box css={{ ml: '$20', bg: '$background_dim', p: '$8' }}>
|
|
23
|
-
<IconButtonWithOptions {...args} />
|
|
24
|
-
</Box>
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
export const Default = Template.bind({});
|
|
28
|
-
Default.args = {
|
|
29
|
-
tooltipMessage: 'Click me!',
|
|
30
|
-
icon: <MicIcon height={32} width={32} />,
|
|
31
|
-
options: [
|
|
32
|
-
{ title: 'Option 1', content: <Text>Some content</Text> },
|
|
33
|
-
{ title: 'Option 2', content: <Text>Some more content</Text> },
|
|
34
|
-
],
|
|
35
|
-
active: true,
|
|
36
|
-
onClick: () => {
|
|
37
|
-
return;
|
|
38
|
-
},
|
|
39
|
-
key: '',
|
|
40
|
-
};
|
package/src/QRCode/QRCode.mdx
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { Flex } from '../Layout';
|
|
4
|
-
import { QRCode } from './QRCode';
|
|
5
|
-
import QRCodeDocs from './QRCode.mdx';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'UI Components/QRCode',
|
|
9
|
-
id: 'qr-code',
|
|
10
|
-
component: QRCode,
|
|
11
|
-
args: {
|
|
12
|
-
value: 'https://100ms.live',
|
|
13
|
-
size: 128,
|
|
14
|
-
},
|
|
15
|
-
parameters: {
|
|
16
|
-
docs: {
|
|
17
|
-
page: QRCodeDocs,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
} as ComponentMeta<typeof QRCode>;
|
|
21
|
-
|
|
22
|
-
//👇 We create a “template” of how args map to rendering
|
|
23
|
-
const Template: ComponentStory<typeof QRCode> = ({ ...args }) => (
|
|
24
|
-
<Flex css={{ w: '$80' }} justify="center">
|
|
25
|
-
<QRCode {...args} />
|
|
26
|
-
</Flex>
|
|
27
|
-
);
|
|
28
|
-
export const Example = Template.bind({});
|
|
29
|
-
Example.storyName = 'QRCode';
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { Label } from '../Label';
|
|
4
|
-
import { Flex } from '../Layout';
|
|
5
|
-
import { RadioGroup } from './RadioGroup';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'UI Components/RadioGroup',
|
|
9
|
-
component: RadioGroup.Root,
|
|
10
|
-
argTypes: {},
|
|
11
|
-
} as ComponentMeta<typeof RadioGroup.Root>;
|
|
12
|
-
|
|
13
|
-
//👇 We create a “template” of how args map to rendering
|
|
14
|
-
const Template: ComponentStory<typeof RadioGroup.Root> = args => (
|
|
15
|
-
<RadioGroup.Root {...args} css={{ flexDirection: 'column', alignItems: 'flex-start' }}>
|
|
16
|
-
<Flex align="center" css={{ my: '$4' }} gap="2">
|
|
17
|
-
<RadioGroup.Item value="grid" id="gridView">
|
|
18
|
-
<RadioGroup.Indicator />
|
|
19
|
-
</RadioGroup.Item>
|
|
20
|
-
<Label htmlFor="gridView">Grid View</Label>
|
|
21
|
-
</Flex>
|
|
22
|
-
<Flex align="center" css={{ cursor: 'pointer' }} gap="2">
|
|
23
|
-
<RadioGroup.Item value="activespeaker" id="activeSpeaker">
|
|
24
|
-
<RadioGroup.Indicator />
|
|
25
|
-
</RadioGroup.Item>
|
|
26
|
-
<Label htmlFor="activeSpeaker">Active Speaker</Label>
|
|
27
|
-
</Flex>
|
|
28
|
-
</RadioGroup.Root>
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
export const Example = Template.bind({});
|
|
32
|
-
Example.storyName = 'RadioGroup';
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from '@100mslive/react-icons';
|
|
4
|
-
import { Flex } from '../Layout';
|
|
5
|
-
import { Text } from '../Text';
|
|
6
|
-
import { Select } from './ReactSelect';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: 'UI Components/ReactSelect',
|
|
10
|
-
component: Select.Root,
|
|
11
|
-
} as ComponentMeta<typeof Select.Root>;
|
|
12
|
-
|
|
13
|
-
const data: {
|
|
14
|
-
[key: string]: { id: string; name: string }[];
|
|
15
|
-
} = {
|
|
16
|
-
FRUITS: [
|
|
17
|
-
{ id: 'apple', name: 'Apple' },
|
|
18
|
-
{ id: 'banana', name: 'Banana' },
|
|
19
|
-
{ id: 'blueberry', name: 'Blueberry' },
|
|
20
|
-
{ id: 'grapes', name: 'Grapes' },
|
|
21
|
-
{ id: 'pineapple', name: 'Pineapple' },
|
|
22
|
-
],
|
|
23
|
-
VEGETABLES: [
|
|
24
|
-
{ id: 'aubergine', name: 'Aubergine' },
|
|
25
|
-
{ id: 'broccoli', name: 'Broccoli' },
|
|
26
|
-
{ id: 'carrot', name: 'Carrot' },
|
|
27
|
-
{ id: 'courgette', name: 'Courgette' },
|
|
28
|
-
],
|
|
29
|
-
MEATS: [
|
|
30
|
-
{ id: 'beef', name: 'Beef' },
|
|
31
|
-
{ id: 'chicken', name: 'Chicken' },
|
|
32
|
-
{ id: 'lamb', name: 'Lamb' },
|
|
33
|
-
{ id: 'pork', name: 'Pork' },
|
|
34
|
-
],
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const Template: ComponentStory<typeof Select.Root> = () => {
|
|
38
|
-
return (
|
|
39
|
-
<Select.Root defaultValue="blueberry">
|
|
40
|
-
<Select.Trigger css={{ bg: '$background_dim' }}>
|
|
41
|
-
<Select.Value />
|
|
42
|
-
<Flex css={{ color: '$on_primary_high' }}>
|
|
43
|
-
<ChevronDownIcon />
|
|
44
|
-
</Flex>
|
|
45
|
-
</Select.Trigger>
|
|
46
|
-
<Select.Content>
|
|
47
|
-
<Select.ScrollUpButton css={{ color: '$on_primary_high' }}>
|
|
48
|
-
<ChevronUpIcon />
|
|
49
|
-
</Select.ScrollUpButton>
|
|
50
|
-
<Select.Viewport>
|
|
51
|
-
{Object.keys(data).map((item: string, index: number) => (
|
|
52
|
-
<>
|
|
53
|
-
<Select.Group>
|
|
54
|
-
<Select.Label>
|
|
55
|
-
<Text variant="xs" css={{ color: '$on_primary_medium' }}>
|
|
56
|
-
{item}
|
|
57
|
-
</Text>
|
|
58
|
-
</Select.Label>
|
|
59
|
-
{data[item].map((type: { id: string; name: string }) => (
|
|
60
|
-
<Select.Item value={type?.id}>
|
|
61
|
-
<Select.ItemText>
|
|
62
|
-
<Text variant="md">{type?.name}</Text>
|
|
63
|
-
</Select.ItemText>
|
|
64
|
-
<Select.ItemIndicator css={{ color: '$on_primary_high' }}>
|
|
65
|
-
<CheckIcon />
|
|
66
|
-
</Select.ItemIndicator>
|
|
67
|
-
</Select.Item>
|
|
68
|
-
))}
|
|
69
|
-
</Select.Group>
|
|
70
|
-
{index < Object.keys(data).length - 1 && <Select.Separator css={{ bg: '$border_default' }} />}
|
|
71
|
-
</>
|
|
72
|
-
))}
|
|
73
|
-
</Select.Viewport>
|
|
74
|
-
<Select.ScrollDownButton css={{ color: '$on_primary_high' }}>
|
|
75
|
-
<ChevronDownIcon />
|
|
76
|
-
</Select.ScrollDownButton>
|
|
77
|
-
</Select.Content>
|
|
78
|
-
</Select.Root>
|
|
79
|
-
);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export const WithGroup = Template.bind({});
|
|
83
|
-
WithGroup.storyName = 'ReactSelect';
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { Select } from './Select';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'UI Components/Select',
|
|
7
|
-
component: Select.Root,
|
|
8
|
-
} as ComponentMeta<typeof Select.Root>;
|
|
9
|
-
|
|
10
|
-
const Template: ComponentStory<typeof Select.Root> = () => {
|
|
11
|
-
return (
|
|
12
|
-
<Select.Root css={{ width: '70%' }}>
|
|
13
|
-
<Select.DefaultDownIcon />
|
|
14
|
-
<Select.Select css={{ width: '100%' }}>
|
|
15
|
-
<option value="orange" key="orange">
|
|
16
|
-
Orange
|
|
17
|
-
</option>
|
|
18
|
-
<option value="orange" key="apple">
|
|
19
|
-
Apple
|
|
20
|
-
</option>
|
|
21
|
-
<option value="orange" key="banana">
|
|
22
|
-
Banana
|
|
23
|
-
</option>
|
|
24
|
-
<option value="orange" key="grapes">
|
|
25
|
-
Grapes
|
|
26
|
-
</option>
|
|
27
|
-
</Select.Select>
|
|
28
|
-
</Select.Root>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const Single = Template.bind({});
|
|
33
|
-
Single.storyName = 'Select';
|
package/src/Sheet/Sheet.mdx
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Replacing DocsPage with custom `MDX` content
|
|
2
|
-
|
|
3
|
-
This file is a documentation-only `MDX`file to customize Storybook's [DocsPage](https://storybook.js.org/docs/react/writing-docs/docs-page#replacing-docspage).
|
|
4
|
-
|
|
5
|
-
It can be further expanded with your own code snippets and include specific information related to your stories.
|
|
6
|
-
|
|
7
|
-
For example:
|
|
8
|
-
|
|
9
|
-
import { Story } from '@storybook/addon-docs';
|
|
10
|
-
|
|
11
|
-
## Sheet
|
|
12
|
-
|
|
13
|
-
Sheet is an hover component used to have a focus-mode like UI for users.
|
|
14
|
-
|
|
15
|
-
- [Example](#example)
|
|
16
|
-
|
|
17
|
-
### Example
|
|
18
|
-
|
|
19
|
-
<Story id="sheet--example" />
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { CrossIcon, InfoIcon } from '@100mslive/react-icons';
|
|
4
|
-
import { Button } from '../Button';
|
|
5
|
-
import { HorizontalDivider } from '../Divider';
|
|
6
|
-
import { Fieldset } from '../Fieldset';
|
|
7
|
-
import { Input } from '../Input';
|
|
8
|
-
import { Label } from '../Label';
|
|
9
|
-
import { Box, Flex } from '../Layout';
|
|
10
|
-
import { Text } from '../Text';
|
|
11
|
-
import { Sheet } from './Sheet';
|
|
12
|
-
import SheetDocs from './Sheet.mdx';
|
|
13
|
-
|
|
14
|
-
export default {
|
|
15
|
-
title: 'UI Components/Sheet',
|
|
16
|
-
component: Sheet.Root,
|
|
17
|
-
argTypes: { onClick: { action: 'clicked' } },
|
|
18
|
-
parameters: {
|
|
19
|
-
docs: {
|
|
20
|
-
page: SheetDocs,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
} as ComponentMeta<typeof Sheet.Root>;
|
|
24
|
-
|
|
25
|
-
//👇 We create a “template” of how args map to rendering
|
|
26
|
-
const Template: ComponentStory<typeof Sheet.Root> = () => (
|
|
27
|
-
<Sheet.Root>
|
|
28
|
-
<Sheet.Trigger asChild>
|
|
29
|
-
<Button variant="standard">Open Sheet</Button>
|
|
30
|
-
</Sheet.Trigger>
|
|
31
|
-
<Sheet.Content>
|
|
32
|
-
<Sheet.Title css={{ p: '$10' }}>
|
|
33
|
-
<Flex direction="row" justify="between" css={{ w: '100%' }}>
|
|
34
|
-
<Flex justify="start" align="center" gap="3">
|
|
35
|
-
<InfoIcon />
|
|
36
|
-
<Text variant="h5">Sheet Heading</Text>
|
|
37
|
-
</Flex>
|
|
38
|
-
<Sheet.Close css={{ color: 'white' }}>
|
|
39
|
-
<CrossIcon />
|
|
40
|
-
</Sheet.Close>
|
|
41
|
-
</Flex>
|
|
42
|
-
</Sheet.Title>
|
|
43
|
-
<HorizontalDivider />
|
|
44
|
-
<Box as="div" css={{ p: '$10', overflowY: 'scroll', maxHeight: '70vh' }}>
|
|
45
|
-
<Text variant="body1" css={{ c: '$on_surface_medium' }}>
|
|
46
|
-
Body 2: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
47
|
-
dolore magna aliqua. Ut enim ad minim veniam,im venitetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
|
48
|
-
labore et dolore magna aliqua. Ut enim ad minim veniam,im veni
|
|
49
|
-
</Text>
|
|
50
|
-
<Fieldset>
|
|
51
|
-
<Label htmlFor="name">Name</Label>
|
|
52
|
-
<Input id="name" defaultValue="Amar" css={{ w: '50%' }} />
|
|
53
|
-
</Fieldset>
|
|
54
|
-
<Fieldset>
|
|
55
|
-
<Label htmlFor="username">Username</Label>
|
|
56
|
-
<Input id="username" defaultValue="@amar1995" css={{ w: '50%' }} />
|
|
57
|
-
</Fieldset>
|
|
58
|
-
<Text variant="body1" css={{ c: '$on_surface_medium' }}>
|
|
59
|
-
Body 2: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
60
|
-
dolore magna aliqua. Ut enim ad minim veniam,im venitetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
|
61
|
-
labore et dolore magna aliqua. Ut enim ad minim veniam,im veni
|
|
62
|
-
</Text>
|
|
63
|
-
<Fieldset>
|
|
64
|
-
<Label htmlFor="name">Name</Label>
|
|
65
|
-
<Input id="name" defaultValue="Amar" css={{ w: '50%' }} />
|
|
66
|
-
</Fieldset>
|
|
67
|
-
<Fieldset>
|
|
68
|
-
<Label htmlFor="username">Username</Label>
|
|
69
|
-
<Input id="username" defaultValue="@amar1995" css={{ w: '50%' }} />
|
|
70
|
-
</Fieldset>
|
|
71
|
-
<Text variant="body1" css={{ c: '$on_surface_medium' }}>
|
|
72
|
-
Body 2: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
73
|
-
dolore magna aliqua. Ut enim ad minim veniam,im venitetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
|
74
|
-
labore et dolore magna aliqua. Ut enim ad minim veniam,im veni
|
|
75
|
-
</Text>
|
|
76
|
-
<Fieldset>
|
|
77
|
-
<Label htmlFor="name">Name</Label>
|
|
78
|
-
<Input id="name" defaultValue="Amar" css={{ w: '50%' }} />
|
|
79
|
-
</Fieldset>
|
|
80
|
-
<Fieldset>
|
|
81
|
-
<Label htmlFor="username">Username</Label>
|
|
82
|
-
<Input id="username" defaultValue="@amar1995" css={{ w: '50%' }} />
|
|
83
|
-
</Fieldset>
|
|
84
|
-
<Text variant="body1" css={{ c: '$on_surface_medium' }}>
|
|
85
|
-
Body 2: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
86
|
-
dolore magna aliqua. Ut enim ad minim veniam,im venitetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
|
87
|
-
labore et dolore magna aliqua. Ut enim ad minim veniam,im veni
|
|
88
|
-
</Text>
|
|
89
|
-
<Fieldset>
|
|
90
|
-
<Label htmlFor="name">Name</Label>
|
|
91
|
-
<Input id="name" defaultValue="Amar" css={{ w: '50%' }} />
|
|
92
|
-
</Fieldset>
|
|
93
|
-
<Fieldset>
|
|
94
|
-
<Label htmlFor="username">Username</Label>
|
|
95
|
-
<Input id="username" defaultValue="@amar1995" css={{ w: '50%' }} />
|
|
96
|
-
</Fieldset>
|
|
97
|
-
</Box>
|
|
98
|
-
</Sheet.Content>
|
|
99
|
-
</Sheet.Root>
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
export const Example = Template.bind({});
|
|
103
|
-
Example.storyName = 'Sheet';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { Box } from '..';
|
|
4
|
-
import { Slider } from './Slider';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'UI Components/Slider',
|
|
8
|
-
component: Slider,
|
|
9
|
-
} as ComponentMeta<typeof Slider>;
|
|
10
|
-
|
|
11
|
-
const Template: ComponentStory<typeof Slider> = () => {
|
|
12
|
-
const [volume, setVolume] = React.useState<number>(25);
|
|
13
|
-
return (
|
|
14
|
-
<Box css={{ width: '$80' }}>
|
|
15
|
-
<Slider defaultValue={[25]} step={1} value={[volume]} onValueChange={e => setVolume(e[0])} />
|
|
16
|
-
</Box>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const Primary = Template.bind({});
|
|
21
|
-
Primary.storyName = 'Slider';
|
package/src/Switch/Switch.mdx
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Story } from '@storybook/addon-docs';
|
|
2
|
-
|
|
3
|
-
## Switch
|
|
4
|
-
|
|
5
|
-
Switch is the primary component. It has 2 possible states i.e. on and off. It accepts states as checked prop and event listener of onCheckedChange.
|
|
6
|
-
|
|
7
|
-
- [Index](#index)
|
|
8
|
-
|
|
9
|
-
### Index
|
|
10
|
-
|
|
11
|
-
<Story id="Switch--index" />
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { Flex } from '../Layout';
|
|
4
|
-
import { Switch } from './Switch';
|
|
5
|
-
import SwitchDocs from './Switch.mdx';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'UI Components/Switch',
|
|
9
|
-
component: Switch,
|
|
10
|
-
argTypes: {
|
|
11
|
-
asChild: { control: false },
|
|
12
|
-
},
|
|
13
|
-
args: {
|
|
14
|
-
disabled: false,
|
|
15
|
-
checked: true,
|
|
16
|
-
required: false,
|
|
17
|
-
},
|
|
18
|
-
parameters: {
|
|
19
|
-
docs: {
|
|
20
|
-
page: SwitchDocs,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
} as ComponentMeta<typeof Switch>;
|
|
24
|
-
|
|
25
|
-
//👇 We create a “template” of how args map to rendering
|
|
26
|
-
const Template: ComponentStory<typeof Switch> = ({ checked: initialChecked, ...args }) => {
|
|
27
|
-
const [checked, onCheckedChange] = React.useState(false);
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
onCheckedChange(!!initialChecked);
|
|
30
|
-
}, [initialChecked]);
|
|
31
|
-
return (
|
|
32
|
-
<Flex align="center" justify="center" css={{ w: '$20', h: '$20' }}>
|
|
33
|
-
<Switch checked={checked} {...args} onCheckedChange={onCheckedChange} />
|
|
34
|
-
</Flex>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const Playground = Template.bind({});
|
|
39
|
-
|
|
40
|
-
Playground.storyName = 'Switch';
|
|
41
|
-
Playground.args = {
|
|
42
|
-
checked: false,
|
|
43
|
-
onCheckedChange: () => {
|
|
44
|
-
return;
|
|
45
|
-
},
|
|
46
|
-
};
|