@100mslive/roomkit-react 0.3.10-alpha.0 → 0.3.10-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.
Files changed (34) hide show
  1. package/dist/{HLSView-5GXP76IN.js → HLSView-524T6OTY.js} +2 -2
  2. package/dist/{HLSView-FBGVUTA5.css → HLSView-VL3DXGRO.css} +3 -3
  3. package/dist/{HLSView-FBGVUTA5.css.map → HLSView-VL3DXGRO.css.map} +1 -1
  4. package/dist/Prebuilt/common/constants.d.ts +1 -0
  5. package/dist/Prebuilt/components/AppData/useSidepaneResetOnLayoutUpdate.d.ts +3 -0
  6. package/dist/Prebuilt/components/Chat/Chat.d.ts +1 -1
  7. package/dist/Prebuilt/components/RoleChangeModal.d.ts +5 -0
  8. package/dist/Prebuilt/components/TileMenu/TileMenuContent.d.ts +2 -1
  9. package/dist/{chunk-WSDBUVSZ.js → chunk-IOHV3H2B.js} +602 -561
  10. package/dist/chunk-IOHV3H2B.js.map +7 -0
  11. package/dist/index.cjs.css +2 -2
  12. package/dist/index.cjs.css.map +1 -1
  13. package/dist/index.cjs.js +1943 -1892
  14. package/dist/index.cjs.js.map +4 -4
  15. package/dist/index.css +2 -2
  16. package/dist/index.css.map +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/meta.cjs.json +130 -56
  19. package/dist/meta.esbuild.json +141 -67
  20. package/package.json +7 -7
  21. package/src/Modal/DialogContent.tsx +1 -1
  22. package/src/Prebuilt/common/constants.ts +2 -0
  23. package/src/Prebuilt/components/AppData/useSidepaneResetOnLayoutUpdate.tsx +22 -0
  24. package/src/Prebuilt/components/AudioVideoToggle.tsx +1 -1
  25. package/src/Prebuilt/components/Chat/Chat.tsx +3 -4
  26. package/src/Prebuilt/components/Footer/ParticipantList.tsx +56 -37
  27. package/src/Prebuilt/components/RoleChangeModal.tsx +187 -0
  28. package/src/Prebuilt/components/TileMenu/TileMenu.tsx +5 -0
  29. package/src/Prebuilt/components/TileMenu/TileMenuContent.tsx +23 -1
  30. package/src/Prebuilt/components/VirtualBackground/VBPicker.tsx +3 -0
  31. package/src/Prebuilt/layouts/SidePane.tsx +9 -9
  32. package/dist/chunk-WSDBUVSZ.js.map +0 -7
  33. package/src/Prebuilt/components/RoleChangeModal.jsx +0 -185
  34. /package/dist/{HLSView-5GXP76IN.js.map → HLSView-524T6OTY.js.map} +0 -0
@@ -1,185 +0,0 @@
1
- import React, { forwardRef, useRef, useState } from 'react';
2
- import { selectPeerByID, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
3
- import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from '@100mslive/react-icons';
4
- import { Button } from '../../Button';
5
- import { Checkbox } from '../../Checkbox';
6
- import { Dropdown } from '../../Dropdown';
7
- import { Label } from '../../Label';
8
- import { Box, Flex } from '../../Layout';
9
- import { Dialog } from '../../Modal';
10
- import { Text } from '../../Text';
11
- import { Tooltip } from '../../Tooltip';
12
- import { useDropdownSelection } from './hooks/useDropdownSelection';
13
- import { useFilteredRoles } from '../common/hooks';
14
- import { textEllipsis } from '../../utils';
15
-
16
- const PeerName = forwardRef(({ children, maxWidth, ...rest }, ref) => (
17
- <Text
18
- {...rest}
19
- ref={ref}
20
- as="strong"
21
- variant="body2"
22
- css={{
23
- ...textEllipsis(maxWidth),
24
- display: 'inline-block',
25
- fontWeight: '$semiBold',
26
- c: 'inherit',
27
- }}
28
- >
29
- {children}
30
- </Text>
31
- ));
32
-
33
- export const RoleChangeModal = ({ peerId, onOpenChange }) => {
34
- const peer = useHMSStore(selectPeerByID(peerId));
35
- const roles = useFilteredRoles();
36
- const [selectedRole, setRole] = useState(peer?.roleName);
37
- const [requestPermission, setRequestPermission] = useState(true);
38
- const hmsActions = useHMSActions();
39
- const [open, setOpen] = useState(false);
40
- const selectionBg = useDropdownSelection();
41
- const [peerNameRef, setPeerNameRef] = useState();
42
- const ref = useRef();
43
- if (!peer) {
44
- return null;
45
- }
46
-
47
- const peerNameMaxWidth = 200;
48
- return (
49
- <Dialog.Root defaultOpen onOpenChange={onOpenChange}>
50
- <Dialog.Portal>
51
- <Dialog.Overlay />
52
- <Dialog.Content css={{ width: 'min(400px,80%)', p: '$10' }}>
53
- <Dialog.Title css={{ p: 0 }} asChild>
54
- <Text as="h6" variant="h6">
55
- Change Role
56
- </Text>
57
- </Dialog.Title>
58
- <Dialog.Description asChild>
59
- <Text
60
- variant="body2"
61
- css={{
62
- mt: '$4',
63
- mb: '$8',
64
- c: '$on_surface_medium',
65
- display: 'flex',
66
- flexWrap: 'wrap',
67
- columnGap: '4px',
68
- }}
69
- >
70
- Change the role of
71
- {peerNameRef && peerNameRef.clientWidth === peerNameMaxWidth ? (
72
- <Tooltip title={peer.name} side="top">
73
- <PeerName ref={setPeerNameRef} maxWidth={peerNameMaxWidth}>
74
- {peer.name}
75
- </PeerName>
76
- </Tooltip>
77
- ) : (
78
- <PeerName ref={setPeerNameRef} maxWidth={peerNameMaxWidth}>
79
- {peer.name}
80
- </PeerName>
81
- )}
82
- to
83
- </Text>
84
- </Dialog.Description>
85
- <Flex
86
- align="center"
87
- css={{
88
- w: '100%',
89
- mb: '$10',
90
- }}
91
- >
92
- <Box
93
- css={{
94
- position: 'relative',
95
- flex: '1 1 0',
96
- minWidth: 0,
97
- }}
98
- >
99
- <Dropdown.Root open={open} onOpenChange={setOpen} css={{ width: '100%' }}>
100
- <Dropdown.Trigger
101
- data-testid="open_role_selection_dropdown"
102
- asChild
103
- css={{
104
- border: '1px solid $border_bright',
105
- bg: '$surface_bright',
106
- r: '$1',
107
- p: '$6 $9',
108
- }}
109
- ref={ref}
110
- >
111
- <Flex align="center" justify="between" css={{ width: '100%' }}>
112
- <Text>{selectedRole}</Text>
113
- {open ? <ChevronUpIcon /> : <ChevronDownIcon />}
114
- </Flex>
115
- </Dropdown.Trigger>
116
- <Dropdown.Portal>
117
- <Dropdown.Content
118
- align="start"
119
- sideOffset={8}
120
- css={{ zIndex: 1000, width: ref.current?.clientWidth }}
121
- >
122
- {roles.map(role => {
123
- return (
124
- <Dropdown.Item
125
- data-testid={role}
126
- key={role}
127
- onSelect={() => setRole(role)}
128
- css={{
129
- px: '$9',
130
- bg: role === selectedRole ? selectionBg : undefined,
131
- }}
132
- >
133
- {role}
134
- </Dropdown.Item>
135
- );
136
- })}
137
- </Dropdown.Content>
138
- </Dropdown.Portal>
139
- </Dropdown.Root>
140
- </Box>
141
- </Flex>
142
- {!peer.isLocal && (
143
- <Flex justify="between" css={{ w: '100%', mb: '$10' }}>
144
- <Label htmlFor="requestRoleChangePermission" css={{ cursor: 'pointer' }}>
145
- Request Permission
146
- </Label>
147
- <Checkbox.Root
148
- checked={requestPermission}
149
- onCheckedChange={value => setRequestPermission(value)}
150
- id="requestRoleChangePermission"
151
- data-testid="force_role_change_checkbox"
152
- >
153
- <Checkbox.Indicator>
154
- <CheckIcon width={16} height={16} />
155
- </Checkbox.Indicator>
156
- </Checkbox.Root>
157
- </Flex>
158
- )}
159
- <Flex justify="center" align="center" css={{ width: '100%', gap: '$md' }}>
160
- <Box css={{ width: '50%' }}>
161
- <Dialog.Close css={{ width: '100%', p: '$4 $8' }} asChild>
162
- <Button variant="standard" outlined css={{ width: '100%' }} data-testid="cancel_button">
163
- Cancel
164
- </Button>
165
- </Dialog.Close>
166
- </Box>
167
- <Box css={{ width: '50%' }}>
168
- <Button
169
- data-testid="change_button"
170
- variant="primary"
171
- css={{ width: '100%' }}
172
- onClick={async () => {
173
- await hmsActions.changeRoleOfPeer(peerId, selectedRole, peer.isLocal ? true : !requestPermission);
174
- onOpenChange(false);
175
- }}
176
- >
177
- Change
178
- </Button>
179
- </Box>
180
- </Flex>
181
- </Dialog.Content>
182
- </Dialog.Portal>
183
- </Dialog.Root>
184
- );
185
- };