@dxos/react-ui 0.1.24-next.6b1f434 → 0.1.25
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/lib/browser/index.mjs +452 -1084
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/IdentityList/IdentityListItem.d.ts +1 -2
- package/dist/types/src/components/IdentityList/IdentityListItem.d.ts.map +1 -1
- package/dist/types/src/components/IdentityList/IdentityListItem.stories.d.ts +1 -2
- package/dist/types/src/components/IdentityList/IdentityListItem.stories.d.ts.map +1 -1
- package/dist/types/src/components/IdentityList/SpaceMemberList.d.ts +2 -3
- package/dist/types/src/components/IdentityList/SpaceMemberList.d.ts.map +1 -1
- package/dist/types/src/components/IdentityList/SpaceMemberListContainer.d.ts +1 -3
- package/dist/types/src/components/IdentityList/SpaceMemberListContainer.d.ts.map +1 -1
- package/dist/types/src/components/IdentityList/index.d.ts +0 -1
- package/dist/types/src/components/IdentityList/index.d.ts.map +1 -1
- package/dist/types/src/components/InvitationList/InvitationList.d.ts.map +1 -1
- package/dist/types/src/components/InvitationList/InvitationListItem.d.ts.map +1 -1
- package/dist/types/src/components/InvitationList/InvitationStatusAvatar.d.ts +1 -6
- package/dist/types/src/components/InvitationList/InvitationStatusAvatar.d.ts.map +1 -1
- package/dist/types/src/components/InvitationList/InvitationStatusAvatar.stories.d.ts +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/composites/JoinDialog/JoinDialog.d.ts +1 -1
- package/dist/types/src/composites/JoinDialog/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/composites/JoinDialog/JoinDialog.stories.d.ts +2 -2
- package/dist/types/src/composites/JoinDialog/JoinDialog.stories.d.ts.map +1 -1
- package/dist/types/src/composites/index.d.ts +0 -2
- package/dist/types/src/composites/index.d.ts.map +1 -1
- package/dist/types/src/layouts/PanelAlertDialog/PanelAlertDialog.d.ts.map +1 -1
- package/dist/types/src/layouts/index.d.ts +0 -1
- package/dist/types/src/layouts/index.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts +0 -3
- package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts +3 -4
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/AdditionMethodSelector.d.ts +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/AdditionMethodSelector.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/IdentityAdded.d.ts +2 -10
- package/dist/types/src/panels/JoinPanel/view-states/IdentityAdded.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/IdentityInput.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/IdentitySelector.d.ts +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/IdentitySelector.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts.map +1 -1
- package/dist/types/src/panels/index.d.ts +0 -2
- package/dist/types/src/panels/index.d.ts.map +1 -1
- package/dist/types/src/styles/index.d.ts +0 -1
- package/dist/types/src/styles/index.d.ts.map +1 -1
- package/dist/types/src/translations/locales/en-US.d.ts +1 -12
- package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
- package/package.json +11 -12
- package/src/components/IdentityList/IdentityListItem.tsx +3 -15
- package/src/components/IdentityList/SpaceMemberList.tsx +8 -10
- package/src/components/IdentityList/SpaceMemberListContainer.tsx +4 -5
- package/src/components/IdentityList/index.ts +0 -1
- package/src/components/InvitationList/InvitationList.tsx +2 -6
- package/src/components/InvitationList/InvitationListItem.tsx +25 -36
- package/src/components/InvitationList/InvitationStatusAvatar.tsx +5 -10
- package/src/components/index.ts +0 -1
- package/src/composites/JoinDialog/JoinDialog.stories.tsx +58 -59
- package/src/composites/JoinDialog/JoinDialog.tsx +1 -3
- package/src/composites/index.ts +0 -3
- package/src/layouts/PanelAlertDialog/PanelAlertDialog.tsx +8 -4
- package/src/layouts/PanelSidebar/PanelSidebar.tsx +1 -1
- package/src/layouts/index.ts +0 -1
- package/src/panels/JoinPanel/JoinHeading.tsx +16 -44
- package/src/panels/JoinPanel/JoinPanel.tsx +9 -25
- package/src/panels/JoinPanel/JoinPanelProps.ts +8 -4
- package/src/panels/JoinPanel/view-states/AdditionMethodSelector.tsx +1 -5
- package/src/panels/JoinPanel/view-states/IdentityAdded.tsx +24 -63
- package/src/panels/JoinPanel/view-states/IdentityInput.tsx +1 -8
- package/src/panels/JoinPanel/view-states/IdentitySelector.tsx +1 -4
- package/src/panels/JoinPanel/view-states/InvitationAccepted.tsx +0 -1
- package/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx +1 -4
- package/src/panels/JoinPanel/view-states/InvitationInput.tsx +1 -8
- package/src/panels/JoinPanel/view-states/InvitationRescuer.tsx +1 -4
- package/src/panels/index.ts +0 -2
- package/src/styles/index.ts +0 -1
- package/src/translations/locales/en-US.ts +3 -14
- package/dist/types/src/components/IdentityList/DeviceList.d.ts +0 -7
- package/dist/types/src/components/IdentityList/DeviceList.d.ts.map +0 -1
- package/dist/types/src/components/SpaceList/SpaceListItem.d.ts +0 -7
- package/dist/types/src/components/SpaceList/SpaceListItem.d.ts.map +0 -1
- package/dist/types/src/components/SpaceList/index.d.ts +0 -2
- package/dist/types/src/components/SpaceList/index.d.ts.map +0 -1
- package/dist/types/src/composites/DevicesDialog/DevicesDialog.d.ts +0 -6
- package/dist/types/src/composites/DevicesDialog/DevicesDialog.d.ts.map +0 -1
- package/dist/types/src/composites/DevicesDialog/index.d.ts +0 -2
- package/dist/types/src/composites/DevicesDialog/index.d.ts.map +0 -1
- package/dist/types/src/composites/Shell/Shell.d.ts +0 -6
- package/dist/types/src/composites/Shell/Shell.d.ts.map +0 -1
- package/dist/types/src/composites/Shell/index.d.ts +0 -2
- package/dist/types/src/composites/Shell/index.d.ts.map +0 -1
- package/dist/types/src/composites/SpaceDialog/SpaceDialog.d.ts +0 -6
- package/dist/types/src/composites/SpaceDialog/SpaceDialog.d.ts.map +0 -1
- package/dist/types/src/composites/SpaceDialog/index.d.ts +0 -2
- package/dist/types/src/composites/SpaceDialog/index.d.ts.map +0 -1
- package/dist/types/src/layouts/PanelDialog/PanelDialog.d.ts +0 -14
- package/dist/types/src/layouts/PanelDialog/PanelDialog.d.ts.map +0 -1
- package/dist/types/src/layouts/PanelDialog/index.d.ts +0 -2
- package/dist/types/src/layouts/PanelDialog/index.d.ts.map +0 -1
- package/dist/types/src/panels/DevicesPanel/DevicesPanel.d.ts +0 -10
- package/dist/types/src/panels/DevicesPanel/DevicesPanel.d.ts.map +0 -1
- package/dist/types/src/panels/DevicesPanel/index.d.ts +0 -2
- package/dist/types/src/panels/DevicesPanel/index.d.ts.map +0 -1
- package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts +0 -18
- package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts.map +0 -1
- package/dist/types/src/panels/SpacePanel/SpacePanel.stories.d.ts +0 -9
- package/dist/types/src/panels/SpacePanel/SpacePanel.stories.d.ts.map +0 -1
- package/dist/types/src/panels/SpacePanel/index.d.ts +0 -2
- package/dist/types/src/panels/SpacePanel/index.d.ts.map +0 -1
- package/dist/types/src/styles/dialogStyles.d.ts +0 -3
- package/dist/types/src/styles/dialogStyles.d.ts.map +0 -1
- package/src/components/IdentityList/DeviceList.tsx +0 -31
- package/src/components/SpaceList/SpaceListItem.tsx +0 -32
- package/src/components/SpaceList/index.ts +0 -5
- package/src/composites/DevicesDialog/DevicesDialog.tsx +0 -38
- package/src/composites/DevicesDialog/index.ts +0 -5
- package/src/composites/Shell/Shell.tsx +0 -92
- package/src/composites/Shell/index.ts +0 -5
- package/src/composites/SpaceDialog/SpaceDialog.tsx +0 -38
- package/src/composites/SpaceDialog/index.ts +0 -5
- package/src/layouts/PanelDialog/PanelDialog.tsx +0 -39
- package/src/layouts/PanelDialog/index.ts +0 -5
- package/src/panels/DevicesPanel/DevicesPanel.tsx +0 -98
- package/src/panels/DevicesPanel/index.ts +0 -5
- package/src/panels/SpacePanel/SpacePanel.stories.tsx +0 -53
- package/src/panels/SpacePanel/SpacePanel.tsx +0 -174
- package/src/panels/SpacePanel/index.ts +0 -5
- package/src/styles/dialogStyles.ts +0 -8
|
@@ -7,8 +7,6 @@ import React, { ComponentPropsWithoutRef, PropsWithChildren } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { mx } from '@dxos/react-components';
|
|
9
9
|
|
|
10
|
-
import { defaultDialogContent, defaultOverlay } from '../../styles';
|
|
11
|
-
|
|
12
10
|
export interface PanelAlertDialogSlots {
|
|
13
11
|
root: ComponentPropsWithoutRef<typeof AlertDialog.Root>;
|
|
14
12
|
overlay: ComponentPropsWithoutRef<typeof AlertDialog.Overlay>;
|
|
@@ -25,12 +23,18 @@ export const PanelAlertDialog = ({ titleId, slots = {}, children }: PanelAlertDi
|
|
|
25
23
|
return (
|
|
26
24
|
<AlertDialog.Root defaultOpen {...slots.root}>
|
|
27
25
|
{slots.trigger && <AlertDialog.Trigger {...slots.trigger} />}
|
|
28
|
-
<AlertDialog.Overlay
|
|
26
|
+
<AlertDialog.Overlay
|
|
27
|
+
{...slots.overlay}
|
|
28
|
+
className={mx(
|
|
29
|
+
'fixed inset-0 backdrop-blur z-50 overflow-auto grid place-items-center p-2 md:p-4 lg:p-8',
|
|
30
|
+
slots.overlay?.className
|
|
31
|
+
)}
|
|
32
|
+
>
|
|
29
33
|
<AlertDialog.Content
|
|
30
34
|
onEscapeKeyDown={(event) => event.preventDefault()}
|
|
31
35
|
{...slots.content}
|
|
32
36
|
aria-labelledby={titleId}
|
|
33
|
-
className={mx(
|
|
37
|
+
className={mx('is-full min-is-[260px] max-is-[320px] shadow-md backdrop-blur-md', slots.content?.className)}
|
|
34
38
|
>
|
|
35
39
|
{children}
|
|
36
40
|
</AlertDialog.Content>
|
|
@@ -82,7 +82,7 @@ export const PanelSidebarProvider = ({ children, slots }: PropsWithChildren<Pane
|
|
|
82
82
|
onCloseAutoFocus={(event) => isLg && event.preventDefault()}
|
|
83
83
|
{...slots?.content}
|
|
84
84
|
className={mx(
|
|
85
|
-
'fixed block-start-0 block-end-0 is-sidebar z-
|
|
85
|
+
'fixed block-start-0 block-end-0 is-sidebar z-50 overscroll-contain overflow-x-hidden overflow-y-auto',
|
|
86
86
|
'transition-[inset-inline-start,inset-inline-end] duration-200 ease-in-out',
|
|
87
87
|
transitionShow ? 'inline-start-0' : '-inline-start-sidebar',
|
|
88
88
|
slots?.content?.className
|
package/src/layouts/index.ts
CHANGED
|
@@ -9,41 +9,25 @@ import { useSpace } from '@dxos/react-client';
|
|
|
9
9
|
import { Avatar, Button, getSize, Heading, mx, Trans, useId, useTranslation } from '@dxos/react-components';
|
|
10
10
|
|
|
11
11
|
import { subduedSurface } from '../../styles';
|
|
12
|
-
import { JoinPanelMode } from './JoinPanelProps';
|
|
13
12
|
|
|
14
13
|
export interface JoinSpaceHeadingProps {
|
|
15
|
-
mode?: JoinPanelMode;
|
|
16
14
|
titleId: string;
|
|
17
15
|
invitation?: AuthenticatingInvitationObservable;
|
|
18
16
|
onExit?: () => void;
|
|
19
17
|
exitActionParent?: Parameters<typeof cloneElement>[0];
|
|
20
|
-
preventExit?: boolean;
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
export const JoinHeading = forwardRef(
|
|
24
|
-
(
|
|
25
|
-
{ mode, titleId, invitation, onExit, exitActionParent, preventExit }: JoinSpaceHeadingProps,
|
|
26
|
-
ref: ForwardedRef<HTMLDivElement>
|
|
27
|
-
) => {
|
|
21
|
+
({ titleId, invitation, onExit, exitActionParent }: JoinSpaceHeadingProps, ref: ForwardedRef<HTMLDivElement>) => {
|
|
28
22
|
const { t } = useTranslation('os');
|
|
29
23
|
|
|
30
24
|
const space = useSpace(invitation?.invitation?.spaceKey);
|
|
31
|
-
const
|
|
32
|
-
const nameId = useId(mode === 'halo-only' ? 'identityDisplayName' : 'spaceDisplayName');
|
|
25
|
+
const spaceTitle = space?.properties.name ?? '(Space not available)';
|
|
33
26
|
|
|
34
|
-
const
|
|
35
|
-
mode === 'halo-only'
|
|
36
|
-
? invitation?.invitation?.identityKey?.toHex()
|
|
37
|
-
: invitation?.invitation?.identityKey?.toHex();
|
|
27
|
+
const nameId = useId('spaceDisplayName');
|
|
38
28
|
|
|
39
29
|
const exitButton = (
|
|
40
|
-
<Button
|
|
41
|
-
compact
|
|
42
|
-
variant='ghost'
|
|
43
|
-
{...(onExit && { onClick: onExit })}
|
|
44
|
-
className='grow-0 shrink-0'
|
|
45
|
-
data-testid='join-exit'
|
|
46
|
-
>
|
|
30
|
+
<Button compact variant='ghost' {...(onExit && { onClick: onExit })} className='grow-0 shrink-0'>
|
|
47
31
|
<ProhibitInset className={getSize(5)} />
|
|
48
32
|
<span className='sr-only'>{t('exit label')}</span>
|
|
49
33
|
</Button>
|
|
@@ -52,32 +36,20 @@ export const JoinHeading = forwardRef(
|
|
|
52
36
|
return (
|
|
53
37
|
<div role='none' className={mx(subduedSurface, 'p-2 rounded-bs-md')} ref={ref}>
|
|
54
38
|
<div role='group' className='flex items-center gap-2'>
|
|
55
|
-
{
|
|
56
|
-
<Avatar fallbackValue={invitationKey} labelId={nameId} />
|
|
57
|
-
) : (
|
|
58
|
-
<span role='none' className={mx(getSize(10), 'bg-neutral-300 dark:bg-neutral-700 rounded-full')} />
|
|
59
|
-
)}
|
|
39
|
+
<Avatar fallbackValue={invitation?.invitation?.spaceKey?.toHex() ?? ''} labelId={nameId} />
|
|
60
40
|
<Heading level={1} className='font-body font-normal text-base grow' id={titleId}>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/>
|
|
72
|
-
) : (
|
|
73
|
-
<span className='block leading-none font-system-medium text-sm'>
|
|
74
|
-
{mode === 'halo-only' ? t('halo heading') : t('join space heading')}
|
|
75
|
-
</span>
|
|
76
|
-
)}
|
|
41
|
+
<Trans
|
|
42
|
+
{...{
|
|
43
|
+
defaults: t('join space heading'),
|
|
44
|
+
components: {
|
|
45
|
+
small: <span className='block leading-none mbe-1 font-system-medium text-sm' />,
|
|
46
|
+
large: <span className='block leading-none' id={nameId} />
|
|
47
|
+
},
|
|
48
|
+
values: { spaceTitle }
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
77
51
|
</Heading>
|
|
78
|
-
{
|
|
79
|
-
mode !== 'halo-only' &&
|
|
80
|
-
(exitActionParent ? cloneElement(exitActionParent, {}, exitButton) : exitButton)}
|
|
52
|
+
{exitActionParent ? cloneElement(exitActionParent, {}, exitButton) : exitButton}
|
|
81
53
|
</div>
|
|
82
54
|
</div>
|
|
83
55
|
);
|
|
@@ -22,14 +22,12 @@ import {
|
|
|
22
22
|
} from './view-states';
|
|
23
23
|
|
|
24
24
|
export const JoinPanel = ({
|
|
25
|
-
mode,
|
|
26
25
|
initialInvitationCode,
|
|
27
26
|
titleId: propsTitleId,
|
|
28
27
|
exitActionParent,
|
|
29
28
|
onExit,
|
|
30
29
|
doneActionParent,
|
|
31
|
-
onDone
|
|
32
|
-
preventExit
|
|
30
|
+
onDone
|
|
33
31
|
}: JoinPanelProps) => {
|
|
34
32
|
const client = useClient();
|
|
35
33
|
const internalTitleId = useId('joinPanel__title');
|
|
@@ -52,7 +50,7 @@ export const JoinPanel = ({
|
|
|
52
50
|
if (action.method === 'accept device invitation') {
|
|
53
51
|
nextState.activeView = 'halo invitation acceptor';
|
|
54
52
|
if (state.unredeemedHaloInvitationCode) {
|
|
55
|
-
nextState.haloInvitation = client.
|
|
53
|
+
nextState.haloInvitation = client.echo.acceptInvitation(
|
|
56
54
|
InvitationEncoder.decode(state.unredeemedHaloInvitationCode)
|
|
57
55
|
);
|
|
58
56
|
nextState.unredeemedHaloInvitationCode = undefined;
|
|
@@ -122,14 +120,13 @@ export const JoinPanel = ({
|
|
|
122
120
|
nextState[action.from === 'halo' ? 'haloViewState' : 'spaceViewState'] = 'invitation input';
|
|
123
121
|
break;
|
|
124
122
|
}
|
|
125
|
-
log('[join panel reducer]', { action, nextState });
|
|
123
|
+
log.debug('[join panel reducer]', { action, nextState });
|
|
126
124
|
return nextState;
|
|
127
125
|
};
|
|
128
126
|
|
|
129
|
-
const unredeemedHaloInvitationCode = mode === 'halo-only' ? initialInvitationCode : undefined;
|
|
130
127
|
const [joinState, dispatch] = useReducer(reducer, {
|
|
131
|
-
unredeemedHaloInvitationCode,
|
|
132
|
-
unredeemedSpaceInvitationCode:
|
|
128
|
+
unredeemedHaloInvitationCode: undefined,
|
|
129
|
+
unredeemedSpaceInvitationCode: initialInvitationCode,
|
|
133
130
|
spaceInvitation: undefined,
|
|
134
131
|
haloInvitation: undefined,
|
|
135
132
|
activeView: availableIdentities.length > 0 ? 'identity selector' : 'addition method selector',
|
|
@@ -139,12 +136,6 @@ export const JoinPanel = ({
|
|
|
139
136
|
haloViewState: 'invitation input'
|
|
140
137
|
});
|
|
141
138
|
|
|
142
|
-
useEffect(() => {
|
|
143
|
-
if (unredeemedHaloInvitationCode) {
|
|
144
|
-
dispatch({ type: 'select addition method', method: 'accept device invitation' });
|
|
145
|
-
}
|
|
146
|
-
}, [unredeemedHaloInvitationCode]);
|
|
147
|
-
|
|
148
139
|
useEffect(() => {
|
|
149
140
|
// TODO (thure): Validate if this is sufficiently synchronous for iOS to move focus. It might not be!
|
|
150
141
|
const attrValue =
|
|
@@ -155,7 +146,7 @@ export const JoinPanel = ({
|
|
|
155
146
|
: joinState.activeView === 'halo invitation acceptor'
|
|
156
147
|
? `${joinState.activeView}; ${joinState.haloViewState}`
|
|
157
148
|
: joinState.activeView;
|
|
158
|
-
log('[autofocus value]', { attrValue });
|
|
149
|
+
log.debug('[autofocus value]', { attrValue });
|
|
159
150
|
const $nextAutofocus: HTMLElement | null = document.querySelector(`[data-autofocus="${attrValue}"]`);
|
|
160
151
|
if ($nextAutofocus) {
|
|
161
152
|
$nextAutofocus.focus();
|
|
@@ -186,9 +177,7 @@ export const JoinPanel = ({
|
|
|
186
177
|
|
|
187
178
|
return (
|
|
188
179
|
<>
|
|
189
|
-
<JoinHeading
|
|
190
|
-
{...{ mode, titleId, invitation: joinState.spaceInvitation, onExit, exitActionParent, preventExit }}
|
|
191
|
-
/>
|
|
180
|
+
<JoinHeading {...{ titleId, invitation: joinState.spaceInvitation, onExit, exitActionParent }} />
|
|
192
181
|
<div role='none' className='is-full overflow-hidden'>
|
|
193
182
|
<div role='none' className='flex is-[1300%]' aria-live='polite'>
|
|
194
183
|
<IdentitySelector
|
|
@@ -251,19 +240,14 @@ export const JoinPanel = ({
|
|
|
251
240
|
active:
|
|
252
241
|
joinState.activeView === 'halo invitation acceptor' &&
|
|
253
242
|
joinState.haloViewState === 'invitation accepted',
|
|
254
|
-
invitationType: 'halo'
|
|
255
|
-
doneActionParent,
|
|
256
|
-
onDone
|
|
243
|
+
invitationType: 'halo'
|
|
257
244
|
}}
|
|
258
245
|
/>
|
|
259
246
|
<IdentityAdded
|
|
260
247
|
{...{
|
|
261
|
-
mode,
|
|
262
248
|
dispatch,
|
|
263
249
|
addedIdentity: joinState.selectedIdentity,
|
|
264
|
-
active: joinState.activeView === 'identity added'
|
|
265
|
-
doneActionParent,
|
|
266
|
-
onDone
|
|
250
|
+
active: joinState.activeView === 'identity added'
|
|
267
251
|
}}
|
|
268
252
|
/>
|
|
269
253
|
<InvitationInput
|
|
@@ -4,18 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
import { cloneElement, Dispatch } from 'react';
|
|
6
6
|
|
|
7
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
AuthenticatingInvitationObservable,
|
|
9
|
+
Profile as NaturalProfile,
|
|
10
|
+
Space as NaturalSpace
|
|
11
|
+
} from '@dxos/client';
|
|
8
12
|
import { InvitationResult } from '@dxos/react-client';
|
|
9
13
|
|
|
10
|
-
export type
|
|
14
|
+
export type Space = Pick<NaturalSpace, 'properties'>;
|
|
15
|
+
|
|
16
|
+
export type Profile = Pick<NaturalProfile, 'displayName' | 'identityKey'>;
|
|
11
17
|
|
|
12
18
|
export interface JoinPanelProps {
|
|
13
|
-
mode?: JoinPanelMode;
|
|
14
19
|
initialInvitationCode?: string;
|
|
15
20
|
titleId?: string;
|
|
16
21
|
exitActionParent?: Parameters<typeof cloneElement>[0];
|
|
17
22
|
onExit?: () => void;
|
|
18
|
-
preventExit?: boolean;
|
|
19
23
|
doneActionParent?: Parameters<typeof cloneElement>[0];
|
|
20
24
|
onDone?: (result: InvitationResult | null) => void;
|
|
21
25
|
parseInvitationCodeInput?: (invitationCodeInput: string) => string;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import { CaretLeft, CaretRight, Plus, QrCode, Textbox } from 'phosphor-react';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import type { Profile } from '@dxos/client';
|
|
9
8
|
import { Button, CompoundButton, getSize, mx, useTranslation } from '@dxos/react-components';
|
|
10
9
|
|
|
10
|
+
import { Profile } from '../JoinPanelProps';
|
|
11
11
|
import { ViewState, ViewStateHeading, ViewStateProps } from './ViewState';
|
|
12
12
|
|
|
13
13
|
export interface AdditionMethodSelectorProps extends ViewStateProps {
|
|
@@ -36,7 +36,6 @@ export const AdditionMethodSelector = ({ availableIdentities, ...viewStateProps
|
|
|
36
36
|
before={<Plus className={getSize(6)} />}
|
|
37
37
|
onClick={() => dispatch({ type: 'select addition method', method: 'create identity' })}
|
|
38
38
|
data-autofocus='addition method selector'
|
|
39
|
-
data-testid='create-identity'
|
|
40
39
|
>
|
|
41
40
|
{t('create identity label')}
|
|
42
41
|
</CompoundButton>
|
|
@@ -45,7 +44,6 @@ export const AdditionMethodSelector = ({ availableIdentities, ...viewStateProps
|
|
|
45
44
|
description={t('join identity description')}
|
|
46
45
|
before={<QrCode className={getSize(6)} />}
|
|
47
46
|
onClick={() => dispatch({ type: 'select addition method', method: 'accept device invitation' })}
|
|
48
|
-
data-testid='join-identity'
|
|
49
47
|
>
|
|
50
48
|
{t('join identity label')}
|
|
51
49
|
</CompoundButton>
|
|
@@ -54,7 +52,6 @@ export const AdditionMethodSelector = ({ availableIdentities, ...viewStateProps
|
|
|
54
52
|
description={t('recover identity description')}
|
|
55
53
|
before={<Textbox className={getSize(6)} />}
|
|
56
54
|
onClick={() => dispatch({ type: 'select addition method', method: 'recover identity' })}
|
|
57
|
-
data-testid='recover-identity'
|
|
58
55
|
>
|
|
59
56
|
{t('recover identity label')}
|
|
60
57
|
</CompoundButton>
|
|
@@ -62,7 +59,6 @@ export const AdditionMethodSelector = ({ availableIdentities, ...viewStateProps
|
|
|
62
59
|
<Button
|
|
63
60
|
disabled={disabled || availableIdentities.length < 1}
|
|
64
61
|
onClick={() => dispatch({ type: 'deselect identity' })}
|
|
65
|
-
data-testid='deselect-identity'
|
|
66
62
|
>
|
|
67
63
|
<CaretLeft className={getSize(4)} weight='bold' />
|
|
68
64
|
<span className='grow'>{t('deselect identity label')}</span>
|
|
@@ -2,54 +2,19 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { CaretLeft, CaretRight
|
|
6
|
-
import React
|
|
5
|
+
import { CaretLeft, CaretRight } from 'phosphor-react';
|
|
6
|
+
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import type { Profile } from '@dxos/client';
|
|
9
|
-
import { InvitationResult } from '@dxos/react-client';
|
|
10
9
|
import { Avatar, Button, getSize, mx, useTranslation } from '@dxos/react-components';
|
|
11
10
|
|
|
12
|
-
import { JoinPanelMode } from '../JoinPanelProps';
|
|
13
11
|
import { ViewState, ViewStateHeading, ViewStateProps } from './ViewState';
|
|
14
12
|
|
|
15
|
-
export interface IdentityAddedProps extends ViewStateProps
|
|
16
|
-
mode?: JoinPanelMode;
|
|
13
|
+
export interface IdentityAddedProps extends ViewStateProps {
|
|
17
14
|
addedIdentity?: Profile;
|
|
18
15
|
}
|
|
19
16
|
|
|
20
|
-
export
|
|
21
|
-
doneActionParent?: Parameters<typeof cloneElement>[0];
|
|
22
|
-
onDone?: (result: InvitationResult | null) => void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const Done = ({ onDone, doneActionParent, active }: DoneProps) => {
|
|
26
|
-
const disabled = !active;
|
|
27
|
-
const { t } = useTranslation('os');
|
|
28
|
-
|
|
29
|
-
const doneButton = (
|
|
30
|
-
<Button
|
|
31
|
-
{...(onDone && { onClick: () => onDone(null) })}
|
|
32
|
-
disabled={disabled}
|
|
33
|
-
className='grow flex items-center gap-2 pli-2'
|
|
34
|
-
data-autofocus='identity added'
|
|
35
|
-
data-testid='identity-added-done'
|
|
36
|
-
>
|
|
37
|
-
<CaretLeft weight='bold' className={mx(getSize(2), 'invisible')} />
|
|
38
|
-
<span className='grow'>{t('done label')}</span>
|
|
39
|
-
<Check weight='bold' className={getSize(4)} />
|
|
40
|
-
</Button>
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
return doneActionParent ? cloneElement(doneActionParent, {}, doneButton) : doneButton;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const IdentityAdded = ({
|
|
47
|
-
mode,
|
|
48
|
-
addedIdentity,
|
|
49
|
-
onDone,
|
|
50
|
-
doneActionParent,
|
|
51
|
-
...viewStateProps
|
|
52
|
-
}: IdentityAddedProps) => {
|
|
17
|
+
export const IdentityAdded = ({ addedIdentity, ...viewStateProps }: IdentityAddedProps) => {
|
|
53
18
|
const disabled = !viewStateProps.active;
|
|
54
19
|
const { dispatch } = viewStateProps;
|
|
55
20
|
const { t } = useTranslation('os');
|
|
@@ -70,30 +35,26 @@ export const IdentityAdded = ({
|
|
|
70
35
|
status='active'
|
|
71
36
|
/>
|
|
72
37
|
</div>
|
|
73
|
-
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
<span>{t('deselect identity label')}</span>
|
|
94
|
-
</Button>
|
|
95
|
-
</div>
|
|
96
|
-
)}
|
|
38
|
+
<div className='flex gap-2'>
|
|
39
|
+
<Button
|
|
40
|
+
disabled={disabled || !addedIdentity}
|
|
41
|
+
className='grow flex items-center gap-2 pli-2 order-2'
|
|
42
|
+
onClick={() => addedIdentity && dispatch({ type: 'select identity', identity: addedIdentity })}
|
|
43
|
+
data-autofocus='identity added'
|
|
44
|
+
>
|
|
45
|
+
<CaretLeft weight='bold' className={mx(getSize(2), 'invisible')} />
|
|
46
|
+
<span className='grow'>{t('continue label')}</span>
|
|
47
|
+
<CaretRight weight='bold' className={getSize(4)} />
|
|
48
|
+
</Button>
|
|
49
|
+
<Button
|
|
50
|
+
disabled={disabled}
|
|
51
|
+
onClick={() => dispatch({ type: 'deselect identity' })}
|
|
52
|
+
className='flex items-center gap-2 pis-2 pie-4'
|
|
53
|
+
>
|
|
54
|
+
<CaretLeft weight='bold' className={getSize(4)} />
|
|
55
|
+
<span>{t('deselect identity label')}</span>
|
|
56
|
+
</Button>
|
|
57
|
+
</div>
|
|
97
58
|
</ViewState>
|
|
98
59
|
);
|
|
99
60
|
};
|
|
@@ -50,16 +50,10 @@ export const IdentityInput = ({ method, ...viewStateProps }: IdentityCreatorProp
|
|
|
50
50
|
} as ComponentPropsWithoutRef<'input'>
|
|
51
51
|
}}
|
|
52
52
|
{...(validationMessage.length && { validationValence: 'error', validationMessage })}
|
|
53
|
-
data-testid='identity-input'
|
|
54
53
|
/>
|
|
55
54
|
<div role='none' className='grow' />
|
|
56
55
|
<div className='flex gap-2'>
|
|
57
|
-
<Button
|
|
58
|
-
disabled={disabled}
|
|
59
|
-
className='grow flex items-center gap-2 pli-2 order-2'
|
|
60
|
-
onClick={handleNext}
|
|
61
|
-
data-testid={`${method === 'recover identity' ? 'recover' : 'create'}-identity-input-continue`}
|
|
62
|
-
>
|
|
56
|
+
<Button disabled={disabled} className='grow flex items-center gap-2 pli-2 order-2' onClick={handleNext}>
|
|
63
57
|
<CaretLeft weight='bold' className={mx(getSize(2), 'invisible')} />
|
|
64
58
|
<span className='grow'>{t('continue label')}</span>
|
|
65
59
|
<CaretRight weight='bold' className={getSize(4)} />
|
|
@@ -68,7 +62,6 @@ export const IdentityInput = ({ method, ...viewStateProps }: IdentityCreatorProp
|
|
|
68
62
|
disabled={disabled}
|
|
69
63
|
onClick={() => dispatch({ type: 'add identity' })}
|
|
70
64
|
className='flex items-center gap-2 pis-2 pie-4'
|
|
71
|
-
data-testid={`${method === 'recover identity' ? 'recover' : 'create'}-identity-input-back`}
|
|
72
65
|
>
|
|
73
66
|
<CaretLeft weight='bold' className={getSize(4)} />
|
|
74
67
|
<span>{t('back label')}</span>
|
|
@@ -6,9 +6,9 @@ import * as RadioGroup from '@radix-ui/react-radio-group';
|
|
|
6
6
|
import { CaretLeft, CaretRight, UserPlus } from 'phosphor-react';
|
|
7
7
|
import React, { useCallback, useState } from 'react';
|
|
8
8
|
|
|
9
|
-
import type { Profile } from '@dxos/client';
|
|
10
9
|
import { Avatar, Button, themeVariantFocus, getSize, mx, useTranslation } from '@dxos/react-components';
|
|
11
10
|
|
|
11
|
+
import { Profile } from '../JoinPanelProps';
|
|
12
12
|
import { ViewState, ViewStateHeading, ViewStateProps } from './ViewState';
|
|
13
13
|
|
|
14
14
|
export interface IdentitySelectorProps extends ViewStateProps {
|
|
@@ -57,7 +57,6 @@ export const IdentitySelector = ({ availableIdentities, ...viewStateProps }: Ide
|
|
|
57
57
|
'radix-state-unchecked:bg-neutral-100 dark:radix-state-unchecked:bg-neutral-900',
|
|
58
58
|
themeVariantFocus('os')
|
|
59
59
|
)}
|
|
60
|
-
data-testid='identity-selector-item'
|
|
61
60
|
>
|
|
62
61
|
<RadioGroup.Indicator className='absolute inset-0 flex items-center justify-center leading-0'>
|
|
63
62
|
<div className='w-1.5 h-1.5 rounded-full bg-white' />
|
|
@@ -76,7 +75,6 @@ export const IdentitySelector = ({ availableIdentities, ...viewStateProps }: Ide
|
|
|
76
75
|
compact
|
|
77
76
|
onClick={() => dispatch({ type: 'add identity' })}
|
|
78
77
|
className='flex items-center gap-2 pli-2'
|
|
79
|
-
data-testid='add-identity'
|
|
80
78
|
>
|
|
81
79
|
<span>{t('add identity label')}</span>
|
|
82
80
|
<UserPlus weight='bold' className={getSize(3.5)} />
|
|
@@ -90,7 +88,6 @@ export const IdentitySelector = ({ availableIdentities, ...viewStateProps }: Ide
|
|
|
90
88
|
identity: activeIdentity
|
|
91
89
|
})
|
|
92
90
|
}
|
|
93
|
-
data-testid='select-identity'
|
|
94
91
|
>
|
|
95
92
|
<CaretLeft weight='bold' className={mx(getSize(4), 'invisible')} />
|
|
96
93
|
<span className='grow'>{t('continue label')}</span>
|
|
@@ -33,7 +33,6 @@ const PureInvitationAcceptedContent = ({
|
|
|
33
33
|
disabled={disabled}
|
|
34
34
|
className='grow flex items-center gap-2 pli-2'
|
|
35
35
|
data-autofocus={`${invitationType} invitation acceptor; invitation accepted`}
|
|
36
|
-
data-testid={`${invitationType}-invitation-accepted-done`}
|
|
37
36
|
>
|
|
38
37
|
<CaretLeft weight='bold' className={mx(getSize(2), 'invisible')} />
|
|
39
38
|
<span className='grow'>{t('done label')}</span>
|
|
@@ -37,7 +37,7 @@ const PureInvitationAuthenticatorContent = ({
|
|
|
37
37
|
return (
|
|
38
38
|
<>
|
|
39
39
|
<Input
|
|
40
|
-
label={t('
|
|
40
|
+
label={t('pin input label')}
|
|
41
41
|
size='pin'
|
|
42
42
|
length={pinLength}
|
|
43
43
|
onChange={onChange}
|
|
@@ -57,7 +57,6 @@ const PureInvitationAuthenticatorContent = ({
|
|
|
57
57
|
validationValence: 'error',
|
|
58
58
|
validationMessage: t('failed to authenticate message')
|
|
59
59
|
})}
|
|
60
|
-
data-testid='auth-code-input'
|
|
61
60
|
/>
|
|
62
61
|
<div role='none' className='grow' />
|
|
63
62
|
<div className='flex gap-2'>
|
|
@@ -66,7 +65,6 @@ const PureInvitationAuthenticatorContent = ({
|
|
|
66
65
|
className='grow flex items-center gap-2 pli-2 order-2'
|
|
67
66
|
onClick={onAuthenticate}
|
|
68
67
|
data-autofocus-pinlength={invitationType}
|
|
69
|
-
data-testid={`${invitationType}-invitation-authenticator-next`}
|
|
70
68
|
>
|
|
71
69
|
<CaretLeft weight='bold' className={mx(getSize(2), 'invisible')} />
|
|
72
70
|
<span className='grow'>{t('next label')}</span>
|
|
@@ -76,7 +74,6 @@ const PureInvitationAuthenticatorContent = ({
|
|
|
76
74
|
disabled={disabled}
|
|
77
75
|
className='flex items-center gap-2 pis-2 pie-4'
|
|
78
76
|
onClick={() => dispatch({ type: 'cancel invitation', from: invitationType })}
|
|
79
|
-
data-testid={`${invitationType}-invitation-authenticator-cancel`}
|
|
80
77
|
>
|
|
81
78
|
<CaretLeft weight='bold' className={getSize(4)} />
|
|
82
79
|
<span>{t('cancel label')}</span>
|
|
@@ -46,16 +46,10 @@ export const InvitationInput = ({ invitationType, ...viewStateProps }: Invitatio
|
|
|
46
46
|
onKeyUp: ({ key }) => key === 'Enter' && handleNext()
|
|
47
47
|
} as ComponentPropsWithoutRef<'input'>
|
|
48
48
|
}}
|
|
49
|
-
data-testid='invitation-input'
|
|
50
49
|
/>
|
|
51
50
|
<div role='none' className='grow' />
|
|
52
51
|
<div className='flex gap-2'>
|
|
53
|
-
<Button
|
|
54
|
-
disabled={disabled}
|
|
55
|
-
className='grow flex items-center gap-2 pli-2 order-2'
|
|
56
|
-
onClick={handleNext}
|
|
57
|
-
data-testid={`${invitationType}-invitation-input-continue`}
|
|
58
|
-
>
|
|
52
|
+
<Button disabled={disabled} className='grow flex items-center gap-2 pli-2 order-2' onClick={handleNext}>
|
|
59
53
|
<CaretLeft weight='bold' className={mx(getSize(2), 'invisible')} />
|
|
60
54
|
<span className='grow'>{t('continue label')}</span>
|
|
61
55
|
<CaretRight weight='bold' className={getSize(4)} />
|
|
@@ -64,7 +58,6 @@ export const InvitationInput = ({ invitationType, ...viewStateProps }: Invitatio
|
|
|
64
58
|
disabled={disabled}
|
|
65
59
|
onClick={() => dispatch({ type: 'add identity' })}
|
|
66
60
|
className='flex items-center gap-2 pis-2 pie-4'
|
|
67
|
-
data-testid={`${invitationType}-invitation-input-back`}
|
|
68
61
|
>
|
|
69
62
|
<CaretLeft weight='bold' className={getSize(4)} />
|
|
70
63
|
<span>{t('back label')}</span>
|
|
@@ -35,7 +35,7 @@ const InvitationActions = ({
|
|
|
35
35
|
<>
|
|
36
36
|
<div role='none' className='grow' />
|
|
37
37
|
<div className='flex gap-2'>
|
|
38
|
-
<Button disabled className='grow flex items-center gap-2 pli-2 order-2'
|
|
38
|
+
<Button disabled className='grow flex items-center gap-2 pli-2 order-2'>
|
|
39
39
|
<CaretLeft weight='bold' className={mx(getSize(2), 'invisible')} />
|
|
40
40
|
<span className='grow'>{t('next label')}</span>
|
|
41
41
|
<CaretRight weight='bold' className={getSize(4)} />
|
|
@@ -45,7 +45,6 @@ const InvitationActions = ({
|
|
|
45
45
|
className='flex items-center gap-2 pis-2 pie-4'
|
|
46
46
|
onClick={cancel}
|
|
47
47
|
data-autofocus={`${invitationType} invitation acceptor; invitation rescuer`}
|
|
48
|
-
data-testid='invitation-rescuer-cancel'
|
|
49
48
|
>
|
|
50
49
|
<CaretLeft weight='bold' className={getSize(4)} />
|
|
51
50
|
<span>{t('cancel label')}</span>
|
|
@@ -63,7 +62,6 @@ const InvitationActions = ({
|
|
|
63
62
|
className='grow flex items-center gap-2 pli-2'
|
|
64
63
|
onClick={() => dispatch({ type: 'reset invitation', from: invitationType })}
|
|
65
64
|
data-autofocus={`${invitationType} invitation acceptor; invitation rescuer`}
|
|
66
|
-
data-testid='invitation-rescuer-reset'
|
|
67
65
|
>
|
|
68
66
|
<CaretLeft weight='bold' className={mx(getSize(5), 'invisible')} />
|
|
69
67
|
<span className='grow'>{t('reset label')}</span>
|
|
@@ -84,7 +82,6 @@ export const InvitationRescuer = ({ invitationType, ...viewStateProps }: Invitat
|
|
|
84
82
|
disabled={disabled}
|
|
85
83
|
className='grow flex items-center gap-2 pli-2'
|
|
86
84
|
data-autofocus='space invitation acceptor; invitation rescuer'
|
|
87
|
-
data-testid='invitation-rescuer-connect'
|
|
88
85
|
>
|
|
89
86
|
<CaretLeft weight='bold' className={mx(getSize(5), 'invisible')} />
|
|
90
87
|
<span className='grow'>{t('connect label')}</span>
|
package/src/panels/index.ts
CHANGED
package/src/styles/index.ts
CHANGED
|
@@ -8,9 +8,7 @@ export const os = {
|
|
|
8
8
|
'sidebar label': 'DXOS sidebar',
|
|
9
9
|
'copy invitation code label': 'Copy',
|
|
10
10
|
'open share panel label': 'Share',
|
|
11
|
-
'
|
|
12
|
-
'join space heading': 'Join a space',
|
|
13
|
-
'halo heading': 'Initialize device identity',
|
|
11
|
+
'join space heading': '<small>Joining</small><large>{{spaceTitle}}</large>',
|
|
14
12
|
'exit label': 'Exit',
|
|
15
13
|
'identity selector title': 'Join as',
|
|
16
14
|
'identity radio group title': 'Select an identity you’ve associated with this device already',
|
|
@@ -18,7 +16,6 @@ export const os = {
|
|
|
18
16
|
'continue label': 'Continue',
|
|
19
17
|
'back label': 'Back',
|
|
20
18
|
'next label': 'Next',
|
|
21
|
-
'close label': 'Close',
|
|
22
19
|
'auth choices label': 'Choose an identity',
|
|
23
20
|
'create identity label': 'Create an identity',
|
|
24
21
|
'create identity description': 'Create a new identity.',
|
|
@@ -48,14 +45,6 @@ export const os = {
|
|
|
48
45
|
'cancel label': 'Cancel',
|
|
49
46
|
'done label': 'Done',
|
|
50
47
|
'reset label': 'Start over',
|
|
51
|
-
'
|
|
52
|
-
'invitation input label': 'Paste an invitation code or URL'
|
|
53
|
-
'create space invitation label': 'Invite',
|
|
54
|
-
'qr label': 'Scan to accept invitation',
|
|
55
|
-
'empty invitations message': 'No pending invitations',
|
|
56
|
-
'show all spaces label': 'All spaces',
|
|
57
|
-
'all spaces label': 'All spaces',
|
|
58
|
-
'create space label': 'Create a new space',
|
|
59
|
-
'join space label': 'Join a space',
|
|
60
|
-
'show current space label': 'Current space'
|
|
48
|
+
'pin input label': 'The PIN provided by the invitation sender',
|
|
49
|
+
'invitation input label': 'Paste an invitation code or URL'
|
|
61
50
|
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DeviceInfo } from '@dxos/protocols/proto/dxos/halo/credentials/identity';
|
|
2
|
-
export interface DeviceListProps {
|
|
3
|
-
devices: DeviceInfo[];
|
|
4
|
-
onSelect?: (device: DeviceInfo) => void;
|
|
5
|
-
}
|
|
6
|
-
export declare const DeviceList: ({ devices, onSelect }: DeviceListProps) => JSX.Element;
|
|
7
|
-
//# sourceMappingURL=DeviceList.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceList.d.ts","sourceRoot":"","sources":["../../../../../src/components/IdentityList/DeviceList.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,sDAAsD,CAAC;AAIlF,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,UAAU,0BAA2B,eAAe,gBAehE,CAAC"}
|