@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,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { AddIcon } from '@100mslive/react-icons';
|
|
4
|
-
import { Button } from '../Button';
|
|
5
|
-
import { Flex } from '../Layout';
|
|
6
|
-
import { Text } from '../Text';
|
|
7
|
-
import { VerticalDivider } from '.';
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: 'UI Components/Divider',
|
|
11
|
-
component: VerticalDivider,
|
|
12
|
-
argTypes: {
|
|
13
|
-
ref: { table: { disable: true }, control: { type: null } },
|
|
14
|
-
as: { table: { disable: true }, control: { type: null } },
|
|
15
|
-
css: { control: { type: 'object' } },
|
|
16
|
-
space: { defaultValue: 1, control: { type: 'number', min: 1, max: 4 } },
|
|
17
|
-
},
|
|
18
|
-
} as ComponentMeta<typeof VerticalDivider>;
|
|
19
|
-
|
|
20
|
-
const VerticalDividerComponent: ComponentStory<typeof VerticalDivider> = ({ space, css }) => {
|
|
21
|
-
return (
|
|
22
|
-
<Flex align="center" css={{ position: 'absolute', left: '$10' }}>
|
|
23
|
-
<Button icon variant="primary">
|
|
24
|
-
<AddIcon />
|
|
25
|
-
<Text as="span" variant="button" css={{ c: 'white' }}>
|
|
26
|
-
Add Stuff
|
|
27
|
-
</Text>
|
|
28
|
-
</Button>
|
|
29
|
-
<VerticalDivider space={space} css={{ bg: '$on_primary_high', ...css }} />
|
|
30
|
-
<Button icon variant="danger">
|
|
31
|
-
<AddIcon />
|
|
32
|
-
<Text as="span" variant="button" css={{ c: 'white' }}>
|
|
33
|
-
Add Another Stuff
|
|
34
|
-
</Text>
|
|
35
|
-
</Button>
|
|
36
|
-
</Flex>
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const Vertical = VerticalDividerComponent.bind({});
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { ChevronDownIcon, ChevronUpIcon, PeopleIcon } from '@100mslive/react-icons';
|
|
4
|
-
import { Avatar, Box, Flex, Text, textEllipsis } from '..';
|
|
5
|
-
import { Dropdown } from './Dropdown';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'UI Components/Dropdown',
|
|
9
|
-
component: Dropdown.Content,
|
|
10
|
-
} as ComponentMeta<typeof Dropdown.Content>;
|
|
11
|
-
|
|
12
|
-
const participants = [
|
|
13
|
-
{ id: '231313', name: 'Simbrella', roleName: 'Student' },
|
|
14
|
-
{ id: '768456', name: 'Jonty', roleName: 'Student' },
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
const Template: ComponentStory<typeof Dropdown.Content> = () => {
|
|
18
|
-
const [open, setOpen] = React.useState(true);
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<Dropdown.Root
|
|
22
|
-
open
|
|
23
|
-
onOpenChange={() => {
|
|
24
|
-
setOpen(!open);
|
|
25
|
-
}}
|
|
26
|
-
>
|
|
27
|
-
<Dropdown.Trigger asChild>
|
|
28
|
-
<Box
|
|
29
|
-
css={{
|
|
30
|
-
color: '$on_surface_high',
|
|
31
|
-
borderRadius: '$1',
|
|
32
|
-
border: '1px solid $border_default',
|
|
33
|
-
padding: '$4 $4',
|
|
34
|
-
width: '$80',
|
|
35
|
-
}}
|
|
36
|
-
>
|
|
37
|
-
<Box css={{ display: 'flex', justifyContent: 'space-between' }}>
|
|
38
|
-
<Box css={{ display: 'flex', gap: '$4', mr: '$4' }}>
|
|
39
|
-
<PeopleIcon />
|
|
40
|
-
<Text variant="md">2</Text>
|
|
41
|
-
</Box>
|
|
42
|
-
<Flex>{open ? <ChevronUpIcon /> : <ChevronDownIcon />}</Flex>
|
|
43
|
-
</Box>
|
|
44
|
-
</Box>
|
|
45
|
-
</Dropdown.Trigger>
|
|
46
|
-
{open && (
|
|
47
|
-
<Dropdown.Content sideOffset={5} align="start" css={{ height: 'auto', maxHeight: '$96' }}>
|
|
48
|
-
<Dropdown.Group
|
|
49
|
-
css={{
|
|
50
|
-
h: 'auto',
|
|
51
|
-
flexDirection: 'column',
|
|
52
|
-
flexWrap: 'wrap',
|
|
53
|
-
alignItems: 'flex-start',
|
|
54
|
-
}}
|
|
55
|
-
>
|
|
56
|
-
<Dropdown.Label css={{ w: 'initial ' }}>
|
|
57
|
-
<Text variant="md" data-testid="role_student">
|
|
58
|
-
{'Students '}({participants.length})
|
|
59
|
-
</Text>
|
|
60
|
-
</Dropdown.Label>
|
|
61
|
-
{participants.map((peer, i) => (
|
|
62
|
-
<Dropdown.Item css={{ justifyContent: 'space-between' }} data-testid={`participant_${i}`}>
|
|
63
|
-
<Flex>
|
|
64
|
-
<Box css={{ width: '$16' }}>
|
|
65
|
-
<Avatar
|
|
66
|
-
name={peer.name}
|
|
67
|
-
css={{
|
|
68
|
-
position: 'unset',
|
|
69
|
-
transform: 'unset',
|
|
70
|
-
mr: '$4',
|
|
71
|
-
fontSize: '$sm',
|
|
72
|
-
}}
|
|
73
|
-
/>
|
|
74
|
-
</Box>
|
|
75
|
-
<Flex direction="column">
|
|
76
|
-
<Text variant="md" css={{ ...textEllipsis(150), fontWeight: '$semiBold' }}>
|
|
77
|
-
{peer.name}
|
|
78
|
-
</Text>
|
|
79
|
-
<Text variant="sub2" css={{ color: '$on_surface_medium' }}>
|
|
80
|
-
{peer.roleName}
|
|
81
|
-
</Text>
|
|
82
|
-
</Flex>
|
|
83
|
-
</Flex>
|
|
84
|
-
</Dropdown.Item>
|
|
85
|
-
))}
|
|
86
|
-
</Dropdown.Group>
|
|
87
|
-
</Dropdown.Content>
|
|
88
|
-
)}
|
|
89
|
-
</Dropdown.Root>
|
|
90
|
-
);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export const DropdownContent = Template.bind({});
|
|
94
|
-
DropdownContent.storyName = 'Dropdown';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { Input } from '../Input';
|
|
4
|
-
import { Label } from '../Label';
|
|
5
|
-
import { Text } from '../Text';
|
|
6
|
-
import { Fieldset } from '.';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: 'UI Components/Fieldset',
|
|
10
|
-
component: Fieldset,
|
|
11
|
-
argTypes: {
|
|
12
|
-
ref: { table: { disable: true } },
|
|
13
|
-
as: { table: { disable: true } },
|
|
14
|
-
},
|
|
15
|
-
} as ComponentMeta<typeof Fieldset>;
|
|
16
|
-
|
|
17
|
-
const Template: ComponentStory<typeof Fieldset> = ({ css }) => {
|
|
18
|
-
return (
|
|
19
|
-
<Fieldset css={css} style={{ width: '70%' }}>
|
|
20
|
-
<Label htmlFor="name">
|
|
21
|
-
<Text variant="sub2">Input Label</Text>
|
|
22
|
-
</Label>
|
|
23
|
-
<Input id="name" placeholder="Some random input" css={{ w: '80%' }} />
|
|
24
|
-
</Fieldset>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const Example = Template.bind({});
|
|
29
|
-
Example.storyName = 'Fieldset';
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import {
|
|
4
|
-
BrbIcon,
|
|
5
|
-
ChatIcon,
|
|
6
|
-
EndStreamIcon,
|
|
7
|
-
MicOnIcon,
|
|
8
|
-
PipIcon,
|
|
9
|
-
ShareScreenIcon,
|
|
10
|
-
VideoOnIcon,
|
|
11
|
-
} from '@100mslive/react-icons';
|
|
12
|
-
import { Button } from '../Button';
|
|
13
|
-
import { IconButton } from '../IconButton';
|
|
14
|
-
import { Footer } from '.';
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
title: 'UI Components/Footer',
|
|
18
|
-
component: Footer.Root,
|
|
19
|
-
argTypes: {
|
|
20
|
-
as: { table: { disable: true } },
|
|
21
|
-
css: { control: { type: 'object' } },
|
|
22
|
-
},
|
|
23
|
-
} as ComponentMeta<typeof Footer.Root>;
|
|
24
|
-
|
|
25
|
-
const Template: ComponentStory<typeof Footer.Root> = ({ css }) => {
|
|
26
|
-
return (
|
|
27
|
-
<Footer.Root css={css}>
|
|
28
|
-
<Footer.Left>
|
|
29
|
-
<IconButton>
|
|
30
|
-
<MicOnIcon />
|
|
31
|
-
</IconButton>
|
|
32
|
-
<IconButton>
|
|
33
|
-
<VideoOnIcon />
|
|
34
|
-
</IconButton>
|
|
35
|
-
</Footer.Left>
|
|
36
|
-
<Footer.Center>
|
|
37
|
-
<IconButton>
|
|
38
|
-
<ShareScreenIcon />
|
|
39
|
-
</IconButton>
|
|
40
|
-
<IconButton>
|
|
41
|
-
<PipIcon />
|
|
42
|
-
</IconButton>
|
|
43
|
-
<Button>
|
|
44
|
-
<EndStreamIcon />
|
|
45
|
-
End Stream
|
|
46
|
-
</Button>
|
|
47
|
-
</Footer.Center>
|
|
48
|
-
<Footer.Right>
|
|
49
|
-
<IconButton>
|
|
50
|
-
<BrbIcon />
|
|
51
|
-
</IconButton>
|
|
52
|
-
<IconButton>
|
|
53
|
-
<ChatIcon />
|
|
54
|
-
</IconButton>
|
|
55
|
-
</Footer.Right>
|
|
56
|
-
</Footer.Root>
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const Example = Template.bind({});
|
|
61
|
-
Example.storyName = 'Footer';
|
package/src/Icons/IconsList.jsx
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { IconGallery, IconItem } from '@storybook/addon-docs';
|
|
3
|
-
import * as icons from '@100mslive/react-icons';
|
|
4
|
-
|
|
5
|
-
const IconsList = () => {
|
|
6
|
-
return (
|
|
7
|
-
<IconGallery>
|
|
8
|
-
{Object.entries(icons).map(([name, Component]) => (
|
|
9
|
-
<IconItem name={name} key={name}>
|
|
10
|
-
<Component />
|
|
11
|
-
</IconItem>
|
|
12
|
-
))}
|
|
13
|
-
</IconGallery>
|
|
14
|
-
);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default IconsList;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { Input } from '.';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'UI Components/Input',
|
|
7
|
-
component: Input,
|
|
8
|
-
argTypes: {
|
|
9
|
-
ref: { table: { disable: true } },
|
|
10
|
-
as: { table: { disable: true } },
|
|
11
|
-
placeholder: { control: { type: 'text' } },
|
|
12
|
-
error: { control: { type: 'boolean' } },
|
|
13
|
-
},
|
|
14
|
-
args: {
|
|
15
|
-
error: false,
|
|
16
|
-
placeholder: 'This is a placeholder',
|
|
17
|
-
},
|
|
18
|
-
} as ComponentMeta<typeof Input>;
|
|
19
|
-
|
|
20
|
-
const Template: ComponentStory<typeof Input> = args => {
|
|
21
|
-
return <Input {...args} />;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const Example = Template.bind({});
|
|
25
|
-
Example.storyName = 'Input';
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useMeasure } from 'react-use';
|
|
3
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
4
|
-
import { Box } from '../Layout';
|
|
5
|
-
import { PasswordInput } from './Input';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'UI Components/PasswordInput',
|
|
9
|
-
component: PasswordInput.Root,
|
|
10
|
-
argTypes: {
|
|
11
|
-
css: { control: 'object' },
|
|
12
|
-
},
|
|
13
|
-
} as ComponentMeta<typeof PasswordInput.Root>;
|
|
14
|
-
|
|
15
|
-
//👇 We create a “template” of how args map to rendering
|
|
16
|
-
const Template: ComponentStory<typeof PasswordInput.Root> = args => {
|
|
17
|
-
const [text, setText] = React.useState('');
|
|
18
|
-
const [showPassword, setShowPassword] = React.useState(false);
|
|
19
|
-
const [ref, { width }] = useMeasure<HTMLDivElement>();
|
|
20
|
-
return (
|
|
21
|
-
<Box css={{ w: '240px' }}>
|
|
22
|
-
<PasswordInput.Root {...args}>
|
|
23
|
-
<PasswordInput.Input
|
|
24
|
-
css={{ pr: width + 8 }}
|
|
25
|
-
showPassword={showPassword}
|
|
26
|
-
onChange={e => setText(e.target.value)}
|
|
27
|
-
/>
|
|
28
|
-
<PasswordInput.Icons ref={ref} css={{ bg: 'transparent' }}>
|
|
29
|
-
<PasswordInput.ShowIcon
|
|
30
|
-
showPassword={showPassword}
|
|
31
|
-
onClick={() => {
|
|
32
|
-
setShowPassword(!showPassword);
|
|
33
|
-
}}
|
|
34
|
-
css={{
|
|
35
|
-
color: '$on_primary_high',
|
|
36
|
-
}}
|
|
37
|
-
/>
|
|
38
|
-
<PasswordInput.CopyIcon
|
|
39
|
-
onClick={() => {
|
|
40
|
-
navigator.clipboard.writeText(text);
|
|
41
|
-
}}
|
|
42
|
-
css={{
|
|
43
|
-
color: '$on_primary_high',
|
|
44
|
-
}}
|
|
45
|
-
/>
|
|
46
|
-
</PasswordInput.Icons>
|
|
47
|
-
</PasswordInput.Root>
|
|
48
|
-
</Box>
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const Example = Template.bind({});
|
|
53
|
-
Example.storyName = 'PasswordInput';
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/addon-docs';
|
|
2
|
-
|
|
3
|
-
<Meta title="Introduction/Integrating The SDK" />
|
|
4
|
-
|
|
5
|
-
## Installing our libraries
|
|
6
|
-
|
|
7
|
-
You can use either npm or yarn to install the dependencies. Please install the respective libraries depending on whether
|
|
8
|
-
you're planning to use with react or other framework/plain JavaScript.
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
npm install --save @100mslive/hms-video-store
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
## npm
|
|
16
|
-
npm install --save @100mslive/react-sdk@latest
|
|
17
|
-
## yarn
|
|
18
|
-
yarn add @100mslive/react-sdk@latest
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Via CDN:
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
https://cdn.skypack.dev/@100mslive/hms-video
|
|
25
|
-
https://cdn.skypack.dev/@100mslive/hms-video-store
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Setting up the sdk
|
|
29
|
-
|
|
30
|
-
Our core SDK can be used with plain JavaScript or any UI framework. We also provide a convenient hooks based interface
|
|
31
|
-
in case you're planning to integrate our SDK in a React app. Please follow the appropriate section below.
|
|
32
|
-
|
|
33
|
-
### JavaScript
|
|
34
|
-
|
|
35
|
-
There are three entities which we need to be familiar of -
|
|
36
|
-
|
|
37
|
-
- `hmsStore` - this contains the complete state of the room at any given time. This includes for example, participant details,
|
|
38
|
-
messages and track states.
|
|
39
|
-
- `hmsActions` - this is used to perform any action such as joining, muting and sending a message.
|
|
40
|
-
- `hmsNotifications` - this can be used to get notified on peer join/leave and new messages in order to show toast notifications to
|
|
41
|
-
the user.
|
|
42
|
-
|
|
43
|
-
Let's create a `hms.js` file where we initialize and export the above entities, so they can be used as required. We'll assume that
|
|
44
|
-
this setup is in place in other sections of the documentation.
|
|
45
|
-
|
|
46
|
-
```js
|
|
47
|
-
import { HMSReactiveStore } from '@100mslive/hms-video-store';
|
|
48
|
-
|
|
49
|
-
const hms = new HMSReactiveStore();
|
|
50
|
-
|
|
51
|
-
// by default subscriber is notified about store changes post subscription only, this can be
|
|
52
|
-
// changed to call it right after subscribing too using this function.
|
|
53
|
-
hms.triggerOnSubscribe(); // optional, recommended
|
|
54
|
-
|
|
55
|
-
const hmsActions = hms.getHMSActions();
|
|
56
|
-
const hmsStore = hms.getStore();
|
|
57
|
-
const hmsNotifications = hms.getNotifications();
|
|
58
|
-
|
|
59
|
-
export { hmsActions, hmsStore, hmsNotifications };
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
```js:some_other_file.js
|
|
63
|
-
import { hmsActions, hmsStore, hmsNotifications } from './hms';
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### React Hooks
|
|
67
|
-
|
|
68
|
-
If you're planning to use our SDK with React, we provide three friendly hooks as a wrapper over our plain JavaScript interface.
|
|
69
|
-
You can wrap your UI in `HMSRoomProvider` and these hooks will become available to all the UI components. We'll learn more about these hooks,
|
|
70
|
-
and their use as we navigate through further sections.
|
|
71
|
-
|
|
72
|
-
```jsx
|
|
73
|
-
// app.jsx
|
|
74
|
-
import { HMSRoomProvider } from '@100mslive/react-sdk';
|
|
75
|
-
|
|
76
|
-
export function App() {
|
|
77
|
-
return (
|
|
78
|
-
<HMSRoomProvider>
|
|
79
|
-
<MyApp />
|
|
80
|
-
</HMSRoomProvider>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
```jsx
|
|
86
|
-
// component.jsx
|
|
87
|
-
import {
|
|
88
|
-
useHMSStore,
|
|
89
|
-
useHMSActions,
|
|
90
|
-
useHMSNotifications
|
|
91
|
-
} from '@100mslive/react-sdk';
|
|
92
|
-
|
|
93
|
-
export function MyComponent() {
|
|
94
|
-
const hmsStore = useHMSStore();
|
|
95
|
-
const hmsActions = useHMSActions();
|
|
96
|
-
const hmsNotifications = useHMSNotifications();
|
|
97
|
-
|
|
98
|
-
return </>;
|
|
99
|
-
}
|
|
100
|
-
```
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/addon-docs';
|
|
2
|
-
|
|
3
|
-
<Meta title="Introduction/Getting Started" />
|
|
4
|
-
|
|
5
|
-
# Getting Started
|
|
6
|
-
|
|
7
|
-
- [Basic Concepts](https://www.100ms.live/docs/javascript/v2/foundation/basics)
|
|
8
|
-
- [Template and Roles](https://www.100ms.live/docs/javascript/v2/foundation/templates-and-roles)
|
|
9
|
-
- [Authentication and Tokens](https://www.100ms.live/docs/javascript/v2/foundation/security-and-tokens)
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { Link } from '.';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'UI Components/Link',
|
|
7
|
-
component: Link,
|
|
8
|
-
} as ComponentMeta<typeof Link>;
|
|
9
|
-
|
|
10
|
-
const Template: ComponentStory<typeof Link> = props => {
|
|
11
|
-
return (
|
|
12
|
-
<Link icon={props.icon} iconSide={props.iconSide} color={props.color} href="#">
|
|
13
|
-
Link Text
|
|
14
|
-
</Link>
|
|
15
|
-
);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const Multiple = Template.bind({});
|
package/src/Loading/Loading.mdx
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Story, Preview, Props } from '@storybook/addon-docs';
|
|
2
|
-
|
|
3
|
-
import { Loading } from '.';
|
|
4
|
-
|
|
5
|
-
# Loading
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
This is some random overview text of the item.
|
|
10
|
-
|
|
11
|
-
<Preview>
|
|
12
|
-
<Story id="ui-components-loading--example" />
|
|
13
|
-
</Preview>
|
|
14
|
-
|
|
15
|
-
<Props />
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { Flex } from '../Layout';
|
|
4
|
-
import mdx from './Loading.mdx';
|
|
5
|
-
import { Loading } from '.';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'UI Components/Loading',
|
|
9
|
-
component: Loading,
|
|
10
|
-
parameters: {
|
|
11
|
-
docs: {
|
|
12
|
-
page: mdx,
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
} as ComponentMeta<typeof Loading>;
|
|
16
|
-
|
|
17
|
-
const Template: ComponentStory<typeof Loading> = ({ color }) => {
|
|
18
|
-
return (
|
|
19
|
-
<Flex gap={4}>
|
|
20
|
-
<Loading size={24} color={color} />
|
|
21
|
-
<Loading size={48} color={color} />
|
|
22
|
-
<Loading size={64} color={color} />
|
|
23
|
-
</Flex>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const Multiple = Template.bind({});
|
|
28
|
-
Multiple.args = {
|
|
29
|
-
color: 'red',
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const Playground: ComponentStory<typeof Loading> = args => <Loading {...args} />;
|
|
33
|
-
Playground.storyName = 'Loading';
|
|
34
|
-
Playground.argTypes = {
|
|
35
|
-
size: { control: { type: 'number' }, defaultValue: 24 },
|
|
36
|
-
color: { defaultValue: 'blue' },
|
|
37
|
-
};
|
package/src/Modal/Dialog.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
|
-
## Dialog
|
|
12
|
-
|
|
13
|
-
Dialog 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="dialog--example" />
|
|
@@ -1,68 +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 { Fieldset } from '../Fieldset';
|
|
6
|
-
import { Input } from '../Input';
|
|
7
|
-
import { Label } from '../Label';
|
|
8
|
-
import { Flex } from '../Layout';
|
|
9
|
-
import { Text } from '../Text';
|
|
10
|
-
import { Dialog } from './Dialog';
|
|
11
|
-
import DialogDocs from './Dialog.mdx';
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
title: 'UI Components/Dialog',
|
|
15
|
-
component: Dialog.Root,
|
|
16
|
-
argTypes: { onClick: { action: 'clicked' } },
|
|
17
|
-
parameters: {
|
|
18
|
-
docs: {
|
|
19
|
-
page: DialogDocs,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
} as ComponentMeta<typeof Dialog.Root>;
|
|
23
|
-
|
|
24
|
-
//👇 We create a “template” of how args map to rendering
|
|
25
|
-
const Template: ComponentStory<typeof Dialog.Root> = () => (
|
|
26
|
-
<Dialog.Root css={{ position: 'relative' }}>
|
|
27
|
-
<Dialog.Trigger asChild>
|
|
28
|
-
<Button variant="standard">Open Dialog</Button>
|
|
29
|
-
</Dialog.Trigger>
|
|
30
|
-
<Dialog.Portal>
|
|
31
|
-
<Dialog.Overlay />
|
|
32
|
-
<Dialog.Content>
|
|
33
|
-
<Dialog.Title css={{ c: '$on_surface_high', position: 'relative' }}>
|
|
34
|
-
<Flex direction="row" justify="between" css={{ w: '100%' }}>
|
|
35
|
-
<Flex justify="start" align="center" gap="3">
|
|
36
|
-
<InfoIcon />
|
|
37
|
-
<Text variant="h5">Dialog Heading</Text>
|
|
38
|
-
</Flex>
|
|
39
|
-
<Dialog.DefaultClose css={{ position: 'absolute', top: '-1rem', right: '-1rem' }}>
|
|
40
|
-
<CrossIcon />
|
|
41
|
-
</Dialog.DefaultClose>
|
|
42
|
-
</Flex>
|
|
43
|
-
</Dialog.Title>
|
|
44
|
-
<Text variant="body1" css={{ c: '$on_surface_medium' }}>
|
|
45
|
-
Body 2: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
46
|
-
dolore magna aliqua. Ut enim ad minim veniam,im venitetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
|
47
|
-
labore et dolore magna aliqua. Ut enim ad minim veniam,im veni
|
|
48
|
-
</Text>
|
|
49
|
-
<Fieldset css={{ mt: '$4' }}>
|
|
50
|
-
<Label htmlFor="name">Name</Label>
|
|
51
|
-
<Input id="name" defaultValue="Hardik" css={{ w: '50%' }} />
|
|
52
|
-
</Fieldset>
|
|
53
|
-
<Fieldset>
|
|
54
|
-
<Label htmlFor="username">Username</Label>
|
|
55
|
-
<Input id="username" defaultValue="@hdz666" css={{ w: '50%' }} />
|
|
56
|
-
</Fieldset>
|
|
57
|
-
<Flex css={{ marginTop: 25, justifyContent: 'flex-end' }}>
|
|
58
|
-
<Dialog.Close asChild>
|
|
59
|
-
<Button variant="primary">Save changes</Button>
|
|
60
|
-
</Dialog.Close>
|
|
61
|
-
</Flex>
|
|
62
|
-
</Dialog.Content>
|
|
63
|
-
</Dialog.Portal>
|
|
64
|
-
</Dialog.Root>
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
export const Example = Template.bind({});
|
|
68
|
-
Example.storyName = 'Dialog';
|