@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.
Files changed (69) hide show
  1. package/dist/Prebuilt/App.d.ts +1 -0
  2. package/dist/Prebuilt/AppContext.d.ts +1 -0
  3. package/dist/index.cjs.css +2 -2
  4. package/dist/index.cjs.css.map +1 -1
  5. package/dist/index.cjs.js +79 -11
  6. package/dist/index.cjs.js.map +3 -3
  7. package/dist/index.css +2 -2
  8. package/dist/index.css.map +1 -1
  9. package/dist/index.js +79 -11
  10. package/dist/index.js.map +3 -3
  11. package/dist/meta.cjs.json +22 -17
  12. package/dist/meta.esbuild.json +22 -17
  13. package/package.json +8 -20
  14. package/src/Prebuilt/App.tsx +6 -1
  15. package/src/Prebuilt/AppContext.tsx +1 -0
  16. package/src/Prebuilt/layouts/HLSView.jsx +51 -4
  17. package/src/Accordion/Accordion.stories.tsx +0 -50
  18. package/src/Avatar/Avatar.stories.tsx +0 -33
  19. package/src/Button/Button.mdx +0 -43
  20. package/src/Button/Button.stories.tsx +0 -52
  21. package/src/Chat/Chat.mdx +0 -39
  22. package/src/Chat/Chat.stories.tsx +0 -39
  23. package/src/Checkbox/Checkbox.stories.tsx +0 -61
  24. package/src/Divider/HorizontalDivider.stories.tsx +0 -34
  25. package/src/Divider/VerticalDivider.stories.tsx +0 -40
  26. package/src/Dropdown/Dropdown.stories.tsx +0 -94
  27. package/src/Fieldset/Fieldset.stories.tsx +0 -29
  28. package/src/Footer/Footer.stories.tsx +0 -61
  29. package/src/Icons/Icons.stories.mdx +0 -10
  30. package/src/Icons/IconsList.jsx +0 -17
  31. package/src/Input/Input.stories.tsx +0 -25
  32. package/src/Input/PasswordInput.stories.tsx +0 -53
  33. package/src/Introduction/Integrating.stories.mdx +0 -100
  34. package/src/Introduction/Introduction.stories.mdx +0 -9
  35. package/src/Link/Link.stories.tsx +0 -18
  36. package/src/Loading/Loading.mdx +0 -15
  37. package/src/Loading/Loading.stories.tsx +0 -37
  38. package/src/Modal/Dialog.mdx +0 -19
  39. package/src/Modal/Dialog.stories.tsx +0 -68
  40. package/src/Pagination/StyledPagination.stories.tsx +0 -80
  41. package/src/Popover/Popover.mdx +0 -9
  42. package/src/Popover/Popover.stories.tsx +0 -95
  43. package/src/Prebuilt/Prebuilt.stories.tsx +0 -46
  44. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.stories.tsx +0 -40
  45. package/src/QRCode/QRCode.mdx +0 -9
  46. package/src/QRCode/QRCode.stories.tsx +0 -29
  47. package/src/RadioGroup/RadioGroup.stories.tsx +0 -32
  48. package/src/ReactSelect/ReactSelect.stories.tsx +0 -83
  49. package/src/Select/Select.stories.tsx +0 -33
  50. package/src/Sheet/Sheet.mdx +0 -19
  51. package/src/Sheet/Sheet.stories.tsx +0 -103
  52. package/src/Slider/Slider.stories.tsx +0 -21
  53. package/src/Switch/Switch.mdx +0 -11
  54. package/src/Switch/Switch.stories.tsx +0 -46
  55. package/src/Tabs/Tabs.stories.tsx +0 -77
  56. package/src/Text/Text.stories.tsx +0 -21
  57. package/src/Theme/Theme.stories.mdx +0 -8
  58. package/src/Theme/ThemeStory.jsx +0 -56
  59. package/src/Toast/AppToast.stories.tsx +0 -56
  60. package/src/Toast/Toast.mdx +0 -19
  61. package/src/Toast/Toast.stories.tsx +0 -57
  62. package/src/Tooltip/Tooltip.stories.tsx +0 -62
  63. package/src/Video/UseVideo.mdx +0 -22
  64. package/src/Video/UseVideo.stories.tsx +0 -26
  65. package/src/Video/Video.mdx +0 -24
  66. package/src/Video/Video.stories.tsx +0 -27
  67. package/src/VideoList/VideoList.stories.tsx +0 -92
  68. package/src/VideoTile/VideoTile.mdx +0 -28
  69. package/src/VideoTile/VideoTile.stories.tsx +0 -32
@@ -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';
@@ -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
- };
@@ -1,77 +0,0 @@
1
- import React, { useCallback, useEffect, useState } from 'react';
2
- import { ComponentMeta, ComponentStory } from '@storybook/react';
3
- import { Box } from '../Layout';
4
- import { Text } from '../Text';
5
- import { Tabs } from '.';
6
-
7
- export default {
8
- title: 'UI Components/Tabs',
9
- component: Tabs.Root,
10
- argTypes: {
11
- value: { control: { type: 'text' }, defaultValue: 'tab1' },
12
- onValueChange: { action: { type: 'click' } },
13
- orientation: { options: ['horizontal', 'vertical'], defaultValue: 'horizontal', control: { type: 'select' } },
14
- },
15
- } as ComponentMeta<typeof Tabs.Root>;
16
-
17
- const Template: ComponentStory<typeof Tabs.Root> = ({
18
- value: propValue = '',
19
- onValueChange: propOnValueChange,
20
- ...rest
21
- }) => {
22
- const [value, setValue] = useState('tab1');
23
-
24
- const handleOnValueChange = useCallback(
25
- (value: string) => {
26
- setValue(value);
27
- if (propOnValueChange) {
28
- propOnValueChange(value);
29
- }
30
- },
31
- [propOnValueChange],
32
- );
33
-
34
- useEffect(() => {
35
- handleOnValueChange(propValue);
36
- if (propOnValueChange) {
37
- propOnValueChange(value);
38
- }
39
- }, [handleOnValueChange, propOnValueChange, propValue, value]);
40
-
41
- return (
42
- <Tabs.Root
43
- css={{
44
- gap: '8px',
45
- maxWidth: '500px',
46
- width: 'max-content',
47
- '&[data-orientation="horizontal"]': { flexDirection: 'column' },
48
- }}
49
- value={value}
50
- onValueChange={handleOnValueChange}
51
- {...rest}
52
- >
53
- <Tabs.List
54
- aria-label="tabs example"
55
- css={{ bg: '$background_dim', r: '$1', '&[data-orientation="vertical"]': { flexDirection: 'column' } }}
56
- >
57
- <Tabs.Trigger value="tab1">One</Tabs.Trigger>
58
- <Tabs.Trigger value="tab2">Two</Tabs.Trigger>
59
- <Tabs.Trigger value="tab3">Three</Tabs.Trigger>
60
- </Tabs.List>
61
- <Box css={{ r: '$1', bg: '$surface_brighter' }}>
62
- <Tabs.Content value="tab1">
63
- <Text>Tab one content</Text>
64
- </Tabs.Content>
65
- <Tabs.Content value="tab2">
66
- <Text>Tab two content</Text>
67
- </Tabs.Content>
68
- <Tabs.Content value="tab3">
69
- <Text>Tab three content</Text>
70
- </Tabs.Content>
71
- </Box>
72
- </Tabs.Root>
73
- );
74
- };
75
-
76
- export const Example = Template.bind({});
77
- Example.storyName = 'Tabs';
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import { ComponentMeta, ComponentStory } from '@storybook/react';
3
- import { Text, textVariants } from './Text';
4
-
5
- export default {
6
- title: 'UI Components/Text',
7
- component: Text,
8
- argTypes: {
9
- variant: {
10
- control: {
11
- type: 'select',
12
- options: Object.keys(textVariants),
13
- },
14
- },
15
- },
16
- } as ComponentMeta<typeof Text>;
17
-
18
- const Template: ComponentStory<typeof Text> = args => <Text {...args}>The Evil Rabbit jumps.</Text>;
19
-
20
- export const Playground = Template.bind({});
21
- Playground.storyName = 'Text';
@@ -1,8 +0,0 @@
1
- import { Meta } from '@storybook/addon-docs';
2
- import ThemeStory from './ThemeStory';
3
-
4
- <Meta title="Theme" />
5
-
6
- ## Theme
7
-
8
- <ThemeStory />
@@ -1,56 +0,0 @@
1
- import React from 'react';
2
- import { ColorItem, ColorPalette } from '@storybook/addon-docs';
3
-
4
- const ThemeStory = () => {
5
- return (
6
- <ColorPalette>
7
- <ColorItem
8
- title="theme.color.brand"
9
- subtitle="Brand Variants"
10
- colors={{ brandLight: '#74AAFF', primary_default: '#2F80FF', brandDark: '#0B326F', brandDisabled: '#D8E7FF' }}
11
- />
12
- <ColorItem
13
- title="theme.color.text"
14
- subtitle="Text Variants"
15
- colors={{
16
- on_surface_high: 'rgba(250, 252, 255, 0.9)',
17
- on_surface_medium: 'rgba(215, 227, 245, 0.8)',
18
- on_surface_low: 'rgba(164, 176, 193, 0.5)',
19
- }}
20
- />
21
- <ColorItem
22
- title="theme.color.surface"
23
- subtitle="Surface Variants"
24
- colors={{
25
- surface_dimmer: '#06080A',
26
- surface_dim: '#080B0F',
27
- surface_default: '#0B0F15',
28
- surface_bright: '#12161C',
29
- surface_brighter: '#1F2228',
30
- }}
31
- />
32
- <ColorItem
33
- title="theme.color.primary"
34
- subtitle="Primary Variants"
35
- colors={{
36
- primary_bright: '#6DA6FF',
37
- primary_default: '#2F80FF',
38
- primary_dim: '#184080',
39
- primary_disabled: '#D8E7FF',
40
- }}
41
- />
42
- <ColorItem
43
- title="theme.color.secondary"
44
- subtitle="Secondary Variants"
45
- colors={{
46
- secondary_bright: '#505863',
47
- secondary_default: '#657080',
48
- secondary_dim: '#1E2329',
49
- secondary_disabled: '#DCE4EF',
50
- }}
51
- />
52
- </ColorPalette>
53
- );
54
- };
55
-
56
- export default ThemeStory;
@@ -1,56 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { ComponentStory } from '@storybook/react';
3
- import { Button } from '../Button';
4
- import { Toast } from './Toast';
5
- import mdx from './Toast.mdx';
6
-
7
- const ReactToastStory = ({ ...props }) => {
8
- return (
9
- <Toast.Provider>
10
- <ReactToastComponent {...props} />
11
- </Toast.Provider>
12
- );
13
- };
14
-
15
- const ToastMeta = {
16
- title: 'UI Components/Toast',
17
- component: ReactToastStory,
18
- argTypes: {
19
- onClick: { action: 'clicked' },
20
- open: { control: 'boolean' },
21
- variant: { control: 'select', options: ['error', 'standard', 'warning', 'success', ''] },
22
- },
23
- args: {
24
- variant: 'standard',
25
- title: 'Hello from Toast Component',
26
- description: 'Hello from toast',
27
- isClosable: true,
28
- },
29
- parameters: {
30
- docs: {
31
- page: mdx,
32
- },
33
- },
34
- };
35
-
36
- const ReactToastComponent: ComponentStory<typeof ReactToastStory> = args => {
37
- const [isOpen, setIsOpen] = useState(false);
38
- return (
39
- <>
40
- <Button onClick={() => setIsOpen(!isOpen)}>{isOpen ? 'Close' : 'Launch'} Toast</Button>
41
- <Toast.HMSToast
42
- title="This is a title"
43
- description="This is a toast using the HMSToast component."
44
- open={isOpen}
45
- isClosable={true}
46
- onOpenChange={o => setIsOpen(o)}
47
- {...args}
48
- />
49
- <Toast.Viewport css={{ bottom: '$24' }} />
50
- </>
51
- );
52
- };
53
-
54
- export const Playground: ComponentStory<typeof ReactToastStory> = ReactToastStory.bind({});
55
- Playground.storyName = 'HMSToast';
56
- export default ToastMeta;
@@ -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,57 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { ComponentStory } from '@storybook/react';
3
- import { Button } from '../Button';
4
- import { Flex } from '../Layout';
5
- import { Text } from '../Text';
6
- import { Toast } from './Toast';
7
- import ToastDocs from './Toast.mdx';
8
-
9
- const ToastStory = ({ ...props }) => {
10
- return (
11
- <Toast.Provider>
12
- <ToastComponent {...props} />
13
- </Toast.Provider>
14
- );
15
- };
16
-
17
- const ToastMeta = {
18
- title: 'UI Components/Toast',
19
- component: ToastStory,
20
- argTypes: {
21
- onClick: { action: 'clicked' },
22
- icon: { control: 'boolean' },
23
- },
24
- parameters: {
25
- docs: {
26
- page: ToastDocs,
27
- },
28
- },
29
- };
30
-
31
- const ToastComponent = ({ ...props }) => {
32
- const [isOpen, setIsOpen] = useState(false);
33
- return (
34
- <>
35
- <Button onClick={() => setIsOpen(!isOpen)}>{isOpen ? 'Close' : 'Launch'} Toast</Button>
36
- <Toast.Root open={isOpen} onOpenChange={o => setIsOpen(o)} {...props}>
37
- <Toast.Title asChild>
38
- <Flex align="center" css={{ gap: '$4', flex: '1 1 0', minWidth: 0 }}>
39
- <Text variant="sub1" css={{ c: 'inherit', wordBreak: 'break-word' }}>
40
- Hello from toast.
41
- </Text>
42
- <Toast.Close />
43
- </Flex>
44
- </Toast.Title>
45
- <Toast.Description>
46
- This is a custom toast component using primitives with controlled open and close state using React state.
47
- </Toast.Description>
48
- </Toast.Root>
49
- <Toast.Viewport css={{ bottom: '$24' }} />
50
- </>
51
- );
52
- };
53
- export const Example: ComponentStory<typeof ToastStory> = ToastStory.bind({});
54
-
55
- Example.storyName = 'Toast';
56
-
57
- export default ToastMeta;
@@ -1,62 +0,0 @@
1
- import React from 'react';
2
- import { ComponentMeta } from '@storybook/react';
3
- import { Flex } from '../Layout';
4
- import { Text } from '../Text';
5
- import { alignTooltip, sideTooltip, Tooltip } from './Tooltip';
6
-
7
- export default {
8
- title: 'UI Components/Tooltip',
9
- argTypes: {
10
- outlined: { control: 'boolean' },
11
- side: { control: 'radio' },
12
- align: { control: 'radio' },
13
- },
14
- args: {
15
- outlined: false,
16
- side: 'bottom',
17
- align: 'center',
18
- },
19
- component: Tooltip,
20
- } as ComponentMeta<typeof Tooltip>;
21
-
22
- const TooltipStoryWithString = (
23
- args: JSX.IntrinsicAttributes & {
24
- title?: React.ReactNode;
25
- outlined?: boolean | undefined;
26
- side?: sideTooltip;
27
- align?: alignTooltip;
28
- } & { children?: React.ReactNode },
29
- ) => {
30
- return (
31
- <Flex justify="center" align="center" css={{ w: 800, h: 200 }}>
32
- <Tooltip title="This is title" {...args}>
33
- <Text>Hover to see Tooltip</Text>
34
- </Tooltip>
35
- </Flex>
36
- );
37
- };
38
-
39
- export const ExampleWithString = TooltipStoryWithString.bind({});
40
-
41
- const ExampleTitle = () => {
42
- return <h3 style={{ color: '$on_primary_high' }}>This is title</h3>;
43
- };
44
-
45
- const TooltipStorywithReactNode = (
46
- args: JSX.IntrinsicAttributes & {
47
- title?: React.ReactNode;
48
- outlined?: boolean | undefined;
49
- side?: sideTooltip;
50
- align?: alignTooltip;
51
- } & { children?: React.ReactNode },
52
- ) => {
53
- return (
54
- <Flex justify="center" align="center" css={{ w: 800, h: 200 }}>
55
- <Tooltip title={<ExampleTitle />} {...args}>
56
- <Text>Hover to see tooltip</Text>
57
- </Tooltip>
58
- </Flex>
59
- );
60
- };
61
-
62
- export const ExampleWithReactNode = TooltipStorywithReactNode.bind({});
@@ -1,22 +0,0 @@
1
- ## useVideo
2
-
3
- For each peer, we’ll render a `<video>` element and a `<div>` element with their name.
4
- To render the video, we need to call attachVideo method of hmsActions, which accepts a trackId and a DOM element.
5
- But we have abstracted this implementation inside useVideo hook for ease. This hook will return an object `videoRef` given a video `trackId`. The returned `videoRef` can be used to set on a video element meant to display the video. The hook will take care of attaching and detaching video, and will automatically detach when the video goes out of view to save on bandwidth.
6
-
7
- import { Story } from '@storybook/addon-docs';
8
-
9
- ```jsx
10
- import { useVideo } from ‘@100mslive/react-sdk’;
11
- function Peer({ peer }) {
12
- const { videoRef } = useVideo({
13
- trackId: peer.videoTrack,
14
- });
15
- return <video ref={videoRef} autoPlay muted playsInline />;
16
- }
17
- export default Peer;
18
- ```
19
-
20
- > Note that `height` and `width` CSS properties need to be set on the `<video>` element to render the peer's video.
21
-
22
- <Story id="rendering-video-video-component--video-example" />
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- import { useVideo } from '@100mslive/react-sdk';
3
- import UseVideoDocs from './UseVideo.mdx';
4
- import { StyledVideo } from './Video';
5
-
6
- const VideoHook = () => {
7
- const { videoRef } = useVideo({
8
- trackId: '1',
9
- });
10
- return <StyledVideo ref={videoRef} autoPlay playsInline muted />;
11
- };
12
-
13
- const VideoStories = {
14
- title: 'Rendering Video/useVideo hook',
15
- component: VideoHook,
16
- // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
17
- parameters: {
18
- docs: {
19
- page: UseVideoDocs,
20
- },
21
- },
22
- };
23
-
24
- export default VideoStories;
25
-
26
- export const UseVideoHook = VideoHook.bind({});
@@ -1,24 +0,0 @@
1
- ## `<Video />` component
2
-
3
- You can directly use `<Video />` all it needs is `trackId` to render the video. This is a headless component to style it you can pass only valid css styles and className.
4
-
5
- ```jsx
6
- import { useVideo } from '@100mslive/react-sdk';
7
- import { Video } from '../';
8
-
9
- const VideoComponent = () => {
10
- return <Video trackId="2" />;
11
- };
12
- ```
13
-
14
- ## Styled Video component
15
-
16
- We use Stitches as our styling solution which provides a `css` prop for overriding styles easily. It’s like the style attribute, but it supports tokens, media queries, nesting and token-aware values.
17
-
18
- Here's an example:
19
-
20
- ```jsx
21
- const StyledVideoComponent = () => {
22
- return <Video css={{ width: 500, height: 300 }} trackId="2" />;
23
- };
24
- ```
@@ -1,27 +0,0 @@
1
- import React from 'react';
2
- import { Video } from './Video';
3
- import VideoDocs from './Video.mdx';
4
-
5
- const VideoComponent = () => {
6
- return <Video trackId="2" />;
7
- };
8
-
9
- const StyledVideoComponent = () => {
10
- return <Video css={{ width: 500, height: 300 }} trackId="2" />;
11
- };
12
-
13
- const VideoStories = {
14
- title: 'Rendering Video/Video Component',
15
- component: VideoComponent,
16
- // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
17
- parameters: {
18
- docs: {
19
- page: VideoDocs,
20
- },
21
- },
22
- };
23
-
24
- export default VideoStories;
25
-
26
- export const VideoExample = VideoComponent.bind({});
27
- export const StyledVideoExample = StyledVideoComponent.bind({});