@100mslive/roomkit-react 0.4.3-alpha.0 → 0.4.3-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Prebuilt/App.d.ts +1 -0
- package/dist/Prebuilt/AppContext.d.ts +1 -0
- package/dist/index.cjs.css +2 -2
- package/dist/index.cjs.css.map +1 -1
- package/dist/index.cjs.js +79 -11
- package/dist/index.cjs.js.map +3 -3
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/index.js +79 -11
- package/dist/index.js.map +3 -3
- package/dist/meta.cjs.json +22 -17
- package/dist/meta.esbuild.json +22 -17
- package/package.json +8 -20
- package/src/Prebuilt/App.tsx +6 -1
- package/src/Prebuilt/AppContext.tsx +1 -0
- package/src/Prebuilt/layouts/HLSView.jsx +51 -4
- 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,52 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { HangUpIcon } from '@100mslive/react-icons';
|
|
4
|
-
import { Button } from './Button';
|
|
5
|
-
import mdx from './Button.mdx';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'UI Components/Button',
|
|
9
|
-
component: Button,
|
|
10
|
-
argTypes: {
|
|
11
|
-
variant: {
|
|
12
|
-
description: 'Button styled variants',
|
|
13
|
-
},
|
|
14
|
-
outlined: { description: 'Give button an outlined style' },
|
|
15
|
-
icon: { description: 'Give space between children' },
|
|
16
|
-
loading: { description: 'Button is in a loading state' },
|
|
17
|
-
},
|
|
18
|
-
parameters: {
|
|
19
|
-
docs: {
|
|
20
|
-
page: mdx,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
} as ComponentMeta<typeof Button>;
|
|
24
|
-
|
|
25
|
-
export const Primary = () => <Button variant="primary">Hello, World</Button>;
|
|
26
|
-
|
|
27
|
-
export const Standard = () => <Button variant="standard">Hello, World</Button>;
|
|
28
|
-
|
|
29
|
-
export const Danger = () => <Button variant="danger">Hello, World</Button>;
|
|
30
|
-
|
|
31
|
-
export const WithIcon = () => (
|
|
32
|
-
<Button variant="danger" icon>
|
|
33
|
-
<HangUpIcon />
|
|
34
|
-
Leave Room
|
|
35
|
-
</Button>
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
export const Playground: ComponentStory<typeof Button> = args => <Button {...args}>Hello World</Button>;
|
|
39
|
-
|
|
40
|
-
Playground.storyName = 'Button';
|
|
41
|
-
Playground.argTypes = {
|
|
42
|
-
onClick: { action: 'clicked' },
|
|
43
|
-
variant: {
|
|
44
|
-
control: {
|
|
45
|
-
type: 'select',
|
|
46
|
-
options: ['primary', 'standard', 'danger'],
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
outlined: { control: 'boolean' },
|
|
50
|
-
icon: { control: 'boolean' },
|
|
51
|
-
loading: { control: 'boolean' },
|
|
52
|
-
};
|
package/src/Chat/Chat.mdx
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
## Broadcast Message:
|
|
2
|
-
|
|
3
|
-
import { Story } from '@storybook/addon-docs';
|
|
4
|
-
|
|
5
|
-
This will be received by everyone in the room.
|
|
6
|
-
|
|
7
|
-
```js
|
|
8
|
-
hmsActions.sendBroadcastMessage('hello everyone!'); // yes it's that simple 😉
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## MVP component
|
|
12
|
-
|
|
13
|
-
```jsx
|
|
14
|
-
const ChatExample = () => {
|
|
15
|
-
const chats = useHMSStore(selectHMSMessages);
|
|
16
|
-
const actions = useHMSActions();
|
|
17
|
-
const [input, setInput] = useState('');
|
|
18
|
-
const sendMessage = (e: React.FormEvent) => {
|
|
19
|
-
e.preventDefault();
|
|
20
|
-
actions.sendBroadcastMessage(input);
|
|
21
|
-
setInput('');
|
|
22
|
-
};
|
|
23
|
-
return (
|
|
24
|
-
<div>
|
|
25
|
-
{chats.map(c => (
|
|
26
|
-
<div>{c.message}</div>
|
|
27
|
-
))}
|
|
28
|
-
<form onSubmit={sendMessage}>
|
|
29
|
-
<input value={input} onChange={e => setInput(e.target.value)} type="text" />
|
|
30
|
-
<button type="submit">Send</button>
|
|
31
|
-
</form>
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
34
|
-
};
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### Demo
|
|
38
|
-
|
|
39
|
-
<Story id="chat-broadcast-message--chat-story-example" />
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { selectHMSMessages, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
|
|
3
|
-
import ChatDocs from './Chat.mdx';
|
|
4
|
-
|
|
5
|
-
const ChatStories = {
|
|
6
|
-
title: 'Chat/Broadcast Message',
|
|
7
|
-
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
8
|
-
parameters: {
|
|
9
|
-
docs: {
|
|
10
|
-
page: ChatDocs,
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default ChatStories;
|
|
16
|
-
|
|
17
|
-
const ChatExample = () => {
|
|
18
|
-
const chats = useHMSStore(selectHMSMessages);
|
|
19
|
-
const actions = useHMSActions();
|
|
20
|
-
const [input, setInput] = useState('');
|
|
21
|
-
const sendMessage = (e: React.FormEvent) => {
|
|
22
|
-
e.preventDefault();
|
|
23
|
-
actions.sendBroadcastMessage(input);
|
|
24
|
-
setInput('');
|
|
25
|
-
};
|
|
26
|
-
return (
|
|
27
|
-
<div>
|
|
28
|
-
{chats.map(c => (
|
|
29
|
-
<div>{c.message}</div>
|
|
30
|
-
))}
|
|
31
|
-
<form onSubmit={sendMessage}>
|
|
32
|
-
<input value={input} onChange={e => setInput(e.target.value)} type="text" />
|
|
33
|
-
<button type="submit">Send</button>
|
|
34
|
-
</form>
|
|
35
|
-
</div>
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const ChatStoryExample = ChatExample.bind({});
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { CheckIcon } from '@100mslive/react-icons';
|
|
4
|
-
import { Label } from '../Label';
|
|
5
|
-
import { Flex } from '../Layout';
|
|
6
|
-
import { Checkbox } from '.';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: 'UI Components/Checkbox',
|
|
10
|
-
component: CheckboxWithLabelComponent,
|
|
11
|
-
argTypes: {
|
|
12
|
-
onCheckedChange: { action: { type: 'clicked' } },
|
|
13
|
-
checked: { control: { type: 'boolean' } },
|
|
14
|
-
label: { control: { type: 'text' } },
|
|
15
|
-
css: { control: { type: 'object' } },
|
|
16
|
-
},
|
|
17
|
-
args: {
|
|
18
|
-
checked: true,
|
|
19
|
-
label: 'Label',
|
|
20
|
-
},
|
|
21
|
-
} as ComponentMeta<typeof CheckboxWithLabelComponent>;
|
|
22
|
-
|
|
23
|
-
type CheckboxWithLabelComponentProps = {
|
|
24
|
-
label?: string;
|
|
25
|
-
checked?: boolean;
|
|
26
|
-
} & React.ComponentProps<typeof Checkbox.Root>;
|
|
27
|
-
|
|
28
|
-
function CheckboxWithLabelComponent({ label, checked = true, css, onCheckedChange }: CheckboxWithLabelComponentProps) {
|
|
29
|
-
const [internalChecked, setInternalChecked] = useState(checked);
|
|
30
|
-
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
handleOnCheckedChange(checked);
|
|
33
|
-
}, [checked]); //eslint-disable-line
|
|
34
|
-
|
|
35
|
-
function handleOnCheckedChange(checked: boolean) {
|
|
36
|
-
setInternalChecked(checked);
|
|
37
|
-
if (onCheckedChange) {
|
|
38
|
-
onCheckedChange(checked);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<Flex align="center">
|
|
44
|
-
<Checkbox.Root id={label} checked={internalChecked} css={css} onCheckedChange={handleOnCheckedChange}>
|
|
45
|
-
<Checkbox.Indicator css={{ display: 'flex' }}>
|
|
46
|
-
<CheckIcon width={16} height={16} />
|
|
47
|
-
</Checkbox.Indicator>
|
|
48
|
-
</Checkbox.Root>
|
|
49
|
-
<Label htmlFor={label} css={{ ml: '$4', fontSize: '$sm', cursor: 'pointer' }}>
|
|
50
|
-
{label}
|
|
51
|
-
</Label>
|
|
52
|
-
</Flex>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const CheckboxWithLabelStory: ComponentStory<typeof CheckboxWithLabelComponent> = args => {
|
|
57
|
-
return <CheckboxWithLabelComponent {...args} />;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const Example = CheckboxWithLabelStory.bind({});
|
|
61
|
-
Example.storyName = 'Checkbox';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { Flex } from '../Layout';
|
|
4
|
-
import { Text } from '../Text';
|
|
5
|
-
import { HorizontalDivider } from '.';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'UI Components/Divider',
|
|
9
|
-
component: HorizontalDivider,
|
|
10
|
-
argTypes: {
|
|
11
|
-
ref: { table: { disable: true } },
|
|
12
|
-
as: { table: { disable: true } },
|
|
13
|
-
css: { control: { type: 'object' } },
|
|
14
|
-
space: { defaultValue: 1, control: { type: 'number', min: 1, max: 4 } },
|
|
15
|
-
},
|
|
16
|
-
} as ComponentMeta<typeof HorizontalDivider>;
|
|
17
|
-
|
|
18
|
-
const HorizontalDividerComponent: ComponentStory<typeof HorizontalDivider> = ({ space, css }) => {
|
|
19
|
-
return (
|
|
20
|
-
<Flex align="center" direction="column" css={{ width: 'max-content', bg: '$surface_bright', p: '$8', r: '$4' }}>
|
|
21
|
-
<ul style={{ listStyle: 'none', padding: '0px', margin: '0px', textAlign: 'center' }}>
|
|
22
|
-
<Text as="li">Item 1</Text>
|
|
23
|
-
<Text as="li">Item 2</Text>
|
|
24
|
-
<Text as="li">Item 3</Text>
|
|
25
|
-
<HorizontalDivider space={space} css={{ bg: '$on_primary_medium', width: '80px', ...css }} />
|
|
26
|
-
<Text as="li">Item 4</Text>
|
|
27
|
-
<Text as="li">Item 5</Text>
|
|
28
|
-
<Text as="li">Item 6</Text>
|
|
29
|
-
</ul>
|
|
30
|
-
</Flex>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const Horizontal = HorizontalDividerComponent.bind({});
|
|
@@ -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)
|