@dxos/react-ui 0.1.23 → 0.1.24

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 (147) hide show
  1. package/dist/lib/browser/index.mjs +1781 -57
  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/{IdentityListItem → IdentityList}/IdentityListItem.d.ts +0 -0
  5. package/dist/types/src/components/IdentityList/IdentityListItem.d.ts.map +1 -0
  6. package/dist/types/src/components/{IdentityListItem → IdentityList}/IdentityListItem.stories.d.ts +0 -0
  7. package/dist/types/src/components/IdentityList/IdentityListItem.stories.d.ts.map +1 -0
  8. package/dist/types/src/components/IdentityList/SpaceMemberList.d.ts +6 -0
  9. package/dist/types/src/components/IdentityList/SpaceMemberList.d.ts.map +1 -0
  10. package/dist/types/src/components/IdentityList/SpaceMemberListContainer.d.ts +7 -0
  11. package/dist/types/src/components/IdentityList/SpaceMemberListContainer.d.ts.map +1 -0
  12. package/dist/types/src/components/IdentityList/index.d.ts +4 -0
  13. package/dist/types/src/components/IdentityList/index.d.ts.map +1 -0
  14. package/dist/types/src/components/InvitationList/InvitationList.d.ts +7 -0
  15. package/dist/types/src/components/InvitationList/InvitationList.d.ts.map +1 -0
  16. package/dist/types/src/components/InvitationList/InvitationList.stories.d.ts +10 -0
  17. package/dist/types/src/components/InvitationList/InvitationList.stories.d.ts.map +1 -0
  18. package/dist/types/src/components/InvitationList/InvitationListContainer.d.ts +7 -0
  19. package/dist/types/src/components/InvitationList/InvitationListContainer.d.ts.map +1 -0
  20. package/dist/types/src/components/InvitationList/InvitationListItem.d.ts +9 -0
  21. package/dist/types/src/components/InvitationList/InvitationListItem.d.ts.map +1 -0
  22. package/dist/types/src/components/InvitationList/InvitationListProps.d.ts +4 -0
  23. package/dist/types/src/components/InvitationList/InvitationListProps.d.ts.map +1 -0
  24. package/dist/types/src/components/InvitationList/InvitationStatusAvatar.d.ts +9 -0
  25. package/dist/types/src/components/InvitationList/InvitationStatusAvatar.d.ts.map +1 -0
  26. package/dist/types/src/components/InvitationList/InvitationStatusAvatar.stories.d.ts +9 -0
  27. package/dist/types/src/components/InvitationList/InvitationStatusAvatar.stories.d.ts.map +1 -0
  28. package/dist/types/src/components/InvitationList/index.d.ts +5 -0
  29. package/dist/types/src/components/InvitationList/index.d.ts.map +1 -0
  30. package/dist/types/src/components/PanelSeparator/PanelSeparator.d.ts +3 -0
  31. package/dist/types/src/components/PanelSeparator/PanelSeparator.d.ts.map +1 -0
  32. package/dist/types/src/components/PanelSeparator/index.d.ts +2 -0
  33. package/dist/types/src/components/PanelSeparator/index.d.ts.map +1 -0
  34. package/dist/types/src/components/index.d.ts +4 -0
  35. package/dist/types/src/components/index.d.ts.map +1 -0
  36. package/dist/types/src/composites/JoinDialog/JoinDialog.d.ts +6 -0
  37. package/dist/types/src/composites/JoinDialog/JoinDialog.d.ts.map +1 -0
  38. package/dist/types/src/composites/JoinDialog/JoinDialog.stories.d.ts +10 -0
  39. package/dist/types/src/composites/JoinDialog/JoinDialog.stories.d.ts.map +1 -0
  40. package/dist/types/src/composites/JoinDialog/index.d.ts +2 -0
  41. package/dist/types/src/composites/JoinDialog/index.d.ts.map +1 -0
  42. package/dist/types/src/composites/index.d.ts +1 -0
  43. package/dist/types/src/composites/index.d.ts.map +1 -1
  44. package/dist/types/src/index.d.ts +1 -0
  45. package/dist/types/src/index.d.ts.map +1 -1
  46. package/dist/types/src/layouts/PanelAlertDialog/PanelAlertDialog.d.ts +14 -0
  47. package/dist/types/src/layouts/PanelAlertDialog/PanelAlertDialog.d.ts.map +1 -0
  48. package/dist/types/src/layouts/PanelAlertDialog/index.d.ts +2 -0
  49. package/dist/types/src/layouts/PanelAlertDialog/index.d.ts.map +1 -0
  50. package/dist/types/src/layouts/PanelSidebar/PanelSidebar.d.ts +2 -3
  51. package/dist/types/src/layouts/PanelSidebar/PanelSidebar.d.ts.map +1 -1
  52. package/dist/types/src/layouts/index.d.ts +1 -0
  53. package/dist/types/src/layouts/index.d.ts.map +1 -1
  54. package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts +10 -0
  55. package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts.map +1 -0
  56. package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts +3 -0
  57. package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts.map +1 -0
  58. package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts +53 -0
  59. package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts.map +1 -0
  60. package/dist/types/src/panels/JoinPanel/index.d.ts +3 -0
  61. package/dist/types/src/panels/JoinPanel/index.d.ts.map +1 -0
  62. package/dist/types/src/panels/JoinPanel/view-states/AdditionMethodSelector.d.ts +7 -0
  63. package/dist/types/src/panels/JoinPanel/view-states/AdditionMethodSelector.d.ts.map +1 -0
  64. package/dist/types/src/panels/JoinPanel/view-states/IdentityAdded.d.ts +7 -0
  65. package/dist/types/src/panels/JoinPanel/view-states/IdentityAdded.d.ts.map +1 -0
  66. package/dist/types/src/panels/JoinPanel/view-states/IdentityInput.d.ts +6 -0
  67. package/dist/types/src/panels/JoinPanel/view-states/IdentityInput.d.ts.map +1 -0
  68. package/dist/types/src/panels/JoinPanel/view-states/IdentitySelector.d.ts +7 -0
  69. package/dist/types/src/panels/JoinPanel/view-states/IdentitySelector.d.ts.map +1 -0
  70. package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts +10 -0
  71. package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts.map +1 -0
  72. package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts +7 -0
  73. package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts.map +1 -0
  74. package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts +6 -0
  75. package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts.map +1 -0
  76. package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts +6 -0
  77. package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts.map +1 -0
  78. package/dist/types/src/panels/JoinPanel/view-states/ViewState.d.ts +12 -0
  79. package/dist/types/src/panels/JoinPanel/view-states/ViewState.d.ts.map +1 -0
  80. package/dist/types/src/panels/JoinPanel/view-states/index.d.ts +9 -0
  81. package/dist/types/src/panels/JoinPanel/view-states/index.d.ts.map +1 -0
  82. package/dist/types/src/panels/index.d.ts +1 -0
  83. package/dist/types/src/panels/index.d.ts.map +1 -1
  84. package/dist/types/src/styles/index.d.ts +1 -0
  85. package/dist/types/src/styles/index.d.ts.map +1 -1
  86. package/dist/types/src/styles/invitationStatusStyles.d.ts +20 -0
  87. package/dist/types/src/styles/invitationStatusStyles.d.ts.map +1 -0
  88. package/dist/types/src/styles/panelStyles.d.ts +2 -1
  89. package/dist/types/src/styles/panelStyles.d.ts.map +1 -1
  90. package/dist/types/src/translations/locales/en-US.d.ts +41 -0
  91. package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
  92. package/dist/types/src/util/index.d.ts +2 -0
  93. package/dist/types/src/util/index.d.ts.map +1 -0
  94. package/dist/types/src/util/invitationStatusValue.d.ts +8 -0
  95. package/dist/types/src/util/invitationStatusValue.d.ts.map +1 -0
  96. package/package.json +18 -11
  97. package/src/components/{IdentityListItem → IdentityList}/IdentityListItem.stories.tsx +0 -0
  98. package/src/components/{IdentityListItem → IdentityList}/IdentityListItem.tsx +4 -3
  99. package/src/components/IdentityList/SpaceMemberList.tsx +31 -0
  100. package/src/components/IdentityList/SpaceMemberListContainer.tsx +27 -0
  101. package/src/components/IdentityList/index.ts +7 -0
  102. package/src/components/InvitationList/InvitationList.stories.tsx +65 -0
  103. package/src/components/InvitationList/InvitationList.tsx +24 -0
  104. package/src/components/InvitationList/InvitationListContainer.tsx +27 -0
  105. package/src/components/InvitationList/InvitationListItem.tsx +95 -0
  106. package/src/components/InvitationList/InvitationListProps.ts +7 -0
  107. package/src/components/InvitationList/InvitationStatusAvatar.stories.tsx +52 -0
  108. package/src/components/InvitationList/InvitationStatusAvatar.tsx +75 -0
  109. package/src/components/InvitationList/index.ts +8 -0
  110. package/src/components/PanelSeparator/PanelSeparator.tsx +17 -0
  111. package/src/components/PanelSeparator/index.ts +5 -0
  112. package/src/components/index.ts +7 -0
  113. package/src/composites/JoinDialog/JoinDialog.stories.tsx +80 -0
  114. package/src/composites/JoinDialog/JoinDialog.tsx +31 -0
  115. package/src/composites/JoinDialog/index.ts +5 -0
  116. package/src/composites/index.ts +1 -0
  117. package/src/index.ts +1 -0
  118. package/src/layouts/PanelAlertDialog/PanelAlertDialog.tsx +44 -0
  119. package/src/layouts/PanelAlertDialog/index.ts +5 -0
  120. package/src/layouts/PanelPopover/PanelPopover.tsx +2 -2
  121. package/src/layouts/PanelSidebar/PanelSidebar.tsx +17 -25
  122. package/src/layouts/index.ts +1 -0
  123. package/src/panels/JoinPanel/JoinHeading.tsx +57 -0
  124. package/src/panels/JoinPanel/JoinPanel.tsx +303 -0
  125. package/src/panels/JoinPanel/JoinPanelProps.ts +94 -0
  126. package/src/panels/JoinPanel/index.ts +6 -0
  127. package/src/panels/JoinPanel/view-states/AdditionMethodSelector.tsx +69 -0
  128. package/src/panels/JoinPanel/view-states/IdentityAdded.tsx +60 -0
  129. package/src/panels/JoinPanel/view-states/IdentityInput.tsx +72 -0
  130. package/src/panels/JoinPanel/view-states/IdentitySelector.tsx +98 -0
  131. package/src/panels/JoinPanel/view-states/InvitationAccepted.tsx +69 -0
  132. package/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx +139 -0
  133. package/src/panels/JoinPanel/view-states/InvitationInput.tsx +68 -0
  134. package/src/panels/JoinPanel/view-states/InvitationRescuer.tsx +95 -0
  135. package/src/panels/JoinPanel/view-states/ViewState.tsx +204 -0
  136. package/src/panels/JoinPanel/view-states/index.ts +12 -0
  137. package/src/panels/index.ts +1 -0
  138. package/src/styles/index.ts +1 -0
  139. package/src/styles/invitationStatusStyles.ts +42 -0
  140. package/src/styles/panelStyles.ts +2 -1
  141. package/src/testing/ClientProvider.tsx +1 -1
  142. package/src/translations/locales/en-US.ts +42 -1
  143. package/src/util/index.ts +5 -0
  144. package/src/util/invitationStatusValue.ts +21 -0
  145. package/theme-extensions.js +11 -0
  146. package/dist/types/src/components/IdentityListItem/IdentityListItem.d.ts.map +0 -1
  147. package/dist/types/src/components/IdentityListItem/IdentityListItem.stories.d.ts.map +0 -1
@@ -0,0 +1,95 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { ArrowsClockwise, CaretLeft, CaretRight } from 'phosphor-react';
6
+ import React from 'react';
7
+
8
+ import { AuthenticatingInvitationObservable, Invitation } from '@dxos/client';
9
+ import { useInvitationStatus } from '@dxos/react-client';
10
+ import { Button, getSize, mx, useTranslation } from '@dxos/react-components';
11
+
12
+ import { ViewState, ViewStateProps } from './ViewState';
13
+
14
+ export interface InvitationConnectorProps extends ViewStateProps {
15
+ invitationType: 'space' | 'halo';
16
+ }
17
+
18
+ const InvitationActions = ({
19
+ activeInvitation,
20
+ disabled,
21
+ dispatch,
22
+ invitationType
23
+ }: {
24
+ activeInvitation: AuthenticatingInvitationObservable;
25
+ disabled?: boolean;
26
+ dispatch: ViewStateProps['dispatch'];
27
+ invitationType: InvitationConnectorProps['invitationType'];
28
+ }) => {
29
+ const { status, cancel } = useInvitationStatus(activeInvitation);
30
+ const { t } = useTranslation('os');
31
+
32
+ switch (status) {
33
+ case Invitation.State.CONNECTING:
34
+ return (
35
+ <>
36
+ <div role='none' className='grow' />
37
+ <div className='flex gap-2'>
38
+ <Button disabled className='grow flex items-center gap-2 pli-2 order-2'>
39
+ <CaretLeft weight='bold' className={mx(getSize(2), 'invisible')} />
40
+ <span className='grow'>{t('next label')}</span>
41
+ <CaretRight weight='bold' className={getSize(4)} />
42
+ </Button>
43
+ <Button
44
+ disabled={disabled}
45
+ className='flex items-center gap-2 pis-2 pie-4'
46
+ onClick={cancel}
47
+ data-autofocus={`${invitationType} invitation acceptor; invitation rescuer`}
48
+ >
49
+ <CaretLeft weight='bold' className={getSize(4)} />
50
+ <span>{t('cancel label')}</span>
51
+ </Button>
52
+ </div>
53
+ </>
54
+ );
55
+ case Invitation.State.TIMEOUT:
56
+ case Invitation.State.CANCELLED:
57
+ case Invitation.State.ERROR:
58
+ default:
59
+ return (
60
+ <Button
61
+ disabled={disabled}
62
+ className='grow flex items-center gap-2 pli-2'
63
+ onClick={() => dispatch({ type: 'reset invitation', from: invitationType })}
64
+ data-autofocus={`${invitationType} invitation acceptor; invitation rescuer`}
65
+ >
66
+ <CaretLeft weight='bold' className={mx(getSize(5), 'invisible')} />
67
+ <span className='grow'>{t('reset label')}</span>
68
+ <ArrowsClockwise weight='bold' className={getSize(5)} />
69
+ </Button>
70
+ );
71
+ }
72
+ };
73
+
74
+ export const InvitationRescuer = ({ invitationType, ...viewStateProps }: InvitationConnectorProps) => {
75
+ const disabled = !viewStateProps.active;
76
+ const { dispatch, activeInvitation } = viewStateProps;
77
+ const { t } = useTranslation('os');
78
+ return (
79
+ <ViewState {...viewStateProps}>
80
+ {activeInvitation === true || !activeInvitation ? (
81
+ <Button
82
+ disabled={disabled}
83
+ className='grow flex items-center gap-2 pli-2'
84
+ data-autofocus='space invitation acceptor; invitation rescuer'
85
+ >
86
+ <CaretLeft weight='bold' className={mx(getSize(5), 'invisible')} />
87
+ <span className='grow'>{t('connect label')}</span>
88
+ <ArrowsClockwise weight='bold' className={getSize(5)} />
89
+ </Button>
90
+ ) : (
91
+ <InvitationActions {...{ activeInvitation, disabled, dispatch, invitationType }} />
92
+ )}
93
+ </ViewState>
94
+ );
95
+ };
@@ -0,0 +1,204 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { CheckCircle, HourglassSimple, X } from 'phosphor-react';
6
+ import React, { ComponentProps, ComponentPropsWithoutRef, ReactNode, useMemo } from 'react';
7
+
8
+ import type { AuthenticatingInvitationObservable, Profile } from '@dxos/client';
9
+ import { Invitation } from '@dxos/client';
10
+ import { useInvitationStatus } from '@dxos/react-client';
11
+ import { mx, useTranslation, Trans, Avatar, useId, getSize, strongShimmer } from '@dxos/react-components';
12
+
13
+ import { defaultSurface, subduedSurface, resolvedBgColor, activeBgColor, inactiveBgColor } from '../../../styles';
14
+ import { invitationStatusValue } from '../../../util';
15
+ import { JoinDispatch } from '../JoinPanelProps';
16
+
17
+ export interface ViewStateProps extends ComponentProps<'div'> {
18
+ active: boolean;
19
+ dispatch: JoinDispatch;
20
+ selectedIdentity?: true | Profile;
21
+ activeInvitation?: true | AuthenticatingInvitationObservable;
22
+ }
23
+
24
+ const stripe = mx('rounded-full grow', getSize(3));
25
+
26
+ export const ViewStateHeading = ({ children, className, ...props }: ComponentPropsWithoutRef<'h2'>) => {
27
+ return (
28
+ <h2 {...props} className={mx('font-system-medium text-sm md:text-base mbe-1 mli-1 text-center', className)}>
29
+ {children}
30
+ </h2>
31
+ );
32
+ };
33
+
34
+ const PureViewStateInvitation = ({
35
+ halted,
36
+ cursor,
37
+ label,
38
+ resolvedColor
39
+ }: {
40
+ halted?: boolean;
41
+ cursor: number;
42
+ label: ReactNode;
43
+ resolvedColor: string;
44
+ }) => {
45
+ const labelId = useId('invitationState');
46
+ return (
47
+ <div role='none' className={mx(defaultSurface, 'pli-2 pbs-2')}>
48
+ <div role='status' aria-labelledby={labelId} className='flex gap-2 items-center mlb-1'>
49
+ <div
50
+ role='none'
51
+ className={mx(
52
+ stripe,
53
+ !halted && cursor === 1 && strongShimmer,
54
+ cursor === 2 ? (halted ? resolvedColor : activeBgColor) : cursor > 1 ? resolvedColor : inactiveBgColor
55
+ )}
56
+ />
57
+ <div
58
+ role='none'
59
+ className={mx(
60
+ stripe,
61
+ !halted && cursor === 3 && strongShimmer,
62
+ cursor === 3 ? (halted ? resolvedColor : activeBgColor) : cursor > 3 ? resolvedColor : inactiveBgColor
63
+ )}
64
+ />
65
+ <div
66
+ role='none'
67
+ className={mx(stripe, cursor > 3 ? (halted ? resolvedColor : resolvedColor) : inactiveBgColor)}
68
+ />
69
+ </div>
70
+ <ViewStateHeading id={labelId} className='mbs-2 flex justify-center items-center gap-2'>
71
+ {label}
72
+ </ViewStateHeading>
73
+ </div>
74
+ );
75
+ };
76
+
77
+ const ViewStateInvitationStatus = ({ activeInvitation }: { activeInvitation: AuthenticatingInvitationObservable }) => {
78
+ const { t } = useTranslation('os');
79
+ const { status, haltedAt } = useInvitationStatus(activeInvitation);
80
+
81
+ const halted =
82
+ status === Invitation.State.CANCELLED || status === Invitation.State.TIMEOUT || status === Invitation.State.ERROR;
83
+
84
+ const cursor = invitationStatusValue.get(halted ? haltedAt! : status)!;
85
+
86
+ const resolvedColor = resolvedBgColor(status);
87
+
88
+ const statusLabelMap = useMemo(
89
+ () =>
90
+ new Map<Invitation.State, ReactNode>([
91
+ [
92
+ Invitation.State.ERROR,
93
+ <>
94
+ <X weight='bold' className={mx(getSize(4), 'text-error-600 dark:text-error-400')} />
95
+ <span>{t('error status label')}</span>
96
+ </>
97
+ ],
98
+ [
99
+ Invitation.State.TIMEOUT,
100
+ <>
101
+ <HourglassSimple weight='fill' className={mx(getSize(4), 'text-warning-600 dark:text-warning-400')} />
102
+ <span>{t('timeout status label')}</span>
103
+ </>
104
+ ],
105
+ [
106
+ Invitation.State.CANCELLED,
107
+ <>
108
+ <X weight='bold' className={mx(getSize(4), 'text-warning-600 dark:text-warning-400')} />
109
+ <span>{t('cancelled status label')}</span>
110
+ </>
111
+ ],
112
+ [Invitation.State.INIT, t('init status label')],
113
+ [Invitation.State.CONNECTING, t('connecting status label')],
114
+ [Invitation.State.CONNECTED, t('connected status label')],
115
+ [Invitation.State.AUTHENTICATING, t('authenticating status label')],
116
+ [
117
+ Invitation.State.SUCCESS,
118
+ <>
119
+ <CheckCircle weight='fill' className={mx(getSize(4), 'text-success-600 dark:text-success-400')} />
120
+ <span>{t('success status label')}</span>
121
+ </>
122
+ ]
123
+ ]),
124
+ [t]
125
+ );
126
+
127
+ return (
128
+ <PureViewStateInvitation
129
+ {...{
130
+ label: statusLabelMap.get(status)!,
131
+ resolvedColor,
132
+ cursor,
133
+ halted
134
+ }}
135
+ />
136
+ );
137
+ };
138
+
139
+ export const ViewState = ({
140
+ active,
141
+ children,
142
+ className,
143
+ dispatch,
144
+ selectedIdentity,
145
+ activeInvitation,
146
+ ...props
147
+ }: ViewStateProps) => {
148
+ // note (thure): reserve `order-1` and `order-3` for outgoing steps in different directions
149
+ const { t } = useTranslation('os');
150
+ const identityLabel = useId('selectedIdentityLabel');
151
+
152
+ return (
153
+ <div
154
+ role='none'
155
+ {...props}
156
+ {...(!active && { 'aria-hidden': true })}
157
+ className={mx('is-[50%] flex flex-col', active ? 'order-2' : 'order-4', className)}
158
+ >
159
+ {selectedIdentity && (
160
+ <div role='none' className={mx(subduedSurface, 'flex-none flex items-center gap-1 pli-2 pbe-1.5')}>
161
+ <Trans
162
+ {...{
163
+ defaults: t('join space as identity heading'),
164
+ components: {
165
+ icon: (
166
+ <Avatar
167
+ size={4}
168
+ fallbackValue={selectedIdentity === true ? '' : selectedIdentity.identityKey.toHex()}
169
+ labelId={identityLabel}
170
+ />
171
+ ),
172
+ label: <span id={identityLabel} />,
173
+ part: <span role='none' className='flex items-center gap-1 leading-none' />
174
+ },
175
+ values: {
176
+ labelValue:
177
+ selectedIdentity === true
178
+ ? ' '
179
+ : selectedIdentity.displayName ?? selectedIdentity.identityKey.truncate()
180
+ }
181
+ }}
182
+ />
183
+ </div>
184
+ )}
185
+ {activeInvitation &&
186
+ (activeInvitation === true ? (
187
+ <PureViewStateInvitation
188
+ {...{
189
+ halted: false,
190
+ status: Invitation.State.INIT,
191
+ label: t('invitation input label'),
192
+ cursor: 0,
193
+ resolvedColor: inactiveBgColor
194
+ }}
195
+ />
196
+ ) : (
197
+ <ViewStateInvitationStatus {...{ activeInvitation }} />
198
+ ))}
199
+ <div role='region' className={mx(defaultSurface, 'rounded-be-md grow shrink-0 flex flex-col gap-1 p-2')}>
200
+ {children}
201
+ </div>
202
+ </div>
203
+ );
204
+ };
@@ -0,0 +1,12 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export * from './AdditionMethodSelector';
6
+ export * from './IdentityAdded';
7
+ export * from './IdentitySelector';
8
+ export * from './IdentityInput';
9
+ export * from './InvitationAccepted';
10
+ export * from './InvitationInput';
11
+ export * from './InvitationRescuer';
12
+ export * from './InvitationAuthenticator';
@@ -3,3 +3,4 @@
3
3
  //
4
4
 
5
5
  export * from './IdentityPanel';
6
+ export * from './JoinPanel';
@@ -3,3 +3,4 @@
3
3
  //
4
4
 
5
5
  export * from './panelStyles';
6
+ export * from './invitationStatusStyles';
@@ -0,0 +1,42 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { Invitation } from '@dxos/client';
6
+
7
+ export const inactiveBgColor = 'bg-neutral-100 dark:bg-neutral-600';
8
+ export const activeBgColor = 'bg-primary-500 dark:bg-primary-400';
9
+ export const successBgColor = 'bg-success-500 dark:bg-success-400';
10
+ export const errorBgColor = 'bg-error-500 dark:bg-error-400';
11
+ export const cancelledBgColor = 'bg-warning-500 dark:bg-warning-400';
12
+
13
+ export const inactiveTextColor = 'text-neutral-100 dark:text-neutral-600';
14
+ export const activeTextColor = 'text-primary-400 dark:text-primary-500';
15
+ export const successTextColor = 'text-success-400 dark:text-success-500';
16
+ export const errorTextColor = 'text-error-400 dark:text-error-500';
17
+ export const cancelledTextColor = 'text-warning-400 dark:text-warning-500';
18
+
19
+ export const inactiveStrokeColor = 'stroke-neutral-100 dark:stroke-neutral-700';
20
+ export const activeStrokeColor = 'stroke-primary-500 dark:stroke-primary-150';
21
+ export const successStrokeColor = 'stroke-success-400 dark:stroke-primary-400';
22
+ export const errorStrokeColor = 'stroke-error-400 dark:stroke-error-500';
23
+ export const cancelledStrokeColor = 'stroke-warning-400 dark:stroke-warning-500';
24
+
25
+ export const resolvedStrokeColor = (status: Invitation.State) =>
26
+ status === Invitation.State.ERROR
27
+ ? errorStrokeColor
28
+ : status === Invitation.State.CANCELLED || status === Invitation.State.TIMEOUT
29
+ ? cancelledStrokeColor
30
+ : successStrokeColor;
31
+ export const resolvedBgColor = (status: Invitation.State) =>
32
+ status === Invitation.State.ERROR
33
+ ? errorBgColor
34
+ : status === Invitation.State.CANCELLED || status === Invitation.State.TIMEOUT
35
+ ? cancelledBgColor
36
+ : successBgColor;
37
+ export const resolvedTextColor = (status: Invitation.State) =>
38
+ status === Invitation.State.ERROR
39
+ ? errorTextColor
40
+ : status === Invitation.State.CANCELLED || status === Invitation.State.TIMEOUT
41
+ ? cancelledTextColor
42
+ : successTextColor;
@@ -2,5 +2,6 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export const defaultPanel = 'p-2 backdrop-blur-md bg-neutral-50/[.66] dark:bg-neutral-950/[.66]';
5
+ export const defaultSurface = 'bg-neutral-50/[.72] dark:bg-neutral-950/[.72]';
6
+ export const subduedSurface = 'bg-neutral-100/[.66] dark:bg-neutral-900/[.66]';
6
7
  export const defaultArrow = 'text-neutral-50/[.66] dark:text-neutral-950/[.66]';
@@ -11,7 +11,7 @@ const configProvider = async () => new Config(await Dynamics(), Defaults());
11
11
 
12
12
  export const ClientProvider = ({ children }: PropsWithChildren<{}>) => {
13
13
  return (
14
- <NaturalClientProvider config={configProvider} fallback={<span>Starting client…</span>}>
14
+ <NaturalClientProvider config={configProvider} fallback={() => <span>Starting client…</span>}>
15
15
  {children}
16
16
  </NaturalClientProvider>
17
17
  );
@@ -5,5 +5,46 @@
5
5
  export const os = {
6
6
  'manage profile label': 'Manage identity',
7
7
  'identity offline description': 'Offline',
8
- 'sidebar label': 'DXOS sidebar'
8
+ 'sidebar label': 'DXOS sidebar',
9
+ 'copy invitation code label': 'Copy',
10
+ 'open share panel label': 'Share',
11
+ 'join space heading': '<small>Joining</small><large>{{spaceTitle}}</large>',
12
+ 'exit label': 'Exit',
13
+ 'identity selector title': 'Join as',
14
+ 'identity radio group title': 'Select an identity you’ve associated with this device already',
15
+ 'add identity label': 'Add',
16
+ 'continue label': 'Continue',
17
+ 'back label': 'Back',
18
+ 'next label': 'Next',
19
+ 'auth choices label': 'Choose an identity',
20
+ 'create identity label': 'Create an identity',
21
+ 'create identity description': 'Create a new identity.',
22
+ 'recover identity label': 'Use a seed phrase',
23
+ 'recover identity description': 'Enter your seed phrase to log in manually.',
24
+ 'join identity label': 'Use an authed device',
25
+ 'join identity description': 'Add this device to an identity you’re already logged into on another device.',
26
+ 'deselect identity label': 'Back to identities',
27
+ 'addition method selector title': 'Add an identity to this device',
28
+ 'new identity input label': 'Add a display name',
29
+ 'recover identity input label': 'Type or paste your seed phrase',
30
+ 'failed to create identity message': 'Failed to create an identity.',
31
+ 'failed to recover identity message': 'Failed to recover an identity from the provided seed phrase.',
32
+ 'failed to authenticate message': 'Incorrect PIN.',
33
+ 'identity added label': 'Created identity & added to this device:',
34
+ 'join space as identity heading': '<part>as </part><part><icon/><label>{{labelValue}}</label></part>',
35
+ 'error status label': 'Failed',
36
+ 'timeout status label': 'Timed out',
37
+ 'cancelled status label': 'Cancelled',
38
+ 'init status label': 'Ready to connect',
39
+ 'connecting status label': 'Connecting…',
40
+ 'connected status label': 'Enter confirmation PIN',
41
+ 'authenticating status label': 'Enter confirmation PIN',
42
+ 'success status label': 'Success',
43
+ 'connect label': 'Connect',
44
+ 'reconnect label': 'Reconnect',
45
+ 'cancel label': 'Cancel',
46
+ 'done label': 'Done',
47
+ 'reset label': 'Start over',
48
+ 'pin input label': 'The PIN provided by the invitation sender',
49
+ 'invitation input label': 'Paste an invitation code or URL'
9
50
  };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export * from './invitationStatusValue';
@@ -0,0 +1,21 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { Invitation } from '@dxos/client';
6
+
7
+ /**
8
+ * This map assigns a numeric value to invitation states to facilitate
9
+ * more terse code which uses combinations of `>`, `<`, and `=` instead of
10
+ * longer sequences of `===` and `||` predicates.
11
+ */
12
+ export const invitationStatusValue = new Map<Invitation.State, number>([
13
+ [Invitation.State.ERROR, -3],
14
+ [Invitation.State.TIMEOUT, -2],
15
+ [Invitation.State.CANCELLED, -1],
16
+ [Invitation.State.INIT, 0],
17
+ [Invitation.State.CONNECTING, 1],
18
+ [Invitation.State.CONNECTED, 2],
19
+ [Invitation.State.AUTHENTICATING, 3],
20
+ [Invitation.State.SUCCESS, 4]
21
+ ]);
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ module.exports = {
6
+ osThemeExtension: {
7
+ spacing: {
8
+ sidebar: '272px'
9
+ }
10
+ }
11
+ };
@@ -1 +0,0 @@
1
- {"version":3,"file":"IdentityListItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/IdentityListItem/IdentityListItem.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGpD,eAAO,MAAM,gBAAgB;cAAwC,OAAO;;iBAuB3E,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IdentityListItem.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/IdentityListItem/IdentityListItem.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;;;;;;;AAIpB,wBAEE;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;CAUnB,CAAC"}