@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,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({});
@@ -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
- };
@@ -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';
@@ -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';
@@ -1,9 +0,0 @@
1
- ## Popover
2
-
3
- Displays rich content in a portal, triggered by a button.
4
-
5
- - [Example](#example)
6
-
7
- ### Example
8
-
9
- <Story id="button--example" />
@@ -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
- };
@@ -1,9 +0,0 @@
1
- ## QRCode
2
-
3
- QRCode component displays a scannable QR code for the given value.
4
-
5
- ## Usage
6
-
7
- ```jsx
8
- <QRCode value="pass any string here" />
9
- ```
@@ -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';
@@ -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" />