@dxos/react-ui 0.1.25-next.3c6b542 → 0.1.26

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 (132) hide show
  1. package/dist/lib/browser/index.mjs +452 -1092
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/types/src/components/IdentityList/IdentityListItem.d.ts +1 -2
  5. package/dist/types/src/components/IdentityList/IdentityListItem.d.ts.map +1 -1
  6. package/dist/types/src/components/IdentityList/IdentityListItem.stories.d.ts +1 -2
  7. package/dist/types/src/components/IdentityList/IdentityListItem.stories.d.ts.map +1 -1
  8. package/dist/types/src/components/IdentityList/SpaceMemberList.d.ts +2 -3
  9. package/dist/types/src/components/IdentityList/SpaceMemberList.d.ts.map +1 -1
  10. package/dist/types/src/components/IdentityList/SpaceMemberListContainer.d.ts +1 -3
  11. package/dist/types/src/components/IdentityList/SpaceMemberListContainer.d.ts.map +1 -1
  12. package/dist/types/src/components/IdentityList/index.d.ts +0 -1
  13. package/dist/types/src/components/IdentityList/index.d.ts.map +1 -1
  14. package/dist/types/src/components/InvitationList/InvitationList.d.ts.map +1 -1
  15. package/dist/types/src/components/InvitationList/InvitationListItem.d.ts.map +1 -1
  16. package/dist/types/src/components/InvitationList/InvitationStatusAvatar.d.ts +1 -6
  17. package/dist/types/src/components/InvitationList/InvitationStatusAvatar.d.ts.map +1 -1
  18. package/dist/types/src/components/InvitationList/InvitationStatusAvatar.stories.d.ts +1 -1
  19. package/dist/types/src/components/index.d.ts +0 -1
  20. package/dist/types/src/components/index.d.ts.map +1 -1
  21. package/dist/types/src/composites/JoinDialog/JoinDialog.d.ts +1 -1
  22. package/dist/types/src/composites/JoinDialog/JoinDialog.d.ts.map +1 -1
  23. package/dist/types/src/composites/JoinDialog/JoinDialog.stories.d.ts +2 -2
  24. package/dist/types/src/composites/JoinDialog/JoinDialog.stories.d.ts.map +1 -1
  25. package/dist/types/src/composites/index.d.ts +0 -2
  26. package/dist/types/src/composites/index.d.ts.map +1 -1
  27. package/dist/types/src/layouts/PanelAlertDialog/PanelAlertDialog.d.ts.map +1 -1
  28. package/dist/types/src/layouts/index.d.ts +0 -1
  29. package/dist/types/src/layouts/index.d.ts.map +1 -1
  30. package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts +0 -3
  31. package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts.map +1 -1
  32. package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts +1 -1
  33. package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts.map +1 -1
  34. package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts +3 -4
  35. package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts.map +1 -1
  36. package/dist/types/src/panels/JoinPanel/view-states/AdditionMethodSelector.d.ts +1 -1
  37. package/dist/types/src/panels/JoinPanel/view-states/AdditionMethodSelector.d.ts.map +1 -1
  38. package/dist/types/src/panels/JoinPanel/view-states/IdentityAdded.d.ts +2 -10
  39. package/dist/types/src/panels/JoinPanel/view-states/IdentityAdded.d.ts.map +1 -1
  40. package/dist/types/src/panels/JoinPanel/view-states/IdentityInput.d.ts.map +1 -1
  41. package/dist/types/src/panels/JoinPanel/view-states/IdentitySelector.d.ts +1 -1
  42. package/dist/types/src/panels/JoinPanel/view-states/IdentitySelector.d.ts.map +1 -1
  43. package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts.map +1 -1
  44. package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts.map +1 -1
  45. package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts.map +1 -1
  46. package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts.map +1 -1
  47. package/dist/types/src/panels/index.d.ts +0 -2
  48. package/dist/types/src/panels/index.d.ts.map +1 -1
  49. package/dist/types/src/styles/index.d.ts +0 -1
  50. package/dist/types/src/styles/index.d.ts.map +1 -1
  51. package/dist/types/src/translations/locales/en-US.d.ts +1 -12
  52. package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
  53. package/package.json +11 -12
  54. package/src/components/IdentityList/IdentityListItem.tsx +3 -15
  55. package/src/components/IdentityList/SpaceMemberList.tsx +8 -10
  56. package/src/components/IdentityList/SpaceMemberListContainer.tsx +4 -5
  57. package/src/components/IdentityList/index.ts +0 -1
  58. package/src/components/InvitationList/InvitationList.tsx +2 -6
  59. package/src/components/InvitationList/InvitationListItem.tsx +25 -36
  60. package/src/components/InvitationList/InvitationStatusAvatar.tsx +5 -10
  61. package/src/components/index.ts +0 -1
  62. package/src/composites/JoinDialog/JoinDialog.stories.tsx +58 -59
  63. package/src/composites/JoinDialog/JoinDialog.tsx +1 -3
  64. package/src/composites/index.ts +0 -3
  65. package/src/layouts/PanelAlertDialog/PanelAlertDialog.tsx +8 -4
  66. package/src/layouts/PanelSidebar/PanelSidebar.tsx +1 -1
  67. package/src/layouts/index.ts +0 -1
  68. package/src/panels/JoinPanel/JoinHeading.tsx +16 -44
  69. package/src/panels/JoinPanel/JoinPanel.tsx +11 -32
  70. package/src/panels/JoinPanel/JoinPanelProps.ts +8 -4
  71. package/src/panels/JoinPanel/view-states/AdditionMethodSelector.tsx +1 -5
  72. package/src/panels/JoinPanel/view-states/IdentityAdded.tsx +24 -63
  73. package/src/panels/JoinPanel/view-states/IdentityInput.tsx +1 -8
  74. package/src/panels/JoinPanel/view-states/IdentitySelector.tsx +1 -4
  75. package/src/panels/JoinPanel/view-states/InvitationAccepted.tsx +0 -1
  76. package/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx +1 -4
  77. package/src/panels/JoinPanel/view-states/InvitationInput.tsx +1 -8
  78. package/src/panels/JoinPanel/view-states/InvitationRescuer.tsx +1 -4
  79. package/src/panels/index.ts +0 -2
  80. package/src/styles/index.ts +0 -1
  81. package/src/translations/locales/en-US.ts +3 -14
  82. package/dist/types/src/components/IdentityList/DeviceList.d.ts +0 -7
  83. package/dist/types/src/components/IdentityList/DeviceList.d.ts.map +0 -1
  84. package/dist/types/src/components/SpaceList/SpaceListItem.d.ts +0 -7
  85. package/dist/types/src/components/SpaceList/SpaceListItem.d.ts.map +0 -1
  86. package/dist/types/src/components/SpaceList/index.d.ts +0 -2
  87. package/dist/types/src/components/SpaceList/index.d.ts.map +0 -1
  88. package/dist/types/src/composites/DevicesDialog/DevicesDialog.d.ts +0 -6
  89. package/dist/types/src/composites/DevicesDialog/DevicesDialog.d.ts.map +0 -1
  90. package/dist/types/src/composites/DevicesDialog/index.d.ts +0 -2
  91. package/dist/types/src/composites/DevicesDialog/index.d.ts.map +0 -1
  92. package/dist/types/src/composites/Shell/Shell.d.ts +0 -6
  93. package/dist/types/src/composites/Shell/Shell.d.ts.map +0 -1
  94. package/dist/types/src/composites/Shell/index.d.ts +0 -2
  95. package/dist/types/src/composites/Shell/index.d.ts.map +0 -1
  96. package/dist/types/src/composites/SpaceDialog/SpaceDialog.d.ts +0 -6
  97. package/dist/types/src/composites/SpaceDialog/SpaceDialog.d.ts.map +0 -1
  98. package/dist/types/src/composites/SpaceDialog/index.d.ts +0 -2
  99. package/dist/types/src/composites/SpaceDialog/index.d.ts.map +0 -1
  100. package/dist/types/src/layouts/PanelDialog/PanelDialog.d.ts +0 -14
  101. package/dist/types/src/layouts/PanelDialog/PanelDialog.d.ts.map +0 -1
  102. package/dist/types/src/layouts/PanelDialog/index.d.ts +0 -2
  103. package/dist/types/src/layouts/PanelDialog/index.d.ts.map +0 -1
  104. package/dist/types/src/panels/DevicesPanel/DevicesPanel.d.ts +0 -10
  105. package/dist/types/src/panels/DevicesPanel/DevicesPanel.d.ts.map +0 -1
  106. package/dist/types/src/panels/DevicesPanel/index.d.ts +0 -2
  107. package/dist/types/src/panels/DevicesPanel/index.d.ts.map +0 -1
  108. package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts +0 -18
  109. package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts.map +0 -1
  110. package/dist/types/src/panels/SpacePanel/SpacePanel.stories.d.ts +0 -9
  111. package/dist/types/src/panels/SpacePanel/SpacePanel.stories.d.ts.map +0 -1
  112. package/dist/types/src/panels/SpacePanel/index.d.ts +0 -2
  113. package/dist/types/src/panels/SpacePanel/index.d.ts.map +0 -1
  114. package/dist/types/src/styles/dialogStyles.d.ts +0 -3
  115. package/dist/types/src/styles/dialogStyles.d.ts.map +0 -1
  116. package/src/components/IdentityList/DeviceList.tsx +0 -31
  117. package/src/components/SpaceList/SpaceListItem.tsx +0 -32
  118. package/src/components/SpaceList/index.ts +0 -5
  119. package/src/composites/DevicesDialog/DevicesDialog.tsx +0 -38
  120. package/src/composites/DevicesDialog/index.ts +0 -5
  121. package/src/composites/Shell/Shell.tsx +0 -92
  122. package/src/composites/Shell/index.ts +0 -5
  123. package/src/composites/SpaceDialog/SpaceDialog.tsx +0 -38
  124. package/src/composites/SpaceDialog/index.ts +0 -5
  125. package/src/layouts/PanelDialog/PanelDialog.tsx +0 -39
  126. package/src/layouts/PanelDialog/index.ts +0 -5
  127. package/src/panels/DevicesPanel/DevicesPanel.tsx +0 -98
  128. package/src/panels/DevicesPanel/index.ts +0 -5
  129. package/src/panels/SpacePanel/SpacePanel.stories.tsx +0 -53
  130. package/src/panels/SpacePanel/SpacePanel.tsx +0 -174
  131. package/src/panels/SpacePanel/index.ts +0 -5
  132. 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 {...slots.overlay} className={mx(defaultOverlay, 'z-40', slots.overlay?.className)}>
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(defaultDialogContent, slots.content?.className)}
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-30 overscroll-contain overflow-x-hidden overflow-y-auto',
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
@@ -5,4 +5,3 @@
5
5
  export * from './PanelPopover';
6
6
  export * from './PanelSidebar';
7
7
  export * from './PanelAlertDialog';
8
- export * from './PanelDialog';
@@ -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 name = mode === 'halo-only' ? '(Unknown identity)' : space?.properties.name ?? '(Space name not available)';
32
- const nameId = useId(mode === 'halo-only' ? 'identityDisplayName' : 'spaceDisplayName');
25
+ const spaceTitle = space?.properties.name ?? '(Space not available)';
33
26
 
34
- const invitationKey =
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
- {invitationKey ? (
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
- {invitation ? (
62
- <Trans
63
- {...{
64
- defaults: t('joining heading'),
65
- components: {
66
- small: <span className='block leading-none mbe-1 font-system-medium text-sm' />,
67
- large: <span className='block leading-none' id={nameId} />
68
- },
69
- values: { name }
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
- {!preventExit &&
79
- mode !== 'halo-only' &&
80
- (exitActionParent ? cloneElement(exitActionParent, {}, exitButton) : exitButton)}
52
+ {exitActionParent ? cloneElement(exitActionParent, {}, exitButton) : exitButton}
81
53
  </div>
82
54
  </div>
83
55
  );
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
- import React, { useEffect, useReducer, useState } from 'react';
4
+ import React, { useEffect, useReducer } from 'react';
5
5
 
6
6
  import { InvitationEncoder } from '@dxos/client';
7
7
  import { log } from '@dxos/log';
@@ -22,20 +22,18 @@ 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');
36
34
  const titleId = propsTitleId ?? internalTitleId;
37
35
  const identity = useIdentity();
38
- const [prevIdentity, setPrevIdentity] = useState(identity);
36
+
39
37
  const availableIdentities = identity ? [identity] : [];
40
38
 
41
39
  const reducer = (state: JoinState, action: JoinAction) => {
@@ -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.halo.acceptInvitation(
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: mode === 'halo-only' ? undefined : initialInvitationCode,
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,17 +136,6 @@ export const JoinPanel = ({
139
136
  haloViewState: 'invitation input'
140
137
  });
141
138
 
142
- if (identity !== prevIdentity) {
143
- setPrevIdentity(identity);
144
- identity && !prevIdentity && dispatch({ type: 'added identity', identity });
145
- }
146
-
147
- useEffect(() => {
148
- if (unredeemedHaloInvitationCode) {
149
- dispatch({ type: 'select addition method', method: 'accept device invitation' });
150
- }
151
- }, [unredeemedHaloInvitationCode]);
152
-
153
139
  useEffect(() => {
154
140
  // TODO (thure): Validate if this is sufficiently synchronous for iOS to move focus. It might not be!
155
141
  const attrValue =
@@ -160,7 +146,7 @@ export const JoinPanel = ({
160
146
  : joinState.activeView === 'halo invitation acceptor'
161
147
  ? `${joinState.activeView}; ${joinState.haloViewState}`
162
148
  : joinState.activeView;
163
- log('[autofocus value]', { attrValue });
149
+ log.debug('[autofocus value]', { attrValue });
164
150
  const $nextAutofocus: HTMLElement | null = document.querySelector(`[data-autofocus="${attrValue}"]`);
165
151
  if ($nextAutofocus) {
166
152
  $nextAutofocus.focus();
@@ -191,9 +177,7 @@ export const JoinPanel = ({
191
177
 
192
178
  return (
193
179
  <>
194
- <JoinHeading
195
- {...{ mode, titleId, invitation: joinState.spaceInvitation, onExit, exitActionParent, preventExit }}
196
- />
180
+ <JoinHeading {...{ titleId, invitation: joinState.spaceInvitation, onExit, exitActionParent }} />
197
181
  <div role='none' className='is-full overflow-hidden'>
198
182
  <div role='none' className='flex is-[1300%]' aria-live='polite'>
199
183
  <IdentitySelector
@@ -256,19 +240,14 @@ export const JoinPanel = ({
256
240
  active:
257
241
  joinState.activeView === 'halo invitation acceptor' &&
258
242
  joinState.haloViewState === 'invitation accepted',
259
- invitationType: 'halo',
260
- doneActionParent,
261
- onDone
243
+ invitationType: 'halo'
262
244
  }}
263
245
  />
264
246
  <IdentityAdded
265
247
  {...{
266
- mode,
267
248
  dispatch,
268
249
  addedIdentity: joinState.selectedIdentity,
269
- active: joinState.activeView === 'identity added',
270
- doneActionParent,
271
- onDone
250
+ active: joinState.activeView === 'identity added'
272
251
  }}
273
252
  />
274
253
  <InvitationInput
@@ -4,18 +4,22 @@
4
4
 
5
5
  import { cloneElement, Dispatch } from 'react';
6
6
 
7
- import type { AuthenticatingInvitationObservable, Profile } from '@dxos/client';
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 JoinPanelMode = 'default' | 'halo-only';
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, Check } from 'phosphor-react';
6
- import React, { cloneElement } from '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, DoneProps {
16
- mode?: JoinPanelMode;
13
+ export interface IdentityAddedProps extends ViewStateProps {
17
14
  addedIdentity?: Profile;
18
15
  }
19
16
 
20
- export interface DoneProps extends ViewStateProps {
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
- {mode === 'halo-only' ? (
74
- <Done onDone={onDone} doneActionParent={doneActionParent} {...viewStateProps} />
75
- ) : (
76
- <div className='flex gap-2'>
77
- <Button
78
- disabled={disabled || !addedIdentity}
79
- className='grow flex items-center gap-2 pli-2 order-2'
80
- onClick={() => addedIdentity && dispatch({ type: 'select identity', identity: addedIdentity })}
81
- data-autofocus='identity added'
82
- >
83
- <CaretLeft weight='bold' className={mx(getSize(2), 'invisible')} />
84
- <span className='grow'>{t('continue label')}</span>
85
- <CaretRight weight='bold' className={getSize(4)} />
86
- </Button>
87
- <Button
88
- disabled={disabled}
89
- onClick={() => dispatch({ type: 'deselect identity' })}
90
- className='flex items-center gap-2 pis-2 pie-4'
91
- >
92
- <CaretLeft weight='bold' className={getSize(4)} />
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('auth code input label')}
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' data-testid='next'>
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>
@@ -2,7 +2,5 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export * from './DevicesPanel';
6
5
  export * from './IdentityPanel';
7
6
  export * from './JoinPanel';
8
- export * from './SpacePanel';
@@ -2,6 +2,5 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export * from './dialogStyles';
6
5
  export * from './panelStyles';
7
6
  export * from './invitationStatusStyles';
@@ -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
- 'joining heading': '<small>Joining</small><large>{{name}}</large>',
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
- 'auth code input label': 'Auth code provided by the invitation sender',
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
  };